1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BsG9zt8z.js","./BMByWOq8.js","./library-components.DFcZPf1c.css","./C2-mFwZ8.js","./D9ED_f8e.js","./page404.6l-MFU76.css","./BbHDu0-Q.js","./site404.BEPZXLRO.css","./Mj0r7m1r.js","./default.B2tVsVMG.css","./DpYcaEt3.js","./error-404.CkhVpEVu.css","./DxH-eEmY.js","./error-500.CwWdQP5R.css"])))=>i.map(i=>d[i]); 2var __defProp = Object.defineProperty; 3var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 4var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); 5import { w as withBase, a as withQuery, b as baseURL, d as defineNuxtPlugin, c as createError, s as shallowRef, r as ref, e as shallowReactive, f as reactive, g as definePayloadReviver, h as executeAsync, i as getNuxtClientPayload, j as destr$1, k as hashTag, l as isMetaArrayDupeKey, H as HasElementTags, n as normalizeProps, m as dedupeKey, o as createUnhead, v as vueInstall, D as DeprecationsPlugin, P as PromisesPlugin, T as TemplateParamsPlugin, A as AliasSortingPlugin, p as h, K as KeepAlive, _ as __vitePreload, q as defineNuxtRouteMiddleware, u as useNuxtApp, t as useRouter, x as showError, y as getRouteRules, z as hasProtocol, B as useRuntimeConfig, C as hashMode, E as routerOptions, F as createWebHashHistory, G as createWebHistory, I as createRouter, J as useError, L as clearError, M as isReadonly, N as createError$1, O as isNuxtError, S as START_LOCATION_NORMALIZED, Q as withoutBase, R as isSamePath, U as toValue, V as hasProtocol$1, W as withHttps, X as useState, Y as loadPayload, Z as onNuxtReady, $ as getAppManifest, a0 as outdatedBuildInterval, a1 as buildAssetsURL, a2 as joinURL, a3 as reloadNuxtApp, a4 as LazyCoreBlockCalendly, a5 as LazyCoreBlockContactCard, a6 as LazyCoreBlockDisclosures, a7 as LazyCoreBlockForm, a8 as LazyCoreBlockFooter, a9 as LazyCoreBlockFooterBackground, aa as LazyCoreBlockFooterBanner, ab as LazyCoreBlockFooterDisclosures, ac as LazyCoreBlockFooterLogo, ad as LazyCoreBlockFooterOneTrust, ae as LazyCoreBlockFooterSocialLinks, af as LazyCoreBlockFooterContact, ag as LazyCoreBlockFooterContactAddress, ah as LazyCoreBlockFooterContactEmail, ai as LazyCoreBlockFooterContactGroup, aj as LazyCoreBlockFooterContactPhone, ak as LazyCoreAnchorLinkNavigation, al as LazyCoreBlock, am as LazyCoreBlockAccessibleTooltip, an as LazyCoreBlockAddressAutocomplete, ao as LazyCoreBlockArticleCard, ap as LazyCoreBlockArticles, aq as LazyCoreBlockBreadcrumbs, ar as LazyCoreBlockButton, as as LazyCoreBlockCalculators, at as LazyCoreBlockCalendlyEmbed, au as LazyCoreBlockCarousel, av as LazyCoreBlockCenteredNavBar, aw as LazyCoreBlockColumns, ax as LazyCoreBlockContactHero, ay as LazyCoreBlockContentCard, az as LazyCoreBlockContentCardTextField, aA as LazyCoreBlockDialog, aB as LazyCoreBlockDivider, aC as LazyCoreBlockDynamicForm, aD as LazyCoreBlockFile, aE as LazyCoreBlockFrameEmbed, aF as LazyCoreBlockGrid, aG as LazyCoreBlockHero, aH as LazyCoreBlockHeroBackground, aI as LazyCoreBlockHeroComponent, aJ as LazyCoreBlockHtml, aK as LazyCoreBlockIcon, aL as LazyCoreBlockImage, aM as LazyCoreBlockImageCropped, aN as LazyCoreBlockLazy, aO as LazyCoreBlockMainNav, aP as LazyCoreBlockMainNavImage, aQ as LazyCoreBlockMap, aR as LazyCoreBlockMedia, aS as LazyCoreBlockNavItem, aT as LazyCoreBlockOEmbed, aU as LazyCoreBlockPencilBanner, aV as LazyCoreBlockRepeat, aW as LazyCoreBlockRichText, aX as LazyCoreBlockRows, aY as LazyCoreBlockSelect, aZ as LazyCoreBlockSocialLinks, a_ as LazyCoreBlockStickyButton, a$ as LazyCoreBlockText, b0 as LazyCoreBlockUnknown, b1 as LazyCoreBlockVerticalDivider, b2 as LazyCoreBlockVideo, b3 as LazyCoreBlockContainer, b4 as LazyCoreBlockContainerAccordion, b5 as LazyCoreBlockContainerTabs, b6 as LazyCoreBlockContainerToggle, b7 as LazyCoreIcon, b8 as LazyCoreIconAccordion, b9 as LazyCoreIconAccount, ba as LazyCoreIconActions, bb as LazyCoreIconActivity, bc as LazyCoreIconAddFolder, bd as LazyCoreIconAddPage, be as LazyCoreIconAdvancedSearch, bf as LazyCoreIconAlignCenter, bg as LazyCoreIconAlignLeft, bh as LazyCoreIconAlignRight, bi as LazyCoreIconAlignVerticalBottom, bj as LazyCoreIconAlignVerticalCenter, bk as LazyCoreIconAlignVerticalTop, bl as LazyCoreIconAnalytics, bm as LazyCoreIconAnchorLink, bn as LazyCoreIconArchive, bo as LazyCoreIconArrowDown, bp as LazyCoreIconArrowLeft, bq as LazyCoreIconArrowLeftCircle, br as LazyCoreIconArrowRight, bs as LazyCoreIconArrowUp, bt as LazyCoreIconArticle, bu as LazyCoreIconBars, bv as LazyCoreIconBell, bw as LazyCoreIconBilling, bx as LazyCoreIconBlock, by as
5LazyCoreIconBottomBanner, bz as LazyCoreIconBreadcrumbExpand, bA as LazyCoreIconBrush, bB as LazyCoreIconButton, bC as LazyCoreIconCalendar, bD as LazyCoreIconCalendly, bE as LazyCoreIconCalendlyTitle, bF as LazyCoreIconCamera, bG as LazyCoreIconCardAccount, bH as LazyCoreIconCarousel, bI as LazyCoreIconCarouselBackward, bJ as LazyCoreIconCarouselForward, bK as LazyCoreIconCategories, bL as LazyCoreIconChanges, bM as LazyCoreIconCheckmark, bN as LazyCoreIconChevronDown, bO as LazyCoreIconChevronLeft, bP as LazyCoreIconChevronRight, bQ as LazyCoreIconChevronUp, bR as LazyCoreIconCircleCheck, bS as LazyCoreIconCircleCheckLight, bT as LazyCoreIconCircleMinus, bU as LazyCoreIconCircleMinusFilled, bV as LazyCoreIconCirclePlus, bW as LazyCoreIconCirclePlusFilled, bX as LazyCoreIconClock, bY as LazyCoreIconClockFilled, bZ as LazyCoreIconClose, b_ as LazyCoreIconCloseCircle, b$ as LazyCoreIconCloseCircleFilled, c0 as LazyCoreIconCompliance, c1 as LazyCoreIconComputer, c2 as LazyCoreIconConnected, c3 as LazyCoreIconConnectedOutline, c4 as LazyCoreIconContact, c5 as LazyCoreIconContactEmail, c6 as LazyCoreIconContactFax, c7 as LazyCoreIconContactPage, c8 as LazyCoreIconContactPhone, c9 as LazyCoreIconContactSmartphone, ca as LazyCoreIconContainersIcon, cb as LazyCoreIconContentLibrary, cc as LazyCoreIconContentLibraryMedia, cd as LazyCoreIconCopy, ce as LazyCoreIconCopyright, cf as LazyCoreIconCornerDownRight, cg as LazyCoreIconCreditCard, ch as LazyCoreIconCrop, ci as LazyCoreIconDefault, cj as LazyCoreIconDesign, ck as LazyCoreIconDevices, cl as LazyCoreIconDiagonalRightArrow, cm as LazyCoreIconDisclosures, cn as LazyCoreIconDivider, co as LazyCoreIconDomains, cp as LazyCoreIconDotsHorizontal, cq as LazyCoreIconDotsVertical, cr as LazyCoreIconDownArrow, cs as LazyCoreIconDownload, ct as LazyCoreIconDraftDetails, cu as LazyCoreIconDrafts, cv as LazyCoreIconDuplicate, cw as LazyCoreIconEdit, cx as LazyCoreIconEditCircle, cy as LazyCoreIconEllipsisOutlined, cz as LazyCoreIconEmail, cA as LazyCoreIconEmoji, cB as LazyCoreIconError, cC as LazyCoreIconErrorFilled, cD as LazyCoreIconExternalLink, cE as LazyCoreIconFacebook, cF as LazyCoreIconFavoriteFilled, cG as LazyCoreIconFavoriteUnfilled, cH as LazyCoreIconFax, cI as LazyCoreIconFile, cJ as LazyCoreIconFilter, cK as LazyCoreIconFilterOutline, cL as LazyCoreIconFocalPoint, cM as LazyCoreIconFolder, cN as LazyCoreIconFooter, cO as LazyCoreIconForm, cP as LazyCoreIconFormIcon, cQ as LazyCoreIconGlobe, cR as LazyCoreIconGradient, cS as LazyCoreIconGradientSquare, cT as LazyCoreIconGrid, cU as LazyCoreIconGridOn, cV as LazyCoreIconHamburgerMenu, cW as LazyCoreIconHeader, cX as LazyCoreIconHome, cY as LazyCoreIconIcon71, cZ as LazyCoreIconIcons, c_ as LazyCoreIconImage, c$ as LazyCoreIconImageOffset, d0 as LazyCoreIconInReview, d1 as LazyCoreIconInfo, d2 as LazyCoreIconInsertDriveFile, d3 as LazyCoreIconInsertLink, d4 as LazyCoreIconInstagram, d5 as LazyCoreIconLandingLogo, d6 as LazyCoreIconLayout, d7 as LazyCoreIconLeftArrow, d8 as LazyCoreIconLinkedin, d9 as LazyCoreIconList, da as LazyCoreIconListView, db as LazyCoreIconLock, dc as LazyCoreIconLogo, dd as LazyCoreIconMap, de as LazyCoreIconMapPin, df as LazyCoreIconMaximize, dg as LazyCoreIconMedia, dh as LazyCoreIconMenuClose, di as LazyCoreIconMessageCircle, dj as LazyCoreIconMinimize, dk as LazyCoreIconMinus, dl as LazyCoreIconMobilePhone, dm as LazyCoreIconModal, dn as LazyCoreIconMonitor, dp as LazyCoreIconMovieStrip, dq as LazyCoreIconNews, dr as LazyCoreIconNotes, ds as LazyCoreIconNotificationAlert, dt as LazyCoreIconNotifications, du as LazyCoreIconOneTrust, dv as LazyCoreIconOpenInFull, dw as LazyCoreIconPaddingAll, dx as LazyCoreIconPaddingBottom, dy as LazyCoreIconPaddingHorizontal, dz as LazyCoreIconPaddingLeft, dA as LazyCoreIconPaddingRight, dB as LazyCoreIconPaddingTop, dC as LazyCoreIconPage, dD as LazyCoreIconPages, dE as LazyCoreIconPaintersPalette, dF as LazyCoreIconPause, dG as LazyCoreIconPauseCircle, dH as LazyCoreIconPdf, dI as LazyCoreIconPhone, dJ as LazyCoreIconPhotoLibrary, dK as LazyCoreIconPlay, dL as LazyCoreIconPlayCircle, dM as LazyCoreIconPlayCircleButton, dN as LazyCoreIconPlus, dO as LazyCoreIconQuestionMark, dP as LazyCoreIconReaderMode, dQ as
5LazyCoreIconRedo, dR as LazyCoreIconReorder, dS as LazyCoreIconReplace, dT as LazyCoreIconReplay, dU as LazyCoreIconRevert, dV as LazyCoreIconRightArrow, dW as LazyCoreIconRoundedSquare, dX as LazyCoreIconSearch, dY as LazyCoreIconSection, dZ as LazyCoreIconSelectAll, d_ as LazyCoreIconSeo, d$ as LazyCoreIconSettings, e0 as LazyCoreIconShield, e1 as LazyCoreIconShoppingBag, e2 as LazyCoreIconShoppingCart, e3 as LazyCoreIconSiteRedo, e4 as LazyCoreIconSiteStyles, e5 as LazyCoreIconSiteUndo, e6 as LazyCoreIconSizing, e7 as LazyCoreIconSocial, e8 as LazyCoreIconSquareEdit, e9 as LazyCoreIconStore, ea as LazyCoreIconTablet, eb as LazyCoreIconTabs, ec as LazyCoreIconTemplate, ed as LazyCoreIconTextStyle, ee as LazyCoreIconTheme, ef as LazyCoreIconTool, eg as LazyCoreIconTrash, eh as LazyCoreIconTwitter, ei as LazyCoreIconUndo, ej as LazyCoreIconUnlock, ek as LazyCoreIconUpdate, el as LazyCoreIconUpload, em as LazyCoreIconUser, en as LazyCoreIconUserCheck, eo as LazyCoreIconVideo, ep as LazyCoreIconVideoPlay, eq as LazyCoreIconViewDesktop, er as LazyCoreIconViewDesktopSettings, es as LazyCoreIconViewLiveSite, et as LazyCoreIconVisibilityOff, eu as LazyCoreIconVisibilityOn, ev as LazyCoreIconVolumeOff, ew as LazyCoreIconVolumeOn, ex as LazyCoreIconVolumeUp, ey as LazyCoreIconWatchLater, ez as LazyCoreIconYoutube, eA as defineAsyncComponent, eB as toRaw, eC as nextTick, eD as BRAND_FEATURE_FLAGS, eE as createStore, eF as axios, eG as mustache, eH as NOOP, eI as extend, eJ as isString$1, eK as NO, eL as isSymbol, eM as isBuiltInDirective, eN as capitalize, eO as camelize, eP as EMPTY_OBJ, eQ as isObject$1, eR as toHandlerKey, eS as isArray$1, eT as isOn, eU as isReservedProp, eV as isHTMLTag, eW as isSVGTag, eX as isMathMLTag, eY as isVoidTag, eZ as parseStringStyle, e_ as makeMap, e$ as generateCodeFrame, f0 as runtimeDom_esmBundler, f1 as shared_esmBundler, f2 as defineComponent, f3 as provide, f4 as PageRouteSymbol, f5 as inject, f6 as watch, f7 as onBeforeUnmount, f8 as appPageTransition, f9 as appKeepalive, fa as _wrapInTransition, fb as Suspense, fc as RouterView, fd as defu, fe as Fragment, ff as LayoutMetaSymbol, fg as useRoute, fh as useRoute$1, fi as computed, fj as unref, fk as appLayoutTransition, fl as mergeProps, fm as _export_sfc, fn as createBlock, fo as openBlock, fp as withCtx, fq as createVNode, fr as normalizeProps$1, fs as guardReactiveProps, ft as onErrorCaptured, fu as createElementBlock, fv as resolveDynamicComponent, fw as createSSRApp, fx as createApp, fy as createNuxtApp, fz as applyPlugins, fA as vueAppRootContainer } from "./BMByWOq8.js"; 6(function polyfill() { 7 const relList = document.createElement("link").relList; 8 if (relList && relList.supports && relList.supports("modulepreload")) { 9 return; 10 } 11 for (const link of document.querySelectorAll('link[rel="modulepreload"]')) { 12 processPreload(link); 13 } 14 new MutationObserver((mutations2) => { 15 for (const mutation of mutations2) { 16 if (mutation.type !== "childList") { 17 continue; 18 } 19 for (const node of mutation.addedNodes) { 20 if (node.tagName === "LINK" && node.rel === "modulepreload") 21 processPreload(node); 22 } 23 } 24 }).observe(document, { childList: true, subtree: true }); 25 function getFetchOpts(link) { 26 const fetchOpts = {}; 27 if (link.integrity) fetchOpts.integrity = link.integrity; 28 if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; 29 if (link.crossOrigin === "use-credentials") 30 fetchOpts.credentials = "include"; 31 else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; 32 else fetchOpts.credentials = "same-origin"; 33 return fetchOpts; 34 } 35 function processPreload(link) { 36 if (link.ep) 37 return; 38 link.ep = true; 39 const fetchOpts = getFetchOpts(link); 40 fetch(link.href, fetchOpts); 41 } 42})(); 43const suspectProtoRx = /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/; 44const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/; 45const JsonSigRx = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/; 46function jsonParseTransform(key, value) { 47 if (key === "__proto__" || key === "constructor" && value && typeof value === "object" && "prototype" in value) { 48 warnKeyDropped(key); 49 return; 50 } 51 return value; 52} 53function warnKeyDropped(key) { 54 console.warn(`[destr] Dropping "${key}" key to prevent prototype pollution.`); 55} 56function destr(value, options = {}) { 57 if (typeof value !== "string") { 58 return value; 59 } 60 const _value = value.trim(); 61 if (
62 // eslint-disable-next-line unicorn/prefer-at 63 value[0] === '"' && value.endsWith('"') && !value.includes("\\") 64 ) { 65 return _value.slice(1, -1); 66 } 67 if (_value.length <= 9) { 68 const _lval = _value.toLowerCase(); 69 if (_lval === "true") { 70 return true; 71 } 72 if (_lval === "false") { 73 return false; 74 } 75 if (_lval === "undefined") { 76 return void 0; 77 } 78 if (_lval === "null") { 79 return null; 80 } 81 if (_lval === "nan") { 82 return Number.NaN; 83 } 84 if (_lval === "infinity") { 85 return Number.POSITIVE_INFINITY; 86 } 87 if (_lval === "-infinity") { 88 return Number.NEGATIVE_INFINITY; 89 } 90 } 91 if (!JsonSigRx.test(value)) { 92 if (options.strict) { 93 throw new SyntaxError("[destr] Invalid JSON"); 94 } 95 return value; 96 } 97 try { 98 if (suspectProtoRx.test(value) || suspectConstructorRx.test(value)) { 99 if (options.strict) { 100 throw new Error("[destr] Possible prototype pollution"); 101 } 102 return JSON.parse(value, jsonParseTransform); 103 } 104 return JSON.parse(value); 105 } catch (error) { 106 if (options.strict) { 107 throw error; 108 } 109 return value; 110 } 111} 112class FetchError extends Error { 113 constructor(message, opts) { 114 super(message, opts); 115 this.name = "FetchError"; 116 if ((opts == null ? void 0 : opts.cause) && !this.cause) { 117 this.cause = opts.cause; 118 } 119 } 120} 121function createFetchError(ctx) { 122 var _a2, _b2, _c2, _d2, _e; 123 const errorMessage = ((_a2 = ctx.error) == null ? void 0 : _a2.message) || ((_b2 = ctx.error) == null ? void 0 : _b2.toString()) || ""; 124 const method = ((_c2 = ctx.request) == null ? void 0 : _c2.method) || ((_d2 = ctx.options) == null ? void 0 : _d2.method) || "GET"; 125 const url = ((_e = ctx.request) == null ? void 0 : _e.url) || String(ctx.request) || "/"; 126 const requestStr = `[${method}] ${JSON.stringify(url)}`; 127 const statusStr = ctx.response ? `${ctx.response.status} ${ctx.response.statusText}` : "<no response>"; 128 const message = `${requestStr}: ${statusStr}${errorMessage ? ` ${errorMessage}` : ""}`; 129 const fetchError = new FetchError( 130 message, 131 ctx.error ? { cause: ctx.error } : void 0 132 ); 133 for (const key of ["request", "options", "response"]) { 134 Object.defineProperty(fetchError, key, { 135 get() { 136 return ctx[key]; 137 } 138 }); 139 } 140 for (const [key, refKey] of [ 141 ["data", "_data"], 142 ["status", "status"], 143 ["statusCode", "status"], 144 ["statusText", "statusText"], 145 ["statusMessage", "statusText"] 146 ]) { 147 Object.defineProperty(fetchError, key, { 148 get() { 149 return ctx.response && ctx.response[refKey]; 150 } 151 }); 152 } 153 return fetchError; 154} 155const payloadMethods = new Set( 156 Object.freeze(["PATCH", "POST", "PUT", "DELETE"]) 157); 158function isPayloadMethod(method = "GET") { 159 return payloadMethods.has(method.toUpperCase()); 160} 161function isJSONSerializable(value) { 162 if (value === void 0) { 163 return false; 164 } 165 const t = typeof value; 166 if (t === "string" || t === "number" || t === "boolean" || t === null) { 167 return true; 168 } 169 if (t !== "object") { 170 return false; 171 } 172 if (Array.isArray(value)) { 173 return true; 174 } 175 if (value.buffer) { 176 return false; 177 } 178 return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function"; 179} 180const textTypes = /* @__PURE__ */ new Set([ 181 "image/svg", 182 "application/xml", 183 "application/xhtml", 184 "application/html" 185]); 186const JSON_RE = /^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i; 187function detectResponseType(_contentType = "") { 188 if (!_contentType) { 189 return "json"; 190 } 191 const contentType = _contentType.split(";").shift() || ""; 192 if (JSON_RE.test(contentType)) { 193 return "json"; 194 } 195 if (textTypes.has(contentType) || contentType.startsWith("text/")) { 196 return "text"; 197 } 198 return "blob"; 199} 200function resolveFetchOptions(request, input, defaults, Headers2) { 201 const headers = mergeHeaders( 202 (input == null ? void 0 : input.headers) ?? (request == null ? void 0 : request.headers), 203 defaults == null ? void 0 : defaults.headers, 204 Headers2 205 ); 206 let query;
207 if ((defaults == null ? void 0 : defaults.query) || (defaults == null ? void 0 : defaults.params) || (input == null ? void 0 : input.params) || (input == null ? void 0 : input.query)) { 208 query = { 209 ...defaults == null ? void 0 : defaults.params, 210 ...defaults == null ? void 0 : defaults.query, 211 ...input == null ? void 0 : input.params, 212 ...input == null ? void 0 : input.query 213 }; 214 } 215 return { 216 ...defaults, 217 ...input, 218 query, 219 params: query, 220 headers 221 }; 222} 223function mergeHeaders(input, defaults, Headers2) { 224 if (!defaults) { 225 return new Headers2(input); 226 } 227 const headers = new Headers2(defaults); 228 if (input) { 229 for (const [key, value] of Symbol.iterator in input || Array.isArray(input) ? input : new Headers2(input)) { 230 headers.set(key, value); 231 } 232 } 233 return headers; 234} 235async function callHooks(context, hooks) { 236 if (hooks) { 237 if (Array.isArray(hooks)) { 238 for (const hook of hooks) { 239 await hook(context); 240 } 241 } else { 242 await hooks(context); 243 } 244 } 245} 246const retryStatusCodes = /* @__PURE__ */ new Set([ 247 408, 248 // Request Timeout 249 409, 250 // Conflict 251 425, 252 // Too Early (Experimental) 253 429, 254 // Too Many Requests 255 500, 256 // Internal Server Error 257 502, 258 // Bad Gateway 259 503, 260 // Service Unavailable 261 504 262 // Gateway Timeout 263]); 264const nullBodyResponses = /* @__PURE__ */ new Set([101, 204, 205, 304]); 265function createFetch(globalOptions = {}) { 266 const { 267 fetch: fetch2 = globalThis.fetch, 268 Headers: Headers2 = globalThis.Headers, 269 AbortController: AbortController2 = globalThis.AbortController 270 } = globalOptions; 271 async function onError(context) { 272 const isAbort = context.error && context.error.name === "AbortError" && !context.options.timeout || false; 273 if (context.options.retry !== false && !isAbort) { 274 let retries; 275 if (typeof context.options.retry === "number") { 276 retries = context.options.retry; 277 } else { 278 retries = isPayloadMethod(context.options.method) ? 0 : 1; 279 } 280 const responseCode = context.response && context.response.status || 500; 281 if (retries > 0 && (Array.isArray(context.options.retryStatusCodes) ? context.options.retryStatusCodes.includes(responseCode) : retryStatusCodes.has(responseCode))) { 282 const retryDelay = typeof context.options.retryDelay === "function" ? context.options.retryDelay(context) : context.options.retryDelay || 0; 283 if (retryDelay > 0) { 284 await new Promise((resolve) => setTimeout(resolve, retryDelay)); 285 } 286 return $fetchRaw(context.request, { 287 ...context.options, 288 retry: retries - 1 289 }); 290 } 291 } 292 const error = createFetchError(context); 293 if (Error.captureStackTrace) { 294 Error.captureStackTrace(error, $fetchRaw); 295 } 296 throw error; 297 } 298 const $fetchRaw = async function $fetchRaw2(_request, _options = {}) { 299 const context = { 300 request: _request, 301 options: resolveFetchOptions( 302 _request, 303 _options, 304 globalOptions.defaults, 305 Headers2 306 ), 307 response: void 0, 308 error: void 0 309 }; 310 if (context.options.method) { 311 context.options.method = context.options.method.toUpperCase(); 312 } 313 if (context.options.onRequest) { 314 await callHooks(context, context.options.onRequest); 315 } 316 if (typeof context.request === "string") { 317 if (context.options.baseURL) { 318 context.request = withBase(context.request, context.options.baseURL); 319 } 320 if (context.options.query) { 321 context.request = withQuery(context.request, context.options.query); 322 delete context.options.query; 323 } 324 if ("query" in context.options) { 325 delete context.options.query; 326 } 327 if ("params" in context.options) { 328 delete context.options.params; 329 } 330 } 331 if (context.options.body && isPayloadMethod(context.options.method)) { 332 if (isJSONSerializable(context.options.body)) { 333 context.options.body = typeof context.options.body === "string" ? context.options.body : JSON.stringify(context.options.body); 334 context.options.headers = new Headers2(context.options.headers || {}); 335 if (!context.options.headers.has("content-type")) { 336 context.options.headers.set("content-type", "application/json"); 337 } 338 if (!context.options.headers.has("accept")) { 339 context.options.headers.set("accept", "application/json"); 340 } 341 } else if ( 342 // ReadableStream Body 343 "pipeTo" in context.options.body && typeof context.options.body.pipeTo === "function" || // Node.js Stream Body 344 typeof context.options.body.pipe === "function" 345 ) { 346 if (!("duplex" in context.options)) { 347 context.options.duplex = "half"; 348 } 349 } 350 } 351 let abortTimeout; 352 if (!context.options.signal && context.options.timeout) { 353 const controller = new AbortController2(); 354 abortTimeout = setTimeout(() => { 355 const error = new Error( 356 "[TimeoutError]: The operation was aborted due to timeout" 357 );
358 error.name = "TimeoutError"; 359 error.code = 23; 360 controller.abort(error); 361 }, context.options.timeout); 362 context.options.signal = controller.signal; 363 } 364 try { 365 context.response = await fetch2( 366 context.request, 367 context.options 368 ); 369 } catch (error) { 370 context.error = error; 371 if (context.options.onRequestError) { 372 await callHooks( 373 context, 374 context.options.onRequestError 375 ); 376 } 377 return await onError(context); 378 } finally { 379 if (abortTimeout) { 380 clearTimeout(abortTimeout); 381 } 382 } 383 const hasBody = (context.response.body || // https://github.com/unjs/ofetch/issues/324 384 // https://github.com/unjs/ofetch/issues/294 385 // https://github.com/JakeChampion/fetch/issues/1454 386 context.response._bodyInit) && !nullBodyResponses.has(context.response.status) && context.options.method !== "HEAD"; 387 if (hasBody) { 388 const responseType = (context.options.parseResponse ? "json" : context.options.responseType) || detectResponseType(context.response.headers.get("content-type") || ""); 389 switch (responseType) { 390 case "json": { 391 const data = await context.response.text(); 392 const parseFunction = context.options.parseResponse || destr; 393 context.response._data = parseFunction(data); 394 break; 395 } 396 case "stream": { 397 context.response._data = context.response.body || context.response._bodyInit; 398 break; 399 } 400 default: { 401 context.response._data = await context.response[responseType](); 402 } 403 } 404 } 405 if (context.options.onResponse) { 406 await callHooks( 407 context, 408 context.options.onResponse 409 ); 410 } 411 if (!context.options.ignoreResponseError && context.response.status >= 400 && context.response.status < 600) { 412 if (context.options.onResponseError) { 413 await callHooks( 414 context, 415 context.options.onResponseError 416 ); 417 } 418 return await onError(context); 419 } 420 return context.response; 421 }; 422 const $fetch2 = async function $fetch22(request, options) { 423 const r = await $fetchRaw(request, options); 424 return r._data; 425 }; 426 $fetch2.raw = $fetchRaw; 427 $fetch2.native = (...args) => fetch2(...args); 428 $fetch2.create = (defaultOptions = {}, customGlobalOptions = {}) => createFetch({ 429 ...globalOptions, 430 ...customGlobalOptions, 431 defaults: { 432 ...globalOptions.defaults, 433 ...customGlobalOptions.defaults, 434 ...defaultOptions 435 } 436 }); 437 return $fetch2; 438} 439const _globalThis = function() { 440 if (typeof globalThis !== "undefined") { 441 return globalThis; 442 } 443 if (typeof self !== "undefined") { 444 return self; 445 } 446 if (typeof window !== "undefined") { 447 return window; 448 } 449 if (typeof global !== "undefined") { 450 return global; 451 } 452 throw new Error("unable to locate global object"); 453}(); 454const fetch$1 = _globalThis.fetch ? (...args) => _globalThis.fetch(...args) : () => Promise.reject(new Error("[ofetch] global.fetch is not supported!")); 455const Headers$1 = _globalThis.Headers; 456const AbortController = _globalThis.AbortController; 457const ofetch = createFetch({ fetch: fetch$1, Headers: Headers$1, AbortController }); 458const $fetch$1 = ofetch; 459if (!globalThis.$fetch) { 460 globalThis.$fetch = $fetch$1.create({ 461 baseURL: baseURL() 462 }); 463} 464const revivers = [ 465 ["NuxtError", (data) => createError(data)], 466 ["EmptyShallowRef", (data) => shallowRef(data === "_" ? void 0 : data === "0n" ? BigInt(0) : destr$1(data))], 467 ["EmptyRef", (data) => ref(data === "_" ? void 0 : data === "0n" ? BigInt(0) : destr$1(data))], 468 ["ShallowRef", (data) => shallowRef(data)], 469 ["ShallowReactive", (data) => shallowReactive(data)], 470 ["Ref", (data) => ref(data)], 471 ["Reactive", (data) => reactive(data)] 472]; 473const revive_payload_client_kG4vF4SWGlhgLJRKrmco1O_zuG41odAu7e9PNPCDOtY = defineNuxtPlugin({ 474 name: "nuxt:revive-payload:client", 475 order: -30, 476 async setup(nuxtApp) { 477 let __temp, __restore; 478 for (const [reviver, fn] of revivers) { 479 definePayloadReviver(reviver, fn); 480 } 481 Object.assign(nuxtApp.payload, ([__temp, __restore] = executeAsync(() => nuxtApp.runWithContext(getNuxtClientPayload)), __temp = await __temp, __restore(
481), __temp)); 482 window.__NUXT__ = nuxtApp.payload; 483 } 484}); 485async function renderDOMHead(head, options = {}) { 486 const dom = options.document || head.resolvedOptions.document; 487 if (!dom || !head.dirty) 488 return; 489 const beforeRenderCtx = { shouldRender: true, tags: [] }; 490 await head.hooks.callHook("dom:beforeRender", beforeRenderCtx); 491 if (!beforeRenderCtx.shouldRender) 492 return; 493 if (head._domUpdatePromise) { 494 return head._domUpdatePromise; 495 } 496 head._domUpdatePromise = new Promise(async (resolve) => { 497 var _a2; 498 const dupeKeyCounter = /* @__PURE__ */ new Map(); 499 const resolveTagPromise = new Promise((resolve2) => { 500 head.resolveTags().then((tags2) => { 501 resolve2( 502 tags2.map((tag) => { 503 const count = dupeKeyCounter.get(tag._d) || 0; 504 const res = { 505 tag, 506 id: (count ? `${tag._d}:${count}` : tag._d) || hashTag(tag), 507 shouldRender: true 508 }; 509 if (tag._d && isMetaArrayDupeKey(tag._d)) { 510 dupeKeyCounter.set(tag._d, count + 1); 511 } 512 return res; 513 }) 514 ); 515 }); 516 }); 517 let state2 = head._dom; 518 if (!state2) { 519 state2 = { 520 title: dom.title, 521 elMap: (/* @__PURE__ */ new Map()).set("htmlAttrs", dom.documentElement).set("bodyAttrs", dom.body) 522 }; 523 for (const key of ["body", "head"]) { 524 const children = (_a2 = dom[key]) == null ? void 0 : _a2.children; 525 for (const c2 of children) { 526 const tag = c2.tagName.toLowerCase(); 527 if (!HasElementTags.has(tag)) { 528 continue; 529 } 530 const next = normalizeProps({ tag, props: {} }, { 531 innerHTML: c2.innerHTML, 532 ...c2.getAttributeNames().reduce((props, name) => { 533 props[name] = c2.getAttribute(name); 534 return props; 535 }, {}) || {} 536 }); 537 next.key = c2.getAttribute("data-hid") || void 0; 538 next._d = dedupeKey(next) || hashTag(next); 539 if (state2.elMap.has(next._d)) { 540 let count = 1; 541 let k = next._d; 542 while (state2.elMap.has(k)) { 543 k = `${next._d}:${count++}`; 544 } 545 state2.elMap.set(k, c2); 546 } else { 547 state2.elMap.set(next._d, c2); 548 } 549 } 550 } 551 } 552 state2.pendingSideEffects = { ...state2.sideEffects }; 553 state2.sideEffects = {}; 554 function track(id, scope, fn) { 555 const k = `${id}:${scope}`; 556 state2.sideEffects[k] = fn; 557 delete state2.pendingSideEffects[k]; 558 } 559 function trackCtx({ id, $el, tag }) { 560 const isAttrTag = tag.tag.endsWith("Attrs"); 561 state2.elMap.set(id, $el); 562 if (!isAttrTag) { 563 if (tag.textContent && tag.textContent !== $el.textContent) { 564 $el.textContent = tag.textContent; 565 } 566 if (tag.innerHTML && tag.innerHTML !== $el.innerHTML) { 567 $el.innerHTML = tag.innerHTML; 568 } 569 track(id, "el", () => { 570 $el == null ? void 0 : $el.remove(); 571 state2.elMap.delete(id); 572 }); 573 } 574 for (const k in tag.props) { 575 if (!Object.prototype.hasOwnProperty.call(tag.props, k)) 576 continue; 577 const value = tag.props[k]; 578 if (k.startsWith("on") && typeof value === "function") { 579 const dataset = $el == null ? void 0 : $el.dataset; 580 if (dataset && dataset[`${k}fired`]) { 581 const ek = k.slice(0, -5); 582 value.call($el, new Event(ek.substring(2))); 583 } 584 if ($el.getAttribute(`data-${k}`) !== "") { 585 (tag.tag === "bodyAttrs" ? dom.defaultView : $el).addEventListener( 586 // onload -> load 587 k.substring(2), 588 value.bind($el) 589 ); 590 $el.setAttribute(`data-${k}`, ""); 591 } 592 continue; 593 } 594 const ck = `attr:${k}`; 595 if (k === "class") { 596 if (!value) { 597 continue; 598 } 599 for (const c2 of value) { 600 isAttrTag && track(id, `${ck}:${c2}`, () => $el.classList.remove(c2)); 601 !$el.classList.contains(c2) && $el.classList.add(c2); 602 } 603 } else if (k === "style") { 604 if (!value) { 605 continue; 606 } 607 for (const [k2, v] of value) { 608 track(id, `${ck}:${k2}`, () => { 609 $el.style.removeProperty(k2); 610 }); 611 $el.style.setProperty(k2, v); 612 } 613 } else if (value !== false && value !== null) { 614 $el.getAttribute(k) !== value && $el.setAttribute(k, value === true ? "" : String(value)); 615 isAttrTag && track(id, ck, () => $el.removeAttribute(k)); 616 } 617 } 618 } 619 const pending = []; 620 const frag = { 621 bodyClose: void 0, 622 bodyOpen: void 0, 623 head: void 0 624 }; 625 const tags = await resolveTagPromise; 626 for (const ctx of tags) { 627 const { tag, shouldRender, id } = ctx; 628 if (!shouldRender) 629 continue; 630 if (tag.tag === "title") { 631 dom.title = tag.textContent; 632 track("title", "", () => dom.title = state2.title); 633 continue; 634 } 635 ctx.$el = ctx.$el || state2.elMap.get(id); 636 if (ctx.$el) { 637 trackCtx(ctx); 638 } else if (HasElementTags.has(tag.tag)) { 639 pending.push(ctx); 640 } 641 } 642 for (const ctx of pending) { 643 const pos = ctx.tag.tagPosition || "head"; 644 ctx.$el = dom.createElement(ctx.tag.tag); 645 trackCtx(ctx); 646 frag[pos] = frag[pos] || dom.createDocumentFragment(); 647 frag[pos].appendChild(ctx.$el); 648 } 649 for (const ctx of tags) 650 await head.hooks.callHook("dom:renderTag", ctx, dom, track); 651 frag.head && dom.head.appendChild(frag.head); 652 frag.bodyOpen && dom.body.insertBefore(frag.bodyOpen, dom.body.firstChild); 653 frag.bodyClose && dom.body.appendChild(frag.bodyClose); 654 for (const k in state2.pendingSideEffects) { 655 state2.pendingSideEffects[k](); 656 } 657 head._dom = state2; 658 await head.hooks.callHook("dom:rendered", { renders: tags }); 659 resolve(); 660 }).finally(() => { 661 head._domUpdatePromise = void 0; 662 head.dirty = false;
663 }); 664 return head._domUpdatePromise; 665} 666function createHead$1(options = {}) { 667 var _a2, _b2, _c2; 668 const render = ((_a2 = options.domOptions) == null ? void 0 : _a2.render) || renderDOMHead; 669 options.document = options.document || (typeof window !== "undefined" ? document : void 0); 670 const initialPayload = ((_c2 = (_b2 = options.document) == null ? void 0 : _b2.head.querySelector('script[id="unhead:payload"]')) == null ? void 0 : _c2.innerHTML) || false; 671 return createUnhead({ 672 ...options, 673 plugins: [ 674 ...options.plugins || [], 675 { 676 key: "client", 677 hooks: { 678 "entries:updated": render 679 } 680 } 681 ], 682 init: [ 683 initialPayload ? JSON.parse(initialPayload) : false, 684 ...options.init || [] 685 ] 686 }); 687} 688function createDebouncedFn(callee, delayer) { 689 let ctxId = 0; 690 return () => { 691 const delayFnCtxId = ++ctxId; 692 delayer(() => { 693 if (ctxId === delayFnCtxId) { 694 callee(); 695 } 696 }); 697 }; 698} 699function createHead(options = {}) { 700 const head = createHead$1({ 701 domOptions: { 702 render: createDebouncedFn(() => renderDOMHead(head), (fn) => setTimeout(fn, 0)) 703 }, 704 ...options 705 }); 706 head.install = vueInstall(head); 707 return head; 708} 709const unheadOptions = { 710 disableDefaults: true, 711 disableCapoSorting: false, 712 plugins: [DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin] 713}; 714const unhead_k2P3m_ZDyjlr2mMYnoDPwavjsDN8hBlk9cFai0bbopU = defineNuxtPlugin({ 715 name: "nuxt:head", 716 enforce: "pre", 717 setup(nuxtApp) { 718 const head = createHead(unheadOptions); 719 nuxtApp.vueApp.use(head); 720 { 721 let pauseDOMUpdates = true; 722 const syncHead = async () => { 723 pauseDOMUpdates = false; 724 await renderDOMHead(head); 725 }; 726 head.hooks.hook("dom:beforeRender", (context) => { 727 context.shouldRender = !pauseDOMUpdates; 728 }); 729 nuxtApp.hooks.hook("page:start", () => { 730 pauseDOMUpdates = true; 731 }); 732 nuxtApp.hooks.hook("page:finish", () => { 733 if (!nuxtApp.isHydrating) { 734 syncHead(); 735 } 736 }); 737 nuxtApp.hooks.hook("app:error", syncHead); 738 nuxtApp.hooks.hook("app:suspense:resolve", syncHead); 739 } 740 } 741}); 742const ROUTE_KEY_PARENTHESES_RE = /(:\w+)\([^)]+\)/g; 743const ROUTE_KEY_SYMBOLS_RE = /(:\w+)[?+*]/g; 744const ROUTE_KEY_NORMAL_RE = /:\w+/g; 745const interpolatePath = (route, match) => { 746 return match.path.replace(ROUTE_KEY_PARENTHESES_RE, "$1").replace(ROUTE_KEY_SYMBOLS_RE, "$1").replace(ROUTE_KEY_NORMAL_RE, (r) => { 747 var _a2; 748 return ((_a2 = route.params[r.slice(1)]) == null ? void 0 : _a2.toString()) || ""; 749 }); 750}; 751const generateRouteKey = (routeProps, override) => { 752 const matchedRoute = routeProps.route.matched.find((m2) => { 753 var _a2; 754 return ((_a2 = m2.components) == null ? void 0 : _a2.default) === routeProps.Component.type; 755 }); 756 const source = override ?? (matchedRoute == null ? void 0 : matchedRoute.meta.key) ?? (matchedRoute && interpolatePath(routeProps.route, matchedRoute)); 757 return typeof source === "function" ? source(routeProps.route) : source; 758}; 759const wrapInKeepAlive = (props, children) => { 760 return { default: () => props ? h(KeepAlive, props === true ? {} : props, children) : children }; 761}; 762function toArray(value) { 763 return Array.isArray(value) ? value : [value]; 764} 765const __nuxt_page_meta = { 766 layout: false 767}; 768function handleHotUpdate(_router, _generateRoutes) { 769} 770const _routes = [ 771 { 772 name: "slug",
773 path: "/:slug(.*)*", 774 component: () => __vitePreload(() => import("./BsG9zt8z.js").then((n2) => n2.a), true ? __vite__mapDeps([0,1,2,3]) : void 0, import.meta.url) 775 }, 776 { 777 name: "errors-page404", 778 path: "/errors/page404", 779 component: () => __vitePreload(() => import("./D9ED_f8e.js"), true ? __vite__mapDeps([4,1,2,5]) : void 0, import.meta.url) 780 }, 781 { 782 name: "errors-site404", 783 path: "/errors/site404", 784 meta: __nuxt_page_meta || {}, 785 component: () => __vitePreload(() => import("./BbHDu0-Q.js"), true ? __vite__mapDeps([6,1,2,7]) : void 0, import.meta.url) 786 } 787]; 788const validate = defineNuxtRouteMiddleware(async (to) => { 789 var _a2; 790 let __temp, __restore; 791 if (!((_a2 = to.meta) == null ? void 0 : _a2.validate)) { 792 return; 793 } 794 const nuxtApp = useNuxtApp(); 795 const router = useRouter(); 796 const result = ([__temp, __restore] = executeAsync(() => Promise.resolve(to.meta.validate(to))), __temp = await __temp, __restore(), __temp); 797 if (result === true) { 798 return; 799 } 800 const error = createError({ 801 statusCode: result && result.statusCode || 404, 802 statusMessage: result && result.statusMessage || `Page Not Found: ${to.fullPath}`, 803 data: { 804 path: to.fullPath 805 } 806 }); 807 const unsub = router.beforeResolve((final) => { 808 unsub(); 809 if (final === to) { 810 const unsub2 = router.afterEach(async () => { 811 unsub2(); 812 await nuxtApp.runWithContext(() => showError(error)); 813 window == null ? void 0 : window.history.pushState({}, "", to.fullPath); 814 }); 815 return false; 816 } 817 }); 818}); 819const manifest_45route_45rule = defineNuxtRouteMiddleware(async (to) => { 820 let __temp, __restore; 821 const rules = ([__temp, __restore] = executeAsync(() => getRouteRules({ path: to.path })), __temp = await __temp, __restore(), __temp); 822 if (rules.redirect) { 823 if (hasProtocol(rules.redirect, { acceptRelative: true })) { 824 window.location.href = rules.redirect; 825 return false; 826 } 827 return rules.redirect; 828 } 829}); 830const globalMiddleware = [ 831 validate, 832 manifest_45route_45rule 833]; 834const namedMiddleware = {}; 835function createCurrentLocation(base, location2, renderedPath) { 836 const { pathname, search, hash } = location2; 837 const hashPos = base.indexOf("#"); 838 if (hashPos > -1) { 839 const slicePos = hash.includes(base.slice(hashPos)) ? base.slice(hashPos).length : 1; 840 let pathFromHash = hash.slice(slicePos); 841 if (pathFromHash[0] !== "/") { 842 pathFromHash = "/" + pathFromHash; 843 } 844 return withoutBase(pathFromHash, ""); 845 } 846 const displayedPath = withoutBase(pathname, base); 847 const path = !renderedPath || isSamePath(displayedPath, renderedPath) ? displayedPath : renderedPath; 848 return path + (path.includes("?") ? "" : search) + hash; 849} 850const plugin = defineNuxtPlugin({ 851 name: "nuxt:router", 852 enforce: "pre", 853 async setup(nuxtApp) { 854 var _a2, _b2; 855 let __temp, __restore; 856 let routerBase = useRuntimeConfig().app.baseURL; 857 if (hashMode && !routerBase.includes("#")) { 858 routerBase += "#"; 859 } 860 const history = ((_b2 = (_a2 = routerOptions).history) == null ? void 0 : _b2.call(_a2, routerBase)) ?? (hashMode ? createWebHashHistory(routerBase) : createWebHistory(routerBase)); 861 const routes = routerOptions.routes ? ([__temp, __restore] = executeAsync(() => routerOptions.routes(_routes)), __temp = await __temp, __restore(), __temp) ?? _routes : _routes; 862 let startPosition; 863 const router = createRouter({ 864 ...routerOptions, 865 scrollBehavior: (to, from, savedPosition) => { 866 if (from === START_LOCATION_NORMALIZED) { 867 startPosition = savedPosition; 868 return; 869 } 870 if (routerOptions.scrollBehavior) { 871 router.options.scrollBehavior = routerOptions.scrollBehavior; 872 if ("scrollRestoration" in window.history) { 873 const unsub = router.beforeEach(() => { 874 unsub(); 875 window.history.scrollRestoration = "manual"; 876 }); 877 } 878 return routerOptions.scrollBehavior(to, START_LOCATION_NORMALIZED, startPosition || savedPosition); 879 } 880 }, 881 history, 882 routes 883 }); 884 handleHotUpdate(router, routerOptions.routes ? routerOptions.routes : (routes2) => routes2); 885 if ("scrollRestoration" in window.history) { 886 window.history.scrollRestoration = "auto"; 887 } 888 nuxtApp.vueApp.use(router); 889 const previousRoute = shallowRef(router.currentRoute.value); 890 router.afterEach((_to, from) => { 891 previousRoute.value = from; 892 });
893 Object.defineProperty(nuxtApp.vueApp.config.globalProperties, "previousRoute", { 894 get: () => previousRoute.value 895 }); 896 const initialURL = createCurrentLocation(routerBase, window.location, nuxtApp.payload.path); 897 const _route = shallowRef(router.currentRoute.value); 898 const syncCurrentRoute = () => { 899 _route.value = router.currentRoute.value; 900 }; 901 nuxtApp.hook("page:finish", syncCurrentRoute); 902 router.afterEach((to, from) => { 903 var _a3, _b3, _c2, _d2; 904 if (((_b3 = (_a3 = to.matched[0]) == null ? void 0 : _a3.components) == null ? void 0 : _b3.default) === ((_d2 = (_c2 = from.matched[0]) == null ? void 0 : _c2.components) == null ? void 0 : _d2.default)) { 905 syncCurrentRoute(); 906 } 907 }); 908 const route = {}; 909 for (const key in _route.value) { 910 Object.defineProperty(route, key, { 911 get: () => _route.value[key], 912 enumerable: true 913 }); 914 } 915 nuxtApp._route = shallowReactive(route); 916 nuxtApp._middleware || (nuxtApp._middleware = { 917 global: [], 918 named: {} 919 }); 920 const error = useError(); 921 { 922 router.afterEach(async (to, _from, failure) => { 923 delete nuxtApp._processingMiddleware; 924 if (!nuxtApp.isHydrating && error.value) { 925 await nuxtApp.runWithContext(clearError); 926 } 927 if (failure) { 928 await nuxtApp.callHook("page:loading:end"); 929 } 930 }); 931 } 932 try { 933 if (false) ; 934 ; 935 [__temp, __restore] = executeAsync(() => router.isReady()), await __temp, __restore(); 936 ; 937 } catch (error2) { 938 [__temp, __restore] = executeAsync(() => nuxtApp.runWithContext(() => showError(error2))), await __temp, __restore(); 939 } 940 const resolvedInitialRoute = initialURL !== router.currentRoute.value.fullPath ? router.resolve(initialURL) : router.currentRoute.value; 941 syncCurrentRoute(); 942 const initialLayout = nuxtApp.payload.state._layout; 943 router.beforeEach(async (to, from) => { 944 var _a3; 945 await nuxtApp.callHook("page:loading:start"); 946 to.meta = reactive(to.meta); 947 if (nuxtApp.isHydrating && initialLayout && !isReadonly(to.meta.layout)) { 948 to.meta.layout = initialLayout; 949 } 950 nuxtApp._processingMiddleware = true; 951 { 952 const middlewareEntries = /* @__PURE__ */ new Set([...globalMiddleware, ...nuxtApp._middleware.global]); 953 for (const component of to.matched) { 954 const componentMiddleware = component.meta.middleware; 955 if (!componentMiddleware) { 956 continue; 957 } 958 for (const entry2 of toArray(componentMiddleware)) { 959 middlewareEntries.add(entry2); 960 } 961 } 962 { 963 const routeRules = await nuxtApp.runWithContext(() => getRouteRules({ path: to.path })); 964 if (routeRules.appMiddleware) { 965 for (const key in routeRules.appMiddleware) { 966 if (routeRules.appMiddleware[key]) { 967 middlewareEntries.add(key); 968 } else { 969 middlewareEntries.delete(key); 970 } 971 } 972 } 973 } 974 for (const entry2 of middlewareEntries) { 975 const middleware = typeof entry2 === "string" ? nuxtApp._middleware.named[entry2] || await ((_a3 = namedMiddleware[entry2]) == null ? void 0 : _a3.call(namedMiddleware).then((r) => r.default || r)) : entry2; 976 if (!middleware) { 977 throw new Error(`Unknown route middleware: '${entry2}'.`); 978 } 979 try { 980 const result = await nuxtApp.runWithContext(() => middleware(to, from)); 981 if (!nuxtApp.payload.serverRendered && nuxtApp.isHydrating) { 982 if (result === false || result instanceof Error) { 983 const error2 = result || createError$1({ 984 statusCode: 404, 985 statusMessage: `Page Not Found: ${initialURL}` 986 }); 987 await nuxtApp.runWithContext(() => showError(error2)); 988 return false; 989 } 990 } 991 if (result === true) { 992 continue; 993 } 994 if (result === false) { 995 return result; 996 } 997 if (result) { 998 if (isNuxtError(result) && result.fatal) { 999 await nuxtApp.runWithContext(() => showError(result)); 1000 } 1001 return result; 1002 } 1003 } catch (err) { 1004 const error2 = createError$1(err); 1005 if (error2.fatal) { 1006 await nuxtApp.runWithContext(() => showError(error2)); 1007 } 1008 return error2; 1009 } 1010 } 1011 } 1012 }); 1013 router.onError(async () => { 1014 delete nuxtApp._processingMiddleware; 1015 await nuxtApp.callHook("page:loading:end"); 1016 }); 1017 router.afterEach(async (to, _from) => { 1018 if (to.matched.length === 0) { 1019 await nuxtApp.runWithContext(() => showError(createError$1({ 1020 statusCode: 404, 1021 fatal: false, 1022 statusMessage: `Page not found: ${to.fullPath}`, 1023 data: { 1024 path: to.fullPath 1025 } 1026 }))); 1027 } 1028 }); 1029 nuxtApp.hooks.hookOnce("app:created", async () => {
1030 try { 1031 if ("name" in resolvedInitialRoute) { 1032 resolvedInitialRoute.name = void 0; 1033 } 1034 await router.replace({ 1035 ...resolvedInitialRoute, 1036 force: true 1037 }); 1038 router.options.scrollBehavior = routerOptions.scrollBehavior; 1039 } catch (error2) { 1040 await nuxtApp.runWithContext(() => showError(error2)); 1041 } 1042 }); 1043 return { provide: { router } }; 1044 } 1045}); 1046function normalizeSiteConfig(config) { 1047 if (typeof config.indexable !== "undefined") 1048 config.indexable = String(config.indexable) !== "false"; 1049 if (typeof config.trailingSlash !== "undefined" && !config.trailingSlash) 1050 config.trailingSlash = String(config.trailingSlash) !== "false"; 1051 if (config.url && !hasProtocol$1(String(config.url), { acceptRelative: true, strict: false })) 1052 config.url = withHttps(String(config.url)); 1053 const keys = Object.keys(config).sort((a, b) => a.localeCompare(b)); 1054 const newConfig = {}; 1055 for (const k of keys) 1056 newConfig[k] = config[k]; 1057 return newConfig; 1058} 1059function createSiteConfigStack(options) { 1060 const debug = false; 1061 const stack2 = []; 1062 function push(input) { 1063 if (!input || typeof input !== "object" || Object.keys(input).length === 0) { 1064 return () => { 1065 }; 1066 } 1067 if (!input._context && debug) ; 1068 const entry2 = {}; 1069 for (const k in input) { 1070 const val = input[k]; 1071 if (typeof val !== "undefined" && val !== "") 1072 entry2[k] = val; 1073 } 1074 let idx; 1075 if (Object.keys(entry2).filter((k) => !k.startsWith("_")).length > 0) 1076 idx = stack2.push(entry2); 1077 return () => { 1078 if (typeof idx !== "undefined") { 1079 stack2.splice(idx - 1, 1); 1080 } 1081 }; 1082 } 1083 function get(options2) { 1084 var _a2; 1085 const siteConfig = {}; 1086 if (options2 == null ? void 0 : options2.debug) 1087 siteConfig._context = {}; 1088 siteConfig._priority = {}; 1089 for (const o in stack2.sort((a, b) => (a._priority || 0) - (b._priority || 0))) { 1090 for (const k in stack2[o]) { 1091 const key = k; 1092 const val = (options2 == null ? void 0 : options2.resolveRefs) ? toValue(stack2[o][k]) : stack2[o][k]; 1093 if (!k.startsWith("_") && typeof val !== "undefined" && val !== "") { 1094 siteConfig[k] = val; 1095 if (typeof stack2[o]._priority !== "undefined" && stack2[o]._priority !== -1) { 1096 siteConfig._priority[key] = stack2[o]._priority; 1097 } 1098 if (options2 == null ? void 0 : options2.debug) 1099 siteConfig._context[key] = ((_a2 = stack2[o]._context) == null ? void 0 : _a2[key]) || stack2[o]._context || "anonymous"; 1100 } 1101 } 1102 } 1103 return (options2 == null ? void 0 : options2.skipNormalize) ? siteConfig : normalizeSiteConfig(siteConfig); 1104 } 1105 return { 1106 stack: stack2, 1107 push, 1108 get 1109 }; 1110} 1111const _0_siteConfig_tU0SxKrPeVRXWcGu2sOnIfhNDbYiKNfDCvYZhRueG0Q = defineNuxtPlugin({ 1112 name: "nuxt-site-config:init", 1113 enforce: "pre", 1114 async setup(nuxtApp) { 1115 var _a2; 1116 const stack2 = createSiteConfigStack(); 1117 const state2 = useState("site-config"); 1118 { 1119 const store = state2.value || window.__NUXT_SITE_CONFIG__ || {}; 1120 for (const k in store) { 1121 if (k[0] !== "_") { 1122 stack2.push({ [k]: store[k], _priority: ((_a2 = store._priority) == null ? void 0 : _a2[k]) || -1 }); 1123 } 1124 } 1125 } 1126 return { 1127 provide: { 1128 nuxtSiteConfig: stack2 1129 } 1130 }; 1131 } 1132}); 1133const payload_client_kSYcIMYUswSDcSGoGWqM0MO2T4MjOZsQFA1GU6fqohM = defineNuxtPlugin({ 1134 name: "nuxt:payload", 1135 setup(nuxtApp) { 1136 const staticKeysToRemove = /* @__PURE__ */ new Set(); 1137 useRouter().beforeResolve(async (to, from) => { 1138 if (to.path === from.path) { 1139 return; 1140 } 1141 const payload = await loadPayload(to.path); 1142 if (!payload) { 1143 return; 1144 } 1145 { 1146 for (const key of staticKeysToRemove) { 1147 delete nuxtApp.static.data[key]; 1148 } 1149 } 1150 for (const key in payload.data) { 1151 { 1152 if (!(key in nuxtApp.static.data)) { 1153 staticKeysToRemove.add(key); 1154 } 1155 } 1156 nuxtApp.static.data[key] = payload.data[key]; 1157 } 1158 }); 1159 onNuxtReady(() => { 1160 var _a2; 1161 nuxtApp.hooks.hook("link:prefetch", async (url) => { 1162 const { hostname } = new URL(url, window.location.href); 1163 if (hostname === window.location.hostname) { 1164 await loadPayload(url).catch(() => { 1165 console.warn("[nuxt] Error preloading payload for", url); 1166 }); 1167 } 1168 }); 1169 if (((_a2 = navigator.connection) == null ? void 0 : _a2.effectiveType) !== "slow-2g") { 1170 setTimeout(getAppManifest, 1e3); 1171 } 1172 }); 1173 } 1174}); 1175const navigation_repaint_client_iZ4sbIDUOBlI58WRS1dxkRZJOsKNs1c7SCqRszdxr6Y = defineNuxtPlugin(() => { 1176 const router = useRouter(); 1177 onNuxtReady(() => {
1178 router.beforeResolve(async () => { 1179 await new Promise((resolve) => { 1180 setTimeout(resolve, 100); 1181 requestAnimationFrame(() => { 1182 setTimeout(resolve, 0); 1183 }); 1184 }); 1185 }); 1186 }); 1187}); 1188const check_outdated_build_client__GMdmUuNCTKDee9GyDhHz84CJEYUp5_FenYjvgAxtj8 = defineNuxtPlugin((nuxtApp) => { 1189 let timeout; 1190 async function getLatestManifest() { 1191 const currentManifest = await getAppManifest(); 1192 if (timeout) { 1193 clearTimeout(timeout); 1194 } 1195 timeout = setTimeout(getLatestManifest, outdatedBuildInterval); 1196 try { 1197 const meta = await $fetch(buildAssetsURL("builds/latest.json") + `?${Date.now()}`); 1198 if (meta.id !== currentManifest.id) { 1199 nuxtApp.hooks.callHook("app:manifest:update", meta); 1200 } 1201 } catch { 1202 } 1203 } 1204 onNuxtReady(() => { 1205 timeout = setTimeout(getLatestManifest, outdatedBuildInterval); 1206 }); 1207}); 1208const chunk_reload_client_90gdG_aWZaDfO85SQYWzwaOywz7zi0wBnFUoX0cT54U = defineNuxtPlugin({ 1209 name: "nuxt:chunk-reload", 1210 setup(nuxtApp) { 1211 const router = useRouter(); 1212 const config = useRuntimeConfig(); 1213 const chunkErrors = /* @__PURE__ */ new Set(); 1214 router.beforeEach(() => { 1215 chunkErrors.clear(); 1216 }); 1217 nuxtApp.hook("app:chunkError", ({ error }) => { 1218 chunkErrors.add(error); 1219 }); 1220 function reloadAppAtPath(to) { 1221 const isHash = "href" in to && to.href[0] === "#"; 1222 const path = isHash ? config.app.baseURL + to.href : joinURL(config.app.baseURL, to.fullPath); 1223 reloadNuxtApp({ path, persistState: true }); 1224 } 1225 nuxtApp.hook("app:manifest:update", () => { 1226 router.beforeResolve(reloadAppAtPath); 1227 }); 1228 router.onError((error, to) => { 1229 if (chunkErrors.has(error)) { 1230 reloadAppAtPath(to); 1231 } 1232 }); 1233 } 1234}); 1235const lazyGlobalComponents = [ 1236 ["CoreBlockCalendly", LazyCoreBlockCalendly], 1237 ["CoreBlockContactCard", LazyCoreBlockContactCard], 1238 ["CoreBlockDisclosures", LazyCoreBlockDisclosures], 1239 ["CoreBlockForm", LazyCoreBlockForm], 1240 ["CoreBlockFooter", LazyCoreBlockFooter], 1241 ["CoreBlockFooterBackground", LazyCoreBlockFooterBackground], 1242 ["CoreBlockFooterBanner", LazyCoreBlockFooterBanner], 1243 ["CoreBlockFooterDisclosures", LazyCoreBlockFooterDisclosures], 1244 ["CoreBlockFooterLogo", LazyCoreBlockFooterLogo], 1245 ["CoreBlockFooterOneTrust", LazyCoreBlockFooterOneTrust], 1246 ["CoreBlockFooterSocialLinks", LazyCoreBlockFooterSocialLinks], 1247 ["CoreBlockFooterContact", LazyCoreBlockFooterContact], 1248 ["CoreBlockFooterContactAddress", LazyCoreBlockFooterContactAddress], 1249 ["CoreBlockFooterContactEmail", LazyCoreBlockFooterContactEmail], 1250 ["CoreBlockFooterContactGroup", LazyCoreBlockFooterContactGroup], 1251 ["CoreBlockFooterContactPhone", LazyCoreBlockFooterContactPhone], 1252 ["CoreAnchorLinkNavigation", LazyCoreAnchorLinkNavigation], 1253 ["CoreBlock", LazyCoreBlock], 1254 ["CoreBlockAccessibleTooltip", LazyCoreBlockAccessibleTooltip], 1255 ["CoreBlockAddressAutocomplete", LazyCoreBlockAddressAutocomplete], 1256 ["CoreBlockArticleCard", LazyCoreBlockArticleCard], 1257 ["CoreBlockArticles", LazyCoreBlockArticles], 1258 ["CoreBlockBreadcrumbs", LazyCoreBlockBreadcrumbs], 1259 ["CoreBlockButton", LazyCoreBlockButton], 1260 ["CoreBlockCalculators", LazyCoreBlockCalculators], 1261 ["CoreBlockCalendlyEmbed", LazyCoreBlockCalendlyEmbed], 1262 ["CoreBlockCarousel", LazyCoreBlockCarousel], 1263 ["CoreBlockCenteredNavBar", LazyCoreBlockCenteredNavBar], 1264 ["CoreBlockColumns", LazyCoreBlockColumns], 1265 ["CoreBlockContactHero", LazyCoreBlockContactHero], 1266 ["CoreBlockContentCard", LazyCoreBlockContentCard], 1267 ["CoreBlockContentCardTextField", LazyCoreBlockContentCardTextField], 1268 ["CoreBlockDialog", LazyCoreBlockDialog], 1269 ["CoreBlockDivider", LazyCoreBlockDivider], 1270 ["CoreBlockDynamicForm", LazyCoreBlockDynamicForm], 1271 ["CoreBlockFile", LazyCoreBlockFile], 1272 ["CoreBlockFrameEmbed", LazyCoreBlockFrameEmbed], 1273 ["CoreBlockGrid", LazyCoreBlockGrid], 1274 ["CoreBlockHero", LazyCoreBlockHero], 1275 ["CoreBlockHeroBackground", LazyCoreBlockHeroBackground], 1276 ["CoreBlockHeroComponent", LazyCoreBlockHeroComponent], 1277 ["CoreBlockHtml", LazyCoreBlockHtml], 1278 ["CoreBlockIcon", LazyCoreBlockIcon], 1279 ["CoreBlockImage", LazyCoreBlockImage], 1280 ["CoreBlockImageCropped", LazyCoreBlockImageCropped], 1281 ["CoreBlockLazy", LazyCoreBlockLazy], 1282 ["CoreBlockMainNav", LazyCoreBlockMainNav], 1283 ["CoreBlockMainNavImage", LazyCoreBlockMainNavImage], 1284 ["CoreBlockMap", LazyCoreBlockMap], 1285 ["CoreBlockMedia", LazyCoreBlockMedia], 1286 ["CoreBlockNavItem", LazyCoreBlockNavItem], 1287 ["CoreBlockOEmbed", LazyCoreBlockOEmbed], 1288 ["CoreBlockPencilBanner", LazyCoreBlockPencilBanner], 1289 ["CoreBlockRepeat", LazyCoreBlockRepeat], 1290 ["CoreBlockRichText", LazyCoreBlockRichText], 1291 ["CoreBlockRows", LazyCoreBlockRows], 1292 ["CoreBlockSelect", LazyCoreBlockSelect], 1293 ["CoreBlockSocialLinks", LazyCoreBlockSocialLinks], 1294 ["CoreBlockStickyButton", LazyCoreBlockStickyButton], 1295 ["CoreBlockText", LazyCoreBlockText], 1296 ["CoreBlockUnknown", LazyCoreBlockUnknown], 1297 ["CoreBlockVerticalDivider", LazyCoreBlockVerticalDivider], 1298 ["CoreBlockVideo", LazyCoreBlockVideo], 1299 ["CoreBlockContainer", LazyCoreBlockContainer], 1300 ["CoreBlockContainerAccordion", LazyCoreBlockContainerAccordion], 1301 ["CoreBlockContainerTabs", LazyCoreBlockContainerTabs], 1302 ["CoreBlockContainerToggle", LazyCoreBlockContainerToggle], 1303 ["CoreIcon", LazyCoreIcon], 1304 ["CoreIconAccordion", LazyCoreIconAccordion], 1305 ["CoreIconAccount", LazyCoreIconAccount], 1306 ["CoreIconActions", LazyCoreIconActions], 1307 ["CoreIconActivity", LazyCoreIconActivity], 1308 ["CoreIconAddFolder", LazyCoreIconAddFolder], 1309 ["CoreIconAddPage", LazyCoreIconAddPage], 1310 ["CoreIconAdvancedSearch", LazyCoreIconAdvancedSearch], 1311 ["CoreIconAlignCenter", LazyCoreIconAlignCenter], 1312 ["CoreIconAlignLeft", LazyCoreIconAlignLeft], 1313 ["CoreIconAlignRight", LazyCoreIconAlignRight], 1314 ["CoreIconAlignVerticalBottom", LazyCoreIconAlignVerticalBottom], 1315 ["CoreIconAlignVerticalCenter", LazyCoreIconAlignVerticalCenter], 1316 ["CoreIconAlignVerticalTop", LazyCoreIconAlignVerticalTop], 1317 ["CoreIconAnalytics", LazyCoreIconAnalytics], 1318 ["CoreIconAnchorLink", LazyCoreIconAnchorLink], 1319 ["CoreIconArchive", LazyCoreIconArchive], 1320 ["CoreIconArrowDown", LazyCoreIconArrowDown], 1321 ["CoreIconArrowLeft", LazyCoreIconArrowLeft], 1322 ["CoreIconArrowLeftCircle", LazyCoreIconArrowLeftCircle], 1323 ["CoreIconArrowRight", LazyCoreIconArrowRight], 1324 ["CoreIconArrowUp", LazyCoreIconArrowUp], 1325 ["CoreIconArticle", LazyCoreIconArticle], 1326 ["CoreIconBars", LazyCoreIconBars], 1327 ["CoreIconBell", LazyCoreIconBell], 1328 ["CoreIconBilling", LazyCoreIconBilling], 1329 ["CoreIconBlock", LazyCoreIconBlock], 1330 ["CoreIconBottomBanner", LazyCoreIconBottomBanner], 1331 ["CoreIconBreadcrumbExpand", LazyCoreIconBreadcrumbExpand], 1332 ["CoreIconBrush", LazyCoreIconBrush], 1333 ["CoreIconButton", LazyCoreIconButton], 1334 ["CoreIconCalendar", LazyCoreIconCalendar], 1335 ["CoreIconCalendly", LazyCoreIconCalendly], 1336 ["CoreIconCalendlyTitle", LazyCoreIconCalendlyTitle], 1337 ["CoreIconCamera", LazyCoreIconCamera], 1338 ["CoreIconCardAccount", LazyCoreIconCardAccount], 1339 ["CoreIconCarousel", LazyCoreIconCarousel], 1340 ["CoreIconCarouselBackward", LazyCoreIconCarouselBackward], 1341 ["CoreIconCarouselForward", LazyCoreIconCarouselForward], 1342 ["CoreIconCategories", LazyCoreIconCategories], 1343 ["CoreIconChanges", LazyCoreIconChanges], 1344 ["CoreIconCheckmark", LazyCoreIconCheckmark], 1345 ["CoreIconChevronDown", LazyCoreIconChevronDown], 1346 ["CoreIconChevronLeft", LazyCoreIconChevronLeft], 1347 ["CoreIconChevronRight", LazyCoreIconChevronRight], 1348 ["CoreIconChevronUp", LazyCoreIconChevronUp], 1349 ["CoreIconCircleCheck", LazyCoreIconCircleCheck], 1350 ["CoreIconCircleCheckLight", LazyCoreIconCircleCheckLight], 1351 ["CoreIconCircleMinus", LazyCoreIconCircleMinus], 1352 ["CoreIconCircleMinusFilled", LazyCoreIconCircleMinusFilled], 1353 ["CoreIconCirclePlus", LazyCoreIconCirclePlus], 1354 ["CoreIconCirclePlusFilled", LazyCoreIconCirclePlusFilled], 1355 ["CoreIconClock", LazyCoreIconClock], 1356 ["CoreIconClockFilled", LazyCoreIconClockFilled], 1357 ["CoreIconClose", LazyCoreIconClose], 1358 ["CoreIconCloseCircle", LazyCoreIconCloseCircle], 1359 ["CoreIconCloseCircleFilled", LazyCoreIconCloseCircleFilled], 1360 ["CoreIconCompliance", LazyCoreIconCompliance], 1361 ["CoreIconComputer", LazyCoreIconComputer], 1362 ["CoreIconConnected", LazyCoreIconConnected], 1363 ["CoreIconConnectedOutline", LazyCoreIconConnectedOutline], 1364 ["CoreIconContact", LazyCoreIconContact], 1365 ["CoreIconContactEmail", LazyCoreIconContactEmail], 1366 ["CoreIconContactFax", LazyCoreIconContactFax], 1367 ["CoreIconContactPage", LazyCoreIconContactPage], 1368 ["CoreIconContactPhone", LazyCoreIconContactPhone], 1369 ["CoreIconContactSmartphone", LazyCoreIconContactSmartphone], 1370 ["CoreIconContainersIcon", LazyCoreIconContainersIcon], 1371 ["CoreIconContentLibrary", LazyCoreIconContentLibrary], 1372 ["CoreIconContentLibraryMedia", LazyCoreIconContentLibraryMedia], 1373 ["CoreIconCopy", LazyCoreIconCopy], 1374 ["CoreIconCopyright", LazyCoreIconCopyright], 1375 ["CoreIconCornerDownRight", LazyCoreIconCornerDownRight], 1376 ["CoreIconCreditCard", LazyCoreIconCreditCard], 1377 ["CoreIconCrop", LazyCoreIconCrop], 1378 ["CoreIconDefault", LazyCoreIconDefault], 1379 ["CoreIconDesign", LazyCoreIconDesign], 1380 ["CoreIconDevices", LazyCoreIconDevices], 1381 ["CoreIconDiagonalRightArrow", LazyCoreIconDiagonalRightArrow], 1382 ["CoreIconDisclosures", LazyCoreIconDisclosures], 1383 ["CoreIconDivider", LazyCoreIconDivider], 1384 ["CoreIconDomains", LazyCoreIconDomains], 1385 ["CoreIconDotsHorizontal", LazyCoreIconDotsHorizontal], 1386 ["CoreIconDotsVertical", LazyCoreIconDotsVertical], 1387 ["CoreIconDownArrow", LazyCoreIconDownArrow], 1388 ["CoreIconDownload", LazyCoreIconDownload], 1389 ["CoreIconDraftDetails", LazyCoreIconDraftDetails], 1390 ["CoreIconDrafts", LazyCoreIconDrafts], 1391 ["CoreIconDuplicate", LazyCoreIconDuplicate], 1392 ["CoreIconEdit", LazyCoreIconEdit], 1393 ["CoreIconEditCircle", LazyCoreIconEditCircle], 1394 ["CoreIconEllipsisOutlined", LazyCoreIconEllipsisOutlined], 1395 ["CoreIconEmail", LazyCoreIconEmail], 1396 ["CoreIconEmoji", LazyCoreIconEmoji], 1397 ["CoreIconError", LazyCoreIconError], 1398 ["CoreIconErrorFilled", LazyCoreIconErrorFilled], 1399 ["CoreIconExternalLink", LazyCoreIconExternalLink], 1400 ["CoreIconFacebook", LazyCoreIconFacebook], 1401 ["CoreIconFavoriteFilled", LazyCoreIconFavoriteFilled], 1402 ["CoreIconFavoriteUnfilled", LazyCoreIconFavoriteUnfilled], 1403 ["CoreIconFax", LazyCoreIconFax], 1404 ["CoreIconFile", LazyCoreIconFile], 1405 ["CoreIconFilter", LazyCoreIconFilter], 1406 ["CoreIconFilterOutline", LazyCoreIconFilterOutline], 1407 ["CoreIconFocalPoint", LazyCoreIconFocalPoint], 1408 ["CoreIconFolder", LazyCoreIconFolder], 1409 ["CoreIconFooter", LazyCoreIconFooter], 1410 ["CoreIconForm", LazyCoreIconForm], 1411 ["CoreIconFormIcon", LazyCoreIconFormIcon], 1412 ["CoreIconGlobe", LazyCoreIconGlobe], 1413 ["CoreIconGradient", LazyCoreIconGradient], 1414 ["CoreIconGradientSquare", LazyCoreIconGradientSquare], 1415 ["CoreIconGrid", LazyCoreIconGrid], 1416 ["CoreIconGridOn", LazyCoreIconGridOn], 1417 ["CoreIconHamburgerMenu", LazyCoreIconHamburgerMenu], 1418 ["CoreIconHeader", LazyCoreIconHeader], 1419 ["CoreIconHome", LazyCoreIconHome], 1420 ["CoreIconIcon71", LazyCoreIconIcon71], 1421 ["CoreIconIcons", LazyCoreIconIcons], 1422 ["CoreIconImage", LazyCoreIconImage], 1423 ["CoreIconImageOffset", LazyCoreIconImageOffset], 1424 ["CoreIconInReview", LazyCoreIconInReview], 1425 ["CoreIconInfo", LazyCoreIconInfo], 1426 ["CoreIconInsertDriveFile", LazyCoreIconInsertDriveFile], 1427 ["CoreIconInsertLink", LazyCoreIconInsertLink], 1428 ["CoreIconInstagram", LazyCoreIconInstagram], 1429 ["CoreIconLandingLogo", LazyCoreIconLandingLogo], 1430 ["CoreIconLayout", LazyCoreIconLayout], 1431 ["CoreIconLeftArrow", LazyCoreIconLeftArrow], 1432 ["CoreIconLinkedin", LazyCoreIconLinkedin], 1433 ["CoreIconList", LazyCoreIconList], 1434 ["CoreIconListView", LazyCoreIconListView], 1435 ["CoreIconLock", LazyCoreIconLock], 1436 ["CoreIconLogo", LazyCoreIconLogo], 1437 ["CoreIconMap", LazyCoreIconMap], 1438 ["CoreIconMapPin", LazyCoreIconMapPin], 1439 ["CoreIconMaximize", LazyCoreIconMaximize], 1440 ["CoreIconMedia", LazyCoreIconMedia], 1441 ["CoreIconMenuClose", LazyCoreIconMenuClose], 1442 ["CoreIconMessageCircle", LazyCoreIconMessageCircle], 1443 ["CoreIconMinimize", LazyCoreIconMinimize], 1444 ["CoreIconMinus", LazyCoreIconMinus], 1445 ["CoreIconMobilePhone", LazyCoreIconMobilePhone], 1446 ["CoreIconModal", LazyCoreIconModal], 1447 ["CoreIconMonitor", LazyCoreIconMonitor], 1448 ["CoreIconMovieStrip", LazyCoreIconMovieStrip], 1449 ["CoreIconNews", LazyCoreIconNews], 1450 ["CoreIconNotes", LazyCoreIconNotes], 1451 ["CoreIconNotificationAlert", LazyCoreIconNotificationAlert], 1452 ["CoreIconNotifications", LazyCoreIconNotifications], 1453 ["CoreIconOneTrust", LazyCoreIconOneTrust], 1454 ["CoreIconOpenInFull", LazyCoreIconOpenInFull], 1455 ["CoreIconPaddingAll", LazyCoreIconPaddingAll], 1456 ["CoreIconPaddingBottom", LazyCoreIconPaddingBottom], 1457 ["CoreIconPaddingHorizontal", LazyCoreIconPaddingHorizontal], 1458 ["CoreIconPaddingLeft", LazyCoreIconPaddingLeft], 1459 ["CoreIconPaddingRight", LazyCoreIconPaddingRight], 1460 ["CoreIconPaddingTop", LazyCoreIconPaddingTop], 1461 ["CoreIconPage", LazyCoreIconPage], 1462 ["CoreIconPages", LazyCoreIconPages], 1463 ["CoreIconPaintersPalette", LazyCoreIconPaintersPalette], 1464 ["CoreIconPause", LazyCoreIconPause], 1465 ["CoreIconPauseCircle", LazyCoreIconPauseCircle], 1466 ["CoreIconPdf", LazyCoreIconPdf], 1467 ["CoreIconPhone", LazyCoreIconPhone], 1468 ["CoreIconPhotoLibrary", LazyCoreIconPhotoLibrary], 1469 ["CoreIconPlay", LazyCoreIconPlay], 1470 ["CoreIconPlayCircle", LazyCoreIconPlayCircle], 1471 ["CoreIconPlayCircleButton", LazyCoreIconPlayCircleButton], 1472 ["CoreIconPlus", LazyCoreIconPlus], 1473 ["CoreIconQuestionMark", LazyCoreIconQuestionMark], 1474 ["CoreIconReaderMode", LazyCoreIconReaderMode], 1475 ["CoreIconRedo", LazyCoreIconRedo], 1476 ["CoreIconReorder", LazyCoreIconReorder], 1477 ["CoreIconReplace", LazyCoreIconReplace], 1478 ["CoreIconReplay", LazyCoreIconReplay], 1479 ["CoreIconRevert", LazyCoreIconRevert], 1480 ["CoreIconRightArrow", LazyCoreIconRightArrow], 1481 ["CoreIconRoundedSquare", LazyCoreIconRoundedSquare], 1482 ["CoreIconSearch", LazyCoreIconSearch], 1483 ["CoreIconSection", LazyCoreIconSection], 1484 ["CoreIconSelectAll", LazyCoreIconSelectAll], 1485 ["CoreIconSeo", LazyCoreIconSeo], 1486 ["CoreIconSettings", LazyCoreIconSettings], 1487 ["CoreIconShield", LazyCoreIconShield], 1488 ["CoreIconShoppingBag", LazyCoreIconShoppingBag], 1489 ["CoreIconShoppingCart", LazyCoreIconShoppingCart], 1490 ["CoreIconSiteRedo", LazyCoreIconSiteRedo], 1491 ["CoreIconSiteStyles", LazyCoreIconSiteStyles], 1492 ["CoreIconSiteUndo", LazyCoreIconSiteUndo], 1493 ["CoreIconSizing", LazyCoreIconSizing], 1494 ["CoreIconSocial", LazyCoreIconSocial], 1495 ["CoreIconSquareEdit", LazyCoreIconSquareEdit], 1496 ["CoreIconStore", LazyCoreIconStore], 1497 ["CoreIconTablet", LazyCoreIconTablet], 1498 ["CoreIconTabs", LazyCoreIconTabs], 1499 ["CoreIconTemplate", LazyCoreIconTemplate], 1500 ["CoreIconTextStyle", LazyCoreIconTextStyle], 1501 ["CoreIconTheme", LazyCoreIconTheme], 1502 ["CoreIconTool", LazyCoreIconTool], 1503 ["CoreIconTrash", LazyCoreIconTrash], 1504 ["CoreIconTwitter", LazyCoreIconTwitter], 1505 ["CoreIconUndo", LazyCoreIconUndo], 1506 ["CoreIconUnlock", LazyCoreIconUnlock], 1507 ["CoreIconUpdate", LazyCoreIconUpdate], 1508 ["CoreIconUpload", LazyCoreIconUpload], 1509 ["CoreIconUser", LazyCoreIconUser], 1510 ["CoreIconUserCheck", LazyCoreIconUserCheck], 1511 ["CoreIconVideo", LazyCoreIconVideo], 1512 ["CoreIconVideoPlay", LazyCoreIconVideoPlay], 1513 ["CoreIconViewDesktop", LazyCoreIconViewDesktop], 1514 ["CoreIconViewDesktopSettings", LazyCoreIconViewDesktopSettings], 1515 ["CoreIconViewLiveSite", LazyCoreIconViewLiveSite], 1516 ["CoreIconVisibilityOff", LazyCoreIconVisibilityOff], 1517 ["CoreIconVisibilityOn", LazyCoreIconVisibilityOn], 1518 ["CoreIconVolumeOff", LazyCoreIconVolumeOff], 1519 ["CoreIconVolumeOn", LazyCoreIconVolumeOn], 1520 ["CoreIconVolumeUp", LazyCoreIconVolumeUp], 1521 ["CoreIconWatchLater", LazyCoreIconWatchLater], 1522 ["CoreIconYoutube", LazyCoreIconYoutube] 1523]; 1524const components_plugin_z4hgvsiddfKkfXTP6M8M4zG5Cb7sGnDhcryKVM45Di4 = defineNuxtPlugin({ 1525 name: "nuxt:global-components", 1526 setup(nuxtApp) { 1527 for (const [name, component] of lazyGlobalComponents) { 1528 nuxtApp.vueApp.component(name, component); 1529 nuxtApp.vueApp.component("Lazy" + name, component); 1530 } 1531 } 1532}); 1533const layouts = { 1534 default: defineAsyncComponent(() => __vitePreload(() => import("./Mj0r7m1r.js"), true ? __vite__mapDeps([8,1,2,3,0,9]) : void 0, import.meta.url).then((m2) => m2.default |
1534| m2)) 1535}; 1536const prefetch_client_plc8Lsxh1X10IEwNhW7mxf0MabjBz64b9ODLi87nY5E = defineNuxtPlugin({ 1537 name: "nuxt:prefetch", 1538 setup(nuxtApp) { 1539 const router = useRouter(); 1540 nuxtApp.hooks.hook("app:mounted", () => { 1541 router.beforeEach(async (to) => { 1542 var _a2; 1543 const layout = (_a2 = to == null ? void 0 : to.meta) == null ? void 0 : _a2.layout; 1544 if (layout && typeof layouts[layout] === "function") { 1545 await layouts[layout](); 1546 } 1547 }); 1548 }); 1549 nuxtApp.hooks.hook("link:prefetch", (url) => { 1550 if (hasProtocol(url)) { 1551 return; 1552 } 1553 const route = router.resolve(url); 1554 if (!route) { 1555 return; 1556 } 1557 const layout = route.meta.layout; 1558 let middleware = toArray(route.meta.middleware); 1559 middleware = middleware.filter((m2) => typeof m2 === "string"); 1560 for (const name of middleware) { 1561 if (typeof namedMiddleware[name] === "function") { 1562 namedMiddleware[name](); 1563 } 1564 } 1565 if (layout && typeof layouts[layout] === "function") { 1566 layouts[layout](); 1567 } 1568 }); 1569 } 1570}); 1571/*! https://github.com/nevware21/ts-utils v0.12.5 */ 1572// @__NO_SIDE_EFFECTS__ 1573function _pureAssign(func1, func2) { 1574 return func1 || func2; 1575} 1576// @__NO_SIDE_EFFECTS__ 1577function _pureRef(value, name) { 1578 return value[name]; 1579} 1580var UNDEF_VALUE = void 0; 1581var NULL_VALUE = null; 1582var EMPTY = ""; 1583var FUNCTION = "function"; 1584var OBJECT = "object"; 1585var PROTOTYPE = "prototype"; 1586var __PROTO__ = "__proto__"; 1587var UNDEFINED = "undefined"; 1588var CONSTRUCTOR = "constructor"; 1589var SYMBOL = "Symbol"; 1590var LENGTH = "length"; 1591var NAME = "name"; 1592var CALL = "call"; 1593var TO_STRING = "toString"; 1594var GET_OWN_PROPERTY_DESCRIPTOR = "getOwnPropertyDescriptor"; 1595var ObjClass$1 = /* @__PURE__ */ _pureAssign(Object); 1596var ObjProto$1 = /* @__PURE__ */ _pureRef(ObjClass$1, PROTOTYPE); 1597var StrCls = /* @__PURE__ */ _pureAssign(String); 1598var StrProto = /* @__PURE__ */ _pureRef(StrCls, PROTOTYPE); 1599var MathCls = /* @__PURE__ */ _pureAssign(Math); 1600var ArrCls = /* @__PURE__ */ _pureAssign(Array); 1601var ArrProto = /* @__PURE__ */ _pureRef(ArrCls, PROTOTYPE); 1602var ArrSlice = /* @__PURE__ */ _pureRef(ArrProto, "slice"); 1603var POLYFILL_TAG = "_polyfill"; 1604var POLYFILL_TYPE_NAME = "__nw21$polytype__"; 1605function safe(func, argArray) { 1606 try { 1607 return { 1608 v: func.apply(this, argArray) 1609 }; 1610 } catch (e) { 1611 return { e }; 1612 } 1613} 1614// @__NO_SIDE_EFFECTS__ 1615function safeGet(cb, defValue, argArray) { 1616 var result = safe(cb, argArray); 1617 return result.e ? defValue : result.v; 1618} 1619var _primitiveTypes; 1620// @__NO_SIDE_EFFECTS__ 1621function _createIs(theType) { 1622 return function(value) { 1623 return typeof value === theType; 1624 }; 1625} 1626// @__NO_SIDE_EFFECTS__ 1627function _createObjIs(theName) { 1628 var theType = "[object " + theName + "]"; 1629 return function(value) { 1630 return !!(value && /* @__PURE__ */ objToString(value) === theType); 1631 }; 1632} 1633// @__NO_SIDE_EFFECTS__ 1634function objToString(value) { 1635 return ObjProto$1[TO_STRING].call(value); 1636} 1637// @__NO_SIDE_EFFECTS__ 1638function isUndefined(value) { 1639 return typeof value === UNDEFINED || value === UNDEFINED; 1640} 1641// @__NO_SIDE_EFFECTS__ 1642function isStrictUndefined(arg) { 1643 return arg === UNDEF_VALUE; 1644} 1645// @__NO_SIDE_EFFECTS__ 1646function isNullOrUndefined(value) {
1647 return value === NULL_VALUE || /* @__PURE__ */ isUndefined(value); 1648} 1649// @__NO_SIDE_EFFECTS__ 1650function isStrictNullOrUndefined(value) { 1651 return value === NULL_VALUE || value === UNDEF_VALUE; 1652} 1653// @__NO_SIDE_EFFECTS__ 1654function isDefined(arg) { 1655 return !!arg || arg !== UNDEF_VALUE; 1656} 1657// @__NO_SIDE_EFFECTS__ 1658function isPrimitiveType(theType) { 1659 !_primitiveTypes && (_primitiveTypes = ["string", "number", "boolean", UNDEFINED, "symbol", "bigint"]); 1660 return !!(theType !== OBJECT && _primitiveTypes.indexOf(theType) !== -1); 1661} 1662var isString = /* @__PURE__ */ _createIs("string"); 1663var isFunction = /* @__PURE__ */ _createIs(FUNCTION); 1664// @__NO_SIDE_EFFECTS__ 1665function isObject(value) { 1666 if (!value && /* @__PURE__ */ isNullOrUndefined(value)) { 1667 return false; 1668 } 1669 return !!value && typeof value === OBJECT; 1670} 1671var isArray = /* @__PURE__ */ _pureRef(ArrCls, "isArray"); 1672var isDate = /* @__PURE__ */ _createObjIs("Date"); 1673var isNumber = /* @__PURE__ */ _createIs("number"); 1674var isBoolean = /* @__PURE__ */ _createIs("boolean"); 1675var isError = /* @__PURE__ */ _createObjIs("Error"); 1676// @__NO_SIDE_EFFECTS__ 1677function isPromiseLike(value) { 1678 return !!(value && value.then && isFunction(value.then)); 1679} 1680// @__NO_SIDE_EFFECTS__ 1681function isTruthy(value) { 1682 return !(!value || /* @__PURE__ */ safeGet(function() { 1683 return !(value && 0 + value); 1684 }, !value)); 1685} 1686function _returnNothing() { 1687 return; 1688} 1689function _returnFalse() { 1690 return false; 1691} 1692var asString = /* @__PURE__ */ _pureAssign(StrCls); 1693var ERROR_TYPE = "[object Error]"; 1694// @__NO_SIDE_EFFECTS__ 1695function dumpObj(object, format) { 1696 var propertyValueDump = EMPTY; 1697 var objType = ObjProto$1[TO_STRING][CALL](object); 1698 if (objType === ERROR_TYPE) { 1699 object = { stack: asString(object.stack), message: asString(object.message), name: asString(object.name) }; 1700 } 1701 try { 1702 propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? typeof format === "number" ? format : 4 : UNDEF_VALUE); 1703 propertyValueDump = (propertyValueDump ? propertyValueDump.replace(/"(\w+)"\s*:\s{0,1}/g, "$1: ") : NULL_VALUE) || asString(object); 1704 } catch (e) { 1705 propertyValueDump = " - " + /* @__PURE__ */ dumpObj(e, format); 1706 } 1707 return objType + ": " + propertyValueDump; 1708} 1709function throwError(message) { 1710 throw new Error(message); 1711} 1712function throwTypeError(message) { 1713 throw new TypeError(message); 1714} 1715function _throwIfNullOrUndefined(obj) { 1716 if (/* @__PURE__ */ isStrictNullOrUndefined(obj)) { 1717 throwTypeError("Cannot convert undefined or null to object"); 1718 } 1719} 1720function _throwIfNotString(value) { 1721 if (!isString(value)) { 1722 throwTypeError("'" + /* @__PURE__ */ dumpObj(value) + "' is not a string"); 1723 } 1724} 1725// @__NO_SIDE_EFFECTS__ 1726function objHasOwnProperty(obj, prop) { 1727 return !!obj && ObjProto$1.hasOwnProperty[CALL](obj, prop); 1728} 1729var _objGetOwnPropertyDescriptor$2 = /* @__PURE__ */ _pureAssign(/* @__PURE__ */ _pureRef(ObjClass$1, GET_OWN_PROPERTY_DESCRIPTOR), _returnNothing); 1730var objHasOwn = /* @__PURE__ */ _pureAssign(/* @__PURE__ */ _pureRef(ObjClass$1, "hasOwn"), polyObjHasOwn); 1731// @__NO_SIDE_EFFECTS__ 1732function polyObjHasOwn(obj, prop) { 1733 _throwIfNullOrUndefined(obj); 1734 return /* @__PURE__ */ objHasOwnProperty(obj, prop) || !!_objGetOwnPropertyDescriptor$2(obj, prop); 1735} 1736function objForEachKey(theObject, callbackfn, thisArg) { 1737 if (theObject && (/* @__PURE__ */ isObject(theObject) || isFunction(theObject))) { 1738 for (var prop in theObject) { 1739 if (objHasOwn(theObject, prop)) { 1740 if (callbackfn[CALL](theObject, prop, theObject[prop]) === -1) { 1741 break; 1742 } 1743 } 1744 } 1745 } 1746} 1747function arrForEach(theArray, callbackfn, thisArg) { 1748 if (theArray) { 1749 var len = theArray[LENGTH] >>> 0; 1750 for (var idx = 0; idx < len; idx++) { 1751 if (idx in theArray) { 1752 if (callbackfn[CALL](theArray, theArray[idx], idx, theArray) === -1) { 1753 break; 1754 } 1755 } 1756 } 1757 } 1758} 1759var _unwrapFunction = _unwrapFunctionWithPoly; 1760// @__NO_SIDE_EFFECTS__ 1761function _unwrapFunctionWithPoly(funcName, clsProto, polyFunc) { 1762 var clsFn = clsProto ? clsProto[funcName] : NULL_VALUE; 1763 return function(thisArg) {
1764 var theFunc = (thisArg ? thisArg[funcName] : NULL_VALUE) || clsFn; 1765 if (theFunc || polyFunc) { 1766 var theArgs = arguments; 1767 return (theFunc || polyFunc).apply(thisArg, theFunc ? ArrSlice[CALL](theArgs, 1) : theArgs); 1768 } 1769 throwTypeError('"' + asString(funcName) + '" not defined for ' + /* @__PURE__ */ dumpObj(thisArg)); 1770 }; 1771} 1772// @__NO_SIDE_EFFECTS__ 1773function _unwrapProp(propName) { 1774 return function(thisArg) { 1775 return thisArg[propName]; 1776 }; 1777} 1778var _objGetOwnPropertyDescriptor$1 = /* @__PURE__ */ _pureAssign(/* @__PURE__ */ _pureRef(ObjClass$1, GET_OWN_PROPERTY_DESCRIPTOR), _returnNothing); 1779var propMap = { 1780 e: "enumerable", 1781 c: "configurable", 1782 v: "value", 1783 w: "writable", 1784 g: "get", 1785 s: "set" 1786}; 1787// @__NO_SIDE_EFFECTS__ 1788function _createProp(value) { 1789 var prop = {}; 1790 prop[propMap["c"]] = true; 1791 prop[propMap["e"]] = true; 1792 if (value.l) { 1793 prop.get = function() { 1794 return value.l.v; 1795 }; 1796 var desc = _objGetOwnPropertyDescriptor$1(value.l, "v"); 1797 if (desc && desc.set) { 1798 prop.set = function(newValue) { 1799 value.l.v = newValue; 1800 }; 1801 } 1802 } 1803 objForEachKey(value, function(key, value2) { 1804 prop[propMap[key]] = /* @__PURE__ */ isStrictUndefined(value2) ? prop[propMap[key]] : value2; 1805 }); 1806 return prop; 1807} 1808var objDefineProp = /* @__PURE__ */ _pureRef(ObjClass$1, "defineProperty"); 1809var objDefineProperties = /* @__PURE__ */ _pureRef(ObjClass$1, "defineProperties"); 1810function objDefine(target, key, propDesc) { 1811 return objDefineProp(target, key, /* @__PURE__ */ _createProp(propDesc)); 1812} 1813// @__NO_SIDE_EFFECTS__ 1814function _createKeyValueMap(values, keyType, valueType, completeFn, writable) { 1815 var theMap = {}; 1816 objForEachKey(values, function(key, value) { 1817 _assignMapValue(theMap, key, keyType ? value : key); 1818 _assignMapValue(theMap, value, key); 1819 }); 1820 return completeFn ? completeFn(theMap) : theMap; 1821} 1822function _assignMapValue(theMap, key, value, writable) { 1823 objDefineProp(theMap, key, { 1824 value, 1825 enumerable: true, 1826 writable: false 1827 }); 1828} 1829var objIsFrozen = /* @__PURE__ */ _pureAssign(/* @__PURE__ */ _pureRef(ObjClass$1, "isFrozen"), _returnFalse); 1830var _objFreeze = /* @__PURE__ */ _pureRef(ObjClass$1, "freeze"); 1831function _doNothing(value) { 1832 return value; 1833} 1834// @__NO_SIDE_EFFECTS__ 1835function _getProto(value) { 1836 _throwIfNullOrUndefined(value); 1837 return value[__PROTO__] || NULL_VALUE; 1838} 1839var objAssign = /* @__PURE__ */ _pureRef(ObjClass$1, "assign"); 1840var objKeys = /* @__PURE__ */ _pureRef(ObjClass$1, "keys"); 1841function _deepFreeze(val, visited) {
1842 if ((isArray(val) || /* @__PURE__ */ isObject(val) || isFunction(val)) && !objIsFrozen(val)) { 1843 for (var lp = 0; lp < visited.length; lp++) { 1844 if (visited[lp] === val) { 1845 return val; 1846 } 1847 } 1848 visited.push(val); 1849 objForEachKey(val, function(_key, propValue) { 1850 _deepFreeze(propValue, visited); 1851 }); 1852 objFreeze(val); 1853 } 1854 return val; 1855} 1856function objDeepFreeze(value) { 1857 return _objFreeze ? _deepFreeze(value, []) : value; 1858} 1859var objFreeze = /* @__PURE__ */ _pureAssign(_objFreeze, _doNothing); 1860var objGetPrototypeOf = /* @__PURE__ */ _pureAssign(/* @__PURE__ */ _pureRef(ObjClass$1, "getPrototypeOf"), _getProto); 1861// @__NO_SIDE_EFFECTS__ 1862function createEnum(values) { 1863 return /* @__PURE__ */ _createKeyValueMap(values, 1, 0, objFreeze); 1864} 1865// @__NO_SIDE_EFFECTS__ 1866function createEnumKeyMap(values) { 1867 return /* @__PURE__ */ _createKeyValueMap(values, 0, 0, objFreeze); 1868} 1869// @__NO_SIDE_EFFECTS__ 1870function createSimpleMap(values) { 1871 var mapClass = {}; 1872 objForEachKey(values, function(key, value) { 1873 _assignMapValue(mapClass, key, value[1]); 1874 _assignMapValue(mapClass, value[0], value[1]); 1875 }); 1876 return objFreeze(mapClass); 1877} 1878// @__NO_SIDE_EFFECTS__ 1879function createTypeMap(values) { 1880 return /* @__PURE__ */ createSimpleMap(values); 1881} 1882var _wellKnownSymbolMap = /* @__PURE__ */ createEnumKeyMap({ 1883 asyncIterator: 0, 1884 hasInstance: 1, 1885 isConcatSpreadable: 2, 1886 iterator: 3, 1887 match: 4, 1888 matchAll: 5, 1889 replace: 6, 1890 search: 7, 1891 species: 8, 1892 split: 9, 1893 toPrimitive: 10, 1894 toStringTag: 11, 1895 unscopables: 12 1896}); 1897var GLOBAL_CONFIG_KEY = "__tsUtils$gblCfg"; 1898var _globalCfg; 1899// @__NO_SIDE_EFFECTS__ 1900function _getGlobalValue() { 1901 var result; 1902 if (typeof globalThis !== UNDEFINED) { 1903 result = globalThis; 1904 } 1905 if (!result && typeof self !== UNDEFINED) { 1906 result = self; 1907 } 1908 if (!result && typeof window !== UNDEFINED) { 1909 result = window; 1910 } 1911 if (!result && typeof global !== UNDEFINED) { 1912 result = global; 1913 } 1914 return result; 1915} 1916// @__NO_SIDE_EFFECTS__ 1917function _getGlobalConfig() { 1918 if (!_globalCfg) { 1919 var gbl = safe(_getGlobalValue).v || {}; 1920 _globalCfg = gbl[GLOBAL_CONFIG_KEY] = gbl[GLOBAL_CONFIG_KEY] || {}; 1921 } 1922 return _globalCfg; 1923} 1924var mathMin = /* @__PURE__ */ _pureRef(MathCls, "min"); 1925var mathMax = /* @__PURE__ */ _pureRef(MathCls, "max"); 1926var strSlice = /* @__PURE__ */ _unwrapFunction("slice", StrProto); 1927var strSubstring = /* @__PURE__ */ _unwrapFunction("substring", StrProto); 1928var strSubstr = /* @__PURE__ */ _unwrapFunctionWithPoly("substr", StrProto, polyStrSubstr); 1929// @__NO_SIDE_EFFECTS__ 1930function polyStrSubstr(value, start, length) { 1931 _throwIfNullOrUndefined(value); 1932 if (length < 0) { 1933 return EMPTY; 1934 } 1935 start = start || 0; 1936 if (start < 0) { 1937 start = mathMax(start + value[LENGTH], 0); 1938 } 1939 if (/* @__PURE__ */ isUndefined(length)) { 1940 return strSlice(value, start); 1941 } 1942 return strSlice(value, start, start + length); 1943} 1944// @__NO_SIDE_EFFECTS__ 1945function strLeft(value, count) { 1946 return strSubstring(value, 0, count); 1947} 1948function _tagAsPolyfill(target, polyfillTypeName) { 1949 if (target) { 1950 safe(function() { 1951 target[POLYFILL_TAG] = true; 1952 target[POLYFILL_TYPE_NAME] = polyfillTypeName; 1953 }); 1954 safe(objDefine, [target, POLYFILL_TAG, { 1955 v: true, 1956 w: false, 1957 e: false 1958 }]); 1959 safe(objDefine, [target, POLYFILL_TYPE_NAME, { 1960 v: polyfillTypeName, 1961 w: false, 1962 e: false 1963 }]); 1964 } 1965 return target; 1966} 1967var objCreate = /* @__PURE__ */ _pureAssign(/* @__PURE__ */ _pureRef(ObjClass$1, "create"), polyObjCreate); 1968// @__NO_SIDE_EFFECTS__ 1969function polyObjCreate(obj, properties) { 1970 var newObj = null; 1971 function tempFunc() { 1972 } 1973 if (!/* @__PURE__ */ isStrictNullOrUndefined(obj)) { 1974 var type = typeof obj; 1975 if (type !== OBJECT && type !== FUNCTION) { 1976 throwTypeError("Prototype must be an Object or function: " + /* @__PURE__ */ dumpObj(obj)); 1977 } 1978 tempFunc[PROTOTYPE] = obj; 1979 safe(function() { 1980 tempFunc[__PROTO__] = obj; 1981 }); 1982 newObj = new tempFunc(); 1983 } else { 1984 newObj = {}; 1985 } 1986 if (properties) { 1987 safe(objDefineProperties, [newObj, properties]); 1988 } 1989 return newObj; 1990} 1991// @__NO_SIDE_EFFECTS__ 1992function utcNow() { 1993 return (Date.now || polyUtcNow)(); 1994} 1995// @__NO_SIDE_EFFECTS__ 1996function polyUtcNow() { 1997 return (/* @__PURE__ */ new Date()).getTime(); 1998} 1999function fnApply(fn, thisArg, argArray) { 2000 return fn.apply(thisArg, argArray); 2001} 2002var _globalLazyTestHooks; 2003function _initTestHooks() { 2004 _globalLazyTestHooks = /* @__PURE__ */ _getGlobalConfig(); 2005} 2006// @__NO_SIDE_EFFECTS__ 2007function getLazy(cb, argArray) { 2008 var lazyValue = {}; 2009 !_globalLazyTestHooks && _initTestHooks(); 2010 lazyValue.b = _globalLazyTestHooks.lzy; 2011 objDefineProp(lazyValue, "v", { 2012 configurable: true, 2013 get: function() { 2014 var result = fnApply(cb, null, argArray); 2015 if (!_globalLazyTestHooks.lzy) { 2016 objDefineProp(lazyValue, "v", { 2017 value: result 2018 }); 2019 } 2020 lazyValue.b = _globalLazyTestHooks.lzy; 2021 return result; 2022 } 2023 }); 2024 return lazyValue; 2025} 2026var mathRandom = /* @__PURE__ */ _pureRef(MathCls, "random"); 2027var _uniqueInstanceId = /* @__PURE__ */ getLazy(function() { 2028 var value = (/* @__PURE__ */ utcNow()).toString(36).slice(2); 2029 while (value.length < 16) { 2030 value += mathRandom().toString(36).slice(2); 2031 } 2032 value = value.substring(0, 16); 2033 return value; 2034}); 2035var UNIQUE_REGISTRY_ID = "_urid"; 2036var POLY_SYM = "$nw21sym"; 2037var _polySymbols; 2038var _polyId = 0; 2039// @__NO_SIDE_EFFECTS__ 2040function _globalSymbolRegistry() { 2041 if (!_polySymbols) { 2042 var gblCfg = /* @__PURE__ */ _getGlobalConfig(); 2043 _polySymbols = gblCfg.gblSym = gblCfg.gblSym || { k: {}, s: {} }; 2044 } 2045 return _polySymbols; 2046} 2047var _wellKnownSymbolCache; 2048// @__NO_SIDE_EFFECTS__ 2049function polyNewSymbol(description) { 2050 var uniqueId = "_" + _polyId++ + "_" + _uniqueInstanceId.v; 2051 var symString = SYMBOL + "(" + description + ")"; 2052 function _setProp(name, value) { 2053 objDefine(theSymbol, name, { 2054 v: value, 2055 e: false, 2056 w: false 2057 }); 2058 } 2059 var theSymbol = objCreate(null); 2060 _setProp("description", asString(description)); 2061 _setProp(TO_STRING, function() { 2062 return symString + POLY_SYM + uniqueId; 2063 }); 2064 _setProp("valueOf", function() { 2065 return theSymbol; 2066 }); 2067 _setProp("v", symString); 2068 _setProp("_uid", uniqueId); 2069 return _tagAsPolyfill(theSymbol, "symbol"); 2070} 2071// @__NO_SIDE_EFFECTS__ 2072function polySymbolFor(key) { 2073 var registry = /* @__PURE__ */ _globalSymbolRegistry(); 2074 if (!objHasOwn(registry.k, key)) { 2075 var newSymbol_1 = /* @__PURE__ */ polyNewSymbol(key); 2076 var regId_1 = objKeys(registry.s).length; 2077 newSymbol_1[UNIQUE_REGISTRY_ID] = function() { 2078 return regId_1 + "_" + newSymbol_1[TO_STRING](); 2079 }; 2080 registry.k[key] = newSymbol_1; 2081 registry.s[newSymbol_1[UNIQUE_REGISTRY_ID]()] = asString(key); 2082 } 2083 return registry.k[key]; 2084} 2085// @__NO_SIDE_EFFECTS__ 2086function polyGetKnownSymbol(name) { 2087 !_wellKnownSymbolCache && (_wellKnownSymbolCache = {}); 2088 var result; 2089 var knownName = _wellKnownSymbolMap[name]; 2090 if (knownName) { 2091 result = _wellKnownSymbolCache[knownName] = _wellKnownSymbolCache[knownName] || /* @__P
2091URE__ */ polyNewSymbol(SYMBOL + "." + knownName); 2092 } 2093 return result; 2094} 2095// @__NO_SIDE_EFFECTS__ 2096function createCachedValue(value) { 2097 return objDefineProp({ 2098 toJSON: function() { 2099 return value; 2100 } 2101 }, "v", { value }); 2102} 2103var WINDOW = "window"; 2104var _cachedGlobal; 2105function _getGlobalInstFn(getFn, theArgs) { 2106 var cachedValue; 2107 return function() { 2108 !_globalLazyTestHooks && _initTestHooks(); 2109 if (!cachedValue || _globalLazyTestHooks.lzy) { 2110 cachedValue = /* @__PURE__ */ createCachedValue(safe(getFn, theArgs).v); 2111 } 2112 return cachedValue.v; 2113 }; 2114} 2115function getGlobal(useCached) { 2116 !_globalLazyTestHooks && _initTestHooks(); 2117 if (!_cachedGlobal || useCached === false || _globalLazyTestHooks.lzy) { 2118 _cachedGlobal = /* @__PURE__ */ createCachedValue(safe(_getGlobalValue).v || NULL_VALUE); 2119 } 2120 return _cachedGlobal.v; 2121} 2122// @__NO_SIDE_EFFECTS__ 2123function getInst(name, useCached) { 2124 var gbl; 2125 if (!_cachedGlobal || useCached === false) { 2126 gbl = getGlobal(useCached); 2127 } else { 2128 gbl = _cachedGlobal.v; 2129 } 2130 if (gbl && gbl[name]) { 2131 return gbl[name]; 2132 } 2133 if (name === WINDOW) { 2134 try { 2135 return window; 2136 } catch (e) { 2137 } 2138 } 2139 return NULL_VALUE; 2140} 2141// @__NO_SIDE_EFFECTS__ 2142function hasDocument() { 2143 return !!/* @__PURE__ */ getDocument(); 2144} 2145var getDocument = /* @__PURE__ */ _getGlobalInstFn(getInst, ["document"]); 2146// @__NO_SIDE_EFFECTS__ 2147function hasWindow() { 2148 return !!/* @__PURE__ */ getWindow(); 2149} 2150var getWindow = /* @__PURE__ */ _getGlobalInstFn(getInst, [WINDOW]); 2151// @__NO_SIDE_EFFECTS__ 2152function hasNavigator() { 2153 return !!/* @__PURE__ */ getNavigator(); 2154} 2155var getNavigator = /* @__PURE__ */ _getGlobalInstFn(getInst, ["navigator"]); 2156// @__NO_SIDE_EFFECTS__ 2157function hasHistory() { 2158 return !!/* @__PURE__ */ getHistory(); 2159} 2160var getHistory = /* @__PURE__ */ _getGlobalInstFn(getInst, ["history"]); 2161var isNode = /* @__PURE__ */ _getGlobalInstFn(function() { 2162 return !!safe(function() { 2163 return process && (process.versions || {}).node; 2164 }).v; 2165}); 2166var isWebWorker = /* @__PURE__ */ _getGlobalInstFn(function() { 2167 return !!safe(function() { 2168 return self && self instanceof WorkerGlobalScope; 2169 }).v; 2170}); 2171var _symbol; 2172var _symbolFor; 2173// @__NO_SIDE_EFFECTS__ 2174function _initSymbol() { 2175 _symbol = /* @__PURE__ */ createCachedValue(safe(getInst, [SYMBOL]).v); 2176 return _symbol; 2177} 2178function _getSymbolKey(key) { 2179 var gblSym = (!_globalLazyTestHooks.lzy ? _symbol : 0) || /* @__PURE__ */ _initSymbol(); 2180 return gblSym.v ? gblSym.v[key] : UNDEF_VALUE; 2181} 2182// @__NO_SIDE_EFFECTS__ 2183function hasSymbol() { 2184 return !!/* @__PURE__ */ getSymbol(); 2185} 2186// @__NO_SIDE_EFFECTS__ 2187function getSymbol() { 2188 !_globalLazyTestHooks && _initTestHooks(); 2189 return ((!_globalLazyTestHooks.lzy ? _symbol : 0) || /* @__PURE__ */ _initSymbol()).v; 2190} 2191// @__NO_SIDE_EFFECTS__ 2192function getKnownSymbol(name, noPoly) { 2193 var knownName = _wellKnownSymbolMap[name]; 2194 !_globalLazyTestHooks && _initTestHooks(); 2195 var sym = (!_globalLazyTestHooks.lzy ? _symbol : 0) || /* @__PURE__ */ _initSymbol();
2196 return sym.v ? sym.v[knownName || name] : true ? /* @__PURE__ */ polyGetKnownSymbol(name) : UNDEF_VALUE; 2197} 2198// @__NO_SIDE_EFFECTS__ 2199function newSymbol(description, noPoly) { 2200 !_globalLazyTestHooks && _initTestHooks(); 2201 var sym = (!_globalLazyTestHooks.lzy ? _symbol : 0) || /* @__PURE__ */ _initSymbol(); 2202 return sym.v ? sym.v(description) : /* @__PURE__ */ polyNewSymbol(description); 2203} 2204// @__NO_SIDE_EFFECTS__ 2205function symbolFor(key) { 2206 !_globalLazyTestHooks && _initTestHooks(); 2207 _symbolFor = (!_globalLazyTestHooks.lzy ? _symbolFor : 0) || /* @__PURE__ */ createCachedValue(safe(_getSymbolKey, ["for"]).v); 2208 return (_symbolFor.v || polySymbolFor)(key); 2209} 2210// @__NO_SIDE_EFFECTS__ 2211function isIterator(value) { 2212 return !!value && isFunction(value.next); 2213} 2214// @__NO_SIDE_EFFECTS__ 2215function isIterable(value) { 2216 return !/* @__PURE__ */ isStrictNullOrUndefined(value) && isFunction(value[/* @__PURE__ */ getKnownSymbol(3)]); 2217} 2218var _iterSymbol$1; 2219function iterForOf(iter, callbackfn, thisArg) { 2220 if (iter) { 2221 if (!/* @__PURE__ */ isIterator(iter)) { 2222 !_iterSymbol$1 && (_iterSymbol$1 = /* @__PURE__ */ createCachedValue(/* @__PURE__ */ getKnownSymbol(3))); 2223 iter = iter[_iterSymbol$1.v] ? iter[_iterSymbol$1.v]() : NULL_VALUE; 2224 } 2225 if (/* @__PURE__ */ isIterator(iter)) { 2226 var err = UNDEF_VALUE; 2227 var iterResult = UNDEF_VALUE; 2228 try { 2229 var count = 0; 2230 while (!(iterResult = iter.next()).done) { 2231 if (callbackfn[CALL](thisArg || iter, iterResult.value, count, iter) === -1) { 2232 break; 2233 } 2234 count++; 2235 } 2236 } catch (failed) { 2237 err = { e: failed }; 2238 if (iter.throw) { 2239 iterResult = NULL_VALUE; 2240 iter.throw(err); 2241 } 2242 } finally { 2243 try { 2244 if (iterResult && !iterResult.done) { 2245 iter.return && iter.return(iterResult); 2246 } 2247 } finally { 2248 if (err) { 2249 throw err.e; 2250 } 2251 } 2252 } 2253 } 2254 } 2255} 2256function arrAppend(target, elms) { 2257 if (!/* @__PURE__ */ isUndefined(elms) && target) { 2258 if (isArray(elms)) { 2259 fnApply(target.push, target, elms); 2260 } else if (/* @__PURE__ */ isIterator(elms) || /* @__PURE__ */ isIterable(elms)) { 2261 iterForOf(elms, function(elm) { 2262 target.push(elm); 2263 }); 2264 } else { 2265 target.push(elms); 2266 } 2267 } 2268 return target; 2269} 2270var arrIndexOf = /* @__PURE__ */ _unwrapFunction("indexOf", ArrProto); 2271var arrMap = /* @__PURE__ */ _unwrapFunction("map", ArrProto); 2272function arrSlice(theArray, start, end) { 2273 return ((theArray ? theArray["slice"] : NULL_VALUE) || ArrSlice).apply(theArray, ArrSlice[CALL](arguments, 1)); 2274} 2275var arrReduce = /* @__PURE__ */ _unwrapFunction("reduce", ArrProto); 2276var _isProtoArray; 2277var objSetPrototypeOf = /* @__PURE__ */ _pureAssign(/* @__PURE__ */ _pureRef(ObjClass$1, "setPrototypeOf"), _polyObjSetPrototypeOf); 2278function _polyObjSetPrototypeOf(obj, proto) { 2279 var _a2; 2280 !_isProtoArray && (_isProtoArray = /* @__PURE__ */ createCachedValue((_a2 = {}, _a2[__PROTO__] = [], _a2) instanceof Array)); 2281 _isProtoArray.v ? obj[__PROTO__] = proto : objForEachKey(proto, function(key, value) { 2282 return obj[key] = value; 2283 }); 2284 return obj; 2285} 2286// @__NO_SIDE_EFFECTS__ 2287function _createCustomError(name, d, b) { 2288 safe(objDefine, [d, NAME, { v: name, c: true, e: false }]); 2289 d = objSetPrototypeOf(d, b); 2290 function __() { 2291 this[CONSTRUCTOR] = d; 2292 safe(objDefine, [this, NAME, { v: name, c: true, e: false }]); 2293 } 2294 d[PROTOTYPE] = b === NULL_VALUE ? objCreate(b) : (__[PROTOTYPE] = b[PROTOTYPE], new __()); 2295 return d; 2296} 2297function _setName(baseClass, name) { 2298 name && (baseClass[NAME] = name); 2299} 2300// @__NO_SIDE_EFFECTS__ 2301function createCustomError(name, constructCb, errorBase) { 2302 var theBaseClass = Error; 2303 var orgName = theBaseClass[PROTOTYPE][NAME]; 2304 var captureFn = Error.captureStackTrace; 2305 return /* @__PURE__ */ _createCustomError(name, function() { 2306 var _this = this; 2307 var theArgs = arguments; 2308 try { 2309 safe(_setName, [theBaseClass, name]); 2310 var _self = fnApply(theBaseClass, _this, ArrSlice[CALL](theArgs)) || _this; 2311 if (_self !== _this) { 2312 var orgProto = objGetPrototypeOf(_this); 2313 if (orgProto !== objGetPrototypeOf(_self)) { 2314 objSetPrototypeOf(_self, orgProto); 2315 } 2316 } 2317 captureFn && captureFn(_self, _this[CONSTRUCTOR]); 2318 constructCb && constructCb(_self, theArgs); 2319 return _self; 2320 } finally { 2321 safe(_setName, [theBaseClass, orgName]); 2322 } 2323 }, theBaseClass); 2324} 2325var _unsupportedError; 2326function throwUnsupported(message) { 2327 if (!_unsupportedError) { 2328 _unsupportedError = /* @__PURE__ */ createCustomError("UnsupportedError"); 2329 } 2330 throw new _unsupportedError(message); 2331} 2332// @__NO_SIDE_EFFECTS__ 2333function _createTrimFn(exp) { 2334 return function _doTrim(value) { 2335 _throwIfNullOrUndefined(value); 2336 if (value && value.replace) { 2337 value = value.replace(exp, EMPTY); 2338 } 2339 return value; 2340 }; 2341} 2342var polyStrTrim = /* @__PURE__ */ _createTrimFn(/^\s+|(?=\s)\s+$/g); 2343var strTrim = /* @__PURE__ */ _unwrapFunctionWithPoly("trim", StrProto, polyStrTrim); 2344var mathFloor = /* @__PURE__ */ _pureRef(MathCls, "floor"); 2345var _fnToString; 2346var _objCtrFnString; 2347var _gblWindow; 2348// @__NO_SIDE_EFFECTS__ 2349function isPlainObject(value) { 2350 if (!value || typeof value !== OBJECT) { 2351 return false;
2352 } 2353 if (!_gblWindow) { 2354 _gblWindow = /* @__PURE__ */ hasWindow() ? getWindow() : true; 2355 } 2356 var result = false; 2357 if (value !== _gblWindow) { 2358 if (!_objCtrFnString) { 2359 _fnToString = Function[PROTOTYPE][TO_STRING]; 2360 _objCtrFnString = _fnToString[CALL](ObjClass$1); 2361 } 2362 try { 2363 var proto = objGetPrototypeOf(value); 2364 result = !proto; 2365 if (!result) { 2366 if (/* @__PURE__ */ objHasOwnProperty(proto, CONSTRUCTOR)) { 2367 proto = proto[CONSTRUCTOR]; 2368 } 2369 result = !!(proto && typeof proto === FUNCTION && _fnToString[CALL](proto) === _objCtrFnString); 2370 } 2371 } catch (ex) { 2372 } 2373 } 2374 return result; 2375} 2376// @__NO_SIDE_EFFECTS__ 2377function _defaultDeepCopyHandler(details) { 2378 details.value && plainObjDeepCopyHandler(details); 2379 return true; 2380} 2381var defaultDeepCopyHandlers = [ 2382 arrayDeepCopyHandler, 2383 plainObjDeepCopyHandler, 2384 functionDeepCopyHandler, 2385 dateDeepCopyHandler 2386]; 2387// @__NO_SIDE_EFFECTS__ 2388function _getSetVisited(visitMap, source, newPath, cb) { 2389 var theEntry; 2390 arrForEach(visitMap, function(entry2) { 2391 if (entry2.k === source) { 2392 theEntry = entry2; 2393 return -1; 2394 } 2395 }); 2396 if (!theEntry) { 2397 theEntry = { k: source, v: source }; 2398 visitMap.push(theEntry); 2399 cb(theEntry); 2400 } 2401 return theEntry.v; 2402} 2403function _deepCopy(visitMap, value, ctx, key) { 2404 var userHandler = ctx.handler; 2405 var newPath = ctx.path ? key ? ctx.path.concat(key) : ctx.path : []; 2406 var newCtx = { 2407 handler: ctx.handler, 2408 src: ctx.src, 2409 path: newPath 2410 }; 2411 var theType = typeof value; 2412 var isPlain = false; 2413 var isPrim = value === NULL_VALUE; 2414 if (!isPrim) { 2415 if (value && theType === OBJECT) { 2416 isPlain = /* @__PURE__ */ isPlainObject(value); 2417 } else { 2418 isPrim = /* @__PURE__ */ isPrimitiveType(theType); 2419 } 2420 } 2421 var details = { 2422 type: theType, 2423 isPrim, 2424 isPlain, 2425 value, 2426 result: value, 2427 path: newPath, 2428 origin: ctx.src, 2429 copy: function(source, newKey) { 2430 return _deepCopy(visitMap, source, newKey ? newCtx : ctx, newKey); 2431 }, 2432 copyTo: function(target, source) { 2433 return _copyProps(visitMap, target, source, newCtx); 2434 } 2435 }; 2436 if (!details.isPrim) { 2437 return /* @__PURE__ */ _getSetVisited(visitMap, value, newPath, function(newEntry) { 2438 objDefine(details, "result", { 2439 g: function() { 2440 return newEntry.v; 2441 }, 2442 s: function(newValue) { 2443 newEntry.v = newValue; 2444 } 2445 }); 2446 var idx = 0; 2447 var handler = userHandler; 2448 while (!(handler || (idx < defaultDeepCopyHandlers.length ? defaultDeepCopyHandlers[idx++] : _defaultDeepCopyHandler))[CALL](ctx, details)) { 2449 handler = NULL_VALUE; 2450 } 2451 }); 2452 } 2453 if (userHandler && userHandler[CALL](ctx, details)) { 2454 return details.result; 2455 } 2456 return value; 2457} 2458function _copyProps(visitMap, target, source, ctx) { 2459 if (!/* @__PURE__ */ isNullOrUndefined(source)) { 2460 for (var key in source) { 2461 target[key] = _deepCopy(visitMap, source[key], ctx, key); 2462 } 2463 } 2464 return target; 2465} 2466function objCopyProps(target, source, handler) { 2467 var ctx = { 2468 handler, 2469 src: source, 2470 path: [] 2471 }; 2472 return _copyProps([], target, source, ctx); 2473} 2474// @__NO_SIDE_EFFECTS__ 2475function objDeepCopy(source, handler) { 2476 var ctx = { 2477 handler, 2478 src: source 2479 }; 2480 return _deepCopy([], source, ctx); 2481} 2482function arrayDeepCopyHandler(details) { 2483 var value = details.value; 2484 if (isArray(value)) { 2485 var target = details.result = []; 2486 target.length = value.length; 2487 details.copyTo(target, value); 2488 return true; 2489 } 2490 return false; 2491} 2492function dateDeepCopyHandler(details) { 2493 var value = details.value; 2494 if (isDate(value)) { 2495 details.result = new Date(value.getTime()); 2496 return true; 2497 } 2498 return false; 2499} 2500function functionDeepCopyHandler(details) { 2501 if (details.type === FUNCTION) { 2502 return true; 2503 } 2504 return false; 2505} 2506function plainObjDeepCopyHandler(details) { 2507 var value = details.value; 2508 if (value && details.isPlain) { 2509 var target = details.result = {}; 2510 details.copyTo(target, value); 2511 return true; 2512 } 2513 return false;
2514} 2515function _doExtend(target, theArgs) { 2516 arrForEach(theArgs, function(theArg) { 2517 objCopyProps(target, theArg); 2518 }); 2519 return target; 2520} 2521function deepExtend(target, obj1, obj2, obj3, obj4, obj5, obj6) { 2522 return _doExtend(/* @__PURE__ */ objDeepCopy(target) || {}, ArrSlice[CALL](arguments)); 2523} 2524function objExtend$1(target, obj1, obj2, obj3, obj4, obj5, obj6) { 2525 return _doExtend(target || {}, ArrSlice[CALL](arguments)); 2526} 2527var strSplit = /* @__PURE__ */ _unwrapFunction("split", StrProto); 2528function setValueByKey(target, path, value) { 2529 if (target && path) { 2530 var parts = strSplit(path, "."); 2531 var lastKey = parts.pop(); 2532 arrForEach(parts, function(key) { 2533 if (/* @__PURE__ */ isNullOrUndefined(target[key])) { 2534 target[key] = {}; 2535 } 2536 target = target[key]; 2537 }); 2538 target[lastKey] = value; 2539 } 2540} 2541var getLength = /* @__PURE__ */ _unwrapProp(LENGTH); 2542var _perf; 2543// @__NO_SIDE_EFFECTS__ 2544function getPerformance() { 2545 !_globalLazyTestHooks && _initTestHooks(); 2546 if (!_perf || _globalLazyTestHooks.lzy) { 2547 _perf = /* @__PURE__ */ createCachedValue(safe(getInst, ["performance"]).v); 2548 } 2549 return _perf.v; 2550} 2551var mathRound = /* @__PURE__ */ _pureRef(MathCls, "round"); 2552var objGetOwnPropertyDescriptor = /* @__PURE__ */ _pureAssign(/* @__PURE__ */ _pureRef(ObjClass$1, GET_OWN_PROPERTY_DESCRIPTOR), _returnNothing); 2553var strEndsWith = /* @__PURE__ */ _unwrapFunctionWithPoly("endsWith", StrProto, polyStrEndsWith); 2554// @__NO_SIDE_EFFECTS__ 2555function polyStrEndsWith(value, searchString, length) { 2556 _throwIfNotString(value); 2557 var searchValue = isString(searchString) ? searchString : asString(searchString); 2558 var end = !/* @__PURE__ */ isUndefined(length) && length < value[LENGTH] ? length : value[LENGTH]; 2559 return strSubstring(value, end - searchValue[LENGTH], end) === searchValue; 2560} 2561var strIndexOf = /* @__PURE__ */ _unwrapFunction("indexOf", StrProto); 2562var REF = "ref"; 2563var UNREF$1 = "unref"; 2564var HAS_REF = "hasRef"; 2565var ENABLED = "enabled"; 2566// @__NO_SIDE_EFFECTS__ 2567function _createTimerHandler(startTimer, refreshFn, cancelFn) { 2568 var ref2 = true; 2569 var timerId = startTimer ? refreshFn(NULL_VALUE) : NULL_VALUE; 2570 var theTimerHandler; 2571 function _unref() { 2572 ref2 = false; 2573 timerId && timerId[UNREF$1] && timerId[UNREF$1](); 2574 return theTimerHandler; 2575 } 2576 function _cancel() { 2577 timerId && cancelFn(timerId); 2578 timerId = NULL_VALUE; 2579 } 2580 function _refresh() { 2581 timerId = refreshFn(timerId); 2582 if (!ref2) { 2583 _unref(); 2584 } 2585 return theTimerHandler; 2586 } 2587 function _setEnabled(value) { 2588 !value && timerId && _cancel(); 2589 value && !timerId && _refresh(); 2590 } 2591 theTimerHandler = { 2592 cancel: _cancel, 2593 refresh: _refresh 2594 }; 2595 theTimerHandler[HAS_REF] = function() { 2596 if (timerId && timerId[HAS_REF]) { 2597 return timerId[HAS_REF](); 2598 } 2599 return ref2; 2600 }; 2601 theTimerHandler[REF] = function() { 2602 ref2 = true; 2603 timerId && timerId[REF] && timerId[REF](); 2604 return theTimerHandler; 2605 }; 2606 theTimerHandler[UNREF$1] = _unref; 2607 theTimerHandler = objDefineProp(theTimerHandler, ENABLED, { 2608 get: function() { 2609 return !!timerId; 2610 }, 2611 set: _setEnabled 2612 }); 2613 return { 2614 h: theTimerHandler, 2615 dn: function() { 2616 timerId = NULL_VALUE; 2617 } 2618 }; 2619} 2620var _setTimeoutFn; 2621var _clearTimeoutFn; 2622function _resolveTimeoutFn(timeoutFn) { 2623 var result = isFunction(timeoutFn) ? timeoutFn : _setTimeoutFn; 2624 if (!result) { 2625 var globalOverrides = (/* @__PURE__ */ _getGlobalConfig()).tmOut || []; 2626 if (isArray(globalOverrides) && globalOverrides.length > 0 && isFunction(globalOverrides[0])) { 2627 result = globalOverrides[0]; 2628 } 2629 } 2630 return result || setTimeout; 2631} 2632function _resolveClearTimeoutFn(timeoutFn) { 2633 var result = isFunction(timeoutFn) ? timeoutFn : _clearTimeoutFn; 2634 if (!result) { 2635 var globalOverrides = (/* @__PURE__ */ _getGlobalConfig()).tmOut || []; 2636 if (isArray(globalOverrides) && globalOverrides.length > 1 && isFunction(globalOverrides[1])) { 2637 result = globalOverrides[1]; 2638 } 2639 } 2640 return result || clearTimeout; 2641} 2642function _createTimeoutWith(startTimer, overrideFn, theArgs) { 2643 var isArr = isArray(overrideFn); 2644 var len = isArr ? overrideFn.length : 0; 2645 var setFn = _resolveTimeoutFn(len >
vendor: 3,389 bytes, lines 2645-2739
2645 0 ? overrideFn[0] : !isArr ? overrideFn : UNDEF_VALUE); 2646 var clearFn = _resolveClearTimeoutFn(len > 1 ? overrideFn[1] : UNDEF_VALUE); 2647 var timerFn = theArgs[0]; 2648 theArgs[0] = function() { 2649 handler.dn(); 2650 fnApply(timerFn, UNDEF_VALUE, ArrSlice[CALL](arguments)); 2651 }; 2652 var handler = /* @__PURE__ */ _createTimerHandler(startTimer, function(timerId) { 2653 if (timerId) { 2654 if (timerId.refresh) { 2655 timerId.refresh(); 2656 return timerId; 2657 } 2658 fnApply(clearFn, UNDEF_VALUE, [timerId]); 2659 } 2660 return fnApply(setFn, UNDEF_VALUE, theArgs); 2661 }, function(timerId) { 2662 fnApply(clearFn, UNDEF_VALUE, [timerId]); 2663 }); 2664 return handler.h; 2665} 2666function scheduleTimeout(callback, timeout) { 2667 return _createTimeoutWith(true, UNDEF_VALUE, ArrSlice[CALL](arguments)); 2668} 2669function createTimeout(callback, timeout) { 2670 return _createTimeoutWith(false, UNDEF_VALUE, ArrSlice[CALL](arguments)); 2671} 2672var _a$a; 2673var Constructor = "constructor"; 2674var Prototype = "prototype"; 2675var strFunction = "function"; 2676var DynInstFuncTable = "_dynInstFuncs"; 2677var DynProxyTag = "_isDynProxy"; 2678var DynClassName = "_dynClass"; 2679var DynClassNamePrefix = "_dynCls$"; 2680var DynInstChkTag = "_dynInstChk"; 2681var DynAllowInstChkTag = DynInstChkTag; 2682var DynProtoDefaultOptions = "_dfOpts"; 2683var UnknownValue = "_unknown_"; 2684var str__Proto = "__proto__"; 2685var DynProtoBaseProto = "_dyn" + str__Proto; 2686var DynProtoGlobalSettings = "__dynProto$Gbl"; 2687var DynProtoCurrent = "_dynInstProto"; 2688var strUseBaseInst = "useBaseInst"; 2689var strSetInstFuncs = "setInstFuncs"; 2690var Obj = Object; 2691var _objGetPrototypeOf = Obj["getPrototypeOf"]; 2692var _objGetOwnProps = Obj["getOwnPropertyNames"]; 2693var _gbl = getGlobal(); 2694var _gblInst = _gbl[DynProtoGlobalSettings] || (_gbl[DynProtoGlobalSettings] = { 2695 o: (_a$a = {}, _a$a[strSetInstFuncs] = true, _a$a[strUseBaseInst] = true, _a$a), 2696 n: 1e3 2697 // Start new global index @ 1000 so we "fix" some cases when mixed with 1.1.6 or earlier 2698}); 2699function _isObjectOrArrayPrototype(target) { 2700 return target && (target === Obj[Prototype] || target === Array[Prototype]); 2701} 2702function _isObjectArrayOrFunctionPrototype(target) { 2703 return _isObjectOrArrayPrototype(target) || target === Function[Prototype]; 2704} 2705function _getObjProto$1(target) { 2706 var newProto; 2707 if (target) { 2708 if (_objGetPrototypeOf) { 2709 return _objGetPrototypeOf(target); 2710 } 2711 var curProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null); 2712 newProto = target[DynProtoBaseProto] || curProto; 2713 if (!/* @__PURE__ */ objHasOwnProperty(target, DynProtoBaseProto)) { 2714 delete target[DynProtoCurrent]; 2715 newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto]; 2716 target[DynProtoCurrent] = curProto; 2717 } 2718 } 2719 return newProto; 2720} 2721function _forEachProp(target, func) { 2722 var props = []; 2723 if (_objGetOwnProps) { 2724 props = _objGetOwnProps(target); 2725 } else { 2726 for (var name_1 in target) { 2727 if (typeof name_1 === "string" && /* @__PURE__ */ objHasOwnProperty(target, name_1)) { 2728 props.push(name_1); 2729 } 2730 } 2731 } 2732 if (props && props.length > 0) { 2733 for (var lp = 0; lp < props.length; lp++) { 2734 func(props[lp]); 2735 } 2736 } 2737} 2738function _isDynamicCandidate(target, funcName, skipOwn) { 2739 return funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || /* @__P
2739URE__ */ objHasOwnProperty(target, funcName)) && funcName !== str__Proto && funcName !== Prototype; 2740} 2741function _throwTypeError(message) { 2742 throwTypeError("DynamicProto: " + message); 2743} 2744function _getInstanceFuncs(thisTarget) { 2745 var instFuncs = objCreate(null); 2746 _forEachProp(thisTarget, function(name) { 2747 if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) { 2748 instFuncs[name] = thisTarget[name]; 2749 } 2750 }); 2751 return instFuncs; 2752} 2753function _hasVisited(values, value) { 2754 for (var lp = values.length - 1; lp >= 0; lp--) { 2755 if (values[lp] === value) { 2756 return true; 2757 } 2758 } 2759 return false; 2760} 2761function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) { 2762 function _instFuncProxy(target, funcHost, funcName) { 2763 var theFunc = funcHost[funcName]; 2764 if (theFunc[DynProxyTag] && useBaseInst) { 2765 var instFuncTable = target[DynInstFuncTable] || {}; 2766 if (instFuncTable[DynAllowInstChkTag] !== false) { 2767 theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc; 2768 } 2769 } 2770 return function() { 2771 return theFunc.apply(target, arguments); 2772 }; 2773 } 2774 var baseFuncs = objCreate(null); 2775 _forEachProp(instFuncs, function(name) { 2776 baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name); 2777 }); 2778 var baseProto = _getObjProto$1(classProto); 2779 var visited = []; 2780 while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) { 2781 _forEachProp(baseProto, function(name) { 2782 if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) { 2783 baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name); 2784 } 2785 }); 2786 visited.push(baseProto); 2787 baseProto = _getObjProto$1(baseProto); 2788 } 2789 return baseFuncs; 2790} 2791function _getInstFunc(target, funcName, proto, currentDynProtoProxy) { 2792 var instFunc = null; 2793 if (target && /* @__PURE__ */ objHasOwnProperty(proto, DynClassName)) { 2794 var instFuncTable = target[DynInstFuncTable] || objCreate(null); 2795 instFunc = (instFuncTable[proto[DynClassName]] || objCreate(null))[funcName]; 2796 if (!instFunc) { 2797 _throwTypeError("Missing [" + funcName + "] " + strFunction); 2798 } 2799 if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) { 2800 var canAddInst = !/* @__PURE__ */ objHasOwnProperty(target, funcName); 2801 var objProto = _getObjProto$1(target); 2802 var visited = []; 2803 while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) { 2804 var protoFunc = objProto[funcName]; 2805 if (protoFunc) { 2806 canAddInst = protoFunc === currentDynProtoProxy; 2807 break; 2808 } 2809 visited.push(objProto); 2810 objProto = _getObjProto$1(objProto); 2811 } 2812 try { 2813 if (canAddInst) { 2814 target[funcName] = instFunc; 2815 } 2816 instFunc[DynInstChkTag] = 1; 2817 } catch (e) { 2818 instFuncTable[DynAllowInstChkTag] = false; 2819 } 2820 } 2821 } 2822 return instFunc; 2823} 2824function _getProtoFunc(funcName, proto, currentDynProtoProxy) { 2825 var protoFunc = proto[funcName]; 2826 if (protoFunc === currentDynProtoProxy) { 2827 protoFunc = _getObjProto$1(proto)[funcName]; 2828 } 2829 if (typeof protoFunc !== strFunction) { 2830 _throwTypeError("[" + funcName + "] is not a " + strFunction); 2831 } 2832 return protoFunc; 2833} 2834function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) { 2835 function _createDynamicPrototype(proto2, funcName) { 2836 var dynProtoProxy = function() { 2837 var instFunc = _getInstFunc(this, funcName, proto2, dynProtoProxy) || _getProtoFunc(funcName, proto2, dynProtoProxy); 2838 return instFunc.apply(this, arguments); 2839 }; 2840 dynProtoProxy[DynProxyTag] = 1; 2841 return dynProtoProxy; 2842 } 2843 if (!_isObjectOrArrayPrototype(proto)) { 2844 var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || objCreate(null); 2845 if (!_isObjectOrArrayPrototype(instFuncTable)) { 2846 var instFuncs_1 = instFuncTable[className] = instFuncTable[className] || objCreate(null); 2847 if (instFuncTable[DynAllowInstChkTag] !== false) { 2848 instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc; 2849 } 2850 if (!_isObjectOrArrayPrototype(instFuncs_1)) {
2851 _forEachProp(target, function(name) { 2852 if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) { 2853 instFuncs_1[name] = target[name]; 2854 delete target[name]; 2855 if (!/* @__PURE__ */ objHasOwnProperty(proto, name) || proto[name] && !proto[name][DynProxyTag]) { 2856 proto[name] = _createDynamicPrototype(proto, name); 2857 } 2858 } 2859 }); 2860 } 2861 } 2862 } 2863} 2864function _checkPrototype(classProto, thisTarget) { 2865 if (_objGetPrototypeOf) { 2866 var visited = []; 2867 var thisProto = _getObjProto$1(thisTarget); 2868 while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) { 2869 if (thisProto === classProto) { 2870 return true; 2871 } 2872 visited.push(thisProto); 2873 thisProto = _getObjProto$1(thisProto); 2874 } 2875 return false; 2876 } 2877 return true; 2878} 2879function _getObjName(target, unknownValue) { 2880 if (/* @__PURE__ */ objHasOwnProperty(target, Prototype)) { 2881 return target.name || unknownValue || UnknownValue; 2882 } 2883 return ((target || {})[Constructor] || {}).name || unknownValue || UnknownValue; 2884} 2885function dynamicProto(theClass, target, delegateFunc, options) { 2886 if (!/* @__PURE__ */ objHasOwnProperty(theClass, Prototype)) { 2887 _throwTypeError("theClass is an invalid class definition."); 2888 } 2889 var classProto = theClass[Prototype]; 2890 if (!_checkPrototype(classProto, target)) { 2891 _throwTypeError("[" + _getObjName(theClass) + "] not in hierarchy of [" + _getObjName(target) + "]"); 2892 } 2893 var className = null; 2894 if (/* @__PURE__ */ objHasOwnProperty(classProto, DynClassName)) { 2895 className = classProto[DynClassName]; 2896 } else { 2897 className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _gblInst.n; 2898 _gblInst.n++; 2899 classProto[DynClassName] = className; 2900 } 2901 var perfOptions = dynamicProto[DynProtoDefaultOptions]; 2902 var useBaseInst = !!perfOptions[strUseBaseInst]; 2903 if (useBaseInst && options && options[strUseBaseInst] !== void 0) { 2904 useBaseInst = !!options[strUseBaseInst]; 2905 } 2906 var instFuncs = _getInstanceFuncs(target); 2907 var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst); 2908 delegateFunc(target, baseFuncs);
2909 var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs]; 2910 if (setInstanceFunc && options) { 2911 setInstanceFunc = !!options[strSetInstFuncs]; 2912 } 2913 _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false); 2914} 2915dynamicProto[DynProtoDefaultOptions] = _gblInst.o; 2916var strShimFunction = "function"; 2917var strShimObject = "object"; 2918var strShimUndefined = "undefined"; 2919var strShimPrototype = "prototype"; 2920var ObjClass = Object; 2921var ObjProto = ObjClass[strShimPrototype]; 2922(getGlobal() || {})["Symbol"]; 2923(getGlobal() || {})["Reflect"]; 2924var strHasOwnProperty = "hasOwnProperty"; 2925var __objAssignFnImpl = function(t) { 2926 for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { 2927 s2 = arguments[i2]; 2928 for (var p2 in s2) { 2929 if (ObjProto[strHasOwnProperty].call(s2, p2)) { 2930 t[p2] = s2[p2]; 2931 } 2932 } 2933 } 2934 return t; 2935}; 2936var __assignFn = objAssign || __objAssignFnImpl; 2937var extendStaticsFn = function(d, b) { 2938 extendStaticsFn = ObjClass["setPrototypeOf"] || // tslint:disable-next-line: only-arrow-functions 2939 { __proto__: [] } instanceof Array && function(d2, b2) { 2940 d2.__proto__ = b2; 2941 } || // tslint:disable-next-line: only-arrow-functions 2942 function(d2, b2) { 2943 for (var p2 in b2) { 2944 if (b2[strHasOwnProperty](p2)) { 2945 d2[p2] = b2[p2]; 2946 } 2947 } 2948 }; 2949 return extendStaticsFn(d, b); 2950}; 2951function __extendsFn(d, b) { 2952 if (typeof b !== strShimFunction && b !== null) { 2953 throwTypeError("Class extends value " + String(b) + " is not a constructor or null"); 2954 } 2955 extendStaticsFn(d, b); 2956 function __() { 2957 this.constructor = d; 2958 } 2959 d[strShimPrototype] = b === null ? objCreate(b) : (__[strShimPrototype] = b[strShimPrototype], new __()); 2960} 2961function __spreadArrayFn(to, from) { 2962 for (var i2 = 0, il = from.length, j = to.length; i2 < il; i2++, j++) { 2963 to[j] = from[i2]; 2964 } 2965 return to; 2966} 2967var createEnumStyle = createEnum; 2968var createValueMap = createTypeMap; 2969var ActiveStatus = createEnumStyle({ 2970 NONE: 0, 2971 PENDING: 3, 2972 INACTIVE: 1, 2973 ACTIVE: 2 2974 /* eActiveStatus.ACTIVE */ 2975}); 2976var _DYN_TO_LOWER_CASE$2 = "toLowerCase"; 2977var _DYN_LENGTH$4 = "length"; 2978var _DYN_WARN_TO_CONSOLE = "warnToConsole"; 2979var _DYN_THROW_INTERNAL = "throwInternal"; 2980var _DYN_WATCH = "watch"; 2981var _DYN_APPLY = "apply"; 2982var _DYN_PUSH$1 = "push"; 2983var _DYN_SPLICE = "splice"; 2984var _DYN_LOGGER = "logger"; 2985var _DYN_CANCEL = "cancel"; 2986var _DYN_INITIALIZE$1 = "initialize"; 2987var _DYN_IDENTIFIER = "identifier"; 2988var _DYN_REMOVE_NOTIFICATION_0 = "removeNotificationListener"; 2989var _DYN_ADD_NOTIFICATION_LIS1 = "addNotificationListener"; 2990var _DYN_IS_INITIALIZED = "isInitialized"; 2991var _DYN_GET_NOTIFY_MGR = "getNotifyMgr"; 2992var _DYN_GET_PLUGIN = "getPlugin"; 2993var _DYN_NAME$2 = "name"; 2994var _DYN_PROCESS_NEXT = "processNext"; 2995var _DYN_GET_PROCESS_TEL_CONT2 = "getProcessTelContext"; 2996var _DYN_VALUE = "value"; 2997var _DYN_ENABLED = "enabled"; 2998var _DYN_STOP_POLLING_INTERNA3 = "stopPollingInternalLogs"; 2999var _DYN_UNLOAD = "unload"; 3000var _DYN_ON_COMPLETE = "onComplete"; 3001var _DYN_VERSION$1 = "version"; 3002var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole"; 3003var _DYN_CREATE_NEW = "createNew"; 3004var _DYN_TEARDOWN = "teardown"; 3005var _DYN_MESSAGE_ID = "messageId"; 3006var _DYN_MESSAGE$1 = "message"; 3007var _DYN_DIAG_LOG$2 = "diagLog"; 3008var _DYN__DO_TEARDOWN = "_doTeardown"; 3009var _DYN_UPDATE = "update"; 3010var _DYN_GET_NEXT = "getNext"; 3011var _DYN_SET_NEXT_PLUGIN = "setNextPlugin"; 3012var _DYN_USER_AGENT = "userAgent"; 3013var _DYN_SPLIT$1 = "split"; 3014var _DYN_REPLACE = "replace"; 3015var _DYN_TYPE = "type"; 3016var _DYN_EVT_NAME = "evtName"; 3017var _DYN_STATUS$1 = "status"; 3018var _DYN_INDEX_OF = "indexOf"; 3019var _DYN_GET_ALL_RESPONSE_HEA5 = "getAllResponseHeaders"; 3020var _DYN_IS_CHILD_EVT = "isChildEvt"; 3021var _DYN_DATA$1 = "data"; 3022var _DYN_GET_CTX = "getCtx"; 3023var _DYN_SET_CTX = "setCtx"; 3024var _DYN_ITEMS_RECEIVED$1 = "itemsReceived"; 3025var _DYN_HEADERS$1 = "headers"; 3026var _DYN_URL_STRING = "urlString"; 3027var _DYN_TIMEOUT = "timeout"; 3028var _DYN_TRACE_FLAGS$1 = "traceFlags"; 3029var _DYN_GET_ATTRIBUTE = "getAttribute"; 3030var aggregationErrorType; 3031function throwAggregationError(message, sourceErrors) { 3032 if (!aggregationErrorType) { 3033 aggregationErrorType = /* @__PURE__ */ createCustomError("AggregationError", function(self2, args) { 3034 if (args[ 3035 _DYN_LENGTH$4 3036 /* @min:%2elength */ 3037 ] > 1) { 3038 self2.errors = args[1]; 3039 } 3040 }); 3041 } 3042 var theMessage = message; 3043 arrForEach(sourceErrors, function(srcError, idx) { 3044 theMessage += "\n".concat(idx, " > ").concat(/* @__PURE__ */ dumpObj(srcError)); 3045 }); 3046 throw new aggregationErrorType(theMessage, sourceErrors || []); 3047} 3048/*! 3049 * NevWare21 Solutions LLC - ts-async, 0.5.4 3050 * https://github.com/nevware21/ts-async 3051 * Copyright (c) NevWare21 Solutions LLC and contributors. All rights reserved. 3052 * Licensed under the MIT license. 3053 */ 3054var STR_PROMISE = "Promise"; 3055var REJECTED = "rejected"; 3056function doAwaitResponse(value, cb) { 3057 return doAwait(value, function(value2) { 3058 return cb ? cb({ 3059 status: "fulfilled", 3060 rejected: false, 3061 value: value2 3062 }) : value2; 3063 }, function(reason) { 3064 return cb ? cb({ 3065 status: REJECTED, 3066 rejected: true, 3067 reason 3068 }) : reason; 3069 }); 3070} 3071function doAwait(value, resolveFn, rejectFn, finallyFn) { 3072 var result = value; 3073 try { 3074 if (/* @__PURE__ */ isPromiseLike(value)) { 3075 if (resolveFn || rejectFn) { 3076 result = value.then(resolveFn, rejectFn); 3077 } 3078 } else {
3079 try { 3080 if (resolveFn) { 3081 result = resolveFn(value); 3082 } 3083 } catch (err) { 3084 if (rejectFn) { 3085 result = rejectFn(err); 3086 } else { 3087 throw err; 3088 } 3089 } 3090 } 3091 } finally { 3092 } 3093 return result; 3094} 3095var STRING_STATES = [ 3096 "pending", 3097 "resolving", 3098 "resolved", 3099 REJECTED 3100]; 3101var DISPATCH_EVENT = "dispatchEvent"; 3102var _hasInitEvent; 3103function _hasInitEventFn(doc) { 3104 var evt; 3105 if (doc && doc.createEvent) { 3106 evt = doc.createEvent("Event"); 3107 } 3108 return !!evt && evt.initEvent; 3109} 3110function emitEvent(target, evtName, populateEvent, useNewEvent) { 3111 var doc = getDocument(); 3112 !_hasInitEvent && (_hasInitEvent = /* @__PURE__ */ createCachedValue(!!safe(_hasInitEventFn, [doc]).v)); 3113 var theEvt = _hasInitEvent.v ? doc.createEvent("Event") : useNewEvent ? new Event(evtName) : {}; 3114 populateEvent && populateEvent(theEvt); 3115 if (_hasInitEvent.v) { 3116 theEvt.initEvent(evtName, false, true); 3117 } 3118 if (theEvt && target[DISPATCH_EVENT]) { 3119 target[DISPATCH_EVENT](theEvt); 3120 } else { 3121 var handler = target["on" + evtName]; 3122 if (handler) { 3123 handler(theEvt); 3124 } else { 3125 var theConsole = /* @__PURE__ */ getInst("console"); 3126 theConsole && (theConsole["error"] || theConsole["log"])(evtName, /* @__PURE__ */ dumpObj(theEvt)); 3127 } 3128 } 3129} 3130var NODE_UNHANDLED_REJECTION = "unhandledRejection"; 3131var UNHANDLED_REJECTION = NODE_UNHANDLED_REJECTION.toLowerCase(); 3132var _currentPromiseId = []; 3133var _uniquePromiseId = 0; 3134var _unhandledRejectionTimeout = 10; 3135var _hasPromiseRejectionEvent; 3136function dumpFnObj(value) { 3137 if (isFunction(value)) { 3138 return value.toString(); 3139 } 3140 return /* @__PURE__ */ dumpObj(value); 3141} 3142function _createPromise(newPromise, processor, executor) { 3143 var additionalArgs = arrSlice(arguments, 3); 3144 var _state = 0; 3145 var _hasResolved = false; 3146 var _settledValue; 3147 var _queue = []; 3148 var _id = _uniquePromiseId++; 3149 var _handled = false; 3150 var _unHandledRejectionHandler = null; 3151 var _thePromise; 3152 function _then(onResolved, onRejected) { 3153 try { 3154 _currentPromiseId.push(_id); 3155 _handled = true; 3156 _unHandledRejectionHandler && _unHandledRejectionHandler.cancel(); 3157 _unHandledRejectionHandler = null; 3158 var thenPromise = newPromise(function(resolve, reject) { 3159 _queue.push(function() { 3160 try { 3161 var handler = _state === 2 ? onResolved : onRejected; 3162 var value = /* @__PURE__ */ isUndefined(handler) ? _settledValue : isFunction(handler) ? handler(_settledValue) : handler; 3163 if (/* @__PURE__ */ isPromiseLike(value)) { 3164 value.then(resolve, reject); 3165 } else if (handler) { 3166 resolve(value); 3167 } else if (_state === 3) { 3168 reject(value); 3169 } else { 3170 resolve(value); 3171 } 3172 } catch (e) { 3173 reject(e); 3174 } 3175 }); 3176 if (_hasResolved) { 3177 _processQueue(); 3178 } 3179 }, additionalArgs); 3180 return thenPromise; 3181 } finally { 3182 _currentPromiseId.pop(); 3183 } 3184 } 3185 function _catch(onRejected) { 3186 return _then(void 0, onRejected); 3187 } 3188 function _finally(onFinally) { 3189 var thenFinally = onFinally; 3190 var catchFinally = onFinally; 3191 if (isFunction(onFinally)) { 3192 thenFinally = function(value) { 3193 onFinally && onFinally(); 3194 return value; 3195 }; 3196 catchFinally = function(reason) { 3197 onFinally && onFinally(); 3198 throw reason; 3199 }; 3200 } 3201 return _then(thenFinally, catchFinally); 3202 } 3203 function _strState() { 3204 return STRING_STATES[_state]; 3205 } 3206 function _processQueue() { 3207 if (_queue.length > 0) { 3208 var pending = _queue.slice(); 3209 _queue = []; 3210 _handled = true; 3211 _unHandledRejectionHandler && _unHandledRejectionHandler.cancel(); 3212 _unHandledRejectionHandler = null; 3213 processor(pending); 3214 } 3215 } 3216 function _createSettleIfFn(newState, allowState) { 3217 return function(theValue) { 3218 if (_state === allowState) { 3219 if (newState === 2 && /* @__PURE__ */ isPromiseLike(theValue)) { 3220 _state = 1; 3221 theValue.then(_createSettleIfFn(2, 1), _createSettleIfFn(3, 1)); 3222 return; 3223 } 3224 _state = newState; 3225 _hasResolved = true; 3226 _settledValue = theValue; 3227 _processQueue(); 3228 if (!_handled && newState === 3 && !_unHandledRejectionHandler) { 3229 _unHandledRejectionHandler = scheduleTimeout(_notifyUnhandledRejection, _unhandledRejectionTimeout); 3230 } 3231 } 3232 }; 3233 } 3234 function _notifyUnhandledRejection() { 3235 if (!_handled) { 3236 _handled = true; 3237 if (isNode()) { 3238 process.emit(NODE_UNHANDLED_REJECTION, _settledValue, _thePromise); 3239 } else { 3240 var gbl = getWindow() || getGlobal(); 3241 !_hasPromiseRejectionEvent && (_hasPromiseRejectionEvent = /* @__PURE__ */ createCachedValue(safe(getInst, [STR_PROMISE + "RejectionEvent"]).v)); 3242 emitEvent(gbl, UNHANDLED_REJECTION, function(theEvt) { 3243 objDefine(theEvt, "promise", { g: function() { 3244 return _thePromise; 3245 } }); 3246 theEvt.reason = _settledValue; 3247 return theEvt; 3248 }, !!_hasPromiseRejectionEvent.v); 3249 } 3250 } 3251 } 3252 _thePromise = { 3253 then: _then, 3254 "catch": _catch, 3255 finally: _finally 3256 }; 3257 objDefineProp(_thePromise, "state", { 3258 get: _strState 3259 }); 3260 if (/* @__PURE__ */ hasSymbol()) { 3261 _thePromise[/* @__PURE__ */ getKnownSymbol(11)] = "IPromise"; 3262 } 3263 function _toString() { 3264 return "IPromise " + _strState() + (_hasResolved ? " - " + dumpFnObj(_settledValue) : ""); 3265 } 3266 _thePromise.toString = _toString; 3267 (function _initialize() { 3268 if (!isFunction(executor)) { 3269 throwTypeError(STR_PROMISE + ": executor is not a function - " + dumpFnObj(executor)); 3270 } 3271 var _rejectFn = _createSettleIfFn(3, 0); 3272 try { 3273 executor.call(_thePromise, _createSettleIfFn(2, 0), _rejectFn); 3274 } catch (e) { 3275 _rejectFn(e); 3276 } 3277 })(); 3278 return _thePromise; 3279} 3280// @__NO_SIDE_EFFECTS__ 3281function _createAllPromise(newPromise) { 3282 return function(input) { 3283 var additionalArgs = arrSlice(arguments, 1); 3284 return newPromise(function(resolve, reject) {
3285 try { 3286 var values_1 = []; 3287 var pending_1 = 1; 3288 iterForOf(input, function(item, idx) { 3289 if (item) { 3290 pending_1++; 3291 doAwait(item, function(value) { 3292 values_1[idx] = value; 3293 if (--pending_1 === 0) { 3294 resolve(values_1); 3295 } 3296 }, reject); 3297 } 3298 }); 3299 pending_1--; 3300 if (pending_1 === 0) { 3301 resolve(values_1); 3302 } 3303 } catch (e) { 3304 reject(e); 3305 } 3306 }, additionalArgs); 3307 }; 3308} 3309// @__NO_SIDE_EFFECTS__ 3310function _createAllSettledPromise(newPromise) { 3311 return /* @__PURE__ */ createCachedValue(function(input) { 3312 var additionalArgs = arrSlice(arguments, 1); 3313 return newPromise(function(resolve, reject) { 3314 var values = []; 3315 var pending = 1; 3316 function processItem(item, idx) { 3317 pending++; 3318 doAwaitResponse(item, function(value) { 3319 if (value.rejected) { 3320 values[idx] = { 3321 status: REJECTED, 3322 reason: value.reason 3323 }; 3324 } else { 3325 values[idx] = { 3326 status: "fulfilled", 3327 value: value.value 3328 }; 3329 } 3330 if (--pending === 0) { 3331 resolve(values); 3332 } 3333 }); 3334 } 3335 try { 3336 if (isArray(input)) { 3337 arrForEach(input, processItem); 3338 } else if (/* @__PURE__ */ isIterable(input)) { 3339 iterForOf(input, processItem); 3340 } else { 3341 throwTypeError("Input is not an iterable"); 3342 } 3343 pending--; 3344 if (pending === 0) { 3345 resolve(values); 3346 } 3347 } catch (e) { 3348 reject(e); 3349 } 3350 }, additionalArgs); 3351 }); 3352} 3353function syncItemProcessor(pending) { 3354 arrForEach(pending, function(fn) { 3355 try { 3356 fn(); 3357 } catch (e) { 3358 } 3359 }); 3360} 3361function timeoutItemProcessor(timeout) { 3362 var callbackTimeout = isNumber(timeout) ? timeout : 0; 3363 return function(pending) { 3364 scheduleTimeout(function() { 3365 syncItemProcessor(pending); 3366 }, callbackTimeout); 3367 }; 3368} 3369function createAsyncPromise(executor, timeout) { 3370 return _createPromise(createAsyncPromise, timeoutItemProcessor(timeout), executor, timeout); 3371} 3372var _promiseCls; 3373function createNativePromise(executor, timeout) { 3374 !_promiseCls && (_promiseCls = /* @__PURE__ */ createCachedValue(safe(getInst, [STR_PROMISE]).v || null)); 3375 var PrmCls = _promiseCls.v; 3376 if (!PrmCls) { 3377 return createAsyncPromise(executor); 3378 } 3379 if (!isFunction(executor)) { 3380 throwTypeError(STR_PROMISE + ": executor is not a function - " + /* @__PURE__ */ dumpObj(executor)); 3381 } 3382 var _state = 0; 3383 function _strState() { 3384 return STRING_STATES[_state]; 3385 } 3386 var thePromise = new PrmCls(function(resolve, reject) { 3387 function _resolve(value) { 3388 _state = 2; 3389 resolve(value); 3390 } 3391 function _reject(reason) { 3392 _state = 3; 3393 reject(reason); 3394 } 3395 executor(_resolve, _reject); 3396 }); 3397 objDefineProp(thePromise, "state", { 3398 get: _strState 3399 }); 3400 return thePromise; 3401} 3402var _allSyncSettledCreator; 3403function createSyncPromise(executor) { 3404 return _createPromise(createSyncPromise, syncItemProcessor, executor); 3405} 3406function createSyncAllSettledPromise(input, timeout) { 3407 !_allSyncSettledCreator && (_allSyncSettledCreator = /* @__PURE__ */ _createAllSettledPromise(createSyncPromise)); 3408 return _allSyncSettledCreator.v(input, timeout); 3409} 3410var _promiseCreator; 3411function createPromise(executor, timeout) { 3412 !_promiseCreator && (_promiseCreator = /* @__PURE__ */ createCachedValue(createNativePromise)); 3413 return _promiseCreator.v.call(this, executor, timeout); 3414} 3415var createAllPromise = /* @__PURE__ */ _createAllPromise(createPromise); 3416var UNDEFINED_VALUE$2 = void 0; 3417var STR_EMPTY$1 = ""; 3418var STR_CHANNELS = "channels"; 3419var STR_CORE = "core"; 3420var STR_CREATE_PERF_MGR = "createPerfMgr"; 3421var STR_DISABLED = "disabled"; 3422var STR_EXTENSION_CONFIG = "extensionConfig"; 3423var STR_EXTENSIONS = "extensions"; 3424var STR_PROCESS_TELEMETRY = "processTelemetry"; 3425var STR_PRIORITY = "priority"; 3426var STR_EVENTS_SENT = "eventsSent"; 3427var STR_EVENTS_DISCARDED = "eventsDiscarded"; 3428var STR_EVENTS_SEND_REQUEST = "eventsSendRequest";
vendor: 2,696 bytes, lines 3429-3531
3429var STR_PERF_EVENT = "perfEvent"; 3430var STR_OFFLINE_STORE = "offlineEventsStored"; 3431var STR_OFFLINE_SENT = "offlineBatchSent"; 3432var STR_OFFLINE_DROP = "offlineBatchDrop"; 3433var STR_GET_PERF_MGR = "getPerfMgr"; 3434var STR_DOMAIN = "domain"; 3435var STR_PATH = "path"; 3436var STR_NOT_DYNAMIC_ERROR = "Not dynamic - "; 3437var strGetPrototypeOf = "getPrototypeOf"; 3438var rCamelCase = /-([a-z])/g; 3439var rNormalizeInvalid = /([^\w\d_$])/g; 3440var rLeadingNumeric = /^(\d+[\w\d_$])/; 3441var _getObjProto = Object[strGetPrototypeOf]; 3442function isNotNullOrUndefined(value) { 3443 return !/* @__PURE__ */ isNullOrUndefined(value); 3444} 3445function normalizeJsName(name) { 3446 var value = name; 3447 if (value && isString(value)) { 3448 value = value[ 3449 _DYN_REPLACE 3450 /* @min:%2ereplace */ 3451 ](rCamelCase, function(_all, letter) { 3452 return letter.toUpperCase(); 3453 }); 3454 value = value[ 3455 _DYN_REPLACE 3456 /* @min:%2ereplace */ 3457 ](rNormalizeInvalid, "_"); 3458 value = value[ 3459 _DYN_REPLACE 3460 /* @min:%2ereplace */ 3461 ](rLeadingNumeric, function(_all, match) { 3462 return "_" + match; 3463 }); 3464 } 3465 return value; 3466} 3467function strContains(value, search) { 3468 if (value && search) { 3469 return strIndexOf(value, search) !== -1; 3470 } 3471 return false; 3472} 3473function toISOString(date) { 3474 return date && date.toISOString() || ""; 3475} 3476function getExceptionName(object) { 3477 if (isError(object)) { 3478 return object[ 3479 _DYN_NAME$2 3480 /* @min:%2ename */ 3481 ]; 3482 } 3483 return STR_EMPTY$1; 3484} 3485function setValue(target, field, value, valChk, srcChk) { 3486 var theValue = value; 3487 if (target) { 3488 theValue = target[field]; 3489 if (theValue !== value && (!srcChk || srcChk(theValue)) && (!valChk || valChk(value))) { 3490 theValue = value; 3491 target[field] = theValue; 3492 } 3493 } 3494 return theValue; 3495} 3496function getSetValue(target, field, defValue) { 3497 var theValue; 3498 if (target) { 3499 theValue = target[field]; 3500 if (!theValue && /* @__PURE__ */ isNullOrUndefined(theValue)) { 3501 theValue = !/* @__PURE__ */ isUndefined(defValue) ? defValue : {}; 3502 target[field] = theValue; 3503 } 3504 } else { 3505 theValue = !/* @__PURE__ */ isUndefined(defValue) ? defValue : {}; 3506 } 3507 return theValue; 3508} 3509function _createProxyFunction(source, funcName) { 3510 var srcFunc = null; 3511 var src = null; 3512 if (isFunction(source)) { 3513 srcFunc = source; 3514 } else { 3515 src = source; 3516 } 3517 return function() { 3518 var originalArguments = arguments; 3519 if (srcFunc) { 3520 src = srcFunc(); 3521 } 3522 if (src) { 3523 return src[funcName][ 3524 _DYN_APPLY 3525 /* @min:%2eapply */ 3526 ](src, originalArguments); 3527 } 3528 }; 3529} 3530function proxyAssign(target, source, chkSet) { 3531 if (target && source && /* @__PURE__ */ isObject(target) && /* @__P
3531URE__ */ isObject(source)) { 3532 var _loop_1 = function(field2) { 3533 if (isString(field2)) { 3534 var value = source[field2]; 3535 if (isFunction(value)) { 3536 if (!chkSet || chkSet(field2, true, source, target)) { 3537 target[field2] = _createProxyFunction(source, field2); 3538 } 3539 } else if (!chkSet || chkSet(field2, false, source, target)) { 3540 if (objHasOwn(target, field2)) { 3541 delete target[field2]; 3542 } 3543 objDefine(target, field2, { 3544 g: function() { 3545 return source[field2]; 3546 }, 3547 s: function(theValue) { 3548 source[field2] = theValue; 3549 } 3550 }); 3551 } 3552 } 3553 }; 3554 for (var field in source) { 3555 _loop_1(field); 3556 } 3557 } 3558 return target; 3559} 3560function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) { 3561 if (target && name && source) { 3562 { 3563 target[name] = _createProxyFunction(source, theFunc); 3564 } 3565 } 3566} 3567function proxyFunctions(target, source, functionsToProxy, overwriteTarget) { 3568 if (target && source && /* @__PURE__ */ isObject(target) && isArray(functionsToProxy)) { 3569 arrForEach(functionsToProxy, function(theFuncName) { 3570 if (isString(theFuncName)) { 3571 proxyFunctionAs(target, theFuncName, source, theFuncName); 3572 } 3573 }); 3574 } 3575 return target; 3576} 3577function createClassFromInterface(defaults) { 3578 return ( 3579 /** @class */ 3580 /* @__PURE__ */ function() { 3581 function class_1() { 3582 var _this = this; 3583 if (defaults) { 3584 objForEachKey(defaults, function(field, value) { 3585 _this[field] = value; 3586 }); 3587 } 3588 } 3589 return class_1; 3590 }() 3591 ); 3592} 3593function optimizeObject(theObject) { 3594 if (theObject && objAssign) { 3595 theObject = ObjClass(objAssign({}, theObject)); 3596 } 3597 return theObject; 3598} 3599function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) { 3600 var theArgs = arguments; 3601 var extended = theArgs[0] || {}; 3602 var argLen = theArgs[ 3603 _DYN_LENGTH$4 3604 /* @min:%2elength */ 3605 ]; 3606 var deep = false; 3607 var idx = 1; 3608 if (argLen > 0 && isBoolean(extended)) { 3609 deep = extended; 3610 extended = theArgs[idx] || {}; 3611 idx++; 3612 } 3613 if (!/* @__PURE__ */ isObject(extended)) { 3614 extended = {}; 3615 } 3616 for (; idx < argLen; idx++) { 3617 var arg = theArgs[idx]; 3618 var isArgArray = isArray(arg); 3619 var isArgObj = /* @__PURE__ */ isObject(arg); 3620 for (var prop in arg) { 3621 var propOk = isArgArray && prop in arg || isArgObj && objHasOwn(arg, prop); 3622 if (!propOk) { 3623 continue; 3624 } 3625 var newValue = arg[prop]; 3626 var isNewArray = void 0; 3627 if (deep && newValue && ((isNewArray = isArray(newValue)) || /* @__PURE__ */ isPlainObject(newValue))) { 3628 var clone = extended[prop]; 3629 if (isNewArray) { 3630 if (!isArray(clone)) { 3631 clone = []; 3632 } 3633 } else if (!/* @__PURE__ */ isPlainObject(clone)) { 3634 clone = {}; 3635 } 3636 newValue = objExtend(deep, clone, newValue); 3637 } 3638 if (newValue !== void 0) { 3639 extended[prop] = newValue; 3640 } 3641 } 3642 } 3643 return extended; 3644} 3645function isFeatureEnabled(feature, cfg, sdkDefaultState) { 3646 var ft = cfg && cfg.featureOptIn && cfg.featureOptIn[feature]; 3647 if (feature && ft) { 3648 var mode = ft.mode; 3649 if (mode === 3) { 3650 return true; 3651 } else if (mode === 2) { 3652 return false; 3653 } 3654 } 3655 return sdkDefaultState; 3656} 3657function getResponseText(xhr) { 3658 try { 3659 return xhr.responseText; 3660 } catch (e) { 3661 } 3662 return null; 3663} 3664function formatErrorMessageXdr(xdr, message) { 3665 if (xdr) { 3666 return "XDomainRequest,Response:" + getResponseText(xdr) || ""; 3667 } 3668 return message; 3669} 3670function formatErrorMessageXhr(xhr, message) { 3671 if (xhr) { 3672 return "XMLHttpRequest,Status:" + xhr[ 3673 _DYN_STATUS$1 3674 /* @min:%2estatus */ 3675 ] + ",Response:" + getResponseText(xhr) || xhr.response || ""; 3676 } 3677 return message; 3678} 3679function prependTransports(theTransports, newTransports) { 3680 if (newTransports) { 3681 if (isNumber(newTransports)) { 3682 theTransports = [newTransports].concat(theTransports); 3683 } else if (isArray(newTransports)) { 3684 theTransports = newTransports.concat(theTransports); 3685 } 3686 } 3687 return theTransports; 3688}
3689var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation"; 3690var strWithCredentials = "withCredentials"; 3691var strTimeout = "timeout"; 3692function openXhr(method, urlString, withCredentials, disabled, isSync, timeout) { 3693 if (isSync === void 0) { 3694 isSync = false; 3695 } 3696 function _wrapSetXhrProp(xhr2, prop, value) { 3697 try { 3698 xhr2[prop] = value; 3699 } catch (e) { 3700 } 3701 } 3702 var xhr = new XMLHttpRequest(); 3703 { 3704 _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled); 3705 } 3706 if (withCredentials) { 3707 _wrapSetXhrProp(xhr, strWithCredentials, withCredentials); 3708 } 3709 xhr.open(method, urlString, !isSync); 3710 if (withCredentials) { 3711 _wrapSetXhrProp(xhr, strWithCredentials, withCredentials); 3712 } 3713 if (!isSync && timeout) { 3714 _wrapSetXhrProp(xhr, strTimeout, timeout); 3715 } 3716 return xhr; 3717} 3718function convertAllHeadersToMap(headersString) { 3719 var headers = {}; 3720 if (isString(headersString)) { 3721 var headersArray = strTrim(headersString)[ 3722 _DYN_SPLIT$1 3723 /* @min:%2esplit */ 3724 ](/[\r\n]+/); 3725 arrForEach(headersArray, function(headerEntry) { 3726 if (headerEntry) { 3727 var idx = headerEntry[ 3728 _DYN_INDEX_OF 3729 /* @min:%2eindexOf */ 3730 ](": "); 3731 if (idx !== -1) { 3732 var header = strTrim(headerEntry.substring(0, idx))[ 3733 _DYN_TO_LOWER_CASE$2 3734 /* @min:%2etoLowerCase */ 3735 ](); 3736 var value = strTrim(headerEntry.substring(idx + 1)); 3737 headers[header] = value; 3738 } else { 3739 headers[strTrim(headerEntry)] = 1; 3740 } 3741 } 3742 }); 3743 } 3744 return headers; 3745} 3746function _appendHeader(theHeaders, xhr, name) { 3747 if (!theHeaders[name] && xhr && xhr.getResponseHeader) { 3748 var value = xhr.getResponseHeader(name); 3749 if (value) { 3750 theHeaders[name] = strTrim(value); 3751 } 3752 } 3753 return theHeaders; 3754} 3755var STR_KILL_DURATION_HEADER = "kill-duration"; 3756var STR_KILL_DURATION_SECONDS_HEADER = "kill-duration-seconds"; 3757var STR_TIME_DELTA_HEADER = "time-delta-millis"; 3758function _getAllResponseHeaders(xhr, isOneDs) { 3759 var theHeaders = {}; 3760 if (!xhr[ 3761 _DYN_GET_ALL_RESPONSE_HEA5 3762 /* @min:%2egetAllResponseHeaders */ 3763 ]) { 3764 if (!!isOneDs) { 3765 theHeaders = _appendHeader(theHeaders, xhr, STR_TIME_DELTA_HEADER); 3766 theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_HEADER); 3767 theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER); 3768 } 3769 } else { 3770 theHeaders = convertAllHeadersToMap(xhr[ 3771 _DYN_GET_ALL_RESPONSE_HEA5 3772 /* @min:%2egetAllResponseHeaders */ 3773 ]()); 3774 } 3775 return theHeaders; 3776} 3777var strDocumentMode = "documentMode"; 3778var strLocation = "location"; 3779var strConsole = "console"; 3780var strJSON = "JSON"; 3781var strCrypto = "crypto"; 3782var strMsCrypto = "msCrypto"; 3783var strReactNative = "ReactNative"; 3784var strMsie = "msie"; 3785var strTrident = "trident/"; 3786var strXMLHttpRequest = "XMLHttpRequest"; 3787var _isTrident = null; 3788var _navUserAgentCheck = null; 3789var _enableMocks = false; 3790var _useXDomainRequest = null; 3791var _beaconsSupported = null; 3792function _hasProperty(theClass, property) { 3793 var supported = false; 3794 if (theClass) { 3795 try { 3796 supported = property in theClass; 3797 if (!supported) { 3798 var proto = theClass[strShimPrototype]; 3799 if (proto) { 3800 supported = property in proto; 3801 } 3802 } 3803 } catch (e) { 3804 } 3805 if (!supported) { 3806 try { 3807 var tmp = new theClass(); 3808 supported = !/* @__PURE__ */ isUndefined(tmp[property]); 3809 } catch (e) { 3810 } 3811 } 3812 } 3813 return supported; 3814} 3815function getLocation(checkForMock) { 3816 if (checkForMock && _enableMocks) { 3817 var mockLocation = /* @__PURE__ */ getInst("__mockLocation"); 3818 if (mockLocation) { 3819 return mockLocation; 3820 } 3821 } 3822 if (typeof location === strShimObject && location) { 3823 return location; 3824 } 3825 return /* @__PURE__ */ getInst(strLocation); 3826} 3827function getConsole() { 3828 if (typeof console !== strShimUndefined) { 3829 return console; 3830 } 3831 return /* @__PURE__ */ getInst(strConsole); 3832} 3833function hasJSON() { 3834 return Boolean(typeof JSON === strShimObject && JSON || /* @__P
3834URE__ */ getInst(strJSON) !== null); 3835} 3836function getJSON() { 3837 if (hasJSON()) { 3838 return JSON || /* @__PURE__ */ getInst(strJSON); 3839 } 3840 return null; 3841} 3842function getCrypto() { 3843 return /* @__PURE__ */ getInst(strCrypto); 3844} 3845function getMsCrypto() { 3846 return /* @__PURE__ */ getInst(strMsCrypto); 3847} 3848function isReactNative() { 3849 var nav = getNavigator(); 3850 if (nav && nav.product) { 3851 return nav.product === strReactNative; 3852 } 3853 return false; 3854} 3855function isIE() { 3856 var nav = getNavigator(); 3857 if (nav && (nav[ 3858 _DYN_USER_AGENT 3859 /* @min:%2euserAgent */ 3860 ] !== _navUserAgentCheck || _isTrident === null)) { 3861 _navUserAgentCheck = nav[ 3862 _DYN_USER_AGENT 3863 /* @min:%2euserAgent */ 3864 ]; 3865 var userAgent = (_navUserAgentCheck || STR_EMPTY$1)[ 3866 _DYN_TO_LOWER_CASE$2 3867 /* @min:%2etoLowerCase */ 3868 ](); 3869 _isTrident = strContains(userAgent, strMsie) || strContains(userAgent, strTrident); 3870 } 3871 return _isTrident; 3872} 3873function getIEVersion(userAgentStr) { 3874 if (userAgentStr === void 0) { 3875 userAgentStr = null; 3876 } 3877 if (!userAgentStr) { 3878 var navigator_1 = getNavigator() || {}; 3879 userAgentStr = navigator_1 ? (navigator_1.userAgent || STR_EMPTY$1)[ 3880 _DYN_TO_LOWER_CASE$2 3881 /* @min:%2etoLowerCase */ 3882 ]() : STR_EMPTY$1; 3883 } 3884 var ua = (userAgentStr || STR_EMPTY$1)[ 3885 _DYN_TO_LOWER_CASE$2 3886 /* @min:%2etoLowerCase */ 3887 ](); 3888 if (strContains(ua, strMsie)) { 3889 var doc = getDocument() || {}; 3890 return mathMax(parseInt(ua[ 3891 _DYN_SPLIT$1 3892 /* @min:%2esplit */ 3893 ](strMsie)[1]), doc[strDocumentMode] || 0); 3894 } else if (strContains(ua, strTrident)) { 3895 var tridentVer = parseInt(ua[ 3896 _DYN_SPLIT$1 3897 /* @min:%2esplit */ 3898 ](strTrident)[1]); 3899 if (tridentVer) { 3900 return tridentVer + 4; 3901 } 3902 } 3903 return null; 3904} 3905function isBeaconsSupported(useCached) { 3906 if (_beaconsSupported === null || useCached === false) { 3907 _beaconsSupported = /* @__PURE__ */ hasNavigator() && Boolean(getNavigator().sendBeacon); 3908 } 3909 return _beaconsSupported; 3910} 3911function isFetchSupported(withKeepAlive) { 3912 var isSupported = false; 3913 try { 3914 isSupported = !!/* @__PURE__ */ getInst("fetch"); 3915 var request = /* @__PURE__ */ getInst("Request"); 3916 if (isSupported && withKeepAlive && request) { 3917 isSupported = _hasProperty(request, "keepalive"); 3918 } 3919 } catch (e) { 3920 } 3921 return isSupported; 3922} 3923function useXDomainRequest() { 3924 if (_useXDomainRequest === null) { 3925 _useXDomainRequest = typeof XDomainRequest !== strShimUndefined; 3926 if (_useXDomainRequest && isXhrSupported()) { 3927 _useXDomainRequest = _useXDomainRequest && !_hasProperty(/* @__PURE__ */ getInst(strXMLHttpRequest), "withCredentials"); 3928 } 3929 } 3930 return _useXDomainRequest; 3931} 3932function isXhrSupported() { 3933 var isSupported = false; 3934 try { 3935 var xmlHttpRequest = /* @__PURE__ */ getInst(strXMLHttpRequest); 3936 isSupported = !!xmlHttpRequest; 3937 } catch (e) { 3938 } 3939 return isSupported; 3940} 3941function dispatchEvent(target, evnt) { 3942 if (target && target.dispatchEvent && evnt) { 3943 target.dispatchEvent(evnt); 3944 return true; 3945 } 3946 return false; 3947} 3948function createCustomDomEvent(eventName, details) { 3949 var event = null; 3950 var detail = { detail: details || null }; 3951 if (isFunction(CustomEvent)) { 3952 event = new CustomEvent(eventName, detail); 3953 } else { 3954 var doc = getDocument(); 3955 if (doc && doc.createEvent) { 3956 event = doc.createEvent("CustomEvent"); 3957 event.initCustomEvent(eventName, true, true, detail); 3958 } 3959 } 3960 return event; 3961} 3962function sendCustomEvent(evtName, cfg, customDetails) { 3963 var global2 = getGlobal(); 3964 if (global2 && global2.CustomEvent) { 3965 try { 3966 var details = { cfg: cfg || null, customDetails: customDetails || null }; 3967 return dispatchEvent(global2, createCustomDomEvent(evtName, details)); 3968 } catch (e) { 3969 } 3970 } 3971 return false; 3972} 3973var UInt32Mask = 4294967296; 3974var MaxUInt32 = 4294967295; 3975var SEED1 = 123456789; 3976var SEED2 = 987654321; 3977var _mwcSeeded = false; 3978var _mwcW = SEED1; 3979var _mwcZ = SEED2; 3980function _mwcSeed(seedValue) { 3981 if (seedValue < 0) { 3982 seedValue >>>= 0; 3983 } 3984 _mwcW = SEED1 + seedValue & MaxUInt32; 3985 _mwcZ = SEED2 - seedValue & MaxUInt32; 3986 _mwcSeeded = true; 3987} 3988function _autoSeedMwc() { 3989 try { 3990 var now = /* @__PURE__ */ utcNow() & 2147483647; 3991 _mwcSeed((Math.random() * UInt32Mask ^ now) + now); 3992 } catch (e) { 3993 } 3994} 3995function randomValue(maxValue) { 3996 { 3997 return mathFloor(random32() / MaxUInt32 * (maxValue + 1)) >>> 0; 3998 } 3999} 4000function random32(signed) { 4001 var value = 0; 4002 var c2 = getCrypto() || getMsCrypto(); 4003 if (c2 && c2.getRandomValues) { 4004 value = c2.getRandomValues(new Uint32Array(1))[0] & MaxUInt32; 4005 } 4006 if (value === 0 && isIE()) { 4007 if (!_mwcSeeded) { 4008 _autoSeedMwc(); 4009 } 4010 value = mwcRandom32() & MaxUInt32; 4011 } 4012 if (value === 0) { 4013 value = mathFloor(UInt32Mask * Math.random() | 0); 4014 } 4015 { 4016 value >>>= 0; 4017 } 4018 return value; 4019} 4020function mwcRandom32(signed) { 4021 _mwcZ = 36969 * (_mwcZ & 65535) + (_mwcZ >> 16) & MaxUInt32; 4022 _mwcW = 18e3 * (_mwcW & 65535) + (_mwcW >> 16) & MaxUInt32; 4023 var value = (_mwcZ << 16) + (_mwcW & 65535) >>> 0 & MaxUInt32 | 0; 4024 { 4025 value >>>= 0; 4026 } 4027 return value; 4028} 4029function newId(maxLength) { 4030 if (maxLength === void 0) { 4031 maxLength = 22; 4032 } 4033 var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
vendor: 34,480 bytes, lines 4033-5214
4033+/"; 4034 var number = random32() >>> 0; 4035 var chars = 0; 4036 var result = STR_EMPTY$1; 4037 while (result[ 4038 _DYN_LENGTH$4 4039 /* @min:%2elength */ 4040 ] < maxLength) { 4041 chars++; 4042 result += base64chars.charAt(number & 63); 4043 number >>>= 6; 4044 if (chars === 5) { 4045 number = (random32() << 2 & 4294967295 | number & 3) >>> 0; 4046 chars = 0; 4047 } 4048 } 4049 return result; 4050} 4051var version = "3.3.8"; 4052var instanceName = "." + newId(6); 4053var _dataUid = 0; 4054function _canAcceptData(target) { 4055 return target.nodeType === 1 || target.nodeType === 9 || !+target.nodeType; 4056} 4057function _getCache(data, target) { 4058 var theCache = target[data.id]; 4059 if (!theCache) { 4060 theCache = {}; 4061 try { 4062 if (_canAcceptData(target)) { 4063 objDefine(target, data.id, { 4064 e: false, 4065 v: theCache 4066 }); 4067 } 4068 } catch (e) { 4069 } 4070 } 4071 return theCache; 4072} 4073function createUniqueNamespace(name, includeVersion) { 4074 if (includeVersion === void 0) { 4075 includeVersion = false; 4076 } 4077 return normalizeJsName(name + _dataUid++ + (includeVersion ? "." + version : STR_EMPTY$1) + instanceName); 4078} 4079function createElmNodeData(name) { 4080 var data = { 4081 id: createUniqueNamespace("_aiData-" + (name || STR_EMPTY$1) + "." + version), 4082 accept: function(target) { 4083 return _canAcceptData(target); 4084 }, 4085 get: function(target, name2, defValue, addDefault) { 4086 var theCache = target[data.id]; 4087 if (!theCache) { 4088 if (addDefault) { 4089 theCache = _getCache(data, target); 4090 theCache[normalizeJsName(name2)] = defValue; 4091 } 4092 return defValue; 4093 } 4094 return theCache[normalizeJsName(name2)]; 4095 }, 4096 kill: function(target, name2) { 4097 if (target && target[name2]) { 4098 try { 4099 delete target[name2]; 4100 } catch (e) { 4101 } 4102 } 4103 } 4104 }; 4105 return data; 4106} 4107function _isConfigDefaults(value) { 4108 return value && /* @__PURE__ */ isObject(value) && !isArray(value) && (value.isVal || value.fb || objHasOwn(value, "v") || objHasOwn(value, "mrg") || objHasOwn(value, "ref") || value.set); 4109} 4110function _getDefault(dynamicHandler, theConfig, cfgDefaults) { 4111 var defValue; 4112 var isDefaultValid = cfgDefaults.dfVal || isDefined; 4113 if (theConfig && cfgDefaults.fb) { 4114 var fallbacks = cfgDefaults.fb; 4115 if (!isArray(fallbacks)) { 4116 fallbacks = [fallbacks]; 4117 } 4118 for (var lp = 0; lp < fallbacks[ 4119 _DYN_LENGTH$4 4120 /* @min:%2elength */ 4121 ]; lp++) { 4122 var fallback = fallbacks[lp]; 4123 var fbValue = theConfig[fallback]; 4124 if (isDefaultValid(fbValue)) { 4125 defValue = fbValue; 4126 } else if (dynamicHandler) { 4127 fbValue = dynamicHandler.cfg[fallback]; 4128 if (isDefaultValid(fbValue)) { 4129 defValue = fbValue; 4130 } 4131 dynamicHandler.set(dynamicHandler.cfg, asString(fallback), fbValue); 4132 } 4133 if (isDefaultValid(defValue)) { 4134 break; 4135 } 4136 } 4137 } 4138 if (!isDefaultValid(defValue) && isDefaultValid(cfgDefaults.v)) { 4139 defValue = cfgDefaults.v; 4140 } 4141 return defValue; 4142} 4143function _resolveDefaultValue(dynamicHandler, theConfig, cfgDefaults) { 4144 var theValue = cfgDefaults; 4145 if (cfgDefaults && _isConfigDefaults(cfgDefaults)) { 4146 theValue = _getDefault(dynamicHandler, theConfig, cfgDefaults); 4147 } 4148 if (theValue) { 4149 if (_isConfigDefaults(theValue)) { 4150 theValue = _resolveDefaultValue(dynamicHandler, theConfig, theValue); 4151 } 4152 var newValue_1; 4153 if (isArray(theValue)) { 4154 newValue_1 = []; 4155 newValue_1[ 4156 _DYN_LENGTH$4 4157 /* @min:%2elength */ 4158 ] = theValue[ 4159 _DYN_LENGTH$4 4160 /* @min:%2elength */ 4161 ]; 4162 } else if (/* @__PURE__ */ isPlainObject(theValue)) { 4163 newValue_1 = {}; 4164 } 4165 if (newValue_1) { 4166 objForEachKey(theValue, function(key, value) { 4167 if (value && _isConfigDefaults(value)) { 4168 value = _resolveDefaultValue(dynamicHandler, theConfig, value); 4169 } 4170 newValue_1[key] = value; 4171 }); 4172 theValue = newValue_1; 4173 } 4174 } 4175 return theValue; 4176} 4177function _applyDefaultValue(dynamicHandler, theConfig, name, defaultValue) { 4178 var isValid; 4179 var setFn; 4180 var defValue; 4181 var cfgDefaults = defaultValue; 4182 var mergeDf; 4183 var reference; 4184 var readOnly; 4185 var blkDynamicValue; 4186 if (_isConfigDefaults(cfgDefaults)) { 4187 isValid = cfgDefaults.isVal; 4188 setFn = cfgDefaults.set; 4189 readOnly = cfgDefaults.rdOnly; 4190 blkDynamicValue = cfgDefaults.blkVal; 4191 mergeDf = cfgDefaults.mrg; 4192 reference = cfgDefaults.ref; 4193 if (!reference && /* @__PURE__ */ isUndefined(reference)) { 4194 reference = !!mergeDf; 4195 } 4196 defValue = _getDefault(dynamicHandler, theConfig, cfgDefaults); 4197 } else { 4198 defValue = defaultValue; 4199 } 4200 if (blkDynamicValue) { 4201 dynamicHandler.blkVal(theConfig, name); 4202 } 4203 var theValue; 4204 var usingDefault = true; 4205 var cfgValue = theConfig[name]; 4206 if (cfgValue || !/* @__PURE__ */ isNullOrUndefined(cfgValue)) { 4207 theValue = cfgValue; 4208 usingDefault = false; 4209 if (isValid && theValue !== defValue && !isValid(theValue)) { 4210 theValue = defValue; 4211 usingDefault = true; 4212 } 4213 if (setFn) { 4214 theValue = setFn(theValue, defValue, theConfig); 4215 usingDefault = theValue === defValue; 4216 } 4217 } 4218 if (!usingDefault) { 4219 if (/* @__PURE__ */ isPlainObject(theValue) || isArray(defValue)) { 4220 if (mergeDf && defValue && (/* @__PURE__ */ isPlainObject(defValue) || isArray(defValue))) { 4221 objForEachKey(defValue, function(dfName, dfValue) { 4222 _applyDefaultValue(dynamicHandler, theValue, dfName, dfValue); 4223 }); 4224 } 4225 } 4226 } else if (defValue) { 4227 theValue = _resolveDefaultValue(dynamicHandler, theConfig, defValue); 4228 } else { 4229 theValue = defValue; 4230 } 4231 dynamicHandler.set(theConfig, name, theValue); 4232 if (reference) { 4233 dynamicHandler.ref(theConfig, name); 4234 } 4235 if (readOnly) { 4236 dynamicHandler.rdOnly(theConfig, name); 4237 } 4238} 4239var CFG_HANDLER_LINK = /* @__PURE__ */ symbolFor("[[ai_dynCfg_1]]"); 4240var BLOCK_DYNAMIC = /* @__PURE__ */ symbolFor("[[ai_blkDynCfg_1]]"); 4241var FORCE_DYNAMIC = /* @__PURE__ */ symbolFor("[[ai_frcDynCfg_1]]"); 4242function _cfgDeepCopy(source) { 4243 if (source) { 4244 var target_1; 4245 if (isArray(source)) { 4246 target_1 = []; 4247 target_1[ 4248 _DYN_LENGTH$4 4249 /* @min:%2elength */ 4250 ] = source[ 4251 _DYN_LENGTH$4 4252 /* @min:%2elength */ 4253 ]; 4254 } else if (/* @__PURE__ */ isPlainObject(source)) { 4255 target_1 = {}; 4256 } 4257 if (target_1) { 4258 objForEachKey(source, function(key, value) { 4259 target_1[key] = _cfgDeepCopy(value); 4260 }); 4261 return target_1; 4262 } 4263 } 4264 return source; 4265} 4266function getDynamicConfigHandler(value) { 4267 if (value) { 4268 var handler = value[CFG_HANDLER_LINK] || value; 4269 if (handler.cfg && (handler.cfg === value || handler.cfg[CFG_HANDLER_LINK] === handler)) { 4270 return handler; 4271 } 4272 } 4273 return null; 4274} 4275function blockDynamicConversion(value) { 4276 if (value && (/* @__PURE__ */ isPlainObject(value) || isArray(value))) { 4277 try { 4278 value[BLOCK_DYNAMIC] = true; 4279 } catch (e) { 4280 } 4281 } 4282 return value; 4283} 4284function _canMakeDynamic(getFunc, state2, value) { 4285 var result = false; 4286 if (value && !getFunc[state2.blkVal]) { 4287 result = value[FORCE_DYNAMIC]; 4288 if (!result && !value[BLOCK_DYNAMIC]) { 4289 result = /* @__PURE__ */ isPlainObject(value) || isArray(value); 4290 } 4291 } 4292 return result; 4293} 4294function throwInvalidAccess(message) { 4295 throwTypeError("InvalidAccess:" + message); 4296} 4297var arrayMethodsToPatch = [ 4298 "push", 4299 "pop", 4300 "shift", 4301 "unshift", 4302 "splice" 4303]; 4304var _throwDynamicError = function(logger, name, desc, e) { 4305 logger && logger[ 4306 _DYN_THROW_INTERNAL 4307 /* @min:%2ethrowInternal */ 4308 ](3, 108, "".concat(desc, " [").concat(name, "] failed - ") + /* @__PURE__ */ dumpObj(e)); 4309}; 4310function _patchArray(state2, target, name) { 4311 if (isArray(target)) { 4312 arrForEach(arrayMethodsToPatch, function(method) { 4313 var orgMethod = target[method]; 4314 target[method] = function() { 4315 var args = []; 4316 for (var _i = 0; _i < arguments.length; _i++) { 4317 args[_i] = arguments[_i]; 4318 } 4319 var result = orgMethod[ 4320 _DYN_APPLY 4321 /* @min:%2eapply */ 4322 ](this, args); 4323 _makeDynamicObject(state2, target, name, "Patching"); 4324 return result; 4325 }; 4326 }); 4327 } 4328} 4329function _getOwnPropGetter(target, name) { 4330 var propDesc = objGetOwnPropertyDescriptor(target, name); 4331 return propDesc && propDesc.get; 4332} 4333function _createDynamicProperty(state2, theConfig, name, value) { 4334 var detail = { 4335 n: name, 4336 h: [], 4337 trk: function(handler) { 4338 if (handler && handler.fn) { 4339 if (arrIndexOf(detail.h, handler) === -1) { 4340 detail.h[ 4341 _DYN_PUSH$1 4342 /* @min:%2epush */ 4343 ](handler); 4344 } 4345 state2.trk(handler, detail); 4346 } 4347 }, 4348 clr: function(handler) { 4349 var idx = arrIndexOf(detail.h, handler); 4350 if (idx !== -1) { 4351 detail.h[ 4352 _DYN_SPLICE 4353 /* @min:%2esplice */ 4354 ](idx, 1); 4355 } 4356 } 4357 }; 4358 var checkDynamic = true; 4359 var isObjectOrArray = false; 4360 function _getProperty() { 4361 if (checkDynamic) { 4362 isObjectOrArray = isObjectOrArray || _canMakeDynamic(_getProperty, state2, value); 4363 if (value && !value[CFG_HANDLER_LINK] && isObjectOrArray) { 4364 value = _makeDynamicObject(state2, value, name, "Converting"); 4365 } 4366 checkDynamic = false; 4367 } 4368 var activeHandler = state2.act; 4369 if (activeHandler) { 4370 detail.trk(activeHandler); 4371 } 4372 return value; 4373 } 4374 _getProperty[state2.prop] = { 4375 chng: function() { 4376 state2.add(detail); 4377 } 4378 }; 4379 function _setProperty(newValue) { 4380 if (value !== newValue) { 4381 if (!!_getProperty[state2.ro] && !state2.upd) { 4382 throwInvalidAccess("[" + name + "] is read-only:" + /* @__PURE__ */ dumpObj(theConfig)); 4383 } 4384 if (checkDynamic) { 4385 isObjectOrArray = isObjectOrArray || _canMakeDynamic(_getProperty, state2, value); 4386 checkDynamic = false; 4387 } 4388 var isReferenced = isObjectOrArray && _getProperty[state2.rf]; 4389 if (isObjectOrArray) { 4390 if (isReferenced) { 4391 objForEachKey(value, function(key) { 4392 value[key] = newValue ? newValue[key] : UNDEFINED_VALUE$2; 4393 }); 4394 try { 4395 objForEachKey(newValue, function(key, theValue) { 4396 _setDynamicProperty(state2, value, key, theValue); 4397 }); 4398 newValue = value; 4399 } catch (e) { 4400 _throwDynamicError((state2.hdlr || {})[ 4401 _DYN_LOGGER 4402 /* @min:%2elogger */ 4403 ], name, "Assigning", e); 4404 isObjectOrArray = false; 4405 } 4406 } else if (value && value[CFG_HANDLER_LINK]) { 4407 objForEachKey(value, function(key) { 4408 var getter = _getOwnPropGetter(value, key); 4409 if (getter) { 4410 var valueState = getter[state2.prop]; 4411 valueState && valueState.chng(); 4412 } 4413 }); 4414 } 4415 } 4416 if (newValue !== value) { 4417 var newIsObjectOrArray = newValue && _canMakeDynamic(_getProperty, state2, newValue); 4418 if (!isReferenced && newIsObjectOrArray) { 4419 newValue = _makeDynamicObject(state2, newValue, name, "Converting"); 4420 } 4421 value = newValue; 4422 isObjectOrArray = newIsObjectOrArray; 4423 } 4424 state2.add(detail); 4425 } 4426 } 4427 objDefine(theConfig, detail.n, { g: _getProperty, s: _setProperty }); 4428} 4429function _setDynamicProperty(state2, target, name, value) { 4430 if (target) { 4431 var getter = _getOwnPropGetter(target, name); 4432 var isDynamic = getter && !!getter[state2.prop]; 4433 if (!isDynamic) { 4434 _createDynamicProperty(state2, target, name, value); 4435 } else { 4436 target[name] = value; 4437 } 4438 } 4439 return target; 4440} 4441function _setDynamicPropertyState(state2, target, name, flags) { 4442 if (target) { 4443 var getter = _getOwnPropGetter(target, name); 4444 var isDynamic = getter && !!getter[state2.prop]; 4445 var inPlace = flags && flags[ 4446 0 4447 /* _eSetDynamicPropertyFlags.inPlace */ 4448 ]; 4449 var rdOnly = flags && flags[ 4450 1 4451 /* _eSetDynamicPropertyFlags.readOnly */ 4452 ]; 4453 var blkProp = flags && flags[ 4454 2 4455 /* _eSetDynamicPropertyFlags.blockDynamicProperty */ 4456 ]; 4457 if (!isDynamic) { 4458 if (blkProp) { 4459 try { 4460 blockDynamicConversion(target); 4461 } catch (e) { 4462 _throwDynamicError((state2.hdlr || {})[ 4463 _DYN_LOGGER 4464 /* @min:%2elogger */ 4465 ], name, "Blocking", e); 4466 } 4467 } 4468 try { 4469 _setDynamicProperty(state2, target, name, target[name]); 4470 getter = _getOwnPropGetter(target, name); 4471 } catch (e) { 4472 _throwDynamicError((state2.hdlr || {})[ 4473 _DYN_LOGGER 4474 /* @min:%2elogger */ 4475 ], name, "State", e); 4476 } 4477 } 4478 if (inPlace) { 4479 getter[state2.rf] = inPlace; 4480 } 4481 if (rdOnly) { 4482 getter[state2.ro] = rdOnly; 4483 } 4484 if (blkProp) { 4485 getter[state2.blkVal] = true; 4486 } 4487 } 4488 return target; 4489} 4490function _makeDynamicObject(state2, target, name, desc) { 4491 try { 4492 objForEachKey(target, function(key, value) { 4493 _setDynamicProperty(state2, target, key, value); 4494 }); 4495 if (!target[CFG_HANDLER_LINK]) { 4496 objDefineProp(target, CFG_HANDLER_LINK, { 4497 get: function() { 4498 return state2.hdlr; 4499 } 4500 }); 4501 _patchArray(state2, target, name); 4502 } 4503 } catch (e) { 4504 _throwDynamicError((state2.hdlr || {})[ 4505 _DYN_LOGGER 4506 /* @min:%2elogger */ 4507 ], name, desc, e); 4508 } 4509 return target; 4510} 4511var symPrefix = "[[ai_"; 4512var symPostfix = "]]"; 4513function _createState(cfgHandler) { 4514 var dynamicPropertySymbol = /* @__PURE__ */ newSymbol(symPrefix + "get" + cfgHandler.uid + symPostfix); 4515 var dynamicPropertyReadOnly = /* @__PURE__ */ newSymbol(symPrefix + "ro" + cfgHandler.uid + symPostfix); 4516 var dynamicPropertyReferenced = /* @__PURE__ */ newSymbol(symPrefix + "rf" + cfgHandler.uid + symPostfix); 4517 var dynamicPropertyBlockValue = /* @__PURE__ */ newSymbol(symPrefix + "blkVal" + cfgHandler.uid + symPostfix); 4518 var dynamicPropertyDetail = /* @__PURE__ */ newSymbol(symPrefix + "dtl" + cfgHandler.uid + symPostfix); 4519 var _waitingHandlers = null; 4520 var _watcherTimer = null; 4521 var theState; 4522 function _useHandler(activeHandler, callback) { 4523 var prevWatcher = theState.act; 4524 try { 4525 theState.act = activeHandler; 4526 if (activeHandler && activeHandler[dynamicPropertyDetail]) { 4527 arrForEach(activeHandler[dynamicPropertyDetail], function(detail) { 4528 detail.clr(activeHandler); 4529 }); 4530 activeHandler[dynamicPropertyDetail] = []; 4531 } 4532 callback({ 4533 cfg: cfgHandler.cfg, 4534 set: cfgHandler.set.bind(cfgHandler), 4535 setDf: cfgHandler.setDf.bind(cfgHandler), 4536 ref: cfgHandler.ref.bind(cfgHandler), 4537 rdOnly: cfgHandler.rdOnly.bind(cfgHandler) 4538 }); 4539 } catch (e) { 4540 var logger = cfgHandler[ 4541 _DYN_LOGGER 4542 /* @min:%2elogger */ 4543 ]; 4544 if (logger) { 4545 logger[ 4546 _DYN_THROW_INTERNAL 4547 /* @min:%2ethrowInternal */ 4548 ](1, 107, /* @__PURE__ */ dumpObj(e)); 4549 } 4550 throw e; 4551 } finally { 4552 theState.act = prevWatcher || null; 4553 } 4554 } 4555 function _notifyWatchers() { 4556 if (_waitingHandlers) { 4557 var notifyHandlers = _waitingHandlers; 4558 _waitingHandlers = null; 4559 _watcherTimer && _watcherTimer[ 4560 _DYN_CANCEL 4561 /* @min:%2ecancel */ 4562 ](); 4563 _watcherTimer = null; 4564 var watcherFailures_1 = []; 4565 arrForEach(notifyHandlers, function(handler) { 4566 if (handler) { 4567 if (handler[dynamicPropertyDetail]) { 4568 arrForEach(handler[dynamicPropertyDetail], function(detail) { 4569 detail.clr(handler); 4570 }); 4571 handler[dynamicPropertyDetail] = null; 4572 } 4573 if (handler.fn) { 4574 try { 4575 _useHandler(handler, handler.fn); 4576 } catch (e) { 4577 watcherFailures_1[ 4578 _DYN_PUSH$1 4579 /* @min:%2epush */ 4580 ](e); 4581 } 4582 } 4583 } 4584 }); 4585 if (_waitingHandlers) { 4586 try { 4587 _notifyWatchers(); 4588 } catch (e) { 4589 watcherFailures_1[ 4590 _DYN_PUSH$1 4591 /* @min:%2epush */ 4592 ](e); 4593 } 4594 } 4595 if (watcherFailures_1[ 4596 _DYN_LENGTH$4 4597 /* @min:%2elength */ 4598 ] > 0) { 4599 throwAggregationError("Watcher error(s): ", watcherFailures_1); 4600 } 4601 } 4602 } 4603 function _addWatcher(detail) { 4604 if (detail && detail.h[ 4605 _DYN_LENGTH$4 4606 /* @min:%2elength */ 4607 ] > 0) { 4608 if (!_waitingHandlers) { 4609 _waitingHandlers = []; 4610 } 4611 if (!_watcherTimer) { 4612 _watcherTimer = scheduleTimeout(function() { 4613 _watcherTimer = null; 4614 _notifyWatchers(); 4615 }, 0); 4616 } 4617 for (var idx = 0; idx < detail.h[ 4618 _DYN_LENGTH$4 4619 /* @min:%2elength */ 4620 ]; idx++) { 4621 var handler = detail.h[idx]; 4622 if (handler && arrIndexOf(_waitingHandlers, handler) === -1) { 4623 _waitingHandlers[ 4624 _DYN_PUSH$1 4625 /* @min:%2epush */ 4626 ](handler); 4627 } 4628 } 4629 } 4630 } 4631 function _trackHandler(handler, detail) { 4632 if (handler) { 4633 var details = handler[dynamicPropertyDetail] = handler[dynamicPropertyDetail] || []; 4634 if (arrIndexOf(details, detail) === -1) { 4635 details[ 4636 _DYN_PUSH$1 4637 /* @min:%2epush */ 4638 ](detail); 4639 } 4640 } 4641 } 4642 theState = { 4643 prop: dynamicPropertySymbol, 4644 ro: dynamicPropertyReadOnly, 4645 rf: dynamicPropertyReferenced, 4646 blkVal: dynamicPropertyBlockValue, 4647 hdlr: cfgHandler, 4648 add: _addWatcher, 4649 notify: _notifyWatchers, 4650 use: _useHandler, 4651 trk: _trackHandler 4652 }; 4653 return theState; 4654} 4655function _createAndUseHandler(state2, configHandler) { 4656 var handler = { 4657 fn: configHandler, 4658 rm: function() { 4659 handler.fn = null; 4660 state2 = null; 4661 configHandler = null; 4662 } 4663 }; 4664 objDefine(handler, "toJSON", { v: function() { 4665 return "WatcherHandler" + (handler.fn ? "" : "[X]"); 4666 } }); 4667 state2.use(handler, configHandler); 4668 return handler; 4669} 4670function _createDynamicHandler(logger, target, inPlace) { 4671 var dynamicHandler = getDynamicConfigHandler(target); 4672 if (dynamicHandler) { 4673 return dynamicHandler; 4674 } 4675 var uid = createUniqueNamespace("dyncfg", true); 4676 var newTarget = target && inPlace !== false ? target : _cfgDeepCopy(target); 4677 var theState; 4678 function _notifyWatchers() { 4679 theState.notify(); 4680 } 4681 function _setValue(target2, name, value) { 4682 try { 4683 target2 = _setDynamicProperty(theState, target2, name, value); 4684 } catch (e) { 4685 _throwDynamicError(logger, name, "Setting value", e); 4686 } 4687 return target2[name]; 4688 } 4689 function _watch(configHandler) { 4690 return _createAndUseHandler(theState, configHandler); 4691 } 4692 function _block(configHandler, allowUpdate) { 4693 theState.use(null, function(details) { 4694 var prevUpd = theState.upd; 4695 try { 4696 if (!/* @__PURE__ */ isUndefined(allowUpdate)) { 4697 theState.upd = allowUpdate; 4698 } 4699 configHandler(details); 4700 } finally { 4701 theState.upd = prevUpd; 4702 } 4703 }); 4704 } 4705 function _ref(target2, name) { 4706 var _a2; 4707 return _setDynamicPropertyState(theState, target2, name, (_a2 = {}, _a2[ 4708 0 4709 /* _eSetDynamicPropertyFlags.inPlace */ 4710 ] = true, _a2))[name]; 4711 } 4712 function _rdOnly(target2, name) { 4713 var _a2; 4714 return _setDynamicPropertyState(theState, target2, name, (_a2 = {}, _a2[ 4715 1 4716 /* _eSetDynamicPropertyFlags.readOnly */ 4717 ] = true, _a2))[name]; 4718 } 4719 function _blkPropValue(target2, name) { 4720 var _a2; 4721 return _setDynamicPropertyState(theState, target2, name, (_a2 = {}, _a2[ 4722 2 4723 /* _eSetDynamicPropertyFlags.blockDynamicProperty */ 4724 ] = true, _a2))[name]; 4725 } 4726 function _applyDefaults(theConfig, defaultValues2) { 4727 if (defaultValues2) { 4728 objForEachKey(defaultValues2, function(name, value) { 4729 _applyDefaultValue(cfgHandler, theConfig, name, value); 4730 }); 4731 } 4732 return theConfig; 4733 } 4734 var cfgHandler = { 4735 uid: null, 4736 cfg: newTarget, 4737 logger, 4738 notify: _notifyWatchers, 4739 set: _setValue, 4740 setDf: _applyDefaults, 4741 watch: _watch, 4742 ref: _ref, 4743 rdOnly: _rdOnly, 4744 blkVal: _blkPropValue, 4745 _block 4746 }; 4747 objDefine(cfgHandler, "uid", { 4748 c: false, 4749 e: false, 4750 w: false, 4751 v: uid 4752 }); 4753 theState = _createState(cfgHandler); 4754 _makeDynamicObject(theState, newTarget, "config", "Creating"); 4755 return cfgHandler; 4756} 4757function _logInvalidAccess(logger, message) { 4758 if (logger) { 4759 logger[ 4760 _DYN_WARN_TO_CONSOLE 4761 /* @min:%2ewarnToConsole */ 4762 ](message); 4763 logger[ 4764 _DYN_THROW_INTERNAL 4765 /* @min:%2ethrowInternal */ 4766 ](2, 108, message); 4767 } else { 4768 throwInvalidAccess(message); 4769 } 4770} 4771function createDynamicConfig(config, defaultConfig2, logger, inPlace) { 4772 var dynamicHandler = _createDynamicHandler(logger, config || {}, inPlace); 4773 if (defaultConfig2) { 4774 dynamicHandler.setDf(dynamicHandler.cfg, defaultConfig2); 4775 } 4776 return dynamicHandler; 4777} 4778function onConfigChange(config, configHandler, logger) { 4779 var handler = config[CFG_HANDLER_LINK] || config; 4780 if (handler.cfg && (handler.cfg === config || handler.cfg[CFG_HANDLER_LINK] === handler)) { 4781 return handler[ 4782 _DYN_WATCH 4783 /* @min:%2ewatch */ 4784 ](configHandler); 4785 } 4786 _logInvalidAccess(logger, STR_NOT_DYNAMIC_ERROR + /* @__PURE__ */ dumpObj(config)); 4787 return createDynamicConfig(config, null, logger)[ 4788 _DYN_WATCH 4789 /* @min:%2ewatch */ 4790 ](configHandler); 4791} 4792function runTargetUnload(target, isAsync) { 4793 if (target && target[ 4794 _DYN_UNLOAD 4795 /* @min:%2eunload */ 4796 ]) { 4797 return target[ 4798 _DYN_UNLOAD 4799 /* @min:%2eunload */ 4800 ](isAsync); 4801 } 4802} 4803function doUnloadAll(targets, isAsync, done) { 4804 var result; 4805 if (!done) { 4806 result = createPromise(function(resolved) { 4807 done = resolved; 4808 }); 4809 } 4810 if (targets && getLength(targets) > 0) { 4811 doAwaitResponse(runTargetUnload(targets[0], isAsync), function() { 4812 doUnloadAll(arrSlice(targets, 1), isAsync, done); 4813 }); 4814 } else { 4815 done(); 4816 } 4817 return result; 4818} 4819var ChannelControllerPriority = 500; 4820var DisabledPropertyName$1 = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation"; 4821function _stringToBoolOrDefault(theValue, defaultValue, theConfig) { 4822 if (!theValue && /* @__PURE__ */ isNullOrUndefined(theValue)) { 4823 return defaultValue; 4824 } 4825 if (isBoolean(theValue)) { 4826 return theValue; 4827 } 4828 return asString(theValue)[ 4829 _DYN_TO_LOWER_CASE$2 4830 /* @min:%2etoLowerCase */ 4831 ]() === "true"; 4832} 4833function cfgDfMerge(defaultValue) { 4834 return { 4835 mrg: true, 4836 v: defaultValue 4837 }; 4838} 4839function cfgDfSet(setter, defaultValue) { 4840 return { 4841 set: setter, 4842 v: defaultValue 4843 }; 4844} 4845function cfgDfValidate(validator, defaultValue, fallBackName) { 4846 return { 4847 fb: fallBackName, 4848 isVal: validator, 4849 v: defaultValue 4850 }; 4851} 4852function cfgDfBoolean(defaultValue, fallBackName) { 4853 return { 4854 fb: fallBackName, 4855 set: _stringToBoolOrDefault, 4856 v: !!defaultValue 4857 }; 4858} 4859function cfgDfString(defaultValue) { 4860 return { 4861 isVal: isString, 4862 v: asString(STR_EMPTY$1) 4863 }; 4864} 4865var listenerFuncs = [STR_EVENTS_SENT, STR_EVENTS_DISCARDED, STR_EVENTS_SEND_REQUEST, STR_PERF_EVENT]; 4866var _aiNamespace = null; 4867var _debugListener; 4868function _listenerProxyFunc(name, config) { 4869 return function() { 4870 var args = arguments; 4871 var dbgExt = getDebugExt(config); 4872 if (dbgExt) { 4873 var listener = dbgExt.listener; 4874 if (listener && listener[name]) { 4875 listener[name][ 4876 _DYN_APPLY 4877 /* @min:%2eapply */ 4878 ](listener, args); 4879 } 4880 } 4881 }; 4882} 4883function _getExtensionNamespace() { 4884 var target = /* @__PURE__ */ getInst("Microsoft"); 4885 if (target) { 4886 _aiNamespace = target["ApplicationInsights"]; 4887 } 4888 return _aiNamespace; 4889} 4890function getDebugExt(config) { 4891 var ns = _aiNamespace; 4892 if (!ns && config.disableDbgExt !== true) { 4893 ns = _aiNamespace || _getExtensionNamespace(); 4894 } 4895 return ns ? ns["ChromeDbgExt"] : null; 4896} 4897function getDebugListener(config) { 4898 if (!_debugListener) { 4899 _debugListener = {}; 4900 for (var lp = 0; lp < listenerFuncs[ 4901 _DYN_LENGTH$4 4902 /* @min:%2elength */ 4903 ]; lp++) { 4904 _debugListener[listenerFuncs[lp]] = _listenerProxyFunc(listenerFuncs[lp], config); 4905 } 4906 } 4907 return _debugListener; 4908} 4909var _a$9; 4910var STR_WARN_TO_CONSOLE = "warnToConsole"; 4911var AiNonUserActionablePrefix = "AI (Internal): "; 4912var AiUserActionablePrefix = "AI: "; 4913var AIInternalMessagePrefix = "AITR_"; 4914var defaultValues$3 = { 4915 loggingLevelConsole: 0, 4916 loggingLevelTelemetry: 1, 4917 maxMessageLimit: 25, 4918 enableDebug: false 4919}; 4920var _logFuncs = (_a$9 = {}, _a$9[ 4921 0 4922 /* eLoggingSeverity.DISABLED */ 4923] = null, _a$9[ 4924 1 4925 /* eLoggingSeverity.CRITICAL */ 4926] = "errorToConsole", _a$9[ 4927 2 4928 /* eLoggingSeverity.WARNING */ 4929] = STR_WARN_TO_CONSOLE, _a$9[ 4930 3 4931 /* eLoggingSeverity.DEBUG */ 4932] = "debugToConsole", _a$9); 4933function _sanitizeDiagnosticText(text) { 4934 if (text) { 4935 return '"' + text[ 4936 _DYN_REPLACE 4937 /* @min:%2ereplace */ 4938 ](/\"/g, STR_EMPTY$1) + '"'; 4939 } 4940 return STR_EMPTY$1; 4941} 4942function _logToConsole(func, message) { 4943 var theConsole = getConsole(); 4944 if (!!theConsole) { 4945 var logFunc = "log"; 4946 if (theConsole[func]) { 4947 logFunc = func; 4948 } 4949 if (isFunction(theConsole[logFunc])) { 4950 theConsole[logFunc](message); 4951 } 4952 } 4953} 4954var _InternalLogMessage = ( 4955 /** @class */ 4956 function() { 4957 function _InternalLogMessage2(msgId, msg, isUserAct, properties) { 4958 if (isUserAct === void 0) { 4959 isUserAct = false; 4960 } 4961 var _self = this; 4962 _self[ 4963 _DYN_MESSAGE_ID 4964 /* @min:%2emessageId */ 4965 ] = msgId; 4966 _self[ 4967 _DYN_MESSAGE$1 4968 /* @min:%2emessage */ 4969 ] = (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) + msgId; 4970 var strProps = STR_EMPTY$1; 4971 if (hasJSON()) { 4972 strProps = getJSON().stringify(properties); 4973 } 4974 var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : STR_EMPTY$1) + (properties ? " props:" + _sanitizeDiagnosticText(strProps) : STR_EMPTY$1); 4975 _self[ 4976 _DYN_MESSAGE$1 4977 /* @min:%2emessage */ 4978 ] += diagnosticText; 4979 } 4980 _InternalLogMessage2.dataType = "MessageData"; 4981 return _InternalLogMessage2; 4982 }() 4983); 4984function safeGetLogger(core, config) { 4985 return (core || {})[ 4986 _DYN_LOGGER 4987 /* @min:%2elogger */ 4988 ] || new DiagnosticLogger(config); 4989} 4990var DiagnosticLogger = ( 4991 /** @class */ 4992 function() { 4993 function DiagnosticLogger2(config) { 4994 this.identifier = "DiagnosticLogger"; 4995 this.queue = []; 4996 var _messageCount = 0; 4997 var _messageLogged = {}; 4998 var _loggingLevelConsole; 4999 var _loggingLevelTelemetry; 5000 var _maxInternalMessageLimit; 5001 var _enableDebug; 5002 var _unloadHandler; 5003 dynamicProto(DiagnosticLogger2, this, function(_self) { 5004 _unloadHandler = _setDefaultsFromConfig(config || {}); 5005 _self.consoleLoggingLevel = function() { 5006 return _loggingLevelConsole; 5007 }; 5008 _self[ 5009 _DYN_THROW_INTERNAL 5010 /* @min:%2ethrowInternal */ 5011 ] = function(severity, msgId, msg, properties, isUserAct) { 5012 if (isUserAct === void 0) { 5013 isUserAct = false; 5014 } 5015 var message = new _InternalLogMessage(msgId, msg, isUserAct, properties); 5016 if (_enableDebug) { 5017 throw /* @__PURE__ */ dumpObj(message); 5018 } else { 5019 var logFunc = _logFuncs[severity] || STR_WARN_TO_CONSOLE; 5020 if (!/* @__PURE__ */ isUndefined(message[ 5021 _DYN_MESSAGE$1 5022 /* @min:%2emessage */ 5023 ])) { 5024 if (isUserAct) { 5025 var messageKey = +message[ 5026 _DYN_MESSAGE_ID 5027 /* @min:%2emessageId */ 5028 ]; 5029 if (!_messageLogged[messageKey] && _loggingLevelConsole >= severity) { 5030 _self[logFunc](message[ 5031 _DYN_MESSAGE$1 5032 /* @min:%2emessage */ 5033 ]); 5034 _messageLogged[messageKey] = true; 5035 } 5036 } else { 5037 if (_loggingLevelConsole >= severity) { 5038 _self[logFunc](message[ 5039 _DYN_MESSAGE$1 5040 /* @min:%2emessage */ 5041 ]); 5042 } 5043 } 5044 _logInternalMessage2(severity, message); 5045 } else { 5046 _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message); 5047 } 5048 } 5049 }; 5050 _self.debugToConsole = function(message) { 5051 _logToConsole("debug", message); 5052 _debugExtMsg("warning", message); 5053 }; 5054 _self[ 5055 _DYN_WARN_TO_CONSOLE 5056 /* @min:%2ewarnToConsole */ 5057 ] = function(message) { 5058 _logToConsole("warn", message); 5059 _debugExtMsg("warning", message); 5060 }; 5061 _self.errorToConsole = function(message) { 5062 _logToConsole("error", message); 5063 _debugExtMsg("error", message); 5064 }; 5065 _self.resetInternalMessageCount = function() { 5066 _messageCount = 0; 5067 _messageLogged = {}; 5068 }; 5069 _self.logInternalMessage = _logInternalMessage2; 5070 _self[ 5071 _DYN_UNLOAD 5072 /* @min:%2eunload */ 5073 ] = function(isAsync) { 5074 _unloadHandler && _unloadHandler.rm(); 5075 _unloadHandler = null; 5076 }; 5077 function _logInternalMessage2(severity, message) { 5078 if (_areInternalMessagesThrottled()) { 5079 return; 5080 } 5081 var logMessage = true; 5082 var messageKey = AIInternalMessagePrefix + message[ 5083 _DYN_MESSAGE_ID 5084 /* @min:%2emessageId */ 5085 ]; 5086 if (_messageLogged[messageKey]) { 5087 logMessage = false; 5088 } else { 5089 _messageLogged[messageKey] = true; 5090 } 5091 if (logMessage) { 5092 if (severity <= _loggingLevelTelemetry) { 5093 _self.queue[ 5094 _DYN_PUSH$1 5095 /* @min:%2epush */ 5096 ](message); 5097 _messageCount++; 5098 _debugExtMsg(severity === 1 ? "error" : "warn", message); 5099 } 5100 if (_messageCount === _maxInternalMessageLimit) { 5101 var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app."; 5102 var throttleMessage = new _InternalLogMessage(23, throttleLimitMessage, false); 5103 _self.queue[ 5104 _DYN_PUSH$1 5105 /* @min:%2epush */ 5106 ](throttleMessage); 5107 if (severity === 1) { 5108 _self.errorToConsole(throttleLimitMessage); 5109 } else { 5110 _self[ 5111 _DYN_WARN_TO_CONSOLE 5112 /* @min:%2ewarnToConsole */ 5113 ](throttleLimitMessage); 5114 } 5115 } 5116 } 5117 } 5118 function _setDefaultsFromConfig(config2) { 5119 return onConfigChange(createDynamicConfig(config2, defaultValues$3, _self).cfg, function(details) { 5120 var config3 = details.cfg; 5121 _loggingLevelConsole = config3[ 5122 _DYN_LOGGING_LEVEL_CONSOL4 5123 /* @min:%2eloggingLevelConsole */ 5124 ]; 5125 _loggingLevelTelemetry = config3.loggingLevelTelemetry; 5126 _maxInternalMessageLimit = config3.maxMessageLimit; 5127 _enableDebug = config3.enableDebug; 5128 }); 5129 } 5130 function _areInternalMessagesThrottled() { 5131 return _messageCount >= _maxInternalMessageLimit; 5132 } 5133 function _debugExtMsg(name, data) { 5134 var dbgExt = getDebugExt(config || {}); 5135 if (dbgExt && dbgExt[ 5136 _DYN_DIAG_LOG$2 5137 /* @min:%2ediagLog */ 5138 ]) { 5139 dbgExt[ 5140 _DYN_DIAG_LOG$2 5141 /* @min:%2ediagLog */ 5142 ](name, data); 5143 } 5144 } 5145 }); 5146 } 5147 DiagnosticLogger2.__ieDyn = 1; 5148 return DiagnosticLogger2; 5149 }() 5150); 5151function _getLogger(logger) { 5152 return logger || new DiagnosticLogger(); 5153} 5154function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) { 5155 if (isUserAct === void 0) { 5156 isUserAct = false; 5157 } 5158 _getLogger(logger)[ 5159 _DYN_THROW_INTERNAL 5160 /* @min:%2ethrowInternal */ 5161 ](severity, msgId, msg, properties, isUserAct); 5162} 5163function _warnToConsole(logger, message) { 5164 _getLogger(logger)[ 5165 _DYN_WARN_TO_CONSOLE 5166 /* @min:%2ewarnToConsole */ 5167 ](message); 5168} 5169function _logInternalMessage(logger, severity, message) { 5170 _getLogger(logger).logInternalMessage(severity, message); 5171} 5172var _a$8, _b$2; 5173var strToGMTString = "toGMTString"; 5174var strToUTCString = "toUTCString"; 5175var strCookie = "cookie"; 5176var strExpires = "expires"; 5177var strIsCookieUseDisabled = "isCookieUseDisabled"; 5178var strDisableCookiesUsage = "disableCookiesUsage"; 5179var strConfigCookieMgr = "_ckMgr"; 5180var _supportsCookies = null; 5181var _allowUaSameSite = null; 5182var _parsedCookieValue = null; 5183var _doc; 5184var _cookieCache = {}; 5185var _globalCookieConfig = {}; 5186var rootDefaultConfig = (_a$8 = { 5187 cookieCfg: cfgDfMerge((_b$2 = {}, _b$2[STR_DOMAIN] = { fb: "cookieDomain", dfVal: isNotNullOrUndefined }, _b$2.path = { fb: "cookiePath", dfVal: isNotNullOrUndefined }, _b$2.enabled = UNDEFINED_VALUE$2, _b$2.ignoreCookies = UNDEFINED_VALUE$2, _b$2.blockedCookies = UNDEFINED_VALUE$2, _b$2)), 5188 cookieDomain: UNDEFINED_VALUE$2, 5189 cookiePath: UNDEFINED_VALUE$2 5190}, _a$8[strDisableCookiesUsage] = UNDEFINED_VALUE$2, _a$8); 5191function _getDoc() { 5192 !_doc && (_doc = /* @__PURE__ */ getLazy(function() { 5193 return getDocument(); 5194 })); 5195} 5196function _gblCookieMgr(config, logger) { 5197 var inst = createCookieMgr[strConfigCookieMgr] || _globalCookieConfig[strConfigCookieMgr]; 5198 if (!inst) { 5199 inst = createCookieMgr[strConfigCookieMgr] = createCookieMgr(config, logger); 5200 _globalCookieConfig[strConfigCookieMgr] = inst; 5201 } 5202 return inst; 5203} 5204function _isMgrEnabled(cookieMgr) { 5205 if (cookieMgr) { 5206 return cookieMgr.isEnabled(); 5207 } 5208 return true; 5209} 5210function _isIgnoredCookie(cookieMgrCfg, name) { 5211 if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) { 5212 return arrIndexOf(cookieMgrCfg.ignoreCookies, name) !== -1; 5213 } 5214 return false;
5215} 5216function _isBlockedCookie(cookieMgrCfg, name) { 5217 if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) { 5218 if (arrIndexOf(cookieMgrCfg.blockedCookies, name) !== -1) { 5219 return true; 5220 } 5221 } 5222 return _isIgnoredCookie(cookieMgrCfg, name); 5223} 5224function _isCfgEnabled(rootConfig, cookieMgrConfig) { 5225 var isCfgEnabled = cookieMgrConfig[ 5226 _DYN_ENABLED 5227 /* @min:%2eenabled */ 5228 ]; 5229 if (/* @__PURE__ */ isNullOrUndefined(isCfgEnabled)) { 5230 var cookieEnabled = void 0; 5231 if (!/* @__PURE__ */ isUndefined(rootConfig[strIsCookieUseDisabled])) { 5232 cookieEnabled = !rootConfig[strIsCookieUseDisabled]; 5233 } 5234 if (!/* @__PURE__ */ isUndefined(rootConfig[strDisableCookiesUsage])) { 5235 cookieEnabled = !rootConfig[strDisableCookiesUsage]; 5236 } 5237 isCfgEnabled = cookieEnabled; 5238 } 5239 return isCfgEnabled; 5240} 5241function safeGetCookieMgr(core, config) { 5242 var cookieMgr; 5243 if (core) { 5244 cookieMgr = core.getCookieMgr(); 5245 } 5246 if (!cookieMgr) { 5247 cookieMgr = _gblCookieMgr(config, (core || {})[ 5248 _DYN_LOGGER 5249 /* @min:%2elogger */ 5250 ]); 5251 } 5252 return cookieMgr; 5253} 5254function createCookieMgr(rootConfig, logger) { 5255 var cookieMgrConfig; 5256 var _path; 5257 var _domain; 5258 var unloadHandler; 5259 var _enabled; 5260 var _getCookieFn; 5261 var _setCookieFn; 5262 var _delCookieFn; 5263 rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg; 5264 unloadHandler = onConfigChange(rootConfig, function(details) { 5265 details.setDf(details.cfg, rootDefaultConfig); 5266 cookieMgrConfig = details.ref(details.cfg, "cookieCfg"); 5267 _path = cookieMgrConfig[ 5268 STR_PATH 5269 /* @min:%2epath */ 5270 ] || "/"; 5271 _domain = cookieMgrConfig[ 5272 STR_DOMAIN 5273 /* @min:%2edomain */ 5274 ]; 5275 _enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false; 5276 _getCookieFn = cookieMgrConfig.getCookie || _getCookieValue; 5277 _setCookieFn = cookieMgrConfig.setCookie || _setCookieValue; 5278 _delCookieFn = cookieMgrConfig.delCookie || _setCookieValue; 5279 }, logger); 5280 var cookieMgr = { 5281 isEnabled: function() { 5282 var enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false && _enabled && areCookiesSupported(logger); 5283 var gblManager = _globalCookieConfig[strConfigCookieMgr]; 5284 if (enabled && gblManager && cookieMgr !== gblManager) { 5285 enabled = _isMgrEnabled(gblManager); 5286 } 5287 return enabled; 5288 }, 5289 setEnabled: function(value) { 5290 _enabled = value !== false; 5291 cookieMgrConfig[ 5292 _DYN_ENABLED 5293 /* @min:%2eenabled */ 5294 ] = value; 5295 }, 5296 set: function(name, value, maxAgeSec, domain, path) { 5297 var result = false;
5298 if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) { 5299 var values = {}; 5300 var theValue = strTrim(value || STR_EMPTY$1); 5301 var idx = strIndexOf(theValue, ";"); 5302 if (idx !== -1) { 5303 theValue = strTrim(/* @__PURE__ */ strLeft(value, idx)); 5304 values = _extractParts(strSubstring(value, idx + 1)); 5305 } 5306 setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined); 5307 if (!/* @__PURE__ */ isNullOrUndefined(maxAgeSec)) { 5308 var _isIE = isIE(); 5309 if (/* @__PURE__ */ isUndefined(values[strExpires])) { 5310 var nowMs = /* @__PURE__ */ utcNow(); 5311 var expireMs = nowMs + maxAgeSec * 1e3; 5312 if (expireMs > 0) { 5313 var expiry = /* @__PURE__ */ new Date(); 5314 expiry.setTime(expireMs); 5315 setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY$1, isTruthy); 5316 } 5317 } 5318 if (!_isIE) { 5319 setValue(values, "max-age", STR_EMPTY$1 + maxAgeSec, null, isUndefined); 5320 } 5321 } 5322 var location_1 = getLocation(); 5323 if (location_1 && location_1.protocol === "https:") { 5324 setValue(values, "secure", null, null, isUndefined); 5325 if (_allowUaSameSite === null) { 5326 _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[ 5327 _DYN_USER_AGENT 5328 /* @min:%2euserAgent */ 5329 ]); 5330 } 5331 if (_allowUaSameSite) { 5332 setValue(values, "SameSite", "None", null, isUndefined); 5333 } 5334 } 5335 setValue(values, STR_PATH, path || _path, null, isUndefined); 5336 _setCookieFn(name, _formatCookieValue(theValue, values)); 5337 result = true; 5338 } 5339 return result; 5340 }, 5341 get: function(name) { 5342 var value = STR_EMPTY$1; 5343 if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) { 5344 value = _getCookieFn(name); 5345 } 5346 return value; 5347 }, 5348 del: function(name, path) { 5349 var result = false;
vendor: 35,410 bytes, lines 5350-6580
5350 if (_isMgrEnabled(cookieMgr)) { 5351 result = cookieMgr.purge(name, path); 5352 } 5353 return result; 5354 }, 5355 purge: function(name, path) { 5356 var _a2; 5357 var result = false; 5358 if (areCookiesSupported(logger)) { 5359 var values = (_a2 = {}, _a2[STR_PATH] = path ? path : "/", _a2[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT", _a2); 5360 if (!isIE()) { 5361 values["max-age"] = "0"; 5362 } 5363 _delCookieFn(name, _formatCookieValue(STR_EMPTY$1, values)); 5364 result = true; 5365 } 5366 return result; 5367 }, 5368 unload: function(isAsync) { 5369 unloadHandler && unloadHandler.rm(); 5370 unloadHandler = null; 5371 } 5372 }; 5373 cookieMgr[strConfigCookieMgr] = cookieMgr; 5374 return cookieMgr; 5375} 5376function areCookiesSupported(logger) { 5377 if (_supportsCookies === null) { 5378 _supportsCookies = false; 5379 !_doc && _getDoc(); 5380 try { 5381 var doc = _doc.v || {}; 5382 _supportsCookies = doc[strCookie] !== void 0; 5383 } catch (e) { 5384 _throwInternal(logger, 2, 68, "Cannot access document.cookie - " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 5385 } 5386 } 5387 return _supportsCookies; 5388} 5389function _extractParts(theValue) { 5390 var values = {}; 5391 if (theValue && theValue[ 5392 _DYN_LENGTH$4 5393 /* @min:%2elength */ 5394 ]) { 5395 var parts = strTrim(theValue)[ 5396 _DYN_SPLIT$1 5397 /* @min:%2esplit */ 5398 ](";"); 5399 arrForEach(parts, function(thePart) { 5400 thePart = strTrim(thePart || STR_EMPTY$1); 5401 if (thePart) { 5402 var idx = strIndexOf(thePart, "="); 5403 if (idx === -1) { 5404 values[thePart] = null; 5405 } else { 5406 values[strTrim(/* @__PURE__ */ strLeft(thePart, idx))] = strTrim(strSubstring(thePart, idx + 1)); 5407 } 5408 } 5409 }); 5410 } 5411 return values; 5412} 5413function _formatDate(theDate, func) { 5414 if (isFunction(theDate[func])) { 5415 return theDate[func](); 5416 } 5417 return null; 5418} 5419function _formatCookieValue(value, values) { 5420 var cookieValue = value || STR_EMPTY$1; 5421 objForEachKey(values, function(name, theValue) { 5422 cookieValue += "; " + name + (!/* @__PURE__ */ isNullOrUndefined(theValue) ? "=" + theValue : STR_EMPTY$1); 5423 }); 5424 return cookieValue; 5425} 5426function _getCookieValue(name) { 5427 var cookieValue = STR_EMPTY$1; 5428 !_doc && _getDoc(); 5429 if (_doc.v) { 5430 var theCookie = _doc.v[strCookie] || STR_EMPTY$1; 5431 if (_parsedCookieValue !== theCookie) { 5432 _cookieCache = _extractParts(theCookie); 5433 _parsedCookieValue = theCookie; 5434 } 5435 cookieValue = strTrim(_cookieCache[name] || STR_EMPTY$1); 5436 } 5437 return cookieValue; 5438} 5439function _setCookieValue(name, cookieValue) { 5440 !_doc && _getDoc(); 5441 if (_doc.v) { 5442 _doc.v[strCookie] = name + "=" + cookieValue; 5443 } 5444} 5445function uaDisallowsSameSiteNone(userAgent) { 5446 if (!isString(userAgent)) { 5447 return false; 5448 } 5449 if (strContains(userAgent, "CPU iPhone OS 12") || strContains(userAgent, "iPad; CPU OS 12")) { 5450 return true; 5451 } 5452 if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strContains(userAgent, "Version/") && strContains(userAgent, "Safari")) { 5453 return true; 5454 } 5455 if (strContains(userAgent, "Macintosh; Intel Mac OS X 10_14") && strEndsWith(userAgent, "AppleWebKit/605.1.15 (KHTML, like Gecko)")) { 5456 return true; 5457 } 5458 if (strContains(userAgent, "Chrome/5") || strContains(userAgent, "Chrome/6")) { 5459 return true; 5460 } 5461 if (strContains(userAgent, "UnrealEngine") && !strContains(userAgent, "Chrome")) { 5462 return true; 5463 } 5464 if (strContains(userAgent, "UCBrowser/12") || strContains(userAgent, "UCBrowser/11")) { 5465 return true; 5466 } 5467 return false; 5468} 5469var defaultValues$2 = { 5470 perfEvtsSendAll: false 5471}; 5472function _runScheduledListeners(asyncNotifications) { 5473 asyncNotifications.h = null; 5474 var callbacks = asyncNotifications.cb; 5475 asyncNotifications.cb = []; 5476 arrForEach(callbacks, function(cb) { 5477 safe(cb.fn, [cb.arg]); 5478 }); 5479} 5480function _runListeners(listeners, name, asyncNotifications, callback) { 5481 arrForEach(listeners, function(listener) { 5482 if (listener && listener[name]) { 5483 if (asyncNotifications) { 5484 asyncNotifications.cb[ 5485 _DYN_PUSH$1 5486 /* @min:%2epush */ 5487 ]({ 5488 fn: callback, 5489 arg: listener 5490 }); 5491 asyncNotifications.h = asyncNotifications.h || scheduleTimeout(_runScheduledListeners, 0, asyncNotifications); 5492 } else { 5493 safe(callback, [listener]); 5494 } 5495 } 5496 }); 5497} 5498var NotificationManager = ( 5499 /** @class */ 5500 function() { 5501 function NotificationManager2(config) { 5502 this.listeners = []; 5503 var perfEvtsSendAll; 5504 var unloadHandler; 5505 var _listeners = []; 5506 var _asyncNotifications = { 5507 h: null, 5508 cb: [] 5509 }; 5510 var cfgHandler = createDynamicConfig(config, defaultValues$2); 5511 unloadHandler = cfgHandler[ 5512 _DYN_WATCH 5513 /* @min:%2ewatch */ 5514 ](function(details) { 5515 perfEvtsSendAll = !!details.cfg.perfEvtsSendAll; 5516 }); 5517 dynamicProto(NotificationManager2, this, function(_self) { 5518 objDefine(_self, "listeners", { 5519 g: function() { 5520 return _listeners; 5521 } 5522 }); 5523 _self[ 5524 _DYN_ADD_NOTIFICATION_LIS1 5525 /* @min:%2eaddNotificationListener */ 5526 ] = function(listener) { 5527 _listeners[ 5528 _DYN_PUSH$1 5529 /* @min:%2epush */ 5530 ](listener); 5531 }; 5532 _self[ 5533 _DYN_REMOVE_NOTIFICATION_0 5534 /* @min:%2eremoveNotificationListener */ 5535 ] = function(listener) { 5536 var index = arrIndexOf(_listeners, listener); 5537 while (index > -1) { 5538 _listeners[ 5539 _DYN_SPLICE 5540 /* @min:%2esplice */ 5541 ](index, 1); 5542 index = arrIndexOf(_listeners, listener); 5543 } 5544 }; 5545 _self[ 5546 STR_EVENTS_SENT 5547 /* @min:%2eeventsSent */ 5548 ] = function(events) { 5549 _runListeners(_listeners, STR_EVENTS_SENT, _asyncNotifications, function(listener) { 5550 listener[ 5551 STR_EVENTS_SENT 5552 /* @min:%2eeventsSent */ 5553 ](events); 5554 }); 5555 }; 5556 _self[ 5557 STR_EVENTS_DISCARDED 5558 /* @min:%2eeventsDiscarded */ 5559 ] = function(events, reason) { 5560 _runListeners(_listeners, STR_EVENTS_DISCARDED, _asyncNotifications, function(listener) { 5561 listener[ 5562 STR_EVENTS_DISCARDED 5563 /* @min:%2eeventsDiscarded */ 5564 ](events, reason); 5565 }); 5566 }; 5567 _self[ 5568 STR_EVENTS_SEND_REQUEST 5569 /* @min:%2eeventsSendRequest */ 5570 ] = function(sendReason, isAsync) { 5571 _runListeners(_listeners, STR_EVENTS_SEND_REQUEST, isAsync ? _asyncNotifications : null, function(listener) { 5572 listener[ 5573 STR_EVENTS_SEND_REQUEST 5574 /* @min:%2eeventsSendRequest */ 5575 ](sendReason, isAsync); 5576 }); 5577 }; 5578 _self[ 5579 STR_PERF_EVENT 5580 /* @min:%2eperfEvent */ 5581 ] = function(perfEvent) { 5582 if (perfEvent) { 5583 if (perfEvtsSendAll || !perfEvent[ 5584 _DYN_IS_CHILD_EVT 5585 /* @min:%2eisChildEvt */ 5586 ]()) { 5587 _runListeners(_listeners, STR_PERF_EVENT, null, function(listener) { 5588 if (perfEvent.isAsync) { 5589 scheduleTimeout(function() { 5590 return listener[ 5591 STR_PERF_EVENT 5592 /* @min:%2eperfEvent */ 5593 ](perfEvent); 5594 }, 0); 5595 } else { 5596 listener[ 5597 STR_PERF_EVENT 5598 /* @min:%2eperfEvent */ 5599 ](perfEvent); 5600 } 5601 }); 5602 } 5603 } 5604 }; 5605 _self[ 5606 STR_OFFLINE_STORE 5607 /* @min:%2eofflineEventsStored */ 5608 ] = function(events) { 5609 if (events && events[ 5610 _DYN_LENGTH$4 5611 /* @min:%2elength */ 5612 ]) { 5613 _runListeners(_listeners, STR_OFFLINE_STORE, _asyncNotifications, function(listener) { 5614 listener[ 5615 STR_OFFLINE_STORE 5616 /* @min:%2eofflineEventsStored */ 5617 ](events); 5618 }); 5619 } 5620 }; 5621 _self[ 5622 STR_OFFLINE_SENT 5623 /* @min:%2eofflineBatchSent */ 5624 ] = function(batch) { 5625 if (batch && batch[ 5626 _DYN_DATA$1 5627 /* @min:%2edata */ 5628 ]) { 5629 _runListeners(_listeners, STR_OFFLINE_SENT, _asyncNotifications, function(listener) { 5630 listener[ 5631 STR_OFFLINE_SENT 5632 /* @min:%2eofflineBatchSent */ 5633 ](batch); 5634 }); 5635 } 5636 }; 5637 _self[ 5638 STR_OFFLINE_DROP 5639 /* @min:%2eofflineBatchDrop */ 5640 ] = function(cnt, reason) { 5641 if (cnt > 0) { 5642 var rn_1 = reason || 0; 5643 _runListeners(_listeners, STR_OFFLINE_DROP, _asyncNotifications, function(listener) { 5644 listener[ 5645 STR_OFFLINE_DROP 5646 /* @min:%2eofflineBatchDrop */ 5647 ](cnt, rn_1); 5648 }); 5649 } 5650 }; 5651 _self[ 5652 _DYN_UNLOAD 5653 /* @min:%2eunload */ 5654 ] = function(isAsync) { 5655 var _finishUnload = function() { 5656 unloadHandler && unloadHandler.rm(); 5657 unloadHandler = null; 5658 _listeners = []; 5659 _asyncNotifications.h && _asyncNotifications.h[ 5660 _DYN_CANCEL 5661 /* @min:%2ecancel */ 5662 ](); 5663 _asyncNotifications.h = null; 5664 _asyncNotifications.cb = []; 5665 }; 5666 var waiting; 5667 _runListeners(_listeners, "unload", null, function(listener) { 5668 var asyncUnload = listener[ 5669 _DYN_UNLOAD 5670 /* @min:%2eunload */ 5671 ](isAsync); 5672 if (asyncUnload) { 5673 if (!waiting) { 5674 waiting = []; 5675 } 5676 waiting[ 5677 _DYN_PUSH$1 5678 /* @min:%2epush */ 5679 ](asyncUnload); 5680 } 5681 }); 5682 if (waiting) { 5683 return createPromise(function(resolve) { 5684 return doAwaitResponse(createAllPromise(waiting), function() { 5685 _finishUnload(); 5686 resolve(); 5687 }); 5688 }); 5689 } else { 5690 _finishUnload(); 5691 } 5692 }; 5693 }); 5694 } 5695 NotificationManager2.__ieDyn = 1; 5696 return NotificationManager2; 5697 }() 5698); 5699var strExecutionContextKey = "ctx"; 5700var strParentContextKey = "ParentContextKey"; 5701var strChildrenContextKey = "ChildrenContextKey"; 5702var _defaultPerfManager = null; 5703var PerfEvent = ( 5704 /** @class */ 5705 function() { 5706 function PerfEvent2(name, payloadDetails, isAsync) { 5707 var _self = this; 5708 _self.start = /* @__PURE__ */ utcNow(); 5709 _self[ 5710 _DYN_NAME$2 5711 /* @min:%2ename */ 5712 ] = name; 5713 _self.isAsync = isAsync; 5714 _self[ 5715 _DYN_IS_CHILD_EVT 5716 /* @min:%2eisChildEvt */ 5717 ] = function() { 5718 return false; 5719 }; 5720 if (isFunction(payloadDetails)) { 5721 var theDetails_1; 5722 objDefine(_self, "payload", { 5723 g: function() { 5724 if (!theDetails_1 && isFunction(payloadDetails)) { 5725 theDetails_1 = payloadDetails(); 5726 payloadDetails = null; 5727 } 5728 return theDetails_1; 5729 } 5730 }); 5731 } 5732 _self[ 5733 _DYN_GET_CTX 5734 /* @min:%2egetCtx */ 5735 ] = function(key) { 5736 if (key) { 5737 if (key === PerfEvent2[strParentContextKey] || key === PerfEvent2[strChildrenContextKey]) { 5738 return _self[key]; 5739 } 5740 return (_self[strExecutionContextKey] || {})[key]; 5741 } 5742 return null; 5743 }; 5744 _self[ 5745 _DYN_SET_CTX 5746 /* @min:%2esetCtx */ 5747 ] = function(key, value) { 5748 if (key) { 5749 if (key === PerfEvent2[strParentContextKey]) { 5750 if (!_self[key]) { 5751 _self[ 5752 _DYN_IS_CHILD_EVT 5753 /* @min:%2eisChildEvt */ 5754 ] = function() { 5755 return true; 5756 }; 5757 } 5758 _self[key] = value; 5759 } else if (key === PerfEvent2[strChildrenContextKey]) { 5760 _self[key] = value; 5761 } else { 5762 var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {}; 5763 ctx[key] = value; 5764 } 5765 } 5766 }; 5767 _self.complete = function() { 5768 var childTime = 0; 5769 var childEvts = _self[ 5770 _DYN_GET_CTX 5771 /* @min:%2egetCtx */ 5772 ](PerfEvent2[strChildrenContextKey]); 5773 if (isArray(childEvts)) { 5774 for (var lp = 0; lp < childEvts[ 5775 _DYN_LENGTH$4 5776 /* @min:%2elength */ 5777 ]; lp++) { 5778 var childEvt = childEvts[lp]; 5779 if (childEvt) { 5780 childTime += childEvt.time; 5781 } 5782 } 5783 } 5784 _self.time = /* @__PURE__ */ utcNow() - _self.start; 5785 _self.exTime = _self.time - childTime; 5786 _self.complete = function() { 5787 }; 5788 }; 5789 } 5790 PerfEvent2.ParentContextKey = "parent"; 5791 PerfEvent2.ChildrenContextKey = "childEvts"; 5792 return PerfEvent2; 5793 }() 5794); 5795var PerfManager = ( 5796 /** @class */ 5797 function() { 5798 function PerfManager2(manager) { 5799 this.ctx = {}; 5800 dynamicProto(PerfManager2, this, function(_self) { 5801 _self.create = function(src, payloadDetails, isAsync) { 5802 return new PerfEvent(src, payloadDetails, isAsync); 5803 }; 5804 _self.fire = function(perfEvent) { 5805 if (perfEvent) { 5806 perfEvent.complete(); 5807 if (manager && isFunction(manager[ 5808 STR_PERF_EVENT 5809 /* @min:%2eperfEvent */ 5810 ])) { 5811 manager[ 5812 STR_PERF_EVENT 5813 /* @min:%2eperfEvent */ 5814 ](perfEvent); 5815 } 5816 } 5817 }; 5818 _self[ 5819 _DYN_SET_CTX 5820 /* @min:%2esetCtx */ 5821 ] = function(key, value) { 5822 if (key) { 5823 var ctx = _self[strExecutionContextKey] = _self[strExecutionContextKey] || {}; 5824 ctx[key] = value; 5825 } 5826 }; 5827 _self[ 5828 _DYN_GET_CTX 5829 /* @min:%2egetCtx */ 5830 ] = function(key) { 5831 return (_self[strExecutionContextKey] || {})[key]; 5832 }; 5833 }); 5834 } 5835 PerfManager2.__ieDyn = 1; 5836 return PerfManager2; 5837 }() 5838); 5839var doPerfActiveKey = "CoreUtils.doPerf"; 5840function doPerf(mgrSource, getSource, func, details, isAsync) { 5841 if (mgrSource) { 5842 var perfMgr = mgrSource; 5843 if (perfMgr[STR_GET_PERF_MGR]) { 5844 perfMgr = perfMgr[STR_GET_PERF_MGR](); 5845 } 5846 if (perfMgr) { 5847 var perfEvt = void 0; 5848 var currentActive = perfMgr[ 5849 _DYN_GET_CTX 5850 /* @min:%2egetCtx */ 5851 ](doPerfActiveKey); 5852 try { 5853 perfEvt = perfMgr.create(getSource(), details, isAsync); 5854 if (perfEvt) { 5855 if (currentActive && perfEvt[ 5856 _DYN_SET_CTX 5857 /* @min:%2esetCtx */ 5858 ]) { 5859 perfEvt[ 5860 _DYN_SET_CTX 5861 /* @min:%2esetCtx */ 5862 ](PerfEvent[strParentContextKey], currentActive); 5863 if (currentActive[ 5864 _DYN_GET_CTX 5865 /* @min:%2egetCtx */ 5866 ] && currentActive[ 5867 _DYN_SET_CTX 5868 /* @min:%2esetCtx */ 5869 ]) { 5870 var children = currentActive[ 5871 _DYN_GET_CTX 5872 /* @min:%2egetCtx */ 5873 ](PerfEvent[strChildrenContextKey]); 5874 if (!children) { 5875 children = []; 5876 currentActive[ 5877 _DYN_SET_CTX 5878 /* @min:%2esetCtx */ 5879 ](PerfEvent[strChildrenContextKey], children); 5880 } 5881 children[ 5882 _DYN_PUSH$1 5883 /* @min:%2epush */ 5884 ](perfEvt); 5885 } 5886 } 5887 perfMgr[ 5888 _DYN_SET_CTX 5889 /* @min:%2esetCtx */ 5890 ](doPerfActiveKey, perfEvt); 5891 return func(perfEvt); 5892 } 5893 } catch (ex) { 5894 if (perfEvt && perfEvt[ 5895 _DYN_SET_CTX 5896 /* @min:%2esetCtx */ 5897 ]) { 5898 perfEvt[ 5899 _DYN_SET_CTX 5900 /* @min:%2esetCtx */ 5901 ]("exception", ex); 5902 } 5903 } finally { 5904 if (perfEvt) { 5905 perfMgr.fire(perfEvt); 5906 } 5907 perfMgr[ 5908 _DYN_SET_CTX 5909 /* @min:%2esetCtx */ 5910 ](doPerfActiveKey, currentActive); 5911 } 5912 } 5913 } 5914 return func(); 5915} 5916function getGblPerfMgr() { 5917 return _defaultPerfManager; 5918} 5919function generateW3CId() { 5920 var hexValues = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]; 5921 var oct = STR_EMPTY$1, tmp; 5922 for (var a = 0; a < 4; a++) { 5923 tmp = random32(); 5924 oct += hexValues[tmp & 15] + hexValues[tmp >> 4 & 15] + hexValues[tmp >> 8 & 15] + hexValues[tmp >> 12 & 15] + hexValues[tmp >> 16 & 15] + hexValues[tmp >> 20 & 15] + hexValues[tmp >> 24 & 15] + hexValues[tmp >> 28 & 15]; 5925 } 5926 var clockSequenceHi = hexValues[8 + (random32() & 3) | 0]; 5927 return strSubstr(oct, 0, 8) + strSubstr(oct, 9, 4) + "4" + strSubstr(oct, 13, 3) + clockSequenceHi + strSubstr(oct, 16, 3) + strSubstr(oct, 19, 12); 5928} 5929var DEFAULT_VERSION = "00"; 5930var INVALID_VERSION = "ff"; 5931var INVALID_TRACE_ID = "00000000000000000000000000000000"; 5932var INVALID_SPAN_ID = "0000000000000000"; 5933function _isValid(value, len, invalidValue) { 5934 if (value && value[ 5935 _DYN_LENGTH$4 5936 /* @min:%2elength */ 5937 ] === len && value !== invalidValue) { 5938 return !!value.match(/^[\da-f]*$/i); 5939 } 5940 return false; 5941} 5942function _formatValue(value, len, defValue) { 5943 if (_isValid(value, len)) { 5944 return value; 5945 } 5946 return defValue; 5947} 5948function _formatFlags(value) { 5949 if (isNaN(value) || value < 0 || value > 255) { 5950 value = 1; 5951 } 5952 var result = value.toString(16); 5953 while (result[ 5954 _DYN_LENGTH$4 5955 /* @min:%2elength */ 5956 ] < 2) { 5957 result = "0" + result; 5958 } 5959 return result; 5960} 5961function createTraceParent(traceId, spanId, flags, version2) { 5962 return { 5963 version: _isValid(version2, 2, INVALID_VERSION) ? version2 : DEFAULT_VERSION, 5964 traceId: isValidTraceId(traceId) ? traceId : generateW3CId(), 5965 spanId: isValidSpanId(spanId) ? spanId : /* @__PURE__ */ strLeft(generateW3CId(), 16), 5966 traceFlags: flags >= 0 && flags <= 255 ? flags : 1 5967 }; 5968} 5969function isValidTraceId(value) { 5970 return _isValid(value, 32, INVALID_TRACE_ID); 5971} 5972function isValidSpanId(value) { 5973 return _isValid(value, 16, INVALID_SPAN_ID); 5974} 5975function formatTraceParent(value) { 5976 if (value) { 5977 var flags = _formatFlags(value[ 5978 _DYN_TRACE_FLAGS$1 5979 /* @min:%2etraceFlags */ 5980 ]); 5981 if (!_isValid(flags, 2)) { 5982 flags = "01"; 5983 } 5984 var version2 = value[ 5985 _DYN_VERSION$1 5986 /* @min:%2eversion */ 5987 ] || DEFAULT_VERSION; 5988 if (version2 !== "00" && version2 !== "ff") { 5989 version2 = DEFAULT_VERSION; 5990 } 5991 return "".concat(version2.toLowerCase(), "-").concat(_formatValue(value.traceId, 32, INVALID_TRACE_ID).toLowerCase(), "-").concat(_formatValue(value.spanId, 16, INVALID_SPAN_ID).toLowerCase(), "-").concat(flags.toLowerCase()); 5992 } 5993 return ""; 5994} 5995function findAllScripts(doc) { 5996 var scripts = doc.getElementsByTagName("script"); 5997 var result = []; 5998 arrForEach(scripts, function(script) { 5999 var src = script[ 6000 _DYN_GET_ATTRIBUTE 6001 /* @min:%2egetAttribute */ 6002 ]("src"); 6003 if (src) { 6004 var crossOrigin = script[ 6005 _DYN_GET_ATTRIBUTE 6006 /* @min:%2egetAttribute */ 6007 ]("crossorigin"); 6008 var async = script.hasAttribute("async") === true; 6009 var defer = script.hasAttribute("defer") === true; 6010 var referrerPolicy = script[ 6011 _DYN_GET_ATTRIBUTE 6012 /* @min:%2egetAttribute */ 6013 ]("referrerpolicy"); 6014 var info = { url: src }; 6015 if (crossOrigin) { 6016 info.crossOrigin = crossOrigin; 6017 } 6018 if (async) { 6019 info.async = async; 6020 } 6021 if (defer) { 6022 info.defer = defer; 6023 } 6024 if (referrerPolicy) { 6025 info.referrerPolicy = referrerPolicy; 6026 } 6027 result[ 6028 _DYN_PUSH$1 6029 /* @min:%2epush */ 6030 ](info); 6031 } 6032 }); 6033 return result; 6034} 6035var pluginStateData = createElmNodeData("plugin"); 6036function _getPluginState(plugin2) { 6037 return pluginStateData.get(plugin2, "state", {}, true); 6038} 6039function initializePlugins(processContext, extensions) { 6040 var initPlugins = []; 6041 var lastPlugin = null; 6042 var proxy = processContext[ 6043 _DYN_GET_NEXT 6044 /* @min:%2egetNext */ 6045 ](); 6046 var pluginState; 6047 while (proxy) { 6048 var thePlugin = proxy[ 6049 _DYN_GET_PLUGIN 6050 /* @min:%2egetPlugin */ 6051 ](); 6052 if (thePlugin) { 6053 if (lastPlugin && lastPlugin[ 6054 _DYN_SET_NEXT_PLUGIN 6055 /* @min:%2esetNextPlugin */ 6056 ] && thePlugin[ 6057 STR_PROCESS_TELEMETRY 6058 /* @min:%2eprocessTelemetry */ 6059 ]) { 6060 lastPlugin[ 6061 _DYN_SET_NEXT_PLUGIN 6062 /* @min:%2esetNextPlugin */ 6063 ](thePlugin); 6064 } 6065 pluginState = _getPluginState(thePlugin); 6066 var isInitialized = !!pluginState[ 6067 _DYN_IS_INITIALIZED 6068 /* @min:%2eisInitialized */ 6069 ]; 6070 if (thePlugin[ 6071 _DYN_IS_INITIALIZED 6072 /* @min:%2eisInitialized */ 6073 ]) { 6074 isInitialized = thePlugin[ 6075 _DYN_IS_INITIALIZED 6076 /* @min:%2eisInitialized */ 6077 ](); 6078 } 6079 if (!isInitialized) { 6080 initPlugins[ 6081 _DYN_PUSH$1 6082 /* @min:%2epush */ 6083 ](thePlugin); 6084 } 6085 lastPlugin = thePlugin; 6086 proxy = proxy[ 6087 _DYN_GET_NEXT 6088 /* @min:%2egetNext */ 6089 ](); 6090 } 6091 } 6092 arrForEach(initPlugins, function(thePlugin2) { 6093 var core = processContext[ 6094 STR_CORE 6095 /* @min:%2ecore */ 6096 ](); 6097 thePlugin2[ 6098 _DYN_INITIALIZE$1 6099 /* @min:%2einitialize */ 6100 ](processContext.getCfg(), core, extensions, processContext[ 6101 _DYN_GET_NEXT 6102 /* @min:%2egetNext */ 6103 ]()); 6104 pluginState = _getPluginState(thePlugin2); 6105 if (!thePlugin2[STR_CORE] && !pluginState[STR_CORE]) { 6106 pluginState[STR_CORE] = core; 6107 } 6108 pluginState[ 6109 _DYN_IS_INITIALIZED 6110 /* @min:%2eisInitialized */ 6111 ] = true; 6112 delete pluginState[ 6113 _DYN_TEARDOWN 6114 /* @min:%2eteardown */ 6115 ]; 6116 }); 6117} 6118function sortPlugins(plugins2) { 6119 return plugins2.sort(function(extA, extB) { 6120 var result = 0; 6121 if (extB) { 6122 var bHasProcess = extB[STR_PROCESS_TELEMETRY]; 6123 if (extA[STR_PROCESS_TELEMETRY]) { 6124 result = bHasProcess ? extA[STR_PRIORITY] - extB[STR_PRIORITY] : 1; 6125 } else if (bHasProcess) { 6126 result = -1; 6127 } 6128 } else { 6129 result = extA ? 1 : -1; 6130 } 6131 return result; 6132 }); 6133} 6134function createDistributedTraceContext(parentCtx) { 6135 var trace = {}; 6136 return { 6137 getName: function() { 6138 return trace[ 6139 _DYN_NAME$2 6140 /* @min:%2ename */ 6141 ]; 6142 }, 6143 setName: function(newValue) { 6144 trace[ 6145 _DYN_NAME$2 6146 /* @min:%2ename */ 6147 ] = newValue; 6148 }, 6149 getTraceId: function() { 6150 return trace.traceId; 6151 }, 6152 setTraceId: function(newValue) { 6153 if (isValidTraceId(newValue)) { 6154 trace.traceId = newValue; 6155 } 6156 }, 6157 getSpanId: function() { 6158 return trace.spanId; 6159 }, 6160 setSpanId: function(newValue) { 6161 if (isValidSpanId(newValue)) { 6162 trace.spanId = newValue; 6163 } 6164 }, 6165 getTraceFlags: function() { 6166 return trace[ 6167 _DYN_TRACE_FLAGS$1 6168 /* @min:%2etraceFlags */ 6169 ]; 6170 }, 6171 setTraceFlags: function(newTraceFlags) { 6172 trace[ 6173 _DYN_TRACE_FLAGS$1 6174 /* @min:%2etraceFlags */ 6175 ] = newTraceFlags; 6176 } 6177 }; 6178} 6179var strTelemetryPluginChain = "TelemetryPluginChain"; 6180var strHasRunFlags = "_hasRun"; 6181var strGetTelCtx = "_getTelCtx"; 6182var _chainId = 0; 6183function _getNextProxyStart(proxy, core, startAt) { 6184 while (proxy) { 6185 if (proxy[ 6186 _DYN_GET_PLUGIN 6187 /* @min:%2egetPlugin */ 6188 ]() === startAt) { 6189 return proxy; 6190 } 6191 proxy = proxy[ 6192 _DYN_GET_NEXT 6193 /* @min:%2egetNext */ 6194 ](); 6195 } 6196 return createTelemetryProxyChain([startAt], core.config || {}, core); 6197} 6198function _createInternalContext(telemetryChain, dynamicHandler, core, startAt) { 6199 var _nextProxy = null; 6200 var _onComplete = []; 6201 if (!dynamicHandler) { 6202 dynamicHandler = createDynamicConfig({}, null, core[ 6203 _DYN_LOGGER 6204 /* @min:%2elogger */ 6205 ]); 6206 } 6207 if (startAt !== null) { 6208 _nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain; 6209 } 6210 var context = { 6211 _next: _moveNext, 6212 ctx: { 6213 core: function() { 6214 return core; 6215 }, 6216 diagLog: function() { 6217 return safeGetLogger(core, dynamicHandler.cfg); 6218 }, 6219 getCfg: function() { 6220 return dynamicHandler.cfg; 6221 }, 6222 getExtCfg: _resolveExtCfg, 6223 getConfig: _getConfig, 6224 hasNext: function() { 6225 return !!_nextProxy; 6226 }, 6227 getNext: function() { 6228 return _nextProxy; 6229 }, 6230 setNext: function(nextPlugin) { 6231 _nextProxy = nextPlugin; 6232 }, 6233 iterate: _iterateChain, 6234 onComplete: _addOnComplete 6235 } 6236 }; 6237 function _addOnComplete(onComplete, that) { 6238 var args = []; 6239 for (var _i = 2; _i < arguments.length; _i++) { 6240 args[_i - 2] = arguments[_i]; 6241 } 6242 if (onComplete) { 6243 _onComplete[ 6244 _DYN_PUSH$1 6245 /* @min:%2epush */ 6246 ]({ 6247 func: onComplete, 6248 self: !/* @__PURE__ */ isUndefined(that) ? that : context.ctx, 6249 args 6250 }); 6251 } 6252 } 6253 function _moveNext() { 6254 var nextProxy = _nextProxy; 6255 _nextProxy = nextProxy ? nextProxy[ 6256 _DYN_GET_NEXT 6257 /* @min:%2egetNext */ 6258 ]() : null; 6259 if (!nextProxy) { 6260 var onComplete = _onComplete; 6261 if (onComplete && onComplete[ 6262 _DYN_LENGTH$4 6263 /* @min:%2elength */ 6264 ] > 0) { 6265 arrForEach(onComplete, function(completeDetails) { 6266 try { 6267 completeDetails.func.call(completeDetails.self, completeDetails.args); 6268 } catch (e) { 6269 _throwInternal(core[ 6270 _DYN_LOGGER 6271 /* @min:%2elogger */ 6272 ], 2, 73, "Unexpected Exception during onComplete - " + /* @__PURE__ */ dumpObj(e)); 6273 } 6274 }); 6275 _onComplete = []; 6276 } 6277 } 6278 return nextProxy; 6279 } 6280 function _getExtCfg(identifier, createIfMissing) { 6281 var idCfg = null; 6282 var cfg = dynamicHandler.cfg; 6283 if (cfg && identifier) { 6284 var extCfg = cfg[ 6285 STR_EXTENSION_CONFIG 6286 /* @min:%2eextensionConfig */ 6287 ]; 6288 if (!extCfg && createIfMissing) { 6289 extCfg = {}; 6290 } 6291 cfg[STR_EXTENSION_CONFIG] = extCfg; 6292 extCfg = dynamicHandler.ref(cfg, STR_EXTENSION_CONFIG); 6293 if (extCfg) { 6294 idCfg = extCfg[identifier]; 6295 if (!idCfg && createIfMissing) { 6296 idCfg = {}; 6297 } 6298 extCfg[identifier] = idCfg; 6299 idCfg = dynamicHandler.ref(extCfg, identifier); 6300 } 6301 } 6302 return idCfg; 6303 } 6304 function _resolveExtCfg(identifier, defaultValues2) { 6305 var newConfig = _getExtCfg(identifier, true); 6306 if (defaultValues2) { 6307 objForEachKey(defaultValues2, function(field, defaultValue) { 6308 if (/* @__PURE__ */ isNullOrUndefined(newConfig[field])) { 6309 var cfgValue = dynamicHandler.cfg[field]; 6310 if (cfgValue || !/* @__PURE__ */ isNullOrUndefined(cfgValue)) { 6311 newConfig[field] = cfgValue; 6312 } 6313 } 6314 _applyDefaultValue(dynamicHandler, newConfig, field, defaultValue); 6315 }); 6316 } 6317 return dynamicHandler.setDf(newConfig, defaultValues2); 6318 } 6319 function _getConfig(identifier, field, defaultValue) { 6320 if (defaultValue === void 0) { 6321 defaultValue = false; 6322 } 6323 var theValue; 6324 var extConfig = _getExtCfg(identifier, false); 6325 var rootConfig = dynamicHandler.cfg; 6326 if (extConfig && (extConfig[field] || !/* @__PURE__ */ isNullOrUndefined(extConfig[field]))) { 6327 theValue = extConfig[field]; 6328 } else if (rootConfig[field] || !/* @__PURE__ */ isNullOrUndefined(rootConfig[field])) { 6329 theValue = rootConfig[field]; 6330 } 6331 return theValue || !/* @__PURE__ */ isNullOrUndefined(theValue) ? theValue : defaultValue; 6332 } 6333 function _iterateChain(cb) { 6334 var nextPlugin; 6335 while (!!(nextPlugin = context._next())) { 6336 var plugin2 = nextPlugin[ 6337 _DYN_GET_PLUGIN 6338 /* @min:%2egetPlugin */ 6339 ](); 6340 if (plugin2) { 6341 cb(plugin2); 6342 } 6343 } 6344 } 6345 return context; 6346} 6347function createProcessTelemetryContext(telemetryChain, cfg, core, startAt) { 6348 var config = createDynamicConfig(cfg); 6349 var internalContext = _createInternalContext(telemetryChain, config, core, startAt); 6350 var context = internalContext.ctx; 6351 function _processNext(env) { 6352 var nextPlugin = internalContext._next(); 6353 if (nextPlugin) { 6354 nextPlugin[ 6355 STR_PROCESS_TELEMETRY 6356 /* @min:%2eprocessTelemetry */ 6357 ](env, context); 6358 } 6359 return !nextPlugin; 6360 } 6361 function _createNew(plugins2, startAt2) { 6362 if (plugins2 === void 0) { 6363 plugins2 = null; 6364 } 6365 if (isArray(plugins2)) { 6366 plugins2 = createTelemetryProxyChain(plugins2, config.cfg, core, startAt2); 6367 } 6368 return createProcessTelemetryContext(plugins2 || context[ 6369 _DYN_GET_NEXT 6370 /* @min:%2egetNext */ 6371 ](), config.cfg, core, startAt2); 6372 } 6373 context[ 6374 _DYN_PROCESS_NEXT 6375 /* @min:%2eprocessNext */ 6376 ] = _processNext; 6377 context[ 6378 _DYN_CREATE_NEW 6379 /* @min:%2ecreateNew */ 6380 ] = _createNew; 6381 return context; 6382} 6383function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) { 6384 var config = createDynamicConfig(core.config); 6385 var internalContext = _createInternalContext(telemetryChain, config, core, startAt); 6386 var context = internalContext.ctx; 6387 function _processNext(unloadState) { 6388 var nextPlugin = internalContext._next(); 6389 nextPlugin && nextPlugin[ 6390 _DYN_UNLOAD 6391 /* @min:%2eunload */ 6392 ](context, unloadState); 6393 return !nextPlugin; 6394 } 6395 function _createNew(plugins2, startAt2) { 6396 if (plugins2 === void 0) { 6397 plugins2 = null; 6398 } 6399 if (isArray(plugins2)) { 6400 plugins2 = createTelemetryProxyChain(plugins2, config.cfg, core, startAt2); 6401 } 6402 return createProcessTelemetryUnloadContext(plugins2 || context[ 6403 _DYN_GET_NEXT 6404 /* @min:%2egetNext */ 6405 ](), core, startAt2); 6406 } 6407 context[ 6408 _DYN_PROCESS_NEXT 6409 /* @min:%2eprocessNext */ 6410 ] = _processNext; 6411 context[ 6412 _DYN_CREATE_NEW 6413 /* @min:%2ecreateNew */ 6414 ] = _createNew; 6415 return context; 6416} 6417function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) { 6418 var config = createDynamicConfig(core.config); 6419 var internalContext = _createInternalContext(telemetryChain, config, core, startAt); 6420 var context = internalContext.ctx; 6421 function _processNext(updateState) { 6422 return context.iterate(function(plugin2) { 6423 if (isFunction(plugin2[ 6424 _DYN_UPDATE 6425 /* @min:%2eupdate */ 6426 ])) { 6427 plugin2[ 6428 _DYN_UPDATE 6429 /* @min:%2eupdate */ 6430 ](context, updateState); 6431 } 6432 }); 6433 } 6434 function _createNew(plugins2, startAt2) { 6435 if (plugins2 === void 0) { 6436 plugins2 = null; 6437 } 6438 if (isArray(plugins2)) { 6439 plugins2 = createTelemetryProxyChain(plugins2, config.cfg, core, startAt2); 6440 } 6441 return createProcessTelemetryUpdateContext(plugins2 || context[ 6442 _DYN_GET_NEXT 6443 /* @min:%2egetNext */ 6444 ](), core, startAt2); 6445 } 6446 context[ 6447 _DYN_PROCESS_NEXT 6448 /* @min:%2eprocessNext */ 6449 ] = _processNext; 6450 context[ 6451 _DYN_CREATE_NEW 6452 /* @min:%2ecreateNew */ 6453 ] = _createNew; 6454 return context; 6455} 6456function createTelemetryProxyChain(plugins2, config, core, startAt) { 6457 var firstProxy = null; 6458 var add = startAt ? false : true; 6459 if (isArray(plugins2) && plugins2[ 6460 _DYN_LENGTH$4 6461 /* @min:%2elength */ 6462 ] > 0) { 6463 var lastProxy_1 = null; 6464 arrForEach(plugins2, function(thePlugin) { 6465 if (!add && startAt === thePlugin) { 6466 add = true; 6467 } 6468 if (add && thePlugin && isFunction(thePlugin[ 6469 STR_PROCESS_TELEMETRY 6470 /* @min:%2eprocessTelemetry */ 6471 ])) { 6472 var newProxy = createTelemetryPluginProxy(thePlugin, config, core); 6473 if (!firstProxy) { 6474 firstProxy = newProxy; 6475 } 6476 if (lastProxy_1) { 6477 lastProxy_1._setNext(newProxy); 6478 } 6479 lastProxy_1 = newProxy; 6480 } 6481 }); 6482 } 6483 if (startAt && !firstProxy) { 6484 return createTelemetryProxyChain([startAt], config, core); 6485 } 6486 return firstProxy; 6487} 6488function createTelemetryPluginProxy(plugin2, config, core) { 6489 var nextProxy = null; 6490 var hasProcessTelemetry = isFunction(plugin2[ 6491 STR_PROCESS_TELEMETRY 6492 /* @min:%2eprocessTelemetry */ 6493 ]); 6494 var hasSetNext = isFunction(plugin2[ 6495 _DYN_SET_NEXT_PLUGIN 6496 /* @min:%2esetNextPlugin */ 6497 ]); 6498 var chainId; 6499 if (plugin2) { 6500 chainId = plugin2[ 6501 _DYN_IDENTIFIER 6502 /* @min:%2eidentifier */ 6503 ] + "-" + plugin2[ 6504 STR_PRIORITY 6505 /* @min:%2epriority */ 6506 ] + "-" + _chainId++; 6507 } else { 6508 chainId = "Unknown-0-" + _chainId++; 6509 } 6510 var proxyChain = { 6511 getPlugin: function() { 6512 return plugin2; 6513 }, 6514 getNext: function() { 6515 return nextProxy; 6516 }, 6517 processTelemetry: _processTelemetry, 6518 unload: _unloadPlugin, 6519 update: _updatePlugin, 6520 _id: chainId, 6521 _setNext: function(nextPlugin) { 6522 nextProxy = nextPlugin; 6523 } 6524 }; 6525 function _getTelCtx() { 6526 var itemCtx; 6527 if (plugin2 && isFunction(plugin2[strGetTelCtx])) { 6528 itemCtx = plugin2[strGetTelCtx](); 6529 } 6530 if (!itemCtx) { 6531 itemCtx = createProcessTelemetryContext(proxyChain, config, core); 6532 } 6533 return itemCtx; 6534 } 6535 function _processChain(itemCtx, processPluginFn, name, details, isAsync) { 6536 var hasRun = false; 6537 var identifier = plugin2 ? plugin2[ 6538 _DYN_IDENTIFIER 6539 /* @min:%2eidentifier */ 6540 ] : strTelemetryPluginChain; 6541 var hasRunContext = itemCtx[strHasRunFlags]; 6542 if (!hasRunContext) { 6543 hasRunContext = itemCtx[strHasRunFlags] = {}; 6544 } 6545 itemCtx.setNext(nextProxy); 6546 if (plugin2) { 6547 doPerf(itemCtx[ 6548 STR_CORE 6549 /* @min:%2ecore */ 6550 ](), function() { 6551 return identifier + ":" + name; 6552 }, function() { 6553 hasRunContext[chainId] = true; 6554 try { 6555 var nextId = nextProxy ? nextProxy._id : STR_EMPTY$1; 6556 if (nextId) { 6557 hasRunContext[nextId] = false; 6558 } 6559 hasRun = processPluginFn(itemCtx); 6560 } catch (error) { 6561 var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true; 6562 if (hasNextRun) { 6563 hasRun = true; 6564 } 6565 if (!nextProxy || !hasNextRun) { 6566 _throwInternal(itemCtx[ 6567 _DYN_DIAG_LOG$2 6568 /* @min:%2ediagLog */ 6569 ](), 1, 73, "Plugin [" + identifier + "] failed during " + name + " - " + /* @__PURE__ */ dumpObj(error) + ", run flags: " + /* @__PURE__ */ dumpObj(hasRunContext)); 6570 } 6571 } 6572 }, details, isAsync); 6573 } 6574 return hasRun; 6575 } 6576 function _processTelemetry(env, itemCtx) { 6577 itemCtx = itemCtx || _getTelCtx(); 6578 function _callProcessTelemetry(itemCtx2) { 6579 if (!plugin2 || !hasProcessTelemetry) { 6580 return false;
6581 } 6582 var pluginState = _getPluginState(plugin2); 6583 if (pluginState[ 6584 _DYN_TEARDOWN 6585 /* @min:%2eteardown */ 6586 ] || pluginState[STR_DISABLED]) { 6587 return false; 6588 } 6589 if (hasSetNext) { 6590 plugin2[ 6591 _DYN_SET_NEXT_PLUGIN 6592 /* @min:%2esetNextPlugin */ 6593 ](nextProxy); 6594 } 6595 plugin2[ 6596 STR_PROCESS_TELEMETRY 6597 /* @min:%2eprocessTelemetry */ 6598 ](env, itemCtx2); 6599 return true; 6600 } 6601 if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function() { 6602 return { item: env }; 6603 }, !env.sync)) { 6604 itemCtx[ 6605 _DYN_PROCESS_NEXT 6606 /* @min:%2eprocessNext */ 6607 ](env); 6608 } 6609 } 6610 function _unloadPlugin(unloadCtx, unloadState) { 6611 function _callTeardown() { 6612 var hasRun = false; 6613 if (plugin2) { 6614 var pluginState = _getPluginState(plugin2); 6615 var pluginCore = plugin2[STR_CORE] || pluginState[ 6616 STR_CORE 6617 /* @min:%2ecore */ 6618 ]; 6619 if (plugin2 && (!pluginCore || pluginCore === unloadCtx.core()) && !pluginState[ 6620 _DYN_TEARDOWN 6621 /* @min:%2eteardown */ 6622 ]) { 6623 pluginState[ 6624 STR_CORE 6625 /* @min:%2ecore */ 6626 ] = null; 6627 pluginState[ 6628 _DYN_TEARDOWN 6629 /* @min:%2eteardown */ 6630 ] = true; 6631 pluginState[ 6632 _DYN_IS_INITIALIZED 6633 /* @min:%2eisInitialized */ 6634 ] = false; 6635 if (plugin2[ 6636 _DYN_TEARDOWN 6637 /* @min:%2eteardown */ 6638 ] && plugin2[ 6639 _DYN_TEARDOWN 6640 /* @min:%2eteardown */ 6641 ](unloadCtx, unloadState) === true) { 6642 hasRun = true; 6643 } 6644 } 6645 } 6646 return hasRun; 6647 } 6648 if (!_processChain(unloadCtx, _callTeardown, "unload", function() { 6649 }, unloadState.isAsync)) { 6650 unloadCtx[ 6651 _DYN_PROCESS_NEXT 6652 /* @min:%2eprocessNext */ 6653 ](unloadState); 6654 } 6655 } 6656 function _updatePlugin(updateCtx, updateState) { 6657 function _callUpdate() { 6658 var hasRun = false; 6659 if (plugin2) { 6660 var pluginState = _getPluginState(plugin2); 6661 var pluginCore = plugin2[STR_CORE] || pluginState[ 6662 STR_CORE 6663 /* @min:%2ecore */ 6664 ]; 6665 if (plugin2 && (!pluginCore || pluginCore === updateCtx.core()) && !pluginState[ 6666 _DYN_TEARDOWN 6667 /* @min:%2eteardown */ 6668 ]) { 6669 if (plugin2[ 6670 _DYN_UPDATE 6671 /* @min:%2eupdate */ 6672 ] && plugin2[ 6673 _DYN_UPDATE 6674 /* @min:%2eupdate */ 6675 ](updateCtx, updateState) === true) { 6676 hasRun = true; 6677 } 6678 } 6679 } 6680 return hasRun; 6681 } 6682 if (!_processChain(updateCtx, _callUpdate, "update", function() { 6683 }, false)) { 6684 updateCtx[ 6685 _DYN_PROCESS_NEXT 6686 /* @min:%2eprocessNext */ 6687 ](updateState); 6688 } 6689 } 6690 return objFreeze(proxyChain); 6691} 6692function createUnloadHandlerContainer() { 6693 var handlers = []; 6694 function _addHandler2(handler) { 6695 if (handler) { 6696 handlers[ 6697 _DYN_PUSH$1 6698 /* @min:%2epush */ 6699 ](handler); 6700 } 6701 } 6702 function _runHandlers(unloadCtx, unloadState) { 6703 arrForEach(handlers, function(handler) { 6704 try { 6705 handler(unloadCtx, unloadState); 6706 } catch (e) { 6707 _throwInternal(unloadCtx[ 6708 _DYN_DIAG_LOG$2 6709 /* @min:%2ediagLog */ 6710 ](), 2, 73, "Unexpected error calling unload handler - " + /* @__PURE__ */ dumpObj(e)); 6711 } 6712 }); 6713 handlers = []; 6714 } 6715 return { 6716 add: _addHandler2, 6717 run: _runHandlers 6718 }; 6719} 6720function createUnloadHookContainer() { 6721 var _hooks = []; 6722 function _doUnload(logger) { 6723 var oldHooks = _hooks; 6724 _hooks = []; 6725 arrForEach(oldHooks, function(fn) { 6726 try { 6727 (fn.rm || fn.remove).call(fn); 6728 } catch (e) { 6729 _throwInternal(logger, 2, 73, "Unloading:" + /* @__PURE__ */ dumpObj(e)); 6730 } 6731 }); 6732 } 6733 function _addHook(hooks) { 6734 if (hooks) { 6735 arrAppend(_hooks, hooks); 6736 } 6737 } 6738 return { 6739 run: _doUnload, 6740 add: _addHook 6741 }; 6742} 6743var _a$7; 6744var strGetPlugin = "getPlugin"; 6745var defaultValues$1 = (_a$7 = {}, _a$7[STR_EXTENSION_CONFIG] = { isVal: isNotNullOrUndefined, v: {} }, _a$7); 6746var BaseTelemetryPlugin = ( 6747 /** @class */ 6748 function() { 6749 function BaseTelemetryPlugin2() { 6750 var _self = this; 6751 var _isinitialized; 6752 var _rootCtx; 6753 var _nextPlugin; 6754 var _unloadHandlerContainer; 6755 var _hookContainer; 6756 _initDefaults(); 6757 dynamicProto(BaseTelemetryPlugin2, _self, function(_self2) { 6758 _self2[ 6759 _DYN_INITIALIZE$1 6760 /* @min:%2einitialize */ 6761 ] = function(config, core, extensions, pluginChain) { 6762 _setDefaults(config, core, pluginChain); 6763 _isinitialized = true; 6764 }; 6765 _self2[ 6766 _DYN_TEARDOWN 6767 /* @min:%2eteardown */ 6768 ] = function(unloadCtx, unloadState) { 6769 var core = _self2[ 6770 STR_CORE 6771 /* @min:%2ecore */ 6772 ]; 6773 if (!core || unloadCtx && core !== unloadCtx[ 6774 STR_CORE 6775 /* @min:%2ecore */ 6776 ]()) { 6777 return; 6778 } 6779 var result; 6780 var unloadDone = false;
vendor: 9,544 bytes, lines 6781-7079
6781 var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin); 6782 var theUnloadState = unloadState || { 6783 reason: 0, 6784 isAsync: false 6785 }; 6786 function _unloadCallback() { 6787 if (!unloadDone) { 6788 unloadDone = true; 6789 _unloadHandlerContainer.run(theUnloadCtx, unloadState); 6790 _hookContainer.run(theUnloadCtx[ 6791 _DYN_DIAG_LOG$2 6792 /* @min:%2ediagLog */ 6793 ]()); 6794 if (result === true) { 6795 theUnloadCtx[ 6796 _DYN_PROCESS_NEXT 6797 /* @min:%2eprocessNext */ 6798 ](theUnloadState); 6799 } 6800 _initDefaults(); 6801 } 6802 } 6803 if (!_self2[ 6804 _DYN__DO_TEARDOWN 6805 /* @min:%2e_doTeardown */ 6806 ] || _self2[ 6807 _DYN__DO_TEARDOWN 6808 /* @min:%2e_doTeardown */ 6809 ](theUnloadCtx, theUnloadState, _unloadCallback) !== true) { 6810 _unloadCallback(); 6811 } else { 6812 result = true; 6813 } 6814 return result; 6815 }; 6816 _self2[ 6817 _DYN_UPDATE 6818 /* @min:%2eupdate */ 6819 ] = function(updateCtx, updateState) { 6820 var core = _self2[ 6821 STR_CORE 6822 /* @min:%2ecore */ 6823 ]; 6824 if (!core || updateCtx && core !== updateCtx[ 6825 STR_CORE 6826 /* @min:%2ecore */ 6827 ]()) { 6828 return; 6829 } 6830 var result; 6831 var updateDone = false; 6832 var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin); 6833 var theUpdateState = updateState || { 6834 reason: 0 6835 /* TelemetryUpdateReason.Unknown */ 6836 }; 6837 function _updateCallback() { 6838 if (!updateDone) { 6839 updateDone = true; 6840 _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx[ 6841 _DYN_GET_NEXT 6842 /* @min:%2egetNext */ 6843 ]()); 6844 } 6845 } 6846 if (!_self2._doUpdate || _self2._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) { 6847 _updateCallback(); 6848 } else { 6849 result = true; 6850 } 6851 return result; 6852 }; 6853 proxyFunctionAs(_self2, "_addUnloadCb", function() { 6854 return _unloadHandlerContainer; 6855 }, "add"); 6856 proxyFunctionAs(_self2, "_addHook", function() { 6857 return _hookContainer; 6858 }, "add"); 6859 objDefine(_self2, "_unloadHooks", { g: function() { 6860 return _hookContainer; 6861 } }); 6862 }); 6863 _self[ 6864 _DYN_DIAG_LOG$2 6865 /* @min:%2ediagLog */ 6866 ] = function(itemCtx) { 6867 return _getTelCtx(itemCtx)[ 6868 _DYN_DIAG_LOG$2 6869 /* @min:%2ediagLog */ 6870 ](); 6871 }; 6872 _self[ 6873 _DYN_IS_INITIALIZED 6874 /* @min:%2eisInitialized */ 6875 ] = function() { 6876 return _isinitialized; 6877 }; 6878 _self.setInitialized = function(isInitialized) { 6879 _isinitialized = isInitialized; 6880 }; 6881 _self[ 6882 _DYN_SET_NEXT_PLUGIN 6883 /* @min:%2esetNextPlugin */ 6884 ] = function(next) { 6885 _nextPlugin = next; 6886 }; 6887 _self[ 6888 _DYN_PROCESS_NEXT 6889 /* @min:%2eprocessNext */ 6890 ] = function(env, itemCtx) { 6891 if (itemCtx) { 6892 itemCtx[ 6893 _DYN_PROCESS_NEXT 6894 /* @min:%2eprocessNext */ 6895 ](env); 6896 } else if (_nextPlugin && isFunction(_nextPlugin[ 6897 STR_PROCESS_TELEMETRY 6898 /* @min:%2eprocessTelemetry */ 6899 ])) { 6900 _nextPlugin[ 6901 STR_PROCESS_TELEMETRY 6902 /* @min:%2eprocessTelemetry */ 6903 ](env, null); 6904 } 6905 }; 6906 _self._getTelCtx = _getTelCtx; 6907 function _getTelCtx(currentCtx) { 6908 if (currentCtx === void 0) { 6909 currentCtx = null; 6910 } 6911 var itemCtx = currentCtx; 6912 if (!itemCtx) { 6913 var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self[ 6914 STR_CORE 6915 /* @min:%2ecore */ 6916 ]); 6917 if (_nextPlugin && _nextPlugin[strGetPlugin]) { 6918 itemCtx = rootCtx[ 6919 _DYN_CREATE_NEW 6920 /* @min:%2ecreateNew */ 6921 ](null, _nextPlugin[strGetPlugin]); 6922 } else { 6923 itemCtx = rootCtx[ 6924 _DYN_CREATE_NEW 6925 /* @min:%2ecreateNew */ 6926 ](null, _nextPlugin); 6927 } 6928 } 6929 return itemCtx; 6930 } 6931 function _setDefaults(config, core, pluginChain) { 6932 createDynamicConfig(config, defaultValues$1, safeGetLogger(core)); 6933 if (!pluginChain && core) { 6934 pluginChain = core[ 6935 _DYN_GET_PROCESS_TEL_CONT2 6936 /* @min:%2egetProcessTelContext */ 6937 ]()[ 6938 _DYN_GET_NEXT 6939 /* @min:%2egetNext */ 6940 ](); 6941 } 6942 var nextPlugin = _nextPlugin; 6943 if (_nextPlugin && _nextPlugin[strGetPlugin]) { 6944 nextPlugin = _nextPlugin[strGetPlugin](); 6945 } 6946 _self[ 6947 STR_CORE 6948 /* @min:%2ecore */ 6949 ] = core; 6950 _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin); 6951 } 6952 function _initDefaults() { 6953 _isinitialized = false; 6954 _self[ 6955 STR_CORE 6956 /* @min:%2ecore */ 6957 ] = null; 6958 _rootCtx = null; 6959 _nextPlugin = null; 6960 _hookContainer = createUnloadHookContainer(); 6961 _unloadHandlerContainer = createUnloadHandlerContainer(); 6962 } 6963 } 6964 BaseTelemetryPlugin2.__ieDyn = 1; 6965 return BaseTelemetryPlugin2; 6966 }() 6967); 6968function _addInitializer(_initializers, id, telemetryInitializer) { 6969 var theInitializer = { 6970 id, 6971 fn: telemetryInitializer 6972 }; 6973 arrAppend(_initializers, theInitializer); 6974 var handler = { 6975 remove: function() { 6976 arrForEach(_initializers, function(initializer, idx) { 6977 if (initializer.id === theInitializer.id) { 6978 _initializers[ 6979 _DYN_SPLICE 6980 /* @min:%2esplice */ 6981 ](idx, 1); 6982 return -1; 6983 } 6984 }); 6985 } 6986 }; 6987 return handler; 6988} 6989function _runInitializers(_initializers, item, logger) { 6990 var doNotSendItem = false; 6991 var telemetryInitializersCount = _initializers[ 6992 _DYN_LENGTH$4 6993 /* @min:%2elength */ 6994 ]; 6995 for (var i2 = 0; i2 < telemetryInitializersCount; ++i2) { 6996 var telemetryInitializer = _initializers[i2]; 6997 if (telemetryInitializer) { 6998 try { 6999 if (telemetryInitializer.fn[ 7000 _DYN_APPLY 7001 /* @min:%2eapply */ 7002 ](null, [item]) === false) { 7003 doNotSendItem = true; 7004 break; 7005 } 7006 } catch (e) { 7007 _throwInternal(logger, 2, 64, "Telemetry initializer failed: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }, true); 7008 } 7009 } 7010 } 7011 return !doNotSendItem; 7012} 7013var TelemetryInitializerPlugin = ( 7014 /** @class */ 7015 function(_super) { 7016 __extendsFn(TelemetryInitializerPlugin2, _super); 7017 function TelemetryInitializerPlugin2() { 7018 var _this = _super.call(this) || this; 7019 _this.identifier = "TelemetryInitializerPlugin"; 7020 _this.priority = 199; 7021 var _id; 7022 var _initializers; 7023 _initDefaults(); 7024 dynamicProto(TelemetryInitializerPlugin2, _this, function(_self, _base) { 7025 _self.addTelemetryInitializer = function(telemetryInitializer) { 7026 return _addInitializer(_initializers, _id++, telemetryInitializer); 7027 }; 7028 _self[ 7029 STR_PROCESS_TELEMETRY 7030 /* @min:%2eprocessTelemetry */ 7031 ] = function(item, itemCtx) { 7032 if (_runInitializers(_initializers, item, itemCtx ? itemCtx[ 7033 _DYN_DIAG_LOG$2 7034 /* @min:%2ediagLog */ 7035 ]() : _self[ 7036 _DYN_DIAG_LOG$2 7037 /* @min:%2ediagLog */ 7038 ]())) { 7039 _self[ 7040 _DYN_PROCESS_NEXT 7041 /* @min:%2eprocessNext */ 7042 ](item, itemCtx); 7043 } 7044 }; 7045 _self[ 7046 _DYN__DO_TEARDOWN 7047 /* @min:%2e_doTeardown */ 7048 ] = function() { 7049 _initDefaults(); 7050 }; 7051 }); 7052 function _initDefaults() { 7053 _id = 0; 7054 _initializers = []; 7055 } 7056 return _this; 7057 } 7058 TelemetryInitializerPlugin2.__ieDyn = 1; 7059 return TelemetryInitializerPlugin2; 7060 }(BaseTelemetryPlugin) 7061); 7062var _a$6; 7063var strValidationError = "Plugins must provide initialize method"; 7064var strNotificationManager = "_notificationManager"; 7065var strSdkUnloadingError = "SDK is still unloading..."; 7066var strSdkNotInitialized = "SDK is not initialized"; 7067var maxInitQueueSize = 100; 7068var maxInitTimeout = 5e4; 7069var defaultConfig = objDeepFreeze((_a$6 = { 7070 cookieCfg: {} 7071}, _a$6[STR_EXTENSIONS] = { rdOnly: true, ref: true, v: [] }, _a$6[STR_CHANNELS] = { rdOnly: true, ref: true, v: [] }, _a$6[STR_EXTENSION_CONFIG] = { ref: true, v: {} }, _a$6[STR_CREATE_PERF_MGR] = UNDEFINED_VALUE$2, _a$6.loggingLevelConsole = 0, _a$6.diagnosticLogInterval = UNDEFINED_VALUE$2, _a$6)); 7072function _createPerfManager(core, notificationMgr) { 7073 return new PerfManager(notificationMgr); 7074} 7075function _validateExtensions(logger, channelPriority, allExtensions) { 7076 var coreExtensions = []; 7077 var channels = []; 7078 var extPriorities = {}; 7079 arrForEach(allExtensions, function(ext) {
7080 if (/* @__PURE__ */ isNullOrUndefined(ext) || /* @__PURE__ */ isNullOrUndefined(ext[ 7081 _DYN_INITIALIZE$1 7082 /* @min:%2einitialize */ 7083 ])) { 7084 throwError(strValidationError); 7085 } 7086 var extPriority = ext[ 7087 STR_PRIORITY 7088 /* @min:%2epriority */ 7089 ]; 7090 var identifier = ext[ 7091 _DYN_IDENTIFIER 7092 /* @min:%2eidentifier */ 7093 ]; 7094 if (ext && extPriority) { 7095 if (!/* @__PURE__ */ isNullOrUndefined(extPriorities[extPriority])) { 7096 _warnToConsole(logger, "Two extensions have same priority #" + extPriority + " - " + extPriorities[extPriority] + ", " + identifier); 7097 } else { 7098 extPriorities[extPriority] = identifier; 7099 } 7100 } 7101 if (!extPriority || extPriority < channelPriority) { 7102 coreExtensions[ 7103 _DYN_PUSH$1 7104 /* @min:%2epush */ 7105 ](ext); 7106 } else { 7107 channels[ 7108 _DYN_PUSH$1 7109 /* @min:%2epush */ 7110 ](ext); 7111 } 7112 }); 7113 return { 7114 core: coreExtensions, 7115 channels 7116 }; 7117} 7118function _isPluginPresent(thePlugin, plugins2) { 7119 var exists = false; 7120 arrForEach(plugins2, function(plugin2) { 7121 if (plugin2 === thePlugin) { 7122 exists = true; 7123 return -1; 7124 } 7125 }); 7126 return exists; 7127} 7128function _deepMergeConfig(details, target, newValues, merge) { 7129 if (newValues) { 7130 objForEachKey(newValues, function(key, value) { 7131 if (merge) {
vendor: 5,000 bytes, lines 7132-7298
7132 if (/* @__PURE__ */ isPlainObject(value) && /* @__PURE__ */ isPlainObject(target[key])) { 7133 _deepMergeConfig(details, target[key], value, merge); 7134 } 7135 } 7136 if (merge && /* @__PURE__ */ isPlainObject(value) && /* @__PURE__ */ isPlainObject(target[key])) { 7137 _deepMergeConfig(details, target[key], value, merge); 7138 } else { 7139 details.set(target, key, value); 7140 } 7141 }); 7142 } 7143} 7144function _findWatcher(listeners, newWatcher) { 7145 var theListener = null; 7146 var idx = -1; 7147 arrForEach(listeners, function(listener, lp) { 7148 if (listener.w === newWatcher) { 7149 theListener = listener; 7150 idx = lp; 7151 return -1; 7152 } 7153 }); 7154 return { i: idx, l: theListener }; 7155} 7156function _addDelayedCfgListener(listeners, newWatcher) { 7157 var theListener = _findWatcher(listeners, newWatcher).l; 7158 if (!theListener) { 7159 theListener = { 7160 w: newWatcher, 7161 rm: function() { 7162 var fnd = _findWatcher(listeners, newWatcher); 7163 if (fnd.i !== -1) { 7164 listeners[ 7165 _DYN_SPLICE 7166 /* @min:%2esplice */ 7167 ](fnd.i, 1); 7168 } 7169 } 7170 }; 7171 listeners[ 7172 _DYN_PUSH$1 7173 /* @min:%2epush */ 7174 ](theListener); 7175 } 7176 return theListener; 7177} 7178function _registerDelayedCfgListener(config, listeners, logger) { 7179 arrForEach(listeners, function(listener) { 7180 var unloadHdl = onConfigChange(config, listener.w, logger); 7181 delete listener.w; 7182 listener.rm = function() { 7183 unloadHdl.rm(); 7184 }; 7185 }); 7186} 7187function _initDebugListener(configHandler, unloadContainer, notificationManager, debugListener) { 7188 unloadContainer.add(configHandler[ 7189 _DYN_WATCH 7190 /* @min:%2ewatch */ 7191 ](function(details) { 7192 var disableDbgExt = details.cfg.disableDbgExt; 7193 if (disableDbgExt === true && debugListener) { 7194 notificationManager[ 7195 _DYN_REMOVE_NOTIFICATION_0 7196 /* @min:%2eremoveNotificationListener */ 7197 ](debugListener); 7198 debugListener = null; 7199 } 7200 if (notificationManager && !debugListener && disableDbgExt !== true) { 7201 debugListener = getDebugListener(details.cfg); 7202 notificationManager[ 7203 _DYN_ADD_NOTIFICATION_LIS1 7204 /* @min:%2eaddNotificationListener */ 7205 ](debugListener); 7206 } 7207 })); 7208 return debugListener; 7209} 7210function _createUnloadHook(unloadHook) { 7211 return objDefine({ 7212 rm: function() { 7213 unloadHook.rm(); 7214 } 7215 }, "toJSON", { v: function() { 7216 return "aicore::onCfgChange<" + JSON.stringify(unloadHook) + ">"; 7217 } }); 7218} 7219var AppInsightsCore = ( 7220 /** @class */ 7221 function() { 7222 function AppInsightsCore2() { 7223 var _configHandler; 7224 var _isInitialized; 7225 var _logger; 7226 var _eventQueue; 7227 var _notificationManager; 7228 var _perfManager; 7229 var _cfgPerfManager; 7230 var _cookieManager; 7231 var _pluginChain; 7232 var _configExtensions; 7233 var _channelConfig; 7234 var _channels; 7235 var _isUnloading; 7236 var _telemetryInitializerPlugin; 7237 var _internalLogsEventName; 7238 var _evtNamespace; 7239 var _unloadHandlers; 7240 var _hookContainer; 7241 var _debugListener2; 7242 var _traceCtx; 7243 var _instrumentationKey; 7244 var _cfgListeners; 7245 var _extensions; 7246 var _pluginVersionStringArr; 7247 var _pluginVersionString; 7248 var _activeStatus; 7249 var _endpoint; 7250 var _initInMemoMaxSize; 7251 var _isStatusSet; 7252 var _initTimer; 7253 var _internalLogPoller; 7254 var _internalLogPollerListening; 7255 var _forceStopInternalLogPoller; 7256 dynamicProto(AppInsightsCore2, this, function(_self) { 7257 _initDefaults(); 7258 _self["_getDbgPlgTargets"] = function() { 7259 return [_extensions, _eventQueue]; 7260 }; 7261 _self[ 7262 _DYN_IS_INITIALIZED 7263 /* @min:%2eisInitialized */ 7264 ] = function() { 7265 return _isInitialized; 7266 }; 7267 _self.activeStatus = function() { 7268 return _activeStatus; 7269 }; 7270 _self._setPendingStatus = function() { 7271 _activeStatus = 3; 7272 }; 7273 _self[ 7274 _DYN_INITIALIZE$1 7275 /* @min:%2einitialize */ 7276 ] = function(config, extensions, logger, notificationManager) { 7277 if (_isUnloading) { 7278 throwError(strSdkUnloadingError); 7279 } 7280 if (_self[ 7281 _DYN_IS_INITIALIZED 7282 /* @min:%2eisInitialized */ 7283 ]()) { 7284 throwError("Core cannot be initialized more than once"); 7285 } 7286 _configHandler = createDynamicConfig(config, defaultConfig, logger || _self[ 7287 _DYN_LOGGER 7288 /* @min:%2elogger */ 7289 ], false); 7290 config = _configHandler.cfg; 7291 _addUnloadHook(_configHandler[ 7292 _DYN_WATCH 7293 /* @min:%2ewatch */ 7294 ](function(details) { 7295 var rootCfg = details.cfg; 7296 _initInMemoMaxSize = rootCfg.initInMemoMaxSize || maxInitQueueSize; 7297 _handleIKeyEndpointPromises(rootCfg); 7298 var extCfg = details.ref(details.cfg, STR_EXTENSION_CONFIG);
vendor: 2,688 bytes, lines 7299-7377
7299 objForEachKey(extCfg, function(key) { 7300 details.ref(extCfg, key); 7301 }); 7302 })); 7303 _notificationManager = notificationManager; 7304 _debugListener2 = _initDebugListener(_configHandler, _hookContainer, _notificationManager && _self[ 7305 _DYN_GET_NOTIFY_MGR 7306 /* @min:%2egetNotifyMgr */ 7307 ](), _debugListener2); 7308 _initPerfManager(); 7309 _self[ 7310 _DYN_LOGGER 7311 /* @min:%2elogger */ 7312 ] = logger; 7313 var cfgExtensions = config[ 7314 STR_EXTENSIONS 7315 /* @min:%2eextensions */ 7316 ]; 7317 _configExtensions = []; 7318 _configExtensions[ 7319 _DYN_PUSH$1 7320 /* @min:%2epush */ 7321 ].apply(_configExtensions, __spreadArrayFn(__spreadArrayFn([], extensions, false), cfgExtensions)); 7322 _channelConfig = config[ 7323 STR_CHANNELS 7324 /* @min:%2echannels */ 7325 ]; 7326 _initPluginChain(null); 7327 if (!_channels || _channels[ 7328 _DYN_LENGTH$4 7329 /* @min:%2elength */ 7330 ] === 0) { 7331 throwError("No " + STR_CHANNELS + " available"); 7332 } 7333 if (_channelConfig && _channelConfig[ 7334 _DYN_LENGTH$4 7335 /* @min:%2elength */ 7336 ] > 1) { 7337 var teeController = _self[ 7338 _DYN_GET_PLUGIN 7339 /* @min:%2egetPlugin */ 7340 ]("TeeChannelController"); 7341 if (!teeController || !teeController.plugin) { 7342 _throwInternal(_logger, 1, 28, "TeeChannel required"); 7343 } 7344 } 7345 _registerDelayedCfgListener(config, _cfgListeners, _logger); 7346 _cfgListeners = null; 7347 _isInitialized = true; 7348 if (_activeStatus === ActiveStatus.ACTIVE) { 7349 _releaseQueues(); 7350 } 7351 }; 7352 _self.getChannels = function() { 7353 var controls = []; 7354 if (_channels) { 7355 arrForEach(_channels, function(channel) { 7356 controls[ 7357 _DYN_PUSH$1 7358 /* @min:%2epush */ 7359 ](channel); 7360 }); 7361 } 7362 return objFreeze(controls); 7363 }; 7364 _self.track = function(telemetryItem) { 7365 doPerf(_self[ 7366 STR_GET_PERF_MGR 7367 /* @min:%2egetPerfMgr */ 7368 ](), function() { 7369 return "AppInsightsCore:track"; 7370 }, function() { 7371 if (telemetryItem === null) { 7372 _notifyInvalidEvent(telemetryItem); 7373 throwError("Invalid telemetry item"); 7374 } 7375 if (!telemetryItem[ 7376 _DYN_NAME$2 7377 /* @min:%2ename */
7378 ] && /* @__PURE__ */ isNullOrUndefined(telemetryItem[ 7379 _DYN_NAME$2 7380 /* @min:%2ename */ 7381 ])) { 7382 _notifyInvalidEvent(telemetryItem); 7383 throwError("telemetry name required"); 7384 } 7385 telemetryItem.iKey = telemetryItem.iKey || _instrumentationKey; 7386 telemetryItem.time = telemetryItem.time || toISOString(/* @__PURE__ */ new Date()); 7387 telemetryItem.ver = telemetryItem.ver || "4.0"; 7388 if (!_isUnloading && _self[ 7389 _DYN_IS_INITIALIZED 7390 /* @min:%2eisInitialized */ 7391 ]() && _activeStatus === ActiveStatus.ACTIVE) { 7392 _createTelCtx()[ 7393 _DYN_PROCESS_NEXT 7394 /* @min:%2eprocessNext */ 7395 ](telemetryItem); 7396 } else if (_activeStatus !== ActiveStatus.INACTIVE) { 7397 if (_eventQueue[ 7398 _DYN_LENGTH$4 7399 /* @min:%2elength */ 7400 ] <= _initInMemoMaxSize) { 7401 _eventQueue[ 7402 _DYN_PUSH$1 7403 /* @min:%2epush */ 7404 ](telemetryItem); 7405 } 7406 } 7407 }, function() { 7408 return { item: telemetryItem }; 7409 }, !telemetryItem.sync); 7410 }; 7411 _self[ 7412 _DYN_GET_PROCESS_TEL_CONT2 7413 /* @min:%2egetProcessTelContext */ 7414 ] = _createTelCtx; 7415 _self[ 7416 _DYN_GET_NOTIFY_MGR 7417 /* @min:%2egetNotifyMgr */ 7418 ] = function() { 7419 if (!_notificationManager) { 7420 _notificationManager = new NotificationManager(_configHandler.cfg); 7421 _self[strNotificationManager] = _notificationManager; 7422 } 7423 return _notificationManager; 7424 }; 7425 _self[ 7426 _DYN_ADD_NOTIFICATION_LIS1 7427 /* @min:%2eaddNotificationListener */ 7428 ] = function(listener) { 7429 _self.getNotifyMgr()[ 7430 _DYN_ADD_NOTIFICATION_LIS1 7431 /* @min:%2eaddNotificationListener */ 7432 ](listener); 7433 }; 7434 _self[ 7435 _DYN_REMOVE_NOTIFICATION_0 7436 /* @min:%2eremoveNotificationListener */ 7437 ] = function(listener) { 7438 if (_notificationManager) { 7439 _notificationManager[ 7440 _DYN_REMOVE_NOTIFICATION_0 7441 /* @min:%2eremoveNotificationListener */ 7442 ](listener); 7443 } 7444 }; 7445 _self.getCookieMgr = function() { 7446 if (!_cookieManager) { 7447 _cookieManager = createCookieMgr(_configHandler.cfg, _self[ 7448 _DYN_LOGGER 7449 /* @min:%2elogger */ 7450 ]); 7451 } 7452 return _cookieManager; 7453 }; 7454 _self.setCookieMgr = function(cookieMgr) { 7455 if (_cookieManager !== cookieMgr) { 7456 runTargetUnload(_cookieManager, false); 7457 _cookieManager = cookieMgr; 7458 } 7459 }; 7460 _self[ 7461 STR_GET_PERF_MGR 7462 /* @min:%2egetPerfMgr */ 7463 ] = function() { 7464 return _perfManager || _cfgPerfManager || getGblPerfMgr(); 7465 }; 7466 _self.setPerfMgr = function(perfMgr) { 7467 _perfManager = perfMgr; 7468 }; 7469 _self.eventCnt = function() { 7470 return _eventQueue[ 7471 _DYN_LENGTH$4 7472 /* @min:%2elength */ 7473 ]; 7474 }; 7475 _self.releaseQueue = function() { 7476 if (_isInitialized && _eventQueue[ 7477 _DYN_LENGTH$4 7478 /* @min:%2elength */ 7479 ] > 0) { 7480 var eventQueue = _eventQueue; 7481 _eventQueue = []; 7482 if (_activeStatus === 2) { 7483 arrForEach(eventQueue, function(event) { 7484 event.iKey = event.iKey || _instrumentationKey; 7485 _createTelCtx()[ 7486 _DYN_PROCESS_NEXT 7487 /* @min:%2eprocessNext */ 7488 ](event); 7489 }); 7490 } else { 7491 _throwInternal(_logger, 2, 20, "core init status is not active"); 7492 } 7493 } 7494 }; 7495 _self.pollInternalLogs = function(eventName) { 7496 _internalLogsEventName = eventName || null; 7497 _forceStopInternalLogPoller = false;
vendor: 28,895 bytes, lines 7498-8337
7498 _internalLogPoller && _internalLogPoller[ 7499 _DYN_CANCEL 7500 /* @min:%2ecancel */ 7501 ](); 7502 return _startLogPoller(true); 7503 }; 7504 function _handleIKeyEndpointPromises(theConfig) { 7505 var ikey = theConfig.instrumentationKey; 7506 var endpointUrl = theConfig.endpointUrl; 7507 if (_activeStatus !== 3) { 7508 if (/* @__PURE__ */ isNullOrUndefined(ikey)) { 7509 _instrumentationKey = null; 7510 _activeStatus = ActiveStatus.INACTIVE; 7511 var msg = "Please provide instrumentation key"; 7512 if (!_isInitialized) { 7513 throwError(msg); 7514 } else { 7515 _throwInternal(_logger, 1, 100, msg); 7516 _releaseQueues(); 7517 } 7518 return; 7519 } 7520 var promises = []; 7521 if (/* @__PURE__ */ isPromiseLike(ikey)) { 7522 promises[ 7523 _DYN_PUSH$1 7524 /* @min:%2epush */ 7525 ](ikey); 7526 _instrumentationKey = null; 7527 } else { 7528 _instrumentationKey = ikey; 7529 } 7530 if (/* @__PURE__ */ isPromiseLike(endpointUrl)) { 7531 promises[ 7532 _DYN_PUSH$1 7533 /* @min:%2epush */ 7534 ](endpointUrl); 7535 _endpoint = null; 7536 } else { 7537 _endpoint = endpointUrl; 7538 } 7539 if (promises[ 7540 _DYN_LENGTH$4 7541 /* @min:%2elength */ 7542 ]) { 7543 _waitForInitPromises(theConfig, promises); 7544 } else { 7545 _setStatus(); 7546 } 7547 } 7548 } 7549 function _waitForInitPromises(theConfig, promises) { 7550 _isStatusSet = false; 7551 _activeStatus = 3; 7552 var initTimeout = isNotNullOrUndefined(theConfig.initTimeOut) ? theConfig.initTimeOut : maxInitTimeout; 7553 var allPromises = createSyncAllSettledPromise(promises); 7554 if (_initTimer) { 7555 _initTimer[ 7556 _DYN_CANCEL 7557 /* @min:%2ecancel */ 7558 ](); 7559 } 7560 _initTimer = scheduleTimeout(function() { 7561 _initTimer = null; 7562 if (!_isStatusSet) { 7563 _setStatus(); 7564 } 7565 }, initTimeout); 7566 doAwaitResponse(allPromises, function(response) { 7567 try { 7568 if (_isStatusSet) { 7569 return; 7570 } 7571 if (!response.rejected) { 7572 var values = response[ 7573 _DYN_VALUE 7574 /* @min:%2evalue */ 7575 ]; 7576 if (values && values[ 7577 _DYN_LENGTH$4 7578 /* @min:%2elength */ 7579 ]) { 7580 var ikeyRes = values[0]; 7581 _instrumentationKey = ikeyRes && ikeyRes[ 7582 _DYN_VALUE 7583 /* @min:%2evalue */ 7584 ]; 7585 if (values[ 7586 _DYN_LENGTH$4 7587 /* @min:%2elength */ 7588 ] > 1) { 7589 var endpointRes = values[1]; 7590 _endpoint = endpointRes && endpointRes[ 7591 _DYN_VALUE 7592 /* @min:%2evalue */ 7593 ]; 7594 } 7595 } 7596 if (_instrumentationKey) { 7597 theConfig.instrumentationKey = _instrumentationKey; 7598 theConfig.endpointUrl = _endpoint; 7599 } 7600 } 7601 _setStatus(); 7602 } catch (e) { 7603 if (!_isStatusSet) { 7604 _setStatus(); 7605 } 7606 } 7607 }); 7608 } 7609 function _setStatus() { 7610 _isStatusSet = true; 7611 if (/* @__PURE__ */ isNullOrUndefined(_instrumentationKey)) { 7612 _activeStatus = ActiveStatus.INACTIVE; 7613 _throwInternal(_logger, 1, 112, "ikey can't be resolved from promises"); 7614 } else { 7615 _activeStatus = ActiveStatus.ACTIVE; 7616 } 7617 _releaseQueues(); 7618 } 7619 function _releaseQueues() { 7620 if (_isInitialized) { 7621 _self.releaseQueue(); 7622 _self.pollInternalLogs(); 7623 } 7624 } 7625 function _startLogPoller(alwaysStart) { 7626 if ((!_internalLogPoller || !_internalLogPoller[ 7627 _DYN_ENABLED 7628 /* @min:%2eenabled */ 7629 ]) && !_forceStopInternalLogPoller) { 7630 var shouldStart = alwaysStart || _logger && _logger.queue[ 7631 _DYN_LENGTH$4 7632 /* @min:%2elength */ 7633 ] > 0; 7634 if (shouldStart) { 7635 if (!_internalLogPollerListening) { 7636 _internalLogPollerListening = true; 7637 _addUnloadHook(_configHandler[ 7638 _DYN_WATCH 7639 /* @min:%2ewatch */ 7640 ](function(details) { 7641 var interval = details.cfg.diagnosticLogInterval; 7642 if (!interval || !(interval > 0)) { 7643 interval = 1e4; 7644 } 7645 var isRunning = false; 7646 if (_internalLogPoller) { 7647 isRunning = _internalLogPoller[ 7648 _DYN_ENABLED 7649 /* @min:%2eenabled */ 7650 ]; 7651 _internalLogPoller[ 7652 _DYN_CANCEL 7653 /* @min:%2ecancel */ 7654 ](); 7655 } 7656 _internalLogPoller = createTimeout(_flushInternalLogs, interval); 7657 _internalLogPoller.unref(); 7658 _internalLogPoller[ 7659 _DYN_ENABLED 7660 /* @min:%2eenabled */ 7661 ] = isRunning; 7662 })); 7663 } 7664 _internalLogPoller[ 7665 _DYN_ENABLED 7666 /* @min:%2eenabled */ 7667 ] = true; 7668 } 7669 } 7670 return _internalLogPoller; 7671 } 7672 _self[ 7673 _DYN_STOP_POLLING_INTERNA3 7674 /* @min:%2estopPollingInternalLogs */ 7675 ] = function() { 7676 _forceStopInternalLogPoller = true; 7677 _internalLogPoller && _internalLogPoller[ 7678 _DYN_CANCEL 7679 /* @min:%2ecancel */ 7680 ](); 7681 _flushInternalLogs(); 7682 }; 7683 proxyFunctions(_self, function() { 7684 return _telemetryInitializerPlugin; 7685 }, ["addTelemetryInitializer"]); 7686 _self[ 7687 _DYN_UNLOAD 7688 /* @min:%2eunload */ 7689 ] = function(isAsync, unloadComplete, cbTimeout) { 7690 if (isAsync === void 0) { 7691 isAsync = true; 7692 } 7693 if (!_isInitialized) { 7694 throwError(strSdkNotInitialized); 7695 } 7696 if (_isUnloading) { 7697 throwError(strSdkUnloadingError); 7698 } 7699 var unloadState = { 7700 reason: 50, 7701 isAsync, 7702 flushComplete: false 7703 }; 7704 var result; 7705 if (isAsync && !unloadComplete) { 7706 result = createPromise(function(resolve) { 7707 unloadComplete = resolve; 7708 }); 7709 } 7710 var processUnloadCtx = createProcessTelemetryUnloadContext(_getPluginChain(), _self); 7711 processUnloadCtx[ 7712 _DYN_ON_COMPLETE 7713 /* @min:%2eonComplete */ 7714 ](function() { 7715 _hookContainer.run(_self[ 7716 _DYN_LOGGER 7717 /* @min:%2elogger */ 7718 ]); 7719 doUnloadAll([_cookieManager, _notificationManager, _logger], isAsync, function() { 7720 _initDefaults(); 7721 unloadComplete && unloadComplete(unloadState); 7722 }); 7723 }, _self); 7724 function _doUnload(flushComplete) { 7725 unloadState.flushComplete = flushComplete; 7726 _isUnloading = true; 7727 _unloadHandlers.run(processUnloadCtx, unloadState); 7728 _self[ 7729 _DYN_STOP_POLLING_INTERNA3 7730 /* @min:%2estopPollingInternalLogs */ 7731 ](); 7732 processUnloadCtx[ 7733 _DYN_PROCESS_NEXT 7734 /* @min:%2eprocessNext */ 7735 ](unloadState); 7736 } 7737 _flushInternalLogs(); 7738 if (!_flushChannels(isAsync, _doUnload, 6, cbTimeout)) ; 7739 return result; 7740 }; 7741 _self[ 7742 _DYN_GET_PLUGIN 7743 /* @min:%2egetPlugin */ 7744 ] = _getPlugin; 7745 _self.addPlugin = function(plugin2, replaceExisting, isAsync, addCb) { 7746 if (!plugin2) { 7747 addCb && addCb(false); 7748 _logOrThrowError(strValidationError); 7749 return; 7750 } 7751 var existingPlugin = _getPlugin(plugin2[ 7752 _DYN_IDENTIFIER 7753 /* @min:%2eidentifier */ 7754 ]); 7755 if (existingPlugin && !replaceExisting) { 7756 addCb && addCb(false); 7757 _logOrThrowError("Plugin [" + plugin2[ 7758 _DYN_IDENTIFIER 7759 /* @min:%2eidentifier */ 7760 ] + "] is already loaded!"); 7761 return; 7762 } 7763 var updateState = { 7764 reason: 16 7765 /* TelemetryUpdateReason.PluginAdded */ 7766 }; 7767 function _addPlugin(removed) { 7768 _configExtensions[ 7769 _DYN_PUSH$1 7770 /* @min:%2epush */ 7771 ](plugin2); 7772 updateState.added = [plugin2]; 7773 _initPluginChain(updateState); 7774 addCb && addCb(true); 7775 } 7776 if (existingPlugin) { 7777 var removedPlugins_1 = [existingPlugin.plugin]; 7778 var unloadState = { 7779 reason: 2, 7780 isAsync: !!isAsync 7781 }; 7782 _removePlugins(removedPlugins_1, unloadState, function(removed) { 7783 if (!removed) { 7784 addCb && addCb(false); 7785 } else { 7786 updateState.removed = removedPlugins_1; 7787 updateState.reason |= 32; 7788 _addPlugin(); 7789 } 7790 }); 7791 } else { 7792 _addPlugin(); 7793 } 7794 }; 7795 _self.updateCfg = function(newConfig, mergeExisting) { 7796 if (mergeExisting === void 0) { 7797 mergeExisting = true; 7798 } 7799 var updateState; 7800 if (_self[ 7801 _DYN_IS_INITIALIZED 7802 /* @min:%2eisInitialized */ 7803 ]()) { 7804 updateState = { 7805 reason: 1, 7806 cfg: _configHandler.cfg, 7807 oldCfg: deepExtend({}, _configHandler.cfg), 7808 newConfig: deepExtend({}, newConfig), 7809 merge: mergeExisting 7810 }; 7811 newConfig = updateState.newConfig; 7812 var cfg = _configHandler.cfg; 7813 newConfig[ 7814 STR_EXTENSIONS 7815 /* @min:%2eextensions */ 7816 ] = cfg[ 7817 STR_EXTENSIONS 7818 /* @min:%2eextensions */ 7819 ]; 7820 newConfig[ 7821 STR_CHANNELS 7822 /* @min:%2echannels */ 7823 ] = cfg[ 7824 STR_CHANNELS 7825 /* @min:%2echannels */ 7826 ]; 7827 } 7828 _configHandler._block(function(details) { 7829 var theConfig = details.cfg; 7830 _deepMergeConfig(details, theConfig, newConfig, mergeExisting); 7831 if (!mergeExisting) { 7832 objForEachKey(theConfig, function(key) { 7833 if (!objHasOwn(newConfig, key)) { 7834 details.set(theConfig, key, UNDEFINED_VALUE$2); 7835 } 7836 }); 7837 } 7838 details.setDf(theConfig, defaultConfig); 7839 }, true); 7840 _configHandler.notify(); 7841 if (updateState) { 7842 _doUpdate(updateState); 7843 } 7844 }; 7845 _self.evtNamespace = function() { 7846 return _evtNamespace; 7847 }; 7848 _self.flush = _flushChannels; 7849 _self.getTraceCtx = function(createNew) { 7850 if (!_traceCtx) { 7851 _traceCtx = createDistributedTraceContext(); 7852 } 7853 return _traceCtx; 7854 }; 7855 _self.setTraceCtx = function(traceCtx) { 7856 _traceCtx = traceCtx || null; 7857 }; 7858 _self.addUnloadHook = _addUnloadHook; 7859 proxyFunctionAs(_self, "addUnloadCb", function() { 7860 return _unloadHandlers; 7861 }, "add"); 7862 _self.onCfgChange = function(handler) { 7863 var unloadHook; 7864 if (!_isInitialized) { 7865 unloadHook = _addDelayedCfgListener(_cfgListeners, handler); 7866 } else { 7867 unloadHook = onConfigChange(_configHandler.cfg, handler, _self[ 7868 _DYN_LOGGER 7869 /* @min:%2elogger */ 7870 ]); 7871 } 7872 return _createUnloadHook(unloadHook); 7873 }; 7874 _self.getWParam = function() { 7875 return /* @__PURE__ */ hasDocument() || !!_configHandler.cfg.enableWParam ? 0 : -1; 7876 }; 7877 function _setPluginVersions() { 7878 var thePlugins = {}; 7879 _pluginVersionStringArr = []; 7880 var _addPluginVersions = function(plugins2) { 7881 if (plugins2) { 7882 arrForEach(plugins2, function(plugin2) { 7883 if (plugin2[ 7884 _DYN_IDENTIFIER 7885 /* @min:%2eidentifier */ 7886 ] && plugin2[ 7887 _DYN_VERSION$1 7888 /* @min:%2eversion */ 7889 ] && !thePlugins[plugin2.identifier]) { 7890 var ver = plugin2[ 7891 _DYN_IDENTIFIER 7892 /* @min:%2eidentifier */ 7893 ] + "=" + plugin2[ 7894 _DYN_VERSION$1 7895 /* @min:%2eversion */ 7896 ]; 7897 _pluginVersionStringArr[ 7898 _DYN_PUSH$1 7899 /* @min:%2epush */ 7900 ](ver); 7901 thePlugins[plugin2.identifier] = plugin2; 7902 } 7903 }); 7904 } 7905 }; 7906 _addPluginVersions(_channels); 7907 if (_channelConfig) { 7908 arrForEach(_channelConfig, function(channels) { 7909 _addPluginVersions(channels); 7910 }); 7911 } 7912 _addPluginVersions(_configExtensions); 7913 } 7914 function _initDefaults() { 7915 _isInitialized = false; 7916 _configHandler = createDynamicConfig({}, defaultConfig, _self[ 7917 _DYN_LOGGER 7918 /* @min:%2elogger */ 7919 ]); 7920 _configHandler.cfg[ 7921 _DYN_LOGGING_LEVEL_CONSOL4 7922 /* @min:%2eloggingLevelConsole */ 7923 ] = 1; 7924 objDefine(_self, "config", { 7925 g: function() { 7926 return _configHandler.cfg; 7927 }, 7928 s: function(newValue) { 7929 _self.updateCfg(newValue, false); 7930 } 7931 }); 7932 objDefine(_self, "pluginVersionStringArr", { 7933 g: function() { 7934 if (!_pluginVersionStringArr) { 7935 _setPluginVersions(); 7936 } 7937 return _pluginVersionStringArr; 7938 } 7939 }); 7940 objDefine(_self, "pluginVersionString", { 7941 g: function() { 7942 if (!_pluginVersionString) { 7943 if (!_pluginVersionStringArr) { 7944 _setPluginVersions(); 7945 } 7946 _pluginVersionString = _pluginVersionStringArr.join(";"); 7947 } 7948 return _pluginVersionString || STR_EMPTY$1; 7949 } 7950 }); 7951 objDefine(_self, "logger", { 7952 g: function() { 7953 if (!_logger) { 7954 _logger = new DiagnosticLogger(_configHandler.cfg); 7955 _configHandler[ 7956 _DYN_LOGGER 7957 /* @min:%2elogger */ 7958 ] = _logger; 7959 } 7960 return _logger; 7961 }, 7962 s: function(newLogger) { 7963 _configHandler[ 7964 _DYN_LOGGER 7965 /* @min:%2elogger */ 7966 ] = newLogger; 7967 if (_logger !== newLogger) { 7968 runTargetUnload(_logger, false); 7969 _logger = newLogger; 7970 } 7971 } 7972 }); 7973 _self[ 7974 _DYN_LOGGER 7975 /* @min:%2elogger */ 7976 ] = new DiagnosticLogger(_configHandler.cfg); 7977 _extensions = []; 7978 var cfgExtensions = _self.config[ 7979 STR_EXTENSIONS 7980 /* @min:%2eextensions */ 7981 ] || []; 7982 cfgExtensions.splice(0, cfgExtensions[ 7983 _DYN_LENGTH$4 7984 /* @min:%2elength */ 7985 ]); 7986 arrAppend(cfgExtensions, _extensions); 7987 _telemetryInitializerPlugin = new TelemetryInitializerPlugin(); 7988 _eventQueue = []; 7989 runTargetUnload(_notificationManager, false); 7990 _notificationManager = null; 7991 _perfManager = null; 7992 _cfgPerfManager = null; 7993 runTargetUnload(_cookieManager, false); 7994 _cookieManager = null; 7995 _pluginChain = null; 7996 _configExtensions = []; 7997 _channelConfig = null; 7998 _channels = null; 7999 _isUnloading = false; 8000 _internalLogsEventName = null; 8001 _evtNamespace = createUniqueNamespace("AIBaseCore", true); 8002 _unloadHandlers = createUnloadHandlerContainer(); 8003 _traceCtx = null; 8004 _instrumentationKey = null; 8005 _hookContainer = createUnloadHookContainer(); 8006 _cfgListeners = []; 8007 _pluginVersionString = null; 8008 _pluginVersionStringArr = null; 8009 _forceStopInternalLogPoller = false; 8010 _internalLogPoller = null; 8011 _internalLogPollerListening = false; 8012 _activeStatus = 0; 8013 _endpoint = null; 8014 _initInMemoMaxSize = null; 8015 _isStatusSet = false; 8016 _initTimer = null; 8017 } 8018 function _createTelCtx() { 8019 var theCtx = createProcessTelemetryContext(_getPluginChain(), _configHandler.cfg, _self); 8020 theCtx[ 8021 _DYN_ON_COMPLETE 8022 /* @min:%2eonComplete */ 8023 ](_startLogPoller); 8024 return theCtx; 8025 } 8026 function _initPluginChain(updateState) { 8027 var theExtensions = _validateExtensions(_self[ 8028 _DYN_LOGGER 8029 /* @min:%2elogger */ 8030 ], ChannelControllerPriority, _configExtensions); 8031 _pluginChain = null; 8032 _pluginVersionString = null; 8033 _pluginVersionStringArr = null; 8034 _channels = (_channelConfig || [])[0] || []; 8035 _channels = sortPlugins(arrAppend(_channels, theExtensions[ 8036 STR_CHANNELS 8037 /* @min:%2echannels */ 8038 ])); 8039 var allExtensions = arrAppend(sortPlugins(theExtensions[ 8040 STR_CORE 8041 /* @min:%2ecore */ 8042 ]), _channels); 8043 _extensions = objFreeze(allExtensions); 8044 var cfgExtensions = _self.config[ 8045 STR_EXTENSIONS 8046 /* @min:%2eextensions */ 8047 ] || []; 8048 cfgExtensions.splice(0, cfgExtensions[ 8049 _DYN_LENGTH$4 8050 /* @min:%2elength */ 8051 ]); 8052 arrAppend(cfgExtensions, _extensions); 8053 var rootCtx = _createTelCtx(); 8054 if (_channels && _channels[ 8055 _DYN_LENGTH$4 8056 /* @min:%2elength */ 8057 ] > 0) { 8058 initializePlugins(rootCtx[ 8059 _DYN_CREATE_NEW 8060 /* @min:%2ecreateNew */ 8061 ](_channels), allExtensions); 8062 } 8063 initializePlugins(rootCtx, allExtensions); 8064 if (updateState) { 8065 _doUpdate(updateState); 8066 } 8067 } 8068 function _getPlugin(pluginIdentifier) { 8069 var theExt = null; 8070 var thePlugin = null; 8071 var channelHosts = []; 8072 arrForEach(_extensions, function(ext) { 8073 if (ext[ 8074 _DYN_IDENTIFIER 8075 /* @min:%2eidentifier */ 8076 ] === pluginIdentifier && ext !== _telemetryInitializerPlugin) { 8077 thePlugin = ext; 8078 return -1; 8079 } 8080 if (ext.getChannel) { 8081 channelHosts[ 8082 _DYN_PUSH$1 8083 /* @min:%2epush */ 8084 ](ext); 8085 } 8086 }); 8087 if (!thePlugin && channelHosts[ 8088 _DYN_LENGTH$4 8089 /* @min:%2elength */ 8090 ] > 0) { 8091 arrForEach(channelHosts, function(host) { 8092 thePlugin = host.getChannel(pluginIdentifier); 8093 if (!thePlugin) { 8094 return -1; 8095 } 8096 }); 8097 } 8098 if (thePlugin) { 8099 theExt = { 8100 plugin: thePlugin, 8101 setEnabled: function(enabled) { 8102 _getPluginState(thePlugin)[STR_DISABLED] = !enabled; 8103 }, 8104 isEnabled: function() { 8105 var pluginState = _getPluginState(thePlugin); 8106 return !pluginState[ 8107 _DYN_TEARDOWN 8108 /* @min:%2eteardown */ 8109 ] && !pluginState[STR_DISABLED]; 8110 }, 8111 remove: function(isAsync, removeCb) { 8112 if (isAsync === void 0) { 8113 isAsync = true; 8114 } 8115 var pluginsToRemove = [thePlugin]; 8116 var unloadState = { 8117 reason: 1, 8118 isAsync 8119 }; 8120 _removePlugins(pluginsToRemove, unloadState, function(removed) { 8121 if (removed) { 8122 _initPluginChain({ 8123 reason: 32, 8124 removed: pluginsToRemove 8125 }); 8126 } 8127 removeCb && removeCb(removed); 8128 }); 8129 } 8130 }; 8131 } 8132 return theExt; 8133 } 8134 function _getPluginChain() { 8135 if (!_pluginChain) { 8136 var extensions = (_extensions || []).slice(); 8137 if (arrIndexOf(extensions, _telemetryInitializerPlugin) === -1) { 8138 extensions[ 8139 _DYN_PUSH$1 8140 /* @min:%2epush */ 8141 ](_telemetryInitializerPlugin); 8142 } 8143 _pluginChain = createTelemetryProxyChain(sortPlugins(extensions), _configHandler.cfg, _self); 8144 } 8145 return _pluginChain; 8146 } 8147 function _removePlugins(thePlugins, unloadState, removeComplete) { 8148 if (thePlugins && thePlugins[ 8149 _DYN_LENGTH$4 8150 /* @min:%2elength */ 8151 ] > 0) { 8152 var unloadChain = createTelemetryProxyChain(thePlugins, _configHandler.cfg, _self); 8153 var unloadCtx = createProcessTelemetryUnloadContext(unloadChain, _self); 8154 unloadCtx[ 8155 _DYN_ON_COMPLETE 8156 /* @min:%2eonComplete */ 8157 ](function() { 8158 var removed = false; 8159 var newConfigExtensions = []; 8160 arrForEach(_configExtensions, function(plugin2, idx) { 8161 if (!_isPluginPresent(plugin2, thePlugins)) { 8162 newConfigExtensions[ 8163 _DYN_PUSH$1 8164 /* @min:%2epush */ 8165 ](plugin2); 8166 } else { 8167 removed = true; 8168 } 8169 }); 8170 _configExtensions = newConfigExtensions; 8171 _pluginVersionString = null; 8172 _pluginVersionStringArr = null; 8173 var newChannelConfig = []; 8174 if (_channelConfig) { 8175 arrForEach(_channelConfig, function(queue, idx) { 8176 var newQueue = []; 8177 arrForEach(queue, function(channel) { 8178 if (!_isPluginPresent(channel, thePlugins)) { 8179 newQueue[ 8180 _DYN_PUSH$1 8181 /* @min:%2epush */ 8182 ](channel); 8183 } else { 8184 removed = true; 8185 } 8186 }); 8187 newChannelConfig[ 8188 _DYN_PUSH$1 8189 /* @min:%2epush */ 8190 ](newQueue); 8191 }); 8192 _channelConfig = newChannelConfig; 8193 } 8194 removeComplete && removeComplete(removed); 8195 _startLogPoller(); 8196 }); 8197 unloadCtx[ 8198 _DYN_PROCESS_NEXT 8199 /* @min:%2eprocessNext */ 8200 ](unloadState); 8201 } else { 8202 removeComplete(false); 8203 } 8204 } 8205 function _flushInternalLogs() { 8206 if (_logger && _logger.queue) { 8207 var queue = _logger.queue.slice(0); 8208 _logger.queue[ 8209 _DYN_LENGTH$4 8210 /* @min:%2elength */ 8211 ] = 0; 8212 arrForEach(queue, function(logMessage) { 8213 var item = { 8214 name: _internalLogsEventName ? _internalLogsEventName : "InternalMessageId: " + logMessage[ 8215 _DYN_MESSAGE_ID 8216 /* @min:%2emessageId */ 8217 ], 8218 iKey: _instrumentationKey, 8219 time: toISOString(/* @__PURE__ */ new Date()), 8220 baseType: _InternalLogMessage.dataType, 8221 baseData: { message: logMessage[ 8222 _DYN_MESSAGE$1 8223 /* @min:%2emessage */ 8224 ] } 8225 }; 8226 _self.track(item); 8227 }); 8228 } 8229 } 8230 function _flushChannels(isAsync, callBack, sendReason, cbTimeout) { 8231 var waiting = 1; 8232 var doneIterating = false; 8233 var cbTimer = null; 8234 cbTimeout = cbTimeout || 5e3; 8235 function doCallback() { 8236 waiting--; 8237 if (doneIterating && waiting === 0) { 8238 cbTimer && cbTimer[ 8239 _DYN_CANCEL 8240 /* @min:%2ecancel */ 8241 ](); 8242 cbTimer = null; 8243 callBack && callBack(doneIterating); 8244 callBack = null; 8245 } 8246 } 8247 if (_channels && _channels[ 8248 _DYN_LENGTH$4 8249 /* @min:%2elength */ 8250 ] > 0) { 8251 var flushCtx = _createTelCtx()[ 8252 _DYN_CREATE_NEW 8253 /* @min:%2ecreateNew */ 8254 ](_channels); 8255 flushCtx.iterate(function(plugin2) { 8256 if (plugin2.flush) { 8257 waiting++; 8258 var handled_1 = false; 8259 if (!plugin2.flush(isAsync, function() { 8260 handled_1 = true; 8261 doCallback(); 8262 }, sendReason)) { 8263 if (!handled_1) { 8264 if (isAsync && cbTimer == null) { 8265 cbTimer = scheduleTimeout(function() { 8266 cbTimer = null; 8267 doCallback(); 8268 }, cbTimeout); 8269 } else { 8270 doCallback(); 8271 } 8272 } 8273 } 8274 } 8275 }); 8276 } 8277 doneIterating = true; 8278 doCallback(); 8279 return true; 8280 } 8281 function _initPerfManager() { 8282 var prevCfgPerfMgr; 8283 _addUnloadHook(_configHandler[ 8284 _DYN_WATCH 8285 /* @min:%2ewatch */ 8286 ](function(details) { 8287 var enablePerfMgr = details.cfg.enablePerfMgr; 8288 if (enablePerfMgr) { 8289 var createPerfMgr = details.cfg[ 8290 STR_CREATE_PERF_MGR 8291 /* @min:%2ecreatePerfMgr */ 8292 ]; 8293 if (prevCfgPerfMgr !== createPerfMgr || !prevCfgPerfMgr) { 8294 if (!createPerfMgr) { 8295 createPerfMgr = _createPerfManager; 8296 } 8297 getSetValue(details.cfg, STR_CREATE_PERF_MGR, createPerfMgr); 8298 prevCfgPerfMgr = createPerfMgr; 8299 _cfgPerfManager = null; 8300 } 8301 if (!_perfManager && !_cfgPerfManager && isFunction(createPerfMgr)) { 8302 _cfgPerfManager = createPerfMgr(_self, _self[ 8303 _DYN_GET_NOTIFY_MGR 8304 /* @min:%2egetNotifyMgr */ 8305 ]()); 8306 } 8307 } else { 8308 _cfgPerfManager = null; 8309 prevCfgPerfMgr = null; 8310 } 8311 })); 8312 } 8313 function _doUpdate(updateState) { 8314 var updateCtx = createProcessTelemetryUpdateContext(_getPluginChain(), _self); 8315 updateCtx[ 8316 _DYN_ON_COMPLETE 8317 /* @min:%2eonComplete */ 8318 ](_startLogPoller); 8319 if (!_self._updateHook || _self._updateHook(updateCtx, updateState) !== true) { 8320 updateCtx[ 8321 _DYN_PROCESS_NEXT 8322 /* @min:%2eprocessNext */ 8323 ](updateState); 8324 } 8325 } 8326 function _logOrThrowError(message) { 8327 var logger = _self[ 8328 _DYN_LOGGER 8329 /* @min:%2elogger */ 8330 ]; 8331 if (logger) { 8332 _throwInternal(logger, 2, 73, message); 8333 _startLogPoller(); 8334 } else { 8335 throwError(message); 8336 } 8337 }
8338 function _notifyInvalidEvent(telemetryItem) { 8339 var manager = _self[ 8340 _DYN_GET_NOTIFY_MGR 8341 /* @min:%2egetNotifyMgr */ 8342 ](); 8343 if (manager) { 8344 manager[ 8345 STR_EVENTS_DISCARDED 8346 /* @min:%2eeventsDiscarded */ 8347 ]( 8348 [telemetryItem], 8349 2 8350 /* eEventsDiscardedReason.InvalidEvent */ 8351 ); 8352 } 8353 } 8354 function _addUnloadHook(hooks) { 8355 _hookContainer.add(hooks); 8356 } 8357 }); 8358 } 8359 AppInsightsCore2.__ieDyn = 1; 8360 return AppInsightsCore2; 8361 }() 8362); 8363function parseResponse(response, diagLog) { 8364 try { 8365 if (response && response !== "") { 8366 var result = getJSON().parse(response); 8367 if (result && result[ 8368 _DYN_ITEMS_RECEIVED$1 8369 /* @min:%2eitemsReceived */ 8370 ] && result[ 8371 _DYN_ITEMS_RECEIVED$1 8372 /* @min:%2eitemsReceived */ 8373 ] >= result.itemsAccepted && result.itemsReceived - result.itemsAccepted === result.errors[ 8374 _DYN_LENGTH$4 8375 /* @min:%2elength */ 8376 ]) { 8377 return result; 8378 } 8379 } 8380 } catch (e) { 8381 _throwInternal(diagLog, 1, 43, "Cannot parse the response. " + (e[ 8382 _DYN_NAME$2 8383 /* @min:%2ename */
vendor: 12,859 bytes, lines 8384-8740
8384 ] || /* @__PURE__ */ dumpObj(e)), { 8385 response 8386 }); 8387 } 8388 return null; 8389} 8390var STR_EMPTY = ""; 8391var STR_NO_RESPONSE_BODY = "NoResponseBody"; 8392var _noResponseQs = "&" + STR_NO_RESPONSE_BODY + "=true"; 8393var STR_POST_METHOD = "POST"; 8394var SenderPostManager = ( 8395 /** @class */ 8396 function() { 8397 function SenderPostManager2() { 8398 var _syncFetchPayload = 0; 8399 var _enableSendPromise; 8400 var _isInitialized; 8401 var _diagLog; 8402 var _isOneDs; 8403 var _onCompleteFuncs; 8404 var _disableCredentials; 8405 var _fetchCredentials; 8406 var _fallbackInst; 8407 var _disableXhr; 8408 var _disableBeacon; 8409 var _disableBeaconSync; 8410 var _disableFetchKeepAlive; 8411 var _addNoResponse; 8412 var _timeoutWrapper; 8413 dynamicProto(SenderPostManager2, this, function(_self, _base) { 8414 var _sendCredentials = true; 8415 _initDefaults(); 8416 _self[ 8417 _DYN_INITIALIZE$1 8418 /* @min:%2einitialize */ 8419 ] = function(config, diagLog) { 8420 _diagLog = diagLog; 8421 if (_isInitialized) { 8422 _throwInternal(_diagLog, 1, 28, "Sender is already initialized"); 8423 } 8424 _self.SetConfig(config); 8425 _isInitialized = true; 8426 }; 8427 _self["_getDbgPlgTargets"] = function() { 8428 return [_isInitialized, _isOneDs, _disableCredentials, _enableSendPromise]; 8429 }; 8430 _self.SetConfig = function(config) { 8431 try { 8432 _onCompleteFuncs = config.senderOnCompleteCallBack || {}; 8433 _disableCredentials = !!config.disableCredentials; 8434 _fetchCredentials = config.fetchCredentials; 8435 _isOneDs = !!config.isOneDs; 8436 _enableSendPromise = !!config.enableSendPromise; 8437 _disableXhr = !!config.disableXhr; 8438 _disableBeacon = !!config.disableBeacon; 8439 _disableBeaconSync = !!config.disableBeaconSync; 8440 _timeoutWrapper = config.timeWrapper; 8441 _addNoResponse = !!config.addNoResponse; 8442 _disableFetchKeepAlive = !!config.disableFetchKeepAlive; 8443 _fallbackInst = { sendPOST: _xhrSender }; 8444 if (!_isOneDs) { 8445 _sendCredentials = false; 8446 } 8447 if (_disableCredentials) { 8448 var location_1 = getLocation(); 8449 if (location_1 && location_1.protocol && location_1.protocol[ 8450 _DYN_TO_LOWER_CASE$2 8451 /* @min:%2etoLowerCase */ 8452 ]() === "file:") { 8453 _sendCredentials = false; 8454 } 8455 } 8456 return true; 8457 } catch (e) { 8458 } 8459 return false; 8460 }; 8461 _self.getSyncFetchPayload = function() { 8462 return _syncFetchPayload; 8463 }; 8464 _self.getSenderInst = function(transports, sync) { 8465 if (transports && transports[ 8466 _DYN_LENGTH$4 8467 /* @min:%2elength */ 8468 ]) { 8469 return _getSenderInterface(transports, sync); 8470 } 8471 return null; 8472 }; 8473 _self.getFallbackInst = function() { 8474 return _fallbackInst; 8475 }; 8476 _self[ 8477 _DYN__DO_TEARDOWN 8478 /* @min:%2e_doTeardown */ 8479 ] = function(unloadCtx, unloadState) { 8480 _initDefaults(); 8481 }; 8482 _self.preparePayload = function(callback, zipPayload, payload, isSync) { 8483 if (!zipPayload || isSync || !payload[ 8484 _DYN_DATA$1 8485 /* @min:%2edata */ 8486 ]) { 8487 callback(payload); 8488 return; 8489 } 8490 try { 8491 var csStream = /* @__PURE__ */ getInst("CompressionStream"); 8492 if (!isFunction(csStream)) { 8493 callback(payload); 8494 return; 8495 } 8496 var body = new ReadableStream({ 8497 start: function(controller) { 8498 controller.enqueue(isString(payload[ 8499 _DYN_DATA$1 8500 /* @min:%2edata */ 8501 ]) ? new TextEncoder().encode(payload[ 8502 _DYN_DATA$1 8503 /* @min:%2edata */ 8504 ]) : payload[ 8505 _DYN_DATA$1 8506 /* @min:%2edata */ 8507 ]); 8508 controller.close(); 8509 } 8510 }); 8511 var compressedStream = body.pipeThrough(new csStream("gzip")); 8512 var reader_1 = compressedStream.getReader(); 8513 var chunks_1 = []; 8514 var totalLength_1 = 0; 8515 var callbackCalled_1 = false; 8516 doAwaitResponse(reader_1.read(), function processChunk(response) { 8517 if (!callbackCalled_1 && !response.rejected) { 8518 var result = response[ 8519 _DYN_VALUE 8520 /* @min:%2evalue */ 8521 ]; 8522 if (!result.done) { 8523 chunks_1[ 8524 _DYN_PUSH$1 8525 /* @min:%2epush */ 8526 ](result[ 8527 _DYN_VALUE 8528 /* @min:%2evalue */ 8529 ]); 8530 totalLength_1 += result.value[ 8531 _DYN_LENGTH$4 8532 /* @min:%2elength */ 8533 ]; 8534 return doAwaitResponse(reader_1.read(), processChunk); 8535 } 8536 var combined = new Uint8Array(totalLength_1); 8537 var offset = 0; 8538 for (var _i = 0, chunks_2 = chunks_1; _i < chunks_2.length; _i++) { 8539 var chunk = chunks_2[_i]; 8540 combined.set(chunk, offset); 8541 offset += chunk[ 8542 _DYN_LENGTH$4 8543 /* @min:%2elength */ 8544 ]; 8545 } 8546 payload[ 8547 _DYN_DATA$1 8548 /* @min:%2edata */ 8549 ] = combined; 8550 payload[ 8551 _DYN_HEADERS$1 8552 /* @min:%2eheaders */ 8553 ]["Content-Encoding"] = "gzip"; 8554 payload._chunkCount = chunks_1[ 8555 _DYN_LENGTH$4 8556 /* @min:%2elength */ 8557 ]; 8558 } 8559 if (!callbackCalled_1) { 8560 callbackCalled_1 = true; 8561 callback(payload); 8562 } 8563 }); 8564 return reader_1; 8565 } catch (error) { 8566 callback(payload); 8567 return; 8568 } 8569 }; 8570 function _onSuccess(res, onComplete) { 8571 _doOnComplete(onComplete, 200, {}, res); 8572 } 8573 function _onError(message, onComplete) { 8574 _throwInternal(_diagLog, 2, 26, "Failed to send telemetry.", { message }); 8575 _doOnComplete(onComplete, 400, {}); 8576 } 8577 function _onNoPayloadUrl(onComplete) { 8578 _onError("No endpoint url is provided for the batch", onComplete); 8579 } 8580 function _getSenderInterface(transports, syncSupport) { 8581 var transportType = 0; 8582 var sendPostFunc = null; 8583 var lp = 0; 8584 while (sendPostFunc == null && lp < transports[ 8585 _DYN_LENGTH$4 8586 /* @min:%2elength */ 8587 ]) { 8588 transportType = transports[lp]; 8589 if (!_disableXhr && transportType === 1) { 8590 if (useXDomainRequest()) { 8591 sendPostFunc = _xdrSender; 8592 } else if (isXhrSupported()) { 8593 sendPostFunc = _xhrSender; 8594 } 8595 } else if (transportType === 2 && isFetchSupported(syncSupport) && (!syncSupport || !_disableFetchKeepAlive)) { 8596 sendPostFunc = _doFetchSender; 8597 } else if (transportType === 3 && isBeaconsSupported() && (syncSupport ? !_disableBeaconSync : !_disableBeacon)) { 8598 sendPostFunc = _beaconSender; 8599 } 8600 lp++; 8601 } 8602 if (sendPostFunc) { 8603 return { 8604 _transport: transportType, 8605 _isSync: syncSupport, 8606 sendPOST: sendPostFunc 8607 }; 8608 } 8609 return null; 8610 } 8611 function _doOnComplete(oncomplete, status, headers, response) { 8612 try { 8613 oncomplete && oncomplete(status, headers, response); 8614 } catch (e) { 8615 } 8616 } 8617 function _doBeaconSend(payload, oncomplete) { 8618 var nav = getNavigator(); 8619 var url = payload[ 8620 _DYN_URL_STRING 8621 /* @min:%2eurlString */ 8622 ]; 8623 if (!url) { 8624 _onNoPayloadUrl(oncomplete); 8625 return true; 8626 } 8627 url = payload[ 8628 _DYN_URL_STRING 8629 /* @min:%2eurlString */ 8630 ] + (_addNoResponse ? _noResponseQs : STR_EMPTY); 8631 var data = payload[ 8632 _DYN_DATA$1 8633 /* @min:%2edata */ 8634 ]; 8635 var plainTextBatch = _isOneDs ? data : new Blob([data], { type: "text/plain;charset=UTF-8" }); 8636 var queued = nav.sendBeacon(url, plainTextBatch); 8637 return queued; 8638 } 8639 function _beaconSender(payload, oncomplete, sync) { 8640 var data = payload[ 8641 _DYN_DATA$1 8642 /* @min:%2edata */ 8643 ]; 8644 try { 8645 if (data) { 8646 if (!_doBeaconSend(payload, oncomplete)) { 8647 var onRetry = _onCompleteFuncs && _onCompleteFuncs.beaconOnRetry; 8648 if (onRetry && isFunction(onRetry)) { 8649 onRetry(payload, oncomplete, _doBeaconSend); 8650 } else { 8651 _fallbackInst && _fallbackInst.sendPOST(payload, oncomplete, true); 8652 _throwInternal(_diagLog, 2, 40, ". Failed to send telemetry with Beacon API, retried with normal sender."); 8653 } 8654 } else { 8655 _onSuccess(STR_EMPTY, oncomplete); 8656 } 8657 } 8658 } catch (e) { 8659 _isOneDs && _warnToConsole(_diagLog, "Failed to send telemetry using sendBeacon API. Ex:" + /* @__PURE__ */ dumpObj(e)); 8660 _doOnComplete(oncomplete, _isOneDs ? 0 : 400, {}, STR_EMPTY); 8661 } 8662 return; 8663 } 8664 function _xhrSender(payload, oncomplete, sync) { 8665 var thePromise; 8666 var resolveFunc; 8667 var rejectFunc; 8668 var headers = payload[ 8669 _DYN_HEADERS$1 8670 /* @min:%2eheaders */ 8671 ] || {}; 8672 if (!sync && _enableSendPromise) { 8673 thePromise = createPromise(function(resolve, reject) { 8674 resolveFunc = resolve; 8675 rejectFunc = reject; 8676 }); 8677 } 8678 if (_isOneDs && sync && payload.disableXhrSync) { 8679 sync = false; 8680 } 8681 var endPointUrl = payload[ 8682 _DYN_URL_STRING 8683 /* @min:%2eurlString */ 8684 ]; 8685 if (!endPointUrl) { 8686 _onNoPayloadUrl(oncomplete); 8687 resolveFunc && resolveFunc(false); 8688 return; 8689 } 8690 var xhr = openXhr(STR_POST_METHOD, endPointUrl, _sendCredentials, true, sync, payload[ 8691 _DYN_TIMEOUT 8692 /* @min:%2etimeout */ 8693 ]); 8694 if (!_isOneDs) { 8695 xhr.setRequestHeader("Content-type", "application/json"); 8696 } 8697 arrForEach(objKeys(headers), function(headerName) { 8698 xhr.setRequestHeader(headerName, headers[headerName]); 8699 }); 8700 xhr.onreadystatechange = function() { 8701 if (!_isOneDs) { 8702 _doOnReadyFunc(xhr); 8703 if (xhr.readyState === 4) { 8704 resolveFunc && resolveFunc(true); 8705 } 8706 } 8707 }; 8708 xhr.onload = function() { 8709 if (_isOneDs) { 8710 _doOnReadyFunc(xhr); 8711 } 8712 }; 8713 function _doOnReadyFunc(xhr2) { 8714 var onReadyFunc = _onCompleteFuncs && _onCompleteFuncs.xhrOnComplete; 8715 var onReadyFuncExist = onReadyFunc && isFunction(onReadyFunc); 8716 if (onReadyFuncExist) { 8717 onReadyFunc(xhr2, oncomplete, payload); 8718 } else { 8719 var response = getResponseText(xhr2); 8720 _doOnComplete(oncomplete, xhr2[ 8721 _DYN_STATUS$1 8722 /* @min:%2estatus */ 8723 ], _getAllResponseHeaders(xhr2, _isOneDs), response); 8724 } 8725 } 8726 xhr.onerror = function(event) { 8727 _doOnComplete(oncomplete, _isOneDs ? xhr[ 8728 _DYN_STATUS$1 8729 /* @min:%2estatus */ 8730 ] : 400, _getAllResponseHeaders(xhr, _isOneDs), _isOneDs ? STR_EMPTY : formatErrorMessageXhr(xhr)); 8731 rejectFunc && rejectFunc(event); 8732 }; 8733 xhr.ontimeout = function() { 8734 _doOnComplete(oncomplete, _isOneDs ? xhr[ 8735 _DYN_STATUS$1 8736 /* @min:%2estatus */ 8737 ] : 500, _getAllResponseHeaders(xhr, _isOneDs), _isOneDs ? STR_EMPTY : formatErrorMessageXhr(xhr)); 8738 resolveFunc && resolveFunc(false); 8739 }; 8740 xhr.send(payload[
vendor: 8,695 bytes, lines 8741-8975
8741 _DYN_DATA$1 8742 /* @min:%2edata */ 8743 ]); 8744 return thePromise; 8745 } 8746 function _doFetchSender(payload, oncomplete, sync) { 8747 var _a2; 8748 var endPointUrl = payload[ 8749 _DYN_URL_STRING 8750 /* @min:%2eurlString */ 8751 ]; 8752 var batch = payload[ 8753 _DYN_DATA$1 8754 /* @min:%2edata */ 8755 ]; 8756 var plainTextBatch = _isOneDs ? batch : new Blob([batch], { type: "application/json" }); 8757 var thePromise; 8758 var resolveFunc; 8759 var rejectFunc; 8760 var requestHeaders = new Headers(); 8761 var batchLength = batch[ 8762 _DYN_LENGTH$4 8763 /* @min:%2elength */ 8764 ]; 8765 var ignoreResponse = false; 8766 var responseHandled = false; 8767 var headers = payload[ 8768 _DYN_HEADERS$1 8769 /* @min:%2eheaders */ 8770 ] || {}; 8771 var init = (_a2 = { 8772 method: STR_POST_METHOD, 8773 body: plainTextBatch 8774 }, _a2[DisabledPropertyName$1] = true, _a2); 8775 if (payload.headers && objKeys(payload.headers)[ 8776 _DYN_LENGTH$4 8777 /* @min:%2elength */ 8778 ] > 0) { 8779 arrForEach(objKeys(headers), function(headerName) { 8780 requestHeaders.append(headerName, headers[headerName]); 8781 }); 8782 init[ 8783 _DYN_HEADERS$1 8784 /* @min:%2eheaders */ 8785 ] = requestHeaders; 8786 } 8787 if (_fetchCredentials) { 8788 init.credentials = _fetchCredentials; 8789 } else if (_sendCredentials && _isOneDs) { 8790 init.credentials = "include"; 8791 } 8792 if (sync) { 8793 init.keepalive = true; 8794 _syncFetchPayload += batchLength; 8795 if (_isOneDs) { 8796 if (payload["_sendReason"] === 2) { 8797 ignoreResponse = true; 8798 if (_addNoResponse) { 8799 endPointUrl += _noResponseQs; 8800 } 8801 } 8802 } else { 8803 ignoreResponse = true; 8804 } 8805 } 8806 var request = new Request(endPointUrl, init); 8807 try { 8808 request[DisabledPropertyName$1] = true; 8809 } catch (e) { 8810 } 8811 if (!sync && _enableSendPromise) { 8812 thePromise = createPromise(function(resolve, reject) { 8813 resolveFunc = resolve; 8814 rejectFunc = reject; 8815 }); 8816 } 8817 if (!endPointUrl) { 8818 _onNoPayloadUrl(oncomplete); 8819 resolveFunc && resolveFunc(false); 8820 return; 8821 } 8822 function _handleError(res, statusCode) { 8823 if (statusCode) { 8824 _doOnComplete(oncomplete, _isOneDs ? 0 : statusCode, {}, _isOneDs ? STR_EMPTY : res); 8825 } else { 8826 _doOnComplete(oncomplete, _isOneDs ? 0 : 400, {}, _isOneDs ? STR_EMPTY : res); 8827 } 8828 } 8829 function _onFetchComplete(response, payload2, value) { 8830 var status = response[ 8831 _DYN_STATUS$1 8832 /* @min:%2estatus */ 8833 ]; 8834 var onCompleteFunc = _onCompleteFuncs.fetchOnComplete; 8835 if (onCompleteFunc && isFunction(onCompleteFunc)) { 8836 onCompleteFunc(response, oncomplete, value || STR_EMPTY, payload2); 8837 } else { 8838 _doOnComplete(oncomplete, status, {}, value || STR_EMPTY); 8839 } 8840 } 8841 try { 8842 doAwaitResponse(fetch(_isOneDs ? endPointUrl : request, _isOneDs ? init : null), function(result) { 8843 if (sync) { 8844 _syncFetchPayload -= batchLength; 8845 batchLength = 0; 8846 } 8847 if (!responseHandled) { 8848 responseHandled = true; 8849 if (!result.rejected) { 8850 var response_1 = result[ 8851 _DYN_VALUE 8852 /* @min:%2evalue */ 8853 ]; 8854 try { 8855 if (!_isOneDs && !response_1.ok) { 8856 if (response_1[ 8857 _DYN_STATUS$1 8858 /* @min:%2estatus */ 8859 ]) { 8860 _handleError(response_1.statusText, response_1[ 8861 _DYN_STATUS$1 8862 /* @min:%2estatus */ 8863 ]); 8864 } else { 8865 _handleError(response_1.statusText, 499); 8866 } 8867 resolveFunc && resolveFunc(false); 8868 } else { 8869 if (_isOneDs && !response_1.body) { 8870 _onFetchComplete(response_1, null, STR_EMPTY); 8871 resolveFunc && resolveFunc(true); 8872 } else { 8873 doAwaitResponse(response_1.text(), function(resp) { 8874 _onFetchComplete(response_1, payload, resp[ 8875 _DYN_VALUE 8876 /* @min:%2evalue */ 8877 ]); 8878 resolveFunc && resolveFunc(true); 8879 }); 8880 } 8881 } 8882 } catch (e) { 8883 if (response_1 && response_1[ 8884 _DYN_STATUS$1 8885 /* @min:%2estatus */ 8886 ]) { 8887 _handleError(/* @__PURE__ */ dumpObj(e), response_1[ 8888 _DYN_STATUS$1 8889 /* @min:%2estatus */ 8890 ]); 8891 } else { 8892 _handleError(/* @__PURE__ */ dumpObj(e), 499); 8893 } 8894 rejectFunc && rejectFunc(e); 8895 } 8896 } else { 8897 _handleError(result.reason && result.reason[ 8898 _DYN_MESSAGE$1 8899 /* @min:%2emessage */ 8900 ], 499); 8901 rejectFunc && rejectFunc(result.reason); 8902 } 8903 } 8904 }); 8905 } catch (e) { 8906 if (!responseHandled) { 8907 _handleError(/* @__PURE__ */ dumpObj(e), 499); 8908 rejectFunc && rejectFunc(e); 8909 } 8910 } 8911 if (ignoreResponse && !responseHandled) { 8912 responseHandled = true; 8913 _doOnComplete(oncomplete, 200, {}); 8914 resolveFunc && resolveFunc(true); 8915 } 8916 if (_isOneDs && !responseHandled && payload[ 8917 _DYN_TIMEOUT 8918 /* @min:%2etimeout */ 8919 ] > 0) { 8920 _timeoutWrapper && _timeoutWrapper.set(function() { 8921 if (!responseHandled) { 8922 responseHandled = true; 8923 _doOnComplete(oncomplete, 500, {}); 8924 resolveFunc && resolveFunc(true); 8925 } 8926 }, payload[ 8927 _DYN_TIMEOUT 8928 /* @min:%2etimeout */ 8929 ]); 8930 } 8931 return thePromise; 8932 } 8933 function _xdrSender(payload, oncomplete, sync) { 8934 var _window = getWindow(); 8935 var xdr = new XDomainRequest(); 8936 var data = payload[ 8937 _DYN_DATA$1 8938 /* @min:%2edata */ 8939 ]; 8940 xdr.onload = function() { 8941 var response = getResponseText(xdr); 8942 var onloadFunc = _onCompleteFuncs && _onCompleteFuncs.xdrOnComplete; 8943 if (onloadFunc && isFunction(onloadFunc)) { 8944 onloadFunc(xdr, oncomplete, payload); 8945 } else { 8946 _doOnComplete(oncomplete, 200, {}, response); 8947 } 8948 }; 8949 xdr.onerror = function() { 8950 _doOnComplete(oncomplete, 400, {}, _isOneDs ? STR_EMPTY : formatErrorMessageXdr(xdr)); 8951 }; 8952 xdr.ontimeout = function() { 8953 _doOnComplete(oncomplete, 500, {}); 8954 }; 8955 xdr.onprogress = function() { 8956 }; 8957 var hostingProtocol = _window && _window.location && _window.location.protocol || ""; 8958 var endpoint = payload[ 8959 _DYN_URL_STRING 8960 /* @min:%2eurlString */ 8961 ]; 8962 if (!endpoint) { 8963 _onNoPayloadUrl(oncomplete); 8964 return; 8965 } 8966 if (!_isOneDs && endpoint.lastIndexOf(hostingProtocol, 0) !== 0) { 8967 var msg = "Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol."; 8968 _throwInternal(_diagLog, 2, 40, ". " + msg); 8969 _onError(msg, oncomplete); 8970 return; 8971 } 8972 var endpointUrl = _isOneDs ? endpoint : endpoint[ 8973 _DYN_REPLACE 8974 /* @min:%2ereplace */ 8975 ](/^(https?:)/, "");
8976 xdr.open(STR_POST_METHOD, endpointUrl); 8977 if (payload[ 8978 _DYN_TIMEOUT 8979 /* @min:%2etimeout */ 8980 ]) { 8981 xdr[ 8982 _DYN_TIMEOUT 8983 /* @min:%2etimeout */ 8984 ] = payload[ 8985 _DYN_TIMEOUT 8986 /* @min:%2etimeout */ 8987 ]; 8988 } 8989 xdr.send(data); 8990 if (_isOneDs && sync) { 8991 _timeoutWrapper && _timeoutWrapper.set(function() { 8992 xdr.send(data); 8993 }, 0); 8994 } else { 8995 xdr.send(data); 8996 } 8997 } 8998 function _initDefaults() { 8999 _syncFetchPayload = 0; 9000 _isInitialized = false; 9001 _enableSendPromise = false; 9002 _diagLog = null; 9003 _isOneDs = null; 9004 _onCompleteFuncs = null; 9005 _disableCredentials = null; 9006 _fetchCredentials = null; 9007 _fallbackInst = null; 9008 _disableXhr = false; 9009 _disableBeacon = false; 9010 _disableBeaconSync = false; 9011 _disableFetchKeepAlive = false; 9012 _addNoResponse = false; 9013 _timeoutWrapper = null; 9014 } 9015 }); 9016 } 9017 SenderPostManager2.__ieDyn = 1; 9018 return SenderPostManager2; 9019 }() 9020); 9021var strOnPrefix = "on"; 9022var strAttachEvent = "attachEvent"; 9023var strAddEventHelper = "addEventListener"; 9024var strDetachEvent = "detachEvent"; 9025var strRemoveEventListener = "removeEventListener"; 9026var strEvents = "events"; 9027var strVisibilityChangeEvt = "visibilitychange"; 9028var strPageHide = "pagehide"; 9029var strUnload = "unload"; 9030var strBeforeUnload = "beforeunload"; 9031var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide"); 9032createUniqueNamespace("aiEvtPageShow"); 9033var rRemoveEmptyNs = /\.[\.]+/g; 9034var rRemoveTrailingEmptyNs = /[\.]+$/; 9035var _guid = 1; 9036var elmNodeData = createElmNodeData("events"); 9037var eventNamespace = /^([^.]*)(?:\.(.+)|)/; 9038function _normalizeNamespace(name) { 9039 if (name && name[ 9040 _DYN_REPLACE 9041 /* @min:%2ereplace */ 9042 ]) { 9043 return name[ 9044 _DYN_REPLACE 9045 /* @min:%2ereplace */ 9046 ](/^[\s\.]+|(?=[\s\.])[\.\s]+$/g, STR_EMPTY$1); 9047 } 9048 return name; 9049} 9050function _getEvtNamespace(eventName, evtNamespace) { 9051 if (evtNamespace) { 9052 var theNamespace_1 = STR_EMPTY$1; 9053 if (isArray(evtNamespace)) { 9054 theNamespace_1 = STR_EMPTY$1; 9055 arrForEach(evtNamespace, function(name) { 9056 name = _normalizeNamespace(name); 9057 if (name) { 9058 if (name[0] !== ".") { 9059 name = "." + name; 9060 } 9061 theNamespace_1 += name; 9062 } 9063 }); 9064 } else { 9065 theNamespace_1 = _normalizeNamespace(evtNamespace); 9066 } 9067 if (theNamespace_1) { 9068 if (theNamespace_1[0] !== ".") { 9069 theNamespace_1 = "." + theNamespace_1; 9070 } 9071 eventName = (eventName || STR_EMPTY$1) + theNamespace_1; 9072 } 9073 } 9074 var parsedEvent = eventNamespace.exec(eventName || STR_EMPTY$1) || []; 9075 return { 9076 type: parsedEvent[1], 9077 ns: (parsedEvent[2] || STR_EMPTY$1).replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, STR_EMPTY$1)[ 9078 _DYN_SPLIT$1 9079 /* @min:%2esplit */ 9080 ](".").sort().join(".") 9081 }; 9082} 9083function _getRegisteredEvents(target, evtName, addDefault) { 9084 if (addDefault === void 0) { 9085 addDefault = true; 9086 } 9087 var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault); 9088 var registeredEvents = aiEvts[evtName]; 9089 if (!registeredEvents) { 9090 registeredEvents = aiEvts[evtName] = []; 9091 } 9092 return registeredEvents; 9093} 9094function _doDetach(obj, evtName, handlerRef, useCapture) { 9095 if (obj && evtName && evtName[ 9096 _DYN_TYPE 9097 /* @min:%2etype */ 9098 ]) { 9099 if (obj[strRemoveEventListener]) { 9100 obj[strRemoveEventListener](evtName[ 9101 _DYN_TYPE 9102 /* @min:%2etype */ 9103 ], handlerRef, useCapture); 9104 } else if (obj[strDetachEvent]) { 9105 obj[strDetachEvent](strOnPrefix + evtName[ 9106 _DYN_TYPE 9107 /* @min:%2etype */ 9108 ], handlerRef); 9109 } 9110 } 9111} 9112function _doAttach(obj, evtName, handlerRef, useCapture) { 9113 var result = false;
9114 if (obj && evtName && evtName[ 9115 _DYN_TYPE 9116 /* @min:%2etype */ 9117 ] && handlerRef) { 9118 if (obj[strAddEventHelper]) { 9119 obj[strAddEventHelper](evtName[ 9120 _DYN_TYPE 9121 /* @min:%2etype */ 9122 ], handlerRef, useCapture); 9123 result = true; 9124 } else if (obj[strAttachEvent]) { 9125 obj[strAttachEvent](strOnPrefix + evtName[ 9126 _DYN_TYPE 9127 /* @min:%2etype */ 9128 ], handlerRef); 9129 result = true; 9130 } 9131 } 9132 return result; 9133} 9134function _doUnregister(target, events, evtName, unRegFn) { 9135 var idx = events[ 9136 _DYN_LENGTH$4 9137 /* @min:%2elength */ 9138 ]; 9139 while (idx--) { 9140 var theEvent = events[idx]; 9141 if (theEvent) { 9142 if (!evtName.ns || evtName.ns === theEvent[ 9143 _DYN_EVT_NAME 9144 /* @min:%2eevtName */ 9145 ].ns) { 9146 if (!unRegFn || unRegFn(theEvent)) { 9147 _doDetach(target, theEvent[ 9148 _DYN_EVT_NAME 9149 /* @min:%2eevtName */ 9150 ], theEvent.handler, theEvent.capture); 9151 events[ 9152 _DYN_SPLICE 9153 /* @min:%2esplice */ 9154 ](idx, 1); 9155 } 9156 } 9157 } 9158 } 9159} 9160function _unregisterEvents(target, evtName, unRegFn) { 9161 if (evtName[ 9162 _DYN_TYPE 9163 /* @min:%2etype */ 9164 ]) { 9165 _doUnregister(target, _getRegisteredEvents(target, evtName[ 9166 _DYN_TYPE 9167 /* @min:%2etype */ 9168 ]), evtName, unRegFn); 9169 } else { 9170 var eventCache = elmNodeData.get(target, strEvents, {}); 9171 objForEachKey(eventCache, function(evtType, events) { 9172 _doUnregister(target, events, evtName, unRegFn); 9173 }); 9174 if (objKeys(eventCache)[ 9175 _DYN_LENGTH$4 9176 /* @min:%2elength */ 9177 ] === 0) { 9178 elmNodeData.kill(target, strEvents); 9179 } 9180 } 9181} 9182function mergeEvtNamespace(theNamespace, namespaces) { 9183 var newNamespaces; 9184 if (namespaces) { 9185 if (isArray(namespaces)) { 9186 newNamespaces = [theNamespace].concat(namespaces); 9187 } else { 9188 newNamespaces = [theNamespace, namespaces]; 9189 } 9190 newNamespaces = _getEvtNamespace("xx", newNamespaces).ns[ 9191 _DYN_SPLIT$1 9192 /* @min:%2esplit */ 9193 ]("."); 9194 } else { 9195 newNamespaces = theNamespace; 9196 } 9197 return newNamespaces; 9198} 9199function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) { 9200 if (useCapture === void 0) { 9201 useCapture = false; 9202 } 9203 var result = false;
9204 if (target) { 9205 try { 9206 var evtName = _getEvtNamespace(eventName, evtNamespace); 9207 result = _doAttach(target, evtName, handlerRef, useCapture); 9208 if (result && elmNodeData.accept(target)) { 9209 var registeredEvent = { 9210 guid: _guid++, 9211 evtName, 9212 handler: handlerRef, 9213 capture: useCapture 9214 }; 9215 _getRegisteredEvents(target, evtName.type)[ 9216 _DYN_PUSH$1 9217 /* @min:%2epush */ 9218 ](registeredEvent); 9219 } 9220 } catch (e) { 9221 } 9222 } 9223 return result; 9224} 9225function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) { 9226 if (useCapture === void 0) { 9227 useCapture = false; 9228 } 9229 if (target) { 9230 try { 9231 var evtName_1 = _getEvtNamespace(eventName, evtNamespace); 9232 var found_1 = false; 9233 _unregisterEvents(target, evtName_1, function(regEvent) { 9234 if (evtName_1.ns && !handlerRef || regEvent.handler === handlerRef) { 9235 found_1 = true; 9236 return true; 9237 } 9238 return false; 9239 }); 9240 if (!found_1) { 9241 _doDetach(target, evtName_1, handlerRef, useCapture); 9242 } 9243 } catch (e) { 9244 } 9245 } 9246} 9247function addEventHandler(eventName, callback, evtNamespace) { 9248 var result = false;
vendor: 9,600 bytes, lines 9249-9578
9249 var w = getWindow(); 9250 if (w) { 9251 result = eventOn(w, eventName, callback, evtNamespace); 9252 result = eventOn(w["body"], eventName, callback, evtNamespace) || result; 9253 } 9254 var doc = getDocument(); 9255 if (doc) { 9256 result = eventOn(doc, eventName, callback, evtNamespace) || result; 9257 } 9258 return result; 9259} 9260function removeEventHandler(eventName, callback, evtNamespace) { 9261 var w = getWindow(); 9262 if (w) { 9263 eventOff(w, eventName, callback, evtNamespace); 9264 eventOff(w["body"], eventName, callback, evtNamespace); 9265 } 9266 var doc = getDocument(); 9267 if (doc) { 9268 eventOff(doc, eventName, callback, evtNamespace); 9269 } 9270} 9271function _addEventListeners(events, listener, excludeEvents, evtNamespace) { 9272 var added = false; 9273 if (listener && events && events[ 9274 _DYN_LENGTH$4 9275 /* @min:%2elength */ 9276 ] > 0) { 9277 arrForEach(events, function(name) { 9278 if (name) { 9279 if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) { 9280 added = addEventHandler(name, listener, evtNamespace) || added; 9281 } 9282 } 9283 }); 9284 } 9285 return added; 9286} 9287function addEventListeners(events, listener, excludeEvents, evtNamespace) { 9288 var added = false; 9289 if (listener && events && isArray(events)) { 9290 added = _addEventListeners(events, listener, excludeEvents, evtNamespace); 9291 if (!added && excludeEvents && excludeEvents[ 9292 _DYN_LENGTH$4 9293 /* @min:%2elength */ 9294 ] > 0) { 9295 added = _addEventListeners(events, listener, null, evtNamespace); 9296 } 9297 } 9298 return added; 9299} 9300function removeEventListeners(events, listener, evtNamespace) { 9301 if (events && isArray(events)) { 9302 arrForEach(events, function(name) { 9303 if (name) { 9304 removeEventHandler(name, listener, evtNamespace); 9305 } 9306 }); 9307 } 9308} 9309function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) { 9310 return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace); 9311} 9312function removePageUnloadEventListener(listener, evtNamespace) { 9313 removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace); 9314} 9315function addPageHideEventListener(listener, excludeEvents, evtNamespace) { 9316 function _handlePageVisibility(evt) { 9317 var doc = getDocument(); 9318 if (listener && doc && doc.visibilityState === "hidden") { 9319 listener(evt); 9320 } 9321 } 9322 var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace); 9323 var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces); 9324 if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) { 9325 pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded; 9326 } 9327 if (!pageUnloadAdded && excludeEvents) { 9328 pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace); 9329 } 9330 return pageUnloadAdded; 9331} 9332function removePageHideEventListener(listener, evtNamespace) { 9333 var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace); 9334 removeEventListeners([strPageHide], listener, newNamespaces); 9335 removeEventListeners([strVisibilityChangeEvt], null, newNamespaces); 9336} 9337var aiInstrumentHooks = "_aiHooks"; 9338var cbNames = [ 9339 "req", 9340 "rsp", 9341 "hkErr", 9342 "fnErr" 9343]; 9344function _arrLoop(arr, fn) { 9345 if (arr) { 9346 for (var lp = 0; lp < arr[ 9347 _DYN_LENGTH$4 9348 /* @min:%2elength */ 9349 ]; lp++) { 9350 if (fn(arr[lp], lp)) { 9351 break; 9352 } 9353 } 9354 } 9355} 9356function _doCallbacks(hooks, callDetails, cbArgs, hookCtx, type) { 9357 if (type >= 0 && type <= 2) { 9358 _arrLoop(hooks, function(hook, idx) { 9359 var cbks = hook.cbks; 9360 var cb = cbks[cbNames[type]]; 9361 if (cb) { 9362 callDetails.ctx = function() { 9363 var ctx = hookCtx[idx] = hookCtx[idx] || {}; 9364 return ctx; 9365 }; 9366 try { 9367 cb[ 9368 _DYN_APPLY 9369 /* @min:%2eapply */ 9370 ](callDetails.inst, cbArgs); 9371 } catch (err) { 9372 var orgEx = callDetails.err; 9373 try { 9374 var hookErrorCb = cbks[cbNames[ 9375 2 9376 /* CallbackType.HookError */ 9377 ]]; 9378 if (hookErrorCb) { 9379 callDetails.err = err; 9380 hookErrorCb[ 9381 _DYN_APPLY 9382 /* @min:%2eapply */ 9383 ](callDetails.inst, cbArgs); 9384 } 9385 } catch (e) { 9386 } finally { 9387 callDetails.err = orgEx; 9388 } 9389 } 9390 } 9391 }); 9392 } 9393} 9394function _createFunctionHook(aiHook) { 9395 return function() { 9396 var funcThis = this; 9397 var orgArgs = arguments; 9398 var hooks = aiHook.h; 9399 var funcArgs = { 9400 name: aiHook.n, 9401 inst: funcThis, 9402 ctx: null, 9403 set: _replaceArg 9404 }; 9405 var hookCtx = []; 9406 var cbArgs = _createArgs([funcArgs], orgArgs); 9407 funcArgs.evt = /* @__PURE__ */ getInst("event"); 9408 function _createArgs(target, theArgs) { 9409 _arrLoop(theArgs, function(arg) { 9410 target[ 9411 _DYN_PUSH$1 9412 /* @min:%2epush */ 9413 ](arg); 9414 }); 9415 return target; 9416 } 9417 function _replaceArg(idx, value) { 9418 orgArgs = _createArgs([], orgArgs); 9419 orgArgs[idx] = value; 9420 cbArgs = _createArgs([funcArgs], orgArgs); 9421 } 9422 _doCallbacks( 9423 hooks, 9424 funcArgs, 9425 cbArgs, 9426 hookCtx, 9427 0 9428 /* CallbackType.Request */ 9429 ); 9430 var theFunc = aiHook.f; 9431 if (theFunc) { 9432 try { 9433 funcArgs.rslt = theFunc[ 9434 _DYN_APPLY 9435 /* @min:%2eapply */ 9436 ](funcThis, orgArgs); 9437 } catch (err) { 9438 funcArgs.err = err; 9439 _doCallbacks( 9440 hooks, 9441 funcArgs, 9442 cbArgs, 9443 hookCtx, 9444 3 9445 /* CallbackType.FunctionError */ 9446 ); 9447 throw err; 9448 } 9449 } 9450 _doCallbacks( 9451 hooks, 9452 funcArgs, 9453 cbArgs, 9454 hookCtx, 9455 1 9456 /* CallbackType.Response */ 9457 ); 9458 return funcArgs.rslt; 9459 }; 9460} 9461function _getOwner(target, name, checkPrototype, checkParentProto) { 9462 var owner = null; 9463 if (target) { 9464 if (/* @__PURE__ */ objHasOwnProperty(target, name)) { 9465 owner = target; 9466 } else if (checkPrototype) { 9467 owner = _getOwner(_getObjProto(target), name, checkParentProto, false); 9468 } 9469 } 9470 return owner; 9471} 9472function InstrumentProto(target, funcName, callbacks) { 9473 if (target) { 9474 return InstrumentFunc(target[strShimPrototype], funcName, callbacks, false); 9475 } 9476 return null; 9477} 9478function _createInstrumentHook(owner, funcName, fn, callbacks) { 9479 var aiHook = fn && fn[aiInstrumentHooks]; 9480 if (!aiHook) { 9481 aiHook = { 9482 i: 0, 9483 n: funcName, 9484 f: fn, 9485 h: [] 9486 }; 9487 var newFunc = _createFunctionHook(aiHook); 9488 newFunc[aiInstrumentHooks] = aiHook; 9489 owner[funcName] = newFunc; 9490 } 9491 var theHook = { 9492 // tslint:disable:object-literal-shorthand 9493 id: aiHook.i, 9494 cbks: callbacks, 9495 rm: function() { 9496 var id = this.id; 9497 _arrLoop(aiHook.h, function(hook, idx) { 9498 if (hook.id === id) { 9499 aiHook.h[ 9500 _DYN_SPLICE 9501 /* @min:%2esplice */ 9502 ](idx, 1); 9503 return 1; 9504 } 9505 }); 9506 } 9507 // tslint:enable:object-literal-shorthand 9508 }; 9509 aiHook.i++; 9510 aiHook.h[ 9511 _DYN_PUSH$1 9512 /* @min:%2epush */ 9513 ](theHook); 9514 return theHook; 9515} 9516function InstrumentFunc(target, funcName, callbacks, checkPrototype, checkParentProto) { 9517 if (checkPrototype === void 0) { 9518 checkPrototype = true; 9519 } 9520 if (target && funcName && callbacks) { 9521 var owner = _getOwner(target, funcName, checkPrototype, checkParentProto); 9522 if (owner) { 9523 var fn = owner[funcName]; 9524 if (typeof fn === strShimFunction) { 9525 return _createInstrumentHook(owner, funcName, fn, callbacks); 9526 } 9527 } 9528 } 9529 return null; 9530} 9531function InstrumentEvent(target, evtName, callbacks, checkPrototype, checkParentProto) { 9532 if (target && evtName && callbacks) { 9533 var owner = _getOwner(target, evtName, checkPrototype, checkParentProto) || target; 9534 if (owner) { 9535 return _createInstrumentHook(owner, evtName, owner[evtName], callbacks); 9536 } 9537 } 9538 return null; 9539} 9540var DisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation"; 9541var SampleRate = "sampleRate"; 9542var ProcessLegacy = "ProcessLegacy"; 9543var HttpMethod = "http.method"; 9544var DEFAULT_BREEZE_ENDPOINT = "https://dc.services.visualstudio.com"; 9545var DEFAULT_BREEZE_PATH = "/v2/track"; 9546var strNotSpecified = "not_specified"; 9547var strIkey = "iKey"; 9548var RequestHeaders = createValueMap({ 9549 requestContextHeader: [0, "Request-Context"], 9550 requestContextTargetKey: [1, "appId"], 9551 requestContextAppIdFormat: [2, "appId=cid-v1:"], 9552 requestIdHeader: [3, "Request-Id"], 9553 traceParentHeader: [4, "traceparent"], 9554 traceStateHeader: [5, "tracestate"], 9555 sdkContextHeader: [6, "Sdk-Context"], 9556 sdkContextHeaderAppIdRequest: [7, "appId"], 9557 requestContextHeaderLowerCase: [8, "request-context"] 9558}); 9559var _DYN_SPLIT = "split"; 9560var _DYN_LENGTH$3 = "length"; 9561var _DYN_TO_LOWER_CASE$1 = "toLowerCase"; 9562var _DYN_INGESTIONENDPOINT = "ingestionendpoint"; 9563var _DYN_TO_STRING$2 = "toString"; 9564var _DYN_REMOVE_ITEM = "removeItem"; 9565var _DYN_MESSAGE = "message"; 9566var _DYN_COUNT$1 = "count"; 9567var _DYN_PRE_TRIGGER_DATE = "preTriggerDate"; 9568var _DYN_GET_UTCDATE = "getUTCDate"; 9569var _DYN_STRINGIFY$1 = "stringify"; 9570var _DYN_PATHNAME = "pathname"; 9571var _DYN_MATCH = "match"; 9572var _DYN_CORRELATION_HEADER_E0 = "correlationHeaderExcludePatterns"; 9573var _DYN_NAME$1 = "name"; 9574var _DYN_PROPERTIES$1 = "properties"; 9575var _DYN_MEASUREMENTS$1 = "measurements"; 9576var _DYN_SIZE_IN_BYTES = "sizeInBytes"; 9577var _DYN_TYPE_NAME = "typeName"; 9578var _DYN_EXCEPTIONS = "exceptions";
9579var _DYN_SEVERITY_LEVEL = "severityLevel"; 9580var _DYN_PROBLEM_GROUP = "problemGroup"; 9581var _DYN_PARSED_STACK = "parsedStack"; 9582var _DYN_HAS_FULL_STACK = "hasFullStack"; 9583var _DYN_ASSEMBLY = "assembly"; 9584var _DYN_FILE_NAME = "fileName"; 9585var _DYN_LINE = "line"; 9586var _DYN_AI_DATA_CONTRACT = "aiDataContract"; 9587var _DYN_DURATION$1 = "duration"; 9588function dataSanitizeKeyAndAddUniqueness(logger, key, map) { 9589 var origLength = key[ 9590 _DYN_LENGTH$3 9591 /* @min:%2elength */ 9592 ]; 9593 var field = dataSanitizeKey(logger, key); 9594 if (field[ 9595 _DYN_LENGTH$3 9596 /* @min:%2elength */ 9597 ] !== origLength) { 9598 var i2 = 0; 9599 var uniqueField = field; 9600 while (map[uniqueField] !== void 0) { 9601 i2++; 9602 uniqueField = strSubstring(field, 0, 150 - 3) + dsPadNumber(i2); 9603 } 9604 field = uniqueField; 9605 } 9606 return field; 9607} 9608function dataSanitizeKey(logger, name) { 9609 var nameTrunc; 9610 if (name) { 9611 name = strTrim(asString(name)); 9612 if (name[ 9613 _DYN_LENGTH$3 9614 /* @min:%2elength */ 9615 ] > 150) { 9616 nameTrunc = strSubstring( 9617 name, 9618 0, 9619 150 9620 /* DataSanitizerValues.MAX_NAME_LENGTH */ 9621 ); 9622 _throwInternal(logger, 2, 57, "name is too long. It has been truncated to 150 characters.", { name }, true); 9623 } 9624 } 9625 return nameTrunc || name; 9626} 9627function dataSanitizeString(logger, value, maxLength) { 9628 if (maxLength === void 0) { 9629 maxLength = 1024; 9630 } 9631 var valueTrunc; 9632 if (value) { 9633 maxLength = maxLength ? maxLength : 1024; 9634 value = strTrim(asString(value)); 9635 if (value[ 9636 _DYN_LENGTH$3 9637 /* @min:%2elength */ 9638 ] > maxLength) { 9639 valueTrunc = strSubstring(value, 0, maxLength); 9640 _throwInternal(logger, 2, 61, "string value is too long. It has been truncated to " + maxLength + " characters.", { value }, true); 9641 } 9642 } 9643 return valueTrunc || value; 9644} 9645function dataSanitizeUrl(logger, url) { 9646 return dataSanitizeInput( 9647 logger, 9648 url, 9649 2048, 9650 66 9651 /* _eInternalMessageId.UrlTooLong */ 9652 ); 9653} 9654function dataSanitizeMessage(logger, message) { 9655 var messageTrunc; 9656 if (message) { 9657 if (message[ 9658 _DYN_LENGTH$3 9659 /* @min:%2elength */ 9660 ] > 32768) { 9661 messageTrunc = strSubstring( 9662 message, 9663 0, 9664 32768 9665 /* DataSanitizerValues.MAX_MESSAGE_LENGTH */ 9666 ); 9667 _throwInternal(logger, 2, 56, "message is too long, it has been truncated to 32768 characters.", { message }, true); 9668 } 9669 } 9670 return messageTrunc || message; 9671} 9672function dataSanitizeException(logger, exception) { 9673 var exceptionTrunc; 9674 if (exception) { 9675 var value = "" + exception; 9676 if (value[ 9677 _DYN_LENGTH$3 9678 /* @min:%2elength */ 9679 ] > 32768) { 9680 exceptionTrunc = strSubstring( 9681 value, 9682 0, 9683 32768 9684 /* DataSanitizerValues.MAX_EXCEPTION_LENGTH */ 9685 ); 9686 _throwInternal(logger, 2, 52, "exception is too long, it has been truncated to 32768 characters.", { exception }, true); 9687 } 9688 } 9689 return exceptionTrunc || exception; 9690} 9691function dataSanitizeProperties(logger, properties) { 9692 if (properties) { 9693 var tempProps_1 = {}; 9694 objForEachKey(properties, function(prop, value) { 9695 if (/* @__PURE__ */ isObject(value) && hasJSON()) { 9696 try { 9697 value = getJSON()[ 9698 _DYN_STRINGIFY$1 9699 /* @min:%2estringify */ 9700 ](value); 9701 } catch (e) { 9702 _throwInternal(logger, 2, 49, "custom property is not valid", { exception: e }, true); 9703 } 9704 } 9705 value = dataSanitizeString( 9706 logger, 9707 value, 9708 8192 9709 /* DataSanitizerValues.MAX_PROPERTY_LENGTH */ 9710 ); 9711 prop = dataSanitizeKeyAndAddUniqueness(logger, prop, tempProps_1); 9712 tempProps_1[prop] = value; 9713 }); 9714 properties = tempProps_1; 9715 } 9716 return properties; 9717} 9718function dataSanitizeMeasurements(logger, measurements) { 9719 if (measurements) { 9720 var tempMeasurements_1 = {}; 9721 objForEachKey(measurements, function(measure, value) { 9722 measure = dataSanitizeKeyAndAddUniqueness(logger, measure, tempMeasurements_1); 9723 tempMeasurements_1[measure] = value; 9724 }); 9725 measurements = tempMeasurements_1; 9726 } 9727 return measurements; 9728} 9729function dataSanitizeId(logger, id) { 9730 return id ? dataSanitizeInput( 9731 logger, 9732 id, 9733 128, 9734 69 9735 /* _eInternalMessageId.IdTooLong */ 9736 )[ 9737 _DYN_TO_STRING$2 9738 /* @min:%2etoString */ 9739 ]() : id; 9740} 9741function dataSanitizeInput(logger, input, maxLength, _msgId) { 9742 var inputTrunc; 9743 if (input) { 9744 input = strTrim(asString(input)); 9745 if (input[ 9746 _DYN_LENGTH$3 9747 /* @min:%2elength */ 9748 ] > maxLength) { 9749 inputTrunc = strSubstring(input, 0, maxLength); 9750 _throwInternal(logger, 2, _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true); 9751 } 9752 } 9753 return inputTrunc || input; 9754} 9755function dsPadNumber(num) { 9756 var s2 = "00" + num; 9757 return strSubstr(s2, s2[ 9758 _DYN_LENGTH$3 9759 /* @min:%2elength */ 9760 ] - 3); 9761} 9762var _document = getDocument() || {}; 9763var _htmlAnchorIdx = 0; 9764var _htmlAnchorElement = [null, null, null, null, null]; 9765function urlParseUrl(url) { 9766 var anchorIdx = _htmlAnchorIdx; 9767 var anchorCache = _htmlAnchorElement; 9768 var tempAnchor = anchorCache[anchorIdx]; 9769 if (!_document.createElement) { 9770 tempAnchor = { host: urlParseHost(url) }; 9771 } else if (!anchorCache[anchorIdx]) { 9772 tempAnchor = anchorCache[anchorIdx] = _document.createElement("a"); 9773 } 9774 tempAnchor.href = url; 9775 anchorIdx++; 9776 if (anchorIdx >= anchorCache[ 9777 _DYN_LENGTH$3 9778 /* @min:%2elength */ 9779 ]) { 9780 anchorIdx = 0; 9781 } 9782 _htmlAnchorIdx = anchorIdx; 9783 return tempAnchor; 9784} 9785function urlGetAbsoluteUrl(url) { 9786 var result; 9787 var a = urlParseUrl(url); 9788 if (a) { 9789 result = a.href; 9790 } 9791 return result; 9792} 9793function urlGetCompleteUrl(method, absoluteUrl) { 9794 if (method) { 9795 return method.toUpperCase() + " " + absoluteUrl; 9796 } 9797 return absoluteUrl; 9798} 9799function urlParseHost(url, inclPort) { 9800 var fullHost = urlParseFullHost(url) || ""; 9801 if (fullHost) { 9802 var match = fullHost[ 9803 _DYN_MATCH 9804 /* @min:%2ematch */ 9805 ](/(www\d{0,5}\.)?([^\/:]{1,256})(:\d{1,20})?/i); 9806 if (match != null && match[ 9807 _DYN_LENGTH$3 9808 /* @min:%2elength */ 9809 ] > 3 && isString(match[2]) && match[2][ 9810 _DYN_LENGTH$3 9811 /* @min:%2elength */ 9812 ] > 0) { 9813 return match[2] + (match[3] || ""); 9814 } 9815 } 9816 return fullHost; 9817} 9818function urlParseFullHost(url, inclPort) { 9819 var result = null; 9820 if (url) { 9821 var match = url[ 9822 _DYN_MATCH 9823 /* @min:%2ematch */ 9824 ](/(\w{1,150}):\/\/([^\/:]{1,256})(:\d{1,20})?/i); 9825 if (match != null && match[ 9826 _DYN_LENGTH$3 9827 /* @min:%2elength */ 9828 ] > 2 && isString(match[2]) && match[2][ 9829 _DYN_LENGTH$3 9830 /* @min:%2elength */ 9831 ] > 0) { 9832 result = match[2] || ""; 9833 if (match[ 9834 _DYN_LENGTH$3 9835 /* @min:%2elength */ 9836 ] > 2) { 9837 var protocol = (match[1] || "")[ 9838 _DYN_TO_LOWER_CASE$1 9839 /* @min:%2etoLowerCase */ 9840 ](); 9841 var port = match[3] || ""; 9842 if (protocol === "http" && port === ":80") { 9843 port = ""; 9844 } else if (protocol === "https" && port === ":443") { 9845 port = ""; 9846 } 9847 result += port; 9848 } 9849 } 9850 } 9851 return result; 9852} 9853var _internalEndpoints = [ 9854 DEFAULT_BREEZE_ENDPOINT + DEFAULT_BREEZE_PATH, 9855 "https://breeze.aimon.applicationinsights.io" + DEFAULT_BREEZE_PATH, 9856 "https://dc-int.services.visualstudio.com" + DEFAULT_BREEZE_PATH 9857]; 9858var _correlationIdPrefix = "cid-v1:"; 9859function isInternalApplicationInsightsEndpoint(endpointUrl) { 9860 return arrIndexOf(_internalEndpoints, endpointUrl[ 9861 _DYN_TO_LOWER_CASE$1 9862 /* @min:%2etoLowerCase */ 9863 ]()) !== -1; 9864} 9865function correlationIdCanIncludeCorrelationHeader(config, requestUrl, currentHost) { 9866 if (!requestUrl || config && config.disableCorrelationHeaders) { 9867 return false;
9868 } 9869 if (config && config[ 9870 _DYN_CORRELATION_HEADER_E0 9871 /* @min:%2ecorrelationHeaderExcludePatterns */ 9872 ]) { 9873 for (var i2 = 0; i2 < config.correlationHeaderExcludePatterns[ 9874 _DYN_LENGTH$3 9875 /* @min:%2elength */ 9876 ]; i2++) { 9877 if (config[ 9878 _DYN_CORRELATION_HEADER_E0 9879 /* @min:%2ecorrelationHeaderExcludePatterns */ 9880 ][i2].test(requestUrl)) { 9881 return false; 9882 } 9883 } 9884 } 9885 var requestHost = urlParseUrl(requestUrl).host[ 9886 _DYN_TO_LOWER_CASE$1 9887 /* @min:%2etoLowerCase */ 9888 ](); 9889 if (requestHost && (strIndexOf(requestHost, ":443") !== -1 || strIndexOf(requestHost, ":80") !== -1)) { 9890 requestHost = (urlParseFullHost(requestUrl) || "")[ 9891 _DYN_TO_LOWER_CASE$1 9892 /* @min:%2etoLowerCase */ 9893 ](); 9894 } 9895 if ((!config || !config.enableCorsCorrelation) && (requestHost && requestHost !== currentHost)) { 9896 return false; 9897 } 9898 var includedDomains = config && config.correlationHeaderDomains; 9899 if (includedDomains) { 9900 var matchExists_1; 9901 arrForEach(includedDomains, function(domain) { 9902 var regex2 = new RegExp(domain.toLowerCase().replace(/\\/g, "\\\\").replace(/\./g, "\\.").replace(/\*/g, ".*")); 9903 matchExists_1 = matchExists_1 || regex2.test(requestHost); 9904 }); 9905 if (!matchExists_1) { 9906 return false; 9907 } 9908 } 9909 var excludedDomains = config && config.correlationHeaderExcludedDomains; 9910 if (!excludedDomains || excludedDomains[ 9911 _DYN_LENGTH$3 9912 /* @min:%2elength */ 9913 ] === 0) { 9914 return true; 9915 } 9916 for (var i2 = 0; i2 < excludedDomains[ 9917 _DYN_LENGTH$3 9918 /* @min:%2elength */ 9919 ]; i2++) { 9920 var regex = new RegExp(excludedDomains[i2].toLowerCase().replace(/\\/g, "\\\\").replace(/\./g, "\\.").replace(/\*/g, ".*")); 9921 if (regex.test(requestHost)) { 9922 return false; 9923 } 9924 } 9925 return requestHost && requestHost[ 9926 _DYN_LENGTH$3 9927 /* @min:%2elength */ 9928 ] > 0; 9929} 9930function correlationIdGetCorrelationContext(responseHeader) { 9931 if (responseHeader) { 9932 var correlationId = correlationIdGetCorrelationContextValue(responseHeader, RequestHeaders[ 9933 1 9934 /* eRequestHeaders.requestContextTargetKey */ 9935 ]); 9936 if (correlationId && correlationId !== _correlationIdPrefix) { 9937 return correlationId; 9938 } 9939 } 9940} 9941function correlationIdGetCorrelationContextValue(responseHeader, key) { 9942 if (responseHeader) { 9943 var keyValues = responseHeader[ 9944 _DYN_SPLIT 9945 /* @min:%2esplit */ 9946 ](","); 9947 for (var i2 = 0; i2 < keyValues[ 9948 _DYN_LENGTH$3 9949 /* @min:%2elength */ 9950 ]; ++i2) { 9951 var keyValue = keyValues[i2][ 9952 _DYN_SPLIT 9953 /* @min:%2esplit */ 9954 ]("="); 9955 if (keyValue[ 9956 _DYN_LENGTH$3 9957 /* @min:%2elength */ 9958 ] === 2 && keyValue[0] === key) { 9959 return keyValue[1]; 9960 } 9961 } 9962 } 9963} 9964function AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName) { 9965 var target, name = commandName, data = commandName; 9966 if (absoluteUrl && absoluteUrl[ 9967 _DYN_LENGTH$3 9968 /* @min:%2elength */ 9969 ] > 0) { 9970 var parsedUrl = urlParseUrl(absoluteUrl); 9971 target = parsedUrl.host; 9972 if (!name) { 9973 if (parsedUrl[ 9974 _DYN_PATHNAME 9975 /* @min:%2epathname */ 9976 ] != null) { 9977 var pathName = parsedUrl.pathname[ 9978 _DYN_LENGTH$3 9979 /* @min:%2elength */ 9980 ] === 0 ? "/" : parsedUrl[ 9981 _DYN_PATHNAME 9982 /* @min:%2epathname */ 9983 ]; 9984 if (pathName.charAt(0) !== "/") { 9985 pathName = "/" + pathName; 9986 } 9987 data = parsedUrl[ 9988 _DYN_PATHNAME 9989 /* @min:%2epathname */ 9990 ]; 9991 name = dataSanitizeString(logger, method ? method + " " + pathName : pathName); 9992 } else { 9993 name = dataSanitizeString(logger, absoluteUrl); 9994 } 9995 } 9996 } else { 9997 target = commandName; 9998 name = commandName; 9999 } 10000 return { 10001 target, 10002 name, 10003 data 10004 }; 10005} 10006function dateTimeUtilsNow() { 10007 var perf = /* @__PURE__ */ getPerformance(); 10008 if (perf && perf.now && perf.timing) { 10009 var now = perf.now() + perf.timing.navigationStart; 10010 if (now > 0) { 10011 return now; 10012 } 10013 } 10014 return /* @__PURE__ */ utcNow(); 10015} 10016function dateTimeUtilsDuration(start, end) { 10017 var result = null; 10018 if (start !== 0 && end !== 0 && !/* @__PURE__ */ isNullOrUndefined(start) && !/* @__PURE__ */ isNullOrUndefined(end)) { 10019 result = end - start; 10020 } 10021 return result; 10022} 10023function createDistributedTraceContextFromTrace(telemetryTrace, parentCtx) { 10024 var trace = telemetryTrace || {}; 10025 return { 10026 getName: function() { 10027 return trace[ 10028 _DYN_NAME$1 10029 /* @min:%2ename */ 10030 ]; 10031 }, 10032 setName: function(newValue) { 10033 parentCtx && parentCtx.setName(newValue); 10034 trace[ 10035 _DYN_NAME$1 10036 /* @min:%2ename */ 10037 ] = newValue; 10038 }, 10039 getTraceId: function() { 10040 return trace.traceID; 10041 }, 10042 setTraceId: function(newValue) { 10043 parentCtx && parentCtx.setTraceId(newValue); 10044 if (isValidTraceId(newValue)) { 10045 trace.traceID = newValue; 10046 } 10047 }, 10048 getSpanId: function() { 10049 return trace.parentID; 10050 }, 10051 setSpanId: function(newValue) { 10052 parentCtx && parentCtx.setSpanId(newValue); 10053 if (isValidSpanId(newValue)) { 10054 trace.parentID = newValue; 10055 } 10056 }, 10057 getTraceFlags: function() { 10058 return trace.traceFlags; 10059 }, 10060 setTraceFlags: function(newTraceFlags) { 10061 parentCtx && parentCtx.setTraceFlags(newTraceFlags); 10062 trace.traceFlags = newTraceFlags; 10063 } 10064 }; 10065} 10066var StorageType = createEnumStyle({ 10067 LocalStorage: 0, 10068 SessionStorage: 1 10069 /* eStorageType.SessionStorage */ 10070}); 10071var _canUseLocalStorage = void 0; 10072var _canUseSessionStorage = void 0; 10073var _storagePrefix = ""; 10074function _getLocalStorageObject() { 10075 if (utlCanUseLocalStorage()) { 10076 return _getVerifiedStorageObject(StorageType.LocalStorage); 10077 } 10078 return null; 10079} 10080function _getVerifiedStorageObject(storageType) { 10081 try { 10082 if (/* @__PURE__ */ isNullOrUndefined(getGlobal())) { 10083 return null; 10084 } 10085 var uid = (/* @__PURE__ */ new Date())[ 10086 _DYN_TO_STRING$2 10087 /* @min:%2etoString */ 10088 ](); 10089 var storage = /* @__PURE__ */ getInst(storageType === StorageType.LocalStorage ? "localStorage" : "sessionStorage"); 10090 var name_1 = _storagePrefix + uid; 10091 storage.setItem(name_1, uid); 10092 var fail = storage.getItem(name_1) !== uid; 10093 storage[ 10094 _DYN_REMOVE_ITEM 10095 /* @min:%2eremoveItem */ 10096 ](name_1); 10097 if (!fail) { 10098 return storage; 10099 } 10100 } catch (exception) { 10101 } 10102 return null; 10103} 10104function _getSessionStorageObject() { 10105 if (utlCanUseSessionStorage()) { 10106 return _getVerifiedStorageObject(StorageType.SessionStorage); 10107 } 10108 return null; 10109} 10110function utlDisableStorage() { 10111 _canUseLocalStorage = false;
vendor: 14,070 bytes, lines 10112-10521
10112 _canUseSessionStorage = false; 10113} 10114function utlSetStoragePrefix(storagePrefix) { 10115 _storagePrefix = storagePrefix || ""; 10116} 10117function utlEnableStorage() { 10118 _canUseLocalStorage = utlCanUseLocalStorage(true); 10119 _canUseSessionStorage = utlCanUseSessionStorage(true); 10120} 10121function utlCanUseLocalStorage(reset2) { 10122 if (reset2 || _canUseLocalStorage === void 0) { 10123 _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage); 10124 } 10125 return _canUseLocalStorage; 10126} 10127function utlGetLocalStorage(logger, name) { 10128 var storage = _getLocalStorageObject(); 10129 if (storage !== null) { 10130 try { 10131 return storage.getItem(name); 10132 } catch (e) { 10133 _canUseLocalStorage = false; 10134 _throwInternal(logger, 2, 1, "Browser failed read of local storage. " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 10135 } 10136 } 10137 return null; 10138} 10139function utlSetLocalStorage(logger, name, data) { 10140 var storage = _getLocalStorageObject(); 10141 if (storage !== null) { 10142 try { 10143 storage.setItem(name, data); 10144 return true; 10145 } catch (e) { 10146 _canUseLocalStorage = false; 10147 _throwInternal(logger, 2, 3, "Browser failed write to local storage. " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 10148 } 10149 } 10150 return false; 10151} 10152function utlRemoveStorage(logger, name) { 10153 var storage = _getLocalStorageObject(); 10154 if (storage !== null) { 10155 try { 10156 storage[ 10157 _DYN_REMOVE_ITEM 10158 /* @min:%2eremoveItem */ 10159 ](name); 10160 return true; 10161 } catch (e) { 10162 _canUseLocalStorage = false; 10163 _throwInternal(logger, 2, 5, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 10164 } 10165 } 10166 return false; 10167} 10168function utlCanUseSessionStorage(reset2) { 10169 if (reset2 || _canUseSessionStorage === void 0) { 10170 _canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage); 10171 } 10172 return _canUseSessionStorage; 10173} 10174function utlGetSessionStorage(logger, name) { 10175 var storage = _getSessionStorageObject(); 10176 if (storage !== null) { 10177 try { 10178 return storage.getItem(name); 10179 } catch (e) { 10180 _canUseSessionStorage = false; 10181 _throwInternal(logger, 2, 2, "Browser failed read of session storage. " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 10182 } 10183 } 10184 return null; 10185} 10186function utlSetSessionStorage(logger, name, data) { 10187 var storage = _getSessionStorageObject(); 10188 if (storage !== null) { 10189 try { 10190 storage.setItem(name, data); 10191 return true; 10192 } catch (e) { 10193 _canUseSessionStorage = false; 10194 _throwInternal(logger, 2, 4, "Browser failed write to session storage. " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 10195 } 10196 } 10197 return false; 10198} 10199function utlRemoveSessionStorage(logger, name) { 10200 var storage = _getSessionStorageObject(); 10201 if (storage !== null) { 10202 try { 10203 storage[ 10204 _DYN_REMOVE_ITEM 10205 /* @min:%2eremoveItem */ 10206 ](name); 10207 return true; 10208 } catch (e) { 10209 _canUseSessionStorage = false; 10210 _throwInternal(logger, 2, 6, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 10211 } 10212 } 10213 return false; 10214} 10215var THROTTLE_STORAGE_PREFIX = "appInsightsThrottle"; 10216var ThrottleMgr = ( 10217 /** @class */ 10218 /* @__PURE__ */ function() { 10219 function ThrottleMgr2(core, namePrefix) { 10220 var _self = this; 10221 var _canUseLocalStorage2; 10222 var _logger; 10223 var _config; 10224 var _localStorageObj; 10225 var _isTriggered; 10226 var _namePrefix; 10227 var _queue; 10228 var _isReady = false; 10229 var _isSpecificDaysGiven = false; 10230 _initConfig(); 10231 _self["_getDbgPlgTargets"] = function() { 10232 return [_queue]; 10233 }; 10234 _self.getConfig = function() { 10235 return _config; 10236 }; 10237 _self.canThrottle = function(msgId) { 10238 var localObj = _getLocalStorageObjByKey(msgId); 10239 var cfg = _getCfgByKey(msgId); 10240 return _canThrottle(cfg, _canUseLocalStorage2, localObj); 10241 }; 10242 _self.isTriggered = function(msgId) { 10243 return _isTrigger(msgId); 10244 }; 10245 _self.isReady = function() { 10246 return _isReady; 10247 }; 10248 _self.flush = function(msgId) { 10249 try { 10250 var queue = _getQueueByKey(msgId); 10251 if (queue && queue[ 10252 _DYN_LENGTH$3 10253 /* @min:%2elength */ 10254 ] > 0) { 10255 var items = queue.slice(0); 10256 _queue[msgId] = []; 10257 arrForEach(items, function(item) { 10258 _flushMessage(item.msgID, item[ 10259 _DYN_MESSAGE 10260 /* @min:%2emessage */ 10261 ], item.severity, false); 10262 }); 10263 return true; 10264 } 10265 } catch (err) { 10266 } 10267 return false; 10268 }; 10269 _self.flushAll = function() { 10270 try { 10271 if (_queue) { 10272 var result_1 = true; 10273 objForEachKey(_queue, function(key) { 10274 var isFlushed = _self.flush(parseInt(key)); 10275 result_1 = result_1 && isFlushed; 10276 }); 10277 return result_1; 10278 } 10279 } catch (err) { 10280 } 10281 return false; 10282 }; 10283 _self.onReadyState = function(isReady, flushAll) { 10284 if (flushAll === void 0) { 10285 flushAll = true; 10286 } 10287 _isReady = /* @__PURE__ */ isNullOrUndefined(isReady) ? true : isReady; 10288 if (_isReady && flushAll) { 10289 return _self.flushAll(); 10290 } 10291 return null; 10292 }; 10293 _self.sendMessage = function(msgID, message, severity) { 10294 return _flushMessage(msgID, message, severity, true); 10295 }; 10296 function _flushMessage(msgID, message, severity, saveUnsentMsg) { 10297 if (_isReady) { 10298 var isSampledIn = _canSampledIn(msgID); 10299 if (!isSampledIn) { 10300 return; 10301 } 10302 var cfg = _getCfgByKey(msgID); 10303 var localStorageObj = _getLocalStorageObjByKey(msgID); 10304 var canThrottle = _canThrottle(cfg, _canUseLocalStorage2, localStorageObj); 10305 var throttled = false; 10306 var number = 0; 10307 var isTriggered = _isTrigger(msgID); 10308 try { 10309 if (canThrottle && !isTriggered) { 10310 number = mathMin(cfg.limit.maxSendNumber, localStorageObj[ 10311 _DYN_COUNT$1 10312 /* @min:%2ecount */ 10313 ] + 1); 10314 localStorageObj[ 10315 _DYN_COUNT$1 10316 /* @min:%2ecount */ 10317 ] = 0; 10318 throttled = true; 10319 _isTriggered[msgID] = true; 10320 localStorageObj[ 10321 _DYN_PRE_TRIGGER_DATE 10322 /* @min:%2epreTriggerDate */ 10323 ] = /* @__PURE__ */ new Date(); 10324 } else { 10325 _isTriggered[msgID] = canThrottle; 10326 localStorageObj[ 10327 _DYN_COUNT$1 10328 /* @min:%2ecount */ 10329 ] += 1; 10330 } 10331 var localStorageName = _getLocalStorageName(msgID); 10332 _resetLocalStorage(_logger, localStorageName, localStorageObj); 10333 for (var i2 = 0; i2 < number; i2++) { 10334 _sendMessage(msgID, _logger, message, severity); 10335 } 10336 } catch (e) { 10337 } 10338 return { 10339 isThrottled: throttled, 10340 throttleNum: number 10341 }; 10342 } else { 10343 if (!!saveUnsentMsg) { 10344 var queue = _getQueueByKey(msgID); 10345 queue.push({ 10346 msgID, 10347 message, 10348 severity 10349 }); 10350 } 10351 } 10352 return null; 10353 } 10354 function _initConfig() { 10355 _logger = safeGetLogger(core); 10356 _isTriggered = {}; 10357 _localStorageObj = {}; 10358 _queue = {}; 10359 _config = {}; 10360 _setCfgByKey( 10361 109 10362 /* _eInternalMessageId.DefaultThrottleMsgKey */ 10363 ); 10364 _namePrefix = isNotNullOrUndefined(namePrefix) ? namePrefix : ""; 10365 core.addUnloadHook(onConfigChange(core.config, function(details) { 10366 var coreConfig = details.cfg; 10367 _canUseLocalStorage2 = utlCanUseLocalStorage(); 10368 var configMgr = coreConfig.throttleMgrCfg || {}; 10369 objForEachKey(configMgr, function(key, cfg) { 10370 _setCfgByKey(parseInt(key), cfg); 10371 }); 10372 })); 10373 } 10374 function _getCfgByKey(msgID) { 10375 return _config[msgID] || _config[ 10376 109 10377 /* _eInternalMessageId.DefaultThrottleMsgKey */ 10378 ]; 10379 } 10380 function _setCfgByKey(msgID, config) { 10381 var _a2, _b2; 10382 try { 10383 var cfg = config || {}; 10384 var curCfg = {}; 10385 curCfg.disabled = !!cfg.disabled; 10386 var configInterval = cfg.interval || {}; 10387 _isSpecificDaysGiven = (configInterval === null || configInterval === void 0 ? void 0 : configInterval.daysOfMonth) && (configInterval === null || configInterval === void 0 ? void 0 : configInterval.daysOfMonth[ 10388 _DYN_LENGTH$3 10389 /* @min:%2elength */ 10390 ]) > 0; 10391 curCfg.interval = _getIntervalConfig(configInterval); 10392 var limit = { 10393 samplingRate: ((_a2 = cfg.limit) === null || _a2 === void 0 ? void 0 : _a2.samplingRate) || 100, 10394 // dafault: every time sent only 1 event 10395 maxSendNumber: ((_b2 = cfg.limit) === null || _b2 === void 0 ? void 0 : _b2.maxSendNumber) || 1 10396 }; 10397 curCfg.limit = limit; 10398 _config[msgID] = curCfg; 10399 } catch (e) { 10400 } 10401 } 10402 function _getIntervalConfig(interval) { 10403 interval = interval || {}; 10404 var monthInterval = interval === null || interval === void 0 ? void 0 : interval.monthInterval; 10405 var dayInterval = interval === null || interval === void 0 ? void 0 : interval.dayInterval; 10406 if (/* @__PURE__ */ isNullOrUndefined(monthInterval) && /* @__PURE__ */ isNullOrUndefined(dayInterval)) { 10407 interval.monthInterval = 3; 10408 if (!_isSpecificDaysGiven) { 10409 interval.daysOfMonth = [28]; 10410 _isSpecificDaysGiven = true; 10411 } 10412 } 10413 interval = { 10414 // dafault: sent every three months 10415 monthInterval: interval === null || interval === void 0 ? void 0 : interval.monthInterval, 10416 dayInterval: interval === null || interval === void 0 ? void 0 : interval.dayInterval, 10417 daysOfMonth: interval === null || interval === void 0 ? void 0 : interval.daysOfMonth 10418 }; 10419 return interval; 10420 } 10421 function _canThrottle(config, canUseLocalStorage, localStorageObj) { 10422 if (config && !config.disabled && canUseLocalStorage && isNotNullOrUndefined(localStorageObj)) { 10423 var curDate = _getThrottleDate(); 10424 var date = localStorageObj.date; 10425 var interval = config.interval; 10426 var monthCheck = 1; 10427 if (interval === null || interval === void 0 ? void 0 : interval.monthInterval) { 10428 var monthExpand = (curDate.getUTCFullYear() - date.getUTCFullYear()) * 12 + curDate.getUTCMonth() - date.getUTCMonth(); 10429 monthCheck = _checkInterval(interval.monthInterval, 0, monthExpand); 10430 } 10431 var dayCheck = 1; 10432 if (_isSpecificDaysGiven) { 10433 dayCheck = arrIndexOf(interval.daysOfMonth, curDate[ 10434 _DYN_GET_UTCDATE 10435 /* @min:%2egetUTCDate */ 10436 ]()); 10437 } else if (interval === null || interval === void 0 ? void 0 : interval.dayInterval) { 10438 var daySpan = mathFloor((curDate.getTime() - date.getTime()) / 864e5); 10439 dayCheck = _checkInterval(interval.dayInterval, 0, daySpan); 10440 } 10441 return monthCheck >= 0 && dayCheck >= 0; 10442 } 10443 return false; 10444 } 10445 function _getLocalStorageName(msgKey, prefix) { 10446 var fix = isNotNullOrUndefined(prefix) ? prefix : ""; 10447 if (msgKey) { 10448 return THROTTLE_STORAGE_PREFIX + fix + "-" + msgKey; 10449 } 10450 return null; 10451 } 10452 function _isTriggeredOnCurDate(preTriggerDate) { 10453 try { 10454 if (preTriggerDate) { 10455 var curDate = /* @__PURE__ */ new Date(); 10456 return preTriggerDate.getUTCFullYear() === curDate.getUTCFullYear() && preTriggerDate.getUTCMonth() === curDate.getUTCMonth() && preTriggerDate[ 10457 _DYN_GET_UTCDATE 10458 /* @min:%2egetUTCDate */ 10459 ]() === curDate[ 10460 _DYN_GET_UTCDATE 10461 /* @min:%2egetUTCDate */ 10462 ](); 10463 } 10464 } catch (e) { 10465 } 10466 return false; 10467 } 10468 function _getLocalStorageObj(value, logger, storageName) { 10469 try { 10470 var storageObj = { 10471 date: _getThrottleDate(), 10472 count: 0 10473 }; 10474 if (value) { 10475 var obj = JSON.parse(value); 10476 var curObj = { 10477 date: _getThrottleDate(obj.date) || storageObj.date, 10478 count: obj[ 10479 _DYN_COUNT$1 10480 /* @min:%2ecount */ 10481 ] || storageObj[ 10482 _DYN_COUNT$1 10483 /* @min:%2ecount */ 10484 ], 10485 preTriggerDate: obj.preTriggerDate ? _getThrottleDate(obj[ 10486 _DYN_PRE_TRIGGER_DATE 10487 /* @min:%2epreTriggerDate */ 10488 ]) : void 0 10489 }; 10490 return curObj; 10491 } else { 10492 _resetLocalStorage(logger, storageName, storageObj); 10493 return storageObj; 10494 } 10495 } catch (e) { 10496 } 10497 return null; 10498 } 10499 function _getThrottleDate(dateStr) { 10500 try { 10501 if (dateStr) { 10502 var date = new Date(dateStr); 10503 if (!isNaN(date.getDate())) { 10504 return date; 10505 } 10506 } else { 10507 return /* @__PURE__ */ new Date(); 10508 } 10509 } catch (e) { 10510 } 10511 return null; 10512 } 10513 function _resetLocalStorage(logger, storageName, obj) { 10514 try { 10515 return utlSetLocalStorage(logger, storageName, strTrim(JSON[ 10516 _DYN_STRINGIFY$1 10517 /* @min:%2estringify */ 10518 ](obj))); 10519 } catch (e) { 10520 } 10521 return false;
10522 } 10523 function _checkInterval(interval, start, current) { 10524 if (interval <= 0) { 10525 return 1; 10526 } 10527 return current >= start && (current - start) % interval == 0 ? mathFloor((current - start) / interval) + 1 : -1; 10528 } 10529 function _sendMessage(msgID, logger, message, severity) { 10530 _throwInternal(logger, severity || 1, msgID, message); 10531 } 10532 function _canSampledIn(msgID) { 10533 try { 10534 var cfg = _getCfgByKey(msgID); 10535 return randomValue(1e6) <= cfg.limit.samplingRate; 10536 } catch (e) { 10537 } 10538 return false; 10539 } 10540 function _getLocalStorageObjByKey(key) { 10541 try { 10542 var curObj = _localStorageObj[key]; 10543 if (!curObj) { 10544 var localStorageName = _getLocalStorageName(key, _namePrefix); 10545 curObj = _getLocalStorageObj(utlGetLocalStorage(_logger, localStorageName), _logger, localStorageName); 10546 _localStorageObj[key] = curObj; 10547 } 10548 return _localStorageObj[key]; 10549 } catch (e) { 10550 } 10551 return null; 10552 } 10553 function _isTrigger(key) { 10554 var isTrigger = _isTriggered[key]; 10555 if (/* @__PURE__ */ isNullOrUndefined(isTrigger)) { 10556 isTrigger = false; 10557 var localStorageObj = _getLocalStorageObjByKey(key); 10558 if (localStorageObj) { 10559 isTrigger = _isTriggeredOnCurDate(localStorageObj[ 10560 _DYN_PRE_TRIGGER_DATE 10561 /* @min:%2epreTriggerDate */ 10562 ]); 10563 } 10564 _isTriggered[key] = isTrigger; 10565 } 10566 return _isTriggered[key]; 10567 } 10568 function _getQueueByKey(key) { 10569 _queue = _queue || {}; 10570 if (/* @__PURE__ */ isNullOrUndefined(_queue[key])) { 10571 _queue[key] = []; 10572 } 10573 return _queue[key]; 10574 } 10575 } 10576 return ThrottleMgr2; 10577 }() 10578); 10579var _FIELDS_SEPARATOR = ";"; 10580var _FIELD_KEY_VALUE_SEPARATOR = "="; 10581function parseConnectionString(connectionString) { 10582 if (!connectionString) { 10583 return {}; 10584 } 10585 var kvPairs = connectionString[ 10586 _DYN_SPLIT 10587 /* @min:%2esplit */ 10588 ](_FIELDS_SEPARATOR); 10589 var result = arrReduce(kvPairs, function(fields, kv) { 10590 var kvParts = kv[ 10591 _DYN_SPLIT 10592 /* @min:%2esplit */ 10593 ](_FIELD_KEY_VALUE_SEPARATOR); 10594 if (kvParts[ 10595 _DYN_LENGTH$3 10596 /* @min:%2elength */ 10597 ] === 2) { 10598 var key = kvParts[0][ 10599 _DYN_TO_LOWER_CASE$1 10600 /* @min:%2etoLowerCase */ 10601 ](); 10602 var value = kvParts[1]; 10603 fields[key] = value; 10604 } 10605 return fields; 10606 }, {}); 10607 if (objKeys(result)[ 10608 _DYN_LENGTH$3 10609 /* @min:%2elength */ 10610 ] > 0) { 10611 if (result.endpointsuffix) { 10612 var locationPrefix = result.location ? result.location + "." : ""; 10613 result[ 10614 _DYN_INGESTIONENDPOINT 10615 /* @min:%2eingestionendpoint */ 10616 ] = result[ 10617 _DYN_INGESTIONENDPOINT 10618 /* @min:%2eingestionendpoint */ 10619 ] || "https://" + locationPrefix + "dc." + result.endpointsuffix; 10620 } 10621 result[ 10622 _DYN_INGESTIONENDPOINT 10623 /* @min:%2eingestionendpoint */ 10624 ] = result[ 10625 _DYN_INGESTIONENDPOINT 10626 /* @min:%2eingestionendpoint */ 10627 ] || DEFAULT_BREEZE_ENDPOINT; 10628 if (strEndsWith(result[ 10629 _DYN_INGESTIONENDPOINT 10630 /* @min:%2eingestionendpoint */ 10631 ], "/")) { 10632 result[ 10633 _DYN_INGESTIONENDPOINT 10634 /* @min:%2eingestionendpoint */ 10635 ] = result[ 10636 _DYN_INGESTIONENDPOINT 10637 /* @min:%2eingestionendpoint */ 10638 ].slice(0, -1); 10639 } 10640 } 10641 return result; 10642} 10643var Envelope = ( 10644 /** @class */ 10645 /* @__PURE__ */ function() { 10646 function Envelope2(logger, data, name) { 10647 var _this = this; 10648 var _self = this; 10649 _self.ver = 1; 10650 _self.sampleRate = 100; 10651 _self.tags = {}; 10652 _self[ 10653 _DYN_NAME$1 10654 /* @min:%2ename */ 10655 ] = dataSanitizeString(logger, name) || strNotSpecified; 10656 _self.data = data; 10657 _self.time = toISOString(/* @__PURE__ */ new Date()); 10658 _self[ 10659 _DYN_AI_DATA_CONTRACT 10660 /* @min:%2eaiDataContract */ 10661 ] = { 10662 time: 1, 10663 iKey: 1, 10664 name: 1, 10665 sampleRate: function() { 10666 return _this.sampleRate === 100 ? 4 : 1; 10667 }, 10668 tags: 1, 10669 data: 1 10670 /* FieldType.Required */ 10671 }; 10672 } 10673 return Envelope2; 10674 }() 10675); 10676var Event$1 = ( 10677 /** @class */ 10678 function() { 10679 function Event2(logger, name, properties, measurements) { 10680 this.aiDataContract = { 10681 ver: 1, 10682 name: 1, 10683 properties: 0, 10684 measurements: 0 10685 /* FieldType.Default */ 10686 }; 10687 var _self = this; 10688 _self.ver = 2; 10689 _self[ 10690 _DYN_NAME$1 10691 /* @min:%2ename */ 10692 ] = dataSanitizeString(logger, name) || strNotSpecified; 10693 _self[ 10694 _DYN_PROPERTIES$1 10695 /* @min:%2eproperties */ 10696 ] = dataSanitizeProperties(logger, properties); 10697 _self[ 10698 _DYN_MEASUREMENTS$1 10699 /* @min:%2emeasurements */ 10700 ] = dataSanitizeMeasurements(logger, measurements); 10701 } 10702 Event2.envelopeType = "Microsoft.ApplicationInsights.{0}.Event"; 10703 Event2.dataType = "EventData"; 10704 return Event2; 10705 }() 10706); 10707var STACKFRAME_BASE_SIZE = 58; 10708var IS_FRAME = /^\s{0,50}(from\s|at\s|Line\s{1,5}\d{1,10}\s{1,5}of|\w{1,50}@\w{1,80}|[^\(\s\n]+:[0-9\?]+(?::[0-9\?]+)?)/; 10709var FULL_STACK_FRAME_1 = /^(?:\s{0,50}at)?\s{0,50}([^\@\()\s]+)?\s{0,50}(?:\s|\@|\()\s{0,5}([^\(\s\n\]]+):([0-9\?]+):([0-9\?]+)\)?$/; 10710var FULL_STACK_FRAME_2 = /^(?:\s{0,50}at)?\s{0,50}([^\@\()\s]+)?\s{0,50}(?:\s|\@|\()\s{0,5}([^\(\s\n\]]+):([0-9\?]+)\)?$/; 10711var FULL_STACK_FRAME_3 = /^(?:\s{0,50}at)?\s{0,50}([^\@\()\s]+)?\s{0,50}(?:\s|\@|\()\s{0,5}([^\(\s\n\)\]]+)\)?$/; 10712var EXTRACT_FILENAME = /(?:^|\(|\s{0,10}[\w\)]+\@)?([^\(\n\s\]\)]+)(?:\:([0-9]+)(?:\:([0-9]+))?)?\)?(?:,|$)/; 10713var PARSE_FILENAME_LINE_COL = /([^\(\s\n]+):([0-9]+):([0-9]+)$/; 10714var PARSE_FILENAME_LINE_ONLY = /([^\(\s\n]+):([0-9]+)$/; 10715var NoMethod = "<no_method>"; 10716var strError = "error"; 10717var strStack = "stack";
vendor: 10,822 bytes, lines 10718-11105
10718var strStackDetails = "stackDetails"; 10719var strErrorSrc = "errorSrc"; 10720var strMessage = "message"; 10721var strDescription = "description"; 10722var _parseSequence = [ 10723 { re: FULL_STACK_FRAME_1, len: 5, m: 1, fn: 2, ln: 3, col: 4 }, 10724 { chk: _ignoreNative, pre: _scrubAnonymous, re: FULL_STACK_FRAME_2, len: 4, m: 1, fn: 2, ln: 3 }, 10725 { re: FULL_STACK_FRAME_3, len: 3, m: 1, fn: 2, hdl: _handleFilename }, 10726 { re: EXTRACT_FILENAME, len: 2, fn: 1, hdl: _handleFilename } 10727]; 10728function _scrubAnonymous(frame) { 10729 return frame.replace(/(\(anonymous\))/, "<anonymous>"); 10730} 10731function _ignoreNative(frame) { 10732 return strIndexOf(frame, "[native") < 0; 10733} 10734function _stringify(value, convertToString) { 10735 var result = value; 10736 if (result && !isString(result)) { 10737 if (JSON && JSON[ 10738 _DYN_STRINGIFY$1 10739 /* @min:%2estringify */ 10740 ]) { 10741 result = JSON[ 10742 _DYN_STRINGIFY$1 10743 /* @min:%2estringify */ 10744 ](value); 10745 if (convertToString && (!result || result === "{}")) { 10746 if (isFunction(value[ 10747 _DYN_TO_STRING$2 10748 /* @min:%2etoString */ 10749 ])) { 10750 result = value[ 10751 _DYN_TO_STRING$2 10752 /* @min:%2etoString */ 10753 ](); 10754 } else { 10755 result = "" + value; 10756 } 10757 } 10758 } else { 10759 result = "" + value + " - (Missing JSON.stringify)"; 10760 } 10761 } 10762 return result || ""; 10763} 10764function _formatMessage(theEvent, errorType) { 10765 var evtMessage = theEvent; 10766 if (theEvent) { 10767 if (evtMessage && !isString(evtMessage)) { 10768 evtMessage = theEvent[strMessage] || theEvent[strDescription] || evtMessage; 10769 } 10770 if (evtMessage && !isString(evtMessage)) { 10771 evtMessage = _stringify(evtMessage, true); 10772 } 10773 if (theEvent["filename"]) { 10774 evtMessage = evtMessage + " @" + (theEvent["filename"] || "") + ":" + (theEvent["lineno"] || "?") + ":" + (theEvent["colno"] || "?"); 10775 } 10776 } 10777 if (errorType && errorType !== "String" && errorType !== "Object" && errorType !== "Error" && strIndexOf(evtMessage || "", errorType) === -1) { 10778 evtMessage = errorType + ": " + evtMessage; 10779 } 10780 return evtMessage || ""; 10781} 10782function _isExceptionDetailsInternal(value) { 10783 try { 10784 if (/* @__PURE__ */ isObject(value)) { 10785 return "hasFullStack" in value && "typeName" in value; 10786 } 10787 } catch (e) { 10788 } 10789 return false; 10790} 10791function _isExceptionInternal(value) { 10792 try { 10793 if (/* @__PURE__ */ isObject(value)) { 10794 return "ver" in value && "exceptions" in value && "properties" in value; 10795 } 10796 } catch (e) { 10797 } 10798 return false; 10799} 10800function _isStackDetails(details) { 10801 return details && details.src && isString(details.src) && details.obj && isArray(details.obj); 10802} 10803function _convertStackObj(errorStack) { 10804 var src = errorStack || ""; 10805 if (!isString(src)) { 10806 if (isString(src[strStack])) { 10807 src = src[strStack]; 10808 } else { 10809 src = "" + src; 10810 } 10811 } 10812 var items = src[ 10813 _DYN_SPLIT 10814 /* @min:%2esplit */ 10815 ]("\n"); 10816 return { 10817 src, 10818 obj: items 10819 }; 10820} 10821function _getOperaStack(errorMessage) { 10822 var stack2 = []; 10823 var lines = errorMessage[ 10824 _DYN_SPLIT 10825 /* @min:%2esplit */ 10826 ]("\n"); 10827 for (var lp = 0; lp < lines[ 10828 _DYN_LENGTH$3 10829 /* @min:%2elength */ 10830 ]; lp++) { 10831 var entry2 = lines[lp]; 10832 if (lines[lp + 1]) { 10833 entry2 += "@" + lines[lp + 1]; 10834 lp++; 10835 } 10836 stack2.push(entry2); 10837 } 10838 return { 10839 src: errorMessage, 10840 obj: stack2 10841 }; 10842} 10843function _getStackFromErrorObj(errorObj) { 10844 var details = null; 10845 if (errorObj) { 10846 try { 10847 if (errorObj[strStack]) { 10848 details = _convertStackObj(errorObj[strStack]); 10849 } else if (errorObj[strError] && errorObj[strError][strStack]) { 10850 details = _convertStackObj(errorObj[strError][strStack]); 10851 } else if (errorObj["exception"] && errorObj.exception[strStack]) { 10852 details = _convertStackObj(errorObj.exception[strStack]); 10853 } else if (_isStackDetails(errorObj)) { 10854 details = errorObj; 10855 } else if (_isStackDetails(errorObj[strStackDetails])) { 10856 details = errorObj[strStackDetails]; 10857 } else if (getWindow() && getWindow()["opera"] && errorObj[strMessage]) { 10858 details = _getOperaStack(errorObj[ 10859 _DYN_MESSAGE 10860 /* @min:%2emessage */ 10861 ]); 10862 } else if (errorObj["reason"] && errorObj.reason[strStack]) { 10863 details = _convertStackObj(errorObj.reason[strStack]); 10864 } else if (isString(errorObj)) { 10865 details = _convertStackObj(errorObj); 10866 } else { 10867 var evtMessage = errorObj[strMessage] || errorObj[strDescription] || ""; 10868 if (isString(errorObj[strErrorSrc])) { 10869 if (evtMessage) { 10870 evtMessage += "\n"; 10871 } 10872 evtMessage += " from " + errorObj[strErrorSrc]; 10873 } 10874 if (evtMessage) { 10875 details = _convertStackObj(evtMessage); 10876 } 10877 } 10878 } catch (e) { 10879 details = _convertStackObj(e); 10880 } 10881 } 10882 return details || { 10883 src: "", 10884 obj: null 10885 }; 10886} 10887function _formatStackTrace(stackDetails) { 10888 var stack2 = ""; 10889 if (stackDetails) { 10890 if (stackDetails.obj) { 10891 stack2 = stackDetails.obj.join("\n"); 10892 } else { 10893 stack2 = stackDetails.src || ""; 10894 } 10895 } 10896 return stack2; 10897} 10898function _parseStack(stack2) { 10899 var parsedStack; 10900 var frames = stack2.obj; 10901 if (frames && frames[ 10902 _DYN_LENGTH$3 10903 /* @min:%2elength */ 10904 ] > 0) { 10905 parsedStack = []; 10906 var level_1 = 0; 10907 var foundStackStart_1 = false; 10908 var totalSizeInBytes_1 = 0; 10909 arrForEach(frames, function(frame) { 10910 if (foundStackStart_1 || _isStackFrame(frame)) { 10911 var theFrame = asString(frame); 10912 foundStackStart_1 = true; 10913 var parsedFrame = _extractStackFrame(theFrame, level_1); 10914 if (parsedFrame) { 10915 totalSizeInBytes_1 += parsedFrame[ 10916 _DYN_SIZE_IN_BYTES 10917 /* @min:%2esizeInBytes */ 10918 ]; 10919 parsedStack.push(parsedFrame); 10920 level_1++; 10921 } 10922 } 10923 }); 10924 var exceptionParsedStackThreshold = 32 * 1024; 10925 if (totalSizeInBytes_1 > exceptionParsedStackThreshold) { 10926 var left = 0; 10927 var right = parsedStack[ 10928 _DYN_LENGTH$3 10929 /* @min:%2elength */ 10930 ] - 1; 10931 var size = 0; 10932 var acceptedLeft = left; 10933 var acceptedRight = right; 10934 while (left < right) { 10935 var lSize = parsedStack[left][ 10936 _DYN_SIZE_IN_BYTES 10937 /* @min:%2esizeInBytes */ 10938 ]; 10939 var rSize = parsedStack[right][ 10940 _DYN_SIZE_IN_BYTES 10941 /* @min:%2esizeInBytes */ 10942 ]; 10943 size += lSize + rSize; 10944 if (size > exceptionParsedStackThreshold) { 10945 var howMany = acceptedRight - acceptedLeft + 1; 10946 parsedStack.splice(acceptedLeft, howMany); 10947 break; 10948 } 10949 acceptedLeft = left; 10950 acceptedRight = right; 10951 left++; 10952 right--; 10953 } 10954 } 10955 } 10956 return parsedStack; 10957} 10958function _getErrorType(errorType) { 10959 var typeName = ""; 10960 if (errorType) { 10961 typeName = errorType.typeName || errorType[ 10962 _DYN_NAME$1 10963 /* @min:%2ename */ 10964 ] || ""; 10965 if (!typeName) { 10966 try { 10967 var funcNameRegex = /function (.{1,200})\(/; 10968 var results = funcNameRegex.exec(errorType.constructor[ 10969 _DYN_TO_STRING$2 10970 /* @min:%2etoString */ 10971 ]()); 10972 typeName = results && results[ 10973 _DYN_LENGTH$3 10974 /* @min:%2elength */ 10975 ] > 1 ? results[1] : ""; 10976 } catch (e) { 10977 } 10978 } 10979 } 10980 return typeName; 10981} 10982function _formatErrorCode(errorObj) { 10983 if (errorObj) { 10984 try { 10985 if (!isString(errorObj)) { 10986 var errorType = _getErrorType(errorObj); 10987 var result = _stringify(errorObj, false); 10988 if (!result || result === "{}") { 10989 if (errorObj[strError]) { 10990 errorObj = errorObj[strError]; 10991 errorType = _getErrorType(errorObj); 10992 } 10993 result = _stringify(errorObj, true); 10994 } 10995 if (strIndexOf(result, errorType) !== 0 && errorType !== "String") { 10996 return errorType + ":" + result; 10997 } 10998 return result; 10999 } 11000 } catch (e) { 11001 } 11002 } 11003 return "" + (errorObj || ""); 11004} 11005var Exception = ( 11006 /** @class */ 11007 function() { 11008 function Exception2(logger, exception, properties, measurements, severityLevel, id) { 11009 this.aiDataContract = { 11010 ver: 1, 11011 exceptions: 1, 11012 severityLevel: 0, 11013 properties: 0, 11014 measurements: 0 11015 /* FieldType.Default */ 11016 }; 11017 var _self = this; 11018 _self.ver = 2; 11019 if (!_isExceptionInternal(exception)) { 11020 if (!properties) { 11021 properties = {}; 11022 } 11023 if (id) { 11024 properties.id = id; 11025 } 11026 _self[ 11027 _DYN_EXCEPTIONS 11028 /* @min:%2eexceptions */ 11029 ] = [_createExceptionDetails(logger, exception, properties)]; 11030 _self[ 11031 _DYN_PROPERTIES$1 11032 /* @min:%2eproperties */ 11033 ] = dataSanitizeProperties(logger, properties); 11034 _self[ 11035 _DYN_MEASUREMENTS$1 11036 /* @min:%2emeasurements */ 11037 ] = dataSanitizeMeasurements(logger, measurements); 11038 if (severityLevel) { 11039 _self[ 11040 _DYN_SEVERITY_LEVEL 11041 /* @min:%2eseverityLevel */ 11042 ] = severityLevel; 11043 } 11044 if (id) { 11045 _self.id = id; 11046 } 11047 } else { 11048 _self[ 11049 _DYN_EXCEPTIONS 11050 /* @min:%2eexceptions */ 11051 ] = exception[ 11052 _DYN_EXCEPTIONS 11053 /* @min:%2eexceptions */ 11054 ] || []; 11055 _self[ 11056 _DYN_PROPERTIES$1 11057 /* @min:%2eproperties */ 11058 ] = exception[ 11059 _DYN_PROPERTIES$1 11060 /* @min:%2eproperties */ 11061 ]; 11062 _self[ 11063 _DYN_MEASUREMENTS$1 11064 /* @min:%2emeasurements */ 11065 ] = exception[ 11066 _DYN_MEASUREMENTS$1 11067 /* @min:%2emeasurements */ 11068 ]; 11069 if (exception[ 11070 _DYN_SEVERITY_LEVEL 11071 /* @min:%2eseverityLevel */ 11072 ]) { 11073 _self[ 11074 _DYN_SEVERITY_LEVEL 11075 /* @min:%2eseverityLevel */ 11076 ] = exception[ 11077 _DYN_SEVERITY_LEVEL 11078 /* @min:%2eseverityLevel */ 11079 ]; 11080 } 11081 if (exception.id) { 11082 _self.id = exception.id; 11083 exception[ 11084 _DYN_PROPERTIES$1 11085 /* @min:%2eproperties */ 11086 ].id = exception.id; 11087 } 11088 if (exception[ 11089 _DYN_PROBLEM_GROUP 11090 /* @min:%2eproblemGroup */ 11091 ]) { 11092 _self[ 11093 _DYN_PROBLEM_GROUP 11094 /* @min:%2eproblemGroup */ 11095 ] = exception[ 11096 _DYN_PROBLEM_GROUP 11097 /* @min:%2eproblemGroup */ 11098 ]; 11099 } 11100 if (!/* @__PURE__ */ isNullOrUndefined(exception.isManual)) { 11101 _self.isManual = exception.isManual; 11102 } 11103 } 11104 } 11105 Exception2.CreateAutoException = function(message, url, lineNumber,
11105columnNumber, error, evt, stack2, errorSrc) { 11106 var errorType = _getErrorType(error || evt || message); 11107 return { 11108 message: _formatMessage(message, errorType), 11109 url, 11110 lineNumber, 11111 columnNumber, 11112 error: _formatErrorCode(error || evt || message), 11113 evt: _formatErrorCode(evt || message), 11114 typeName: errorType, 11115 stackDetails: _getStackFromErrorObj(stack2 || error || evt), 11116 errorSrc 11117 }; 11118 }; 11119 Exception2.CreateFromInterface = function(logger, exception, properties, measurements) { 11120 var exceptions = exception[ 11121 _DYN_EXCEPTIONS 11122 /* @min:%2eexceptions */ 11123 ] && arrMap(exception[ 11124 _DYN_EXCEPTIONS 11125 /* @min:%2eexceptions */ 11126 ], function(ex) { 11127 return _createExDetailsFromInterface(logger, ex); 11128 }); 11129 var exceptionData = new Exception2(logger, __assignFn(__assignFn({}, exception), { exceptions }), properties, measurements); 11130 return exceptionData; 11131 }; 11132 Exception2.prototype.toInterface = function() { 11133 var _a2 = this, exceptions = _a2.exceptions, properties = _a2.properties, measurements = _a2.measurements, severityLevel = _a2.severityLevel, problemGroup = _a2.problemGroup, id = _a2.id, isManual = _a2.isManual; 11134 var exceptionDetailsInterface = exceptions instanceof Array && arrMap(exceptions, function(exception) { 11135 return exception.toInterface(); 11136 }) || void 0; 11137 return { 11138 ver: "4.0", 11139 exceptions: exceptionDetailsInterface, 11140 severityLevel, 11141 properties, 11142 measurements, 11143 problemGroup, 11144 id, 11145 isManual 11146 }; 11147 }; 11148 Exception2.CreateSimpleException = function(message, typeName, assembly, fileName, details, line) { 11149 var _a2; 11150 return { 11151 exceptions: [ 11152 (_a2 = {}, _a2[ 11153 _DYN_HAS_FULL_STACK 11154 /* @min:hasFullStack */ 11155 ] = true, _a2.message = message, _a2.stack = details, _a2.typeName = typeName, _a2) 11156 ] 11157 }; 11158 }; 11159 Exception2.envelopeType = "Microsoft.ApplicationInsights.{0}.Exception"; 11160 Exception2.dataType = "ExceptionData"; 11161 Exception2.formatError = _formatErrorCode; 11162 return Exception2; 11163 }() 11164);
vendor: 5,315 bytes, lines 11165-11369
11165var exDetailsAiDataContract = objFreeze({ 11166 id: 0, 11167 outerId: 0, 11168 typeName: 1, 11169 message: 1, 11170 hasFullStack: 0, 11171 stack: 0, 11172 parsedStack: 2 11173 /* FieldType.Array */ 11174}); 11175function _toInterface() { 11176 var _self = this; 11177 var parsedStack = isArray(_self[ 11178 _DYN_PARSED_STACK 11179 /* @min:%2eparsedStack */ 11180 ]) && arrMap(_self[ 11181 _DYN_PARSED_STACK 11182 /* @min:%2eparsedStack */ 11183 ], function(frame) { 11184 return _parsedFrameToInterface(frame); 11185 }); 11186 var exceptionDetailsInterface = { 11187 id: _self.id, 11188 outerId: _self.outerId, 11189 typeName: _self[ 11190 _DYN_TYPE_NAME 11191 /* @min:%2etypeName */ 11192 ], 11193 message: _self[ 11194 _DYN_MESSAGE 11195 /* @min:%2emessage */ 11196 ], 11197 hasFullStack: _self[ 11198 _DYN_HAS_FULL_STACK 11199 /* @min:%2ehasFullStack */ 11200 ], 11201 stack: _self[strStack], 11202 parsedStack: parsedStack || void 0 11203 }; 11204 return exceptionDetailsInterface; 11205} 11206function _createExceptionDetails(logger, exception, properties) { 11207 var _a2; 11208 var id; 11209 var outerId; 11210 var typeName; 11211 var message; 11212 var hasFullStack; 11213 var theStack; 11214 var parsedStack; 11215 if (!_isExceptionDetailsInternal(exception)) { 11216 var error = exception; 11217 var evt = error && error.evt; 11218 if (!isError(error)) { 11219 error = error[strError] || evt || error; 11220 } 11221 typeName = dataSanitizeString(logger, _getErrorType(error)) || strNotSpecified; 11222 message = dataSanitizeMessage(logger, _formatMessage(exception || error, typeName)) || strNotSpecified; 11223 var stack2 = exception[strStackDetails] || _getStackFromErrorObj(exception); 11224 parsedStack = _parseStack(stack2); 11225 if (isArray(parsedStack)) { 11226 arrMap(parsedStack, function(frame) { 11227 frame[ 11228 _DYN_ASSEMBLY 11229 /* @min:%2eassembly */ 11230 ] = dataSanitizeString(logger, frame[ 11231 _DYN_ASSEMBLY 11232 /* @min:%2eassembly */ 11233 ]); 11234 frame[ 11235 _DYN_FILE_NAME 11236 /* @min:%2efileName */ 11237 ] = dataSanitizeString(logger, frame[ 11238 _DYN_FILE_NAME 11239 /* @min:%2efileName */ 11240 ]); 11241 }); 11242 } 11243 theStack = dataSanitizeException(logger, _formatStackTrace(stack2)); 11244 hasFullStack = isArray(parsedStack) && parsedStack[ 11245 _DYN_LENGTH$3 11246 /* @min:%2elength */ 11247 ] > 0; 11248 if (properties) { 11249 properties[ 11250 _DYN_TYPE_NAME 11251 /* @min:%2etypeName */ 11252 ] = properties[ 11253 _DYN_TYPE_NAME 11254 /* @min:%2etypeName */ 11255 ] || typeName; 11256 } 11257 } else { 11258 typeName = exception[ 11259 _DYN_TYPE_NAME 11260 /* @min:%2etypeName */ 11261 ]; 11262 message = exception[ 11263 _DYN_MESSAGE 11264 /* @min:%2emessage */ 11265 ]; 11266 theStack = exception[strStack]; 11267 parsedStack = exception[ 11268 _DYN_PARSED_STACK 11269 /* @min:%2eparsedStack */ 11270 ] || []; 11271 hasFullStack = exception[ 11272 _DYN_HAS_FULL_STACK 11273 /* @min:%2ehasFullStack */ 11274 ]; 11275 } 11276 return _a2 = {}, _a2[ 11277 _DYN_AI_DATA_CONTRACT 11278 /* @min:aiDataContract */ 11279 ] = exDetailsAiDataContract, _a2.id = id, _a2.outerId = outerId, _a2.typeName = typeName, _a2.message = message, _a2[ 11280 _DYN_HAS_FULL_STACK 11281 /* @min:hasFullStack */ 11282 ] = hasFullStack, _a2.stack = theStack, _a2.parsedStack = parsedStack, _a2.toInterface = _toInterface, _a2; 11283} 11284function _createExDetailsFromInterface(logger, exception) { 11285 var parsedStack = isArray(exception[ 11286 _DYN_PARSED_STACK 11287 /* @min:%2eparsedStack */ 11288 ]) && arrMap(exception[ 11289 _DYN_PARSED_STACK 11290 /* @min:%2eparsedStack */ 11291 ], function(frame) { 11292 return _stackFrameFromInterface(frame); 11293 }) || exception[ 11294 _DYN_PARSED_STACK 11295 /* @min:%2eparsedStack */ 11296 ]; 11297 var exceptionDetails = _createExceptionDetails(logger, __assignFn(__assignFn({}, exception), { parsedStack })); 11298 return exceptionDetails; 11299} 11300function _parseFilename(theFrame, fileName) { 11301 var lineCol = fileName[ 11302 _DYN_MATCH 11303 /* @min:%2ematch */ 11304 ](PARSE_FILENAME_LINE_COL); 11305 if (lineCol && lineCol[ 11306 _DYN_LENGTH$3 11307 /* @min:%2elength */ 11308 ] >= 4) { 11309 theFrame[ 11310 _DYN_FILE_NAME 11311 /* @min:%2efileName */ 11312 ] = lineCol[1]; 11313 theFrame[ 11314 _DYN_LINE 11315 /* @min:%2eline */ 11316 ] = parseInt(lineCol[2]); 11317 } else { 11318 var lineNo = fileName[ 11319 _DYN_MATCH 11320 /* @min:%2ematch */ 11321 ](PARSE_FILENAME_LINE_ONLY); 11322 if (lineNo && lineNo[ 11323 _DYN_LENGTH$3 11324 /* @min:%2elength */ 11325 ] >= 3) { 11326 theFrame[ 11327 _DYN_FILE_NAME 11328 /* @min:%2efileName */ 11329 ] = lineNo[1]; 11330 theFrame[ 11331 _DYN_LINE 11332 /* @min:%2eline */ 11333 ] = parseInt(lineNo[2]); 11334 } else { 11335 theFrame[ 11336 _DYN_FILE_NAME 11337 /* @min:%2efileName */ 11338 ] = fileName; 11339 } 11340 } 11341} 11342function _handleFilename(theFrame, sequence, matches) { 11343 var filename = theFrame[ 11344 _DYN_FILE_NAME 11345 /* @min:%2efileName */ 11346 ]; 11347 if (sequence.fn && matches && matches[ 11348 _DYN_LENGTH$3 11349 /* @min:%2elength */ 11350 ] > sequence.fn) { 11351 if (sequence.ln && matches[ 11352 _DYN_LENGTH$3 11353 /* @min:%2elength */ 11354 ] > sequence.ln) { 11355 filename = strTrim(matches[sequence.fn] || ""); 11356 theFrame[ 11357 _DYN_LINE 11358 /* @min:%2eline */ 11359 ] = parseInt(strTrim(matches[sequence.ln] || "")) || 0; 11360 } else { 11361 filename = strTrim(matches[sequence.fn] || ""); 11362 } 11363 } 11364 if (filename) { 11365 _parseFilename(theFrame, filename); 11366 } 11367} 11368function _isStackFrame(frame) { 11369 var result = false;
11370 if (frame && isString(frame)) { 11371 var trimmedFrame = strTrim(frame); 11372 if (trimmedFrame) { 11373 result = IS_FRAME.test(trimmedFrame); 11374 } 11375 } 11376 return result; 11377} 11378var stackFrameAiDataContract = objFreeze({ 11379 level: 1, 11380 method: 1, 11381 assembly: 0, 11382 fileName: 0, 11383 line: 0 11384 /* FieldType.Default */ 11385}); 11386function _extractStackFrame(frame, level) { 11387 var _a2; 11388 var theFrame; 11389 if (frame && isString(frame) && strTrim(frame)) { 11390 theFrame = (_a2 = {}, _a2[ 11391 _DYN_AI_DATA_CONTRACT 11392 /* @min:aiDataContract */ 11393 ] = stackFrameAiDataContract, _a2.level = level, _a2.assembly = strTrim(frame), _a2.method = NoMethod, _a2.fileName = "", _a2.line = 0, _a2.sizeInBytes = 0, _a2); 11394 var idx = 0; 11395 while (idx < _parseSequence[ 11396 _DYN_LENGTH$3 11397 /* @min:%2elength */ 11398 ]) { 11399 var sequence = _parseSequence[idx]; 11400 if (sequence.chk && !sequence.chk(frame)) { 11401 break; 11402 } 11403 if (sequence.pre) { 11404 frame = sequence.pre(frame); 11405 } 11406 var matches = frame[ 11407 _DYN_MATCH 11408 /* @min:%2ematch */ 11409 ](sequence.re); 11410 if (matches && matches[ 11411 _DYN_LENGTH$3 11412 /* @min:%2elength */ 11413 ] >= sequence.len) { 11414 if (sequence.m) { 11415 theFrame.method = strTrim(matches[sequence.m] || NoMethod); 11416 } 11417 if (sequence.hdl) { 11418 sequence.hdl(theFrame, sequence, matches); 11419 } else if (sequence.fn) { 11420 if (sequence.ln) { 11421 theFrame[ 11422 _DYN_FILE_NAME 11423 /* @min:%2efileName */ 11424 ] = strTrim(matches[sequence.fn] || ""); 11425 theFrame[ 11426 _DYN_LINE 11427 /* @min:%2eline */ 11428 ] = parseInt(strTrim(matches[sequence.ln] || "")) || 0; 11429 } else { 11430 _parseFilename(theFrame, matches[sequence.fn] || ""); 11431 } 11432 } 11433 break; 11434 } 11435 idx++; 11436 } 11437 } 11438 return _populateFrameSizeInBytes(theFrame); 11439} 11440function _stackFrameFromInterface(frame) { 11441 var _a2; 11442 var parsedFrame = (_a2 = {}, _a2[ 11443 _DYN_AI_DATA_CONTRACT 11444 /* @min:aiDataContract */ 11445 ] = stackFrameAiDataContract, _a2.level = frame.level, _a2.method = frame.method, _a2.assembly = frame[ 11446 _DYN_ASSEMBLY 11447 /* @min:%2eassembly */ 11448 ], _a2.fileName = frame[ 11449 _DYN_FILE_NAME 11450 /* @min:%2efileName */ 11451 ], _a2.line = frame[ 11452 _DYN_LINE 11453 /* @min:%2eline */ 11454 ], _a2.sizeInBytes = 0, _a2); 11455 return _populateFrameSizeInBytes(parsedFrame); 11456} 11457function _populateFrameSizeInBytes(frame) { 11458 var sizeInBytes = STACKFRAME_BASE_SIZE; 11459 if (frame) { 11460 sizeInBytes += frame.method[ 11461 _DYN_LENGTH$3 11462 /* @min:%2elength */ 11463 ]; 11464 sizeInBytes += frame.assembly[ 11465 _DYN_LENGTH$3 11466 /* @min:%2elength */ 11467 ]; 11468 sizeInBytes += frame.fileName[ 11469 _DYN_LENGTH$3 11470 /* @min:%2elength */ 11471 ]; 11472 sizeInBytes += frame.level.toString()[ 11473 _DYN_LENGTH$3 11474 /* @min:%2elength */ 11475 ]; 11476 sizeInBytes += frame.line.toString()[ 11477 _DYN_LENGTH$3 11478 /* @min:%2elength */ 11479 ]; 11480 frame[ 11481 _DYN_SIZE_IN_BYTES 11482 /* @min:%2esizeInBytes */ 11483 ] = sizeInBytes; 11484 } 11485 return frame; 11486} 11487function _parsedFrameToInterface(frame) { 11488 return { 11489 level: frame.level, 11490 method: frame.method, 11491 assembly: frame[ 11492 _DYN_ASSEMBLY 11493 /* @min:%2eassembly */ 11494 ], 11495 fileName: frame[ 11496 _DYN_FILE_NAME 11497 /* @min:%2efileName */ 11498 ], 11499 line: frame[ 11500 _DYN_LINE 11501 /* @min:%2eline */ 11502 ] 11503 }; 11504} 11505var DataPoint = ( 11506 /** @class */ 11507 /* @__PURE__ */ function() { 11508 function DataPoint2() { 11509 this.aiDataContract = { 11510 name: 1, 11511 kind: 0, 11512 value: 1, 11513 count: 0, 11514 min: 0, 11515 max: 0, 11516 stdDev: 0 11517 /* FieldType.Default */ 11518 }; 11519 this.kind = 0; 11520 } 11521 return DataPoint2; 11522 }() 11523); 11524var Metric = ( 11525 /** @class */ 11526 function() { 11527 function Metric2(logger, name, value, count, min, max, stdDev, properties, measurements) { 11528 this.aiDataContract = { 11529 ver: 1, 11530 metrics: 1, 11531 properties: 0 11532 /* FieldType.Default */ 11533 }; 11534 var _self = this; 11535 _self.ver = 2; 11536 var dataPoint = new DataPoint(); 11537 dataPoint[ 11538 _DYN_COUNT$1 11539 /* @min:%2ecount */ 11540 ] = count > 0 ? count : void 0; 11541 dataPoint.max = isNaN(max) || max === null ? void 0 : max; 11542 dataPoint.min = isNaN(min) || min === null ? void 0 : min; 11543 dataPoint[ 11544 _DYN_NAME$1 11545 /* @min:%2ename */ 11546 ] = dataSanitizeString(logger, name) || strNotSpecified; 11547 dataPoint.value = value; 11548 dataPoint.stdDev = isNaN(stdDev) || stdDev === null ? void 0 : stdDev; 11549 _self.metrics = [dataPoint]; 11550 _self[ 11551 _DYN_PROPERTIES$1 11552 /* @min:%2eproperties */ 11553 ] = dataSanitizeProperties(logger, properties); 11554 _self[ 11555 _DYN_MEASUREMENTS$1 11556 /* @min:%2emeasurements */ 11557 ] = dataSanitizeMeasurements(logger, measurements); 11558 } 11559 Metric2.envelopeType = "Microsoft.ApplicationInsights.{0}.Metric"; 11560 Metric2.dataType = "MetricData"; 11561 return Metric2; 11562 }() 11563); 11564var strEmpty = ""; 11565function msToTimeSpan(totalms) { 11566 if (isNaN(totalms) || totalms < 0) { 11567 totalms = 0; 11568 } 11569 totalms = mathRound(totalms); 11570 var ms = strEmpty + totalms % 1e3; 11571 var sec = strEmpty + mathFloor(totalms / 1e3) % 60; 11572 var min = strEmpty + mathFloor(totalms / (1e3 * 60)) % 60; 11573 var hour = strEmpty + mathFloor(totalms / (1e3 * 60 * 60)) % 24; 11574 var days = mathFloor(totalms / (1e3 * 60 * 60 * 24)); 11575 ms = ms[ 11576 _DYN_LENGTH$3 11577 /* @min:%2elength */ 11578 ] === 1 ? "00" + ms : ms[ 11579 _DYN_LENGTH$3 11580 /* @min:%2elength */ 11581 ] === 2 ? "0" + ms : ms; 11582 sec = sec[ 11583 _DYN_LENGTH$3 11584 /* @min:%2elength */ 11585 ] < 2 ? "0" + sec : sec; 11586 min = min[ 11587 _DYN_LENGTH$3 11588 /* @min:%2elength */ 11589 ] < 2 ? "0" + min : min; 11590 hour = hour[ 11591 _DYN_LENGTH$3 11592 /* @min:%2elength */ 11593 ] < 2 ? "0" + hour : hour; 11594 return (days > 0 ? days + "." : strEmpty) + hour + ":" + min + ":" + sec + "." + ms; 11595}
11596function isCrossOriginError(message, url, lineNumber, columnNumber, error) { 11597 return !error && isString(message) && (message === "Script error." || message === "Script error"); 11598} 11599var PageView = ( 11600 /** @class */ 11601 function() { 11602 function PageView2(logger, name, url, durationMs, properties, measurements, id) { 11603 this.aiDataContract = { 11604 ver: 1, 11605 name: 0, 11606 url: 0, 11607 duration: 0, 11608 properties: 0, 11609 measurements: 0, 11610 id: 0 11611 /* FieldType.Default */ 11612 }; 11613 var _self = this; 11614 _self.ver = 2; 11615 _self.id = dataSanitizeId(logger, id); 11616 _self.url = dataSanitizeUrl(logger, url); 11617 _self[ 11618 _DYN_NAME$1 11619 /* @min:%2ename */ 11620 ] = dataSanitizeString(logger, name) || strNotSpecified; 11621 if (!isNaN(durationMs)) { 11622 _self[ 11623 _DYN_DURATION$1 11624 /* @min:%2eduration */ 11625 ] = msToTimeSpan(durationMs); 11626 } 11627 _self[ 11628 _DYN_PROPERTIES$1 11629 /* @min:%2eproperties */ 11630 ] = dataSanitizeProperties(logger, properties); 11631 _self[ 11632 _DYN_MEASUREMENTS$1 11633 /* @min:%2emeasurements */ 11634 ] = dataSanitizeMeasurements(logger, measurements); 11635 } 11636 PageView2.envelopeType = "Microsoft.ApplicationInsights.{0}.Pageview"; 11637 PageView2.dataType = "PageviewData"; 11638 return PageView2; 11639 }() 11640); 11641var RemoteDependencyData = ( 11642 /** @class */ 11643 function() { 11644 function RemoteDependencyData2(logger, id, absoluteUrl, commandName, value, success, resultCode, method, requestAPI, correlationContext, properties, measurements) { 11645 if (requestAPI === void 0) { 11646 requestAPI = "Ajax"; 11647 } 11648 this.aiDataContract = { 11649 id: 1, 11650 ver: 1, 11651 name: 0, 11652 resultCode: 0, 11653 duration: 0, 11654 success: 0, 11655 data: 0, 11656 target: 0, 11657 type: 0, 11658 properties: 0, 11659 measurements: 0, 11660 kind: 0, 11661 value: 0, 11662 count: 0, 11663 min: 0, 11664 max: 0, 11665 stdDev: 0, 11666 dependencyKind: 0, 11667 dependencySource: 0, 11668 commandName: 0, 11669 dependencyTypeName: 0 11670 /* FieldType.Default */ 11671 }; 11672 var _self = this; 11673 _self.ver = 2; 11674 _self.id = id; 11675 _self[ 11676 _DYN_DURATION$1 11677 /* @min:%2eduration */ 11678 ] = msToTimeSpan(value); 11679 _self.success = success; 11680 _self.resultCode = resultCode + ""; 11681 _self.type = dataSanitizeString(logger, requestAPI); 11682 var dependencyFields = AjaxHelperParseDependencyPath(logger, absoluteUrl, method, commandName); 11683 _self.data = dataSanitizeUrl(logger, commandName) || dependencyFields.data; 11684 _self.target = dataSanitizeString(logger, dependencyFields.target); 11685 if (correlationContext) { 11686 _self.target = "".concat(_self.target, " | ").concat(correlationContext); 11687 } 11688 _self[ 11689 _DYN_NAME$1 11690 /* @min:%2ename */ 11691 ] = dataSanitizeString(logger, dependencyFields[ 11692 _DYN_NAME$1 11693 /* @min:%2ename */ 11694 ]); 11695 _self[ 11696 _DYN_PROPERTIES$1 11697 /* @min:%2eproperties */ 11698 ] = dataSanitizeProperties(logger, properties); 11699 _self[ 11700 _DYN_MEASUREMENTS$1 11701 /* @min:%2emeasurements */ 11702 ] = dataSanitizeMeasurements(logger, measurements); 11703 } 11704 RemoteDependencyData2.envelopeType = "Microsoft.ApplicationInsights.{0}.RemoteDependency"; 11705 RemoteDependencyData2.dataType = "RemoteDependencyData"; 11706 return RemoteDependencyData2; 11707 }() 11708); 11709var Trace = ( 11710 /** @class */ 11711 function() { 11712 function Trace2(logger, message, severityLevel, properties, measurements) { 11713 this.aiDataContract = { 11714 ver: 1, 11715 message: 1, 11716 severityLevel: 0, 11717 properties: 0 11718 /* FieldType.Default */ 11719 }; 11720 var _self = this; 11721 _self.ver = 2; 11722 message = message || strNotSpecified; 11723 _self[ 11724 _DYN_MESSAGE 11725 /* @min:%2emessage */ 11726 ] = dataSanitizeMessage(logger, message); 11727 _self[ 11728 _DYN_PROPERTIES$1 11729 /* @min:%2eproperties */ 11730 ] = dataSanitizeProperties(logger, properties); 11731 _self[ 11732 _DYN_MEASUREMENTS$1 11733 /* @min:%2emeasurements */ 11734 ] = dataSanitizeMeasurements(logger, measurements); 11735 if (severityLevel) { 11736 _self[ 11737 _DYN_SEVERITY_LEVEL 11738 /* @min:%2eseverityLevel */ 11739 ] = severityLevel; 11740 } 11741 } 11742 Trace2.envelopeType = "Microsoft.ApplicationInsights.{0}.Message"; 11743 Trace2.dataType = "MessageData"; 11744 return Trace2; 11745 }() 11746); 11747var PageViewPerformance = ( 11748 /** @class */ 11749 function() { 11750 function PageViewPerformance2(logger, name, url, unused, properties, measurements, cs4BaseData) { 11751 this.aiDataContract = { 11752 ver: 1, 11753 name: 0, 11754 url: 0, 11755 duration: 0, 11756 perfTotal: 0, 11757 networkConnect: 0, 11758 sentRequest: 0, 11759 receivedResponse: 0, 11760 domProcessing: 0, 11761 properties: 0, 11762 measurements: 0 11763 /* FieldType.Default */ 11764 }; 11765 var _self = this; 11766 _self.ver = 2; 11767 _self.url = dataSanitizeUrl(logger, url); 11768 _self[ 11769 _DYN_NAME$1 11770 /* @min:%2ename */ 11771 ] = dataSanitizeString(logger, name) || strNotSpecified; 11772 _self[ 11773 _DYN_PROPERTIES$1 11774 /* @min:%2eproperties */ 11775 ] = dataSanitizeProperties(logger, properties); 11776 _self[ 11777 _DYN_MEASUREMENTS$1 11778 /* @min:%2emeasurements */ 11779 ] = dataSanitizeMeasurements(logger, measurements); 11780 if (cs4BaseData) { 11781 _self.domProcessing = cs4BaseData.domProcessing; 11782 _self[ 11783 _DYN_DURATION$1 11784 /* @min:%2eduration */ 11785 ] = cs4BaseData[ 11786 _DYN_DURATION$1 11787 /* @min:%2eduration */ 11788 ]; 11789 _self.networkConnect = cs4BaseData.networkConnect; 11790 _self.perfTotal = cs4BaseData.perfTotal; 11791 _self.receivedResponse = cs4BaseData.receivedResponse; 11792 _self.sentRequest = cs4BaseData.sentRequest; 11793 } 11794 } 11795 PageViewPerformance2.envelopeType = "Microsoft.ApplicationInsights.{0}.PageviewPerformance"; 11796 PageViewPerformance2.dataType = "PageviewPerformanceData"; 11797 return PageViewPerformance2; 11798 }() 11799); 11800var Data = ( 11801 /** @class */
11802 /* @__PURE__ */ function() { 11803 function Data2(baseType, data) { 11804 this.aiDataContract = { 11805 baseType: 1, 11806 baseData: 1 11807 /* FieldType.Required */ 11808 }; 11809 this.baseType = baseType; 11810 this.baseData = data; 11811 } 11812 return Data2; 11813 }() 11814); 11815function _aiNameFunc(baseName) { 11816 var aiName = "ai." + baseName + "."; 11817 return function(name) { 11818 return aiName + name; 11819 }; 11820} 11821var _aiApplication = _aiNameFunc("application"); 11822var _aiDevice = _aiNameFunc("device"); 11823var _aiLocation = _aiNameFunc("location"); 11824var _aiOperation = _aiNameFunc("operation"); 11825var _aiSession = _aiNameFunc("session"); 11826var _aiUser = _aiNameFunc("user"); 11827var _aiCloud = _aiNameFunc("cloud"); 11828var _aiInternal = _aiNameFunc("internal"); 11829var ContextTagKeys = ( 11830 /** @class */ 11831 function(_super) { 11832 __extendsFn(ContextTagKeys2, _super); 11833 function ContextTagKeys2() { 11834 return _super.call(this) || this; 11835 } 11836 return ContextTagKeys2; 11837 }(createClassFromInterface({ 11838 applicationVersion: _aiApplication("ver"), 11839 applicationBuild: _aiApplication("build"), 11840 applicationTypeId: _aiApplication("typeId"), 11841 applicationId: _aiApplication("applicationId"), 11842 applicationLayer: _aiApplication("layer"), 11843 deviceId: _aiDevice("id"), 11844 deviceIp: _aiDevice("ip"), 11845 deviceLanguage: _aiDevice("language"), 11846 deviceLocale: _aiDevice("locale"), 11847 deviceModel: _aiDevice("model"), 11848 deviceFriendlyName: _aiDevice("friendlyName"), 11849 deviceNetwork: _aiDevice("network"), 11850 deviceNetworkName: _aiDevice("networkName"), 11851 deviceOEMName: _aiDevice("oemName"), 11852 deviceOS: _aiDevice("os"), 11853 deviceOSVersion: _aiDevice("osVersion"), 11854 deviceRoleInstance: _aiDevice("roleInstance"), 11855 deviceRoleName: _aiDevice("roleName"), 11856 deviceScreenResolution: _aiDevice("screenResolution"), 11857 deviceType: _aiDevice("type"), 11858 deviceMachineName: _aiDevice("machineName"), 11859 deviceVMName: _aiDevice("vmName"), 11860 deviceBrowser: _aiDevice("browser"), 11861 deviceBrowserVersion: _aiDevice("browserVersion"), 11862 locationIp: _aiLocation("ip"), 11863 locationCountry: _aiLocation("country"), 11864 locationProvince: _aiLocation("province"), 11865 locationCity: _aiLocation("city"), 11866 operationId: _aiOperation("id"), 11867 operationName: _aiOperation("name"), 11868 operationParentId: _aiOperation("parentId"), 11869 operationRootId: _aiOperation("rootId"), 11870 operationSyntheticSource: _aiOperation("syntheticSource"), 11871 operationCorrelationVector: _aiOperation("correlationVector"), 11872 sessionId: _aiSession("id"), 11873 sessionIsFirst: _aiSession("isFirst"), 11874 sessionIsNew: _aiSession("isNew"), 11875 userAccountAcquisitionDate: _aiUser("accountAcquisitionDate"), 11876 userAccountId: _aiUser("accountId"), 11877 userAgent: _aiUser("userAgent"), 11878 userId: _aiUser("id"), 11879 userStoreRegion: _aiUser("storeRegion"), 11880 userAuthUserId: _aiUser("authUserId"), 11881 userAnonymousUserAcquisitionDate: _aiUser("anonUserAcquisitionDate"), 11882 userAuthenticatedUserAcquisitionDate: _aiUser("authUserAcquisitionDate"), 11883 cloudName: _aiCloud("name"), 11884 cloudRole: _aiCloud("role"), 11885 cloudRoleVer: _aiCloud("roleVer"), 11886 cloudRoleInstance: _aiCloud("roleInstance"), 11887 cloudEnvironment: _aiCloud("environment"), 11888 cloudLocation: _aiCloud("location"), 11889 cloudDeploymentUnit: _aiCloud("deploymentUnit"), 11890 internalNodeName: _aiInternal("nodeName"), 11891 internalSdkVersion: _aiInternal("sdkVersion"), 11892 internalAgentVersion: _aiInternal("agentVersion"), 11893 internalSnippet: _aiInternal("snippet"), 11894 internalSdkSrc: _aiInternal("sdkSrc") 11895 })) 11896); 11897function createTelemetryItem(item, baseType, envelopeName, logger, customProperties, systemProperties) { 11898 envelopeName = dataSanitizeString(logger, envelopeName) || strNotSpecified;
11899 if (/* @__PURE__ */ isNullOrUndefined(item) || /* @__PURE__ */ isNullOrUndefined(baseType) || /* @__PURE__ */ isNullOrUndefined(envelopeName)) { 11900 throwError("Input doesn't contain all required fields"); 11901 } 11902 var iKey = ""; 11903 if (item[strIkey]) { 11904 iKey = item[strIkey]; 11905 delete item[strIkey]; 11906 } 11907 var telemetryItem = { 11908 name: envelopeName, 11909 time: toISOString(/* @__PURE__ */ new Date()), 11910 iKey, 11911 ext: systemProperties ? systemProperties : {}, 11912 tags: [], 11913 data: {}, 11914 baseType, 11915 baseData: item 11916 // Part B 11917 }; 11918 if (!/* @__PURE__ */ isNullOrUndefined(customProperties)) { 11919 objForEachKey(customProperties, function(prop, value) { 11920 telemetryItem.data[prop] = value; 11921 }); 11922 } 11923 return telemetryItem; 11924} 11925var Extensions = { 11926 UserExt: "user", 11927 DeviceExt: "device", 11928 TraceExt: "trace", 11929 WebExt: "web", 11930 AppExt: "app", 11931 OSExt: "os" 11932}; 11933var CtxTagKeys = new ContextTagKeys(); 11934function createDomEvent(eventName) { 11935 var event = null; 11936 if (isFunction(Event)) { 11937 event = new Event(eventName); 11938 } else { 11939 var doc = getDocument(); 11940 if (doc && doc.createEvent) { 11941 event = doc.createEvent("Event"); 11942 event.initEvent(eventName, true, true); 11943 } 11944 } 11945 return event; 11946} 11947function _disableEvents(target, evtNamespace) { 11948 eventOff(target, null, null, evtNamespace); 11949} 11950function createOfflineListener(parentEvtNamespace) { 11951 var _document2 = getDocument(); 11952 var _navigator = getNavigator(); 11953 var _isListening = false; 11954 var listenerList = []; 11955 var rState = 1; 11956 if (_navigator && !/* @__PURE__ */ isNullOrUndefined(_navigator.onLine) && !_navigator.onLine) { 11957 rState = 2; 11958 } 11959 var uState = 0; 11960 var _currentState = calCurrentState(); 11961 var _evtNamespace = mergeEvtNamespace(createUniqueNamespace("OfflineListener"), parentEvtNamespace); 11962 try { 11963 if (_enableEvents(getWindow())) { 11964 _isListening = true; 11965 } 11966 if (_document2) { 11967 var target = _document2.body || _document2; 11968 if (target.ononline) { 11969 if (_enableEvents(target)) { 11970 _isListening = true; 11971 } 11972 } 11973 } 11974 } catch (e) { 11975 _isListening = false; 11976 } 11977 function _enableEvents(target2) { 11978 var enabled = false; 11979 if (target2) { 11980 enabled = eventOn(target2, "online", _setOnline, _evtNamespace); 11981 if (enabled) { 11982 eventOn(target2, "offline", _setOffline, _evtNamespace); 11983 } 11984 } 11985 return enabled; 11986 } 11987 function _isOnline() { 11988 return _currentState; 11989 } 11990 function calCurrentState() { 11991 if (uState === 2 || rState === 2) { 11992 return false; 11993 } 11994 return true; 11995 } 11996 function listnerNoticeCheck() { 11997 var newState = calCurrentState(); 11998 if (_currentState !== newState) { 11999 _currentState = newState; 12000 arrForEach(listenerList, function(callback) { 12001 var offlineState = { 12002 isOnline: _currentState, 12003 rState, 12004 uState 12005 }; 12006 try { 12007 callback(offlineState); 12008 } catch (e) { 12009 } 12010 }); 12011 } 12012 } 12013 function setOnlineState(newState) { 12014 uState = newState; 12015 listnerNoticeCheck(); 12016 } 12017 function _setOnline() { 12018 rState = 1; 12019 listnerNoticeCheck(); 12020 } 12021 function _setOffline() { 12022 rState = 2; 12023 listnerNoticeCheck(); 12024 } 12025 function _unload() { 12026 var win = getWindow(); 12027 if (win && _isListening) { 12028 _disableEvents(win, _evtNamespace); 12029 if (_document2) { 12030 var target2 = _document2.body || _document2; 12031 if (!/* @__PURE__ */ isUndefined(target2.ononline)) { 12032 _disableEvents(target2, _evtNamespace); 12033 } 12034 } 12035 _isListening = false; 12036 } 12037 } 12038 function addListener(callback) { 12039 listenerList.push(callback); 12040 return { 12041 rm: function() { 12042 var index = listenerList.indexOf(callback); 12043 if (index > -1) { 12044 return listenerList.splice(index, 1); 12045 } else { 12046 return; 12047 } 12048 } 12049 }; 12050 } 12051 return { 12052 isOnline: _isOnline, 12053 isListening: function() { 12054 return _isListening; 12055 }, 12056 unload: _unload, 12057 addListener, 12058 setOnlineState 12059 }; 12060} 12061var PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin"; 12062var BreezeChannelIdentifier = "AppInsightsChannelPlugin"; 12063var AnalyticsPluginIdentifier = "ApplicationInsightsAnalytics"; 12064var _DYN_TO_STRING$1 = "toString"; 12065var _DYN_IS_STORAGE_USE_DISAB0 = "isStorageUseDisabled"; 12066var _DYN__ADD_HOOK$1 = "_addHook"; 12067var _DYN_CORE$1 = "core"; 12068var _DYN_DATA_TYPE$1 = "dataType"; 12069var _DYN_ENVELOPE_TYPE$1 = "envelopeType"; 12070var _DYN_DIAG_LOG$1 = "diagLog"; 12071var _DYN_TRACK = "track"; 12072var _DYN_TRACK_PAGE_VIEW = "trackPageView"; 12073var _DYN_TRACK_PREVIOUS_PAGE_1 = "trackPreviousPageVisit"; 12074var _DYN_SEND_PAGE_VIEW_INTER2 = "sendPageViewInternal"; 12075var _DYN_START_TIME$1 = "startTime"; 12076var _DYN_PROPERTIES = "properties"; 12077var _DYN_DURATION = "duration"; 12078var _DYN_SEND_PAGE_VIEW_PERFO3 = "sendPageViewPerformanceInternal"; 12079var _DYN_POPULATE_PAGE_VIEW_P4 = "populatePageViewPerformanceEvent"; 12080var _DYN_HREF = "href"; 12081var _DYN_SEND_EXCEPTION_INTER5 = "sendExceptionInternal"; 12082var _DYN_ERROR = "error"; 12083var _DYN_LINE_NUMBER = "lineNumber"; 12084var _DYN_COLUMN_NUMBER = "columnNumber"; 12085var _DYN__CREATE_AUTO_EXCEPTI6 = "CreateAutoException"; 12086var _DYN_ADD_TELEMETRY_INITIA7 = "addTelemetryInitializer"; 12087var _DYN_OVERRIDE_PAGE_VIEW_D8 = "overridePageViewDuration"; 12088var _DYN_AUTO_EXCEPTION_INSTR9 = "autoExceptionInstrumented"; 12089var _DYN_AUTO_TRACK_PAGE_VISI10 = "autoTrackPageVisitTime"; 12090var _DYN_IS_BROWSER_LINK_TRAC11 = "isBrowserLinkTrackingEnabled"; 12091var _DYN_LENGTH$2 = "length"; 12092var _DYN_ENABLE_AUTO_ROUTE_TR12 = "enableAutoRouteTracking"; 12093var _DYN_ENABLE_UNHANDLED_PRO13 = "enableUnhandledPromiseRejectionTracking"; 12094var _DYN_AUTO_UNHANDLED_PROMI14 = "autoUnhandledPromiseInstrumented"; 12095var _DYN_GET_ENTRIES_BY_TYPE = "getEntriesByType"; 12096var _DYN_IS_PERFORMANCE_TIMIN15 = "isPerformanceTimingSupported"; 12097var _DYN_GET_PERFORMANCE_TIMI16 = "getPerformanceTiming"; 12098var _DYN_NAVIGATION_START = "navigationStart"; 12099var _DYN_SHOULD_COLLECT_DURAT17 = "shouldCollectDuration"; 12100var _DYN_IS_PERFORMANCE_TIMIN18 = "isPerformanceTimingDataReady"; 12101var _DYN_RESPONSE_START = "responseStart"; 12102var _DYN_REQUEST_START = "requestStart"; 12103var _DYN_LOAD_EVENT_END = "loadEventEnd"; 12104var _DYN_RESPONSE_END = "responseEnd"; 12105var _DYN_CONNECT_END = "connectEnd"; 12106var PageViewManager = ( 12107 /** @class */ 12108 function() { 12109 function PageViewManager2(appInsights, overridePageViewDuration, core, pageViewPerformanceManager) { 12110 dynamicProto(PageViewManager2, this, function(_self) { 12111 var queueTimer = null; 12112 var itemQueue = []; 12113 var pageViewPerformanceSent = false;
12114 var firstPageViewSent = false; 12115 var _logger; 12116 if (core) { 12117 _logger = core.logger; 12118 } 12119 function _flushChannels(isAsync) { 12120 if (core) { 12121 core.flush(isAsync, function() { 12122 }); 12123 } 12124 } 12125 function _startTimer() { 12126 if (!queueTimer) { 12127 queueTimer = scheduleTimeout(function() { 12128 queueTimer = null; 12129 var allItems = itemQueue.slice(0); 12130 var doFlush = false; 12131 itemQueue = []; 12132 arrForEach(allItems, function(item) { 12133 if (!item()) { 12134 itemQueue.push(item); 12135 } else { 12136 doFlush = true; 12137 } 12138 }); 12139 if (itemQueue[ 12140 _DYN_LENGTH$2 12141 /* @min:%2elength */ 12142 ] > 0) { 12143 _startTimer(); 12144 } 12145 if (doFlush) { 12146 _flushChannels(true); 12147 } 12148 }, 100); 12149 } 12150 } 12151 function _addQueue(cb) { 12152 itemQueue.push(cb); 12153 _startTimer(); 12154 } 12155 _self[ 12156 _DYN_TRACK_PAGE_VIEW 12157 /* @min:%2etrackPageView */ 12158 ] = function(pageView, customProperties) { 12159 var name = pageView.name; 12160 if (/* @__PURE__ */ isNullOrUndefined(name) || typeof name !== "string") { 12161 var doc = getDocument(); 12162 name = pageView.name = doc && doc.title || ""; 12163 } 12164 var uri = pageView.uri; 12165 if (/* @__PURE__ */ isNullOrUndefined(uri) || typeof uri !== "string") { 12166 var location_1 = getLocation(); 12167 uri = pageView.uri = location_1 && location_1[ 12168 _DYN_HREF 12169 /* @min:%2ehref */ 12170 ] || ""; 12171 } 12172 if (!firstPageViewSent) { 12173 var perf = /* @__PURE__ */ getPerformance(); 12174 var navigationEntries = perf && perf[ 12175 _DYN_GET_ENTRIES_BY_TYPE 12176 /* @min:%2egetEntriesByType */ 12177 ] && perf[ 12178 _DYN_GET_ENTRIES_BY_TYPE 12179 /* @min:%2egetEntriesByType */ 12180 ]("navigation"); 12181 if (navigationEntries && navigationEntries[0] && !/* @__PURE__ */ isUndefined(perf.timeOrigin)) { 12182 var loadEventStart = navigationEntries[0].loadEventStart; 12183 pageView[ 12184 _DYN_START_TIME$1 12185 /* @min:%2estartTime */ 12186 ] = new Date(perf.timeOrigin + loadEventStart); 12187 } else { 12188 var duration_1 = (customProperties || pageView[ 12189 _DYN_PROPERTIES 12190 /* @min:%2eproperties */ 12191 ] || {})[ 12192 _DYN_DURATION 12193 /* @min:%2eduration */ 12194 ] || 0; 12195 pageView[ 12196 _DYN_START_TIME$1 12197 /* @min:%2estartTime */ 12198 ] = new Date((/* @__PURE__ */ new Date()).getTime() - duration_1); 12199 } 12200 firstPageViewSent = true; 12201 } 12202 if (!pageViewPerformanceManager[ 12203 _DYN_IS_PERFORMANCE_TIMIN15 12204 /* @min:%2eisPerformanceTimingSupported */ 12205 ]()) { 12206 appInsights[ 12207 _DYN_SEND_PAGE_VIEW_INTER2 12208 /* @min:%2esendPageViewInternal */ 12209 ](pageView, customProperties); 12210 _flushChannels(true); 12211 if (!isWebWorker()) { 12212 _throwInternal(_logger, 2, 25, "trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info."); 12213 } 12214 return; 12215 } 12216 var pageViewSent = false; 12217 var customDuration; 12218 var start = pageViewPerformanceManager[ 12219 _DYN_GET_PERFORMANCE_TIMI16 12220 /* @min:%2egetPerformanceTiming */ 12221 ]()[ 12222 _DYN_NAVIGATION_START 12223 /* @min:%2enavigationStart */ 12224 ]; 12225 if (start > 0) { 12226 customDuration = dateTimeUtilsDuration(start, +/* @__PURE__ */ new Date()); 12227 if (!pageViewPerformanceManager[ 12228 _DYN_SHOULD_COLLECT_DURAT17 12229 /* @min:%2eshouldCollectDuration */ 12230 ](customDuration)) { 12231 customDuration = void 0; 12232 } 12233 } 12234 var duration; 12235 if (!/* @__PURE__ */ isNullOrUndefined(customProperties) && !/* @__PURE__ */ isNullOrUndefined(customProperties[ 12236 _DYN_DURATION 12237 /* @min:%2eduration */ 12238 ])) { 12239 duration = customProperties[ 12240 _DYN_DURATION 12241 /* @min:%2eduration */ 12242 ]; 12243 } 12244 if (overridePageViewDuration || !isNaN(duration)) { 12245 if (isNaN(duration)) { 12246 if (!customProperties) { 12247 customProperties = {}; 12248 } 12249 customProperties[ 12250 _DYN_DURATION 12251 /* @min:%2eduration */ 12252 ] = customDuration; 12253 } 12254 appInsights[ 12255 _DYN_SEND_PAGE_VIEW_INTER2 12256 /* @min:%2esendPageViewInternal */ 12257 ](pageView, customProperties); 12258 _flushChannels(true); 12259 pageViewSent = true; 12260 } 12261 var maxDurationLimit = 6e4; 12262 if (!customProperties) { 12263 customProperties = {}; 12264 } 12265 _addQueue(function() { 12266 var processed = false;
12267 try { 12268 if (pageViewPerformanceManager[ 12269 _DYN_IS_PERFORMANCE_TIMIN18 12270 /* @min:%2eisPerformanceTimingDataReady */ 12271 ]()) { 12272 processed = true; 12273 var pageViewPerformance = { 12274 name, 12275 uri 12276 }; 12277 pageViewPerformanceManager[ 12278 _DYN_POPULATE_PAGE_VIEW_P4 12279 /* @min:%2epopulatePageViewPerformanceEvent */ 12280 ](pageViewPerformance); 12281 if (!pageViewPerformance.isValid && !pageViewSent) { 12282 customProperties[ 12283 _DYN_DURATION 12284 /* @min:%2eduration */ 12285 ] = customDuration; 12286 appInsights[ 12287 _DYN_SEND_PAGE_VIEW_INTER2 12288 /* @min:%2esendPageViewInternal */ 12289 ](pageView, customProperties); 12290 } else { 12291 if (!pageViewSent) { 12292 customProperties[ 12293 _DYN_DURATION 12294 /* @min:%2eduration */ 12295 ] = pageViewPerformance.durationMs; 12296 appInsights[ 12297 _DYN_SEND_PAGE_VIEW_INTER2 12298 /* @min:%2esendPageViewInternal */ 12299 ](pageView, customProperties); 12300 } 12301 if (!pageViewPerformanceSent) { 12302 appInsights[ 12303 _DYN_SEND_PAGE_VIEW_PERFO3 12304 /* @min:%2esendPageViewPerformanceInternal */ 12305 ](pageViewPerformance, customProperties); 12306 pageViewPerformanceSent = true; 12307 } 12308 } 12309 } else if (start > 0 && dateTimeUtilsDuration(start, +/* @__PURE__ */ new Date()) > maxDurationLimit) { 12310 processed = true; 12311 if (!pageViewSent) { 12312 customProperties[ 12313 _DYN_DURATION 12314 /* @min:%2eduration */ 12315 ] = maxDurationLimit; 12316 appInsights[ 12317 _DYN_SEND_PAGE_VIEW_INTER2 12318 /* @min:%2esendPageViewInternal */ 12319 ](pageView, customProperties); 12320 } 12321 } 12322 } catch (e) { 12323 _throwInternal(_logger, 1, 38, "trackPageView failed on page load calculation: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 12324 } 12325 return processed; 12326 }); 12327 }; 12328 _self.teardown = function(unloadCtx, unloadState) { 12329 if (queueTimer) { 12330 queueTimer.cancel(); 12331 queueTimer = null; 12332 var allItems = itemQueue.slice(0); 12333 itemQueue = []; 12334 arrForEach(allItems, function(item) { 12335 if (item()) ; 12336 }); 12337 } 12338 }; 12339 }); 12340 } 12341 PageViewManager2.__ieDyn = 1; 12342 return PageViewManager2; 12343 }() 12344); 12345var MAX_DURATION_ALLOWED = 36e5; 12346var botAgentNames = ["googlebot", "adsbot-google", "apis-google", "mediapartners-google"]; 12347function _isPerformanceTimingSupported() { 12348 var perf = /* @__PURE__ */ getPerformance(); 12349 return perf && !!perf.timing; 12350} 12351function _isPerformanceNavigationTimingSupported() { 12352 var perf = /* @__PURE__ */ getPerformance(); 12353 return perf && perf.getEntriesByType && perf.getEntriesByType("navigation")[ 12354 _DYN_LENGTH$2 12355 /* @min:%2elength */ 12356 ] > 0; 12357} 12358function _isPerformanceTimingDataReady() { 12359 var perf = /* @__PURE__ */ getPerformance(); 12360 var timing = perf ? perf.timing : 0; 12361 return timing && timing.domainLookupStart > 0 && timing[ 12362 _DYN_NAVIGATION_START 12363 /* @min:%2enavigationStart */ 12364 ] > 0 && timing[ 12365 _DYN_RESPONSE_START 12366 /* @min:%2eresponseStart */ 12367 ] > 0 && timing[ 12368 _DYN_REQUEST_START 12369 /* @min:%2erequestStart */ 12370 ] > 0 && timing[ 12371 _DYN_LOAD_EVENT_END 12372 /* @min:%2eloadEventEnd */ 12373 ] > 0 && timing[ 12374 _DYN_RESPONSE_END 12375 /* @min:%2eresponseEnd */ 12376 ] > 0 && timing[ 12377 _DYN_CONNECT_END 12378 /* @min:%2econnectEnd */ 12379 ] > 0 && timing.domLoading > 0; 12380} 12381function _getPerformanceTiming() { 12382 if (_isPerformanceTimingSupported()) { 12383 return (/* @__PURE__ */ getPerformance()).timing; 12384 } 12385 return null; 12386} 12387function _getPerformanceNavigationTiming() { 12388 if (_isPerformanceNavigationTimingSupported()) { 12389 return (/* @__PURE__ */ getPerformance())[ 12390 _DYN_GET_ENTRIES_BY_TYPE 12391 /* @min:%2egetEntriesByType */ 12392 ]("navigation")[0]; 12393 } 12394 return null; 12395} 12396function _shouldCollectDuration() { 12397 var durations = []; 12398 for (var _i = 0; _i < arguments.length; _i++) { 12399 durations[_i] = arguments[_i]; 12400 } 12401 var _navigator = getNavigator() || {}; 12402 var userAgent = _navigator.userAgent; 12403 var isGoogleBot = false;
12404 if (userAgent) { 12405 for (var i2 = 0; i2 < botAgentNames[ 12406 _DYN_LENGTH$2 12407 /* @min:%2elength */ 12408 ]; i2++) { 12409 isGoogleBot = isGoogleBot || strIndexOf(userAgent.toLowerCase(), botAgentNames[i2]) !== -1; 12410 } 12411 } 12412 if (isGoogleBot) { 12413 return false; 12414 } else { 12415 for (var i2 = 0; i2 < durations[ 12416 _DYN_LENGTH$2 12417 /* @min:%2elength */ 12418 ]; i2++) { 12419 if (durations[i2] < 0 || durations[i2] >= MAX_DURATION_ALLOWED) { 12420 return false; 12421 } 12422 } 12423 } 12424 return true; 12425} 12426var PageViewPerformanceManager = ( 12427 /** @class */ 12428 function() { 12429 function PageViewPerformanceManager2(core) { 12430 var _logger = safeGetLogger(core); 12431 dynamicProto(PageViewPerformanceManager2, this, function(_self) { 12432 _self[ 12433 _DYN_POPULATE_PAGE_VIEW_P4 12434 /* @min:%2epopulatePageViewPerformanceEvent */ 12435 ] = function(pageViewPerformance) { 12436 pageViewPerformance.isValid = false; 12437 var navigationTiming = _getPerformanceNavigationTiming(); 12438 var timing = _getPerformanceTiming(); 12439 var total = 0; 12440 var network = 0; 12441 var request = 0; 12442 var response = 0; 12443 var dom = 0; 12444 if (navigationTiming || timing) { 12445 if (navigationTiming) { 12446 total = navigationTiming[ 12447 _DYN_DURATION 12448 /* @min:%2eduration */ 12449 ]; 12450 network = navigationTiming[ 12451 _DYN_START_TIME$1 12452 /* @min:%2estartTime */ 12453 ] === 0 ? navigationTiming[ 12454 _DYN_CONNECT_END 12455 /* @min:%2econnectEnd */ 12456 ] : dateTimeUtilsDuration(navigationTiming[ 12457 _DYN_START_TIME$1 12458 /* @min:%2estartTime */ 12459 ], navigationTiming[ 12460 _DYN_CONNECT_END 12461 /* @min:%2econnectEnd */ 12462 ]); 12463 request = dateTimeUtilsDuration(navigationTiming.requestStart, navigationTiming[ 12464 _DYN_RESPONSE_START 12465 /* @min:%2eresponseStart */ 12466 ]); 12467 response = dateTimeUtilsDuration(navigationTiming[ 12468 _DYN_RESPONSE_START 12469 /* @min:%2eresponseStart */ 12470 ], navigationTiming[ 12471 _DYN_RESPONSE_END 12472 /* @min:%2eresponseEnd */ 12473 ]); 12474 dom = dateTimeUtilsDuration(navigationTiming.responseEnd, navigationTiming[ 12475 _DYN_LOAD_EVENT_END 12476 /* @min:%2eloadEventEnd */ 12477 ]); 12478 } else { 12479 total = dateTimeUtilsDuration(timing[ 12480 _DYN_NAVIGATION_START 12481 /* @min:%2enavigationStart */ 12482 ], timing[ 12483 _DYN_LOAD_EVENT_END 12484 /* @min:%2eloadEventEnd */ 12485 ]); 12486 network = dateTimeUtilsDuration(timing[ 12487 _DYN_NAVIGATION_START 12488 /* @min:%2enavigationStart */ 12489 ], timing[ 12490 _DYN_CONNECT_END 12491 /* @min:%2econnectEnd */ 12492 ]); 12493 request = dateTimeUtilsDuration(timing.requestStart, timing[ 12494 _DYN_RESPONSE_START 12495 /* @min:%2eresponseStart */ 12496 ]); 12497 response = dateTimeUtilsDuration(timing[ 12498 _DYN_RESPONSE_START 12499 /* @min:%2eresponseStart */ 12500 ], timing[ 12501 _DYN_RESPONSE_END 12502 /* @min:%2eresponseEnd */ 12503 ]); 12504 dom = dateTimeUtilsDuration(timing.responseEnd, timing[ 12505 _DYN_LOAD_EVENT_END 12506 /* @min:%2eloadEventEnd */ 12507 ]); 12508 } 12509 if (total === 0) { 12510 _throwInternal(_logger, 2, 10, "error calculating page view performance.", { total, network, request, response, dom }); 12511 } else if (!_self[ 12512 _DYN_SHOULD_COLLECT_DURAT17 12513 /* @min:%2eshouldCollectDuration */ 12514 ](total, network, request, response, dom)) { 12515 _throwInternal(_logger, 2, 45, "Invalid page load duration value. Browser perf data won't be sent.", { total, network, request, response, dom }); 12516 } else if (total < mathFloor(network) + mathFloor(request) + mathFloor(response) + mathFloor(dom)) { 12517 _throwInternal(_logger, 2, 8, "client performance math error.", { total, network, request, response, dom }); 12518 } else { 12519 pageViewPerformance.durationMs = total; 12520 pageViewPerformance.perfTotal = pageViewPerformance[ 12521 _DYN_DURATION 12522 /* @min:%2eduration */ 12523 ] = msToTimeSpan(total); 12524 pageViewPerformance.networkConnect = msToTimeSpan(network); 12525 pageViewPerformance.sentRequest = msToTimeSpan(request); 12526 pageViewPerformance.receivedResponse = msToTimeSpan(response); 12527 pageViewPerformance.domProcessing = msToTimeSpan(dom); 12528 pageViewPerformance.isValid = true; 12529 } 12530 } 12531 }; 12532 _self[ 12533 _DYN_GET_PERFORMANCE_TIMI16 12534 /* @min:%2egetPerformanceTiming */ 12535 ] = _getPerformanceTiming; 12536 _self[ 12537 _DYN_IS_PERFORMANCE_TIMIN15 12538 /* @min:%2eisPerformanceTimingSupported */ 12539 ] = _isPerformanceTimingSupported; 12540 _self[ 12541 _DYN_IS_PERFORMANCE_TIMIN18 12542 /* @min:%2eisPerformanceTimingDataReady */ 12543 ] = _isPerformanceTimingDataReady; 12544 _self[ 12545 _DYN_SHOULD_COLLECT_DURAT17 12546 /* @min:%2eshouldCollectDuration */ 12547 ] = _shouldCollectDuration; 12548 }); 12549 } 12550 PageViewPerformanceManager2.__ieDyn = 1; 12551 return PageViewPerformanceManager2; 12552 }() 12553); 12554var PageVisitTimeManager = ( 12555 /** @class */ 12556 function() { 12557 function PageVisitTimeManager2(logger, pageVisitTimeTrackingHandler) { 12558 var prevPageVisitDataKeyName = "prevPageVisitData"; 12559 dynamicProto(PageVisitTimeManager2, this, function(_self) { 12560 _self[ 12561 _DYN_TRACK_PREVIOUS_PAGE_1 12562 /* @min:%2etrackPreviousPageVisit */ 12563 ] = function(currentPageName, currentPageUrl) { 12564 try { 12565 var prevPageVisitTimeData = restartPageVisitTimer(currentPageName, currentPageUrl); 12566 if (prevPageVisitTimeData) { 12567 pageVisitTimeTrackingHandler(prevPageVisitTimeData.pageName, prevPageVisitTimeData.pageUrl, prevPageVisitTimeData.pageVisitTime); 12568 } 12569 } catch (e) { 12570 _warnToConsole(logger, "Auto track page visit time failed, metric will not be collected: " + /* @__PURE__ */ dumpObj(e)); 12571 } 12572 }; 12573 function restartPageVisitTimer(pageName, pageUrl) { 12574 var prevPageVisitData = null; 12575 try { 12576 prevPageVisitData = stopPageVisitTimer(); 12577 if (utlCanUseSessionStorage()) { 12578 if (utlGetSessionStorage(logger, prevPageVisitDataKeyName) != null) { 12579 throwError("Cannot call startPageVisit consecutively without first calling stopPageVisit"); 12580 } 12581 var currPageVisitDataStr = getJSON().stringify(new PageVisitData(pageName, pageUrl)); 12582 utlSetSessionStorage(logger, prevPageVisitDataKeyName, currPageVisitDataStr); 12583 } 12584 } catch (e) { 12585 _warnToConsole(logger, "Call to restart failed: " + /* @__PURE__ */ dumpObj(e)); 12586 prevPageVisitData = null; 12587 } 12588 return prevPageVisitData; 12589 } 12590 function stopPageVisitTimer() { 12591 var prevPageVisitData = null; 12592 try { 12593 if (utlCanUseSessionStorage()) { 12594 var pageVisitEndTime = /* @__PURE__ */ utcNow(); 12595 var pageVisitDataJsonStr = utlGetSessionStorage(logger, prevPageVisitDataKeyName); 12596 if (pageVisitDataJsonStr && hasJSON()) { 12597 prevPageVisitData = getJSON().parse(pageVisitDataJsonStr); 12598 prevPageVisitData.pageVisitTime = pageVisitEndTime - prevPageVisitData.pageVisitStartTime; 12599 utlRemoveSessionStorage(logger, prevPageVisitDataKeyName); 12600 } 12601 } 12602 } catch (e) { 12603 _warnToConsole(logger, "Stop page visit timer failed: " + /* @__PURE__ */ dumpObj(e)); 12604 prevPageVisitData = null; 12605 } 12606 return prevPageVisitData; 12607 } 12608 objDefine(_self, "_logger", { g: function() { 12609 return logger; 12610 } }); 12611 objDefine(_self, "pageVisitTimeTrackingHandler", { g: function() { 12612 return pageVisitTimeTrackingHandler; 12613 } }); 12614 }); 12615 } 12616 PageVisitTimeManager2.__ieDyn = 1; 12617 return PageVisitTimeManager2; 12618 }() 12619); 12620var PageVisitData = ( 12621 /** @class */
12622 /* @__PURE__ */ function() { 12623 function PageVisitData2(pageName, pageUrl) { 12624 this.pageVisitStartTime = /* @__PURE__ */ utcNow(); 12625 this.pageName = pageName; 12626 this.pageUrl = pageUrl; 12627 } 12628 return PageVisitData2; 12629 }() 12630); 12631var Timing = ( 12632 /** @class */ 12633 /* @__PURE__ */ function() { 12634 function Timing2(logger, name) { 12635 var _self = this; 12636 var _events = {}; 12637 _self.start = function(name2) { 12638 if (typeof _events[name2] !== "undefined") { 12639 _throwInternal(logger, 2, 62, "start was called more than once for this event without calling stop.", { name: name2, key: name2 }, true); 12640 } 12641 _events[name2] = +/* @__PURE__ */ new Date(); 12642 }; 12643 _self.stop = function(name2, url, properties, measurements) { 12644 var start = _events[name2]; 12645 if (isNaN(start)) { 12646 _throwInternal(logger, 2, 63, "stop was called without a corresponding start.", { name: name2, key: name2 }, true); 12647 } else { 12648 var end = +/* @__PURE__ */ new Date(); 12649 var duration = dateTimeUtilsDuration(start, end); 12650 _self.action(name2, url, duration, properties, measurements); 12651 } 12652 delete _events[name2]; 12653 _events[name2] = void 0; 12654 }; 12655 } 12656 return Timing2; 12657 }() 12658); 12659var _a$5; 12660var strEvent = "event"; 12661function _dispatchEvent(target, evnt) { 12662 if (target && target.dispatchEvent && evnt) { 12663 target.dispatchEvent(evnt); 12664 } 12665} 12666function _getReason(error) { 12667 if (error && error.reason) { 12668 var reason = error.reason; 12669 if (!isString(reason) && isFunction(reason[ 12670 _DYN_TO_STRING$1 12671 /* @min:%2etoString */ 12672 ])) { 12673 return reason[ 12674 _DYN_TO_STRING$1 12675 /* @min:%2etoString */ 12676 ](); 12677 } 12678 return /* @__PURE__ */ dumpObj(reason); 12679 } 12680 return error || ""; 12681} 12682var MinMilliSeconds = 6e4; 12683var defaultValues = objDeepFreeze((_a$5 = { 12684 sessionRenewalMs: cfgDfSet(_chkConfigMilliseconds, 30 * 60 * 1e3), 12685 sessionExpirationMs: cfgDfSet(_chkConfigMilliseconds, 24 * 60 * 60 * 1e3), 12686 disableExceptionTracking: cfgDfBoolean() 12687}, _a$5[ 12688 _DYN_AUTO_TRACK_PAGE_VISI10 12689 /* @min:autoTrackPageVisitTime */ 12690] = cfgDfBoolean(), _a$5[ 12691 _DYN_OVERRIDE_PAGE_VIEW_D8 12692 /* @min:overridePageViewDuration */ 12693] = cfgDfBoolean(), _a$5[ 12694 _DYN_ENABLE_UNHANDLED_PRO13 12695 /* @min:enableUnhandledPromiseRejectionTracking */ 12696] = cfgDfBoolean(), _a$5[ 12697 _DYN_AUTO_UNHANDLED_PROMI14 12698 /* @min:autoUnhandledPromiseInstrumented */ 12699] = false, _a$5.samplingPercentage = cfgDfValidate(_chkSampling$1, 100), _a$5[ 12700 _DYN_IS_STORAGE_USE_DISAB0 12701 /* @min:isStorageUseDisabled */ 12702] = cfgDfBoolean(), _a$5[ 12703 _DYN_IS_BROWSER_LINK_TRAC11 12704 /* @min:isBrowserLinkTrackingEnabled */ 12705] = cfgDfBoolean(), _a$5[ 12706 _DYN_ENABLE_AUTO_ROUTE_TR12 12707 /* @min:enableAutoRouteTracking */ 12708] = cfgDfBoolean(), _a$5.namePrefix = cfgDfString(), _a$5.enableDebug = cfgDfBoolean(), _a$5.disableFlushOnBeforeUnload = cfgDfBoolean(), _a$5.disableFlushOnUnload = cfgDfBoolean(false, "disableFlushOnBeforeUnload"), _a$5.expCfg = cfgDfMerge({ inclScripts: false, expLog: void 0, maxLogs: 50 }), _a$5)); 12709function _chkConfigMilliseconds(value, defValue) { 12710 value = value || defValue; 12711 if (value < MinMilliSeconds) { 12712 value = MinMilliSeconds; 12713 } 12714 return +value; 12715} 12716function _chkSampling$1(value) { 12717 return !isNaN(value) && value > 0 && value <= 100; 12718} 12719function _updateStorageUsage(extConfig) { 12720 if (!/* @__PURE__ */ isUndefined(extConfig[ 12721 _DYN_IS_STORAGE_USE_DISAB0 12722 /* @min:%2eisStorageUseDisabled */ 12723 ])) { 12724 if (extConfig[ 12725 _DYN_IS_STORAGE_USE_DISAB0 12726 /* @min:%2eisStorageUseDisabled */ 12727 ]) { 12728 utlDisableStorage(); 12729 } else { 12730 utlEnableStorage(); 12731 } 12732 } 12733} 12734var AnalyticsPlugin = ( 12735 /** @class */ 12736 function(_super) { 12737 __extendsFn(AnalyticsPlugin2, _super); 12738 function AnalyticsPlugin2() { 12739 var _this = _super.call(this) || this; 12740 _this.identifier = AnalyticsPluginIdentifier; 12741 _this.priority = 180; 12742 _this.autoRoutePVDelay = 500; 12743 var _eventTracking; 12744 var _pageTracking; 12745 var _pageViewManager; 12746 var _pageViewPerformanceManager; 12747 var _pageVisitTimeManager;
12748 var _preInitTelemetryInitializers; 12749 var _isBrowserLinkTrackingEnabled; 12750 var _browserLinkInitializerAdded; 12751 var _enableAutoRouteTracking; 12752 var _historyListenerAdded; 12753 var _disableExceptionTracking; 12754 var _autoExceptionInstrumented; 12755 var _enableUnhandledPromiseRejectionTracking; 12756 var _autoUnhandledPromiseInstrumented; 12757 var _extConfig; 12758 var _autoTrackPageVisitTime; 12759 var _expCfg; 12760 var _prevUri; 12761 var _currUri; 12762 var _evtNamespace; 12763 var _errorHookCnt; 12764 dynamicProto(AnalyticsPlugin2, _this, function(_self, _base) { 12765 var _addHook = _base[ 12766 _DYN__ADD_HOOK$1 12767 /* @min:%2e_addHook */ 12768 ]; 12769 _initDefaults(); 12770 _self.getCookieMgr = function() { 12771 return safeGetCookieMgr(_self[ 12772 _DYN_CORE$1 12773 /* @min:%2ecore */ 12774 ]); 12775 }; 12776 _self.processTelemetry = function(env, itemCtx) { 12777 _self.processNext(env, itemCtx); 12778 }; 12779 _self.trackEvent = function(event, customProperties) { 12780 try { 12781 var telemetryItem = createTelemetryItem(event, Event$1[ 12782 _DYN_DATA_TYPE$1 12783 /* @min:%2edataType */ 12784 ], Event$1[ 12785 _DYN_ENVELOPE_TYPE$1 12786 /* @min:%2eenvelopeType */ 12787 ], _self[ 12788 _DYN_DIAG_LOG$1 12789 /* @min:%2ediagLog */ 12790 ](), customProperties); 12791 _self[ 12792 _DYN_CORE$1 12793 /* @min:%2ecore */ 12794 ][ 12795 _DYN_TRACK 12796 /* @min:%2etrack */ 12797 ](telemetryItem); 12798 } catch (e) { 12799 _throwInternal2(2, 39, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 12800 } 12801 }; 12802 _self.startTrackEvent = function(name) { 12803 try { 12804 _eventTracking.start(name); 12805 } catch (e) { 12806 _throwInternal2(1, 29, "startTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 12807 } 12808 }; 12809 _self.stopTrackEvent = function(name, properties, measurements) { 12810 try { 12811 _eventTracking.stop(name, void 0, properties, measurements); 12812 } catch (e) { 12813 _throwInternal2(1, 30, "stopTrackEvent failed, event will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 12814 } 12815 }; 12816 _self.trackTrace = function(trace, customProperties) { 12817 try { 12818 var telemetryItem = createTelemetryItem(trace, Trace[ 12819 _DYN_DATA_TYPE$1 12820 /* @min:%2edataType */ 12821 ], Trace[ 12822 _DYN_ENVELOPE_TYPE$1 12823 /* @min:%2eenvelopeType */ 12824 ], _self[ 12825 _DYN_DIAG_LOG$1 12826 /* @min:%2ediagLog */ 12827 ](), customProperties); 12828 _self[ 12829 _DYN_CORE$1 12830 /* @min:%2ecore */ 12831 ][ 12832 _DYN_TRACK 12833 /* @min:%2etrack */ 12834 ](telemetryItem); 12835 } catch (e) { 12836 _throwInternal2(2, 39, "trackTrace failed, trace will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 12837 } 12838 }; 12839 _self.trackMetric = function(metric, customProperties) { 12840 try { 12841 var telemetryItem = createTelemetryItem(metric, Metric[ 12842 _DYN_DATA_TYPE$1 12843 /* @min:%2edataType */ 12844 ], Metric[ 12845 _DYN_ENVELOPE_TYPE$1 12846 /* @min:%2eenvelopeType */ 12847 ], _self[ 12848 _DYN_DIAG_LOG$1 12849 /* @min:%2ediagLog */ 12850 ](), customProperties); 12851 _self[ 12852 _DYN_CORE$1 12853 /* @min:%2ecore */ 12854 ][ 12855 _DYN_TRACK 12856 /* @min:%2etrack */ 12857 ](telemetryItem); 12858 } catch (e) { 12859 _throwInternal2(1, 36, "trackMetric failed, metric will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 12860 } 12861 }; 12862 _self[ 12863 _DYN_TRACK_PAGE_VIEW 12864 /* @min:%2etrackPageView */ 12865 ] = function(pageView, customProperties) { 12866 try { 12867 var inPv = pageView || {};
12868 _pageViewManager[ 12869 _DYN_TRACK_PAGE_VIEW 12870 /* @min:%2etrackPageView */ 12871 ](inPv, __assignFn(__assignFn(__assignFn({}, inPv.properties), inPv.measurements), customProperties)); 12872 if (_autoTrackPageVisitTime) { 12873 _pageVisitTimeManager[ 12874 _DYN_TRACK_PREVIOUS_PAGE_1 12875 /* @min:%2etrackPreviousPageVisit */ 12876 ](inPv.name, inPv.uri); 12877 } 12878 } catch (e) { 12879 _throwInternal2(1, 37, "trackPageView failed, page view will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 12880 } 12881 }; 12882 _self[ 12883 _DYN_SEND_PAGE_VIEW_INTER2 12884 /* @min:%2esendPageViewInternal */ 12885 ] = function(pageView, properties, systemProperties) { 12886 var doc = getDocument(); 12887 if (doc) { 12888 pageView.refUri = pageView.refUri === void 0 ? doc.referrer : pageView.refUri; 12889 } 12890 if (/* @__PURE__ */ isNullOrUndefined(pageView[ 12891 _DYN_START_TIME$1 12892 /* @min:%2estartTime */ 12893 ])) { 12894 var duration = (properties || pageView[ 12895 _DYN_PROPERTIES 12896 /* @min:%2eproperties */ 12897 ] || {})[ 12898 _DYN_DURATION 12899 /* @min:%2eduration */ 12900 ] || 0; 12901 pageView[ 12902 _DYN_START_TIME$1 12903 /* @min:%2estartTime */ 12904 ] = new Date((/* @__PURE__ */ new Date()).getTime() - duration); 12905 } 12906 var telemetryItem = createTelemetryItem(pageView, PageView[ 12907 _DYN_DATA_TYPE$1 12908 /* @min:%2edataType */ 12909 ], PageView[ 12910 _DYN_ENVELOPE_TYPE$1 12911 /* @min:%2eenvelopeType */ 12912 ], _self[ 12913 _DYN_DIAG_LOG$1 12914 /* @min:%2ediagLog */ 12915 ](), properties, systemProperties); 12916 _self[ 12917 _DYN_CORE$1 12918 /* @min:%2ecore */ 12919 ][ 12920 _DYN_TRACK 12921 /* @min:%2etrack */ 12922 ](telemetryItem); 12923 }; 12924 _self[ 12925 _DYN_SEND_PAGE_VIEW_PERFO3 12926 /* @min:%2esendPageViewPerformanceInternal */ 12927 ] = function(pageViewPerformance, properties, systemProperties) { 12928 var telemetryItem = createTelemetryItem(pageViewPerformance, PageViewPerformance[ 12929 _DYN_DATA_TYPE$1 12930 /* @min:%2edataType */ 12931 ], PageViewPerformance[ 12932 _DYN_ENVELOPE_TYPE$1 12933 /* @min:%2eenvelopeType */ 12934 ], _self[ 12935 _DYN_DIAG_LOG$1 12936 /* @min:%2ediagLog */ 12937 ](), properties, systemProperties); 12938 _self[ 12939 _DYN_CORE$1 12940 /* @min:%2ecore */ 12941 ][ 12942 _DYN_TRACK 12943 /* @min:%2etrack */ 12944 ](telemetryItem); 12945 }; 12946 _self.trackPageViewPerformance = function(pageViewPerformance, customProperties) { 12947 var inPvp = pageViewPerformance || {}; 12948 try { 12949 _pageViewPerformanceManager[ 12950 _DYN_POPULATE_PAGE_VIEW_P4 12951 /* @min:%2epopulatePageViewPerformanceEvent */ 12952 ](inPvp); 12953 _self[ 12954 _DYN_SEND_PAGE_VIEW_PERFO3 12955 /* @min:%2esendPageViewPerformanceInternal */ 12956 ](inPvp, customProperties); 12957 } catch (e) { 12958 _throwInternal2(1, 37, "trackPageViewPerformance failed, page view will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 12959 } 12960 }; 12961 _self.startTrackPage = function(name) { 12962 try { 12963 if (typeof name !== "string") { 12964 var doc = getDocument(); 12965 name = doc && doc.title || ""; 12966 } 12967 _pageTracking.start(name); 12968 } catch (e) { 12969 _throwInternal2(1, 31, "startTrackPage failed, page view may not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 12970 } 12971 }; 12972 _self.stopTrackPage = function(name, url, properties, measurement) { 12973 try { 12974 if (typeof name !== "string") { 12975 var doc = getDocument(); 12976 name = doc && doc.title || ""; 12977 } 12978 if (typeof url !== "string") { 12979 var loc = getLocation(); 12980 url = loc && loc[ 12981 _DYN_HREF 12982 /* @min:%2ehref */ 12983 ] || ""; 12984 } 12985 _pageTracking.stop(name, url, properties, measurement); 12986 if (_autoTrackPageVisitTime) { 12987 _pageVisitTimeManager[ 12988 _DYN_TRACK_PREVIOUS_PAGE_1 12989 /* @min:%2etrackPreviousPageVisit */ 12990 ](name, url); 12991 } 12992 } catch (e) { 12993 _throwInternal2(1, 32, "stopTrackPage failed, page view will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 12994 } 12995 }; 12996 _self[ 12997 _DYN_SEND_EXCEPTION_INTER5 12998 /* @min:%2esendExceptionInternal */ 12999 ] = function(exception, customProperties, systemProperties) { 13000 var theError = exception && (exception.exception || exception[ 13001 _DYN_ERROR 13002 /* @min:%2eerror */ 13003 ]) || // - Handle someone calling trackException based of v1 API where the exception was the Error 13004 isError(exception) && exception || // - Handles no error being defined and instead of creating a new Error() instance attempt to map so any stacktrace 13005 // is preserved and does not list ApplicationInsights code as the source 13006 { name: exception && typeof exception, message: exception || strNotSpecified }; 13007 exception = exception || {}; 13008 var exceptionPartB = new Exception(_self[ 13009 _DYN_DIAG_LOG$1 13010 /* @min:%2ediagLog */ 13011 ](), theError, exception[ 13012 _DYN_PROPERTIES 13013 /* @min:%2eproperties */ 13014 ] || customProperties, exception.measurements, exception.severityLevel, exception.id).toInterface(); 13015 var doc = getDocument(); 13016 if (doc && (_expCfg === null || _expCfg === void 0 ? void 0 : _expCfg.inclScripts)) { 13017 var scriptsInfo = findAllScripts(doc); 13018 exceptionPartB[ 13019 _DYN_PROPERTIES 13020 /* @min:%2eproperties */ 13021 ]["exceptionScripts"] = JSON.stringify(scriptsInfo); 13022 } 13023 if (_expCfg === null || _expCfg === void 0 ? void 0 : _expCfg.expLog) { 13024 var logs = _expCfg.expLog(); 13025 if (logs && logs.logs && isArray(logs.logs)) { 13026 exceptionPartB[ 13027 _DYN_PROPERTIES 13028 /* @min:%2eproperties */ 13029 ]["exceptionLog"] = logs.logs.slice(0, _expCfg.maxLogs).join("\n"); 13030 } 13031 } 13032 var telemetryItem = createTelemetryItem(exceptionPartB, Exception[ 13033 _DYN_DATA_TYPE$1 13034 /* @min:%2edataType */ 13035 ], Exception[ 13036 _DYN_ENVELOPE_TYPE$1 13037 /* @min:%2eenvelopeType */ 13038 ], _self[ 13039 _DYN_DIAG_LOG$1 13040 /* @min:%2ediagLog */ 13041 ](), customProperties, systemProperties); 13042 _self[ 13043 _DYN_CORE$1 13044 /* @min:%2ecore */ 13045 ][ 13046 _DYN_TRACK 13047 /* @min:%2etrack */ 13048 ](telemetryItem); 13049 }; 13050 _self.trackException = function(exception, customProperties) { 13051 if (exception && !exception.exception && exception[ 13052 _DYN_ERROR 13053 /* @min:%2eerror */ 13054 ]) { 13055 exception.exception = exception[ 13056 _DYN_ERROR 13057 /* @min:%2eerror */ 13058 ]; 13059 } 13060 try { 13061 _self[ 13062 _DYN_SEND_EXCEPTION_INTER5 13063 /* @min:%2esendExceptionInternal */ 13064 ](exception, customProperties); 13065 } catch (e) { 13066 _throwInternal2(1, 35, "trackException failed, exception will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 13067 } 13068 }; 13069 _self._onerror = function(exception) { 13070 var error = exception && exception[ 13071 _DYN_ERROR 13072 /* @min:%2eerror */ 13073 ]; 13074 var evt = exception && exception.evt; 13075 try { 13076 if (!evt) { 13077 var _window = getWindow(); 13078 if (_window) { 13079 evt = _window[strEvent]; 13080 } 13081 } 13082 var url = exception && exception.url || (getDocument() || {}).URL; 13083 var errorSrc = exception.errorSrc || "window.onerror@" + url + ":" + (exception[ 13084 _DYN_LINE_NUMBER 13085 /* @min:%2elineNumber */ 13086 ] || 0) + ":" + (exception[ 13087 _DYN_COLUMN_NUMBER 13088 /* @min:%2ecolumnNumber */ 13089 ] || 0); 13090 var properties = { 13091 errorSrc, 13092 url, 13093 lineNumber: exception[ 13094 _DYN_LINE_NUMBER 13095 /* @min:%2elineNumber */ 13096 ] || 0, 13097 columnNumber: exception[ 13098 _DYN_COLUMN_NUMBER 13099 /* @min:%2ecolumnNumber */ 13100 ] || 0, 13101 message: exception.message 13102 }; 13103 if (isCrossOriginError(exception.message, exception.url, exception.lineNumber, exception.columnNumber, exception[ 13104 _DYN_ERROR 13105 /* @min:%2eerror */ 13106 ])) { 13107 _sendCORSException(Exception[ 13108 _DYN__CREATE_AUTO_EXCEPTI6 13109 /* @min:%2eCreateAutoException */ 13110 ]("Script error: The browser's same-origin policy prevents us from getting the details of this exception. Consider using the 'crossorigin' attribute.", url, exception[ 13111 _DYN_LINE_NUMBER 13112 /* @min:%2elineNumber */ 13113 ] || 0, exception[ 13114 _DYN_COLUMN_NUMBER 13115 /* @min:%2ecolumnNumber */ 13116 ] || 0, error, evt, null, errorSrc), properties); 13117 } else { 13118 if (!exception.errorSrc) { 13119 exception.errorSrc = errorSrc; 13120 } 13121 _self.trackException({ 13122 exception, 13123 severityLevel: 3 13124 /* eSeverityLevel.Error */ 13125 }, properties); 13126 } 13127 } catch (e) {
13128 var errorString = error ? error.name + ", " + error.message : "null"; 13129 _throwInternal2(1, 11, "_onError threw exception while logging error, error will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e), errorString }); 13130 } 13131 }; 13132 _self[ 13133 _DYN_ADD_TELEMETRY_INITIA7 13134 /* @min:%2eaddTelemetryInitializer */ 13135 ] = function(telemetryInitializer) { 13136 if (_self[ 13137 _DYN_CORE$1 13138 /* @min:%2ecore */ 13139 ]) { 13140 return _self[ 13141 _DYN_CORE$1 13142 /* @min:%2ecore */ 13143 ][ 13144 _DYN_ADD_TELEMETRY_INITIA7 13145 /* @min:%2eaddTelemetryInitializer */ 13146 ](telemetryInitializer); 13147 } 13148 if (!_preInitTelemetryInitializers) { 13149 _preInitTelemetryInitializers = []; 13150 } 13151 _preInitTelemetryInitializers.push(telemetryInitializer); 13152 }; 13153 _self.initialize = function(config, core, extensions, pluginChain) { 13154 if (_self.isInitialized()) { 13155 return; 13156 } 13157 if (/* @__PURE__ */ isNullOrUndefined(core)) { 13158 throwError("Error initializing"); 13159 } 13160 _base.initialize(config, core, extensions, pluginChain); 13161 try { 13162 _evtNamespace = mergeEvtNamespace(createUniqueNamespace(_self.identifier), core.evtNamespace && core.evtNamespace()); 13163 if (_preInitTelemetryInitializers) { 13164 arrForEach(_preInitTelemetryInitializers, function(initializer) { 13165 core[ 13166 _DYN_ADD_TELEMETRY_INITIA7 13167 /* @min:%2eaddTelemetryInitializer */ 13168 ](initializer); 13169 }); 13170 _preInitTelemetryInitializers = null; 13171 } 13172 _populateDefaults(config); 13173 _pageViewPerformanceManager = new PageViewPerformanceManager(_self[ 13174 _DYN_CORE$1 13175 /* @min:%2ecore */ 13176 ]); 13177 _pageViewManager = new PageViewManager(_self, _extConfig.overridePageViewDuration, _self[ 13178 _DYN_CORE$1 13179 /* @min:%2ecore */ 13180 ], _pageViewPerformanceManager); 13181 _pageVisitTimeManager = new PageVisitTimeManager(_self[ 13182 _DYN_DIAG_LOG$1 13183 /* @min:%2ediagLog */ 13184 ](), function(pageName, pageUrl, pageVisitTime) { 13185 return trackPageVisitTime(pageName, pageUrl, pageVisitTime); 13186 }); 13187 _eventTracking = new Timing(_self[ 13188 _DYN_DIAG_LOG$1 13189 /* @min:%2ediagLog */ 13190 ](), "trackEvent"); 13191 _eventTracking.action = function(name, url, duration, properties, measurements) { 13192 if (!properties) { 13193 properties = {}; 13194 } 13195 if (!measurements) { 13196 measurements = {}; 13197 } 13198 properties.duration = duration[ 13199 _DYN_TO_STRING$1 13200 /* @min:%2etoString */ 13201 ](); 13202 _self.trackEvent({ name, properties, measurements }); 13203 }; 13204 _pageTracking = new Timing(_self[ 13205 _DYN_DIAG_LOG$1 13206 /* @min:%2ediagLog */ 13207 ](), "trackPageView"); 13208 _pageTracking.action = function(name, url, duration, properties, measurements) { 13209 if (/* @__PURE__ */ isNullOrUndefined(properties)) { 13210 properties = {}; 13211 } 13212 properties.duration = duration[ 13213 _DYN_TO_STRING$1 13214 /* @min:%2etoString */ 13215 ](); 13216 var pageViewItem = { 13217 name, 13218 uri: url, 13219 properties, 13220 measurements 13221 }; 13222 _self[ 13223 _DYN_SEND_PAGE_VIEW_INTER2 13224 /* @min:%2esendPageViewInternal */ 13225 ](pageViewItem, properties); 13226 }; 13227 if (/* @__PURE__ */ hasWindow()) { 13228 _updateExceptionTracking(); 13229 _updateLocationChange(); 13230 } 13231 } catch (e) { 13232 _self.setInitialized(false); 13233 throw e; 13234 } 13235 }; 13236 _self._doTeardown = function(unloadCtx, unloadState) {
13237 _pageViewManager && _pageViewManager.teardown(unloadCtx, unloadState); 13238 eventOff(window, null, null, _evtNamespace); 13239 _initDefaults(); 13240 }; 13241 _self["_getDbgPlgTargets"] = function() { 13242 return [_errorHookCnt, _autoExceptionInstrumented]; 13243 }; 13244 function _populateDefaults(config) { 13245 var identifier = _self.identifier; 13246 var core = _self[ 13247 _DYN_CORE$1 13248 /* @min:%2ecore */ 13249 ]; 13250 _self[ 13251 _DYN__ADD_HOOK$1 13252 /* @min:%2e_addHook */ 13253 ](onConfigChange(config, function() { 13254 var ctx = createProcessTelemetryContext(null, config, core); 13255 _extConfig = ctx.getExtCfg(identifier, defaultValues); 13256 _autoExceptionInstrumented = _autoExceptionInstrumented || config[ 13257 _DYN_AUTO_EXCEPTION_INSTR9 13258 /* @min:%2eautoExceptionInstrumented */ 13259 ] || _extConfig[ 13260 _DYN_AUTO_EXCEPTION_INSTR9 13261 /* @min:%2eautoExceptionInstrumented */ 13262 ]; 13263 _expCfg = _extConfig.expCfg; 13264 _autoTrackPageVisitTime = _extConfig[ 13265 _DYN_AUTO_TRACK_PAGE_VISI10 13266 /* @min:%2eautoTrackPageVisitTime */ 13267 ]; 13268 if (config.storagePrefix) { 13269 utlSetStoragePrefix(config.storagePrefix); 13270 } 13271 _updateStorageUsage(_extConfig); 13272 _isBrowserLinkTrackingEnabled = _extConfig[ 13273 _DYN_IS_BROWSER_LINK_TRAC11 13274 /* @min:%2eisBrowserLinkTrackingEnabled */ 13275 ]; 13276 _addDefaultTelemetryInitializers(); 13277 })); 13278 } 13279 function trackPageVisitTime(pageName, pageUrl, pageVisitTime) { 13280 var properties = { PageName: pageName, PageUrl: pageUrl }; 13281 _self.trackMetric({ 13282 name: "PageVisitTime", 13283 average: pageVisitTime, 13284 max: pageVisitTime, 13285 min: pageVisitTime, 13286 sampleCount: 1 13287 }, properties); 13288 } 13289 function _addDefaultTelemetryInitializers() { 13290 if (!_browserLinkInitializerAdded && _isBrowserLinkTrackingEnabled) { 13291 var browserLinkPaths_1 = ["/browserLinkSignalR/", "/__browserLink/"]; 13292 var dropBrowserLinkRequests = function(envelope) { 13293 if (_isBrowserLinkTrackingEnabled && envelope.baseType === RemoteDependencyData[ 13294 _DYN_DATA_TYPE$1 13295 /* @min:%2edataType */ 13296 ]) { 13297 var remoteData = envelope.baseData; 13298 if (remoteData) { 13299 for (var i2 = 0; i2 < browserLinkPaths_1[ 13300 _DYN_LENGTH$2 13301 /* @min:%2elength */ 13302 ]; i2++) { 13303 if (remoteData.target && strIndexOf(remoteData.target, browserLinkPaths_1[i2]) >= 0) { 13304 return false; 13305 } 13306 } 13307 } 13308 } 13309 return true; 13310 }; 13311 _self[ 13312 _DYN__ADD_HOOK$1 13313 /* @min:%2e_addHook */ 13314 ](_self[ 13315 _DYN_ADD_TELEMETRY_INITIA7 13316 /* @min:%2eaddTelemetryInitializer */ 13317 ](dropBrowserLinkRequests)); 13318 _browserLinkInitializerAdded = true; 13319 } 13320 } 13321 function _sendCORSException(exception, properties) { 13322 var telemetryItem = createTelemetryItem(exception, Exception[ 13323 _DYN_DATA_TYPE$1 13324 /* @min:%2edataType */ 13325 ], Exception[ 13326 _DYN_ENVELOPE_TYPE$1 13327 /* @min:%2eenvelopeType */ 13328 ], _self[ 13329 _DYN_DIAG_LOG$1 13330 /* @min:%2ediagLog */ 13331 ](), properties); 13332 _self[ 13333 _DYN_CORE$1 13334 /* @min:%2ecore */ 13335 ][ 13336 _DYN_TRACK 13337 /* @min:%2etrack */ 13338 ](telemetryItem); 13339 } 13340 function _updateExceptionTracking() { 13341 var _window = getWindow(); 13342 var locn = getLocation(true); 13343 _self[ 13344 _DYN__ADD_HOOK$1 13345 /* @min:%2e_addHook */ 13346 ](onConfigChange(_extConfig, function() { 13347 _disableExceptionTracking = _extConfig.disableExceptionTracking; 13348 if (!_disableExceptionTracking && !_autoExceptionInstrumented && !_extConfig[ 13349 _DYN_AUTO_EXCEPTION_INSTR9 13350 /* @min:%2eautoExceptionInstrumented */ 13351 ]) { 13352 _addHook(InstrumentEvent(_window, "onerror", { 13353 ns: _evtNamespace, 13354 rsp: function(callDetails, message, url, lineNumber,
vendor: 1,092 bytes, lines 13354-13380
13354columnNumber, error) { 13355 if (!_disableExceptionTracking && callDetails.rslt !== true) { 13356 _self._onerror(Exception[ 13357 _DYN__CREATE_AUTO_EXCEPTI6 13358 /* @min:%2eCreateAutoException */ 13359 ](message, url, lineNumber, columnNumber, error, callDetails.evt)); 13360 } 13361 } 13362 }, false)); 13363 _errorHookCnt++; 13364 _autoExceptionInstrumented = true; 13365 } 13366 })); 13367 _addUnhandledPromiseRejectionTracking(_window, locn); 13368 } 13369 function _updateLocationChange() { 13370 var win = getWindow(); 13371 var locn = getLocation(true); 13372 _self[ 13373 _DYN__ADD_HOOK$1 13374 /* @min:%2e_addHook */ 13375 ](onConfigChange(_extConfig, function() { 13376 _enableAutoRouteTracking = _extConfig[ 13377 _DYN_ENABLE_AUTO_ROUTE_TR12 13378 /* @min:%2eenableAutoRouteTracking */ 13379 ] === true; 13380 if (win && _enableAutoRouteTracking && !_historyListenerAdded && /* @__P
13380URE__ */ hasHistory()) { 13381 var _history = getHistory(); 13382 if (isFunction(_history.pushState) && isFunction(_history.replaceState) && typeof Event !== strShimUndefined) { 13383 _addHistoryListener(win, _history, locn); 13384 } 13385 } 13386 })); 13387 } 13388 function _getDistributedTraceCtx() { 13389 var distributedTraceCtx = null; 13390 if (_self[ 13391 _DYN_CORE$1 13392 /* @min:%2ecore */ 13393 ] && _self[ 13394 _DYN_CORE$1 13395 /* @min:%2ecore */ 13396 ].getTraceCtx) { 13397 distributedTraceCtx = _self[ 13398 _DYN_CORE$1 13399 /* @min:%2ecore */ 13400 ].getTraceCtx(false); 13401 } 13402 if (!distributedTraceCtx) { 13403 var properties = _self[ 13404 _DYN_CORE$1 13405 /* @min:%2ecore */ 13406 ].getPlugin(PropertiesPluginIdentifier); 13407 if (properties) { 13408 var context = properties.plugin.context; 13409 if (context) { 13410 distributedTraceCtx = createDistributedTraceContextFromTrace(context.telemetryTrace); 13411 } 13412 } 13413 } 13414 return distributedTraceCtx; 13415 } 13416 function _addHistoryListener(win, history, locn) { 13417 if (_historyListenerAdded) { 13418 return; 13419 } 13420 var namePrefix = _extConfig.namePrefix || ""; 13421 function _popstateHandler() { 13422 if (_enableAutoRouteTracking) { 13423 _dispatchEvent(win, createDomEvent(namePrefix + "locationchange")); 13424 } 13425 } 13426 function _locationChangeHandler() { 13427 if (_currUri) { 13428 _prevUri = _currUri; 13429 _currUri = locn && locn[ 13430 _DYN_HREF 13431 /* @min:%2ehref */ 13432 ] || ""; 13433 } else { 13434 _currUri = locn && locn[ 13435 _DYN_HREF 13436 /* @min:%2ehref */ 13437 ] || ""; 13438 } 13439 if (_enableAutoRouteTracking) { 13440 var distributedTraceCtx = _getDistributedTraceCtx(); 13441 if (distributedTraceCtx) { 13442 distributedTraceCtx.setTraceId(generateW3CId()); 13443 var traceLocationName = "_unknown_"; 13444 if (locn && locn.pathname) { 13445 traceLocationName = locn.pathname + (locn.hash || ""); 13446 } 13447 distributedTraceCtx.setName(dataSanitizeString(_self[ 13448 _DYN_DIAG_LOG$1 13449 /* @min:%2ediagLog */ 13450 ](), traceLocationName)); 13451 } 13452 scheduleTimeout((function(uri) { 13453 _self[ 13454 _DYN_TRACK_PAGE_VIEW 13455 /* @min:%2etrackPageView */ 13456 ]({ refUri: uri, properties: { duration: 0 } }); 13457 }).bind(_self, _prevUri), _self.autoRoutePVDelay); 13458 } 13459 } 13460 _addHook(InstrumentEvent(history, "pushState", { 13461 ns: _evtNamespace, 13462 rsp: function() { 13463 if (_enableAutoRouteTracking) { 13464 _dispatchEvent(win, createDomEvent(namePrefix + "pushState")); 13465 _dispatchEvent(win, createDomEvent(namePrefix + "locationchange")); 13466 } 13467 } 13468 }, true)); 13469 _addHook(InstrumentEvent(history, "replaceState", { 13470 ns: _evtNamespace, 13471 rsp: function() { 13472 if (_enableAutoRouteTracking) { 13473 _dispatchEvent(win, createDomEvent(namePrefix + "replaceState")); 13474 _dispatchEvent(win, createDomEvent(namePrefix + "locationchange")); 13475 } 13476 } 13477 }, true)); 13478 eventOn(win, namePrefix + "popstate", _popstateHandler, _evtNamespace); 13479 eventOn(win, namePrefix + "locationchange", _locationChangeHandler, _evtNamespace); 13480 _historyListenerAdded = true; 13481 } 13482 function _addUnhandledPromiseRejectionTracking(_window, _location) { 13483 _self[ 13484 _DYN__ADD_HOOK$1 13485 /* @min:%2e_addHook */ 13486 ](onConfigChange(_extConfig, function() { 13487 _enableUnhandledPromiseRejectionTracking = _extConfig[ 13488 _DYN_ENABLE_UNHANDLED_PRO13 13489 /* @min:%2eenableUnhandledPromiseRejectionTracking */ 13490 ] === true; 13491 _autoExceptionInstrumented = _autoExceptionInstrumented || _extConfig[ 13492 _DYN_AUTO_UNHANDLED_PROMI14 13493 /* @min:%2eautoUnhandledPromiseInstrumented */ 13494 ]; 13495 if (_enableUnhandledPromiseRejectionTracking && !_autoUnhandledPromiseInstrumented) { 13496 _addHook(InstrumentEvent(_window, "onunhandledrejection", { 13497 ns: _evtNamespace, 13498 rsp: function(callDetails, error) { 13499 if (_enableUnhandledPromiseRejectionTracking && callDetails.rslt !== true) {
vendor: 50,605 bytes, lines 13500-15012
13500 _self._onerror(Exception[ 13501 _DYN__CREATE_AUTO_EXCEPTI6 13502 /* @min:%2eCreateAutoException */ 13503 ](_getReason(error), _location ? _location[ 13504 _DYN_HREF 13505 /* @min:%2ehref */ 13506 ] : "", 0, 0, error, callDetails.evt)); 13507 } 13508 } 13509 }, false)); 13510 _errorHookCnt++; 13511 _extConfig[ 13512 _DYN_AUTO_UNHANDLED_PROMI14 13513 /* @min:%2eautoUnhandledPromiseInstrumented */ 13514 ] = _autoUnhandledPromiseInstrumented = true; 13515 } 13516 })); 13517 } 13518 function _throwInternal2(severity, msgId, msg, properties, isUserAct) { 13519 _self[ 13520 _DYN_DIAG_LOG$1 13521 /* @min:%2ediagLog */ 13522 ]().throwInternal(severity, msgId, msg, properties, isUserAct); 13523 } 13524 function _initDefaults() { 13525 _eventTracking = null; 13526 _pageTracking = null; 13527 _pageViewManager = null; 13528 _pageViewPerformanceManager = null; 13529 _pageVisitTimeManager = null; 13530 _preInitTelemetryInitializers = null; 13531 _isBrowserLinkTrackingEnabled = false; 13532 _browserLinkInitializerAdded = false; 13533 _enableAutoRouteTracking = false; 13534 _historyListenerAdded = false; 13535 _disableExceptionTracking = false; 13536 _autoExceptionInstrumented = false; 13537 _enableUnhandledPromiseRejectionTracking = false; 13538 _autoUnhandledPromiseInstrumented = false; 13539 _autoTrackPageVisitTime = false; 13540 var location2 = getLocation(true); 13541 _prevUri = location2 && location2[ 13542 _DYN_HREF 13543 /* @min:%2ehref */ 13544 ] || ""; 13545 _currUri = null; 13546 _evtNamespace = null; 13547 _extConfig = null; 13548 _errorHookCnt = 0; 13549 objDefine(_self, "config", { 13550 g: function() { 13551 return _extConfig; 13552 } 13553 }); 13554 } 13555 objDefine(_self, "_pageViewManager", { g: function() { 13556 return _pageViewManager; 13557 } }); 13558 objDefine(_self, "_pageViewPerformanceManager", { g: function() { 13559 return _pageViewPerformanceManager; 13560 } }); 13561 objDefine(_self, "_pageVisitTimeManager", { g: function() { 13562 return _pageVisitTimeManager; 13563 } }); 13564 objDefine(_self, "_evtNamespace", { g: function() { 13565 return "." + _evtNamespace; 13566 } }); 13567 }); 13568 return _this; 13569 } 13570 AnalyticsPlugin2.Version = "3.3.8"; 13571 return AnalyticsPlugin2; 13572 }(BaseTelemetryPlugin) 13573); 13574var _DYN_FEATURE_OPT_IN = "featureOptIn"; 13575var _DYN_SCHEDULE_FETCH_TIMEO0 = "scheduleFetchTimeout"; 13576function replaceByNonOverrideCfg(cfg, nonOverrideConfigs, curLevel, maxLevel) { 13577 try { 13578 var exceedMaxLevel = curLevel > maxLevel; 13579 if (exceedMaxLevel) { 13580 cfg = null; 13581 } 13582 var curCfg_1 = curLevel == 0 ? objExtend$1({}, cfg) : cfg; 13583 if (curCfg_1 && nonOverrideConfigs && !exceedMaxLevel) { 13584 objForEachKey(curCfg_1, function(key) { 13585 var nonOverrideVal = nonOverrideConfigs[key]; 13586 if (!!nonOverrideVal) { 13587 if (/* @__PURE__ */ isObject(curCfg_1[key]) && /* @__PURE__ */ isObject(nonOverrideVal)) { 13588 curCfg_1[key] = replaceByNonOverrideCfg(curCfg_1[key], nonOverrideVal, ++curLevel, maxLevel); 13589 } else { 13590 delete curCfg_1[key]; 13591 } 13592 } 13593 }); 13594 } 13595 return curCfg_1; 13596 } catch (e) { 13597 } 13598 return cfg; 13599} 13600var F = "featureOptIn."; 13601var M = ".mode"; 13602var ON = ".onCfg"; 13603var OFF = ".offCfg"; 13604function resolveCdnFeatureCfg(field, cdnCfg, userOptInDetails) { 13605 var _a2; 13606 if (!cdnCfg || !cdnCfg.enabled) { 13607 return null; 13608 } 13609 var cdnFt = (cdnCfg[ 13610 _DYN_FEATURE_OPT_IN 13611 /* @min:%2efeatureOptIn */ 13612 ] || {})[field] || { 13613 mode: 1 13614 /* CdnFeatureMode.none */ 13615 }; 13616 var cdnM = cdnFt.mode; 13617 var cdnOnV = cdnFt.onCfg; 13618 var cdnOffV = cdnFt.offCfg; 13619 var userFt = (userOptInDetails || {})[field] || { 13620 mode: 2 13621 /* FeatureOptInMode.disable */ 13622 }; 13623 var userM = userFt.mode; 13624 var userOnV = userFt.onCfg; 13625 var userOffV = userFt.offCfg; 13626 var blockCdn = !!userFt.blockCdnCfg; 13627 var mFld = F + field + M; 13628 var onFld = F + field + ON; 13629 var offFld = F + field + OFF; 13630 var mode = userM; 13631 var onV = userOnV; 13632 var offV = userOffV; 13633 if (!blockCdn) { 13634 if (cdnM === 4 || cdnM === 5) { 13635 mode = cdnM == 4 ? 3 : 2; 13636 onV = cdnOnV || userOnV; 13637 offV = cdnOffV || userOffV; 13638 } else if (cdnM === 2 || userM === 2) { 13639 mode = 2; 13640 onV = userOnV || cdnOnV; 13641 offV = userOffV || cdnOffV; 13642 } else if (cdnM === 3) { 13643 mode = 3; 13644 onV = userOnV || cdnOnV; 13645 offV = userOffV || cdnOffV; 13646 } else if (cdnM === 1 && userM === 1) { 13647 mode = 1; 13648 } 13649 } 13650 return _a2 = {}, _a2[mFld] = mode, _a2[onFld] = onV, _a2[offFld] = offV, _a2; 13651} 13652function applyCdnfeatureCfg(cdnCfg, core) { 13653 try { 13654 if (!cdnCfg || !cdnCfg.enabled) { 13655 return null; 13656 } 13657 if (!cdnCfg[ 13658 _DYN_FEATURE_OPT_IN 13659 /* @min:%2efeatureOptIn */ 13660 ]) { 13661 return cdnCfg.config; 13662 } 13663 var optInMap = cdnCfg[ 13664 _DYN_FEATURE_OPT_IN 13665 /* @min:%2efeatureOptIn */ 13666 ]; 13667 var cdnConfig_1 = cdnCfg.config || {}; 13668 objForEachKey(optInMap, function(key) { 13669 var featureVal = resolveCdnFeatureCfg(key, cdnCfg, core.config[ 13670 _DYN_FEATURE_OPT_IN 13671 /* @min:%2efeatureOptIn */ 13672 ]); 13673 if (!/* @__PURE__ */ isNullOrUndefined(featureVal)) { 13674 objForEachKey(featureVal, function(config, val) { 13675 setValueByKey(cdnConfig_1, config, val); 13676 }); 13677 _overrideCdnCfgByFeature(key, featureVal, cdnConfig_1); 13678 } 13679 }); 13680 return cdnConfig_1; 13681 } catch (e) { 13682 } 13683 return null; 13684} 13685function _overrideCdnCfgByFeature(field, ftVal, config) { 13686 var mode = ftVal[F + field + M]; 13687 var val = ftVal[F + field + ON]; 13688 var dVal = ftVal[F + field + OFF]; 13689 var target = null; 13690 if (mode === 3) { 13691 target = val; 13692 } 13693 if (mode === 2) { 13694 target = dVal; 13695 } 13696 if (target) { 13697 objForEachKey(target, function(key, cfg) { 13698 setValueByKey(config, key, cfg); 13699 }); 13700 } 13701} 13702var _a$4; 13703var EVENT_NAME = "ai_cfgsync"; 13704var STR_GET_METHOD = "GET"; 13705var FETCH_TIMEOUT = 18e5; 13706var udfVal = void 0; 13707var defaultNonOverrideCfg = { instrumentationKey: true, connectionString: true, endpointUrl: true }; 13708var _defaultConfig$2 = objDeepFreeze((_a$4 = { 13709 syncMode: 1, 13710 blkCdnCfg: udfVal, 13711 customEvtName: udfVal, 13712 cfgUrl: udfVal, 13713 overrideSyncFn: udfVal, 13714 overrideFetchFn: udfVal, 13715 onCfgChangeReceive: udfVal 13716}, _a$4[ 13717 _DYN_SCHEDULE_FETCH_TIMEO0 13718 /* @min:scheduleFetchTimeout */ 13719] = FETCH_TIMEOUT, _a$4.nonOverrideConfigs = defaultNonOverrideCfg, _a$4.enableAjax = false, _a$4)); 13720var CfgSyncPlugin = ( 13721 /** @class */ 13722 function(_super) { 13723 __extendsFn(CfgSyncPlugin2, _super); 13724 function CfgSyncPlugin2() { 13725 var _this = _super.call(this) || this; 13726 _this.priority = 198; 13727 _this.identifier = "AppInsightsCfgSyncPlugin"; 13728 var _extensionConfig; 13729 var _mainConfig; 13730 var _evtName; 13731 var _evtNamespace; 13732 var _cfgUrl; 13733 var _timeoutHandle; 13734 var _receiveChanges; 13735 var _broadcastChanges; 13736 var _blkCdnCfg; 13737 var _fetchTimeout; 13738 var _retryCnt; 13739 var _onCfgChangeReceive; 13740 var _nonOverrideConfigs; 13741 var _fetchFn; 13742 var _overrideFetchFn; 13743 var _overrideSyncFn; 13744 var _paused = false; 13745 var _enableAjax; 13746 dynamicProto(CfgSyncPlugin2, _this, function(_self, _base) { 13747 _initDefaults(); 13748 _self.initialize = function(config, core, extensions, pluginChain) { 13749 _base.initialize(config, core, extensions, pluginChain); 13750 _evtNamespace = mergeEvtNamespace(createUniqueNamespace(_self.identifier), core.evtNamespace && core.evtNamespace()); 13751 _populateDefaults(config); 13752 }; 13753 _self.getCfg = function() { 13754 return _mainConfig; 13755 }; 13756 _self.pause = function() { 13757 _paused = true; 13758 _clearScheduledTimer(); 13759 }; 13760 _self.resume = function() { 13761 _paused = false; 13762 _setupTimer(); 13763 }; 13764 _self.setCfg = function(config) { 13765 return _setCfg(config); 13766 }; 13767 _self.sync = function(customDetails) { 13768 return _sendCfgsyncEvents(customDetails); 13769 }; 13770 _self.updateEventListenerName = function(eventName) { 13771 return _updateEventListenerName(eventName); 13772 }; 13773 _self._doTeardown = function(unloadCtx, unloadState) { 13774 _eventOff(); 13775 _clearScheduledTimer(); 13776 _initDefaults(); 13777 }; 13778 _self["_getDbgPlgTargets"] = function() { 13779 return [_broadcastChanges, _receiveChanges, _evtName, _blkCdnCfg, _nonOverrideConfigs]; 13780 }; 13781 function _initDefaults() { 13782 _mainConfig = null; 13783 _evtName = null; 13784 _evtNamespace = null; 13785 _cfgUrl = null; 13786 _receiveChanges = null; 13787 _broadcastChanges = null; 13788 _nonOverrideConfigs = null; 13789 _timeoutHandle = null; 13790 _fetchTimeout = null; 13791 _retryCnt = null; 13792 _blkCdnCfg = null; 13793 _enableAjax = false; 13794 _overrideFetchFn = null; 13795 _overrideSyncFn = null; 13796 _onCfgChangeReceive = null; 13797 } 13798 function _populateDefaults(config) { 13799 var identifier = _self.identifier; 13800 var core = _self.core; 13801 _self._addHook(onConfigChange(config, function() { 13802 var ctx = createProcessTelemetryContext(null, config, core); 13803 _extensionConfig = ctx.getExtCfg(identifier, _defaultConfig$2); 13804 var preBlkCdn = _blkCdnCfg; 13805 _blkCdnCfg = !!_extensionConfig.blkCdnCfg; 13806 _enableAjax = !!_extensionConfig.enableAjax; 13807 if (!/* @__PURE__ */ isNullOrUndefined(preBlkCdn) && preBlkCdn !== _blkCdnCfg) { 13808 if (!_blkCdnCfg && _cfgUrl) { 13809 _fetchFn && _fetchFn(_cfgUrl, _onFetchComplete, _broadcastChanges); 13810 } else { 13811 _clearScheduledTimer(); 13812 } 13813 } 13814 if (/* @__PURE__ */ isNullOrUndefined(_receiveChanges)) { 13815 _receiveChanges = _extensionConfig.syncMode === 2; 13816 } 13817 if (/* @__PURE__ */ isNullOrUndefined(_broadcastChanges)) { 13818 _broadcastChanges = _extensionConfig.syncMode === 1; 13819 } 13820 var newEvtName = _extensionConfig.customEvtName || EVENT_NAME; 13821 if (_evtName !== newEvtName) { 13822 if (_receiveChanges) { 13823 _updateEventListenerName(newEvtName); 13824 } else { 13825 _eventOff(); 13826 _evtName = newEvtName; 13827 } 13828 } 13829 if (/* @__PURE__ */ isNullOrUndefined(_cfgUrl)) { 13830 _cfgUrl = _extensionConfig.cfgUrl; 13831 } 13832 if (!_cfgUrl) { 13833 _mainConfig = config; 13834 if (_broadcastChanges) { 13835 _sendCfgsyncEvents(); 13836 } 13837 } 13838 })); 13839 _overrideSyncFn = _extensionConfig.overrideSyncFn; 13840 _overrideFetchFn = _extensionConfig.overrideFetchFn; 13841 _onCfgChangeReceive = _extensionConfig.onCfgChangeReceive; 13842 _nonOverrideConfigs = _extensionConfig.nonOverrideConfigs; 13843 _fetchTimeout = _extensionConfig[ 13844 _DYN_SCHEDULE_FETCH_TIMEO0 13845 /* @min:%2escheduleFetchTimeout */ 13846 ]; 13847 _fetchFn = _getFetchFnInterface(); 13848 _retryCnt = 0; 13849 if (_cfgUrl && !_blkCdnCfg) { 13850 _fetchFn && _fetchFn(_cfgUrl, _onFetchComplete, _broadcastChanges); 13851 } 13852 } 13853 function _setCfg(config, isAutoSync) { 13854 if (config) { 13855 _mainConfig = config; 13856 if (!!isAutoSync && !_paused) { 13857 return _sendCfgsyncEvents(); 13858 } 13859 if (_receiveChanges && !_paused) { 13860 _self.core.updateCfg(config); 13861 return true; 13862 } 13863 } 13864 return false; 13865 } 13866 function _eventOff() { 13867 try { 13868 var global_1 = getGlobal(); 13869 if (global_1) { 13870 eventOff(global_1, null, null, _evtNamespace); 13871 } 13872 } catch (e) { 13873 } 13874 } 13875 function _sendCfgsyncEvents(customDetails) { 13876 try { 13877 if (!!_overrideSyncFn && isFunction(_overrideSyncFn)) { 13878 return _overrideSyncFn(_mainConfig, customDetails); 13879 } 13880 return sendCustomEvent(_evtName, _mainConfig, customDetails); 13881 } catch (e) { 13882 } 13883 return false; 13884 } 13885 function _updateEventListenerName(name) { 13886 try { 13887 _eventOff(); 13888 if (name) { 13889 _evtName = name; 13890 _addEventListener(); 13891 } 13892 return true; 13893 } catch (e) { 13894 } 13895 return false; 13896 } 13897 function _getFetchFnInterface() { 13898 var _fetchFn2 = _overrideFetchFn; 13899 if (/* @__PURE__ */ isNullOrUndefined(_fetchFn2)) { 13900 if (isFetchSupported()) { 13901 _fetchFn2 = _fetchSender; 13902 } else if (isXhrSupported()) { 13903 _fetchFn2 = _xhrSender; 13904 } 13905 } 13906 return _fetchFn2; 13907 } 13908 function _fetchSender(url, oncomplete, isAutoSync) { 13909 var global2 = getGlobal(); 13910 var fetchFn = global2 && global2.fetch || null; 13911 if (url && fetchFn && isFunction(fetchFn)) { 13912 try { 13913 var init = { 13914 method: STR_GET_METHOD 13915 }; 13916 if (!_enableAjax) { 13917 init[DisabledPropertyName] = true; 13918 } 13919 var request = new Request(url, init); 13920 if (!_enableAjax) { 13921 try { 13922 request[DisabledPropertyName] = true; 13923 } catch (e) { 13924 } 13925 } 13926 doAwaitResponse(fetch(request), function(result) { 13927 var response = result.value; 13928 if (!result.rejected) { 13929 if (response.ok) { 13930 doAwaitResponse(response.text(), function(res) { 13931 _doOnComplete(oncomplete, response.status, res.value, isAutoSync); 13932 }); 13933 } else { 13934 _doOnComplete(oncomplete, response.status, null, isAutoSync); 13935 } 13936 } else { 13937 _doOnComplete(oncomplete, 400); 13938 } 13939 }); 13940 } catch (e) { 13941 } 13942 } 13943 } 13944 function _xhrSender(url, oncomplete, isAutoSync) { 13945 try { 13946 var xhr_1 = new XMLHttpRequest(); 13947 if (!_enableAjax) { 13948 xhr_1[DisabledPropertyName] = true; 13949 } 13950 xhr_1.open(STR_GET_METHOD, url); 13951 xhr_1.onreadystatechange = function() { 13952 if (xhr_1.readyState === XMLHttpRequest.DONE) { 13953 _doOnComplete(oncomplete, xhr_1.status, xhr_1.responseText, isAutoSync); 13954 } 13955 }; 13956 xhr_1.onerror = function() { 13957 _doOnComplete(oncomplete, 400); 13958 }; 13959 xhr_1.ontimeout = function() { 13960 _doOnComplete(oncomplete, 400); 13961 }; 13962 xhr_1.send(); 13963 } catch (e) { 13964 } 13965 } 13966 function _onFetchComplete(status, response, isAutoSync) { 13967 try { 13968 if (status >= 200 && status < 400 && response) { 13969 _retryCnt = 0; 13970 var JSON_1 = getJSON(); 13971 if (JSON_1) { 13972 var cdnCfg = JSON_1.parse(response); 13973 var cfg = applyCdnfeatureCfg(cdnCfg, _self.core); 13974 var newCfg = cfg && /* @__PURE__ */ isPlainObject(cfg) && _replaceTartgetByKeys(cfg); 13975 newCfg && _setCfg(newCfg, isAutoSync); 13976 } 13977 } else { 13978 _retryCnt++; 13979 } 13980 if (_retryCnt < 3) { 13981 _setupTimer(); 13982 } 13983 } catch (e) { 13984 } 13985 } 13986 function _doOnComplete(oncomplete, status, response, isAutoSync) { 13987 try { 13988 oncomplete(status, response, isAutoSync); 13989 } catch (e) { 13990 } 13991 } 13992 function _addEventListener() { 13993 if (_receiveChanges) { 13994 var global_2 = getGlobal(); 13995 if (global_2) { 13996 try { 13997 eventOn(global_2, _evtName, function(event) { 13998 var cfgEvent = event && event.detail; 13999 if (_onCfgChangeReceive && cfgEvent) { 14000 _onCfgChangeReceive(cfgEvent); 14001 } else { 14002 var cfg = cfgEvent && cfgEvent.cfg; 14003 var newCfg = cfg && /* @__PURE__ */ isPlainObject(cfg) && _replaceTartgetByKeys(cfg); 14004 newCfg && _setCfg(newCfg); 14005 } 14006 }, _evtNamespace, true); 14007 } catch (e) { 14008 } 14009 } 14010 } 14011 } 14012 function _replaceTartgetByKeys(cfg, level) { 14013 var _cfg = null; 14014 try { 14015 if (cfg) { 14016 _cfg = replaceByNonOverrideCfg(cfg, _nonOverrideConfigs, 0, 5); 14017 } 14018 } catch (e) { 14019 } 14020 return _cfg; 14021 } 14022 function _setupTimer() { 14023 if (!_timeoutHandle && _fetchTimeout) { 14024 _timeoutHandle = scheduleTimeout(function() { 14025 _timeoutHandle = null; 14026 _fetchFn(_cfgUrl, _onFetchComplete, _broadcastChanges); 14027 }, _fetchTimeout); 14028 _timeoutHandle.unref(); 14029 } 14030 } 14031 function _clearScheduledTimer() { 14032 _timeoutHandle && _timeoutHandle.cancel(); 14033 _timeoutHandle = null; 14034 _retryCnt = 0; 14035 } 14036 _self.processTelemetry = function(env, itemCtx) { 14037 _self.processNext(env, itemCtx); 14038 }; 14039 }); 14040 return _this; 14041 } 14042 CfgSyncPlugin2.__ieDyn = 1; 14043 return CfgSyncPlugin2; 14044 }(BaseTelemetryPlugin) 14045); 14046var STR_DURATION$1 = "duration"; 14047var _DYN_TAGS = "tags"; 14048var _DYN_DEVICE_TYPE = "deviceType"; 14049var _DYN_DATA = "data"; 14050var _DYN_NAME = "name"; 14051var _DYN_TRACE_ID$1 = "traceID"; 14052var _DYN_LENGTH$1 = "length"; 14053var _DYN_STRINGIFY = "stringify"; 14054var _DYN_MEASUREMENTS = "measurements"; 14055var _DYN_DATA_TYPE = "dataType"; 14056var _DYN_ENVELOPE_TYPE = "envelopeType"; 14057var _DYN_TO_STRING = "toString"; 14058var _DYN_ENQUEUE = "enqueue"; 14059var _DYN_COUNT = "count"; 14060var _DYN_PUSH = "push"; 14061var _DYN_EMIT_LINE_DELIMITED_0 = "emitLineDelimitedJson"; 14062var _DYN_CLEAR = "clear"; 14063var _DYN_MARK_AS_SENT = "markAsSent"; 14064var _DYN_CLEAR_SENT = "clearSent"; 14065var _DYN_BUFFER_OVERRIDE = "bufferOverride"; 14066var _DYN__BUFFER__KEY = "BUFFER_KEY"; 14067var _DYN__SENT__BUFFER__KEY = "SENT_BUFFER_KEY"; 14068var _DYN_CONCAT = "concat"; 14069var _DYN__MAX__BUFFER__SIZE = "MAX_BUFFER_SIZE"; 14070var _DYN_TRIGGER_SEND = "triggerSend"; 14071var _DYN_DIAG_LOG = "diagLog"; 14072var _DYN_INITIALIZE = "initialize"; 14073var _DYN__SENDER = "_sender"; 14074var _DYN_ENDPOINT_URL$1 = "endpointUrl"; 14075var _DYN_INSTRUMENTATION_KEY$1 = "instrumentationKey"; 14076var _DYN_CUSTOM_HEADERS = "customHeaders"; 14077var _DYN_MAX_BATCH_SIZE_IN_BY1 = "maxBatchSizeInBytes"; 14078var _DYN_ONUNLOAD_DISABLE_BEA2 = "onunloadDisableBeacon"; 14079var _DYN_IS_BEACON_API_DISABL3 = "isBeaconApiDisabled"; 14080var _DYN_ALWAYS_USE_XHR_OVERR4 = "alwaysUseXhrOverride"; 14081var _DYN_ENABLE_SESSION_STORA5 = "enableSessionStorageBuffer"; 14082var _DYN__BUFFER = "_buffer"; 14083var _DYN_ONUNLOAD_DISABLE_FET6 = "onunloadDisableFetch"; 14084var _DYN_DISABLE_SEND_BEACON_7 = "disableSendBeaconSplit"; 14085var _DYN_GET_SENDER_INST = "getSenderInst"; 14086var _DYN__ON_ERROR = "_onError"; 14087var _DYN__ON_PARTIAL_SUCCESS = "_onPartialSuccess"; 14088var _DYN__ON_SUCCESS = "_onSuccess"; 14089var _DYN_ITEMS_RECEIVED = "itemsReceived"; 14090var _DYN_ITEMS_ACCEPTED = "itemsAccepted"; 14091var _DYN_BASE_TYPE = "baseType"; 14092var _DYN_SAMPLE_RATE = "sampleRate"; 14093var _DYN_GET_HASH_CODE_SCORE = "getHashCodeScore"; 14094var strBaseType = "baseType"; 14095var strBaseData = "baseData"; 14096var strProperties = "properties"; 14097var strTrue = "true"; 14098function _setValueIf(target, field, value) { 14099 return setValue(target, field, value, isTruthy); 14100} 14101function _extractPartAExtensions(logger, item, env) { 14102 var envTags = env[ 14103 _DYN_TAGS 14104 /* @min:%2etags */ 14105 ] = env[ 14106 _DYN_TAGS 14107 /* @min:%2etags */ 14108 ] || {}; 14109 var itmExt = item.ext = item.ext || {}; 14110 var itmTags = item[ 14111 _DYN_TAGS 14112 /* @min:%2etags */ 14113 ] = item[ 14114 _DYN_TAGS 14115 /* @min:%2etags */ 14116 ] || []; 14117 var extUser = itmExt.user; 14118 if (extUser) { 14119 _setValueIf(envTags, CtxTagKeys.userAuthUserId, extUser.authId); 14120 _setValueIf(envTags, CtxTagKeys.userId, extUser.id || extUser.localId); 14121 } 14122 var extApp = itmExt.app; 14123 if (extApp) { 14124 _setValueIf(envTags, CtxTagKeys.sessionId, extApp.sesId); 14125 } 14126 var extDevice = itmExt.device; 14127 if (extDevice) { 14128 _setValueIf(envTags, CtxTagKeys.deviceId, extDevice.id || extDevice.localId); 14129 _setValueIf(envTags, CtxTagKeys[ 14130 _DYN_DEVICE_TYPE 14131 /* @min:%2edeviceType */ 14132 ], extDevice.deviceClass); 14133 _setValueIf(envTags, CtxTagKeys.deviceIp, extDevice.ip); 14134 _setValueIf(envTags, CtxTagKeys.deviceModel, extDevice.model); 14135 _setValueIf(envTags, CtxTagKeys[ 14136 _DYN_DEVICE_TYPE 14137 /* @min:%2edeviceType */ 14138 ], extDevice[ 14139 _DYN_DEVICE_TYPE 14140 /* @min:%2edeviceType */ 14141 ]); 14142 } 14143 var web = item.ext.web; 14144 if (web) { 14145 _setValueIf(envTags, CtxTagKeys.deviceLanguage, web.browserLang); 14146 _setValueIf(envTags, CtxTagKeys.deviceBrowserVersion, web.browserVer); 14147 _setValueIf(envTags, CtxTagKeys.deviceBrowser, web.browser); 14148 var envData = env[ 14149 _DYN_DATA 14150 /* @min:%2edata */ 14151 ] = env[ 14152 _DYN_DATA 14153 /* @min:%2edata */ 14154 ] || {}; 14155 var envBaseData = envData[strBaseData] = envData[strBaseData] || {}; 14156 var envProps = envBaseData[strProperties] = envBaseData[strProperties] || {}; 14157 _setValueIf(envProps, "domain", web.domain); 14158 _setValueIf(envProps, "isManual", web.isManual ? strTrue : null); 14159 _setValueIf(envProps, "screenRes", web.screenRes); 14160 _setValueIf(envProps, "userConsent", web.userConsent ? strTrue : null); 14161 } 14162 var extOs = itmExt.os; 14163 if (extOs) { 14164 _setValueIf(envTags, CtxTagKeys.deviceOS, extOs[ 14165 _DYN_NAME 14166 /* @min:%2ename */ 14167 ]); 14168 _setValueIf(envTags, CtxTagKeys.deviceOSVersion, extOs.osVer); 14169 } 14170 var extTrace = itmExt.trace; 14171 if (extTrace) { 14172 _setValueIf(envTags, CtxTagKeys.operationParentId, extTrace.parentID); 14173 _setValueIf(envTags, CtxTagKeys.operationName, dataSanitizeString(logger, extTrace[ 14174 _DYN_NAME 14175 /* @min:%2ename */ 14176 ])); 14177 _setValueIf(envTags, CtxTagKeys.operationId, extTrace[ 14178 _DYN_TRACE_ID$1 14179 /* @min:%2etraceID */ 14180 ]); 14181 } 14182 var tgs = {}; 14183 for (var i2 = itmTags[ 14184 _DYN_LENGTH$1 14185 /* @min:%2elength */ 14186 ] - 1; i2 >= 0; i2--) { 14187 var tg = itmTags[i2]; 14188 objForEachKey(tg, function(key, value) { 14189 tgs[key] = value; 14190 }); 14191 itmTags.splice(i2, 1); 14192 } 14193 objForEachKey(itmTags, function(tg2, value) { 14194 tgs[tg2] = value; 14195 }); 14196 var theTags = __assignFn(__assignFn({}, envTags), tgs); 14197 if (!theTags[CtxTagKeys.internalSdkVersion]) { 14198 theTags[CtxTagKeys.internalSdkVersion] = dataSanitizeString(logger, "javascript:".concat(EnvelopeCreator.Version), 64); 14199 } 14200 env[ 14201 _DYN_TAGS 14202 /* @min:%2etags */ 14203 ] = optimizeObject(theTags); 14204} 14205function _extractPropsAndMeasurements(data, properties, measurements) { 14206 if (!/* @__PURE__ */ isNullOrUndefined(data)) { 14207 objForEachKey(data, function(key, value) { 14208 if (isNumber(value)) { 14209 measurements[key] = value; 14210 } else if (isString(value)) { 14211 properties[key] = value; 14212 } else if (hasJSON()) { 14213 properties[key] = getJSON()[ 14214 _DYN_STRINGIFY 14215 /* @min:%2estringify */ 14216 ](value); 14217 } 14218 }); 14219 } 14220} 14221function _convertPropsUndefinedToCustomDefinedValue(properties, customUndefinedValue) { 14222 if (!/* @__PURE__ */ isNullOrUndefined(properties)) { 14223 objForEachKey(properties, function(key, value) { 14224 properties[key] = value || customUndefinedValue; 14225 }); 14226 } 14227} 14228function _createEnvelope(logger, envelopeType, telemetryItem, data) { 14229 var envelope = new Envelope(logger, data, envelopeType); 14230 _setValueIf(envelope, "sampleRate", telemetryItem[SampleRate]); 14231 if ((telemetryItem[strBaseData] || {}).startTime) { 14232 envelope.time = toISOString(telemetryItem[strBaseData].startTime); 14233 } 14234 envelope.iKey = telemetryItem.iKey; 14235 var iKeyNoDashes = telemetryItem.iKey.replace(/-/g, ""); 14236 envelope[ 14237 _DYN_NAME 14238 /* @min:%2ename */ 14239 ] = envelope[ 14240 _DYN_NAME 14241 /* @min:%2ename */ 14242 ].replace("{0}", iKeyNoDashes); 14243 _extractPartAExtensions(logger, telemetryItem, envelope); 14244 telemetryItem[ 14245 _DYN_TAGS 14246 /* @min:%2etags */ 14247 ] = telemetryItem[ 14248 _DYN_TAGS 14249 /* @min:%2etags */ 14250 ] || []; 14251 return optimizeObject(envelope); 14252} 14253function EnvelopeCreatorInit(logger, telemetryItem) { 14254 if (/* @__PURE__ */ isNullOrUndefined(telemetryItem[strBaseData])) { 14255 _throwInternal(logger, 1, 46, "telemetryItem.baseData cannot be null."); 14256 } 14257} 14258var EnvelopeCreator = { 14259 Version: "3.3.8" 14260}; 14261function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) { 14262 EnvelopeCreatorInit(logger, telemetryItem); 14263 var customMeasurements = telemetryItem[strBaseData][ 14264 _DYN_MEASUREMENTS 14265 /* @min:%2emeasurements */ 14266 ] || {}; 14267 var customProperties = telemetryItem[strBaseData][strProperties] || {}; 14268 _extractPropsAndMeasurements(telemetryItem[ 14269 _DYN_DATA 14270 /* @min:%2edata */ 14271 ], customProperties, customMeasurements); 14272 if (!/* @__PURE__ */ isNullOrUndefined(customUndefinedValue)) { 14273 _convertPropsUndefinedToCustomDefinedValue(customProperties, customUndefinedValue); 14274 } 14275 var bd = telemetryItem[strBaseData]; 14276 if (/* @__PURE__ */ isNullOrUndefined(bd)) { 14277 _warnToConsole(logger, "Invalid input for dependency data"); 14278 return null; 14279 } 14280 var method = bd[strProperties] && bd[strProperties][HttpMethod] ? bd[strProperties][HttpMethod] : "GET"; 14281 var remoteDepData = new RemoteDependencyData(logger, bd.id, bd.target, bd[ 14282 _DYN_NAME 14283 /* @min:%2ename */ 14284 ], bd[ 14285 STR_DURATION$1 14286 /* @min:%2eduration */ 14287 ], bd.success, bd.responseCode, method, bd.type, bd.correlationContext, customProperties, customMeasurements); 14288 var data = new Data(RemoteDependencyData[ 14289 _DYN_DATA_TYPE 14290 /* @min:%2edataType */ 14291 ], remoteDepData); 14292 return _createEnvelope(logger, RemoteDependencyData[ 14293 _DYN_ENVELOPE_TYPE 14294 /* @min:%2eenvelopeType */ 14295 ], telemetryItem, data); 14296} 14297function EventEnvelopeCreator(logger, telemetryItem, customUndefinedValue) { 14298 EnvelopeCreatorInit(logger, telemetryItem); 14299 var customProperties = {}; 14300 var customMeasurements = {}; 14301 if (telemetryItem[strBaseType] !== Event$1[ 14302 _DYN_DATA_TYPE 14303 /* @min:%2edataType */ 14304 ]) { 14305 customProperties["baseTypeSource"] = telemetryItem[strBaseType]; 14306 } 14307 if (telemetryItem[strBaseType] === Event$1[ 14308 _DYN_DATA_TYPE 14309 /* @min:%2edataType */ 14310 ]) { 14311 customProperties = telemetryItem[strBaseData][strProperties] || {}; 14312 customMeasurements = telemetryItem[strBaseData][ 14313 _DYN_MEASUREMENTS 14314 /* @min:%2emeasurements */ 14315 ] || {}; 14316 } else { 14317 if (telemetryItem[strBaseData]) { 14318 _extractPropsAndMeasurements(telemetryItem[strBaseData], customProperties, customMeasurements); 14319 } 14320 } 14321 _extractPropsAndMeasurements(telemetryItem[ 14322 _DYN_DATA 14323 /* @min:%2edata */ 14324 ], customProperties, customMeasurements); 14325 if (!/* @__PURE__ */ isNullOrUndefined(customUndefinedValue)) { 14326 _convertPropsUndefinedToCustomDefinedValue(customProperties, customUndefinedValue); 14327 } 14328 var eventName = telemetryItem[strBaseData][ 14329 _DYN_NAME 14330 /* @min:%2ename */ 14331 ]; 14332 var eventData = new Event$1(logger, eventName, customProperties, customMeasurements); 14333 var data = new Data(Event$1[ 14334 _DYN_DATA_TYPE 14335 /* @min:%2edataType */ 14336 ], eventData); 14337 return _createEnvelope(logger, Event$1[ 14338 _DYN_ENVELOPE_TYPE 14339 /* @min:%2eenvelopeType */ 14340 ], telemetryItem, data); 14341} 14342function ExceptionEnvelopeCreator(logger, telemetryItem, customUndefinedValue) { 14343 EnvelopeCreatorInit(logger, telemetryItem); 14344 var customMeasurements = telemetryItem[strBaseData][ 14345 _DYN_MEASUREMENTS 14346 /* @min:%2emeasurements */ 14347 ] || {}; 14348 var customProperties = telemetryItem[strBaseData][strProperties] || {}; 14349 _extractPropsAndMeasurements(telemetryItem[ 14350 _DYN_DATA 14351 /* @min:%2edata */ 14352 ], customProperties, customMeasurements); 14353 if (!/* @__PURE__ */ isNullOrUndefined(customUndefinedValue)) { 14354 _convertPropsUndefinedToCustomDefinedValue(customProperties, customUndefinedValue); 14355 } 14356 var bd = telemetryItem[strBaseData]; 14357 var exData = Exception.CreateFromInterface(logger, bd, customProperties, customMeasurements); 14358 var data = new Data(Exception[ 14359 _DYN_DATA_TYPE 14360 /* @min:%2edataType */ 14361 ], exData); 14362 return _createEnvelope(logger, Exception[ 14363 _DYN_ENVELOPE_TYPE 14364 /* @min:%2eenvelopeType */ 14365 ], telemetryItem, data); 14366} 14367function MetricEnvelopeCreator(logger, telemetryItem, customUndefinedValue) { 14368 EnvelopeCreatorInit(logger, telemetryItem); 14369 var baseData = telemetryItem[strBaseData]; 14370 var props = baseData[strProperties] || {}; 14371 var measurements = baseData[ 14372 _DYN_MEASUREMENTS 14373 /* @min:%2emeasurements */ 14374 ] || {}; 14375 _extractPropsAndMeasurements(telemetryItem[ 14376 _DYN_DATA 14377 /* @min:%2edata */ 14378 ], props, measurements); 14379 if (!/* @__PURE__ */ isNullOrUndefined(customUndefinedValue)) { 14380 _convertPropsUndefinedToCustomDefinedValue(props, customUndefinedValue); 14381 } 14382 var baseMetricData = new Metric(logger, baseData[ 14383 _DYN_NAME 14384 /* @min:%2ename */ 14385 ], baseData.average, baseData.sampleCount, baseData.min, baseData.max, baseData.stdDev, props, measurements); 14386 var data = new Data(Metric[ 14387 _DYN_DATA_TYPE 14388 /* @min:%2edataType */ 14389 ], baseMetricData); 14390 return _createEnvelope(logger, Metric[ 14391 _DYN_ENVELOPE_TYPE 14392 /* @min:%2eenvelopeType */ 14393 ], telemetryItem, data); 14394} 14395function PageViewEnvelopeCreator(logger, telemetryItem, customUndefinedValue) { 14396 EnvelopeCreatorInit(logger, telemetryItem); 14397 var duration; 14398 var baseData = telemetryItem[strBaseData]; 14399 if (!/* @__PURE__ */ isNullOrUndefined(baseData) && !/* @__PURE__ */ isNullOrUndefined(baseData[strProperties]) && !/* @__PURE__ */ isNullOrUndefined(baseData[strProperties][STR_DURATION$1])) { 14400 duration = baseData[strProperties][STR_DURATION$1]; 14401 delete baseData[strProperties][STR_DURATION$1]; 14402 } else if (!/* @__PURE__ */ isNullOrUndefined(telemetryItem[ 14403 _DYN_DATA 14404 /* @min:%2edata */ 14405 ]) && !/* @__PURE__ */ isNullOrUndefined(telemetryItem[ 14406 _DYN_DATA 14407 /* @min:%2edata */ 14408 ][STR_DURATION$1])) { 14409 duration = telemetryItem[ 14410 _DYN_DATA 14411 /* @min:%2edata */ 14412 ][STR_DURATION$1]; 14413 delete telemetryItem[ 14414 _DYN_DATA 14415 /* @min:%2edata */ 14416 ][STR_DURATION$1]; 14417 } 14418 var bd = telemetryItem[strBaseData]; 14419 var currentContextId; 14420 if (((telemetryItem.ext || {}).trace || {})[ 14421 _DYN_TRACE_ID$1 14422 /* @min:%2etraceID */ 14423 ]) { 14424 currentContextId = telemetryItem.ext.trace[ 14425 _DYN_TRACE_ID$1 14426 /* @min:%2etraceID */ 14427 ]; 14428 } 14429 var id = bd.id || currentContextId; 14430 var name = bd[ 14431 _DYN_NAME 14432 /* @min:%2ename */ 14433 ]; 14434 var url = bd.uri; 14435 var properties = bd[strProperties] || {}; 14436 var measurements = bd[ 14437 _DYN_MEASUREMENTS 14438 /* @min:%2emeasurements */ 14439 ] || {}; 14440 if (!/* @__PURE__ */ isNullOrUndefined(bd.refUri)) { 14441 properties["refUri"] = bd.refUri; 14442 } 14443 if (!/* @__PURE__ */ isNullOrUndefined(bd.pageType)) { 14444 properties["pageType"] = bd.pageType; 14445 } 14446 if (!/* @__PURE__ */ isNullOrUndefined(bd.isLoggedIn)) { 14447 properties["isLoggedIn"] = bd.isLoggedIn[ 14448 _DYN_TO_STRING 14449 /* @min:%2etoString */ 14450 ](); 14451 } 14452 if (!/* @__PURE__ */ isNullOrUndefined(bd[strProperties])) { 14453 var pageTags = bd[strProperties]; 14454 objForEachKey(pageTags, function(key, value) { 14455 properties[key] = value; 14456 }); 14457 } 14458 _extractPropsAndMeasurements(telemetryItem[ 14459 _DYN_DATA 14460 /* @min:%2edata */ 14461 ], properties, measurements); 14462 if (!/* @__PURE__ */ isNullOrUndefined(customUndefinedValue)) { 14463 _convertPropsUndefinedToCustomDefinedValue(properties, customUndefinedValue); 14464 } 14465 var pageViewData = new PageView(logger, name, url, duration, properties, measurements, id); 14466 var data = new Data(PageView[ 14467 _DYN_DATA_TYPE 14468 /* @min:%2edataType */ 14469 ], pageViewData); 14470 return _createEnvelope(logger, PageView[ 14471 _DYN_ENVELOPE_TYPE 14472 /* @min:%2eenvelopeType */ 14473 ], telemetryItem, data); 14474} 14475function PageViewPerformanceEnvelopeCreator(logger, telemetryItem, customUndefinedValue) { 14476 EnvelopeCreatorInit(logger, telemetryItem); 14477 var bd = telemetryItem[strBaseData]; 14478 var name = bd[ 14479 _DYN_NAME 14480 /* @min:%2ename */ 14481 ]; 14482 var url = bd.uri || bd.url; 14483 var properties = bd[strProperties] || {}; 14484 var measurements = bd[ 14485 _DYN_MEASUREMENTS 14486 /* @min:%2emeasurements */ 14487 ] || {}; 14488 _extractPropsAndMeasurements(telemetryItem[ 14489 _DYN_DATA 14490 /* @min:%2edata */ 14491 ], properties, measurements); 14492 if (!/* @__PURE__ */ isNullOrUndefined(customUndefinedValue)) { 14493 _convertPropsUndefinedToCustomDefinedValue(properties, customUndefinedValue); 14494 } 14495 var baseData = new PageViewPerformance(logger, name, url, void 0, properties, measurements, bd); 14496 var data = new Data(PageViewPerformance[ 14497 _DYN_DATA_TYPE 14498 /* @min:%2edataType */ 14499 ], baseData); 14500 return _createEnvelope(logger, PageViewPerformance[ 14501 _DYN_ENVELOPE_TYPE 14502 /* @min:%2eenvelopeType */ 14503 ], telemetryItem, data); 14504} 14505function TraceEnvelopeCreator(logger, telemetryItem, customUndefinedValue) { 14506 EnvelopeCreatorInit(logger, telemetryItem); 14507 var message = telemetryItem[strBaseData].message; 14508 var severityLevel = telemetryItem[strBaseData].severityLevel; 14509 var props = telemetryItem[strBaseData][strProperties] || {}; 14510 var measurements = telemetryItem[strBaseData][ 14511 _DYN_MEASUREMENTS 14512 /* @min:%2emeasurements */ 14513 ] || {}; 14514 _extractPropsAndMeasurements(telemetryItem[ 14515 _DYN_DATA 14516 /* @min:%2edata */ 14517 ], props, measurements); 14518 if (!/* @__PURE__ */ isNullOrUndefined(customUndefinedValue)) { 14519 _convertPropsUndefinedToCustomDefinedValue(props, customUndefinedValue); 14520 } 14521 var baseData = new Trace(logger, message, severityLevel, props, measurements); 14522 var data = new Data(Trace[ 14523 _DYN_DATA_TYPE 14524 /* @min:%2edataType */ 14525 ], baseData); 14526 return _createEnvelope(logger, Trace[ 14527 _DYN_ENVELOPE_TYPE 14528 /* @min:%2eenvelopeType */ 14529 ], telemetryItem, data); 14530} 14531var BaseSendBuffer = ( 14532 /** @class */ 14533 function() { 14534 function BaseSendBuffer2(logger, config) { 14535 var _buffer = []; 14536 var _bufferFullMessageSent = false; 14537 var _maxRetryCnt = config.maxRetryCnt; 14538 this._get = function() { 14539 return _buffer; 14540 }; 14541 this._set = function(buffer) { 14542 _buffer = buffer; 14543 return _buffer; 14544 }; 14545 dynamicProto(BaseSendBuffer2, this, function(_self) { 14546 _self[ 14547 _DYN_ENQUEUE 14548 /* @min:%2eenqueue */ 14549 ] = function(payload) { 14550 if (_self[ 14551 _DYN_COUNT 14552 /* @min:%2ecount */ 14553 ]() >= config.eventsLimitInMem) { 14554 if (!_bufferFullMessageSent) { 14555 _throwInternal(logger, 2, 105, "Maximum in-memory buffer size reached: " + _self[ 14556 _DYN_COUNT 14557 /* @min:%2ecount */ 14558 ](), true); 14559 _bufferFullMessageSent = true; 14560 } 14561 return; 14562 } 14563 payload.cnt = payload.cnt || 0; 14564 if (!/* @__PURE__ */ isNullOrUndefined(_maxRetryCnt)) { 14565 if (payload.cnt > _maxRetryCnt) { 14566 return; 14567 } 14568 } 14569 _buffer[ 14570 _DYN_PUSH 14571 /* @min:%2epush */ 14572 ](payload); 14573 return; 14574 }; 14575 _self[ 14576 _DYN_COUNT 14577 /* @min:%2ecount */ 14578 ] = function() { 14579 return _buffer[ 14580 _DYN_LENGTH$1 14581 /* @min:%2elength */ 14582 ]; 14583 }; 14584 _self.size = function() { 14585 var size = _buffer[ 14586 _DYN_LENGTH$1 14587 /* @min:%2elength */ 14588 ]; 14589 for (var lp = 0; lp < _buffer[ 14590 _DYN_LENGTH$1 14591 /* @min:%2elength */ 14592 ]; lp++) { 14593 size += _buffer[lp].item[ 14594 _DYN_LENGTH$1 14595 /* @min:%2elength */ 14596 ]; 14597 } 14598 if (!config[ 14599 _DYN_EMIT_LINE_DELIMITED_0 14600 /* @min:%2eemitLineDelimitedJson */ 14601 ]) { 14602 size += 2; 14603 } 14604 return size; 14605 }; 14606 _self[ 14607 _DYN_CLEAR 14608 /* @min:%2eclear */ 14609 ] = function() { 14610 _buffer = []; 14611 _bufferFullMessageSent = false; 14612 }; 14613 _self.getItems = function() { 14614 return _buffer.slice(0); 14615 }; 14616 _self.batchPayloads = function(payloads) { 14617 if (payloads && payloads[ 14618 _DYN_LENGTH$1 14619 /* @min:%2elength */ 14620 ] > 0) { 14621 var payloadStr_1 = []; 14622 arrForEach(payloads, function(payload) { 14623 payloadStr_1[ 14624 _DYN_PUSH 14625 /* @min:%2epush */ 14626 ](payload.item); 14627 }); 14628 var batch = config[ 14629 _DYN_EMIT_LINE_DELIMITED_0 14630 /* @min:%2eemitLineDelimitedJson */ 14631 ] ? payloadStr_1.join("\n") : "[" + payloadStr_1.join(",") + "]"; 14632 return batch; 14633 } 14634 return null; 14635 }; 14636 _self.createNew = function(newLogger, newConfig, canUseSessionStorage) { 14637 var items = _buffer.slice(0); 14638 newLogger = newLogger || logger; 14639 newConfig = newConfig || {}; 14640 var newBuffer = !!canUseSessionStorage ? new SessionStorageSendBuffer(newLogger, newConfig) : new ArraySendBuffer(newLogger, newConfig); 14641 arrForEach(items, function(payload) { 14642 newBuffer[ 14643 _DYN_ENQUEUE 14644 /* @min:%2eenqueue */ 14645 ](payload); 14646 }); 14647 return newBuffer; 14648 }; 14649 }); 14650 } 14651 BaseSendBuffer2.__ieDyn = 1; 14652 return BaseSendBuffer2; 14653 }() 14654); 14655var ArraySendBuffer = ( 14656 /** @class */ 14657 function(_super) { 14658 __extendsFn(ArraySendBuffer2, _super); 14659 function ArraySendBuffer2(logger, config) { 14660 var _this = _super.call(this, logger, config) || this; 14661 dynamicProto(ArraySendBuffer2, _this, function(_self, _base) { 14662 _self[ 14663 _DYN_MARK_AS_SENT 14664 /* @min:%2emarkAsSent */ 14665 ] = function(payload) { 14666 _base[ 14667 _DYN_CLEAR 14668 /* @min:%2eclear */ 14669 ](); 14670 }; 14671 _self[ 14672 _DYN_CLEAR_SENT 14673 /* @min:%2eclearSent */ 14674 ] = function(payload) { 14675 }; 14676 }); 14677 return _this; 14678 } 14679 ArraySendBuffer2.__ieDyn = 1; 14680 return ArraySendBuffer2; 14681 }(BaseSendBuffer) 14682); 14683var PREVIOUS_KEYS = ["AI_buffer", "AI_sentBuffer"]; 14684var SessionStorageSendBuffer = ( 14685 /** @class */ 14686 function(_super) { 14687 __extendsFn(SessionStorageSendBuffer2, _super); 14688 function SessionStorageSendBuffer2(logger, config) { 14689 var _this = _super.call(this, logger, config) || this; 14690 var _bufferFullMessageSent = false; 14691 var _namePrefix = config === null || config === void 0 ? void 0 : config.namePrefix; 14692 var _b2 = config[ 14693 _DYN_BUFFER_OVERRIDE 14694 /* @min:%2ebufferOverride */ 14695 ] || { getItem: utlGetSessionStorage, setItem: utlSetSessionStorage }, getItem = _b2.getItem, setItem = _b2.setItem; 14696 var _maxRetryCnt = config.maxRetryCnt; 14697 dynamicProto(SessionStorageSendBuffer2, _this, function(_self, _base) { 14698 var bufferItems = _getBuffer(SessionStorageSendBuffer2[ 14699 _DYN__BUFFER__KEY 14700 /* @min:%2eBUFFER_KEY */ 14701 ]); 14702 var itemsInSentBuffer = _getBuffer(SessionStorageSendBuffer2[ 14703 _DYN__SENT__BUFFER__KEY 14704 /* @min:%2eSENT_BUFFER_KEY */ 14705 ]); 14706 var previousItems = _getPreviousEvents(); 14707 var notDeliveredItems = itemsInSentBuffer[ 14708 _DYN_CONCAT 14709 /* @min:%2econcat */ 14710 ](previousItems); 14711 var buffer = _self._set(bufferItems[ 14712 _DYN_CONCAT 14713 /* @min:%2econcat */ 14714 ](notDeliveredItems)); 14715 if (buffer[ 14716 _DYN_LENGTH$1 14717 /* @min:%2elength */ 14718 ] > SessionStorageSendBuffer2[ 14719 _DYN__MAX__BUFFER__SIZE 14720 /* @min:%2eMAX_BUFFER_SIZE */ 14721 ]) { 14722 buffer[ 14723 _DYN_LENGTH$1 14724 /* @min:%2elength */ 14725 ] = SessionStorageSendBuffer2[ 14726 _DYN__MAX__BUFFER__SIZE 14727 /* @min:%2eMAX_BUFFER_SIZE */ 14728 ]; 14729 } 14730 _setBuffer(SessionStorageSendBuffer2[ 14731 _DYN__SENT__BUFFER__KEY 14732 /* @min:%2eSENT_BUFFER_KEY */ 14733 ], []); 14734 _setBuffer(SessionStorageSendBuffer2[ 14735 _DYN__BUFFER__KEY 14736 /* @min:%2eBUFFER_KEY */ 14737 ], buffer); 14738 _self[ 14739 _DYN_ENQUEUE 14740 /* @min:%2eenqueue */ 14741 ] = function(payload) { 14742 if (_self[ 14743 _DYN_COUNT 14744 /* @min:%2ecount */ 14745 ]() >= SessionStorageSendBuffer2[ 14746 _DYN__MAX__BUFFER__SIZE 14747 /* @min:%2eMAX_BUFFER_SIZE */ 14748 ]) { 14749 if (!_bufferFullMessageSent) { 14750 _throwInternal(logger, 2, 67, "Maximum buffer size reached: " + _self[ 14751 _DYN_COUNT 14752 /* @min:%2ecount */ 14753 ](), true); 14754 _bufferFullMessageSent = true; 14755 } 14756 return; 14757 } 14758 payload.cnt = payload.cnt || 0; 14759 if (!/* @__PURE__ */ isNullOrUndefined(_maxRetryCnt)) { 14760 if (payload.cnt > _maxRetryCnt) { 14761 return; 14762 } 14763 } 14764 _base[ 14765 _DYN_ENQUEUE 14766 /* @min:%2eenqueue */ 14767 ](payload); 14768 _setBuffer(SessionStorageSendBuffer2[ 14769 _DYN__BUFFER__KEY 14770 /* @min:%2eBUFFER_KEY */ 14771 ], _self._get()); 14772 }; 14773 _self[ 14774 _DYN_CLEAR 14775 /* @min:%2eclear */ 14776 ] = function() { 14777 _base[ 14778 _DYN_CLEAR 14779 /* @min:%2eclear */ 14780 ](); 14781 _setBuffer(SessionStorageSendBuffer2[ 14782 _DYN__BUFFER__KEY 14783 /* @min:%2eBUFFER_KEY */ 14784 ], _self._get()); 14785 _setBuffer(SessionStorageSendBuffer2[ 14786 _DYN__SENT__BUFFER__KEY 14787 /* @min:%2eSENT_BUFFER_KEY */ 14788 ], []); 14789 _bufferFullMessageSent = false; 14790 }; 14791 _self[ 14792 _DYN_MARK_AS_SENT 14793 /* @min:%2emarkAsSent */ 14794 ] = function(payload) { 14795 _setBuffer(SessionStorageSendBuffer2[ 14796 _DYN__BUFFER__KEY 14797 /* @min:%2eBUFFER_KEY */ 14798 ], _self._set(_removePayloadsFromBuffer(payload, _self._get()))); 14799 var sentElements = _getBuffer(SessionStorageSendBuffer2[ 14800 _DYN__SENT__BUFFER__KEY 14801 /* @min:%2eSENT_BUFFER_KEY */ 14802 ]); 14803 if (sentElements instanceof Array && payload instanceof Array) { 14804 sentElements = sentElements[ 14805 _DYN_CONCAT 14806 /* @min:%2econcat */ 14807 ](payload); 14808 if (sentElements[ 14809 _DYN_LENGTH$1 14810 /* @min:%2elength */ 14811 ] > SessionStorageSendBuffer2[ 14812 _DYN__MAX__BUFFER__SIZE 14813 /* @min:%2eMAX_BUFFER_SIZE */ 14814 ]) { 14815 _throwInternal(logger, 1, 67, "Sent buffer reached its maximum size: " + sentElements[ 14816 _DYN_LENGTH$1 14817 /* @min:%2elength */ 14818 ], true); 14819 sentElements[ 14820 _DYN_LENGTH$1 14821 /* @min:%2elength */ 14822 ] = SessionStorageSendBuffer2[ 14823 _DYN__MAX__BUFFER__SIZE 14824 /* @min:%2eMAX_BUFFER_SIZE */ 14825 ]; 14826 } 14827 _setBuffer(SessionStorageSendBuffer2[ 14828 _DYN__SENT__BUFFER__KEY 14829 /* @min:%2eSENT_BUFFER_KEY */ 14830 ], sentElements); 14831 } 14832 }; 14833 _self[ 14834 _DYN_CLEAR_SENT 14835 /* @min:%2eclearSent */ 14836 ] = function(payload) { 14837 var sentElements = _getBuffer(SessionStorageSendBuffer2[ 14838 _DYN__SENT__BUFFER__KEY 14839 /* @min:%2eSENT_BUFFER_KEY */ 14840 ]); 14841 sentElements = _removePayloadsFromBuffer(payload, sentElements); 14842 _setBuffer(SessionStorageSendBuffer2[ 14843 _DYN__SENT__BUFFER__KEY 14844 /* @min:%2eSENT_BUFFER_KEY */ 14845 ], sentElements); 14846 }; 14847 _self.createNew = function(newLogger, newConfig, canUseSessionStorage) { 14848 canUseSessionStorage = !!canUseSessionStorage; 14849 var unsentItems = _self._get().slice(0); 14850 var sentItems = _getBuffer(SessionStorageSendBuffer2[ 14851 _DYN__SENT__BUFFER__KEY 14852 /* @min:%2eSENT_BUFFER_KEY */ 14853 ]).slice(0); 14854 newLogger = newLogger || logger; 14855 newConfig = newConfig || {}; 14856 _self[ 14857 _DYN_CLEAR 14858 /* @min:%2eclear */ 14859 ](); 14860 var newBuffer = canUseSessionStorage ? new SessionStorageSendBuffer2(newLogger, newConfig) : new ArraySendBuffer(newLogger, newConfig); 14861 arrForEach(unsentItems, function(payload) { 14862 newBuffer[ 14863 _DYN_ENQUEUE 14864 /* @min:%2eenqueue */ 14865 ](payload); 14866 }); 14867 if (canUseSessionStorage) { 14868 newBuffer[ 14869 _DYN_MARK_AS_SENT 14870 /* @min:%2emarkAsSent */ 14871 ](sentItems); 14872 } 14873 return newBuffer; 14874 }; 14875 function _removePayloadsFromBuffer(payloads, buffer2) { 14876 var remaining = []; 14877 var payloadStr = []; 14878 arrForEach(payloads, function(payload) { 14879 payloadStr[ 14880 _DYN_PUSH 14881 /* @min:%2epush */ 14882 ](payload.item); 14883 }); 14884 arrForEach(buffer2, function(value) { 14885 if (!isFunction(value) && arrIndexOf(payloadStr, value.item) === -1) { 14886 remaining[ 14887 _DYN_PUSH 14888 /* @min:%2epush */ 14889 ](value); 14890 } 14891 }); 14892 return remaining; 14893 } 14894 function _getBuffer(key) { 14895 var prefixedKey = key; 14896 prefixedKey = _namePrefix ? _namePrefix + "_" + prefixedKey : prefixedKey; 14897 return _getBufferBase(prefixedKey); 14898 } 14899 function _getBufferBase(key) { 14900 try { 14901 var bufferJson = getItem(logger, key); 14902 if (bufferJson) { 14903 var buffer_1 = getJSON().parse(bufferJson); 14904 if (isString(buffer_1)) { 14905 buffer_1 = getJSON().parse(buffer_1); 14906 } 14907 if (buffer_1 && isArray(buffer_1)) { 14908 return buffer_1; 14909 } 14910 } 14911 } catch (e) { 14912 _throwInternal(logger, 1, 42, " storage key: " + key + ", " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 14913 } 14914 return []; 14915 } 14916 function _setBuffer(key, buffer2) { 14917 var prefixedKey = key; 14918 try { 14919 prefixedKey = _namePrefix ? _namePrefix + "_" + prefixedKey : prefixedKey; 14920 var bufferJson = JSON[ 14921 _DYN_STRINGIFY 14922 /* @min:%2estringify */ 14923 ](buffer2); 14924 setItem(logger, prefixedKey, bufferJson); 14925 } catch (e) { 14926 setItem(logger, prefixedKey, JSON[ 14927 _DYN_STRINGIFY 14928 /* @min:%2estringify */ 14929 ]([])); 14930 _throwInternal(logger, 2, 41, " storage key: " + prefixedKey + ", " + getExceptionName(e) + ". Buffer cleared", { exception: /* @__PURE__ */ dumpObj(e) }); 14931 } 14932 } 14933 function _getPreviousEvents() { 14934 var items = []; 14935 try { 14936 arrForEach(PREVIOUS_KEYS, function(key) { 14937 var events = _getItemsFromPreviousKey(key); 14938 items = items[ 14939 _DYN_CONCAT 14940 /* @min:%2econcat */ 14941 ](events); 14942 if (_namePrefix) { 14943 var prefixedKey = _namePrefix + "_" + key; 14944 var prefixEvents = _getItemsFromPreviousKey(prefixedKey); 14945 items = items[ 14946 _DYN_CONCAT 14947 /* @min:%2econcat */ 14948 ](prefixEvents); 14949 } 14950 }); 14951 return items; 14952 } catch (e) { 14953 _throwInternal(logger, 2, 41, "Transfer events from previous buffers: " + getExceptionName(e) + ". previous Buffer items can not be removed", { exception: /* @__PURE__ */ dumpObj(e) }); 14954 } 14955 return []; 14956 } 14957 function _getItemsFromPreviousKey(key) { 14958 try { 14959 var items = _getBufferBase(key); 14960 var transFormedItems_1 = []; 14961 arrForEach(items, function(item) { 14962 var internalItem = { 14963 item, 14964 cnt: 0 14965 // previous events will be default to 0 count 14966 }; 14967 transFormedItems_1[ 14968 _DYN_PUSH 14969 /* @min:%2epush */ 14970 ](internalItem); 14971 }); 14972 utlRemoveSessionStorage(logger, key); 14973 return transFormedItems_1; 14974 } catch (e) { 14975 } 14976 return []; 14977 } 14978 }); 14979 return _this; 14980 } 14981 var _a2; 14982 _a2 = SessionStorageSendBuffer2; 14983 SessionStorageSendBuffer2.VERSION = "_1"; 14984 SessionStorageSendBuffer2.BUFFER_KEY = "AI_buffer" + _a2.VERSION; 14985 SessionStorageSendBuffer2.SENT_BUFFER_KEY = "AI_sentBuffer" + _a2.VERSION; 14986 SessionStorageSendBuffer2.MAX_BUFFER_SIZE = 2e3; 14987 return SessionStorageSendBuffer2; 14988 }(BaseSendBuffer) 14989); 14990var Serializer = ( 14991 /** @class */ 14992 function() { 14993 function Serializer2(logger) { 14994 dynamicProto(Serializer2, this, function(_self) { 14995 _self.serialize = function(input) { 14996 var output = _serializeObject(input, "root"); 14997 try { 14998 return getJSON()[ 14999 _DYN_STRINGIFY 15000 /* @min:%2estringify */ 15001 ](output); 15002 } catch (e) { 15003 _throwInternal(logger, 1, 48, e && isFunction(e[ 15004 _DYN_TO_STRING 15005 /* @min:%2etoString */ 15006 ]) ? e[ 15007 _DYN_TO_STRING 15008 /* @min:%2etoString */ 15009 ]() : "Error serializing object", null, true); 15010 } 15011 }; 15012 function _serializeObject(source, name) {
15013 var circularReferenceCheck = "__aiCircularRefCheck"; 15014 var output = {}; 15015 if (!source) { 15016 _throwInternal(logger, 1, 48, "cannot serialize object because it is null or undefined", { name }, true); 15017 return output; 15018 } 15019 if (source[circularReferenceCheck]) { 15020 _throwInternal(logger, 2, 50, "Circular reference detected while serializing object", { name }, true); 15021 return output; 15022 } 15023 if (!source.aiDataContract) { 15024 if (name === "measurements") { 15025 output = _serializeStringMap(source, "number", name); 15026 } else if (name === "properties") { 15027 output = _serializeStringMap(source, "string", name); 15028 } else if (name === "tags") { 15029 output = _serializeStringMap(source, "string", name); 15030 } else if (isArray(source)) { 15031 output = _serializeArray(source, name); 15032 } else { 15033 _throwInternal(logger, 2, 49, "Attempting to serialize an object which does not implement ISerializable", { name }, true); 15034 try { 15035 getJSON()[ 15036 _DYN_STRINGIFY 15037 /* @min:%2estringify */ 15038 ](source); 15039 output = source; 15040 } catch (e) { 15041 _throwInternal(logger, 1, 48, e && isFunction(e[ 15042 _DYN_TO_STRING 15043 /* @min:%2etoString */ 15044 ]) ? e[ 15045 _DYN_TO_STRING 15046 /* @min:%2etoString */ 15047 ]() : "Error serializing object", null, true); 15048 } 15049 } 15050 return output; 15051 } 15052 source[circularReferenceCheck] = true; 15053 objForEachKey(source.aiDataContract, function(field, contract) { 15054 var isRequired = isFunction(contract) ? contract() & 1 : contract & 1; 15055 var isHidden = isFunction(contract) ? contract() & 4 : contract & 4; 15056 var isArray2 = contract & 2; 15057 var isPresent = source[field] !== void 0; 15058 var isObj = /* @__PURE__ */ isObject(source[field]) && source[field] !== null; 15059 if (isRequired && !isPresent && !isArray2) { 15060 _throwInternal(logger, 1, 24, "Missing required field specification. The field is required but not present on source", { field, name }); 15061 }
15061 else if (!isHidden) { 15062 var value = void 0; 15063 if (isObj) { 15064 if (isArray2) { 15065 value = _serializeArray(source[field], field); 15066 } else { 15067 value = _serializeObject(source[field], field); 15068 } 15069 } else { 15070 value = source[field]; 15071 } 15072 if (value !== void 0) { 15073 output[field] = value; 15074 } 15075 } 15076 }); 15077 delete source[circularReferenceCheck]; 15078 return output; 15079 } 15080 function _serializeArray(sources, name) { 15081 var output; 15082 if (!!sources) { 15083 if (!isArray(sources)) { 15084 _throwInternal(logger, 1, 54, "This field was specified as an array in the contract but the item is not an array.\r\n", { name }, true); 15085 } else { 15086 output = []; 15087 for (var i2 = 0; i2 < sources[ 15088 _DYN_LENGTH$1 15089 /* @min:%2elength */ 15090 ]; i2++) { 15091 var source = sources[i2]; 15092 var item = _serializeObject(source, name + "[" + i2 + "]"); 15093 output[ 15094 _DYN_PUSH 15095 /* @min:%2epush */ 15096 ](item); 15097 } 15098 } 15099 } 15100 return output; 15101 } 15102 function _serializeStringMap(map, expectedType, name) { 15103 var output; 15104 if (map) { 15105 output = {}; 15106 objForEachKey(map, function(field, value) { 15107 if (expectedType === "string") { 15108 if (value === void 0) { 15109 output[field] = "undefined"; 15110 } else if (value === null) { 15111 output[field] = "null"; 15112 } else if (!value[ 15113 _DYN_TO_STRING 15114 /* @min:%2etoString */ 15115 ]) { 15116 output[field] = "invalid field: toString() is not defined."; 15117 } else { 15118 output[field] = value[ 15119 _DYN_TO_STRING 15120 /* @min:%2etoString */ 15121 ](); 15122 } 15123 } else if (expectedType === "number") { 15124 if (value === void 0) { 15125 output[field] = "undefined"; 15126 } else if (value === null) { 15127 output[field] = "null"; 15128 } else { 15129 var num = parseFloat(value); 15130 output[field] = num; 15131 } 15132 } else { 15133 output[field] = "invalid field: " + name + " is of unknown type."; 15134 _throwInternal(logger, 1, output[field], null, true); 15135 } 15136 }); 15137 } 15138 return output; 15139 } 15140 }); 15141 } 15142 Serializer2.__ieDyn = 1; 15143 return Serializer2; 15144 }() 15145); 15146var MIN_INPUT_LENGTH = 8; 15147var HashCodeScoreGenerator = ( 15148 /** @class */ 15149 function() { 15150 function HashCodeScoreGenerator2() { 15151 } 15152 HashCodeScoreGenerator2.prototype.getHashCodeScore = function(key) { 15153 var score = this.getHashCode(key) / HashCodeScoreGenerator2.INT_MAX_VALUE; 15154 return score * 100; 15155 }; 15156 HashCodeScoreGenerator2.prototype.getHashCode = function(input) { 15157 if (input === "") { 15158 return 0; 15159 } 15160 while (input[ 15161 _DYN_LENGTH$1 15162 /* @min:%2elength */ 15163 ] < MIN_INPUT_LENGTH) { 15164 input = input[ 15165 _DYN_CONCAT 15166 /* @min:%2econcat */ 15167 ](input); 15168 } 15169 var hash = 5381; 15170 for (var i2 = 0; i2 < input[ 15171 _DYN_LENGTH$1 15172 /* @min:%2elength */ 15173 ]; ++i2) { 15174 hash = (hash << 5) + hash + input.charCodeAt(i2); 15175 hash = hash & hash; 15176 } 15177 return Math.abs(hash); 15178 }; 15179 HashCodeScoreGenerator2.INT_MAX_VALUE = 2147483647; 15180 return HashCodeScoreGenerator2; 15181 }() 15182); 15183var SamplingScoreGenerator = ( 15184 /** @class */ 15185 /* @__PURE__ */ function() { 15186 function SamplingScoreGenerator2() { 15187 var _self = this; 15188 var hashCodeGenerator = new HashCodeScoreGenerator(); 15189 var keys = new ContextTagKeys(); 15190 _self.getSamplingScore = function(item) { 15191 var score = 0; 15192 if (item[ 15193 _DYN_TAGS 15194 /* @min:%2etags */ 15195 ] && item[ 15196 _DYN_TAGS 15197 /* @min:%2etags */ 15198 ][keys.userId]) { 15199 score = hashCodeGenerator.getHashCodeScore(item[ 15200 _DYN_TAGS 15201 /* @min:%2etags */ 15202 ][keys.userId]); 15203 } else if (item.ext && item.ext.user && item.ext.user.id) { 15204 score = hashCodeGenerator[ 15205 _DYN_GET_HASH_CODE_SCORE 15206 /* @min:%2egetHashCodeScore */ 15207 ](item.ext.user.id); 15208 } else if (item[ 15209 _DYN_TAGS 15210 /* @min:%2etags */ 15211 ] && item[ 15212 _DYN_TAGS 15213 /* @min:%2etags */ 15214 ][keys.operationId]) { 15215 score = hashCodeGenerator.getHashCodeScore(item[ 15216 _DYN_TAGS 15217 /* @min:%2etags */ 15218 ][keys.operationId]); 15219 } else if (item.ext && item.ext.telemetryTrace && item.ext.telemetryTrace[ 15220 _DYN_TRACE_ID$1 15221 /* @min:%2etraceID */ 15222 ]) { 15223 score = hashCodeGenerator.getHashCodeScore(item.ext.telemetryTrace[ 15224 _DYN_TRACE_ID$1 15225 /* @min:%2etraceID */ 15226 ]); 15227 } else { 15228 score = Math.random() * 100; 15229 } 15230 return score; 15231 }; 15232 } 15233 return SamplingScoreGenerator2; 15234 }() 15235); 15236var Sample = ( 15237 /** @class */ 15238 function() { 15239 function Sample2(sampleRate, logger) { 15240 this.INT_MAX_VALUE = 2147483647; 15241 var _logger = logger || safeGetLogger(null); 15242 if (sampleRate > 100 || sampleRate < 0) { 15243 _logger.throwInternal(2, 58, "Sampling rate is out of range (0..100). Sampling will be disabled, you may be sending too much data which may affect your AI service level.", { samplingRate: sampleRate }, true); 15244 sampleRate = 100; 15245 } 15246 this[ 15247 _DYN_SAMPLE_RATE 15248 /* @min:%2esampleRate */ 15249 ] = sampleRate; 15250 this.samplingScoreGenerator = new SamplingScoreGenerator(); 15251 } 15252 Sample2.prototype.isSampledIn = function(envelope) { 15253 var samplingPercentage = this[ 15254 _DYN_SAMPLE_RATE 15255 /* @min:%2esampleRate */ 15256 ]; 15257 var isSampledIn = false;
15258 if (samplingPercentage === null || samplingPercentage === void 0 || samplingPercentage >= 100) { 15259 return true; 15260 } else if (envelope.baseType === Metric[ 15261 _DYN_DATA_TYPE 15262 /* @min:%2edataType */ 15263 ]) { 15264 return true; 15265 } 15266 isSampledIn = this.samplingScoreGenerator.getSamplingScore(envelope) < samplingPercentage; 15267 return isSampledIn; 15268 }; 15269 return Sample2; 15270 }() 15271); 15272var _a$3, _b$1; 15273var UNDEFINED_VALUE$1 = void 0; 15274var EMPTY_STR = ""; 15275var FetchSyncRequestSizeLimitBytes = 65e3; 15276function _getResponseText(xhr) { 15277 try { 15278 return xhr.responseText; 15279 } catch (e) { 15280 } 15281 return null; 15282} 15283function isOverrideFn(httpXHROverride) { 15284 return httpXHROverride && httpXHROverride.sendPOST; 15285} 15286var defaultAppInsightsChannelConfig = objDeepFreeze((_a$3 = { 15287 // Use the default value (handles empty string in the configuration) 15288 endpointUrl: cfgDfValidate(isTruthy, DEFAULT_BREEZE_ENDPOINT + DEFAULT_BREEZE_PATH) 15289}, _a$3[ 15290 _DYN_EMIT_LINE_DELIMITED_0 15291 /* @min:emitLineDelimitedJson */ 15292] = cfgDfBoolean(), _a$3.maxBatchInterval = 15e3, _a$3[ 15293 _DYN_MAX_BATCH_SIZE_IN_BY1 15294 /* @min:maxBatchSizeInBytes */ 15295] = 102400, _a$3.disableTelemetry = cfgDfBoolean(), _a$3[ 15296 _DYN_ENABLE_SESSION_STORA5 15297 /* @min:enableSessionStorageBuffer */ 15298] = cfgDfBoolean(true), _a$3.isRetryDisabled = cfgDfBoolean(), _a$3[ 15299 _DYN_IS_BEACON_API_DISABL3 15300 /* @min:isBeaconApiDisabled */ 15301] = cfgDfBoolean(true), _a$3[ 15302 _DYN_DISABLE_SEND_BEACON_7 15303 /* @min:disableSendBeaconSplit */ 15304] = cfgDfBoolean(true), _a$3.disableXhr = cfgDfBoolean(), _a$3[ 15305 _DYN_ONUNLOAD_DISABLE_FET6 15306 /* @min:onunloadDisableFetch */ 15307] = cfgDfBoolean(), _a$3[ 15308 _DYN_ONUNLOAD_DISABLE_BEA2 15309 /* @min:onunloadDisableBeacon */ 15310] = cfgDfBoolean(), _a$3[ 15311 _DYN_INSTRUMENTATION_KEY$1 15312 /* @min:instrumentationKey */ 15313] = UNDEFINED_VALUE$1, _a$3.namePrefix = UNDEFINED_VALUE$1, _a$3.samplingPercentage = cfgDfValidate(_chkSampling, 100), _a$3[ 15314 _DYN_CUSTOM_HEADERS 15315 /* @min:customHeaders */ 15316] = UNDEFINED_VALUE$1, _a$3.convertUndefined = UNDEFINED_VALUE$1, _a$3.eventsLimitInMem = 1e4, _a$3[ 15317 _DYN_BUFFER_OVERRIDE 15318 /* @min:bufferOverride */ 15319] = false, _a$3.httpXHROverride = { isVal: isOverrideFn, v: UNDEFINED_VALUE$1 }, _a$3[ 15320 _DYN_ALWAYS_USE_XHR_OVERR4 15321 /* @min:alwaysUseXhrOverride */ 15322] = cfgDfBoolean(), _a$3.transports = UNDEFINED_VALUE$1, _a$3.retryCodes = UNDEFINED_VALUE$1, _a$3.corsPolicy = UNDEFINED_VALUE$1, _a$3.maxRetryCnt = { isVal: isNumber, v: 10 }, _a$3)); 15323var CrossOriginResourcePolicyHeader = "X-Set-Cross-Origin-Resource-Policy"; 15324function _chkSampling(value) { 15325 return !isNaN(value) && value > 0 && value <= 100; 15326} 15327var EnvelopeTypeCreator = (_b$1 = {}, _b$1[Event$1.dataType] = EventEnvelopeCreator, _b$1[Trace.dataType] = TraceEnvelopeCreator, _b$1[PageView.dataType] = PageViewEnvelopeCreator, _b$1[PageViewPerformance.dataType] = PageViewPerformanceEnvelopeCreator, _b$1[Exception.dataType] = ExceptionEnvelopeCreator, _b$1[Metric.dataType] = MetricEnvelopeCreator, _b$1[RemoteDependencyData.dataType] = DependencyEnvelopeCreator, _b$1); 15328var Sender = ( 15329 /** @class */ 15330 function(_super) { 15331 __extendsFn(Sender2, _super); 15332 function Sender2() { 15333 var _this = _super.call(this) || this; 15334 _this.priority = 1001; 15335 _this.identifier = BreezeChannelIdentifier; 15336 var _consecutiveErrors; 15337 var _retryAt; 15338 var _lastSend; 15339 var _paused; 15340 var _timeoutHandle; 15341 var _serializer; 15342 var _stamp_specific_redirects; 15343 var _headers; 15344 var _syncFetchPayload = 0; 15345 var _syncUnloadSender; 15346 var _offlineListener; 15347 var _evtNamespace; 15348 var _endpointUrl; 15349 var _orgEndpointUrl; 15350 var _maxBatchSizeInBytes; 15351 var _beaconSupported; 15352 var _beaconOnUnloadSupported; 15353 var _beaconNormalSupported; 15354 var _customHeaders; 15355 var _disableTelemetry; 15356 var _instrumentationKey; 15357 var _convertUndefined; 15358 var _isRetryDisabled; 15359 var _maxBatchInterval; 15360 var _sessionStorageUsed; 15361 var _bufferOverrideUsed; 15362 var _namePrefix; 15363 var _enableSendPromise; 15364 var _alwaysUseCustomSend; 15365 var _disableXhr; 15366 var _fetchKeepAlive; 15367 var _xhrSend; 15368 var _fallbackSend; 15369 var _disableBeaconSplit; 15370 var _sendPostMgr; 15371 var _retryCodes; 15372 var _zipPayload; 15373 dynamicProto(Sender2, _this, function(_self, _base) { 15374 _initDefaults(); 15375 _self.pause = function() { 15376 _clearScheduledTimer(); 15377 _paused = true; 15378 }; 15379 _self.resume = function() { 15380 if (_paused) { 15381 _paused = false;
vendor: 8,733 bytes, lines 15382-15604
15382 _retryAt = null; 15383 _checkMaxSize(); 15384 _setupTimer(); 15385 } 15386 }; 15387 _self.flush = function(isAsync, callBack, sendReason) { 15388 if (isAsync === void 0) { 15389 isAsync = true; 15390 } 15391 if (!_paused) { 15392 _clearScheduledTimer(); 15393 try { 15394 return _self[ 15395 _DYN_TRIGGER_SEND 15396 /* @min:%2etriggerSend */ 15397 ]( 15398 isAsync, 15399 null, 15400 sendReason || 1 15401 /* SendRequestReason.ManualFlush */ 15402 ); 15403 } catch (e) { 15404 _throwInternal(_self[ 15405 _DYN_DIAG_LOG 15406 /* @min:%2ediagLog */ 15407 ](), 1, 22, "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 15408 } 15409 } 15410 }; 15411 _self.onunloadFlush = function() { 15412 if (!_paused) { 15413 if (_beaconSupported || _alwaysUseCustomSend) { 15414 try { 15415 return _self[ 15416 _DYN_TRIGGER_SEND 15417 /* @min:%2etriggerSend */ 15418 ]( 15419 true, 15420 _doUnloadSend, 15421 2 15422 /* SendRequestReason.Unload */ 15423 ); 15424 } catch (e) { 15425 _throwInternal(_self[ 15426 _DYN_DIAG_LOG 15427 /* @min:%2ediagLog */ 15428 ](), 1, 20, "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 15429 } 15430 } else { 15431 _self.flush(false); 15432 } 15433 } 15434 }; 15435 _self.addHeader = function(name, value) { 15436 _headers[name] = value; 15437 }; 15438 _self[ 15439 _DYN_INITIALIZE 15440 /* @min:%2einitialize */ 15441 ] = function(config, core, extensions, pluginChain) { 15442 if (_self.isInitialized()) { 15443 _throwInternal(_self[ 15444 _DYN_DIAG_LOG 15445 /* @min:%2ediagLog */ 15446 ](), 1, 28, "Sender is already initialized"); 15447 } 15448 _base[ 15449 _DYN_INITIALIZE 15450 /* @min:%2einitialize */ 15451 ](config, core, extensions, pluginChain); 15452 var identifier = _self.identifier; 15453 _serializer = new Serializer(core.logger); 15454 _consecutiveErrors = 0; 15455 _retryAt = null; 15456 _lastSend = 0; 15457 _self[ 15458 _DYN__SENDER 15459 /* @min:%2e_sender */ 15460 ] = null; 15461 _stamp_specific_redirects = 0; 15462 var diagLog = _self[ 15463 _DYN_DIAG_LOG 15464 /* @min:%2ediagLog */ 15465 ](); 15466 _evtNamespace = mergeEvtNamespace(createUniqueNamespace("Sender"), core.evtNamespace && core.evtNamespace()); 15467 _offlineListener = createOfflineListener(_evtNamespace); 15468 _self._addHook(onConfigChange(config, function(details) { 15469 var config2 = details.cfg; 15470 if (config2.storagePrefix) { 15471 utlSetStoragePrefix(config2.storagePrefix); 15472 } 15473 var ctx = createProcessTelemetryContext(null, config2, core); 15474 var senderConfig = ctx.getExtCfg(identifier, defaultAppInsightsChannelConfig); 15475 var curExtUrl = senderConfig[ 15476 _DYN_ENDPOINT_URL$1 15477 /* @min:%2eendpointUrl */ 15478 ]; 15479 if (_endpointUrl && curExtUrl === _endpointUrl) { 15480 var coreUrl = config2[ 15481 _DYN_ENDPOINT_URL$1 15482 /* @min:%2eendpointUrl */ 15483 ]; 15484 if (coreUrl && coreUrl !== curExtUrl) { 15485 senderConfig[ 15486 _DYN_ENDPOINT_URL$1 15487 /* @min:%2eendpointUrl */ 15488 ] = coreUrl; 15489 } 15490 } 15491 var csStream = /* @__PURE__ */ getInst("CompressionStream"); 15492 _zipPayload = isFeatureEnabled("zipPayload", config2, false); 15493 if (!isFunction(csStream)) { 15494 _zipPayload = false; 15495 } 15496 var corsPolicy = senderConfig.corsPolicy; 15497 if (corsPolicy) { 15498 if (corsPolicy === "same-origin" || corsPolicy === "same-site" || corsPolicy === "cross-origin") { 15499 _this.addHeader(CrossOriginResourcePolicyHeader, corsPolicy); 15500 } 15501 } else { 15502 delete _headers[CrossOriginResourcePolicyHeader]; 15503 } 15504 if (/* @__PURE__ */ isPromiseLike(senderConfig[ 15505 _DYN_INSTRUMENTATION_KEY$1 15506 /* @min:%2einstrumentationKey */ 15507 ])) { 15508 senderConfig[ 15509 _DYN_INSTRUMENTATION_KEY$1 15510 /* @min:%2einstrumentationKey */ 15511 ] = config2[ 15512 _DYN_INSTRUMENTATION_KEY$1 15513 /* @min:%2einstrumentationKey */ 15514 ]; 15515 } 15516 objDefine(_self, "_senderConfig", { 15517 g: function() { 15518 return senderConfig; 15519 } 15520 }); 15521 if (_orgEndpointUrl !== senderConfig[ 15522 _DYN_ENDPOINT_URL$1 15523 /* @min:%2eendpointUrl */ 15524 ]) { 15525 _endpointUrl = _orgEndpointUrl = senderConfig[ 15526 _DYN_ENDPOINT_URL$1 15527 /* @min:%2eendpointUrl */ 15528 ]; 15529 } 15530 if (core.activeStatus() === ActiveStatus.PENDING) { 15531 _self.pause(); 15532 } else if (core.activeStatus() === ActiveStatus.ACTIVE) { 15533 _self.resume(); 15534 } 15535 if (_customHeaders && _customHeaders !== senderConfig[ 15536 _DYN_CUSTOM_HEADERS 15537 /* @min:%2ecustomHeaders */ 15538 ]) { 15539 arrForEach(_customHeaders, function(customHeader) { 15540 delete _headers[customHeader.header]; 15541 }); 15542 } 15543 _maxBatchSizeInBytes = senderConfig[ 15544 _DYN_MAX_BATCH_SIZE_IN_BY1 15545 /* @min:%2emaxBatchSizeInBytes */ 15546 ]; 15547 _beaconSupported = (senderConfig[ 15548 _DYN_ONUNLOAD_DISABLE_BEA2 15549 /* @min:%2eonunloadDisableBeacon */ 15550 ] === false || senderConfig[ 15551 _DYN_IS_BEACON_API_DISABL3 15552 /* @min:%2eisBeaconApiDisabled */ 15553 ] === false) && isBeaconsSupported(); 15554 _beaconOnUnloadSupported = senderConfig[ 15555 _DYN_ONUNLOAD_DISABLE_BEA2 15556 /* @min:%2eonunloadDisableBeacon */ 15557 ] === false && isBeaconsSupported(); 15558 _beaconNormalSupported = senderConfig[ 15559 _DYN_IS_BEACON_API_DISABL3 15560 /* @min:%2eisBeaconApiDisabled */ 15561 ] === false && isBeaconsSupported(); 15562 _alwaysUseCustomSend = senderConfig[ 15563 _DYN_ALWAYS_USE_XHR_OVERR4 15564 /* @min:%2ealwaysUseXhrOverride */ 15565 ]; 15566 _disableXhr = !!senderConfig.disableXhr; 15567 _retryCodes = senderConfig.retryCodes; 15568 var bufferOverride = senderConfig[ 15569 _DYN_BUFFER_OVERRIDE 15570 /* @min:%2ebufferOverride */ 15571 ]; 15572 var canUseSessionStorage = !!senderConfig[ 15573 _DYN_ENABLE_SESSION_STORA5 15574 /* @min:%2eenableSessionStorageBuffer */ 15575 ] && (!!bufferOverride || utlCanUseSessionStorage()); 15576 var namePrefix = senderConfig.namePrefix; 15577 var shouldUpdate = canUseSessionStorage !== _sessionStorageUsed || canUseSessionStorage && _namePrefix !== namePrefix || canUseSessionStorage && _bufferOverrideUsed !== bufferOverride; 15578 if (_self[ 15579 _DYN__BUFFER 15580 /* @min:%2e_buffer */ 15581 ]) { 15582 if (shouldUpdate) { 15583 try { 15584 _self[ 15585 _DYN__BUFFER 15586 /* @min:%2e_buffer */ 15587 ] = _self[ 15588 _DYN__BUFFER 15589 /* @min:%2e_buffer */ 15590 ].createNew(diagLog, senderConfig, canUseSessionStorage); 15591 } catch (e) { 15592 _throwInternal(_self[ 15593 _DYN_DIAG_LOG 15594 /* @min:%2ediagLog */ 15595 ](), 1, 12, "failed to transfer telemetry to different buffer storage, telemetry will be lost: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 15596 } 15597 } 15598 _checkMaxSize(); 15599 } else { 15600 _self[ 15601 _DYN__BUFFER 15602 /* @min:%2e_buffer */ 15603 ] = canUseSessionStorage ? new SessionStorageSendBuffer(diagLog, senderConfig) : new ArraySendBuffer(diagLog, senderConfig); 15604 }
15605 _namePrefix = namePrefix; 15606 _sessionStorageUsed = canUseSessionStorage; 15607 _bufferOverrideUsed = bufferOverride; 15608 _fetchKeepAlive = !senderConfig[ 15609 _DYN_ONUNLOAD_DISABLE_FET6 15610 /* @min:%2eonunloadDisableFetch */ 15611 ] && isFetchSupported(true); 15612 _disableBeaconSplit = !!senderConfig[ 15613 _DYN_DISABLE_SEND_BEACON_7 15614 /* @min:%2edisableSendBeaconSplit */ 15615 ]; 15616 _self._sample = new Sample(senderConfig.samplingPercentage, diagLog); 15617 _instrumentationKey = senderConfig[ 15618 _DYN_INSTRUMENTATION_KEY$1 15619 /* @min:%2einstrumentationKey */ 15620 ]; 15621 if (!/* @__PURE__ */ isPromiseLike(_instrumentationKey) && !_validateInstrumentationKey(_instrumentationKey, config2)) { 15622 _throwInternal(diagLog, 1, 100, "Invalid Instrumentation key " + _instrumentationKey); 15623 } 15624 _customHeaders = senderConfig[ 15625 _DYN_CUSTOM_HEADERS 15626 /* @min:%2ecustomHeaders */ 15627 ]; 15628 if (isString(_endpointUrl) && !isInternalApplicationInsightsEndpoint(_endpointUrl) && _customHeaders && _customHeaders[ 15629 _DYN_LENGTH$1 15630 /* @min:%2elength */ 15631 ] > 0) { 15632 arrForEach(_customHeaders, function(customHeader) { 15633 _this.addHeader(customHeader.header, customHeader.value); 15634 }); 15635 } else { 15636 _customHeaders = null; 15637 } 15638 _enableSendPromise = senderConfig.enableSendPromise; 15639 var sendPostConfig = _getSendPostMgrConfig(); 15640 if (!_sendPostMgr) { 15641 _sendPostMgr = new SenderPostManager(); 15642 _sendPostMgr[ 15643 _DYN_INITIALIZE 15644 /* @min:%2einitialize */ 15645 ](sendPostConfig, diagLog); 15646 } else { 15647 _sendPostMgr.SetConfig(sendPostConfig); 15648 } 15649 var customInterface = senderConfig.httpXHROverride; 15650 var httpInterface = null; 15651 var syncInterface = null; 15652 var theTransports = prependTransports([ 15653 3, 15654 1, 15655 2 15656 /* TransportType.Fetch */ 15657 ], senderConfig.transports); 15658 httpInterface = _sendPostMgr && _sendPostMgr[ 15659 _DYN_GET_SENDER_INST 15660 /* @min:%2egetSenderInst */ 15661 ](theTransports, false); 15662 var xhrInterface = _sendPostMgr && _sendPostMgr.getFallbackInst(); 15663 _xhrSend = function(payload, isAsync) { 15664 return _doSend(xhrInterface, payload, isAsync); 15665 }; 15666 _fallbackSend = function(payload, isAsync) { 15667 return _doSend(xhrInterface, payload, isAsync, false); 15668 }; 15669 httpInterface = _alwaysUseCustomSend ? customInterface : httpInterface || customInterface || xhrInterface; 15670 _self[ 15671 _DYN__SENDER 15672 /* @min:%2e_sender */ 15673 ] = function(payload, isAsync) { 15674 return _doSend(httpInterface, payload, isAsync); 15675 }; 15676 if (_fetchKeepAlive) { 15677 _syncUnloadSender = _fetchKeepAliveSender; 15678 } 15679 var syncTransports = prependTransports([ 15680 3, 15681 1 15682 /* TransportType.Xhr */ 15683 ], senderConfig.unloadTransports); 15684 if (!_fetchKeepAlive) { 15685 syncTransports = syncTransports.filter(function(transport) { 15686 return transport !== 2; 15687 }); 15688 } 15689 syncInterface = _sendPostMgr && _sendPostMgr[ 15690 _DYN_GET_SENDER_INST 15691 /* @min:%2egetSenderInst */ 15692 ](syncTransports, true); 15693 syncInterface = _alwaysUseCustomSend ? customInterface : syncInterface || customInterface; 15694 if ((_alwaysUseCustomSend || senderConfig.unloadTransports || !_syncUnloadSender) && syncInterface) { 15695 _syncUnloadSender = function(payload, isAsync) { 15696 return _doSend(syncInterface, payload, isAsync); 15697 }; 15698 } 15699 if (!_syncUnloadSender) { 15700 _syncUnloadSender = _xhrSend; 15701 } 15702 _disableTelemetry = senderConfig.disableTelemetry; 15703 _convertUndefined = senderConfig.convertUndefined || UNDEFINED_VALUE$1; 15704 _isRetryDisabled = senderConfig.isRetryDisabled; 15705 _maxBatchInterval = senderConfig.maxBatchInterval; 15706 })); 15707 }; 15708 _self.processTelemetry = function(telemetryItem, itemCtx) { 15709 itemCtx = _self._getTelCtx(itemCtx); 15710 var diagLogger = itemCtx[ 15711 _DYN_DIAG_LOG 15712 /* @min:%2ediagLog */ 15713 ](); 15714 try { 15715 var isValidate = _validate(telemetryItem, diagLogger); 15716 if (!isValidate) { 15717 return; 15718 } 15719 var aiEnvelope = _getEnvelope(telemetryItem, diagLogger); 15720 if (!aiEnvelope) { 15721 return; 15722 } 15723 var payload = _serializer.serialize(aiEnvelope); 15724 var buffer = _self[ 15725 _DYN__BUFFER 15726 /* @min:%2e_buffer */ 15727 ]; 15728 _checkMaxSize(payload); 15729 var payloadItem = { 15730 item: payload, 15731 cnt: 0 15732 // inital cnt will always be 0 15733 }; 15734 buffer[ 15735 _DYN_ENQUEUE 15736 /* @min:%2eenqueue */ 15737 ](payloadItem); 15738 _setupTimer(); 15739 } catch (e) { 15740 _throwInternal(diagLogger, 2, 12, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 15741 } 15742 _self.processNext(telemetryItem, itemCtx); 15743 }; 15744 _self.isCompletelyIdle = function() { 15745 return !_paused && _syncFetchPayload === 0 && _self._buffer[ 15746 _DYN_COUNT 15747 /* @min:%2ecount */ 15748 ]() === 0; 15749 }; 15750 _self.getOfflineListener = function() { 15751 return _offlineListener; 15752 }; 15753 _self._xhrReadyStateChange = function(xhr, payload, countOfItemsInPayload) { 15754 if (_isStringArr(payload)) { 15755 return; 15756 } 15757 return _xhrReadyStateChange(xhr, payload, countOfItemsInPayload); 15758 }; 15759 _self[ 15760 _DYN_TRIGGER_SEND 15761 /* @min:%2etriggerSend */ 15762 ] = function(async, forcedSender, sendReason) { 15763 if (async === void 0) { 15764 async = true; 15765 } 15766 var result; 15767 if (!_paused) { 15768 try { 15769 var buffer = _self[ 15770 _DYN__BUFFER 15771 /* @min:%2e_buffer */ 15772 ]; 15773 if (!_disableTelemetry) { 15774 if (buffer[ 15775 _DYN_COUNT 15776 /* @min:%2ecount */ 15777 ]() > 0) { 15778 var payload = buffer.getItems(); 15779 _notifySendRequest(sendReason || 0, async); 15780 if (forcedSender) { 15781 result = forcedSender.call(_self, payload, async); 15782 } else { 15783 result = _self[ 15784 _DYN__SENDER 15785 /* @min:%2e_sender */ 15786 ](payload, async); 15787 } 15788 } 15789 _lastSend = +/* @__PURE__ */ new Date(); 15790 } else { 15791 buffer[ 15792 _DYN_CLEAR 15793 /* @min:%2eclear */ 15794 ](); 15795 } 15796 _clearScheduledTimer(); 15797 } catch (e) { 15798 var ieVer = getIEVersion(); 15799 if (!ieVer || ieVer > 9) { 15800 _throwInternal(_self[ 15801 _DYN_DIAG_LOG 15802 /* @min:%2ediagLog */ 15803 ](), 1, 40, "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 15804 } 15805 } 15806 } 15807 return result; 15808 }; 15809 _self.getOfflineSupport = function() { 15810 return { 15811 getUrl: function() { 15812 return _endpointUrl; 15813 }, 15814 createPayload: _createPayload, 15815 serialize: _serialize, 15816 batch: _batch, 15817 shouldProcess: function(evt) { 15818 return !!_validate(evt); 15819 } 15820 }; 15821 }; 15822 _self._doTeardown = function(unloadCtx, unloadState) { 15823 _self.onunloadFlush(); 15824 runTargetUnload(_offlineListener, false); 15825 _initDefaults(); 15826 }; 15827 _self[
vendor: 9,983 bytes, lines 15828-16114
15828 _DYN__ON_ERROR 15829 /* @min:%2e_onError */ 15830 ] = function(payload, message, event) { 15831 if (_isStringArr(payload)) { 15832 return; 15833 } 15834 return _onError(payload, message); 15835 }; 15836 _self[ 15837 _DYN__ON_PARTIAL_SUCCESS 15838 /* @min:%2e_onPartialSuccess */ 15839 ] = function(payload, results) { 15840 if (_isStringArr(payload)) { 15841 return; 15842 } 15843 return _onPartialSuccess(payload, results); 15844 }; 15845 _self[ 15846 _DYN__ON_SUCCESS 15847 /* @min:%2e_onSuccess */ 15848 ] = function(payload, countOfItemsInPayload) { 15849 if (_isStringArr(payload)) { 15850 return; 15851 } 15852 return _onSuccess(payload); 15853 }; 15854 _self._xdrOnLoad = function(xdr, payload) { 15855 if (_isStringArr(payload)) { 15856 return; 15857 } 15858 return _xdrOnLoad(xdr, payload); 15859 }; 15860 function _xdrOnLoad(xdr, payload) { 15861 var responseText = _getResponseText(xdr); 15862 if (xdr && (responseText + "" === "200" || responseText === "")) { 15863 _consecutiveErrors = 0; 15864 _self[ 15865 _DYN__ON_SUCCESS 15866 /* @min:%2e_onSuccess */ 15867 ](payload, 0); 15868 } else { 15869 var results = parseResponse(responseText); 15870 if (results && results[ 15871 _DYN_ITEMS_RECEIVED 15872 /* @min:%2eitemsReceived */ 15873 ] && results[ 15874 _DYN_ITEMS_RECEIVED 15875 /* @min:%2eitemsReceived */ 15876 ] > results[ 15877 _DYN_ITEMS_ACCEPTED 15878 /* @min:%2eitemsAccepted */ 15879 ] && !_isRetryDisabled) { 15880 _self[ 15881 _DYN__ON_PARTIAL_SUCCESS 15882 /* @min:%2e_onPartialSuccess */ 15883 ](payload, results); 15884 } else { 15885 _self[ 15886 _DYN__ON_ERROR 15887 /* @min:%2e_onError */ 15888 ](payload, formatErrorMessageXdr(xdr)); 15889 } 15890 } 15891 } 15892 function _getSendPostMgrConfig() { 15893 try { 15894 var onCompleteFuncs = { 15895 xdrOnComplete: function(xdr, oncomplete, payload) { 15896 var payloadArr = _getPayloadArr(payload); 15897 if (!payloadArr) { 15898 return; 15899 } 15900 return _xdrOnLoad(xdr, payloadArr); 15901 }, 15902 fetchOnComplete: function(response, onComplete, resValue, payload) { 15903 var payloadArr = _getPayloadArr(payload); 15904 if (!payloadArr) { 15905 return; 15906 } 15907 return _checkResponsStatus(response.status, payloadArr, response.url, payloadArr[ 15908 _DYN_LENGTH$1 15909 /* @min:%2elength */ 15910 ], response.statusText, resValue || ""); 15911 }, 15912 xhrOnComplete: function(request, oncomplete, payload) { 15913 var payloadArr = _getPayloadArr(payload); 15914 if (!payloadArr) { 15915 return; 15916 } 15917 return _xhrReadyStateChange(request, payloadArr, payloadArr[ 15918 _DYN_LENGTH$1 15919 /* @min:%2elength */ 15920 ]); 15921 }, 15922 beaconOnRetry: function(data, onComplete, canSend) { 15923 return _onBeaconRetry(data, onComplete, canSend); 15924 } 15925 }; 15926 var config = { 15927 enableSendPromise: _enableSendPromise, 15928 isOneDs: false, 15929 disableCredentials: false, 15930 disableXhr: _disableXhr, 15931 disableBeacon: !_beaconNormalSupported, 15932 disableBeaconSync: !_beaconOnUnloadSupported, 15933 senderOnCompleteCallBack: onCompleteFuncs 15934 }; 15935 return config; 15936 } catch (e) { 15937 } 15938 return null; 15939 } 15940 function _xhrReadyStateChange(xhr, payload, countOfItemsInPayload) { 15941 if (xhr.readyState === 4) { 15942 _checkResponsStatus(xhr.status, payload, xhr.responseURL, countOfItemsInPayload, formatErrorMessageXhr(xhr), _getResponseText(xhr) || xhr.response); 15943 } 15944 } 15945 function _onError(payload, message, event) { 15946 _throwInternal(_self[ 15947 _DYN_DIAG_LOG 15948 /* @min:%2ediagLog */ 15949 ](), 2, 26, "Failed to send telemetry.", { message }); 15950 _self._buffer && _self._buffer[ 15951 _DYN_CLEAR_SENT 15952 /* @min:%2eclearSent */ 15953 ](payload); 15954 } 15955 function _onPartialSuccess(payload, results) { 15956 var failed = []; 15957 var retry = []; 15958 var errors = results.errors.reverse(); 15959 for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) { 15960 var error = errors_1[_i]; 15961 var extracted = payload.splice(error.index, 1)[0]; 15962 if (_isRetriable(error.statusCode)) { 15963 retry[ 15964 _DYN_PUSH 15965 /* @min:%2epush */ 15966 ](extracted); 15967 } else { 15968 failed[ 15969 _DYN_PUSH 15970 /* @min:%2epush */ 15971 ](extracted); 15972 } 15973 } 15974 if (payload[ 15975 _DYN_LENGTH$1 15976 /* @min:%2elength */ 15977 ] > 0) { 15978 _self[ 15979 _DYN__ON_SUCCESS 15980 /* @min:%2e_onSuccess */ 15981 ](payload, results[ 15982 _DYN_ITEMS_ACCEPTED 15983 /* @min:%2eitemsAccepted */ 15984 ]); 15985 } 15986 if (failed[ 15987 _DYN_LENGTH$1 15988 /* @min:%2elength */ 15989 ] > 0) { 15990 _self[ 15991 _DYN__ON_ERROR 15992 /* @min:%2e_onError */ 15993 ](failed, formatErrorMessageXhr(null, ["partial success", results[ 15994 _DYN_ITEMS_ACCEPTED 15995 /* @min:%2eitemsAccepted */ 15996 ], "of", results.itemsReceived].join(" "))); 15997 } 15998 if (retry[ 15999 _DYN_LENGTH$1 16000 /* @min:%2elength */ 16001 ] > 0) { 16002 _resendPayload(retry); 16003 _throwInternal(_self[ 16004 _DYN_DIAG_LOG 16005 /* @min:%2ediagLog */ 16006 ](), 2, 40, "Partial success. Delivered: " + payload[ 16007 _DYN_LENGTH$1 16008 /* @min:%2elength */ 16009 ] + ", Failed: " + failed[ 16010 _DYN_LENGTH$1 16011 /* @min:%2elength */ 16012 ] + ". Will retry to send " + retry[ 16013 _DYN_LENGTH$1 16014 /* @min:%2elength */ 16015 ] + " our of " + results[ 16016 _DYN_ITEMS_RECEIVED 16017 /* @min:%2eitemsReceived */ 16018 ] + " items"); 16019 } 16020 } 16021 function _onSuccess(payload, countOfItemsInPayload) { 16022 _self._buffer && _self._buffer[ 16023 _DYN_CLEAR_SENT 16024 /* @min:%2eclearSent */ 16025 ](payload); 16026 } 16027 function _getPayloadArr(payload) { 16028 try { 16029 if (payload) { 16030 var internalPayload = payload; 16031 var arr = internalPayload.oriPayload; 16032 if (arr && arr[ 16033 _DYN_LENGTH$1 16034 /* @min:%2elength */ 16035 ]) { 16036 return arr; 16037 } 16038 return null; 16039 } 16040 } catch (e) { 16041 } 16042 return null; 16043 } 16044 function _validate(telemetryItem, diagLogger) { 16045 if (_disableTelemetry) { 16046 return false; 16047 } 16048 if (!telemetryItem) { 16049 diagLogger && _throwInternal(diagLogger, 1, 7, "Cannot send empty telemetry"); 16050 return false; 16051 } 16052 if (telemetryItem.baseData && !telemetryItem[ 16053 _DYN_BASE_TYPE 16054 /* @min:%2ebaseType */ 16055 ]) { 16056 diagLogger && _throwInternal(diagLogger, 1, 70, "Cannot send telemetry without baseData and baseType"); 16057 return false; 16058 } 16059 if (!telemetryItem[ 16060 _DYN_BASE_TYPE 16061 /* @min:%2ebaseType */ 16062 ]) { 16063 telemetryItem[ 16064 _DYN_BASE_TYPE 16065 /* @min:%2ebaseType */ 16066 ] = "EventData"; 16067 } 16068 if (!_self[ 16069 _DYN__SENDER 16070 /* @min:%2e_sender */ 16071 ]) { 16072 diagLogger && _throwInternal(diagLogger, 1, 28, "Sender was not initialized"); 16073 return false; 16074 } 16075 if (!_isSampledIn(telemetryItem)) { 16076 diagLogger && _throwInternal(diagLogger, 2, 33, "Telemetry item was sampled out and not sent", { SampleRate: _self._sample[ 16077 _DYN_SAMPLE_RATE 16078 /* @min:%2esampleRate */ 16079 ] }); 16080 return false; 16081 } else { 16082 telemetryItem[SampleRate] = _self._sample[ 16083 _DYN_SAMPLE_RATE 16084 /* @min:%2esampleRate */ 16085 ]; 16086 } 16087 return true; 16088 } 16089 function _getEnvelope(telemetryItem, diagLogger) { 16090 var defaultEnvelopeIkey = telemetryItem.iKey || _instrumentationKey; 16091 var aiEnvelope = Sender2.constructEnvelope(telemetryItem, defaultEnvelopeIkey, diagLogger, _convertUndefined); 16092 if (!aiEnvelope) { 16093 _throwInternal(diagLogger, 1, 47, "Unable to create an AppInsights envelope"); 16094 return; 16095 } 16096 var doNotSendItem = false; 16097 if (telemetryItem[ 16098 _DYN_TAGS 16099 /* @min:%2etags */ 16100 ] && telemetryItem[ 16101 _DYN_TAGS 16102 /* @min:%2etags */ 16103 ][ProcessLegacy]) { 16104 arrForEach(telemetryItem[ 16105 _DYN_TAGS 16106 /* @min:%2etags */ 16107 ][ProcessLegacy], function(callBack) { 16108 try { 16109 if (callBack && callBack(aiEnvelope) === false) { 16110 doNotSendItem = true; 16111 _warnToConsole(diagLogger, "Telemetry processor check returns false"); 16112 } 16113 } catch (e) { 16114 _throwInternal(diagLogger, 1, 64, "One of telemetry initializer
16114s failed, telemetry item will not be sent: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }, true); 16115 } 16116 }); 16117 delete telemetryItem[ 16118 _DYN_TAGS 16119 /* @min:%2etags */ 16120 ][ProcessLegacy]; 16121 } 16122 if (doNotSendItem) { 16123 return; 16124 } 16125 return aiEnvelope; 16126 } 16127 function _serialize(item) { 16128 var rlt = EMPTY_STR; 16129 var diagLogger = _self[ 16130 _DYN_DIAG_LOG 16131 /* @min:%2ediagLog */ 16132 ](); 16133 try { 16134 var valid = _validate(item, diagLogger); 16135 var envelope = null; 16136 if (valid) { 16137 envelope = _getEnvelope(item, diagLogger); 16138 } 16139 if (envelope) { 16140 rlt = _serializer.serialize(envelope); 16141 } 16142 } catch (e) { 16143 } 16144 return rlt; 16145 } 16146 function _batch(arr) { 16147 var rlt = EMPTY_STR; 16148 if (arr && arr[ 16149 _DYN_LENGTH$1 16150 /* @min:%2elength */ 16151 ]) { 16152 rlt = "[" + arr.join(",") + "]"; 16153 } 16154 return rlt; 16155 } 16156 function _createPayload(data) { 16157 var headers = _getHeaders(); 16158 return { 16159 urlString: _endpointUrl, 16160 data, 16161 headers 16162 }; 16163 } 16164 function _isSampledIn(envelope) { 16165 return _self._sample.isSampledIn(envelope); 16166 } 16167 function _getOnComplete(payload, status, headers, response) { 16168 if (status === 200 && payload) { 16169 _self._onSuccess(payload, payload[ 16170 _DYN_LENGTH$1 16171 /* @min:%2elength */ 16172 ]); 16173 } else { 16174 response && _self[ 16175 _DYN__ON_ERROR 16176 /* @min:%2e_onError */ 16177 ](payload, response); 16178 } 16179 } 16180 function _doSend(sendInterface, payload, isAsync, markAsSent) { 16181 if (markAsSent === void 0) { 16182 markAsSent = true; 16183 } 16184 var onComplete = function(status, headers, response) { 16185 return _getOnComplete(payload, status, headers, response); 16186 }; 16187 var payloadData = _getPayload(payload); 16188 var sendPostFunc = sendInterface && sendInterface.sendPOST; 16189 if (sendPostFunc && payloadData) { 16190 if (markAsSent) { 16191 _self._buffer[ 16192 _DYN_MARK_AS_SENT 16193 /* @min:%2emarkAsSent */ 16194 ](payload); 16195 } 16196 _sendPostMgr.preparePayload(function(processedPayload) { 16197 return sendPostFunc(processedPayload, onComplete, !isAsync); 16198 }, _zipPayload, payloadData, !isAsync); 16199 } 16200 return null; 16201 } 16202 function _getPayload(payload) { 16203 if (isArray(payload) && payload[ 16204 _DYN_LENGTH$1 16205 /* @min:%2elength */ 16206 ] > 0) { 16207 var batch = _self[ 16208 _DYN__BUFFER 16209 /* @min:%2e_buffer */ 16210 ].batchPayloads(payload); 16211 var headers = _getHeaders(); 16212 var payloadData = { 16213 data: batch, 16214 urlString: _endpointUrl, 16215 headers, 16216 disableXhrSync: _disableXhr, 16217 disableFetchKeepAlive: !_fetchKeepAlive, 16218 oriPayload: payload 16219 }; 16220 return payloadData; 16221 } 16222 return null; 16223 } 16224 function _getHeaders() { 16225 try { 16226 var headers = _headers || {}; 16227 if (isInternalApplicationInsightsEndpoint(_endpointUrl)) { 16228 headers[RequestHeaders[ 16229 6 16230 /* eRequestHeaders.sdkContextHeader */ 16231 ]] = RequestHeaders[ 16232 7 16233 /* eRequestHeaders.sdkContextHeaderAppIdRequest */ 16234 ]; 16235 } 16236 return headers; 16237 } catch (e) { 16238 } 16239 return null; 16240 } 16241 function _checkMaxSize(incomingPayload) { 16242 var incomingSize = incomingPayload ? incomingPayload[ 16243 _DYN_LENGTH$1 16244 /* @min:%2elength */ 16245 ] : 0; 16246 if (_self[ 16247 _DYN__BUFFER 16248 /* @min:%2e_buffer */ 16249 ].size() + incomingSize > _maxBatchSizeInBytes) { 16250 if (!_offlineListener || _offlineListener.isOnline()) { 16251 _self[ 16252 _DYN_TRIGGER_SEND 16253 /* @min:%2etriggerSend */ 16254 ]( 16255 true, 16256 null, 16257 10 16258 /* SendRequestReason.MaxBatchSize */ 16259 ); 16260 } 16261 return true; 16262 } 16263 return false;
vendor: 16,028 bytes, lines 16264-16706
16264 } 16265 function _checkResponsStatus(status, payload, responseUrl, countOfItemsInPayload, errorMessage, res) { 16266 var response = null; 16267 if (!_self._appId) { 16268 response = parseResponse(res); 16269 if (response && response.appId) { 16270 _self._appId = response.appId; 16271 } 16272 } 16273 if ((status < 200 || status >= 300) && status !== 0) { 16274 if (status === 301 || status === 307 || status === 308) { 16275 if (!_checkAndUpdateEndPointUrl(responseUrl)) { 16276 _self[ 16277 _DYN__ON_ERROR 16278 /* @min:%2e_onError */ 16279 ](payload, errorMessage); 16280 return; 16281 } 16282 } 16283 if (_offlineListener && !_offlineListener.isOnline()) { 16284 if (!_isRetryDisabled) { 16285 var offlineBackOffMultiplier = 10; 16286 _resendPayload(payload, offlineBackOffMultiplier); 16287 _throwInternal(_self[ 16288 _DYN_DIAG_LOG 16289 /* @min:%2ediagLog */ 16290 ](), 2, 40, ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(!_offlineListener.isOnline(), ". Will retry to send ").concat(payload.length, " items.")); 16291 } 16292 return; 16293 } 16294 if (!_isRetryDisabled && _isRetriable(status)) { 16295 _resendPayload(payload); 16296 _throwInternal(_self[ 16297 _DYN_DIAG_LOG 16298 /* @min:%2ediagLog */ 16299 ](), 2, 40, ". Response code " + status + ". Will retry to send " + payload[ 16300 _DYN_LENGTH$1 16301 /* @min:%2elength */ 16302 ] + " items."); 16303 } else { 16304 _self[ 16305 _DYN__ON_ERROR 16306 /* @min:%2e_onError */ 16307 ](payload, errorMessage); 16308 } 16309 } else { 16310 _checkAndUpdateEndPointUrl(responseUrl); 16311 if (status === 206) { 16312 if (!response) { 16313 response = parseResponse(res); 16314 } 16315 if (response && !_isRetryDisabled) { 16316 _self[ 16317 _DYN__ON_PARTIAL_SUCCESS 16318 /* @min:%2e_onPartialSuccess */ 16319 ](payload, response); 16320 } else { 16321 _self[ 16322 _DYN__ON_ERROR 16323 /* @min:%2e_onError */ 16324 ](payload, errorMessage); 16325 } 16326 } else { 16327 _consecutiveErrors = 0; 16328 _self[ 16329 _DYN__ON_SUCCESS 16330 /* @min:%2e_onSuccess */ 16331 ](payload, countOfItemsInPayload); 16332 } 16333 } 16334 } 16335 function _checkAndUpdateEndPointUrl(responseUrl) { 16336 if (_stamp_specific_redirects >= 10) { 16337 return false; 16338 } 16339 if (!/* @__PURE__ */ isNullOrUndefined(responseUrl) && responseUrl !== "") { 16340 if (responseUrl !== _endpointUrl) { 16341 _endpointUrl = responseUrl; 16342 ++_stamp_specific_redirects; 16343 return true; 16344 } 16345 } 16346 return false; 16347 } 16348 function _doUnloadSend(payload, isAsync) { 16349 if (_syncUnloadSender) { 16350 _syncUnloadSender(payload, false); 16351 } else { 16352 var beaconInst = _sendPostMgr && _sendPostMgr[ 16353 _DYN_GET_SENDER_INST 16354 /* @min:%2egetSenderInst */ 16355 ]([ 16356 3 16357 /* TransportType.Beacon */ 16358 ], true); 16359 return _doSend(beaconInst, payload, isAsync); 16360 } 16361 } 16362 function _onBeaconRetry(payload, onComplete, canSend) { 16363 var internalPayload = payload; 16364 var data = internalPayload && internalPayload.oriPayload; 16365 if (!_disableBeaconSplit) { 16366 var droppedPayload = []; 16367 for (var lp = 0; lp < data[ 16368 _DYN_LENGTH$1 16369 /* @min:%2elength */ 16370 ]; lp++) { 16371 var thePayload = data[lp]; 16372 var arr = [thePayload]; 16373 var item = _getPayload(arr); 16374 if (!canSend(item, onComplete)) { 16375 droppedPayload[ 16376 _DYN_PUSH 16377 /* @min:%2epush */ 16378 ](thePayload); 16379 } else { 16380 _self._onSuccess(arr, arr[ 16381 _DYN_LENGTH$1 16382 /* @min:%2elength */ 16383 ]); 16384 } 16385 } 16386 if (droppedPayload[ 16387 _DYN_LENGTH$1 16388 /* @min:%2elength */ 16389 ] > 0) { 16390 _fallbackSend && _fallbackSend(droppedPayload, true); 16391 _throwInternal(_self[ 16392 _DYN_DIAG_LOG 16393 /* @min:%2ediagLog */ 16394 ](), 2, 40, ". Failed to send telemetry with Beacon API, retried with normal sender."); 16395 } 16396 } else { 16397 _fallbackSend && _fallbackSend(data, true); 16398 _throwInternal(_self[ 16399 _DYN_DIAG_LOG 16400 /* @min:%2ediagLog */ 16401 ](), 2, 40, ". Failed to send telemetry with Beacon API, retried with normal sender."); 16402 } 16403 } 16404 function _isStringArr(arr) { 16405 try { 16406 if (arr && arr[ 16407 _DYN_LENGTH$1 16408 /* @min:%2elength */ 16409 ]) { 16410 return isString(arr[0]); 16411 } 16412 } catch (e) { 16413 } 16414 return null; 16415 } 16416 function _fetchKeepAliveSender(payload, isAsync) { 16417 var transport = null; 16418 if (isArray(payload)) { 16419 var payloadSize = payload[ 16420 _DYN_LENGTH$1 16421 /* @min:%2elength */ 16422 ]; 16423 for (var lp = 0; lp < payload[ 16424 _DYN_LENGTH$1 16425 /* @min:%2elength */ 16426 ]; lp++) { 16427 payloadSize += payload[lp].item[ 16428 _DYN_LENGTH$1 16429 /* @min:%2elength */ 16430 ]; 16431 } 16432 var syncFetchPayload = _sendPostMgr.getSyncFetchPayload(); 16433 if (syncFetchPayload + payloadSize <= FetchSyncRequestSizeLimitBytes) { 16434 transport = 2; 16435 } else if (isBeaconsSupported()) { 16436 transport = 3; 16437 } else { 16438 transport = 1; 16439 _throwInternal(_self[ 16440 _DYN_DIAG_LOG 16441 /* @min:%2ediagLog */ 16442 ](), 2, 40, ". Failed to send telemetry with Beacon API, retried with xhrSender."); 16443 } 16444 var inst = _sendPostMgr && _sendPostMgr[ 16445 _DYN_GET_SENDER_INST 16446 /* @min:%2egetSenderInst */ 16447 ]([transport], true); 16448 return _doSend(inst, payload, isAsync); 16449 } 16450 return null; 16451 } 16452 function _resendPayload(payload, linearFactor) { 16453 if (linearFactor === void 0) { 16454 linearFactor = 1; 16455 } 16456 if (!payload || payload[ 16457 _DYN_LENGTH$1 16458 /* @min:%2elength */ 16459 ] === 0) { 16460 return; 16461 } 16462 var buffer = _self[ 16463 _DYN__BUFFER 16464 /* @min:%2e_buffer */ 16465 ]; 16466 buffer[ 16467 _DYN_CLEAR_SENT 16468 /* @min:%2eclearSent */ 16469 ](payload); 16470 _consecutiveErrors++; 16471 for (var _i = 0, payload_1 = payload; _i < payload_1.length; _i++) { 16472 var item = payload_1[_i]; 16473 item.cnt = item.cnt || 0; 16474 item.cnt++; 16475 buffer[ 16476 _DYN_ENQUEUE 16477 /* @min:%2eenqueue */ 16478 ](item); 16479 } 16480 _setRetryTime(linearFactor); 16481 _setupTimer(); 16482 } 16483 function _setRetryTime(linearFactor) { 16484 var SlotDelayInSeconds = 10; 16485 var delayInSeconds; 16486 if (_consecutiveErrors <= 1) { 16487 delayInSeconds = SlotDelayInSeconds; 16488 } else { 16489 var backOffSlot = (Math.pow(2, _consecutiveErrors) - 1) / 2; 16490 var backOffDelay = mathFloor(Math.random() * backOffSlot * SlotDelayInSeconds) + 1; 16491 backOffDelay = linearFactor * backOffDelay; 16492 delayInSeconds = mathMax(mathMin(backOffDelay, 3600), SlotDelayInSeconds); 16493 } 16494 var retryAfterTimeSpan = /* @__PURE__ */ utcNow() + delayInSeconds * 1e3; 16495 _retryAt = retryAfterTimeSpan; 16496 } 16497 function _setupTimer() { 16498 if (!_timeoutHandle && !_paused) { 16499 var retryInterval = _retryAt ? mathMax(0, _retryAt - /* @__PURE__ */ utcNow()) : 0; 16500 var timerValue = mathMax(_maxBatchInterval, retryInterval); 16501 _timeoutHandle = scheduleTimeout(function() { 16502 _timeoutHandle = null; 16503 _self[ 16504 _DYN_TRIGGER_SEND 16505 /* @min:%2etriggerSend */ 16506 ]( 16507 true, 16508 null, 16509 1 16510 /* SendRequestReason.NormalSchedule */ 16511 ); 16512 }, timerValue); 16513 } 16514 } 16515 function _clearScheduledTimer() { 16516 _timeoutHandle && _timeoutHandle.cancel(); 16517 _timeoutHandle = null; 16518 _retryAt = null; 16519 } 16520 function _isRetriable(statusCode) { 16521 if (!/* @__PURE__ */ isNullOrUndefined(_retryCodes)) { 16522 return _retryCodes[ 16523 _DYN_LENGTH$1 16524 /* @min:%2elength */ 16525 ] && _retryCodes.indexOf(statusCode) > -1; 16526 } 16527 return statusCode === 401 || statusCode === 408 || statusCode === 429 || statusCode === 500 || statusCode === 502 || statusCode === 503 || statusCode === 504; 16528 } 16529 function _getNotifyMgr() { 16530 var func = "getNotifyMgr"; 16531 var result; 16532 var core = _self.core; 16533 if (core) { 16534 if (core[func]) { 16535 result = core[func](); 16536 } else { 16537 result = core["_notificationManager"]; 16538 } 16539 } 16540 return result; 16541 } 16542 function _notifySendRequest(sendRequest, isAsync) { 16543 var manager = _getNotifyMgr(); 16544 if (manager && manager.eventsSendRequest) { 16545 try { 16546 manager.eventsSendRequest(sendRequest, isAsync); 16547 } catch (e) { 16548 _throwInternal(_self[ 16549 _DYN_DIAG_LOG 16550 /* @min:%2ediagLog */ 16551 ](), 1, 74, "send request notification failed: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 16552 } 16553 } 16554 } 16555 function _validateInstrumentationKey(instrumentationKey, config) { 16556 var disableValidation = config.disableInstrumentationKeyValidation; 16557 var disableIKeyValidationFlag = /* @__PURE__ */ isNullOrUndefined(disableValidation) ? false : disableValidation; 16558 if (disableIKeyValidationFlag) { 16559 return true; 16560 } 16561 var UUID_Regex = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"; 16562 var regexp = new RegExp(UUID_Regex); 16563 return regexp.test(instrumentationKey); 16564 } 16565 function _initDefaults() { 16566 _self[ 16567 _DYN__SENDER 16568 /* @min:%2e_sender */ 16569 ] = null; 16570 _self[ 16571 _DYN__BUFFER 16572 /* @min:%2e_buffer */ 16573 ] = null; 16574 _self._appId = null; 16575 _self._sample = null; 16576 _headers = {}; 16577 _offlineListener = null; 16578 _consecutiveErrors = 0; 16579 _retryAt = null; 16580 _lastSend = null; 16581 _paused = false; 16582 _timeoutHandle = null; 16583 _serializer = null; 16584 _stamp_specific_redirects = 0; 16585 _syncFetchPayload = 0; 16586 _syncUnloadSender = null; 16587 _evtNamespace = null; 16588 _endpointUrl = null; 16589 _orgEndpointUrl = null; 16590 _maxBatchSizeInBytes = 0; 16591 _beaconSupported = false; 16592 _customHeaders = null; 16593 _disableTelemetry = false; 16594 _instrumentationKey = null; 16595 _convertUndefined = UNDEFINED_VALUE$1; 16596 _isRetryDisabled = false; 16597 _sessionStorageUsed = null; 16598 _namePrefix = UNDEFINED_VALUE$1; 16599 _disableXhr = false; 16600 _fetchKeepAlive = false; 16601 _disableBeaconSplit = false; 16602 _xhrSend = null; 16603 _fallbackSend = null; 16604 _sendPostMgr = null; 16605 objDefine(_self, "_senderConfig", { 16606 g: function() { 16607 return objExtend({}, defaultAppInsightsChannelConfig); 16608 } 16609 }); 16610 } 16611 }); 16612 return _this; 16613 } 16614 Sender2.constructEnvelope = function(orig, iKey, logger, convertUndefined) { 16615 var envelope; 16616 if (iKey !== orig.iKey && !/* @__PURE__ */ isNullOrUndefined(iKey)) { 16617 envelope = __assignFn(__assignFn({}, orig), { iKey }); 16618 } else { 16619 envelope = orig; 16620 } 16621 var creator = EnvelopeTypeCreator[envelope.baseType] || EventEnvelopeCreator; 16622 return creator(logger, envelope, convertUndefined); 16623 }; 16624 return Sender2; 16625 }(BaseTelemetryPlugin) 16626); 16627var STR_DURATION = "duration"; 16628var STR_PROPERTIES = "properties"; 16629var _DYN_REQUEST_URL = "requestUrl"; 16630var _DYN_LENGTH = "length"; 16631var _DYN_TRACE_ID = "traceID"; 16632var _DYN_SPAN_ID = "spanID"; 16633var _DYN_TRACE_FLAGS = "traceFlags"; 16634var _DYN_CONTEXT$1 = "context"; 16635var _DYN_ABORTED = "aborted"; 16636var _DYN__ADD_HOOK = "_addHook"; 16637var _DYN_CORE = "core"; 16638var _DYN_INCLUDE_CORRELATION_0 = "includeCorrelationHeaders"; 16639var _DYN_GET_ABSOLUTE_URL = "getAbsoluteUrl"; 16640var _DYN_HEADERS = "headers"; 16641var _DYN_REQUEST_HEADERS = "requestHeaders"; 16642var _DYN_SET_REQUEST_HEADER = "setRequestHeader"; 16643var _DYN_TRACK_DEPENDENCY_DAT1 = "trackDependencyDataInternal"; 16644var _DYN_START_TIME = "startTime"; 16645var _DYN_TO_LOWER_CASE = "toLowerCase"; 16646var _DYN_ENABLE_REQUEST_HEADE2 = "enableRequestHeaderTracking"; 16647var _DYN_ENABLE_AJAX_ERROR_ST3 = "enableAjaxErrorStatusText"; 16648var _DYN_ENABLE_AJAX_PERF_TRA4 = "enableAjaxPerfTracking"; 16649var _DYN_MAX_AJAX_CALLS_PER_V5 = "maxAjaxCallsPerView"; 16650var _DYN_EXCLUDE_REQUEST_FROM6 = "excludeRequestFromAutoTrackingPatterns"; 16651var _DYN_DISABLE_AJAX_TRACKIN7 = "disableAjaxTracking"; 16652var _DYN_AJAX_PERF_LOOKUP_DEL8 = "ajaxPerfLookupDelay"; 16653var _DYN_DISABLE_FETCH_TRACKI9 = "disableFetchTracking"; 16654var _DYN_ENABLE_RESPONSE_HEAD10 = "enableResponseHeaderTracking"; 16655var _DYN_STATUS = "status"; 16656var _DYN_STATUS_TEXT = "statusText"; 16657var _DYN_HEADER_MAP = "headerMap"; 16658var _DYN_REQUEST_SENT_TIME = "requestSentTime"; 16659var _DYN_GET_TRACE_ID = "getTraceId"; 16660var _DYN_GET_TRACE_FLAGS = "getTraceFlags"; 16661var _DYN_METHOD = "method"; 16662var _DYN_ERROR_STATUS_TEXT = "errorStatusText"; 16663var _DYN_STATE_CHANGE_ATTACHE11 = "stateChangeAttached"; 16664var _DYN_RESPONSE_TEXT = "responseText"; 16665var _DYN_RESPONSE_FINISHED_TI12 = "responseFinishedTime"; 16666var _DYN__CREATE_TRACK_ITEM = "CreateTrackItem"; 16667var _DYN_GET_ALL_RESPONSE_HEA13 = "getAllResponseHeaders"; 16668var _DYN_GET_PART_APROPS = "getPartAProps"; 16669var _DYN_PERF_MARK = "perfMark"; 16670var _DYN_PERF_TIMING = "perfTiming"; 16671var _DYN_AJAX_DIAGNOSTICS_MES14 = "ajaxDiagnosticsMessage"; 16672var _DYN_CORRELATION_CONTEXT = "correlationContext"; 16673var _DYN_AJAX_TOTAL_DURATION = "ajaxTotalDuration"; 16674var _DYN_EVENT_TRACE_CTX = "eventTraceCtx"; 16675function _calcPerfDuration(resourceEntry, start, end) { 16676 var result = 0; 16677 var from = resourceEntry[start]; 16678 var to = resourceEntry[end]; 16679 if (from && to) { 16680 result = dateTimeUtilsDuration(from, to); 16681 } 16682 return result; 16683} 16684function _setPerfDuration(props, name, resourceEntry, start, end) { 16685 var result = 0; 16686 var value = _calcPerfDuration(resourceEntry, start, end); 16687 if (value) { 16688 result = _setPerfValue(props, name, msToTimeSpan(value)); 16689 } 16690 return result; 16691} 16692function _setPerfValue(props, name, value) { 16693 var strPerf = "ajaxPerf"; 16694 var result = 0; 16695 if (props && name && value) { 16696 var perfData = props[strPerf] = props[strPerf] || {}; 16697 perfData[name] = value; 16698 result = 1; 16699 } 16700 return result; 16701} 16702function _populatePerfData(ajaxData, dependency) { 16703 var resourceEntry = ajaxData[ 16704 _DYN_PERF_TIMING 16705 /* @min:%2eperfTiming */ 16706 ];
16707 var props = dependency[ 16708 STR_PROPERTIES 16709 /* @min:%2eproperties */ 16710 ] || {}; 16711 var propsSet = 0; 16712 var strName = "name"; 16713 var strStart = "Start"; 16714 var strEnd = "End"; 16715 var strDomainLookup = "domainLookup"; 16716 var strConnect = "connect"; 16717 var strRedirect = "redirect"; 16718 var strRequest = "request"; 16719 var strResponse = "response"; 16720 var strStartTime = "startTime"; 16721 var strDomainLookupStart = strDomainLookup + strStart; 16722 var strDomainLookupEnd = strDomainLookup + strEnd; 16723 var strConnectStart = strConnect + strStart; 16724 var strConnectEnd = strConnect + strEnd; 16725 var strRequestStart = strRequest + strStart; 16726 var strRequestEnd = strRequest + strEnd; 16727 var strResponseStart = strResponse + strStart; 16728 var strResponseEnd = strResponse + strEnd; 16729 var strRedirectStart = strRedirect + strStart; 16730 var strRedirectEnd = strRedirect = strEnd; 16731 var strTransferSize = "transferSize"; 16732 var strEncodedBodySize = "encodedBodySize"; 16733 var strDecodedBodySize = "decodedBodySize"; 16734 var strServerTiming = "serverTiming"; 16735 if (resourceEntry) { 16736 propsSet |= _setPerfDuration(props, strRedirect, resourceEntry, strRedirectStart, strRedirectEnd); 16737 propsSet |= _setPerfDuration(props, strDomainLookup, resourceEntry, strDomainLookupStart, strDomainLookupEnd); 16738 propsSet |= _setPerfDuration(props, strConnect, resourceEntry, strConnectStart, strConnectEnd); 16739 propsSet |= _setPerfDuration(props, strRequest, resourceEntry, strRequestStart, strRequestEnd); 16740 propsSet |= _setPerfDuration(props, strResponse, resourceEntry, strResponseStart, strResponseEnd); 16741 propsSet |= _setPerfDuration(props, "networkConnect", resourceEntry, strStartTime, strConnectEnd); 16742 propsSet |= _setPerfDuration(props, "sentRequest", resourceEntry, strRequestStart, strResponseEnd); 16743 var duration = resourceEntry[ 16744 STR_DURATION 16745 /* @min:%2eduration */ 16746 ]; 16747 if (!duration) { 16748 duration = _calcPerfDuration(resourceEntry, strStartTime, strResponseEnd) || 0; 16749 } 16750 propsSet |= _setPerfValue(props, STR_DURATION, duration); 16751 propsSet |= _setPerfValue(props, "perfTotal", duration); 16752 var serverTiming = resourceEntry[strServerTiming]; 16753 if (serverTiming) { 16754 var server_1 = {}; 16755 arrForEach(serverTiming, function(value, idx) { 16756 var name = normalizeJsName(value[strName] || "" + idx); 16757 var newValue = server_1[name] || {}; 16758 objForEachKey(value, function(key, val) { 16759 if (key !== strName && isString(val) || isNumber(val)) { 16760 if (newValue[key]) { 16761 val = newValue[key] + ";" + val; 16762 } 16763 if (val || !isString(val)) { 16764 newValue[key] = val; 16765 } 16766 } 16767 }); 16768 server_1[name] = newValue; 16769 }); 16770 propsSet |= _setPerfValue(props, strServerTiming, server_1); 16771 } 16772 propsSet |= _setPerfValue(props, strTransferSize, resourceEntry[strTransferSize]); 16773 propsSet |= _setPerfValue(props, strEncodedBodySize, resourceEntry[strEncodedBodySize]); 16774 propsSet |= _setPerfValue(props, strDecodedBodySize, resourceEntry[strDecodedBodySize]); 16775 } else { 16776 if (ajaxData[ 16777 _DYN_PERF_MARK 16778 /* @min:%2eperfMark */ 16779 ]) { 16780 propsSet |= _setPerfValue(props, "missing", ajaxData.perfAttempts); 16781 } 16782 } 16783 if (propsSet) { 16784 dependency[ 16785 STR_PROPERTIES 16786 /* @min:%2eproperties */ 16787 ] = props; 16788 } 16789} 16790var XHRMonitoringState = ( 16791 /** @class */ 16792 /* @__PURE__ */ function() { 16793 function XHRMonitoringState2() { 16794 var self2 = this; 16795 self2.openDone = false; 16796 self2.setRequestHeaderDone = false; 16797 self2.sendDone = false; 16798 self2.abortDone = false; 16799 self2[ 16800 _DYN_STATE_CHANGE_ATTACHE11 16801 /* @min:%2estateChangeAttached */ 16802 ] = false; 16803 } 16804 return XHRMonitoringState2; 16805 }() 16806); 16807var ajaxRecord = ( 16808 /** @class */ 16809 function() { 16810 function ajaxRecord2(traceId, spanId, logger, traceCtx) { 16811 var self2 = this; 16812 var _logger = logger; 16813 var strResponseText = "responseText"; 16814 self2[ 16815 _DYN_PERF_MARK 16816 /* @min:%2eperfMark */ 16817 ] = null; 16818 self2.completed = false;
16819 self2.requestHeadersSize = null; 16820 self2[ 16821 _DYN_REQUEST_HEADERS 16822 /* @min:%2erequestHeaders */ 16823 ] = null; 16824 self2.responseReceivingDuration = null; 16825 self2.callbackDuration = null; 16826 self2[ 16827 _DYN_AJAX_TOTAL_DURATION 16828 /* @min:%2eajaxTotalDuration */ 16829 ] = null; 16830 self2[ 16831 _DYN_ABORTED 16832 /* @min:%2eaborted */ 16833 ] = 0; 16834 self2.pageUrl = null; 16835 self2[ 16836 _DYN_REQUEST_URL 16837 /* @min:%2erequestUrl */ 16838 ] = null; 16839 self2.requestSize = 0; 16840 self2[ 16841 _DYN_METHOD 16842 /* @min:%2emethod */ 16843 ] = null; 16844 self2[ 16845 _DYN_STATUS 16846 /* @min:%2estatus */ 16847 ] = null; 16848 self2[ 16849 _DYN_REQUEST_SENT_TIME 16850 /* @min:%2erequestSentTime */ 16851 ] = null; 16852 self2.responseStartedTime = null; 16853 self2[ 16854 _DYN_RESPONSE_FINISHED_TI12 16855 /* @min:%2eresponseFinishedTime */ 16856 ] = null; 16857 self2.callbackFinishedTime = null; 16858 self2.endTime = null; 16859 self2.xhrMonitoringState = new XHRMonitoringState(); 16860 self2.clientFailure = 0; 16861 self2[ 16862 _DYN_TRACE_ID 16863 /* @min:%2etraceID */ 16864 ] = traceId; 16865 self2[ 16866 _DYN_SPAN_ID 16867 /* @min:%2espanID */ 16868 ] = spanId; 16869 self2[ 16870 _DYN_TRACE_FLAGS 16871 /* @min:%2etraceFlags */ 16872 ] = traceCtx === null || traceCtx === void 0 ? void 0 : traceCtx.getTraceFlags(); 16873 if (traceCtx) { 16874 self2[ 16875 _DYN_EVENT_TRACE_CTX 16876 /* @min:%2eeventTraceCtx */ 16877 ] = { 16878 traceId: traceCtx[ 16879 _DYN_GET_TRACE_ID 16880 /* @min:%2egetTraceId */ 16881 ](), 16882 spanId: traceCtx.getSpanId(), 16883 traceFlags: traceCtx[ 16884 _DYN_GET_TRACE_FLAGS 16885 /* @min:%2egetTraceFlags */ 16886 ]() 16887 }; 16888 } else { 16889 self2[ 16890 _DYN_EVENT_TRACE_CTX 16891 /* @min:%2eeventTraceCtx */ 16892 ] = null; 16893 } 16894 dynamicProto(ajaxRecord2, self2, function(self3) { 16895 self3.getAbsoluteUrl = function() { 16896 return self3[ 16897 _DYN_REQUEST_URL 16898 /* @min:%2erequestUrl */ 16899 ] ? urlGetAbsoluteUrl(self3[ 16900 _DYN_REQUEST_URL 16901 /* @min:%2erequestUrl */ 16902 ]) : null; 16903 }; 16904 self3.getPathName = function() { 16905 return self3[ 16906 _DYN_REQUEST_URL 16907 /* @min:%2erequestUrl */ 16908 ] ? dataSanitizeUrl(_logger, urlGetCompleteUrl(self3[ 16909 _DYN_METHOD 16910 /* @min:%2emethod */ 16911 ], self3[ 16912 _DYN_REQUEST_URL 16913 /* @min:%2erequestUrl */ 16914 ])) : null; 16915 }; 16916 self3[ 16917 _DYN__CREATE_TRACK_ITEM 16918 /* @min:%2eCreateTrackItem */ 16919 ] = function(ajaxType, enableRequestHeaderTracking, getResponse) { 16920 var _a2; 16921 self3.ajaxTotalDuration = mathRound(dateTimeUtilsDuration(self3.requestSentTime, self3.responseFinishedTime) * 1e3) / 1e3; 16922 if (self3[ 16923 _DYN_AJAX_TOTAL_DURATION 16924 /* @min:%2eajaxTotalDuration */ 16925 ] < 0) { 16926 return null; 16927 } 16928 var dependency = (_a2 = { 16929 id: "|" + self3[ 16930 _DYN_TRACE_ID 16931 /* @min:%2etraceID */ 16932 ] + "." + self3[ 16933 _DYN_SPAN_ID 16934 /* @min:%2espanID */ 16935 ], 16936 target: self3[ 16937 _DYN_GET_ABSOLUTE_URL 16938 /* @min:%2egetAbsoluteUrl */ 16939 ](), 16940 name: self3.getPathName(), 16941 type: ajaxType, 16942 startTime: null, 16943 duration: self3[ 16944 _DYN_AJAX_TOTAL_DURATION 16945 /* @min:%2eajaxTotalDuration */ 16946 ], 16947 success: +self3[ 16948 _DYN_STATUS 16949 /* @min:%2estatus */ 16950 ] >= 200 && +self3[ 16951 _DYN_STATUS 16952 /* @min:%2estatus */ 16953 ] < 400, 16954 responseCode: +self3[ 16955 _DYN_STATUS 16956 /* @min:%2estatus */ 16957 ] 16958 }, _a2[STR_PROPERTIES] = { HttpMethod: self3[ 16959 _DYN_METHOD 16960 /* @min:%2emethod */ 16961 ] }, _a2);
16962 var props = dependency[STR_PROPERTIES]; 16963 if (self3[ 16964 _DYN_ABORTED 16965 /* @min:%2eaborted */ 16966 ]) { 16967 props[ 16968 _DYN_ABORTED 16969 /* @min:%2eaborted */ 16970 ] = true; 16971 } 16972 if (self3[ 16973 _DYN_REQUEST_SENT_TIME 16974 /* @min:%2erequestSentTime */ 16975 ]) { 16976 dependency[ 16977 _DYN_START_TIME 16978 /* @min:%2estartTime */ 16979 ] = /* @__PURE__ */ new Date(); 16980 dependency[ 16981 _DYN_START_TIME 16982 /* @min:%2estartTime */ 16983 ].setTime(self3[ 16984 _DYN_REQUEST_SENT_TIME 16985 /* @min:%2erequestSentTime */ 16986 ]); 16987 } 16988 _populatePerfData(self3, dependency); 16989 if (enableRequestHeaderTracking) { 16990 if (objKeys(self3.requestHeaders)[ 16991 _DYN_LENGTH 16992 /* @min:%2elength */ 16993 ] > 0) { 16994 props[ 16995 _DYN_REQUEST_HEADERS 16996 /* @min:%2erequestHeaders */ 16997 ] = self3[ 16998 _DYN_REQUEST_HEADERS 16999 /* @min:%2erequestHeaders */ 17000 ]; 17001 } 17002 } 17003 if (getResponse) { 17004 var response = getResponse(); 17005 if (response) { 17006 var correlationContext = response[ 17007 _DYN_CORRELATION_CONTEXT 17008 /* @min:%2ecorrelationContext */ 17009 ]; 17010 if (correlationContext) { 17011 dependency.correlationContext = /* dependency.target + " | " + */ 17012 correlationContext; 17013 } 17014 if (response[ 17015 _DYN_HEADER_MAP 17016 /* @min:%2eheaderMap */ 17017 ]) { 17018 if (objKeys(response.headerMap)[ 17019 _DYN_LENGTH 17020 /* @min:%2elength */ 17021 ] > 0) { 17022 props.responseHeaders = response[ 17023 _DYN_HEADER_MAP 17024 /* @min:%2eheaderMap */ 17025 ]; 17026 } 17027 } 17028 if (self3[ 17029 _DYN_ERROR_STATUS_TEXT 17030 /* @min:%2eerrorStatusText */ 17031 ]) { 17032 if (self3[ 17033 _DYN_STATUS 17034 /* @min:%2estatus */ 17035 ] >= 400) { 17036 var responseType = response.type; 17037 if (responseType === "" || responseType === "text") { 17038 props.responseText = response.responseText ? response[ 17039 _DYN_STATUS_TEXT 17040 /* @min:%2estatusText */ 17041 ] + " - " + response[strResponseText] : response[ 17042 _DYN_STATUS_TEXT 17043 /* @min:%2estatusText */ 17044 ]; 17045 } 17046 if (responseType === "json") { 17047 props.responseText = response.response ? response[ 17048 _DYN_STATUS_TEXT 17049 /* @min:%2estatusText */ 17050 ] + " - " + JSON.stringify(response.response) : response[ 17051 _DYN_STATUS_TEXT 17052 /* @min:%2estatusText */ 17053 ]; 17054 } 17055 } else if (self3[ 17056 _DYN_STATUS 17057 /* @min:%2estatus */ 17058 ] === 0) { 17059 props.responseText = response[ 17060 _DYN_STATUS_TEXT 17061 /* @min:%2estatusText */ 17062 ] || ""; 17063 } 17064 } 17065 } 17066 } 17067 return dependency; 17068 }; 17069 self3[ 17070 _DYN_GET_PART_APROPS 17071 /* @min:%2egetPartAProps */ 17072 ] = function() { 17073 var partA = null; 17074 var traceCtx2 = self3[ 17075 _DYN_EVENT_TRACE_CTX 17076 /* @min:%2eeventTraceCtx */ 17077 ]; 17078 if (traceCtx2 && (traceCtx2.traceId || traceCtx2.spanId)) { 17079 partA = {}; 17080 var traceExt = partA[Extensions.TraceExt] = { 17081 traceID: traceCtx2.traceId, 17082 parentID: traceCtx2.spanId 17083 }; 17084 if (!/* @__PURE__ */ isNullOrUndefined(traceCtx2[ 17085 _DYN_TRACE_FLAGS 17086 /* @min:%2etraceFlags */ 17087 ])) { 17088 traceExt[ 17089 _DYN_TRACE_FLAGS 17090 /* @min:%2etraceFlags */ 17091 ] = traceCtx2[ 17092 _DYN_TRACE_FLAGS 17093 /* @min:%2etraceFlags */ 17094 ]; 17095 } 17096 } 17097 return partA; 17098 }; 17099 }); 17100 } 17101 ajaxRecord2.__ieDyn = 1; 17102 return ajaxRecord2; 17103 }() 17104); 17105var _a$2; 17106var strDiagLog = "diagLog"; 17107var AJAX_DATA_CONTAINER = "_ajaxData"; 17108var STR_FETCH = "fetch"; 17109var ERROR_HEADER = "Failed to monitor XMLHttpRequest";
vendor: 4,656 bytes, lines 17110-17247
17110var ERROR_PREFIX = ", monitoring data for this ajax call "; 17111var ERROR_POSTFIX = ERROR_PREFIX + "may be incorrect."; 17112var ERROR_NOT_SENT = ERROR_PREFIX + "won't be sent."; 17113var CORRELATION_HEADER_ERROR = "Failed to get Request-Context correlation header as it may be not included in the response or not accessible."; 17114var CUSTOM_REQUEST_CONTEXT_ERROR = "Failed to add custom defined request context as configured call back may missing a null check."; 17115var FAILED_TO_CALCULATE_DURATION_ERROR = "Failed to calculate the duration of the "; 17116var _markCount = 0; 17117function _supportsFetch() { 17118 var _global = getGlobal(); 17119 if (!_global || /* @__PURE__ */ isNullOrUndefined(_global.Request) || /* @__PURE__ */ isNullOrUndefined(_global.Request[strShimPrototype]) || /* @__PURE__ */ isNullOrUndefined(_global[STR_FETCH])) { 17120 return null; 17121 } 17122 return _global[STR_FETCH]; 17123} 17124function _supportsAjaxMonitoring(ajaxMonitorInstance, ajaxDataId) { 17125 var _a2; 17126 var result = false; 17127 if (isXhrSupported()) { 17128 var proto = XMLHttpRequest[strShimPrototype]; 17129 result = !/* @__PURE__ */ isNullOrUndefined(proto) && !/* @__PURE__ */ isNullOrUndefined(proto.open) && // eslint-disable-line security/detect-non-literal-fs-filename -- false positive 17130 !/* @__PURE__ */ isNullOrUndefined(proto.send) && !/* @__PURE__ */ isNullOrUndefined(proto.abort); 17131 } 17132 var ieVer = getIEVersion(); 17133 if (ieVer && ieVer < 9) { 17134 result = false; 17135 } 17136 if (result) { 17137 try { 17138 var xhr = new XMLHttpRequest(); 17139 var xhrData = { 17140 xh: [], 17141 i: (_a2 = {}, _a2[ajaxDataId] = {}, _a2) 17142 }; 17143 xhr[AJAX_DATA_CONTAINER] = xhrData; 17144 var theOpen = XMLHttpRequest[strShimPrototype].open; 17145 XMLHttpRequest[strShimPrototype].open = theOpen; 17146 } catch (e) { 17147 result = false; 17148 _throwInternalCritical(ajaxMonitorInstance, 15, "Failed to enable XMLHttpRequest monitoring, extension is not supported", { 17149 exception: /* @__PURE__ */ dumpObj(e) 17150 }); 17151 } 17152 } 17153 return result; 17154} 17155var _getAjaxData = function(xhr, ajaxDataId) { 17156 if (xhr && ajaxDataId && xhr[AJAX_DATA_CONTAINER]) { 17157 return (xhr[AJAX_DATA_CONTAINER].i || {})[ajaxDataId]; 17158 } 17159 return null; 17160}; 17161var _addSharedXhrHeaders = function(xhr, name, value) { 17162 if (xhr) { 17163 var headers = (xhr[AJAX_DATA_CONTAINER] || {}).xh; 17164 if (headers) { 17165 headers.push({ 17166 n: name, 17167 v: value 17168 }); 17169 } 17170 } 17171}; 17172var _isHeaderSet = function(xhr, name) { 17173 var isPresent = false; 17174 if (xhr) { 17175 var headers = (xhr[AJAX_DATA_CONTAINER] || {}).xh; 17176 if (headers) { 17177 arrForEach(headers, function(header) { 17178 if (header.n === name) { 17179 isPresent = true; 17180 return -1; 17181 } 17182 }); 17183 } 17184 } 17185 return isPresent; 17186}; 17187function _getFailedAjaxDiagnosticsMessage(xhr, ajaxDataId) { 17188 var result = ""; 17189 try { 17190 var ajaxData = _getAjaxData(xhr, ajaxDataId); 17191 if (ajaxData && ajaxData[ 17192 _DYN_REQUEST_URL 17193 /* @min:%2erequestUrl */ 17194 ]) { 17195 result += "(url: '" + ajaxData[ 17196 _DYN_REQUEST_URL 17197 /* @min:%2erequestUrl */ 17198 ] + "')"; 17199 } 17200 } catch (e) { 17201 } 17202 return result; 17203} 17204function _throwInternalCritical(ajaxMonitorInstance, msgId, message, properties, isUserAct) { 17205 _throwInternal(ajaxMonitorInstance[strDiagLog](), 1, msgId, message, properties, isUserAct); 17206} 17207function _throwInternalWarning(ajaxMonitorInstance, msgId, message, properties, isUserAct) { 17208 _throwInternal(ajaxMonitorInstance[strDiagLog](), 2, msgId, message, properties, isUserAct); 17209} 17210function _createErrorCallbackFunc(ajaxMonitorInstance, internalMessage, message) { 17211 return function(callDetails) { 17212 var _a2; 17213 _throwInternalCritical(ajaxMonitorInstance, internalMessage, message, (_a2 = {}, _a2[ 17214 _DYN_AJAX_DIAGNOSTICS_MES14 17215 /* @min:ajaxDiagnosticsMessage */ 17216 ] = _getFailedAjaxDiagnosticsMessage(callDetails.inst, ajaxMonitorInstance._ajaxDataId), _a2.exception = /* @__PURE__ */ dumpObj(callDetails.err), _a2)); 17217 }; 17218} 17219function _indexOf(value, match) { 17220 if (value && match) { 17221 return strIndexOf(value, match); 17222 } 17223 return -1; 17224} 17225function _addHandler(container, id, theFunc) { 17226 var theHandler = { 17227 id, 17228 fn: theFunc 17229 }; 17230 container.push(theHandler); 17231 return { 17232 remove: function() { 17233 arrForEach(container, function(initializer, idx) { 17234 if (initializer.id === theHandler.id) { 17235 container.splice(idx, 1); 17236 return -1; 17237 } 17238 }); 17239 } 17240 }; 17241} 17242function _processDependencyContainer(core, container, details, message) { 17243 var result = true; 17244 arrForEach(container, function(theFunc, idx) { 17245 try { 17246 if (theFunc.fn.call(null, details) === false) { 17247 result = false;
17248 } 17249 } catch (e) { 17250 _throwInternal(core && core.logger, 1, 64, "Dependency " + message + " [#" + idx + "] failed: " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }, true); 17251 } 17252 }); 17253 return result; 17254} 17255function _processDependencyListeners(listeners, core, ajaxData, xhr, input, init) { 17256 var initializersCount = listeners[ 17257 _DYN_LENGTH 17258 /* @min:%2elength */ 17259 ]; 17260 var result = true; 17261 if (initializersCount > 0) { 17262 var details = { 17263 core, 17264 xhr, 17265 input, 17266 init, 17267 traceId: ajaxData[ 17268 _DYN_TRACE_ID 17269 /* @min:%2etraceID */ 17270 ], 17271 spanId: ajaxData[ 17272 _DYN_SPAN_ID 17273 /* @min:%2espanID */ 17274 ], 17275 traceFlags: ajaxData[ 17276 _DYN_TRACE_FLAGS 17277 /* @min:%2etraceFlags */ 17278 ], 17279 context: ajaxData[ 17280 _DYN_CONTEXT$1 17281 /* @min:%2econtext */ 17282 ] || {}, 17283 aborted: !!ajaxData[ 17284 _DYN_ABORTED 17285 /* @min:%2eaborted */ 17286 ] 17287 }; 17288 result = _processDependencyContainer(core, listeners, details, "listener"); 17289 ajaxData[ 17290 _DYN_TRACE_ID 17291 /* @min:%2etraceID */ 17292 ] = details.traceId; 17293 ajaxData[ 17294 _DYN_SPAN_ID 17295 /* @min:%2espanID */ 17296 ] = details.spanId; 17297 ajaxData[ 17298 _DYN_TRACE_FLAGS 17299 /* @min:%2etraceFlags */ 17300 ] = details[ 17301 _DYN_TRACE_FLAGS 17302 /* @min:%2etraceFlags */ 17303 ]; 17304 ajaxData[ 17305 _DYN_CONTEXT$1 17306 /* @min:%2econtext */ 17307 ] = details[ 17308 _DYN_CONTEXT$1 17309 /* @min:%2econtext */ 17310 ]; 17311 } 17312 return result; 17313} 17314var BLOB_CORE = "*.blob.core."; 17315var DfltAjaxCorrelationHeaderExDomains = objFreeze([ 17316 BLOB_CORE + "windows.net", 17317 BLOB_CORE + "chinacloudapi.cn", 17318 BLOB_CORE + "cloudapi.de", 17319 BLOB_CORE + "usgovcloudapi.net" 17320]); 17321var _internalExcludeEndpoints = [ 17322 /https:\/\/[^\/]*(\.pipe\.aria|aria\.pipe|events\.data|collector\.azure)\.[^\/]+\/(OneCollector\/1|Collector\/3)\.0/i 17323]; 17324var _defaultConfig$1 = objFreeze((_a$2 = {}, _a$2[ 17325 _DYN_MAX_AJAX_CALLS_PER_V5 17326 /* @min:maxAjaxCallsPerView */ 17327] = 500, _a$2[ 17328 _DYN_DISABLE_AJAX_TRACKIN7 17329 /* @min:disableAjaxTracking */ 17330] = false, _a$2[ 17331 _DYN_DISABLE_FETCH_TRACKI9 17332 /* @min:disableFetchTracking */ 17333] = false, _a$2[ 17334 _DYN_EXCLUDE_REQUEST_FROM6 17335 /* @min:excludeRequestFromAutoTrackingPatterns */ 17336] = void 0, _a$2.disableCorrelationHeaders = false, _a$2.distributedTracingMode = 1, _a$2.correlationHeaderExcludedDomains = DfltAjaxCorrelationHeaderExDomains, _a$2.correlationHeaderDomains = void 0, _a$2.correlationHeaderExcludePatterns = void 0, _a$2.appId = void 0, _a$2.enableCorsCorrelation = false, _a$2[ 17337 _DYN_ENABLE_REQUEST_HEADE2 17338 /* @min:enableRequestHeaderTracking */ 17339] = false, _a$2[ 17340 _DYN_ENABLE_RESPONSE_HEAD10 17341 /* @min:enableResponseHeaderTracking */ 17342] = false, _a$2[ 17343 _DYN_ENABLE_AJAX_ERROR_ST3 17344 /* @min:enableAjaxErrorStatusText */ 17345] = false, _a$2[ 17346 _DYN_ENABLE_AJAX_PERF_TRA4 17347 /* @min:enableAjaxPerfTracking */ 17348] = false, _a$2.maxAjaxPerfLookupAttempts = 3, _a$2[ 17349 _DYN_AJAX_PERF_LOOKUP_DEL8 17350 /* @min:ajaxPerfLookupDelay */ 17351] = 25, _a$2.ignoreHeaders = [ 17352 "Authorization", 17353 "X-API-Key", 17354 "WWW-Authenticate" 17355], _a$2.addRequestContext = void 0, _a$2.addIntEndpoints = true, _a$2)); 17356var AjaxMonitor = ( 17357 /** @class */ 17358 function(_super) { 17359 __extendsFn(AjaxMonitor2, _super); 17360 function AjaxMonitor2() { 17361 var _this = _super.call(this) || this; 17362 _this.identifier = AjaxMonitor2.identifier; 17363 _this.priority = 120; 17364 var _fetchInitialized; 17365 var _xhrInitialized; 17366 var _currentWindowHost; 17367 var _extensionConfig; 17368 var _enableRequestHeaderTracking; 17369 var _enableAjaxErrorStatusText; 17370 var _trackAjaxAttempts; 17371 var _context; 17372 var _isUsingW3CHeaders; 17373 var _isUsingAIHeaders; 17374 var _markPrefix; 17375 var _enableAjaxPerfTracking; 17376 var _maxAjaxCallsPerView; 17377 var _enableResponseHeaderTracking; 17378 var _disabledUrls; 17379 var _disableAjaxTracking; 17380 var _disableFetchTracking; 17381 var _excludeRequestFromAutoTrackingPatterns; 17382 var _addRequestContext; 17383 var _evtNamespace; 17384 var _ajaxDataId; 17385 var _dependencyHandlerId; 17386 var _dependencyListeners;
vendor: 1,728 bytes, lines 17387-17429
17387 var _dependencyInitializers; 17388 var _ignoreHeaders; 17389 var _maxAjaxPerfLookupAttempts; 17390 var _ajaxPerfLookupDelay; 17391 var _distributedTracingMode; 17392 var _appId; 17393 var _polyfillInitialized; 17394 dynamicProto(AjaxMonitor2, _this, function(_self, _base) { 17395 var _addHook = _base[ 17396 _DYN__ADD_HOOK 17397 /* @min:%2e_addHook */ 17398 ]; 17399 _initDefaults(); 17400 _self.initialize = function(config, core, extensions, pluginChain) { 17401 if (!_self.isInitialized()) { 17402 _base.initialize(config, core, extensions, pluginChain); 17403 _evtNamespace = mergeEvtNamespace(createUniqueNamespace("ajax"), core && core.evtNamespace && core.evtNamespace()); 17404 _populateDefaults(config); 17405 _instrumentXhr(); 17406 _instrumentFetch(); 17407 _populateContext(); 17408 } 17409 }; 17410 _self._doTeardown = function() { 17411 _initDefaults(); 17412 }; 17413 _self.trackDependencyData = function(dependency, properties) { 17414 _reportDependencyInternal(_dependencyInitializers, _self[ 17415 _DYN_CORE 17416 /* @min:%2ecore */ 17417 ], null, dependency, properties); 17418 }; 17419 _self[ 17420 _DYN_INCLUDE_CORRELATION_0 17421 /* @min:%2eincludeCorrelationHeaders */ 17422 ] = function(ajaxData, input, init, xhr) { 17423 var currentWindowHost = _self["_currentWindowHost"] || _currentWindowHost; 17424 if (_processDependencyListeners(_dependencyListeners, _self[ 17425 _DYN_CORE 17426 /* @min:%2ecore */ 17427 ], ajaxData, xhr, input, init)) { 17428 if (input || input === "") { 17429 if (correlationIdCanIncludeCorrelationHeader(_extensionConfig, aja
17429xData[ 17430 _DYN_GET_ABSOLUTE_URL 17431 /* @min:%2egetAbsoluteUrl */ 17432 ](), currentWindowHost)) { 17433 if (!init) { 17434 init = {}; 17435 } 17436 var headers = new Headers(init[ 17437 _DYN_HEADERS 17438 /* @min:%2eheaders */ 17439 ] || (input instanceof Request ? input[ 17440 _DYN_HEADERS 17441 /* @min:%2eheaders */ 17442 ] || {} : {})); 17443 if (_isUsingAIHeaders) { 17444 var id = "|" + ajaxData[ 17445 _DYN_TRACE_ID 17446 /* @min:%2etraceID */ 17447 ] + "." + ajaxData[ 17448 _DYN_SPAN_ID 17449 /* @min:%2espanID */ 17450 ]; 17451 headers.set(RequestHeaders[ 17452 3 17453 /* eRequestHeaders.requestIdHeader */ 17454 ], id); 17455 if (_enableRequestHeaderTracking) { 17456 ajaxData[ 17457 _DYN_REQUEST_HEADERS 17458 /* @min:%2erequestHeaders */ 17459 ][RequestHeaders[ 17460 3 17461 /* eRequestHeaders.requestIdHeader */ 17462 ]] = id; 17463 } 17464 } 17465 var appId = _appId || _context && _context.appId(); 17466 if (appId) { 17467 headers.set(RequestHeaders[ 17468 0 17469 /* eRequestHeaders.requestContextHeader */ 17470 ], RequestHeaders[ 17471 2 17472 /* eRequestHeaders.requestContextAppIdFormat */ 17473 ] + appId); 17474 if (_enableRequestHeaderTracking) { 17475 ajaxData[ 17476 _DYN_REQUEST_HEADERS 17477 /* @min:%2erequestHeaders */ 17478 ][RequestHeaders[ 17479 0 17480 /* eRequestHeaders.requestContextHeader */ 17481 ]] = RequestHeaders[ 17482 2 17483 /* eRequestHeaders.requestContextAppIdFormat */ 17484 ] + appId; 17485 } 17486 } 17487 if (_isUsingW3CHeaders) { 17488 var traceFlags = ajaxData[ 17489 _DYN_TRACE_FLAGS 17490 /* @min:%2etraceFlags */ 17491 ]; 17492 if (/* @__PURE__ */ isNullOrUndefined(traceFlags)) { 17493 traceFlags = 1; 17494 } 17495 var traceParent = formatTraceParent(createTraceParent(ajaxData[ 17496 _DYN_TRACE_ID 17497 /* @min:%2etraceID */ 17498 ], ajaxData[ 17499 _DYN_SPAN_ID 17500 /* @min:%2espanID */ 17501 ], traceFlags)); 17502 headers.set(RequestHeaders[ 17503 4 17504 /* eRequestHeaders.traceParentHeader */ 17505 ], traceParent); 17506 if (_enableRequestHeaderTracking) { 17507 ajaxData[ 17508 _DYN_REQUEST_HEADERS 17509 /* @min:%2erequestHeaders */ 17510 ][RequestHeaders[ 17511 4 17512 /* eRequestHeaders.traceParentHeader */ 17513 ]] = traceParent; 17514 } 17515 } 17516 init[ 17517 _DYN_HEADERS 17518 /* @min:%2eheaders */ 17519 ] = headers; 17520 } 17521 return init; 17522 } else if (xhr) { 17523 if (correlationIdCanIncludeCorrelationHeader(_extensionConfig, aja
17523xData[ 17524 _DYN_GET_ABSOLUTE_URL 17525 /* @min:%2egetAbsoluteUrl */ 17526 ](), currentWindowHost)) { 17527 if (_isUsingAIHeaders) { 17528 if (!_isHeaderSet(xhr, RequestHeaders[ 17529 3 17530 /* eRequestHeaders.requestIdHeader */ 17531 ])) { 17532 var id = "|" + ajaxData[ 17533 _DYN_TRACE_ID 17534 /* @min:%2etraceID */ 17535 ] + "." + ajaxData[ 17536 _DYN_SPAN_ID 17537 /* @min:%2espanID */ 17538 ]; 17539 xhr[ 17540 _DYN_SET_REQUEST_HEADER 17541 /* @min:%2esetRequestHeader */ 17542 ](RequestHeaders[ 17543 3 17544 /* eRequestHeaders.requestIdHeader */ 17545 ], id); 17546 if (_enableRequestHeaderTracking) { 17547 ajaxData[ 17548 _DYN_REQUEST_HEADERS 17549 /* @min:%2erequestHeaders */ 17550 ][RequestHeaders[ 17551 3 17552 /* eRequestHeaders.requestIdHeader */ 17553 ]] = id; 17554 } 17555 } else { 17556 _throwInternalWarning(_self, 71, "Unable to set [" + RequestHeaders[ 17557 3 17558 /* eRequestHeaders.requestIdHeader */ 17559 ] + "] as it has already been set by another instance"); 17560 } 17561 } 17562 var appId = _appId || _context && _context.appId(); 17563 if (appId) { 17564 if (!_isHeaderSet(xhr, RequestHeaders[ 17565 0 17566 /* eRequestHeaders.requestContextHeader */ 17567 ])) { 17568 xhr[ 17569 _DYN_SET_REQUEST_HEADER 17570 /* @min:%2esetRequestHeader */ 17571 ](RequestHeaders[ 17572 0 17573 /* eRequestHeaders.requestContextHeader */ 17574 ], RequestHeaders[ 17575 2 17576 /* eRequestHeaders.requestContextAppIdFormat */ 17577 ] + appId); 17578 if (_enableRequestHeaderTracking) { 17579 ajaxData[ 17580 _DYN_REQUEST_HEADERS 17581 /* @min:%2erequestHeaders */ 17582 ][RequestHeaders[ 17583 0 17584 /* eRequestHeaders.requestContextHeader */ 17585 ]] = RequestHeaders[ 17586 2 17587 /* eRequestHeaders.requestContextAppIdFormat */ 17588 ] + appId; 17589 } 17590 } else { 17591 _throwInternalWarning(_self, 71, "Unable to set [" + RequestHeaders[ 17592 0 17593 /* eRequestHeaders.requestContextHeader */ 17594 ] + "] as it has already been set by another instance"); 17595 } 17596 } 17597 if (_isUsingW3CHeaders) { 17598 var traceFlags = ajaxData[ 17599 _DYN_TRACE_FLAGS 17600 /* @min:%2etraceFlags */ 17601 ]; 17602 if (/* @__PURE__ */ isNullOrUndefined(traceFlags)) { 17603 traceFlags = 1; 17604 } 17605 if (!_isHeaderSet(xhr, RequestHeaders[ 17606 4 17607 /* eRequestHeaders.traceParentHeader */ 17608 ])) { 17609 var traceParent = formatTraceParent(createTraceParent(ajaxData[ 17610 _DYN_TRACE_ID 17611 /* @min:%2etraceID */ 17612 ], ajaxData[ 17613 _DYN_SPAN_ID 17614 /* @min:%2espanID */ 17615 ], traceFlags)); 17616 xhr[ 17617 _DYN_SET_REQUEST_HEADER 17618 /* @min:%2esetRequestHeader */ 17619 ](RequestHeaders[ 17620 4 17621 /* eRequestHeaders.traceParentHeader */ 17622 ], traceParent); 17623 if (_enableRequestHeaderTracking) { 17624 ajaxData[ 17625 _DYN_REQUEST_HEADERS 17626 /* @min:%2erequestHeaders */ 17627 ][RequestHeaders[ 17628 4 17629 /* eRequestHeaders.traceParentHeader */ 17630 ]] = traceParent; 17631 } 17632 } else { 17633 _throwInternalWarning(_self, 71, "Unable to set [" + RequestHeaders[ 17634 4 17635 /* eRequestHeaders.traceParentHeader */ 17636 ] + "] as it has already been set by another instance"); 17637 } 17638 } 17639 } 17640 return xhr; 17641 } 17642 } 17643 return void 0; 17644 }; 17645 _self[ 17646 _DYN_TRACK_DEPENDENCY_DAT1 17647 /* @min:%2etrackDependencyDataInternal */ 17648 ] = function(dependency, properties, systemProperties) {
vendor: 4,139 bytes, lines 17649-17741
17649 if (_maxAjaxCallsPerView === -1 || _trackAjaxAttempts < _maxAjaxCallsPerView) { 17650 if ((_distributedTracingMode === 2 || _distributedTracingMode === 1) && typeof dependency.id === "string" && dependency.id[dependency.id[ 17651 _DYN_LENGTH 17652 /* @min:%2elength */ 17653 ] - 1] !== ".") { 17654 dependency.id += "."; 17655 } 17656 if (/* @__PURE__ */ isNullOrUndefined(dependency[ 17657 _DYN_START_TIME 17658 /* @min:%2estartTime */ 17659 ])) { 17660 dependency[ 17661 _DYN_START_TIME 17662 /* @min:%2estartTime */ 17663 ] = /* @__PURE__ */ new Date(); 17664 } 17665 var item = createTelemetryItem(dependency, RemoteDependencyData.dataType, RemoteDependencyData.envelopeType, _self[strDiagLog](), properties, systemProperties); 17666 _self[ 17667 _DYN_CORE 17668 /* @min:%2ecore */ 17669 ].track(item); 17670 } else if (_trackAjaxAttempts === _maxAjaxCallsPerView) { 17671 _throwInternalCritical(_self, 55, "Maximum ajax per page view limit reached, ajax monitoring is paused until the next trackPageView(). In order to increase the limit set the maxAjaxCallsPerView configuration parameter.", true); 17672 } 17673 ++_trackAjaxAttempts; 17674 }; 17675 _self.addDependencyListener = function(dependencyListener) { 17676 return _addHandler(_dependencyListeners, _dependencyHandlerId++, dependencyListener); 17677 }; 17678 _self.addDependencyInitializer = function(dependencyInitializer) { 17679 return _addHandler(_dependencyInitializers, _dependencyHandlerId++, dependencyInitializer); 17680 }; 17681 function _initDefaults() { 17682 var location2 = getLocation(); 17683 _fetchInitialized = false; 17684 _xhrInitialized = false; 17685 _polyfillInitialized = false; 17686 _currentWindowHost = location2 && location2.host && location2.host[ 17687 _DYN_TO_LOWER_CASE 17688 /* @min:%2etoLowerCase */ 17689 ](); 17690 _extensionConfig = null; 17691 _enableRequestHeaderTracking = false; 17692 _enableAjaxErrorStatusText = false; 17693 _trackAjaxAttempts = 0; 17694 _context = null; 17695 _isUsingW3CHeaders = false; 17696 _isUsingAIHeaders = false; 17697 _markPrefix = null; 17698 _enableAjaxPerfTracking = false; 17699 _maxAjaxCallsPerView = 0; 17700 _enableResponseHeaderTracking = false; 17701 _disabledUrls = {}; 17702 _disableAjaxTracking = false; 17703 _disableFetchTracking = false; 17704 _excludeRequestFromAutoTrackingPatterns = null; 17705 _addRequestContext = null; 17706 _evtNamespace = null; 17707 _dependencyHandlerId = 0; 17708 _dependencyListeners = []; 17709 _dependencyInitializers = []; 17710 _ajaxDataId = createUniqueNamespace("ajaxData"); 17711 _self._ajaxDataId = _ajaxDataId; 17712 _ignoreHeaders = null; 17713 _maxAjaxPerfLookupAttempts = 1; 17714 _ajaxPerfLookupDelay = 1; 17715 _distributedTracingMode = 1; 17716 _appId = null; 17717 } 17718 function _populateDefaults(config) { 17719 _self[ 17720 _DYN__ADD_HOOK 17721 /* @min:%2e_addHook */ 17722 ](onConfigChange(config, function(details) { 17723 var config2 = details.cfg; 17724 var ctx = createProcessTelemetryContext(null, config2, _self[ 17725 _DYN_CORE 17726 /* @min:%2ecore */ 17727 ]); 17728 _extensionConfig = ctx.getExtCfg(AjaxMonitor2.identifier, _defaultConfig$1); 17729 _distributedTracingMode = _extensionConfig.distributedTracingMode; 17730 _enableRequestHeaderTracking = _extensionConfig[ 17731 _DYN_ENABLE_REQUEST_HEADE2 17732 /* @min:%2eenableRequestHeaderTracking */ 17733 ]; 17734 _enableAjaxErrorStatusText = _extensionConfig[ 17735 _DYN_ENABLE_AJAX_ERROR_ST3 17736 /* @min:%2eenableAjaxErrorStatusText */ 17737 ]; 17738 _enableAjaxPerfTracking = _extensionConfig[ 17739 _DYN_ENABLE_AJAX_PERF_TRA4 17740 /* @min:%2eenableAjaxPerfTracking */ 17741 ];
17742 _maxAjaxCallsPerView = _extensionConfig[ 17743 _DYN_MAX_AJAX_CALLS_PER_V5 17744 /* @min:%2emaxAjaxCallsPerView */ 17745 ]; 17746 _excludeRequestFromAutoTrackingPatterns = [].concat(_extensionConfig[ 17747 _DYN_EXCLUDE_REQUEST_FROM6 17748 /* @min:%2eexcludeRequestFromAutoTrackingPatterns */ 17749 ] || [], _extensionConfig.addIntEndpoints !== false ? _internalExcludeEndpoints : []); 17750 _addRequestContext = _extensionConfig.addRequestContext; 17751 _isUsingAIHeaders = _distributedTracingMode === 0 || _distributedTracingMode === 1; 17752 _isUsingW3CHeaders = _distributedTracingMode === 1 || _distributedTracingMode === 2; 17753 if (_enableAjaxPerfTracking) { 17754 _markPrefix = _ajaxDataId; 17755 } 17756 _disableAjaxTracking = !!_extensionConfig[ 17757 _DYN_DISABLE_AJAX_TRACKIN7 17758 /* @min:%2edisableAjaxTracking */ 17759 ]; 17760 _maxAjaxPerfLookupAttempts = _extensionConfig.maxAjaxPerfLookupAttempts; 17761 _ajaxPerfLookupDelay = _extensionConfig[ 17762 _DYN_AJAX_PERF_LOOKUP_DEL8 17763 /* @min:%2eajaxPerfLookupDelay */ 17764 ]; 17765 _ignoreHeaders = _extensionConfig.ignoreHeaders; 17766 _appId = _extensionConfig.appId; 17767 })); 17768 } 17769 function _populateContext() { 17770 var propExt = _self[ 17771 _DYN_CORE 17772 /* @min:%2ecore */ 17773 ].getPlugin(PropertiesPluginIdentifier); 17774 if (propExt) { 17775 _context = propExt.plugin[ 17776 _DYN_CONTEXT$1 17777 /* @min:%2econtext */ 17778 ]; 17779 } 17780 } 17781 function _canIncludeHeaders(header) { 17782 var rlt = true; 17783 if (header || _ignoreHeaders) { 17784 arrForEach(_ignoreHeaders, function(key) { 17785 if (key[ 17786 _DYN_TO_LOWER_CASE 17787 /* @min:%2etoLowerCase */ 17788 ]() === header[ 17789 _DYN_TO_LOWER_CASE 17790 /* @min:%2etoLowerCase */ 17791 ]()) { 17792 rlt = false;
vendor: 9,341 bytes, lines 17793-17997
17793 return -1; 17794 } 17795 }); 17796 } 17797 return rlt; 17798 } 17799 function _instrumentFetch() { 17800 var fetch2 = _supportsFetch(); 17801 if (!fetch2) { 17802 return; 17803 } 17804 var global2 = getGlobal(); 17805 var isPolyfill = fetch2.polyfill; 17806 _self[ 17807 _DYN__ADD_HOOK 17808 /* @min:%2e_addHook */ 17809 ](onConfigChange(_extensionConfig, function() { 17810 _disableFetchTracking = !!_extensionConfig[ 17811 _DYN_DISABLE_FETCH_TRACKI9 17812 /* @min:%2edisableFetchTracking */ 17813 ]; 17814 _enableResponseHeaderTracking = _extensionConfig[ 17815 _DYN_ENABLE_RESPONSE_HEAD10 17816 /* @min:%2eenableResponseHeaderTracking */ 17817 ]; 17818 if (!_disableFetchTracking && !_fetchInitialized) { 17819 _addHook(InstrumentFunc(global2, STR_FETCH, { 17820 ns: _evtNamespace, 17821 // Add request hook 17822 req: function(callDetails, input, init) { 17823 var fetchData; 17824 if (!_disableFetchTracking && _fetchInitialized && !_isDisabledRequest(null, input, init) && // If we have a polyfil and XHR instrumented then let XHR report otherwise we get duplicates 17825 !(isPolyfill && _xhrInitialized)) { 17826 var ctx = callDetails.ctx(); 17827 fetchData = _createFetchRecord(input, init); 17828 var newInit = _self[ 17829 _DYN_INCLUDE_CORRELATION_0 17830 /* @min:%2eincludeCorrelationHeaders */ 17831 ](fetchData, input, init); 17832 if (newInit !== init) { 17833 callDetails.set(1, newInit); 17834 } 17835 ctx.data = fetchData; 17836 } 17837 }, 17838 rsp: function(callDetails, input) { 17839 if (!_disableFetchTracking) { 17840 var fetchData_1 = callDetails.ctx().data; 17841 if (fetchData_1) { 17842 callDetails.rslt = callDetails.rslt.then(function(response) { 17843 _reportFetchMetrics(callDetails, (response || {})[ 17844 _DYN_STATUS 17845 /* @min:%2estatus */ 17846 ], input, response, fetchData_1, function() { 17847 var _a2; 17848 var ajaxResponse = (_a2 = { 17849 statusText: (response || {})[ 17850 _DYN_STATUS_TEXT 17851 /* @min:%2estatusText */ 17852 ], 17853 headerMap: null 17854 }, _a2[ 17855 _DYN_CORRELATION_CONTEXT 17856 /* @min:correlationContext */ 17857 ] = _getFetchCorrelationContext(response), _a2); 17858 if (_enableResponseHeaderTracking && response) { 17859 var responseHeaderMap_1 = {}; 17860 response.headers.forEach(function(value, name) { 17861 if (_canIncludeHeaders(name)) { 17862 responseHeaderMap_1[name] = value; 17863 } 17864 }); 17865 ajaxResponse[ 17866 _DYN_HEADER_MAP 17867 /* @min:%2eheaderMap */ 17868 ] = responseHeaderMap_1; 17869 } 17870 return ajaxResponse; 17871 }); 17872 return response; 17873 }).catch(function(reason) { 17874 _reportFetchMetrics(callDetails, 0, input, null, fetchData_1, null, { error: reason.message || /* @__PURE__ */ dumpObj(reason) }); 17875 throw reason; 17876 }); 17877 } 17878 } 17879 }, 17880 // Create an error callback to report any hook errors 17881 hkErr: _createErrorCallbackFunc(_self, 15, "Failed to monitor Window.fetch" + ERROR_POSTFIX) 17882 }, true, isWebWorker())); 17883 _fetchInitialized = true; 17884 } else if (isPolyfill && !_polyfillInitialized) { 17885 _addHook(InstrumentFunc(global2, STR_FETCH, { 17886 ns: _evtNamespace, 17887 req: function(callDetails, input, init) { 17888 _isDisabledRequest(null, input, init); 17889 } 17890 })); 17891 _polyfillInitialized = true; 17892 } 17893 })); 17894 if (isPolyfill) { 17895 global2[STR_FETCH].polyfill = isPolyfill; 17896 } 17897 } 17898 function _hookProto(target, funcName, callbacks) { 17899 _addHook(InstrumentProto(target, funcName, callbacks)); 17900 } 17901 function _instrumentXhr() { 17902 if (!_supportsAjaxMonitoring(_self, _ajaxDataId)) { 17903 return; 17904 } 17905 _self[ 17906 _DYN__ADD_HOOK 17907 /* @min:%2e_addHook */ 17908 ](onConfigChange(_extensionConfig, function() { 17909 _disableAjaxTracking = !!_extensionConfig[ 17910 _DYN_DISABLE_AJAX_TRACKIN7 17911 /* @min:%2edisableAjaxTracking */ 17912 ]; 17913 _enableRequestHeaderTracking = _extensionConfig[ 17914 _DYN_ENABLE_REQUEST_HEADE2 17915 /* @min:%2eenableRequestHeaderTracking */ 17916 ]; 17917 if (!_disableAjaxTracking && !_xhrInitialized) { 17918 _hookProto(XMLHttpRequest, "open", { 17919 ns: _evtNamespace, 17920 req: function(callDetails, method, url, async) { 17921 if (!_disableAjaxTracking) { 17922 var xhr = callDetails.inst; 17923 var ajaxData = _getAjaxData(xhr, _ajaxDataId); 17924 if (!_isDisabledRequest(xhr, url) && _isMonitoredXhrInstance(xhr, ajaxData, true)) { 17925 if (!ajaxData || !ajaxData.xhrMonitoringState.openDone) { 17926 ajaxData = _openHandler(xhr, method, url, async); 17927 } 17928 _attachToOnReadyStateChange(xhr, ajaxData); 17929 } 17930 } 17931 }, 17932 hkErr: _createErrorCallbackFunc(_self, 15, ERROR_HEADER + ".open" + ERROR_POSTFIX) 17933 }); 17934 _hookProto(XMLHttpRequest, "send", { 17935 ns: _evtNamespace, 17936 req: function(callDetails, context) { 17937 if (!_disableAjaxTracking) { 17938 var xhr = callDetails.inst; 17939 var ajaxData = _getAjaxData(xhr, _ajaxDataId); 17940 if (_isMonitoredXhrInstance(xhr, ajaxData) && !ajaxData.xhrMonitoringState.sendDone) { 17941 _createMarkId("xhr", ajaxData); 17942 ajaxData[ 17943 _DYN_REQUEST_SENT_TIME 17944 /* @min:%2erequestSentTime */ 17945 ] = dateTimeUtilsNow(); 17946 _self[ 17947 _DYN_INCLUDE_CORRELATION_0 17948 /* @min:%2eincludeCorrelationHeaders */ 17949 ](ajaxData, void 0, void 0, xhr); 17950 ajaxData.xhrMonitoringState.sendDone = true; 17951 } 17952 } 17953 }, 17954 hkErr: _createErrorCallbackFunc(_self, 17, ERROR_HEADER + ERROR_POSTFIX) 17955 }); 17956 _hookProto(XMLHttpRequest, "abort", { 17957 ns: _evtNamespace, 17958 req: function(callDetails) { 17959 if (!_disableAjaxTracking) { 17960 var xhr = callDetails.inst; 17961 var ajaxData = _getAjaxData(xhr, _ajaxDataId); 17962 if (_isMonitoredXhrInstance(xhr, ajaxData) && !ajaxData.xhrMonitoringState.abortDone) { 17963 ajaxData[ 17964 _DYN_ABORTED 17965 /* @min:%2eaborted */ 17966 ] = 1; 17967 ajaxData.xhrMonitoringState.abortDone = true; 17968 } 17969 } 17970 }, 17971 hkErr: _createErrorCallbackFunc(_self, 13, ERROR_HEADER + ".abort" + ERROR_POSTFIX) 17972 }); 17973 _hookProto(XMLHttpRequest, "setRequestHeader", { 17974 ns: _evtNamespace, 17975 req: function(callDetails, header, value) { 17976 if (!_disableAjaxTracking) { 17977 var xhr = callDetails.inst; 17978 var ajaxData = _getAjaxData(xhr, _ajaxDataId); 17979 if (ajaxData && _isMonitoredXhrInstance(xhr, ajaxData)) { 17980 _addSharedXhrHeaders(xhr, header, value); 17981 if (_enableRequestHeaderTracking && _canIncludeHeaders(header)) { 17982 ajaxData[ 17983 _DYN_REQUEST_HEADERS 17984 /* @min:%2erequestHeaders */ 17985 ][header] = value; 17986 } 17987 } 17988 } 17989 }, 17990 hkErr: _createErrorCallbackFunc(_self, 71, ERROR_HEADER + ".setRequestHeader" + ERROR_POSTFIX) 17991 }); 17992 _xhrInitialized = true; 17993 } 17994 })); 17995 } 17996 function _isDisabledRequest(xhr, request, init) { 17997 var isDisabled = false;
17998 var theUrl = ((!isString(request) ? (request || {}).url || "" : request) || "")[ 17999 _DYN_TO_LOWER_CASE 18000 /* @min:%2etoLowerCase */ 18001 ](); 18002 arrForEach(_excludeRequestFromAutoTrackingPatterns, function(regex) { 18003 var theRegex = regex; 18004 if (isString(regex)) { 18005 theRegex = new RegExp(regex); 18006 } 18007 if (!isDisabled) { 18008 isDisabled = theRegex.test(theUrl); 18009 } 18010 }); 18011 if (isDisabled) { 18012 return isDisabled; 18013 } 18014 var idx = _indexOf(theUrl, "?"); 18015 var idx2 = _indexOf(theUrl, "#"); 18016 if (idx === -1 || idx2 !== -1 && idx2 < idx) { 18017 idx = idx2; 18018 } 18019 if (idx !== -1) { 18020 theUrl = theUrl.substring(0, idx); 18021 } 18022 if (!/* @__PURE__ */ isNullOrUndefined(xhr)) { 18023 isDisabled = xhr[DisabledPropertyName] === true || theUrl[DisabledPropertyName] === true; 18024 } else if (!/* @__PURE__ */ isNullOrUndefined(request)) { 18025 isDisabled = (typeof request === "object" ? request[DisabledPropertyName] === true : false) || (init ? init[DisabledPropertyName] === true : false); 18026 } 18027 if (!isDisabled && theUrl && isInternalApplicationInsightsEndpoint(theUrl)) { 18028 isDisabled = true; 18029 } 18030 if (isDisabled) { 18031 if (!_disabledUrls[theUrl]) { 18032 _disabledUrls[theUrl] = 1; 18033 } 18034 } else { 18035 if (_disabledUrls[theUrl]) { 18036 isDisabled = true; 18037 } 18038 } 18039 return isDisabled; 18040 } 18041 function _isMonitoredXhrInstance(xhr, ajaxData, excludeAjaxDataValidation) { 18042 var ajaxValidation = true; 18043 var initialized = _xhrInitialized; 18044 if (!/* @__PURE__ */ isNullOrUndefined(xhr)) { 18045 ajaxValidation = excludeAjaxDataValidation === true || !/* @__PURE__ */ isNullOrUndefined(ajaxData); 18046 } 18047 return initialized && ajaxValidation; 18048 } 18049 function _getDistributedTraceCtx() { 18050 var distributedTraceCtx = null; 18051 if (_self[ 18052 _DYN_CORE 18053 /* @min:%2ecore */ 18054 ] && _self[ 18055 _DYN_CORE 18056 /* @min:%2ecore */ 18057 ].getTraceCtx) { 18058 distributedTraceCtx = _self[ 18059 _DYN_CORE 18060 /* @min:%2ecore */ 18061 ].getTraceCtx(false); 18062 } 18063 if (!distributedTraceCtx && _context && _context.telemetryTrace) { 18064 distributedTraceCtx = createDistributedTraceContextFromTrace(_context.telemetryTrace); 18065 } 18066 return distributedTraceCtx; 18067 } 18068 function _openHandler(xhr, method, url, async) { 18069 var _a2; 18070 var distributedTraceCtx = _getDistributedTraceCtx(); 18071 var traceID = distributedTraceCtx && distributedTraceCtx[ 18072 _DYN_GET_TRACE_ID 18073 /* @min:%2egetTraceId */ 18074 ]() || generateW3CId(); 18075 var spanID = strSubstr(generateW3CId(), 0, 16); 18076 var xhrRequestData = xhr[AJAX_DATA_CONTAINER] = xhr[AJAX_DATA_CONTAINER] || { xh: [], i: {} }; 18077 var ajaxDataCntr = xhrRequestData.i = xhrRequestData.i || {}; 18078 var ajaxData = ajaxDataCntr[_ajaxDataId] = ajaxDataCntr[_ajaxDataId] || new ajaxRecord(traceID, spanID, _self[strDiagLog](), (_a2 = _self.core) === null || _a2 === void 0 ? void 0 : _a2.getTraceCtx()); 18079 ajaxData[ 18080 _DYN_TRACE_FLAGS 18081 /* @min:%2etraceFlags */ 18082 ] = distributedTraceCtx && distributedTraceCtx[ 18083 _DYN_GET_TRACE_FLAGS 18084 /* @min:%2egetTraceFlags */ 18085 ](); 18086 ajaxData[ 18087 _DYN_METHOD 18088 /* @min:%2emethod */ 18089 ] = method; 18090 ajaxData[ 18091 _DYN_REQUEST_URL 18092 /* @min:%2erequestUrl */ 18093 ] = url; 18094 ajaxData.xhrMonitoringState.openDone = true; 18095 ajaxData[ 18096 _DYN_REQUEST_HEADERS 18097 /* @min:%2erequestHeaders */ 18098 ] = {}; 18099 ajaxData.async = async; 18100 ajaxData[ 18101 _DYN_ERROR_STATUS_TEXT 18102 /* @min:%2eerrorStatusText */ 18103 ] = _enableAjaxErrorStatusText; 18104 return ajaxData; 18105 } 18106 function _attachToOnReadyStateChange(xhr, ajaxData) { 18107 ajaxData.xhrMonitoringState[ 18108 _DYN_STATE_CHANGE_ATTACHE11 18109 /* @min:%2estateChangeAttached */ 18110 ] = eventOn(xhr, "readystatechange", function() { 18111 var _a2; 18112 try { 18113 if (xhr && xhr.readyState === 4 && _isMonitoredXhrInstance(xhr, ajaxData)) { 18114 _onAjaxComplete(xhr); 18115 } 18116 } catch (e) { 18117 var exceptionText = /* @__PURE__ */ dumpObj(e); 18118 if (!exceptionText || _indexOf(exceptionText[ 18119 _DYN_TO_LOWER_CASE 18120 /* @min:%2etoLowerCase */ 18121 ](), "c00c023f") === -1) { 18122 _throwInternalCritical(_self, 16, ERROR_HEADER + " 'readystatechange' event handler" + ERROR_POSTFIX, (_a2 = {}, _a2[ 18123 _DYN_AJAX_DIAGNOSTICS_MES14 18124 /* @min:ajaxDiagnosticsMessage */ 18125 ] = _getFailedAjaxDiagnosticsMessage(xhr, _ajaxDataId), _a2.exception = exceptionText, _a2)); 18126 } 18127 } 18128 }, _evtNamespace); 18129 } 18130 function _getResponseText2(xhr) { 18131 try { 18132 var responseType = xhr.responseType; 18133 if (responseType === "" || responseType === "text") { 18134 return xhr[ 18135 _DYN_RESPONSE_TEXT 18136 /* @min:%2eresponseText */ 18137 ]; 18138 } 18139 } catch (e) { 18140 } 18141 return null; 18142 } 18143 function _onAjaxComplete(xhr) { 18144 var ajaxData = _getAjaxData(xhr, _ajaxDataId); 18145 ajaxData[ 18146 _DYN_RESPONSE_FINISHED_TI12 18147 /* @min:%2eresponseFinishedTime */ 18148 ] = dateTimeUtilsNow(); 18149 ajaxData[ 18150 _DYN_STATUS 18151 /* @min:%2estatus */ 18152 ] = xhr[ 18153 _DYN_STATUS 18154 /* @min:%2estatus */ 18155 ]; 18156 function _reportXhrError(e, failedProps) { 18157 var errorProps = failedProps || {}; 18158 errorProps["ajaxDiagnosticsMessage"] = _getFailedAjaxDiagnosticsMessage(xhr, _ajaxDataId); 18159 if (e) { 18160 errorProps["exception"] = /* @__PURE__ */ dumpObj(e); 18161 } 18162 _throwInternalWarning(_self, 14, FAILED_TO_CALCULATE_DURATION_ERROR + "ajax call" + ER
18162ROR_NOT_SENT, errorProps); 18163 } 18164 _findPerfResourceEntry("xmlhttprequest", ajaxData, function() { 18165 try { 18166 var dependency = ajaxData[ 18167 _DYN__CREATE_TRACK_ITEM 18168 /* @min:%2eCreateTrackItem */ 18169 ]("Ajax", _enableRequestHeaderTracking, function() { 18170 var _a2; 18171 var ajaxResponse = (_a2 = { 18172 statusText: xhr[ 18173 _DYN_STATUS_TEXT 18174 /* @min:%2estatusText */ 18175 ], 18176 headerMap: null 18177 }, _a2[ 18178 _DYN_CORRELATION_CONTEXT 18179 /* @min:correlationContext */ 18180 ] = _getAjaxCorrelationContext(xhr), _a2.type = xhr.responseType, _a2[ 18181 _DYN_RESPONSE_TEXT 18182 /* @min:responseText */ 18183 ] = _getResponseText2(xhr), _a2.response = xhr.response, _a2); 18184 if (_enableResponseHeaderTracking) { 18185 var headers = xhr[ 18186 _DYN_GET_ALL_RESPONSE_HEA13 18187 /* @min:%2egetAllResponseHeaders */ 18188 ](); 18189 if (headers) { 18190 var arr = strTrim(headers).split(/[\r\n]+/); 18191 var responseHeaderMap_2 = {}; 18192 arrForEach(arr, function(line) { 18193 var parts = line.split(": "); 18194 var header = parts.shift(); 18195 var value = parts.join(": "); 18196 if (_canIncludeHeaders(header)) { 18197 responseHeaderMap_2[header] = value; 18198 } 18199 }); 18200 ajaxResponse[ 18201 _DYN_HEADER_MAP 18202 /* @min:%2eheaderMap */ 18203 ] = responseHeaderMap_2; 18204 } 18205 } 18206 return ajaxResponse; 18207 }); 18208 var properties = void 0; 18209 try { 18210 if (!!_addRequestContext) { 18211 properties = _addRequestContext({ status: xhr[ 18212 _DYN_STATUS 18213 /* @min:%2estatus */ 18214 ], xhr }); 18215 } 18216 } catch (e) { 18217 _throwInternalWarning(_self, 104, CUSTOM_REQUEST_CONTEXT_ERROR); 18218 } 18219 if (dependency) { 18220 if (properties !== void 0) { 18221 dependency[ 18222 STR_PROPERTIES 18223 /* @min:%2eproperties */ 18224 ] = __assignFn(__assignFn({}, dependency.properties), properties); 18225 } 18226 var sysProperties = ajaxData[ 18227 _DYN_GET_PART_APROPS 18228 /* @min:%2egetPartAProps */ 18229 ](); 18230 _reportDependencyInternal(_dependencyInitializers, _self[ 18231 _DYN_CORE 18232 /* @min:%2ecore */ 18233 ], ajaxData, dependency, null, sysProperties); 18234 } else { 18235 _reportXhrError(null, { 18236 requestSentTime: ajaxData[ 18237 _DYN_REQUEST_SENT_TIME 18238 /* @min:%2erequestSentTime */ 18239 ], 18240 responseFinishedTime: ajaxData[ 18241 _DYN_RESPONSE_FINISHED_TI12 18242 /* @min:%2eresponseFinishedTime */ 18243 ] 18244 }); 18245 } 18246 } finally { 18247 try { 18248 var xhrRequestData = xhr[AJAX_DATA_CONTAINER] || { i: {} }; 18249 var ajaxDataCntr = xhrRequestData.i || {}; 18250 if (ajaxDataCntr[_ajaxDataId]) { 18251 ajaxDataCntr[_ajaxDataId] = null; 18252 } 18253 } catch (e) { 18254 } 18255 } 18256 }, function(e) { 18257 _reportXhrError(e, null); 18258 }); 18259 } 18260 function _getAjaxCorrelationContext(xhr) { 18261 var _a2; 18262 try { 18263 var responseHeadersString = xhr[ 18264 _DYN_GET_ALL_RESPONSE_HEA13 18265 /* @min:%2egetAllResponseHeaders */ 18266 ](); 18267 if (responseHeadersString !== null) { 18268 var index = _indexOf(responseHeadersString[ 18269 _DYN_TO_LOWER_CASE 18270 /* @min:%2etoLowerCase */ 18271 ](), RequestHeaders[ 18272 8 18273 /* eRequestHeaders.requestContextHeaderLowerCase */ 18274 ]); 18275 if (index !== -1) { 18276 var responseHeader = xhr.getResponseHeader(RequestHeaders[ 18277 0 18278 /* eRequestHeaders.requestContextHeader */ 18279 ]); 18280 return correlationIdGetCorrelationContext(responseHeader); 18281 } 18282 } 18283 } catch (e) { 18284 _throwInternalWarning(_self, 18, CORRELATION_HEADER_ERROR, (_a2 = {}, _a2[ 18285 _DYN_AJAX_DIAGNOSTICS_MES14 18286 /* @min:ajaxDiagnosticsMessage */ 18287 ] = _getFailedAjaxDiagnosticsMessage(xhr, _ajaxDataId), _a2.exception = /* @__PURE__ */ dumpObj(e), _a2)); 18288 } 18289 } 18290 function _createMarkId(type, ajaxData) { 18291 if (ajaxData[ 18292 _DYN_REQUEST_URL 18293 /* @min:%2erequestUrl */ 18294 ] && _markPrefix && _enableAjaxPerfTracking) { 18295 var performance_1 = /* @__PURE__ */ getPerformance(); 18296 if (performance_1 && isFunction(performance_1.mark)) { 18297 _markCount++; 18298 var markId = _markPrefix + type + "#" + _markCount; 18299 performance_1.mark(markId); 18300 var entries = performance_1.getEntriesByName(markId);
18301 if (entries && entries[ 18302 _DYN_LENGTH 18303 /* @min:%2elength */ 18304 ] === 1) { 18305 ajaxData[ 18306 _DYN_PERF_MARK 18307 /* @min:%2eperfMark */ 18308 ] = entries[0]; 18309 } 18310 } 18311 } 18312 } 18313 function _findPerfResourceEntry(initiatorType, ajaxData, trackCallback, reportError) { 18314 var perfMark = ajaxData[ 18315 _DYN_PERF_MARK 18316 /* @min:%2eperfMark */ 18317 ]; 18318 var performance = /* @__PURE__ */ getPerformance(); 18319 var maxAttempts = _maxAjaxPerfLookupAttempts; 18320 var retryDelay = _ajaxPerfLookupDelay; 18321 var requestUrl = ajaxData[ 18322 _DYN_REQUEST_URL 18323 /* @min:%2erequestUrl */ 18324 ]; 18325 var attempt = 0; 18326 (function locateResourceTiming() { 18327 try { 18328 if (performance && perfMark) { 18329 attempt++; 18330 var perfTiming = null; 18331 var entries = performance.getEntries(); 18332 for (var lp = entries[ 18333 _DYN_LENGTH 18334 /* @min:%2elength */ 18335 ] - 1; lp >= 0; lp--) { 18336 var entry2 = entries[lp]; 18337 if (entry2) { 18338 if (entry2.entryType === "resource") { 18339 if (entry2.initiatorType === initiatorType && (_indexOf(entry2.name, requestUrl) !== -1 || _indexOf(requestUrl, entry2.name) !== -1)) { 18340 perfTiming = entry2; 18341 } 18342 } else if (entry2.entryType === "mark" && entry2.name === perfMark.name) { 18343 ajaxData[ 18344 _DYN_PERF_TIMING 18345 /* @min:%2eperfTiming */ 18346 ] = perfTiming; 18347 break; 18348 } 18349 if (entry2[ 18350 _DYN_START_TIME 18351 /* @min:%2estartTime */ 18352 ] < perfMark[ 18353 _DYN_START_TIME 18354 /* @min:%2estartTime */ 18355 ] - 1e3) { 18356 break; 18357 } 18358 } 18359 } 18360 } 18361 if (!perfMark || // - we don't have a perfMark or 18362 ajaxData[ 18363 _DYN_PERF_TIMING 18364 /* @min:%2eperfTiming */ 18365 ] || // - we have not found the perf entry or 18366 attempt >= maxAttempts || // - we have tried too many attempts or 18367 ajaxData.async === false) { 18368 if (perfMark && isFunction(performance.clearMarks)) { 18369 performance.clearMarks(perfMark.name); 18370 } 18371 ajaxData.perfAttempts = attempt; 18372 trackCallback(); 18373 } else { 18374 scheduleTimeout(locateResourceTiming, retryDelay); 18375 } 18376 } catch (e) { 18377 reportError(e); 18378 } 18379 })(); 18380 } 18381 function _createFetchRecord(input, init) { 18382 var _a2; 18383 var distributedTraceCtx = _getDistributedTraceCtx(); 18384 var traceID = distributedTraceCtx && distributedTraceCtx[ 18385 _DYN_GET_TRACE_ID 18386 /* @min:%2egetTraceId */ 18387 ]() || generateW3CId(); 18388 var spanID = strSubstr(generateW3CId(), 0, 16); 18389 var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog](), (_a2 = _self.core) === null || _a2 === void 0 ? void 0 : _a2.getTraceCtx()); 18390 ajaxData[ 18391 _DYN_TRACE_FLAGS 18392 /* @min:%2etraceFlags */ 18393 ] = distributedTraceCtx && distributedTraceCtx[ 18394 _DYN_GET_TRACE_FLAGS 18395 /* @min:%2egetTraceFlags */ 18396 ](); 18397 ajaxData[ 18398 _DYN_REQUEST_SENT_TIME 18399 /* @min:%2erequestSentTime */ 18400 ] = dateTimeUtilsNow(); 18401 ajaxData[ 18402 _DYN_ERROR_STATUS_TEXT 18403 /* @min:%2eerrorStatusText */ 18404 ] = _enableAjaxErrorStatusText; 18405 var requestUrl; 18406 if (input instanceof Request) { 18407 requestUrl = (input || {}).url || ""; 18408 } else { 18409 requestUrl = input; 18410 } 18411 if (requestUrl === "") { 18412 var location_1 = getLocation(); 18413 if (location_1 && location_1.href) { 18414 requestUrl = strSplit(location_1.href, "#")[0]; 18415 } 18416 } 18417 ajaxData[ 18418 _DYN_REQUEST_URL 18419 /* @min:%2erequestUrl */ 18420 ] = requestUrl; 18421 var method = "GET"; 18422 if (init && init[ 18423 _DYN_METHOD 18424 /* @min:%2emethod */ 18425 ]) { 18426 method = init[ 18427 _DYN_METHOD 18428 /* @min:%2emethod */ 18429 ]; 18430 } else if (input && input instanceof Request) { 18431 method = input[ 18432 _DYN_METHOD 18433 /* @min:%2emethod */ 18434 ]; 18435 } 18436 ajaxData[ 18437 _DYN_METHOD 18438 /* @min:%2emethod */ 18439 ] = method; 18440 var requestHeaders = {}; 18441 if (_enableRequestHeaderTracking) { 18442 var headers = new Headers((init ? init[ 18443 _DYN_HEADERS 18444 /* @min:%2eheaders */ 18445 ] : 0) || (input instanceof Request ? input[ 18446 _DYN_HEADERS 18447 /* @min:%2eheaders */ 18448 ] || {} : {}));
18449 headers.forEach(function(value, key) { 18450 if (_canIncludeHeaders(key)) { 18451 requestHeaders[key] = value; 18452 } 18453 }); 18454 } 18455 ajaxData[ 18456 _DYN_REQUEST_HEADERS 18457 /* @min:%2erequestHeaders */ 18458 ] = requestHeaders; 18459 _createMarkId(STR_FETCH, ajaxData); 18460 return ajaxData; 18461 } 18462 function _getFailedFetchDiagnosticsMessage(input) { 18463 var result = ""; 18464 try { 18465 if (!/* @__PURE__ */ isNullOrUndefined(input)) { 18466 if (typeof input === "string") { 18467 result += "(url: '".concat(input, "')"); 18468 } else { 18469 result += "(url: '".concat(input.url, "')"); 18470 } 18471 } 18472 } catch (e) { 18473 _throwInternalCritical(_self, 15, "Failed to grab failed fetch diagnostics message", { exception: /* @__PURE__ */ dumpObj(e) }); 18474 } 18475 return result; 18476 } 18477 function _reportFetchMetrics(callDetails, status, input, response, ajaxData, getResponse, properties) { 18478 if (!ajaxData) { 18479 return; 18480 } 18481 function _reportFetchError(msgId, e, failedProps) { 18482 var errorProps = failedProps || {}; 18483 errorProps["fetchDiagnosticsMessage"] = _getFailedFetchDiagnosticsMessage(input); 18484 if (e) { 18485 errorProps["exception"] = /* @__PURE__ */ dumpObj(e); 18486 } 18487 _throwInternalWarning(_self, msgId, FAILED_TO_CALCULATE_DURATION_ERROR + "fetch call" + ERROR_NOT_SENT, errorProps); 18488 } 18489 ajaxData[ 18490 _DYN_RESPONSE_FINISHED_TI12 18491 /* @min:%2eresponseFinishedTime */ 18492 ] = dateTimeUtilsNow(); 18493 ajaxData[ 18494 _DYN_STATUS 18495 /* @min:%2estatus */ 18496 ] = status; 18497 _findPerfResourceEntry(STR_FETCH, ajaxData, function() { 18498 var dependency = ajaxData[ 18499 _DYN__CREATE_TRACK_ITEM 18500 /* @min:%2eCreateTrackItem */ 18501 ]("Fetch", _enableRequestHeaderTracking, getResponse); 18502 var properties2; 18503 try { 18504 if (!!_addRequestContext) { 18505 properties2 = _addRequestContext({ status, request: input, response }); 18506 } 18507 } catch (e) { 18508 _throwInternalWarning(_self, 104, CUSTOM_REQUEST_CONTEXT_ERROR); 18509 } 18510 if (dependency) { 18511 if (properties2 !== void 0) { 18512 dependency[ 18513 STR_PROPERTIES 18514 /* @min:%2eproperties */ 18515 ] = __assignFn(__assignFn({}, dependency.properties), properties2); 18516 } 18517 var sysProperties = ajaxData[ 18518 _DYN_GET_PART_APROPS 18519 /* @min:%2egetPartAProps */ 18520 ](); 18521 _reportDependencyInternal(_dependencyInitializers, _self[ 18522 _DYN_CORE 18523 /* @min:%2ecore */ 18524 ], ajaxData, dependency, null, sysProperties); 18525 } else { 18526 _reportFetchError(14, null, { 18527 requestSentTime: ajaxData[ 18528 _DYN_REQUEST_SENT_TIME 18529 /* @min:%2erequestSentTime */ 18530 ], 18531 responseFinishedTime: ajaxData[ 18532 _DYN_RESPONSE_FINISHED_TI12 18533 /* @min:%2eresponseFinishedTime */ 18534 ] 18535 }); 18536 } 18537 }, function(e) { 18538 _reportFetchError(18, e, null); 18539 }); 18540 } 18541 function _getFetchCorrelationContext(response) { 18542 if (response && response[ 18543 _DYN_HEADERS 18544 /* @min:%2eheaders */ 18545 ]) { 18546 try { 18547 var responseHeader = response[ 18548 _DYN_HEADERS 18549 /* @min:%2eheaders */ 18550 ].get(RequestHeaders[ 18551 0 18552 /* eRequestHeaders.requestContextHeader */ 18553 ]); 18554 return correlationIdGetCorrelationContext(responseHeader); 18555 } catch (e) { 18556 _throwInternalWarning(_self, 18, CORRELATION_HEADER_ERROR, { 18557 fetchDiagnosticsMessage: _getFailedFetchDiagnosticsMessage(response), 18558 exception: /* @__PURE__ */ dumpObj(e) 18559 }); 18560 } 18561 } 18562 }
vendor: 10,165 bytes, lines 18563-18848
18563 function _reportDependencyInternal(initializers, core, ajaxData, dependency, properties, systemProperties) { 18564 var result = true; 18565 var initializersCount = initializers[ 18566 _DYN_LENGTH 18567 /* @min:%2elength */ 18568 ]; 18569 if (initializersCount > 0) { 18570 var details = { 18571 item: dependency, 18572 properties, 18573 sysProperties: systemProperties, 18574 context: ajaxData ? ajaxData[ 18575 _DYN_CONTEXT$1 18576 /* @min:%2econtext */ 18577 ] : null, 18578 aborted: ajaxData ? !!ajaxData[ 18579 _DYN_ABORTED 18580 /* @min:%2eaborted */ 18581 ] : false 18582 }; 18583 result = _processDependencyContainer(core, initializers, details, "initializer"); 18584 } 18585 if (result) { 18586 _self[ 18587 _DYN_TRACK_DEPENDENCY_DAT1 18588 /* @min:%2etrackDependencyDataInternal */ 18589 ](dependency, properties, systemProperties); 18590 } 18591 } 18592 }); 18593 return _this; 18594 } 18595 AjaxMonitor2.prototype.processTelemetry = function(item, itemCtx) { 18596 this.processNext(item, itemCtx); 18597 }; 18598 AjaxMonitor2.prototype.addDependencyInitializer = function(dependencyInitializer) { 18599 return null; 18600 }; 18601 AjaxMonitor2.identifier = "AjaxDependencyPlugin"; 18602 return AjaxMonitor2; 18603 }(BaseTelemetryPlugin) 18604); 18605var Application = ( 18606 /** @class */ 18607 /* @__PURE__ */ function() { 18608 function Application2() { 18609 } 18610 return Application2; 18611 }() 18612); 18613var Device = ( 18614 /** @class */ 18615 /* @__PURE__ */ function() { 18616 function Device2() { 18617 this.id = "browser"; 18618 this.deviceClass = "Browser"; 18619 } 18620 return Device2; 18621 }() 18622); 18623var Version = "3.3.8"; 18624var Internal = ( 18625 /** @class */ 18626 /* @__PURE__ */ function() { 18627 function Internal2(config, unloadHookContainer) { 18628 var _this = this; 18629 var unloadHook = onConfigChange(config, function() { 18630 var prefix = config.sdkExtension; 18631 _this.sdkVersion = (prefix ? prefix + "_" : "") + "javascript:" + Version; 18632 }); 18633 unloadHookContainer && unloadHookContainer.add(unloadHook); 18634 } 18635 return Internal2; 18636 }() 18637); 18638var Location = ( 18639 /** @class */ 18640 /* @__PURE__ */ function() { 18641 function Location2() { 18642 } 18643 return Location2; 18644 }() 18645); 18646var _DYN_SESSION = "session"; 18647var _DYN_SESSION_MANAGER = "sessionManager"; 18648var _DYN_IS_USER_COOKIE_SET = "isUserCookieSet"; 18649var _DYN_IS_NEW_USER = "isNewUser"; 18650var _DYN_GET_TRACE_CTX = "getTraceCtx"; 18651var _DYN_TELEMETRY_TRACE = "telemetryTrace"; 18652var _DYN_APPLY_SESSION_CONTEX0 = "applySessionContext"; 18653var _DYN_APPLY_APPLICATION_CO1 = "applyApplicationContext"; 18654var _DYN_APPLY_OPERATION_CONT2 = "applyOperationContext"; 18655var _DYN_APPLY_OPERATING_SYST3 = "applyOperatingSystemContxt"; 18656var _DYN_APPLY_LOCATION_CONTE4 = "applyLocationContext"; 18657var _DYN_APPLY_INTERNAL_CONTE5 = "applyInternalContext"; 18658var _DYN_GET_SESSION_ID = "getSessionId"; 18659var _DYN_SESSION_COOKIE_POSTF6 = "sessionCookiePostfix"; 18660var _DYN_AUTOMATIC_SESSION = "automaticSession"; 18661var _DYN_ACCOUNT_ID = "accountId"; 18662var _DYN_AUTHENTICATED_ID = "authenticatedId"; 18663var _DYN_ACQUISITION_DATE = "acquisitionDate"; 18664var _DYN_RENEWAL_DATE = "renewalDate"; 18665var _DYN_COOKIE_SEPARATOR = "cookieSeparator"; 18666var _DYN_AUTH_USER_COOKIE_NAM7 = "authUserCookieName"; 18667var SESSION_COOKIE_NAME = "ai_session"; 18668var ACQUISITION_SPAN = 864e5; 18669var RENEWAL_SPAN = 18e5; 18670var COOKIE_UPDATE_INTERVAL = 6e4; 18671var Session = ( 18672 /** @class */ 18673 /* @__PURE__ */ function() { 18674 function Session2() { 18675 } 18676 return Session2; 18677 }() 18678); 18679var _SessionManager = ( 18680 /** @class */ 18681 function() { 18682 function _SessionManager2(config, core, unloadHookContainer) { 18683 var self2 = this; 18684 var _storageNamePrefix; 18685 var _cookieUpdatedTimestamp; 18686 var _logger = safeGetLogger(core); 18687 var _cookieManager = safeGetCookieMgr(core); 18688 var _sessionExpirationMs; 18689 var _sessionRenewalMs; 18690 dynamicProto(_SessionManager2, self2, function(_self) { 18691 if (!config) { 18692 config = {}; 18693 } 18694 var unloadHook = onConfigChange(config, function(details) { 18695 _sessionExpirationMs = config.sessionExpirationMs || ACQUISITION_SPAN; 18696 _sessionRenewalMs = config.sessionRenewalMs || RENEWAL_SPAN; 18697 var sessionCookiePostfix = config[ 18698 _DYN_SESSION_COOKIE_POSTF6 18699 /* @min:%2esessionCookiePostfix */ 18700 ] || config.namePrefix || ""; 18701 _storageNamePrefix = SESSION_COOKIE_NAME + sessionCookiePostfix; 18702 }); 18703 unloadHookContainer && unloadHookContainer.add(unloadHook); 18704 _self[ 18705 _DYN_AUTOMATIC_SESSION 18706 /* @min:%2eautomaticSession */ 18707 ] = new Session(); 18708 _self.update = function() { 18709 var nowMs = /* @__PURE__ */ utcNow(); 18710 var isExpired = false; 18711 var session = _self[ 18712 _DYN_AUTOMATIC_SESSION 18713 /* @min:%2eautomaticSession */ 18714 ]; 18715 if (!session.id) { 18716 isExpired = !_initializeAutomaticSession(session); 18717 } 18718 if (!isExpired && _sessionExpirationMs > 0) { 18719 var timeSinceAcqMs = nowMs - session[ 18720 _DYN_ACQUISITION_DATE 18721 /* @min:%2eacquisitionDate */ 18722 ]; 18723 var timeSinceRenewalMs = nowMs - session[ 18724 _DYN_RENEWAL_DATE 18725 /* @min:%2erenewalDate */ 18726 ]; 18727 isExpired = timeSinceAcqMs < 0 || timeSinceRenewalMs < 0; 18728 isExpired = isExpired || timeSinceAcqMs > _sessionExpirationMs; 18729 isExpired = isExpired || timeSinceRenewalMs > _sessionRenewalMs; 18730 } 18731 if (isExpired) { 18732 _renew(nowMs); 18733 } else { 18734 if (!_cookieUpdatedTimestamp || nowMs - _cookieUpdatedTimestamp > COOKIE_UPDATE_INTERVAL) { 18735 _setCookie(session, nowMs); 18736 } 18737 } 18738 }; 18739 _self.backup = function() { 18740 var session = _self[ 18741 _DYN_AUTOMATIC_SESSION 18742 /* @min:%2eautomaticSession */ 18743 ]; 18744 _setStorage(session.id, session[ 18745 _DYN_ACQUISITION_DATE 18746 /* @min:%2eacquisitionDate */ 18747 ], session[ 18748 _DYN_RENEWAL_DATE 18749 /* @min:%2erenewalDate */ 18750 ]); 18751 }; 18752 function _initializeAutomaticSession(session, now) { 18753 var isValid = false; 18754 var cookieValue = _cookieManager.get(_storageNamePrefix); 18755 if (cookieValue && isFunction(cookieValue.split)) { 18756 isValid = _initializeAutomaticSessionWithData(session, cookieValue); 18757 } else { 18758 var storageValue = utlGetLocalStorage(_logger, _storageNamePrefix); 18759 if (storageValue) { 18760 isValid = _initializeAutomaticSessionWithData(session, storageValue); 18761 } 18762 } 18763 return isValid || !!session.id; 18764 } 18765 function _initializeAutomaticSessionWithData(session, sessionData) { 18766 var isValid = false; 18767 var sessionReset = ", session will be reset"; 18768 var tokens = sessionData.split("|"); 18769 if (tokens.length >= 2) { 18770 try { 18771 var acqMs = +tokens[1] || 0; 18772 var renewalMs = +tokens[2] || 0; 18773 if (isNaN(acqMs) || acqMs <= 0) { 18774 _throwInternal(_logger, 2, 27, "AI session acquisition date is 0" + sessionReset); 18775 } else if (isNaN(renewalMs) || renewalMs <= 0) { 18776 _throwInternal(_logger, 2, 27, "AI session renewal date is 0" + sessionReset); 18777 } else if (tokens[0]) { 18778 session.id = tokens[0]; 18779 session[ 18780 _DYN_ACQUISITION_DATE 18781 /* @min:%2eacquisitionDate */ 18782 ] = acqMs; 18783 session[ 18784 _DYN_RENEWAL_DATE 18785 /* @min:%2erenewalDate */ 18786 ] = renewalMs; 18787 isValid = true; 18788 } 18789 } catch (e) { 18790 _throwInternal(_logger, 1, 9, "Error parsing ai_session value [" + (sessionData || "") + "]" + sessionReset + " - " + getExceptionName(e), { exception: /* @__PURE__ */ dumpObj(e) }); 18791 } 18792 } 18793 return isValid; 18794 } 18795 function _renew(nowMs) { 18796 var getNewId = config.getNewId || newId; 18797 _self[ 18798 _DYN_AUTOMATIC_SESSION 18799 /* @min:%2eautomaticSession */ 18800 ].id = getNewId(config.idLength || 22); 18801 _self[ 18802 _DYN_AUTOMATIC_SESSION 18803 /* @min:%2eautomaticSession */ 18804 ][ 18805 _DYN_ACQUISITION_DATE 18806 /* @min:%2eacquisitionDate */ 18807 ] = nowMs; 18808 _setCookie(_self[ 18809 _DYN_AUTOMATIC_SESSION 18810 /* @min:%2eautomaticSession */ 18811 ], nowMs); 18812 if (!utlCanUseLocalStorage()) { 18813 _throwInternal(_logger, 2, 0, "Browser does not support local storage. Session durations will be inaccurate."); 18814 } 18815 } 18816 function _setCookie(session, nowMs) { 18817 var acq = session[ 18818 _DYN_ACQUISITION_DATE 18819 /* @min:%2eacquisitionDate */ 18820 ]; 18821 session[ 18822 _DYN_RENEWAL_DATE 18823 /* @min:%2erenewalDate */ 18824 ] = nowMs; 18825 var renewalPeriodMs = _sessionRenewalMs; 18826 var acqTimeLeftMs = acq + _sessionExpirationMs - nowMs; 18827 var cookie = [session.id, acq, nowMs]; 18828 var maxAgeSec = 0; 18829 if (acqTimeLeftMs < renewalPeriodMs) { 18830 maxAgeSec = acqTimeLeftMs / 1e3; 18831 } else { 18832 maxAgeSec = renewalPeriodMs / 1e3; 18833 } 18834 var cookieDomain = config.cookieDomain || null; 18835 _cookieManager.set(_storageNamePrefix, cookie.join("|"), _sessionExpirationMs > 0 ? maxAgeSec : null, cookieDomain); 18836 _cookieUpdatedTimestamp = nowMs; 18837 } 18838 function _setStorage(guid, acq, renewal) { 18839 utlSetLocalStorage(_logger, _storageNamePrefix, [guid, acq, renewal].join("|")); 18840 } 18841 }); 18842 } 18843 _SessionManager2.__ieDyn = 1; 18844 return _SessionManager2; 18845 }() 18846); 18847var TelemetryTrace = ( 18848 /** @class */
18849 /* @__PURE__ */ function() { 18850 function TelemetryTrace2(id, parentId, name, logger) { 18851 var _self = this; 18852 _self.traceID = id || generateW3CId(); 18853 _self.parentID = parentId; 18854 var location2 = getLocation(); 18855 if (!name && location2 && location2.pathname) { 18856 name = location2.pathname; 18857 } 18858 _self.name = dataSanitizeString(logger, name); 18859 } 18860 return TelemetryTrace2; 18861 }() 18862); 18863function _validateUserInput(id) { 18864 if (typeof id !== "string" || !id || id.match(/,|;|=| |\|/)) { 18865 return false; 18866 } 18867 return true; 18868} 18869var User = ( 18870 /** @class */ 18871 function() { 18872 function User2(config, core, unloadHookContainer) { 18873 this.isNewUser = false; 18874 this.isUserCookieSet = false; 18875 var _logger = safeGetLogger(core); 18876 var _cookieManager = safeGetCookieMgr(core); 18877 var _storageNamePrefix; 18878 dynamicProto(User2, this, function(_self) { 18879 objDefine(_self, "config", { 18880 g: function() { 18881 return config; 18882 } 18883 }); 18884 var unloadHook = onConfigChange(config, function() { 18885 var userCookiePostfix = config.userCookiePostfix || ""; 18886 _storageNamePrefix = User2.userCookieName + userCookiePostfix; 18887 var cookie = _cookieManager.get(_storageNamePrefix); 18888 if (cookie) { 18889 _self[ 18890 _DYN_IS_NEW_USER 18891 /* @min:%2eisNewUser */ 18892 ] = false; 18893 var params = cookie.split(User2[ 18894 _DYN_COOKIE_SEPARATOR 18895 /* @min:%2ecookieSeparator */ 18896 ]); 18897 if (params.length > 0) { 18898 _self.id = params[0]; 18899 _self[ 18900 _DYN_IS_USER_COOKIE_SET 18901 /* @min:%2eisUserCookieSet */ 18902 ] = !!_self.id; 18903 } 18904 } 18905 if (!_self.id) { 18906 _self.id = _generateNewId(); 18907 var newCookie = _generateNewCookie(_self.id); 18908 _setUserCookie(newCookie.join(User2[ 18909 _DYN_COOKIE_SEPARATOR 18910 /* @min:%2ecookieSeparator */ 18911 ])); 18912 var name_1 = (config.namePrefix || "") + "ai_session"; 18913 utlRemoveStorage(_logger, name_1); 18914 } 18915 _self[ 18916 _DYN_ACCOUNT_ID 18917 /* @min:%2eaccountId */ 18918 ] = config[ 18919 _DYN_ACCOUNT_ID 18920 /* @min:%2eaccountId */ 18921 ] || void 0; 18922 var authCookie = _cookieManager.get(User2[ 18923 _DYN_AUTH_USER_COOKIE_NAM7 18924 /* @min:%2eauthUserCookieName */ 18925 ]); 18926 if (authCookie) { 18927 authCookie = decodeURI(authCookie); 18928 var authCookieString = authCookie.split(User2[ 18929 _DYN_COOKIE_SEPARATOR 18930 /* @min:%2ecookieSeparator */ 18931 ]); 18932 if (authCookieString[0]) { 18933 _self[ 18934 _DYN_AUTHENTICATED_ID 18935 /* @min:%2eauthenticatedId */ 18936 ] = authCookieString[0]; 18937 } 18938 if (authCookieString.length > 1 && authCookieString[1]) { 18939 _self[ 18940 _DYN_ACCOUNT_ID 18941 /* @min:%2eaccountId */ 18942 ] = authCookieString[1]; 18943 } 18944 } 18945 }); 18946 unloadHookContainer && unloadHookContainer.add(unloadHook); 18947 function _generateNewId() { 18948 var theConfig = config || {}; 18949 var getNewId = theConfig.getNewId || newId; 18950 var id = getNewId(theConfig.idLength ? config.idLength : 22); 18951 return id; 18952 } 18953 function _generateNewCookie(userId) { 18954 var acqStr = toISOString(/* @__PURE__ */ new Date()); 18955 _self.accountAcquisitionDate = acqStr; 18956 _self[ 18957 _DYN_IS_NEW_USER 18958 /* @min:%2eisNewUser */ 18959 ] = true; 18960 var newCookie = [userId, acqStr]; 18961 return newCookie; 18962 } 18963 function _setUserCookie(cookie) { 18964 var oneYear = 31536e3; 18965 _self[ 18966 _DYN_IS_USER_COOKIE_SET 18967 /* @min:%2eisUserCookieSet */ 18968 ] = _cookieManager.set(_storageNamePrefix, cookie, oneYear); 18969 } 18970 _self.setAuthenticatedUserContext = function(authenticatedUserId, accountId, storeInCookie) { 18971 if (storeInCookie === void 0) { 18972 storeInCookie = false;
18973 } 18974 var isInvalidInput = !_validateUserInput(authenticatedUserId) || accountId && !_validateUserInput(accountId); 18975 if (isInvalidInput) { 18976 _throwInternal(_logger, 2, 60, "Setting auth user context failed. User auth/account id should be of type string, and not contain commas, semi-colons, equal signs, spaces, or vertical-bars.", true); 18977 return; 18978 } 18979 _self[ 18980 _DYN_AUTHENTICATED_ID 18981 /* @min:%2eauthenticatedId */ 18982 ] = authenticatedUserId; 18983 var authCookie = _self[ 18984 _DYN_AUTHENTICATED_ID 18985 /* @min:%2eauthenticatedId */ 18986 ]; 18987 if (accountId) { 18988 _self[ 18989 _DYN_ACCOUNT_ID 18990 /* @min:%2eaccountId */ 18991 ] = accountId; 18992 authCookie = [_self[ 18993 _DYN_AUTHENTICATED_ID 18994 /* @min:%2eauthenticatedId */ 18995 ], _self.accountId].join(User2[ 18996 _DYN_COOKIE_SEPARATOR 18997 /* @min:%2ecookieSeparator */ 18998 ]); 18999 } 19000 if (storeInCookie) { 19001 _cookieManager.set(User2[ 19002 _DYN_AUTH_USER_COOKIE_NAM7 19003 /* @min:%2eauthUserCookieName */ 19004 ], encodeURI(authCookie)); 19005 } 19006 }; 19007 _self.clearAuthenticatedUserContext = function() { 19008 _self[ 19009 _DYN_AUTHENTICATED_ID 19010 /* @min:%2eauthenticatedId */ 19011 ] = null; 19012 _self[ 19013 _DYN_ACCOUNT_ID 19014 /* @min:%2eaccountId */ 19015 ] = null; 19016 _cookieManager.del(User2[ 19017 _DYN_AUTH_USER_COOKIE_NAM7 19018 /* @min:%2eauthUserCookieName */ 19019 ]); 19020 }; 19021 _self.update = function(userId) { 19022 if (_self.id !== userId || !_self[ 19023 _DYN_IS_USER_COOKIE_SET 19024 /* @min:%2eisUserCookieSet */ 19025 ]) { 19026 var user_id = userId ? userId : _generateNewId(); 19027 var user_cookie = _generateNewCookie(user_id); 19028 _setUserCookie(user_cookie.join(User2[ 19029 _DYN_COOKIE_SEPARATOR 19030 /* @min:%2ecookieSeparator */ 19031 ])); 19032 } 19033 }; 19034 }); 19035 } 19036 User2.cookieSeparator = "|"; 19037 User2.userCookieName = "ai_user"; 19038 User2.authUserCookieName = "ai_authUser"; 19039 return User2; 19040 }() 19041); 19042var strExt = "ext"; 19043var strTags = "tags"; 19044function _removeEmpty(target, name) { 19045 if (target && target[name] && objKeys(target[name]).length === 0) { 19046 delete target[name]; 19047 } 19048} 19049function _nullResult() { 19050 return null; 19051} 19052var TelemetryContext = ( 19053 /** @class */ 19054 function() { 19055 function TelemetryContext2(core, defaultConfig2, previousTraceCtx, unloadHookContainer) { 19056 var _this = this; 19057 var logger = core.logger; 19058 dynamicProto(TelemetryContext2, this, function(_self) { 19059 _self.appId = _nullResult; 19060 _self[ 19061 _DYN_GET_SESSION_ID 19062 /* @min:%2egetSessionId */ 19063 ] = _nullResult; 19064 _self.application = new Application(); 19065 _self.internal = new Internal(defaultConfig2, unloadHookContainer); 19066 if (/* @__PURE__ */ hasWindow()) { 19067 _self[ 19068 _DYN_SESSION_MANAGER 19069 /* @min:%2esessionManager */ 19070 ] = new _SessionManager(defaultConfig2, core, unloadHookContainer); 19071 _self.device = new Device(); 19072 _self.location = new Location(); 19073 _self.user = new User(defaultConfig2, core, unloadHookContainer); 19074 var traceId = void 0; 19075 var parentId = void 0; 19076 var name_1; 19077 if (previousTraceCtx) { 19078 traceId = previousTraceCtx.getTraceId(); 19079 parentId = previousTraceCtx.getSpanId(); 19080 name_1 = previousTraceCtx.getName(); 19081 } 19082 _self[ 19083 _DYN_TELEMETRY_TRACE 19084 /* @min:%2etelemetryTrace */ 19085 ] = new TelemetryTrace(traceId, parentId, name_1, logger); 19086 _self[ 19087 _DYN_SESSION 19088 /* @min:%2esession */ 19089 ] = new Session(); 19090 } 19091 _self[ 19092 _DYN_GET_SESSION_ID 19093 /* @min:%2egetSessionId */ 19094 ] = function() { 19095 var session = _self[ 19096 _DYN_SESSION 19097 /* @min:%2esession */ 19098 ]; 19099 var sesId = null; 19100 if (session && isString(session.id)) { 19101 sesId = session.id; 19102 } else { 19103 var autoSession = (_self[ 19104 _DYN_SESSION_MANAGER 19105 /* @min:%2esessionManager */ 19106 ] || {})[ 19107 _DYN_AUTOMATIC_SESSION 19108 /* @min:%2eautomaticSession */ 19109 ]; 19110 sesId = autoSession && isString(autoSession.id) ? autoSession.id : null; 19111 } 19112 return sesId; 19113 }; 19114 _self[ 19115 _DYN_APPLY_SESSION_CONTEX0 19116 /* @min:%2eapplySessionContext */ 19117 ] = function(evt, itemCtx) { 19118 setValue(getSetValue(evt.ext, Extensions.AppExt), "sesId", _self[ 19119 _DYN_GET_SESSION_ID 19120 /* @min:%2egetSessionId */ 19121 ](), isString); 19122 }; 19123 _self[ 19124 _DYN_APPLY_OPERATING_SYST3 19125 /* @min:%2eapplyOperatingSystemContxt */ 19126 ] = function(evt, itemCtx) { 19127 setValue(evt.ext, Extensions.OSExt, _self.os); 19128 }; 19129 _self[
vendor: 6,980 bytes, lines 19130-19310
19130 _DYN_APPLY_APPLICATION_CO1 19131 /* @min:%2eapplyApplicationContext */ 19132 ] = function(evt, itemCtx) { 19133 var application = _self.application; 19134 if (application) { 19135 var tags = getSetValue(evt, strTags); 19136 setValue(tags, CtxTagKeys.applicationVersion, application.ver, isString); 19137 setValue(tags, CtxTagKeys.applicationBuild, application.build, isString); 19138 } 19139 }; 19140 _self.applyDeviceContext = function(evt, itemCtx) { 19141 var device = _self.device; 19142 if (device) { 19143 var extDevice = getSetValue(getSetValue(evt, strExt), Extensions.DeviceExt); 19144 setValue(extDevice, "localId", device.id, isString); 19145 setValue(extDevice, "ip", device.ip, isString); 19146 setValue(extDevice, "model", device.model, isString); 19147 setValue(extDevice, "deviceClass", device.deviceClass, isString); 19148 } 19149 }; 19150 _self[ 19151 _DYN_APPLY_INTERNAL_CONTE5 19152 /* @min:%2eapplyInternalContext */ 19153 ] = function(evt, itemCtx) { 19154 var internal = _self.internal; 19155 if (internal) { 19156 var tags = getSetValue(evt, strTags); 19157 setValue(tags, CtxTagKeys.internalAgentVersion, internal.agentVersion, isString); 19158 setValue(tags, CtxTagKeys.internalSdkVersion, dataSanitizeString(logger, internal.sdkVersion, 64), isString); 19159 if (evt.baseType === _InternalLogMessage.dataType || evt.baseType === PageView.dataType) { 19160 setValue(tags, CtxTagKeys.internalSnippet, internal.snippetVer, isString); 19161 setValue(tags, CtxTagKeys.internalSdkSrc, internal.sdkSrc, isString); 19162 } 19163 } 19164 }; 19165 _self[ 19166 _DYN_APPLY_LOCATION_CONTE4 19167 /* @min:%2eapplyLocationContext */ 19168 ] = function(evt, itemCtx) { 19169 var location2 = _this.location; 19170 if (location2) { 19171 setValue(getSetValue(evt, strTags, []), CtxTagKeys.locationIp, location2.ip, isString); 19172 } 19173 }; 19174 _self[ 19175 _DYN_APPLY_OPERATION_CONT2 19176 /* @min:%2eapplyOperationContext */ 19177 ] = function(evt, itemCtx) { 19178 var telemetryTrace = _self[ 19179 _DYN_TELEMETRY_TRACE 19180 /* @min:%2etelemetryTrace */ 19181 ]; 19182 if (telemetryTrace) { 19183 var extTrace = getSetValue(getSetValue(evt, strExt), Extensions.TraceExt, { traceID: void 0, parentID: void 0 }); 19184 setValue(extTrace, "traceID", telemetryTrace.traceID, isString, isNullOrUndefined); 19185 setValue(extTrace, "name", telemetryTrace.name, isString, isNullOrUndefined); 19186 setValue(extTrace, "parentID", telemetryTrace.parentID, isString, isNullOrUndefined); 19187 } 19188 }; 19189 _self.applyWebContext = function(evt, itemCtx) { 19190 var web = _this.web; 19191 if (web) { 19192 setValue(getSetValue(evt, strExt), Extensions.WebExt, web); 19193 } 19194 }; 19195 _self.applyUserContext = function(evt, itemCtx) { 19196 var user = _self.user; 19197 if (user) { 19198 var tags = getSetValue(evt, strTags, []); 19199 setValue(tags, CtxTagKeys.userAccountId, user[ 19200 _DYN_ACCOUNT_ID 19201 /* @min:%2eaccountId */ 19202 ], isString); 19203 var extUser = getSetValue(getSetValue(evt, strExt), Extensions.UserExt); 19204 setValue(extUser, "id", user.id, isString); 19205 setValue(extUser, "authId", user[ 19206 _DYN_AUTHENTICATED_ID 19207 /* @min:%2eauthenticatedId */ 19208 ], isString); 19209 } 19210 }; 19211 _self.cleanUp = function(evt, itemCtx) { 19212 var ext = evt.ext; 19213 if (ext) { 19214 _removeEmpty(ext, Extensions.DeviceExt); 19215 _removeEmpty(ext, Extensions.UserExt); 19216 _removeEmpty(ext, Extensions.WebExt); 19217 _removeEmpty(ext, Extensions.OSExt); 19218 _removeEmpty(ext, Extensions.AppExt); 19219 _removeEmpty(ext, Extensions.TraceExt); 19220 } 19221 }; 19222 }); 19223 } 19224 TelemetryContext2.__ieDyn = 1; 19225 return TelemetryContext2; 19226 }() 19227); 19228var _a$1; 19229var undefString; 19230var nullValue = null; 19231var _defaultConfig = objDeepFreeze((_a$1 = { 19232 accountId: nullValue, 19233 sessionRenewalMs: 30 * 60 * 1e3, 19234 samplingPercentage: 100, 19235 sessionExpirationMs: 24 * 60 * 60 * 1e3, 19236 cookieDomain: nullValue, 19237 sdkExtension: nullValue, 19238 isBrowserLinkTrackingEnabled: false, 19239 appId: nullValue 19240}, _a$1[ 19241 _DYN_GET_SESSION_ID 19242 /* @min:getSessionId */ 19243] = nullValue, _a$1.namePrefix = undefString, _a$1[ 19244 _DYN_SESSION_COOKIE_POSTF6 19245 /* @min:sessionCookiePostfix */ 19246] = undefString, _a$1.userCookiePostfix = undefString, _a$1.idLength = 22, _a$1.getNewId = nullValue, _a$1)); 19247var PropertiesPlugin = ( 19248 /** @class */ 19249 function(_super) { 19250 __extendsFn(PropertiesPlugin2, _super); 19251 function PropertiesPlugin2() { 19252 var _this = _super.call(this) || this; 19253 _this.priority = 110; 19254 _this.identifier = PropertiesPluginIdentifier; 19255 var _extensionConfig; 19256 var _distributedTraceCtx; 19257 var _previousTraceCtx; 19258 var _context; 19259 var _disableUserInitMessage; 19260 dynamicProto(PropertiesPlugin2, _this, function(_self, _base) { 19261 _initDefaults(); 19262 objDefine(_self, "context", { 19263 g: function() { 19264 return _context; 19265 } 19266 }); 19267 _self.initialize = function(config, core, extensions, pluginChain) { 19268 _base.initialize(config, core, extensions, pluginChain); 19269 _populateDefaults(config); 19270 }; 19271 _self.processTelemetry = function(event, itemCtx) { 19272 if (!/* @__PURE__ */ isNullOrUndefined(event)) { 19273 itemCtx = _self._getTelCtx(itemCtx); 19274 if (event.name === PageView.envelopeType) { 19275 itemCtx.diagLog().resetInternalMessageCount(); 19276 } 19277 var theContext = _context || {}; 19278 if (theContext[ 19279 _DYN_SESSION 19280 /* @min:%2esession */ 19281 ]) { 19282 if (typeof _context[ 19283 _DYN_SESSION 19284 /* @min:%2esession */ 19285 ].id !== "string" && theContext[ 19286 _DYN_SESSION_MANAGER 19287 /* @min:%2esessionManager */ 19288 ]) { 19289 theContext[ 19290 _DYN_SESSION_MANAGER 19291 /* @min:%2esessionManager */ 19292 ].update(); 19293 } 19294 } 19295 var userCtx = theContext.user; 19296 if (userCtx && !userCtx[ 19297 _DYN_IS_USER_COOKIE_SET 19298 /* @min:%2eisUserCookieSet */ 19299 ]) { 19300 userCtx.update(theContext.user.id); 19301 } 19302 _processTelemetryInternal(event, itemCtx); 19303 if (userCtx && userCtx[ 19304 _DYN_IS_NEW_USER 19305 /* @min:%2eisNewUser */ 19306 ]) { 19307 userCtx[ 19308 _DYN_IS_NEW_USER 19309 /* @min:%2eisNewUser */ 19310 ] = false;
19311 if (!_disableUserInitMessage) { 19312 var message = new _InternalLogMessage(72, (getNavigator() || {}).userAgent || ""); 19313 _logInternalMessage(itemCtx.diagLog(), 1, message); 19314 } 19315 } 19316 _self.processNext(event, itemCtx); 19317 } 19318 }; 19319 _self._doTeardown = function(unloadCtx, unloadState) { 19320 var core = (unloadCtx || {}).core(); 19321 if (core && core[ 19322 _DYN_GET_TRACE_CTX 19323 /* @min:%2egetTraceCtx */ 19324 ]) { 19325 var traceCtx = core[ 19326 _DYN_GET_TRACE_CTX 19327 /* @min:%2egetTraceCtx */ 19328 ](false); 19329 if (traceCtx === _distributedTraceCtx) { 19330 core.setTraceCtx(_previousTraceCtx); 19331 } 19332 } 19333 _initDefaults(); 19334 }; 19335 function _initDefaults() { 19336 _extensionConfig = null; 19337 _distributedTraceCtx = null; 19338 _previousTraceCtx = null; 19339 _context = null; 19340 _disableUserInitMessage = true; 19341 } 19342 function _populateDefaults(config) { 19343 var identifier = _self.identifier; 19344 var core = _self.core; 19345 _self._addHook(onConfigChange(config, function() { 19346 var ctx = createProcessTelemetryContext(null, config, core); 19347 if (config.storagePrefix) { 19348 utlSetStoragePrefix(config.storagePrefix); 19349 } 19350 _disableUserInitMessage = config.disableUserInitMessage === false ? false : true; 19351 _extensionConfig = ctx.getExtCfg(identifier, _defaultConfig); 19352 _self["_extConfig"] = _extensionConfig; 19353 })); 19354 _previousTraceCtx = core[ 19355 _DYN_GET_TRACE_CTX 19356 /* @min:%2egetTraceCtx */ 19357 ](false); 19358 _context = new TelemetryContext(core, _extensionConfig, _previousTraceCtx, _self._unloadHooks); 19359 _distributedTraceCtx = createDistributedTraceContextFromTrace(_self.context[ 19360 _DYN_TELEMETRY_TRACE 19361 /* @min:%2etelemetryTrace */ 19362 ], _previousTraceCtx); 19363 core.setTraceCtx(_distributedTraceCtx); 19364 _self.context.appId = function() { 19365 var breezeChannel = core.getPlugin(BreezeChannelIdentifier); 19366 return breezeChannel ? breezeChannel.plugin["_appId"] : null; 19367 }; 19368 } 19369 function _processTelemetryInternal(evt, itemCtx) { 19370 getSetValue(evt, "tags", []); 19371 getSetValue(evt, "ext", {}); 19372 var ctx = _self.context; 19373 ctx[ 19374 _DYN_APPLY_SESSION_CONTEX0 19375 /* @min:%2eapplySessionContext */ 19376 ](evt, itemCtx); 19377 ctx[ 19378 _DYN_APPLY_APPLICATION_CO1 19379 /* @min:%2eapplyApplicationContext */ 19380 ](evt, itemCtx); 19381 ctx.applyDeviceContext(evt, itemCtx); 19382 ctx[ 19383 _DYN_APPLY_OPERATION_CONT2 19384 /* @min:%2eapplyOperationContext */ 19385 ](evt, itemCtx); 19386 ctx.applyUserContext(evt, itemCtx); 19387 ctx[ 19388 _DYN_APPLY_OPERATING_SYST3 19389 /* @min:%2eapplyOperatingSystemContxt */ 19390 ](evt, itemCtx); 19391 ctx.applyWebContext(evt, itemCtx); 19392 ctx[ 19393 _DYN_APPLY_LOCATION_CONTE4 19394 /* @min:%2eapplyLocationContext */ 19395 ](evt, itemCtx); 19396 ctx[ 19397 _DYN_APPLY_INTERNAL_CONTE5 19398 /* @min:%2eapplyInternalContext */ 19399 ](evt, itemCtx); 19400 ctx.cleanUp(evt, itemCtx); 19401 } 19402 }); 19403 return _this; 19404 } 19405 PropertiesPlugin2.__ieDyn = 1; 19406 return PropertiesPlugin2; 19407 }(BaseTelemetryPlugin) 19408); 19409var _AUTHENTICATED_USER_CONTEXT = "AuthenticatedUserContext"; 19410var _TRACK = "track"; 19411var STR_SNIPPET = "snippet"; 19412var STR_GET_COOKIE_MGR = "getCookieMgr"; 19413var STR_START_TRACK_PAGE = "startTrackPage"; 19414var STR_STOP_TRACK_PAGE = "stopTrackPage"; 19415var STR_FLUSH = "flush"; 19416var STR_START_TRACK_EVENT = "startTrackEvent"; 19417var STR_STOP_TRACK_EVENT = "stopTrackEvent"; 19418var STR_ADD_TELEMETRY_INITIALIZER = "addTelemetryInitializer"; 19419var STR_POLL_INTERNAL_LOGS = "pollInternalLogs"; 19420var STR_GET_PLUGIN = "getPlugin"; 19421var STR_EVT_NAMESPACE = "evtNamespace"; 19422var STR_TRACK_EVENT = _TRACK + "Event"; 19423var STR_TRACK_TRACE = _TRACK + "Trace"; 19424var STR_TRACK_METRIC = _TRACK + "Metric"; 19425var STR_TRACK_PAGE_VIEW = _TRACK + "PageView"; 19426var STR_TRACK_EXCEPTION = _TRACK + "Exception";
19427var STR_TRACK_DEPENDENCY_DATA = _TRACK + "DependencyData"; 19428var STR_SET_AUTHENTICATED_USER_CONTEXT = "set" + _AUTHENTICATED_USER_CONTEXT; 19429var STR_CLEAR_AUTHENTICATED_USER_CONTEXT = "clear" + _AUTHENTICATED_USER_CONTEXT; 19430var CONFIG_ENDPOINT_URL = "https://js.monitor.azure.com/scripts/b/ai.config.1.cfg.json"; 19431var _DYN_CONNECTION_STRING = "connectionString"; 19432var _DYN_VERSION = "version"; 19433var _DYN_QUEUE = "queue"; 19434var _DYN_INSTRUMENTATION_KEY = "instrumentationKey"; 19435var _DYN_USER_OVERRIDE_ENDPOI0 = "userOverrideEndpointUrl"; 19436var _DYN_ENDPOINT_URL = "endpointUrl"; 19437var _DYN_ONUNLOAD_FLUSH = "onunloadFlush"; 19438var _DYN_CONTEXT = "context"; 19439var _DYN_ADD_HOUSEKEEPING_BEF1 = "addHousekeepingBeforeUnload"; 19440var _DYN_SEND_MESSAGE = "sendMessage"; 19441var _DYN_UPDATE_SNIPPET_DEFIN2 = "updateSnippetDefinitions"; 19442var _a, _b, _c, _d; 19443var _internalSdkSrc; 19444var _ignoreUpdateSnippetProperties = [ 19445 STR_SNIPPET, 19446 "dependencies", 19447 "properties", 19448 "_snippetVersion", 19449 "appInsightsNew", 19450 "getSKUDefaults" 19451]; 19452var IKEY_USAGE = "iKeyUsage"; 19453var CDN_USAGE = "CdnUsage"; 19454var SDK_LOADER_VER = "SdkLoaderVer"; 19455var ZIP_PAYLOAD = "zipPayload"; 19456var UNDEFINED_VALUE = void 0; 19457var default_limit = { 19458 samplingRate: 100, 19459 maxSendNumber: 1 19460}; 19461var default_interval = { 19462 monthInterval: 3, 19463 daysOfMonth: [28] 19464}; 19465var default_throttle_config = { 19466 disabled: true, 19467 limit: cfgDfMerge(default_limit), 19468 interval: cfgDfMerge(default_interval) 19469}; 19470var defaultConfigValues = (_a = {}, _a[ 19471 _DYN_CONNECTION_STRING 19472 /* @min:connectionString */ 19473] = UNDEFINED_VALUE, _a.endpointUrl = UNDEFINED_VALUE, _a[ 19474 _DYN_INSTRUMENTATION_KEY 19475 /* @min:instrumentationKey */ 19476] = UNDEFINED_VALUE, _a[ 19477 _DYN_USER_OVERRIDE_ENDPOI0 19478 /* @min:userOverrideEndpointUrl */ 19479] = UNDEFINED_VALUE, _a.diagnosticLogInterval = cfgDfValidate(_chkDiagLevel, 1e4), _a.featureOptIn = (_b = {}, _b[IKEY_USAGE] = { 19480 mode: 3 19481 /* FeatureOptInMode.enable */ 19482}, _b[CDN_USAGE] = { 19483 mode: 2 19484 /* FeatureOptInMode.disable */ 19485}, _b[SDK_LOADER_VER] = { 19486 mode: 2 19487 /* FeatureOptInMode.disable */ 19488}, _b[ZIP_PAYLOAD] = { 19489 mode: 1 19490 /* FeatureOptInMode.none */ 19491}, _b), _a.throttleMgrCfg = cfgDfMerge((_c = {}, _c[ 19492 109 19493 /* _eInternalMessageId.DefaultThrottleMsgKey */ 19494] = cfgDfMerge(default_throttle_config), _c[ 19495 106 19496 /* _eInternalMessageId.InstrumentationKeyDeprecation */ 19497] = cfgDfMerge(default_throttle_config), _c[ 19498 111 19499 /* _eInternalMessageId.SdkLdrUpdate */ 19500] = cfgDfMerge(default_throttle_config), _c[ 19501 110 19502 /* _eInternalMessageId.CdnDeprecation */ 19503] = cfgDfMerge(default_throttle_config), _c)), _a.extensionConfig = cfgDfMerge((_d = {}, _d["AppInsightsCfgSyncPlugin"] = cfgDfMerge({ 19504 cfgUrl: CONFIG_ENDPOINT_URL, 19505 syncMode: 2 19506 /* ICfgSyncMode.Receive */ 19507}), _d)), _a); 19508function _chkDiagLevel(value) { 19509 return value && value > 0; 19510} 19511function _parseCs(config, configCs) { 19512 return createSyncPromise(function(resolve, reject) { 19513 doAwaitResponse(configCs, function(res) { 19514 var curCs = res && res.value; 19515 var parsedCs = null; 19516 if (!res.rejected && curCs) { 19517 config[ 19518 _DYN_CONNECTION_STRING 19519 /* @min:%2econnectionString */ 19520 ] = curCs; 19521 parsedCs = parseConnectionString(curCs); 19522 } 19523 resolve(parsedCs); 19524 }); 19525 }); 19526} 19527var AppInsightsSku = ( 19528 /** @class */ 19529 function() { 19530 function AppInsightsSku2(snippet) { 19531 var _this = this; 19532 var dependencies; 19533 var properties; 19534 var _sender; 19535 var _snippetVersion; 19536 var _evtNamespace; 19537 var _houseKeepingNamespace; 19538 var _core; 19539 var _config; 19540 var _analyticsPlugin; 19541 var _cfgSyncPlugin; 19542 var _throttleMgr; 19543 var _iKeySentMessage; 19544 var _cdnSentMessage; 19545 var _sdkVerSentMessage; 19546 dynamicProto(AppInsightsSku2, this, function(_self) { 19547 _initDefaults(); 19548 objDefine(_self, "config", { 19549 g: function() { 19550 return _config; 19551 } 19552 }); 19553 arrForEach(["pluginVersionStringArr", "pluginVersionString"], function(key) { 19554 objDefine(_self, key, { 19555 g: function() { 19556 if (_core) { 19557 return _core[key]; 19558 } 19559 return null; 19560 } 19561 }); 19562 }); 19563 _snippetVersion = "" + (snippet.sv || snippet[ 19564 _DYN_VERSION 19565 /* @min:%2eversion */ 19566 ] || ""); 19567 snippet[ 19568 _DYN_QUEUE 19569 /* @min:%2equeue */ 19570 ] = snippet[ 19571 _DYN_QUEUE 19572 /* @min:%2equeue */ 19573 ] || []; 19574 snippet[ 19575 _DYN_VERSION 19576 /* @min:%2eversion */ 19577 ] = snippet[ 19578 _DYN_VERSION 19579 /* @min:%2eversion */ 19580 ] || 2; 19581 var cfgHandler = createDynamicConfig(snippet.config || {}, defaultConfigValues); 19582 _config = cfgHandler.cfg; 19583 _analyticsPlugin = new AnalyticsPlugin(); 19584 objDefine(_self, "appInsights", { 19585 g: function() { 19586 return _analyticsPlugin; 19587 } 19588 }); 19589 properties = new PropertiesPlugin(); 19590 dependencies = new AjaxMonitor(); 19591 _sender = new Sender(); 19592 _core = new AppInsightsCore(); 19593 objDefine(_self, "core", { 19594 g: function() { 19595 return _core; 19596 } 19597 }); 19598 _addUnloadHook(onConfigChange(cfgHandler, function() { 19599 var configCs = _config[ 19600 _DYN_CONNECTION_STRING 19601 /* @min:%2econnectionString */ 19602 ]; 19603 if (/* @__PURE__ */ isPromiseLike(configCs)) { 19604 var ikeyPromise = createSyncPromise(function(resolve, reject) { 19605 doAwaitResponse(_parseCs(_config, configCs), function(rsp) { 19606 if (!rsp.rejected) { 19607 var ikey = _config[ 19608 _DYN_INSTRUMENTATION_KEY 19609 /* @min:%2einstrumentationKey */ 19610 ]; 19611 var cs2 = rsp.value; 19612 ikey = cs2 && cs2.instrumentationkey || ikey; 19613 resolve(ikey); 19614 } else { 19615 resolve(null); 19616 } 19617 }); 19618 }); 19619 var url = _config[ 19620 _DYN_USER_OVERRIDE_ENDPOI0 19621 /* @min:%2euserOverrideEndpointUrl */ 19622 ]; 19623 if (/* @__PURE__ */ isNullOrUndefined(url)) { 19624 url = createSyncPromise(function(resolve, reject) { 19625 doAwaitResponse(_parseCs(_config, configCs), function(rsp) { 19626 if (!rsp.rejected) {
19627 var url_1 = _config[ 19628 _DYN_ENDPOINT_URL 19629 /* @min:%2eendpointUrl */ 19630 ]; 19631 var cs2 = rsp.value; 19632 var ingest2 = cs2 && cs2.ingestionendpoint; 19633 url_1 = ingest2 ? ingest2 + DEFAULT_BREEZE_PATH : url_1; 19634 resolve(url_1); 19635 } else { 19636 resolve(null); 19637 } 19638 }); 19639 }); 19640 } 19641 _config[ 19642 _DYN_INSTRUMENTATION_KEY 19643 /* @min:%2einstrumentationKey */ 19644 ] = ikeyPromise; 19645 _config[ 19646 _DYN_ENDPOINT_URL 19647 /* @min:%2eendpointUrl */ 19648 ] = url; 19649 } 19650 if (isString(configCs) && configCs) { 19651 var cs = parseConnectionString(configCs); 19652 var ingest = cs.ingestionendpoint; 19653 _config.endpointUrl = _config[ 19654 _DYN_USER_OVERRIDE_ENDPOI0 19655 /* @min:%2euserOverrideEndpointUrl */ 19656 ] ? _config[ 19657 _DYN_USER_OVERRIDE_ENDPOI0 19658 /* @min:%2euserOverrideEndpointUrl */ 19659 ] : ingest + DEFAULT_BREEZE_PATH; 19660 _config[ 19661 _DYN_INSTRUMENTATION_KEY 19662 /* @min:%2einstrumentationKey */ 19663 ] = cs.instrumentationkey || _config[ 19664 _DYN_INSTRUMENTATION_KEY 19665 /* @min:%2einstrumentationKey */ 19666 ]; 19667 } 19668 _config.endpointUrl = _config[ 19669 _DYN_USER_OVERRIDE_ENDPOI0 19670 /* @min:%2euserOverrideEndpointUrl */ 19671 ] ? _config[ 19672 _DYN_USER_OVERRIDE_ENDPOI0 19673 /* @min:%2euserOverrideEndpointUrl */ 19674 ] : _config[ 19675 _DYN_ENDPOINT_URL 19676 /* @min:%2eendpointUrl */ 19677 ]; 19678 })); 19679 _self[ 19680 STR_SNIPPET 19681 /* @min:%2esnippet */ 19682 ] = snippet; 19683 _self[ 19684 STR_FLUSH 19685 /* @min:%2eflush */ 19686 ] = function(async, callBack) { 19687 if (async === void 0) { 19688 async = true; 19689 } 19690 var result; 19691 doPerf(_core, function() { 19692 return "AISKU.flush"; 19693 }, function() { 19694 if (async && !callBack) { 19695 result = createPromise(function(resolve) { 19696 callBack = resolve; 19697 }); 19698 } 19699 var waiting = 1; 19700 var flushDone = function() { 19701 waiting--; 19702 if (waiting === 0) { 19703 callBack(); 19704 } 19705 }; 19706 arrForEach(_core.getChannels(), function(channel) { 19707 if (channel) { 19708 waiting++; 19709 channel[ 19710 STR_FLUSH 19711 /* @min:%2eflush */ 19712 ](async, flushDone); 19713 } 19714 }); 19715 flushDone(); 19716 }, null, async); 19717 return result; 19718 }; 19719 _self[ 19720 _DYN_ONUNLOAD_FLUSH 19721 /* @min:%2eonunloadFlush */ 19722 ] = function(async) { 19723 if (async === void 0) { 19724 async = true; 19725 } 19726 arrForEach(_core.getChannels(), function(channel) { 19727 if (channel[ 19728 _DYN_ONUNLOAD_FLUSH 19729 /* @min:%2eonunloadFlush */ 19730 ]) { 19731 channel[ 19732 _DYN_ONUNLOAD_FLUSH 19733 /* @min:%2eonunloadFlush */ 19734 ](); 19735 } else { 19736 channel[ 19737 STR_FLUSH 19738 /* @min:%2eflush */ 19739 ](async); 19740 } 19741 }); 19742 }; 19743 _self.loadAppInsights = function(legacyMode, logger, notificationManager) { 19744 if (legacyMode === void 0) { 19745 legacyMode = false; 19746 } 19747 if (legacyMode) { 19748 throwUnsupported("Legacy Mode is no longer supported"); 19749 } 19750 function _updateSnippetProperties(snippet2) { 19751 if (snippet2) { 19752 var snippetVer = ""; 19753 if (!/* @__PURE__ */ isNullOrUndefined(_snippetVersion)) { 19754 snippetVer += _snippetVersion; 19755 } 19756 if (_self[ 19757 _DYN_CONTEXT 19758 /* @min:%2econtext */ 19759 ] && _self[ 19760 _DYN_CONTEXT 19761 /* @min:%2econtext */ 19762 ].internal) { 19763 _self[ 19764 _DYN_CONTEXT 19765 /* @min:%2econtext */ 19766 ].internal.snippetVer = snippetVer || "-"; 19767 } 19768 objForEachKey(_self, function(field, value) { 19769 if (isString(field) && !isFunction(value) && field && field[0] !== "_" && // Don't copy "internal" values 19770 arrIndexOf(_ignoreUpdateSnippetProperties, field) === -1) { 19771 if (snippet2[field] !== value) { 19772 snippet2[field] = value; 19773 } 19774 } 19775 }); 19776 } 19777 } 19778 doPerf(_self.core, function() { 19779 return "AISKU.loadAppInsights"; 19780 }, function() { 19781 _core.initialize(_config, [_sender, properties, dependencies, _analyticsPlugin, _cfgSyncPlugin], logger, notificationManager); 19782 objDefine(_self, "context", { 19783 g: function() { 19784 return properties[ 19785 _DYN_CONTEXT 19786 /* @min:%2econtext */ 19787 ]; 19788 } 19789 }); 19790 if (!_throttleMgr) { 19791 _throttleMgr = new ThrottleMgr(_core); 19792 } 19793 var sdkSrc = _findSdkSourceFile(); 19794 if (sdkSrc && _self[ 19795 _DYN_CONTEXT 19796 /* @min:%2econtext */ 19797 ]) { 19798 _self[ 19799 _DYN_CONTEXT 19800 /* @min:%2econtext */ 19801 ].internal.sdkSrc = sdkSrc; 19802 } 19803 _updateSnippetProperties(_self[ 19804 STR_SNIPPET 19805 /* @min:%2esnippet */ 19806 ]); 19807 _self.emptyQueue(); 19808 _self[ 19809 STR_POLL_INTERNAL_LOGS 19810 /* @min:%2epollInternalLogs */ 19811 ](); 19812 _self[ 19813 _DYN_ADD_HOUSEKEEPING_BEF1 19814 /* @min:%2eaddHousekeepingBeforeUnload */ 19815 ](_self); 19816 _addUnloadHook(onConfigChange(cfgHandler, function() { 19817 var defaultEnable = false;
vendor: 4,680 bytes, lines 19818-19940
19818 if (_config.throttleMgrCfg[ 19819 109 19820 /* _eInternalMessageId.DefaultThrottleMsgKey */ 19821 ]) { 19822 defaultEnable = !_config.throttleMgrCfg[ 19823 109 19824 /* _eInternalMessageId.DefaultThrottleMsgKey */ 19825 ].disabled; 19826 } 19827 if (!_throttleMgr.isReady() && _config.extensionConfig && _config.extensionConfig[_cfgSyncPlugin.identifier] && defaultEnable) { 19828 _throttleMgr.onReadyState(true); 19829 } 19830 if (!_iKeySentMessage && !_config[ 19831 _DYN_CONNECTION_STRING 19832 /* @min:%2econnectionString */ 19833 ] && isFeatureEnabled(IKEY_USAGE, _config, true)) { 19834 _throttleMgr[ 19835 _DYN_SEND_MESSAGE 19836 /* @min:%2esendMessage */ 19837 ](106, "See Instrumentation key support at aka.ms/IkeyMigrate"); 19838 _iKeySentMessage = true; 19839 } 19840 if (!_cdnSentMessage && _self[ 19841 _DYN_CONTEXT 19842 /* @min:%2econtext */ 19843 ].internal.sdkSrc && _self[ 19844 _DYN_CONTEXT 19845 /* @min:%2econtext */ 19846 ].internal.sdkSrc.indexOf("az416426") != -1 && isFeatureEnabled(CDN_USAGE, _config, true)) { 19847 _throttleMgr[ 19848 _DYN_SEND_MESSAGE 19849 /* @min:%2esendMessage */ 19850 ](110, "See Cdn support notice at aka.ms/JsActiveCdn"); 19851 _cdnSentMessage = true; 19852 } 19853 if (!_sdkVerSentMessage && parseInt(_snippetVersion) < 6 && isFeatureEnabled(SDK_LOADER_VER, _config, true)) { 19854 _throttleMgr[ 19855 _DYN_SEND_MESSAGE 19856 /* @min:%2esendMessage */ 19857 ](111, "An updated Sdk Loader is available, see aka.ms/SnippetVer"); 19858 _sdkVerSentMessage = true; 19859 } 19860 })); 19861 }); 19862 return _self; 19863 }; 19864 _self[ 19865 _DYN_UPDATE_SNIPPET_DEFIN2 19866 /* @min:%2eupdateSnippetDefinitions */ 19867 ] = function(snippet2) { 19868 proxyAssign(snippet2, _self, function(name) { 19869 return name && arrIndexOf(_ignoreUpdateSnippetProperties, name) === -1; 19870 }); 19871 }; 19872 _self.emptyQueue = function() { 19873 try { 19874 if (isArray(_self.snippet[ 19875 _DYN_QUEUE 19876 /* @min:%2equeue */ 19877 ])) { 19878 var length_1 = _self.snippet[ 19879 _DYN_QUEUE 19880 /* @min:%2equeue */ 19881 ].length; 19882 for (var i2 = 0; i2 < length_1; i2++) { 19883 var call = _self.snippet[ 19884 _DYN_QUEUE 19885 /* @min:%2equeue */ 19886 ][i2]; 19887 call(); 19888 } 19889 _self.snippet[ 19890 _DYN_QUEUE 19891 /* @min:%2equeue */ 19892 ] = void 0; 19893 delete _self.snippet[ 19894 _DYN_QUEUE 19895 /* @min:%2equeue */ 19896 ]; 19897 } 19898 } catch (exception) { 19899 var properties_1 = {}; 19900 if (exception && isFunction(exception.toString)) { 19901 properties_1.exception = exception.toString(); 19902 } 19903 } 19904 }; 19905 _self[ 19906 _DYN_ADD_HOUSEKEEPING_BEF1 19907 /* @min:%2eaddHousekeepingBeforeUnload */ 19908 ] = function(appInsightsInstance) { 19909 if (/* @__PURE__ */ hasWindow() || /* @__PURE__ */ hasDocument()) { 19910 var performHousekeeping_1 = function() { 19911 appInsightsInstance[ 19912 _DYN_ONUNLOAD_FLUSH 19913 /* @min:%2eonunloadFlush */ 19914 ](false); 19915 if (isFunction(_self.core[ 19916 STR_GET_PLUGIN 19917 /* @min:%2egetPlugin */ 19918 ])) { 19919 var loadedPlugin = _this.core[ 19920 STR_GET_PLUGIN 19921 /* @min:%2egetPlugin */ 19922 ](PropertiesPluginIdentifier); 19923 if (loadedPlugin) { 19924 var propertiesPlugin = loadedPlugin.plugin; 19925 if (propertiesPlugin && propertiesPlugin[ 19926 _DYN_CONTEXT 19927 /* @min:%2econtext */ 19928 ] && propertiesPlugin[ 19929 _DYN_CONTEXT 19930 /* @min:%2econtext */ 19931 ]._sessionManager) { 19932 propertiesPlugin[ 19933 _DYN_CONTEXT 19934 /* @min:%2econtext */ 19935 ]._sessionManager.backup(); 19936 } 19937 } 19938 } 19939 }; 19940 var added_1 = false;
19941 if (!_houseKeepingNamespace) { 19942 _houseKeepingNamespace = mergeEvtNamespace(_evtNamespace, _core[ 19943 STR_EVT_NAMESPACE 19944 /* @min:%2eevtNamespace */ 19945 ] && _core[ 19946 STR_EVT_NAMESPACE 19947 /* @min:%2eevtNamespace */ 19948 ]()); 19949 } 19950 _addUnloadHook(onConfigChange(_config, function(details) { 19951 var coreConfig = details.cfg; 19952 var analyticsPlugin = appInsightsInstance.appInsights; 19953 var ctx = createProcessTelemetryContext(null, coreConfig, analyticsPlugin.core); 19954 var extConfig = ctx.getExtCfg(analyticsPlugin.identifier || AnalyticsPluginIdentifier); 19955 _removePageEventHandlers(); 19956 var excludePageUnloadEvents = coreConfig.disablePageUnloadEvents; 19957 if (!extConfig.disableFlushOnBeforeUnload) { 19958 if (addPageUnloadEventListener(performHousekeeping_1, excludePageUnloadEvents, _houseKeepingNamespace)) { 19959 added_1 = true; 19960 } 19961 if (addPageHideEventListener(performHousekeeping_1, excludePageUnloadEvents, _houseKeepingNamespace)) { 19962 added_1 = true; 19963 } 19964 if (!added_1 && !isReactNative()) { 19965 _throwInternal(_core.logger, 1, 19, "Could not add handler for beforeunload and pagehide"); 19966 } 19967 } 19968 if (!added_1 && !extConfig.disableFlushOnUnload) { 19969 addPageHideEventListener(performHousekeeping_1, excludePageUnloadEvents, _houseKeepingNamespace); 19970 } 19971 })); 19972 } 19973 }; 19974 _self.getSender = function() { 19975 return _sender; 19976 }; 19977 _self.unload = function(isAsync, unloadComplete, cbTimeout) { 19978 var unloadDone = false; 19979 var result; 19980 if (isAsync && !unloadComplete) { 19981 result = createPromise(function(resolve) { 19982 unloadComplete = resolve; 19983 }); 19984 } 19985 function _unloadCallback(unloadState) { 19986 if (!unloadDone) { 19987 unloadDone = true; 19988 _initDefaults(); 19989 unloadComplete && unloadComplete(unloadState); 19990 } 19991 } 19992 _self[ 19993 _DYN_ONUNLOAD_FLUSH 19994 /* @min:%2eonunloadFlush */ 19995 ](isAsync); 19996 _removePageEventHandlers(); 19997 _core.unload && _core.unload(isAsync, _unloadCallback, cbTimeout); 19998 return result; 19999 }; 20000 proxyFunctions(_self, _analyticsPlugin, [ 20001 STR_GET_COOKIE_MGR, 20002 STR_TRACK_EVENT, 20003 STR_TRACK_PAGE_VIEW, 20004 "trackPageViewPerformance", 20005 STR_TRACK_EXCEPTION, 20006 "_onerror", 20007 STR_TRACK_TRACE, 20008 STR_TRACK_METRIC, 20009 STR_START_TRACK_PAGE, 20010 STR_STOP_TRACK_PAGE, 20011 STR_START_TRACK_EVENT, 20012 STR_STOP_TRACK_EVENT 20013 ]); 20014 proxyFunctions(_self, _getCurrentDependencies, [ 20015 STR_TRACK_DEPENDENCY_DATA, 20016 "addDependencyListener", 20017 "addDependencyInitializer" 20018 ]); 20019 proxyFunctions(_self, _core, [ 20020 STR_ADD_TELEMETRY_INITIALIZER, 20021 STR_POLL_INTERNAL_LOGS, 20022 "stopPollingInternalLogs", 20023 STR_GET_PLUGIN, 20024 "addPlugin", 20025 STR_EVT_NAMESPACE, 20026 "addUnloadCb", 20027 "getTraceCtx", 20028 "updateCfg", 20029 "onCfgChange" 20030 ]); 20031 proxyFunctions(_self, function() { 20032 var context = properties[ 20033 _DYN_CONTEXT 20034 /* @min:%2econtext */ 20035 ]; 20036 return context ? context.user : null; 20037 }, [ 20038 STR_SET_AUTHENTICATED_USER_CONTEXT, 20039 STR_CLEAR_AUTHENTICATED_USER_CONTEXT 20040 ]); 20041 function _getCurrentDependencies() { 20042 return dependencies; 20043 } 20044 function _initDefaults() { 20045 _evtNamespace = createUniqueNamespace("AISKU"); 20046 _houseKeepingNamespace = null; 20047 dependencies = null; 20048 properties = null; 20049 _sender = null; 20050 _snippetVersion = null; 20051 _throttleMgr = null; 20052 _iKeySentMessage = false;
20053 _cdnSentMessage = false; 20054 _sdkVerSentMessage = false; 20055 _cfgSyncPlugin = new CfgSyncPlugin(); 20056 } 20057 function _removePageEventHandlers() { 20058 if (_houseKeepingNamespace) { 20059 removePageUnloadEventListener(null, _houseKeepingNamespace); 20060 removePageHideEventListener(null, _houseKeepingNamespace); 20061 } 20062 } 20063 function _addUnloadHook(hooks) { 20064 _core.addUnloadHook(hooks); 20065 } 20066 }); 20067 } 20068 AppInsightsSku2.prototype.addDependencyInitializer = function(dependencyInitializer) { 20069 return null; 20070 }; 20071 return AppInsightsSku2; 20072 }() 20073); 20074function _findSdkSourceFile() { 20075 if (_internalSdkSrc) { 20076 return _internalSdkSrc; 20077 } 20078 var sdkSrc = null; 20079 var isModule = false; 20080 var cdns = [ 20081 "://js.monitor.azure.com/", 20082 "://az416426.vo.msecnd.net/" 20083 ]; 20084 try { 20085 var scrpt = (document || {}).currentScript; 20086 if (scrpt) { 20087 sdkSrc = scrpt.src; 20088 } 20089 } catch (e) { 20090 } 20091 if (sdkSrc) { 20092 try { 20093 var url_2 = sdkSrc.toLowerCase(); 20094 if (url_2) { 20095 var src_1 = ""; 20096 arrForEach(cdns, function(value, idx) { 20097 if (strIndexOf(url_2, value) !== -1) { 20098 src_1 = "cdn" + (idx + 1); 20099 if (strIndexOf(url_2, "/scripts/") === -1) { 20100 if (strIndexOf(url_2, "/next/") !== -1) { 20101 src_1 += "-next"; 20102 } else if (strIndexOf(url_2, "/beta/") !== -1) { 20103 src_1 += "-beta"; 20104 } 20105 } 20106 _internalSdkSrc = src_1 + (isModule ? ".mod" : ""); 20107 return -1; 20108 } 20109 }); 20110 } 20111 } catch (e) { 20112 } 20113 _internalSdkSrc = sdkSrc; 20114 } 20115 return _internalSdkSrc; 20116} 20117const plugin_client_C6hmBeEmQBn26yUo0oB8PaR6oCkpopuHjNxArx40zE8 = defineNuxtPlugin({ 20118 name: "nuxt-applicationinsights:client", 20119 async setup(nuxtApp) { 20120 let __temp, __restore; 20121 const runtimeConfig = useRuntimeConfig(); 20122 const config = { 20123 config: toRaw(runtimeConfig.public).applicationinsights ?? {} 20124 }; 20125 [__temp, __restore] = executeAsync(() => nuxtApp.callHook("applicationinsights:config:client", config)), await __temp, __restore(); 20126 const applicationInsights = new AppInsightsSku(config); 20127 applicationInsights.addTelemetryInitializer((e) => { 20128 var _a2; 20129 if (e.baseType === "PageviewData" && nuxtApp.$router && ((_a2 = e.baseData) == null ? void 0 : _a2.uri)) { 20130 const resolvedRoute = nuxtApp.$router.resolve( 20131 new URL(e.baseData.uri).pathname 20132 ); 20133 e.baseData.name = resolvedRoute.name || resolvedRoute.path || resolvedRoute.fullPath; 20134 } 20135 return true; 20136 }); 20137 try { 20138 applicationInsights.loadAppInsights(); 20139 delete globalThis.$fetch; 20140 globalThis.$fetch = createFetch({ 20141 defaults: { 20142 baseURL: baseURL() 20143 } 20144 }); 20145 } catch (e) { 20146 nuxtApp.callHook("applicationinsights:load:error", e); 20147 } 20148 return { 20149 provide: { 20150 appInsights: applicationInsights 20151 } 20152 }; 20153 } 20154}); 20155var m = /^GTM-[0-9A-Z]+$/; 20156function s(r) { 20157 if (typeof r != "string" || !m.test(r)) { 20158 let t = String(r).toUpperCase().replace(/.*-|[^0-9A-Z]/g, ""), a = t.length === 0 ? "" : ` Did you mean 'GTM-${t}'?`; 20159 throw new Error(`'${r}' is not a valid GTM-ID (${m}).${a}`); 20160 } 20161} 20162function n(r, t = "dataLayer") { 20163 return r[t] || (r[t] = []), r[t]; 20164} 20165function p(r, t) { 20166 let a = document, e = a.createElement("script"), o = (g) => { 20167 var _a2; 20168 (_a2 = t.onReady) == null ? void 0 : _a2.call(t, { id: r, script: e }), e.removeEventListener("load", o); 20169 }; 20170 e.addEventListener("load", o); 20171 let i2 = t.dataLayerName ?? "dataLayer"; 20172 if (n(window, i2).push({ event: "gtm.js", "gtm.start": (/* @__PURE__ */ new Date()).getTime() }), !r) return e; 20173 e.async = !t.defer, e.defer = !!(t.defer || t.compatibility), t.nonce && e.setAttribute("nonce", t.nonce), t.scriptType && (e.type = t.scriptType); 20174 let c2 = new URLSearchParams({ id: r, ...t.dataLayerName ? { l: t.dataLayerName } : {}, ...t.queryParams ?? {} }), d = t.source ?? "https://www.googletagmanager.com/gtm.js"; 20175 e.src = `${d}?${c2}`; 20176 let l = t.parentElement ?? a.body; 20177 if (typeof (l == null ? void 0 : l.appendChild) != "function") throw new Error("parentElement must be a DOM element"); 20178 return l.appendChild(e), e; 20179} 20180function y(r = "https://www.googletagmanager.com/gtm.js") { 20181 return Array.from(document.getElementsByTagName("script")).some((t) => t.src.includes(r)); 20182} 20183var u = class { 20184 constructor(t) { 20185 __publicField(this, "id"); 20186 __publicField(this, "options"); 20187 __publicField(this, "scriptElements", []); 20188 __publicField(this, "isInBrowserContext", () => typeof window < "u"); 20189 if (Array.isArray(t.id)) for (let a of t.id) typeof a == "string" ? s(a) : s(a.id); 20190 else s(t.id); 20191 this.id = t.id, this.options = { enabled: true, debug: false, loadScript: true, defer: false, compatibility: false, dataLayerName: "dataLayer", ...t }, delete this.options.id; 20192 } 20193 enabled() { 20194 return this.options.enabled ?? true; 20195 } 20196 enable(t = true, a) { 20197 if (this.options.enabled = t, this.isInBrowserContext() && t && !y(a) && this.options.loadScript) if (Array.isArray(this.id)) this.id.forEac
20197h((e) => { 20198 let o; 20199 typeof e == "string" ? o = p(e, { ...this.options }) : o = p(e.id, { ...this.options, queryParams: e.queryParams }), this.scriptElements.push(o); 20200 }); 20201 else { 20202 let e = p(this.id, { ...this.options }); 20203 this.scriptElements.push(e); 20204 } 20205 } 20206 debugEnabled() { 20207 return this.options.debug ?? false; 20208 } 20209 debug(t) { 20210 this.options.debug = t; 20211 } 20212 dataLayer() { 20213 return this.isInBrowserContext() && this.options.enabled ? n(window, this.options.dataLayerName) : false; 20214 } 20215 trackView(t, a, e = {}) { 20216 let o = this.isInBrowserContext() && (this.options.enabled ?? false); 20217 this.options.debug && console.log(`[GTM-Support${o ? "" : "(disabled)"}]: Dispatching TrackView`, { screenName: t, path: a }), o && n(window, this.options.dataLayerName).push({ ...e, event: this.options.trackViewEventProperty ?? "content-view", "content-name": a, "content-view-name": t }); 20218 } 20219 trackEvent({ event: t, category: a = null, action: e = null, label: o = null, value: i2 = null, noninteraction: b = false, ...c2 } = {}) { 20220 let d = this.isInBrowserContext() && (this.options.enabled ?? false); 20221 this.options.debug && console.log(`[GTM-Support${d ? "" : "(disabled)"}]: Dispatching event`, { event: t, category: a, action: e, label: o, value: i2, ...c2 }), d && n(window, this.options.dataLayerName).push({ event: t ?? "interaction", target: a, action: e, "target-properties": o, value: i2, "interaction-type": b, ...c2 }); 20222 } 20223 push(t) { 20224 let a = this.isInBrowserContext() && (this.options.enabled ?? false); 20225 this.options.debug && console.log(`[GTM-Support${a ? "" : "(disabled)"}]: Dispatching event`, t), a && n(window, this.options.dataLayerName).push(t); 20226 } 20227}; 20228var i; 20229function c(a, t = { id: "" }) { 20230 t = { trackOnNextTick: false, ...t }, i = new u(t), a.config.globalProperties.$gtm = i, i.isInBrowserContext() && (t.vueRouter && G(a, t.vueRouter, t.ignoredViews, t.trackOnNextTick, t.vueRouterAdditionalEventData), i.options.enabled && i.options.loadScript && (Array.isArray(t.id) ? t.id.forEach((r) => { 20231 if (typeof r == "string") p(r, t); 20232 else { 20233 let n2 = { ...t }; 20234 r.queryParams != null && (n2.queryParams = { ...n2.queryParams, ...r.queryParams }), p(r.id, n2); 20235 } 20236 }) : p(t.id, t))), a.provide("gtm", t); 20237} 20238function G(a, t, r = [], n2, f = () => ({})) { 20239 function l(e, u2) { 20240 return e instanceof Error ? !!(e.type & u2) : false; 20241 } 20242 t.afterEach(async (e, u2, p2) => { 20243 var _a2, _b2, _c2; 20244 if (typeof e.name != "string" || Array.isArray(r) && r.includes(e.name) || typeof r == "function" && r(e, u2)) return; 20245 let s2 = e.meta && typeof e.meta.gtm == "string" && e.meta.gtm ? e.meta.gtm : e.name; 20246 l(p2, 4) ? (i == null ? void 0 : i.debugEnabled()) && console.log(`[VueGtm]: '${s2}' not tracked due to navigation aborted`) : l(p2, 8) && (i == null ? void 0 : i.debugEnabled()) && console.log(`[VueGtm]: '${s2}' not tracked due to navigation cancelled`); 20247 let d = { ...await f(e, u2), ...(_a2 = e.meta) == null ? void 0 : _a2.gtmAdditionalEventData }, o = ((_c2 = (_b2 = t.options) == null ? void 0 : _b2.history) == null ? void 0 : _c2.base) ?? ""; 20248 o.endsWith("/") || (o += "/"), o += e.fullPath.startsWith("/") ? e.fullPath.substring(1) : e.fullPath, n2 ? nextTick(() => { 20249 i == null ? void 0 : i.trackView(s2, o, d); 20250 }) : i == null ? void 0 : i.trackView(s2, o, d); 20251 }); 20252} 20253function N(a) { 20254 return { install: (t) => c(t, a) }; 20255} 20256function E() { 20257 return i; 20258} 20259const plugin_7DB4Q_rSg7Y6_r2xTJAR9sj0Plzl7GeeI8C3uqDzeqY = defineNuxtPlugin((nuxt) => { 20260 { 20261 const options = nuxt.$config.public.gtm; 20262 const router = useRouter(); 20263 const pluginOptions = { 20264 ...options, 20265 vueRouter: options.enableRouterSync && router ? router : void 0 20266 }; 20267 nuxt.vueApp.use(N(pluginOptions)); 20268 } 20269}); 20270const state$3 = () => ({ 20271 site: { 20272 copyrightYear: (/* @__PURE__ */ new Date()).getFullYear() 20273 } 20274}); 20275const getters$3 = { 20276 // Getter for getting theme by its key 20277 getThemeByKey: (state2) => (themeKey) => { 20278 if (state2.site && state2.site.themes) { 20279 return state2.site.themes[themeKey]; 20280 } 20281 return null; 20282 }, 20283 // Getter for getting page by its handle 20284 getPageByHandle: (state2) => (pageHandle) => { 20285 var _a2, _b2, _c2; 20286 return { 20287 ...(_b2 = (_a2 = state2.site) == null ? void 0 : _a2.pages) == null ? void 0 : _b2.find((page) => (page == null ? void 0 : page.handle) === pageHandle), 20288 head: JSON.parse(((_c2 = state2.site) == null ? void 0 : _c2.head) || "{}") 20289 }; 20290 }, 20291 // Getter for getting home page 20292 getHomePage: (state2) => { 20293 var _a2, _b2; 20294 return { 20295 ...(_a2 = state2.site) == null ? void 0 : _a2.pages.find((page) => page.id === state2.site.homepageId), 20296 head: JSON.parse(((_b2 = state2.site) == null ? void 0 : _b2.head) || "{}") 20297 }; 20298 }, 20299 // Getter for checking if a page is a folder 20300 "site/pageIsFolder": (state2) => (pageId) => { 20301 var _a2; 20302 const parseString = (str) => {
20303 try { 20304 return JSON.parse(str || "{}"); 20305 } catch { 20306 return null; 20307 } 20308 }; 20309 const page = (_a2 = state2.site) == null ? void 0 : _a2.pages.find((p2) => p2.id === pageId); 20310 const pageSettings = parseString(page == null ? void 0 : page.settings); 20311 const isLink = Boolean(parseString(page == null ? void 0 : page.link)); 20312 const pageBlocks = parseString(page == null ? void 0 : page.blocks); 20313 const pageAsFolder = (pageSettings == null ? void 0 : pageSettings.pageAsFolder) ?? false; 20314 const hasBlocks = (pageBlocks == null ? void 0 : pageBlocks.length) > 0; 20315 if (pageAsFolder) return false; 20316 return !hasBlocks && !isLink; 20317 } 20318}; 20319const actions$3 = {}; 20320const mutations$3 = { 20321 // Set site data 20322 setSite(state2, siteData) { 20323 let site = (siteData == null ? void 0 : siteData.value) ?? siteData; 20324 if (typeof site === "string") { 20325 site = JSON.parse(site); 20326 } 20327 if (site.footer && typeof site.footer === "string") 20328 site.footer = JSON.parse(site.footer); 20329 if (site.navigation && typeof site.navigation === "string") 20330 site.navigation = JSON.parse(site.navigation); 20331 if (site.settings && typeof site.settings === "string") 20332 site.settings = JSON.parse(site.settings); 20333 if (site.stickyButton && typeof site.stickyButton === "string") 20334 site.stickyButton = JSON.parse(site.stickyButton || "{}"); 20335 state2.site = site; 20336 if (state2.site) state2.site.copyrightYear = (/* @__PURE__ */ new Date()).getFullYear(); 20337 } 20338}; 20339const __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 20340 __proto__: null, 20341 actions: actions$3, 20342 getters: getters$3, 20343 mutations: mutations$3, 20344 state: state$3 20345}, Symbol.toStringTag, { value: "Module" })); 20346const state$2 = () => ({ 20347 busy: { 20348 loading: [], 20349 saving: [] 20350 } 20351}); 20352const getters$2 = { 20353 isLoading: (state2) => (key) => { 20354 return state2.busy.loading.includes(key); 20355 } 20356}; 20357const actions$2 = { 20358 // Add typed actions here if needed 20359}; 20360const mutations$2 = { 20361 startLoading(state2, key) { 20362 if (!state2.busy.loading.includes(key)) { 20363 state2.busy.loading.push(key); 20364 } 20365 }, 20366 stopLoading(state2, key) { 20367 const index = state2.busy.loading.indexOf(key); 20368 if (index >= 0) { 20369 state2.busy.loading.splice(index, 1); 20370 } 20371 }, 20372 stopLoadingAll(state2) { 20373 state2.busy.loading = []; 20374 } 20375}; 20376const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 20377 __proto__: null, 20378 actions: actions$2, 20379 getters: getters$2, 20380 mutations: mutations$2, 20381 state: state$2 20382}, Symbol.toStringTag, { value: "Module" })); 20383const state$1 = () => ({ 20384 expiredContent: [], 20385 allowedContent: [] 20386}); 20387const getAllContentLibraryItems = (blocks, evaluateArticlesAsCLItems = false) => { 20388 const allItems = []; 20389 if (!Array.isArray(blocks)) { 20390 return allItems; 20391 } 20392 const recurseBlocks = (blockArray) => { 20393 for (const block of blockArray) { 20394 if ((block == null ? void 0 : block.contentLibraryItems) && Array.isArray(block.contentLibraryItems)) { 20395 for (const item of block.contentLibraryItems) { 20396 allItems.push(item); 20397 } 20398 } 20399 if (evaluateArticlesAsCLItems && block.type === "articles" && (block == null ? void 0 : block.items) && Array.isArray(block.items)) { 20400 for (const item of block.items) { 20401 if (item == null ? void 0 : item.id) { 20402 allItems.push(item); 20403 } 20404 } 20405 } 20406 if ((block == null ? void 0 : block.blocks) && Array.isArray(block.blocks)) { 20407 recurseBlocks(block.blocks); 20408 } 20409 } 20410 }; 20411 recurseBlocks(blocks); 20412 return allItems; 20413}; 20414const getters$1 = { 20415 canRemoveContent: (state2, getters2, rootState, rootGetters) => { 20416 return rootGetters["settings/isContentRemovalEnabled"]; 20417 }, 20418 isContentExpired: (state2, getters2, rootState) => (contentId, item) => { 20419 var _a2, _b2, _c2, _d2; 20420 if (state2.expiredContent.includes(contentId)) return true; 20421 if (getters2.canRemoveContent && state2.allowedContent.length === 0 && (item == null ? void 0 : item.isRemoved) === true && ((_a2 = rootState == null ? void 0 : rootState.site) == null ? void 0 : _a2.pages)) { 20422 const evaluateArticlesAsCLItems = Boolean( 20423 (_c2 = (_b2 = rootState == null ? void 0 : rootState.settings) == null ? void 0 : _b2.featureFlags) == null ? void 0 : _c2.EvaluateArticlesAsCLItems 20424 ); 20425 for (const page of rootState.site.pages) { 20426 if (!page) continue; 20427 let pageBlocks = page.blocks; 20428 if (typeof pageBlocks === "string") { 20429 try { 20430 pageBlocks = JSON.parse(pageBlocks); 20431 } catch { 20432 continue; 20433 } 20434 } 20435 if (!Array.isArray(pageBlocks)) continue; 20436 const allPageItems = getAllContentLibraryItems( 20437 pageBlocks, 20438 evaluateArticlesAsCLItems 20439 ); 20440 if (allPageItems.length === 1 && ((_d2 = allPageItems[0]) == null ? void 0 : _d2.id) === contentId) { 20441 return true; 20442 } 20443 } 20444 } 20445 if (getters2.canRemoveContent && state2.allowedContent.length > 0 && !state2.allowedContent.includes(contentId)) { 20446 return true; 20447 } 20448 return false;
20449 }, 20450 isExpired: (state2, getters2, rootState) => (contentLibraryItems, itemCheckFunction) => { 20451 return contentLibraryItems == null ? void 0 : contentLibraryItems.some( 20452 (item) => getters2.isContentExpired(item == null ? void 0 : item.id, item, rootState) && itemCheckFunction(item) 20453 ); 20454 }, 20455 isPresetExpired: (state2, getters2) => (presetId) => { 20456 if (!presetId) return false; 20457 return getters2.isContentExpired(presetId, void 0); 20458 } 20459}; 20460const actions$1 = {}; 20461const mutations$1 = { 20462 setExpiredContent(state2, expiredContent) { 20463 if (!expiredContent.value) state2.expiredContent = []; 20464 else state2.expiredContent = expiredContent; 20465 }, 20466 setAllowedContent(state2, allowedContent) { 20467 if (!allowedContent.value) state2.allowedContent = []; 20468 else state2.allowedContent = allowedContent; 20469 } 20470}; 20471const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 20472 __proto__: null, 20473 actions: actions$1, 20474 getters: getters$1, 20475 mutations: mutations$1, 20476 state: state$1 20477}, Symbol.toStringTag, { value: "Module" })); 20478const brandFeatureFlag = { ...BRAND_FEATURE_FLAGS }; 20479const state = () => ({ 20480 featureFlags: {}, 20481 brandFeatureFlags: null 20482}); 20483const getters = { 20484 getFeatureFlag: (state2) => (flagName) => { 20485 if (!state2.featureFlags) { 20486 return false; 20487 } 20488 return state2.featureFlags[flagName] === true; 20489 }, 20490 // Only CoreLite is supported in SiteViewer. 20491 // It was added here so components can get it independently of being used in Builder or Site Viewer. 20492 getBrandFeatureFlag: (state2) => (flagName) => { 20493 const id = brandFeatureFlag[flagName]; 20494 if (!id) { 20495 return false; 20496 } 20497 if (!state2.brandFeatureFlags) { 20498 return false; 20499 } 20500 return state2.brandFeatureFlags.includes(id); 20501 }, 20502 /** Global ContentRemoval flag, disabled entirely for CoreLite brands. */ 20503 isContentRemovalEnabled: (_state, getters2) => getters2.getFeatureFlag("ContentRemoval") && !getters2.getBrandFeatureFlag("CoreLite") 20504}; 20505const mutations = { 20506 setFeatureFlags(state2, value) { 20507 state2.featureFlags = value ? { ...value } : null; 20508 }, 20509 setBrandFeatureFlagsFromSitedata(state2, site) { 20510 if (!site) { 20511 state2.brandFeatureFlags = []; 20512 return; 20513 } 20514 if (Array.isArray(site.brandFeatureFlags)) { 20515 state2.brandFeatureFlags = site.brandFeatureFlags.filter( 20516 (id) => typeof id === "number" 20517 ); 20518 return; 20519 } 20520 state2.brandFeatureFlags = site.isCoreLite ? [brandFeatureFlag.CoreLite] : []; 20521 } 20522}; 20523const actions = { 20524 // Actions for feature flags can be added here 20525}; 20526const settings = { 20527 state, 20528 getters, 20529 mutations, 20530 actions 20531}; 20532const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 20533 __proto__: null, 20534 actions, 20535 default: settings, 20536 getters, 20537 mutations, 20538 state 20539}, Symbol.toStringTag, { value: "Module" })); 20540const _01_vuex_JR2iuD9rUEJsbfc58CLbFrAaaNxdKncRJbnIkHqaZg0 = defineNuxtPlugin(async (nuxtApp) => { 20541 var _a2; 20542 const modules = {}; 20543 const storeFiles = /* @__PURE__ */ Object.assign({ "../store/index.ts": __vite_glob_0_0, "../store/interface.ts": __vite_glob_0_1, "../store/library.ts": __vite_glob_0_2, "../store/settings.ts": __vite_glob_0_3 }); 20544 for (const path in storeFiles) { 20545 const moduleName = (_a2 = path.split("/").pop()) == null ? void 0 : _a2.replace(".ts", ""); 20546 if (moduleName) { 20547 if (moduleName === "index") { 20548 modules[moduleName] = { 20549 ...storeFiles[path].default || storeFiles[path] 20550 }; 20551 } else { 20552 modules[moduleName] = { 20553 namespaced: true, 20554 ...storeFiles[path].default || storeFiles[path] 20555 }; 20556 } 20557 } 20558 } 20559 const store = createStore({ 20560 // Spread the index module at the root level if it exists 20561 ...modules.index || {}, 20562 modules: Object.fromEntries( 20563 // Filter out the index module from modules 20564 Object.entries(modules).filter(([key]) => key !== "index") 20565 ) 20566 }); 20567 nuxtApp.vueApp.use(store); 20568 nuxtApp.provide("store", store); 20569 return { 20570 provide: { 20571 vuexStore: store 20572 } 20573 }; 20574}); 20575const _02_axios_9_2_CAngmP9WS9XLmomohNeXUXfLl__BcBNmgTjmGTs = defineNuxtPlugin(() => { 20576 const { 20577 public: { apiBaseUrl } 20578 } = useRuntimeConfig(); 20579 const baseURL2 = apiBaseUrl || "https://localhost:8080/api"; 20580 const axiosInstance = axios.create({ 20581 baseURL: baseURL2 20582 }); 20583 return { 20584 provide: { 20585 axios: axiosInstance 20586 } 20587 }; 20588}); 20589const PRINT_MEDIA_FALLBACK_TIMEOUT = 100; 20590const PRELOAD_STYLESHEET_TIMEOUT = 50; 20591function injectFontDisplayOverrideOnce() { 20592 if (document.querySelector("style[data-font-display-override]")) return; 20593 __vitePreload(async () => { 20594 const { getExternalLibFontStyles } = await import("./C2-mFwZ8.js"); 20595 return { getExternalLibFontStyles }; 20596 }, true ? [] : void 0, import.meta.url).then(({ getExternalLibFontStyles }) => { 20597 const css = getExternalLibFontStyles(); 20598 if (!css) return; 20599 const style = document.createElement("style"); 20600 style.setAttribute("data-font-display-override", ""); 20601 style.textContent = css; 20602 document.head.appendChild(style); 20603 }).catch(() => { 20604 }); 20605} 20606const async_css_client_eo9M_GWpwPQDYVwMPBbD0RwdbPwQD1FHI0qu89UswJI = defineNuxtPlugin({ 20607 name: "async-css", 20608 dependsOn: ["01-vuex"], 20609 setup(nuxtApp) { 20610 { 20611 onNuxtReady(() => { 20612 const store = nuxtApp.$vuexStore; 20613 const isMobileSettingsEnabled = store.getters["settings/getFeatureFlag"]("MobileSettings") === true; 20614 if (!isMobileSettingsEnabled) { 20615 return; 20616 } 20617 const asyncStylesheets = document.querySelectorAll( 20618 'link[rel="stylesheet"][media="print"]' 20619 );
20620 asyncStylesheets.forEach((link) => { 20621 try { 20622 link.onload = function() { 20623 if (this instanceof HTMLLinkElement) { 20624 this.media = "all"; 20625 injectFontDisplayOverrideOnce(); 20626 } 20627 }; 20628 setTimeout(() => { 20629 if (link.media === "print") { 20630 link.media = "all"; 20631 injectFontDisplayOverrideOnce(); 20632 } 20633 }, PRINT_MEDIA_FALLBACK_TIMEOUT); 20634 } catch { 20635 } 20636 }); 20637 if (asyncStylesheets.length === 0) { 20638 injectFontDisplayOverrideOnce(); 20639 } 20640 setTimeout(() => { 20641 try { 20642 const preloadStylesheets = document.querySelectorAll( 20643 'link[rel="preload"][as="style"]' 20644 ); 20645 preloadStylesheets.forEach((link) => { 20646 try { 20647 const href = link.getAttribute("href"); 20648 if (!href) return; 20649 const existing = document.querySelector( 20650 `link[rel="stylesheet"][href="${href}"]` 20651 ); 20652 if (!existing) { 20653 const stylesheet = document.createElement("link"); 20654 stylesheet.rel = "stylesheet"; 20655 stylesheet.href = href; 20656 document.head.appendChild(stylesheet); 20657 } 20658 } catch { 20659 } 20660 }); 20661 } catch { 20662 } 20663 }, PRELOAD_STYLESHEET_TIMEOUT); 20664 }); 20665 } 20666 } 20667}); 20668const BRYG_SDK_URL = "https://bryg.fusion92.com/assets/sdk/bryg-sdk.umd.js"; 20669const bryg_client_iGD8EaiwErkh_EOh4EuPHXr91PPbOWjosGds2K9BSpo = defineNuxtPlugin({ 20670 name: "bryg", 20671 setup() { 20672 { 20673 onNuxtReady(() => { 20674 const campaignId = new URLSearchParams(window.location.search).get( 20675 "campaignId" 20676 ); 20677 if (!campaignId) return; 20678 const script = document.createElement("script"); 20679 script.src = BRYG_SDK_URL; 20680 script.onload = () => { 20681 window.BRYG.init({}).catch((error) => { 20682 console.error("Bryg SDK initialization failed:", error); 20683 }); 20684 }; 20685 script.onerror = () => { 20686 console.error("Failed to load Bryg SDK script"); 20687 }; 20688 document.head.appendChild(script); 20689 }); 20690 } 20691 } 20692}); 20693const mustache_gg39OlBMWpHMwTxqs1R_DHcp6rvZyzo4wHDPqgJrMfk = defineNuxtPlugin(async (nuxtApp) => { 20694 globalThis.Mustache = mustache; 20695 return { 20696 provide: { 20697 mustache 20698 } 20699 }; 20700}); 20701function getAugmentedNamespace(n2) { 20702 if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2; 20703 var f = n2.default; 20704 if (typeof f == "function") { 20705 var a = function a2() { 20706 if (this instanceof a2) { 20707 return Reflect.construct(f, arguments, this.constructor); 20708 } 20709 return f.apply(this, arguments); 20710 }; 20711 a.prototype = f.prototype; 20712 } else a = {}; 20713 Object.defineProperty(a, "__esModule", { value: true }); 20714 Object.keys(n2).forEach(function(k) { 20715 var d = Object.getOwnPropertyDescriptor(n2, k); 20716 Object.defineProperty(a, k, d.get ? d : { 20717 enumerable: true, 20718 get: function() { 20719 return n2[k]; 20720 } 20721 }); 20722 }); 20723 return a; 20724} 20725var ReCaptchaVuePlugin = {}; 20726var ReCaptcha = {}; 20727var ReCaptchaLoader = {}; 20728var ReCaptchaInstance = {}; 20729var hasRequiredReCaptchaInstance; 20730function requireReCaptchaInstance() { 20731 if (hasRequiredReCaptchaInstance) return ReCaptchaInstance; 20732 hasRequiredReCaptchaInstance = 1; 20733 var __awaiter = ReCaptchaInstance && ReCaptchaInstance.__awaiter || function(thisArg, _arguments, P, generator) { 20734 function adopt(value) { 20735 return value instanceof P ? value : new P(function(resolve) { 20736 resolve(value); 20737 }); 20738 } 20739 return new (P || (P = Promise))(function(resolve, reject) { 20740 function fulfilled(value) { 20741 try { 20742 step(generator.next(value)); 20743 } catch (e) { 20744 reject(e); 20745 } 20746 } 20747 function rejected(value) { 20748 try { 20749 step(generator["throw"](value)); 20750 } catch (e) { 20751 reject(e); 20752 } 20753 } 20754 function step(result) { 20755 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 20756 } 20757 step((generator = generator.apply(thisArg, _arguments || [])).next()); 20758 }); 20759 }; 20760 var __generator = ReCaptchaInstance && ReCaptchaInstance.__generator || function(thisArg, body) { 20761 var _ = { label: 0, sent: function() { 20762 if (t[0] & 1) throw t[1]; 20763 return t[1]; 20764 }, trys: [], ops: [] }, f, y2, t, g; 20765 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { 20766 return this; 20767 }), g; 20768 function verb(n2) { 20769 return function(v) { 20770 return step([n2, v]); 20771 }; 20772 } 20773 function step(op) { 20774 if (f) throw new TypeError("Generator is already executing."); 20775 while (g && (g = 0, op[0] && (_ = 0)), _) try {
20776 if (f = 1, y2 && (t = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t = y2["return"]) && t.call(y2), 0) : y2.next) && !(t = t.call(y2, op[1])).done) return t; 20777 if (y2 = 0, t) op = [op[0] & 2, t.value]; 20778 switch (op[0]) { 20779 case 0: 20780 case 1: 20781 t = op; 20782 break; 20783 case 4: 20784 _.label++; 20785 return { value: op[1], done: false }; 20786 case 5: 20787 _.label++; 20788 y2 = op[1]; 20789 op = [0]; 20790 continue; 20791 case 7: 20792 op = _.ops.pop(); 20793 _.trys.pop(); 20794 continue; 20795 default: 20796 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { 20797 _ = 0; 20798 continue; 20799 } 20800 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { 20801 _.label = op[1]; 20802 break; 20803 } 20804 if (op[0] === 6 && _.label < t[1]) { 20805 _.label = t[1]; 20806 t = op; 20807 break; 20808 } 20809 if (t && _.label < t[2]) { 20810 _.label = t[2]; 20811 _.ops.push(op); 20812 break; 20813 } 20814 if (t[2]) _.ops.pop(); 20815 _.trys.pop(); 20816 continue; 20817 } 20818 op = body.call(thisArg, _); 20819 } catch (e) { 20820 op = [6, e]; 20821 y2 = 0; 20822 } finally { 20823 f = t = 0; 20824 } 20825 if (op[0] & 5) throw op[1]; 20826 return { value: op[0] ? op[1] : void 0, done: true }; 20827 } 20828 }; 20829 Object.defineProperty(ReCaptchaInstance, "__esModule", { value: true }); 20830 ReCaptchaInstance.ReCaptchaInstance = void 0; 20831 var ReCaptchaInstance$1 = function() { 20832 function ReCaptchaInstance2(siteKey, recaptchaID, recaptcha) { 20833 this.siteKey = siteKey; 20834 this.recaptchaID = recaptchaID; 20835 this.recaptcha = recaptcha; 20836 this.styleContainer = null; 20837 } 20838 ReCaptchaInstance2.prototype.execute = function(action) { 20839 return __awaiter(this, void 0, void 0, function() { 20840 var _a2; 20841 return __generator(this, function(_b2) { 20842 switch (_b2.label) { 20843 case 0: 20844 if (!this.recaptcha.enterprise) return [3, 2]; 20845 return [4, this.recaptcha.enterprise.execute(this.recaptchaID, { action })]; 20846 case 1: 20847 _a2 = _b2.sent(); 20848 return [3, 4]; 20849 case 2: 20850 return [4, this.recaptcha.execute(this.recaptchaID, { action })]; 20851 case 3: 20852 _a2 = _b2.sent(); 20853 _b2.label = 4; 20854 case 4: 20855 return [2, _a2]; 20856 } 20857 }); 20858 }); 20859 }; 20860 ReCaptchaInstance2.prototype.getSiteKey = function() { 20861 return this.siteKey; 20862 }; 20863 ReCaptchaInstance2.prototype.hideBadge = function() { 20864 if (this.styleContainer !== null) { 20865 return; 20866 } 20867 this.styleContainer = document.createElement("style"); 20868 this.styleContainer.innerHTML = ".grecaptcha-badge{visibility:hidden !important;}"; 20869 document.head.appendChild(this.styleContainer); 20870 }; 20871 ReCaptchaInstance2.prototype.showBadge = function() { 20872 if (this.styleContainer === null) { 20873 return; 20874 } 20875 document.head.removeChild(this.styleContainer); 20876 this.styleContainer = null; 20877 }; 20878 return ReCaptchaInstance2; 20879 }(); 20880 ReCaptchaInstance.ReCaptchaInstance = ReCaptchaInstance$1; 20881 return ReCaptchaInstance; 20882} 20883var hasRequiredReCaptchaLoader; 20884function requireReCaptchaLoader() { 20885 if (hasRequiredReCaptchaLoader) return ReCaptchaLoader; 20886 hasRequiredReCaptchaLoader = 1; 20887 var __assign = ReCaptchaLoader && ReCaptchaLoader.__assign || function() { 20888 __assign = Object.assign || function(t) { 20889 for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { 20890 s2 = arguments[i2]; 20891 for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) 20892 t[p2] = s2[p2]; 20893 } 20894 return t; 20895 }; 20896 return __assign.apply(this, arguments); 20897 }; 20898 Object.defineProperty(ReCaptchaLoader, "__esModule", { value: true }); 20899 ReCaptchaLoader.getInstance = ReCaptchaLoader.load = void 0; 20900 var ReCaptchaInstance_1 = requireReCaptchaInstance(); 20901 var ELoadingState; 20902 (function(ELoadingState2) { 20903 ELoadingState2[ELoadingState2["NOT_LOADED"] = 0] = "NOT_LOADED"; 20904 ELoadingState2[ELoadingState2["LOADING"] = 1] = "LOADING"; 20905 ELoadingState2[ELoadingState2["LOADED"] = 2] = "LOADED"; 20906 })(ELoadingState || (ELoadingState = {})); 20907 var ReCaptchaLoader$1 = function() { 20908 function ReCaptchaLoader2() { 20909 } 20910 ReCaptchaLoader2.load = function(siteKey, options) { 20911 if (options === void 0) { 20912 options = {}; 20913 } 20914 if (typeof document === "undefined") { 20915 return Promise.reject(new Error("This is a library for the browser!")); 20916 } 20917 if (ReCaptchaLoader2.getLoadingState() === ELoadingState.LOADED) { 20918 if (ReCaptchaLoader2.instance.getSiteKey() === siteKey) { 20919 return Promise.resolve(ReCaptchaLoader2.instance); 20920 } else { 20921 return Promise.reject(new Error("reCAPTCHA already loaded with different site key!")); 20922 } 20923 } 20924 if (ReCaptchaLoader2.getLoadingState() === ELoadingState.LOADING) { 20925 if (siteKey !== ReCaptchaLoader2.instanceSiteKey) { 20926 return Promise.reject(new Error("reCAPTCHA already loaded with different site key!")); 20927 } 20928 return new Promise(function(resolve, reject) { 20929 ReCaptchaLoader2.successfulLoadingConsumers.push(function(instance) { 20930 return resolve(instance); 20931 }); 20932 ReCaptchaLoader2.errorLoadingRunnable.push(function(reason) { 20933 return reject(reason); 20934 }); 20935 }); 20936 } 20937 ReCaptchaLoader2.instanceSiteKey = siteKey; 20938 ReCaptchaLoader2.setLoadingState(ELoadingState.LOADING); 20939 var loader = new ReCaptchaLoader2(); 20940 return new Promise(function(resolve, reject) { 20941 loader.loadScript(siteKey, options.useRecaptchaNet || false, options.useEnterprise || false, options.renderParameters ? options.renderParameters : {}, options.customUrl).then(function() { 20942 ReCaptchaLoader2.setLoadingState(ELoadingState.LOADED); 20943 var widgetID = loader.doExplicitRender(grecaptcha, siteKey, options.explicitRenderParameters ? options.explicitRenderParameters : {}, options.useEnterprise || false); 20944 var instance = new ReCaptchaInstance_1.ReCaptchaInstance(siteKey, widgetID, grecaptcha);
20945 ReCaptchaLoader2.successfulLoadingConsumers.forEach(function(v) { 20946 return v(instance); 20947 }); 20948 ReCaptchaLoader2.successfulLoadingConsumers = []; 20949 if (options.autoHideBadge) { 20950 instance.hideBadge(); 20951 } 20952 ReCaptchaLoader2.instance = instance; 20953 resolve(instance); 20954 }).catch(function(error) { 20955 ReCaptchaLoader2.errorLoadingRunnable.forEach(function(v) { 20956 return v(error); 20957 }); 20958 ReCaptchaLoader2.errorLoadingRunnable = []; 20959 reject(error); 20960 }); 20961 }); 20962 }; 20963 ReCaptchaLoader2.getInstance = function() { 20964 return ReCaptchaLoader2.instance; 20965 }; 20966 ReCaptchaLoader2.setLoadingState = function(state2) { 20967 ReCaptchaLoader2.loadingState = state2; 20968 }; 20969 ReCaptchaLoader2.getLoadingState = function() { 20970 if (ReCaptchaLoader2.loadingState === null) { 20971 return ELoadingState.NOT_LOADED; 20972 } else { 20973 return ReCaptchaLoader2.loadingState; 20974 } 20975 }; 20976 ReCaptchaLoader2.prototype.loadScript = function(siteKey, useRecaptchaNet, useEnterprise, renderParameters, customUrl) { 20977 var _this = this; 20978 if (useRecaptchaNet === void 0) { 20979 useRecaptchaNet = false; 20980 } 20981 if (useEnterprise === void 0) { 20982 useEnterprise = false; 20983 } 20984 if (renderParameters === void 0) { 20985 renderParameters = {}; 20986 } 20987 if (customUrl === void 0) { 20988 customUrl = ""; 20989 } 20990 var scriptElement = document.createElement("script"); 20991 scriptElement.setAttribute("recaptcha-v3-script", ""); 20992 scriptElement.setAttribute("async", ""); 20993 scriptElement.setAttribute("defer", ""); 20994 var scriptBase = "https://www.google.com/recaptcha/api.js"; 20995 if (useRecaptchaNet) { 20996 if (useEnterprise) { 20997 scriptBase = "https://recaptcha.net/recaptcha/enterprise.js"; 20998 } else { 20999 scriptBase = "https://recaptcha.net/recaptcha/api.js"; 21000 } 21001 } else if (useEnterprise) { 21002 scriptBase = "https://www.google.com/recaptcha/enterprise.js"; 21003 } 21004 if (customUrl) { 21005 scriptBase = customUrl; 21006 } 21007 if (renderParameters.render) { 21008 renderParameters.render = void 0; 21009 } 21010 var parametersQuery = this.buildQueryString(renderParameters); 21011 scriptElement.src = scriptBase + "?render=explicit" + parametersQuery; 21012 return new Promise(function(resolve, reject) { 21013 scriptElement.addEventListener("load", _this.waitForScriptToLoad(function() { 21014 resolve(scriptElement); 21015 }, useEnterprise), false); 21016 scriptElement.onerror = function(error) { 21017 ReCaptchaLoader2.setLoadingState(ELoadingState.NOT_LOADED); 21018 reject(error); 21019 }; 21020 document.head.appendChild(scriptElement); 21021 }); 21022 }; 21023 ReCaptchaLoader2.prototype.buildQueryString = function(parameters) { 21024 var parameterKeys = Object.keys(parameters); 21025 if (parameterKeys.length < 1) { 21026 return ""; 21027 } 21028 return "&" + Object.keys(parameters).filter(function(parameterKey) { 21029 return !!parameters[parameterKey]; 21030 }).map(function(parameterKey) { 21031 return parameterKey + "=" + parameters[parameterKey]; 21032 }).join("&"); 21033 }; 21034 ReCaptchaLoader2.prototype.waitForScriptToLoad = function(callback, useEnterprise) { 21035 var _this = this; 21036 return function() { 21037 if (window.grecaptcha === void 0) { 21038 setTimeout(function() { 21039 _this.waitForScriptToLoad(callback, useEnterprise); 21040 }, ReCaptchaLoader2.SCRIPT_LOAD_DELAY); 21041 } else { 21042 if (useEnterprise) { 21043 window.grecaptcha.enterprise.ready(function() { 21044 callback(); 21045 }); 21046 } else { 21047 window.grecaptcha.ready(function() { 21048 callback(); 21049 }); 21050 } 21051 } 21052 }; 21053 }; 21054 ReCaptchaLoader2.prototype.doExplicitRender = function(grecaptcha2, siteKey, parameters, isEnterprise) { 21055 var augmentedParameters = __assign({ sitekey: siteKey }, parameters); 21056 if (parameters.container) { 21057 if (isEnterprise) { 21058 return grecaptcha2.enterprise.render(parameters.container, augmentedParameters); 21059 } else { 21060 return grecaptcha2.render(parameters.container, augmentedParameters); 21061 } 21062 } else { 21063 if (isEnterprise) { 21064 return grecaptcha2.enterprise.render(augmentedParameters); 21065 } else { 21066 return grecaptcha2.render(augmentedParameters); 21067 } 21068 } 21069 }; 21070 ReCaptchaLoader2.loadingState = null; 21071 ReCaptchaLoader2.instance = null; 21072 ReCaptchaLoader2.instanceSiteKey = null; 21073 ReCaptchaLoader2.successfulLoadingConsumers = []; 21074 ReCaptchaLoader2.errorLoadingRunnable = []; 21075 ReCaptchaLoader2.SCRIPT_LOAD_DELAY = 25; 21076 return ReCaptchaLoader2; 21077 }(); 21078 ReCaptchaLoader.load = ReCaptchaLoader$1.load; 21079 ReCaptchaLoader.getInstance = ReCaptchaLoader$1.getInstance; 21080 return ReCaptchaLoader; 21081} 21082var hasRequiredReCaptcha; 21083function requireReCaptcha() { 21084 if (hasRequiredReCaptcha) return ReCaptcha; 21085 hasRequiredReCaptcha = 1; 21086 (function(exports) { 21087 Object.defineProperty(exports, "__esModule", { value: true }); 21088 exports.ReCaptchaInstance = exports.getInstance = exports.load = void 0; 21089 var ReCaptchaLoader_1 = requireReCaptchaLoader();
21090 Object.defineProperty(exports, "load", { enumerable: true, get: function() { 21091 return ReCaptchaLoader_1.load; 21092 } }); 21093 Object.defineProperty(exports, "getInstance", { enumerable: true, get: function() { 21094 return ReCaptchaLoader_1.getInstance; 21095 } }); 21096 var ReCaptchaInstance_1 = requireReCaptchaInstance(); 21097 Object.defineProperty(exports, "ReCaptchaInstance", { enumerable: true, get: function() { 21098 return ReCaptchaInstance_1.ReCaptchaInstance; 21099 } }); 21100 })(ReCaptcha); 21101 return ReCaptcha; 21102} 21103var vue = { exports: {} }; 21104var vue_cjs_prod = {}; 21105/** 21106* @vue/compiler-core v3.5.13 21107* (c) 2018-present Yuxi (Evan) You and Vue contributors 21108* @license MIT 21109**/ 21110const FRAGMENT = Symbol(``); 21111const TELEPORT = Symbol(``); 21112const SUSPENSE = Symbol(``); 21113const KEEP_ALIVE = Symbol(``); 21114const BASE_TRANSITION = Symbol( 21115 `` 21116); 21117const OPEN_BLOCK = Symbol(``); 21118const CREATE_BLOCK = Symbol(``); 21119const CREATE_ELEMENT_BLOCK = Symbol( 21120 `` 21121); 21122const CREATE_VNODE = Symbol(``); 21123const CREATE_ELEMENT_VNODE = Symbol( 21124 `` 21125); 21126const CREATE_COMMENT = Symbol( 21127 `` 21128); 21129const CREATE_TEXT = Symbol( 21130 `` 21131); 21132const CREATE_STATIC = Symbol( 21133 `` 21134); 21135const RESOLVE_COMPONENT = Symbol( 21136 `` 21137); 21138const RESOLVE_DYNAMIC_COMPONENT = Symbol( 21139 `` 21140); 21141const RESOLVE_DIRECTIVE = Symbol( 21142 `` 21143); 21144const RESOLVE_FILTER = Symbol( 21145 `` 21146); 21147const WITH_DIRECTIVES = Symbol( 21148 `` 21149); 21150const RENDER_LIST = Symbol(``); 21151const RENDER_SLOT = Symbol(``); 21152const CREATE_SLOTS = Symbol(``); 21153const TO_DISPLAY_STRING = Symbol( 21154 `` 21155); 21156const MERGE_PROPS = Symbol(``); 21157const NORMALIZE_CLASS = Symbol( 21158 `` 21159); 21160const NORMALIZE_STYLE = Symbol( 21161 `` 21162); 21163const NORMALIZE_PROPS = Symbol( 21164 `` 21165); 21166const GUARD_REACTIVE_PROPS = Symbol( 21167 `` 21168); 21169const TO_HANDLERS = Symbol(``); 21170const CAMELIZE = Symbol(``); 21171const CAPITALIZE = Symbol(``); 21172const TO_HANDLER_KEY = Symbol( 21173 `` 21174); 21175const SET_BLOCK_TRACKING = Symbol( 21176 `` 21177); 21178const PUSH_SCOPE_ID = Symbol(``); 21179const POP_SCOPE_ID = Symbol(``); 21180const WITH_CTX = Symbol(``); 21181const UNREF = Symbol(``); 21182const IS_REF = Symbol(``); 21183const WITH_MEMO = Symbol(``); 21184const IS_MEMO_SAME = Symbol(``); 21185const helperNameMap = { 21186 [FRAGMENT]: `Fragment`, 21187 [TELEPORT]: `Teleport`, 21188 [SUSPENSE]: `Suspense`, 21189 [KEEP_ALIVE]: `KeepAlive`, 21190 [BASE_TRANSITION]: `BaseTransition`, 21191 [OPEN_BLOCK]: `openBlock`, 21192 [CREATE_BLOCK]: `createBlock`, 21193 [CREATE_ELEMENT_BLOCK]: `createElementBlock`, 21194 [CREATE_VNODE]: `createVNode`, 21195 [CREATE_ELEMENT_VNODE]: `createElementVNode`, 21196 [CREATE_COMMENT]: `createCommentVNode`, 21197 [CREATE_TEXT]: `createTextVNode`, 21198 [CREATE_STATIC]: `createStaticVNode`, 21199 [RESOLVE_COMPONENT]: `resolveComponent`, 21200 [RESOLVE_DYNAMIC_COMPONENT]: `resolveDynamicComponent`, 21201 [RESOLVE_DIRECTIVE]: `resolveDirective`, 21202 [RESOLVE_FILTER]: `resolveFilter`, 21203 [WITH_DIRECTIVES]: `withDirectives`, 21204 [RENDER_LIST]: `renderList`, 21205 [RENDER_SLOT]: `renderSlot`, 21206 [CREATE_SLOTS]: `createSlots`, 21207 [TO_DISPLAY_STRING]: `toDisplayString`, 21208 [MERGE_PROPS]: `mergeProps`, 21209 [NORMALIZE_CLASS]: `normalizeClass`, 21210 [NORMALIZE_STYLE]: `normalizeStyle`, 21211 [NORMALIZE_PROPS]: `normalizeProps`, 21212 [GUARD_REACTIVE_PROPS]: `guardReactiveProps`, 21213 [TO_HANDLERS]: `toHandlers`, 21214 [CAMELIZE]: `camelize`, 21215 [CAPITALIZE]: `capitalize`, 21216 [TO_HANDLER_KEY]: `toHandlerKey`, 21217 [SET_BLOCK_TRACKING]: `setBlockTracking`, 21218 [PUSH_SCOPE_ID]: `pushScopeId`, 21219 [POP_SCOPE_ID]: `popScopeId`, 21220 [WITH_CTX]: `withCtx`, 21221 [UNREF]: `unref`, 21222 [IS_REF]: `isRef`, 21223 [WITH_MEMO]: `withMemo`, 21224 [IS_MEMO_SAME]: `isMemoSame` 21225}; 21226function registerRuntimeHelpers(helpers) { 21227 Object.getOwnPropertySymbols(helpers).forEach((s2) => { 21228 helperNameMap[s2] = helpers[s2]; 21229 }); 21230} 21231const Namespaces = { 21232 "HTML": 0, 21233 "0": "HTML", 21234 "SVG": 1, 21235 "1": "SVG", 21236 "MATH_ML": 2, 21237 "2": "MATH_ML" 21238}; 21239const NodeTypes = { 21240 "ROOT": 0, 21241 "0": "ROOT", 21242 "ELEMENT": 1, 21243 "1": "ELEMENT", 21244 "TEXT": 2, 21245 "2": "TEXT", 21246 "COMMENT": 3, 21247 "3": "COMMENT", 21248 "SIMPLE_EXPRESSION": 4, 21249 "4": "SIMPLE_EXPRESSION", 21250 "INTERPOLATION": 5, 21251 "5": "INTERPOLATION", 21252 "ATTRIBUTE": 6, 21253 "6": "ATTRIBUTE", 21254 "DIRECTIVE": 7, 21255 "7": "DIRECTIVE", 21256 "COMPOUND_EXPRESSION": 8, 21257 "8": "COMPOUND_EXPRESSION", 21258 "IF": 9, 21259 "9": "IF", 21260 "IF_BRANCH": 10, 21261 "10": "IF_BRANCH", 21262 "FOR": 11, 21263 "11": "FOR", 21264 "TEXT_CALL": 12, 21265 "12": "TEXT_CALL", 21266 "VNODE_CALL": 13, 21267 "13": "VNODE_CALL", 21268 "JS_CALL_EXPRESSION": 14, 21269 "14": "JS_CALL_EXPRESSION", 21270 "JS_OBJECT_EXPRESSION": 15, 21271 "15": "JS_OBJECT_EXPRESSION", 21272 "JS_PROPERTY": 16, 21273 "16": "JS_PROPERTY", 21274 "JS_ARRAY_EXPRESSION": 17, 21275 "17": "JS_ARRAY_EXPRESSION", 21276 "JS_FUNCTION_EXPRESSION": 18, 21277 "18": "JS_FUNCTION_EXPRESSION", 21278 "JS_CONDITIONAL_EXPRESSION": 19, 21279 "19": "JS_CONDITIONAL_EXPRESSION", 21280 "JS_CACHE_EXPRESSION": 20, 21281 "20": "JS_CACHE_EXPRESSION", 21282 "JS_BLOCK_STATEMENT": 21, 21283 "21": "JS_BLOCK_STATEMENT", 21284 "JS_TEMPLATE_LITERAL": 22, 21285 "22": "JS_TEMPLATE_LITERAL", 21286 "JS_IF_STATEMENT": 23, 21287 "23": "JS_IF_STATEMENT", 21288 "JS_ASSIGNMENT_EXPRESSION": 24, 21289 "24": "JS_ASSIGNMENT_EXPRESSION", 21290 "JS_SEQUENCE_EXPRESSION": 25, 21291 "25": "JS_SEQUENCE_EXPRESSION", 21292 "JS_RETURN_STATEMENT": 26, 21293 "26": "JS_RETURN_STATEMENT" 21294}; 21295const ElementTypes = { 21296 "ELEMENT": 0, 21297 "0": "ELEMENT", 21298 "COMPONENT": 1, 21299 "1": "COMPONENT", 21300 "SLOT": 2, 21301 "2": "SLOT", 21302 "TEMPLATE": 3, 21303 "3": "TEMPLATE"
vendor: 3,499 bytes, lines 21304-21483
21304}; 21305const ConstantTypes = { 21306 "NOT_CONSTANT": 0, 21307 "0": "NOT_CONSTANT", 21308 "CAN_SKIP_PATCH": 1, 21309 "1": "CAN_SKIP_PATCH", 21310 "CAN_CACHE": 2, 21311 "2": "CAN_CACHE", 21312 "CAN_STRINGIFY": 3, 21313 "3": "CAN_STRINGIFY" 21314}; 21315const locStub = { 21316 start: { line: 1, column: 1, offset: 0 }, 21317 end: { line: 1, column: 1, offset: 0 }, 21318 source: "" 21319}; 21320function createRoot(children, source = "") { 21321 return { 21322 type: 0, 21323 source, 21324 children, 21325 helpers: /* @__PURE__ */ new Set(), 21326 components: [], 21327 directives: [], 21328 hoists: [], 21329 imports: [], 21330 cached: [], 21331 temps: 0, 21332 codegenNode: void 0, 21333 loc: locStub 21334 }; 21335} 21336function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent2 = false, loc = locStub) { 21337 if (context) { 21338 if (isBlock) { 21339 context.helper(OPEN_BLOCK); 21340 context.helper(getVNodeBlockHelper(context.inSSR, isComponent2)); 21341 } else { 21342 context.helper(getVNodeHelper(context.inSSR, isComponent2)); 21343 } 21344 if (directives) { 21345 context.helper(WITH_DIRECTIVES); 21346 } 21347 } 21348 return { 21349 type: 13, 21350 tag, 21351 props, 21352 children, 21353 patchFlag, 21354 dynamicProps, 21355 directives, 21356 isBlock, 21357 disableTracking, 21358 isComponent: isComponent2, 21359 loc 21360 }; 21361} 21362function createArrayExpression(elements, loc = locStub) { 21363 return { 21364 type: 17, 21365 loc, 21366 elements 21367 }; 21368} 21369function createObjectExpression(properties, loc = locStub) { 21370 return { 21371 type: 15, 21372 loc, 21373 properties 21374 }; 21375} 21376function createObjectProperty(key, value) { 21377 return { 21378 type: 16, 21379 loc: locStub, 21380 key: isString$1(key) ? createSimpleExpression(key, true) : key, 21381 value 21382 }; 21383} 21384function createSimpleExpression(content, isStatic = false, loc = locStub, constType = 0) { 21385 return { 21386 type: 4, 21387 loc, 21388 content, 21389 isStatic, 21390 constType: isStatic ? 3 : constType 21391 }; 21392} 21393function createInterpolation(content, loc) { 21394 return { 21395 type: 5, 21396 loc, 21397 content: isString$1(content) ? createSimpleExpression(content, false, loc) : content 21398 }; 21399} 21400function createCompoundExpression(children, loc = locStub) { 21401 return { 21402 type: 8, 21403 loc, 21404 children 21405 }; 21406} 21407function createCallExpression(callee, args = [], loc = locStub) { 21408 return { 21409 type: 14, 21410 loc, 21411 callee, 21412 arguments: args 21413 }; 21414} 21415function createFunctionExpression(params, returns = void 0, newline = false, isSlot = false, loc = locStub) { 21416 return { 21417 type: 18, 21418 params, 21419 returns, 21420 newline, 21421 isSlot, 21422 loc 21423 }; 21424} 21425function createConditionalExpression(test, consequent, alternate, newline = true) { 21426 return { 21427 type: 19, 21428 test, 21429 consequent, 21430 alternate, 21431 newline, 21432 loc: locStub 21433 }; 21434} 21435function createCacheExpression(index, value, needPauseTracking = false, inVOnce = false) { 21436 return { 21437 type: 20, 21438 index, 21439 value, 21440 needPauseTracking, 21441 inVOnce, 21442 needArraySpread: false, 21443 loc: locStub 21444 }; 21445} 21446function createBlockStatement(body) { 21447 return { 21448 type: 21, 21449 body, 21450 loc: locStub 21451 }; 21452} 21453function createTemplateLiteral(elements) { 21454 return { 21455 type: 22, 21456 elements, 21457 loc: locStub 21458 }; 21459} 21460function createIfStatement(test, consequent, alternate) { 21461 return { 21462 type: 23, 21463 test, 21464 consequent, 21465 alternate, 21466 loc: locStub 21467 }; 21468} 21469function createAssignmentExpression(left, right) { 21470 return { 21471 type: 24, 21472 left, 21473 right, 21474 loc: locStub 21475 }; 21476} 21477function createSequenceExpression(expressions) { 21478 return { 21479 type: 25, 21480 expressions, 21481 loc: locStub 21482 }; 21483}
vendor: 21,847 bytes, lines 21484-22273
21484function createReturnStatement(returns) { 21485 return { 21486 type: 26, 21487 returns, 21488 loc: locStub 21489 }; 21490} 21491function getVNodeHelper(ssr, isComponent2) { 21492 return ssr || isComponent2 ? CREATE_VNODE : CREATE_ELEMENT_VNODE; 21493} 21494function getVNodeBlockHelper(ssr, isComponent2) { 21495 return ssr || isComponent2 ? CREATE_BLOCK : CREATE_ELEMENT_BLOCK; 21496} 21497function convertToBlock(node, { helper, removeHelper, inSSR }) { 21498 if (!node.isBlock) { 21499 node.isBlock = true; 21500 removeHelper(getVNodeHelper(inSSR, node.isComponent)); 21501 helper(OPEN_BLOCK); 21502 helper(getVNodeBlockHelper(inSSR, node.isComponent)); 21503 } 21504} 21505const defaultDelimitersOpen = new Uint8Array([123, 123]); 21506const defaultDelimitersClose = new Uint8Array([125, 125]); 21507function isTagStartChar(c2) { 21508 return c2 >= 97 && c2 <= 122 || c2 >= 65 && c2 <= 90; 21509} 21510function isWhitespace(c2) { 21511 return c2 === 32 || c2 === 10 || c2 === 9 || c2 === 12 || c2 === 13; 21512} 21513function isEndOfTagSection(c2) { 21514 return c2 === 47 || c2 === 62 || isWhitespace(c2); 21515} 21516function toCharCodes(str) { 21517 const ret = new Uint8Array(str.length); 21518 for (let i2 = 0; i2 < str.length; i2++) { 21519 ret[i2] = str.charCodeAt(i2); 21520 } 21521 return ret; 21522} 21523const Sequences = { 21524 Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]), 21525 // CDATA[ 21526 CdataEnd: new Uint8Array([93, 93, 62]), 21527 // ]]> 21528 CommentEnd: new Uint8Array([45, 45, 62]), 21529 // `-->` 21530 ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]), 21531 // `<\/script` 21532 StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]), 21533 // `</style` 21534 TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]), 21535 // `</title` 21536 TextareaEnd: new Uint8Array([ 21537 60, 21538 47, 21539 116, 21540 101, 21541 120, 21542 116, 21543 97, 21544 114, 21545 101, 21546 97 21547 ]) 21548 // `</textarea 21549}; 21550class Tokenizer { 21551 constructor(stack2, cbs) { 21552 this.stack = stack2; 21553 this.cbs = cbs; 21554 this.state = 1; 21555 this.buffer = ""; 21556 this.sectionStart = 0; 21557 this.index = 0; 21558 this.entityStart = 0; 21559 this.baseState = 1; 21560 this.inRCDATA = false; 21561 this.inXML = false; 21562 this.inVPre = false; 21563 this.newlines = []; 21564 this.mode = 0; 21565 this.delimiterOpen = defaultDelimitersOpen; 21566 this.delimiterClose = defaultDelimitersClose; 21567 this.delimiterIndex = -1; 21568 this.currentSequence = void 0; 21569 this.sequenceIndex = 0; 21570 } 21571 get inSFCRoot() { 21572 return this.mode === 2 && this.stack.length === 0; 21573 } 21574 reset() { 21575 this.state = 1; 21576 this.mode = 0; 21577 this.buffer = ""; 21578 this.sectionStart = 0; 21579 this.index = 0; 21580 this.baseState = 1; 21581 this.inRCDATA = false; 21582 this.currentSequence = void 0; 21583 this.newlines.length = 0; 21584 this.delimiterOpen = defaultDelimitersOpen; 21585 this.delimiterClose = defaultDelimitersClose; 21586 } 21587 /** 21588 * Generate Position object with line / column information using recorded 21589 * newline positions. We know the index is always going to be an already 21590 * processed index, so all the newlines up to this index should have been 21591 * recorded. 21592 */ 21593 getPos(index) { 21594 let line = 1; 21595 let column = index + 1; 21596 for (let i2 = this.newlines.length - 1; i2 >= 0; i2--) { 21597 const newlineIndex = this.newlines[i2]; 21598 if (index > newlineIndex) { 21599 line = i2 + 2; 21600 column = index - newlineIndex; 21601 break; 21602 } 21603 } 21604 return { 21605 column, 21606 line, 21607 offset: index 21608 }; 21609 } 21610 peek() { 21611 return this.buffer.charCodeAt(this.index + 1); 21612 } 21613 stateText(c2) { 21614 if (c2 === 60) { 21615 if (this.index > this.sectionStart) { 21616 this.cbs.ontext(this.sectionStart, this.index); 21617 } 21618 this.state = 5; 21619 this.sectionStart = this.index; 21620 } else if (!this.inVPre && c2 === this.delimiterOpen[0]) { 21621 this.state = 2; 21622 this.delimiterIndex = 0; 21623 this.stateInterpolationOpen(c2); 21624 } 21625 } 21626 stateInterpolationOpen(c2) { 21627 if (c2 === this.delimiterOpen[this.delimiterIndex]) { 21628 if (this.delimiterIndex === this.delimiterOpen.length - 1) { 21629 const start = this.index + 1 - this.delimiterOpen.length; 21630 if (start > this.sectionStart) { 21631 this.cbs.ontext(this.sectionStart, start); 21632 } 21633 this.state = 3; 21634 this.sectionStart = start; 21635 } else { 21636 this.delimiterIndex++; 21637 } 21638 } else if (this.inRCDATA) { 21639 this.state = 32; 21640 this.stateInRCDATA(c2); 21641 } else { 21642 this.state = 1; 21643 this.stateText(c2); 21644 } 21645 } 21646 stateInterpolation(c2) { 21647 if (c2 === this.delimiterClose[0]) { 21648 this.state = 4; 21649 this.delimiterIndex = 0; 21650 this.stateInterpolationClose(c2); 21651 } 21652 } 21653 stateInterpolationClose(c2) { 21654 if (c2 === this.delimiterClose[this.delimiterIndex]) { 21655 if (this.delimiterIndex === this.delimiterClose.length - 1) { 21656 this.cbs.oninterpolation(this.sectionStart, this.index + 1); 21657 if (this.inRCDATA) { 21658 this.state = 32; 21659 } else { 21660 this.state = 1; 21661 } 21662 this.sectionStart = this.index + 1; 21663 } else { 21664 this.delimiterIndex++; 21665 } 21666 } else { 21667 this.state = 3; 21668 this.stateInterpolation(c2); 21669 } 21670 } 21671 stateSpecialStartSequence(c2) { 21672 const isEnd = this.sequenceIndex === this.currentSequence.length; 21673 const isMatch = isEnd ? ( 21674 // If we are at the end of the sequence, make sure the tag name has ended 21675 isEndOfTagSection(c2) 21676 ) : ( 21677 // Otherwise, do a case-insensitive comparison 21678 (c2 | 32) === this.currentSequence[this.sequenceIndex] 21679 ); 21680 if (!isMatch) { 21681 this.inRCDATA = false; 21682 } else if (!isEnd) { 21683 this.sequenceIndex++; 21684 return; 21685 } 21686 this.sequenceIndex = 0; 21687 this.state = 6; 21688 this.stateInTagName(c2); 21689 } 21690 /** Look for an end tag. For <title> and <textarea>, also decode entities. */ 21691 stateInRCDATA(c2) { 21692 if (this.sequenceIndex === this.currentSequence.length) { 21693 if (c2 === 62 || isWhitespace(c2)) { 21694 const endOfText = this.index - this.currentSequence.length; 21695 if (this.sectionStart < endOfText) { 21696 const actualIndex = this.index; 21697 this.index = endOfText; 21698 this.cbs.ontext(this.sectionStart, endOfText); 21699 this.index = actualIndex; 21700 } 21701 this.sectionStart = endOfText + 2; 21702 this.stateInClosingTagName(c2); 21703 this.inRCDATA = false; 21704 return; 21705 } 21706 this.sequenceIndex = 0; 21707 } 21708 if ((c2 | 32) === this.currentSequence[this.sequenceIndex]) { 21709 this.sequenceIndex += 1; 21710 } else if (this.sequenceIndex === 0) { 21711 if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) { 21712 if (!this.inVPre && c2 === this.delimiterOpen[0]) { 21713 this.state = 2; 21714 this.delimiterIndex = 0; 21715 this.stateInterpolationOpen(c2); 21716 } 21717 } else if (this.fastForwardTo(60)) { 21718 this.sequenceIndex = 1; 21719 } 21720 } else { 21721 this.sequenceIndex = Number(c2 === 60); 21722 } 21723 } 21724 stateCDATASequence(c2) { 21725 if (c2 === Sequences.Cdata[this.sequenceIndex]) { 21726 if (++this.sequenceIndex === Sequences.Cdata.length) { 21727 this.state = 28; 21728 this.currentSequence = Sequences.CdataEnd; 21729 this.sequenceIndex = 0; 21730 this.sectionStart = this.index + 1; 21731 } 21732 } else { 21733 this.sequenceIndex = 0; 21734 this.state = 23; 21735 this.stateInDeclaration(c2); 21736 } 21737 } 21738 /** 21739 * When we wait for one specific character, we can speed things up 21740 * by skipping through the buffer until we find it. 21741 * 21742 * @returns Whether the character was found. 21743 */ 21744 fastForwardTo(c2) { 21745 while (++this.index < this.buffer.length) { 21746 const cc = this.buffer.charCodeAt(this.index); 21747 if (cc === 10) { 21748 this.newlines.push(this.index); 21749 } 21750 if (cc === c2) { 21751 return true; 21752 } 21753 } 21754 this.index = this.buffer.length - 1; 21755 return false; 21756 } 21757 /** 21758 * Comments and CDATA end with `-->` and `]]>`. 21759 * 21760 * Their common qualities are: 21761 * - Their end sequences have a distinct character they start with. 21762 * - That character is then repeated, so we have to check multiple repeats. 21763 * - All characters but the start character of the sequence can be skipped. 21764 */ 21765 stateInCommentLike(c2) { 21766 if (c2 === this.currentSequence[this.sequenceIndex]) { 21767 if (++this.sequenceIndex === this.currentSequence.length) { 21768 if (this.currentSequence === Sequences.CdataEnd) { 21769 this.cbs.oncdata(this.sectionStart, this.index - 2); 21770 } else { 21771 this.cbs.oncomment(this.sectionStart, this.index - 2); 21772 } 21773 this.sequenceIndex = 0; 21774 this.sectionStart = this.index + 1; 21775 this.state = 1; 21776 } 21777 } else if (this.sequenceIndex === 0) { 21778 if (this.fastForwardTo(this.currentSequence[0])) { 21779 this.sequenceIndex = 1; 21780 } 21781 } else if (c2 !== this.currentSequence[this.sequenceIndex - 1]) { 21782 this.sequenceIndex = 0; 21783 } 21784 } 21785 startSpecial(sequence, offset) { 21786 this.enterRCDATA(sequence, offset); 21787 this.state = 31; 21788 } 21789 enterRCDATA(sequence, offset) { 21790 this.inRCDATA = true; 21791 this.currentSequence = sequence; 21792 this.sequenceIndex = offset; 21793 } 21794 stateBeforeTagName(c2) { 21795 if (c2 === 33) { 21796 this.state = 22; 21797 this.sectionStart = this.index + 1; 21798 } else if (c2 === 63) { 21799 this.state = 24; 21800 this.sectionStart = this.index + 1; 21801 } else if (isTagStartChar(c2)) { 21802 this.sectionStart = this.index; 21803 if (this.mode === 0) { 21804 this.state = 6; 21805 } else if (this.inSFCRoot) { 21806 this.state = 34; 21807 } else if (!this.inXML) { 21808 if (c2 === 116) { 21809 this.state = 30; 21810 } else { 21811 this.state = c2 === 115 ? 29 : 6; 21812 } 21813 } else { 21814 this.state = 6; 21815 } 21816 } else if (c2 === 47) { 21817 this.state = 8; 21818 } else { 21819 this.state = 1; 21820 this.stateText(c2); 21821 } 21822 } 21823 stateInTagName(c2) { 21824 if (isEndOfTagSection(c2)) { 21825 this.handleTagName(c2); 21826 } 21827 } 21828 stateInSFCRootTagName(c2) { 21829 if (isEndOfTagSection(c2)) { 21830 const tag = this.buffer.slice(this.sectionStart, this.index); 21831 if (tag !== "template") { 21832 this.enterRCDATA(toCharCodes(`</` + tag), 0); 21833 } 21834 this.handleTagName(c2); 21835 } 21836 } 21837 handleTagName(c2) { 21838 this.cbs.onopentagname(this.sectionStart, this.index); 21839 this.sectionStart = -1; 21840 this.state = 11; 21841 this.stateBeforeAttrName(c2); 21842 } 21843 stateBeforeClosingTagName(c2) { 21844 if (isWhitespace(c2)) ; 21845 else if (c2 === 62) { 21846 this.state = 1; 21847 this.sectionStart = this.index + 1; 21848 } else { 21849 this.state = isTagStartChar(c2) ? 9 : 27; 21850 this.sectionStart = this.index; 21851 } 21852 } 21853 stateInClosingTagName(c2) { 21854 if (c2 === 62 || isWhitespace(c2)) { 21855 this.cbs.onclosetag(this.sectionStart, this.index); 21856 this.sectionStart = -1; 21857 this.state = 10; 21858 this.stateAfterClosingTagName(c2); 21859 } 21860 } 21861 stateAfterClosingTagName(c2) { 21862 if (c2 === 62) { 21863 this.state = 1; 21864 this.sectionStart = this.index + 1; 21865 } 21866 } 21867 stateBeforeAttrName(c2) { 21868 if (c2 === 62) { 21869 this.cbs.onopentagend(this.index); 21870 if (this.inRCDATA) { 21871 this.state = 32; 21872 } else { 21873 this.state = 1; 21874 } 21875 this.sectionStart = this.index + 1; 21876 } else if (c2 === 47) { 21877 this.state = 7; 21878 } else if (c2 === 60 && this.peek() === 47) { 21879 this.cbs.onopentagend(this.index); 21880 this.state = 5; 21881 this.sectionStart = this.index; 21882 } else if (!isWhitespace(c2)) { 21883 this.handleAttrStart(c2); 21884 } 21885 } 21886 handleAttrStart(c2) { 21887 if (c2 === 118 && this.peek() === 45) { 21888 this.state = 13; 21889 this.sectionStart = this.index; 21890 } else if (c2 === 46 || c2 === 58 || c2 === 64 || c2 === 35) { 21891 this.cbs.ondirname(this.index, this.index + 1); 21892 this.state = 14; 21893 this.sectionStart = this.index + 1; 21894 } else { 21895 this.state = 12; 21896 this.sectionStart = this.index; 21897 } 21898 } 21899 stateInSelfClosingTag(c2) { 21900 if (c2 === 62) { 21901 this.cbs.onselfclosingtag(this.index); 21902 this.state = 1; 21903 this.sectionStart = this.index + 1; 21904 this.inRCDATA = false; 21905 } else if (!isWhitespace(c2)) { 21906 this.state = 11; 21907 this.stateBeforeAttrName(c2); 21908 } 21909 } 21910 stateInAttrName(c2) { 21911 if (c2 === 61 || isEndOfTagSection(c2)) { 21912 this.cbs.onattribname(this.sectionStart, this.index); 21913 this.handleAttrNameEnd(c2); 21914 } 21915 } 21916 stateInDirName(c2) { 21917 if (c2 === 61 || isEndOfTagSection(c2)) { 21918 this.cbs.ondirname(this.sectionStart, this.index); 21919 this.handleAttrNameEnd(c2); 21920 } else if (c2 === 58) { 21921 this.cbs.ondirname(this.sectionStart, this.index); 21922 this.state = 14; 21923 this.sectionStart = this.index + 1; 21924 } else if (c2 === 46) { 21925 this.cbs.ondirname(this.sectionStart, this.index); 21926 this.state = 16; 21927 this.sectionStart = this.index + 1; 21928 } 21929 } 21930 stateInDirArg(c2) { 21931 if (c2 === 61 || isEndOfTagSection(c2)) { 21932 this.cbs.ondirarg(this.sectionStart, this.index); 21933 this.handleAttrNameEnd(c2); 21934 } else if (c2 === 91) { 21935 this.state = 15; 21936 } else if (c2 === 46) { 21937 this.cbs.ondirarg(this.sectionStart, this.index); 21938 this.state = 16; 21939 this.sectionStart = this.index + 1; 21940 } 21941 } 21942 stateInDynamicDirArg(c2) { 21943 if (c2 === 93) { 21944 this.state = 14; 21945 } else if (c2 === 61 || isEndOfTagSection(c2)) { 21946 this.cbs.ondirarg(this.sectionStart, this.index + 1); 21947 this.handleAttrNameEnd(c2); 21948 } 21949 } 21950 stateInDirModifier(c2) { 21951 if (c2 === 61 || isEndOfTagSection(c2)) { 21952 this.cbs.ondirmodifier(this.sectionStart, this.index); 21953 this.handleAttrNameEnd(c2); 21954 } else if (c2 === 46) { 21955 this.cbs.ondirmodifier(this.sectionStart, this.index); 21956 this.sectionStart = this.index + 1; 21957 } 21958 } 21959 handleAttrNameEnd(c2) { 21960 this.sectionStart = this.index; 21961 this.state = 17; 21962 this.cbs.onattribnameend(this.index); 21963 this.stateAfterAttrName(c2); 21964 } 21965 stateAfterAttrName(c2) { 21966 if (c2 === 61) { 21967 this.state = 18; 21968 } else if (c2 === 47 || c2 === 62) { 21969 this.cbs.onattribend(0, this.sectionStart); 21970 this.sectionStart = -1; 21971 this.state = 11; 21972 this.stateBeforeAttrName(c2); 21973 } else if (!isWhitespace(c2)) { 21974 this.cbs.onattribend(0, this.sectionStart); 21975 this.handleAttrStart(c2); 21976 } 21977 } 21978 stateBeforeAttrValue(c2) { 21979 if (c2 === 34) { 21980 this.state = 19; 21981 this.sectionStart = this.index + 1; 21982 } else if (c2 === 39) { 21983 this.state = 20; 21984 this.sectionStart = this.index + 1; 21985 } else if (!isWhitespace(c2)) { 21986 this.sectionStart = this.index; 21987 this.state = 21; 21988 this.stateInAttrValueNoQuotes(c2); 21989 } 21990 } 21991 handleInAttrValue(c2, quote) { 21992 if (c2 === quote || this.fastForwardTo(quote)) { 21993 this.cbs.onattribdata(this.sectionStart, this.index); 21994 this.sectionStart = -1; 21995 this.cbs.onattribend( 21996 quote === 34 ? 3 : 2, 21997 this.index + 1 21998 ); 21999 this.state = 11; 22000 } 22001 } 22002 stateInAttrValueDoubleQuotes(c2) { 22003 this.handleInAttrValue(c2, 34); 22004 } 22005 stateInAttrValueSingleQuotes(c2) { 22006 this.handleInAttrValue(c2, 39); 22007 } 22008 stateInAttrValueNoQuotes(c2) { 22009 if (isWhitespace(c2) || c2 === 62) { 22010 this.cbs.onattribdata(this.sectionStart, this.index); 22011 this.sectionStart = -1; 22012 this.cbs.onattribend(1, this.index); 22013 this.state = 11; 22014 this.stateBeforeAttrName(c2); 22015 } else if (c2 === 39 || c2 === 60 || c2 === 61 || c2 === 96) { 22016 this.cbs.onerr( 22017 18, 22018 this.index 22019 ); 22020 } else ; 22021 } 22022 stateBeforeDeclaration(c2) { 22023 if (c2 === 91) { 22024 this.state = 26; 22025 this.sequenceIndex = 0; 22026 } else { 22027 this.state = c2 === 45 ? 25 : 23; 22028 } 22029 } 22030 stateInDeclaration(c2) { 22031 if (c2 === 62 || this.fastForwardTo(62)) { 22032 this.state = 1; 22033 this.sectionStart = this.index + 1; 22034 } 22035 } 22036 stateInProcessingInstruction(c2) { 22037 if (c2 === 62 || this.fastForwardTo(62)) { 22038 this.cbs.onprocessinginstruction(this.sectionStart, this.index); 22039 this.state = 1; 22040 this.sectionStart = this.index + 1; 22041 } 22042 } 22043 stateBeforeComment(c2) { 22044 if (c2 === 45) { 22045 this.state = 28; 22046 this.currentSequence = Sequences.CommentEnd; 22047 this.sequenceIndex = 2; 22048 this.sectionStart = this.index + 1; 22049 } else { 22050 this.state = 23; 22051 } 22052 } 22053 stateInSpecialComment(c2) { 22054 if (c2 === 62 || this.fastForwardTo(62)) { 22055 this.cbs.oncomment(this.sectionStart, this.index); 22056 this.state = 1; 22057 this.sectionStart = this.index + 1; 22058 } 22059 } 22060 stateBeforeSpecialS(c2) { 22061 if (c2 === Sequences.ScriptEnd[3]) { 22062 this.startSpecial(Sequences.ScriptEnd, 4); 22063 } else if (c2 === Sequences.StyleEnd[3]) { 22064 this.startSpecial(Sequences.StyleEnd, 4); 22065 } else { 22066 this.state = 6; 22067 this.stateInTagName(c2); 22068 } 22069 } 22070 stateBeforeSpecialT(c2) { 22071 if (c2 === Sequences.TitleEnd[3]) { 22072 this.startSpecial(Sequences.TitleEnd, 4); 22073 } else if (c2 === Sequences.TextareaEnd[3]) { 22074 this.startSpecial(Sequences.TextareaEnd, 4); 22075 } else { 22076 this.state = 6; 22077 this.stateInTagName(c2); 22078 } 22079 } 22080 startEntity() { 22081 } 22082 stateInEntity() { 22083 } 22084 /** 22085 * Iterates through the buffer, calling the function corresponding to the current state. 22086 * 22087 * States that are more likely to be hit are higher up, as a performance improvement. 22088 */ 22089 parse(input) { 22090 this.buffer = input; 22091 while (this.index < this.buffer.length) { 22092 const c2 = this.buffer.charCodeAt(this.index); 22093 if (c2 === 10) { 22094 this.newlines.push(this.index); 22095 } 22096 switch (this.state) { 22097 case 1: { 22098 this.stateText(c2); 22099 break; 22100 } 22101 case 2: { 22102 this.stateInterpolationOpen(c2); 22103 break; 22104 } 22105 case 3: { 22106 this.stateInterpolation(c2); 22107 break; 22108 } 22109 case 4: { 22110 this.stateInterpolationClose(c2); 22111 break; 22112 } 22113 case 31: { 22114 this.stateSpecialStartSequence(c2); 22115 break; 22116 } 22117 case 32: { 22118 this.stateInRCDATA(c2); 22119 break; 22120 } 22121 case 26: { 22122 this.stateCDATASequence(c2); 22123 break; 22124 } 22125 case 19: { 22126 this.stateInAttrValueDoubleQuotes(c2); 22127 break; 22128 } 22129 case 12: { 22130 this.stateInAttrName(c2); 22131 break; 22132 } 22133 case 13: { 22134 this.stateInDirName(c2); 22135 break; 22136 } 22137 case 14: { 22138 this.stateInDirArg(c2); 22139 break; 22140 } 22141 case 15: { 22142 this.stateInDynamicDirArg(c2); 22143 break; 22144 } 22145 case 16: { 22146 this.stateInDirModifier(c2); 22147 break; 22148 } 22149 case 28: { 22150 this.stateInCommentLike(c2); 22151 break; 22152 } 22153 case 27: { 22154 this.stateInSpecialComment(c2); 22155 break; 22156 } 22157 case 11: { 22158 this.stateBeforeAttrName(c2); 22159 break; 22160 } 22161 case 6: { 22162 this.stateInTagName(c2); 22163 break; 22164 } 22165 case 34: { 22166 this.stateInSFCRootTagName(c2); 22167 break; 22168 } 22169 case 9: { 22170 this.stateInClosingTagName(c2); 22171 break; 22172 } 22173 case 5: { 22174 this.stateBeforeTagName(c2); 22175 break; 22176 } 22177 case 17: { 22178 this.stateAfterAttrName(c2); 22179 break; 22180 } 22181 case 20: { 22182 this.stateInAttrValueSingleQuotes(c2); 22183 break; 22184 } 22185 case 18: { 22186 this.stateBeforeAttrValue(c2); 22187 break; 22188 } 22189 case 8: { 22190 this.stateBeforeClosingTagName(c2); 22191 break; 22192 } 22193 case 10: { 22194 this.stateAfterClosingTagName(c2); 22195 break; 22196 } 22197 case 29: { 22198 this.stateBeforeSpecialS(c2); 22199 break; 22200 } 22201 case 30: { 22202 this.stateBeforeSpecialT(c2); 22203 break; 22204 } 22205 case 21: { 22206 this.stateInAttrValueNoQuotes(c2); 22207 break; 22208 } 22209 case 7: { 22210 this.stateInSelfClosingTag(c2); 22211 break; 22212 } 22213 case 23: { 22214 this.stateInDeclaration(c2); 22215 break; 22216 } 22217 case 22: { 22218 this.stateBeforeDeclaration(c2); 22219 break; 22220 } 22221 case 25: { 22222 this.stateBeforeComment(c2); 22223 break; 22224 } 22225 case 24: { 22226 this.stateInProcessingInstruction(c2); 22227 break; 22228 } 22229 case 33: { 22230 this.stateInEntity(); 22231 break; 22232 } 22233 } 22234 this.index++; 22235 } 22236 this.cleanup(); 22237 this.finish(); 22238 } 22239 /** 22240 * Remove data that has already been consumed from the buffer. 22241 */ 22242 cleanup() { 22243 if (this.sectionStart !== this.index) { 22244 if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) { 22245 this.cbs.ontext(this.sectionStart, this.index); 22246 this.sectionStart = this.index; 22247 } else if (this.state === 19 || this.state === 20 || this.state === 21) { 22248 this.cbs.onattribdata(this.sectionStart, this.index); 22249 this.sectionStart = this.index; 22250 } 22251 } 22252 } 22253 finish() { 22254 this.handleTrailingData(); 22255 this.cbs.onend(); 22256 } 22257 /** Handle any trailing data. */ 22258 handleTrailingData() { 22259 const endIndex = this.buffer.length; 22260 if (this.sectionStart >= endIndex) { 22261 return; 22262 } 22263 if (this.state === 28) { 22264 if (this.currentSequence === Sequences.CdataEnd) { 22265 this.cbs.oncdata(this.sectionStart, endIndex); 22266 } else { 22267 this.cbs.oncomment(this.sectionStart, endIndex); 22268 } 22269 } else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; 22270 else { 22271 this.cbs.ontext(this.sectionStart, endIndex); 22272 } 22273 }
22274 emitCodePoint(cp, consumed) { 22275 } 22276}
vendor: 3,291 bytes, lines 22276-22335
22276 22277const CompilerDeprecationTypes = { 22278 "COMPILER_IS_ON_ELEMENT": "COMPILER_IS_ON_ELEMENT", 22279 "COMPILER_V_BIND_SYNC": "COMPILER_V_BIND_SYNC", 22280 "COMPILER_V_BIND_OBJECT_ORDER": "COMPILER_V_BIND_OBJECT_ORDER", 22281 "COMPILER_V_ON_NATIVE": "COMPILER_V_ON_NATIVE", 22282 "COMPILER_V_IF_V_FOR_PRECEDENCE": "COMPILER_V_IF_V_FOR_PRECEDENCE", 22283 "COMPILER_NATIVE_TEMPLATE": "COMPILER_NATIVE_TEMPLATE", 22284 "COMPILER_INLINE_TEMPLATE": "COMPILER_INLINE_TEMPLATE", 22285 "COMPILER_FILTERS": "COMPILER_FILTERS" 22286}; 22287const deprecationData = { 22288 ["COMPILER_IS_ON_ELEMENT"]: { 22289 message: `Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".`, 22290 link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html` 22291 }, 22292 ["COMPILER_V_BIND_SYNC"]: { 22293 message: (key) => `.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${key}.sync\` should be changed to \`v-model:${key}\`.`, 22294 link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html` 22295 }, 22296 ["COMPILER_V_BIND_OBJECT_ORDER"]: { 22297 message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.`, 22298 link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html` 22299 }, 22300 ["COMPILER_V_ON_NATIVE"]: { 22301 message: `.native modifier for v-on has been removed as is no longer necessary.`, 22302 link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html` 22303 }, 22304 ["COMPILER_V_IF_V_FOR_PRECEDENCE"]: { 22305 message: `v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.`, 22306 link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html` 22307 }, 22308 ["COMPILER_NATIVE_TEMPLATE"]: { 22309 message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.` 22310 }, 22311 ["COMPILER_INLINE_TEMPLATE"]: { 22312 message: `"inline-template" has been removed in Vue 3.`, 22313 link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html` 22314 }, 22315 ["COMPILER_FILTERS"]: { 22316 message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`, 22317 link: `https://v3-migration.vuejs.org/breaking-changes/filters.html` 22318 } 22319}; 22320function getCompatValue(key, { compatConfig }) { 22321 const value = compatConfig && compatConfig[key]; 22322 if (key === "MODE") { 22323 return value || 3; 22324 } else { 22325 return value; 22326 } 22327} 22328function isCompatEnabled(key, context) { 22329 const mode = getCompatValue("MODE", context); 22330 const value = getCompatValue(key, context); 22331 return mode === 3 ? value === true : value !== false; 22332} 22333function checkCompatEnabled(key, context, loc, ...args) { 22334 const enabled = isCompatEnabled(key, context); 22335
22335return enabled; 22336} 22337function warnDeprecation(key, context, loc, ...args) { 22338 const val = getCompatValue(key, context); 22339 if (val === "suppress-warning") { 22340 return; 22341 } 22342 const { message, link } = deprecationData[key]; 22343 const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? ` 22344 Details: ${link}` : ``}`; 22345 const err = new SyntaxError(msg); 22346 err.code = key; 22347 if (loc) err.loc = loc; 22348 context.onWarn(err); 22349} 22350function defaultOnError(error) { 22351 throw error; 22352} 22353function defaultOnWarn(msg) { 22354} 22355function createCompilerError(code, loc, messages, additionalMessage) { 22356 const msg = `https://vuejs.org/error-reference/#compiler-${code}`; 22357 const error = new SyntaxError(String(msg)); 22358 error.code = code; 22359 error.loc = loc; 22360 return error; 22361} 22362const ErrorCodes = { 22363 "ABRUPT_CLOSING_OF_EMPTY_COMMENT": 0, 22364 "0": "ABRUPT_CLOSING_OF_EMPTY_COMMENT", 22365 "CDATA_IN_HTML_CONTENT": 1, 22366 "1": "CDATA_IN_HTML_CONTENT", 22367 "DUPLICATE_ATTRIBUTE": 2, 22368 "2": "DUPLICATE_ATTRIBUTE", 22369 "END_TAG_WITH_ATTRIBUTES": 3, 22370 "3": "END_TAG_WITH_ATTRIBUTES", 22371 "END_TAG_WITH_TRAILING_SOLIDUS": 4, 22372 "4": "END_TAG_WITH_TRAILING_SOLIDUS", 22373 "EOF_BEFORE_TAG_NAME": 5, 22374 "5": "EOF_BEFORE_TAG_NAME", 22375 "EOF_IN_CDATA": 6, 22376 "6": "EOF_IN_CDATA", 22377 "EOF_IN_COMMENT": 7, 22378 "7": "EOF_IN_COMMENT", 22379 "EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT": 8, 22380 "8": "EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT", 22381 "EOF_IN_TAG": 9, 22382 "9": "EOF_IN_TAG", 22383 "INCORRECTLY_CLOSED_COMMENT": 10, 22384 "10": "INCORRECTLY_CLOSED_COMMENT", 22385 "INCORRECTLY_OPENED_COMMENT": 11, 22386 "11": "INCORRECTLY_OPENED_COMMENT", 22387 "INVALID_FIRST_CHARACTER_OF_TAG_NAME": 12, 22388 "12": "INVALID_FIRST_CHARACTER_OF_TAG_NAME", 22389 "MISSING_ATTRIBUTE_VALUE": 13, 22390 "13": "MISSING_ATTRIBUTE_VALUE", 22391 "MISSING_END_TAG_NAME": 14, 22392 "14": "MISSING_END_TAG_NAME", 22393 "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES": 15, 22394 "15": "MISSING_WHITESPACE_BETWEEN_ATTRIBUTES", 22395 "NESTED_COMMENT": 16, 22396 "16": "NESTED_COMMENT", 22397 "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME": 17, 22398 "17": "UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME", 22399 "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE": 18, 22400 "18": "UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE", 22401 "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME": 19, 22402 "19": "UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME", 22403 "UNEXPECTED_NULL_CHARACTER": 20, 22404 "20": "UNEXPECTED_NULL_CHARACTER", 22405 "UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME": 21, 22406 "21": "UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME", 22407 "UNEXPECTED_SOLIDUS_IN_TAG": 22, 22408 "22": "UNEXPECTED_SOLIDUS_IN_TAG", 22409 "X_INVALID_END_TAG": 23, 22410 "23": "X_INVALID_END_TAG", 22411 "X_MISSING_END_TAG": 24, 22412 "24": "X_MISSING_END_TAG", 22413 "X_MISSING_INTERPOLATION_END": 25, 22414 "25": "X_MISSING_INTERPOLATION_END", 22415 "X_MISSING_DIRECTIVE_NAME": 26, 22416 "26": "X_MISSING_DIRECTIVE_NAME", 22417 "X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END": 27, 22418 "27": "X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END", 22419 "X_V_IF_NO_EXPRESSION": 28, 22420 "28": "X_V_IF_NO_EXPRESSION", 22421 "X_V_IF_SAME_KEY": 29, 22422 "29": "X_V_IF_SAME_KEY", 22423 "X_V_ELSE_NO_ADJACENT_IF": 30, 22424 "30": "X_V_ELSE_NO_ADJACENT_IF", 22425 "X_V_FOR_NO_EXPRESSION": 31, 22426 "31": "X_V_FOR_NO_EXPRESSION", 22427 "X_V_FOR_MALFORMED_EXPRESSION": 32, 22428 "32": "X_V_FOR_MALFORMED_EXPRESSION", 22429 "X_V_FOR_TEMPLATE_KEY_PLACEMENT": 33, 22430 "33": "X_V_FOR_TEMPLATE_KEY_PLACEMENT", 22431 "X_V_BIND_NO_EXPRESSION": 34, 22432 "34": "X_V_BIND_NO_EXPRESSION", 22433 "X_V_ON_NO_EXPRESSION": 35, 22434 "35": "X_V_ON_NO_EXPRESSION", 22435 "X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET": 36, 22436 "36": "X_V_SLOT_UNEXPECTED_DIRECTIVE_ON_SLOT_OUTLET", 22437 "X_V_SLOT_MIXED_SLOT_USAGE": 37, 22438 "37": "X_V_SLOT_MIXED_SLOT_USAGE", 22439 "X_V_SLOT_DUPLICATE_SLOT_NAMES": 38, 22440 "38": "X_V_SLOT_DUPLICATE_SLOT_NAMES", 22441 "X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN": 39, 22442 "39": "X_V_SLOT_EXTRANEOUS_DEFAULT_SLOT_CHILDREN", 22443 "X_V_SLOT_MISPLACED": 40, 22444 "40": "X_V_SLOT_MISPLACED", 22445 "X_V_MODEL_NO_EXPRESSION": 41, 22446 "41": "X_V_MODEL_NO_EXPRESSION", 22447 "X_V_MODEL_MALFORMED_EXPRESSION": 42, 22448 "42": "X_V_MODEL_MALFORMED_EXPRESSION", 22449 "X_V_MODEL_ON_SCOPE_VARIABLE": 43, 22450 "43": "X_V_MODEL_ON_SCOPE_VARIABLE", 22451 "X_V_MODEL_ON_PROPS": 44, 22452 "44": "X_V_MODEL_ON_PROPS", 22453 "X_INVALID_EXPRESSION": 45,
22454 "45": "X_INVALID_EXPRESSION", 22455 "X_KEEP_ALIVE_INVALID_CHILDREN": 46, 22456 "46": "X_KEEP_ALIVE_INVALID_CHILDREN", 22457 "X_PREFIX_ID_NOT_SUPPORTED": 47, 22458 "47": "X_PREFIX_ID_NOT_SUPPORTED", 22459 "X_MODULE_MODE_NOT_SUPPORTED": 48, 22460 "48": "X_MODULE_MODE_NOT_SUPPORTED", 22461 "X_CACHE_HANDLER_NOT_SUPPORTED": 49, 22462 "49": "X_CACHE_HANDLER_NOT_SUPPORTED", 22463 "X_SCOPE_ID_NOT_SUPPORTED": 50, 22464 "50": "X_SCOPE_ID_NOT_SUPPORTED", 22465 "X_VNODE_HOOKS": 51, 22466 "51": "X_VNODE_HOOKS", 22467 "X_V_BIND_INVALID_SAME_NAME_ARGUMENT": 52, 22468 "52": "X_V_BIND_INVALID_SAME_NAME_ARGUMENT", 22469 "__EXTEND_POINT__": 53, 22470 "53": "__EXTEND_POINT__" 22471}; 22472const errorMessages = { 22473 // parse errors 22474 [0]: "Illegal comment.", 22475 [1]: "CDATA section is allowed only in XML context.", 22476 [2]: "Duplicate attribute.", 22477 [3]: "End tag cannot have attributes.", 22478 [4]: "Illegal '/' in tags.", 22479 [5]: "Unexpected EOF in tag.", 22480 [6]: "Unexpected EOF in CDATA section.", 22481 [7]: "Unexpected EOF in comment.", 22482 [8]: "Unexpected EOF in script.", 22483 [9]: "Unexpected EOF in tag.", 22484 [10]: "Incorrectly closed comment.", 22485 [11]: "Incorrectly opened comment.", 22486 [12]: "Illegal tag name. Use '<' to print '<'.", 22487 [13]: "Attribute value was expected.", 22488 [14]: "End tag name was expected.", 22489 [15]: "Whitespace was expected.", 22490 [16]: "Unexpected '<!--' in comment.", 22491 [17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`, 22492 [18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).", 22493 [19]: "Attribute name cannot start with '='.", 22494 [21]: "'<?' is allowed only in XML context.", 22495 [20]: `Unexpected null character.`, 22496 [22]: "Illegal '/' in tags.", 22497 // Vue-specific parse errors 22498 [23]: "Invalid end tag.", 22499 [24]: "Element is missing end tag.", 22500 [25]: "Interpolation end sign was not found.", 22501 [27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.", 22502 [26]: "Legal directive name was expected.", 22503 // transform errors 22504 [28]: `v-if/v-else-if is missing expression.`, 22505 [29]: `v-if/else branches must use unique keys.`, 22506 [30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`, 22507 [31]: `v-for is missing expression.`, 22508 [32]: `v-for has invalid expression.`, 22509 [33]: `<template v-for> key should be placed on the <template> tag.`, 22510 [34]: `v-bind is missing expression.`, 22511 [52]: `v-bind with same-name shorthand only allows static argument.`, 22512 [35]: `v-on is missing expression.`, 22513 [36]: `Unexpected custom directive on <slot> outlet.`, 22514 [37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`, 22515 [38]: `Duplicate slot names found. `, 22516 [39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`, 22517 [40]: `v-slot can only be used on components or <template> tags.`, 22518 [41]: `v-model is missing expression.`, 22519 [42]: `v-model value must be a valid JavaScript member expression.`, 22520 [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`, 22521 [44]: `v-model cannot be used on a prop, because local prop bindings are not writable. 22522Use a v-bind binding combined with a v-on listener that emits update:x event instead.`, 22523 [45]: `Error parsing JavaScript expression: `, 22524 [46]: `<KeepAlive> expects exactly one child component.`, 22525 [51]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`, 22526 // generic errors 22527 [47]: `"prefixIdentifiers" option is not supported in this build of compiler.`, 22528 [48]: `ES module mode is not supported in this build of compiler.`, 22529 [49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`, 22530 [50]: `"scopeId" option is only supported in module mode.`, 22531 // just to fulfill types 22532 [53]: `` 22533}; 22534function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [], knownIds = /* @__PURE__ */ Object.create(null)) { 22535 { 22536 return; 22537 } 22538} 22539function isReferencedIdentifier(id, parent, parentStack) { 22540 { 22541 return false;
vendor: 10,493 bytes, lines 22542-22883
22542 } 22543} 22544function isInDestructureAssignment(parent, parentStack) { 22545 if (parent && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) { 22546 let i2 = parentStack.length; 22547 while (i2--) { 22548 const p2 = parentStack[i2]; 22549 if (p2.type === "AssignmentExpression") { 22550 return true; 22551 } else if (p2.type !== "ObjectProperty" && !p2.type.endsWith("Pattern")) { 22552 break; 22553 } 22554 } 22555 } 22556 return false; 22557} 22558function isInNewExpression(parentStack) { 22559 let i2 = parentStack.length; 22560 while (i2--) { 22561 const p2 = parentStack[i2]; 22562 if (p2.type === "NewExpression") { 22563 return true; 22564 } else if (p2.type !== "MemberExpression") { 22565 break; 22566 } 22567 } 22568 return false; 22569} 22570function walkFunctionParams(node, onIdent) { 22571 for (const p2 of node.params) { 22572 for (const id of extractIdentifiers(p2)) { 22573 onIdent(id); 22574 } 22575 } 22576} 22577function walkBlockDeclarations(block, onIdent) { 22578 for (const stmt of block.body) { 22579 if (stmt.type === "VariableDeclaration") { 22580 if (stmt.declare) continue; 22581 for (const decl of stmt.declarations) { 22582 for (const id of extractIdentifiers(decl.id)) { 22583 onIdent(id); 22584 } 22585 } 22586 } else if (stmt.type === "FunctionDeclaration" || stmt.type === "ClassDeclaration") { 22587 if (stmt.declare || !stmt.id) continue; 22588 onIdent(stmt.id); 22589 } else if (isForStatement(stmt)) { 22590 walkForStatement(stmt, true, onIdent); 22591 } 22592 } 22593} 22594function isForStatement(stmt) { 22595 return stmt.type === "ForOfStatement" || stmt.type === "ForInStatement" || stmt.type === "ForStatement"; 22596} 22597function walkForStatement(stmt, isVar, onIdent) { 22598 const variable = stmt.type === "ForStatement" ? stmt.init : stmt.left; 22599 if (variable && variable.type === "VariableDeclaration" && (variable.kind === "var" ? isVar : false)) { 22600 for (const decl of variable.declarations) { 22601 for (const id of extractIdentifiers(decl.id)) { 22602 onIdent(id); 22603 } 22604 } 22605 } 22606} 22607function extractIdentifiers(param, nodes = []) { 22608 switch (param.type) { 22609 case "Identifier": 22610 nodes.push(param); 22611 break; 22612 case "MemberExpression": 22613 let object = param; 22614 while (object.type === "MemberExpression") { 22615 object = object.object; 22616 } 22617 nodes.push(object); 22618 break; 22619 case "ObjectPattern": 22620 for (const prop of param.properties) { 22621 if (prop.type === "RestElement") { 22622 extractIdentifiers(prop.argument, nodes); 22623 } else { 22624 extractIdentifiers(prop.value, nodes); 22625 } 22626 } 22627 break; 22628 case "ArrayPattern": 22629 param.elements.forEach((element) => { 22630 if (element) extractIdentifiers(element, nodes); 22631 }); 22632 break; 22633 case "RestElement": 22634 extractIdentifiers(param.argument, nodes); 22635 break; 22636 case "AssignmentPattern": 22637 extractIdentifiers(param.left, nodes); 22638 break; 22639 } 22640 return nodes; 22641} 22642const isFunctionType = (node) => { 22643 return /Function(?:Expression|Declaration)$|Method$/.test(node.type); 22644}; 22645const isStaticProperty = (node) => node && (node.type === "ObjectProperty" || node.type === "ObjectMethod") && !node.computed; 22646const isStaticPropertyKey = (node, parent) => isStaticProperty(parent) && parent.key === node; 22647const TS_NODE_TYPES = [ 22648 "TSAsExpression", 22649 // foo as number 22650 "TSTypeAssertion", 22651 // (<number>foo) 22652 "TSNonNullExpression", 22653 // foo! 22654 "TSInstantiationExpression", 22655 // foo<string> 22656 "TSSatisfiesExpression" 22657 // foo satisfies T 22658]; 22659function unwrapTSNode(node) { 22660 if (TS_NODE_TYPES.includes(node.type)) { 22661 return unwrapTSNode(node.expression); 22662 } else { 22663 return node; 22664 } 22665} 22666const isStaticExp = (p2) => p2.type === 4 && p2.isStatic; 22667function isCoreComponent(tag) { 22668 switch (tag) { 22669 case "Teleport": 22670 case "teleport": 22671 return TELEPORT; 22672 case "Suspense": 22673 case "suspense": 22674 return SUSPENSE; 22675 case "KeepAlive": 22676 case "keep-alive": 22677 return KEEP_ALIVE; 22678 case "BaseTransition": 22679 case "base-transition": 22680 return BASE_TRANSITION; 22681 } 22682} 22683const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/; 22684const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name); 22685const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/; 22686const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/; 22687const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g; 22688const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source; 22689const isMemberExpressionBrowser = (exp) => { 22690 const path = getExpSource(exp).trim().replace(whitespaceRE, (s2) => s2.trim()); 22691 let state2 = 0; 22692 let stateStack = []; 22693 let currentOpenBracketCount = 0; 22694 let currentOpenParensCount = 0; 22695 let currentStringType = null; 22696 for (let i2 = 0; i2 < path.length; i2++) { 22697 const char = path.charAt(i2); 22698 switch (state2) { 22699 case 0: 22700 if (char === "[") { 22701 stateStack.push(state2); 22702 state2 = 1; 22703 currentOpenBracketCount++; 22704 } else if (char === "(") { 22705 stateStack.push(state2); 22706 state2 = 2; 22707 currentOpenParensCount++; 22708 } else if (!(i2 === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) { 22709 return false; 22710 } 22711 break; 22712 case 1: 22713 if (char === `'` || char === `"` || char === "`") { 22714 stateStack.push(state2); 22715 state2 = 3; 22716 currentStringType = char; 22717 } else if (char === `[`) { 22718 currentOpenBracketCount++; 22719 } else if (char === `]`) { 22720 if (!--currentOpenBracketCount) { 22721 state2 = stateStack.pop(); 22722 } 22723 } 22724 break; 22725 case 2: 22726 if (char === `'` || char === `"` || char === "`") { 22727 stateStack.push(state2); 22728 state2 = 3; 22729 currentStringType = char; 22730 } else if (char === `(`) { 22731 currentOpenParensCount++; 22732 } else if (char === `)`) { 22733 if (i2 === path.length - 1) { 22734 return false; 22735 } 22736 if (!--currentOpenParensCount) { 22737 state2 = stateStack.pop(); 22738 } 22739 } 22740 break; 22741 case 3: 22742 if (char === currentStringType) { 22743 state2 = stateStack.pop(); 22744 currentStringType = null; 22745 } 22746 break; 22747 } 22748 } 22749 return !currentOpenBracketCount && !currentOpenParensCount; 22750}; 22751const isMemberExpressionNode = NOOP; 22752const isMemberExpression = isMemberExpressionBrowser; 22753const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/; 22754const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp)); 22755const isFnExpressionNode = NOOP; 22756const isFnExpression = isFnExpressionBrowser; 22757function advancePositionWithClone(pos, source, numberOfCharacters = source.length) { 22758 return advancePositionWithMutation( 22759 { 22760 offset: pos.offset, 22761 line: pos.line, 22762 column: pos.column 22763 }, 22764 source, 22765 numberOfCharacters 22766 ); 22767} 22768function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) { 22769 let linesCount = 0; 22770 let lastNewLinePos = -1; 22771 for (let i2 = 0; i2 < numberOfCharacters; i2++) { 22772 if (source.charCodeAt(i2) === 10) { 22773 linesCount++; 22774 lastNewLinePos = i2; 22775 } 22776 } 22777 pos.offset += numberOfCharacters; 22778 pos.line += linesCount; 22779 pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos; 22780 return pos; 22781} 22782function assert(condition, msg) { 22783 if (!condition) { 22784 throw new Error(msg || `unexpected compiler condition`); 22785 } 22786} 22787function findDir(node, name, allowEmpty = false) { 22788 for (let i2 = 0; i2 < node.props.length; i2++) { 22789 const p2 = node.props[i2]; 22790 if (p2.type === 7 && (allowEmpty || p2.exp) && (isString$1(name) ? p2.name === name : name.test(p2.name))) { 22791 return p2; 22792 } 22793 } 22794} 22795function findProp(node, name, dynamicOnly = false, allowEmpty = false) { 22796 for (let i2 = 0; i2 < node.props.length; i2++) { 22797 const p2 = node.props[i2]; 22798 if (p2.type === 6) { 22799 if (dynamicOnly) continue; 22800 if (p2.name === name && (p2.value || allowEmpty)) { 22801 return p2; 22802 } 22803 } else if (p2.name === "bind" && (p2.exp || allowEmpty) && isStaticArgOf(p2.arg, name)) { 22804 return p2; 22805 } 22806 } 22807} 22808function isStaticArgOf(arg, name) { 22809 return !!(arg && isStaticExp(arg) && arg.content === name); 22810} 22811function hasDynamicKeyVBind(node) { 22812 return node.props.some( 22813 (p2) => p2.type === 7 && p2.name === "bind" && (!p2.arg || // v-bind="obj" 22814 p2.arg.type !== 4 || // v-bind:[_ctx.foo] 22815 !p2.arg.isStatic) 22816 // v-bind:[foo] 22817 ); 22818} 22819function isText$1(node) { 22820 return node.type === 5 || node.type === 2; 22821} 22822function isVSlot(p2) { 22823 return p2.type === 7 && p2.name === "slot"; 22824} 22825function isTemplateNode(node) { 22826 return node.type === 1 && node.tagType === 3; 22827} 22828function isSlotOutlet(node) { 22829 return node.type === 1 && node.tagType === 2; 22830} 22831const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]); 22832function getUnnormalizedProps(props, callPath = []) { 22833 if (props && !isString$1(props) && props.type === 14) { 22834 const callee = props.callee; 22835 if (!isString$1(callee) && propsHelperSet.has(callee)) { 22836 return getUnnormalizedProps( 22837 props.arguments[0], 22838 callPath.concat(props) 22839 ); 22840 } 22841 } 22842 return [props, callPath]; 22843} 22844function injectProp(node, prop, context) { 22845 let propsWithInjection; 22846 let props = node.type === 13 ? node.props : node.arguments[2]; 22847 let callPath = []; 22848 let parentCall; 22849 if (props && !isString$1(props) && props.type === 14) { 22850 const ret = getUnnormalizedProps(props); 22851 props = ret[0]; 22852 callPath = ret[1]; 22853 parentCall = callPath[callPath.length - 1]; 22854 } 22855 if (props == null || isString$1(props)) { 22856 propsWithInjection = createObjectExpression([prop]); 22857 } else if (props.type === 14) { 22858 const first = props.arguments[0]; 22859 if (!isString$1(first) && first.type === 15) { 22860 if (!hasProp(prop, first)) { 22861 first.properties.unshift(prop); 22862 } 22863 } else { 22864 if (props.callee === TO_HANDLERS) { 22865 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 22866 createObjectExpression([prop]), 22867 props 22868 ]); 22869 } else { 22870 props.arguments.unshift(createObjectExpression([prop])); 22871 } 22872 } 22873 !propsWithInjection && (propsWithInjection = props); 22874 } else if (props.type === 15) { 22875 if (!hasProp(prop, props)) { 22876 props.properties.unshift(prop); 22877 } 22878 propsWithInjection = props; 22879 } else { 22880 propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [ 22881 createObjectExpression([prop]), 22882 props 22883 ]);
vendor: 4,185 bytes, lines 22884-23037
22884 if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) { 22885 parentCall = callPath[callPath.length - 2]; 22886 } 22887 } 22888 if (node.type === 13) { 22889 if (parentCall) { 22890 parentCall.arguments[0] = propsWithInjection; 22891 } else { 22892 node.props = propsWithInjection; 22893 } 22894 } else { 22895 if (parentCall) { 22896 parentCall.arguments[0] = propsWithInjection; 22897 } else { 22898 node.arguments[2] = propsWithInjection; 22899 } 22900 } 22901} 22902function hasProp(prop, props) { 22903 let result = false; 22904 if (prop.key.type === 4) { 22905 const propKeyName = prop.key.content; 22906 result = props.properties.some( 22907 (p2) => p2.key.type === 4 && p2.key.content === propKeyName 22908 ); 22909 } 22910 return result; 22911} 22912function toValidAssetId(name, type) { 22913 return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => { 22914 return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString(); 22915 })}`; 22916} 22917function hasScopeRef(node, ids) { 22918 if (!node || Object.keys(ids).length === 0) { 22919 return false; 22920 } 22921 switch (node.type) { 22922 case 1: 22923 for (let i2 = 0; i2 < node.props.length; i2++) { 22924 const p2 = node.props[i2]; 22925 if (p2.type === 7 && (hasScopeRef(p2.arg, ids) || hasScopeRef(p2.exp, ids))) { 22926 return true; 22927 } 22928 } 22929 return node.children.some((c2) => hasScopeRef(c2, ids)); 22930 case 11: 22931 if (hasScopeRef(node.source, ids)) { 22932 return true; 22933 } 22934 return node.children.some((c2) => hasScopeRef(c2, ids)); 22935 case 9: 22936 return node.branches.some((b) => hasScopeRef(b, ids)); 22937 case 10: 22938 if (hasScopeRef(node.condition, ids)) { 22939 return true; 22940 } 22941 return node.children.some((c2) => hasScopeRef(c2, ids)); 22942 case 4: 22943 return !node.isStatic && isSimpleIdentifier(node.content) && !!ids[node.content]; 22944 case 8: 22945 return node.children.some((c2) => isObject$1(c2) && hasScopeRef(c2, ids)); 22946 case 5: 22947 case 12: 22948 return hasScopeRef(node.content, ids); 22949 case 2: 22950 case 3: 22951 case 20: 22952 return false; 22953 default: 22954 return false; 22955 } 22956} 22957function getMemoedVNodeCall(node) { 22958 if (node.type === 14 && node.callee === WITH_MEMO) { 22959 return node.arguments[1].returns; 22960 } else { 22961 return node; 22962 } 22963} 22964const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/; 22965const defaultParserOptions = { 22966 parseMode: "base", 22967 ns: 0, 22968 delimiters: [`{{`, `}}`], 22969 getNamespace: () => 0, 22970 isVoidTag: NO, 22971 isPreTag: NO, 22972 isIgnoreNewlineTag: NO, 22973 isCustomElement: NO, 22974 onError: defaultOnError, 22975 onWarn: defaultOnWarn, 22976 comments: false, 22977 prefixIdentifiers: false 22978}; 22979let currentOptions = defaultParserOptions; 22980let currentRoot = null; 22981let currentInput = ""; 22982let currentOpenTag = null; 22983let currentProp = null; 22984let currentAttrValue = ""; 22985let currentAttrStartIndex = -1; 22986let currentAttrEndIndex = -1; 22987let inPre = 0; 22988let inVPre = false; 22989let currentVPreBoundary = null; 22990const stack = []; 22991const tokenizer = new Tokenizer(stack, { 22992 onerr: emitError, 22993 ontext(start, end) { 22994 onText(getSlice(start, end), start, end); 22995 }, 22996 ontextentity(char, start, end) { 22997 onText(char, start, end); 22998 }, 22999 oninterpolation(start, end) { 23000 if (inVPre) { 23001 return onText(getSlice(start, end), start, end); 23002 } 23003 let innerStart = start + tokenizer.delimiterOpen.length; 23004 let innerEnd = end - tokenizer.delimiterClose.length; 23005 while (isWhitespace(currentInput.charCodeAt(innerStart))) { 23006 innerStart++; 23007 } 23008 while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) { 23009 innerEnd--; 23010 } 23011 let exp = getSlice(innerStart, innerEnd); 23012 if (exp.includes("&")) { 23013 { 23014 exp = currentOptions.decodeEntities(exp, false); 23015 } 23016 } 23017 addNode({ 23018 type: 5, 23019 content: createExp(exp, false, getLoc(innerStart, innerEnd)), 23020 loc: getLoc(start, end) 23021 }); 23022 }, 23023 onopentagname(start, end) { 23024 const name = getSlice(start, end); 23025 currentOpenTag = { 23026 type: 1, 23027 tag: name, 23028 ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns), 23029 tagType: 0, 23030 // will be refined on tag close 23031 props: [], 23032 children: [], 23033 loc: getLoc(start - 1, end), 23034 codegenNode: void 0 23035 }; 23036 }, 23037 onopentagend(end) {
vendor: 7,502 bytes, lines 23038-23291
23038 endOpenTag(end); 23039 }, 23040 onclosetag(start, end) { 23041 const name = getSlice(start, end); 23042 if (!currentOptions.isVoidTag(name)) { 23043 let found = false; 23044 for (let i2 = 0; i2 < stack.length; i2++) { 23045 const e = stack[i2]; 23046 if (e.tag.toLowerCase() === name.toLowerCase()) { 23047 found = true; 23048 if (i2 > 0) { 23049 emitError(24, stack[0].loc.start.offset); 23050 } 23051 for (let j = 0; j <= i2; j++) { 23052 const el = stack.shift(); 23053 onCloseTag(el, end, j < i2); 23054 } 23055 break; 23056 } 23057 } 23058 if (!found) { 23059 emitError(23, backTrack(start, 60)); 23060 } 23061 } 23062 }, 23063 onselfclosingtag(end) { 23064 const name = currentOpenTag.tag; 23065 currentOpenTag.isSelfClosing = true; 23066 endOpenTag(end); 23067 if (stack[0] && stack[0].tag === name) { 23068 onCloseTag(stack.shift(), end); 23069 } 23070 }, 23071 onattribname(start, end) { 23072 currentProp = { 23073 type: 6, 23074 name: getSlice(start, end), 23075 nameLoc: getLoc(start, end), 23076 value: void 0, 23077 loc: getLoc(start) 23078 }; 23079 }, 23080 ondirname(start, end) { 23081 const raw = getSlice(start, end); 23082 const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2); 23083 if (!inVPre && name === "") { 23084 emitError(26, start); 23085 } 23086 if (inVPre || name === "") { 23087 currentProp = { 23088 type: 6, 23089 name: raw, 23090 nameLoc: getLoc(start, end), 23091 value: void 0, 23092 loc: getLoc(start) 23093 }; 23094 } else { 23095 currentProp = { 23096 type: 7, 23097 name, 23098 rawName: raw, 23099 exp: void 0, 23100 arg: void 0, 23101 modifiers: raw === "." ? [createSimpleExpression("prop")] : [], 23102 loc: getLoc(start) 23103 }; 23104 if (name === "pre") { 23105 inVPre = tokenizer.inVPre = true; 23106 currentVPreBoundary = currentOpenTag; 23107 const props = currentOpenTag.props; 23108 for (let i2 = 0; i2 < props.length; i2++) { 23109 if (props[i2].type === 7) { 23110 props[i2] = dirToAttr(props[i2]); 23111 } 23112 } 23113 } 23114 } 23115 }, 23116 ondirarg(start, end) { 23117 if (start === end) return; 23118 const arg = getSlice(start, end); 23119 if (inVPre) { 23120 currentProp.name += arg; 23121 setLocEnd(currentProp.nameLoc, end); 23122 } else { 23123 const isStatic = arg[0] !== `[`; 23124 currentProp.arg = createExp( 23125 isStatic ? arg : arg.slice(1, -1), 23126 isStatic, 23127 getLoc(start, end), 23128 isStatic ? 3 : 0 23129 ); 23130 } 23131 }, 23132 ondirmodifier(start, end) { 23133 const mod = getSlice(start, end); 23134 if (inVPre) { 23135 currentProp.name += "." + mod; 23136 setLocEnd(currentProp.nameLoc, end); 23137 } else if (currentProp.name === "slot") { 23138 const arg = currentProp.arg; 23139 if (arg) { 23140 arg.content += "." + mod; 23141 setLocEnd(arg.loc, end); 23142 } 23143 } else { 23144 const exp = createSimpleExpression(mod, true, getLoc(start, end)); 23145 currentProp.modifiers.push(exp); 23146 } 23147 }, 23148 onattribdata(start, end) { 23149 currentAttrValue += getSlice(start, end); 23150 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 23151 currentAttrEndIndex = end; 23152 }, 23153 onattribentity(char, start, end) { 23154 currentAttrValue += char; 23155 if (currentAttrStartIndex < 0) currentAttrStartIndex = start; 23156 currentAttrEndIndex = end; 23157 }, 23158 onattribnameend(end) { 23159 const start = currentProp.loc.start.offset; 23160 const name = getSlice(start, end); 23161 if (currentProp.type === 7) { 23162 currentProp.rawName = name; 23163 } 23164 if (currentOpenTag.props.some( 23165 (p2) => (p2.type === 7 ? p2.rawName : p2.name) === name 23166 )) { 23167 emitError(2, start); 23168 } 23169 }, 23170 onattribend(quote, end) { 23171 if (currentOpenTag && currentProp) { 23172 setLocEnd(currentProp.loc, end); 23173 if (quote !== 0) { 23174 if (currentAttrValue.includes("&")) { 23175 currentAttrValue = currentOptions.decodeEntities( 23176 currentAttrValue, 23177 true 23178 ); 23179 } 23180 if (currentProp.type === 6) { 23181 if (currentProp.name === "class") { 23182 currentAttrValue = condense(currentAttrValue).trim(); 23183 } 23184 if (quote === 1 && !currentAttrValue) { 23185 emitError(13, end); 23186 } 23187 currentProp.value = { 23188 type: 2, 23189 content: currentAttrValue, 23190 loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1) 23191 }; 23192 if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") { 23193 tokenizer.enterRCDATA(toCharCodes(`</template`), 0); 23194 } 23195 } else { 23196 let expParseMode = 0; 23197 currentProp.exp = createExp( 23198 currentAttrValue, 23199 false, 23200 getLoc(currentAttrStartIndex, currentAttrEndIndex), 23201 0, 23202 expParseMode 23203 ); 23204 if (currentProp.name === "for") { 23205 currentProp.forParseResult = parseForExpression(currentProp.exp); 23206 } 23207 let syncIndex = -1; 23208 if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.findIndex( 23209 (mod) => mod.content === "sync" 23210 )) > -1 && checkCompatEnabled( 23211 "COMPILER_V_BIND_SYNC", 23212 currentOptions, 23213 currentProp.loc, 23214 currentProp.rawName 23215 )) { 23216 currentProp.name = "model"; 23217 currentProp.modifiers.splice(syncIndex, 1); 23218 } 23219 } 23220 } 23221 if (currentProp.type !== 7 || currentProp.name !== "pre") { 23222 currentOpenTag.props.push(currentProp); 23223 } 23224 } 23225 currentAttrValue = ""; 23226 currentAttrStartIndex = currentAttrEndIndex = -1; 23227 }, 23228 oncomment(start, end) { 23229 if (currentOptions.comments) { 23230 addNode({ 23231 type: 3, 23232 content: getSlice(start, end), 23233 loc: getLoc(start - 4, end + 3) 23234 }); 23235 } 23236 }, 23237 onend() { 23238 const end = currentInput.length; 23239 for (let index = 0; index < stack.length; index++) { 23240 onCloseTag(stack[index], end - 1); 23241 emitError(24, stack[index].loc.start.offset); 23242 } 23243 }, 23244 oncdata(start, end) { 23245 if (stack[0].ns !== 0) { 23246 onText(getSlice(start, end), start, end); 23247 } else { 23248 emitError(1, start - 9); 23249 } 23250 }, 23251 onprocessinginstruction(start) { 23252 if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 23253 emitError( 23254 21, 23255 start - 1 23256 ); 23257 } 23258 } 23259}); 23260const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 23261const stripParensRE = /^\(|\)$/g; 23262function parseForExpression(input) { 23263 const loc = input.loc; 23264 const exp = input.content; 23265 const inMatch = exp.match(forAliasRE); 23266 if (!inMatch) return; 23267 const [, LHS, RHS] = inMatch; 23268 const createAliasExpression = (content, offset, asParam = false) => { 23269 const start = loc.start.offset + offset; 23270 const end = start + content.length; 23271 return createExp( 23272 content, 23273 false, 23274 getLoc(start, end), 23275 0, 23276 asParam ? 1 : 0 23277 /* Normal */ 23278 ); 23279 }; 23280 const result = { 23281 source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)), 23282 value: void 0, 23283 key: void 0, 23284 index: void 0, 23285 finalized: false 23286 }; 23287 let valueContent = LHS.trim().replace(stripParensRE, "").trim(); 23288 const trimmedOffset = LHS.indexOf(valueContent); 23289 const iteratorMatch = valueContent.match(forIteratorRE); 23290 if (iteratorMatch) { 23291 valueContent = valueContent.replace(forIteratorRE, "").trim();
vendor: 4,640 bytes, lines 23292-23453
23292 const keyContent = iteratorMatch[1].trim(); 23293 let keyOffset; 23294 if (keyContent) { 23295 keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length); 23296 result.key = createAliasExpression(keyContent, keyOffset, true); 23297 } 23298 if (iteratorMatch[2]) { 23299 const indexContent = iteratorMatch[2].trim(); 23300 if (indexContent) { 23301 result.index = createAliasExpression( 23302 indexContent, 23303 exp.indexOf( 23304 indexContent, 23305 result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length 23306 ), 23307 true 23308 ); 23309 } 23310 } 23311 } 23312 if (valueContent) { 23313 result.value = createAliasExpression(valueContent, trimmedOffset, true); 23314 } 23315 return result; 23316} 23317function getSlice(start, end) { 23318 return currentInput.slice(start, end); 23319} 23320function endOpenTag(end) { 23321 if (tokenizer.inSFCRoot) { 23322 currentOpenTag.innerLoc = getLoc(end + 1, end + 1); 23323 } 23324 addNode(currentOpenTag); 23325 const { tag, ns } = currentOpenTag; 23326 if (ns === 0 && currentOptions.isPreTag(tag)) { 23327 inPre++; 23328 } 23329 if (currentOptions.isVoidTag(tag)) { 23330 onCloseTag(currentOpenTag, end); 23331 } else { 23332 stack.unshift(currentOpenTag); 23333 if (ns === 1 || ns === 2) { 23334 tokenizer.inXML = true; 23335 } 23336 } 23337 currentOpenTag = null; 23338} 23339function onText(content, start, end) { 23340 { 23341 const tag = stack[0] && stack[0].tag; 23342 if (tag !== "script" && tag !== "style" && content.includes("&")) { 23343 content = currentOptions.decodeEntities(content, false); 23344 } 23345 } 23346 const parent = stack[0] || currentRoot; 23347 const lastNode = parent.children[parent.children.length - 1]; 23348 if (lastNode && lastNode.type === 2) { 23349 lastNode.content += content; 23350 setLocEnd(lastNode.loc, end); 23351 } else { 23352 parent.children.push({ 23353 type: 2, 23354 content, 23355 loc: getLoc(start, end) 23356 }); 23357 } 23358} 23359function onCloseTag(el, end, isImplied = false) { 23360 if (isImplied) { 23361 setLocEnd(el.loc, backTrack(end, 60)); 23362 } else { 23363 setLocEnd(el.loc, lookAhead(end, 62) + 1); 23364 } 23365 if (tokenizer.inSFCRoot) { 23366 if (el.children.length) { 23367 el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end); 23368 } else { 23369 el.innerLoc.end = extend({}, el.innerLoc.start); 23370 } 23371 el.innerLoc.source = getSlice( 23372 el.innerLoc.start.offset, 23373 el.innerLoc.end.offset 23374 ); 23375 } 23376 const { tag, ns, children } = el; 23377 if (!inVPre) { 23378 if (tag === "slot") { 23379 el.tagType = 2; 23380 } else if (isFragmentTemplate(el)) { 23381 el.tagType = 3; 23382 } else if (isComponent(el)) { 23383 el.tagType = 1; 23384 } 23385 } 23386 if (!tokenizer.inRCDATA) { 23387 el.children = condenseWhitespace(children); 23388 } 23389 if (ns === 0 && currentOptions.isIgnoreNewlineTag(tag)) { 23390 const first = children[0]; 23391 if (first && first.type === 2) { 23392 first.content = first.content.replace(/^\r?\n/, ""); 23393 } 23394 } 23395 if (ns === 0 && currentOptions.isPreTag(tag)) { 23396 inPre--; 23397 } 23398 if (currentVPreBoundary === el) { 23399 inVPre = tokenizer.inVPre = false; 23400 currentVPreBoundary = null; 23401 } 23402 if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) { 23403 tokenizer.inXML = false; 23404 } 23405 { 23406 const props = el.props; 23407 if (!tokenizer.inSFCRoot && isCompatEnabled( 23408 "COMPILER_NATIVE_TEMPLATE", 23409 currentOptions 23410 ) && el.tag === "template" && !isFragmentTemplate(el)) { 23411 const parent = stack[0] || currentRoot; 23412 const index = parent.children.indexOf(el); 23413 parent.children.splice(index, 1, ...el.children); 23414 } 23415 const inlineTemplateProp = props.find( 23416 (p2) => p2.type === 6 && p2.name === "inline-template" 23417 ); 23418 if (inlineTemplateProp && checkCompatEnabled( 23419 "COMPILER_INLINE_TEMPLATE", 23420 currentOptions, 23421 inlineTemplateProp.loc 23422 ) && el.children.length) { 23423 inlineTemplateProp.value = { 23424 type: 2, 23425 content: getSlice( 23426 el.children[0].loc.start.offset, 23427 el.children[el.children.length - 1].loc.end.offset 23428 ), 23429 loc: inlineTemplateProp.loc 23430 }; 23431 } 23432 } 23433} 23434function lookAhead(index, c2) { 23435 let i2 = index; 23436 while (currentInput.charCodeAt(i2) !== c2 && i2 < currentInput.length - 1) i2++; 23437 return i2; 23438} 23439function backTrack(index, c2) { 23440 let i2 = index; 23441 while (currentInput.charCodeAt(i2) !== c2 && i2 >= 0) i2--; 23442 return i2; 23443} 23444const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]); 23445function isFragmentTemplate({ tag, props }) { 23446 if (tag === "template") { 23447 for (let i2 = 0; i2 < props.length; i2++) { 23448 if (props[i2].type === 7 && specialTemplateDir.has(props[i2].name)) { 23449 return true; 23450 } 23451 } 23452 } 23453 return false;
vendor: 4,342 bytes, lines 23454-23611
23454} 23455function isComponent({ tag, props }) { 23456 if (currentOptions.isCustomElement(tag)) { 23457 return false; 23458 } 23459 if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent && currentOptions.isBuiltInComponent(tag) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) { 23460 return true; 23461 } 23462 for (let i2 = 0; i2 < props.length; i2++) { 23463 const p2 = props[i2]; 23464 if (p2.type === 6) { 23465 if (p2.name === "is" && p2.value) { 23466 if (p2.value.content.startsWith("vue:")) { 23467 return true; 23468 } else if (checkCompatEnabled( 23469 "COMPILER_IS_ON_ELEMENT", 23470 currentOptions, 23471 p2.loc 23472 )) { 23473 return true; 23474 } 23475 } 23476 } else if ( 23477 // :is on plain element - only treat as component in compat mode 23478 p2.name === "bind" && isStaticArgOf(p2.arg, "is") && checkCompatEnabled( 23479 "COMPILER_IS_ON_ELEMENT", 23480 currentOptions, 23481 p2.loc 23482 ) 23483 ) { 23484 return true; 23485 } 23486 } 23487 return false; 23488} 23489function isUpperCase(c2) { 23490 return c2 > 64 && c2 < 91; 23491} 23492const windowsNewlineRE = /\r\n/g; 23493function condenseWhitespace(nodes, tag) { 23494 const shouldCondense = currentOptions.whitespace !== "preserve"; 23495 let removedWhitespace = false; 23496 for (let i2 = 0; i2 < nodes.length; i2++) { 23497 const node = nodes[i2]; 23498 if (node.type === 2) { 23499 if (!inPre) { 23500 if (isAllWhitespace(node.content)) { 23501 const prev = nodes[i2 - 1] && nodes[i2 - 1].type; 23502 const next = nodes[i2 + 1] && nodes[i2 + 1].type; 23503 if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) { 23504 removedWhitespace = true; 23505 nodes[i2] = null; 23506 } else { 23507 node.content = " "; 23508 } 23509 } else if (shouldCondense) { 23510 node.content = condense(node.content); 23511 } 23512 } else { 23513 node.content = node.content.replace(windowsNewlineRE, "\n"); 23514 } 23515 } 23516 } 23517 return removedWhitespace ? nodes.filter(Boolean) : nodes; 23518} 23519function isAllWhitespace(str) { 23520 for (let i2 = 0; i2 < str.length; i2++) { 23521 if (!isWhitespace(str.charCodeAt(i2))) { 23522 return false; 23523 } 23524 } 23525 return true; 23526} 23527function hasNewlineChar(str) { 23528 for (let i2 = 0; i2 < str.length; i2++) { 23529 const c2 = str.charCodeAt(i2); 23530 if (c2 === 10 || c2 === 13) { 23531 return true; 23532 } 23533 } 23534 return false; 23535} 23536function condense(str) { 23537 let ret = ""; 23538 let prevCharIsWhitespace = false; 23539 for (let i2 = 0; i2 < str.length; i2++) { 23540 if (isWhitespace(str.charCodeAt(i2))) { 23541 if (!prevCharIsWhitespace) { 23542 ret += " "; 23543 prevCharIsWhitespace = true; 23544 } 23545 } else { 23546 ret += str[i2]; 23547 prevCharIsWhitespace = false; 23548 } 23549 } 23550 return ret; 23551} 23552function addNode(node) { 23553 (stack[0] || currentRoot).children.push(node); 23554} 23555function getLoc(start, end) { 23556 return { 23557 start: tokenizer.getPos(start), 23558 // @ts-expect-error allow late attachment 23559 end: end == null ? end : tokenizer.getPos(end), 23560 // @ts-expect-error allow late attachment 23561 source: end == null ? end : getSlice(start, end) 23562 }; 23563} 23564function cloneLoc(loc) { 23565 return getLoc(loc.start.offset, loc.end.offset); 23566} 23567function setLocEnd(loc, end) { 23568 loc.end = tokenizer.getPos(end); 23569 loc.source = getSlice(loc.start.offset, end); 23570} 23571function dirToAttr(dir) { 23572 const attr = { 23573 type: 6, 23574 name: dir.rawName, 23575 nameLoc: getLoc( 23576 dir.loc.start.offset, 23577 dir.loc.start.offset + dir.rawName.length 23578 ), 23579 value: void 0, 23580 loc: dir.loc 23581 }; 23582 if (dir.exp) { 23583 const loc = dir.exp.loc; 23584 if (loc.end.offset < dir.loc.end.offset) { 23585 loc.start.offset--; 23586 loc.start.column--; 23587 loc.end.offset++; 23588 loc.end.column++; 23589 } 23590 attr.value = { 23591 type: 2, 23592 content: dir.exp.content, 23593 loc 23594 }; 23595 } 23596 return attr; 23597} 23598function createExp(content, isStatic = false, loc, constType = 0, parseMode = 0) { 23599 const exp = createSimpleExpression(content, isStatic, loc, constType); 23600 return exp; 23601} 23602function emitError(code, index, message) { 23603 currentOptions.onError( 23604 createCompilerError(code, getLoc(index, index)) 23605 ); 23606} 23607function reset() { 23608 tokenizer.reset(); 23609 currentOpenTag = null; 23610 currentProp = null; 23611 currentAttrValue = "";
vendor: 4,675 bytes, lines 23612-23741
23612 currentAttrStartIndex = -1; 23613 currentAttrEndIndex = -1; 23614 stack.length = 0; 23615} 23616function baseParse(input, options) { 23617 reset(); 23618 currentInput = input; 23619 currentOptions = extend({}, defaultParserOptions); 23620 if (options) { 23621 let key; 23622 for (key in options) { 23623 if (options[key] != null) { 23624 currentOptions[key] = options[key]; 23625 } 23626 } 23627 } 23628 tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0; 23629 tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2; 23630 const delimiters = options && options.delimiters; 23631 if (delimiters) { 23632 tokenizer.delimiterOpen = toCharCodes(delimiters[0]); 23633 tokenizer.delimiterClose = toCharCodes(delimiters[1]); 23634 } 23635 const root = currentRoot = createRoot([], input); 23636 tokenizer.parse(currentInput); 23637 root.loc = getLoc(0, input.length); 23638 root.children = condenseWhitespace(root.children); 23639 currentRoot = null; 23640 return root; 23641} 23642function cacheStatic(root, context) { 23643 walk( 23644 root, 23645 void 0, 23646 context, 23647 // Root node is unfortunately non-hoistable due to potential parent 23648 // fallthrough attributes. 23649 isSingleElementRoot(root, root.children[0]) 23650 ); 23651} 23652function isSingleElementRoot(root, child) { 23653 const { children } = root; 23654 return children.length === 1 && child.type === 1 && !isSlotOutlet(child); 23655} 23656function walk(node, parent, context, doNotHoistNode = false, inFor = false) { 23657 const { children } = node; 23658 const toCache = []; 23659 for (let i2 = 0; i2 < children.length; i2++) { 23660 const child = children[i2]; 23661 if (child.type === 1 && child.tagType === 0) { 23662 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 23663 if (constantType > 0) { 23664 if (constantType >= 2) { 23665 child.codegenNode.patchFlag = -1; 23666 toCache.push(child); 23667 continue; 23668 } 23669 } else { 23670 const codegenNode = child.codegenNode; 23671 if (codegenNode.type === 13) { 23672 const flag = codegenNode.patchFlag; 23673 if ((flag === void 0 || flag === 512 || flag === 1) && getGeneratedPropsConstantType(child, context) >= 2) { 23674 const props = getNodeProps(child); 23675 if (props) { 23676 codegenNode.props = context.hoist(props); 23677 } 23678 } 23679 if (codegenNode.dynamicProps) { 23680 codegenNode.dynamicProps = context.hoist(codegenNode.dynamicProps); 23681 } 23682 } 23683 } 23684 } else if (child.type === 12) { 23685 const constantType = doNotHoistNode ? 0 : getConstantType(child, context); 23686 if (constantType >= 2) { 23687 toCache.push(child); 23688 continue; 23689 } 23690 } 23691 if (child.type === 1) { 23692 const isComponent2 = child.tagType === 1; 23693 if (isComponent2) { 23694 context.scopes.vSlot++; 23695 } 23696 walk(child, node, context, false, inFor); 23697 if (isComponent2) { 23698 context.scopes.vSlot--; 23699 } 23700 } else if (child.type === 11) { 23701 walk(child, node, context, child.children.length === 1, true); 23702 } else if (child.type === 9) { 23703 for (let i22 = 0; i22 < child.branches.length; i22++) { 23704 walk( 23705 child.branches[i22], 23706 node, 23707 context, 23708 child.branches[i22].children.length === 1, 23709 inFor 23710 ); 23711 } 23712 } 23713 } 23714 let cachedAsArray = false; 23715 if (toCache.length === children.length && node.type === 1) { 23716 if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray$1(node.codegenNode.children)) { 23717 node.codegenNode.children = getCacheExpression( 23718 createArrayExpression(node.codegenNode.children) 23719 ); 23720 cachedAsArray = true; 23721 } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray$1(node.codegenNode.children) && node.codegenNode.children.type === 15) { 23722 const slot = getSlotNode(node.codegenNode, "default"); 23723 if (slot) { 23724 slot.returns = getCacheExpression( 23725 createArrayExpression(slot.returns) 23726 ); 23727 cachedAsArray = true; 23728 } 23729 } else if (node.tagType === 3 && parent && parent.type === 1 && parent.tagType === 1 && parent.codegenNode && parent.codegenNode.type === 13 && parent.codegenNode.children && !isArray$1(parent.codegenNode.children) && parent.codegenNode.children.type === 15) { 23730 const slotName = findDir(node, "slot", true); 23731 const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg); 23732 if (slot) { 23733 slot.returns = getCacheExpression( 23734 createArrayExpression(slot.returns) 23735 ); 23736 cachedAsArray = true; 23737 } 23738 } 23739 } 23740 if (!cachedAsArray) { 23741 for (const child of toCache) {
vendor: 4,601 bytes, lines 23742-23894
23742 child.codegenNode = context.cache(child.codegenNode); 23743 } 23744 } 23745 function getCacheExpression(value) { 23746 const exp = context.cache(value); 23747 if (inFor && context.hmr) { 23748 exp.needArraySpread = true; 23749 } 23750 return exp; 23751 } 23752 function getSlotNode(node2, name) { 23753 if (node2.children && !isArray$1(node2.children) && node2.children.type === 15) { 23754 const slot = node2.children.properties.find( 23755 (p2) => p2.key === name || p2.key.content === name 23756 ); 23757 return slot && slot.value; 23758 } 23759 } 23760 if (toCache.length && context.transformHoist) { 23761 context.transformHoist(children, context, node); 23762 } 23763} 23764function getConstantType(node, context) { 23765 const { constantCache } = context; 23766 switch (node.type) { 23767 case 1: 23768 if (node.tagType !== 0) { 23769 return 0; 23770 } 23771 const cached = constantCache.get(node); 23772 if (cached !== void 0) { 23773 return cached; 23774 } 23775 const codegenNode = node.codegenNode; 23776 if (codegenNode.type !== 13) { 23777 return 0; 23778 } 23779 if (codegenNode.isBlock && node.tag !== "svg" && node.tag !== "foreignObject" && node.tag !== "math") { 23780 return 0; 23781 } 23782 if (codegenNode.patchFlag === void 0) { 23783 let returnType2 = 3; 23784 const generatedPropsType = getGeneratedPropsConstantType(node, context); 23785 if (generatedPropsType === 0) { 23786 constantCache.set(node, 0); 23787 return 0; 23788 } 23789 if (generatedPropsType < returnType2) { 23790 returnType2 = generatedPropsType; 23791 } 23792 for (let i2 = 0; i2 < node.children.length; i2++) { 23793 const childType = getConstantType(node.children[i2], context); 23794 if (childType === 0) { 23795 constantCache.set(node, 0); 23796 return 0; 23797 } 23798 if (childType < returnType2) { 23799 returnType2 = childType; 23800 } 23801 } 23802 if (returnType2 > 1) { 23803 for (let i2 = 0; i2 < node.props.length; i2++) { 23804 const p2 = node.props[i2]; 23805 if (p2.type === 7 && p2.name === "bind" && p2.exp) { 23806 const expType = getConstantType(p2.exp, context); 23807 if (expType === 0) { 23808 constantCache.set(node, 0); 23809 return 0; 23810 } 23811 if (expType < returnType2) { 23812 returnType2 = expType; 23813 } 23814 } 23815 } 23816 } 23817 if (codegenNode.isBlock) { 23818 for (let i2 = 0; i2 < node.props.length; i2++) { 23819 const p2 = node.props[i2]; 23820 if (p2.type === 7) { 23821 constantCache.set(node, 0); 23822 return 0; 23823 } 23824 } 23825 context.removeHelper(OPEN_BLOCK); 23826 context.removeHelper( 23827 getVNodeBlockHelper(context.inSSR, codegenNode.isComponent) 23828 ); 23829 codegenNode.isBlock = false; 23830 context.helper(getVNodeHelper(context.inSSR, codegenNode.isComponent)); 23831 } 23832 constantCache.set(node, returnType2); 23833 return returnType2; 23834 } else { 23835 constantCache.set(node, 0); 23836 return 0; 23837 } 23838 case 2: 23839 case 3: 23840 return 3; 23841 case 9: 23842 case 11: 23843 case 10: 23844 return 0; 23845 case 5: 23846 case 12: 23847 return getConstantType(node.content, context); 23848 case 4: 23849 return node.constType; 23850 case 8: 23851 let returnType = 3; 23852 for (let i2 = 0; i2 < node.children.length; i2++) { 23853 const child = node.children[i2]; 23854 if (isString$1(child) || isSymbol(child)) { 23855 continue; 23856 } 23857 const childType = getConstantType(child, context); 23858 if (childType === 0) { 23859 return 0; 23860 } else if (childType < returnType) { 23861 returnType = childType; 23862 } 23863 } 23864 return returnType; 23865 case 20: 23866 return 2; 23867 default: 23868 return 0; 23869 } 23870} 23871const allowHoistedHelperSet = /* @__PURE__ */ new Set([ 23872 NORMALIZE_CLASS, 23873 NORMALIZE_STYLE, 23874 NORMALIZE_PROPS, 23875 GUARD_REACTIVE_PROPS 23876]); 23877function getConstantTypeOfHelperCall(value, context) { 23878 if (value.type === 14 && !isString$1(value.callee) && allowHoistedHelperSet.has(value.callee)) { 23879 const arg = value.arguments[0]; 23880 if (arg.type === 4) { 23881 return getConstantType(arg, context); 23882 } else if (arg.type === 14) { 23883 return getConstantTypeOfHelperCall(arg, context); 23884 } 23885 } 23886 return 0; 23887} 23888function getGeneratedPropsConstantType(node, context) { 23889 let returnType = 3; 23890 const props = getNodeProps(node); 23891 if (props && props.type === 15) { 23892 const { properties } = props; 23893 for (let i2 = 0; i2 < properties.length; i2++) { 23894 const { key, value } = properties[i2];
vendor: 9,405 bytes, lines 23895-24282
23895 const keyType = getConstantType(key, context); 23896 if (keyType === 0) { 23897 return keyType; 23898 } 23899 if (keyType < returnType) { 23900 returnType = keyType; 23901 } 23902 let valueType; 23903 if (value.type === 4) { 23904 valueType = getConstantType(value, context); 23905 } else if (value.type === 14) { 23906 valueType = getConstantTypeOfHelperCall(value, context); 23907 } else { 23908 valueType = 0; 23909 } 23910 if (valueType === 0) { 23911 return valueType; 23912 } 23913 if (valueType < returnType) { 23914 returnType = valueType; 23915 } 23916 } 23917 } 23918 return returnType; 23919} 23920function getNodeProps(node) { 23921 const codegenNode = node.codegenNode; 23922 if (codegenNode.type === 13) { 23923 return codegenNode.props; 23924 } 23925} 23926function createTransformContext(root, { 23927 filename = "", 23928 prefixIdentifiers = false, 23929 hoistStatic = false, 23930 hmr = false, 23931 cacheHandlers = false, 23932 nodeTransforms = [], 23933 directiveTransforms = {}, 23934 transformHoist = null, 23935 isBuiltInComponent = NOOP, 23936 isCustomElement = NOOP, 23937 expressionPlugins = [], 23938 scopeId = null, 23939 slotted = true, 23940 ssr = false, 23941 inSSR = false, 23942 ssrCssVars = ``, 23943 bindingMetadata = EMPTY_OBJ, 23944 inline = false, 23945 isTS = false, 23946 onError = defaultOnError, 23947 onWarn = defaultOnWarn, 23948 compatConfig 23949}) { 23950 const nameMatch = filename.replace(/\?.*$/, "").match(/([^/\\]+)\.\w+$/); 23951 const context = { 23952 // options 23953 filename, 23954 selfName: nameMatch && capitalize(camelize(nameMatch[1])), 23955 prefixIdentifiers, 23956 hoistStatic, 23957 hmr, 23958 cacheHandlers, 23959 nodeTransforms, 23960 directiveTransforms, 23961 transformHoist, 23962 isBuiltInComponent, 23963 isCustomElement, 23964 expressionPlugins, 23965 scopeId, 23966 slotted, 23967 ssr, 23968 inSSR, 23969 ssrCssVars, 23970 bindingMetadata, 23971 inline, 23972 isTS, 23973 onError, 23974 onWarn, 23975 compatConfig, 23976 // state 23977 root, 23978 helpers: /* @__PURE__ */ new Map(), 23979 components: /* @__PURE__ */ new Set(), 23980 directives: /* @__PURE__ */ new Set(), 23981 hoists: [], 23982 imports: [], 23983 cached: [], 23984 constantCache: /* @__PURE__ */ new WeakMap(), 23985 temps: 0, 23986 identifiers: /* @__PURE__ */ Object.create(null), 23987 scopes: { 23988 vFor: 0, 23989 vSlot: 0, 23990 vPre: 0, 23991 vOnce: 0 23992 }, 23993 parent: null, 23994 grandParent: null, 23995 currentNode: root, 23996 childIndex: 0, 23997 inVOnce: false, 23998 // methods 23999 helper(name) { 24000 const count = context.helpers.get(name) || 0; 24001 context.helpers.set(name, count + 1); 24002 return name; 24003 }, 24004 removeHelper(name) { 24005 const count = context.helpers.get(name); 24006 if (count) { 24007 const currentCount = count - 1; 24008 if (!currentCount) { 24009 context.helpers.delete(name); 24010 } else { 24011 context.helpers.set(name, currentCount); 24012 } 24013 } 24014 }, 24015 helperString(name) { 24016 return `_${helperNameMap[context.helper(name)]}`; 24017 }, 24018 replaceNode(node) { 24019 context.parent.children[context.childIndex] = context.currentNode = node; 24020 }, 24021 removeNode(node) { 24022 const list = context.parent.children; 24023 const removalIndex = node ? list.indexOf(node) : context.currentNode ? context.childIndex : -1; 24024 if (!node || node === context.currentNode) { 24025 context.currentNode = null; 24026 context.onNodeRemoved(); 24027 } else { 24028 if (context.childIndex > removalIndex) { 24029 context.childIndex--; 24030 context.onNodeRemoved(); 24031 } 24032 } 24033 context.parent.children.splice(removalIndex, 1); 24034 }, 24035 onNodeRemoved: NOOP, 24036 addIdentifiers(exp) { 24037 }, 24038 removeIdentifiers(exp) { 24039 }, 24040 hoist(exp) { 24041 if (isString$1(exp)) exp = createSimpleExpression(exp); 24042 context.hoists.push(exp); 24043 const identifier = createSimpleExpression( 24044 `_hoisted_${context.hoists.length}`, 24045 false, 24046 exp.loc, 24047 2 24048 ); 24049 identifier.hoisted = exp; 24050 return identifier; 24051 }, 24052 cache(exp, isVNode = false, inVOnce = false) { 24053 const cacheExp = createCacheExpression( 24054 context.cached.length, 24055 exp, 24056 isVNode, 24057 inVOnce 24058 ); 24059 context.cached.push(cacheExp); 24060 return cacheExp; 24061 } 24062 }; 24063 { 24064 context.filters = /* @__PURE__ */ new Set(); 24065 } 24066 return context; 24067} 24068function transform(root, options) { 24069 const context = createTransformContext(root, options); 24070 traverseNode(root, context); 24071 if (options.hoistStatic) { 24072 cacheStatic(root, context); 24073 } 24074 if (!options.ssr) { 24075 createRootCodegen(root, context); 24076 } 24077 root.helpers = /* @__PURE__ */ new Set([...context.helpers.keys()]); 24078 root.components = [...context.components]; 24079 root.directives = [...context.directives]; 24080 root.imports = context.imports; 24081 root.hoists = context.hoists; 24082 root.temps = context.temps; 24083 root.cached = context.cached; 24084 root.transformed = true; 24085 { 24086 root.filters = [...context.filters]; 24087 } 24088} 24089function createRootCodegen(root, context) { 24090 const { helper } = context; 24091 const { children } = root; 24092 if (children.length === 1) { 24093 const child = children[0]; 24094 if (isSingleElementRoot(root, child) && child.codegenNode) { 24095 const codegenNode = child.codegenNode; 24096 if (codegenNode.type === 13) { 24097 convertToBlock(codegenNode, context); 24098 } 24099 root.codegenNode = codegenNode; 24100 } else { 24101 root.codegenNode = child; 24102 } 24103 } else if (children.length > 1) { 24104 let patchFlag = 64; 24105 root.codegenNode = createVNodeCall( 24106 context, 24107 helper(FRAGMENT), 24108 void 0, 24109 root.children, 24110 patchFlag, 24111 void 0, 24112 void 0, 24113 true, 24114 void 0, 24115 false 24116 ); 24117 } else ; 24118} 24119function traverseChildren(parent, context) { 24120 let i2 = 0; 24121 const nodeRemoved = () => { 24122 i2--; 24123 }; 24124 for (; i2 < parent.children.length; i2++) { 24125 const child = parent.children[i2]; 24126 if (isString$1(child)) continue; 24127 context.grandParent = context.parent; 24128 context.parent = parent; 24129 context.childIndex = i2; 24130 context.onNodeRemoved = nodeRemoved; 24131 traverseNode(child, context); 24132 } 24133} 24134function traverseNode(node, context) { 24135 context.currentNode = node; 24136 const { nodeTransforms } = context; 24137 const exitFns = []; 24138 for (let i22 = 0; i22 < nodeTransforms.length; i22++) { 24139 const onExit = nodeTransforms[i22](node, context); 24140 if (onExit) { 24141 if (isArray$1(onExit)) { 24142 exitFns.push(...onExit); 24143 } else { 24144 exitFns.push(onExit); 24145 } 24146 } 24147 if (!context.currentNode) { 24148 return; 24149 } else { 24150 node = context.currentNode; 24151 } 24152 } 24153 switch (node.type) { 24154 case 3: 24155 if (!context.ssr) { 24156 context.helper(CREATE_COMMENT); 24157 } 24158 break; 24159 case 5: 24160 if (!context.ssr) { 24161 context.helper(TO_DISPLAY_STRING); 24162 } 24163 break; 24164 // for container types, further traverse downwards 24165 case 9: 24166 for (let i22 = 0; i22 < node.branches.length; i22++) { 24167 traverseNode(node.branches[i22], context); 24168 } 24169 break; 24170 case 10: 24171 case 11: 24172 case 1: 24173 case 0: 24174 traverseChildren(node, context); 24175 break; 24176 } 24177 context.currentNode = node; 24178 let i2 = exitFns.length; 24179 while (i2--) { 24180 exitFns[i2](); 24181 } 24182} 24183function createStructuralDirectiveTransform(name, fn) { 24184 const matches = isString$1(name) ? (n2) => n2 === name : (n2) => name.test(n2); 24185 return (node, context) => { 24186 if (node.type === 1) { 24187 const { props } = node; 24188 if (node.tagType === 3 && props.some(isVSlot)) { 24189 return; 24190 } 24191 const exitFns = []; 24192 for (let i2 = 0; i2 < props.length; i2++) { 24193 const prop = props[i2]; 24194 if (prop.type === 7 && matches(prop.name)) { 24195 props.splice(i2, 1); 24196 i2--; 24197 const onExit = fn(node, prop, context); 24198 if (onExit) exitFns.push(onExit); 24199 } 24200 } 24201 return exitFns; 24202 } 24203 }; 24204} 24205const PURE_ANNOTATION = `/*@__PURE__*/`; 24206const aliasHelper = (s2) => `${helperNameMap[s2]}: _${helperNameMap[s2]}`; 24207function createCodegenContext(ast, { 24208 mode = "function", 24209 prefixIdentifiers = mode === "module", 24210 sourceMap = false, 24211 filename = `template.vue.html`, 24212 scopeId = null, 24213 optimizeImports = false, 24214 runtimeGlobalName = `Vue`, 24215 runtimeModuleName = `vue`, 24216 ssrRuntimeModuleName = "vue/server-renderer", 24217 ssr = false, 24218 isTS = false, 24219 inSSR = false 24220}) { 24221 const context = { 24222 mode, 24223 prefixIdentifiers, 24224 sourceMap, 24225 filename, 24226 scopeId, 24227 optimizeImports, 24228 runtimeGlobalName, 24229 runtimeModuleName, 24230 ssrRuntimeModuleName, 24231 ssr, 24232 isTS, 24233 inSSR, 24234 source: ast.source, 24235 code: ``, 24236 column: 1, 24237 line: 1, 24238 offset: 0, 24239 indentLevel: 0, 24240 pure: false, 24241 map: void 0, 24242 helper(key) { 24243 return `_${helperNameMap[key]}`; 24244 }, 24245 push(code, newlineIndex = -2, node) { 24246 context.code += code; 24247 }, 24248 indent() { 24249 newline(++context.indentLevel); 24250 }, 24251 deindent(withoutNewLine = false) { 24252 if (withoutNewLine) { 24253 --context.indentLevel; 24254 } else { 24255 newline(--context.indentLevel); 24256 } 24257 }, 24258 newline() { 24259 newline(context.indentLevel); 24260 } 24261 }; 24262 function newline(n2) { 24263 context.push( 24264 "\n" + ` `.repeat(n2), 24265 0 24266 /* Start */ 24267 ); 24268 } 24269 return context; 24270} 24271function generate(ast, options = {}) { 24272 const context = createCodegenContext(ast, options); 24273 if (options.onContextCreated) options.onContextCreated(context); 24274 const { 24275 mode, 24276 push, 24277 prefixIdentifiers, 24278 indent, 24279 deindent, 24280 newline, 24281 scopeId, 24282 ssr
vendor: 6,438 bytes, lines 24283-24563
24283 } = context; 24284 const helpers = Array.from(ast.helpers); 24285 const hasHelpers = helpers.length > 0; 24286 const useWithBlock = !prefixIdentifiers && mode !== "module"; 24287 const preambleContext = context; 24288 { 24289 genFunctionPreamble(ast, preambleContext); 24290 } 24291 const functionName = ssr ? `ssrRender` : `render`; 24292 const args = ssr ? ["_ctx", "_push", "_parent", "_attrs"] : ["_ctx", "_cache"]; 24293 const signature = args.join(", "); 24294 { 24295 push(`function ${functionName}(${signature}) {`); 24296 } 24297 indent(); 24298 if (useWithBlock) { 24299 push(`with (_ctx) {`); 24300 indent(); 24301 if (hasHelpers) { 24302 push( 24303 `const { ${helpers.map(aliasHelper).join(", ")} } = _Vue 24304`, 24305 -1 24306 /* End */ 24307 ); 24308 newline(); 24309 } 24310 } 24311 if (ast.components.length) { 24312 genAssets(ast.components, "component", context); 24313 if (ast.directives.length || ast.temps > 0) { 24314 newline(); 24315 } 24316 } 24317 if (ast.directives.length) { 24318 genAssets(ast.directives, "directive", context); 24319 if (ast.temps > 0) { 24320 newline(); 24321 } 24322 } 24323 if (ast.filters && ast.filters.length) { 24324 newline(); 24325 genAssets(ast.filters, "filter", context); 24326 newline(); 24327 } 24328 if (ast.temps > 0) { 24329 push(`let `); 24330 for (let i2 = 0; i2 < ast.temps; i2++) { 24331 push(`${i2 > 0 ? `, ` : ``}_temp${i2}`); 24332 } 24333 } 24334 if (ast.components.length || ast.directives.length || ast.temps) { 24335 push( 24336 ` 24337`, 24338 0 24339 /* Start */ 24340 ); 24341 newline(); 24342 } 24343 if (!ssr) { 24344 push(`return `); 24345 } 24346 if (ast.codegenNode) { 24347 genNode(ast.codegenNode, context); 24348 } else { 24349 push(`null`); 24350 } 24351 if (useWithBlock) { 24352 deindent(); 24353 push(`}`); 24354 } 24355 deindent(); 24356 push(`}`); 24357 return { 24358 ast, 24359 code: context.code, 24360 preamble: ``, 24361 map: context.map ? context.map.toJSON() : void 0 24362 }; 24363} 24364function genFunctionPreamble(ast, context) { 24365 const { 24366 ssr, 24367 prefixIdentifiers, 24368 push, 24369 newline, 24370 runtimeModuleName, 24371 runtimeGlobalName, 24372 ssrRuntimeModuleName 24373 } = context; 24374 const VueBinding = runtimeGlobalName; 24375 const helpers = Array.from(ast.helpers); 24376 if (helpers.length > 0) { 24377 { 24378 push( 24379 `const _Vue = ${VueBinding} 24380`, 24381 -1 24382 /* End */ 24383 ); 24384 if (ast.hoists.length) { 24385 const staticHelpers = [ 24386 CREATE_VNODE, 24387 CREATE_ELEMENT_VNODE, 24388 CREATE_COMMENT, 24389 CREATE_TEXT, 24390 CREATE_STATIC 24391 ].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", "); 24392 push( 24393 `const { ${staticHelpers} } = _Vue 24394`, 24395 -1 24396 /* End */ 24397 ); 24398 } 24399 } 24400 } 24401 genHoists(ast.hoists, context); 24402 newline(); 24403 push(`return `); 24404} 24405function genAssets(assets, type, { helper, push, newline, isTS }) { 24406 const resolver = helper( 24407 type === "filter" ? RESOLVE_FILTER : type === "component" ? RESOLVE_COMPONENT : RESOLVE_DIRECTIVE 24408 ); 24409 for (let i2 = 0; i2 < assets.length; i2++) { 24410 let id = assets[i2]; 24411 const maybeSelfReference = id.endsWith("__self"); 24412 if (maybeSelfReference) { 24413 id = id.slice(0, -6); 24414 } 24415 push( 24416 `const ${toValidAssetId(id, type)} = ${resolver}(${JSON.stringify(id)}${maybeSelfReference ? `, true` : ``})${isTS ? `!` : ``}` 24417 ); 24418 if (i2 < assets.length - 1) { 24419 newline(); 24420 } 24421 } 24422} 24423function genHoists(hoists, context) { 24424 if (!hoists.length) { 24425 return; 24426 } 24427 context.pure = true; 24428 const { push, newline } = context; 24429 newline(); 24430 for (let i2 = 0; i2 < hoists.length; i2++) { 24431 const exp = hoists[i2]; 24432 if (exp) { 24433 push(`const _hoisted_${i2 + 1} = `); 24434 genNode(exp, context); 24435 newline(); 24436 } 24437 } 24438 context.pure = false; 24439} 24440function genNodeListAsArray(nodes, context) { 24441 const multilines = nodes.length > 3 || false; 24442 context.push(`[`); 24443 multilines && context.indent(); 24444 genNodeList(nodes, context, multilines); 24445 multilines && context.deindent(); 24446 context.push(`]`); 24447} 24448function genNodeList(nodes, context, multilines = false, comma = true) { 24449 const { push, newline } = context; 24450 for (let i2 = 0; i2 < nodes.length; i2++) { 24451 const node = nodes[i2]; 24452 if (isString$1(node)) { 24453 push( 24454 node, 24455 -3 24456 /* Unknown */ 24457 ); 24458 } else if (isArray$1(node)) { 24459 genNodeListAsArray(node, context); 24460 } else { 24461 genNode(node, context); 24462 } 24463 if (i2 < nodes.length - 1) { 24464 if (multilines) { 24465 comma && push(","); 24466 newline(); 24467 } else { 24468 comma && push(", "); 24469 } 24470 } 24471 } 24472} 24473function genNode(node, context) { 24474 if (isString$1(node)) { 24475 context.push( 24476 node, 24477 -3 24478 /* Unknown */ 24479 ); 24480 return; 24481 } 24482 if (isSymbol(node)) { 24483 context.push(context.helper(node)); 24484 return; 24485 } 24486 switch (node.type) { 24487 case 1: 24488 case 9: 24489 case 11: 24490 genNode(node.codegenNode, context); 24491 break; 24492 case 2: 24493 genText(node, context); 24494 break; 24495 case 4: 24496 genExpression(node, context); 24497 break; 24498 case 5: 24499 genInterpolation(node, context); 24500 break; 24501 case 12: 24502 genNode(node.codegenNode, context); 24503 break; 24504 case 8: 24505 genCompoundExpression(node, context); 24506 break; 24507 case 3: 24508 genComment(node, context); 24509 break; 24510 case 13: 24511 genVNodeCall(node, context); 24512 break; 24513 case 14: 24514 genCallExpression(node, context); 24515 break; 24516 case 15: 24517 genObjectExpression(node, context); 24518 break; 24519 case 17: 24520 genArrayExpression(node, context); 24521 break; 24522 case 18: 24523 genFunctionExpression(node, context); 24524 break; 24525 case 19: 24526 genConditionalExpression(node, context); 24527 break; 24528 case 20: 24529 genCacheExpression(node, context); 24530 break; 24531 case 21: 24532 genNodeList(node.body, context, true, false); 24533 break; 24534 } 24535} 24536function genText(node, context) { 24537 context.push(JSON.stringify(node.content), -3, node); 24538} 24539function genExpression(node, context) { 24540 const { content, isStatic } = node; 24541 context.push( 24542 isStatic ? JSON.stringify(content) : content, 24543 -3, 24544 node 24545 ); 24546} 24547function genInterpolation(node, context) { 24548 const { push, helper, pure } = context; 24549 if (pure) push(PURE_ANNOTATION); 24550 push(`${helper(TO_DISPLAY_STRING)}(`); 24551 genNode(node.content, context); 24552 push(`)`); 24553} 24554function genCompoundExpression(node, context) { 24555 for (let i2 = 0; i2 < node.children.length; i2++) { 24556 const child = node.children[i2]; 24557 if (isString$1(child)) { 24558 context.push( 24559 child, 24560 -3 24561 /* Unknown */ 24562 ); 24563 } else {
vendor: 4,130 bytes, lines 24564-24732
24564 genNode(child, context); 24565 } 24566 } 24567} 24568function genExpressionAsPropertyKey(node, context) { 24569 const { push } = context; 24570 if (node.type === 8) { 24571 push(`[`); 24572 genCompoundExpression(node, context); 24573 push(`]`); 24574 } else if (node.isStatic) { 24575 const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content); 24576 push(text, -2, node); 24577 } else { 24578 push(`[${node.content}]`, -3, node); 24579 } 24580} 24581function genComment(node, context) { 24582 const { push, helper, pure } = context; 24583 if (pure) { 24584 push(PURE_ANNOTATION); 24585 } 24586 push( 24587 `${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`, 24588 -3, 24589 node 24590 ); 24591} 24592function genVNodeCall(node, context) { 24593 const { push, helper, pure } = context; 24594 const { 24595 tag, 24596 props, 24597 children, 24598 patchFlag, 24599 dynamicProps, 24600 directives, 24601 isBlock, 24602 disableTracking, 24603 isComponent: isComponent2 24604 } = node; 24605 let patchFlagString; 24606 if (patchFlag) { 24607 { 24608 patchFlagString = String(patchFlag); 24609 } 24610 } 24611 if (directives) { 24612 push(helper(WITH_DIRECTIVES) + `(`); 24613 } 24614 if (isBlock) { 24615 push(`(${helper(OPEN_BLOCK)}(${disableTracking ? `true` : ``}), `); 24616 } 24617 if (pure) { 24618 push(PURE_ANNOTATION); 24619 } 24620 const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent2) : getVNodeHelper(context.inSSR, isComponent2); 24621 push(helper(callHelper) + `(`, -2, node); 24622 genNodeList( 24623 genNullableArgs([tag, props, children, patchFlagString, dynamicProps]), 24624 context 24625 ); 24626 push(`)`); 24627 if (isBlock) { 24628 push(`)`); 24629 } 24630 if (directives) { 24631 push(`, `); 24632 genNode(directives, context); 24633 push(`)`); 24634 } 24635} 24636function genNullableArgs(args) { 24637 let i2 = args.length; 24638 while (i2--) { 24639 if (args[i2] != null) break; 24640 } 24641 return args.slice(0, i2 + 1).map((arg) => arg || `null`); 24642} 24643function genCallExpression(node, context) { 24644 const { push, helper, pure } = context; 24645 const callee = isString$1(node.callee) ? node.callee : helper(node.callee); 24646 if (pure) { 24647 push(PURE_ANNOTATION); 24648 } 24649 push(callee + `(`, -2, node); 24650 genNodeList(node.arguments, context); 24651 push(`)`); 24652} 24653function genObjectExpression(node, context) { 24654 const { push, indent, deindent, newline } = context; 24655 const { properties } = node; 24656 if (!properties.length) { 24657 push(`{}`, -2, node); 24658 return; 24659 } 24660 const multilines = properties.length > 1 || false; 24661 push(multilines ? `{` : `{ `); 24662 multilines && indent(); 24663 for (let i2 = 0; i2 < properties.length; i2++) { 24664 const { key, value } = properties[i2]; 24665 genExpressionAsPropertyKey(key, context); 24666 push(`: `); 24667 genNode(value, context); 24668 if (i2 < properties.length - 1) { 24669 push(`,`); 24670 newline(); 24671 } 24672 } 24673 multilines && deindent(); 24674 push(multilines ? `}` : ` }`); 24675} 24676function genArrayExpression(node, context) { 24677 genNodeListAsArray(node.elements, context); 24678} 24679function genFunctionExpression(node, context) { 24680 const { push, indent, deindent } = context; 24681 const { params, returns, body, newline, isSlot } = node; 24682 if (isSlot) { 24683 push(`_${helperNameMap[WITH_CTX]}(`); 24684 } 24685 push(`(`, -2, node); 24686 if (isArray$1(params)) { 24687 genNodeList(params, context); 24688 } else if (params) { 24689 genNode(params, context); 24690 } 24691 push(`) => `); 24692 if (newline || body) { 24693 push(`{`); 24694 indent(); 24695 } 24696 if (returns) { 24697 if (newline) { 24698 push(`return `); 24699 } 24700 if (isArray$1(returns)) { 24701 genNodeListAsArray(returns, context); 24702 } else { 24703 genNode(returns, context); 24704 } 24705 } else if (body) { 24706 genNode(body, context); 24707 } 24708 if (newline || body) { 24709 deindent(); 24710 push(`}`); 24711 } 24712 if (isSlot) { 24713 if (node.isNonScopedSlot) { 24714 push(`, undefined, true`); 24715 } 24716 push(`)`); 24717 } 24718} 24719function genConditionalExpression(node, context) { 24720 const { test, consequent, alternate, newline: needNewline } = node; 24721 const { push, indent, deindent, newline } = context; 24722 if (test.type === 4) { 24723 const needsParens = !isSimpleIdentifier(test.content); 24724 needsParens && push(`(`); 24725 genExpression(test, context); 24726 needsParens && push(`)`); 24727 } else { 24728 push(`(`); 24729 genNode(test, context); 24730 push(`)`); 24731 } 24732 needNewline && indent();
vendor: 5,124 bytes, lines 24733-24903
24733 context.indentLevel++; 24734 needNewline || push(` `); 24735 push(`? `); 24736 genNode(consequent, context); 24737 context.indentLevel--; 24738 needNewline && newline(); 24739 needNewline || push(` `); 24740 push(`: `); 24741 const isNested = alternate.type === 19; 24742 if (!isNested) { 24743 context.indentLevel++; 24744 } 24745 genNode(alternate, context); 24746 if (!isNested) { 24747 context.indentLevel--; 24748 } 24749 needNewline && deindent( 24750 true 24751 /* without newline */ 24752 ); 24753} 24754function genCacheExpression(node, context) { 24755 const { push, helper, indent, deindent, newline } = context; 24756 const { needPauseTracking, needArraySpread } = node; 24757 if (needArraySpread) { 24758 push(`[...(`); 24759 } 24760 push(`_cache[${node.index}] || (`); 24761 if (needPauseTracking) { 24762 indent(); 24763 push(`${helper(SET_BLOCK_TRACKING)}(-1`); 24764 if (node.inVOnce) push(`, true`); 24765 push(`),`); 24766 newline(); 24767 push(`(`); 24768 } 24769 push(`_cache[${node.index}] = `); 24770 genNode(node.value, context); 24771 if (needPauseTracking) { 24772 push(`).cacheIndex = ${node.index},`); 24773 newline(); 24774 push(`${helper(SET_BLOCK_TRACKING)}(1),`); 24775 newline(); 24776 push(`_cache[${node.index}]`); 24777 deindent(); 24778 } 24779 push(`)`); 24780 if (needArraySpread) { 24781 push(`)]`); 24782 } 24783} 24784new RegExp( 24785 "\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b" 24786); 24787const transformExpression = (node, context) => { 24788 if (node.type === 5) { 24789 node.content = processExpression( 24790 node.content, 24791 context 24792 ); 24793 } else if (node.type === 1) { 24794 const memo = findDir(node, "memo"); 24795 for (let i2 = 0; i2 < node.props.length; i2++) { 24796 const dir = node.props[i2]; 24797 if (dir.type === 7 && dir.name !== "for") { 24798 const exp = dir.exp; 24799 const arg = dir.arg; 24800 if (exp && exp.type === 4 && !(dir.name === "on" && arg) && // key has been processed in transformFor(vMemo + vFor) 24801 !(memo && arg && arg.type === 4 && arg.content === "key")) { 24802 dir.exp = processExpression( 24803 exp, 24804 context, 24805 // slot args must be processed as function params 24806 dir.name === "slot" 24807 ); 24808 } 24809 if (arg && arg.type === 4 && !arg.isStatic) { 24810 dir.arg = processExpression(arg, context); 24811 } 24812 } 24813 } 24814 } 24815}; 24816function processExpression(node, context, asParams = false, asRawStatements = false, localVars = Object.create(context.identifiers)) { 24817 { 24818 return node; 24819 } 24820} 24821function stringifyExpression(exp) { 24822 if (isString$1(exp)) { 24823 return exp; 24824 } else if (exp.type === 4) { 24825 return exp.content; 24826 } else { 24827 return exp.children.map(stringifyExpression).join(""); 24828 } 24829} 24830const transformIf = createStructuralDirectiveTransform( 24831 /^(if|else|else-if)$/, 24832 (node, dir, context) => { 24833 return processIf(node, dir, context, (ifNode, branch, isRoot) => { 24834 const siblings = context.parent.children; 24835 let i2 = siblings.indexOf(ifNode); 24836 let key = 0; 24837 while (i2-- >= 0) { 24838 const sibling = siblings[i2]; 24839 if (sibling && sibling.type === 9) { 24840 key += sibling.branches.length; 24841 } 24842 } 24843 return () => { 24844 if (isRoot) { 24845 ifNode.codegenNode = createCodegenNodeForBranch( 24846 branch, 24847 key, 24848 context 24849 ); 24850 } else { 24851 const parentCondition = getParentCondition(ifNode.codegenNode); 24852 parentCondition.alternate = createCodegenNodeForBranch( 24853 branch, 24854 key + ifNode.branches.length - 1, 24855 context 24856 ); 24857 } 24858 }; 24859 }); 24860 } 24861); 24862function processIf(node, dir, context, processCodegen) { 24863 if (dir.name !== "else" && (!dir.exp || !dir.exp.content.trim())) { 24864 const loc = dir.exp ? dir.exp.loc : node.loc; 24865 context.onError( 24866 createCompilerError(28, dir.loc) 24867 ); 24868 dir.exp = createSimpleExpression(`true`, false, loc); 24869 } 24870 if (dir.name === "if") { 24871 const branch = createIfBranch(node, dir); 24872 const ifNode = { 24873 type: 9, 24874 loc: cloneLoc(node.loc), 24875 branches: [branch] 24876 }; 24877 context.replaceNode(ifNode); 24878 if (processCodegen) { 24879 return processCodegen(ifNode, branch, true); 24880 } 24881 } else { 24882 const siblings = context.parent.children; 24883 let i2 = siblings.indexOf(node); 24884 while (i2-- >= -1) { 24885 const sibling = siblings[i2]; 24886 if (sibling && sibling.type === 3) { 24887 context.removeNode(sibling); 24888 continue; 24889 } 24890 if (sibling && sibling.type === 2 && !sibling.content.trim().length) { 24891 context.removeNode(sibling); 24892 continue; 24893 } 24894 if (sibling && sibling.type === 9) { 24895 if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) { 24896 context.onError( 24897 createCompilerError(30, node.loc) 24898 ); 24899 } 24900 context.removeNode(); 24901 const branch = createIfBranch(node, dir); 24902 sibling.branches.push(branch); 24903 const onExit = processCodegen && processCodegen(sibling, branch, false);
24904 traverseNode(branch, context); 24905 if (onExit) onExit(); 24906 context.currentNode = null; 24907 } else { 24908 context.onError( 24909 createCompilerError(30, node.loc) 24910 ); 24911 } 24912 break; 24913 } 24914 } 24915} 24916function createIfBranch(node, dir) { 24917 const isTemplateIf = node.tagType === 3; 24918 return { 24919 type: 10, 24920 loc: node.loc, 24921 condition: dir.name === "else" ? void 0 : dir.exp, 24922 children: isTemplateIf && !findDir(node, "for") ? node.children : [node], 24923 userKey: findProp(node, `key`), 24924 isTemplateIf 24925 }; 24926} 24927function createCodegenNodeForBranch(branch, keyIndex, context) { 24928 if (branch.condition) { 24929 return createConditionalExpression( 24930 branch.condition, 24931 createChildrenCodegenNode(branch, keyIndex, context), 24932 // make sure to pass in asBlock: true so that the comment node call 24933 // closes the current block. 24934 createCallExpression(context.helper(CREATE_COMMENT), [ 24935 '""', 24936 "true" 24937 ]) 24938 ); 24939 } else { 24940 return createChildrenCodegenNode(branch, keyIndex, context); 24941 } 24942} 24943function createChildrenCodegenNode(branch, keyIndex, context) { 24944 const { helper } = context; 24945 const keyProperty = createObjectProperty( 24946 `key`, 24947 createSimpleExpression( 24948 `${keyIndex}`, 24949 false, 24950 locStub, 24951 2 24952 ) 24953 ); 24954 const { children } = branch; 24955 const firstChild = children[0]; 24956 const needFragmentWrapper = children.length !== 1 || firstChild.type !== 1; 24957 if (needFragmentWrapper) { 24958 if (children.length === 1 && firstChild.type === 11) { 24959 const vnodeCall = firstChild.codegenNode; 24960 injectProp(vnodeCall, keyProperty, context); 24961 return vnodeCall; 24962 } else { 24963 let patchFlag = 64; 24964 return createVNodeCall( 24965 context, 24966 helper(FRAGMENT), 24967 createObjectExpression([keyProperty]), 24968 children, 24969 patchFlag, 24970 void 0, 24971 void 0, 24972 true, 24973 false, 24974 false, 24975 branch.loc 24976 ); 24977 } 24978 } else { 24979 const ret = firstChild.codegenNode; 24980 const vnodeCall = getMemoedVNodeCall(ret); 24981 if (vnodeCall.type === 13) { 24982 convertToBlock(vnodeCall, context); 24983 } 24984 injectProp(vnodeCall, keyProperty, context); 24985 return ret; 24986 } 24987} 24988function getParentCondition(node) { 24989 while (true) { 24990 if (node.type === 19) { 24991 if (node.alternate.type === 19) { 24992 node = node.alternate; 24993 } else { 24994 return node; 24995 } 24996 } else if (node.type === 20) { 24997 node = node.value; 24998 } 24999 } 25000} 25001const transformBind = (dir, _node, context) => { 25002 const { modifiers, loc } = dir; 25003 const arg = dir.arg; 25004 let { exp } = dir; 25005 if (exp && exp.type === 4 && !exp.content.trim()) { 25006 { 25007 exp = void 0; 25008 } 25009 } 25010 if (!exp) { 25011 if (arg.type !== 4 || !arg.isStatic) { 25012 context.onError( 25013 createCompilerError( 25014 52, 25015 arg.loc 25016 ) 25017 ); 25018 return { 25019 props: [ 25020 createObjectProperty(arg, createSimpleExpression("", true, loc)) 25021 ] 25022 }; 25023 } 25024 transformBindShorthand(dir); 25025 exp = dir.exp; 25026 } 25027 if (arg.type !== 4) { 25028 arg.children.unshift(`(`); 25029 arg.children.push(`) || ""`); 25030 } else if (!arg.isStatic) { 25031 arg.content = `${arg.content} || ""`; 25032 } 25033 if (modifiers.some((mod) => mod.content === "camel")) { 25034 if (arg.type === 4) { 25035 if (arg.isStatic) { 25036 arg.content = camelize(arg.content); 25037 } else { 25038 arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`; 25039 } 25040 } else { 25041 arg.children.unshift(`${context.helperString(CAMELIZE)}(`); 25042 arg.children.push(`)`); 25043 } 25044 } 25045 if (!context.inSSR) { 25046 if (modifiers.some((mod) => mod.content === "prop")) { 25047 injectPrefix(arg, "."); 25048 } 25049 if (modifiers.some((mod) => mod.content === "attr")) { 25050 injectPrefix(arg, "^"); 25051 } 25052 } 25053 return { 25054 props: [createObjectProperty(arg, exp)] 25055 }; 25056}; 25057const transformBindShorthand = (dir, context) => { 25058 const arg = dir.arg; 25059 const propName = camelize(arg.content); 25060 dir.exp = createSimpleExpression(propName, false, arg.loc); 25061}; 25062const injectPrefix = (arg, prefix) => { 25063 if (arg.type === 4) { 25064 if (arg.isStatic) { 25065 arg.content = prefix + arg.content; 25066 } else { 25067 arg.content = `\`${prefix}\${${arg.content}}\``; 25068 } 25069 } else { 25070 arg.children.unshift(`'${prefix}' + (`); 25071 arg.children.push(`)`); 25072 } 25073}; 25074const transformFor = createStructuralDirectiveTransform( 25075 "for", 25076 (node, dir, context) => { 25077 const { helper, removeHelper } = context;
25078 return processFor(node, dir, context, (forNode) => { 25079 const renderExp = createCallExpression(helper(RENDER_LIST), [ 25080 forNode.source 25081 ]); 25082 const isTemplate = isTemplateNode(node); 25083 const memo = findDir(node, "memo"); 25084 const keyProp = findProp(node, `key`, false, true); 25085 const isDirKey = keyProp && keyProp.type === 7; 25086 if (isDirKey && !keyProp.exp) { 25087 transformBindShorthand(keyProp); 25088 } 25089 let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp); 25090 const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null; 25091 const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0; 25092 const fragmentFlag = isStableFragment ? 64 : keyProp ? 128 : 256; 25093 forNode.codegenNode = createVNodeCall( 25094 context, 25095 helper(FRAGMENT), 25096 void 0, 25097 renderExp, 25098 fragmentFlag, 25099 void 0, 25100 void 0, 25101 true, 25102 !isStableFragment, 25103 false, 25104 node.loc 25105 ); 25106 return () => { 25107 let childBlock; 25108 const { children } = forNode; 25109 const needFragmentWrapper = children.length !== 1 || children[0].type !== 1; 25110 const slotOutlet = isSlotOutlet(node) ? node : isTemplate && node.children.length === 1 && isSlotOutlet(node.children[0]) ? node.children[0] : null; 25111 if (slotOutlet) { 25112 childBlock = slotOutlet.codegenNode; 25113 if (isTemplate && keyProperty) { 25114 injectProp(childBlock, keyProperty, context); 25115 } 25116 } else if (needFragmentWrapper) { 25117 childBlock = createVNodeCall( 25118 context, 25119 helper(FRAGMENT), 25120 keyProperty ? createObjectExpression([keyProperty]) : void 0, 25121 node.children, 25122 64, 25123 void 0, 25124 void 0, 25125 true, 25126 void 0, 25127 false 25128 ); 25129 } else { 25130 childBlock = children[0].codegenNode; 25131 if (isTemplate && keyProperty) { 25132 injectProp(childBlock, keyProperty, context); 25133 } 25134 if (childBlock.isBlock !== !isStableFragment) { 25135 if (childBlock.isBlock) { 25136 removeHelper(OPEN_BLOCK); 25137 removeHelper( 25138 getVNodeBlockHelper(context.inSSR, childBlock.isComponent) 25139 ); 25140 } else { 25141 removeHelper( 25142 getVNodeHelper(context.inSSR, childBlock.isComponent) 25143 ); 25144 } 25145 } 25146 childBlock.isBlock = !isStableFragment; 25147 if (childBlock.isBlock) { 25148 helper(OPEN_BLOCK); 25149 helper(getVNodeBlockHelper(context.inSSR, childBlock.isComponent)); 25150 } else { 25151 helper(getVNodeHelper(context.inSSR, childBlock.isComponent)); 25152 } 25153 } 25154 if (memo) { 25155 const loop = createFunctionExpression( 25156 createForLoopParams(forNode.parseResult, [ 25157 createSimpleExpression(`_cached`) 25158 ]) 25159 ); 25160 loop.body = createBlockStatement([ 25161 createCompoundExpression([`const _memo = (`, memo.exp, `)`]), 25162 createCompoundExpression([ 25163 `if (_cached`, 25164 ...keyExp ? [` && _cached.key === `, keyExp] : [], 25165 ` && ${context.helperString( 25166 IS_MEMO_SAME 25167 )}(_cached, _memo)) return _cached` 25168 ]), 25169 createCompoundExpression([`const _item = `, childBlock]), 25170 createSimpleExpression(`_item.memo = _memo`), 25171 createSimpleExpression(`return _item`) 25172 ]); 25173 renderExp.arguments.push( 25174 loop, 25175 createSimpleExpression(`_cache`), 25176 createSimpleExpression(String(context.cached.length)) 25177 ); 25178 context.cached.push(null); 25179 } else { 25180 renderExp.arguments.push( 25181 createFunctionExpression( 25182 createForLoopParams(forNode.parseResult), 25183 childBlock, 25184 true 25185 ) 25186 ); 25187 } 25188 }; 25189 }); 25190 } 25191);
vendor: 6,533 bytes, lines 25192-25416
25192function processFor(node, dir, context, processCodegen) { 25193 if (!dir.exp) { 25194 context.onError( 25195 createCompilerError(31, dir.loc) 25196 ); 25197 return; 25198 } 25199 const parseResult = dir.forParseResult; 25200 if (!parseResult) { 25201 context.onError( 25202 createCompilerError(32, dir.loc) 25203 ); 25204 return; 25205 } 25206 finalizeForParseResult(parseResult); 25207 const { addIdentifiers, removeIdentifiers, scopes } = context; 25208 const { source, value, key, index } = parseResult; 25209 const forNode = { 25210 type: 11, 25211 loc: dir.loc, 25212 source, 25213 valueAlias: value, 25214 keyAlias: key, 25215 objectIndexAlias: index, 25216 parseResult, 25217 children: isTemplateNode(node) ? node.children : [node] 25218 }; 25219 context.replaceNode(forNode); 25220 scopes.vFor++; 25221 const onExit = processCodegen && processCodegen(forNode); 25222 return () => { 25223 scopes.vFor--; 25224 if (onExit) onExit(); 25225 }; 25226} 25227function finalizeForParseResult(result, context) { 25228 if (result.finalized) return; 25229 result.finalized = true; 25230} 25231function createForLoopParams({ value, key, index }, memoArgs = []) { 25232 return createParamsList([value, key, index, ...memoArgs]); 25233} 25234function createParamsList(args) { 25235 let i2 = args.length; 25236 while (i2--) { 25237 if (args[i2]) break; 25238 } 25239 return args.slice(0, i2 + 1).map((arg, i22) => arg || createSimpleExpression(`_`.repeat(i22 + 1), false)); 25240} 25241const defaultFallback = createSimpleExpression(`undefined`, false); 25242const trackSlotScopes = (node, context) => { 25243 if (node.type === 1 && (node.tagType === 1 || node.tagType === 3)) { 25244 const vSlot = findDir(node, "slot"); 25245 if (vSlot) { 25246 vSlot.exp; 25247 context.scopes.vSlot++; 25248 return () => { 25249 context.scopes.vSlot--; 25250 }; 25251 } 25252 } 25253}; 25254const trackVForSlotScopes = (node, context) => { 25255 let vFor; 25256 if (isTemplateNode(node) && node.props.some(isVSlot) && (vFor = findDir(node, "for"))) { 25257 const result = vFor.forParseResult; 25258 if (result) { 25259 finalizeForParseResult(result); 25260 const { value, key, index } = result; 25261 const { addIdentifiers, removeIdentifiers } = context; 25262 value && addIdentifiers(value); 25263 key && addIdentifiers(key); 25264 index && addIdentifiers(index); 25265 return () => { 25266 value && removeIdentifiers(value); 25267 key && removeIdentifiers(key); 25268 index && removeIdentifiers(index); 25269 }; 25270 } 25271 } 25272}; 25273const buildClientSlotFn = (props, _vForExp, children, loc) => createFunctionExpression( 25274 props, 25275 children, 25276 false, 25277 true, 25278 children.length ? children[0].loc : loc 25279); 25280function buildSlots(node, context, buildSlotFn = buildClientSlotFn) { 25281 context.helper(WITH_CTX); 25282 const { children, loc } = node; 25283 const slotsProperties = []; 25284 const dynamicSlots = []; 25285 let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0; 25286 const onComponentSlot = findDir(node, "slot", true); 25287 if (onComponentSlot) { 25288 const { arg, exp } = onComponentSlot; 25289 if (arg && !isStaticExp(arg)) { 25290 hasDynamicSlots = true; 25291 } 25292 slotsProperties.push( 25293 createObjectProperty( 25294 arg || createSimpleExpression("default", true), 25295 buildSlotFn(exp, void 0, children, loc) 25296 ) 25297 ); 25298 } 25299 let hasTemplateSlots = false; 25300 let hasNamedDefaultSlot = false; 25301 const implicitDefaultChildren = []; 25302 const seenSlotNames = /* @__PURE__ */ new Set(); 25303 let conditionalBranchIndex = 0; 25304 for (let i2 = 0; i2 < children.length; i2++) { 25305 const slotElement = children[i2]; 25306 let slotDir; 25307 if (!isTemplateNode(slotElement) || !(slotDir = findDir(slotElement, "slot", true))) { 25308 if (slotElement.type !== 3) { 25309 implicitDefaultChildren.push(slotElement); 25310 } 25311 continue; 25312 } 25313 if (onComponentSlot) { 25314 context.onError( 25315 createCompilerError(37, slotDir.loc) 25316 ); 25317 break; 25318 } 25319 hasTemplateSlots = true; 25320 const { children: slotChildren, loc: slotLoc } = slotElement; 25321 const { 25322 arg: slotName = createSimpleExpression(`default`, true), 25323 exp: slotProps, 25324 loc: dirLoc 25325 } = slotDir; 25326 let staticSlotName; 25327 if (isStaticExp(slotName)) { 25328 staticSlotName = slotName ? slotName.content : `default`; 25329 } else { 25330 hasDynamicSlots = true; 25331 } 25332 const vFor = findDir(slotElement, "for"); 25333 const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc); 25334 let vIf; 25335 let vElse; 25336 if (vIf = findDir(slotElement, "if")) { 25337 hasDynamicSlots = true; 25338 dynamicSlots.push( 25339 createConditionalExpression( 25340 vIf.exp, 25341 buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++), 25342 defaultFallback 25343 ) 25344 ); 25345 } else if (vElse = findDir( 25346 slotElement, 25347 /^else(-if)?$/, 25348 true 25349 /* allowEmpty */ 25350 )) { 25351 let j = i2; 25352 let prev; 25353 while (j--) { 25354 prev = children[j]; 25355 if (prev.type !== 3) { 25356 break; 25357 } 25358 } 25359 if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) { 25360 let conditional = dynamicSlots[dynamicSlots.length - 1]; 25361 while (conditional.alternate.type === 19) { 25362 conditional = conditional.alternate; 25363 } 25364 conditional.alternate = vElse.exp ? createConditionalExpression( 25365 vElse.exp, 25366 buildDynamicSlot( 25367 slotName, 25368 slotFunction, 25369 conditionalBranchIndex++ 25370 ), 25371 defaultFallback 25372 ) : buildDynamicSlot(slotName, slotFunction, conditionalBranchIndex++); 25373 } else { 25374 context.onError( 25375 createCompilerError(30, vElse.loc) 25376 ); 25377 } 25378 } else if (vFor) { 25379 hasDynamicSlots = true; 25380 const parseResult = vFor.forParseResult; 25381 if (parseResult) { 25382 finalizeForParseResult(parseResult); 25383 dynamicSlots.push( 25384 createCallExpression(context.helper(RENDER_LIST), [ 25385 parseResult.source, 25386 createFunctionExpression( 25387 createForLoopParams(parseResult), 25388 buildDynamicSlot(slotName, slotFunction), 25389 true 25390 ) 25391 ]) 25392 ); 25393 } else { 25394 context.onError( 25395 createCompilerError( 25396 32, 25397 vFor.loc 25398 ) 25399 ); 25400 } 25401 } else { 25402 if (staticSlotName) { 25403 if (seenSlotNames.has(staticSlotName)) { 25404 context.onError( 25405 createCompilerError( 25406 38, 25407 dirLoc 25408 ) 25409 ); 25410 continue; 25411 } 25412 seenSlotNames.add(staticSlotName); 25413 if (staticSlotName === "default") { 25414 hasNamedDefaultSlot = true; 25415 } 25416 }
25417 slotsProperties.push(createObjectProperty(slotName, slotFunction)); 25418 } 25419 } 25420 if (!onComponentSlot) { 25421 const buildDefaultSlotProperty = (props, children2) => { 25422 const fn = buildSlotFn(props, void 0, children2, loc); 25423 if (context.compatConfig) { 25424 fn.isNonScopedSlot = true; 25425 } 25426 return createObjectProperty(`default`, fn); 25427 }; 25428 if (!hasTemplateSlots) { 25429 slotsProperties.push(buildDefaultSlotProperty(void 0, children)); 25430 } else if (implicitDefaultChildren.length && // #3766 25431 // with whitespace: 'preserve', whitespaces between slots will end up in 25432 // implicitDefaultChildren. Ignore if all implicit children are whitespaces. 25433 implicitDefaultChildren.some((node2) => isNonWhitespaceContent(node2))) { 25434 if (hasNamedDefaultSlot) { 25435 context.onError( 25436 createCompilerError( 25437 39, 25438 implicitDefaultChildren[0].loc 25439 ) 25440 ); 25441 } else { 25442 slotsProperties.push( 25443 buildDefaultSlotProperty(void 0, implicitDefaultChildren) 25444 ); 25445 } 25446 } 25447 } 25448 const slotFlag = hasDynamicSlots ? 2 : hasForwardedSlots(node.children) ? 3 : 1; 25449 let slots = createObjectExpression( 25450 slotsProperties.concat( 25451 createObjectProperty( 25452 `_`, 25453 // 2 = compiled but dynamic = can skip normalization, but must run diff 25454 // 1 = compiled and static = can skip normalization AND diff as optimized 25455 createSimpleExpression( 25456 slotFlag + ``, 25457 false 25458 ) 25459 ) 25460 ), 25461 loc 25462 ); 25463 if (dynamicSlots.length) { 25464 slots = createCallExpression(context.helper(CREATE_SLOTS), [ 25465 slots, 25466 createArrayExpression(dynamicSlots) 25467 ]); 25468 } 25469 return { 25470 slots, 25471 hasDynamicSlots 25472 }; 25473} 25474function buildDynamicSlot(name, fn, index) { 25475 const props = [ 25476 createObjectProperty(`name`, name), 25477 createObjectProperty(`fn`, fn) 25478 ]; 25479 if (index != null) { 25480 props.push( 25481 createObjectProperty(`key`, createSimpleExpression(String(index), true)) 25482 ); 25483 } 25484 return createObjectExpression(props); 25485} 25486function hasForwardedSlots(children) { 25487 for (let i2 = 0; i2 < children.length; i2++) { 25488 const child = children[i2]; 25489 switch (child.type) { 25490 case 1: 25491 if (child.tagType === 2 || hasForwardedSlots(child.children)) { 25492 return true; 25493 } 25494 break; 25495 case 9: 25496 if (hasForwardedSlots(child.branches)) return true; 25497 break; 25498 case 10: 25499 case 11: 25500 if (hasForwardedSlots(child.children)) return true; 25501 break; 25502 } 25503 } 25504 return false; 25505} 25506function isNonWhitespaceContent(node) { 25507 if (node.type !== 2 && node.type !== 12) 25508 return true; 25509 return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content); 25510} 25511const directiveImportMap = /* @__PURE__ */ new WeakMap(); 25512const transformElement = (node, context) => { 25513 return function postTransformElement() { 25514 node = context.currentNode; 25515 if (!(node.type === 1 && (node.tagType === 0 || node.tagType === 1))) { 25516 return; 25517 } 25518 const { tag, props } = node; 25519 const isComponent2 = node.tagType === 1; 25520 let vnodeTag = isComponent2 ? resolveComponentType(node, context) : `"${tag}"`; 25521 const isDynamicComponent = isObject$1(vnodeTag) && vnodeTag.callee === RESOLVE_DYNAMIC_COMPONENT; 25522 let vnodeProps; 25523 let vnodeChildren; 25524 let patchFlag = 0; 25525 let vnodeDynamicProps; 25526 let dynamicPropNames; 25527 let vnodeDirectives; 25528 let shouldUseBlock = ( 25529 // dynamic component may resolve to plain elements 25530 isDynamicComponent || vnodeTag === TELEPORT || vnodeTag === SUSPENSE || !isComponent2 && // <svg> and <foreignObject> must be forced into blocks so that block 25531 // updates inside get proper isSVG flag at runtime. (#639, #643) 25532 // This is technically web-specific, but splitting the logic out of core 25533 // leads to too much unnecessary complexity. 25534 (tag === "svg" || tag === "foreignObject" || tag === "math") 25535 ); 25536 if (props.length > 0) { 25537 const propsBuildResult = buildProps( 25538 node, 25539 context, 25540 void 0, 25541 isComponent2, 25542 isDynamicComponent 25543 ); 25544 vnodeProps = propsBuildResult.props; 25545 patchFlag = propsBuildResult.patchFlag; 25546 dynamicPropNames = propsBuildResult.dynamicPropNames; 25547 const directives = propsBuildResult.directives; 25548 vnodeDirectives = directives && directives.length ? createArrayExpression( 25549 directives.map((dir) => buildDirectiveArgs(dir, context)) 25550 ) : void 0; 25551 if (propsBuildResult.shouldUseBlock) { 25552 shouldUseBlock = true; 25553 } 25554 } 25555 if (node.children.length > 0) { 25556 if (vnodeTag === KEEP_ALIVE) { 25557 shouldUseBlock = true; 25558 patchFlag |= 1024; 25559 } 25560 const shouldBuildAsSlots = isComponent2 && // Teleport is not a real component and has dedicated runtime handling 25561 vnodeTag !== TELEPORT && // explained above. 25562 vnodeTag !== KEEP_ALIVE; 25563 if (shouldBuildAsSlots) { 25564 const { slots, hasDynamicSlots } = buildSlots(node, context); 25565 vnodeChildren = slots; 25566 if (hasDynamicSlots) { 25567 patchFlag |= 1024; 25568 } 25569 } else if (node.children.length === 1 && vnodeTag !== TELEPORT) { 25570 const child = node.children[0]; 25571 const type = child.type; 25572 const hasDynamicTextChild = type === 5 || type === 8;
vendor: 6,675 bytes, lines 25573-25795
25573 if (hasDynamicTextChild && getConstantType(child, context) === 0) { 25574 patchFlag |= 1; 25575 } 25576 if (hasDynamicTextChild || type === 2) { 25577 vnodeChildren = child; 25578 } else { 25579 vnodeChildren = node.children; 25580 } 25581 } else { 25582 vnodeChildren = node.children; 25583 } 25584 } 25585 if (dynamicPropNames && dynamicPropNames.length) { 25586 vnodeDynamicProps = stringifyDynamicPropNames(dynamicPropNames); 25587 } 25588 node.codegenNode = createVNodeCall( 25589 context, 25590 vnodeTag, 25591 vnodeProps, 25592 vnodeChildren, 25593 patchFlag === 0 ? void 0 : patchFlag, 25594 vnodeDynamicProps, 25595 vnodeDirectives, 25596 !!shouldUseBlock, 25597 false, 25598 isComponent2, 25599 node.loc 25600 ); 25601 }; 25602}; 25603function resolveComponentType(node, context, ssr = false) { 25604 let { tag } = node; 25605 const isExplicitDynamic = isComponentTag(tag); 25606 const isProp = findProp( 25607 node, 25608 "is", 25609 false, 25610 true 25611 /* allow empty */ 25612 ); 25613 if (isProp) { 25614 if (isExplicitDynamic || isCompatEnabled( 25615 "COMPILER_IS_ON_ELEMENT", 25616 context 25617 )) { 25618 let exp; 25619 if (isProp.type === 6) { 25620 exp = isProp.value && createSimpleExpression(isProp.value.content, true); 25621 } else { 25622 exp = isProp.exp; 25623 if (!exp) { 25624 exp = createSimpleExpression(`is`, false, isProp.arg.loc); 25625 } 25626 } 25627 if (exp) { 25628 return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [ 25629 exp 25630 ]); 25631 } 25632 } else if (isProp.type === 6 && isProp.value.content.startsWith("vue:")) { 25633 tag = isProp.value.content.slice(4); 25634 } 25635 } 25636 const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag); 25637 if (builtIn) { 25638 if (!ssr) context.helper(builtIn); 25639 return builtIn; 25640 } 25641 context.helper(RESOLVE_COMPONENT); 25642 context.components.add(tag); 25643 return toValidAssetId(tag, `component`); 25644} 25645function buildProps(node, context, props = node.props, isComponent2, isDynamicComponent, ssr = false) { 25646 const { tag, loc: elementLoc, children } = node; 25647 let properties = []; 25648 const mergeArgs = []; 25649 const runtimeDirectives = []; 25650 const hasChildren = children.length > 0; 25651 let shouldUseBlock = false; 25652 let patchFlag = 0; 25653 let hasRef = false; 25654 let hasClassBinding = false; 25655 let hasStyleBinding = false; 25656 let hasHydrationEventBinding = false; 25657 let hasDynamicKeys = false; 25658 let hasVnodeHook = false; 25659 const dynamicPropNames = []; 25660 const pushMergeArg = (arg) => { 25661 if (properties.length) { 25662 mergeArgs.push( 25663 createObjectExpression(dedupeProperties(properties), elementLoc) 25664 ); 25665 properties = []; 25666 } 25667 if (arg) mergeArgs.push(arg); 25668 }; 25669 const pushRefVForMarker = () => { 25670 if (context.scopes.vFor > 0) { 25671 properties.push( 25672 createObjectProperty( 25673 createSimpleExpression("ref_for", true), 25674 createSimpleExpression("true") 25675 ) 25676 ); 25677 } 25678 }; 25679 const analyzePatchFlag = ({ key, value }) => { 25680 if (isStaticExp(key)) { 25681 const name = key.content; 25682 const isEventHandler = isOn(name); 25683 if (isEventHandler && (!isComponent2 || isDynamicComponent) && // omit the flag for click handlers because hydration gives click 25684 // dedicated fast path. 25685 name.toLowerCase() !== "onclick" && // omit v-model handlers 25686 name !== "onUpdate:modelValue" && // omit onVnodeXXX hooks 25687 !isReservedProp(name)) { 25688 hasHydrationEventBinding = true; 25689 } 25690 if (isEventHandler && isReservedProp(name)) { 25691 hasVnodeHook = true; 25692 } 25693 if (isEventHandler && value.type === 14) { 25694 value = value.arguments[0]; 25695 } 25696 if (value.type === 20 || (value.type === 4 || value.type === 8) && getConstantType(value, context) > 0) { 25697 return; 25698 } 25699 if (name === "ref") { 25700 hasRef = true; 25701 } else if (name === "class") { 25702 hasClassBinding = true; 25703 } else if (name === "style") { 25704 hasStyleBinding = true; 25705 } else if (name !== "key" && !dynamicPropNames.includes(name)) { 25706 dynamicPropNames.push(name); 25707 } 25708 if (isComponent2 && (name === "class" || name === "style") && !dynamicPropNames.includes(name)) { 25709 dynamicPropNames.push(name); 25710 } 25711 } else { 25712 hasDynamicKeys = true; 25713 } 25714 }; 25715 for (let i2 = 0; i2 < props.length; i2++) { 25716 const prop = props[i2]; 25717 if (prop.type === 6) { 25718 const { loc, name, nameLoc, value } = prop; 25719 let isStatic = true; 25720 if (name === "ref") { 25721 hasRef = true; 25722 pushRefVForMarker(); 25723 } 25724 if (name === "is" && (isComponentTag(tag) || value && value.content.startsWith("vue:") || isCompatEnabled( 25725 "COMPILER_IS_ON_ELEMENT", 25726 context 25727 ))) { 25728 continue; 25729 } 25730 properties.push( 25731 createObjectProperty( 25732 createSimpleExpression(name, true, nameLoc), 25733 createSimpleExpression( 25734 value ? value.content : "", 25735 isStatic, 25736 value ? value.loc : loc 25737 ) 25738 ) 25739 ); 25740 } else { 25741 const { name, arg, exp, loc, modifiers } = prop; 25742 const isVBind = name === "bind"; 25743 const isVOn = name === "on"; 25744 if (name === "slot") { 25745 if (!isComponent2) { 25746 context.onError( 25747 createCompilerError(40, loc) 25748 ); 25749 } 25750 continue; 25751 } 25752 if (name === "once" || name === "memo") { 25753 continue; 25754 } 25755 if (name === "is" || isVBind && isStaticArgOf(arg, "is") && (isComponentTag(tag) || isCompatEnabled( 25756 "COMPILER_IS_ON_ELEMENT", 25757 context 25758 ))) { 25759 continue; 25760 } 25761 if (isVOn && ssr) { 25762 continue; 25763 } 25764 if ( 25765 // #938: elements with dynamic keys should be forced into blocks 25766 isVBind && isStaticArgOf(arg, "key") || // inline before-update hooks need to force block so that it is invoked 25767 // before children 25768 isVOn && hasChildren && isStaticArgOf(arg, "vue:before-update") 25769 ) { 25770 shouldUseBlock = true; 25771 } 25772 if (isVBind && isStaticArgOf(arg, "ref")) { 25773 pushRefVForMarker(); 25774 } 25775 if (!arg && (isVBind || isVOn)) { 25776 hasDynamicKeys = true; 25777 if (exp) { 25778 if (isVBind) { 25779 pushRefVForMarker(); 25780 pushMergeArg(); 25781 { 25782 if (isCompatEnabled( 25783 "COMPILER_V_BIND_OBJECT_ORDER", 25784 context 25785 )) { 25786 mergeArgs.unshift(exp); 25787 continue; 25788 } 25789 } 25790 mergeArgs.push(exp); 25791 } else { 25792 pushMergeArg({ 25793 type: 14, 25794 loc, 25795 callee: context.helper(TO_HANDLERS),
vendor: 8,629 bytes, lines 25796-26104
25796 arguments: isComponent2 ? [exp] : [exp, `true`] 25797 }); 25798 } 25799 } else { 25800 context.onError( 25801 createCompilerError( 25802 isVBind ? 34 : 35, 25803 loc 25804 ) 25805 ); 25806 } 25807 continue; 25808 } 25809 if (isVBind && modifiers.some((mod) => mod.content === "prop")) { 25810 patchFlag |= 32; 25811 } 25812 const directiveTransform = context.directiveTransforms[name]; 25813 if (directiveTransform) { 25814 const { props: props2, needRuntime } = directiveTransform(prop, node, context); 25815 !ssr && props2.forEach(analyzePatchFlag); 25816 if (isVOn && arg && !isStaticExp(arg)) { 25817 pushMergeArg(createObjectExpression(props2, elementLoc)); 25818 } else { 25819 properties.push(...props2); 25820 } 25821 if (needRuntime) { 25822 runtimeDirectives.push(prop); 25823 if (isSymbol(needRuntime)) { 25824 directiveImportMap.set(prop, needRuntime); 25825 } 25826 } 25827 } else if (!isBuiltInDirective(name)) { 25828 runtimeDirectives.push(prop); 25829 if (hasChildren) { 25830 shouldUseBlock = true; 25831 } 25832 } 25833 } 25834 } 25835 let propsExpression = void 0; 25836 if (mergeArgs.length) { 25837 pushMergeArg(); 25838 if (mergeArgs.length > 1) { 25839 propsExpression = createCallExpression( 25840 context.helper(MERGE_PROPS), 25841 mergeArgs, 25842 elementLoc 25843 ); 25844 } else { 25845 propsExpression = mergeArgs[0]; 25846 } 25847 } else if (properties.length) { 25848 propsExpression = createObjectExpression( 25849 dedupeProperties(properties), 25850 elementLoc 25851 ); 25852 } 25853 if (hasDynamicKeys) { 25854 patchFlag |= 16; 25855 } else { 25856 if (hasClassBinding && !isComponent2) { 25857 patchFlag |= 2; 25858 } 25859 if (hasStyleBinding && !isComponent2) { 25860 patchFlag |= 4; 25861 } 25862 if (dynamicPropNames.length) { 25863 patchFlag |= 8; 25864 } 25865 if (hasHydrationEventBinding) { 25866 patchFlag |= 32; 25867 } 25868 } 25869 if (!shouldUseBlock && (patchFlag === 0 || patchFlag === 32) && (hasRef || hasVnodeHook || runtimeDirectives.length > 0)) { 25870 patchFlag |= 512; 25871 } 25872 if (!context.inSSR && propsExpression) { 25873 switch (propsExpression.type) { 25874 case 15: 25875 let classKeyIndex = -1; 25876 let styleKeyIndex = -1; 25877 let hasDynamicKey = false; 25878 for (let i2 = 0; i2 < propsExpression.properties.length; i2++) { 25879 const key = propsExpression.properties[i2].key; 25880 if (isStaticExp(key)) { 25881 if (key.content === "class") { 25882 classKeyIndex = i2; 25883 } else if (key.content === "style") { 25884 styleKeyIndex = i2; 25885 } 25886 } else if (!key.isHandlerKey) { 25887 hasDynamicKey = true; 25888 } 25889 } 25890 const classProp = propsExpression.properties[classKeyIndex]; 25891 const styleProp = propsExpression.properties[styleKeyIndex]; 25892 if (!hasDynamicKey) { 25893 if (classProp && !isStaticExp(classProp.value)) { 25894 classProp.value = createCallExpression( 25895 context.helper(NORMALIZE_CLASS), 25896 [classProp.value] 25897 ); 25898 } 25899 if (styleProp && // the static style is compiled into an object, 25900 // so use `hasStyleBinding` to ensure that it is a dynamic style binding 25901 (hasStyleBinding || styleProp.value.type === 4 && styleProp.value.content.trim()[0] === `[` || // v-bind:style and style both exist, 25902 // v-bind:style with static literal object 25903 styleProp.value.type === 17)) { 25904 styleProp.value = createCallExpression( 25905 context.helper(NORMALIZE_STYLE), 25906 [styleProp.value] 25907 ); 25908 } 25909 } else { 25910 propsExpression = createCallExpression( 25911 context.helper(NORMALIZE_PROPS), 25912 [propsExpression] 25913 ); 25914 } 25915 break; 25916 case 14: 25917 break; 25918 default: 25919 propsExpression = createCallExpression( 25920 context.helper(NORMALIZE_PROPS), 25921 [ 25922 createCallExpression(context.helper(GUARD_REACTIVE_PROPS), [ 25923 propsExpression 25924 ]) 25925 ] 25926 ); 25927 break; 25928 } 25929 } 25930 return { 25931 props: propsExpression, 25932 directives: runtimeDirectives, 25933 patchFlag, 25934 dynamicPropNames, 25935 shouldUseBlock 25936 }; 25937} 25938function dedupeProperties(properties) { 25939 const knownProps = /* @__PURE__ */ new Map(); 25940 const deduped = []; 25941 for (let i2 = 0; i2 < properties.length; i2++) { 25942 const prop = properties[i2]; 25943 if (prop.key.type === 8 || !prop.key.isStatic) { 25944 deduped.push(prop); 25945 continue; 25946 } 25947 const name = prop.key.content; 25948 const existing = knownProps.get(name); 25949 if (existing) { 25950 if (name === "style" || name === "class" || isOn(name)) { 25951 mergeAsArray(existing, prop); 25952 } 25953 } else { 25954 knownProps.set(name, prop); 25955 deduped.push(prop); 25956 } 25957 } 25958 return deduped; 25959} 25960function mergeAsArray(existing, incoming) { 25961 if (existing.value.type === 17) { 25962 existing.value.elements.push(incoming.value); 25963 } else { 25964 existing.value = createArrayExpression( 25965 [existing.value, incoming.value], 25966 existing.loc 25967 ); 25968 } 25969} 25970function buildDirectiveArgs(dir, context) { 25971 const dirArgs = []; 25972 const runtime = directiveImportMap.get(dir); 25973 if (runtime) { 25974 dirArgs.push(context.helperString(runtime)); 25975 } else { 25976 { 25977 context.helper(RESOLVE_DIRECTIVE); 25978 context.directives.add(dir.name); 25979 dirArgs.push(toValidAssetId(dir.name, `directive`)); 25980 } 25981 } 25982 const { loc } = dir; 25983 if (dir.exp) dirArgs.push(dir.exp); 25984 if (dir.arg) { 25985 if (!dir.exp) { 25986 dirArgs.push(`void 0`); 25987 } 25988 dirArgs.push(dir.arg); 25989 } 25990 if (Object.keys(dir.modifiers).length) { 25991 if (!dir.arg) { 25992 if (!dir.exp) { 25993 dirArgs.push(`void 0`); 25994 } 25995 dirArgs.push(`void 0`); 25996 } 25997 const trueExpression = createSimpleExpression(`true`, false, loc); 25998 dirArgs.push( 25999 createObjectExpression( 26000 dir.modifiers.map( 26001 (modifier) => createObjectProperty(modifier, trueExpression) 26002 ), 26003 loc 26004 ) 26005 ); 26006 } 26007 return createArrayExpression(dirArgs, dir.loc); 26008} 26009function stringifyDynamicPropNames(props) { 26010 let propsNamesString = `[`; 26011 for (let i2 = 0, l = props.length; i2 < l; i2++) { 26012 propsNamesString += JSON.stringify(props[i2]); 26013 if (i2 < l - 1) propsNamesString += ", "; 26014 } 26015 return propsNamesString + `]`; 26016} 26017function isComponentTag(tag) { 26018 return tag === "component" || tag === "Component"; 26019} 26020const transformSlotOutlet = (node, context) => { 26021 if (isSlotOutlet(node)) { 26022 const { children, loc } = node; 26023 const { slotName, slotProps } = processSlotOutlet(node, context); 26024 const slotArgs = [ 26025 context.prefixIdentifiers ? `_ctx.$slots` : `$slots`, 26026 slotName, 26027 "{}", 26028 "undefined", 26029 "true" 26030 ]; 26031 let expectedLen = 2; 26032 if (slotProps) { 26033 slotArgs[2] = slotProps; 26034 expectedLen = 3; 26035 } 26036 if (children.length) { 26037 slotArgs[3] = createFunctionExpression([], children, false, false, loc); 26038 expectedLen = 4; 26039 } 26040 if (context.scopeId && !context.slotted) { 26041 expectedLen = 5; 26042 } 26043 slotArgs.splice(expectedLen); 26044 node.codegenNode = createCallExpression( 26045 context.helper(RENDER_SLOT), 26046 slotArgs, 26047 loc 26048 ); 26049 } 26050}; 26051function processSlotOutlet(node, context) { 26052 let slotName = `"default"`; 26053 let slotProps = void 0; 26054 const nonNameProps = []; 26055 for (let i2 = 0; i2 < node.props.length; i2++) { 26056 const p2 = node.props[i2]; 26057 if (p2.type === 6) { 26058 if (p2.value) { 26059 if (p2.name === "name") { 26060 slotName = JSON.stringify(p2.value.content); 26061 } else { 26062 p2.name = camelize(p2.name); 26063 nonNameProps.push(p2); 26064 } 26065 } 26066 } else { 26067 if (p2.name === "bind" && isStaticArgOf(p2.arg, "name")) { 26068 if (p2.exp) { 26069 slotName = p2.exp; 26070 } else if (p2.arg && p2.arg.type === 4) { 26071 const name = camelize(p2.arg.content); 26072 slotName = p2.exp = createSimpleExpression(name, false, p2.arg.loc); 26073 } 26074 } else { 26075 if (p2.name === "bind" && p2.arg && isStaticExp(p2.arg)) { 26076 p2.arg.content = camelize(p2.arg.content); 26077 } 26078 nonNameProps.push(p2); 26079 } 26080 } 26081 } 26082 if (nonNameProps.length > 0) { 26083 const { props, directives } = buildProps( 26084 node, 26085 context, 26086 nonNameProps, 26087 false, 26088 false 26089 ); 26090 slotProps = props; 26091 if (directives.length) { 26092 context.onError( 26093 createCompilerError( 26094 36, 26095 directives[0].loc 26096 ) 26097 ); 26098 } 26099 } 26100 return { 26101 slotName, 26102 slotProps 26103 }; 26104}
vendor: 13,865 bytes, lines 26105-26570
26105const transformOn$1 = (dir, node, context, augmentor) => { 26106 const { loc, modifiers, arg } = dir; 26107 if (!dir.exp && !modifiers.length) { 26108 context.onError(createCompilerError(35, loc)); 26109 } 26110 let eventName; 26111 if (arg.type === 4) { 26112 if (arg.isStatic) { 26113 let rawName = arg.content; 26114 if (rawName.startsWith("vue:")) { 26115 rawName = `vnode-${rawName.slice(4)}`; 26116 } 26117 const eventString = node.tagType !== 0 || rawName.startsWith("vnode") || !/[A-Z]/.test(rawName) ? ( 26118 // for non-element and vnode lifecycle event listeners, auto convert 26119 // it to camelCase. See issue #2249 26120 toHandlerKey(camelize(rawName)) 26121 ) : ( 26122 // preserve case for plain element listeners that have uppercase 26123 // letters, as these may be custom elements' custom events 26124 `on:${rawName}` 26125 ); 26126 eventName = createSimpleExpression(eventString, true, arg.loc); 26127 } else { 26128 eventName = createCompoundExpression([ 26129 `${context.helperString(TO_HANDLER_KEY)}(`, 26130 arg, 26131 `)` 26132 ]); 26133 } 26134 } else { 26135 eventName = arg; 26136 eventName.children.unshift(`${context.helperString(TO_HANDLER_KEY)}(`); 26137 eventName.children.push(`)`); 26138 } 26139 let exp = dir.exp; 26140 if (exp && !exp.content.trim()) { 26141 exp = void 0; 26142 } 26143 let shouldCache = context.cacheHandlers && !exp && !context.inVOnce; 26144 if (exp) { 26145 const isMemberExp = isMemberExpression(exp); 26146 const isInlineStatement = !(isMemberExp || isFnExpression(exp)); 26147 const hasMultipleStatements = exp.content.includes(`;`); 26148 if (isInlineStatement || shouldCache && isMemberExp) { 26149 exp = createCompoundExpression([ 26150 `${isInlineStatement ? `$event` : `${``}(...args)`} => ${hasMultipleStatements ? `{` : `(`}`, 26151 exp, 26152 hasMultipleStatements ? `}` : `)` 26153 ]); 26154 } 26155 } 26156 let ret = { 26157 props: [ 26158 createObjectProperty( 26159 eventName, 26160 exp || createSimpleExpression(`() => {}`, false, loc) 26161 ) 26162 ] 26163 }; 26164 if (augmentor) { 26165 ret = augmentor(ret); 26166 } 26167 if (shouldCache) { 26168 ret.props[0].value = context.cache(ret.props[0].value); 26169 } 26170 ret.props.forEach((p2) => p2.key.isHandlerKey = true); 26171 return ret; 26172}; 26173const transformText = (node, context) => { 26174 if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) { 26175 return () => { 26176 const children = node.children; 26177 let currentContainer = void 0; 26178 let hasText = false; 26179 for (let i2 = 0; i2 < children.length; i2++) { 26180 const child = children[i2]; 26181 if (isText$1(child)) { 26182 hasText = true; 26183 for (let j = i2 + 1; j < children.length; j++) { 26184 const next = children[j]; 26185 if (isText$1(next)) { 26186 if (!currentContainer) { 26187 currentContainer = children[i2] = createCompoundExpression( 26188 [child], 26189 child.loc 26190 ); 26191 } 26192 currentContainer.children.push(` + `, next); 26193 children.splice(j, 1); 26194 j--; 26195 } else { 26196 currentContainer = void 0; 26197 break; 26198 } 26199 } 26200 } 26201 } 26202 if (!hasText || // if this is a plain element with a single text child, leave it 26203 // as-is since the runtime has dedicated fast path for this by directly 26204 // setting textContent of the element. 26205 // for component root it's always normalized anyway. 26206 children.length === 1 && (node.type === 0 || node.type === 1 && node.tagType === 0 && // #3756 26207 // custom directives can potentially add DOM elements arbitrarily, 26208 // we need to avoid setting textContent of the element at runtime 26209 // to avoid accidentally overwriting the DOM elements added 26210 // by the user through custom directives. 26211 !node.props.find( 26212 (p2) => p2.type === 7 && !context.directiveTransforms[p2.name] 26213 ) && // in compat mode, <template> tags with no special directives 26214 // will be rendered as a fragment so its children must be 26215 // converted into vnodes. 26216 !(node.tag === "template"))) { 26217 return; 26218 } 26219 for (let i2 = 0; i2 < children.length; i2++) { 26220 const child = children[i2]; 26221 if (isText$1(child) || child.type === 8) { 26222 const callArgs = []; 26223 if (child.type !== 2 || child.content !== " ") { 26224 callArgs.push(child); 26225 } 26226 if (!context.ssr && getConstantType(child, context) === 0) { 26227 callArgs.push( 26228 `1` 26229 ); 26230 } 26231 children[i2] = { 26232 type: 12, 26233 content: child, 26234 loc: child.loc, 26235 codegenNode: createCallExpression( 26236 context.helper(CREATE_TEXT), 26237 callArgs 26238 ) 26239 }; 26240 } 26241 } 26242 }; 26243 } 26244}; 26245const seen$1 = /* @__PURE__ */ new WeakSet(); 26246const transformOnce = (node, context) => { 26247 if (node.type === 1 && findDir(node, "once", true)) { 26248 if (seen$1.has(node) || context.inVOnce || context.inSSR) { 26249 return; 26250 } 26251 seen$1.add(node); 26252 context.inVOnce = true; 26253 context.helper(SET_BLOCK_TRACKING); 26254 return () => { 26255 context.inVOnce = false; 26256 const cur = context.currentNode; 26257 if (cur.codegenNode) { 26258 cur.codegenNode = context.cache( 26259 cur.codegenNode, 26260 true, 26261 true 26262 ); 26263 } 26264 }; 26265 } 26266}; 26267const transformModel$1 = (dir, node, context) => { 26268 const { exp, arg } = dir; 26269 if (!exp) { 26270 context.onError( 26271 createCompilerError(41, dir.loc) 26272 ); 26273 return createTransformProps(); 26274 } 26275 const rawExp = exp.loc.source.trim(); 26276 const expString = exp.type === 4 ? exp.content : rawExp; 26277 const bindingType = context.bindingMetadata[rawExp]; 26278 if (bindingType === "props" || bindingType === "props-aliased") { 26279 context.onError(createCompilerError(44, exp.loc)); 26280 return createTransformProps(); 26281 } 26282 if (!expString.trim() || !isMemberExpression(exp) && true) { 26283 context.onError( 26284 createCompilerError(42, exp.loc) 26285 ); 26286 return createTransformProps(); 26287 } 26288 const propName = arg ? arg : createSimpleExpression("modelValue", true); 26289 const eventName = arg ? isStaticExp(arg) ? `onUpdate:${camelize(arg.content)}` : createCompoundExpression(['"onUpdate:" + ', arg]) : `onUpdate:modelValue`; 26290 let assignmentExp; 26291 const eventArg = context.isTS ? `($event: any)` : `$event`; 26292 { 26293 assignmentExp = createCompoundExpression([ 26294 `${eventArg} => ((`, 26295 exp, 26296 `) = $event)` 26297 ]); 26298 } 26299 const props = [ 26300 // modelValue: foo 26301 createObjectProperty(propName, dir.exp), 26302 // "onUpdate:modelValue": $event => (foo = $event) 26303 createObjectProperty(eventName, assignmentExp) 26304 ]; 26305 if (dir.modifiers.length && node.tagType === 1) { 26306 const modifiers = dir.modifiers.map((m2) => m2.content).map((m2) => (isSimpleIdentifier(m2) ? m2 : JSON.stringify(m2)) + `: true`).join(`, `); 26307 const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`; 26308 props.push( 26309 createObjectProperty( 26310 modifiersKey, 26311 createSimpleExpression( 26312 `{ ${modifiers} }`, 26313 false, 26314 dir.loc, 26315 2 26316 ) 26317 ) 26318 ); 26319 } 26320 return createTransformProps(props); 26321}; 26322function createTransformProps(props = []) { 26323 return { props }; 26324} 26325const validDivisionCharRE = /[\w).+\-_$\]]/; 26326const transformFilter = (node, context) => { 26327 if (!isCompatEnabled("COMPILER_FILTERS", context)) { 26328 return; 26329 } 26330 if (node.type === 5) { 26331 rewriteFilter(node.content, context); 26332 } else if (node.type === 1) { 26333 node.props.forEach((prop) => { 26334 if (prop.type === 7 && prop.name !== "for" && prop.exp) { 26335 rewriteFilter(prop.exp, context); 26336 } 26337 }); 26338 } 26339}; 26340function rewriteFilter(node, context) { 26341 if (node.type === 4) { 26342 parseFilter(node, context); 26343 } else { 26344 for (let i2 = 0; i2 < node.children.length; i2++) { 26345 const child = node.children[i2]; 26346 if (typeof child !== "object") continue; 26347 if (child.type === 4) { 26348 parseFilter(child, context); 26349 } else if (child.type === 8) { 26350 rewriteFilter(node, context); 26351 } else if (child.type === 5) { 26352 rewriteFilter(child.content, context); 26353 } 26354 } 26355 } 26356} 26357function parseFilter(node, context) { 26358 const exp = node.content; 26359 let inSingle = false; 26360 let inDouble = false; 26361 let inTemplateString = false; 26362 let inRegex = false; 26363 let curly = 0; 26364 let square = 0; 26365 let paren = 0; 26366 let lastFilterIndex = 0; 26367 let c2, prev, i2, expression, filters = []; 26368 for (i2 = 0; i2 < exp.length; i2++) { 26369 prev = c2; 26370 c2 = exp.charCodeAt(i2); 26371 if (inSingle) { 26372 if (c2 === 39 && prev !== 92) inSingle = false; 26373 } else if (inDouble) { 26374 if (c2 === 34 && prev !== 92) inDouble = false; 26375 } else if (inTemplateString) { 26376 if (c2 === 96 && prev !== 92) inTemplateString = false; 26377 } else if (inRegex) { 26378 if (c2 === 47 && prev !== 92) inRegex = false; 26379 } else if (c2 === 124 && // pipe 26380 exp.charCodeAt(i2 + 1) !== 124 && exp.charCodeAt(i2 - 1) !== 124 && !curly && !square && !paren) { 26381 if (expression === void 0) { 26382 lastFilterIndex = i2 + 1; 26383 expression = exp.slice(0, i2).trim(); 26384 } else { 26385 pushFilter(); 26386 } 26387 } else { 26388 switch (c2) { 26389 case 34: 26390 inDouble = true; 26391 break; 26392 // " 26393 case 39: 26394 inSingle = true; 26395 break; 26396 // ' 26397 case 96: 26398 inTemplateString = true; 26399 break; 26400 // ` 26401 case 40: 26402 paren++; 26403 break; 26404 // ( 26405 case 41: 26406 paren--; 26407 break; 26408 // ) 26409 case 91: 26410 square++; 26411 break; 26412 // [ 26413 case 93: 26414 square--; 26415 break; 26416 // ] 26417 case 123: 26418 curly++; 26419 break; 26420 // { 26421 case 125: 26422 curly--; 26423 break; 26424 } 26425 if (c2 === 47) { 26426 let j = i2 - 1; 26427 let p2; 26428 for (; j >= 0; j--) { 26429 p2 = exp.charAt(j); 26430 if (p2 !== " ") break; 26431 } 26432 if (!p2 || !validDivisionCharRE.test(p2)) { 26433 inRegex = true; 26434 } 26435 } 26436 } 26437 } 26438 if (expression === void 0) { 26439 expression = exp.slice(0, i2).trim(); 26440 } else if (lastFilterIndex !== 0) { 26441 pushFilter(); 26442 } 26443 function pushFilter() { 26444 filters.push(exp.slice(lastFilterIndex, i2).trim()); 26445 lastFilterIndex = i2 + 1; 26446 } 26447 if (filters.length) { 26448 for (i2 = 0; i2 < filters.length; i2++) { 26449 expression = wrapFilter(expression, filters[i2], context); 26450 } 26451 node.content = expression; 26452 node.ast = void 0; 26453 } 26454} 26455function wrapFilter(exp, filter, context) { 26456 context.helper(RESOLVE_FILTER); 26457 const i2 = filter.indexOf("("); 26458 if (i2 < 0) { 26459 context.filters.add(filter); 26460 return `${toValidAssetId(filter, "filter")}(${exp})`; 26461 } else { 26462 const name = filter.slice(0, i2); 26463 const args = filter.slice(i2 + 1); 26464 context.filters.add(name); 26465 return `${toValidAssetId(name, "filter")}(${exp}${args !== ")" ? "," + args : args}`; 26466 } 26467} 26468const seen = /* @__PURE__ */ new WeakSet(); 26469const transformMemo = (node, context) => { 26470 if (node.type === 1) { 26471 const dir = findDir(node, "memo"); 26472 if (!dir || seen.has(node)) { 26473 return; 26474 } 26475 seen.add(node); 26476 return () => { 26477 const codegenNode = node.codegenNode || context.currentNode.codegenNode; 26478 if (codegenNode && codegenNode.type === 13) { 26479 if (node.tagType !== 1) { 26480 convertToBlock(codegenNode, context); 26481 } 26482 node.codegenNode = createCallExpression(context.helper(WITH_MEMO), [ 26483 dir.exp, 26484 createFunctionExpression(void 0, codegenNode), 26485 `_cache`, 26486 String(context.cached.length) 26487 ]); 26488 context.cached.push(null); 26489 } 26490 }; 26491 } 26492}; 26493function getBaseTransformPreset(prefixIdentifiers) { 26494 return [ 26495 [ 26496 transformOnce, 26497 transformIf, 26498 transformMemo, 26499 transformFor, 26500 ...[transformFilter], 26501 ...[], 26502 transformSlotOutlet, 26503 transformElement, 26504 trackSlotScopes, 26505 transformText 26506 ], 26507 { 26508 on: transformOn$1, 26509 bind: transformBind, 26510 model: transformModel$1 26511 } 26512 ]; 26513} 26514function baseCompile(source, options = {}) { 26515 const onError = options.onError || defaultOnError; 26516 const isModuleMode = options.mode === "module"; 26517 { 26518 if (options.prefixIdentifiers === true) { 26519 onError(createCompilerError(47)); 26520 } else if (isModuleMode) { 26521 onError(createCompilerError(48)); 26522 } 26523 } 26524 const prefixIdentifiers = false; 26525 if (options.cacheHandlers) { 26526 onError(createCompilerError(49)); 26527 } 26528 if (options.scopeId && !isModuleMode) { 26529 onError(createCompilerError(50)); 26530 } 26531 const resolvedOptions = extend({}, options, { 26532 prefixIdentifiers 26533 }); 26534 const ast = isString$1(source) ? baseParse(source, resolvedOptions) : source; 26535 const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(); 26536 transform( 26537 ast, 26538 extend({}, resolvedOptions, { 26539 nodeTransforms: [ 26540 ...nodeTransforms, 26541 ...options.nodeTransforms || [] 26542 // user transforms 26543 ], 26544 directiveTransforms: extend( 26545 {}, 26546 directiveTransforms, 26547 options.directiveTransforms || {} 26548 // user transforms 26549 ) 26550 }) 26551 ); 26552 return generate(ast, resolvedOptions); 26553} 26554const BindingTypes = { 26555 "DATA": "data", 26556 "PROPS": "props", 26557 "PROPS_ALIASED": "props-aliased", 26558 "SETUP_LET": "setup-let", 26559 "SETUP_CONST": "setup-const", 26560 "SETUP_REACTIVE_CONST": "setup-reactive-const", 26561 "SETUP_MAYBE_REF": "setup-maybe-ref", 26562 "SETUP_REF": "setup-ref", 26563 "OPTIONS": "options", 26564 "LITERAL_CONST": "literal-const" 26565}; 26566const noopDirectiveTransform = () => ({ props: [] }); 26567/** 26568* @vue/compiler-dom v3.5.13 26569* (c) 2018-present Yuxi (Evan) You and Vue contributors 26570* @license MIT
26571**/ 26572const V_MODEL_RADIO = Symbol(``); 26573const V_MODEL_CHECKBOX = Symbol( 26574 `` 26575); 26576const V_MODEL_TEXT = Symbol(``); 26577const V_MODEL_SELECT = Symbol( 26578 `` 26579); 26580const V_MODEL_DYNAMIC = Symbol( 26581 `` 26582); 26583const V_ON_WITH_MODIFIERS = Symbol( 26584 `` 26585); 26586const V_ON_WITH_KEYS = Symbol( 26587 `` 26588); 26589const V_SHOW = Symbol(``); 26590const TRANSITION = Symbol(``); 26591const TRANSITION_GROUP = Symbol( 26592 `` 26593); 26594registerRuntimeHelpers({ 26595 [V_MODEL_RADIO]: `vModelRadio`, 26596 [V_MODEL_CHECKBOX]: `vModelCheckbox`, 26597 [V_MODEL_TEXT]: `vModelText`, 26598 [V_MODEL_SELECT]: `vModelSelect`, 26599 [V_MODEL_DYNAMIC]: `vModelDynamic`, 26600 [V_ON_WITH_MODIFIERS]: `withModifiers`, 26601 [V_ON_WITH_KEYS]: `withKeys`, 26602 [V_SHOW]: `vShow`, 26603 [TRANSITION]: `Transition`, 26604 [TRANSITION_GROUP]: `TransitionGroup` 26605}); 26606let decoder; 26607function decodeHtmlBrowser(raw, asAttr = false) { 26608 if (!decoder) { 26609 decoder = document.createElement("div"); 26610 } 26611 if (asAttr) { 26612 decoder.innerHTML = `<div foo="${raw.replace(/"/g, """)}">`; 26613 return decoder.children[0].getAttribute("foo"); 26614 } else { 26615 decoder.innerHTML = raw; 26616 return decoder.textContent; 26617 } 26618} 26619const parserOptions = { 26620 parseMode: "html", 26621 isVoidTag, 26622 isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag) || isMathMLTag(tag), 26623 isPreTag: (tag) => tag === "pre", 26624 isIgnoreNewlineTag: (tag) => tag === "pre" || tag === "textarea", 26625 decodeEntities: decodeHtmlBrowser, 26626 isBuiltInComponent: (tag) => { 26627 if (tag === "Transition" || tag === "transition") { 26628 return TRANSITION; 26629 } else if (tag === "TransitionGroup" || tag === "transition-group") { 26630 return TRANSITION_GROUP; 26631 } 26632 }, 26633 // https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher 26634 getNamespace(tag, parent, rootNamespace) { 26635 let ns = parent ? parent.ns : rootNamespace; 26636 if (parent && ns === 2) { 26637 if (parent.tag === "annotation-xml") { 26638 if (tag === "svg") { 26639 return 1; 26640 } 26641 if (parent.props.some( 26642 (a) => a.type === 6 && a.name === "encoding" && a.value != null && (a.value.content === "text/html" || a.value.content === "application/xhtml+xml") 26643 )) { 26644 ns = 0; 26645 } 26646 } else if (/^m(?:[ions]|text)$/.test(parent.tag) && tag !== "mglyph" && tag !== "malignmark") { 26647 ns = 0; 26648 } 26649 } else if (parent && ns === 1) { 26650 if (parent.tag === "foreignObject" || parent.tag === "desc" || parent.tag === "title") { 26651 ns = 0; 26652 } 26653 } 26654 if (ns === 0) { 26655 if (tag === "svg") { 26656 return 1; 26657 } 26658 if (tag === "math") { 26659 return 2; 26660 } 26661 } 26662 return ns; 26663 } 26664}; 26665const transformStyle = (node) => { 26666 if (node.type === 1) { 26667 node.props.forEach((p2, i2) => { 26668 if (p2.type === 6 && p2.name === "style" && p2.value) { 26669 node.props[i2] = { 26670 type: 7, 26671 name: `bind`, 26672 arg: createSimpleExpression(`style`, true, p2.loc), 26673 exp: parseInlineCSS(p2.value.content, p2.loc), 26674 modifiers: [], 26675 loc: p2.loc 26676 }; 26677 } 26678 }); 26679 } 26680}; 26681const parseInlineCSS = (cssText, loc) => { 26682 const normalized = parseStringStyle(cssText); 26683 return createSimpleExpression( 26684 JSON.stringify(normalized), 26685 false, 26686 loc, 26687 3 26688 ); 26689}; 26690function createDOMCompilerError(code, loc) { 26691 return createCompilerError( 26692 code, 26693 loc 26694 ); 26695} 26696const DOMErrorCodes = { 26697 "X_V_HTML_NO_EXPRESSION": 53, 26698 "53": "X_V_HTML_NO_EXPRESSION", 26699 "X_V_HTML_WITH_CHILDREN": 54, 26700 "54": "X_V_HTML_WITH_CHILDREN", 26701 "X_V_TEXT_NO_EXPRESSION": 55, 26702 "55": "X_V_TEXT_NO_EXPRESSION", 26703 "X_V_TEXT_WITH_CHILDREN": 56, 26704 "56": "X_V_TEXT_WITH_CHILDREN", 26705 "X_V_MODEL_ON_INVALID_ELEMENT": 57, 26706 "57": "X_V_MODEL_ON_INVALID_ELEMENT", 26707 "X_V_MODEL_ARG_ON_ELEMENT": 58, 26708 "58": "X_V_MODEL_ARG_ON_ELEMENT", 26709 "X_V_MODEL_ON_FILE_INPUT_ELEMENT": 59, 26710 "59": "X_V_MODEL_ON_FILE_INPUT_ELEMENT", 26711 "X_V_MODEL_UNNECESSARY_VALUE": 60, 26712 "60": "X_V_MODEL_UNNECESSARY_VALUE", 26713 "X_V_SHOW_NO_EXPRESSION": 61, 26714 "61": "X_V_SHOW_NO_EXPRESSION", 26715 "X_TRANSITION_INVALID_CHILDREN": 62, 26716 "62": "X_TRANSITION_INVALID_CHILDREN", 26717 "X_IGNORED_SIDE_EFFECT_TAG": 63, 26718 "63": "X_IGNORED_SIDE_EFFECT_TAG", 26719 "__EXTEND_POINT__": 64, 26720 "64": "__EXTEND_POINT__" 26721}; 26722const DOMErrorMessages = { 26723 [53]: `v-html is missing expression.`, 26724 [54]: `v-html will override element children.`, 26725 [55]: `v-text is missing expression.`, 26726 [56]: `v-text will override element children.`, 26727 [57]: `v-model can only be used on <input>, <textarea> and <select> elements.`, 26728 [58]: `v-model argument is not supported on plain elements.`, 26729 [59]: `v-model cannot be used on file inputs since they are read-only. Use a v-on:change listener instead.`, 26730 [60]: `Unnecessary value binding used alongside v-model. It will interfere with v-model's behavior.`, 26731 [61]: `v-show is missing expression.`, 26732 [62]: `<Transition> expects exactly one child element or component.`, 26733 [63]: `Tags with side effect (<script> and <style>) are ignored in client component templates.` 26734}; 26735const transformVHtml = (dir, node, context) => { 26736 const { exp, loc } = dir; 26737 if (!exp) { 26738 context.onError( 26739 createDOMCompilerError(53, loc) 26740 ); 26741 } 26742 if (node.children.length) { 26743 context.onError( 26744 createDOMCompilerError(54, loc) 26745 ); 26746 node.children.length = 0; 26747 } 26748 return { 26749 props: [ 26750 createObjectProperty( 26751 createSimpleExpression(`innerHTML`, true, loc), 26752 exp || createSimpleExpression("", true) 26753 ) 26754 ] 26755 }; 26756}; 26757const transformVText = (dir, node, context) => { 26758 const { exp, loc } = dir; 26759 if (!exp) { 26760 context.onError( 26761 createDOMCompilerError(55, loc) 26762 ); 26763 } 26764 if (node.children.length) { 26765 context.onError( 26766 createDOMCompilerError(56, loc) 26767 ); 26768 node.children.length = 0; 26769 } 26770 return { 26771 props: [ 26772 createObjectProperty( 26773 createSimpleExpression(`textContent`, true), 26774 exp ? getConstantType(exp, context) > 0 ? exp : createCallExpression( 26775 context.helperString(TO_DISPLAY_STRING), 26776 [exp], 26777 loc 26778 ) : createSimpleExpression("", true) 26779 ) 26780 ] 26781 }; 26782}; 26783const transformModel = (dir, node, context) => { 26784 const baseResult = transformModel$1(dir, node, context); 26785 if (!baseResult.props.length || node.tagType === 1) { 26786 return baseResult; 26787 } 26788 if (dir.arg) { 26789 context.onError( 26790 createDOMCompilerError( 26791 58, 26792 dir.arg.loc 26793 ) 26794 ); 26795 } 26796 const { tag } = node;
vendor: 6,104 bytes, lines 26797-26992
26797 const isCustomElement = context.isCustomElement(tag); 26798 if (tag === "input" || tag === "textarea" || tag === "select" || isCustomElement) { 26799 let directiveToUse = V_MODEL_TEXT; 26800 let isInvalidType = false; 26801 if (tag === "input" || isCustomElement) { 26802 const type = findProp(node, `type`); 26803 if (type) { 26804 if (type.type === 7) { 26805 directiveToUse = V_MODEL_DYNAMIC; 26806 } else if (type.value) { 26807 switch (type.value.content) { 26808 case "radio": 26809 directiveToUse = V_MODEL_RADIO; 26810 break; 26811 case "checkbox": 26812 directiveToUse = V_MODEL_CHECKBOX; 26813 break; 26814 case "file": 26815 isInvalidType = true; 26816 context.onError( 26817 createDOMCompilerError( 26818 59, 26819 dir.loc 26820 ) 26821 ); 26822 break; 26823 } 26824 } 26825 } else if (hasDynamicKeyVBind(node)) { 26826 directiveToUse = V_MODEL_DYNAMIC; 26827 } else ; 26828 } else if (tag === "select") { 26829 directiveToUse = V_MODEL_SELECT; 26830 } else ; 26831 if (!isInvalidType) { 26832 baseResult.needRuntime = context.helper(directiveToUse); 26833 } 26834 } else { 26835 context.onError( 26836 createDOMCompilerError( 26837 57, 26838 dir.loc 26839 ) 26840 ); 26841 } 26842 baseResult.props = baseResult.props.filter( 26843 (p2) => !(p2.key.type === 4 && p2.key.content === "modelValue") 26844 ); 26845 return baseResult; 26846}; 26847const isEventOptionModifier = /* @__PURE__ */ makeMap(`passive,once,capture`); 26848const isNonKeyModifier = /* @__PURE__ */ makeMap( 26849 // event propagation management 26850 `stop,prevent,self,ctrl,shift,alt,meta,exact,middle` 26851); 26852const maybeKeyModifier = /* @__PURE__ */ makeMap("left,right"); 26853const isKeyboardEvent = /* @__PURE__ */ makeMap(`onkeyup,onkeydown,onkeypress`); 26854const resolveModifiers = (key, modifiers, context, loc) => { 26855 const keyModifiers = []; 26856 const nonKeyModifiers = []; 26857 const eventOptionModifiers = []; 26858 for (let i2 = 0; i2 < modifiers.length; i2++) { 26859 const modifier = modifiers[i2].content; 26860 if (modifier === "native" && checkCompatEnabled( 26861 "COMPILER_V_ON_NATIVE", 26862 context 26863 )) { 26864 eventOptionModifiers.push(modifier); 26865 } else if (isEventOptionModifier(modifier)) { 26866 eventOptionModifiers.push(modifier); 26867 } else { 26868 if (maybeKeyModifier(modifier)) { 26869 if (isStaticExp(key)) { 26870 if (isKeyboardEvent(key.content.toLowerCase())) { 26871 keyModifiers.push(modifier); 26872 } else { 26873 nonKeyModifiers.push(modifier); 26874 } 26875 } else { 26876 keyModifiers.push(modifier); 26877 nonKeyModifiers.push(modifier); 26878 } 26879 } else { 26880 if (isNonKeyModifier(modifier)) { 26881 nonKeyModifiers.push(modifier); 26882 } else { 26883 keyModifiers.push(modifier); 26884 } 26885 } 26886 } 26887 } 26888 return { 26889 keyModifiers, 26890 nonKeyModifiers, 26891 eventOptionModifiers 26892 }; 26893}; 26894const transformClick = (key, event) => { 26895 const isStaticClick = isStaticExp(key) && key.content.toLowerCase() === "onclick"; 26896 return isStaticClick ? createSimpleExpression(event, true) : key.type !== 4 ? createCompoundExpression([ 26897 `(`, 26898 key, 26899 `) === "onClick" ? "${event}" : (`, 26900 key, 26901 `)` 26902 ]) : key; 26903}; 26904const transformOn = (dir, node, context) => { 26905 return transformOn$1(dir, node, context, (baseResult) => { 26906 const { modifiers } = dir; 26907 if (!modifiers.length) return baseResult; 26908 let { key, value: handlerExp } = baseResult.props[0]; 26909 const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(key, modifiers, context, dir.loc); 26910 if (nonKeyModifiers.includes("right")) { 26911 key = transformClick(key, `onContextmenu`); 26912 } 26913 if (nonKeyModifiers.includes("middle")) { 26914 key = transformClick(key, `onMouseup`); 26915 } 26916 if (nonKeyModifiers.length) { 26917 handlerExp = createCallExpression(context.helper(V_ON_WITH_MODIFIERS), [ 26918 handlerExp, 26919 JSON.stringify(nonKeyModifiers) 26920 ]); 26921 } 26922 if (keyModifiers.length && // if event name is dynamic, always wrap with keys guard 26923 (!isStaticExp(key) || isKeyboardEvent(key.content.toLowerCase()))) { 26924 handlerExp = createCallExpression(context.helper(V_ON_WITH_KEYS), [ 26925 handlerExp, 26926 JSON.stringify(keyModifiers) 26927 ]); 26928 } 26929 if (eventOptionModifiers.length) { 26930 const modifierPostfix = eventOptionModifiers.map(capitalize).join(""); 26931 key = isStaticExp(key) ? createSimpleExpression(`${key.content}${modifierPostfix}`, true) : createCompoundExpression([`(`, key, `) + "${modifierPostfix}"`]); 26932 } 26933 return { 26934 props: [createObjectProperty(key, handlerExp)] 26935 }; 26936 }); 26937}; 26938const transformShow = (dir, node, context) => { 26939 const { exp, loc } = dir; 26940 if (!exp) { 26941 context.onError( 26942 createDOMCompilerError(61, loc) 26943 ); 26944 } 26945 return { 26946 props: [], 26947 needRuntime: context.helper(V_SHOW) 26948 }; 26949}; 26950const ignoreSideEffectTags = (node, context) => { 26951 if (node.type === 1 && node.tagType === 0 && (node.tag === "script" || node.tag === "style")) { 26952 context.removeNode(); 26953 } 26954}; 26955const DOMNodeTransforms = [ 26956 transformStyle, 26957 ...[] 26958]; 26959const DOMDirectiveTransforms = { 26960 cloak: noopDirectiveTransform, 26961 html: transformVHtml, 26962 text: transformVText, 26963 model: transformModel, 26964 // override compiler-core 26965 on: transformOn, 26966 // override compiler-core 26967 show: transformShow 26968}; 26969function compile(src, options = {}) { 26970 return baseCompile( 26971 src, 26972 extend({}, parserOptions, options, { 26973 nodeTransforms: [ 26974 // ignore <script> and <tag> 26975 // this is not put inside DOMNodeTransforms because that list is used 26976 // by compiler-ssr to generate vnode fallback branches 26977 ignoreSideEffectTags, 26978 ...DOMNodeTransforms, 26979 ...options.nodeTransforms || [] 26980 ], 26981 directiveTransforms: extend( 26982 {}, 26983 DOMDirectiveTransforms, 26984 options.directiveTransforms || {} 26985 ), 26986 transformHoist: null 26987 }) 26988 ); 26989} 26990function parse(template, options = {}) { 26991 return baseParse(template, extend({}, parserOptions, options)); 26992}
26993const compilerDom_esmBundler = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 26994 __proto__: null, 26995 BASE_TRANSITION, 26996 BindingTypes, 26997 CAMELIZE, 26998 CAPITALIZE, 26999 CREATE_BLOCK, 27000 CREATE_COMMENT, 27001 CREATE_ELEMENT_BLOCK, 27002 CREATE_ELEMENT_VNODE, 27003 CREATE_SLOTS, 27004 CREATE_STATIC, 27005 CREATE_TEXT, 27006 CREATE_VNODE, 27007 CompilerDeprecationTypes, 27008 ConstantTypes, 27009 DOMDirectiveTransforms, 27010 DOMErrorCodes, 27011 DOMErrorMessages, 27012 DOMNodeTransforms, 27013 ElementTypes, 27014 ErrorCodes, 27015 FRAGMENT, 27016 GUARD_REACTIVE_PROPS, 27017 IS_MEMO_SAME, 27018 IS_REF, 27019 KEEP_ALIVE, 27020 MERGE_PROPS, 27021 NORMALIZE_CLASS, 27022 NORMALIZE_PROPS, 27023 NORMALIZE_STYLE, 27024 Namespaces, 27025 NodeTypes, 27026 OPEN_BLOCK, 27027 POP_SCOPE_ID, 27028 PUSH_SCOPE_ID, 27029 RENDER_LIST, 27030 RENDER_SLOT, 27031 RESOLVE_COMPONENT, 27032 RESOLVE_DIRECTIVE, 27033 RESOLVE_DYNAMIC_COMPONENT, 27034 RESOLVE_FILTER, 27035 SET_BLOCK_TRACKING, 27036 SUSPENSE, 27037 TELEPORT, 27038 TO_DISPLAY_STRING, 27039 TO_HANDLERS, 27040 TO_HANDLER_KEY, 27041 TRANSITION, 27042 TRANSITION_GROUP, 27043 TS_NODE_TYPES, 27044 UNREF, 27045 V_MODEL_CHECKBOX, 27046 V_MODEL_DYNAMIC, 27047 V_MODEL_RADIO, 27048 V_MODEL_SELECT, 27049 V_MODEL_TEXT, 27050 V_ON_WITH_KEYS, 27051 V_ON_WITH_MODIFIERS, 27052 V_SHOW, 27053 WITH_CTX, 27054 WITH_DIRECTIVES, 27055 WITH_MEMO, 27056 advancePositionWithClone, 27057 advancePositionWithMutation, 27058 assert, 27059 baseCompile, 27060 baseParse, 27061 buildDirectiveArgs, 27062 buildProps, 27063 buildSlots, 27064 checkCompatEnabled, 27065 compile, 27066 convertToBlock, 27067 createArrayExpression, 27068 createAssignmentExpression, 27069 createBlockStatement, 27070 createCacheExpression, 27071 createCallExpression, 27072 createCompilerError, 27073 createCompoundExpression, 27074 createConditionalExpression, 27075 createDOMCompilerError, 27076 createForLoopParams, 27077 createFunctionExpression, 27078 createIfStatement, 27079 createInterpolation, 27080 createObjectExpression, 27081 createObjectProperty, 27082 createReturnStatement, 27083 createRoot, 27084 createSequenceExpression, 27085 createSimpleExpression, 27086 createStructuralDirectiveTransform, 27087 createTemplateLiteral, 27088 createTransformContext, 27089 createVNodeCall, 27090 errorMessages, 27091 extractIdentifiers, 27092 findDir, 27093 findProp, 27094 forAliasRE, 27095 generate, 27096 generateCodeFrame, 27097 getBaseTransformPreset, 27098 getConstantType, 27099 getMemoedVNodeCall, 27100 getVNodeBlockHelper, 27101 getVNodeHelper, 27102 hasDynamicKeyVBind, 27103 hasScopeRef, 27104 helperNameMap, 27105 injectProp, 27106 isCoreComponent, 27107 isFnExpression, 27108 isFnExpressionBrowser, 27109 isFnExpressionNode, 27110 isFunctionType, 27111 isInDestructureAssignment, 27112 isInNewExpression, 27113 isMemberExpression, 27114 isMemberExpressionBrowser, 27115 isMemberExpressionNode, 27116 isReferencedIdentifier, 27117 isSimpleIdentifier, 27118 isSlotOutlet, 27119 isStaticArgOf, 27120 isStaticExp, 27121 isStaticProperty, 27122 isStaticPropertyKey, 27123 isTemplateNode, 27124 isText: isText$1, 27125 isVSlot, 27126 locStub, 27127 noopDirectiveTransform, 27128 parse, 27129 parserOptions, 27130 processExpression, 27131 processFor, 27132 processIf, 27133 processSlotOutlet, 27134 registerRuntimeHelpers, 27135 resolveComponentType, 27136 stringifyExpression, 27137 toValidAssetId, 27138 trackSlotScopes, 27139 trackVForSlotScopes, 27140 transform, 27141 transformBind, 27142 transformElement, 27143 transformExpression, 27144 transformModel: transformModel$1, 27145 transformOn: transformOn$1, 27146 transformStyle, 27147 traverseNode, 27148 unwrapTSNode, 27149 walkBlockDeclarations, 27150 walkFunctionParams, 27151 walkIdentifiers, 27152 warnDeprecation 27153}, Symbol.toStringTag, { value: "Module" })); 27154const require$$0 = /* @__PURE__ */ getAugmentedNamespace(compilerDom_esmBundler); 27155const require$$1 = /* @__PURE__ */ getAugmentedNamespace(runtimeDom_esmBundler); 27156const require$$2 = /* @__PURE__ */ getAugmentedNamespace(shared_esmBundler); 27157/** 27158* vue v3.5.13 27159* (c) 2018-present Yuxi (Evan) You and Vue contributors 27160* @license MIT
27161**/ 27162var hasRequiredVue_cjs_prod; 27163function requireVue_cjs_prod() { 27164 if (hasRequiredVue_cjs_prod) return vue_cjs_prod; 27165 hasRequiredVue_cjs_prod = 1; 27166 (function(exports) { 27167 Object.defineProperty(exports, "__esModule", { value: true }); 27168 var compilerDom = require$$0; 27169 var runtimeDom = require$$1; 27170 var shared = require$$2; 27171 function _interopNamespaceDefault(e) { 27172 var n2 = /* @__PURE__ */ Object.create(null); 27173 if (e) { 27174 for (var k in e) { 27175 n2[k] = e[k]; 27176 } 27177 } 27178 n2.default = e; 27179 return Object.freeze(n2); 27180 } 27181 var runtimeDom__namespace = /* @__PURE__ */ _interopNamespaceDefault(runtimeDom); 27182 const compileCache = /* @__PURE__ */ Object.create(null); 27183 function compileToFunction(template, options) { 27184 if (!shared.isString(template)) { 27185 if (template.nodeType) { 27186 template = template.innerHTML; 27187 } else { 27188 return shared.NOOP; 27189 } 27190 } 27191 const key = shared.genCacheKey(template, options); 27192 const cached = compileCache[key]; 27193 if (cached) { 27194 return cached; 27195 } 27196 if (template[0] === "#") { 27197 const el = document.querySelector(template); 27198 template = el ? el.innerHTML : ``; 27199 } 27200 const opts = shared.extend( 27201 { 27202 hoistStatic: true, 27203 onError: void 0, 27204 onWarn: shared.NOOP 27205 }, 27206 options 27207 ); 27208 if (!opts.isCustomElement && typeof customElements !== "undefined") { 27209 opts.isCustomElement = (tag) => !!customElements.get(tag); 27210 } 27211 const { code } = compilerDom.compile(template, opts); 27212 const render = new Function("Vue", code)(runtimeDom__namespace); 27213 render._rc = true; 27214 return compileCache[key] = render; 27215 } 27216 runtimeDom.registerRuntimeCompiler(compileToFunction); 27217 exports.compile = compileToFunction; 27218 Object.keys(runtimeDom).forEach(function(k) { 27219 if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeDom[k]; 27220 }); 27221 })(vue_cjs_prod); 27222 return vue_cjs_prod; 27223} 27224var hasRequiredVue; 27225function requireVue() { 27226 if (hasRequiredVue) return vue.exports; 27227 hasRequiredVue = 1; 27228 { 27229 vue.exports = requireVue_cjs_prod(); 27230 } 27231 return vue.exports; 27232} 27233var hasRequiredReCaptchaVuePlugin; 27234function requireReCaptchaVuePlugin() { 27235 if (hasRequiredReCaptchaVuePlugin) return ReCaptchaVuePlugin; 27236 hasRequiredReCaptchaVuePlugin = 1; 27237 var __awaiter = ReCaptchaVuePlugin && ReCaptchaVuePlugin.__awaiter || function(thisArg, _arguments, P, generator) { 27238 function adopt(value) { 27239 return value instanceof P ? value : new P(function(resolve) { 27240 resolve(value); 27241 }); 27242 } 27243 return new (P || (P = Promise))(function(resolve, reject) { 27244 function fulfilled(value) { 27245 try { 27246 step(generator.next(value)); 27247 } catch (e) { 27248 reject(e); 27249 } 27250 } 27251 function rejected(value) { 27252 try { 27253 step(generator["throw"](value)); 27254 } catch (e) { 27255 reject(e); 27256 } 27257 } 27258 function step(result) { 27259 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 27260 } 27261 step((generator = generator.apply(thisArg, _arguments || [])).next()); 27262 }); 27263 }; 27264 var __generator = ReCaptchaVuePlugin && ReCaptchaVuePlugin.__generator || function(thisArg, body) { 27265 var _ = { label: 0, sent: function() { 27266 if (t[0] & 1) throw t[1]; 27267 return t[1]; 27268 }, trys: [], ops: [] }, f, y2, t, g; 27269 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { 27270 return this; 27271 }), g; 27272 function verb(n2) { 27273 return function(v) { 27274 return step([n2, v]); 27275 }; 27276 } 27277 function step(op) { 27278 if (f) throw new TypeError("Generator is already executing."); 27279 while (_) try { 27280 if (f = 1, y2 && (t = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t = y2["return"]) && t.call(y2), 0) : y2.next) && !(t = t.call(y2, op[1])).done) return t; 27281 if (y2 = 0, t) op = [op[0] & 2, t.value]; 27282 switch (op[0]) { 27283 case 0: 27284 case 1: 27285 t = op; 27286 break; 27287 case 4: 27288 _.label++; 27289 return { value: op[1], done: false }; 27290 case 5: 27291 _.label++; 27292 y2 = op[1]; 27293 op = [0]; 27294 continue; 27295 case 7: 27296 op = _.ops.pop(); 27297 _.trys.pop(); 27298 continue; 27299 default: 27300 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { 27301 _ = 0; 27302 continue; 27303 } 27304 if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { 27305 _.label = op[1]; 27306 break; 27307 } 27308 if (op[0] === 6 && _.label < t[1]) { 27309 _.label = t[1]; 27310 t = op; 27311 break; 27312 } 27313 if (t && _.label < t[2]) { 27314 _.label = t[2];
27315 _.ops.push(op); 27316 break; 27317 } 27318 if (t[2]) _.ops.pop(); 27319 _.trys.pop(); 27320 continue; 27321 } 27322 op = body.call(thisArg, _); 27323 } catch (e) { 27324 op = [6, e]; 27325 y2 = 0; 27326 } finally { 27327 f = t = 0; 27328 } 27329 if (op[0] & 5) throw op[1]; 27330 return { value: op[0] ? op[1] : void 0, done: true }; 27331 } 27332 }; 27333 Object.defineProperty(ReCaptchaVuePlugin, "__esModule", { value: true }); 27334 ReCaptchaVuePlugin.useReCaptcha = ReCaptchaVuePlugin.VueReCaptcha = void 0; 27335 var recaptcha_v3_1 = requireReCaptcha(); 27336 var vue_1 = requireVue(); 27337 var VueReCaptchaInjectKey = Symbol("VueReCaptchaInjectKey"); 27338 var globalConfig = { 27339 loadedWaiters: [], 27340 error: null 27341 }; 27342 ReCaptchaVuePlugin.VueReCaptcha = { 27343 install: function(app, options) { 27344 var isLoaded = vue_1.ref(false); 27345 var instance = vue_1.ref(void 0); 27346 app.config.globalProperties.$recaptchaLoaded = recaptchaLoaded(isLoaded); 27347 initializeReCaptcha(options).then(function(wrapper) { 27348 isLoaded.value = true; 27349 instance.value = wrapper; 27350 app.config.globalProperties.$recaptcha = recaptcha(instance); 27351 app.config.globalProperties.$recaptchaInstance = instance; 27352 globalConfig.loadedWaiters.forEach(function(v) { 27353 return v.resolve(true); 27354 }); 27355 }).catch(function(error) { 27356 globalConfig.error = error; 27357 globalConfig.loadedWaiters.forEach(function(v) { 27358 return v.reject(error); 27359 }); 27360 }); 27361 app.provide(VueReCaptchaInjectKey, { 27362 instance, 27363 isLoaded, 27364 executeRecaptcha: recaptcha(instance), 27365 recaptchaLoaded: recaptchaLoaded(isLoaded) 27366 }); 27367 } 27368 }; 27369 function useReCaptcha() { 27370 return vue_1.inject(VueReCaptchaInjectKey); 27371 } 27372 ReCaptchaVuePlugin.useReCaptcha = useReCaptcha; 27373 function initializeReCaptcha(options) { 27374 return __awaiter(this, void 0, void 0, function() { 27375 return __generator(this, function(_a2) { 27376 switch (_a2.label) { 27377 case 0: 27378 return [4, recaptcha_v3_1.load(options.siteKey, options.loaderOptions)]; 27379 case 1: 27380 return [2, _a2.sent()]; 27381 } 27382 }); 27383 }); 27384 } 27385 function recaptchaLoaded(isLoaded) { 27386 return function() { 27387 return new Promise(function(resolve, reject) { 27388 if (globalConfig.error !== null) { 27389 return reject(globalConfig.error); 27390 } 27391 if (isLoaded.value) { 27392 return resolve(true); 27393 } 27394 globalConfig.loadedWaiters.push({ resolve, reject }); 27395 }); 27396 }; 27397 } 27398 function recaptcha(instance) { 27399 var _this = this; 27400 return function(action) { 27401 return __awaiter(_this, void 0, void 0, function() { 27402 var _a2; 27403 return __generator(this, function(_b2) { 27404 switch (_b2.label) { 27405 case 0: 27406 return [4, (_a2 = instance.value) === null || _a2 === void 0 ? void 0 : _a2.execute(action)]; 27407 case 1: 27408 return [2, _b2.sent()]; 27409 } 27410 }); 27411 }); 27412 }; 27413 } 27414 return ReCaptchaVuePlugin; 27415} 27416var ReCaptchaVuePluginExports = requireReCaptchaVuePlugin(); 27417const vue_recaptcha_v3_client_vGBcFwrtQTtqGI8UVoA_a_ovDWu1LdENeco1LH3g46I = defineNuxtPlugin((nuxtApp) => { 27418 const { 27419 public: { googleRecaptchaSiteKey } 27420 } = useRuntimeConfig(); 27421 nuxtApp.vueApp.use(ReCaptchaVuePluginExports.VueReCaptcha, { 27422 siteKey: googleRecaptchaSiteKey, 27423 loaderOptions: { 27424 useRecaptchaNet: true, 27425 hideBadge: true 27426 } 27427 }); 27428}); 27429const plugins = [ 27430 revive_payload_client_kG4vF4SWGlhgLJRKrmco1O_zuG41odAu7e9PNPCDOtY, 27431 unhead_k2P3m_ZDyjlr2mMYnoDPwavjsDN8hBlk9cFai0bbopU, 27432 plugin, 27433 _0_siteConfig_tU0SxKrPeVRXWcGu2sOnIfhNDbYiKNfDCvYZhRueG0Q, 27434 payload_client_kSYcIMYUswSDcSGoGWqM0MO2T4MjOZsQFA1GU6fqohM, 27435 navigation_repaint_client_iZ4sbIDUOBlI58WRS1dxkRZJOsKNs1c7SCqRszdxr6Y, 27436 check_outdated_build_client__GMdmUuNCTKDee9GyDhHz84CJEYUp5_FenYjvgAxtj8, 27437 chunk_reload_client_90gdG_aWZaDfO85SQYWzwaOywz7zi0wBnFUoX0cT54U, 27438 components_plugin_z4hgvsiddfKkfXTP6M8M4zG5Cb7sGnDhcryKVM45Di4, 27439 prefetch_client_plc8Lsxh1X10IEwNhW7mxf0MabjBz64b9ODLi87nY5E,
27440 plugin_client_C6hmBeEmQBn26yUo0oB8PaR6oCkpopuHjNxArx40zE8, 27441 plugin_7DB4Q_rSg7Y6_r2xTJAR9sj0Plzl7GeeI8C3uqDzeqY, 27442 _01_vuex_JR2iuD9rUEJsbfc58CLbFrAaaNxdKncRJbnIkHqaZg0, 27443 _02_axios_9_2_CAngmP9WS9XLmomohNeXUXfLl__BcBNmgTjmGTs, 27444 async_css_client_eo9M_GWpwPQDYVwMPBbD0RwdbPwQD1FHI0qu89UswJI, 27445 bryg_client_iGD8EaiwErkh_EOh4EuPHXr91PPbOWjosGds2K9BSpo, 27446 mustache_gg39OlBMWpHMwTxqs1R_DHcp6rvZyzo4wHDPqgJrMfk, 27447 vue_recaptcha_v3_client_vGBcFwrtQTtqGI8UVoA_a_ovDWu1LdENeco1LH3g46I 27448]; 27449const defineRouteProvider = (name = "RouteProvider") => defineComponent({ 27450 name, 27451 props: { 27452 vnode: { 27453 type: Object, 27454 required: true 27455 }, 27456 route: { 27457 type: Object, 27458 required: true 27459 }, 27460 vnodeRef: Object, 27461 renderKey: String, 27462 trackRootNodes: Boolean 27463 }, 27464 setup(props) { 27465 const previousKey = props.renderKey; 27466 const previousRoute = props.route; 27467 const route = {}; 27468 for (const key in props.route) { 27469 Object.defineProperty(route, key, { 27470 get: () => previousKey === props.renderKey ? props.route[key] : previousRoute[key], 27471 enumerable: true 27472 }); 27473 } 27474 provide(PageRouteSymbol, shallowReactive(route)); 27475 return () => { 27476 return h(props.vnode, { ref: props.vnodeRef }); 27477 }; 27478 } 27479}); 27480const RouteProvider = defineRouteProvider(); 27481const _routeProviders = /* @__PURE__ */ new WeakMap(); 27482const __nuxt_component_0 = defineComponent({ 27483 name: "NuxtPage", 27484 inheritAttrs: false, 27485 props: { 27486 name: { 27487 type: String 27488 }, 27489 transition: { 27490 type: [Boolean, Object], 27491 default: void 0 27492 }, 27493 keepalive: { 27494 type: [Boolean, Object], 27495 default: void 0 27496 }, 27497 route: { 27498 type: Object 27499 }, 27500 pageKey: { 27501 type: [Function, String], 27502 default: null 27503 } 27504 }, 27505 setup(props, { attrs, slots, expose }) { 27506 const nuxtApp = useNuxtApp(); 27507 const pageRef = ref(); 27508 const forkRoute = inject(PageRouteSymbol, null); 27509 let previousPageKey; 27510 expose({ pageRef }); 27511 const _layoutMeta = inject(LayoutMetaSymbol, null); 27512 let vnode; 27513 const done = nuxtApp.deferHydration(); 27514 if (nuxtApp.isHydrating) { 27515 const removeErrorHook = nuxtApp.hooks.hookOnce("app:error", done); 27516 useRouter().beforeEach(removeErrorHook); 27517 } 27518 if (props.pageKey) { 27519 watch(() => props.pageKey, (next, prev) => { 27520 if (next !== prev) { 27521 nuxtApp.callHook("page:loading:start"); 27522 } 27523 }); 27524 } 27525 let pageLoadingEndHookAlreadyCalled = false; 27526 { 27527 const unsub = useRouter().beforeResolve(() => { 27528 pageLoadingEndHookAlreadyCalled = false; 27529 }); 27530 onBeforeUnmount(() => { 27531 unsub(); 27532 }); 27533 } 27534 return () => { 27535 return h(RouterView, { name: props.name, route: props.route, ...attrs }, { 27536 default: (routeProps) => { 27537 const isRenderingNewRouteInOldFork = haveParentRoutesRendered(forkRoute, routeProps.route, routeProps.Component); 27538 const hasSameChildren = forkRoute && forkRoute.matched.length === routeProps.route.matched.length; 27539 if (!routeProps.Component) { 27540 if (vnode && !hasSameChildren) { 27541 return vnode; 27542 } 27543 done(); 27544 return; 27545 } 27546 if (vnode && _layoutMeta && !_layoutMeta.isCurrent(routeProps.route)) { 27547 return vnode; 27548 } 27549 if (isRenderingNewRouteInOldFork && forkRoute && (!_layoutMeta || (_layoutMeta == null ? void 0 : _layoutMeta.isCurrent(forkRoute)))) { 27550 if (hasSameChildren) { 27551 return vnode; 27552 } 27553 return null; 27554 } 27555 const key = generateRouteKey(routeProps, props.pageKey); 27556 const willRenderAnotherChild = hasChildrenRoutes(forkRoute, routeProps.route, routeProps.Component); 27557 if (!nuxtApp.isHydrating && previousPageKey === key && !willRenderAnotherChild) { 27558 nuxtApp.callHook("page:loading:end"); 27559 pageLoadingEndHookAlreadyCalled = true; 27560 } 27561 previousPageKey = key; 27562 const hasTransition = !!(props.transition ?? routeProps.route.meta.pageTransition ?? appPageTransition); 27563 const transitionProps = hasTransition && _mergeTransitionProps([ 27564 props.transition, 27565 routeProps.route.meta.pageTransition, 27566 appPageTransition, 27567 { onAfterLeave: () => { 27568 nuxtApp.callHook("page:transition:finish", routeProps.Component); 27569 } } 27570 ]);
27571 const keepaliveConfig = props.keepalive ?? routeProps.route.meta.keepalive ?? appKeepalive; 27572 vnode = _wrapInTransition( 27573 hasTransition && transitionProps, 27574 wrapInKeepAlive( 27575 keepaliveConfig, 27576 h(Suspense, { 27577 suspensible: true, 27578 onPending: () => nuxtApp.callHook("page:start", routeProps.Component), 27579 onResolve: () => { 27580 nextTick(() => nuxtApp.callHook("page:finish", routeProps.Component).then(() => { 27581 if (!pageLoadingEndHookAlreadyCalled && !willRenderAnotherChild) { 27582 pageLoadingEndHookAlreadyCalled = true; 27583 return nuxtApp.callHook("page:loading:end"); 27584 } 27585 }).finally(done)); 27586 } 27587 }, { 27588 default: () => { 27589 const routeProviderProps = { 27590 key: key || void 0, 27591 vnode: slots.default ? normalizeSlot(slots.default, routeProps) : routeProps.Component, 27592 route: routeProps.route, 27593 renderKey: key || void 0, 27594 trackRootNodes: hasTransition, 27595 vnodeRef: pageRef 27596 }; 27597 if (!keepaliveConfig) { 27598 return h(RouteProvider, routeProviderProps); 27599 } 27600 const routerComponentType = routeProps.Component.type; 27601 const routeProviderKey = routerComponentType; 27602 let PageRouteProvider = _routeProviders.get(routeProviderKey); 27603 if (!PageRouteProvider) { 27604 PageRouteProvider = defineRouteProvider(routerComponentType.name || routerComponentType.__name); 27605 _routeProviders.set(routeProviderKey, PageRouteProvider); 27606 } 27607 return h(PageRouteProvider, routeProviderProps); 27608 } 27609 }) 27610 ) 27611 ).default(); 27612 return vnode; 27613 } 27614 }); 27615 }; 27616 } 27617}); 27618function _mergeTransitionProps(routeProps) { 27619 const _props = routeProps.filter(Boolean).map((prop) => ({ 27620 ...prop, 27621 onAfterLeave: prop.onAfterLeave ? toArray(prop.onAfterLeave) : void 0 27622 })); 27623 return defu(..._props); 27624} 27625function haveParentRoutesRendered(fork, newRoute, Component) { 27626 if (!fork) { 27627 return false; 27628 } 27629 const index = newRoute.matched.findIndex((m2) => { 27630 var _a2; 27631 return ((_a2 = m2.components) == null ? void 0 : _a2.default) === (Component == null ? void 0 : Component.type); 27632 }); 27633 if (!index || index === -1) { 27634 return false; 27635 } 27636 return newRoute.matched.slice(0, index).some( 27637 (c2, i2) => { 27638 var _a2, _b2, _c2; 27639 return ((_a2 = c2.components) == null ? void 0 : _a2.default) !== ((_c2 = (_b2 = fork.matched[i2]) == null ? void 0 : _b2.components) == null ? void 0 : _c2.default); 27640 } 27641 ) || Component && generateRouteKey({ route: newRoute, Component }) !== generateRouteKey({ route: fork, Component }); 27642} 27643function hasChildrenRoutes(fork, newRoute, Component) { 27644 if (!fork) { 27645 return false; 27646 } 27647 const index = newRoute.matched.findIndex((m2) => { 27648 var _a2; 27649 return ((_a2 = m2.components) == null ? void 0 : _a2.default) === (Component == null ? void 0 : Component.type); 27650 }); 27651 return index < newRoute.matched.length - 1; 27652} 27653function normalizeSlot(slot, data) { 27654 const slotContent = slot(data); 27655 return slotContent.length === 1 ? h(slotContent[0]) : h(Fragment, void 0, slotContent); 27656} 27657const LayoutLoader = defineComponent({ 27658 name: "LayoutLoader", 27659 inheritAttrs: false, 27660 props: { 27661 name: String, 27662 layoutProps: Object 27663 }, 27664 setup(props, context) { 27665 return () => h(layouts[props.name], props.layoutProps, context.slots); 27666 } 27667}); 27668const nuxtLayoutProps = { 27669 name: { 27670 type: [String, Boolean, Object], 27671 default: null 27672 }, 27673 fallback: { 27674 type: [String, Object], 27675 default: null 27676 } 27677}; 27678const __nuxt_component_1 = defineComponent({ 27679 name: "NuxtLayout", 27680 inheritAttrs: false, 27681 props: nuxtLayoutProps, 27682 setup(props, context) { 27683 const nuxtApp = useNuxtApp(); 27684 const injectedRoute = inject(PageRouteSymbol); 27685 const route = injectedRoute === useRoute() ? useRoute$1() : injectedRoute; 27686 const layout = computed(() => { 27687 let layout2 = unref(props.name) ?? route.meta.layout ?? "default"; 27688 if (layout2 && !(layout2 in layouts)) { 27689 if (props.fallback) { 27690 layout2 = unref(props.fallback); 27691 } 27692 } 27693 return layout2; 27694 }); 27695 const layoutRef = ref(); 27696 context.expose({ layoutRef }); 27697 const done = nuxtApp.deferHydration(); 27698 if (nuxtApp.isHydrating) { 27699 const removeErrorHook = nuxtApp.hooks.hookOnce("app:error", done); 27700 useRouter().beforeEach(removeErrorHook); 27701 } 27702 return () => { 27703 const hasLayout = layout.value && layout.value in layouts; 27704 const transitionProps = route.meta.layoutTransition ?? appLayoutTransition; 27705 return _wrapInTransition(hasLayout && transitionProps, { 27706 default: () => h(Suspense, { suspensible: true, onResolve: () => { 27707 nextTick(done); 27708 } }, { 27709 default: () => h( 27710 LayoutProvider, 27711 { 27712 layoutProps: mergeProps(context.attrs, { ref: layoutRef }), 27713 key: layout.value || void 0, 27714 name: layout.value, 27715 shouldProvide: !props.name, 27716 hasTransition: !!transitionProps 27717 }, 27718 context.slots 27719 ) 27720 }) 27721 }).default(); 27722 }; 27723 } 27724}); 27725const LayoutProvider = defineComponent({ 27726 name: "NuxtLayoutProvider", 27727 inheritAttrs: false, 27728 props: { 27729 name: { 27730 type: [String, Boolean] 27731 }, 27732 layoutProps: { 27733 type: Object 27734 }, 27735 hasTransition: { 27736 type: Boolean 27737 }, 27738 shouldProvide: { 27739 type: Boolean 27740 } 27741 }, 27742 setup(props, context) { 27743 const name = props.name; 27744 if (props.shouldProvide) { 27745 provide(LayoutMetaSymbol, { 27746 isCurrent: (route) => name === (route.meta.layout ?? "default") 27747 }); 27748 } 27749 return () => { 27750 var _a2, _b2; 27751 if (!name || typeof name === "string" && !(name in layouts)) { 27752 return (_b2 = (_a2 = context.slots).default) == null ? void 0 : _b2.call(_a2); 27753 } 27754 return h( 27755 LayoutLoader, 27756 { key: name, layoutProps: props.layoutProps, name }, 27757 context.slots 27758 ); 27759 }; 27760 } 27761}); 27762const _sfc_main$2 = {}; 27763function _sfc_render(_ctx, _cache) { 27764 const _component_NuxtPage = __nuxt_component_0; 27765 const _component_NuxtLayout = __nuxt_component_1; 27766 return openBlock(), createBlock(_component_NuxtLayout, null, { 27767 default: withCtx(() => [ 27768 createVNode(_component_NuxtPage) 27769 ]), 27770 _: 1 27771 }); 27772} 27773const AppComponent = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]); 27774const _sfc_main$1 = { 27775 __name: "nuxt-error-page", 27776 props: { 27777 error: Object 27778 }, 27779 setup(__props) { 27780 const props = __props; 27781 const _error = props.error; 27782 _error.stack ? _error.stack.split("\n").splice(1).map((line) => { 27783 const text = line.replace("webpack:/", "").replace(".vue", ".js").trim(); 27784 return { 27785 text, 27786 internal: line.includes("node_modules") && !line.includes(".cache") || line.includes("internal") || line.includes("new Promise") 27787 }; 27788 }).map((i2) => `<span class="stack${i2.internal ? " internal" : ""}">${i2.text}</span>`).join("\n") : ""; 27789 const statusCode = Number(_error.statusCode || 500); 27790 const is404 = statusCode === 404; 27791 const statusMessage = _error.statusMessage ?? (is404 ? "Page Not Found" : "Internal Server Error"); 27792 const description = _error.message || _error.toString(); 27793 const stack2 = void 0; 27794 const _Error404 = defineAsyncComponent(() => __vitePreload(() => import("./DpYcaEt3.js"), true ? __vite__mapDeps([10,1,2,11]) : void 0, import.meta.url)); 27795 const _Error = defineAsyncComponent(() => __vitePreload(() =>
27795 import("./DxH-eEmY.js"), true ? __vite__mapDeps([12,1,2,13]) : void 0, import.meta.url)); 27796 const ErrorTemplate = is404 ? _Error404 : _Error; 27797 return (_ctx, _cache) => { 27798 return openBlock(), createBlock(unref(ErrorTemplate), normalizeProps$1(guardReactiveProps({ statusCode: unref(statusCode), statusMessage: unref(statusMessage), description: unref(description), stack: unref(stack2) })), null, 16); 27799 }; 27800 } 27801}; 27802const _hoisted_1 = { key: 0 }; 27803const _sfc_main = { 27804 __name: "nuxt-root", 27805 setup(__props) { 27806 const IslandRenderer = () => null; 27807 const nuxtApp = useNuxtApp(); 27808 const onResolve = nuxtApp.deferHydration(); 27809 if (nuxtApp.isHydrating) { 27810 const removeErrorHook = nuxtApp.hooks.hookOnce("app:error", onResolve); 27811 useRouter().beforeEach(removeErrorHook); 27812 } 27813 const SingleRenderer = false; 27814 provide(PageRouteSymbol, useRoute()); 27815 nuxtApp.hooks.callHookWith((hooks) => hooks.map((hook) => hook()), "vue:setup"); 27816 const error = useError(); 27817 const abortRender = false; 27818 onErrorCaptured((err, target, info) => { 27819 nuxtApp.hooks.callHook("vue:error", err, target, info).catch((hookError) => console.error("[nuxt] Error in `vue:error` hook", hookError)); 27820 if (isNuxtError(err) && (err.fatal || err.unhandled)) { 27821 nuxtApp.runWithContext(() => showError(err)); 27822 return false; 27823 } 27824 }); 27825 const islandContext = false; 27826 return (_ctx, _cache) => { 27827 return openBlock(), createBlock(Suspense, { onResolve: unref(onResolve) }, { 27828 default: withCtx(() => [ 27829 unref(abortRender) ? (openBlock(), createElementBlock("div", _hoisted_1)) : unref(error) ? (openBlock(), createBlock(unref(_sfc_main$1), { 27830 key: 1, 27831 error: unref(error) 27832 }, null, 8, ["error"])) : unref(islandContext) ? (openBlock(), createBlock(unref(IslandRenderer), { 27833 key: 2, 27834 context: unref(islandContext) 27835 }, null, 8, ["context"])) : unref(SingleRenderer) ? (openBlock(), createBlock(resolveDynamicComponent(unref(SingleRenderer)), { key: 3 })) : (openBlock(), createBlock(unref(AppComponent), { key: 4 })) 27836 ]), 27837 _: 1 27838 }, 8, ["onResolve"]); 27839 }; 27840 } 27841}; 27842let entry; 27843{ 27844 let vueAppPromise; 27845 entry = async function initApp() { 27846 var _a2, _b2; 27847 if (vueAppPromise) { 27848 return vueAppPromise; 27849 } 27850 const isSSR = Boolean( 27851 ((_a2 = window.__NUXT__) == null ? void 0 : _a2.serverRendered) ?? ((_b2 = document.getElementById("__NUXT_DATA__")) == null ? void 0 : _b2.dataset.ssr) === "true" 27852 ); 27853 const vueApp = isSSR ? createSSRApp(_sfc_main) : createApp(_sfc_main); 27854 const nuxt = createNuxtApp({ vueApp }); 27855 async function handleVueError(error) { 27856 var _a3; 27857 await nuxt.callHook("app:error", error); 27858 (_a3 = nuxt.payload).error || (_a3.error = createError(error)); 27859 } 27860 vueApp.config.errorHandler = handleVueError; 27861 nuxt.hook("app:suspense:resolve", () => { 27862 if (vueApp.config.errorHandler === handleVueError) { 27863 vueApp.config.errorHandler = void 0; 27864 } 27865 }); 27866 try { 27867 await applyPlugins(nuxt, plugins); 27868 } catch (err) { 27869 handleVueError(err); 27870 } 27871 try { 27872 await nuxt.hooks.callHook("app:created", vueApp); 27873 await nuxt.hooks.callHook("app:beforeMount", vueApp); 27874 vueApp.mount(vueAppRootContainer); 27875 await nuxt.hooks.callHook("app:mounted", vueApp); 27876 await nextTick(); 27877 } catch (err) { 27878 handleVueError(err); 27879 } 27880 return vueApp; 27881 }; 27882 vueAppPromise = entry().catch((error) => { 27883 console.error("Error while mounting app:", error); 27884 throw error; 27885 }); 27886} 27887export { 27888 E 27889};
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.