1System.register(['axios', 'vue', '@Obsidian/Libs/sse', '@Obsidian/Libs/pluralize', 'luxon', '@Obsidian/Enums/Controls/dayOfWeek', 'mitt', '@Obsidian/Enums/Cms/blockRole', '@Obsidian/Libs/chart', '@Obsidian/Enums/Controls/controlLazyMode', '@Obsidian/Enums/Controls/pickerDisplayStyle', '@Obsidian/Libs/liquidjs', '@Obsidian/Libs/big', '@Obsidian/Enums/Controls/slidingDateRangeType', '@Obsidian/Enums/Controls/timeUnitType', '@Obsidian/Enums/Controls/mergeTemplateOwnership'], (function (exports, module) { 2 'use strict'; 3 var axios, provide, getCurrentInstance, inject, ref, watch, nextTick, defineAsyncComponent$1, reactive, createVNode, render, markRaw, onMounted, onUnmounted, EventSourceStream, Pluralize, FixedOffsetZone, DateTime, DayOfWeek, mitt, BlockRoleDescription, BarElement, ControlLazyMode, PickerDisplayStyle, Liquid, Big, SlidingDateRangeType, TimeUnitType, MergeTemplateOwnership; 4 return { 5 setters: [function (module) { 6 axios = module.default; 7 }, function (module) { 8 provide = module.provide; 9 getCurrentInstance = module.getCurrentInstance; 10 inject = module.inject; 11 ref = module.ref; 12 watch = module.watch; 13 nextTick = module.nextTick; 14 defineAsyncComponent$1 = module.defineAsyncComponent; 15 reactive = module.reactive; 16 createVNode = module.createVNode; 17 render = module.render; 18 markRaw = module.markRaw; 19 onMounted = module.onMounted; 20 onUnmounted = module.onUnmounted; 21 }, function (module) { 22 EventSourceStream = module.EventSourceStream; 23 }, function (module) { 24 Pluralize = module.Pluralize; 25 }, function (module) { 26 FixedOffsetZone = module.FixedOffsetZone; 27 DateTime = module.DateTime; 28 }, function (module) { 29 DayOfWeek = module.DayOfWeek; 30 }, function (module) { 31 mitt = module.default; 32 }, function (module) { 33 BlockRoleDescription = module.BlockRoleDescription; 34 }, function (module) { 35 BarElement = module.BarElement; 36 }, function (module) { 37 ControlLazyMode = module.ControlLazyMode; 38 }, function (module) { 39 PickerDisplayStyle = module.PickerDisplayStyle; 40 }, function (module) { 41 Liquid = module.Liquid; 42 }, function (module) { 43 Big = module.default; 44 }, function (module) { 45 SlidingDateRangeType = module.SlidingDateRangeType; 46 }, function (module) { 47 TimeUnitType = module.TimeUnitType; 48 }, function (module) { 49 MergeTemplateOwnership = module.MergeTemplateOwnership; 50 }], 51 execute: (function () { 52 53 function _arrayLikeToArray(r, a) { 54 (null == a || a > r.length) && (a = r.length); 55 for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; 56 return n; 57 } 58 function _arrayWithHoles(r) { 59 if (Array.isArray(r)) return r; 60 } 61 function asyncGeneratorStep(n, t, e, r, o, a, c) { 62 try { 63 var i = n[a](c), 64 u = i.value; 65 } catch (n) { 66 return void e(n); 67 } 68 i.done ? t(u) : Promise.resolve(u).then(r, o); 69 } 70 function _asyncToGenerator(n) { 71 return function () { 72 var t = this, 73 e = arguments; 74 return new Promise(function (r, o) { 75 var a = n.apply(t, e); 76 function _next(n) { 77 asyncGeneratorStep(a, r, o, _next, _throw, "next", n); 78 } 79 function _throw(n) { 80 asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); 81 } 82 _next(void 0); 83 }); 84 }; 85 } 86 function _createForOfIteratorHelper(r, e) { 87 var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 88 if (!t) { 89 if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { 90 t && (r = t); 91 var n = 0, 92 F = function () {}; 93 return { 94 s: F, 95 n: function () { 96 return n >= r.length ? { 97 done: !0 98 } : { 99 done: !1, 100 value: r[n++] 101 }; 102 }, 103 e: function (r) { 104 throw r; 105 }, 106 f: F 107 }; 108 } 109 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 110 } 111 var o, 112 a = !0, 113 u = !1; 114 return { 115 s: function () { 116 t = t.call(r); 117 }, 118 n: function () { 119 var r = t.next(); 120 return a = r.done, r; 121 }, 122 e: function (r) { 123 u = !0, o = r; 124 }, 125 f: function () { 126 try { 127 a || null == t.return || t.return(); 128 } finally { 129 if (u) throw o; 130 } 131 } 132 }; 133 } 134 function _defineProperty(e, r, t) { 135 return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { 136 value: t, 137 enumerable: !0, 138 configurable: !0, 139 writable: !0 140 }) : e[r] = t, e; 141 } 142 function _iterableToArrayLimit(r, l) { 143 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 144 if (null != t) { 145 var e, 146 n, 147 i, 148 u, 149 a = [], 150 f = !0, 151 o = !1; 152 try { 153 if (i = (t = t.call(r)).next, 0 === l) { 154 if (Object(t) !== t) return; 155 f = !1; 156 } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); 157 } catch (r) { 158 o = !0, n = r; 159 } finally { 160 try { 161 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; 162 } finally { 163 if (o) throw n; 164 } 165 } 166 return a; 167 } 168 } 169 function _nonIterableRest() {
170 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 171 } 172 function ownKeys(e, r) { 173 var t = Object.keys(e); 174 if (Object.getOwnPropertySymbols) { 175 var o = Object.getOwnPropertySymbols(e); 176 r && (o = o.filter(function (r) { 177 return Object.getOwnPropertyDescriptor(e, r).enumerable; 178 })), t.push.apply(t, o); 179 } 180 return t; 181 } 182 function _objectSpread2(e) { 183 for (var r = 1; r < arguments.length; r++) { 184 var t = null != arguments[r] ? arguments[r] : {}; 185 r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { 186 _defineProperty(e, r, t[r]); 187 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { 188 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); 189 }); 190 } 191 return e; 192 } 193 function _slicedToArray(r, e) { 194 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); 195 } 196 function _toPrimitive(t, r) { 197 if ("object" != typeof t || !t) return t; 198 var e = t[Symbol.toPrimitive]; 199 if (void 0 !== e) { 200 var i = e.call(t, r || "default"); 201 if ("object" != typeof i) return i; 202 throw new TypeError("@@toPrimitive must return a primitive value."); 203 } 204 return ("string" === r ? String : Number)(t); 205 } 206 function _toPropertyKey(t) { 207 var i = _toPrimitive(t, "string"); 208 return "symbol" == typeof i ? i : i + ""; 209 } 210 function _unsupportedIterableToArray(r, a) { 211 if (r) { 212 if ("string" == typeof r) return _arrayLikeToArray(r, a); 213 var t = {}.toString.call(r).slice(8, -1); 214 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 215 } 216 } 217 218 function doApiCallRaw(_x, _x2, _x3, _x4, _x5, _x6) { 219 return _doApiCallRaw.apply(this, arguments); 220 } 221 function _doApiCallRaw() { 222 _doApiCallRaw = _asyncToGenerator(function* (method, url, params, data, options, cancellationToken) { 223 return yield axios({ 224 method, 225 url, 226 params, 227 data, 228 headers: options === null || options === void 0 ? void 0 : options.headers, 229 signal: getSignal(cancellationToken) 230 }); 231 }); 232 return _doApiCallRaw.apply(this, arguments); 233 } 234 function doStreamingApiCallRaw(_x7, _x8, _x9, _x0, _x1, _x10) { 235 return _doStreamingApiCallRaw.apply(this, arguments); 236 } 237 function _doStreamingApiCallRaw() { 238 _doStreamingApiCallRaw = _asyncToGenerator(function* (method, url, params, data, options, cancellationToken) { 239 return yield axios({ 240 method, 241 url, 242 params, 243 data, 244 signal: getSignal(cancellationToken), 245 headers: _objectSpread2(_objectSpread2({}, options === null || options === void 0 ? void 0 : options.headers), {}, { 246 Accept: "text/event-stream" 247 }), 248 responseType: "stream", 249 adapter: "fetch" 250 }); 251 }); 252 return _doStreamingApiCallRaw.apply(this, arguments); 253 } 254 function getSignal(cancellationToken) { 255 if (cancellationToken) { 256 var controller = new AbortController(); 257 cancellationToken.onCancellationRequested(() => { 258 if (controller && controller.signal && !controller.signal.aborted) { 259 controller.abort(); 260 } 261 }); 262 return controller.signal; 263 } 264 } 265 function doApiCall(_x11, _x12) { 266 return _doApiCall.apply(this, arguments); 267 } 268 function _doApiCall() { 269 _doApiCall = _asyncToGenerator(function* (method, url) { 270 var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; 271 var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined; 272 var optionsOrCancellationToken = arguments.length > 4 ? arguments[4] : undefined; 273 var cancellationToken = arguments.length > 5 ? arguments[5] : undefined; 274 try { 275 var result; 276 if (optionsOrCancellationToken && "onCancellationRequested" in optionsOrCancellationToken) { 277 result = yield doApiCallRaw(method, url, params, data, undefined, optionsOrCancellationToken); 278 } else { 279 result = yield doApiCallRaw(method, url, params, data, optionsOrCancellationToken, cancellationToken); 280 } 281 return { 282 data: result.data, 283 isError: false, 284 isSuccess: true, 285 statusCode: result.status, 286 errorMessage: null 287 }; 288 } catch (e) { 289 if (axios.isAxiosError(e)) { 290 var _e$response, _e$response2, _e$response$status, _e$response4; 291 if ((_e$response = e.response) !== null && _e$response !== void 0 && (_e$response = _e$response.data) !== null && _e$response !== void 0 && _e$response.Message || e !== null && e !== void 0 && (_e$response2 = e.response) !== null && _e$response2 !== void 0 && (_e$response2 = _e$response2.data) !== null && _e$response2 !== void 0 && _e$response2.message) { 292 var _e$response$data$Mess, _e$response3; 293 return { 294 data: null, 295 isError: true, 296 isSuccess: false, 297 statusCode: e.response.status, 298 errorMessage: (_e$response$data$Mess = e === null || e === void 0 || (_e$response3 = e.response) === null || _e$response3 === void 0 || (_e$response3 = _e$response3.data) === null || _e$response3 === void 0 ? void 0 : _e$response3.Message) !== null && _e$response$data$Mess !== void 0 ? _e$response$data$Mess : e.response.data.message 299 }; 300 } 301 return { 302 data: null, 303 isError: true, 304 isSuccess: false, 305 statusCode: (_e$response$status = (_e$response4 = e.response) === null || _e$response4 === void 0 ? void 0 : _e$response4.status) !== null && _e$response$status !== void 0 ? _e$response$status : 0, 306 errorMessage: null 307 }; 308 } else { 309 return { 310 data: null, 311 isError: true, 312 isSuccess: false, 313 statusCode: 0, 314 errorMessage: null 315 }; 316 } 317 } 318 }); 319 return _doApiCall.apply(this, arguments); 320 } 321 function doStreamingApiCall(_x13, _x14) { 322 return _doStreamingApiCall.apply(this, arguments); 323 } 324 function _doStreamingApiCall() { 325 _doStreamingApiCall = _asyncToGenerator(function* (method, url) { 326 var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; 327 var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined; 328 var optionsOrCancellationToken = arguments.length > 4 ? arguments[4] : undefined; 329 var cancellationToken = arguments.length > 5 ? arguments[5] : undefined; 330 try { 331 var result; 332 if (optionsOrCancellationToken && "onCancellationRequested" in optionsOrCancellationToken) { 333 result = yield doStreamingApiCallRaw(method, url, params, data, undefined, optionsOrCancellationToken); 334 } else { 335 result = yield doStreamingApiCallRaw(method, url, params, data, optionsOrCancellationToken, cancellationToken); 336 } 337 var decoder = new EventSourceStream(); 338 var x = new JsonDecodeStream(); 339 return { 340 data: result.data.pipeThrough(decoder).pipeThrough(x), 341 isError: false, 342 isSuccess: true, 343 statusCode: result.status, 344 errorMessage: null 345 }; 346 } catch (e) { 347 if (axios.isAxiosError(e)) { 348 var _e$response5, _e$response6, _e$response$status2, _e$response8; 349 if ((_e$response5 = e.response) !== null && _e$response5 !== void 0 && (_e$response5 = _e$response5.data) !== null && _e$response5 !== void 0 && _e$response5.Message || e !== null && e !== void 0 && (_e$response6 = e.response) !== null && _e$response6 !== void 0 && (_e$response6 = _e$response6.data) !== null && _e$response6 !== void 0 && _e$response6.message) { 350 var _e$response$data$Mess2, _e$response7; 351 return { 352 data: null, 353 isError: true, 354 isSuccess: false, 355 statusCode: e.response.status, 356 errorMessage: (_e$response$data$Mess2 = e === null || e === void 0 || (_e$response7 = e.response) === null || _e$response7 === void 0 || (_e$response7 = _e$response7.data) === null || _e$response7 === void 0 ? void 0 : _e$response7.Message) !== null && _e$response$data$Mess2 !== void 0 ? _e$response$data$Mess2 : e.response.data.message 357 }; 358 } 359 return { 360 data: null, 361 isError: true, 362 isSuccess: false, 363 statusCode: (_e$response$status2 = (_e$response8 = e.response) === null || _e$response8 === void 0 ? void 0 : _e$response8.status) !== null && _e$response$status2 !== void 0 ? _e$response$status2 : 0, 364 errorMessage: null 365 }; 366 } else { 367 return { 368 data: null, 369 isError: true, 370 isSuccess: false, 371 statusCode: 0, 372 errorMessage: null 373 }; 374 } 375 } 376 }); 377 return _doStreamingApiCall.apply(this, arguments); 378 } 379 function get$1(_x15) { 380 return _get.apply(this, arguments); 381 } 382 function _get() { 383 _get = _asyncToGenerator(function* (url) { 384 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; 385 return yield doApiCall("GET", url, params, undefined); 386 }); 387 return _get.apply(this, arguments); 388 } 389 function post(_x16) { 390 return _post.apply(this, arguments); 391 } 392 function _post() { 393 _post = _asyncToGenerator(function* (url) { 394 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; 395 var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; 396 var cancellationToken = arguments.length > 3 ? arguments[3] : undefined; 397 return yield doApiCall("POST", url, params, data, cancellationToken); 398 }); 399 return _post.apply(this, arguments); 400 } 401 var httpFunctionsSymbol = Symbol("http-functions"); 402 function provideHttp(functions) { 403 provide(httpFunctionsSymbol, functions); 404 } 405 function useHttp() { 406 var http; 407 if (getCurrentInstance()) { 408 http = inject(httpFunctionsSymbol); 409 } 410 return http || { 411 doApiCall: doApiCall, 412 doStreamingApiCall: doStreamingApiCall, 413 get: get$1, 414 post: post 415 }; 416 } 417 function createApiCaller(options) { 418 var fetchFunction = useHttp()[(options.method || "post").toLowerCase()]; 419 var isLoading = ref(false); 420 var hasError = ref(false); 421 var errorMessage = ref(); 422 return { 423 isLoading, 424 hasError, 425 errorMessage, 426 run() { 427 var _arguments = arguments; 428 return _asyncToGenerator(function* () { 429 isLoading.value = true; 430 hasError.value = false;
431 errorMessage.value = undefined; 432 for (var _len = _arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 433 args[_key] = _arguments[_key]; 434 } 435 var params = typeof options.params === "function" ? options.params(...args) : options.params; 436 var data = typeof options.data === "function" ? options.data(...args) : options.data; 437 try { 438 var result = yield fetchFunction(options.url, params, data); 439 if (result.isSuccess) { 440 if (typeof options.onComplete === "function") { 441 options.onComplete(result.data, ...args); 442 } 443 return result.data; 444 } else { 445 var _result$errorMessage; 446 hasError.value = true; 447 errorMessage.value = (_result$errorMessage = result.errorMessage) !== null && _result$errorMessage !== void 0 ? _result$errorMessage : undefined; 448 } 449 } catch (e) { 450 hasError.value = true; 451 if (e instanceof Error) { 452 errorMessage.value = e.message; 453 } else if (typeof e === "string") { 454 errorMessage.value = e; 455 } else { 456 errorMessage.value = "An unknown error occurred."; 457 } 458 } finally { 459 isLoading.value = false; 460 } 461 })(); 462 } 463 }; 464 } 465 class JsonDecodeStream { 466 constructor() { 467 var transformer = { 468 transform(chunk, controller) { 469 try { 470 var obj = JSON.parse(chunk.data); 471 controller.enqueue(obj); 472 } catch (e) { 473 controller.error(new Error("Invalid JSON: ".concat(e))); 474 } 475 } 476 }; 477 var ts = new TransformStream(transformer); 478 this.readable = ts.readable; 479 this.writable = ts.writable; 480 } 481 } 482 function uploadFile(_x17, _x18, _x19) { 483 return _uploadFile.apply(this, arguments); 484 } 485 function _uploadFile() { 486 _uploadFile = _asyncToGenerator(function* (url, data, progress) { 487 var result; 488 try { 489 result = yield axios.post(url, data, { 490 headers: { 491 "Content-Type": "multipart/form-data" 492 }, 493 onUploadProgress: event => { 494 if (progress && event.total !== undefined) { 495 progress(event.loaded, event.total, Math.floor(event.loaded * 100 / event.total)); 496 } 497 } 498 }); 499 } catch (e) { 500 result = e.response; 501 } 502 if (!result) { 503 throw new Error("Upload failed."); 504 } 505 if (result.status === 200 && typeof result.data === "object") { 506 return result.data; 507 } 508 if (result.status === 406) { 509 throw new Error("File type is not allowed."); 510 } 511 if (typeof result.data === "string") { 512 throw new Error(result.data); 513 } 514 throw new Error("Upload failed."); 515 }); 516 return _uploadFile.apply(this, arguments); 517 } 518 function uploadContentFile(_x20, _x21, _x22, _x23) { 519 return _uploadContentFile.apply(this, arguments); 520 } 521 function _uploadContentFile() { 522 _uploadContentFile = _asyncToGenerator(function* (file, encryptedRootFolder, folderPath, options) { 523 var _options$baseUrl; 524 var url = "".concat((_options$baseUrl = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _options$baseUrl !== void 0 ? _options$baseUrl : "/FileUploader.ashx", "?rootFolder=").concat(encodeURIComponent(encryptedRootFolder)); 525 var formData = new FormData(); 526 formData.append("file", file); 527 if (folderPath) { 528 formData.append("folderPath", folderPath); 529 } 530 var result = yield uploadFile(url, formData, options === null || options === void 0 ? void 0 : options.progress); 531 return { 532 value: "", 533 text: result.FileName 534 }; 535 }); 536 return _uploadContentFile.apply(this, arguments); 537 } 538 function uploadAssetProviderFile(_x24, _x25, _x26, _x27) { 539 return _uploadAssetProviderFile.apply(this, arguments); 540 } 541 function _uploadAssetProviderFile() { 542 _uploadAssetProviderFile = _asyncToGenerator(function* (file, folderPath, assetStorageId, options) { 543 var _options$baseUrl2; 544 var url = "".concat((_options$baseUrl2 = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _options$baseUrl2 !== void 0 ? _options$baseUrl2 : "/FileUploader.ashx", "?rootFolder="); 545 var formData = new FormData(); 546 if (!assetStorageId) { 547 throw "Asset Storage Id and Key are required."; 548 } 549 formData.append("file", file); 550 formData.append("StorageId", assetStorageId); 551 formData.append("Key", folderPath); 552 formData.append("IsAssetStorageProviderAsset", "true"); 553 var result = yield uploadFile(url, formData, options === null || options === void 0 ? void 0 : options.progress); 554 return { 555 value: "", 556 text: result.FileName 557 }; 558 }); 559 return _uploadAssetProviderFile.apply(this, arguments); 560 } 561 function uploadBinaryFile(_x28, _x29, _x30) { 562 return _uploadBinaryFile.apply(this, arguments); 563 } 564 function _uploadBinaryFile() { 565 _uploadBinaryFile = _asyncToGenerator(function* (file, binaryFileTypeGuid, options) { 566 var _options$baseUrl3; 567 var url = "".concat((_options$baseUrl3 = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _options$baseUrl3 !== void 0 ? _options$baseUrl3 : "/FileUploader.ashx", "?isBinaryFile=True&fileTypeGuid=").concat(binaryFileTypeGuid); 568 if ((options === null || options === void 0 ? void 0 : options.isTemporary) === false) { 569 url += "&isTemporary=False"; 570 } else { 571 url += "&isTemporary=True"; 572 } 573 if (options !== null && options !== void 0 && options.parentEntityTypeId) { 574 url += "&ParentEntityTypeId=" + options.parentEntityTypeId; 575 } 576 if (options !== null && options !== void 0 && options.parentEntityId) { 577 url += "&ParentEntityId=" + options.parentEntityId; 578 } 579 if (options !== null && options !== void 0 && options.securityGrantToken) { 580 url += "&SecurityGrantToken=" + encodeURIComponent(options.securityGrantToken); 581 } 582 var formData = new FormData(); 583 formData.append("file", file); 584 var result = yield uploadFile(url, formData, options === null || options === void 0 ? void 0 : options.progress); 585 return { 586 value: result.Guid, 587 text: result.FileName 588 }; 589 }); 590 return _uploadBinaryFile.apply(this, arguments); 591 } 592 var http$1 = { 593 doApiCall, 594 post, 595 get: get$1 596 }; 597 598 var http$2 = /*#__PURE__*/Object.freeze({ 599 __proto__: null, 600 createApiCaller: createApiCaller, 601 default: http$1, 602 doApiCall: doApiCall, 603 doStreamingApiCall: doStreamingApiCall, 604 get: get$1, 605 post: post, 606 provideHttp: provideHttp, 607 uploadAssetProviderFile: uploadAssetProviderFile, 608 uploadBinaryFile: uploadBinaryFile, 609 uploadContentFile: uploadContentFile, 610 useHttp: useHttp 611 }); 612 exports('http', http$2); 613 614 function getDefaultAddressControlModel() { 615 return { 616 state: "AZ", 617 country: "US" 618 }; 619 } 620 function validateAddress(address) { 621 var post = useHttp().post; 622 return post("/api/v2/Controls/AddressControlValidateAddress", undefined, address); 623 } 624 function getAddressString(address) { 625 var post = useHttp().post; 626 return post("/api/v2/Controls/AddressControlGetStreetAddressString", undefined, address); 627 } 628 629 var address = /*#__PURE__*/Object.freeze({ 630 __proto__: null, 631 getAddressString: getAddressString, 632 getDefaultAddressControlModel: getDefaultAddressControlModel, 633 validateAddress: validateAddress 634 }); 635 exports('address', address); 636 637 function flatten(arr) { 638 var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; 639 var result = [];
640 var forEach = result.forEach; 641 var _flatDeep = function flatDeep(arr, depth) { 642 forEach.call(arr, function (val) { 643 if (depth > 0 && Array.isArray(val)) { 644 _flatDeep(val, depth - 1); 645 } else { 646 result.push(val); 647 } 648 }); 649 }; 650 _flatDeep(arr, depth); 651 return result; 652 } 653 function forceToArray(value, multiple) { 654 if (value === undefined || value === null) { 655 return []; 656 } else if (Array.isArray(value)) { 657 if (!multiple && value.length > 1) { 658 return [value[0]]; 659 } else { 660 return value; 661 } 662 } else { 663 return [value]; 664 } 665 } 666 667 var arrayUtils = /*#__PURE__*/Object.freeze({ 668 __proto__: null, 669 flatten: flatten, 670 forceToArray: forceToArray 671 }); 672 exports('arrayUtils', arrayUtils); 673 674 var moreThanOneElement = "More than one element was found in collection."; 675 var noElementsFound = "No element was found in collection."; 676 function valueComparer(keySelector, descending) { 677 return (a, b) => { 678 var valueA = keySelector(a); 679 var valueB = keySelector(b); 680 if (valueA === undefined || valueA === null) { 681 if (valueB === undefined || valueB === null) { 682 return 0; 683 } 684 return !descending ? -1 : 1; 685 } 686 if (valueB === undefined || valueB === null) { 687 return !descending ? 1 : -1; 688 } 689 if (valueA > valueB) { 690 return !descending ? 1 : -1; 691 } else if (valueA < valueB) { 692 return !descending ? -1 : 1; 693 } else { 694 return 0; 695 } 696 }; 697 } 698 class List { 699 constructor(elements) { 700 if (elements === undefined) { 701 this.elements = []; 702 } else { 703 this.elements = [...elements]; 704 } 705 } 706 static fromArrayNoCopy(elements) { 707 var list = new List(); 708 list.elements = elements; 709 return list; 710 } 711 any(predicate) { 712 var elements = this.elements; 713 if (predicate !== undefined) { 714 elements = elements.filter(predicate); 715 } 716 return elements.length > 0; 717 } 718 first(predicate) { 719 var elements = this.elements; 720 if (predicate !== undefined) { 721 elements = elements.filter(predicate); 722 } 723 if (elements.length >= 1) { 724 return elements[0]; 725 } else { 726 throw noElementsFound; 727 } 728 } 729 firstOrUndefined(predicate) { 730 var elements = this.elements; 731 if (predicate !== undefined) { 732 elements = elements.filter(predicate); 733 } 734 if (elements.length === 1) { 735 return elements[0]; 736 } else { 737 return undefined; 738 } 739 } 740 lastOrUndefined(predicate) { 741 var elements = this.elements; 742 if (predicate !== undefined) { 743 elements = elements.filter(predicate); 744 } 745 if (elements.length) { 746 return elements[elements.length - 1]; 747 } else { 748 return undefined; 749 } 750 } 751 single(predicate) { 752 var elements = this.elements; 753 if (predicate !== undefined) { 754 elements = elements.filter(predicate); 755 } 756 if (elements.length === 1) { 757 return elements[0]; 758 } else { 759 throw moreThanOneElement; 760 } 761 } 762 singleOrUndefined(predicate) { 763 var elements = this.elements; 764 if (predicate !== undefined) { 765 elements = elements.filter(predicate); 766 } 767 if (elements.length === 0) { 768 return undefined; 769 } else if (elements.length === 1) { 770 return elements[0]; 771 } else { 772 throw moreThanOneElement; 773 } 774 } 775 orderBy(keySelector) { 776 var comparer = valueComparer(keySelector, false); 777 return new OrderedList(this.elements, comparer); 778 } 779 orderByDescending(keySelector) { 780 var comparer = valueComparer(keySelector, true); 781 return new OrderedList(this.elements, comparer); 782 } 783 where(predicate) { 784 return new List(this.elements.filter(predicate)); 785 } 786 toArray() { 787 return [...this.elements]; 788 } 789 } 790 class OrderedList extends List { 791 constructor(elements, baseComparer) { 792 super(elements); 793 this.baseComparer = baseComparer; 794 this.elements.sort(this.baseComparer); 795 } 796 thenBy(keySelector) { 797 var comparer = valueComparer(keySelector, false); 798 return new OrderedList(this.elements, (a, b) => this.baseComparer(a, b) || comparer(a, b)); 799 } 800 thenByDescending(keySelector) { 801 var comparer = valueComparer(keySelector, true); 802 return new OrderedList(this.elements, (a, b) => this.baseComparer(a, b) || comparer(a, b)); 803 } 804 } 805 class Enumerable { 806 constructor(iterableFactory) { 807 this.iterableFactory = iterableFactory; 808 } 809 static empty() { 810 return new Enumerable(() => []); 811 } 812 static from(source) { 813 if (typeof source === "function") { 814 return new Enumerable(source); 815 } else { 816 return new Enumerable(() => source); 817 } 818 } 819 *[Symbol.iterator]() { 820 yield* this.iterableFactory(); 821 } 822 aggregate(accumulator, seed) { 823 var result = seed; 824 var index = 0; 825 var _iterator = _createForOfIteratorHelper(this), 826 _step; 827 try { 828 for (_iterator.s();
828 !(_step = _iterator.n()).done;) { 829 var _item = _step.value; 830 result = accumulator(result, _item, index++); 831 } 832 } catch (err) { 833 _iterator.e(err); 834 } finally { 835 _iterator.f(); 836 } 837 return result; 838 } 839 all(predicate) { 840 var _iterator2 = _createForOfIteratorHelper(this), 841 _step2; 842 try { 843 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 844 var _item2 = _step2.value; 845 if (!predicate(_item2)) { 846 return false; 847 } 848 } 849 } catch (err) { 850 _iterator2.e(err); 851 } finally { 852 _iterator2.f(); 853 } 854 return true; 855 } 856 any(predicate) { 857 var _iterator3 = _createForOfIteratorHelper(this), 858 _step3; 859 try { 860 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 861 var _item3 = _step3.value; 862 if (!predicate || predicate(_item3)) { 863 return true; 864 } 865 } 866 } catch (err) { 867 _iterator3.e(err); 868 } finally { 869 _iterator3.f(); 870 } 871 return false; 872 } 873 average(selector) { 874 var total = 0; 875 var count = 0; 876 var _iterator4 = _createForOfIteratorHelper(this), 877 _step4; 878 try { 879 for (_iterator4.s();
879 !(_step4 = _iterator4.n()).done;) { 880 var _item4 = _step4.value; 881 var _value = selector(_item4); 882 if (typeof _value === "number" && !isNaN(_value)) { 883 total += _value; 884 count++; 885 } 886 } 887 } catch (err) { 888 _iterator4.e(err); 889 } finally { 890 _iterator4.f(); 891 } 892 if (count === 0) { 893 return 0; 894 } else { 895 return total / count; 896 } 897 } 898 cast(typeCheck) { 899 var self = this; 900 return new Enumerable(function* () { 901 var _iterator5 = _createForOfIteratorHelper(self), 902 _step5; 903 try { 904 for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { 905 var _item5 = _step5.value; 906 if (!typeCheck(_item5)) { 907 throw new Error("Invalid cast: Value '".concat(_item5, "' cannot be cast to the specified type.")); 908 } 909 yield _item5; 910 } 911 } catch (err) { 912 _iterator5.e(err); 913 } finally { 914 _iterator5.f(); 915 } 916 }); 917 } 918 chunk(size) { 919 if (size < 1) { 920 throw new Error("Chunk size must be greater than 0."); 921 } 922 var self = this; 923 return new Enumerable(function* () { 924 var buffer = []; 925 var _iterator6 = _createForOfIteratorHelper(self), 926 _step6; 927 try { 928 for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { 929 var _item6 = _step6.value; 930 buffer.push(_item6); 931 if (buffer.length === size) { 932 yield buffer; 933 buffer = []; 934 } 935 } 936 } catch (err) { 937 _iterator6.e(err); 938 } finally { 939 _iterator6.f(); 940 } 941 if (buffer.length > 0) { 942 yield buffer; 943 } 944 }); 945 } 946 concat(second) { 947 var self = this; 948 return this.spawn(function* () { 949 yield* self; 950 yield* second; 951 }); 952 } 953 count(predicate) { 954 var total = 0; 955 var _iterator7 = _createForOfIteratorHelper(this), 956 _step7; 957 try { 958 for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { 959 var _item7 = _step7.value; 960 if (!predicate || predicate(_item7)) { 961 total++; 962 } 963 } 964 } catch (err) { 965 _iterator7.e(err); 966 } finally { 967 _iterator7.f(); 968 } 969 return total; 970 } 971 distinct() { 972 var self = this; 973 return this.spawn(function* () { 974 var seen = new Set(); 975 var _iterator8 = _createForOfIteratorHelper(self), 976 _step8; 977 try { 978 for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { 979 var _item8 = _step8.value; 980 if (!seen.has(_item8)) { 981 seen.add(_item8); 982 yield _item8; 983 } 984 } 985 } catch (err) { 986 _iterator8.e(err); 987 } finally { 988 _iterator8.f(); 989 } 990 }); 991 } 992 distinctBy(keySelector) { 993 var self = this; 994 return this.spawn(function* () { 995 var seenKeys = new Set(); 996 var _iterator9 = _createForOfIteratorHelper(self), 997 _step9; 998 try { 999 for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { 1000 var _item9 = _step9.value; 1001 var _key = keySelector(_item9); 1002 var keyString = JSON.stringify(_key); 1003 if (!seenKeys.has(keyString)) { 1004 seenKeys.add(keyString); 1005 yield _item9; 1006 } 1007 } 1008 } catch (err) { 1009 _iterator9.e(err); 1010 } finally { 1011 _iterator9.f(); 1012 } 1013 }); 1014 } 1015 first(predicate) { 1016 var i = 0; 1017 var _iterator0 = _createForOfIteratorHelper(this), 1018 _step0; 1019 try { 1020 for (_iterator0.s();
1020 !(_step0 = _iterator0.n()).done;) { 1021 var _item0 = _step0.value; 1022 if (!predicate || predicate(_item0, i)) { 1023 return _item0; 1024 } 1025 i++; 1026 } 1027 } catch (err) { 1028 _iterator0.e(err); 1029 } finally { 1030 _iterator0.f(); 1031 } 1032 throw noElementsFound; 1033 } 1034 firstOrDefault(arg) { 1035 if (typeof arg === "function") { 1036 var _predicate = arg; 1037 var _iterator1 = _createForOfIteratorHelper(this), 1038 _step1; 1039 try { 1040 for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) { 1041 var _item1 = _step1.value; 1042 if (_predicate(_item1)) { 1043 return _item1; 1044 } 1045 } 1046 } catch (err) { 1047 _iterator1.e(err); 1048 } finally { 1049 _iterator1.f(); 1050 } 1051 } else { 1052 var _iterator10 = _createForOfIteratorHelper(this), 1053 _step10; 1054 try { 1055 for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { 1056 var _item10 = _step10.value; 1057 return _item10; 1058 } 1059 } catch (err) { 1060 _iterator10.e(err); 1061 } finally { 1062 _iterator10.f(); 1063 } 1064 return arg; 1065 } 1066 } 1067 forEach(action) { 1068 var _iterator11 = _createForOfIteratorHelper(this), 1069 _step11; 1070 try { 1071 for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { 1072 var _item11 = _step11.value; 1073 action(_item11); 1074 } 1075 } catch (err) { 1076 _iterator11.e(err); 1077 } finally { 1078 _iterator11.f(); 1079 } 1080 } 1081 groupBy(keySelector) { 1082 var self = this; 1083 return new Enumerable(function* () { 1084 var map = new Map(); 1085 var _iterator12 = _createForOfIteratorHelper(self), 1086 _step12; 1087 try { 1088 for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) { 1089 var _item12 = _step12.value; 1090 var _key2 = keySelector(_item12); 1091 var keyString = JSON.stringify(_key2); 1092 var entry = map.get(keyString); 1093 if (entry) { 1094 entry.values.push(_item12); 1095 } else { 1096 map.set(keyString, { 1097 key: _key2, 1098 values: [_item12] 1099 }); 1100 } 1101 } 1102 } catch (err) { 1103 _iterator12.e(err); 1104 } finally { 1105 _iterator12.f(); 1106 } 1107 var _iterator13 = _createForOfIteratorHelper(map.values()), 1108 _step13; 1109 try { 1110 for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) { 1111 var _step13$value = _step13.value, 1112 _key3 = _step13$value.key, 1113 values = _step13$value.values; 1114 yield new GroupedEnumerable(_key3, values); 1115 } 1116 } catch (err) { 1117 _iterator13.e(err); 1118 } finally { 1119 _iterator13.f(); 1120 } 1121 }); 1122 } 1123 last(predicate) { 1124 var found = false; 1125 var lastMatch = undefined; 1126 var _iterator14 = _createForOfIteratorHelper(this), 1127 _step14; 1128 try { 1129 for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) { 1130 var _item13 = _step14.value; 1131 if (!predicate || predicate(_item13)) { 1132 found = true; 1133 lastMatch = _item13; 1134 } 1135 } 1136 } catch (err) { 1137 _iterator14.e(err); 1138 } finally { 1139 _iterator14.f(); 1140 } 1141 if (!found || lastMatch === undefined) { 1142 throw new Error("No element satisfies the condition in last()"); 1143 } 1144 return lastMatch; 1145 } 1146 lastOrDefault(arg) { 1147 var last; 1148 if (typeof arg === "function") { 1149 var _predicate2 = arg; 1150 var _iterator15 = _createForOfIteratorHelper(this), 1151 _step15; 1152 try { 1153 for (_iterator15.s();
1153 !(_step15 = _iterator15.n()).done;) { 1154 var _item14 = _step15.value; 1155 if (_predicate2(_item14)) { 1156 last = _item14; 1157 } 1158 } 1159 } catch (err) { 1160 _iterator15.e(err); 1161 } finally { 1162 _iterator15.f(); 1163 } 1164 } else { 1165 var _iterator16 = _createForOfIteratorHelper(this), 1166 _step16; 1167 try { 1168 for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) { 1169 var _item15 = _step16.value; 1170 last = _item15; 1171 } 1172 } catch (err) { 1173 _iterator16.e(err); 1174 } finally { 1175 _iterator16.f(); 1176 } 1177 } 1178 return last; 1179 } 1180 max(selector) { 1181 var self = this[Symbol.iterator](); 1182 var first = self.next(); 1183 if (first.done) return undefined; 1184 var maxItem = selector(first.value); 1185 for (var next = self.next(); !next.done; next = self.next()) { 1186 var _value2 = selector(next.value); 1187 if (_value2 > maxItem) { 1188 maxItem = _value2; 1189 } 1190 } 1191 return maxItem; 1192 } 1193 min(selector) { 1194 var self = this[Symbol.iterator](); 1195 var first = self.next(); 1196 if (first.done) return undefined; 1197 var minItem = selector(first.value); 1198 for (var next = self.next(); !next.done; next = self.next()) { 1199 var _value3 = selector(next.value); 1200 if (_value3 < minItem) { 1201 minItem = _value3; 1202 } 1203 } 1204 return minItem; 1205 } 1206 ofType(typeCheck) { 1207 var self = this; 1208 return new Enumerable(function* () { 1209 var _iterator17 = _createForOfIteratorHelper(self), 1210 _step17; 1211 try { 1212 for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) { 1213 var _item16 = _step17.value; 1214 if (typeCheck(_item16)) { 1215 yield _item16; 1216 } 1217 } 1218 } catch (err) { 1219 _iterator17.e(err); 1220 } finally { 1221 _iterator17.f(); 1222 } 1223 }); 1224 } 1225 orderBy(keySelector) { 1226 var comparer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (a, b) => a > b ? 1 : a < b ? -1 : 0; 1227 return new OrderedEnumerable(this.iterableFactory, (a, b) => comparer(keySelector(a), keySelector(b))); 1228 } 1229 orderByDescending(keySelector) { 1230 var comparer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (a, b) => a > b ? 1 : a < b ? -1 : 0; 1231 var descendingComparer = (a, b) => -comparer(a, b); 1232 return this.orderBy(keySelector, descendingComparer); 1233 } 1234 prepend(items) { 1235 var self = this; 1236 return this.spawn(function* () { 1237 var _iterator18 = _createForOfIteratorHelper(items), 1238 _step18; 1239 try { 1240 for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) { 1241 var _item17 = _step18.value; 1242 yield _item17; 1243 } 1244 } catch (err) { 1245 _iterator18.e(err); 1246 } finally { 1247 _iterator18.f(); 1248 } 1249 var _iterator19 = _createForOfIteratorHelper(self), 1250 _step19; 1251 try { 1252 for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) { 1253 var _item18 = _step19.value; 1254 yield _item18; 1255 } 1256 } catch (err) { 1257 _iterator19.e(err); 1258 } finally { 1259 _iterator19.f(); 1260 } 1261 }); 1262 } 1263 scan(seed, accumulator) { 1264 var self = this; 1265 return new Enumerable(function* () { 1266 var acc = seed; 1267 var index = 0; 1268 var _iterator20 = _createForOfIteratorHelper(self), 1269 _step20; 1270 try { 1271 for (_iterator20.s();
1271 !(_step20 = _iterator20.n()).done;) { 1272 var _item19 = _step20.value; 1273 acc = accumulator(acc, _item19, index++); 1274 yield acc; 1275 } 1276 } catch (err) { 1277 _iterator20.e(err); 1278 } finally { 1279 _iterator20.f(); 1280 } 1281 }); 1282 } 1283 select(selector) { 1284 var self = this; 1285 return new Enumerable(function* () { 1286 var _iterator21 = _createForOfIteratorHelper(self), 1287 _step21; 1288 try { 1289 for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) { 1290 var _item20 = _step21.value; 1291 yield selector(_item20); 1292 } 1293 } catch (err) { 1294 _iterator21.e(err); 1295 } finally { 1296 _iterator21.f(); 1297 } 1298 }); 1299 } 1300 selectMany(collectionSelector) { 1301 var self = this; 1302 return new Enumerable(function* () { 1303 var _iterator22 = _createForOfIteratorHelper(self), 1304 _step22; 1305 try { 1306 for (_iterator22.s();
1306 !(_step22 = _iterator22.n()).done;) { 1307 var _item21 = _step22.value; 1308 var collection = collectionSelector(_item21); 1309 var _iterator23 = _createForOfIteratorHelper(collection), 1310 _step23; 1311 try { 1312 for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) { 1313 var subItem = _step23.value; 1314 yield subItem; 1315 } 1316 } catch (err) { 1317 _iterator23.e(err); 1318 } finally { 1319 _iterator23.f(); 1320 } 1321 } 1322 } catch (err) { 1323 _iterator22.e(err); 1324 } finally { 1325 _iterator22.f(); 1326 } 1327 }); 1328 } 1329 sequenceEqual(other) { 1330 var comparer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (a, b) => a === b; 1331 var it1 = this[Symbol.iterator](); 1332 var it2 = other[Symbol.iterator](); 1333 while (true) { 1334 var n1 = it1.next(); 1335 var n2 = it2.next(); 1336 if (n1.done && n2.done) return true; 1337 if (n1.done !== n2.done) return false; 1338 if (!comparer(n1.value, n2.value)) return false; 1339 } 1340 } 1341 skip(count) { 1342 var self = this; 1343 return this.spawn(function* () { 1344 var skipped = 0; 1345 var _iterator24 = _createForOfIteratorHelper(self), 1346 _step24; 1347 try { 1348 for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) { 1349 var _item22 = _step24.value; 1350 if (skipped++ >= count) { 1351 yield _item22; 1352 } 1353 } 1354 } catch (err) { 1355 _iterator24.e(err); 1356 } finally { 1357 _iterator24.f(); 1358 } 1359 }); 1360 } 1361 spawn(factory) { 1362 var ctor = this.constructor; 1363 return new ctor(factory); 1364 } 1365 sum(selector) { 1366 var total = 0; 1367 var _iterator25 = _createForOfIteratorHelper(this), 1368 _step25; 1369 try { 1370 for (_iterator25.s(); !(_step25 = _iterator25.n()).done;) { 1371 var _item23 = _step25.value; 1372 var _value4 = selector(_item23); 1373 if (typeof _value4 === "number" && !isNaN(_value4)) { 1374 total += _value4; 1375 } 1376 } 1377 } catch (err) { 1378 _iterator25.e(err); 1379 } finally { 1380 _iterator25.f(); 1381 } 1382 return total; 1383 } 1384 take(count) { 1385 var self = this; 1386 return this.spawn(function* () { 1387 var i = 0; 1388 var _iterator26 = _createForOfIteratorHelper(self), 1389 _step26; 1390 try { 1391 for (_iterator26.s(); !(_step26 = _iterator26.n()).done;) { 1392 var _item24 = _step26.value; 1393 if (i++ < count) { 1394 yield _item24; 1395 } else { 1396 break; 1397 } 1398 } 1399 } catch (err) { 1400 _iterator26.e(err); 1401 } finally { 1402 _iterator26.f(); 1403 } 1404 }); 1405 } 1406 toArray() { 1407 return Array.from(this); 1408 } 1409 toDictionary(keySelector, valueSelector) { 1410 return new Map(this.select(item => [keySelector(item), valueSelector ? valueSelector(item) : item])); 1411 } 1412 where(predicate) { 1413 var self = this; 1414 return this.spawn(function* () { 1415 var _iterator27 = _createForOfIteratorHelper(self), 1416 _step27; 1417 try { 1418 for (_iterator27.s(); !(_step27 = _iterator27.n()).done;) { 1419 var _item25 = _step27.value; 1420 if (predicate(_item25)) { 1421 yield _item25; 1422 } 1423 } 1424 } catch (err) { 1425 _iterator27.e(err); 1426 } finally { 1427 _iterator27.f(); 1428 } 1429 }); 1430 } 1431 withIndex() { 1432 var self = this; 1433 return new Enumerable(function* () { 1434 var index = 0; 1435 var _iterator28 = _createForOfIteratorHelper(self), 1436 _step28; 1437 try { 1438 for (_iterator28.s();
1438 !(_step28 = _iterator28.n()).done;) { 1439 var _item26 = _step28.value; 1440 yield [_item26, index++]; 1441 } 1442 } catch (err) { 1443 _iterator28.e(err); 1444 } finally { 1445 _iterator28.f(); 1446 } 1447 }); 1448 } 1449 } 1450 class OrderedEnumerable extends Enumerable { 1451 constructor(iterableFactory, initialComparer) { 1452 super(iterableFactory); 1453 this.sortComparers = [initialComparer]; 1454 } 1455 thenOrderBy(keySelector) { 1456 var comparer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (a, b) => a > b ? 1 : a < b ? -1 : 0; 1457 var self = this; 1458 return new OrderedEnumerable(this.iterableFactory, (a, b) => { 1459 var _iterator29 = _createForOfIteratorHelper(self.sortComparers), 1460 _step29; 1461 try { 1462 for (_iterator29.s(); !(_step29 = _iterator29.n()).done;) { 1463 var cmp = _step29.value; 1464 var result = cmp(a, b); 1465 if (result !== 0) return result; 1466 } 1467 } catch (err) { 1468 _iterator29.e(err); 1469 } finally { 1470 _iterator29.f(); 1471 } 1472 return comparer(keySelector(a), keySelector(b)); 1473 }); 1474 } 1475 thenOrderByDescending(keySelector) { 1476 var comparer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (a, b) => a > b ? 1 : a < b ? -1 : 0; 1477 var descendingComparer = (a, b) => -comparer(a, b); 1478 return this.thenOrderBy(keySelector, descendingComparer); 1479 } 1480 toArray() { 1481 return Array.from(this); 1482 } 1483 *[Symbol.iterator]() { 1484 var array = Array.from(this.iterableFactory()); 1485 array.sort((a, b) => { 1486 var _iterator30 = _createForOfIteratorHelper(this.sortComparers), 1487 _step30; 1488 try { 1489 for (_iterator30.s(); !(_step30 = _iterator30.n()).done;) { 1490 var comparer = _step30.value; 1491 var result = comparer(a, b); 1492 if (result !== 0) return result; 1493 } 1494 } catch (err) { 1495 _iterator30.e(err); 1496 } finally { 1497 _iterator30.f(); 1498 } 1499 return 0; 1500 }); 1501 yield* array; 1502 } 1503 } 1504 class GroupedEnumerable extends Enumerable { 1505 constructor(key, elements) { 1506 super(() => elements); 1507 this.key = key; 1508 } 1509 } 1510 1511 var linq = /*#__PURE__*/Object.freeze({ 1512 __proto__: null, 1513 Enumerable: Enumerable, 1514 GroupedEnumerable: GroupedEnumerable, 1515 List: List 1516 }); 1517 exports('linq', linq); 1518 1519 var emptyGuid = "00000000-0000-0000-0000-000000000000"; 1520 function newGuid() { 1521 return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => { 1522 var r = Math.random() * 16 | 0; 1523 var v = c === "x" ? r : r & 0x3 | 0x8; 1524 return v.toString(16); 1525 }); 1526 } 1527 function normalize(a) { 1528 if (!a) { 1529 return null; 1530 } 1531 return a.toLowerCase(); 1532 } 1533 function isValidGuid(guid) { 1534 return /^[0-9A-Fa-f]{8}-(?:[0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$/.test(guid); 1535 } 1536 function toGuidOrNull(value) { 1537 if (value === null || value === undefined) { 1538 return null; 1539 } 1540 if (!isValidGuid(value)) { 1541 return null; 1542 } 1543 return value; 1544 } 1545 function areEqual(a, b) { 1546 return normalize(a) === normalize(b); 1547 } 1548 var guid = { 1549 newGuid, 1550 normalize, 1551 areEqual 1552 }; 1553 1554 var guid$1 = /*#__PURE__*/Object.freeze({ 1555 __proto__: null, 1556 areEqual: areEqual, 1557 default: guid, 1558 emptyGuid: emptyGuid, 1559 isValidGuid: isValidGuid, 1560 newGuid: newGuid, 1561 normalize: normalize, 1562 toGuidOrNull: toGuidOrNull 1563 }); 1564 exports('guid', guid$1); 1565 1566 function isEmpty(val) { 1567 if (typeof val === "string") { 1568 return val.length === 0; 1569 } 1570 return false;
1571 } 1572 function isWhiteSpace(val) { 1573 if (typeof val === "string") { 1574 return val.trim().length === 0; 1575 } 1576 return false; 1577 } 1578 function isNullOrWhiteSpace(val) { 1579 return isWhiteSpace(val) || val === undefined || val === null; 1580 } 1581 function splitCase(val) { 1582 val = val.replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2"); 1583 return val.replace(/([a-z0-9])([A-Z])/g, "$1 $2"); 1584 } 1585 function asCommaAnd(strs, andStr) { 1586 if (strs.length === 0) { 1587 return ""; 1588 } 1589 if (strs.length === 1) { 1590 return strs[0]; 1591 } 1592 if (!andStr) { 1593 andStr = "and"; 1594 } 1595 if (strs.length === 2) { 1596 return "".concat(strs[0], " ").concat(andStr, " ").concat(strs[1]); 1597 } 1598 var last = strs.pop(); 1599 return "".concat(strs.join(", "), " ").concat(andStr, " ").concat(last); 1600 } 1601 function toTitleCase(str) { 1602 if (!str) { 1603 return ""; 1604 } 1605 return str.replace(/\w\S*/g, word => { 1606 return word.charAt(0).toUpperCase() + word.substring(1).toLowerCase(); 1607 }); 1608 } 1609 function toKebabCase(str) { 1610 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1611 var _options$preserveMult = options.preserveMultipleDashes, 1612 preserveMultipleDashes = _options$preserveMult === void 0 ? false : _options$preserveMult, 1613 _options$allowLeading = options.allowLeadingDashes, 1614 allowLeadingDashes = _options$allowLeading === void 0 ? false : _options$allowLeading, 1615 _options$allowTrailin = options.allowTrailingDashes, 1616 allowTrailingDashes = _options$allowTrailin === void 0 ? false : _options$allowTrailin, 1617 _options$allowSpecial = options.allowSpecialChars, 1618 allowSpecialChars = _options$allowSpecial === void 0 ? false : _options$allowSpecial; 1619 var result = str.trim(); 1620 result = result.replace(/([a-z])([A-Z])/g, "$1-$2"); 1621 result = result.replace(/\s+/g, "-"); 1622 if (!allowSpecialChars) { 1623 result = result.replace(/[^a-zA-Z0-9-]/g, ""); 1624 } 1625 if (!preserveMultipleDashes) { 1626 result = result.replace(/-+/g, "-"); 1627 } 1628 result = result.toLowerCase(); 1629 if (!allowLeadingDashes) { 1630 result = result.replace(/^-+/, ""); 1631 } 1632 if (!allowTrailingDashes) { 1633 result = result.replace(/-+$/, ""); 1634 } 1635 return result; 1636 } 1637 function upperCaseFirstCharacter(str) { 1638 if (!str) { 1639 return ""; 1640 } 1641 return str.charAt(0).toUpperCase() + str.substring(1); 1642 } 1643 function pluralize(word, count) { 1644 return Pluralize(word, count); 1645 } 1646 function pluralConditional(num, singular, plural) { 1647 return num === 1 ? singular : plural; 1648 } 1649 function padLeft(str, length) { 1650 var padCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : " "; 1651 if (padCharacter === "") { 1652 padCharacter = " "; 1653 } else if (padCharacter.length > 1) { 1654 padCharacter = padCharacter.substring(0, 1); 1655 } 1656 if (!str) { 1657 return Array(length + 1).join(padCharacter); 1658 } 1659 if (str.length >= length) { 1660 return str; 1661 } 1662 return Array(length - str.length + 1).join(padCharacter) + str; 1663 } 1664 function padRight(str, length) { 1665 var padCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : " "; 1666 if (padCharacter === "") { 1667 padCharacter = " "; 1668 } else if (padCharacter.length > 1) { 1669 padCharacter = padCharacter.substring(0, 1); 1670 } 1671 if (!str) { 1672 return Array(length).join(padCharacter); 1673 } 1674 if (str.length >= length) { 1675 return str; 1676 } 1677 return str + Array(length - str.length + 1).join(padCharacter); 1678 } 1679 function truncate(str, limit, options) { 1680 if (str.length <= limit) { 1681 return str; 1682 } 1683 var 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"; 1684 var reg = new RegExp("(?=[".concat(trimmable, "])")); 1685 var words = str.split(reg); 1686 var count = 0; 1687 if (options && options.ellipsis === true) { 1688 limit -= 3; 1689 } 1690 var visibleWords = words.filter(function (word) { 1691 count += word.length; 1692 return count <= limit; 1693 }); 1694 return "".concat(visibleWords.join(""), "..."); 1695 } 1696 var escapeHtmlRegExp = /["'&<>]/g; 1697 var escapeHtmlMap = { 1698 '"': """, 1699 "&": "&", 1700 "'": "'", 1701 "<": "<", 1702 ">": ">" 1703 }; 1704 function escapeHtml(str) { 1705 return str.replace(escapeHtmlRegExp, ch => { 1706 return escapeHtmlMap[ch]; 1707 }); 1708 } 1709 function defaultControlCompareValue(value, itemValue) { 1710 var guidValue = toGuidOrNull(value); 1711 var guidItemValue = toGuidOrNull(itemValue); 1712 if (guidValue !== null && guidItemValue !== null) { 1713 return areEqual(guidValue, guidItemValue); 1714 } 1715 return value === itemValue; 1716 } 1717 function containsHtmlTag(value) { 1718 return /<[/0-9a-zA-Z]/.test(value); 1719 } 1720 function createHash(str) { 1721 var hash = 0; 1722 for (var i = 0; i < str.length; i++) { 1723 var chr = str.charCodeAt(i); 1724 hash = (hash << 5) - hash + chr; 1725 hash |= 0; 1726 } 1727 return hash; 1728 } 1729 function createHashSha256(_x) { 1730 return _createHashSha.apply(this, arguments); 1731 } 1732 function _createHashSha() { 1733 _createHashSha = _asyncToGenerator(function* (str) { 1734 var encoder = new TextEncoder(); 1735 var data = encoder.encode(str); 1736 var hashBuffer = yield crypto.subtle.digest("SHA-256", data); 1737 return Array.from(new Uint8Array(hashBuffer)).map(b => b.toString(16).padStart(2, "0")).join(""); 1738 }); 1739 return _createHashSha.apply(this, arguments); 1740 } 1741 function replaceAll(str, search, replace) { 1742 return str.replace(new RegExp(search, "g"), replace); 1743 } 1744 function safeParseJson$1(value) { 1745 if (!value) { 1746 return undefined; 1747 } 1748 try { 1749 return JSON.parse(value); 1750 } catch (_unused) { 1751 return undefined; 1752 } 1753 } 1754 function prependSingularIndefiniteArticle(singularWord) { 1755 if (!singularWord) { 1756 return singularWord; 1757 } 1758 var lower = singularWord.toLowerCase(); 1759 var silentH = ["honest", "hour", "honor", "heir"]; 1760 if (silentH.includes(lower)) { 1761 return "an ".concat(singularWord); 1762 } 1763 var hardURegex = /^(u[bcfhjkqrstn])/i; 1764 if (hardURegex.test(singularWord)) { 1765 return "a ".concat(singularWord); 1766 } 1767 var vowelSound = /^[aeiou]/i; 1768 if (vowelSound.test(singularWord)) { 1769 return "an ".concat(singularWord); 1770 } 1771 return "a ".concat(singularWord); 1772 } 1773 var stringUtils = { 1774 asCommaAnd, 1775 containsHtmlTag, 1776 escapeHtml, 1777 splitCase, 1778 isNullOrWhiteSpace, 1779 isWhiteSpace, 1780 isEmpty, 1781 toKebabCase, 1782 toTitleCase, 1783 upperCaseFirstCharacter, 1784 pluralize, 1785 pluralConditional, 1786 padLeft, 1787 padRight, 1788 truncate, 1789 createHash, 1790 replaceAll, 1791 safeParseJson: safeParseJson$1 1792 }; 1793 1794 var stringUtils$1 = /*#__PURE__*/Object.freeze({ 1795 __proto__: null, 1796 asCommaAnd: asCommaAnd, 1797 containsHtmlTag: containsHtmlTag, 1798 createHash: createHash, 1799 createHashSha256: createHashSha256,
1800 default: stringUtils, 1801 defaultControlCompareValue: defaultControlCompareValue, 1802 escapeHtml: escapeHtml, 1803 isEmpty: isEmpty, 1804 isNullOrWhiteSpace: isNullOrWhiteSpace, 1805 isWhiteSpace: isWhiteSpace, 1806 padLeft: padLeft, 1807 padRight: padRight, 1808 pluralConditional: pluralConditional, 1809 pluralize: pluralize, 1810 prependSingularIndefiniteArticle: prependSingularIndefiniteArticle, 1811 replaceAll: replaceAll, 1812 safeParseJson: safeParseJson$1, 1813 splitCase: splitCase, 1814 toKebabCase: toKebabCase, 1815 toTitleCase: toTitleCase, 1816 truncate: truncate, 1817 upperCaseFirstCharacter: upperCaseFirstCharacter 1818 }); 1819 exports('stringUtils', stringUtils$1); 1820 1821 class LocaleDateFormatter { 1822 constructor(jsDateFormatString) { 1823 this.jsDateFormatString = jsDateFormatString; 1824 } 1825 static fromCurrent() { 1826 var date = new Date(2222, 2, 4); 1827 var localeDateString = date.toLocaleDateString(undefined, { 1828 year: "numeric", 1829 month: "numeric", 1830 day: "numeric" 1831 }); 1832 var defaultFormatString = "MM/DD/YYYY"; 1833 var localeFormatString = localeDateString; 1834 if (localeDateString.includes("2222")) { 1835 localeFormatString = localeDateString.replace("2222", "YYYY"); 1836 } else if (localeDateString.includes("22")) { 1837 localeFormatString = localeDateString.replace("22", "YY"); 1838 } else { 1839 return new LocaleDateFormatter(defaultFormatString); 1840 } 1841 if (localeFormatString.includes("03")) { 1842 localeFormatString = localeFormatString.replace("03", "MM"); 1843 } else if (localeFormatString.includes("3")) { 1844 localeFormatString = localeFormatString.replace("3", "M"); 1845 } else { 1846 return new LocaleDateFormatter(defaultFormatString); 1847 } 1848 if (localeFormatString.includes("04")) { 1849 localeFormatString = localeFormatString.replace("04", "DD"); 1850 } else if (localeFormatString.includes("4")) { 1851 localeFormatString = localeFormatString.replace("4", "D"); 1852 } else { 1853 return new LocaleDateFormatter(defaultFormatString); 1854 } 1855 return new LocaleDateFormatter(localeFormatString); 1856 } 1857 get aspDateFormat() { 1858 if (!this.aspDateFormatString) { 1859 this.aspDateFormatString = this.jsDateFormatString.replace(/D/g, "d").replace(/Y/g, "y"); 1860 } 1861 return this.aspDateFormatString; 1862 } 1863 get datePickerFormat() { 1864 if (!this.datePickerFormatString) { 1865 this.datePickerFormatString = this.jsDateFormatString.replace(/D/g, "d").replace(/M/g, "m").replace(/Y/g, "y"); 1866 } 1867 return this.datePickerFormatString; 1868 } 1869 } 1870 1871 var localeDateFormatter = /*#__PURE__*/Object.freeze({ 1872 __proto__: null, 1873 LocaleDateFormatter: LocaleDateFormatter 1874 }); 1875 exports('localeDateFormatter', localeDateFormatter); 1876 1877 function blankIfZero(value) { 1878 return parseInt(value) === 0 ? "" : value; 1879 } 1880 function get12HourValue(hour) { 1881 if (hour === 0) { 1882 return 12; 1883 } else if (hour < 13) { 1884 return hour; 1885 } else { 1886 return hour - 12; 1887 } 1888 } 1889 var englishDayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; 1890 var englishMonthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
1890November", "December"]; 1891 var dateFormatters = { 1892 "yyyyy": date => padLeft(date.year.toString(), 5, "0"), 1893 "yyyy": date => padLeft(date.year.toString(), 4, "0"), 1894 "yyy": date => padLeft(date.year.toString(), 3, "0"), 1895 "yy": date => padLeft((date.year % 100).toString(), 2, "0"), 1896 "y": date => (date.year % 100).toString(), 1897 "MMMM": date => englishMonthNames[date.month - 1], 1898 "MMM": date => englishMonthNames[date.month - 1].substr(0, 3), 1899 "MM": date => padLeft(date.month.toString(), 2, "0"), 1900 "M": date => date.month.toString(), 1901 "dddd": date => englishDayNames[date.dayOfWeek], 1902 "ddd": date => englishDayNames[date.dayOfWeek].substr(0, 3), 1903 "dd": date => padLeft(date.day.toString(), 2, "0"), 1904 "d": date => date.day.toString(), 1905 "fffffff": date => padRight((date.millisecond * 10000).toString(), 7, "0"), 1906 "ffffff": date => padRight((date.millisecond * 1000).toString(), 6, "0"), 1907 "fffff": date => padRight((date.millisecond * 100).toString(), 5, "0"), 1908 "ffff": date => padRight((date.millisecond * 10).toString(), 4, "0"), 1909 "fff": date => padRight(date.millisecond.toString(), 3, "0"), 1910 "ff": date => padRight(Math.floor(date.millisecond / 10).toString(), 2, "0"), 1911 "f": date => padRight(Math.floor(date.millisecond / 100).toString(), 1, "0"), 1912 "FFFFFFF": date => blankIfZero(padRight((date.millisecond * 10000).toString(), 7, "0")), 1913 "FFFFFF": date => blankIfZero(padRight((date.millisecond * 1000).toString(), 6, "0")), 1914 "FFFFF": date => blankIfZero(padRight((date.millisecond * 100).toString(), 5, "0")), 1915 "FFFF": date => blankIfZero(padRight((date.millisecond * 10).toString(), 4, "0")), 1916 "FFF": date => blankIfZero(padRight(date.millisecond.toString(), 3, "0")), 1917 "FF": date => blankIfZero(padRight(Math.floor(date.millisecond / 10).toString(), 2, "0")), 1918 "F": date => blankIfZero(padRight(Math.floor(date.millisecond / 100).toString(), 1, "0")), 1919 "g": date => date.year < 0 ? "B.C." : "A.D.", 1920 "gg": date => date.year < 0 ? "B.C." : "A.D.", 1921 "hh": date => padLeft(get12HourValue(date.hour).toString(), 2, "0"), 1922 "h": date => get12HourValue(date.hour).toString(), 1923 "HH": date => padLeft(date.hour.toString(), 2, "0"), 1924 "H": date => date.hour.toString(), 1925 "mm": date => padLeft(date.minute.toString(), 2, "0"), 1926 "m": date => date.minute.toString(), 1927 "ss": date => padLeft(date.second.toString(), 2, "0"), 1928 "s": date => date.second.toString(), 1929 "K": date => { 1930 var offset = date.offset; 1931 var offsetHour = Math.abs(Math.floor(offset / 60)); 1932 var offsetMinute = Math.abs(offset % 60); 1933 return "".concat(offset >= 0 ? "+" : "-").concat(padLeft(offsetHour.toString(), 2, "0"), ":").concat(padLeft(offsetMinute.toString(), 2, "0")); 1934 }, 1935 "tt": date => date.hour >= 12 ? "PM" : "AM", 1936 "t": date => date.hour >= 12 ? "P" : "A", 1937 "zzz": date => { 1938 var offset = date.offset; 1939 var offsetHour = Math.abs(Math.floor(offset / 60)); 1940 var offsetMinute = Math.abs(offset % 60); 1941 return "".concat(offset >= 0 ? "+" : "-").concat(padLeft(offsetHour.toString(), 2, "0"), ":").concat(padLeft(offsetMinute.toString(), 2, "0")); 1942 }, 1943 "zz": date => { 1944 var offset = date.offset; 1945 var offsetHour = Math.abs(Math.floor(offset / 60)); 1946 return "".concat(offset >= 0 ? "+" : "-").concat(padLeft(offsetHour.toString(), 2, "0")); 1947 }, 1948 "z": date => { 1949 var offset = date.offset; 1950 var offsetHour = Math.abs(Math.floor(offset / 60)); 1951 return "".concat(offset >= 0 ? "+" : "-").concat(offsetHour); 1952 }, 1953 ":": () => ":", 1954 "/": () => "/" 1955 }; 1956 var dateFormatterKeys = new List(Object.keys(dateFormatters)).orderByDescending(k => k.length).toArray(); 1957 var currentLocaleDateFormatter = LocaleDateFormatter.fromCurrent(); 1958 var standardDateFormats = { 1959 "d": date => formatAspDate(date, currentLocaleDateFormatter.aspDateFormat), 1960 "D": date => formatAspDate(date, "dddd, MMMM dd, yyyy"), 1961 "t": date => formatAspDate(date, "h:mm tt"), 1962 "T": date => formatAspDate(date, "h:mm:ss tt"), 1963 "M": date => formatAspDate(date, "MMMM dd"), 1964 "m": date => formatAspDate(date, "MMMM dd"), 1965 "Y": date => formatAspDate(date, "yyyy MMMM"), 1966 "y": date => formatAspDate(date, "yyyy MMMM"), 1967 "f": date => "".concat(formatAspDate(date, "D"), " ").concat(formatAspDate(date, "t")), 1968 "F": date => "".concat(formatAspDate(date, "D"), " ").concat(formatAspDate(date, "T")), 1969 "g": date => "".concat(formatAspDate(date, "d"), " ").concat(formatAspDate(date, "t")), 1970 "G": date => "".concat(formatAspDate(date, "d"), " ").concat(formatAspDate(date, "T")), 1971 "o": date => formatAspDate(date, "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffzzz"), 1972 "O": date => formatAspDate(date, "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffzzz"), 1973 "r": date => formatAspDate(date, "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'"), 1974 "R": date => formatAspDate(date, "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'"), 1975 "s": date => formatAspDate(date, "yyyy'-'MM'-'dd'T'HH':'mm':'ss"),
1976 "u": date => formatAspDate(date, "yyyy'-'MM'-'dd HH':'mm':'ss'Z'"), 1977 "U": date => { 1978 return formatAspDate(date.universalDateTime, "F"); 1979 } 1980 }; 1981 function formatAspCustomDate(date, format) { 1982 var result = ""; 1983 for (var i = 0; i < format.length;) { 1984 var matchFound = false; 1985 var _iterator = _createForOfIteratorHelper(dateFormatterKeys), 1986 _step; 1987 try { 1988 for (_iterator.s(); !(_step = _iterator.n()).done;) { 1989 var k = _step.value; 1990 if (format.substr(i, k.length) === k) { 1991 result += dateFormatters[k](date); 1992 matchFound = true; 1993 i += k.length; 1994 break; 1995 } 1996 } 1997 } catch (err) { 1998 _iterator.e(err); 1999 } finally { 2000 _iterator.f(); 2001 } 2002 if (matchFound) { 2003 continue; 2004 } 2005 if (format[i] === "\\") { 2006 i++; 2007 if (i < format.length) { 2008 result += format[i++]; 2009 } 2010 } else if (format[i] === "'") { 2011 i++; 2012 for (; i < format.length && format[i] !== "'"; i++) { 2013 result += format[i]; 2014 } 2015 i++; 2016 } else if (format[i] === '"') { 2017 i++; 2018 for (; i < format.length && format[i] !== '"'; i++) { 2019 result += format[i]; 2020 } 2021 i++; 2022 } else { 2023 result += format[i++]; 2024 } 2025 } 2026 return result; 2027 } 2028 function formatAspStandardDate(date, format) { 2029 if (standardDateFormats[format] !== undefined) { 2030 return standardDateFormats[format](date); 2031 } 2032 return format; 2033 } 2034 function formatAspDate(date, format) { 2035 if (format.length === 1) { 2036 return formatAspStandardDate(date, format); 2037 } else if (format.length === 2 && format[0] === "%") { 2038 return formatAspCustomDate(date, format[1]); 2039 } else { 2040 return formatAspCustomDate(date, format); 2041 } 2042 } 2043 2044 var aspDateFormat = /*#__PURE__*/Object.freeze({ 2045 __proto__: null, 2046 formatAspDate: formatAspDate 2047 }); 2048 exports('aspDateFormat', aspDateFormat); 2049 2050 var DateTimeFormat = { 2051 DateFull: { 2052 year: "numeric", 2053 month: "long", 2054 day: "numeric" 2055 }, 2056 DateMedium: { 2057 year: "numeric", 2058 month: "short", 2059 day: "numeric" 2060 }, 2061 DateShort: { 2062 year: "numeric", 2063 month: "numeric", 2064 day: "numeric" 2065 }, 2066 TimeShort: { 2067 hour: "numeric", 2068 minute: "numeric" 2069 }, 2070 TimeWithSeconds: { 2071 hour: "numeric", 2072 minute: "numeric", 2073 second: "numeric" 2074 }, 2075 DateTimeShort: { 2076 year: "numeric", 2077 month: "numeric", 2078 day: "numeric", 2079 hour: "numeric", 2080 minute: "numeric" 2081 }, 2082 DateTimeShortWithSeconds: { 2083 year: "numeric", 2084 month: "numeric", 2085 day: "numeric", 2086 hour: "numeric", 2087 minute: "numeric", 2088 second: "numeric" 2089 }, 2090 DateTimeMedium: { 2091 year: "numeric", 2092 month: "short", 2093 day: "numeric", 2094 hour: "numeric", 2095 minute: "numeric" 2096 }, 2097 DateTimeMediumWithSeconds: { 2098 year: "numeric", 2099 month: "short", 2100 day: "numeric", 2101 hour: "numeric", 2102 minute: "numeric", 2103 second: "numeric" 2104 }, 2105 DateTimeFull: { 2106 year: "numeric", 2107 month: "long", 2108 day: "numeric", 2109 hour: "numeric", 2110 minute: "numeric" 2111 }, 2112 DateTimeFullWithSeconds: { 2113 year: "numeric", 2114 month: "long", 2115 day: "numeric", 2116 hour: "numeric", 2117 minute: "numeric", 2118 second: "numeric" 2119 } 2120 }; 2121 class RockDateTime { 2122 constructor(dateTime) { 2123 this.dateTime = dateTime; 2124 } 2125 static fromParts(year, month, day, hour, minute, second, millisecond, zone) { 2126 var luxonZone; 2127 if (zone !== undefined) { 2128 if (typeof zone === "number") { 2129 luxonZone = FixedOffsetZone.instance(zone); 2130 } else { 2131 luxonZone = zone; 2132 } 2133 } 2134 var dateTime = DateTime.fromObject({ 2135 year, 2136 month, 2137 day, 2138 hour, 2139 minute, 2140 second, 2141 millisecond 2142 }, { 2143 zone: luxonZone 2144 }); 2145 if (!dateTime.isValid) { 2146 return null; 2147 } 2148 return new RockDateTime(dateTime); 2149 } 2150 static fromMilliseconds(milliseconds) { 2151 var dateTime = DateTime.fromMillis(milliseconds); 2152 if (!dateTime.isValid) { 2153 return null; 2154 } 2155 return new RockDateTime(dateTime); 2156 } 2157 static fromJSDate(date) { 2158 var dateTime = DateTime.fromJSDate(date); 2159 if (!dateTime.isValid) { 2160 return null; 2161 } 2162 return new RockDateTime(dateTime); 2163 } 2164 static parseISO(dateString) { 2165 var dateTime = DateTime.fromISO(dateString, { 2166 setZone: true 2167 }); 2168 if (!dateTime.isValid) { 2169 return null; 2170 } 2171 return new RockDateTime(dateTime); 2172 } 2173 static parseHTTP(dateString) { 2174 var dateTime = DateTime.fromHTTP(dateString, { 2175 setZone: true 2176 }); 2177 if (!dateTime.isValid) { 2178 return null; 2179 } 2180 return new RockDateTime(dateTime); 2181 } 2182 static now() { 2183 return new RockDateTime(DateTime.now()); 2184 } 2185 static utcNow() { 2186 return new RockDateTime(DateTime.now().toUTC()); 2187 } 2188 get date() { 2189 var date = RockDateTime.fromParts(this.year, this.month, this.day, 0, 0, 0, 0, this.offset); 2190 if (date === null) { 2191 throw "Could not convert to date instance."; 2192 } 2193 return date; 2194 } 2195 get rawDate() { 2196 var date = RockDateTime.fromParts(this.year, this.month, this.day, 0, 0, 0, 0); 2197 if (date === null) { 2198 throw "Could not convert to date instance."; 2199 } 2200 return date; 2201 } 2202 get day() { 2203 return this.dateTime.day; 2204 } 2205 get dayOfWeek() { 2206 switch (this.dateTime.weekday) { 2207 case 1: 2208 return DayOfWeek.Monday; 2209 case 2: 2210 return DayOfWeek.Tuesday; 2211 case 3: 2212 return DayOfWeek.Wednesday; 2213 case 4: 2214 return DayOfWeek.Thursday; 2215 case 5: 2216 return DayOfWeek.Friday; 2217 case 6: 2218 return DayOfWeek.Saturday; 2219 case 7: 2220 return DayOfWeek.Sunday; 2221 } 2222 throw "Could not determine day of week."; 2223 } 2224 get dayOfYear() { 2225 return this.dateTime.ordinal; 2226 } 2227 get hour() { 2228 return this.dateTime.hour; 2229 } 2230 get millisecond() { 2231 return this.dateTime.millisecond; 2232 } 2233 get minute() { 2234 return this.dateTime.minute; 2235 } 2236 get month() { 2237 return this.dateTime.month; 2238 } 2239 get offset() { 2240 return this.dateTime.offset; 2241 } 2242 get second() { 2243 return this.dateTime.second; 2244 } 2245 get year() { 2246 return this.dateTime.year; 2247 } 2248 get localDateTime() { 2249 return new RockDateTime(this.dateTime.toLocal()); 2250 } 2251 get organizationDateTime() { 2252 throw "Not Implemented"; 2253 } 2254 get universalDateTime() { 2255 return new RockDateTime(this.dateTime.toUTC()); 2256 } 2257 addDays(days) { 2258 var dateTime = this.dateTime.plus({ 2259 days: days 2260 }); 2261 if (!dateTime.isValid) {
2262 throw "Operation produced an invalid date."; 2263 } 2264 return new RockDateTime(dateTime); 2265 } 2266 startOfWeek() { 2267 var dateTime = this.dateTime.startOf("week"); 2268 if (!dateTime.isValid) { 2269 throw "Operation produced an invalid date."; 2270 } 2271 return new RockDateTime(dateTime); 2272 } 2273 startOfMonth() { 2274 var dateTime = this.dateTime.startOf("month"); 2275 if (!dateTime.isValid) { 2276 throw "Operation produced an invalid date."; 2277 } 2278 return new RockDateTime(dateTime); 2279 } 2280 endOfMonth() { 2281 var dateTime = this.dateTime.endOf("month"); 2282 if (!dateTime.isValid) { 2283 throw "Operation produced an invalid date."; 2284 } 2285 return new RockDateTime(dateTime); 2286 } 2287 addHours(hours) { 2288 var dateTime = this.dateTime.plus({ 2289 hours: hours 2290 }); 2291 if (!dateTime.isValid) { 2292 throw "Operation produced an invalid date."; 2293 } 2294 return new RockDateTime(dateTime); 2295 } 2296 addMilliseconds(milliseconds) { 2297 var dateTime = this.dateTime.plus({ 2298 milliseconds: milliseconds 2299 }); 2300 if (!dateTime.isValid) { 2301 throw "Operation produced an invalid date."; 2302 } 2303 return new RockDateTime(dateTime); 2304 } 2305 addMinutes(minutes) { 2306 var dateTime = this.dateTime.plus({ 2307 minutes: minutes 2308 }); 2309 if (!dateTime.isValid) { 2310 throw "Operation produced an invalid date."; 2311 } 2312 return new RockDateTime(dateTime); 2313 } 2314 addMonths(months) { 2315 var dateTime = this.dateTime.plus({ 2316 months: months 2317 }); 2318 if (!dateTime.isValid) { 2319 throw "Operation produced an invalid date."; 2320 } 2321 return new RockDateTime(dateTime); 2322 } 2323 addSeconds(seconds) { 2324 var dateTime = this.dateTime.plus({ 2325 seconds: seconds 2326 }); 2327 if (!dateTime.isValid) { 2328 throw "Operation produced an invalid date."; 2329 } 2330 return new RockDateTime(dateTime); 2331 } 2332 addYears(years) { 2333 var dateTime = this.dateTime.plus({ 2334 years: years 2335 }); 2336 if (!dateTime.isValid) { 2337 throw "Operation produced an invalid date."; 2338 } 2339 return new RockDateTime(dateTime); 2340 } 2341 toMilliseconds() { 2342 return this.dateTime.toMillis(); 2343 } 2344 toOffset(zone) { 2345 var dateTime; 2346 if (typeof zone === "number") { 2347 dateTime = this.dateTime.setZone(FixedOffsetZone.instance(zone)); 2348 } else { 2349 dateTime = this.dateTime.setZone(zone); 2350 } 2351 if (!dateTime.isValid) { 2352 throw "Invalid time zone specified."; 2353 } 2354 return new RockDateTime(dateTime); 2355 } 2356 toASPString(format) { 2357 return formatAspDate(this, format); 2358 } 2359 toISOString() { 2360 return this.dateTime.toISO(); 2361 } 2362 toLocaleString(format) { 2363 return this.dateTime.toLocaleString(format); 2364 } 2365 toElapsedString(currentDateTime) { 2366 var msPerSecond = 1000; 2367 var msPerMinute = 1000 * 60; 2368 var msPerHour = 1000 * 60 * 60; 2369 var hoursPerDay = 24; 2370 var daysPerYear = 365; 2371 var start = new RockDateTime(this.dateTime); 2372 var end = currentDateTime !== null && currentDateTime !== void 0 ? currentDateTime : RockDateTime.now(); 2373 var direction = "Ago"; 2374 var totalMs = end.toMilliseconds() - start.toMilliseconds(); 2375 if (totalMs < 0) { 2376 direction = "From Now"; 2377 totalMs = Math.abs(totalMs); 2378 start = end; 2379 end = new RockDateTime(this.dateTime); 2380 } 2381 var totalSeconds = totalMs / msPerSecond; 2382 var totalMinutes = totalMs / msPerMinute; 2383 var totalHours = totalMs / msPerHour; 2384 var totalDays = totalHours / hoursPerDay; 2385 if (totalHours < 24) { 2386 if (totalSeconds < 2) { 2387 return "1 Second ".concat(direction); 2388 } 2389 if (totalSeconds < 60) { 2390 return "".concat(Math.floor(totalSeconds), " Seconds ").concat(direction); 2391 } 2392 if (totalMinutes < 2) { 2393 return "1 Minute ".concat(direction); 2394 } 2395 if (totalMinutes < 60) { 2396 return "".concat(Math.floor(totalMinutes), " Minutes ").concat(direction); 2397 } 2398 if (totalHours < 2) { 2399 return "1 Hour ".concat(direction); 2400 } 2401 if (totalHours < 60) { 2402 return "".concat(Math.floor(totalHours), " Hours ").concat(direction); 2403 } 2404 } 2405 if (totalDays < 2) { 2406 return "1 Day ".concat(direction); 2407 } 2408 if (totalDays < 31) { 2409 return "".concat(Math.floor(totalDays), " Days ").concat(direction); 2410 } 2411 var totalMonths = end.totalMonths(start); 2412 if (totalMonths <= 1) { 2413 return "1 Month ".concat(direction); 2414 } 2415 if (totalMonths <= 18) { 2416 return "".concat(Math.round(totalMonths), " Months ").concat(direction); 2417 } 2418 var totalYears = Math.floor(totalDays / daysPerYear); 2419 if (totalYears <= 1) { 2420 return "1 Year ".concat(direction); 2421 } 2422 return "".concat(Math.round(totalYears), " Years ").concat(direction); 2423 } 2424 toElapsedShortString(currentDateTime) { 2425 var start = this.dateTime; 2426 var end = (currentDateTime !== null && currentDateTime !== void 0 ? currentDateTime : RockDateTime.now()).dateTime; 2427 var diffMs = end.toMillis() - start.toMillis(); 2428 diffMs = Math.abs(diffMs); 2429 var seconds = diffMs / 1000; 2430 var minutes = seconds / 60; 2431 var hours = minutes / 60; 2432 var days = hours / 24; 2433 var weeks = days / 7; 2434 var years = days / 365; 2435 if (seconds < 60) { 2436 return "".concat(Math.floor(seconds), "s"); 2437 } 2438 if (minutes < 60) { 2439 return "".concat(Math.floor(minutes), "m"); 2440 } 2441 if (hours < 24) { 2442 return "".concat(Math.floor(hours), "h"); 2443 } 2444 if (days < 14) { 2445 return "".concat(Math.floor(days), "d"); 2446 } 2447 if (weeks < 52) { 2448 return "".concat(Math.floor(weeks), "w"); 2449 } 2450 return "".concat(Math.floor(years), "y"); 2451 } 2452 toHTTPString() { 2453 return this.dateTime.toHTTP(); 2454 } 2455 valueOf() { 2456 return this.dateTime.valueOf(); 2457 } 2458 toString() {
2459 return this.toLocaleString(DateTimeFormat.DateTimeFull); 2460 } 2461 isEqualTo(otherDateTime) { 2462 return this.dateTime.toMillis() === otherDateTime.dateTime.toMillis(); 2463 } 2464 isLaterThan(otherDateTime) { 2465 return this.dateTime.toMillis() > otherDateTime.dateTime.toMillis(); 2466 } 2467 isEarlierThan(otherDateTime) { 2468 return this.dateTime.toMillis() < otherDateTime.dateTime.toMillis(); 2469 } 2470 compareTo(otherDateTime) { 2471 if (this.isEqualTo(otherDateTime)) { 2472 return 0; 2473 } else if (this.isEarlierThan(otherDateTime)) { 2474 return -1; 2475 } else { 2476 return 1; 2477 } 2478 } 2479 humanizeElapsed(otherDateTime) { 2480 otherDateTime = otherDateTime !== null && otherDateTime !== void 0 ? otherDateTime : RockDateTime.now(); 2481 var totalSeconds = Math.floor((otherDateTime.dateTime.toMillis() - this.dateTime.toMillis()) / 1000); 2482 if (totalSeconds <= 1) { 2483 return "right now"; 2484 } else if (totalSeconds < 60) { 2485 return "".concat(totalSeconds, " seconds ago"); 2486 } else if (totalSeconds >= 60 && totalSeconds <= 119) { 2487 return "1 minute ago"; 2488 } else if (totalSeconds < 3600) { 2489 return "".concat(Math.floor(totalSeconds / 60), " minutes ago"); 2490 } else if (totalSeconds < 86400) { 2491 return "".concat(Math.floor(totalSeconds / 3600), " hours ago"); 2492 } else if (totalSeconds < 31536000) { 2493 return "".concat(Math.floor(totalSeconds / 86400), " days ago"); 2494 } else { 2495 return "".concat(Math.floor(totalSeconds / 31536000), " years ago"); 2496 } 2497 } 2498 totalMonths(otherDateTime) { 2499 return this.year * 12 + this.month - (otherDateTime.year * 12 + otherDateTime.month); 2500 } 2501 } 2502 function compareRockDateTimes(a, b) { 2503 return a.compareTo(b); 2504 } 2505 2506 var rockDateTime = /*#__PURE__*/Object.freeze({ 2507 __proto__: null, 2508 DateTimeFormat: DateTimeFormat, 2509 DayOfWeek: DayOfWeek, 2510 RockDateTime: RockDateTime, 2511 compareRockDateTimes: compareRockDateTimes 2512 }); 2513 exports('rockDateTime', rockDateTime); 2514 2515 function shortcutCancelledEvent(listener) { 2516 window.setTimeout(listener, 0); 2517 } 2518 function isCancellationToken(thing) { 2519 if (thing === CancellationTokenNone || thing === CancellationTokenCancelled) { 2520 return true; 2521 } 2522 if (thing instanceof MutableToken) { 2523 return true; 2524 } 2525 if (!thing || typeof thing !== "object") { 2526 return false; 2527 } 2528 return typeof thing.isCancellationRequested === "boolean" && typeof thing.onCancellationRequested === "function"; 2529 } 2530 var CancellationTokenNone = Object.freeze({ 2531 isCancellationRequested: false, 2532 onCancellationRequested() {} 2533 }); 2534 var CancellationTokenCancelled = Object.freeze({ 2535 isCancellationRequested: true, 2536 onCancellationRequested: shortcutCancelledEvent 2537 }); 2538 class MutableToken { 2539 constructor() { 2540 _defineProperty(this, "isCancelled", false); 2541 _defineProperty(this, "emitter", null); 2542 } 2543 cancel() { 2544 if (!this.isCancelled) { 2545 this.isCancelled = true; 2546 if (this.emitter) { 2547 this.emitter.emit("cancel", undefined); 2548 this.emitter = null; 2549 } 2550 } 2551 } 2552 get isCancellationRequested() { 2553 return this.isCancelled; 2554 } 2555 onCancellationRequested(listener) { 2556 if (this.isCancelled) { 2557 return shortcutCancelledEvent(listener); 2558 } 2559 if (!this.emitter) { 2560 this.emitter = mitt(); 2561 } 2562 this.emitter.on("cancel", listener); 2563 } 2564 } 2565 class CancellationTokenSource { 2566 constructor(parent) { 2567 _defineProperty(this, "internalToken", undefined); 2568 if (parent) { 2569 parent.onCancellationRequested(() => this.cancel()); 2570 } 2571 } 2572 get token() { 2573 if (!this.internalToken) { 2574 this.internalToken = new MutableToken(); 2575 } 2576 return this.internalToken; 2577 } 2578 cancel() { 2579 if (!this.internalToken) { 2580 this.internalToken = CancellationTokenCancelled; 2581 } else if (this.internalToken instanceof MutableToken) { 2582 this.internalToken.cancel(); 2583 } 2584 } 2585 } 2586 2587 var cancellation = /*#__PURE__*/Object.freeze({ 2588 __proto__: null, 2589 CancellationTokenCancelled: CancellationTokenCancelled, 2590 CancellationTokenNone: CancellationTokenNone, 2591 CancellationTokenSource: CancellationTokenSource, 2592 isCancellationToken: isCancellationToken 2593 }); 2594 exports('cancellation', cancellation); 2595 2596 function getUniqueCssSelector(el) { 2597 var path = []; 2598 var parent = el.parentNode; 2599 while (parent) { 2600 path.unshift("".concat(el.tagName, ":nth-child(").concat([].indexOf.call(parent.children, el) + 1, ")")); 2601 el = parent; 2602 parent = el.parentNode; 2603 } 2604 return "".concat(path.join(" > ")).toLowerCase(); 2605 } 2606 function* getAncestors(element) { 2607 var parent = element.parentElement; 2608 while (parent) { 2609 yield parent; 2610 parent = parent.parentElement; 2611 } 2612 } 2613 function isElementFullyVisible(element) { 2614 var rect = element.getBoundingClientRect(); 2615 return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth); 2616 } 2617 function scrollElementStartToTop(element) { 2618 var isWithinScrolledContainer = Enumerable.from(getAncestors(element)).any(ancestorElement => { 2619 var _getComputedStyle = getComputedStyle(ancestorElement), 2620 overflowY = _getComputedStyle.overflowY; 2621 var isScrollable = overflowY === "scroll" || overflowY === "auto"; 2622 return isScrollable && ancestorElement.scrollHeight > ancestorElement.clientHeight; 2623 }); 2624 if (isWithinScrolledContainer) { 2625 element.scrollIntoView({ 2626 block: "start", 2627 behavior: "smooth" 2628 }); 2629 } else { 2630 var rect = element.getBoundingClientRect(); 2631 var desiredLeft = rect.left < 0 ? 0 : rect.left; 2632 var desiredTop = 0; 2633 var elementsAtDesiredLocation = document.elementsFromPoint(desiredLeft + 1, desiredTop + 1); 2634 var fixedElementAtDesiredLocation = elementsAtDesiredLocation.find(el => getComputedStyle(el).position === "fixed"); 2635 if (fixedElementAtDesiredLocation) { 2636 var _fixedElementAtDesire = fixedElementAtDesiredLocation.getBoundingClientRect(), 2637 fixedHeight = _fixedElementAtDesire.height; 2638 desiredTop = fixedHeight; 2639 } 2640 window.scrollBy({ 2641 top: rect.top - desiredTop, 2642 behavior: "smooth" 2643 }); 2644 } 2645 } 2646 function findDirectChildContaining(element, descendantElement) {
2647 var current = descendantElement; 2648 while (current && current !== element) { 2649 if (current.parentElement === element && isHTMLElement(current)) { 2650 return current; 2651 } 2652 current = current.parentElement; 2653 } 2654 return null; 2655 } 2656 function findNearestIFrameElementFromPoint(iframe, x, y, selector) { 2657 var _iframe$contentWindow; 2658 var xRange = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 10; 2659 var yRange = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 10; 2660 var iframeDoc = iframe.contentDocument || ((_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.document); 2661 if (!iframeDoc) { 2662 console.error("Unable to access iframe content."); 2663 return { 2664 element: null, 2665 isAbove: false, 2666 isBelow: false, 2667 isLeft: false, 2668 isRight: false 2669 }; 2670 } 2671 var iframeRect = iframe.getBoundingClientRect(); 2672 var closestElement = null; 2673 var isAbove = false; 2674 var isBelow = false; 2675 var isLeft = false; 2676 var isRight = false; 2677 var smallestDistance = Infinity; 2678 var _loop = function _loop(dx) { 2679 var _loop2 = function _loop2(dy) { 2680 Enumerable.from(iframeDoc.elementsFromPoint(x + dx, y + dy)).where(element => element.matches(selector)).ofType(isHTMLElement).forEach(element => { 2681 var rect = element.getBoundingClientRect(); 2682 var elementX = rect.left - iframeRect.left; 2683 var elementY = rect.top - iframeRect.top; 2684 var distance = Math.sqrt(Math.pow(elementX - x, 2) + Math.pow(elementY - y, 2)); 2685 if (distance < smallestDistance) { 2686 smallestDistance = distance; 2687 closestElement = element; 2688 isAbove = dy < 0; 2689 isBelow = dy > 0; 2690 isLeft = dx < 0; 2691 isRight = dx > 0; 2692 } 2693 }); 2694 }; 2695 for (var dy = -yRange; dy <= yRange; dy += 1) { 2696 _loop2(dy); 2697 } 2698 }; 2699 for (var dx = -xRange; dx <= xRange; dx += 1) { 2700 _loop(dx); 2701 } 2702 return { 2703 element: closestElement, 2704 isAbove, 2705 isBelow, 2706 isLeft, 2707 isRight 2708 }; 2709 } 2710 function getWindow(el) { 2711 return el.ownerDocument.defaultView; 2712 } 2713 function isElement(el) { 2714 var _el$ownerDocument; 2715 var elWindow = el === null || el === void 0 || (_el$ownerDocument = el["ownerDocument"]) === null || _el$ownerDocument === void 0 ? void 0 : _el$ownerDocument["defaultView"]; 2716 return el instanceof Element || !!elWindow && el instanceof elWindow.Element; 2717 } 2718 function isHTMLElement(el) { 2719 var _el$ownerDocument2; 2720 var elWindow = el === null || el === void 0 || (_el$ownerDocument2 = el["ownerDocument"]) === null || _el$ownerDocument2 === void 0 ? void 0 : _el$ownerDocument2["defaultView"]; 2721 return el instanceof HTMLElement || !!elWindow && el instanceof elWindow.HTMLElement || typeof el === "object" && el !== null && typeof el.tagName === "string" && typeof el.classList === "object"; 2722 } 2723 function isHTMLTableElement(el) { 2724 var _el$ownerDocument3; 2725 var elWindow = el === null || el === void 0 || (_el$ownerDocument3 = el["ownerDocument"]) === null || _el$ownerDocument3 === void 0 ? void 0 : _el$ownerDocument3["defaultView"]; 2726 return el instanceof HTMLTableElement || !!elWindow && el instanceof elWindow.HTMLTableElement; 2727 } 2728 function isHTMLAnchorElement(el) { 2729 var _el$ownerDocument4; 2730 var elWindow = el === null || el === void 0 || (_el$ownerDocument4 = el["ownerDocument"]) === null || _el$ownerDocument4 === void 0 ? void 0 : _el$ownerDocument4["defaultView"]; 2731 return !!elWindow && el instanceof elWindow.HTMLAnchorElement; 2732 } 2733 function isDocument(doc) { 2734 var docWindow = doc === null || doc === void 0 ? void 0 : doc["defaultView"]; 2735 return !!docWindow && doc instanceof docWindow.Document; 2736 } 2737 function isMouseEvent(event) { 2738 var eventWindow = event === null || event === void 0 ? void 0 : event["view"]; 2739 return !!eventWindow && event instanceof eventWindow.MouseEvent; 2740 } 2741 function isTouchEvent(event) { 2742 var eventWindow = event === null || event === void 0 ? void 0 : event["view"]; 2743 return !!(eventWindow !== null && eventWindow !== void 0 && eventWindow.TouchEvent) && event instanceof eventWindow.TouchEvent; 2744 } 2745 function removeWhiteSpaceFromElement(element, selector) { 2746 var _element$textContent; 2747 if ((!selector || element.matches(selector)) && element.childNodes.length && Enumerable.from(element.childNodes).all(n => n.nodeType === Node.TEXT_NODE) && !((_element$textContent = element.textContent) !== null && _element$textContent !== void 0 && _element$textContent.trim())) { 2748 element.innerHTML = ""; 2749 } 2750 } 2751 function removeWhiteSpaceFromElementAndChildElements(element, selector) { 2752 removeWhiteSpaceFromChildElements(element, selector); 2753 removeWhiteSpaceFromElement(element, selector); 2754 } 2755 function removeWhiteSpaceFromChildElements(element, selector) { 2756 if (selector) { 2757 element.querySelectorAll(selector).forEach(el => { 2758 removeWhiteSpaceFromElement(el, selector); 2759 }); 2760 } else {
2761 Enumerable.from(element.children).forEach(el => { 2762 removeWhiteSpaceFromElement(el, selector); 2763 }); 2764 } 2765 } 2766 function replaceTagName(oldElement, newTagName) { 2767 var newElement = oldElement.ownerDocument.createElement(newTagName); 2768 Array.from(oldElement.attributes).forEach(attr => newElement.setAttribute(attr.name, attr.value)); 2769 while (oldElement.firstChild) { 2770 newElement.appendChild(oldElement.firstChild); 2771 } 2772 oldElement.replaceWith(newElement); 2773 return newElement; 2774 } 2775 2776 var dom = /*#__PURE__*/Object.freeze({ 2777 __proto__: null, 2778 findDirectChildContaining: findDirectChildContaining, 2779 findNearestIFrameElementFromPoint: findNearestIFrameElementFromPoint, 2780 getAncestors: getAncestors, 2781 getUniqueCssSelector: getUniqueCssSelector, 2782 getWindow: getWindow, 2783 isDocument: isDocument, 2784 isElement: isElement, 2785 isElementFullyVisible: isElementFullyVisible, 2786 isHTMLAnchorElement: isHTMLAnchorElement, 2787 isHTMLElement: isHTMLElement, 2788 isHTMLTableElement: isHTMLTableElement, 2789 isMouseEvent: isMouseEvent, 2790 isTouchEvent: isTouchEvent, 2791 removeWhiteSpaceFromChildElements: removeWhiteSpaceFromChildElements, 2792 removeWhiteSpaceFromElement: removeWhiteSpaceFromElement, 2793 removeWhiteSpaceFromElementAndChildElements: removeWhiteSpaceFromElementAndChildElements, 2794 replaceTagName: replaceTagName, 2795 scrollElementStartToTop: scrollElementStartToTop 2796 }); 2797 exports('dom', dom); 2798 2799 function deepEqual(a, b, strict) { 2800 if (strict && a === b) { 2801 return true; 2802 } else if (!strict && a == b) { 2803 return true; 2804 } 2805 if (typeof a === "number" && typeof b === "number" && isNaN(a) && isNaN(b)) { 2806 return true; 2807 } 2808 if (a && b && typeof a === "object" && typeof b === "object") { 2809 if (Array.isArray(a) !== Array.isArray(b)) { 2810 return false; 2811 } 2812 if (Array.isArray(a) && Array.isArray(b)) { 2813 if (a.length !== b.length) { 2814 return false; 2815 } 2816 for (var i = 0; i < a.length; i++) { 2817 if (!deepEqual(a[i], b[i], strict)) { 2818 return false; 2819 } 2820 } 2821 return true; 2822 } else { 2823 if (a.constructor !== b.constructor) { 2824 return false; 2825 } 2826 if (isHTMLElement(a) && isHTMLElement(b)) { 2827 return a === b; 2828 } 2829 var aEntries = Object.entries(a).sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0); 2830 var bEntries = Object.entries(b).sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0); 2831 if (aEntries.length !== bEntries.length) { 2832 return false; 2833 } 2834 for (var _i = 0; _i < aEntries.length; _i++) { 2835 var aEntry = aEntries[_i]; 2836 var bEntry = bEntries[_i]; 2837 if (!deepEqual(aEntry[0], bEntry[0], true)) { 2838 return false; 2839 } 2840 if (!deepEqual(aEntry[1], bEntry[1], strict)) { 2841 return false; 2842 } 2843 } 2844 return true; 2845 } 2846 } 2847 return false; 2848 } 2849 function debounce(fn) { 2850 var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250; 2851 var eager = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 2852 var timeout = null; 2853 return () => { 2854 if (timeout) { 2855 clearTimeout(timeout); 2856 } else if (eager) { 2857 fn(); 2858 timeout = setTimeout(() => timeout = null, delay); 2859 return; 2860 } 2861 timeout = setTimeout(() => { 2862 timeout = null; 2863 fn(); 2864 }, delay); 2865 }; 2866 } 2867 function debounceAsync(fn, options) { 2868 var _options$delay, _options$eager; 2869 var delay = (_options$delay = options === null || options === void 0 ? void 0 : options.delay) !== null && _options$delay !== void 0 ? _options$delay : 250; 2870 var eager = (_options$eager = options === null || options === void 0 ? void 0 : options.eager) !== null && _options$eager !== void 0 ? _options$eager : false;
2871 var timeout = null; 2872 var source = null; 2873 var isEagerExecutionInProgress = false; 2874 var pendingPromise = null; 2875 return function () { 2876 var _ref = _asyncToGenerator(function* (parentCancellationToken) { 2877 var _source; 2878 (_source = source) === null || _source === void 0 || _source.cancel(); 2879 if (timeout) { 2880 clearTimeout(timeout); 2881 timeout = null; 2882 } else if (eager && !isEagerExecutionInProgress) { 2883 isEagerExecutionInProgress = true; 2884 source = new CancellationTokenSource(parentCancellationToken); 2885 timeout = setTimeout(() => { 2886 timeout = null; 2887 isEagerExecutionInProgress = false; 2888 }, delay); 2889 try { 2890 pendingPromise = fn(source.token); 2891 return yield pendingPromise; 2892 } catch (e) { 2893 console.error(e || "Unknown error while debouncing async function call."); 2894 throw e; 2895 } 2896 } 2897 source = new CancellationTokenSource(parentCancellationToken); 2898 var cts = source; 2899 return new Promise((resolve, reject) => { 2900 timeout = setTimeout(_asyncToGenerator(function* () { 2901 try { 2902 pendingPromise = fn(cts.token); 2903 resolve(yield pendingPromise); 2904 } catch (e) { 2905 console.error(e || "Unknown error while debouncing async function call."); 2906 reject(e); 2907 } 2908 timeout = null; 2909 isEagerExecutionInProgress = false; 2910 }), delay); 2911 }); 2912 }); 2913 return function (_x) { 2914 return _ref.apply(this, arguments); 2915 }; 2916 }(); 2917 } 2918 function isNullish(value) { 2919 return (value !== null && value !== void 0 ? value : null) === null; 2920 } 2921 function isNotNullish(item) { 2922 return !isNullish(item); 2923 } 2924 function assertType(value) { 2925 return true; 2926 } 2927 2928 var util = /*#__PURE__*/Object.freeze({ 2929 __proto__: null, 2930 assertType: assertType, 2931 debounce: debounce, 2932 debounceAsync: debounceAsync, 2933 deepEqual: deepEqual, 2934 isNotNullish: isNotNullish, 2935 isNullish: isNullish 2936 }); 2937 exports('util', util); 2938 2939 var PageMessages = { 2940 QueryStringChanged: "page.core.queryStringChanged", 2941 ContextEntityChanged: "page.core.contextEntityChanged" 2942 }; 2943 var BlockMessages = { 2944 BeginEdit: "block.core.beginEdit", 2945 EndEdit: "block.core.endEdit" 2946 }; 2947 function useBrowserBus(options) { 2948 return new BrowserBus(options !== null && options !== void 0 ? options : {}); 2949 } 2950 var customDomEventName = "rockMessage"; 2951 class BrowserBus { 2952 constructor(options) { 2953 _defineProperty(this, "handlers", []); 2954 this.options = _objectSpread2({}, options); 2955 this.eventListener = e => this.onEvent(e); 2956 document.addEventListener(customDomEventName, this.eventListener); 2957 } 2958 onEvent(event) { 2959 if (!(event instanceof CustomEvent)) { 2960 return; 2961 } 2962 var message = event.detail; 2963 if (!message.name) { 2964 return; 2965 } 2966 if (typeof message.timestamp === "undefined") { 2967 message = _objectSpread2(_objectSpread2({}, message), {}, { 2968 timestamp: 0 2969 }); 2970 } 2971 this.onMessage(message); 2972 } 2973 onMessage(message) { 2974 var handlers = [...this.handlers]; 2975 for (var _i = 0, _handlers = handlers; _i < _handlers.length; _i++) { 2976 var handler = _handlers[_i]; 2977 try { 2978 if (handler.name && handler.name !== message.name) { 2979 continue; 2980 } 2981 if (handler.blockType && !areEqual(handler.blockType, message.blockType)) { 2982 continue; 2983 } 2984 if (handler.block && !areEqual(handler.block, message.block)) { 2985 continue; 2986 } 2987 handler.callback(message); 2988 } catch (e) { 2989 console.error(e); 2990 } 2991 } 2992 } 2993 dispose() { 2994 document.removeEventListener(customDomEventName, this.eventListener); 2995 this.handlers.splice(0, this.handlers.length); 2996 } 2997 publish(messageName, data) { 2998 this.publishMessage({ 2999 name: messageName, 3000 timestamp: Date.now(), 3001 blockType: this.options.blockType, 3002 block: this.options.block, 3003 data 3004 }); 3005 } 3006 publishMessage(message) { 3007 var event = new CustomEvent(customDomEventName, { 3008 detail: message 3009 }); 3010 document.dispatchEvent(event); 3011 } 3012 subscribe(messageNameOrCallback, callback) { 3013 var name; 3014 if (typeof messageNameOrCallback === "string") { 3015 name = messageNameOrCallback; 3016 } else { 3017 name = undefined; 3018 callback = messageNameOrCallback; 3019 } 3020 if (!callback) { 3021 return; 3022 } 3023 this.handlers.push({ 3024 name, 3025 callback 3026 }); 3027 } 3028 subscribeToBlockType(messageNameOrBlockType, blockTypeOrCallback, callback) { 3029 var name; 3030 var blockType; 3031 if (typeof blockTypeOrCallback === "string") { 3032 name = messageNameOrBlockType; 3033 blockType = blockTypeOrCallback; 3034 } else { 3035 blockType = messageNameOrBlockType; 3036 callback = blockTypeOrCallback; 3037 } 3038 if (!blockType || !callback) { 3039 return; 3040 } 3041 this.handlers.push({ 3042 name, 3043 blockType, 3044 callback 3045 }); 3046 } 3047 subscribeToBlock(messageNameOrBlock, blockOrCallback, callback) { 3048 var name; 3049 var block; 3050 if (typeof blockOrCallback === "string") { 3051 name = messageNameOrBlock; 3052 block = blockOrCallback; 3053 } else { 3054 block = messageNameOrBlock; 3055 callback = blockOrCallback; 3056 } 3057 if (!block || !callback) { 3058 return; 3059 } 3060 this.handlers.push({ 3061 name, 3062 block, 3063 callback 3064 }); 3065 } 3066 } 3067 3068 var browserBus = /*#__PURE__*/Object.freeze({ 3069 __proto__: null, 3070 BlockMessages: BlockMessages, 3071 BrowserBus: BrowserBus, 3072 PageMessages: PageMessages, 3073 useBrowserBus: useBrowserBus 3074 }); 3075 exports('browserBus', browserBus); 3076 3077 var blockReloadSymbol = Symbol(); 3078 var blockRoleActionsSymbol = Symbol("block-role-actions"); 3079 var configurationValuesChangedSymbol = Symbol(); 3080 var staticContentSymbol = Symbol("static-content"); 3081 function useConfigurationValues() { 3082 var result = inject("configurationValues"); 3083 if (result === undefined) { 3084 throw "Attempted to access block configuration outside of a RockBlock."; 3085 } 3086 return result.value; 3087 } 3088 function useInvokeBlockAction() { 3089 var result = inject("invokeBlockAction"); 3090 if (result === undefined) { 3091 throw "Attempted to access block action invocation outside of a RockBlock."; 3092 } 3093 return result; 3094 } 3095 function useBlockActionUrl() { 3096 var result = inject("blockActionUrl"); 3097 if (result === undefined) { 3098 throw "Attempted to access block action URL outside of a RockBlock."; 3099 } 3100 return result; 3101 } 3102 function createInvokeBlockAction(post, pageGuid, blockGuid, pageParameters, sessionGuid, interactionGuid) { 3103 function invokeBlockAction(_x) { 3104 return _invokeBlockAction.apply(this, arguments); 3105 } 3106 function _invokeBlockAction() { 3107 _invokeBlockAction = _asyncToGenerator(function* (actionName) { 3108 var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; 3109 var actionContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; 3110 var cancellationToken = arguments.length > 3 ? arguments[3] : undefined; 3111 var context = {}; 3112 if (actionContext) {
3113 context = _objectSpread2({}, actionContext); 3114 } 3115 context.pageParameters = pageParameters; 3116 context.interactionGuid = interactionGuid; 3117 context.sessionGuid = sessionGuid; 3118 return yield post("/api/v2/BlockActions/".concat(pageGuid, "/").concat(blockGuid, "/").concat(actionName), undefined, _objectSpread2({ 3119 __context: context 3120 }, data), cancellationToken); 3121 }); 3122 return _invokeBlockAction.apply(this, arguments); 3123 } 3124 return invokeBlockAction; 3125 } 3126 function useInvokeStreamingBlockAction() { 3127 var result = inject("invokeStreamingBlockAction"); 3128 if (result === undefined) { 3129 throw "Attempted to access block action invocation outside of a RockBlock."; 3130 } 3131 return result; 3132 } 3133 function createInvokeStreamingBlockAction(doStreamingApiCall, pageGuid, blockGuid, pageParameters, sessionGuid, interactionGuid) { 3134 function invokeBlockAction(_x2) { 3135 return _invokeBlockAction2.apply(this, arguments); 3136 } 3137 function _invokeBlockAction2() { 3138 _invokeBlockAction2 = _asyncToGenerator(function* (actionName) { 3139 var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; 3140 var actionContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; 3141 var cancellationToken = arguments.length > 3 ? arguments[3] : undefined; 3142 var context = {}; 3143 if (actionContext) { 3144 context = _objectSpread2({}, actionContext); 3145 } 3146 context.pageParameters = pageParameters; 3147 context.interactionGuid = interactionGuid; 3148 context.sessionGuid = sessionGuid; 3149 return yield doStreamingApiCall("POST", "/api/v2/BlockActions/".concat(pageGuid, "/").concat(blockGuid, "/").concat(actionName), undefined, _objectSpread2({ 3150 __context: context 3151 }, data), undefined, cancellationToken); 3152 }); 3153 return _invokeBlockAction2.apply(this, arguments); 3154 } 3155 return invokeBlockAction; 3156 } 3157 function provideReloadBlock(callback) { 3158 provide(blockReloadSymbol, callback); 3159 } 3160 function useReloadBlock() { 3161 return inject(blockReloadSymbol, () => {}); 3162 } 3163 function provideConfigurationValuesChanged() { 3164 var callbacks = []; 3165 provide(configurationValuesChangedSymbol, callbacks); 3166 return { 3167 invoke: () => { 3168 for (var _i = 0, _callbacks = callbacks; _i < _callbacks.length; _i++) { 3169 var c = _callbacks[_i]; 3170 c(); 3171 } 3172 }, 3173 reset: () => { 3174 callbacks.splice(0, callbacks.length); 3175 } 3176 }; 3177 } 3178 function onConfigurationValuesChanged(callback) { 3179 var callbacks = inject(configurationValuesChangedSymbol); 3180 if (callbacks !== undefined) { 3181 callbacks.push(callback); 3182 } 3183 } 3184 function provideStaticContent(content) { 3185 provide(staticContentSymbol, content); 3186 } 3187 function useStaticContent() { 3188 var content = inject(staticContentSymbol); 3189 if (!content) { 3190 return []; 3191 } 3192 return content.value; 3193 } 3194 function useBlockBrowserBus() { 3195 var blockTypeGuid = useBlockTypeGuid(); 3196 var blockGuid = useBlockGuid(); 3197 return useBrowserBus({ 3198 blockType: blockTypeGuid, 3199 block: blockGuid 3200 }); 3201 } 3202 function setCustomSettingsBoxValue(box, propertyName, value) { 3203 if (!box.settings) { 3204 box.settings = {}; 3205 } 3206 box.settings[propertyName] = value; 3207 if (!box.validProperties) { 3208 box.validProperties = []; 3209 } 3210 if (!box.validProperties.includes(propertyName)) { 3211 box.validProperties.push(propertyName); 3212 } 3213 } 3214 function setPropertiesBoxValue(box, propertyName, value) { 3215 if (!box.bag) { 3216 box.bag = {}; 3217 } 3218 box.bag[propertyName] = value; 3219 if (!box.validProperties) { 3220 box.validProperties = []; 3221 } 3222 if (!box.validProperties.some(p => p.toLowerCase() === propertyName.toLowerCase())) { 3223 box.validProperties.push(propertyName); 3224 } 3225 } 3226 function dispatchBlockEvent(eventName, blockGuid, eventData) { 3227 var ev = new CustomEvent(eventName, { 3228 cancelable: true, 3229 detail: { 3230 guid: blockGuid, 3231 data: eventData 3232 } 3233 }); 3234 return document.dispatchEvent(ev); 3235 } 3236 function isBlockEvent(event) { 3237 return event instanceof CustomEvent && typeof event.detail === "object" && "guid" in event.detail && "data" in event.detail; 3238 } 3239 var entityTypeNameSymbol = Symbol("EntityTypeName"); 3240 var entityTypeGuidSymbol = Symbol("EntityTypeGuid"); 3241 function useEntityDetailBlock(options) { 3242 var securityGrant = getSecurityGrant(options.blockConfig.securityGrantToken); 3243 provideSecurityGrant(securityGrant); 3244 if (options.blockConfig.entityTypeName) { 3245 provideEntityTypeName(options.blockConfig.entityTypeName); 3246 } 3247 if (options.blockConfig.entityTypeGuid) { 3248 provideEntityTypeGuid(options.blockConfig.entityTypeGuid); 3249 } 3250 var entity = options.entity; 3251 var result = {}; 3252 if (entity) { 3253 var invokeBlockAction = useInvokeBlockAction(); 3254 var refreshAttributesDebounce = debounce(() => refreshEntityDetailAttributes(entity, invokeBlockAction), undefined, true); 3255 result.onPropertyChanged = propertyName => { 3256 if (!options.blockConfig.qualifiedAttributeProperties || !options.blockConfig.qualifiedAttributeProperties.some(n => n.toLowerCase() === propertyName.toLowerCase())) { 3257 return; 3258 } 3259 refreshAttributesDebounce(); 3260 }; 3261 } 3262 return result; 3263 } 3264 function provideEntityTypeName(name) { 3265 provide(entityTypeNameSymbol, name); 3266 } 3267 function useEntityTypeName() { 3268 return inject(entityTypeNameSymbol, undefined); 3269 } 3270 function provideEntityTypeGuid(guid) { 3271 provide(entityTypeGuidSymbol, guid); 3272 } 3273 function useEntityTypeGuid() { 3274 return inject(entityTypeGuidSymbol, undefined); 3275 } 3276 var securityGrantSymbol = Symbol(); 3277 function getSecurityGrant(token, renewTokenCallback) { 3278 var tokenRef = ref(token || null); 3279 var invokeBlockAction = !renewTokenCallback ? useInvokeBlockAction() : null; 3280 var renewalTimeout = null; 3281 var renewToken = function () { 3282 var _ref = _asyncToGenerator(function* () { 3283 if (renewTokenCallback) { 3284 tokenRef.value = yield renewTokenCallback(); 3285 scheduleRenewal(); 3286 } else if (invokeBlockAction) { 3287 var result = yield invokeBlockAction("RenewSecurityGrantToken"); 3288 if (result.isSuccess && result.data) { 3289 tokenRef.value = result.data; 3290 scheduleRenewal(); 3291 } 3292 } 3293 }); 3294 return function renewToken() { 3295 return _ref.apply(this, arguments); 3296 }; 3297 }(); 3298 var scheduleRenewal = () => { 3299 var _tokenRef$value; 3300 if (renewalTimeout !== null) { 3301 clearTimeout(renewalTimeout); 3302 renewalTimeout = null; 3303 } 3304 if (tokenRef.value === null) { 3305 return; 3306 } 3307 var segments = (_tokenRef$value = tokenRef.value) === null || _tokenRef$value === void 0 ? void 0 : _tokenRef$value.split(";"); 3308 if (segments.length !== 3 || segments[0] !== "1") { 3309 return; 3310 } 3311 var expiresDateTime = RockDateTime.parseISO(segments[1]); 3312 if (expiresDateTime === null) { 3313 return; 3314 } 3315 var renewTimeout = expiresDateTime.addMinutes(-15).toMilliseconds() - RockDateTime.now().toMilliseconds(); 3316 if (renewTimeout < 0) { 3317 return; 3318 } 3319 renewalTimeout = setTimeout(renewToken, renewTimeout); 3320 }; 3321 scheduleRenewal(); 3322 return { 3323 token: tokenRef, 3324 updateToken(newToken) { 3325 tokenRef.value = newToken || null; 3326 scheduleRenewal(); 3327 } 3328 }; 3329 } 3330 function provideSecurityGrant(grant) { 3331 provide(securityGrantSymbol, grant); 3332 } 3333 function useSecurityGrantToken() { 3334 var grant = inject(securityGrantSymbol); 3335 return grant ? grant.token : ref(null); 3336 } 3337 function watchPropertyChanges(propertyRefs, emit) { 3338 var _iterator = _createForOfIteratorHelper(propertyRefs), 3339 _step; 3340 try { 3341 var _loop = function _loop() { 3342 var propRef = _step.value; 3343 watch(propRef, () => { 3344 if (propRef.context.propertyName) { 3345 emit("propertyChanged", propRef.context.propertyName); 3346 } 3347 }); 3348 }; 3349 for (_iterator.s();
3349 !(_step = _iterator.n()).done;) { 3350 _loop(); 3351 } 3352 } catch (err) { 3353 _iterator.e(err); 3354 } finally { 3355 _iterator.f(); 3356 } 3357 } 3358 function refreshEntityDetailAttributes(_x3, _x4) { 3359 return _refreshEntityDetailAttributes.apply(this, arguments); 3360 } 3361 function _refreshEntityDetailAttributes() { 3362 _refreshEntityDetailAttributes = _asyncToGenerator(function* (box, invokeBlockAction) { 3363 var result = yield invokeBlockAction("RefreshAttributes", { 3364 box: box.value 3365 }); 3366 if (result.isSuccess) { 3367 if (result.statusCode === 200 && result.data && box.value) { 3368 var _result$data$bag, _result$data$bag2; 3369 var newBox = _objectSpread2(_objectSpread2({}, box.value), {}, { 3370 bag: _objectSpread2(_objectSpread2({}, box.value.bag), {}, { 3371 attributes: (_result$data$bag = result.data.bag) === null || _result$data$bag === void 0 ? void 0 : _result$data$bag.attributes, 3372 attributeValues: (_result$data$bag2 = result.data.bag) === null || _result$data$bag2 === void 0 ? void 0 : _result$data$bag2.attributeValues 3373 }) 3374 }); 3375 box.value = newBox; 3376 } 3377 } 3378 }); 3379 return _refreshEntityDetailAttributes.apply(this, arguments); 3380 } 3381 function refreshDetailAttributes(_x5, _x6, _x7) { 3382 return _refreshDetailAttributes.apply(this, arguments); 3383 } 3384 function _refreshDetailAttributes() { 3385 _refreshDetailAttributes = _asyncToGenerator(function* (bag, validProperties, invokeBlockAction) { 3386 var data = { 3387 entity: bag.value, 3388 isEditable: true, 3389 validProperties: validProperties 3390 }; 3391 var result = yield invokeBlockAction("RefreshAttributes", { 3392 box: data 3393 }); 3394 if (result.isSuccess) { 3395 if (result.statusCode === 200 && result.data && bag.value) { 3396 var _result$data$entity, _result$data$entity2; 3397 var newBag = _objectSpread2(_objectSpread2({}, bag.value), {}, { 3398 attributes: (_result$data$entity = result.data.entity) === null || _result$data$entity === void 0 ? void 0 : _result$data$entity.attributes, 3399 attributeValues: (_result$data$entity2 = result.data.entity) === null || _result$data$entity2 === void 0 ? void 0 : _result$data$entity2.attributeValues 3400 }); 3401 bag.value = newBag; 3402 } 3403 } 3404 }); 3405 return _refreshDetailAttributes.apply(this, arguments); 3406 } 3407 var blockGuidSymbol = Symbol("block-guid"); 3408 var blockTypeGuidSymbol = Symbol("block-type-guid"); 3409 function provideBlockGuid(blockGuid) { 3410 provide(blockGuidSymbol, blockGuid); 3411 } 3412 function useBlockGuid() { 3413 return inject(blockGuidSymbol); 3414 } 3415 function provideBlockTypeGuid(blockTypeGuid) { 3416 provide(blockTypeGuidSymbol, blockTypeGuid); 3417 } 3418 function useBlockTypeGuid() { 3419 return inject(blockTypeGuidSymbol); 3420 } 3421 var blockPreferenceProviderSymbol = Symbol(); 3422 var emptyPreferences = { 3423 getValue() { 3424 return ""; 3425 }, 3426 setValue() {}, 3427 getKeys() { 3428 return []; 3429 }, 3430 containsKey() { 3431 return false; 3432 }, 3433 save() { 3434 return Promise.resolve(); 3435 }, 3436 withPrefix() { 3437 return emptyPreferences; 3438 }, 3439 on() {}, 3440 off() {} 3441 }; 3442 var emptyPreferenceProvider = { 3443 blockPreferences: emptyPreferences, 3444 getGlobalPreferences() { 3445 return Promise.resolve(emptyPreferences); 3446 }, 3447 getEntityPreferences() { 3448 return Promise.resolve(emptyPreferences); 3449 } 3450 }; 3451 function providePersonPreferences(provider) { 3452 provide(blockPreferenceProviderSymbol, provider); 3453 } 3454 function usePersonPreferences() { 3455 var _inject; 3456 return (_inject = inject(blockPreferenceProviderSymbol)) !== null && _inject !== void 0 ? _inject : emptyPreferenceProvider; 3457 } 3458 var registeredBlocks = []; 3459 var hiddenBlockRoles = new Set(); 3460 function registerBlock(actions, role) { 3461 var block = { 3462 actions, 3463 role, 3464 hideCount: 0 3465 }; 3466 if (hiddenBlockRoles.has(role)) { 3467 block.hideCount = 1; 3468 if (block.actions.hideBlock) { 3469 block.actions.hideBlock(); 3470 } 3471 } 3472 registeredBlocks.push(block); 3473 } 3474 function unregisterBlock(actions, role) { 3475 var index = registeredBlocks.findIndex(entry => entry.actions === actions && entry.role === role); 3476 if (index !== -1) { 3477 registeredBlocks.splice(index, 1); 3478 } 3479 } 3480 function provideBlockActions(actions) { 3481 provide(blockRoleActionsSymbol, actions); 3482 } 3483 function useBlockActions() { 3484 var _inject2; 3485 return (_inject2 = inject(blockRoleActionsSymbol)) !== null && _inject2 !== void 0 ? _inject2 : {}; 3486 } 3487 function hideBlockRole(_x8) { 3488 return _hideBlockRole.apply(this, arguments); 3489 } 3490 function _hideBlockRole() { 3491 _hideBlockRole = _asyncToGenerator(function* (role) { 3492 var _BlockRoleDescription; 3493 var roleName = (_BlockRoleDescription = BlockRoleDescription[role]) === null || _BlockRoleDescription === void 0 ? void 0 : _BlockRoleDescription.toLowerCase(); 3494 if (roleName) { 3495 window.document.body.classList.add("hide-block-role-".concat(roleName)); 3496 } 3497 var promises = []; 3498 var _iterator2 = _createForOfIteratorHelper(registeredBlocks), 3499 _step2; 3500 try { 3501 for (_iterator2.s();
3501 !(_step2 = _iterator2.n()).done;) { 3502 var entry = _step2.value; 3503 if (entry.role === role) { 3504 entry.hideCount++; 3505 if (entry.hideCount === 1 && entry.actions.hideBlock) { 3506 promises.push(entry.actions.hideBlock()); 3507 } 3508 } 3509 } 3510 } catch (err) { 3511 _iterator2.e(err); 3512 } finally { 3513 _iterator2.f(); 3514 } 3515 hiddenBlockRoles.add(role); 3516 yield Promise.all(promises); 3517 }); 3518 return _hideBlockRole.apply(this, arguments); 3519 } 3520 function showBlockRole(_x9) { 3521 return _showBlockRole.apply(this, arguments); 3522 } 3523 function _showBlockRole() { 3524 _showBlockRole = _asyncToGenerator(function* (role) { 3525 var _BlockRoleDescription2; 3526 var roleName = (_BlockRoleDescription2 = BlockRoleDescription[role]) === null || _BlockRoleDescription2 === void 0 ? void 0 : _BlockRoleDescription2.toLowerCase(); 3527 if (roleName) { 3528 window.document.body.classList.remove("hide-block-role-".concat(roleName)); 3529 } 3530 var promises = []; 3531 var _iterator3 = _createForOfIteratorHelper(registeredBlocks), 3532 _step3; 3533 try { 3534 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 3535 var entry = _step3.value; 3536 if (entry.role === role) { 3537 if (entry.hideCount > 0) { 3538 entry.hideCount--; 3539 } 3540 if (entry.hideCount === 0 && entry.actions.showBlock) { 3541 promises.push(entry.actions.showBlock()); 3542 } 3543 } 3544 } 3545 } catch (err) { 3546 _iterator3.e(err); 3547 } finally { 3548 _iterator3.f(); 3549 } 3550 hiddenBlockRoles.delete(role); 3551 yield Promise.all(promises); 3552 }); 3553 return _showBlockRole.apply(this, arguments); 3554 } 3555 function reloadBlockRole(_x0) { 3556 return _reloadBlockRole.apply(this, arguments); 3557 } 3558 function _reloadBlockRole() { 3559 _reloadBlockRole = _asyncToGenerator(function* (role) { 3560 var promises = []; 3561 var _iterator4 = _createForOfIteratorHelper(registeredBlocks), 3562 _step4; 3563 try { 3564 for (_iterator4.s();
3564 !(_step4 = _iterator4.n()).done;) { 3565 var entry = _step4.value; 3566 if (entry.role === role && entry.actions.reloadBlock) { 3567 promises.push(entry.actions.reloadBlock()); 3568 } 3569 } 3570 } catch (err) { 3571 _iterator4.e(err); 3572 } finally { 3573 _iterator4.f(); 3574 } 3575 yield Promise.all(promises); 3576 }); 3577 return _reloadBlockRole.apply(this, arguments); 3578 } 3579 3580 var block = /*#__PURE__*/Object.freeze({ 3581 __proto__: null, 3582 createInvokeBlockAction: createInvokeBlockAction, 3583 createInvokeStreamingBlockAction: createInvokeStreamingBlockAction, 3584 dispatchBlockEvent: dispatchBlockEvent, 3585 getSecurityGrant: getSecurityGrant, 3586 hideBlockRole: hideBlockRole, 3587 isBlockEvent: isBlockEvent, 3588 onConfigurationValuesChanged: onConfigurationValuesChanged, 3589 provideBlockActions: provideBlockActions, 3590 provideBlockGuid: provideBlockGuid, 3591 provideBlockTypeGuid: provideBlockTypeGuid, 3592 provideConfigurationValuesChanged: provideConfigurationValuesChanged, 3593 provideEntityTypeGuid: provideEntityTypeGuid, 3594 provideEntityTypeName: provideEntityTypeName, 3595 providePersonPreferences: providePersonPreferences, 3596 provideReloadBlock: provideReloadBlock, 3597 provideSecurityGrant: provideSecurityGrant, 3598 provideStaticContent: provideStaticContent, 3599 refreshDetailAttributes: refreshDetailAttributes, 3600 registerBlock: registerBlock, 3601 reloadBlockRole: reloadBlockRole, 3602 setCustomSettingsBoxValue: setCustomSettingsBoxValue, 3603 setPropertiesBoxValue: setPropertiesBoxValue, 3604 showBlockRole: showBlockRole, 3605 unregisterBlock: unregisterBlock, 3606 useBlockActionUrl: useBlockActionUrl, 3607 useBlockActions: useBlockActions, 3608 useBlockBrowserBus: useBlockBrowserBus, 3609 useBlockGuid: useBlockGuid, 3610 useBlockTypeGuid: useBlockTypeGuid, 3611 useConfigurationValues: useConfigurationValues, 3612 useEntityDetailBlock: useEntityDetailBlock, 3613 useEntityTypeGuid: useEntityTypeGuid, 3614 useEntityTypeName: useEntityTypeName, 3615 useInvokeBlockAction: useInvokeBlockAction, 3616 useInvokeStreamingBlockAction: useInvokeStreamingBlockAction, 3617 usePersonPreferences: usePersonPreferences, 3618 useReloadBlock: useReloadBlock, 3619 useSecurityGrantToken: useSecurityGrantToken, 3620 useStaticContent: useStaticContent, 3621 watchPropertyChanges: watchPropertyChanges 3622 }); 3623 exports('block', block); 3624 3625 function asBooleanOrNull(val) { 3626 if (val === undefined || val === null) { 3627 return null; 3628 } 3629 if (typeof val === "boolean") { 3630 return val; 3631 } 3632 if (typeof val === "string") { 3633 var asString = (val || "").trim().toLowerCase(); 3634 if (!asString) { 3635 return null; 3636 } 3637 return ["true", "yes", "t", "y", "1"].indexOf(asString) !== -1; 3638 } 3639 if (typeof val === "number") { 3640 return !!val; 3641 } 3642 return null; 3643 } 3644 function asBoolean(val) { 3645 return !!asBooleanOrNull(val); 3646 } 3647 function asYesNoOrNull(val) { 3648 var boolOrNull = asBooleanOrNull(val); 3649 if (boolOrNull === null) { 3650 return null; 3651 } 3652 return boolOrNull ? "Yes" : "No"; 3653 } 3654 function asTrueFalseOrNull(val) { 3655 var boolOrNull = asBooleanOrNull(val); 3656 if (boolOrNull === null) { 3657 return null; 3658 } 3659 return boolOrNull ? "True" : "False"; 3660 } 3661 function asTrueOrFalseString(val) { 3662 var boolOrNull = asBooleanOrNull(val); 3663 return boolOrNull ? "True" : "False"; 3664 } 3665 3666 var booleanUtils = /*#__PURE__*/Object.freeze({ 3667 __proto__: null, 3668 asBoolean: asBoolean, 3669 asBooleanOrNull: asBooleanOrNull, 3670 asTrueFalseOrNull: asTrueFalseOrNull, 3671 asTrueOrFalseString: asTrueOrFalseString, 3672 asYesNoOrNull: asYesNoOrNull 3673 }); 3674 exports('booleanUtils', booleanUtils); 3675 3676 var keyPrefix = "ObsidianCache_"; 3677 function set(key, value) { 3678 var ttl = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 60; 3679 if (typeof ttl !== "number") { 3680 ttl = 60; 3681 console.warn("Cache.set has been changed to use a Time-To-Live instead of an expiration date/time. Please update your co
3681de to use a Time-To-Live."); 3682 } 3683 var expiration = RockDateTime.now().addSeconds(ttl).toMilliseconds(); 3684 var cache = { 3685 expiration, 3686 value 3687 }; 3688 var cacheJson = JSON.stringify(cache); 3689 sessionStorage.setItem(keyPrefix + key, cacheJson); 3690 } 3691 function get(key) { 3692 var cacheJson = sessionStorage.getItem(keyPrefix + key); 3693 if (!cacheJson) { 3694 return null; 3695 } 3696 var cache = JSON.parse(cacheJson); 3697 if (!cache || !cache.expiration) { 3698 return null; 3699 } 3700 if (cache.expiration < RockDateTime.now().toMilliseconds()) { 3701 return null; 3702 } 3703 return cache.value; 3704 } 3705 var promiseCache = {}; 3706 function cachePromiseFactory(key, fn, ttl) { 3707 return _asyncToGenerator(function* () { 3708 var _promiseCache$key; 3709 if (typeof ttl !== "number" || ttl !== undefined) { 3710 console.warn("Cache.cachePromiseFactory has been changed to use a Time-To-Live instead of an expiration date/time. Please update your code to use a Time-To-Live."); 3711 } 3712 var cachedResult = get(key); 3713 if (cachedResult) { 3714 return cachedResult; 3715 } 3716 if (promiseCache[key]) { 3717 return promiseCache[key]; 3718 } 3719 promiseCache[key] = fn(); 3720 (_promiseCache$key = promiseCache[key]) === null || _promiseCache$key === void 0 || _promiseCache$key.then(result => { 3721 set(key, result, ttl); 3722 delete promiseCache[key]; 3723 return result; 3724 }).catch(e => { 3725 delete promiseCache[key]; 3726 throw e; 3727 }); 3728 return promiseCache[key]; 3729 }); 3730 } 3731 var Cache = { 3732 set, 3733 get, 3734 cachePromiseFactory 3735 }; 3736 3737 var cache = /*#__PURE__*/Object.freeze({ 3738 __proto__: null, 3739 default: Cache 3740 }); 3741 exports('cache', cache); 3742 3743 function getCssValue(variableName) { 3744 return getComputedStyle(document.documentElement).getPropertyValue(variableName).trim(); 3745 } 3746 var BarDatasetLabelsPlugin = { 3747 id: "barDatasetLabels", 3748 afterDatasetDraw(chart, _ref) { 3749 var datasetIndex = _ref.index; 3750 _ref.meta; 3751 var ctx = chart.ctx, 3752 data = chart.data; 3753 ctx.save(); 3754 chart.getDatasetMeta(datasetIndex).data.forEach((datapoint, _datapointIndex) => { 3755 ctx.font = "normal 14px sans-serif"; 3756 ctx.fillStyle = getCssValue("--color-interface-medium"); 3757 ctx.textAlign = "center"; 3758 var label = "".concat(data.datasets[datasetIndex].label); 3759 ctx.fillText(label, datapoint.x, datapoint.y - 7); 3760 }); 3761 } 3762 }; 3763 var contrastColors = {}; 3764 var BarValueLabelsPlugin = { 3765 id: "barValueLabels", 3766 afterDatasetDraw(chart, _ref2, options) { 3767 var datasetIndex = _ref2.index, 3768 meta = _ref2.meta; 3769 var ctx = chart.ctx, 3770 data = chart.data; 3771 ctx.save(); 3772 meta.data.forEach((dataElement, dataIndex) => { 3773 var _data$datasets$datase, _data$datasets$datase2; 3774 if (dataElement instanceof BarElement === false) { 3775 console.warn("BarValueLabelsPlugin can only be used with BarElement data elements.", dataElement); 3776 return; 3777 } 3778 var barProps = ["base"]; 3779 var _dataElement$getProps = dataElement.getProps(barProps), 3780 base = _dataElement$getProps.base; 3781 var fontSize = 12; 3782 var minimumSpaceBetweenTextAndBorder = 4; 3783 var desiredSpaceBetweenTextAndBar = 8; 3784 ctx.font = "normal ".concat(fontSize, "px sans-serif"); 3785 ctx.textAlign = "center"; 3786 var barColor = ((_data$datasets$datase = data.datasets[datasetIndex].backgroundColor) === null || _data$datasets$datase === void 0 ? void 0 : _data$datasets$datase[dataIndex]) || ((_data$datasets$datase2 = data.datasets[datasetIndex].borderColor) === null || _data$datasets$datase2 === void 0 ? void 0 : _data$datasets$datase2[dataIndex]) || ""; 3787 if (typeof barColor !== "string") { 3788 console.warn("Bar color must be a string to determine contrast color to use the BarValueLabelsPlugin.", barColor); 3789 return; 3790 } 3791 if (!contrastColors[barColor]) {
3792 var _options$isBackground; 3793 if (options !== null && options !== void 0 && (_options$isBackground = options.isBackgroundDark) !== null && _options$isBackground !== void 0 && _options$isBackground.call(options, barColor)) { 3794 contrastColors[barColor] = "white"; 3795 } else { 3796 contrastColors[barColor] = "black"; 3797 } 3798 } 3799 ctx.fillStyle = contrastColors[barColor] || getCssValue("--color-interface-contrast"); 3800 var value = "".concat(data.datasets[datasetIndex].data[dataIndex]); 3801 var formatted = options !== null && options !== void 0 && options.formatter ? options.formatter(value) : value; 3802 var textOffset = fontSize / 2 + minimumSpaceBetweenTextAndBorder; 3803 if (base - dataElement.y > fontSize / 2 + desiredSpaceBetweenTextAndBar + minimumSpaceBetweenTextAndBorder) { 3804 textOffset = fontSize / 2 + desiredSpaceBetweenTextAndBar; 3805 } 3806 ctx.fillText(formatted, dataElement.x, dataElement.y + textOffset); 3807 }); 3808 } 3809 }; 3810 class BarChartDataBuilder { 3811 constructor(dataPoints) { 3812 this.dataPoints = dataPoints; 3813 } 3814 static createFromDataPoints(dataPoints) { 3815 return new BarChartDataBuilder(dataPoints); 3816 } 3817 withSeriesOrder(orderBy) { 3818 if (Array.isArray(orderBy)) { 3819 var orderMap = new Map(orderBy.map((value, index) => [value, index])); 3820 this.seriesNameOrderBy = (a, b) => { 3821 var indexA = orderMap.has(a) ? orderMap.get(a) : Number.MAX_SAFE_INTEGER; 3822 var indexB = orderMap.has(b) ? orderMap.get(b) : Number.MAX_SAFE_INTEGER; 3823 if (indexA < indexB) { 3824 return -1; 3825 } 3826 if (indexA > indexB) { 3827 return 1; 3828 } 3829 return 0; 3830 }; 3831 } else { 3832 this.seriesNameOrderBy = orderBy; 3833 } 3834 return this; 3835 } 3836 build() { 3837 var dataPointsEnumerable = Enumerable.from(this.dataPoints); 3838 var labels = dataPointsEnumerable.select(d => d.label).ofType(d => !isNullish(d)).distinct().toArray(); 3839 var groupedBySeries = dataPointsEnumerable.where(d => !isNullish(d.seriesName)).groupBy(d => d.seriesName).ofType(group => { 3840 return !isNullish(group.key); 3841 }); 3842 if (this.seriesNameOrderBy) { 3843 groupedBySeries = groupedBySeries.orderBy(group => group.key, this.seriesNameOrderBy); 3844 } 3845 return { 3846 labels, 3847 datasets: groupedBySeries.select(group => { 3848 var seriesDataColors = group.select(d => { 3849 var _d$color; 3850 return (_d$color = d.color) !== null && _d$color !== void 0 ? _d$color : undefined; 3851 }).toArray(); 3852 return { 3853 label: group.key, 3854 data: group.select(d => d.value).toArray(), 3855 backgroundColor: seriesDataColors, 3856 borderColor: seriesDataColors, 3857 grouped: true 3858 }; 3859 }).toArray() 3860 }; 3861 } 3862 } 3863 class BarChartOptionsBuilder { 3864 constructor(options) { 3865 this.options = options; 3866 } 3867 static create() { 3868 return new BarChartOptionsBuilder({}); 3869 } 3870 build() { 3871 return _objectSpread2({}, this.options); 3872 } 3873 withXAxisAsDate() { 3874 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 3875 timeUnit: "day" 3876 }; 3877 return new BarChartOptionsBuilder(_objectSpread2(_objectSpread2({}, this.options), {}, { 3878 scales: _objectSpread2(_objectSpread2({}, this.options.scales), {}, { 3879 x: { 3880 type: "time", 3881 time: { 3882 unit: options.timeUnit 3883 } 3884 } 3885 }) 3886 })); 3887 } 3888 withYAxisAsPercent() { 3889 var _this$options$scales, _this$options$scales2, _this$options$plugins, _this$options$plugins2, _this$options$plugins3; 3890 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 3891 maxDecimalPlaces: undefined 3892 };
3893 return new BarChartOptionsBuilder(_objectSpread2(_objectSpread2({}, this.options), {}, { 3894 scales: _objectSpread2(_objectSpread2({}, this.options.scales), {}, { 3895 y: _objectSpread2(_objectSpread2({}, (_this$options$scales = this.options.scales) === null || _this$options$scales === void 0 ? void 0 : _this$options$scales.y), {}, { 3896 ticks: _objectSpread2(_objectSpread2({}, (_this$options$scales2 = this.options.scales) === null || _this$options$scales2 === void 0 || (_this$options$scales2 = _this$options$scales2.y) === null || _this$options$scales2 === void 0 ? void 0 : _this$options$scales2.ticks), {}, { 3897 callback(tickValue, _index, _ticks) { 3898 if (typeof tickValue !== "number") { 3899 tickValue = Number(tickValue); 3900 } 3901 if (isNaN(tickValue)) { 3902 return "".concat(tickValue); 3903 } 3904 return tickValue.toLocaleString(undefined, { 3905 style: "percent", 3906 maximumFractionDigits: options.maxDecimalPlaces 3907 }); 3908 } 3909 }) 3910 }) 3911 }), 3912 plugins: _objectSpread2(_objectSpread2({}, this.options.plugins), {}, { 3913 tooltip: _objectSpread2(_objectSpread2({}, (_this$options$plugins = this.options.plugins) === null || _this$options$plugins === void 0 ? void 0 : _this$options$plugins.tooltip), {}, { 3914 callbacks: _objectSpread2(_objectSpread2({}, (_this$options$plugins2 = this.options.plugins) === null || _this$options$plugins2 === void 0 || (_this$options$plugins2 = _this$options$plugins2.tooltip) === null || _this$options$plugins2 === void 0 ? void 0 : _this$options$plugins2.callbacks), {}, { 3915 label: function label(context) { 3916 var label = context.dataset.label || ""; 3917 if (label) { 3918 label += ": "; 3919 } 3920 if (context.parsed.y !== null) { 3921 label += context.parsed.y.toLocaleString(undefined, { 3922 style: "percent", 3923 maximumFractionDigits: options.maxDecimalPlaces 3924 }); 3925 } 3926 return label; 3927 } 3928 }) 3929 }), 3930 barValueLabels: _objectSpread2(_objectSpread2({}, (_this$options$plugins3 = this.options.plugins) === null || _this$options$plugins3 === void 0 ? void 0 : _this$options$plugins3.barValueLabels), {}, { 3931 formatter: value => { 3932 var num = Number(value); 3933 if (isNaN(num)) { 3934 return value; 3935 } else { 3936 return num.toLocaleString(undefined, { 3937 style: "percent", 3938 maximumFractionDigits: options.maxDecimalPlaces 3939 }); 3940 } 3941 } 3942 }) 3943 }) 3944 })); 3945 } 3946 withoutLegend() { 3947 return new BarChartOptionsBuilder(_objectSpread2(_objectSpread2({}, this.options), {}, { 3948 plugins: _objectSpread2(_objectSpread2({}, this.options.plugins), {}, { 3949 legend: { 3950 display: false 3951 } 3952 }) 3953 })); 3954 } 3955 withResponsiveSizing() { 3956 return new BarChartOptionsBuilder(_objectSpread2(_objectSpread2({}, this.options), {}, { 3957 responsive: true, 3958 maintainAspectRatio: false 3959 })); 3960 } 3961 withoutTooltips() { 3962 return new BarChartOptionsBuilder(_objectSpread2(_objectSpread2({}, this.options), {}, { 3963 plugins: _objectSpread2(_objectSpread2({}, this.options.plugins), {}, { 3964 tooltip: { 3965 enabled: false 3966 } 3967 }) 3968 })); 3969 } 3970 withBarValueLabels(options) { 3971 var _this$options$plugins4;
3972 return new BarChartOptionsBuilder(_objectSpread2(_objectSpread2({}, this.options), {}, { 3973 plugins: _objectSpread2(_objectSpread2({}, this.options.plugins), {}, { 3974 barValueLabels: _objectSpread2(_objectSpread2({}, (_this$options$plugins4 = this.options.plugins) === null || _this$options$plugins4 === void 0 ? void 0 : _this$options$plugins4.barValueLabels), options) 3975 }) 3976 })); 3977 } 3978 } 3979 class LineChartDataBuilder { 3980 constructor(dataPoints) { 3981 this.dataPoints = dataPoints; 3982 } 3983 static createFromData(dataPoints) { 3984 return new LineChartDataBuilder(dataPoints); 3985 } 3986 withSeriesOrder(orderBy) { 3987 if (Array.isArray(orderBy)) { 3988 var orderMap = new Map(orderBy.map((value, index) => [value, index])); 3989 this.seriesNameOrderBy = (a, b) => { 3990 var indexA = orderMap.has(a) ? orderMap.get(a) : Number.MAX_SAFE_INTEGER; 3991 var indexB = orderMap.has(b) ? orderMap.get(b) : Number.MAX_SAFE_INTEGER; 3992 if (indexA < indexB) { 3993 return -1; 3994 } 3995 if (indexA > indexB) { 3996 return 1; 3997 } 3998 return 0; 3999 }; 4000 } else { 4001 this.seriesNameOrderBy = orderBy; 4002 } 4003 return this; 4004 } 4005 build() { 4006 var dataPointsEnumerable = Enumerable.from(this.dataPoints); 4007 var labels = dataPointsEnumerable.select(d => d.label).ofType(d => !isNullish(d)).distinct().toArray(); 4008 var groupedBySeries = dataPointsEnumerable.groupBy(d => d.seriesName).ofType(group => { 4009 return !isNullish(group.key); 4010 }); 4011 if (this.seriesNameOrderBy) { 4012 groupedBySeries = groupedBySeries.orderBy(group => group.key, this.seriesNameOrderBy); 4013 } 4014 return { 4015 labels, 4016 datasets: groupedBySeries.select(group => { 4017 var groupArray = group.toArray(); 4018 var seriesDataColors = Enumerable.from(groupArray).select(d => { 4019 var _d$color2; 4020 return (_d$color2 = d.color) !== null && _d$color2 !== void 0 ? _d$color2 : undefined; 4021 }).toArray(); 4022 var dataDictionary = Enumerable.from(groupArray).toDictionary(d => d.label, d => d.value); 4023 var lastValue = 0; 4024 var data = Enumerable.from(labels).select(label => { 4025 if (dataDictionary.has(label)) { 4026 lastValue = dataDictionary.get(label); 4027 } 4028 return lastValue; 4029 }).toArray(); 4030 return { 4031 label: group.key, 4032 data, 4033 backgroundColor: seriesDataColors, 4034 borderColor: seriesDataColors 4035 }; 4036 }).toArray() 4037 }; 4038 } 4039 } 4040 class LineChartOptionsBuilder { 4041 constructor(options) { 4042 this.options = options; 4043 } 4044 static create() { 4045 return new LineChartOptionsBuilder({ 4046 scales: { 4047 y: { 4048 min: 0 4049 } 4050 } 4051 }); 4052 } 4053 static createFrom() { 4054 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 4055 return new LineChartOptionsBuilder(options); 4056 } 4057 build() { 4058 return _objectSpread2({}, this.options); 4059 } 4060 withXAxisAsDate() { 4061 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 4062 timeUnit: "day" 4063 }; 4064 return new LineChartOptionsBuilder(_objectSpread2(_objectSpread2({}, this.options), {}, { 4065 scales: _objectSpread2(_objectSpread2({}, this.options.scales), {}, { 4066 x: { 4067 type: "time", 4068 time: { 4069 unit: options.timeUnit 4070 } 4071 } 4072 }) 4073 })); 4074 } 4075 withYAxisAsPercent() { 4076 var _this$options$scales3, _this$options$scales4, _this$options$plugins5, _this$options$plugins6; 4077 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 4078 maxDecimalPlaces: undefined 4079 };
4080 return new LineChartOptionsBuilder(_objectSpread2(_objectSpread2({}, this.options), {}, { 4081 scales: _objectSpread2(_objectSpread2({}, this.options.scales), {}, { 4082 y: _objectSpread2(_objectSpread2({}, (_this$options$scales3 = this.options.scales) === null || _this$options$scales3 === void 0 ? void 0 : _this$options$scales3.y), {}, { 4083 ticks: _objectSpread2(_objectSpread2({}, (_this$options$scales4 = this.options.scales) === null || _this$options$scales4 === void 0 || (_this$options$scales4 = _this$options$scales4.y) === null || _this$options$scales4 === void 0 ? void 0 : _this$options$scales4.ticks), {}, { 4084 callback(tickValue, _index, _ticks) { 4085 if (typeof tickValue !== "number") { 4086 tickValue = Number(tickValue); 4087 } 4088 if (isNaN(tickValue)) { 4089 return "".concat(tickValue); 4090 } else { 4091 return tickValue.toLocaleString(undefined, { 4092 style: "percent", 4093 maximumFractionDigits: options.maxDecimalPlaces 4094 }); 4095 } 4096 } 4097 }) 4098 }) 4099 }), 4100 plugins: _objectSpread2(_objectSpread2({}, this.options.plugins), {}, { 4101 tooltip: _objectSpread2(_objectSpread2({}, (_this$options$plugins5 = this.options.plugins) === null || _this$options$plugins5 === void 0 ? void 0 : _this$options$plugins5.tooltip), {}, { 4102 callbacks: _objectSpread2(_objectSpread2({}, (_this$options$plugins6 = this.options.plugins) === null || _this$options$plugins6 === void 0 || (_this$options$plugins6 = _this$options$plugins6.tooltip) === null || _this$options$plugins6 === void 0 ? void 0 : _this$options$plugins6.callbacks), {}, { 4103 label: function label(context) { 4104 var label = context.dataset.label || ""; 4105 if (label) { 4106 label += ": "; 4107 } 4108 if (context.parsed.y !== null) { 4109 label += context.parsed.y.toLocaleString(undefined, { 4110 style: "percent", 4111 maximumFractionDigits: options.maxDecimalPlaces 4112 }); 4113 } 4114 return label; 4115 } 4116 }) 4117 }) 4118 }) 4119 })); 4120 } 4121 withResponsiveSizing() { 4122 return new LineChartOptionsBuilder(_objectSpread2(_objectSpread2({}, this.options), {}, { 4123 responsive: true, 4124 maintainAspectRatio: false 4125 })); 4126 } 4127 } 4128 function buildCumulativeRates(dateEnumerable, options) { 4129 var _options$dateTransfor, _options$dateFormatte; 4130 var dateTransformer = (_options$dateTransfor = options.dateTransformer) !== null && _options$dateTransfor !== void 0 ? _options$dateTransfor : d => d; 4131 var dateFormatter = (_options$dateFormatte = options.dateFormatter) !== null && _options$dateFormatte !== void 0 ? _options$dateFormatte : d => d.toISOString(); 4132 return dateEnumerable.select(dateTransformer).groupBy(date => date.toMilliseconds()).orderBy(group => group.key).scan({ 4133 count: 0, 4134 dataPoint: undefined 4135 }, (state, group) => { 4136 var date = group.first(); 4137 var groupCount = group.count(); 4138 var count = state.count + groupCount; 4139 var dataPoint = { 4140 seriesName: options.seriesName, 4141 color: options.color, 4142 label: dateFormatter(date), 4143 value: count / options.totalCount, 4144 rockDateTime: date 4145 }; 4146 return { 4147 count, 4148 dataPoint 4149 }; 4150 }).select(state => state.dataPoint); 4151 } 4152 4153 var chartUtils = /*#__PURE__*/Object.freeze({ 4154 __proto__: null, 4155 BarChartDataBuilder: BarChartDataBuilder, 4156 BarChartOptionsBuilder: BarChartOptionsBuilder, 4157 BarDatasetLabelsPlugin: BarDatasetLabelsPlugin, 4158 BarValueLabelsPlugin: BarValueLabelsPlugin, 4159 LineChartDataBuilder: LineChartDataBuilder, 4160 LineChartOptionsBuilder: LineChartOptionsBuilder, 4161 buildCumulativeRates: buildCumulativeRates 4162 }); 4163 exports('chartUtils', chartUtils); 4164 4165 var suspenseSymbol = Symbol("RockSuspense"); 4166 class BasicSuspenseProvider { 4167 constructor(parentProvider) { 4168 this.operationKey = newGuid(); 4169 this.parentProvider = parentProvider; 4170 this.pendingOperations = []; 4171 this.finishedHandlers = []; 4172 } 4173 allOperationsComplete() { 4174 nextTick(() => { 4175 if (this.pendingOperations.length !== 0) { 4176 return; 4177 } 4178 var _iterator = _createForOfIteratorHelper(this.finishedHandlers), 4179 _step; 4180 try { 4181 for (_iterator.s();
4181 !(_step = _iterator.n()).done;) { 4182 var handler = _step.value; 4183 handler(); 4184 } 4185 } catch (err) { 4186 _iterator.e(err); 4187 } finally { 4188 _iterator.f(); 4189 } 4190 this.finishedHandlers = []; 4191 if (this.parentProvider) { 4192 this.parentProvider.completeAsyncOperation(this.operationKey); 4193 } 4194 }); 4195 } 4196 addOperation(operation) { 4197 var operationKey = newGuid(); 4198 this.startAsyncOperation(operationKey); 4199 operation.then(() => this.completeAsyncOperation(operationKey)).catch(() => this.completeAsyncOperation(operationKey)); 4200 } 4201 startAsyncOperation(key) { 4202 this.pendingOperations.push(key); 4203 if (this.pendingOperations.length === 1 && this.parentProvider) { 4204 this.parentProvider.startAsyncOperation(this.operationKey); 4205 } 4206 } 4207 completeAsyncOperation(key) { 4208 var index = this.pendingOperations.indexOf(key); 4209 if (index !== -1) { 4210 this.pendingOperations.splice(index, 1); 4211 } 4212 if (this.pendingOperations.length === 0) { 4213 this.allOperationsComplete(); 4214 } 4215 } 4216 hasPendingOperations() { 4217 return this.pendingOperations.length > 0; 4218 } 4219 addFinishedHandler(callback) { 4220 this.finishedHandlers.push(callback); 4221 } 4222 } 4223 function provideSuspense(provider) { 4224 provide(suspenseSymbol, provider); 4225 } 4226 function useSuspense() { 4227 return inject(suspenseSymbol, undefined); 4228 } 4229 4230 var suspense = /*#__PURE__*/Object.freeze({ 4231 __proto__: null, 4232 BasicSuspenseProvider: BasicSuspenseProvider, 4233 provideSuspense: provideSuspense, 4234 useSuspense: useSuspense 4235 }); 4236 exports('suspense', suspense); 4237 4238 function asFormattedString(num, digits) { 4239 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 4240 if (num === null) { 4241 return ""; 4242 } 4243 return num.toLocaleString("en-US", _objectSpread2({ 4244 minimumFractionDigits: digits, 4245 maximumFractionDigits: digits !== null && digits !== void 0 ? digits : 9 4246 }, options)); 4247 } 4248 function toNumber(str) { 4249 return toNumberOrNull(str) || 0; 4250 } 4251 function toNumberOrNull(str) { 4252 if (str === null || str === undefined || str === "") { 4253 return null; 4254 } 4255 if (typeof str === "number") { 4256 return str; 4257 } 4258 var replaced = str.replace(/[$,]/g, ""); 4259 var num = Number(replaced); 4260 return !isNaN(num) ? num : null; 4261 } 4262 function toCurrencyOrNull(value) { 4263 var _currencyInfo$symbol, _currencyInfo$decimal; 4264 var currencyInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 4265 if (typeof value === "string") { 4266 value = toNumberOrNull(value); 4267 } 4268 if (value === null || value === undefined) { 4269 return null; 4270 } 4271 var currencySymbol = (_currencyInfo$symbol = currencyInfo === null || currencyInfo === void 0 ? void 0 : currencyInfo.symbol) !== null && _currencyInfo$symbol !== void 0 ? _currencyInfo$symbol : "$"; 4272 var currencyDecimalPlaces = (_currencyInfo$decimal = currencyInfo === null || currencyInfo === void 0 ? void 0 : currencyInfo.decimalPlaces) !== null && _currencyInfo$decimal !== void 0 ? _currencyInfo$decimal : 2; 4273 return "".concat(currencySymbol).concat(asFormattedString(value, currencyDecimalPlaces)); 4274 } 4275 function toOrdinalSuffix(num) { 4276 if (!num) { 4277 return ""; 4278 } 4279 var j = num % 10; 4280 var k = num % 100; 4281 if (j === 1 && k !== 11) { 4282 return num + "st"; 4283 } 4284 if (j === 2 && k !== 12) { 4285 return num + "nd"; 4286 } 4287 if (j === 3 && k !== 13) { 4288 return num + "rd"; 4289 } 4290 return num + "th"; 4291 } 4292 function toOrdinal(num) { 4293 if (!num) { 4294 return ""; 4295 } 4296 switch (num) { 4297 case 1: 4298 return "first"; 4299 case 2: 4300 return "second"; 4301 case 3: 4302 return "third"; 4303 case 4: 4304 return "fourth"; 4305 case 5: 4306 return "fifth"; 4307 case 6: 4308 return "sixth"; 4309 case 7: 4310 return "seventh"; 4311 case 8: 4312 return "eighth"; 4313 case 9: 4314 return "ninth"; 4315 case 10: 4316 return "tenth"; 4317 default: 4318 return toOrdinalSuffix(num); 4319 } 4320 } 4321 function toWord(num) { 4322 if (num === null || num === undefined) { 4323 return ""; 4324 } 4325 switch (num) { 4326 case 1: 4327 return "one"; 4328 case 2:
4329 return "two"; 4330 case 3: 4331 return "three"; 4332 case 4: 4333 return "four"; 4334 case 5: 4335 return "five"; 4336 case 6: 4337 return "six"; 4338 case 7: 4339 return "seven"; 4340 case 8: 4341 return "eight"; 4342 case 9: 4343 return "nine"; 4344 case 10: 4345 return "ten"; 4346 default: 4347 return "".concat(num); 4348 } 4349 } 4350 function zeroPad(num, length) { 4351 var str = num.toString(); 4352 while (str.length < length) { 4353 str = "0" + str; 4354 } 4355 return str; 4356 } 4357 function toDecimalPlaces(num, decimalPlaces) { 4358 decimalPlaces = Math.floor(decimalPlaces); 4359 return Math.round(num * Math.pow(10, decimalPlaces)) / Math.pow(10, decimalPlaces); 4360 } 4361 function toWordFull(numb) { 4362 var numberWords = { 4363 0: "zero", 4364 1: "one", 4365 2: "two", 4366 3: "three", 4367 4: "four", 4368 5: "five", 4369 6: "six", 4370 7: "seven", 4371 8: "eight", 4372 9: "nine", 4373 10: "ten", 4374 11: "eleven", 4375 12: "twelve", 4376 13: "thirteen", 4377 14: "fourteen", 4378 15: "fifteen", 4379 16: "sixteen", 4380 17: "seventeen", 4381 18: "eighteen", 4382 19: "nineteen", 4383 20: "twenty", 4384 30: "thirty", 4385 40: "forty", 4386 50: "fifty", 4387 60: "sixty", 4388 70: "seventy", 4389 80: "eighty", 4390 90: "ninety", 4391 100: "one hundred", 4392 1000: "one thousand", 4393 1000000: "one million", 4394 1000000000: "one billion", 4395 1000000000000: "one trillion", 4396 1000000000000000: "one quadrillion" 4397 }; 4398 var oneHundred = 100; 4399 var oneThousand = 1000; 4400 var oneMillion = 1000000; 4401 var oneBillion = 1000000000; 4402 var oneTrillion = 1000000000000; 4403 var oneQuadrillion = 1000000000000000; 4404 if (numberWords[numb]) { 4405 return numberWords[numb]; 4406 } 4407 function quadrillionsToWord(numb) { 4408 var trillions = trillionsToWord(numb); 4409 if (numb >= oneQuadrillion) { 4410 var quadrillions = hundredsToWord(Number(numb.toString().slice(-18, -15))); 4411 if (trillions) { 4412 return "".concat(quadrillions, " quadrillion ").concat(trillions); 4413 } else { 4414 return "".concat(quadrillions, " quadrillion"); 4415 } 4416 } else { 4417 return trillions; 4418 } 4419 } 4420 function trillionsToWord(numb) { 4421 numb = Number(numb.toString().slice(-15)); 4422 var billions = billionsToWord(numb); 4423 if (numb >= oneTrillion) { 4424 var trillions = hundredsToWord(Number(numb.toString().slice(-15, -12))); 4425 if (billions) { 4426 return "".concat(trillions, " trillion ").concat(billions); 4427 } else { 4428 return "".concat(trillions, " trillion"); 4429 } 4430 } else { 4431 return billions; 4432 } 4433 } 4434 function billionsToWord(numb) { 4435 numb = Number(numb.toString().slice(-12)); 4436 var millions = millionsToWord(numb); 4437 if (numb >= oneBillion) { 4438 var billions = hundredsToWord(Number(numb.toString().slice(-12, -9))); 4439 if (millions) { 4440 return "".concat(billions, " billion ").concat(millions); 4441 } else { 4442 return "".concat(billions, " billion"); 4443 } 4444 } else { 4445 return millions; 4446 } 4447 } 4448 function millionsToWord(numb) { 4449 numb = Number(numb.toString().slice(-9)); 4450 var thousands = thousandsToWord(numb); 4451 if (numb >= oneMillion) { 4452 var millions = hundredsToWord(Number(numb.toString().slice(-9, -6))); 4453 if (thousands) { 4454 return "".concat(millions, " million ").concat(thousands); 4455 } else { 4456 return "".concat(millions, " million"); 4457 } 4458 } else { 4459 return thousands; 4460 } 4461 }
4462 function thousandsToWord(numb) { 4463 numb = Number(numb.toString().slice(-6)); 4464 var hundreds = hundredsToWord(numb); 4465 if (numb >= oneThousand) { 4466 var thousands = hundredsToWord(Number(numb.toString().slice(-6, -3))); 4467 if (hundreds) { 4468 return "".concat(thousands, " thousand ").concat(hundreds); 4469 } else { 4470 return "".concat(thousands, " thousandths"); 4471 } 4472 } else { 4473 return hundreds; 4474 } 4475 } 4476 function hundredsToWord(numb) { 4477 numb = Number(numb.toString().slice(-3)); 4478 if (numberWords[numb]) { 4479 return numberWords[numb]; 4480 } 4481 var tens = tensToWord(numb); 4482 if (numb >= oneHundred) { 4483 var hundreds = Number(numb.toString().slice(-3, -2)); 4484 if (tens) { 4485 return "".concat(numberWords[hundreds], " hundred ").concat(tens); 4486 } else { 4487 return "".concat(numberWords[hundreds], " hundred"); 4488 } 4489 } else { 4490 return tens; 4491 } 4492 } 4493 function tensToWord(numb) { 4494 numb = Number(numb.toString().slice(-2)); 4495 if (numberWords[numb]) { 4496 return numberWords[numb]; 4497 } 4498 var ones = onesToWord(numb); 4499 if (numb >= 20) { 4500 var tens = Number(numb.toString().slice(-2, -1)); 4501 if (ones) { 4502 return "".concat(numberWords[tens * 10], "-").concat(ones); 4503 } else { 4504 return numberWords[tens * 10]; 4505 } 4506 } else { 4507 return ones; 4508 } 4509 } 4510 function onesToWord(numb) { 4511 numb = Number(numb.toString().slice(-1)); 4512 return numberWords[numb]; 4513 } 4514 return quadrillionsToWord(numb); 4515 } 4516 var numberUtils = { 4517 toOrdinal, 4518 toOrdinalSuffix, 4519 toNumberOrNull, 4520 asFormattedString 4521 }; 4522 4523 var numberUtils$1 = /*#__PURE__*/Object.freeze({ 4524 __proto__: null, 4525 asFormattedString: asFormattedString, 4526 default: numberUtils, 4527 toCurrencyOrNull: toCurrencyOrNull, 4528 toDecimalPlaces: toDecimalPlaces, 4529 toNumber: toNumber, 4530 toNumberOrNull: toNumberOrNull, 4531 toOrdinal: toOrdinal, 4532 toOrdinalSuffix: toOrdinalSuffix, 4533 toWord: toWord, 4534 toWordFull: toWordFull, 4535 zeroPad: zeroPad 4536 }); 4537 exports('numberUtils', numberUtils$1); 4538 4539 function useVModelPassthrough(props, modelName, emit, options) { 4540 var internalValue = ref(props[modelName]); 4541 watch(() => props[modelName], val => updateRefValue(internalValue, val), options); 4542 watch(internalValue, val => { 4543 if (val !== props[modelName]) { 4544 emit("update:".concat(modelName), val); 4545 } 4546 }, options); 4547 return internalValue; 4548 } 4549 function useVModelPassthroughWithPropUpdateCheck(props, modelName, emit, options) { 4550 var internalValue = ref(props[modelName]); 4551 var listeners = []; 4552 watch(() => props[modelName], val => { 4553 if (updateRefValue(internalValue, val)) { 4554 onPropUpdate(); 4555 } 4556 }, options); 4557 watch(internalValue, val => emit("update:".concat(modelName), val), options); 4558 function onPropUpdate() { 4559 listeners.forEach(fn => fn()); 4560 } 4561 function addPropUpdateListener(fn) { 4562 listeners.push(fn); 4563 } 4564 return [internalValue, addPropUpdateListener]; 4565 } 4566 function updateRefValue(target, value) { 4567 if (deepEqual(target.value, value, true)) { 4568 return false; 4569 } 4570 target.value = value; 4571 return true; 4572 } 4573 function defineAsyncComponent(source) { 4574 return defineAsyncComponent$1(_asyncToGenerator(function* () { 4575 var suspense = useSuspense(); 4576 var operationKey = newGuid(); 4577 suspense === null || suspense === void 0 || suspense.startAsyncOperation(operationKey); 4578 var component = yield source(); 4579 suspense === null || suspense === void 0 || suspense.completeAsyncOperation(operationKey); 4580 return component; 4581 })); 4582 }
4583 var standardRockFormFieldProps = { 4584 label: { 4585 type: String, 4586 default: "" 4587 }, 4588 disableLabel: { 4589 type: Boolean, 4590 default: false 4591 }, 4592 help: { 4593 type: String, 4594 default: "" 4595 }, 4596 rules: { 4597 type: [Array, Object, String], 4598 default: "" 4599 }, 4600 formGroupClasses: { 4601 type: String, 4602 default: "" 4603 }, 4604 validationTitle: { 4605 type: String, 4606 default: "" 4607 }, 4608 isRequiredIndicatorHidden: { 4609 type: Boolean, 4610 default: false 4611 }, 4612 trailblazerField: { 4613 type: Boolean, 4614 default: false 4615 } 4616 }; 4617 function copyStandardRockFormFieldProps(source, destination) { 4618 destination.formGroupClasses = source.formGroupClasses; 4619 destination.help = source.help; 4620 destination.label = source.label; 4621 destination.rules = source.rules; 4622 destination.validationTitle = source.validationTitle; 4623 } 4624 function useStandardRockFormFieldProps(props) { 4625 var propValues = reactive({ 4626 label: props.label, 4627 disableLabel: props.disableLabel, 4628 help: props.help, 4629 rules: props.rules, 4630 formGroupClasses: props.formGroupClasses, 4631 validationTitle: props.validationTitle, 4632 isRequiredIndicatorHidden: props.isRequiredIndicatorHidden, 4633 trailblazerField: props.trailblazerField 4634 }); 4635 watch([() => props.formGroupClasses, () => props.help, () => props.label, () => props.rules, () => props.validationTitle], () => { 4636 copyStandardRockFormFieldProps(props, propValues); 4637 }); 4638 return propValues; 4639 } 4640 var standardAsyncPickerProps = _objectSpread2(_objectSpread2({}, standardRockFormFieldProps), {}, { 4641 enhanceForLongLists: { 4642 type: Boolean, 4643 default: false 4644 }, 4645 lazyMode: { 4646 type: String, 4647 default: ControlLazyMode.OnDemand 4648 }, 4649 multiple: { 4650 type: Boolean, 4651 default: false 4652 }, 4653 showBlankItem: { 4654 type: Boolean, 4655 default: false 4656 }, 4657 blankValue: { 4658 type: String, 4659 default: "" 4660 }, 4661 displayStyle: { 4662 type: String, 4663 default: PickerDisplayStyle.Auto 4664 }, 4665 columnCount: { 4666 type: Number, 4667 default: 0 4668 } 4669 }); 4670 function copyStandardAsyncPickerProps(source, destination) { 4671 copyStandardRockFormFieldProps(source, destination); 4672 destination.enhanceForLongLists = source.enhanceForLongLists; 4673 destination.lazyMode = source.lazyMode; 4674 destination.multiple = source.multiple; 4675 destination.showBlankItem = source.showBlankItem; 4676 destination.blankValue = source.blankValue; 4677 destination.displayStyle = source.displayStyle; 4678 destination.columnCount = source.columnCount; 4679 } 4680 function useStandardAsyncPickerProps(props) { 4681 var standardFieldProps = useStandardRockFormFieldProps(props); 4682 var propValues = reactive(_objectSpread2(_objectSpread2({}, standardFieldProps), {}, { 4683 enhanceForLongLists: props.enhanceForLongLists, 4684 lazyMode: props.lazyMode, 4685 multiple: props.multiple, 4686 showBlankItem: props.showBlankItem, 4687 blankValue: props.blankValue, 4688 displayStyle: props.displayStyle, 4689 columnCount: props.columnCount 4690 })); 4691 watch(() => standardFieldProps, () => { 4692 copyStandardRockFormFieldProps(props, propValues); 4693 }, { 4694 deep: true 4695 }); 4696 watch([() => props.enhanceForLongLists, () => props.lazyMode, () => props.multiple, () => props.showBlankItem, () => props.displayStyle, () => props.columnCount], () => { 4697 copyStandardAsyncPickerProps(props, propValues); 4698 }); 4699 return propValues; 4700 } 4701 var standardDynamicComponentProps = { 4702 modelValue: { 4703 type: Object, 4704 required: true 4705 }, 4706 options: { 4707 type: Object, 4708 required: true 4709 }, 4710 executeRequest: { 4711 type: Function, 4712 required: true 4713 } 4714 }; 4715 function loadDynamicComponentDefinition(_x) { 4716 return _loadDynamicComponentDefinition.apply(this, arguments); 4717 } 4718 function _loadDynamicComponentDefinition() { 4719 _loadDynamicComponentDefinition = _asyncToGenerator(function* (definition) { 4720 if (!definition || !definition.url) { 4721 return; 4722 } 4723 try { 4724 var controlComponentModule = yield module.import(definition.url); 4725 var controlModule = controlComponentModule ? controlComponentModule.default || controlComponentModule : null; 4726 if (controlModule) { 4727 Object.defineProperty(definition, "__component", { 4728 value: markRaw(controlModule), 4729 writable: false, 4730 enumerable: false 4731 }); 4732 } 4733 } catch (e) { 4734 console.error(e); 4735 } finally { 4736 if (!("__component" in definition)) { 4737 Object.defineProperty(definition, "__componentError", { 4738 value: "Could not load the control for '".concat(definition.url, "'"), 4739 writable: false, 4740 enumerable: false 4741 }); 4742 } 4743 } 4744 }); 4745 return _loadDynamicComponentDefinition.apply(this, arguments); 4746 }
4747 var dataViewFilterProps = _objectSpread2(_objectSpread2({}, standardDynamicComponentProps), {}, { 4748 filterMode: { 4749 type: Number, 4750 required: true 4751 } 4752 }); 4753 var dataViewSelectProps = standardDynamicComponentProps; 4754 function extendedRef(value, context) { 4755 var refValue = ref(value); 4756 refValue.context = context; 4757 return refValue; 4758 } 4759 function propertyRef(value, propertyName) { 4760 return extendedRef(value, { 4761 propertyName 4762 }); 4763 } 4764 function getVNodeProp(node, propName) { 4765 if (node.props && node.props[propName] !== undefined) { 4766 return node.props[propName]; 4767 } 4768 if (typeof node.type === "object" && typeof node.type["props"] === "object") { 4769 var defaultProps = node.type["props"]; 4770 var defaultProp = defaultProps[propName]; 4771 if (defaultProp && typeof defaultProp === "object" && defaultProp["default"] !== undefined) { 4772 return defaultProp["default"]; 4773 } 4774 } 4775 return undefined; 4776 } 4777 function getVNodeProps(node) { 4778 var props = {}; 4779 if (typeof node.type === "object" && typeof node.type["props"] === "object") { 4780 var defaultProps = node.type["props"]; 4781 for (var p in defaultProps) { 4782 var defaultProp = defaultProps[p]; 4783 if (defaultProp && typeof defaultProp === "object" && defaultProp["default"] !== undefined) { 4784 props[p] = defaultProp["default"]; 4785 } 4786 } 4787 } 4788 if (node.props) { 4789 for (var _p in node.props) { 4790 if (typeof node.type === "object" && typeof node.type["props"] === "object") { 4791 var _node$type$props$_p; 4792 var propType = (_node$type$props$_p = node.type["props"][_p]) === null || _node$type$props$_p === void 0 ? void 0 : _node$type$props$_p.type; 4793 if (propType === Boolean) { 4794 props[_p] = node.props[_p] === true || node.props[_p] === ""; 4795 } else if (propType === Number) { 4796 var _toNumberOrNull; 4797 props[_p] = (_toNumberOrNull = toNumberOrNull(node.props[_p])) !== null && _toNumberOrNull !== void 0 ? _toNumberOrNull : undefined; 4798 } else { 4799 props[_p] = node.props[_p]; 4800 } 4801 } else { 4802 props[_p] = node.props[_p]; 4803 } 4804 } 4805 } 4806 return props; 4807 } 4808 function extractText(node, props) { 4809 var el = document.createElement("div"); 4810 var vnode = createVNode(node, props); 4811 render(vnode, el); 4812 var text = el.innerText; 4813 render(null, el); 4814 return text.trim(); 4815 } 4816 function extractHtml(node, props) { 4817 var el = document.createElement("div"); 4818 var vnode = createVNode(node, props); 4819 render(vnode, el); 4820 var html = el.innerHTML; 4821 render(null, el); 4822 return html; 4823 } 4824 4825 var component = /*#__PURE__*/Object.freeze({ 4826 __proto__: null, 4827 dataViewFilterProps: dataViewFilterProps, 4828 dataViewSelectProps: dataViewSelectProps, 4829 defineAsyncComponent: defineAsyncComponent, 4830 extendedRef: extendedRef, 4831 extractHtml: extractHtml, 4832 extractText: extractText, 4833 getVNodeProp: getVNodeProp, 4834 getVNodeProps: getVNodeProps, 4835 loadDynamicComponentDefinition: loadDynamicComponentDefinition, 4836 propertyRef: propertyRef, 4837 standardAsyncPickerProps: standardAsyncPickerProps, 4838 standardDynamicComponentProps: standardDynamicComponentProps, 4839 standardRockFormFieldProps: standardRockFormFieldProps, 4840 updateRefValue: updateRefValue, 4841 useStandardAsyncPickerProps: useStandardAsyncPickerProps, 4842 useStandardRockFormFieldProps: useStandardRockFormFieldProps, 4843 useVModelPassthrough: useVModelPassthrough, 4844 useVModelPassthroughWithPropUpdateCheck: useVModelPassthroughWithPropUpdateCheck 4845 }); 4846 exports('component', component); 4847 4848 function getCssVariableValue(cssVariableName, fallbackValue, targetElement) { 4849 var element = targetElement ? typeof targetElement === "string" ? document.querySelector(targetElement) : targetElement : document.documentElement; 4850 if (!element) { 4851 return fallbackValue || ""; 4852 } 4853 var computedStyle = getComputedStyle(element).getPropertyValue(cssVariableName).trim(); 4854 return computedStyle || fallbackValue || ""; 4855 } 4856 4857 var cssUtils = /*#__PURE__*/Object.freeze({ 4858 __proto__: null, 4859 getCssVariableValue: getCssVariableValue 4860 }); 4861 exports('cssUtils', cssUtils); 4862 4863 var dateKeyLength = "YYYYMMDD".length; 4864 var dateKeyNoYearLength = "MMDD".length; 4865 function getYear(dateKey) { 4866 var defaultValue = 0; 4867 if (!dateKey || dateKey.length !== dateKeyLength) { 4868 return defaultValue; 4869 } 4870 var asString = dateKey.substring(0, 4); 4871 var year = toNumberOrNull(asString) || defaultValue; 4872 return year; 4873 } 4874 function getMonth(dateKey) { 4875 var defaultValue = 0; 4876 if (!dateKey) { 4877 return defaultValue; 4878 } 4879 if (dateKey.length === dateKeyLength) { 4880 var asString = dateKey.substring(4, 6); 4881 return toNumberOrNull(asString) || defaultValue; 4882 } 4883 if (dateKey.length === dateKeyNoYearLength) { 4884 var _asString = dateKey.substring(0, 2); 4885 return toNumberOrNull(_asString) || defaultValue; 4886 } 4887 return defaultValue; 4888 } 4889 function getDay(dateKey) { 4890 var defaultValue = 0; 4891 if (!dateKey) { 4892 return defaultValue; 4893 } 4894 if (dateKey.length === dateKeyLength) { 4895 var asString = dateKey.substring(6, 8); 4896 return toNumberOrNull(asString) || defaultValue; 4897 } 4898 if (dateKey.length === dateKeyNoYearLength) { 4899 var _asString2 = dateKey.substring(2, 4); 4900 return toNumberOrNull(_asString2) || defaultValue; 4901 } 4902 return defaultValue; 4903 } 4904 function toDateKey(year, month, day) { 4905 if (!year || year > 9999 || year < 0) { 4906 year = 0; 4907 } 4908 if (!month || month > 12 || month < 0) {
4909 month = 0; 4910 } 4911 if (!day || day > 31 || day < 0) { 4912 day = 0; 4913 } 4914 var yearStr = zeroPad(year, 4); 4915 var monthStr = zeroPad(month, 2); 4916 var dayStr = zeroPad(day, 2); 4917 return "".concat(yearStr).concat(monthStr).concat(dayStr); 4918 } 4919 function toNoYearDateKey(month, day) { 4920 if (!month || month > 12 || month < 0) { 4921 month = 0; 4922 } 4923 if (!day || day > 31 || day < 0) { 4924 day = 0; 4925 } 4926 var monthStr = zeroPad(month, 2); 4927 var dayStr = zeroPad(day, 2); 4928 return "".concat(monthStr).concat(dayStr); 4929 } 4930 var dateKey = { 4931 getYear, 4932 getMonth, 4933 getDay, 4934 toDateKey, 4935 toNoYearDateKey 4936 }; 4937 4938 var dateKey$1 = /*#__PURE__*/Object.freeze({ 4939 __proto__: null, 4940 default: dateKey, 4941 getDay: getDay, 4942 getMonth: getMonth, 4943 getYear: getYear, 4944 toDateKey: toDateKey, 4945 toNoYearDateKey: toNoYearDateKey 4946 }); 4947 exports('dateKey', dateKey$1); 4948 4949 function smoothScrollToTop() { 4950 window.scrollTo({ 4951 top: 0, 4952 behavior: "smooth" 4953 }); 4954 } 4955 var page = { 4956 smoothScrollToTop 4957 }; 4958 var currentModalCount = 0; 4959 function trackModalState(state) { 4960 var body = document.body;
4961 var cssClasses = ["modal-open"]; 4962 if (state) { 4963 currentModalCount++; 4964 } else { 4965 currentModalCount = currentModalCount > 0 ? currentModalCount - 1 : 0; 4966 } 4967 if (currentModalCount > 0) { 4968 var _iterator = _createForOfIteratorHelper(cssClasses), 4969 _step; 4970 try { 4971 for (_iterator.s(); !(_step = _iterator.n()).done;) { 4972 var cssClass = _step.value; 4973 body.classList.add(cssClass); 4974 } 4975 } catch (err) { 4976 _iterator.e(err); 4977 } finally { 4978 _iterator.f(); 4979 } 4980 } else { 4981 var _iterator2 = _createForOfIteratorHelper(cssClasses), 4982 _step2; 4983 try { 4984 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 4985 var _cssClass = _step2.value; 4986 body.classList.remove(_cssClass); 4987 } 4988 } catch (err) { 4989 _iterator2.e(err); 4990 } finally { 4991 _iterator2.f(); 4992 } 4993 } 4994 } 4995 function loadJavaScriptAsync(_x, _x2, _x3, _x4) { 4996 return _loadJavaScriptAsync.apply(this, arguments); 4997 } 4998 function _loadJavaScriptAsync() { 4999 _loadJavaScriptAsync = _asyncToGenerator(function* (source, isScriptLoaded, attributes, fingerprint) { 5000 var _Obsidian; 5001 var src = source; 5002 if (fingerprint !== false && typeof Obsidian !== "undefined" && (_Obsidian = Obsidian) !== null && _Obsidian !== void 0 && (_Obsidian = _Obsidian.options) !== null && _Obsidian !== void 0 && _Obsidian.fingerprint) { 5003 if (src.indexOf("?") === -1) { 5004 src += "?".concat(Obsidian.options.fingerprint); 5005 } else { 5006 src += "&".concat(Obsidian.options.fingerprint); 5007 } 5008 } 5009 if (isScriptLoaded) { 5010 if (isScriptLoaded()) { 5011 return true; 5012 } 5013 } 5014 var scripts = Array.from(document.getElementsByTagName("script")); 5015 var thisScript = scripts.filter(s => s.src === src); 5016 if (thisScript.length > 0) { 5017 var _promise = scriptLoadedPromise(thisScript[0]); 5018 return _promise; 5019 } 5020 var script = document.createElement("script"); 5021 script.type = "text/javascript"; 5022 script.src = src; 5023 if (attributes) { 5024 for (var key in attributes) { 5025 script.setAttribute(key, attributes[key]); 5026 } 5027 } 5028 var promise = scriptLoadedPromise(script); 5029 document.getElementsByTagName("head")[0].appendChild(script); 5030 return promise; 5031 function scriptLoadedPromise(_x5) { 5032 return _scriptLoadedPromise.apply(this, arguments); 5033 } 5034 function _scriptLoadedPromise() { 5035 _scriptLoadedPromise = _asyncToGenerator(function* (scriptElement) { 5036 try { 5037 yield new Promise((resolve, reject) => { 5038 scriptElement.addEventListener("load", () => resolve()); 5039 scriptElement.addEventListener("error", () => { 5040 reject(); 5041 }); 5042 }); 5043 if (isScriptLoaded) { 5044 return isScriptLoaded(); 5045 } 5046 return true; 5047 } catch (_unused) { 5048 return false; 5049 } 5050 }); 5051 return _scriptLoadedPromise.apply(this, arguments); 5052 } 5053 }); 5054 return _loadJavaScriptAsync.apply(this, arguments); 5055 } 5056 function addQuickReturn(title, section, sectionOrder) { 5057 var rock = window["Rock"]; 5058 if (rock && rock.personalLinks) { 5059 rock.personalLinks.addQuickReturn(section, sectionOrder !== null && sectionOrder !== void 0 ? sectionOrder : 0, title); 5060 } 5061 } 5062 5063 var page$1 = /*#__PURE__*/Object.freeze({ 5064 __proto__: null, 5065 addQuickReturn: addQuickReturn, 5066 default: page, 5067 loadJavaScriptAsync: loadJavaScriptAsync, 5068 smoothScrollToTop: smoothScrollToTop, 5069 trackModalState: trackModalState 5070 }); 5071 exports('page', page$1); 5072 5073 function createDialog(body, footer) { 5074 var scrollable = document.createElement("div"); 5075 scrollable.classList.add("modal-scrollable"); 5076 scrollable.style.zIndex = "1060"; 5077 var modal = document.createElement("div"); 5078 scrollable.appendChild(modal); 5079 modal.classList.add("modal", "fade"); 5080 modal.tabIndex = -1; 5081 modal.setAttribute("role", "dialog"); 5082 modal.setAttribute("aria-hidden", "false"); 5083 modal.style.display = "block"; 5084 var modalDialog = document.createElement("div"); 5085 modal.appendChild(modalDialog); 5086 modalDialog.classList.add("modal-dialog"); 5087 var modalContent = document.createElement("div"); 5088 modalDialog.appendChild(modalContent); 5089 modalContent.classList.add("modal-content"); 5090 var modalBody = document.createElement("div"); 5091 modalContent.appendChild(modalBody); 5092 modalBody.classList.add("modal-body"); 5093 if (Array.isArray(body)) { 5094 var _iterator = _createForOfIteratorHelper(body), 5095 _step; 5096 try { 5097 for (_iterator.s();
5097 !(_step = _iterator.n()).done;) { 5098 var el = _step.value; 5099 modalBody.appendChild(el); 5100 } 5101 } catch (err) { 5102 _iterator.e(err); 5103 } finally { 5104 _iterator.f(); 5105 } 5106 } else { 5107 modalBody.appendChild(body); 5108 } 5109 if (footer && (!Array.isArray(footer) || footer.length > 0)) { 5110 var modalFooter = document.createElement("div"); 5111 modalContent.appendChild(modalFooter); 5112 modalFooter.classList.add("modal-footer"); 5113 if (Array.isArray(footer)) { 5114 var _iterator2 = _createForOfIteratorHelper(footer), 5115 _step2; 5116 try { 5117 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 5118 var _el = _step2.value; 5119 modalFooter.appendChild(_el); 5120 } 5121 } catch (err) { 5122 _iterator2.e(err); 5123 } finally { 5124 _iterator2.f(); 5125 } 5126 } else { 5127 modalFooter.appendChild(footer); 5128 } 5129 } 5130 scrollable.addEventListener("click", () => { 5131 modal.classList.remove("animated", "shake"); 5132 setTimeout(() => { 5133 modal.classList.add("animated", "shake"); 5134 }, 0); 5135 }); 5136 return scrollable; 5137 } 5138 function createCloseButton() { 5139 var closeButton = document.createElement("button"); 5140 closeButton.classList.add("close"); 5141 closeButton.type = "button"; 5142 closeButton.style.marginTop = "-10px"; 5143 closeButton.innerHTML = "×"; 5144 return closeButton; 5145 } 5146 function createBackdrop() { 5147 var backdrop = document.createElement("div"); 5148 backdrop.classList.add("modal-backdrop"); 5149 backdrop.style.zIndex = "1050"; 5150 return backdrop; 5151 } 5152 function showDialog(options) { 5153 return new Promise(resolve => { 5154 var _options$cancellation; 5155 var timer = null; 5156 var container = document.fullscreenElement || document.body; 5157 var body = document.createElement("div"); 5158 var autoFocus = null; 5159 if (options.message instanceof HTMLElement) { 5160 body.appendChild(options.message); 5161 } else { 5162 body.innerText = options.message; 5163 } 5164 var buttons = []; 5165 function clearDialog(result) { 5166 if (timer !== null) { 5167 return; 5168 } 5169 timer = setTimeout(() => { 5170 backdrop.remove(); 5171 dialog.remove(); 5172 trackModalState(false); 5173 resolve(result); 5174 }, 1000); 5175 modal.addEventListener("transitionend", () => { 5176 if (timer) { 5177 clearTimeout(timer); 5178 } 5179 backdrop.remove(); 5180 dialog.remove(); 5181 trackModalState(false); 5182 resolve(result); 5183 }); 5184 modal.classList.remove("in"); 5185 backdrop.classList.remove("in"); 5186 } 5187 var _iterator3 = _createForOfIteratorHelper(options.buttons), 5188 _step3; 5189 try { 5190 var _loop = function _loop() { 5191 var button = _step3.value; 5192 var btn = document.createElement("button"); 5193 btn.classList.value = button.className; 5194 btn.type = "button"; 5195 btn.innerText = button.label; 5196 btn.addEventListener("click", () => { 5197 clearDialog(button.key); 5198 }); 5199 if (button.autoFocus) { 5200 autoFocus = btn; 5201 } 5202 buttons.push(btn); 5203 }; 5204 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 5205 _loop(); 5206 } 5207 } catch (err) { 5208 _iterator3.e(err); 5209 } finally { 5210 _iterator3.f(); 5211 } 5212 var dialogBody = [body]; 5213 if (!options.hideCloseButton) { 5214 var closeButton = createCloseButton(); 5215 closeButton.addEventListener("click", () => { 5216 clearDialog("cancel"); 5217 }); 5218 dialogBody.splice(0, 0, closeButton); 5219 } 5220 var dialog = createDialog(dialogBody, buttons); 5221 var backdrop = createBackdrop(); 5222 var modal = dialog.querySelector(".modal"); 5223 trackModalState(true); 5224 container.appendChild(dialog); 5225 container.appendChild(backdrop); 5226 modal.style.marginTop = "-".concat(modal.offsetHeight / 2.0, "px"); 5227 if (autoFocus) { 5228 autoFocus.focus(); 5229 } 5230 backdrop.classList.add("in"); 5231 modal.classList.add("in"); 5232 (_options$cancellation = options.cancellationToken) === null || _options$cancellation === void 0 || _options$cancellation.onCancellationRequested(() => { 5233 clearDialog("cancel"); 5234 }); 5235 }); 5236 } 5237 function alert(_x) { 5238 return _alert.apply(this, arguments); 5239 } 5240 function _alert() { 5241 _alert = _asyncToGenerator(function* (message) { 5242 yield showDialog({ 5243 message, 5244 buttons: [{ 5245 key: "ok", 5246 label: "OK", 5247 className: "btn btn-primary" 5248 }] 5249 }); 5250 }); 5251 return _alert.apply(this, arguments); 5252 } 5253 function confirm(_x2) {
5254 return _confirm.apply(this, arguments); 5255 } 5256 function _confirm() { 5257 _confirm = _asyncToGenerator(function* (message) { 5258 var result = yield showDialog({ 5259 message, 5260 buttons: [{ 5261 key: "ok", 5262 label: "OK", 5263 className: "btn btn-primary", 5264 autoFocus: true 5265 }, { 5266 key: "cancel", 5267 label: "Cancel", 5268 className: "btn btn-default" 5269 }] 5270 }); 5271 return result === "ok"; 5272 }); 5273 return _confirm.apply(this, arguments); 5274 } 5275 function confirmDelete(typeName, additionalMessage) { 5276 var message = "Are you sure you want to delete this ".concat(typeName, "?"); 5277 if (additionalMessage) { 5278 message += " ".concat(additionalMessage); 5279 } 5280 return confirm(message); 5281 } 5282 function showSecurity(entityTypeIdKey, entityIdKey) { 5283 var entityTitle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Item"; 5284 Rock.controls.modal.show(undefined, "/Secure/".concat(entityTypeIdKey, "/").concat(entityIdKey, "?t=Secure ").concat(entityTitle, "&pb=&sb=Done")); 5285 } 5286 function showChildPages(pageId) { 5287 Rock.controls.modal.show(undefined, "/pages/".concat(pageId, "?t=Child Pages&pb=&sb=Done")); 5288 } 5289 5290 var dialogs = /*#__PURE__*/Object.freeze({ 5291 __proto__: null, 5292 alert: alert, 5293 confirm: confirm, 5294 confirmDelete: confirmDelete, 5295 showChildPages: showChildPages, 5296 showDialog: showDialog, 5297 showSecurity: showSecurity 5298 }); 5299 exports('dialogs', dialogs); 5300 5301 function isEmail(val) { 5302 if (typeof val === "string") { 5303 var 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,}))$/; 5304 return re.test(val.toLowerCase()); 5305 } 5306 return false; 5307 } 5308 5309 var email = /*#__PURE__*/Object.freeze({ 5310 __proto__: null, 5311 isEmail: isEmail 5312 }); 5313 exports('email', email); 5314 5315 function enumToListItemBag(description) { 5316 var listItemBagList = []; 5317 var order = description["__order"]; 5318 if (order) { 5319 var _iterator = _createForOfIteratorHelper(order), 5320 _step; 5321 try { 5322 for (_iterator.s(); !(_step = _iterator.n()).done;) { 5323 var value = _step.value; 5324 listItemBagList.push({ 5325 text: description[value], 5326 value: value.toString() 5327 }); 5328 } 5329 } catch (err) { 5330 _iterator.e(err); 5331 } finally { 5332 _iterator.f(); 5333 } 5334 } else { 5335 for (var property in description) { 5336 listItemBagList.push({ 5337 text: description[property], 5338 value: property.toString() 5339 }); 5340 } 5341 } 5342 return listItemBagList; 5343 } 5344 5345 var enumUtils = /*#__PURE__*/Object.freeze({ 5346 __proto__: null, 5347 enumToListItemBag: enumToListItemBag 5348 }); 5349 exports('enumUtils', enumUtils); 5350 5351 var fieldTypeTable = {}; 5352 var fieldTypeAttributeGuidSymbol = Symbol(); 5353 function registerFieldType(fieldTypeGuid, fieldType) { 5354 var normalizedGuid = normalize(fieldTypeGuid); 5355 if (!isValidGuid(fieldTypeGuid) || normalizedGuid === null) { 5356 throw "Invalid guid specified when registering field type."; 5357 } 5358 if (fieldTypeTable[normalizedGuid] !== undefined) { 5359 throw "Invalid attempt to replace existing field type."; 5360 } 5361 fieldTypeTable[normalizedGuid] = fieldType; 5362 } 5363 function getFieldType(fieldTypeGuid) { 5364 var normalizedGuid = normalize(fieldTypeGuid); 5365 if (normalizedGuid !== null) { 5366 var field = fieldTypeTable[normalizedGuid]; 5367 if (field) { 5368 return field; 5369 } 5370 } 5371 console.warn("Field type \"".concat(fieldTypeGuid, "\" was not found")); 5372 return null; 5373 } 5374 function provideFieldTypeAttributeGuid(guid) { 5375 provide(fieldTypeAttributeGuidSymbol, guid); 5376 } 5377 function useFieldTypeAttributeGuid() { 5378 return inject(fieldTypeAttributeGuidSymbol, ref()); 5379 } 5380 5381 var fieldTypes = /*#__PURE__*/Object.freeze({ 5382 __proto__: null, 5383 getFieldType: getFieldType, 5384 provideFieldTypeAttributeGuid: provideFieldTypeAttributeGuid, 5385 registerFieldType: registerFieldType, 5386 useFieldTypeAttributeGuid: useFieldTypeAttributeGuid 5387 }); 5388 exports('fieldTypes', fieldTypes); 5389 5390 function downloadFile(_x, _x2) { 5391 return _downloadFile.apply(this, arguments); 5392 } 5393 function _downloadFile() { 5394 _downloadFile = _asyncToGenerator(function* (data, filename) { 5395 var url = URL.createObjectURL(data); 5396 var element = document.createElement("a"); 5397 element.innerText = "Download"; 5398 element.style.position = "absolute"; 5399 element.style.top = "-100px"; 5400 element.style.left = "0"; 5401 element.href = url; 5402 element.download = filename; 5403 document.body.appendChild(element); 5404 element.click(); 5405 document.body.removeChild(element); 5406 setTimeout(() => URL.revokeObjectURL(url), 100); 5407 }); 5408 return _downloadFile.apply(this, arguments); 5409 } 5410 function fetchImageFileExtensions() { 5411 return _fetchImageFileExtensions.apply(this, arguments); 5412 } 5413 function _fetchImageFileExtensions() { 5414 _fetchImageFileExtensions = _asyncToGenerator(function* () { 5415 var http = useHttp(); 5416 var result = yield http.post("/api/v2/Utilities/GetImageFileExtensions"); 5417 if (result.isSuccess && result.data) { 5418 return result.data.split(","); 5419 } 5420 return null; 5421 }); 5422 return _fetchImageFileExtensions.apply(this, arguments); 5423 }
5424 var getImageFileExtensions = Cache.cachePromiseFactory("imageFileExtensions", fetchImageFileExtensions); 5425 function isImage(_x3) { 5426 return _isImage.apply(this, arguments); 5427 } 5428 function _isImage() { 5429 _isImage = _asyncToGenerator(function* (filename) { 5430 var _imageExtensions$incl; 5431 var imageExtensions = yield getImageFileExtensions(); 5432 var extension = filename.split(".").pop(); 5433 return !!extension && ((_imageExtensions$incl = imageExtensions === null || imageExtensions === void 0 ? void 0 : imageExtensions.includes(extension.toLowerCase())) !== null && _imageExtensions$incl !== void 0 ? _imageExtensions$incl : false); 5434 }); 5435 return _isImage.apply(this, arguments); 5436 } 5437 function resizeImageFileProcessor() { 5438 var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, 5439 minWidth = _ref.minWidth, 5440 minHeight = _ref.minHeight, 5441 maxWidth = _ref.maxWidth, 5442 maxHeight = _ref.maxHeight; 5443 return file => { 5444 if (!file.type.startsWith("image/")) { 5445 return file; 5446 } 5447 return new Promise((resolve, reject) => { 5448 var img = new Image(); 5449 var objectUrl = URL.createObjectURL(file); 5450 img.src = objectUrl; 5451 img.onload = () => { 5452 URL.revokeObjectURL(objectUrl); 5453 var width = img.width, 5454 height = img.height; 5455 if (!maxWidth && !maxHeight && !minWidth && !minHeight) { 5456 resolve(file); 5457 return; 5458 } 5459 var minScale = Math.max(minWidth ? minWidth / width : 0, minHeight ? minHeight / height : 0, 0); 5460 var maxScale = Math.min(maxWidth ? maxWidth / width : Infinity, maxHeight ? maxHeight / height : Infinity, 1); 5461 var scaleFactor = 1; 5462 if (minScale > 1) { 5463 scaleFactor = minScale; 5464 } else if (maxScale < 1) { 5465 scaleFactor = maxScale; 5466 } 5467 if (scaleFactor === 1) { 5468 resolve(file); 5469 return; 5470 } 5471 var newWidth = Math.round(width * scaleFactor); 5472 var newHeight = Math.round(height * scaleFactor); 5473 var canvas = document.createElement("canvas"); 5474 canvas.width = newWidth; 5475 canvas.height = newHeight; 5476 var ctx = canvas.getContext("2d"); 5477 if (!ctx) { 5478 reject(new Error("Failed to get canvas context")); 5479 return; 5480 } 5481 ctx.imageSmoothingEnabled = true; 5482 ctx.imageSmoothingQuality = "high"; 5483 ctx.drawImage(img, 0, 0, newWidth, newHeight); 5484 canvas.toBlob(blob => { 5485 if (!blob) { 5486 reject(new Error("Failed to resize image")); 5487 return; 5488 } 5489 var resizedFile = new File([blob], file.name, { 5490 type: file.type 5491 }); 5492 resolve(resizedFile); 5493 }, file.type); 5494 }; 5495 img.onerror = () => { 5496 URL.revokeObjectURL(objectUrl); 5497 reject(new Error("Failed to load image")); 5498 }; 5499 }); 5500 }; 5501 } 5502 5503 var file = /*#__PURE__*/Object.freeze({ 5504 __proto__: null, 5505 downloadFile: downloadFile, 5506 getImageFileExtensions: getImageFileExtensions, 5507 isImage: isImage, 5508 resizeImageFileProcessor: resizeImageFileProcessor 5509 }); 5510 exports('file', file); 5511 5512 var formStateSymbol = Symbol(); 5513 function provideFormState(state) { 5514 provide(formStateSymbol, state); 5515 } 5516 function useFormState() { 5517 return inject(formStateSymbol, undefined); 5518 } 5519 5520 var form = /*#__PURE__*/Object.freeze({ 5521 __proto__: null, 5522 provideFormState: provideFormState, 5523 useFormState: useFormState 5524 }); 5525 exports('form', form); 5526 5527 function enterFullscreen(_x, _x2) { 5528 return _enterFullscreen.apply(this, arguments); 5529 } 5530 function _enterFullscreen() { 5531 _enterFullscreen = _asyncToGenerator(function* (element, exitCallback) { 5532 try { 5533 if (element.requestFullscreen) { 5534 yield element.requestFullscreen(); 5535 } else if (element.mozRequestFullscreen) { 5536 yield element.mozRequestFullscreen(); 5537 } else if (element.webkitRequestFullscreen) { 5538 yield element.webkitRequestFullscreen(); 5539 } else { 5540 return false;
5541 } 5542 element.classList.add("is-fullscreen"); 5543 var onFullscreenChange = () => { 5544 element.classList.remove("is-fullscreen"); 5545 document.removeEventListener("fullscreenchange", onFullscreenChange); 5546 document.removeEventListener("mozfullscreenchange", onFullscreenChange); 5547 document.removeEventListener("webkitfullscreenchange", onFullscreenChange); 5548 if (exitCallback) { 5549 exitCallback(); 5550 } 5551 }; 5552 document.addEventListener("fullscreenchange", onFullscreenChange); 5553 document.addEventListener("mozfullscreenchange", onFullscreenChange); 5554 document.addEventListener("webkitfullscreenchange", onFullscreenChange); 5555 return true; 5556 } catch (ex) { 5557 console.error(ex); 5558 return false; 5559 } 5560 }); 5561 return _enterFullscreen.apply(this, arguments); 5562 } 5563 function isFullscreen() { 5564 return !!getFullscreenElement(); 5565 } 5566 function getFullscreenElement() { 5567 return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement; 5568 } 5569 function exitFullscreen() { 5570 return _exitFullscreen.apply(this, arguments); 5571 } 5572 function _exitFullscreen() { 5573 _exitFullscreen = _asyncToGenerator(function* () { 5574 try { 5575 if (document.exitFullscreen) { 5576 yield document.exitFullscreen(); 5577 } else if (document.mozCancelFullScreen) { 5578 yield document.mozCancelFullScreen(); 5579 } else if (document.webkitExitFullscreen) { 5580 document.webkitExitFullscreen(); 5581 } else { 5582 return false; 5583 } 5584 return true; 5585 } catch (ex) { 5586 console.error(ex); 5587 return false; 5588 } 5589 }); 5590 return _exitFullscreen.apply(this, arguments); 5591 } 5592 5593 var fullscreen = /*#__PURE__*/Object.freeze({ 5594 __proto__: null, 5595 enterFullscreen: enterFullscreen, 5596 exitFullscreen: exitFullscreen, 5597 getFullscreenElement: getFullscreenElement, 5598 isFullscreen: isFullscreen 5599 }); 5600 exports('fullscreen', fullscreen); 5601 5602 function toCoordinate(coord) { 5603 var isWellKnown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 5604 if (typeof coord == "string") { 5605 if (isWellKnown) { 5606 return coord.split(" ").reverse().map(val => parseFloat(val)); 5607 } else { 5608 return coord.split(",").map(val => parseFloat(val)); 5609 } 5610 } else { 5611 return [coord.lat(), coord.lng()]; 5612 } 5613 } 5614 function wellKnownToCoordinates(wellKnownText, type) { 5615 if (wellKnownText === "") { 5616 return []; 5617 } 5618 if (type === "Point") { 5619 return [toCoordinate(wellKnownText.replace(/(POINT *\( *)|( *\) *)/ig, ""), true)]; 5620 } else { 5621 return wellKnownText.replace(/(POLYGON *\(+ *)|( *\)+ *)/ig, "").split(/ *, */).map(coord => toCoordinate(coord, true)); 5622 } 5623 } 5624 function coordinatesToWellKnown(coordinates, type) { 5625 if (coordinates.length === 0) { 5626 return ""; 5627 } else if (type === "Point") { 5628 return "POINT(".concat(coordinates[0].reverse().join(" "), ")"); 5629 } else { 5630 if (isClockwisePolygon(coordinates)) { 5631 coordinates.reverse(); 5632 } 5633 var coordinateString = coordinates.map(coords => coords.reverse().join(" ")).join(", "); 5634 return "POLYGON((".concat(coordinateString, "))"); 5635 } 5636 } 5637 function nearAddressForCoordinate(coordinate) { 5638 return new Promise(resolve => { 5639 if (window.google) { 5640 var geocoder = new google.maps.Geocoder(); 5641 geocoder.geocode({ 5642 location: new google.maps.LatLng(...coordinate) 5643 }, function (results, status) { 5644 if (status === google.maps.GeocoderStatus.OK && results !== null && results !== void 0 && results[0]) { 5645 resolve("near " + results[0].formatted_address); 5646 } else { 5647 console.log("Geocoder failed due to: " + status); 5648 resolve(""); 5649 } 5650 }); 5651 } else { 5652 resolve(""); 5653 } 5654 }); 5655 } 5656 function nearAddressForCoordinates(coordinates) { 5657 if (!coordinates || coordinates.length === 0) { 5658 return Promise.resolve(""); 5659 } 5660 return nearAddressForCoordinate(coordinates[0]); 5661 } 5662 function isClockwisePolygon(polygon) { 5663 var sum = 0; 5664 for (var i = 0; i < polygon.length - 1; i++) {
5665 sum += (Math.abs(polygon[i + 1][0]) - Math.abs(polygon[i][0])) * (Math.abs(polygon[i + 1][1]) + Math.abs(polygon[i][1])); 5666 } 5667 return sum > 0; 5668 } 5669 function loadMapResources() { 5670 return _loadMapResources.apply(this, arguments); 5671 } 5672 function _loadMapResources() { 5673 _loadMapResources = _asyncToGenerator(function* () { 5674 var _response$data; 5675 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 5676 mapStyleValueGuid: emptyGuid 5677 }; 5678 var response = yield post("/api/v2/Controls/GeoPickerGetGoogleMapSettings", undefined, options); 5679 var googleMapSettings = (_response$data = response.data) !== null && _response$data !== void 0 ? _response$data : {}; 5680 var keyParam = ""; 5681 if (googleMapSettings.googleApiKey) { 5682 keyParam = "key=".concat(googleMapSettings.googleApiKey, "&"); 5683 } 5684 yield loadJavaScriptAsync("https://maps.googleapis.com/maps/api/js?".concat(keyParam, "v=3.64&libraries=drawing,visualization,geometry,marker"), () => typeof google != "undefined" && typeof google.maps != "undefined", {}, false); 5685 return googleMapSettings; 5686 }); 5687 return _loadMapResources.apply(this, arguments); 5688 } 5689 function createLatLng(latOrLatLngOrLatLngLiteral, lngOrNoClampNoWrap, noClampNoWrap) { 5690 return new google.maps.LatLng(latOrLatLngOrLatLngLiteral, lngOrNoClampNoWrap, noClampNoWrap); 5691 } 5692 5693 var geo = /*#__PURE__*/Object.freeze({ 5694 __proto__: null, 5695 coordinatesToWellKnown: coordinatesToWellKnown, 5696 createLatLng: createLatLng, 5697 isClockwisePolygon: isClockwisePolygon, 5698 loadMapResources: loadMapResources, 5699 nearAddressForCoordinate: nearAddressForCoordinate, 5700 nearAddressForCoordinates: nearAddressForCoordinates, 5701 toCoordinate: toCoordinate, 5702 wellKnownToCoordinates: wellKnownToCoordinates 5703 }); 5704 exports('geo', geo); 5705 5706 var nthNamesAbbreviated = [[1, "1st"], [2, "2nd"], [3, "3rd"], [4, "4th"], [-1, "last"]]; 5707 function padZeroLeft(value, length) { 5708 var str = value.toString(); 5709 return "0".repeat(length - str.length) + str; 5710 } 5711 function getDateString(date) { 5712 var year = date.year; 5713 var month = date.month; 5714 var day = date.day; 5715 return "".concat(year).concat(padZeroLeft(month, 2)).concat(padZeroLeft(day, 2)); 5716 } 5717 function getTimeString(date) { 5718 var hour = date.hour; 5719 var minute = date.minute; 5720 var second = date.second; 5721 return "".concat(padZeroLeft(hour, 2)).concat(padZeroLeft(minute, 2)).concat(padZeroLeft(second, 2)); 5722 } 5723 function getDateTimeString(date) { 5724 return "".concat(getDateString(date), "T").concat(getTimeString(date)); 5725 } 5726 function getDatesFromRangeOrPeriod(value) { 5727 var segments = value.split("/"); 5728 if (segments.length === 0) { 5729 return []; 5730 } 5731 var startDate = getDateFromString(segments[0]); 5732 if (!startDate) { 5733 return []; 5734 } 5735 if (segments.length !== 2) { 5736 return [startDate]; 5737 } 5738 var dates = []; 5739 if (segments[1].startsWith("P")) { 5740 var days = getPeriodDurationInDays(segments[1]); 5741 for (var day = 0; day < days; day++) { 5742 var date = startDate.addDays(day); 5743 if (date) { 5744 dates.push(date); 5745 } 5746 } 5747 } else { 5748 var endDate = getDateFromString(segments[1]); 5749 if (endDate !== null) { 5750 var _date = startDate; 5751 while (_date <= endDate) { 5752 dates.push(_date); 5753 _date = _date.addDays(1); 5754 } 5755 } 5756 } 5757 return dates; 5758 } 5759 function getDateFromString(value) { 5760 if (value.length < 8) { 5761 return null; 5762 } 5763 var year = parseInt(value.substring(0, 4)); 5764 var month = parseInt(value.substring(4, 6)); 5765 var day = parseInt(value.substring(6, 8)); 5766 return RockDateTime.fromParts(year, month, day); 5767 } 5768 function getDateTimeFromString(value) { 5769 if (value.length < 15 || value[8] !== "T") { 5770 return null; 5771 } 5772 var year = parseInt(value.substring(0, 4));
5773 var month = parseInt(value.substring(4, 6)); 5774 var day = parseInt(value.substring(6, 8)); 5775 var hour = parseInt(value.substring(9, 11)); 5776 var minute = parseInt(value.substring(11, 13)); 5777 var second = parseInt(value.substring(13, 15)); 5778 return RockDateTime.fromParts(year, month, day, hour, minute, second); 5779 } 5780 function getPeriodDurationInDays(period) { 5781 if (!period.startsWith("P")) { 5782 return 0; 5783 } 5784 if (period.endsWith("D")) { 5785 return parseInt(period.substring(1, period.length - 1)); 5786 } else if (period.endsWith("W")) { 5787 return parseInt(period.substring(1, period.length - 1)) * 7; 5788 } 5789 return 0; 5790 } 5791 function getRecurrenceDates(attributes, value) { 5792 var recurrenceDates = []; 5793 var valueParts = value.split(","); 5794 var valueType = attributes["VALUE"]; 5795 var _iterator = _createForOfIteratorHelper(valueParts), 5796 _step; 5797 try { 5798 for (_iterator.s(); !(_step = _iterator.n()).done;) { 5799 var valuePart = _step.value; 5800 if (!valueType) { 5801 var length = valuePart.length; 5802 if (length === 8) { 5803 valueType = "DATE"; 5804 } else if ((length === 15 || length === 16) && valuePart[8] === "T") { 5805 valueType = "DATE-TIME"; 5806 } else { 5807 valueType = "PERIOD"; 5808 } 5809 } 5810 if (valueType === "PERIOD") { 5811 recurrenceDates.push(...getDatesFromRangeOrPeriod(valuePart)); 5812 } else if (valueType === "DATE") { 5813 var date = getDateFromString(valuePart); 5814 if (date) { 5815 recurrenceDates.push(date); 5816 } 5817 } else if (valueType === "DATE-TIME") { 5818 var _date2 = getDateTimeFromString(valuePart); 5819 if (_date2) { 5820 recurrenceDates.push(_date2); 5821 } 5822 } 5823 } 5824 } catch (err) { 5825 _iterator.e(err); 5826 } finally { 5827 _iterator.f(); 5828 } 5829 return recurrenceDates; 5830 } 5831 function getWeekdayName(day) { 5832 if (day === DayOfWeek.Sunday) { 5833 return "Sunday"; 5834 } else if (day === DayOfWeek.Monday) { 5835 return "Monday"; 5836 } else if (day === DayOfWeek.Tuesday) { 5837 return "Tuesday"; 5838 } else if (day === DayOfWeek.Wednesday) { 5839 return "Wednesday"; 5840 } else if (day === DayOfWeek.Thursday) { 5841 return "Thursday"; 5842 } else if (day === DayOfWeek.Friday) { 5843 return "Friday"; 5844 } else if (day === DayOfWeek.Saturday) { 5845 return "Saturday"; 5846 } else { 5847 return "Unknown"; 5848 } 5849 } 5850 function dateMatchesDays(rockDate, days) { 5851 var _iterator2 = _createForOfIteratorHelper(days), 5852 _step2; 5853 try { 5854 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 5855 var day = _step2.value; 5856 if (rockDate.dayOfWeek === day) { 5857 return true; 5858 } 5859 } 5860 } catch (err) { 5861 _iterator2.e(err); 5862 } finally { 5863 _iterator2.f(); 5864 } 5865 return false; 5866 } 5867 function dateMatchesOffsetDayOfWeeks(rockDate, dayOfWeek, offsets) { 5868 if (!dateMatchesDays(rockDate, [dayOfWeek])) { 5869 return false; 5870 } 5871 var dayOfMonth = rockDate.day; 5872 var _iterator3 = _createForOfIteratorHelper(offsets), 5873 _step3; 5874 try { 5875 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 5876 var offset = _step3.value; 5877 if (offset === 1 && dayOfMonth >= 1 && dayOfMonth <= 7) { 5878 return true; 5879 } else if (offset === 2 && dayOfMonth >= 8 && dayOfMonth <= 14) { 5880 return true; 5881 } else if (offset === 3 && dayOfMonth >= 15 && dayOfMonth <= 21) { 5882 return true; 5883 } else if (offset === 4 && dayOfMonth >= 22 && dayOfMonth <= 28) { 5884 return true; 5885 } else if (offset === -1) { 5886 var lastDayOfMonth = rockDate.addDays(-(rockDate.day - 1)).addMonths(1).addDays(-1).day; 5887 if (dayOfMonth >= lastDayOfMonth - 7 && dayOfMonth <= lastDayOfMonth) { 5888 return true; 5889 } 5890 } 5891 } 5892 } catch (err) { 5893 _iterator3.e(err); 5894 } finally { 5895 _iterator3.f(); 5896 } 5897 return false;
5898 } 5899 function getDayOfWeekFromIcalDay(day) { 5900 switch (day) { 5901 case "SU": 5902 return DayOfWeek.Sunday; 5903 case "MO": 5904 return DayOfWeek.Monday; 5905 case "TU": 5906 return DayOfWeek.Tuesday; 5907 case "WE": 5908 return DayOfWeek.Wednesday; 5909 case "TH": 5910 return DayOfWeek.Thursday; 5911 case "FR": 5912 return DayOfWeek.Friday; 5913 case "SA": 5914 return DayOfWeek.Saturday; 5915 } 5916 } 5917 function getiCalDay(day) { 5918 switch (day) { 5919 case DayOfWeek.Sunday: 5920 return "SU"; 5921 case DayOfWeek.Monday: 5922 return "MO"; 5923 case DayOfWeek.Tuesday: 5924 return "TU"; 5925 case DayOfWeek.Wednesday: 5926 return "WE"; 5927 case DayOfWeek.Thursday: 5928 return "TH"; 5929 case DayOfWeek.Friday: 5930 return "FR"; 5931 case DayOfWeek.Saturday: 5932 return "SA"; 5933 } 5934 } 5935 function normalizeLineLength(lines) { 5936 var newLines = [...lines]; 5937 for (var lineNumber = 0; lineNumber < newLines.length; lineNumber++) { 5938 if (newLines[lineNumber].length > 75) { 5939 var currentLine = newLines[lineNumber].substring(0, 75); 5940 var newLine = " " + newLines[lineNumber].substring(75); 5941 newLines.splice(lineNumber, 1, currentLine, newLine); 5942 } 5943 } 5944 return newLines; 5945 } 5946 function denormalizeLineLength(lines) { 5947 var newLines = [...lines]; 5948 for (var lineNumber = 1; lineNumber < newLines.length;) { 5949 if (newLines[lineNumber][0] === " ") { 5950 newLines[lineNumber - 1] += newLines[lineNumber].substring(1); 5951 newLines.splice(lineNumber, 1); 5952 } else { 5953 lineNumber++; 5954 } 5955 } 5956 return newLines; 5957 } 5958 class LineFeeder { 5959 constructor(content) { 5960 var lines = content.split(/\r\n|\n|\r/); 5961 this.lines = denormalizeLineLength(lines); 5962 } 5963 peek() { 5964 if (this.lines.length === 0) { 5965 return null; 5966 } 5967 return this.lines[0]; 5968 } 5969 pop() { 5970 if (this.lines.length === 0) { 5971 return null; 5972 } 5973 return this.lines.splice(0, 1)[0]; 5974 } 5975 } 5976 class RecurrenceRule { 5977 constructor() { 5978 var _values$UNTIL, _values$UNTIL2; 5979 var rule = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; 5980 _defineProperty(this, "interval", 1); 5981 _defineProperty(this, "byMonthDay", []); 5982 _defineProperty(this, "byDay", []); 5983 if (!rule) { 5984 return; 5985 } 5986 var values = {}; 5987 var _iterator4 = _createForOfIteratorHelper(rule.split(";")), 5988 _step4; 5989 try { 5990 for (_iterator4.s();
5990 !(_step4 = _iterator4.n()).done;) { 5991 var attr = _step4.value; 5992 var attrParts = attr.split("="); 5993 if (attrParts.length === 2) { 5994 values[attrParts[0]] = attrParts[1]; 5995 } 5996 } 5997 } catch (err) { 5998 _iterator4.e(err); 5999 } finally { 6000 _iterator4.f(); 6001 } 6002 if (values["UNTIL"] !== undefined && values["COUNT"] !== undefined) { 6003 throw new Error("Recurrence rule '".concat(rule, "' cannot specify both UNTIL and COUNT.")); 6004 } 6005 if (values["FREQ"] !== "DAILY" && values["FREQ"] !== "WEEKLY" && values["FREQ"] !== "MONTHLY") { 6006 throw new Error("Invalid frequence for recurrence rule '".concat(rule, "'.")); 6007 } 6008 this.frequency = values["FREQ"]; 6009 if (((_values$UNTIL = values["UNTIL"]) === null || _values$UNTIL === void 0 ? void 0 : _values$UNTIL.length) === 8) { 6010 var _getDateFromString; 6011 this.endDate = (_getDateFromString = getDateFromString(values["UNTIL"])) !== null && _getDateFromString !== void 0 ? _getDateFromString : undefined; 6012 } else if (((_values$UNTIL2 = values["UNTIL"]) === null || _values$UNTIL2 === void 0 ? void 0 : _values$UNTIL2.length) >= 15) { 6013 var _getDateTimeFromStrin; 6014 this.endDate = (_getDateTimeFromStrin = getDateTimeFromString(values["UNTIL"])) !== null && _getDateTimeFromStrin !== void 0 ? _getDateTimeFromStrin : undefined; 6015 } 6016 if (values["COUNT"] !== undefined) { 6017 var _toNumberOrNull; 6018 this.count = (_toNumberOrNull = toNumberOrNull(values["COUNT"])) !== null && _toNumberOrNull !== void 0 ? _toNumberOrNull : undefined; 6019 } 6020 if (values["INTERVAL"] !== undefined) { 6021 var _toNumberOrNull2; 6022 this.interval = (_toNumberOrNull2 = toNumberOrNull(values["INTERVAL"])) !== null && _toNumberOrNull2 !== void 0 ? _toNumberOrNull2 : 1; 6023 } 6024 if (values["BYMONTHDAY"] !== undefined && values["BYMONTHDAY"].length > 0) { 6025 this.byMonthDay = []; 6026 var _iterator5 = _createForOfIteratorHelper(values["BYMONTHDAY"].split(",")), 6027 _step5; 6028 try { 6029 for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { 6030 var v = _step5.value; 6031 var num = toNumberOrNull(v); 6032 if (num !== null) { 6033 this.byMonthDay.push(num); 6034 } 6035 } 6036 } catch (err) { 6037 _iterator5.e(err); 6038 } finally { 6039 _iterator5.f(); 6040 } 6041 } 6042 if (values["BYDAY"] !== undefined && values["BYDAY"].length > 0) { 6043 this.byDay = []; 6044 var _iterator6 = _createForOfIteratorHelper(values["BYDAY"].split(",")), 6045 _step6; 6046 try { 6047 for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { 6048 var _v = _step6.value; 6049 if (_v.length < 2) { 6050 continue; 6051 } 6052 var _num = _v.length > 2 ? toNumberOrNull(_v.substring(0, _v.length - 2)) : 1; 6053 var day = _v.substring(_v.length - 2); 6054 if (_num === null) { 6055 continue; 6056 } 6057 if (day === "SU" || day === "MO" || day === "TU" || day === "WE" || day === "TH" || day === "FR" || day === "SA") { 6058 this.byDay.push({ 6059 value: _num, 6060 day: getDayOfWeekFromIcalDay(day) 6061 }); 6062 } 6063 } 6064 } catch (err) { 6065 _iterator6.e(err); 6066 } finally { 6067 _iterator6.f(); 6068 } 6069 } 6070 } 6071 build() { 6072 var attributes = []; 6073 attributes.push("FREQ=".concat(this.frequency)); 6074 if (this.count !== undefined) { 6075 attributes.push("COUNT=".concat(this.count)); 6076 } else if (this.endDate) { 6077 attributes.push("UNTIL=".concat(getDateTimeString(this.endDate))); 6078 } 6079 if (this.interval > 1) { 6080 attributes.push("INTERVAL=".concat(this.interval)); 6081 } 6082 if (this.byMonthDay.length > 0) { 6083 var monthDayValues = this.byMonthDay.map(md => md.toString()).join(","); 6084 attributes.push("BYMONTHDAY=".concat(monthDayValues)); 6085 } 6086 if (this.frequency === "MONTHLY" && this.byDay.length > 0) { 6087 var dayValues = this.byDay.map(d => "".concat(d.value).concat(getiCalDay(d.day))); 6088 attributes.push("BYDAY=".concat(dayValues)); 6089 } else if (this.byDay.length > 0) { 6090 var _dayValues = this.byDay.map(d => d.value !== 1 ? "".concat(d.value).concat(getiCalDay(d.day)) : getiCalDay(d.day)); 6091 attributes.push("BYDAY=".concat(_dayValues)); 6092 } 6093 return attributes.join(";"); 6094 } 6095 getDates(eventStartDateTime, startDateTime, endDateTime) { 6096 var dates = []; 6097 var rockDate = eventStartDateTime; 6098 var dateCount = 0; 6099 if (!rockDate) { 6100 return []; 6101 } 6102 if (this.endDate && this.endDate < endDateTime) { 6103 endDateTime = this.endDate; 6104 } 6105 while (rockDate < endDateTime && dateCount < 100000) { 6106 if (this.count && dateCount >= this.count) { 6107 break; 6108 } 6109 dateCount++; 6110 if (rockDate >= startDateTime) { 6111 dates.push(rockDate); 6112 } 6113 var nextDate = this.nextDateAfter(rockDate); 6114 if (nextDate === null) { 6115 break; 6116 } else { 6117 rockDate = nextDate; 6118 } 6119 } 6120 return dates; 6121 } 6122 nextDateAfter(rockDate) { 6123 if (this.frequency === "DAILY") { 6124 return rockDate.addDays(this.interval); 6125 } else if (this.frequency === "WEEKLY" && this.byDay.length > 0) { 6126 var nextDate = rockDate; 6127 if (nextDate.dayOfWeek === DayOfWeek.Saturday) { 6128 nextDate = nextDate.addDays(1 + (this.interval - 1) * 7); 6129 } else { 6130 nextDate = nextDate.addDays(1); 6131 } 6132 while (!dateMatchesDays(nextDate, this.byDay.map(d => d.day))) { 6133 if (nextDate.dayOfWeek === DayOfWeek.Saturday) { 6134 nextDate = nextDate.addDays(1 + (this.interval - 1) * 7); 6135 } else { 6136 nextDate = nextDate.addDays(1); 6137 } 6138 } 6139 return nextDate; 6140 } else if (this.frequency === "MONTHLY") { 6141 if (this.byMonthDay.length > 0) { 6142 var _nextDate = rockDate.addDays(-(rockDate.day - 1)); 6143 if (rockDate.day >= this.byMonthDay[0]) { 6144 _nextDate = _nextDate.addMonths(this.interval); 6145 } 6146 var lastDayOfMonth = _nextDate.addMonths(1).addDays(-1).day; 6147 var loopCount = 0; 6148 while (lastDayOfMonth < this.byMonthDay[0]) { 6149 _nextDate = _nextDate.addMonths(this.interval); 6150 lastDayOfMonth = _nextDate.addMonths(1).addDays(-1).day; 6151 if (loopCount++ >= 100) { 6152 return null; 6153 } 6154 } 6155 _nextDate = _nextDate.addDays(this.byMonthDay[0] - 1); 6156 return _nextDate; 6157 } else if (this.byDay.length > 0) { 6158 var dayOfWeek = this.byDay[0].day; 6159 var offsets = this.byDay.map(d => d.value); 6160 var _nextDate2 = rockDate.addDays(1); 6161 while (!dateMatchesOffsetDayOfWeeks(_nextDate2, dayOfWeek, offsets)) { 6162 _nextDate2 = _nextDate2.addDays(1); 6163 } 6164 return _nextDate2; 6165 } 6166 } 6167 return null; 6168 } 6169 } 6170 class Event { 6171 constructor() { 6172 var icsContent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; 6173 _defineProperty(this, "excludedDates", []); 6174 _defineProperty(this, "recurrenceDates", []); 6175 _defineProperty(this, "recurrenceRules", []); 6176 if (icsContent === undefined) { 6177 this.uid = newGuid(); 6178 return; 6179 } 6180 var feeder; 6181 if (typeof icsContent === "string") { 6182 feeder = new LineFeeder(icsContent); 6183 } else { 6184 feeder = icsContent; 6185 } 6186 this.parse(feeder); 6187 } 6188 buildLines() { 6189 if (!this.startDateTime || !this.endDateTime) { 6190 return []; 6191 } 6192 var lines = []; 6193 lines.push("BEGIN:VEVENT"); 6194 lines.push("DTEND:".concat(getDateTimeString(this.endDateTime))); 6195 lines.push("DTSTAMP:".concat(getDateTimeString(RockDateTime.now()))); 6196 lines.push("DTSTART:".concat(getDateTimeString(this.startDateTime))); 6197 if (this.excludedDates.length > 0) { 6198 lines.push("EXDATE:".concat(this.excludedDates.map(d => getDateString(d) + "/P1D").join(","))); 6199 } 6200 if (this.recurrenceDates.length > 0) { 6201 var recurrenceDates = []; 6202 var _iterator7 = _createForOfIteratorHelper(this.recurrenceDates), 6203 _step7; 6204 try { 6205 for (_iterator7.s();
6205 !(_step7 = _iterator7.n()).done;) { 6206 var date = _step7.value; 6207 var rDate = RockDateTime.fromParts(date.year, date.month, date.day, this.startDateTime.hour, this.startDateTime.minute, this.startDateTime.second); 6208 if (rDate) { 6209 recurrenceDates.push(getDateTimeString(rDate)); 6210 } 6211 } 6212 } catch (err) { 6213 _iterator7.e(err); 6214 } finally { 6215 _iterator7.f(); 6216 } 6217 lines.push("RDATE:".concat(recurrenceDates.join(","))); 6218 } else if (this.recurrenceRules.length > 0) { 6219 var _iterator8 = _createForOfIteratorHelper(this.recurrenceRules), 6220 _step8; 6221 try { 6222 for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { 6223 var rrule = _step8.value; 6224 lines.push("RRULE:".concat(rrule.build())); 6225 } 6226 } catch (err) { 6227 _iterator8.e(err); 6228 } finally { 6229 _iterator8.f(); 6230 } 6231 } 6232 lines.push("SEQUENCE:0"); 6233 lines.push("UID:".concat(this.uid)); 6234 lines.push("END:VEVENT"); 6235 return lines; 6236 } 6237 build() { 6238 var lines = this.buildLines(); 6239 if (lines.length === 0) { 6240 return null; 6241 } 6242 return normalizeLineLength(lines).join("\r\n"); 6243 } 6244 parse(feeder) { 6245 var line; 6246 if (feeder.peek() !== "BEGIN:VEVENT") { 6247 throw new Error("Invalid event."); 6248 } 6249 feeder.pop(); 6250 while ((line = feeder.pop()) !== null) { 6251 if (line === "END:VEVENT") { 6252 break; 6253 } 6254 var splitAt = line.indexOf(":"); 6255 if (splitAt < 0) { 6256 continue; 6257 } 6258 var key = line.substring(0, splitAt); 6259 var value = line.substring(splitAt + 1); 6260 var keyAttributes = {}; 6261 var keySegments = key.split(";"); 6262 if (keySegments.length > 1) { 6263 key = keySegments[0]; 6264 keySegments.splice(0, 1); 6265 var _iterator9 = _createForOfIteratorHelper(keySegments), 6266 _step9; 6267 try { 6268 for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { 6269 var attr = _step9.value; 6270 var attrSegments = attr.split("="); 6271 if (attr.length === 2) { 6272 keyAttributes[attrSegments[0]] = attrSegments[1]; 6273 } 6274 } 6275 } catch (err) { 6276 _iterator9.e(err); 6277 } finally { 6278 _iterator9.f(); 6279 } 6280 } 6281 if (key === "DTSTART") { 6282 var _getDateTimeFromStrin2; 6283 this.startDateTime = (_getDateTimeFromStrin2 = getDateTimeFromString(value)) !== null && _getDateTimeFromStrin2 !== void 0 ? _getDateTimeFromStrin2 : undefined; 6284 } else if (key === "DTEND") { 6285 var _getDateTimeFromStrin3; 6286 this.endDateTime = (_getDateTimeFromStrin3 = getDateTimeFromString(value)) !== null && _getDateTimeFromStrin3 !== void 0 ? _getDateTimeFromStrin3 : undefined; 6287 } else if (key === "RRULE") { 6288 this.recurrenceRules.push(new RecurrenceRule(value)); 6289 } else if (key === "RDATE") { 6290 this.recurrenceDates = getRecurrenceDates(keyAttributes, value); 6291 } else if (key === "UID") { 6292 this.uid = value; 6293 } else if (key === "DURATION") ; else if (key === "EXDATE") { 6294 var dateValues = value.split(","); 6295 var _iterator0 = _createForOfIteratorHelper(dateValues), 6296 _step0; 6297 try { 6298 for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) { 6299 var dateValue = _step0.value; 6300 var dates = getDatesFromRangeOrPeriod(dateValue); 6301 this.excludedDates.push(...dates); 6302 } 6303 } catch (err) { 6304 _iterator0.e(err); 6305 } finally { 6306 _iterator0.f(); 6307 } 6308 } 6309 } 6310 } 6311 isDateExcluded(rockDate) { 6312 var rockDateOnly = rockDate.date; 6313 var _iterator1 = _createForOfIteratorHelper(this.excludedDates), 6314 _step1; 6315 try { 6316 for (_iterator1.s();
6316 !(_step1 = _iterator1.n()).done;) { 6317 var excludedDate = _step1.value; 6318 if (excludedDate.date.isEqualTo(rockDateOnly)) { 6319 return true; 6320 } 6321 } 6322 } catch (err) { 6323 _iterator1.e(err); 6324 } finally { 6325 _iterator1.f(); 6326 } 6327 return false; 6328 } 6329 getDates(startDateTime, endDateTime) { 6330 if (!this.startDateTime) { 6331 return []; 6332 } 6333 if (this.startDateTime > startDateTime) { 6334 startDateTime = this.startDateTime; 6335 } 6336 if (this.recurrenceDates.length > 0) { 6337 var dates = []; 6338 var recurrenceDates = [this.startDateTime, ...this.recurrenceDates]; 6339 for (var _i = 0, _recurrenceDates = recurrenceDates; _i < _recurrenceDates.length; _i++) { 6340 var date = _recurrenceDates[_i]; 6341 if (date >= startDateTime && date < endDateTime) { 6342 dates.push(date); 6343 } 6344 } 6345 return dates; 6346 } else if (this.recurrenceRules.length > 0) { 6347 var rrule = this.recurrenceRules[0]; 6348 return rrule.getDates(this.startDateTime, startDateTime, endDateTime).filter(d => !this.isDateExcluded(d)); 6349 } else { 6350 if (this.startDateTime >= startDateTime && this.startDateTime < endDateTime) { 6351 return [this.startDateTime]; 6352 } 6353 return []; 6354 } 6355 } 6356 toFriendlyText() { 6357 return this.toFriendlyString(false); 6358 } 6359 toFriendlyHtml() { 6360 return this.toFriendlyString(true); 6361 } 6362 toFriendlyString(html) { 6363 if (!this.startDateTime) { 6364 return ""; 6365 } 6366 var startTimeText = this.startDateTime.toLocaleString({ 6367 hour: "numeric", 6368 minute: "2-digit", 6369 hour12: true 6370 }); 6371 if (this.recurrenceRules.length > 0) { 6372 var rrule = this.recurrenceRules[0]; 6373 if (rrule.frequency === "DAILY") { 6374 var result = "Daily"; 6375 if (rrule.interval > 1) { 6376 result += " every ".concat(rrule.interval, " ").concat(pluralConditional(rrule.interval, "day", "days")); 6377 } 6378 result += " at ".concat(startTimeText); 6379 return result; 6380 } else if (rrule.frequency === "WEEKLY") { 6381 if (rrule.byDay.length === 0) { 6382 return "No Scheduled Days"; 6383 } 6384 var _result = rrule.byDay.map(d => getWeekdayName(d.day) + "s").join(","); 6385 if (rrule.interval > 1) { 6386 _result = "Every ".concat(rrule.interval, " weeks: ").concat(_result); 6387 } else { 6388 _result = "Weekly: ".concat(_result); 6389 } 6390 return "".concat(_result, " at ").concat(startTimeText); 6391 } else if (rrule.frequency === "MONTHLY") { 6392 if (rrule.byMonthDay.length > 0) { 6393 var _result2 = "Day ".concat(rrule.byMonthDay[0], " of every "); 6394 if (rrule.interval > 1) { 6395 _result2 += "".concat(rrule.interval, " months"); 6396 } else { 6397 _result2 += "month"; 6398 } 6399 return "".concat(_result2, " at ").concat(startTimeText); 6400 } else if (rrule.byDay.length > 0) { 6401 var byDay = rrule.byDay[0]; 6402 var offsetNames = nthNamesAbbreviated.filter(n => rrule.byDay.some(d => d.value === n[0])).map(n => n[1]); 6403 var _result3 = ""; 6404 if (offsetNames.length > 0) { 6405 var nameText; 6406 if (offsetNames.length > 2) { 6407 nameText = "".concat(offsetNames.slice(0, offsetNames.length - 1).join(", "), " and ").concat(offsetNames[offsetNames.length - 1]); 6408 } else { 6409 nameText = offsetNames.join(" and "); 6410 } 6411 _result3 = "The ".concat(nameText, " ").concat(getWeekdayName(byDay.day), " of every month"); 6412 } else { 6413 return ""; 6414 } 6415 return "".concat(_result3, " at ").concat(startTimeText); 6416 } else { 6417 return ""; 6418 } 6419 } else { 6420 return ""; 6421 } 6422 } else { 6423 var dates = [this.startDateTime, ...this.recurrenceDates]; 6424 if (dates.length === 1) { 6425 return "Once at ".concat(this.startDateTime.toASPString("g")); 6426 } else if (!html || dates.length > 99) { 6427 var firstDate = dates[0]; 6428 var lastDate = dates[dates.length - 1]; 6429 if (firstDate && lastDate) { 6430 return "Multiple dates between ".concat(firstDate.toASPString("g"), " and ").concat(lastDate.toASPString("g")); 6431 } else { 6432 return ""; 6433 } 6434 } else if (dates.length > 1) { 6435 var listHtml = "<ul class=\"list-unstyled\">"; 6436 var _iterator10 = _createForOfIteratorHelper(dates), 6437 _step10; 6438 try { 6439 for (_iterator10.s();
6439 !(_step10 = _iterator10.n()).done;) { 6440 var date = _step10.value; 6441 listHtml += "<li>".concat(date.toASPString("g"), "</li>"); 6442 } 6443 } catch (err) { 6444 _iterator10.e(err); 6445 } finally { 6446 _iterator10.f(); 6447 } 6448 listHtml += "</li>"; 6449 return listHtml; 6450 } else { 6451 return "No Schedule"; 6452 } 6453 } 6454 } 6455 } 6456 class Calendar { 6457 constructor() { 6458 var icsContent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; 6459 _defineProperty(this, "events", []); 6460 if (icsContent === undefined) { 6461 return; 6462 } 6463 var feeder = new LineFeeder(icsContent); 6464 this.parse(feeder); 6465 } 6466 build() { 6467 var lines = []; 6468 lines.push("BEGIN:VCALENDAR"); 6469 lines.push("PRODID:-//github.com/SparkDevNetwork/Rock//NONSGML Rock//EN"); 6470 lines.push("VERSION:2.0"); 6471 var _iterator11 = _createForOfIteratorHelper(this.events), 6472 _step11; 6473 try { 6474 for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { 6475 var event = _step11.value; 6476 lines.push(...event.buildLines()); 6477 } 6478 } catch (err) { 6479 _iterator11.e(err); 6480 } finally { 6481 _iterator11.f(); 6482 } 6483 lines.push("END:VCALENDAR"); 6484 return denormalizeLineLength(lines).join("\r\n"); 6485 } 6486 parse(feeder) { 6487 var line; 6488 while ((line = feeder.peek()) !== null) { 6489 if (line === "BEGIN:VEVENT") { 6490 var event = new Event(feeder); 6491 this.events.push(event); 6492 } else { 6493 feeder.pop(); 6494 } 6495 } 6496 } 6497 } 6498 6499 var internetCalendar = /*#__PURE__*/Object.freeze({ 6500 __proto__: null, 6501 Calendar: Calendar, 6502 Event: Event, 6503 RecurrenceRule: RecurrenceRule 6504 }); 6505 exports('internetCalendar', internetCalendar); 6506 6507 function safeParseJson(value) { 6508 if (!value) { 6509 return undefined; 6510 } 6511 try { 6512 return JSON.parse(value); 6513 } catch (_unused) { 6514 return undefined; 6515 } 6516 } 6517 6518 var jsonUtils = /*#__PURE__*/Object.freeze({ 6519 __proto__: null, 6520 safeParseJson: safeParseJson 6521 }); 6522 exports('jsonUtils', jsonUtils); 6523 6524 var engine = new Liquid({ 6525 cache: true 6526 }); 6527 var hasLavaCommandFieldsRegex = /\{%.+%\}/; 6528 var hasLavaShortcodeFieldsRegex = /\{\[.+\]\}/; 6529 var hasLavaVariableFieldsRegex = /\{\{\s*[^}}]+\s*\}\}/; 6530 function resolveMergeFields(template, mergeFields) { 6531 var tpl = engine.parse(template); 6532 return engine.renderSync(tpl, mergeFields); 6533 } 6534 function hasLavaVariableFields(template) { 6535 return hasLavaVariableFieldsRegex.test(template); 6536 } 6537 function hasLavaCommandFields(template) { 6538 return hasLavaCommandFieldsRegex.test(template); 6539 } 6540 function hasLavaShortcodeFields(template) { 6541 return hasLavaShortcodeFieldsRegex.test(template); 6542 } 6543 6544 var lava = /*#__PURE__*/Object.freeze({ 6545 __proto__: null, 6546 hasLavaCommandFields: hasLavaCommandFields, 6547 hasLavaShortcodeFields: hasLavaShortcodeFields, 6548 hasLavaVariableFields: hasLavaVariableFields, 6549 resolveMergeFields: resolveMergeFields 6550 }); 6551 exports('lava', lava); 6552 6553 function asListItemBagOrNull(bagJson) { 6554 try { 6555 var val = JSON.parse(bagJson); 6556 if ("value" in val || "text" in val) { 6557 return val; 6558 } 6559 return null; 6560 } catch (e) { 6561 return null; 6562 } 6563 } 6564 6565 var listItemBag = /*#__PURE__*/Object.freeze({ 6566 __proto__: null, 6567 asListItemBagOrNull: asListItemBagOrNull 6568 }); 6569 exports('listItemBag', listItemBag); 6570 6571 function formatValue(_x) { 6572 return _formatValue.apply(this, arguments); 6573 } 6574 function _formatValue() { 6575 _formatValue = _asyncToGenerator(function* (value) { 6576 var http = useHttp(); 6577 var options = { 6578 selectedValue: value 6579 }; 6580 var response = yield http.post("/api/v2/Controls/MergeFieldPickerFormatSelectedValue", {}, options); 6581 if (response.isSuccess && response.data) { 6582 return response.data; 6583 } else { 6584 console.error("Error", response.errorMessage || "Error formatting '".concat(value, "'.")); 6585 return ""; 6586 } 6587 }); 6588 return _formatValue.apply(this, arguments); 6589 } 6590 6591 var mergeField = /*#__PURE__*/Object.freeze({ 6592 __proto__: null, 6593 formatValue: formatValue 6594 }); 6595 exports('mergeField', mergeField); 6596
6597 function fromEntries(entries) { 6598 var res = {}; 6599 var _iterator = _createForOfIteratorHelper(entries), 6600 _step; 6601 try { 6602 for (_iterator.s(); !(_step = _iterator.n()).done;) { 6603 var entry = _step.value; 6604 res[entry[0]] = entry[1]; 6605 } 6606 } catch (err) { 6607 _iterator.e(err); 6608 } finally { 6609 _iterator.f(); 6610 } 6611 return res; 6612 } 6613 function clone(obj) { 6614 return JSON.parse(JSON.stringify(obj)); 6615 } 6616 function toListItemBagList(obj) { 6617 return Object.entries(obj).map(_ref => { 6618 var _ref2 = _slicedToArray(_ref, 2), 6619 key = _ref2[0], 6620 value = _ref2[1]; 6621 return { 6622 text: key, 6623 value: "".concat(value) 6624 }; 6625 }); 6626 } 6627 function getValueFromPath(object, path) { 6628 if (!object || !path) { 6629 return; 6630 } 6631 var pathNames = path.split("."); 6632 for (var i = 0; i < pathNames.length; i++) { 6633 var pathName = pathNames[i].trim(); 6634 if (!pathName || !Object.prototype.hasOwnProperty.call(object, pathName)) { 6635 return; 6636 } 6637 var value = object[pathName]; 6638 if (i === pathNames.length - 1) { 6639 return value; 6640 } 6641 if (typeof value !== "object") { 6642 return; 6643 } 6644 object = value; 6645 } 6646 return; 6647 } 6648 function getTypeMemberName(memberName) { 6649 return memberName; 6650 } 6651 function useGetTypeMemberName() { 6652 return memberName => { 6653 return getTypeMemberName(memberName); 6654 }; 6655 } 6656 6657 var objectUtils = /*#__PURE__*/Object.freeze({ 6658 __proto__: null, 6659 clone: clone, 6660 fromEntries: fromEntries, 6661 getTypeMemberName: getTypeMemberName, 6662 getValueFromPath: getValueFromPath, 6663 toListItemBagList: toListItemBagList, 6664 useGetTypeMemberName: useGetTypeMemberName 6665 }); 6666 exports('objectUtils', objectUtils); 6667 6668 function fetchPhoneNumberConfiguration() { 6669 return _fetchPhoneNumberConfiguration.apply(this, arguments); 6670 } 6671 function _fetchPhoneNumberConfiguration() { 6672 _fetchPhoneNumberConfiguration = _asyncToGenerator(function* () { 6673 var _result$errorMessage; 6674 var http = useHttp(); 6675 var result = yield http.post("/api/v2/Controls/PhoneNumberBoxGetConfiguration", undefined, null); 6676 if (result.isSuccess && result.data) { 6677 return result.data; 6678 } 6679 throw new Error((_result$errorMessage = result.errorMessage) !== null && _result$errorMessage !== void 0 ? _result$errorMessage : "Error fetching phone number configuration"); 6680 }); 6681 return _fetchPhoneNumberConfiguration.apply(this, arguments); 6682 } 6683 function fetchPhoneNumberAndSmsConfiguration() { 6684 return _fetchPhoneNumberAndSmsConfiguration.apply(this, arguments); 6685 } 6686 function _fetchPhoneNumberAndSmsConfiguration() { 6687 _fetchPhoneNumberAndSmsConfiguration = _asyncToGenerator(function* () { 6688 var _result$errorMessage2;
6689 var http = useHttp(); 6690 var options = { 6691 showSmsOptIn: true 6692 }; 6693 var result = yield http.post("/api/v2/Controls/PhoneNumberBoxGetConfiguration", undefined, options); 6694 if (result.isSuccess && result.data) { 6695 return result.data; 6696 } 6697 throw new Error((_result$errorMessage2 = result.errorMessage) !== null && _result$errorMessage2 !== void 0 ? _result$errorMessage2 : "Error fetching phone number configuration"); 6698 }); 6699 return _fetchPhoneNumberAndSmsConfiguration.apply(this, arguments); 6700 } 6701 var getPhoneNumberConfiguration = Cache.cachePromiseFactory("phoneNumberConfiguration", fetchPhoneNumberConfiguration); 6702 var getPhoneNumberAndSmsConfiguration = Cache.cachePromiseFactory("phoneNumberAndSmsConfiguration", fetchPhoneNumberAndSmsConfiguration); 6703 var defaultRulesConfig = [{ 6704 "match": "^(\\d{3})(\\d{4})$", 6705 "format": "$1-$2" 6706 }, { 6707 "match": "^(\\d{3})(\\d{3})(\\d{4})$", 6708 "format": "($1) $2-$3" 6709 }, { 6710 "match": "^1(\\d{3})(\\d{3})(\\d{4})$", 6711 "format": "($1) $2-$3" 6712 }]; 6713 function formatPhoneNumber(value) { 6714 var rules = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultRulesConfig; 6715 value = stripPhoneNumber(value); 6716 if (!value || rules.length === 0) { 6717 return value; 6718 } 6719 var _iterator = _createForOfIteratorHelper(rules), 6720 _step; 6721 try { 6722 for (_iterator.s(); !(_step = _iterator.n()).done;) { 6723 var _rule$match; 6724 var rule = _step.value; 6725 var regex = new RegExp((_rule$match = rule.match) !== null && _rule$match !== void 0 ? _rule$match : ""); 6726 if (regex.test(value)) { 6727 var _rule$format; 6728 return value.replace(regex, (_rule$format = rule.format) !== null && _rule$format !== void 0 ? _rule$format : "") || value; 6729 } 6730 } 6731 } catch (err) { 6732 _iterator.e(err); 6733 } finally { 6734 _iterator.f(); 6735 } 6736 return value; 6737 } 6738 function stripPhoneNumber(str) { 6739 if (!str) { 6740 return ""; 6741 } 6742 return str.replace(/\D/g, ""); 6743 } 6744 var phone = { 6745 getPhoneNumberConfiguration, 6746 formatPhoneNumber, 6747 stripPhoneNumber 6748 }; 6749 window.formatPhoneNumber = formatPhoneNumber; 6750 6751 var phone$1 = /*#__PURE__*/Object.freeze({ 6752 __proto__: null, 6753 default: phone, 6754 formatPhoneNumber: formatPhoneNumber, 6755 getPhoneNumberAndSmsConfiguration: getPhoneNumberAndSmsConfiguration, 6756 getPhoneNumberConfiguration: getPhoneNumberConfiguration, 6757 stripPhoneNumber: stripPhoneNumber 6758 }); 6759 exports('phone', phone$1); 6760 6761 function popover(node, options) { 6762 var _options$sanitize; 6763 if (Array.isArray(node)) { 6764 var _iterator = _createForOfIteratorHelper(node), 6765 _step; 6766 try { 6767 for (_iterator.s(); !(_step = _iterator.n()).done;) { 6768 var n = _step.value; 6769 popover(n, options); 6770 } 6771 } catch (err) { 6772 _iterator.e(err); 6773 } finally { 6774 _iterator.f(); 6775 } 6776 return; 6777 } 6778 $(node).popover({ 6779 html: options === null || options === void 0 ? void 0 : options.html, 6780 sanitize: (_options$sanitize = options === null || options === void 0 ? void 0 : options.sanitize) !== null && _options$sanitize !== void 0 ? _options$sanitize : true 6781 }); 6782 } 6783 6784 var popover$1 = /*#__PURE__*/Object.freeze({ 6785 __proto__: null, 6786 popover: popover 6787 }); 6788 exports('popover', popover$1); 6789 6790 function sleep(ms) { 6791 return new Promise(resolve => { 6792 setTimeout(resolve, ms); 6793 }); 6794 } 6795 function isPromise(obj) { 6796 return !!obj && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function"; 6797 } 6798 class PromiseCompletionSource { 6799 constructor() { 6800 _defineProperty(this, "internalResolve", () => {}); 6801 _defineProperty(this, "internalReject", () => {}); 6802 this.internalPromise = new Promise((resolve, reject) => { 6803 this.internalResolve = resolve; 6804 this.internalReject = reject; 6805 }); 6806 } 6807 get promise() { 6808 return this.internalPromise; 6809 } 6810 resolve(value) { 6811 this.internalResolve(value); 6812 } 6813 reject(reason) { 6814 this.internalReject(reason); 6815 } 6816 } 6817 6818 var promiseUtils = /*#__PURE__*/Object.freeze({ 6819 __proto__: null, 6820 PromiseCompletionSource: PromiseCompletionSource, 6821 isPromise: isPromise, 6822 sleep: sleep 6823 }); 6824 exports('promiseUtils', promiseUtils); 6825 6826 var libraryObject = null; 6827 var libraryPromise = null; 6828 function getRealTimeObject() { 6829 return _getRealTimeObject.apply(this, arguments); 6830 } 6831 function _getRealTimeObject() { 6832 _getRealTimeObject = _asyncToGenerator(function* () { 6833 var _window$Rock2; 6834 if (libraryObject) { 6835 return libraryObject; 6836 } 6837 if (!libraryPromise) { 6838 libraryPromise = loadJavaScriptAsync("/Scripts/Rock/realtime.js", () => { 6839 var _window$Rock; 6840 return !!((_window$Rock = window["Rock"]) !== null && _window$Rock !== void 0 && _window$Rock["RealTime"]); 6841 }); 6842 } 6843 if (!(yield libraryPromise)) { 6844 throw new Error("Unable to load RealTime library."); 6845 } 6846 libraryObject = (_window$Rock2 = window["Rock"]) === null || _window$Rock2 === void 0 ? void 0 : _window$Rock2["RealTime"]; 6847 return libraryObject; 6848 }); 6849 return _getRealTimeObject.apply(this, arguments); 6850 } 6851 function getTopic(_x) { 6852 return _getTopic.apply(this, arguments); 6853 } 6854 function _getTopic() { 6855 _getTopic = _asyncToGenerator(function* (identifier) { 6856 var realTime = yield getRealTimeObject(); 6857 return realTime.getTopic(identifier); 6858 }); 6859 return _getTopic.apply(this, arguments); 6860 } 6861 6862 var realTime = /*#__PURE__*/Object.freeze({ 6863 __proto__: null, 6864 getTopic: getTopic 6865 }); 6866 exports('realTime', realTime); 6867 6868 var regexPatterns = { 6869 specialCharacterPattern: /[({[\]})"]/, 6870 emojiPattern: /(?:[\u2600-\u27BF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDEFF]|\uD83E[\uDD00-\uDDFF])/, 6871 specialFontPattern: /(?:\uD835[\uDC00-\uDFFF]|\uD83C[\uDD00-\uDDFF])/ 6872 }; 6873 var getSpecialCharacterPattern = () => regexPatterns.specialCharacterPattern; 6874 var getEmojiPattern = () => regexPatterns.emojiPattern; 6875 var getSpecialFontPattern = () => regexPatterns.specialFontPattern; 6876 6877 var regexPatterns$1 = /*#__PURE__*/Object.freeze({ 6878 __proto__: null, 6879 getEmojiPattern: getEmojiPattern, 6880 getSpecialCharacterPattern: getSpecialCharacterPattern, 6881 getSpecialFontPattern: getSpecialFontPattern, 6882 regexPatterns: regexPatterns 6883 }); 6884 exports('regexPatterns', regexPatterns$1); 6885 6886 class RockCurrency { 6887 get isZero() { 6888 return this.big.eq(0); 6889 } 6890 get number() { 6891 return this.big.toNumber(); 6892 } 6893 get isNegative() { 6894 return this.big.lt(0); 6895 } 6896 get units() { 6897 return this.big.times(new Big(10).pow(this.currencyInfo.decimalPlaces)).toNumber(); 6898 } 6899 constructor(value, currencyInfo) { 6900 this.currencyInfo = currencyInfo; 6901 if (value instanceof RockCurrency) { 6902 this.big = new Big(value.big).round(this.currencyInfo.decimalPlaces, Big.roundDown); 6903 } else { 6904 this.big = new Big(value !== null && value !== void 0 ? value : 0).round(this.currencyInfo.decimalPlaces, Big.roundDown); 6905 } 6906 } 6907 static create(value, currencyInfo) { 6908 return new RockCurrency(value, currencyInfo); 6909 } 6910 asRockCurrency(value) { 6911 return value instanceof RockCurrency ? value : new RockCurrency(value, this.currencyInfo); 6912 } 6913 add(value) { 6914 var currency = this.asRockCurrency(value); 6915 return new RockCurrency(this.big.plus(currency.big), this.currencyInfo); 6916 } 6917 negate() { 6918 return new RockCurrency(this.big.neg(), this.currencyInfo); 6919 } 6920 divide(divisor) { 6921 var quotient = this.big.div(divisor).round(this.currencyInfo.decimalPlaces, Big.roundDown); 6922 var remainder = this.big.minus(quotient.times(divisor)); 6923 return { 6924 quotient: new RockCurrency(quotient, this.currencyInfo), 6925 remainder: new RockCurrency(remainder, this.currencyInfo) 6926 }; 6927 } 6928 subtract(value) { 6929 var currency = this.asRockCurrency(value); 6930 return new RockCurrency(this.big.minus(currency.big), this.currencyInfo); 6931 } 6932 isEqualTo(value) { 6933 var currency = this.asRockCurrency(value); 6934 return this.big.eq(currency.big); 6935 } 6936 isNotEqualTo(value) { 6937 var currency = this.asRockCurrency(value); 6938 return !this.big.eq(currency.big); 6939 } 6940 isLessThan(value) { 6941 var currency = this.asRockCurrency(value); 6942 return this.big.lt(currency.big); 6943 } 6944 isLessThanOrEqualTo(value) { 6945 var currency = this.asRockCurrency(value); 6946 return this.big.lte(currency.big); 6947 } 6948 noLessThan(value) { 6949 var currency = this.asRockCurrency(value); 6950 if (this.big.lt(currency.big)) { 6951 return new RockCurrency(currency.big, this.currencyInfo); 6952 } else { 6953 return this; 6954 } 6955 } 6956 isGreaterThan(value) { 6957 var limit = this.asRockCurrency(value); 6958 return this.big.gt(limit.big); 6959 } 6960 noGreaterThan(value) { 6961 var currency = this.asRockCurrency(value); 6962 if (this.big.gt(currency.big)) { 6963 return currency; 6964 } else { 6965 return this; 6966 } 6967 } 6968 abs() { 6969 return new RockCurrency(this.big.abs(), this.currencyInfo); 6970 } 6971 mod(divisor) { 6972 var _this$divide = this.divide(divisor), 6973 remainder = _this$divide.remainder; 6974 return remainder; 6975 } 6976 format() { 6977 var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 6978 if (options !== null && options !== void 0 && options.excludeGroupingSeparators) { 6979 var valueString = this.big.toFixed(this.currencyInfo.decimalPlaces, Big.roundDown); 6980 return "".concat(this.currencyInfo.symbol).concat(valueString); 6981 } 6982 return this.toString(); 6983 } 6984 toString() { 6985 var _toCurrencyOrNull; 6986 var valueString = this.big.toFixed(this.currencyInfo.decimalPlaces, Big.roundDown); 6987 return (_toCurrencyOrNull = toCurrencyOrNull(valueString, this.currencyInfo)) !== null && _toCurrencyOrNull !== void 0 ? _toCurrencyOrNull : "".concat(this.currencyInfo.symbol).concat(valueString); 6988 } 6989 } 6990 6991 var rockCurrency = /*#__PURE__*/Object.freeze({ 6992 __proto__: null, 6993 RockCurrency: RockCurrency 6994 }); 6995 exports('rockCurrency', rockCurrency); 6996 6997 class RockTimeSpan { 6998 constructor(_milliseconds) { 6999 this._milliseconds = _milliseconds; 7000 this._milliseconds = Math.abs(_milliseconds); 7001 } 7002 static fromMilliseconds(milliseconds) { 7003 return new RockTimeSpan(milliseconds); 7004 } 7005 static fromSeconds(seconds) { 7006 return new RockTimeSpan(seconds * 1000); 7007 } 7008 static fromMinutes(minutes) { 7009 return new RockTimeSpan(minutes * 60 * 1000); 7010 } 7011 static fromHours(hours) { 7012 return new RockTimeSpan(hours * 60 * 60 * 1000); 7013 } 7014 static fromDays(days) { 7015 return new RockTimeSpan(days * 24 * 60 * 60 * 1000); 7016 } 7017 get totalMilliseconds() { 7018 return this._milliseconds; 7019 } 7020 get totalSeconds() { 7021 return this._milliseconds / 1000; 7022 } 7023 get totalMinutes() { 7024 return this._milliseconds / (60 * 1000); 7025 } 7026 get totalHours() { 7027 return this._milliseconds / (60 * 60 * 1000); 7028 } 7029 get totalDays() { 7030 return this._milliseconds / (24 * 60 * 60 * 1000); 7031 } 7032 get approximatedTotalMonths() { 7033 var msPerMonth = 31 * 24 * 60 * 60 * 1000; 7034 return this._milliseconds / msPerMonth; 7035 } 7036 get milliseconds() { 7037 return this._milliseconds % 1000; 7038 } 7039 get seconds() { 7040 return Math.floor(this._milliseconds / 1000 % 60); 7041 } 7042 get minutes() { 7043 return Math.floor(this._milliseconds / (60 * 1000) % 60); 7044 } 7045 get hours() { 7046 return Math.floor(this._milliseconds / (60 * 60 * 1000) % 24); 7047 } 7048 get days() { 7049 return Math.floor(this._milliseconds / (24 * 60 * 60 * 1000)); 7050 } 7051 toElapsedString() { 7052 var daysPerYear = 365; 7053 var totalHours = this.totalHours; 7054 var totalSeconds = this.totalSeconds; 7055 var totalMinutes = this.totalMinutes; 7056 var totalDays = this.totalDays; 7057 var approximatedTotalMonths = this.approximatedTotalMonths; 7058 if (totalHours < 24) { 7059 if (totalSeconds < 1) {
7060 return "".concat(0 .toLocaleString(undefined), " Seconds"); 7061 } 7062 if (totalSeconds < 2) { 7063 return "".concat(1 .toLocaleString(undefined), " Second"); 7064 } 7065 if (totalSeconds < 60) { 7066 return "".concat(Math.floor(totalSeconds).toLocaleString(undefined), " Seconds"); 7067 } 7068 if (totalMinutes < 2) { 7069 return "".concat(1 .toLocaleString(undefined), " Minute"); 7070 } 7071 if (totalMinutes < 60) { 7072 return "".concat(Math.floor(totalMinutes).toLocaleString(undefined), " Minutes"); 7073 } 7074 if (totalHours < 2) { 7075 return "".concat(1 .toLocaleString(undefined), " Hour"); 7076 } 7077 if (totalHours < 60) { 7078 return "".concat(Math.floor(totalHours).toLocaleString(undefined), " Hours"); 7079 } 7080 } 7081 if (totalDays < 2) { 7082 return "".concat(1 .toLocaleString(undefined), " Day"); 7083 } 7084 if (totalDays < 31) { 7085 return "".concat(Math.floor(totalDays).toLocaleString(undefined), " Days"); 7086 } 7087 if (approximatedTotalMonths <= 1) { 7088 return "".concat(1 .toLocaleString(undefined), " Month"); 7089 } 7090 if (approximatedTotalMonths <= 18) { 7091 return "".concat(Math.round(approximatedTotalMonths).toLocaleString(undefined), " Months"); 7092 } 7093 var totalYears = Math.floor(totalDays / daysPerYear); 7094 if (totalYears <= 1) { 7095 return "".concat(1 .toLocaleString(undefined), " Year"); 7096 } 7097 return "".concat(Math.round(totalYears).toLocaleString(undefined), " Years"); 7098 } 7099 } 7100 7101 var rockTimeSpan = /*#__PURE__*/Object.freeze({ 7102 __proto__: null, 7103 RockTimeSpan: RockTimeSpan 7104 }); 7105 exports('rockTimeSpan', rockTimeSpan); 7106 7107 function useScreenSize() { 7108 var mobileThreshold = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 480; 7109 var isMobile = ref(false); 7110 var screenSize = ref(screen.width); 7111 function onResize() { 7112 screenSize.value = screen.width; 7113 if (screen.width <= mobileThreshold) { 7114 isMobile.value = true; 7115 } else { 7116 isMobile.value = false; 7117 } 7118 } 7119 onMounted(() => { 7120 nextTick(() => { 7121 onResize(); 7122 }); 7123 window.addEventListener("resize", onResize); 7124 }); 7125 onUnmounted(() => { 7126 window.removeEventListener("resize", onResize); 7127 }); 7128 return { 7129 isMobile, 7130 screenSize 7131 }; 7132 } 7133 function useViewportWidth() { 7134 var mobileThreshold = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 480; 7135 var isMobile = ref(false); 7136 var viewportWidth = ref(window.innerWidth); 7137 function onResize() { 7138 viewportWidth.value = window.innerWidth; 7139 isMobile.value = viewportWidth.value <= mobileThreshold; 7140 } 7141 onMounted(() => { 7142 nextTick(() => { 7143 onResize(); 7144 }); 7145 window.addEventListener("resize", onResize); 7146 }); 7147 onUnmounted(() => { 7148 window.removeEventListener("resize", onResize); 7149 }); 7150 return { 7151 isMobile, 7152 viewportWidth: viewportWidth 7153 }; 7154 } 7155 7156 var screenSize = /*#__PURE__*/Object.freeze({ 7157 __proto__: null, 7158 useScreenSize: useScreenSize, 7159 useViewportWidth: useViewportWidth 7160 }); 7161 exports('screenSize', screenSize); 7162 7163 var rangeTypeOptions = [{ 7164 value: SlidingDateRangeType.Current.toString(), 7165 text: "Current" 7166 }, { 7167 value: SlidingDateRangeType.Previous.toString(), 7168 text: "Previous" 7169 }, { 7170 value: SlidingDateRangeType.Last.toString(), 7171 text: "Last" 7172 }, { 7173 value: SlidingDateRangeType.Next.toString(), 7174 text: "Next" 7175 }, { 7176 value: SlidingDateRangeType.Upcoming.toString(), 7177 text: "Upcoming" 7178 }, { 7179 value: SlidingDateRangeType.DateRange.toString(), 7180 text: "Date Range" 7181 }]; 7182 var timeUnitOptions = [{ 7183 value: TimeUnitType.Hour.toString(), 7184 text: "Hour" 7185 }, { 7186 value: TimeUnitType.Day.toString(), 7187 text: "Day" 7188 }, { 7189 value: TimeUnitType.Week.toString(), 7190 text: "Week" 7191 }, { 7192 value: TimeUnitType.Month.toString(), 7193 text: "Month" 7194 }, { 7195 value: TimeUnitType.Year.toString(), 7196 text: "Year" 7197 }]; 7198 function getTextForValue(value, options) { 7199 var _matches$0$text; 7200 var matches = options.filter(v => v.value === value); 7201 return matches.length > 0 ? (_matches$0$text = matches[0].text) !== null && _matches$0$text !== void 0 ? _matches$0$text : "" : ""; 7202 } 7203 function getRangeTypeText(rangeType) { 7204 var _rangeTypes$0$text; 7205 var rangeTypes = rangeTypeOptions.filter(o => o.value === rangeType.toString()); 7206 return rangeTypes.length > 0 ? (_rangeTypes$0$text = rangeTypes[0].text) !== null && _rangeTypes$0$text !== void 0 ? _rangeTypes$0$text : "" : ""; 7207 } 7208 function getTimeUnitText(timeUnit) { 7209 var _timeUnits$0$text; 7210 var timeUnits = timeUnitOptions.filter(o => o.value === timeUnit.toString()); 7211 return timeUnits.length > 0 ? (_timeUnits$0$text = timeUnits[0].text) !== null && _timeUnits$0$text !== void 0 ? _timeUnits$0$text : "" : ""; 7212 } 7213 function parseSlidingDateRangeString(value) { 7214 var segments = value.split("|"); 7215 if (segments.length < 3) { 7216 return null; 7217 } 7218 var rangeTypes = rangeTypeOptions.filter(o => { 7219 var _o$text; 7220 return ((_o$text = o.text) !== null && _o$text !== void 0 ? _o$text : "").replace(" ", "").toLowerCase() === segments[0].toLowerCase() || o.value === segments[0]; 7221 }); 7222 var timeUnits = timeUnitOptions.filter(o => { 7223 var _o$text2; 7224 return ((_o$text2 = o.text) !== null && _o$text2 !== void 0 ? _o$text2 : "").toLowerCase() === segments[2].toLowerCase() || o.value === segments[2]; 7225 }); 7226 if (rangeTypes.length === 0) { 7227 return null; 7228 } 7229 var range = { 7230 rangeType: toNumber(rangeTypes[0].value) 7231 }; 7232 if ([SlidingDateRangeType.Current, SlidingDateRangeType.Last, SlidingDateRangeType.Next, SlidingDateRangeType.Previous, SlidingDateRangeType.Upcoming].includes(range.rangeType)) { 7233 range.timeUnit = timeUnits.length > 0 ? toNumber(timeUnits[0].value) : TimeUnitType.Hour; 7234 if ([SlidingDateRangeType.Last, SlidingDateRangeType.Next, SlidingDateRangeType.Previous, SlidingDateRangeType.Upcoming].includes(range.rangeType)) { 7235 var _toNumberOrNull; 7236 range.timeValue = (_toNumberOrNull = toNumberOrNull(segments[1])) !== null && _toNumberOrNull !== void 0 ? _toNumberOrNull : 1; 7237 } 7238 } 7239 if (range.rangeType === SlidingDateRangeType.DateRange) { 7240 if (segments.length > 3) { 7241 var _RockDateTime$fromJSD, _RockDateTime$fromJSD2; 7242 range.lowerDate = (_RockDateTime$fromJSD = (_RockDateTime$fromJSD2 = RockDateTime.fromJSDate(new Date(segments[3]))) === null || _RockDateTime$fromJSD2 === void 0 || (_RockDateTime$fromJSD2 = _RockDateTime$fromJSD2.toOffset(0)) === null || _RockDateTime$fromJSD2 === void 0 ? void 0 : _RockDateTime$fromJSD2.toASPString("yyyy-MM-dd")) !== null && _RockDateTime$fromJSD !== void 0 ? _RockDateTime$fromJSD : ""; 7243 } 7244 if (segments.length > 4) { 7245 var _RockDateTime$fromJSD3, _RockDateTime$fromJSD4; 7246 range.upperDate = (_RockDateTime$fromJSD3 = (_RockDateTime$fromJSD4 = RockDateTime.fromJSDate(new Date(segments[4]))) === null || _RockDateTime$fromJSD4 === void 0 || (_RockDateTime$fromJSD4 = _RockDateTime$fromJSD4.toOffset(0)) === null || _RockDateTime$fromJSD4 === void 0 ? void 0 : _RockDateTime$fromJSD4.toASPString("yyyy-MM-dd")) !== null && _RockDateTime$fromJSD3 !== void 0 ? _RockDateTime$fromJSD3 : ""; 7247 } 7248 } 7249 return range; 7250 } 7251 function slidingDateRangeToString(value) { 7252 var _value$timeUnit$toStr, _value$timeUnit, _value$lowerDate, _value$upperDate, _value$timeValue, _value$timeUnit$toStr2, _value$timeUnit2; 7253 switch (value.rangeType) { 7254 case SlidingDateRangeType.Current: 7255 return "Current||".concat(getTextForValue((_value$timeUnit$toStr = (_value$timeUnit = value.timeUnit) === null || _value$timeUnit === void 0 ? void 0 : _value$timeUnit.toString()) !== null && _value$timeUnit$toStr !== void 0 ? _value$timeUnit$toStr : "", timeUnitOptions), "||"); 7256 case SlidingDateRangeType.DateRange: 7257 return "DateRange|||".concat((_value$lowerDate = value.lowerDate) !== null && _value$lowerDate !== void 0 ? _value$lowerDate : "", "|").concat((_value$upperDate = value.upperDate) !== null && _value$upperDate !== void 0 ? _value$upperDate : ""); 7258 default: 7259 return "".concat(getTextForValue(value.rangeType.toString(), rangeTypeOptions) || "All", "|").concat((_value$timeValue = value.timeValue) !== null && _value$timeValue !== void 0 ? _value$timeValue : "", "|").concat(getTextForValue((_value$timeUnit$toStr2 = (_value$timeUnit2 = value.timeUnit) === null || _value$timeUnit2 === void 0 ? void 0 : _value$timeUnit2.toString()) !== null && _value$timeUnit$toStr2 !== void 0 ? _value$timeUnit$toStr2 : "", timeUnitOptions), "||"); 7260 } 7261 } 7262 function calculateSlidingDateRange(value) { 7263 var currentDateTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; 7264 var result = { 7265 start: null, 7266 end: null 7267 }; 7268 if (!currentDateTime) { 7269 currentDateTime = RockDateTime.now(); 7270 } 7271 if (value.rangeType === SlidingDateRangeType.Current) { 7272 if (value.timeUnit === TimeUnitType.Hour) { 7273 var _result$start$addHour, _result$start; 7274 result.start = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, currentDateTime.day, currentDateTime.hour, 0, 0); 7275 result.end = (_result$start$addHour = (_result$start = result.start) === null || _result$start === void 0 ? void 0 : _result$start.addHours(1)) !== null && _result$start$addHour !== void 0 ? _result$start$addHour : null; 7276 } else if (value.timeUnit === TimeUnitType.Day) { 7277 result.start = currentDateTime.date; 7278 result.end = result.start.addDays(1); 7279 } else if (value.timeUnit === TimeUnitType.Week) { 7280 var diff = currentDateTime.dayOfWeek - DayOfWeek.Monday; 7281 if (diff < 0) { 7282 diff += 7; 7283 } 7284 result.start = currentDateTime.addDays(-1 * diff).date; 7285 result.end = result.start.addDays(7); 7286 } else if (value.timeUnit === TimeUnitType.Month) { 7287 var _result$start$addMont, _result$start2; 7288 result.start = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, 1); 7289 result.end = (_result$start$addMont = (_result$start2 = result.start) === null || _result$start2 === void 0 ? void 0 : _result$start2.addMonths(1)) !== null && _result$start$addMont !== void 0 ? _result$start$addMont : null; 7290 } else if (value.timeUnit === TimeUnitType.Year) { 7291 result.start = RockDateTime.fromParts(currentDateTime.year, 1, 1); 7292 result.end = RockDateTime.fromParts(currentDateTime.year + 1, 1, 1); 7293 } 7294 } else if (value.rangeType === SlidingDateRangeType.Last || value.rangeType === SlidingDateRangeType.Previous) { 7295 var _value$timeValue2; 7296 var count = (_value$timeValue2 = value.timeValue) !== null && _value$timeValue2 !== void 0 ? _value$timeValue2 : 1; 7297 var roundUpCount = value.rangeType === SlidingDateRangeType.Last ? 1 : 0; 7298 if (value.timeUnit === TimeUnitType.Hour) { 7299 var _RockDateTime$fromPar, _RockDateTime$fromPar2, _result$end$addHours, _result$end; 7300 result.end = (_RockDateTime$fromPar = (_RockDateTime$fromPar2 = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, currentDateTime.day, currentDateTime.hour, 0, 0)) === null || _RockDateTime$fromPar2 === void 0 ? void 0 : _RockDateTime$fromPar2.addHours(roundUpCount)) !== null && _RockDateTime$fromPar !== void 0 ? _RockDateTime$fromPar : null; 7301 result.start = (_result$end$addHours = (_result$end = result.end) === null || _result$end === void 0 ? void 0 : _result$end.addHours(-count)) !== null && _result$end$addHours !== void 0 ? _result$end$addHours : null; 7302 } else if (value.timeUnit === TimeUnitType.Day) { 7303 var _result$end$addDays, _result$end2; 7304 result.end = currentDateTime.date.addDays(roundUpCount); 7305 result.start = (_result$end$addDays = (_result$end2 = result.end) === null || _result$end2 === void 0 ? void 0 : _result$end2.addDays(-count)) !== null && _result$end$addDays !== void 0 ? _result$end$addDays : null; 7306 } else if (value.timeUnit === TimeUnitType.Week) { 7307 var _diff = currentDateTime.dayOfWeek - DayOfWeek.Monday; 7308 if (_diff < 0) { 7309 _diff += 7; 7310 } 7311 result.end = currentDateTime.addDays(-1 * _diff).date.addDays(7 * roundUpCount); 7312 result.start = result.end.addDays(-count * 7); 7313 } else if (value.timeUnit === TimeUnitType.Month) { 7314 var _RockDateTime$fromPar3, _RockDateTime$fromPar4, _result$end$addMonths, _result$end3; 7315 result.end = (_RockDateTime$fromPar3 = (_RockDateTime$fromPar4 = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, 1)) === null || _RockDateTime$fromPar4 === void 0 ? void 0 : _RockDateTime$fromPar4.addMonths(roundUpCount)) !== null && _RockDateTime$fromPar3 !== void 0 ? _RockDateTime$fromPar3 : null; 7316 result.start = (_result$end$addMonths = (_result$end3 = result.end) === null || _result$end3 === void 0 ? void 0 : _result$end3.addMonths(-count)) !== null && _result$end$addMonths !== void 0 ? _result$end$addMonths : null; 7317 } else if (value.timeUnit === TimeUnitType.Year) { 7318 var _RockDateTime$fromPar5, _RockDateTime$fromPar6, _result$end$addYears, _result$end4; 7319 result.end = (_RockDateTime$fromPar5 = (_RockDateTime$fromPar6 = RockDateTime.fromParts(currentDateTime.year, 1, 1)) === null || _RockDateTime$fromPar6 === void 0 ? void 0 : _RockDateTime$fromPar6.addYears(roundUpCount)) !== null && _RockDateTime$fromPar5 !== void 0 ? _RockDateTime$fromPar5 : null; 7320 result.start = (_result$end$addYears = (_result$end4 = result.end) === null || _result$end4 === void 0 ? void 0 : _result$end4.addYears(-count)) !== null && _result$end$addYears !== void 0 ? _result$end$addYears : null; 7321 } 7322 var cutoffDate = currentDateTime.date.addDays(1); 7323 if (result.end && result.end.date > cutoffDate) { 7324 result.end = cutoffDate; 7325 } 7326 } else if (value.rangeType === SlidingDateRangeType.Next || value.rangeType === SlidingDateRangeType.Upcoming) { 7327 var _value$timeValue3; 7328 var _count = (_value$timeValue3 = value.timeValue) !== null && _value$timeValue3 !== void 0 ? _value$timeValue3 : 1; 7329 var _roundUpCount = value.rangeType === SlidingDateRangeType.Upcoming ? 1 : 0; 7330 if (value.timeUnit === TimeUnitType.Hour) { 7331 var _RockDateTime$fromPar7, _RockDateTime$fromPar8, _result$start$addHour2, _result$start3; 7332 result.start = (_RockDateTime$fromPar7 = (_RockDateTime$fromPar8 = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, currentDateTime.day, currentDateTime.hour, 0, 0)) === null || _RockDateTime$fromPar8 === void 0 ? void 0 : _RockDateTime$fromPar8.addHours(_roundUpCount)) !== null && _RockDateTime$fromPar7 !== void 0 ? _RockDateTime$fromPar7 : null; 7333 result.end = (_result$start$addHour2 = (_result$start3 = result.start) === null || _result$start3 === void 0 ? void 0 : _result$start3.addHours(_count)) !== null && _result$start$addHour2 !== void 0 ? _result$start$addHour2 : null; 7334 } else if (value.timeUnit === TimeUnitType.Day) { 7335 result.start = currentDateTime.date
7335.addDays(_roundUpCount); 7336 result.end = result.start.addDays(_count); 7337 } else if (value.timeUnit === TimeUnitType.Week) { 7338 var _diff2 = currentDateTime.dayOfWeek - DayOfWeek.Monday; 7339 if (_diff2 < 0) { 7340 _diff2 += 7; 7341 } 7342 result.start = currentDateTime.addDays(-1 * _diff2).date.addDays(7 * _roundUpCount); 7343 result.end = result.start.addDays(_count * 7); 7344 } else if (value.timeUnit === TimeUnitType.Month) { 7345 var _RockDateTime$fromPar9, _RockDateTime$fromPar0, _result$start$addMont2, _result$start4; 7346 result.start = (_RockDateTime$fromPar9 = (_RockDateTime$fromPar0 = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, 1)) === null || _RockDateTime$fromPar0 === void 0 ? void 0 : _RockDateTime$fromPar0.addMonths(_roundUpCount)) !== null && _RockDateTime$fromPar9 !== void 0 ? _RockDateTime$fromPar9 : null; 7347 result.end = (_result$start$addMont2 = (_result$start4 = result.start) === null || _result$start4 === void 0 ? void 0 : _result$start4.addMonths(_count)) !== null && _result$start$addMont2 !== void 0 ? _result$start$addMont2 : null; 7348 } else if (value.timeUnit === TimeUnitType.Year) { 7349 var _RockDateTime$fromPar1, _RockDateTime$fromPar10, _result$start$addYear, _result$start5; 7350 result.start = (_RockDateTime$fromPar1 = (_RockDateTime$fromPar10 = RockDateTime.fromParts(currentDateTime.year, 1, 1)) === null || _RockDateTime$fromPar10 === void 0 ? void 0 : _RockDateTime$fromPar10.addYears(_roundUpCount)) !== null && _RockDateTime$fromPar1 !== void 0 ? _RockDateTime$fromPar1 : null; 7351 result.end = (_result$start$addYear = (_result$start5 = result.start) === null || _result$start5 === void 0 ? void 0 : _result$start5.addYears(_count)) !== null && _result$start$addYear !== void 0 ? _result$start$addYear : null; 7352 } 7353 if (result.start && result.start.date < currentDateTime.date) { 7354 result.start = currentDateTime.date; 7355 } 7356 } else if (value.rangeType === SlidingDateRangeType.DateRange) { 7357 var _value$lowerDate2, _value$upperDate2; 7358 result.start = RockDateTime.parseISO((_value$lowerDate2 = value.lowerDate) !== null && _value$lowerDate2 !== void 0 ? _value$lowerDate2 : ""); 7359 result.end = RockDateTime.parseISO((_value$upperDate2 = value.upperDate) !== null && _value$upperDate2 !== void 0 ? _value$upperDate2 : ""); 7360 if (!result.start && value.lowerDate) { 7361 result.start = RockDateTime.fromJSDate(new Date(value.lowerDate)); 7362 } 7363 if (!result.end && value.upperDate) { 7364 result.end = RockDateTime.fromJSDate(new Date(value.upperDate)); 7365 } 7366 if (result.end) { 7367 result.end = result.end.addDays(1); 7368 } 7369 } 7370 if (result.end && value.timeUnit !== TimeUnitType.Hour) { 7371 result.end = result.end.addMilliseconds(-1); 7372 } 7373 return result; 7374 } 7375 7376 var slidingDateRange = /*#__PURE__*/Object.freeze({ 7377 __proto__: null, 7378 RangeType: SlidingDateRangeType, 7379 TimeUnit: TimeUnitType, 7380 calculateSlidingDateRange: calculateSlidingDateRange, 7381 getRangeTypeText: getRangeTypeText, 7382 getTimeUnitText: getTimeUnitText, 7383 parseSlidingDateRangeString: parseSlidingDateRangeString, 7384 rangeTypeOptions: rangeTypeOptions, 7385 slidingDateRangeToString: slidingDateRangeToString, 7386 timeUnitOptions: timeUnitOptions 7387 }); 7388 exports('slidingDateRange', slidingDateRange); 7389 7390 var http = useHttp(); 7391 function getStructuredContentEditorConfiguration(_x) { 7392 return _getStructuredContentEditorConfiguration.apply(this, arguments); 7393 } 7394 function _getStructuredContentEditorConfiguration() { 7395 _getStructuredContentEditorConfiguration = _asyncToGenerator(function* (options) { 7396 var result = yield http.post("/api/v2/Controls/StructuredContentEditorGetConfiguration", undefined, options); 7397 if (result.isSuccess && result.data) { 7398 return result.data; 7399 } 7400 throw new Error(result.errorMessage || "Error fetching structured content editor configuration"); 7401 }); 7402 return _getStructuredContentEditorConfiguration.apply(this, arguments); 7403 } 7404 var structuredContentEditor = { 7405 getStructuredContentEditorConfiguration 7406 }; 7407 7408 var structuredContentEditor$1 = /*#__PURE__*/Object.freeze({ 7409 __proto__: null, 7410 default: structuredContentEditor, 7411 getStructuredContentEditorConfiguration: getStructuredContentEditorConfiguration 7412 }); 7413 exports('structuredContentEditor', structuredContentEditor$1); 7414 7415 function tooltip(node, options) { 7416 if (Array.isArray(node)) { 7417 var _iterator = _createForOfIteratorHelper(node), 7418 _step; 7419 try { 7420 for (_iterator.s();
7420 !(_step = _iterator.n()).done;) { 7421 var n = _step.value; 7422 tooltip(n, options); 7423 } 7424 } catch (err) { 7425 _iterator.e(err); 7426 } finally { 7427 _iterator.f(); 7428 } 7429 return; 7430 } 7431 if (typeof $ !== "function") { 7432 return; 7433 } 7434 var $node = $(node); 7435 var appliedContainer = undefined; 7436 var fsElement = undefined; 7437 var getContainer = () => { 7438 var _options$container2; 7439 if (!isFullscreen() && fsElement) { 7440 var _options$container; 7441 fsElement.style.position = ""; 7442 fsElement = undefined; 7443 return (_options$container = options === null || options === void 0 ? void 0 : options.container) !== null && _options$container !== void 0 ? _options$container : "body"; 7444 } 7445 var newFsElement = getFullscreenElement(); 7446 if (newFsElement && newFsElement === fsElement) { 7447 return undefined; 7448 } 7449 if (newFsElement && newFsElement.contains(node)) { 7450 fsElement = newFsElement; 7451 var fsElementPosition = getComputedStyle(fsElement).position; 7452 if (fsElementPosition === "static") { 7453 fsElement.style.position = "relative"; 7454 } 7455 return getUniqueCssSelector(fsElement); 7456 } 7457 return (_options$container2 = options === null || options === void 0 ? void 0 : options.container) !== null && _options$container2 !== void 0 ? _options$container2 : "body"; 7458 }; 7459 var applyTooltip = container => { 7460 if (appliedContainer === container || container === undefined) { 7461 return; 7462 } 7463 if (appliedContainer) { 7464 $node === null || $node === void 0 || $node.tooltip("destroy"); 7465 setTimeout(() => { 7466 var _options$sanitize; 7467 $node === null || $node === void 0 || $node.tooltip({ 7468 container: container, 7469 html: options === null || options === void 0 ? void 0 : options.html, 7470 sanitize: (_options$sanitize = options === null || options === void 0 ? void 0 : options.sanitize) !== null && _options$sanitize !== void 0 ? _options$sanitize : true, 7471 delay: options === null || options === void 0 ? void 0 : options.delay, 7472 trigger: "hover focus" 7473 }); 7474 }, 151); 7475 } else { 7476 var _options$sanitize2; 7477 $node === null || $node === void 0 || $node.tooltip({ 7478 container: container, 7479 html: options === null || options === void 0 ? void 0 : options.html, 7480 sanitize: (_options$sanitize2 = options === null || options === void 0 ? void 0 : options.sanitize) !== null && _options$sanitize2 !== void 0 ? _options$sanitize2 : true, 7481 delay: options === null || options === void 0 ? void 0 : options.delay, 7482 trigger: "hover focus" 7483 }); 7484 } 7485 appliedContainer = container; 7486 }; 7487 if (!(options !== null && options !== void 0 && options.container) || options.container === "body" || options.container === "html") { 7488 document.addEventListener("fullscreenchange", () => applyTooltip(getContainer())); 7489 } 7490 applyTooltip(getContainer()); 7491 $(document).on("click", ".tooltip", function (e) { 7492 e.stopPropagation(); 7493 }); 7494 $node === null || $node === void 0 || $node.on("mouseleave", function () { 7495 if (!$(this).data("tooltip-pinned")) { 7496 $node === null || $node === void 0 || $node.tooltip("hide"); 7497 } 7498 }); 7499 } 7500 function showTooltip(node) { 7501 if (typeof $ === "function") { 7502 $(node).tooltip("show"); 7503 $(node).data("tooltip-pinned", true); 7504 } 7505 } 7506 function hideTooltip(node) { 7507 if (typeof $ === "function") { 7508 $(node).data("tooltip-pinned", false); 7509 $(node).tooltip("hide"); 7510 } 7511 } 7512 function destroyTooltip(node) { 7513 if (typeof $ === "function") { 7514 $(node).tooltip("destroy"); 7515 } 7516 } 7517 function resetTooltip(node, options) { 7518 return new Promise(res => { 7519 destroyTooltip(node); 7520 setTimeout(() => { 7521 tooltip(node, options); 7522 res(); 7523 }, 151); 7524 }); 7525 } 7526 function applyTooltip(el, options) { 7527 if (isElement(el)) { 7528 tooltip(el, options); 7529 } 7530 } 7531 7532 var tooltip$1 = /*#__PURE__*/Object.freeze({ 7533 __proto__: null, 7534 applyTooltip: applyTooltip, 7535 destroyTooltip: destroyTooltip, 7536 hideTooltip: hideTooltip, 7537 resetTooltip: resetTooltip, 7538 showTooltip: showTooltip, 7539 tooltip: tooltip 7540 }); 7541 exports('tooltip', tooltip$1); 7542 7543 class CategoryTreeItemProvider { 7544 constructor() { 7545 _defineProperty(this, "http", useHttp()); 7546 } 7547 getItems(parentGuid) { 7548 var _this = this; 7549 return _asyncToGenerator(function* () { 7550 var options = { 7551 parentGuid: parentGuid, 7552 entityTypeGuid: _this.entityTypeGuid, 7553 entityTypeQualifierColumn: _this.entityTypeQualifierColumn, 7554 entityTypeQualifierValue: _this.entityTypeQualifierValue, 7555 lazyLoad: false, 7556 securityGrantToken: _this.securityGrantToken, 7557 getCategorizedItems: false, 7558 includeCategoriesWithoutChildren: true, 7559 includeInactiveItems: false, 7560 includeUnnamedEntityItems: false 7561 }; 7562 var response = yield _this.http.post("/api/v2/Controls/CategoryPickerChildTreeItems", {}, options); 7563 if (response.isSuccess && response.data) { 7564 return response.data; 7565 } else { 7566 console.log("Error", response.errorMessage); 7567 return []; 7568 } 7569 })(); 7570 } 7571 getRootItems() { 7572 var _this2 = this; 7573 return _asyncToGenerator(function* () { 7574 return yield _this2.getItems(_this2.rootCategoryGuid); 7575 })(); 7576 } 7577 getChildItems(item) { 7578 var _this3 = this; 7579 return _asyncToGenerator(function* () { 7580 return _this3.getItems(item.value); 7581 })(); 7582 } 7583 } 7584 class LocationTreeItemProvider { 7585 constructor() { 7586 _defineProperty(this, "http", useHttp()); 7587 _defineProperty(this, "includeInactive", false); 7588 } 7589 getItems(parentGuid, expandToValues) { 7590 var _this4 = this; 7591 return _asyncToGenerator(function* () { 7592 var _toGuidOrNull, _this4$rootLocationGu; 7593 var options = { 7594 guid: (_toGuidOrNull = toGuidOrNull(parentGuid)) !== null && _toGuidOrNull !== void 0 ? _toGuidOrNull : emptyGuid, 7595 rootLocationGuid: (_this4$rootLocationGu = _this4.rootLocationGuid) !== null && _this4$rootLocationGu !== void 0 ? _this4$rootLocationGu : emptyGuid, 7596 expandToValues: expandToValues, 7597 securityGrantToken: _this4.securityGrantToken, 7598 includeInactive: _this4.includeInactive 7599 }; 7600 var url = "/api/v2/Controls/LocationItemPickerGetActiveChildren"; 7601 var response = yield _this4.http.post(url, undefined, options); 7602 if (response.isSuccess && response.data) { 7603 return response.data; 7604 } else { 7605 console.log("Error", response.errorMessage); 7606 return []; 7607 } 7608 })(); 7609 } 7610 getRootItems(expandToValues) { 7611 var _this5 = this; 7612 return _asyncToGenerator(function* () { 7613 return yield _this5.getItems(null, expandToValues); 7614 })(); 7615 } 7616 getChildItems(item) { 7617 var _this6 = this; 7618 return _asyncToGenerator(function* () { 7619 return _this6.getItems(item.value); 7620 })(); 7621 } 7622 } 7623 class DataViewTreeItemProvider { 7624 constructor() { 7625 _defineProperty(this, "http", useHttp()); 7626 _defineProperty(this, "displayPersistedOnly", false); 7627 } 7628 getItems(parentGuid) { 7629 var _this7 = this; 7630 return _asyncToGenerator(function* () { 7631 var options = { 7632 parentGuid, 7633 getCategorizedItems: true, 7634 includeCategoriesWithoutChildren: false, 7635 entityTypeGuidFilter: _this7.entityTypeGuid, 7636 lazyLoad: false, 7637 securityGrantToken: _this7.securityGrantToken, 7638 displayPersistedOnly: _this7.displayPersistedOnly, 7639 includeUnnamedEntityItems: false 7640 }; 7641 var response = yield _this7.http.post("/api/v2/Controls/DataViewPickerGetDataViews", {}, options); 7642 if (response.isSuccess && response.data) { 7643 return response.data; 7644 } else { 7645 console.log("Error", response.errorMessage); 7646 return []; 7647 } 7648 })(); 7649 } 7650 getRootItems() { 7651 var _this8 = this; 7652 return _asyncToGenerator(function* () { 7653 return yield _this8.getItems(); 7654 })(); 7655 } 7656 getChildItems(item) { 7657 var _this9 = this; 7658 return _asyncToGenerator(function* () { 7659 return _this9.getItems(item.value); 7660 })(); 7661 } 7662 } 7663 class WorkflowTypeTreeItemProvider { 7664 constructor() { 7665 _defineProperty(this, "http", useHttp()); 7666 } 7667 getItems(parentGuid) { 7668 var _this0 = this; 7669 return _asyncToGenerator(function* () { 7670 var _this0$includeInactiv; 7671 var options = { 7672 parentGuid, 7673 includeInactiveItems: (_this0$includeInactiv = _this0.includeInactiveItems) !== null && _this0$includeInactiv !== void 0 ? _this0$includeInactiv : false, 7674 securityGrantToken: _this0.securityGrantToken, 7675 getCategorizedItems: false, 7676 includeCategoriesWithoutChildren: false, 7677 includeUnnamedEntityItems: false, 7678 lazyLoad: false 7679 }; 7680 var response = yield _this0.http.post("/api/v2/Controls/WorkflowTypePickerGetWorkflowTypes", {}, options); 7681 if (response.isSuccess && response.data) { 7682 return response.data; 7683 } else { 7684 console.log("Error", response.errorMessage); 7685 return []; 7686 } 7687 })(); 7688 } 7689 getRootItems() { 7690 var _this1 = this; 7691 return _asyncToGenerator(function* () { 7692 return yield _this1.getItems(); 7693 })(); 7694 } 7695 getChildItems(item) { 7696 var _this10 = this; 7697 return _asyncToGenerator(function* () { 7698 return _this10.getItems(item.value); 7699 })(); 7700 } 7701 } 7702 class PageTreeItemProvider { 7703 constructor() { 7704 _defineProperty(this, "http", useHttp()); 7705 } 7706 getItems(parentGuid, expandToValues) { 7707 var _this11 = this; 7708 return _asyncToGenerator(function* () { 7709 var _toGuidOrNull2, _this11$rootPageGuid, _this11$hidePageGuids; 7710 var result; 7711 var options = { 7712 guid: (_toGuidOrNull2 = toGuidOrNull(parentGuid)) !== null && _toGuidOrNull2 !== void 0 ? _toGuidOrNull2 : emptyGuid, 7713 rootPageGuid: (_this11$rootPageGuid = _this11.rootPageGuid) !== null && _this11$rootPageGuid !== void 0 ? _this11$rootPageGuid : null, 7714 hidePageGuids: (_this11$hidePageGuids = _this11.hidePageGuids) !== null && _this11$hidePageGuids !== void 0 ? _this11$hidePageGuids : [], 7715 securityGrantToken: _this11.securityGrantToken, 7716 siteType: _this11.siteType, 7717 expandToValues 7718 }; 7719 var url = "/api/v2/Controls/PagePickerGetChildren"; 7720 var response = yield _this11.http.post(url, undefined, options); 7721 if (response.isSuccess && response.data) { 7722 result = response.data; 7723 } else { 7724 console.log("Error", response.errorMessage); 7725 return []; 7726 } 7727 if (parentGuid || !_this11.selectedPageGuids) { 7728 return result; 7729 } 7730 return _this11.getHierarchyToSelectedPage(result); 7731 })(); 7732 } 7733 getParentList() { 7734 var _this12 = this; 7735 return _asyncToGenerator(function* () { 7736 var options = { 7737 selectedPageGuids: _this12.selectedPageGuids, 7738 securityGrantToken: _this12.securityGrantToken 7739 }; 7740 var url = "/api/v2/Controls/PagePickerGetSelectedPageHierarchy"; 7741 var response = yield _this12.http.post(url, undefined, options); 7742 if (response.isSuccess && response.data) { 7743 return response.data; 7744 } else { 7745 console.log("Error", response.errorMessage); 7746 return []; 7747 } 7748 })(); 7749 } 7750 getHierarchyToSelectedPage(rootLayer) { 7751 var _this13 = this; 7752 return _asyncToGenerator(function* () { 7753 var parents = yield _this13.getParentList(); 7754 if (!parents || parents.length === 0) { 7755 return rootLayer; 7756 } 7757 var childLists = yield Promise.all(parents.map(guid => _this13.getItems(guid))); 7758 var allPages = rootLayer.concat(flatten(childLists));
7759 parents.forEach((parentGuid, i) => { 7760 var parentPage = allPages.find(page => page.value === parentGuid); 7761 if (parentPage) { 7762 parentPage.children = childLists[i]; 7763 } 7764 }); 7765 return rootLayer; 7766 })(); 7767 } 7768 getRootItems(expandToValues) { 7769 var _this14 = this; 7770 return _asyncToGenerator(function* () { 7771 return yield _this14.getItems(null, expandToValues); 7772 })(); 7773 } 7774 getChildItems(item) { 7775 var _this15 = this; 7776 return _asyncToGenerator(function* () { 7777 return _this15.getItems(item.value); 7778 })(); 7779 } 7780 } 7781 class ConnectionRequestTreeItemProvider { 7782 constructor() { 7783 _defineProperty(this, "http", useHttp()); 7784 } 7785 getItems(parentGuid, expandToValues) { 7786 var _this16 = this; 7787 return _asyncToGenerator(function* () { 7788 var options = { 7789 parentGuid, 7790 securityGrantToken: _this16.securityGrantToken, 7791 expandToValues 7792 }; 7793 var url = "/api/v2/Controls/ConnectionRequestPickerGetChildren"; 7794 var response = yield _this16.http.post(url, undefined, options); 7795 if (response.isSuccess && response.data) { 7796 return response.data; 7797 } else { 7798 console.log("Error", response.errorMessage); 7799 return []; 7800 } 7801 })(); 7802 } 7803 getRootItems(expandToValues) { 7804 var _this17 = this; 7805 return _asyncToGenerator(function* () { 7806 return yield _this17.getItems(null, expandToValues); 7807 })(); 7808 } 7809 getChildItems(item) { 7810 var _this18 = this; 7811 return _asyncToGenerator(function* () { 7812 return _this18.getItems(item.value); 7813 })(); 7814 } 7815 } 7816 class GroupTreeItemProvider { 7817 constructor() { 7818 _defineProperty(this, "http", useHttp()); 7819 _defineProperty(this, "securityGrantToken", null); 7820 _defineProperty(this, "rootGroupGuid", null); 7821 _defineProperty(this, "includedGroupTypeGuids", []); 7822 _defineProperty(this, "excludeAllByDefault", false); 7823 _defineProperty(this, "includeInactiveGroups", false); 7824 _defineProperty(this, "limitToSchedulingEnabled", false); 7825 _defineProperty(this, "limitToRSVPEnabled", false); 7826 } 7827 getItems() { 7828 var _arguments = arguments, 7829 _this19 = this; 7830 return _asyncToGenerator(function* () { 7831 var parentGuid = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : null; 7832 var expandToValues = _arguments.length > 1 ? _arguments[1] : undefined; 7833 var options = { 7834 guid: parentGuid, 7835 rootGroupGuid: _this19.rootGroupGuid, 7836 includedGroupTypeGuids: _this19.includedGroupTypeGuids, 7837 excludeAllByDefault: _this19.excludeAllByDefault, 7838 includeInactiveGroups: _this19.includeInactiveGroups, 7839 limitToSchedulingEnabled: _this19.limitToSchedulingEnabled, 7840 limitToRSVPEnabled: _this19.limitToRSVPEnabled, 7841 securityGrantToken: _this19.securityGrantToken, 7842 expandToValues 7843 }; 7844 var url = "/api/v2/Controls/GroupPickerGetChildren"; 7845 var response = yield _this19.http.post(url, undefined, options); 7846 if (response.isSuccess && response.data) { 7847 return response.data; 7848 } else { 7849 console.log("Error", response.errorMessage); 7850 return []; 7851 } 7852 })(); 7853 } 7854 getRootItems(expandToValues) { 7855 var _this20 = this; 7856 return _asyncToGenerator(function* () { 7857 return yield _this20.getItems(null, expandToValues); 7858 })(); 7859 } 7860 getChildItems(item) { 7861 var _this21 = this; 7862 return _asyncToGenerator(function* () { 7863 return _this21.getItems(item.value); 7864 })(); 7865 } 7866 } 7867 class MergeTemplateTreeItemProvider { 7868 constructor() { 7869 _defineProperty(this, "http", useHttp()); 7870 _defineProperty(this, "securityGrantToken", null); 7871 _defineProperty(this, "mergeTemplateOwnership", MergeTemplateOwnership.Global); 7872 } 7873 getItems() { 7874 var _arguments2 = arguments, 7875 _this22 = this; 7876 return _asyncToGenerator(function* () { 7877 var _toNumberOrNull; 7878 var parentGuid = _arguments2.length > 0 && _arguments2[0] !== undefined ? _arguments2[0] : null; 7879 var expandToValues = _arguments2.length > 1 ? _arguments2[1] : undefined; 7880 var options = { 7881 parentGuid, 7882 mergeTemplateOwnership: (_toNumberOrNull = toNumberOrNull(_this22.mergeTemplateOwnership)) !== null && _toNumberOrNull !== void 0 ? _toNumberOrNull : 0, 7883 securityGrantToken: _this22.securityGrantToken, 7884 expandToValues 7885 }; 7886 var url = "/api/v2/Controls/MergeTemplatePickerGetMergeTemplates"; 7887 var response = yield _this22.http.post(url, undefined, options); 7888 if (response.isSuccess && response.data) { 7889 return response.data; 7890 } else { 7891 console.log("Error", response.errorMessage); 7892 return []; 7893 } 7894 })(); 7895 } 7896 getRootItems(expandToValues) { 7897 var _this23 = this; 7898 return _asyncToGenerator(function* () { 7899 return yield _this23.getItems(null, expandToValues); 7900 })(); 7901 } 7902 getChildItems(item) { 7903 var _this24 = this; 7904 return _asyncToGenerator(function* () { 7905 return _this24.getItems(item.value); 7906 })(); 7907 } 7908 } 7909 class MetricCategoryTreeItemProvider { 7910 constructor() { 7911 _defineProperty(this, "http", useHttp()); 7912 _defineProperty(this, "securityGrantToken", null); 7913 } 7914 getItems() { 7915 var _arguments3 = arguments, 7916 _this25 = this; 7917 return _asyncToGenerator(function* () { 7918 var parentGuid = _arguments3.length > 0 && _arguments3[0] !== undefined ? _arguments3[0] : null; 7919 var expandToValues = _arguments3.length > 1 ? _arguments3[1] : undefined; 7920 var options = { 7921 parentGuid, 7922 securityGrantToken: _this25.securityGrantToken, 7923 expandToValues 7924 }; 7925 var url = "/api/v2/Controls/MetricCategoryPickerGetChildren"; 7926 var response = yield _this25.http.post(url, undefined, options); 7927 if (response.isSuccess && response.data) { 7928 return response.data; 7929 } else { 7930 console.log("Error", response.errorMessage); 7931 return []; 7932 } 7933 })(); 7934 } 7935 getRootItems(expandToValues) { 7936 var _this26 = this; 7937 return _asyncToGenerator(function* () { 7938 return yield _this26.getItems(null, expandToValues); 7939 })(); 7940 } 7941 getChildItems(item) { 7942 var _this27 = this; 7943 return _asyncToGenerator(function* () { 7944 return _this27.getItems(item.value); 7945 })(); 7946 } 7947 } 7948 class MetricItemTreeItemProvider { 7949 constructor() { 7950 _defineProperty(this, "http", useHttp()); 7951 _defineProperty(this, "securityGrantToken", null); 7952 _defineProperty(this, "includeCategoryGuids", null); 7953 } 7954 getItems() { 7955 var _arguments4 = arguments, 7956 _this28 = this; 7957 return _asyncToGenerator(function* () { 7958 var parentGuid = _arguments4.length > 0 && _arguments4[0] !== undefined ? _arguments4[0] : null; 7959 var options = { 7960 parentGuid, 7961 includeCategoryGuids: _this28.includeCategoryGuids, 7962 securityGrantToken: _this28.securityGrantToken 7963 }; 7964 var url = "/api/v2/Controls/MetricItemPickerGetChildren"; 7965 var response = yield _this28.http.post(url, undefined, options); 7966 if (response.isSuccess && response.data) { 7967 return response.data; 7968 } else { 7969 console.log("Error", response.errorMessage); 7970 return []; 7971 } 7972 })(); 7973 } 7974 getRootItems() { 7975 var _this29 = this; 7976 return _asyncToGenerator(function* () { 7977 return yield _this29.getItems(null); 7978 })(); 7979 } 7980 getChildItems(item) { 7981 var _this30 = this; 7982 return _asyncToGenerator(function* () { 7983 return _this30.getItems(item.value); 7984 })(); 7985 } 7986 } 7987 class RegistrationTemplateTreeItemProvider { 7988 constructor() { 7989 _defineProperty(this, "http", useHttp()); 7990 _defineProperty(this, "securityGrantToken", null); 7991 } 7992 getItems() { 7993 var _arguments5 = arguments, 7994 _this31 = this; 7995 return _asyncToGenerator(function* () { 7996 var parentGuid = _arguments5.length > 0 && _arguments5[0] !== undefined ? _arguments5[0] : null; 7997 var expandToValues = _arguments5.length > 1 ? _arguments5[1] : undefined; 7998 var options = { 7999 parentGuid, 8000 securityGrantToken: _this31.securityGrantToken, 8001 expandToValues 8002 }; 8003 var url = "/api/v2/Controls/RegistrationTemplatePickerGetChildren"; 8004 var response = yield _this31.http.post(url, undefined, options); 8005 if (response.isSuccess && response.data) { 8006 return response.data; 8007 } else { 8008 console.log("Error", response.errorMessage); 8009 return []; 8010 } 8011 })(); 8012 } 8013 getRootItems(expandToValues) { 8014 var _this32 = this; 8015 return _asyncToGenerator(function* () { 8016 return yield _this32.getItems(null, expandToValues); 8017 })(); 8018 } 8019 getChildItems(item) { 8020 var _this33 = this; 8021 return _asyncToGenerator(function* () { 8022 return _this33.getItems(item.value); 8023 })(); 8024 } 8025 } 8026 class ReportTreeItemProvider { 8027 constructor() { 8028 _defineProperty(this, "http", useHttp()); 8029 _defineProperty(this, "securityGrantToken", null); 8030 _defineProperty(this, "includeCategoryGuids", null); 8031 _defineProperty(this, "entityTypeGuid", null); 8032 } 8033 getItems() { 8034 var _arguments6 = arguments, 8035 _this34 = this; 8036 return _asyncToGenerator(function* () { 8037 var parentGuid = _arguments6.length > 0 && _arguments6[0] !== undefined ? _arguments6[0] : null; 8038 var expandToValues = _arguments6.length > 1 ? _arguments6[1] : undefined; 8039 var options = { 8040 parentGuid, 8041 includeCategoryGuids: _this34.includeCategoryGuids, 8042 entityTypeGuid: _this34.entityTypeGuid, 8043 securityGrantToken: _this34.securityGrantToken, 8044 expandToValues 8045 }; 8046 var url = "/api/v2/Controls/ReportPickerGetChildren"; 8047 var response = yield _this34.http.post(url, undefined, options); 8048 if (response.isSuccess && response.data) { 8049 return response.data; 8050 } else { 8051 console.log("Error", response.errorMessage); 8052 return []; 8053 } 8054 })(); 8055 } 8056 getRootItems(expandToValues) { 8057 var _this35 = this; 8058 return _asyncToGenerator(function* () { 8059 return yield _this35.getItems(null, expandToValues); 8060 })(); 8061 } 8062 getChildItems(item) { 8063 var _this36 = this; 8064 return _asyncToGenerator(function* () { 8065 return _this36.getItems(item.value); 8066 })(); 8067 } 8068 } 8069 class ScheduleTreeItemProvider { 8070 constructor() { 8071 _defineProperty(this, "http", useHttp()); 8072 _defineProperty(this, "securityGrantToken", null); 8073 _defineProperty(this, "includeInactive", false); 8074 _defineProperty(this, "includePublicOnly", false); 8075 _defineProperty(this, "includeCategoryGuids", null); 8076 } 8077 getItems() { 8078 var _arguments7 = arguments, 8079 _this37 = this; 8080 return _asyncToGenerator(function* () { 8081 var parentGuid = _arguments7.length > 0 && _arguments7[0] !== undefined ? _arguments7[0] : null; 8082 var expandToValues = _arguments7.length > 1 ? _arguments7[1] : undefined; 8083 var options = { 8084 parentGuid, 8085 includeInactiveItems: _this37.includeInactive, 8086 includePublicItemsOnly: _this37.includePublicOnly, 8087 includeCategoryGuids: _this37.includeCategoryGuids, 8088 securityGrantToken: _this37.securityGrantToken, 8089 expandToValues 8090 }; 8091 var url = "/api/v2/Controls/SchedulePickerGetChildren"; 8092 var response = yield _this37.http.post(url, undefined, options); 8093 if (response.isSuccess && response.data) { 8094 return response.data; 8095 } else { 8096 console.log("Error", response.errorMessage); 8097 return []; 8098 } 8099 })(); 8100 } 8101 getRootItems(expandToValues) { 8102 var _this38 = this; 8103 return _asyncToGenerator(function* () { 8104 return yield _this38.getItems(null, expandToValues); 8105 })(); 8106 } 8107 getChildItems(item) { 8108 var _this39 = this; 8109 return _asyncToGenerator(function* () { 8110 return _this39.getItems(item.value); 8111 })(); 8112 } 8113 } 8114 class WorkflowActionTypeTreeItemProvider { 8115 constructor() { 8116 _defineProperty(this, "http", useHttp()); 8117 _defineProperty(this, "securityGrantToken", null); 8118 _defineProperty(this, "includeInactive", false); 8119 } 8120 getItems() { 8121 var _arguments8 = arguments, 8122 _this40 = this; 8123 return _asyncToGenerator(function* () { 8124 var _toNumberOrNull2; 8125 var parentId = _arguments8.length > 0 && _arguments8[0] !== undefined ? _arguments8[0] : null; 8126 var expandToValues = _arguments8.length > 1 ? _arguments8[1] : undefined; 8127 var options = { 8128 parentId: (_toNumberOrNull2 = toNumberOrNull(parentId)) !== null && _toNumberOrNull2 !== void 0 ? _toNumberOrNull2 : 0, 8129 securityGrantToken: _this40.securityGrantToken, 8130 expandToValues 8131 }; 8132 var url = "/api/v2/Controls/WorkflowActionTypePickerGetChildren"; 8133 var response = yield _this40.http.post(url, undefined, options); 8134 if (response.isSuccess && response.data) { 8135 return response.data; 8136 } else { 8137 console.log("Error", response.errorMessage); 8138 return []; 8139 } 8140 })(); 8141 } 8142 getRootItems(expandToValues) { 8143 var _this41 = this; 8144 return _asyncToGenerator(function* () { 8145 return yield _this41.getItems(null, expandToValues); 8146 })(); 8147 } 8148 getChildItems(item) { 8149 var _this42 = this; 8150 return _asyncToGenerator(function* () { 8151 return _this42.getItems(item.value); 8152 })(); 8153 } 8154 } 8155 class MergeFieldTreeItemProvider { 8156 constructor() { 8157 _defineProperty(this, "http", useHttp()); 8158 _defineProperty(this, "additionalFields", ""); 8159 } 8160 getItems(parentId) { 8161 var _this43 = this; 8162 return _asyncToGenerator(function* () { 8163 var result; 8164 var options = { 8165 id: parentId || "0", 8166 additionalFields: _this43.additionalFields 8167 }; 8168 var url = "/api/v2/Controls/MergeFieldPickerGetChildren"; 8169 var response = yield _this43.http.post(url, undefined, options); 8170 if (response.isSuccess && response.data) { 8171 result = response.data; 8172 } else { 8173 console.log("Error", response.errorMessage); 8174 return []; 8175 } 8176 if (parentId || !
8176_this43.selectedIds || _this43.selectedIds.length === 0) { 8177 return result; 8178 } 8179 return _this43.getHierarchyToSelectedMergeField(result); 8180 })(); 8181 } 8182 getHierarchyToSelectedMergeField(rootLayer) { 8183 var _this44 = this; 8184 return _asyncToGenerator(function* () { 8185 var parents = _this44.getParentList(); 8186 if (!parents || parents.length === 0) { 8187 return rootLayer; 8188 } 8189 var childLists = yield Promise.all(parents.map(id => _this44.getItems(id))); 8190 var allMergeFields = rootLayer.concat(flatten(childLists)); 8191 parents.forEach((parentGuid, i) => { 8192 var parentMergeField = allMergeFields.find(page => page.value === parentGuid); 8193 if (parentMergeField) { 8194 parentMergeField.children = childLists[i]; 8195 } 8196 }); 8197 return rootLayer; 8198 })(); 8199 } 8200 getParentList() { 8201 if (!this.selectedIds || this.selectedIds.length === 0) { 8202 return null; 8203 } 8204 if (typeof this.selectedIds == "string") { 8205 return this.splitSelectionIntoParents(this.selectedIds); 8206 } 8207 return flatten(this.selectedIds.map(sel => this.splitSelectionIntoParents(sel))); 8208 } 8209 splitSelectionIntoParents(selection) { 8210 var parentIds = []; 8211 var splitList = selection.split("|"); 8212 splitList.pop(); 8213 while (splitList.length >= 1) { 8214 parentIds.unshift(splitList.join("|")); 8215 splitList.pop(); 8216 } 8217 return parentIds; 8218 } 8219 getRootItems() { 8220 var _this45 = this; 8221 return _asyncToGenerator(function* () { 8222 return yield _this45.getItems(); 8223 })(); 8224 } 8225 getChildItems(item) { 8226 var _this46 = this; 8227 return _asyncToGenerator(function* () { 8228 return _this46.getItems(item.value); 8229 })(); 8230 } 8231 } 8232 class AssetManagerTreeItemProvider { 8233 constructor() { 8234 _defineProperty(this, "http", useHttp()); 8235 _defineProperty(this, "openFolders", new Set()); 8236 _defineProperty(this, "selectedFolder", ""); 8237 _defineProperty(this, "enableAssetManager", false); 8238 _defineProperty(this, "enableFileManager", false); 8239 _defineProperty(this, "encryptedRootFolder", ""); 8240 _defineProperty(this, "securityGrantToken", ""); 8241 _defineProperty(this, "userSpecificRoot", false); 8242 } 8243 getRootItems() { 8244 var _this47 = this; 8245 return _asyncToGenerator(function* () { 8246 var options = { 8247 expandedFolders: _this47.openFolders.size > 0 ? Array.from(_this47.openFolders) : null, 8248 selectedFolder: _this47.selectedFolder, 8249 enableAssetManager: _this47.enableAssetManager, 8250 enableFileManager: _this47.enableFileManager, 8251 rootFolder: _this47.encryptedRootFolder, 8252 securityGrantToken: _this47.securityGrantToken, 8253 userSpecificRoot: _this47.userSpecificRoot 8254 }; 8255 var url = "/api/v2/Controls/AssetManagerGetRootFolders"; 8256 var response = yield _this47.http.post(url, undefined, options); 8257 if (response.isSuccess && response.data) { 8258 _this47.openFolders = new Set(response.data.updatedExpandedFolders); 8259 return response.data.tree; 8260 } else { 8261 console.error("Error Fetching Root Asset Manager Items", response.errorMessage); 8262 return []; 8263 } 8264 })(); 8265 } 8266 getChildItems(item) { 8267 var _this48 = this; 8268 return _asyncToGenerator(function* () { 8269 var options = { 8270 assetFolderId: item.value, 8271 securityGrantToken: _this48.securityGrantToken 8272 }; 8273 var url = "/api/v2/Controls/AssetManagerGetChildren"; 8274 var response = yield _this48.http.post(url, undefined, options); 8275 if (response.isSuccess && response.data) { 8276 return response.data; 8277 } else { 8278 console.error("Error Fetching Asset Manager Children", response.errorMessage); 8279 return []; 8280 } 8281 })(); 8282 } 8283 } 8284 class AdaptiveMessageTreeItemProvider { 8285 constructor() { 8286 _defineProperty(this, "http", useHttp()); 8287 } 8288 getItems(parentGuid, expandToValues) { 8289 var _this49 = this; 8290 return _asyncToGenerator(function* () { 8291 var options = { 8292 parentValue: parentGuid, 8293 securityGrantToken: _this49.securityGrantToken, 8294 expandToValues 8295 }; 8296 var response = yield _this49.http.post("/api/v2/Controls/AdaptiveMessagePickerGetAdaptiveMessages", {}, options); 8297 if (response.isSuccess && response.data) { 8298 return response.data; 8299 } else { 8300 console.log("Error", response.errorMessage); 8301 return []; 8302 } 8303 })(); 8304 } 8305 getRootItems(expandToValues) { 8306 var _this50 = this; 8307 return _asyncToGenerator(function* () { 8308 return yield _this50.getItems(null, expandToValues); 8309 })(); 8310 } 8311 getChildItems(item) { 8312 var _this51 = this; 8313 return _asyncToGenerator(function* () { 8314 return _this51.getItems(item.value); 8315 })(); 8316 } 8317 } 8318 8319 var treeItemProviders = /*#__PURE__*/Object.freeze({ 8320 __proto__: null, 8321 AdaptiveMessageTreeItemProvider: AdaptiveMessageTreeItemProvider, 8322 AssetManagerTreeItemProvider: AssetManagerTreeItemProvider, 8323 CategoryTreeItemProvider: CategoryTreeItemProvider, 8324 ConnectionRequestTreeItemProvider: ConnectionRequestTreeItemProvider, 8325 DataViewTreeItemProvider: DataViewTreeItemProvider, 8326 GroupTreeItemProvider: GroupTreeItemProvider, 8327 LocationTreeItemProvider: LocationTreeItemProvider, 8328 MergeFieldTreeItemProvider: MergeFieldTreeItemProvider, 8329 MergeTemplateTreeItemProvider: MergeTemplateTreeItemProvider, 8330 MetricCategoryTreeItemProvider: MetricCategoryTreeItemProvider, 8331 MetricItemTreeItemProvider: MetricItemTreeItemProvider, 8332 PageTreeItemProvider: PageTreeItemProvider, 8333 RegistrationTemplateTreeItemProvider: RegistrationTemplateTreeItemProvider, 8334 ReportTreeItemProvider: ReportTreeItemProvider, 8335 ScheduleTreeItemProvider: ScheduleTreeItemProvider, 8336 WorkflowActionTypeTreeItemProvider: WorkflowActionTypeTreeItemProvider, 8337 WorkflowTypeTreeItemProvider: WorkflowTypeTreeItemProvider 8338 }); 8339 exports('treeItemProviders', treeItemProviders); 8340 8341 function isUrl(val) { 8342 if (typeof val === "string") { 8343 var re = /^(http[s]?:\/\/)?[^\s(["<,>]*\.?[^\s[",><]*$/; 8344 return re.test(val); 8345 } 8346 return false;
8347 } 8348 function makeUrlRedirectSafe(url) { 8349 try { 8350 var u = new URL(url); 8351 if (u.protocol !== "http:" && u.protocol !== "https:") { 8352 return "/"; 8353 } 8354 return makeUrlRedirectSafe("".concat(u.pathname).concat(u.search)); 8355 } catch (_unused) { 8356 if (url.indexOf(":") !== -1) { 8357 return "/"; 8358 } 8359 return url; 8360 } 8361 } 8362 function syncRefsWithQueryParams(bindings) { 8363 var isReplaceStateScheduled = false; 8364 function scheduleReplaceState() { 8365 if (isReplaceStateScheduled) { 8366 return; 8367 } 8368 isReplaceStateScheduled = true; 8369 queueMicrotask(() => { 8370 try { 8371 var qs = params.toString(); 8372 var _window$location = window.location, 8373 pathname = _window$location.pathname, 8374 search = _window$location.search, 8375 hash = _window$location.hash; 8376 var nextUrl = qs ? "".concat(pathname, "?").concat(qs).concat(hash) : "".concat(pathname).concat(hash); 8377 var currentUrl = "".concat(pathname).concat(search).concat(hash); 8378 if (nextUrl !== currentUrl) { 8379 history.replaceState(null, "", nextUrl); 8380 } 8381 } finally { 8382 isReplaceStateScheduled = false; 8383 } 8384 }); 8385 } 8386 var params = new URLSearchParams(window.location.search); 8387 var _iterator = _createForOfIteratorHelper(bindings), 8388 _step; 8389 try { 8390 var _loop = function _loop() { 8391 var binding = _step.value; 8392 var param = binding.param, 8393 ref = binding.ref, 8394 type = binding.type; 8395 var raw = params.get(param); 8396 if (!isNullish(raw)) { 8397 var parsed = parse(raw, type); 8398 if (!isNullish(parsed)) { 8399 ref.value = parsed; 8400 } else {} 8401 } 8402 watch(ref, value => { 8403 if (isNullish(value)) { 8404 params.delete(param); 8405 } else { 8406 var serialized = serialize(value, type); 8407 if (isNullish(serialized)) { 8408 params.delete(param); 8409 } else { 8410 params.set(param, serialized); 8411 } 8412 } 8413 scheduleReplaceState(); 8414 }); 8415 }; 8416 for (_iterator.s(); !(_step = _iterator.n()).done;) { 8417 _loop(); 8418 } 8419 } catch (err) { 8420 _iterator.e(err); 8421 } finally { 8422 _iterator.f(); 8423 } 8424 function parse(raw, type) { 8425 switch (type) { 8426 case "string": 8427 return raw; 8428 case "boolean": 8429 { 8430 return asBooleanOrNull(raw); 8431 } 8432 case "number": 8433 { 8434 return toNumberOrNull(raw); 8435 } 8436 case "json": 8437 { 8438 try { 8439 return JSON.parse(raw); 8440 } catch (_unused2) { 8441 return null; 8442 } 8443 } 8444 } 8445 } 8446 function serialize(value, type) { 8447 switch (type) { 8448 case "string": 8449 return typeof value === "string" ? value : null; 8450 case "boolean": 8451 return typeof value === "boolean" ? asTrueOrFalseString(value) : null; 8452 case "number": 8453 return typeof value === "number" && Number.isFinite(value) ? String(value) : null; 8454 case "json": 8455 { 8456 try { 8457 return JSON.stringify(value); 8458 } catch (_unused3) { 8459 return null; 8460 } 8461 } 8462 } 8463 } 8464 } 8465 function removeCurrentUrlQueryParams() { 8466 for (var _len = arguments.length, queryParamKeys = new Array(_len), _key = 0; _key < _len; _key++) { 8467 queryParamKeys[_key] = arguments[_key]; 8468 } 8469 return removeUrlQueryParams(window.location.href, ...queryParamKeys); 8470 } 8471 function removeUrlQueryParams(url) { 8472 for (var _len2 = arguments.length, queryParamKeys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 8473 queryParamKeys[_key2 - 1] = arguments[_key2]; 8474 } 8475 if (!queryParamKeys || !queryParamKeys.length) { 8476 return []; 8477 } 8478 if (typeof url === "string") { 8479 url = new URL(url); 8480 } 8481 var queryParams = url.searchParams; 8482 var removedQueryParams = []; 8483 for (var i = 0; i < queryParamKeys.length; i++) { 8484 var queryParamKey = queryParamKeys[i]; 8485 removedQueryParams.push(queryParams.get(queryParamKey)); 8486 queryParams.delete(queryParamKey); 8487 } 8488 window.history.replaceState(null, "", url); 8489 return removedQueryParams; 8490 } 8491 8492 var url = /*#__PURE__*/Object.freeze({ 8493 __proto__: null, 8494 isUrl: isUrl, 8495 makeUrlRedirectSafe: makeUrlRedirectSafe, 8496 removeCurrentUrlQueryParams: removeCurrentUrlQueryParams, 8497 removeUrlQueryParams: removeUrlQueryParams, 8498 syncRefsWithQueryParams: syncRefsWithQueryParams 8499 }); 8500 exports('url', url); 8501 8502 var definedRules = {}; 8503 var rulesPropType = { 8504 type: [Array, Object, String], 8505 default: "" 8506 }; 8507 function parseRule(rule) { 8508 var name = ""; 8509 var params = []; 8510 var colonIndex = rule.indexOf(":"); 8511 if (colonIndex === -1) { 8512 name = rule; 8513 } else { 8514 name = rule.substring(0, colonIndex); 8515 params = rule.substring(colonIndex + 1).split(","); 8516 } 8517 return { 8518 name, 8519 params 8520 }; 8521 } 8522 function normalizeRules(rules) { 8523 if (typeof rules === "string") { 8524 if (rules.indexOf("|") !== -1) { 8525 return rules.split("|").filter(r => r.trim() !== ""); 8526 } else if (rules.trim() !== "") { 8527 return [rules.trim()]; 8528 } 8529 } else if (Array.isArray(rules)) { 8530 var normalizedRules = []; 8531 var _iterator = _createForOfIteratorHelper(rules), 8532 _step; 8533 try { 8534 for (_iterator.s();
8534 !(_step = _iterator.n()).done;) { 8535 var r = _step.value; 8536 normalizedRules.push(...normalizeRules(r)); 8537 } 8538 } catch (err) { 8539 _iterator.e(err); 8540 } finally { 8541 _iterator.f(); 8542 } 8543 return normalizedRules; 8544 } else if (typeof rules === "function") { 8545 return [rules]; 8546 } else if (typeof rules === "object") { 8547 return [rules]; 8548 } 8549 return []; 8550 } 8551 function containsRequiredRule(rules) { 8552 return normalizeRules(rules).some(r => r === "required"); 8553 } 8554 function normalizeRulesToFunctions(rules) { 8555 var ruleFunctions = []; 8556 var _iterator2 = _createForOfIteratorHelper(rules), 8557 _step2; 8558 try { 8559 var _loop = function _loop() { 8560 var rule = _step2.value; 8561 if (typeof rule === "string") { 8562 var ruleRef = parseRule(rule); 8563 var fn = definedRules[ruleRef.name]; 8564 if (fn) { 8565 ruleFunctions.push(value => fn(value, ruleRef.params)); 8566 } else { 8567 console.warn("Attempt to validate with unknown rule ".concat(rule, ".")); 8568 } 8569 } else if (typeof rule === "function") { 8570 ruleFunctions.push(rule); 8571 } else if (typeof rule === "object") { 8572 var _fn = definedRules[rule.name]; 8573 if (_fn) { 8574 ruleFunctions.push(value => _fn(value, rule.params)); 8575 } else { 8576 console.warn("Attempt to validate with unknown rule ".concat(rule.name, ".")); 8577 } 8578 } 8579 }; 8580 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { 8581 _loop(); 8582 } 8583 } catch (err) { 8584 _iterator2.e(err); 8585 } finally { 8586 _iterator2.f(); 8587 } 8588 return ruleFunctions; 8589 } 8590 function normalizeRuleResult(result) { 8591 if (typeof result === "string") { 8592 return result; 8593 } else if (result === true) { 8594 return ""; 8595 } else { 8596 return "failed validation"; 8597 } 8598 } 8599 function validateValue(value, rule) { 8600 var fns = normalizeRulesToFunctions(normalizeRules(rule)); 8601 var results = []; 8602 var _iterator3 = _createForOfIteratorHelper(fns), 8603 _step3; 8604 try { 8605 for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { 8606 var fn = _step3.value; 8607 var result = normalizeRuleResult(fn(value)); 8608 if (result !== "") { 8609 results.push(result); 8610 } 8611 } 8612 } catch (err) { 8613 _iterator3.e(err); 8614 } finally { 8615 _iterator3.f(); 8616 } 8617 return results; 8618 } 8619 function defineRule(ruleName, validator) { 8620 if (definedRules[ruleName] !== undefined) { 8621 console.warn("Attempt to redefine validation rule ".concat(ruleName, ".")); 8622 } else { 8623 definedRules[ruleName] = validator; 8624 } 8625 } 8626 8627 var validationRules = /*#__PURE__*/Object.freeze({ 8628 __proto__: null, 8629 containsRequiredRule: containsRequiredRule, 8630 defineRule: defineRule, 8631 normalizeRules: normalizeRules, 8632 parseRule: parseRule, 8633 rulesPropType: rulesPropType, 8634 validateValue: validateValue 8635 }); 8636 exports('validationRules', validationRules); 8637 8638 }) 8639 }; 8640})); 8641//# sourceMappingURL=Utility.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.