@vc-shell/framework 1.1.44 → 1.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (453) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/core/plugins/modularity/loader.ts +150 -74
  3. package/core/services/app-bar-mobile-buttons-service.ts +1 -1
  4. package/dist/core/plugins/modularity/loader.d.ts.map +1 -1
  5. package/dist/core/services/app-bar-mobile-buttons-service.d.ts +1 -1
  6. package/dist/core/services/app-bar-mobile-buttons-service.d.ts.map +1 -1
  7. package/dist/framework.js +33355 -295
  8. package/dist/index.css +1 -9
  9. package/dist/index.d.ts +0 -4
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/locales/de.json +0 -84
  12. package/dist/locales/en.json +0 -84
  13. package/dist/shared/components/blade-navigation/components/vc-blade-navigation/_internal/vc-mobile-back-button.vue.d.ts.map +1 -1
  14. package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts +1 -1
  15. package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts.map +1 -1
  16. package/dist/shared/components/blade-navigation/composables/useBladeNavigation/internal/bladeRouteResolver.d.ts.map +1 -1
  17. package/dist/shared/components/change-password-button/change-password-button.vue.d.ts.map +1 -1
  18. package/dist/shared/components/logout-button/logout-button.vue.d.ts.map +1 -1
  19. package/dist/shared/components/settings-menu-item/settings-menu-item.vue.d.ts.map +1 -1
  20. package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +2 -2
  21. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +6 -6
  22. package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/dist/ui/components/atoms/vc-hint/vc-hint.vue.d.ts.map +1 -1
  25. package/dist/ui/components/atoms/vc-icon/icons/MenuBurgerIcon.vue.d.ts.map +1 -1
  26. package/dist/ui/components/atoms/vc-icon/icons/index.d.ts +0 -26
  27. package/dist/ui/components/atoms/vc-icon/icons/index.d.ts.map +1 -1
  28. package/dist/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue.d.ts.map +1 -1
  29. package/dist/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue.d.ts.map +1 -1
  30. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
  31. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts +0 -5
  32. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts.map +1 -1
  33. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts +0 -20
  34. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts.map +1 -1
  35. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts.map +1 -1
  36. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts +36 -0
  37. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue.d.ts.map +1 -0
  38. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue.d.ts +17 -0
  39. package/dist/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue.d.ts.map +1 -0
  40. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +16 -2381
  41. package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
  42. package/dist/ui/components/molecules/vc-form/vc-form.vue.d.ts.map +1 -1
  43. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +1 -1
  44. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
  45. package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +1 -1
  46. package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts.map +1 -1
  47. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/MenuSidebar.vue.d.ts.map +1 -1
  48. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue.d.ts.map +1 -1
  49. package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts.map +1 -1
  50. package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
  51. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue.d.ts.map +1 -1
  52. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue.d.ts.map +1 -1
  53. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-mobile.vue.d.ts.map +1 -1
  54. package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
  55. package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +2 -2
  56. package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +2 -2
  57. package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts.map +1 -1
  58. package/dist/ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue.d.ts.map +1 -1
  59. package/dist/vendor-boolbase-Cp9L0GAZ.js +25 -0
  60. package/dist/vendor-cheerio-HN9zIPZn.js +3135 -0
  61. package/dist/vendor-cheerio-select-5Ry0HvBq.js +306 -0
  62. package/dist/vendor-core-js-l0sNRNKZ.js +1 -0
  63. package/dist/vendor-css-select-DRIZ9kfZ.js +966 -0
  64. package/dist/vendor-css-what-DuPJ1HEF.js +448 -0
  65. package/dist/vendor-cypress-signalr-mock-BKdBJpdt.js +778 -0
  66. package/dist/vendor-date-fns-515YWkk-.js +6724 -0
  67. package/dist/vendor-dom-serializer-nQMsqjYW.js +286 -0
  68. package/dist/vendor-dom7-CJLPMwy5.js +941 -0
  69. package/dist/vendor-domelementtype-CjSzQey5.js +53 -0
  70. package/dist/vendor-domhandler-9z8cS16a.js +484 -0
  71. package/dist/vendor-dompurify-CRFzu7ib.js +1336 -0
  72. package/dist/vendor-domutils-Bc-Opz-v.js +981 -0
  73. package/dist/vendor-entities-Bfsx4xOQ.js +636 -0
  74. package/dist/vendor-floating-ui-core-wV8u8QP4.js +511 -0
  75. package/dist/vendor-floating-ui-dom-DDnRPs17.js +706 -0
  76. package/dist/vendor-floating-ui-utils-OMIFy1QU.js +296 -0
  77. package/dist/vendor-floating-ui-vue-D-tCDAMm.js +167 -0
  78. package/dist/vendor-fontsource-plus-jakarta-sans.css +1 -0
  79. package/dist/vendor-headlessui-vue-CY9FRgTb.js +83 -0
  80. package/dist/vendor-htmlparser2-B1dhFPOs.js +1426 -0
  81. package/dist/vendor-iconify-vue-DfRGgyNu.js +1840 -0
  82. package/dist/vendor-intlify-core-base-BuknsFQe.js +1876 -0
  83. package/dist/vendor-intlify-message-compiler-CuOQDWx1.js +1508 -0
  84. package/dist/vendor-intlify-shared-Cz4YRMuC.js +241 -0
  85. package/dist/vendor-iso-639-1-BJCk9DvE.js +819 -0
  86. package/dist/vendor-linkify-it-CKUf4vsc.js +830 -0
  87. package/dist/vendor-linkifyjs-BfyGgbCh.js +1756 -0
  88. package/dist/vendor-lodash-es-BySUOlwf.js +18333 -0
  89. package/dist/vendor-markdown-it-D-apazHa.js +6000 -0
  90. package/dist/vendor-markdown-it-task-lists-rxMVH6Ku.js +131 -0
  91. package/dist/vendor-mdurl-BNh2CCgT.js +537 -0
  92. package/dist/vendor-microsoft-applicationinsights-analytics-js-kG3lLg8X.js +1275 -0
  93. package/dist/vendor-microsoft-applicationinsights-cfgsync-js-C0uQkiQq.js +591 -0
  94. package/dist/vendor-microsoft-applicationinsights-channel-js-Dyd_PXA3.js +2153 -0
  95. package/dist/vendor-microsoft-applicationinsights-common-CfmP1_Qr.js +2470 -0
  96. package/dist/vendor-microsoft-applicationinsights-core-js-Cq4YSEvZ.js +6589 -0
  97. package/dist/vendor-microsoft-applicationinsights-dependencies-js-C56OBFr4.js +1510 -0
  98. package/dist/vendor-microsoft-applicationinsights-properties-js-CBJTBawx.js +761 -0
  99. package/dist/vendor-microsoft-applicationinsights-shims-CX8sJgar.js +70 -0
  100. package/dist/vendor-microsoft-applicationinsights-web-pim2ri-g.js +667 -0
  101. package/dist/vendor-microsoft-dynamicproto-js-CFBBUu9p.js +520 -0
  102. package/dist/vendor-microsoft-signalr-dUnlRsGm.js +3339 -0
  103. package/dist/vendor-moment-Mki5YqAR.js +5679 -0
  104. package/dist/vendor-nevware21-ts-async-CLMApQ9E.js +395 -0
  105. package/dist/vendor-nevware21-ts-utils-e8v8Jty3.js +1160 -0
  106. package/dist/vendor-normalize-css.css +1 -0
  107. package/dist/vendor-nth-check-Bx8TxtJt.js +157 -0
  108. package/dist/vendor-orderedmap-dGG6uMFJ.js +137 -0
  109. package/dist/vendor-parse5-Bt2NhSzR.js +8432 -0
  110. package/dist/vendor-parse5-htmlparser2-tree-adapter-BUUtKzf8.js +216 -0
  111. package/dist/vendor-popperjs-core-Cr2byIky.js +1790 -0
  112. package/dist/vendor-prettier-B4PaeWRQ.js +98 -0
  113. package/dist/vendor-prosemirror-commands-BH9lWGpW.js +561 -0
  114. package/dist/vendor-prosemirror-dropcursor-CeyPcxrA.js +146 -0
  115. package/dist/vendor-prosemirror-gapcursor-U8UoUJII.js +236 -0
  116. package/dist/vendor-prosemirror-history-BDaJkvNx.js +414 -0
  117. package/dist/vendor-prosemirror-keymap-BbWvIWmH.js +128 -0
  118. package/dist/vendor-prosemirror-markdown-gB0PXBbz.js +866 -0
  119. package/dist/vendor-prosemirror-model-BZu3WVcD.js +3463 -0
  120. package/dist/vendor-prosemirror-schema-list-Bl9NpKA7.js +158 -0
  121. package/dist/vendor-prosemirror-state-BvL9Pxph.js +1003 -0
  122. package/dist/vendor-prosemirror-tables-17qAnviK.js +2159 -0
  123. package/dist/vendor-prosemirror-transform-CE9VV3qg.js +2156 -0
  124. package/dist/vendor-prosemirror-view-CU2WTHT7.js +5811 -0
  125. package/dist/vendor-punycode-js-iAs5RxMf.js +441 -0
  126. package/dist/vendor-rope-sequence-BdXDKoGt.js +207 -0
  127. package/dist/vendor-semver-CVLMK-S4.js +2702 -0
  128. package/dist/vendor-ssr-window-s6OpKa3O.js +150 -0
  129. package/dist/vendor-swiper-CdiyNHVt.js +5679 -0
  130. package/dist/vendor-swiper.css +1 -0
  131. package/dist/vendor-tanstack-virtual-core-l0sNRNKZ.js +1 -0
  132. package/dist/vendor-tanstack-vue-virtual-l0sNRNKZ.js +1 -0
  133. package/dist/vendor-tippy-js-DWFe2TfK.js +1647 -0
  134. package/dist/vendor-tiptap-core-NfwGfaQk.js +4910 -0
  135. package/dist/vendor-tiptap-extension-blockquote-jmWBTtsI.js +57 -0
  136. package/dist/vendor-tiptap-extension-bold-p5frh4ak.js +97 -0
  137. package/dist/vendor-tiptap-extension-bubble-menu-KUhZSfrs.js +218 -0
  138. package/dist/vendor-tiptap-extension-bullet-list-COmZRoSB.js +73 -0
  139. package/dist/vendor-tiptap-extension-code-block-DyTARZss.js +221 -0
  140. package/dist/vendor-tiptap-extension-code-jVv6CXpX.js +75 -0
  141. package/dist/vendor-tiptap-extension-document-DssuotYs.js +13 -0
  142. package/dist/vendor-tiptap-extension-dropcursor-BoO0Qv91.js +26 -0
  143. package/dist/vendor-tiptap-extension-floating-menu-CrO8CN5w.js +165 -0
  144. package/dist/vendor-tiptap-extension-gapcursor-KpsWEoMD.js +30 -0
  145. package/dist/vendor-tiptap-extension-hard-break-ldOzhSvf.js +68 -0
  146. package/dist/vendor-tiptap-extension-heading-CKz2llX0.js +77 -0
  147. package/dist/vendor-tiptap-extension-history-DeKZ2VQ9.js +48 -0
  148. package/dist/vendor-tiptap-extension-horizontal-rule-CAjWRyDS.js +92 -0
  149. package/dist/vendor-tiptap-extension-image-ZagcEYuk.js +76 -0
  150. package/dist/vendor-tiptap-extension-italic-CM4xdznY.js +96 -0
  151. package/dist/vendor-tiptap-extension-link-Z-AMC4Ri.js +414 -0
  152. package/dist/vendor-tiptap-extension-list-item-BJi5QpXc.js +37 -0
  153. package/dist/vendor-tiptap-extension-ordered-list-C_TMrfBE.js +97 -0
  154. package/dist/vendor-tiptap-extension-paragraph-CQw0E0Au.js +39 -0
  155. package/dist/vendor-tiptap-extension-placeholder-BBNVKfa_.js +66 -0
  156. package/dist/vendor-tiptap-extension-strike-DUyMYX1Z.js +79 -0
  157. package/dist/vendor-tiptap-extension-table-cell-CoDIMPA5.js +47 -0
  158. package/dist/vendor-tiptap-extension-table-header-DvbGHnmw.js +47 -0
  159. package/dist/vendor-tiptap-extension-table-row-D1uqN5Aj.js +26 -0
  160. package/dist/vendor-tiptap-extension-table-tKS4MOM4.js +354 -0
  161. package/dist/vendor-tiptap-extension-text-DtRBhKB2.js +12 -0
  162. package/dist/vendor-tiptap-extension-underline-DqaSFp_P.js +50 -0
  163. package/dist/vendor-tiptap-markdown-7-PCADTU.js +1017 -0
  164. package/dist/vendor-tiptap-pm-l0sNRNKZ.js +1 -0
  165. package/dist/vendor-tiptap-starter-kit-CDSV_Zuu.js +88 -0
  166. package/dist/vendor-tiptap-vue-3-DZg2fjq_.js +268 -0
  167. package/dist/vendor-truncate-html-3qQY0Djo.js +196 -0
  168. package/dist/vendor-uc-micro-jjt6LQ65.js +23 -0
  169. package/dist/vendor-vee-validate-i18n-v_gHjRmD.js +154 -0
  170. package/dist/vendor-vee-validate-rules-DzV3VY3N.js +536 -0
  171. package/dist/vendor-vue-currency-input-DGAkEFBO.js +545 -0
  172. package/dist/vendor-vue-demi-l0sNRNKZ.js +1 -0
  173. package/dist/vendor-vue-devtools-api-DXYR8qBG.js +169 -0
  174. package/dist/vendor-vue-i18n-Co752uk3.js +1897 -0
  175. package/dist/vendor-vue3-application-insights-CYWFCr_J.js +119 -0
  176. package/dist/vendor-vue3-touch-events-BJEAiSa3.js +416 -0
  177. package/dist/vendor-vuepic-vue-datepicker-BSWXRSiu.js +5019 -0
  178. package/dist/vendor-vuepic-vue-datepicker.css +1 -0
  179. package/dist/vendor-vueuse-components-l1bL12mE.js +339 -0
  180. package/dist/vendor-vueuse-core-DGcJOmwG.js +7743 -0
  181. package/dist/vendor-vueuse-shared-_mOXsFuM.js +1568 -0
  182. package/dist/vendor-w3c-keyname-BOm2dtJm.js +121 -0
  183. package/package.json +22 -11
  184. package/shared/components/blade-navigation/components/vc-blade-navigation/_internal/vc-mobile-back-button.vue +3 -3
  185. package/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.ts +2 -1
  186. package/shared/components/blade-navigation/composables/useBladeNavigation/internal/bladeRouteResolver.ts +1 -0
  187. package/shared/components/change-password-button/change-password-button.vue +1 -2
  188. package/shared/components/logout-button/logout-button.vue +1 -2
  189. package/shared/components/notifications/components/notification-container/index.ts +1 -1
  190. package/shared/components/notifications/core/notification.ts +1 -1
  191. package/shared/components/settings-menu-item/settings-menu-item.vue +1 -0
  192. package/shared/components/sidebar/sidebar.vue +2 -2
  193. package/shared/modules/dynamic/pages/dynamic-blade-list.vue +2 -1
  194. package/ui/components/atoms/vc-hint/vc-hint.vue +2 -0
  195. package/ui/components/atoms/vc-icon/composables/use-icon.ts +1 -1
  196. package/ui/components/atoms/vc-icon/icons/MenuBurgerIcon.vue +18 -14
  197. package/ui/components/atoms/vc-icon/icons/index.ts +1 -27
  198. package/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue +7 -11
  199. package/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue +37 -31
  200. package/ui/components/atoms/vc-icon/vc-icon-examples.vue +1 -1
  201. package/ui/components/atoms/vc-icon/vc-icon.stories.ts +4 -5
  202. package/ui/components/atoms/vc-icon/vc-icon.vue +43 -186
  203. package/ui/components/atoms/vc-icon/vc-lucide-icon.vue +22 -70
  204. package/ui/components/atoms/vc-icon/vc-material-icon.vue +28 -59
  205. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +2 -3
  206. package/ui/components/molecules/vc-editor/_internal/vc-editor-button.vue +103 -0
  207. package/ui/components/molecules/vc-editor/_internal/vc-editor-toolbar.vue +252 -0
  208. package/ui/components/molecules/vc-editor/vc-editor.stories.ts +1 -4
  209. package/ui/components/molecules/vc-editor/vc-editor.vue +666 -360
  210. package/ui/components/molecules/vc-form/vc-form.vue +7 -5
  211. package/ui/components/molecules/vc-input/vc-input.vue +1 -1
  212. package/ui/components/molecules/vc-pagination/vc-pagination.vue +4 -17
  213. package/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarMobileActions.vue +1 -1
  214. package/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/MenuSidebar.vue +1 -3
  215. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +1 -4
  216. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +1 -3
  217. package/ui/components/organisms/vc-app/vc-app.backupsb.ts +214 -214
  218. package/ui/components/organisms/vc-app/vc-app.vue +3 -5
  219. package/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +3 -10
  220. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/mobile/vc-blade-toolbar-mobile.vue +1 -1
  221. package/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-desktop.vue +2 -2
  222. package/ui/components/organisms/vc-blade/_internal/vc-blade-widget-container/_internal/vc-widget-container-mobile.vue +2 -2
  223. package/ui/components/organisms/vc-blade/vc-blade.vue +4 -5
  224. package/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +1 -3
  225. package/ui/components/organisms/vc-table/_internal/vc-table-header/vc-table-header.vue +1 -2
  226. package/ui/components/organisms/vc-table/composables/useTableState.ts +5 -5
  227. package/dist/apl-B2DGVGxc.js +0 -76
  228. package/dist/asciiarmor-2LVJmxlE.js +0 -34
  229. package/dist/asn1-jKiBa2Ya.js +0 -95
  230. package/dist/asterisk-DS281yxp.js +0 -271
  231. package/dist/brainfuck-C_p9pTT8.js +0 -34
  232. package/dist/clike-DGTaUp48.js +0 -620
  233. package/dist/clojure-CCKyeQKf.js +0 -800
  234. package/dist/cmake-CuaCgAKt.js +0 -28
  235. package/dist/cobol-BlTKFDRj.js +0 -72
  236. package/dist/coffeescript-BVCvwO8I.js +0 -179
  237. package/dist/commonlisp-D_kxz07b.js +0 -75
  238. package/dist/crystal-D309uH6_.js +0 -217
  239. package/dist/css-BkF-NPzE.js +0 -1553
  240. package/dist/cypher-BMq4Fwjl.js +0 -68
  241. package/dist/d-BZcgY6La.js +0 -127
  242. package/dist/diff-Cg9d_RX2.js +0 -18
  243. package/dist/dockerfile-DIy8NleC.js +0 -194
  244. package/dist/dtd-CtLokQ-U.js +0 -84
  245. package/dist/dylan-QYeExnWK.js +0 -234
  246. package/dist/ebnf-DUPDuY4r.js +0 -78
  247. package/dist/ecl-CiXN-g_D.js +0 -121
  248. package/dist/eiffel-yQhjl4T1.js +0 -110
  249. package/dist/elm-CNT9vbN0.js +0 -108
  250. package/dist/erlang-CFOYdy9e.js +0 -487
  251. package/dist/factor-DDOC7X6P.js +0 -65
  252. package/dist/fcl-CPC2WYrI.js +0 -103
  253. package/dist/forth-BmxRyE9S.js +0 -60
  254. package/dist/fortran-9bvPyrOW.js +0 -442
  255. package/dist/gas-cpmYfFX2.js +0 -183
  256. package/dist/gherkin-CJuwpceU.js +0 -34
  257. package/dist/groovy-DZeT_VM-.js +0 -146
  258. package/dist/haskell-Bvt3Qq1t.js +0 -375
  259. package/dist/haxe-70NVW1pR.js +0 -359
  260. package/dist/http-D9LttvKF.js +0 -44
  261. package/dist/idl-B6TRFYjl.js +0 -947
  262. package/dist/index-4DWvmoYg.js +0 -71
  263. package/dist/index-52o7mJaX.js +0 -156
  264. package/dist/index-B0KatioT.js +0 -98
  265. package/dist/index-BP3W8zuk.js +0 -268
  266. package/dist/index-BykT5L1A.js +0 -148134
  267. package/dist/index-CfXo9hsG.js +0 -75
  268. package/dist/index-Ch37pBUt.js +0 -308
  269. package/dist/index-D2KGkAYT.js +0 -93
  270. package/dist/index-D83zQom_.js +0 -58
  271. package/dist/index-DuQrVLbu.js +0 -134
  272. package/dist/index-_fdMid5h.js +0 -288
  273. package/dist/index-a1wO-owY.js +0 -545
  274. package/dist/index-crMpNSFe.js +0 -611
  275. package/dist/index-dmBRpHHY.js +0 -137
  276. package/dist/index-kBdB14Fz.js +0 -341
  277. package/dist/index-uBhy41le.js +0 -249
  278. package/dist/index-zZrijNsr.js +0 -299
  279. package/dist/javascript-C2yteZeJ.js +0 -691
  280. package/dist/jinja2-DnB6dQmV.js +0 -154
  281. package/dist/julia-DpvXAuO6.js +0 -241
  282. package/dist/livescript-CanGTf8u.js +0 -272
  283. package/dist/lua-XplVlWi_.js +0 -217
  284. package/dist/mathematica-jaRHnSxC.js +0 -35
  285. package/dist/mbox-BctzC1hL.js +0 -76
  286. package/dist/mirc-CFBPAOaF.js +0 -72
  287. package/dist/mllike-BSnXJBGA.js +0 -272
  288. package/dist/modelica-vUgVs--1.js +0 -93
  289. package/dist/mscgen-Cpl0NYLN.js +0 -104
  290. package/dist/mumps-CQoS1kWX.js +0 -25
  291. package/dist/nginx-zDPm3Z74.js +0 -89
  292. package/dist/nsis-fePjrhq7.js +0 -62
  293. package/dist/ntriples-CsNjv2QF.js +0 -79
  294. package/dist/octave-C8PmmSRH.js +0 -143
  295. package/dist/oz-Ce8aN8oE.js +0 -151
  296. package/dist/pascal-De0D6mP7.js +0 -77
  297. package/dist/perl-B4bSCe1C.js +0 -915
  298. package/dist/pig-D24Z8EXi.js +0 -54
  299. package/dist/powershell-DkYVfTzP.js +0 -249
  300. package/dist/properties-Dn9wna3M.js +0 -26
  301. package/dist/protobuf-BPIjwpzm.js +0 -49
  302. package/dist/pug-CwAQJzGR.js +0 -248
  303. package/dist/puppet-nyd4dhjf.js +0 -45
  304. package/dist/python-BkR3uSy8.js +0 -313
  305. package/dist/q-DXjKs-tC.js +0 -83
  306. package/dist/r-LKEuhEGI.js +0 -104
  307. package/dist/rpm-IznJm2Xc.js +0 -57
  308. package/dist/ruby-CcYfvIk6.js +0 -228
  309. package/dist/sas-7E8yHoCW.js +0 -105
  310. package/dist/scheme-DjibxsNh.js +0 -124
  311. package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts +0 -113
  312. package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts.map +0 -1
  313. package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts +0 -3
  314. package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts.map +0 -1
  315. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +0 -102
  316. package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts.map +0 -1
  317. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts +0 -4
  318. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts.map +0 -1
  319. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts +0 -3
  320. package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts.map +0 -1
  321. package/dist/shell-C0C2sNA_.js +0 -182
  322. package/dist/sieve-Bwz7vjP5.js +0 -72
  323. package/dist/simple-mode-B0dvCdAA.js +0 -89
  324. package/dist/smalltalk-Bhddl2pB.js +0 -48
  325. package/dist/solr-BNlsLglM.js +0 -41
  326. package/dist/sparql-FarWu_Gb.js +0 -197
  327. package/dist/spreadsheet-C-cy4P5N.js +0 -49
  328. package/dist/sql-CfG5lQ3l.js +0 -282
  329. package/dist/stex-Du4h4KAU.js +0 -129
  330. package/dist/stylus-CAdqWld3.js +0 -250
  331. package/dist/swift-DSxqR9R6.js +0 -230
  332. package/dist/tcl-xfoLljhY.js +0 -81
  333. package/dist/textile-D1AWE-pc.js +0 -295
  334. package/dist/tiddlywiki-5wqsXtSk.js +0 -155
  335. package/dist/tiki-__Kn3CeS.js +0 -181
  336. package/dist/toml-BHiuTcfn.js +0 -49
  337. package/dist/troff-D2UO-fKf.js +0 -35
  338. package/dist/ttcn-Bsa4sfRm.js +0 -123
  339. package/dist/ttcn-cfg-Bac_acMi.js +0 -88
  340. package/dist/turtle-xwJUxoPV.js +0 -80
  341. package/dist/ui/components/atoms/vc-icon/icons/AppWindowIcon.vue.d.ts +0 -7
  342. package/dist/ui/components/atoms/vc-icon/icons/AppWindowIcon.vue.d.ts.map +0 -1
  343. package/dist/ui/components/atoms/vc-icon/icons/ArrowLeftIcon.vue.d.ts +0 -7
  344. package/dist/ui/components/atoms/vc-icon/icons/ArrowLeftIcon.vue.d.ts.map +0 -1
  345. package/dist/ui/components/atoms/vc-icon/icons/ArrowRightIcon.vue.d.ts +0 -7
  346. package/dist/ui/components/atoms/vc-icon/icons/ArrowRightIcon.vue.d.ts.map +0 -1
  347. package/dist/ui/components/atoms/vc-icon/icons/BellIcon.vue.d.ts +0 -7
  348. package/dist/ui/components/atoms/vc-icon/icons/BellIcon.vue.d.ts.map +0 -1
  349. package/dist/ui/components/atoms/vc-icon/icons/ChevronDownIcon.vue.d.ts +0 -7
  350. package/dist/ui/components/atoms/vc-icon/icons/ChevronDownIcon.vue.d.ts.map +0 -1
  351. package/dist/ui/components/atoms/vc-icon/icons/ChevronLeftIcon.vue.d.ts +0 -7
  352. package/dist/ui/components/atoms/vc-icon/icons/ChevronLeftIcon.vue.d.ts.map +0 -1
  353. package/dist/ui/components/atoms/vc-icon/icons/ChevronRightIcon.vue.d.ts +0 -7
  354. package/dist/ui/components/atoms/vc-icon/icons/ChevronRightIcon.vue.d.ts.map +0 -1
  355. package/dist/ui/components/atoms/vc-icon/icons/ChevronUpIcon.vue.d.ts +0 -7
  356. package/dist/ui/components/atoms/vc-icon/icons/ChevronUpIcon.vue.d.ts.map +0 -1
  357. package/dist/ui/components/atoms/vc-icon/icons/CircleDotsIcon.vue.d.ts +0 -7
  358. package/dist/ui/components/atoms/vc-icon/icons/CircleDotsIcon.vue.d.ts.map +0 -1
  359. package/dist/ui/components/atoms/vc-icon/icons/CrossSignIcon.vue.d.ts +0 -7
  360. package/dist/ui/components/atoms/vc-icon/icons/CrossSignIcon.vue.d.ts.map +0 -1
  361. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowLeftIcon.vue.d.ts +0 -7
  362. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowLeftIcon.vue.d.ts.map +0 -1
  363. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowRightIcon.vue.d.ts +0 -7
  364. package/dist/ui/components/atoms/vc-icon/icons/DoubleArrowRightIcon.vue.d.ts.map +0 -1
  365. package/dist/ui/components/atoms/vc-icon/icons/FulfillmentCentersIcon.vue.d.ts +0 -7
  366. package/dist/ui/components/atoms/vc-icon/icons/FulfillmentCentersIcon.vue.d.ts.map +0 -1
  367. package/dist/ui/components/atoms/vc-icon/icons/GridDotsIcon.vue.d.ts +0 -7
  368. package/dist/ui/components/atoms/vc-icon/icons/GridDotsIcon.vue.d.ts.map +0 -1
  369. package/dist/ui/components/atoms/vc-icon/icons/LogoutIcon.vue.d.ts +0 -7
  370. package/dist/ui/components/atoms/vc-icon/icons/LogoutIcon.vue.d.ts.map +0 -1
  371. package/dist/ui/components/atoms/vc-icon/icons/MinusSignIcon.vue.d.ts +0 -7
  372. package/dist/ui/components/atoms/vc-icon/icons/MinusSignIcon.vue.d.ts.map +0 -1
  373. package/dist/ui/components/atoms/vc-icon/icons/OffersIcon.vue.d.ts +0 -7
  374. package/dist/ui/components/atoms/vc-icon/icons/OffersIcon.vue.d.ts.map +0 -1
  375. package/dist/ui/components/atoms/vc-icon/icons/OrdersIcon.vue.d.ts +0 -7
  376. package/dist/ui/components/atoms/vc-icon/icons/OrdersIcon.vue.d.ts.map +0 -1
  377. package/dist/ui/components/atoms/vc-icon/icons/PeopleIcon.vue.d.ts +0 -7
  378. package/dist/ui/components/atoms/vc-icon/icons/PeopleIcon.vue.d.ts.map +0 -1
  379. package/dist/ui/components/atoms/vc-icon/icons/PlusSignIcon.vue.d.ts +0 -7
  380. package/dist/ui/components/atoms/vc-icon/icons/PlusSignIcon.vue.d.ts.map +0 -1
  381. package/dist/ui/components/atoms/vc-icon/icons/ProductsIcon.vue.d.ts +0 -7
  382. package/dist/ui/components/atoms/vc-icon/icons/ProductsIcon.vue.d.ts.map +0 -1
  383. package/dist/ui/components/atoms/vc-icon/icons/ProfileIcon.vue.d.ts +0 -7
  384. package/dist/ui/components/atoms/vc-icon/icons/ProfileIcon.vue.d.ts.map +0 -1
  385. package/dist/ui/components/atoms/vc-icon/icons/SearchIcon.vue.d.ts +0 -7
  386. package/dist/ui/components/atoms/vc-icon/icons/SearchIcon.vue.d.ts.map +0 -1
  387. package/dist/ui/components/atoms/vc-icon/icons/SettingsBoltIcon.vue.d.ts +0 -7
  388. package/dist/ui/components/atoms/vc-icon/icons/SettingsBoltIcon.vue.d.ts.map +0 -1
  389. package/dist/ui/components/atoms/vc-icon/icons/ShoppingCardIcon.vue.d.ts +0 -7
  390. package/dist/ui/components/atoms/vc-icon/icons/ShoppingCardIcon.vue.d.ts.map +0 -1
  391. package/dist/ui/components/atoms/vc-icon/icons/VendorSwitchIcon.vue.d.ts +0 -7
  392. package/dist/ui/components/atoms/vc-icon/icons/VendorSwitchIcon.vue.d.ts.map +0 -1
  393. package/dist/ui/components/atoms/vc-icon/icons/VertDotsIcon.vue.d.ts +0 -7
  394. package/dist/ui/components/atoms/vc-icon/icons/VertDotsIcon.vue.d.ts.map +0 -1
  395. package/dist/vb-c2kQGd6-.js +0 -74
  396. package/dist/vbscript-1f_Dhg5H.js +0 -324
  397. package/dist/velocity-DJd0pTTC.js +0 -96
  398. package/dist/verilog-CiS1jyi5.js +0 -262
  399. package/dist/vhdl-T9HkrbI2.js +0 -106
  400. package/dist/webidl-CjfDENEo.js +0 -155
  401. package/dist/xquery-BUQdORAS.js +0 -422
  402. package/dist/yacas-C0absKBh.js +0 -73
  403. package/dist/z80-Pki2zAjW.js +0 -61
  404. package/shared/modules/dynamic/components/fields/storybook/Button.stories.ts +0 -186
  405. package/shared/modules/dynamic/components/fields/storybook/Card.stories.ts +0 -175
  406. package/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.ts +0 -185
  407. package/shared/modules/dynamic/components/fields/storybook/ContentField.stories.ts +0 -245
  408. package/shared/modules/dynamic/components/fields/storybook/EditorField.stories.ts +0 -192
  409. package/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.ts +0 -347
  410. package/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.ts +0 -239
  411. package/shared/modules/dynamic/components/fields/storybook/ImageField.stories.ts +0 -186
  412. package/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.ts +0 -281
  413. package/shared/modules/dynamic/components/fields/storybook/InputField.stories.ts +0 -312
  414. package/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.ts +0 -361
  415. package/shared/modules/dynamic/components/fields/storybook/RadioButtonGroup.stories.ts +0 -224
  416. package/shared/modules/dynamic/components/fields/storybook/RatingField.stories.ts +0 -131
  417. package/shared/modules/dynamic/components/fields/storybook/SelectField.stories.ts +0 -666
  418. package/shared/modules/dynamic/components/fields/storybook/StatusField.stories.ts +0 -202
  419. package/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.ts +0 -178
  420. package/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.ts +0 -203
  421. package/shared/modules/dynamic/components/fields/storybook/VideoField.stories.ts +0 -92
  422. package/shared/modules/dynamic/components/fields/storybook/common/args.ts +0 -130
  423. package/shared/modules/dynamic/components/fields/storybook/common/templates.ts +0 -8
  424. package/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.ts +0 -54
  425. package/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.ts +0 -16
  426. package/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.ts +0 -41
  427. package/ui/components/atoms/vc-icon/icons/AppWindowIcon.vue +0 -15
  428. package/ui/components/atoms/vc-icon/icons/ArrowLeftIcon.vue +0 -20
  429. package/ui/components/atoms/vc-icon/icons/ArrowRightIcon.vue +0 -13
  430. package/ui/components/atoms/vc-icon/icons/BellIcon.vue +0 -14
  431. package/ui/components/atoms/vc-icon/icons/ChevronDownIcon.vue +0 -13
  432. package/ui/components/atoms/vc-icon/icons/ChevronLeftIcon.vue +0 -13
  433. package/ui/components/atoms/vc-icon/icons/ChevronRightIcon.vue +0 -13
  434. package/ui/components/atoms/vc-icon/icons/ChevronUpIcon.vue +0 -13
  435. package/ui/components/atoms/vc-icon/icons/CircleDotsIcon.vue +0 -16
  436. package/ui/components/atoms/vc-icon/icons/CrossSignIcon.vue +0 -20
  437. package/ui/components/atoms/vc-icon/icons/DoubleArrowLeftIcon.vue +0 -14
  438. package/ui/components/atoms/vc-icon/icons/DoubleArrowRightIcon.vue +0 -14
  439. package/ui/components/atoms/vc-icon/icons/FulfillmentCentersIcon.vue +0 -27
  440. package/ui/components/atoms/vc-icon/icons/GridDotsIcon.vue +0 -22
  441. package/ui/components/atoms/vc-icon/icons/LogoutIcon.vue +0 -13
  442. package/ui/components/atoms/vc-icon/icons/MinusSignIcon.vue +0 -14
  443. package/ui/components/atoms/vc-icon/icons/OffersIcon.vue +0 -23
  444. package/ui/components/atoms/vc-icon/icons/OrdersIcon.vue +0 -19
  445. package/ui/components/atoms/vc-icon/icons/PeopleIcon.vue +0 -21
  446. package/ui/components/atoms/vc-icon/icons/PlusSignIcon.vue +0 -20
  447. package/ui/components/atoms/vc-icon/icons/ProductsIcon.vue +0 -23
  448. package/ui/components/atoms/vc-icon/icons/ProfileIcon.vue +0 -18
  449. package/ui/components/atoms/vc-icon/icons/SearchIcon.vue +0 -14
  450. package/ui/components/atoms/vc-icon/icons/SettingsBoltIcon.vue +0 -21
  451. package/ui/components/atoms/vc-icon/icons/ShoppingCardIcon.vue +0 -16
  452. package/ui/components/atoms/vc-icon/icons/VendorSwitchIcon.vue +0 -26
  453. package/ui/components/atoms/vc-icon/icons/VertDotsIcon.vue +0 -19
@@ -0,0 +1,2153 @@
1
+ import { d as dynamicProto } from './vendor-microsoft-dynamicproto-js-CFBBUu9p.js';
2
+ import { E as Event, T as Trace, P as PageView, f as PageViewPerformance, g as Exception, M as Metric, R as RemoteDependencyData, q as Envelope, H as HttpMethod, C as CtxTagKeys, n as dataSanitizeString, S as SampleRate, r as Data, a as utlGetSessionStorage, b as utlSetSessionStorage, c as utlRemoveSessionStorage, t as ContextTagKeys, B as BreezeChannelIdentifier, v as createOfflineListener, u as utlCanUseSessionStorage, w as isInternalApplicationInsightsEndpoint, x as ProcessLegacy, y as RequestHeaders, z as DEFAULT_BREEZE_ENDPOINT, F as DEFAULT_BREEZE_PATH, k as utlSetStoragePrefix } from './vendor-microsoft-applicationinsights-common-CfmP1_Qr.js';
3
+ import { i as isNullOrUndefined, x as objForEachKey, D as isNumber, w as isString, E as isTruthy, d as arrForEach, r as isFunction, F as arrIndexOf, v as isArray, e as dumpObj, A as isObject, n as objDeepFreeze, G as isPromiseLike, o as objDefine, m as mathFloor, H as mathMax, I as mathMin, u as utcNow, s as scheduleTimeout, J as getInst } from './vendor-nevware21-ts-utils-e8v8Jty3.js';
4
+ import { b as _warnToConsole, _ as _throwInternal, h as hasJSON, c as getJSON, x as toISOString, y as optimizeObject, z as setValue, a as getExceptionName, s as safeGetLogger, m as mergeEvtNamespace, e as createUniqueNamespace, o as onConfigChange, i as createProcessTelemetryContext, A as ActiveStatus, C as isBeaconsSupported, v as isFetchSupported, S as SenderPostManager, D as prependTransports, E as getIEVersion, F as runTargetUnload, G as parseResponse, H as formatErrorMessageXdr, J as formatErrorMessageXhr, K as isFeatureEnabled, n as cfgDfValidate, l as cfgDfBoolean, L as objExtend, B as BaseTelemetryPlugin } from './vendor-microsoft-applicationinsights-core-js-Cq4YSEvZ.js';
5
+ import { a as __assignFn, _ as __extendsFn } from './vendor-microsoft-applicationinsights-shims-CX8sJgar.js';
6
+
7
+ /*
8
+ * Application Insights JavaScript SDK - Channel, 3.3.9
9
+ * Copyright (c) Microsoft and contributors. All rights reserved.
10
+ */
11
+
12
+
13
+ // ###################################################################################################################################################
14
+ // Note: DON'T Export these const from the package as we are still targeting IE/ES5 this will export a mutable variables that someone could change ###
15
+ // ###################################################################################################################################################
16
+ // Generally you should only put values that are used more than 2 times and then only if not already exposed as a constant (such as SdkCoreNames)
17
+ // as when using "short" named values from here they will be will be minified smaller than the SdkCoreNames[eSdkCoreNames.xxxx] value.
18
+ var STR_DURATION = "duration";
19
+
20
+ /*
21
+ * Application Insights JavaScript SDK - Channel, 3.3.9
22
+ * Copyright (c) Microsoft and contributors. All rights reserved.
23
+ */
24
+
25
+
26
+ // @skip-file-minify
27
+ // ##############################################################
28
+ // AUTO GENERATED FILE: This file is Auto Generated during build.
29
+ // ##############################################################
30
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
31
+ // Note: DON'T Export these const from the package as we are still targeting ES5 which can result in a mutable variables that someone could change!!!
32
+ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
33
+ var _DYN_TAGS = "tags"; // Count: 17
34
+ var _DYN_DEVICE_TYPE = "deviceType"; // Count: 3
35
+ var _DYN_DATA = "data"; // Count: 13
36
+ var _DYN_NAME = "name"; // Count: 8
37
+ var _DYN_TRACE_ID = "traceID"; // Count: 5
38
+ var _DYN_LENGTH = "length"; // Count: 38
39
+ var _DYN_STRINGIFY = "stringify"; // Count: 5
40
+ var _DYN_MEASUREMENTS = "measurements"; // Count: 7
41
+ var _DYN_DATA_TYPE = "dataType"; // Count: 10
42
+ var _DYN_ENVELOPE_TYPE = "envelopeType"; // Count: 7
43
+ var _DYN_TO_STRING = "toString"; // Count: 7
44
+ var _DYN_ENQUEUE = "enqueue"; // Count: 7
45
+ var _DYN_COUNT = "count"; // Count: 7
46
+ var _DYN_PUSH = "push"; // Count: 9
47
+ var _DYN_EMIT_LINE_DELIMITED_0 = "emitLineDelimitedJson"; // Count: 3
48
+ var _DYN_CLEAR = "clear"; // Count: 6
49
+ var _DYN_MARK_AS_SENT = "markAsSent"; // Count: 4
50
+ var _DYN_CLEAR_SENT = "clearSent"; // Count: 5
51
+ var _DYN_BUFFER_OVERRIDE = "bufferOverride"; // Count: 3
52
+ var _DYN__BUFFER__KEY = "BUFFER_KEY"; // Count: 5
53
+ var _DYN__SENT__BUFFER__KEY = "SENT_BUFFER_KEY"; // Count: 8
54
+ var _DYN_CONCAT = "concat"; // Count: 6
55
+ var _DYN__MAX__BUFFER__SIZE = "MAX_BUFFER_SIZE"; // Count: 5
56
+ var _DYN_TRIGGER_SEND = "triggerSend"; // Count: 5
57
+ var _DYN_DIAG_LOG = "diagLog"; // Count: 16
58
+ var _DYN_INITIALIZE = "initialize"; // Count: 3
59
+ var _DYN__SENDER = "_sender"; // Count: 5
60
+ var _DYN_ENDPOINT_URL = "endpointUrl"; // Count: 5
61
+ var _DYN_INSTRUMENTATION_KEY = "instrumentationKey"; // Count: 5
62
+ var _DYN_CUSTOM_HEADERS = "customHeaders"; // Count: 3
63
+ var _DYN_MAX_BATCH_SIZE_IN_BY1 = "maxBatchSizeInBytes"; // Count: 2
64
+ var _DYN_ONUNLOAD_DISABLE_BEA2 = "onunloadDisableBeacon"; // Count: 3
65
+ var _DYN_IS_BEACON_API_DISABL3 = "isBeaconApiDisabled"; // Count: 3
66
+ var _DYN_ALWAYS_USE_XHR_OVERR4 = "alwaysUseXhrOverride"; // Count: 2
67
+ var _DYN_ENABLE_SESSION_STORA5 = "enableSessionStorageBuffer"; // Count: 2
68
+ var _DYN__BUFFER = "_buffer"; // Count: 9
69
+ var _DYN_ONUNLOAD_DISABLE_FET6 = "onunloadDisableFetch"; // Count: 2
70
+ var _DYN_DISABLE_SEND_BEACON_7 = "disableSendBeaconSplit"; // Count: 2
71
+ var _DYN_GET_SENDER_INST = "getSenderInst"; // Count: 4
72
+ var _DYN__ON_ERROR = "_onError"; // Count: 7
73
+ var _DYN__ON_PARTIAL_SUCCESS = "_onPartialSuccess"; // Count: 3
74
+ var _DYN__ON_SUCCESS = "_onSuccess"; // Count: 6
75
+ var _DYN_ITEMS_RECEIVED = "itemsReceived"; // Count: 3
76
+ var _DYN_ITEMS_ACCEPTED = "itemsAccepted"; // Count: 3
77
+ var _DYN_BASE_TYPE = "baseType"; // Count: 4
78
+ var _DYN_SAMPLE_RATE = "sampleRate"; // Count: 4
79
+ var _DYN_GET_HASH_CODE_SCORE = "getHashCodeScore"; // Count: 4
80
+
81
+ /*
82
+ * Application Insights JavaScript SDK - Channel, 3.3.9
83
+ * Copyright (c) Microsoft and contributors. All rights reserved.
84
+ */
85
+ // these two constants are used to filter out properties not needed when trying to extract custom properties and measurements from the incoming payload
86
+ var strBaseType = "baseType";
87
+ var strBaseData = "baseData";
88
+ var strProperties = "properties";
89
+ var strTrue = "true";
90
+ function _setValueIf(target, field, value) {
91
+ return setValue(target, field, value, isTruthy);
92
+ }
93
+ /*
94
+ * Maps Part A data from CS 4.0
95
+ */
96
+ function _extractPartAExtensions(logger, item, env) {
97
+ // todo: switch to keys from common in this method
98
+ var envTags = env[_DYN_TAGS /* @min:%2etags */] = env[_DYN_TAGS /* @min:%2etags */] || {};
99
+ var itmExt = item.ext = item.ext || {};
100
+ var itmTags = item[_DYN_TAGS /* @min:%2etags */] = item[_DYN_TAGS /* @min:%2etags */] || [];
101
+ var extUser = itmExt.user;
102
+ if (extUser) {
103
+ _setValueIf(envTags, CtxTagKeys.userAuthUserId, extUser.authId);
104
+ _setValueIf(envTags, CtxTagKeys.userId, extUser.id || extUser.localId);
105
+ }
106
+ var extApp = itmExt.app;
107
+ if (extApp) {
108
+ _setValueIf(envTags, CtxTagKeys.sessionId, extApp.sesId);
109
+ }
110
+ var extDevice = itmExt.device;
111
+ if (extDevice) {
112
+ _setValueIf(envTags, CtxTagKeys.deviceId, extDevice.id || extDevice.localId);
113
+ _setValueIf(envTags, CtxTagKeys[_DYN_DEVICE_TYPE /* @min:%2edeviceType */], extDevice.deviceClass);
114
+ _setValueIf(envTags, CtxTagKeys.deviceIp, extDevice.ip);
115
+ _setValueIf(envTags, CtxTagKeys.deviceModel, extDevice.model);
116
+ _setValueIf(envTags, CtxTagKeys[_DYN_DEVICE_TYPE /* @min:%2edeviceType */], extDevice[_DYN_DEVICE_TYPE /* @min:%2edeviceType */]);
117
+ }
118
+ var web = item.ext.web;
119
+ if (web) {
120
+ _setValueIf(envTags, CtxTagKeys.deviceLanguage, web.browserLang);
121
+ _setValueIf(envTags, CtxTagKeys.deviceBrowserVersion, web.browserVer);
122
+ _setValueIf(envTags, CtxTagKeys.deviceBrowser, web.browser);
123
+ var envData = env[_DYN_DATA /* @min:%2edata */] = env[_DYN_DATA /* @min:%2edata */] || {};
124
+ var envBaseData = envData[strBaseData] = envData[strBaseData] || {};
125
+ var envProps = envBaseData[strProperties] = envBaseData[strProperties] || {};
126
+ _setValueIf(envProps, "domain", web.domain);
127
+ _setValueIf(envProps, "isManual", web.isManual ? strTrue : null);
128
+ _setValueIf(envProps, "screenRes", web.screenRes);
129
+ _setValueIf(envProps, "userConsent", web.userConsent ? strTrue : null);
130
+ }
131
+ var extOs = itmExt.os;
132
+ if (extOs) {
133
+ _setValueIf(envTags, CtxTagKeys.deviceOS, extOs[_DYN_NAME /* @min:%2ename */]);
134
+ _setValueIf(envTags, CtxTagKeys.deviceOSVersion, extOs.osVer);
135
+ }
136
+ // No support for mapping Trace.traceState to 2.0 as it is currently empty
137
+ var extTrace = itmExt.trace;
138
+ if (extTrace) {
139
+ _setValueIf(envTags, CtxTagKeys.operationParentId, extTrace.parentID);
140
+ _setValueIf(envTags, CtxTagKeys.operationName, dataSanitizeString(logger, extTrace[_DYN_NAME /* @min:%2ename */]));
141
+ _setValueIf(envTags, CtxTagKeys.operationId, extTrace[_DYN_TRACE_ID /* @min:%2etraceID */]);
142
+ }
143
+ // Sample 4.0 schema
144
+ // {
145
+ // "time" : "2018-09-05T22:51:22.4936Z",
146
+ // "name" : "MetricWithNamespace",
147
+ // "iKey" : "ABC-5a4cbd20-e601-4ef5-a3c6-5d6577e4398e",
148
+ // "ext": { "cloud": {
149
+ // "role": "WATSON3",
150
+ // "roleInstance": "CO4AEAP00000260"
151
+ // },
152
+ // "device": {}, "correlation": {} },
153
+ // "tags": [
154
+ // { "amazon.region" : "east2" },
155
+ // { "os.expid" : "wp:02df239" }
156
+ // ]
157
+ // }
158
+ var tgs = {};
159
+ // deals with tags.push({object})
160
+ for (var i = itmTags[_DYN_LENGTH /* @min:%2elength */] - 1; i >= 0; i--) {
161
+ var tg = itmTags[i];
162
+ objForEachKey(tg, function (key, value) {
163
+ tgs[key] = value;
164
+ });
165
+ itmTags.splice(i, 1);
166
+ }
167
+ // deals with tags[key]=value (and handles hasOwnProperty)
168
+ objForEachKey(itmTags, function (tg, value) {
169
+ tgs[tg] = value;
170
+ });
171
+ var theTags = __assignFn(__assignFn({}, envTags), tgs);
172
+ if (!theTags[CtxTagKeys.internalSdkVersion]) {
173
+ // Append a version in case it is not already set
174
+ theTags[CtxTagKeys.internalSdkVersion] = dataSanitizeString(logger, "javascript:".concat(EnvelopeCreator.Version), 64);
175
+ }
176
+ env[_DYN_TAGS /* @min:%2etags */] = optimizeObject(theTags);
177
+ }
178
+ function _extractPropsAndMeasurements(data, properties, measurements) {
179
+ if (!isNullOrUndefined(data)) {
180
+ objForEachKey(data, function (key, value) {
181
+ if (isNumber(value)) {
182
+ measurements[key] = value;
183
+ }
184
+ else if (isString(value)) {
185
+ properties[key] = value;
186
+ }
187
+ else if (hasJSON()) {
188
+ properties[key] = getJSON()[_DYN_STRINGIFY /* @min:%2estringify */](value);
189
+ }
190
+ });
191
+ }
192
+ }
193
+ function _convertPropsUndefinedToCustomDefinedValue(properties, customUndefinedValue) {
194
+ if (!isNullOrUndefined(properties)) {
195
+ objForEachKey(properties, function (key, value) {
196
+ properties[key] = value || customUndefinedValue;
197
+ });
198
+ }
199
+ }
200
+ // TODO: Do we want this to take logger as arg or use this._logger as nonstatic?
201
+ function _createEnvelope(logger, envelopeType, telemetryItem, data) {
202
+ var envelope = new Envelope(logger, data, envelopeType);
203
+ _setValueIf(envelope, "sampleRate", telemetryItem[SampleRate]);
204
+ if ((telemetryItem[strBaseData] || {}).startTime) {
205
+ // Starting from Version 3.0.3, the time property will be assigned by the startTime value,
206
+ // which records the loadEvent time for the pageView event.
207
+ envelope.time = toISOString(telemetryItem[strBaseData].startTime);
208
+ }
209
+ envelope.iKey = telemetryItem.iKey;
210
+ var iKeyNoDashes = telemetryItem.iKey.replace(/-/g, "");
211
+ envelope[_DYN_NAME /* @min:%2ename */] = envelope[_DYN_NAME /* @min:%2ename */].replace("{0}", iKeyNoDashes);
212
+ // extract all extensions from ctx
213
+ _extractPartAExtensions(logger, telemetryItem, envelope);
214
+ // loop through the envelope tags (extension of Part A) and pick out the ones that should go in outgoing envelope tags
215
+ telemetryItem[_DYN_TAGS /* @min:%2etags */] = telemetryItem[_DYN_TAGS /* @min:%2etags */] || [];
216
+ return optimizeObject(envelope);
217
+ }
218
+ function EnvelopeCreatorInit(logger, telemetryItem) {
219
+ if (isNullOrUndefined(telemetryItem[strBaseData])) {
220
+ _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, 46 /* _eInternalMessageId.TelemetryEnvelopeInvalid */, "telemetryItem.baseData cannot be null.");
221
+ }
222
+ }
223
+ var EnvelopeCreator = {
224
+ Version: '3.3.9'
225
+ };
226
+ function DependencyEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
227
+ EnvelopeCreatorInit(logger, telemetryItem);
228
+ var customMeasurements = telemetryItem[strBaseData][_DYN_MEASUREMENTS /* @min:%2emeasurements */] || {};
229
+ var customProperties = telemetryItem[strBaseData][strProperties] || {};
230
+ _extractPropsAndMeasurements(telemetryItem[_DYN_DATA /* @min:%2edata */], customProperties, customMeasurements);
231
+ if (!isNullOrUndefined(customUndefinedValue)) {
232
+ _convertPropsUndefinedToCustomDefinedValue(customProperties, customUndefinedValue);
233
+ }
234
+ var bd = telemetryItem[strBaseData];
235
+ if (isNullOrUndefined(bd)) {
236
+ _warnToConsole(logger, "Invalid input for dependency data");
237
+ return null;
238
+ }
239
+ var method = bd[strProperties] && bd[strProperties][HttpMethod] ? bd[strProperties][HttpMethod] : "GET";
240
+ var remoteDepData = new RemoteDependencyData(logger, bd.id, bd.target, bd[_DYN_NAME /* @min:%2ename */], bd[STR_DURATION /* @min:%2eduration */], bd.success, bd.responseCode, method, bd.type, bd.correlationContext, customProperties, customMeasurements);
241
+ var data = new Data(RemoteDependencyData[_DYN_DATA_TYPE /* @min:%2edataType */], remoteDepData);
242
+ return _createEnvelope(logger, RemoteDependencyData[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], telemetryItem, data);
243
+ }
244
+ function EventEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
245
+ EnvelopeCreatorInit(logger, telemetryItem);
246
+ var customProperties = {};
247
+ var customMeasurements = {};
248
+ if (telemetryItem[strBaseType] !== Event[_DYN_DATA_TYPE /* @min:%2edataType */]) {
249
+ customProperties["baseTypeSource"] = telemetryItem[strBaseType]; // save the passed in base type as a property
250
+ }
251
+ if (telemetryItem[strBaseType] === Event[_DYN_DATA_TYPE /* @min:%2edataType */]) { // take collection
252
+ customProperties = telemetryItem[strBaseData][strProperties] || {};
253
+ customMeasurements = telemetryItem[strBaseData][_DYN_MEASUREMENTS /* @min:%2emeasurements */] || {};
254
+ }
255
+ else { // if its not a known type, convert to custom event
256
+ if (telemetryItem[strBaseData]) {
257
+ _extractPropsAndMeasurements(telemetryItem[strBaseData], customProperties, customMeasurements);
258
+ }
259
+ }
260
+ // Extract root level properties from part C telemetryItem.data
261
+ _extractPropsAndMeasurements(telemetryItem[_DYN_DATA /* @min:%2edata */], customProperties, customMeasurements);
262
+ if (!isNullOrUndefined(customUndefinedValue)) {
263
+ _convertPropsUndefinedToCustomDefinedValue(customProperties, customUndefinedValue);
264
+ }
265
+ var eventName = telemetryItem[strBaseData][_DYN_NAME /* @min:%2ename */];
266
+ var eventData = new Event(logger, eventName, customProperties, customMeasurements);
267
+ var data = new Data(Event[_DYN_DATA_TYPE /* @min:%2edataType */], eventData);
268
+ return _createEnvelope(logger, Event[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], telemetryItem, data);
269
+ }
270
+ function ExceptionEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
271
+ EnvelopeCreatorInit(logger, telemetryItem);
272
+ // Extract root level properties from part C telemetryItem.data
273
+ var customMeasurements = telemetryItem[strBaseData][_DYN_MEASUREMENTS /* @min:%2emeasurements */] || {};
274
+ var customProperties = telemetryItem[strBaseData][strProperties] || {};
275
+ _extractPropsAndMeasurements(telemetryItem[_DYN_DATA /* @min:%2edata */], customProperties, customMeasurements);
276
+ if (!isNullOrUndefined(customUndefinedValue)) {
277
+ _convertPropsUndefinedToCustomDefinedValue(customProperties, customUndefinedValue);
278
+ }
279
+ var bd = telemetryItem[strBaseData];
280
+ var exData = Exception.CreateFromInterface(logger, bd, customProperties, customMeasurements);
281
+ var data = new Data(Exception[_DYN_DATA_TYPE /* @min:%2edataType */], exData);
282
+ return _createEnvelope(logger, Exception[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], telemetryItem, data);
283
+ }
284
+ function MetricEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
285
+ EnvelopeCreatorInit(logger, telemetryItem);
286
+ var baseData = telemetryItem[strBaseData];
287
+ var props = baseData[strProperties] || {};
288
+ var measurements = baseData[_DYN_MEASUREMENTS /* @min:%2emeasurements */] || {};
289
+ _extractPropsAndMeasurements(telemetryItem[_DYN_DATA /* @min:%2edata */], props, measurements);
290
+ if (!isNullOrUndefined(customUndefinedValue)) {
291
+ _convertPropsUndefinedToCustomDefinedValue(props, customUndefinedValue);
292
+ }
293
+ var baseMetricData = new Metric(logger, baseData[_DYN_NAME /* @min:%2ename */], baseData.average, baseData.sampleCount, baseData.min, baseData.max, baseData.stdDev, props, measurements);
294
+ var data = new Data(Metric[_DYN_DATA_TYPE /* @min:%2edataType */], baseMetricData);
295
+ return _createEnvelope(logger, Metric[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], telemetryItem, data);
296
+ }
297
+ function PageViewEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
298
+ EnvelopeCreatorInit(logger, telemetryItem);
299
+ // Since duration is not part of the domain properties in Common Schema, extract it from part C
300
+ var duration;
301
+ var baseData = telemetryItem[strBaseData];
302
+ if (!isNullOrUndefined(baseData) &&
303
+ !isNullOrUndefined(baseData[strProperties]) &&
304
+ !isNullOrUndefined(baseData[strProperties][STR_DURATION])) { // from part B properties
305
+ duration = baseData[strProperties][STR_DURATION];
306
+ delete baseData[strProperties][STR_DURATION];
307
+ }
308
+ else if (!isNullOrUndefined(telemetryItem[_DYN_DATA /* @min:%2edata */]) &&
309
+ !isNullOrUndefined(telemetryItem[_DYN_DATA /* @min:%2edata */][STR_DURATION])) { // from custom properties
310
+ duration = telemetryItem[_DYN_DATA /* @min:%2edata */][STR_DURATION];
311
+ delete telemetryItem[_DYN_DATA /* @min:%2edata */][STR_DURATION];
312
+ }
313
+ var bd = telemetryItem[strBaseData];
314
+ // special case: pageview.id is grabbed from current operation id. Analytics plugin is decoupled from properties plugin, so this is done here instead. This can be made a default telemetry intializer instead if needed to be decoupled from channel
315
+ var currentContextId;
316
+ if (((telemetryItem.ext || {}).trace || {})[_DYN_TRACE_ID /* @min:%2etraceID */]) {
317
+ currentContextId = telemetryItem.ext.trace[_DYN_TRACE_ID /* @min:%2etraceID */];
318
+ }
319
+ var id = bd.id || currentContextId;
320
+ var name = bd[_DYN_NAME /* @min:%2ename */];
321
+ var url = bd.uri;
322
+ var properties = bd[strProperties] || {};
323
+ var measurements = bd[_DYN_MEASUREMENTS /* @min:%2emeasurements */] || {};
324
+ // refUri is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property
325
+ if (!isNullOrUndefined(bd.refUri)) {
326
+ properties["refUri"] = bd.refUri;
327
+ }
328
+ // pageType is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property
329
+ if (!isNullOrUndefined(bd.pageType)) {
330
+ properties["pageType"] = bd.pageType;
331
+ }
332
+ // isLoggedIn is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property
333
+ if (!isNullOrUndefined(bd.isLoggedIn)) {
334
+ properties["isLoggedIn"] = bd.isLoggedIn[_DYN_TO_STRING /* @min:%2etoString */]();
335
+ }
336
+ // pageTags is a field that Breeze still does not recognize as part of Part B. For now, put it in Part C until it supports it as a domain property
337
+ if (!isNullOrUndefined(bd[strProperties])) {
338
+ var pageTags = bd[strProperties];
339
+ objForEachKey(pageTags, function (key, value) {
340
+ properties[key] = value;
341
+ });
342
+ }
343
+ _extractPropsAndMeasurements(telemetryItem[_DYN_DATA /* @min:%2edata */], properties, measurements);
344
+ if (!isNullOrUndefined(customUndefinedValue)) {
345
+ _convertPropsUndefinedToCustomDefinedValue(properties, customUndefinedValue);
346
+ }
347
+ var pageViewData = new PageView(logger, name, url, duration, properties, measurements, id);
348
+ var data = new Data(PageView[_DYN_DATA_TYPE /* @min:%2edataType */], pageViewData);
349
+ return _createEnvelope(logger, PageView[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], telemetryItem, data);
350
+ }
351
+ function PageViewPerformanceEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
352
+ EnvelopeCreatorInit(logger, telemetryItem);
353
+ var bd = telemetryItem[strBaseData];
354
+ var name = bd[_DYN_NAME /* @min:%2ename */];
355
+ var url = bd.uri || bd.url;
356
+ var properties = bd[strProperties] || {};
357
+ var measurements = bd[_DYN_MEASUREMENTS /* @min:%2emeasurements */] || {};
358
+ _extractPropsAndMeasurements(telemetryItem[_DYN_DATA /* @min:%2edata */], properties, measurements);
359
+ if (!isNullOrUndefined(customUndefinedValue)) {
360
+ _convertPropsUndefinedToCustomDefinedValue(properties, customUndefinedValue);
361
+ }
362
+ var baseData = new PageViewPerformance(logger, name, url, undefined, properties, measurements, bd);
363
+ var data = new Data(PageViewPerformance[_DYN_DATA_TYPE /* @min:%2edataType */], baseData);
364
+ return _createEnvelope(logger, PageViewPerformance[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], telemetryItem, data);
365
+ }
366
+ function TraceEnvelopeCreator(logger, telemetryItem, customUndefinedValue) {
367
+ EnvelopeCreatorInit(logger, telemetryItem);
368
+ var message = telemetryItem[strBaseData].message;
369
+ var severityLevel = telemetryItem[strBaseData].severityLevel;
370
+ var props = telemetryItem[strBaseData][strProperties] || {};
371
+ var measurements = telemetryItem[strBaseData][_DYN_MEASUREMENTS /* @min:%2emeasurements */] || {};
372
+ _extractPropsAndMeasurements(telemetryItem[_DYN_DATA /* @min:%2edata */], props, measurements);
373
+ if (!isNullOrUndefined(customUndefinedValue)) {
374
+ _convertPropsUndefinedToCustomDefinedValue(props, customUndefinedValue);
375
+ }
376
+ var baseData = new Trace(logger, message, severityLevel, props, measurements);
377
+ var data = new Data(Trace[_DYN_DATA_TYPE /* @min:%2edataType */], baseData);
378
+ return _createEnvelope(logger, Trace[_DYN_ENVELOPE_TYPE /* @min:%2eenvelopeType */], telemetryItem, data);
379
+ }
380
+
381
+ /*
382
+ * Application Insights JavaScript SDK - Channel, 3.3.9
383
+ * Copyright (c) Microsoft and contributors. All rights reserved.
384
+ */
385
+ var BaseSendBuffer = /** @class */ (function () {
386
+ function BaseSendBuffer(logger, config) {
387
+ var _buffer = [];
388
+ var _bufferFullMessageSent = false;
389
+ var _maxRetryCnt = config.maxRetryCnt;
390
+ this._get = function () {
391
+ return _buffer;
392
+ };
393
+ this._set = function (buffer) {
394
+ _buffer = buffer;
395
+ return _buffer;
396
+ };
397
+ dynamicProto(BaseSendBuffer, this, function (_self) {
398
+ _self[_DYN_ENQUEUE /* @min:%2eenqueue */] = function (payload) {
399
+ if (_self[_DYN_COUNT /* @min:%2ecount */]() >= config.eventsLimitInMem) {
400
+ // sent internal log only once per page view
401
+ if (!_bufferFullMessageSent) {
402
+ _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 105 /* _eInternalMessageId.InMemoryStorageBufferFull */, "Maximum in-memory buffer size reached: " + _self[_DYN_COUNT /* @min:%2ecount */](), true);
403
+ _bufferFullMessageSent = true;
404
+ }
405
+ return;
406
+ }
407
+ payload.cnt = payload.cnt || 0;
408
+ // max retry is defined, and max retry is reached, do not add the payload to buffer
409
+ if (!isNullOrUndefined(_maxRetryCnt)) {
410
+ if (payload.cnt > _maxRetryCnt) {
411
+ // TODO: add log here on dropping payloads
412
+ // will log statsbeat exception later here
413
+ return;
414
+ }
415
+ }
416
+ _buffer[_DYN_PUSH /* @min:%2epush */](payload);
417
+ return;
418
+ };
419
+ _self[_DYN_COUNT /* @min:%2ecount */] = function () {
420
+ return _buffer[_DYN_LENGTH /* @min:%2elength */];
421
+ };
422
+ _self.size = function () {
423
+ var size = _buffer[_DYN_LENGTH /* @min:%2elength */];
424
+ for (var lp = 0; lp < _buffer[_DYN_LENGTH /* @min:%2elength */]; lp++) {
425
+ size += (_buffer[lp].item)[_DYN_LENGTH /* @min:%2elength */];
426
+ }
427
+ if (!config[_DYN_EMIT_LINE_DELIMITED_0 /* @min:%2eemitLineDelimitedJson */]) {
428
+ size += 2;
429
+ }
430
+ return size;
431
+ };
432
+ _self[_DYN_CLEAR /* @min:%2eclear */] = function () {
433
+ _buffer = [];
434
+ _bufferFullMessageSent = false;
435
+ };
436
+ _self.getItems = function () {
437
+ return _buffer.slice(0);
438
+ };
439
+ _self.batchPayloads = function (payloads) {
440
+ if (payloads && payloads[_DYN_LENGTH /* @min:%2elength */] > 0) {
441
+ var payloadStr_1 = [];
442
+ arrForEach(payloads, function (payload) {
443
+ payloadStr_1[_DYN_PUSH /* @min:%2epush */](payload.item);
444
+ });
445
+ var batch = config[_DYN_EMIT_LINE_DELIMITED_0 /* @min:%2eemitLineDelimitedJson */] ?
446
+ payloadStr_1.join("\n") :
447
+ "[" + payloadStr_1.join(",") + "]";
448
+ return batch;
449
+ }
450
+ return null;
451
+ };
452
+ _self.createNew = function (newLogger, newConfig, canUseSessionStorage) {
453
+ var items = _buffer.slice(0);
454
+ newLogger = newLogger || logger;
455
+ newConfig = newConfig || {};
456
+ var newBuffer = !!canUseSessionStorage ? new SessionStorageSendBuffer(newLogger, newConfig) : new ArraySendBuffer(newLogger, newConfig);
457
+ arrForEach(items, function (payload) {
458
+ newBuffer[_DYN_ENQUEUE /* @min:%2eenqueue */](payload);
459
+ });
460
+ return newBuffer;
461
+ };
462
+ });
463
+ }
464
+ // Removed Stub for BaseSendBuffer.prototype.enqueue.
465
+ // Removed Stub for BaseSendBuffer.prototype.count.
466
+ // Removed Stub for BaseSendBuffer.prototype.size.
467
+ // Removed Stub for BaseSendBuffer.prototype.clear.
468
+ // Removed Stub for BaseSendBuffer.prototype.getItems.
469
+ // Removed Stub for BaseSendBuffer.prototype.batchPayloads.
470
+ // Removed Stub for BaseSendBuffer.prototype.createNew.
471
+ // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
472
+ // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
473
+ BaseSendBuffer.__ieDyn=1;
474
+
475
+ return BaseSendBuffer;
476
+ }());
477
+ /*
478
+ * An array based send buffer.
479
+ */
480
+ var ArraySendBuffer = /** @class */ (function (_super) {
481
+ __extendsFn(ArraySendBuffer, _super);
482
+ function ArraySendBuffer(logger, config) {
483
+ var _this = _super.call(this, logger, config) || this;
484
+ dynamicProto(ArraySendBuffer, _this, function (_self, _base) {
485
+ _self[_DYN_MARK_AS_SENT /* @min:%2emarkAsSent */] = function (payload) {
486
+ _base[_DYN_CLEAR /* @min:%2eclear */]();
487
+ };
488
+ _self[_DYN_CLEAR_SENT /* @min:%2eclearSent */] = function (payload) {
489
+ // not supported
490
+ };
491
+ });
492
+ return _this;
493
+ }
494
+ // Removed Stub for ArraySendBuffer.prototype.markAsSent.
495
+ // Removed Stub for ArraySendBuffer.prototype.clearSent.
496
+ // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
497
+ // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
498
+ ArraySendBuffer.__ieDyn=1;
499
+
500
+ return ArraySendBuffer;
501
+ }(BaseSendBuffer));
502
+ var PREVIOUS_KEYS = ["AI_buffer", "AI_sentBuffer"];
503
+ /*
504
+ * Session storage buffer holds a copy of all unsent items in the browser session storage.
505
+ */
506
+ var SessionStorageSendBuffer = /** @class */ (function (_super) {
507
+ __extendsFn(SessionStorageSendBuffer, _super);
508
+ function SessionStorageSendBuffer(logger, config) {
509
+ var _this = _super.call(this, logger, config) || this;
510
+ var _bufferFullMessageSent = false;
511
+ //Note: should not use config.namePrefix directly, because it will always refers to the latest namePrefix
512
+ var _namePrefix = config === null || config === void 0 ? void 0 : config.namePrefix;
513
+ // TODO: add remove buffer override as well
514
+ var _b = config[_DYN_BUFFER_OVERRIDE /* @min:%2ebufferOverride */] || { getItem: utlGetSessionStorage, setItem: utlSetSessionStorage }, getItem = _b.getItem, setItem = _b.setItem;
515
+ var _maxRetryCnt = config.maxRetryCnt;
516
+ dynamicProto(SessionStorageSendBuffer, _this, function (_self, _base) {
517
+ var bufferItems = _getBuffer(SessionStorageSendBuffer[_DYN__BUFFER__KEY /* @min:%2eBUFFER_KEY */]);
518
+ var itemsInSentBuffer = _getBuffer(SessionStorageSendBuffer[_DYN__SENT__BUFFER__KEY /* @min:%2eSENT_BUFFER_KEY */]);
519
+ var previousItems = _getPreviousEvents();
520
+ var notDeliveredItems = itemsInSentBuffer[_DYN_CONCAT /* @min:%2econcat */](previousItems);
521
+ var buffer = _self._set(bufferItems[_DYN_CONCAT /* @min:%2econcat */](notDeliveredItems));
522
+ // If the buffer has too many items, drop items from the end.
523
+ if (buffer[_DYN_LENGTH /* @min:%2elength */] > SessionStorageSendBuffer[_DYN__MAX__BUFFER__SIZE /* @min:%2eMAX_BUFFER_SIZE */]) {
524
+ buffer[_DYN_LENGTH /* @min:%2elength */] = SessionStorageSendBuffer[_DYN__MAX__BUFFER__SIZE /* @min:%2eMAX_BUFFER_SIZE */];
525
+ }
526
+ _setBuffer(SessionStorageSendBuffer[_DYN__SENT__BUFFER__KEY /* @min:%2eSENT_BUFFER_KEY */], []);
527
+ _setBuffer(SessionStorageSendBuffer[_DYN__BUFFER__KEY /* @min:%2eBUFFER_KEY */], buffer);
528
+ _self[_DYN_ENQUEUE /* @min:%2eenqueue */] = function (payload) {
529
+ if (_self[_DYN_COUNT /* @min:%2ecount */]() >= SessionStorageSendBuffer[_DYN__MAX__BUFFER__SIZE /* @min:%2eMAX_BUFFER_SIZE */]) {
530
+ // sent internal log only once per page view
531
+ if (!_bufferFullMessageSent) {
532
+ _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 67 /* _eInternalMessageId.SessionStorageBufferFull */, "Maximum buffer size reached: " + _self[_DYN_COUNT /* @min:%2ecount */](), true);
533
+ _bufferFullMessageSent = true;
534
+ }
535
+ return;
536
+ }
537
+ payload.cnt = payload.cnt || 0;
538
+ // max retry is defined, and max retry is reached, do not add the payload to buffer
539
+ if (!isNullOrUndefined(_maxRetryCnt)) {
540
+ if (payload.cnt > _maxRetryCnt) {
541
+ // TODO: add log here on dropping payloads
542
+ return;
543
+ }
544
+ }
545
+ _base[_DYN_ENQUEUE /* @min:%2eenqueue */](payload);
546
+ _setBuffer(SessionStorageSendBuffer[_DYN__BUFFER__KEY /* @min:%2eBUFFER_KEY */], _self._get());
547
+ };
548
+ _self[_DYN_CLEAR /* @min:%2eclear */] = function () {
549
+ _base[_DYN_CLEAR /* @min:%2eclear */]();
550
+ _setBuffer(SessionStorageSendBuffer[_DYN__BUFFER__KEY /* @min:%2eBUFFER_KEY */], _self._get());
551
+ _setBuffer(SessionStorageSendBuffer[_DYN__SENT__BUFFER__KEY /* @min:%2eSENT_BUFFER_KEY */], []);
552
+ _bufferFullMessageSent = false;
553
+ };
554
+ _self[_DYN_MARK_AS_SENT /* @min:%2emarkAsSent */] = function (payload) {
555
+ _setBuffer(SessionStorageSendBuffer[_DYN__BUFFER__KEY /* @min:%2eBUFFER_KEY */], _self._set(_removePayloadsFromBuffer(payload, _self._get())));
556
+ var sentElements = _getBuffer(SessionStorageSendBuffer[_DYN__SENT__BUFFER__KEY /* @min:%2eSENT_BUFFER_KEY */]);
557
+ if (sentElements instanceof Array && payload instanceof Array) {
558
+ sentElements = sentElements[_DYN_CONCAT /* @min:%2econcat */](payload);
559
+ if (sentElements[_DYN_LENGTH /* @min:%2elength */] > SessionStorageSendBuffer[_DYN__MAX__BUFFER__SIZE /* @min:%2eMAX_BUFFER_SIZE */]) {
560
+ // We send telemetry normally. If the SENT_BUFFER is too big we don't add new elements
561
+ // until we receive a response from the backend and the buffer has free space again (see clearSent method)
562
+ _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, 67 /* _eInternalMessageId.SessionStorageBufferFull */, "Sent buffer reached its maximum size: " + sentElements[_DYN_LENGTH /* @min:%2elength */], true);
563
+ sentElements[_DYN_LENGTH /* @min:%2elength */] = SessionStorageSendBuffer[_DYN__MAX__BUFFER__SIZE /* @min:%2eMAX_BUFFER_SIZE */];
564
+ }
565
+ _setBuffer(SessionStorageSendBuffer[_DYN__SENT__BUFFER__KEY /* @min:%2eSENT_BUFFER_KEY */], sentElements);
566
+ }
567
+ };
568
+ _self[_DYN_CLEAR_SENT /* @min:%2eclearSent */] = function (payload) {
569
+ var sentElements = _getBuffer(SessionStorageSendBuffer[_DYN__SENT__BUFFER__KEY /* @min:%2eSENT_BUFFER_KEY */]);
570
+ sentElements = _removePayloadsFromBuffer(payload, sentElements);
571
+ _setBuffer(SessionStorageSendBuffer[_DYN__SENT__BUFFER__KEY /* @min:%2eSENT_BUFFER_KEY */], sentElements);
572
+ };
573
+ _self.createNew = function (newLogger, newConfig, canUseSessionStorage) {
574
+ canUseSessionStorage = !!canUseSessionStorage;
575
+ var unsentItems = _self._get().slice(0);
576
+ var sentItems = _getBuffer(SessionStorageSendBuffer[_DYN__SENT__BUFFER__KEY /* @min:%2eSENT_BUFFER_KEY */]).slice(0);
577
+ newLogger = newLogger || logger;
578
+ newConfig = newConfig || {};
579
+ // to make sure that we do not send duplicated payloads when it is switched back to previous one
580
+ _self[_DYN_CLEAR /* @min:%2eclear */]();
581
+ var newBuffer = canUseSessionStorage ? new SessionStorageSendBuffer(newLogger, newConfig) : new ArraySendBuffer(newLogger, newConfig);
582
+ arrForEach(unsentItems, function (payload) {
583
+ newBuffer[_DYN_ENQUEUE /* @min:%2eenqueue */](payload);
584
+ });
585
+ if (canUseSessionStorage) {
586
+ // arr buffer will clear all payloads if markAsSent() is called
587
+ newBuffer[_DYN_MARK_AS_SENT /* @min:%2emarkAsSent */](sentItems);
588
+ }
589
+ return newBuffer;
590
+ };
591
+ function _removePayloadsFromBuffer(payloads, buffer) {
592
+ var remaining = [];
593
+ var payloadStr = [];
594
+ arrForEach(payloads, function (payload) {
595
+ payloadStr[_DYN_PUSH /* @min:%2epush */](payload.item);
596
+ });
597
+ arrForEach(buffer, function (value) {
598
+ if (!isFunction(value) && arrIndexOf(payloadStr, value.item) === -1) {
599
+ remaining[_DYN_PUSH /* @min:%2epush */](value);
600
+ }
601
+ });
602
+ return remaining;
603
+ }
604
+ function _getBuffer(key) {
605
+ var prefixedKey = key;
606
+ prefixedKey = _namePrefix ? _namePrefix + "_" + prefixedKey : prefixedKey;
607
+ return _getBufferBase(prefixedKey);
608
+ }
609
+ function _getBufferBase(key) {
610
+ try {
611
+ var bufferJson = getItem(logger, key);
612
+ if (bufferJson) {
613
+ var buffer_1 = getJSON().parse(bufferJson);
614
+ if (isString(buffer_1)) {
615
+ // When using some version prototype.js the stringify / parse cycle does not decode array's correctly
616
+ buffer_1 = getJSON().parse(buffer_1);
617
+ }
618
+ if (buffer_1 && isArray(buffer_1)) {
619
+ return buffer_1;
620
+ }
621
+ }
622
+ }
623
+ catch (e) {
624
+ _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, 42 /* _eInternalMessageId.FailedToRestoreStorageBuffer */, " storage key: " + key + ", " + getExceptionName(e), { exception: dumpObj(e) });
625
+ }
626
+ return [];
627
+ }
628
+ function _setBuffer(key, buffer) {
629
+ var prefixedKey = key;
630
+ try {
631
+ prefixedKey = _namePrefix ? _namePrefix + "_" + prefixedKey : prefixedKey;
632
+ var bufferJson = JSON[_DYN_STRINGIFY /* @min:%2estringify */](buffer);
633
+ setItem(logger, prefixedKey, bufferJson);
634
+ }
635
+ catch (e) {
636
+ // if there was an error, clear the buffer
637
+ // telemetry is stored in the _buffer array so we won't loose any items
638
+ setItem(logger, prefixedKey, JSON[_DYN_STRINGIFY /* @min:%2estringify */]([]));
639
+ _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 41 /* _eInternalMessageId.FailedToSetStorageBuffer */, " storage key: " + prefixedKey + ", " + getExceptionName(e) + ". Buffer cleared", { exception: dumpObj(e) });
640
+ }
641
+ }
642
+ // this removes buffer with prefix+key
643
+ function _getPreviousEvents() {
644
+ var items = [];
645
+ try {
646
+ arrForEach(PREVIOUS_KEYS, function (key) {
647
+ var events = _getItemsFromPreviousKey(key);
648
+ items = items[_DYN_CONCAT /* @min:%2econcat */](events);
649
+ // to make sure that we also transfer items from old prefixed + key buffer
650
+ if (_namePrefix) {
651
+ var prefixedKey = _namePrefix + "_" + key;
652
+ var prefixEvents = _getItemsFromPreviousKey(prefixedKey);
653
+ items = items[_DYN_CONCAT /* @min:%2econcat */](prefixEvents);
654
+ }
655
+ });
656
+ return items;
657
+ }
658
+ catch (e) {
659
+ _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 41 /* _eInternalMessageId.FailedToSetStorageBuffer */, "Transfer events from previous buffers: " + getExceptionName(e) + ". previous Buffer items can not be removed", { exception: dumpObj(e) });
660
+ }
661
+ return [];
662
+ }
663
+ // transform string[] to IInternalStorageItem[]
664
+ function _getItemsFromPreviousKey(key) {
665
+ try {
666
+ var items = _getBufferBase(key);
667
+ var transFormedItems_1 = [];
668
+ arrForEach(items, function (item) {
669
+ var internalItem = {
670
+ item: item,
671
+ cnt: 0 // previous events will be default to 0 count
672
+ };
673
+ transFormedItems_1[_DYN_PUSH /* @min:%2epush */](internalItem);
674
+ });
675
+ // remove the session storage if we can add events back
676
+ utlRemoveSessionStorage(logger, key);
677
+ return transFormedItems_1;
678
+ }
679
+ catch (e) {
680
+ // eslint-disable-next-line no-empty
681
+ }
682
+ return [];
683
+ }
684
+ });
685
+ return _this;
686
+ }
687
+ // Removed Stub for SessionStorageSendBuffer.prototype.enqueue.
688
+ // Removed Stub for SessionStorageSendBuffer.prototype.clear.
689
+ // Removed Stub for SessionStorageSendBuffer.prototype.markAsSent.
690
+ // Removed Stub for SessionStorageSendBuffer.prototype.clearSent.
691
+ // Removed Stub for SessionStorageSendBuffer.prototype.createNew.
692
+ var _a;
693
+ _a = SessionStorageSendBuffer;
694
+ SessionStorageSendBuffer.VERSION = "_1";
695
+ SessionStorageSendBuffer.BUFFER_KEY = "AI_buffer" + _a.VERSION;
696
+ SessionStorageSendBuffer.SENT_BUFFER_KEY = "AI_sentBuffer" + _a.VERSION;
697
+ // Maximum number of payloads stored in the buffer. If the buffer is full, new elements will be dropped.
698
+ SessionStorageSendBuffer.MAX_BUFFER_SIZE = 2000;
699
+ return SessionStorageSendBuffer;
700
+ }(BaseSendBuffer));
701
+
702
+ /*
703
+ * Application Insights JavaScript SDK - Channel, 3.3.9
704
+ * Copyright (c) Microsoft and contributors. All rights reserved.
705
+ */
706
+ var Serializer = /** @class */ (function () {
707
+ function Serializer(logger) {
708
+ dynamicProto(Serializer, this, function (_self) {
709
+ /**
710
+ * Serializes the current object to a JSON string.
711
+ */
712
+ _self.serialize = function (input) {
713
+ var output = _serializeObject(input, "root");
714
+ try {
715
+ return getJSON()[_DYN_STRINGIFY /* @min:%2estringify */](output);
716
+ }
717
+ catch (e) {
718
+ // if serialization fails return an empty string
719
+ _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, 48 /* _eInternalMessageId.CannotSerializeObject */, (e && isFunction(e[_DYN_TO_STRING /* @min:%2etoString */])) ? e[_DYN_TO_STRING /* @min:%2etoString */]() : "Error serializing object", null, true);
720
+ }
721
+ };
722
+ function _serializeObject(source, name) {
723
+ var circularReferenceCheck = "__aiCircularRefCheck";
724
+ var output = {};
725
+ if (!source) {
726
+ _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, 48 /* _eInternalMessageId.CannotSerializeObject */, "cannot serialize object because it is null or undefined", { name: name }, true);
727
+ return output;
728
+ }
729
+ if (source[circularReferenceCheck]) {
730
+ _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 50 /* _eInternalMessageId.CircularReferenceDetected */, "Circular reference detected while serializing object", { name: name }, true);
731
+ return output;
732
+ }
733
+ if (!source.aiDataContract) {
734
+ // special case for measurements/properties/tags
735
+ if (name === "measurements") {
736
+ output = _serializeStringMap(source, "number", name);
737
+ }
738
+ else if (name === "properties") {
739
+ output = _serializeStringMap(source, "string", name);
740
+ }
741
+ else if (name === "tags") {
742
+ output = _serializeStringMap(source, "string", name);
743
+ }
744
+ else if (isArray(source)) {
745
+ output = _serializeArray(source, name);
746
+ }
747
+ else {
748
+ _throwInternal(logger, 2 /* eLoggingSeverity.WARNING */, 49 /* _eInternalMessageId.CannotSerializeObjectNonSerializable */, "Attempting to serialize an object which does not implement ISerializable", { name: name }, true);
749
+ try {
750
+ // verify that the object can be stringified
751
+ getJSON()[_DYN_STRINGIFY /* @min:%2estringify */](source);
752
+ output = source;
753
+ }
754
+ catch (e) {
755
+ // if serialization fails return an empty string
756
+ _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, 48 /* _eInternalMessageId.CannotSerializeObject */, (e && isFunction(e[_DYN_TO_STRING /* @min:%2etoString */])) ? e[_DYN_TO_STRING /* @min:%2etoString */]() : "Error serializing object", null, true);
757
+ }
758
+ }
759
+ return output;
760
+ }
761
+ source[circularReferenceCheck] = true;
762
+ objForEachKey(source.aiDataContract, function (field, contract) {
763
+ var isRequired = (isFunction(contract)) ? (contract() & 1 /* FieldType.Required */) : (contract & 1 /* FieldType.Required */);
764
+ var isHidden = (isFunction(contract)) ? (contract() & 4 /* FieldType.Hidden */) : (contract & 4 /* FieldType.Hidden */);
765
+ var isArray = contract & 2 /* FieldType.Array */;
766
+ var isPresent = source[field] !== undefined;
767
+ var isObj = isObject(source[field]) && source[field] !== null;
768
+ if (isRequired && !isPresent && !isArray) {
769
+ _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, 24 /* _eInternalMessageId.MissingRequiredFieldSpecification */, "Missing required field specification. The field is required but not present on source", { field: field, name: name });
770
+ // If not in debug mode, continue and hope the error is permissible
771
+ }
772
+ else if (!isHidden) { // Don't serialize hidden fields
773
+ var value = void 0;
774
+ if (isObj) {
775
+ if (isArray) {
776
+ // special case; recurse on each object in the source array
777
+ value = _serializeArray(source[field], field);
778
+ }
779
+ else {
780
+ // recurse on the source object in this field
781
+ value = _serializeObject(source[field], field);
782
+ }
783
+ }
784
+ else {
785
+ // assign the source field to the output even if undefined or required
786
+ value = source[field];
787
+ }
788
+ // only emit this field if the value is defined
789
+ if (value !== undefined) {
790
+ output[field] = value;
791
+ }
792
+ }
793
+ });
794
+ delete source[circularReferenceCheck];
795
+ return output;
796
+ }
797
+ function _serializeArray(sources, name) {
798
+ var output;
799
+ if (!!sources) {
800
+ if (!isArray(sources)) {
801
+ _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, 54 /* _eInternalMessageId.ItemNotInArray */, "This field was specified as an array in the contract but the item is not an array.\r\n", { name: name }, true);
802
+ }
803
+ else {
804
+ output = [];
805
+ for (var i = 0; i < sources[_DYN_LENGTH /* @min:%2elength */]; i++) {
806
+ var source = sources[i];
807
+ var item = _serializeObject(source, name + "[" + i + "]");
808
+ output[_DYN_PUSH /* @min:%2epush */](item);
809
+ }
810
+ }
811
+ }
812
+ return output;
813
+ }
814
+ function _serializeStringMap(map, expectedType, name) {
815
+ var output;
816
+ if (map) {
817
+ output = {};
818
+ objForEachKey(map, function (field, value) {
819
+ if (expectedType === "string") {
820
+ if (value === undefined) {
821
+ output[field] = "undefined";
822
+ }
823
+ else if (value === null) {
824
+ output[field] = "null";
825
+ }
826
+ else if (!value[_DYN_TO_STRING /* @min:%2etoString */]) {
827
+ output[field] = "invalid field: toString() is not defined.";
828
+ }
829
+ else {
830
+ output[field] = value[_DYN_TO_STRING /* @min:%2etoString */]();
831
+ }
832
+ }
833
+ else if (expectedType === "number") {
834
+ if (value === undefined) {
835
+ output[field] = "undefined";
836
+ }
837
+ else if (value === null) {
838
+ output[field] = "null";
839
+ }
840
+ else {
841
+ var num = parseFloat(value);
842
+ output[field] = num;
843
+ }
844
+ }
845
+ else {
846
+ output[field] = "invalid field: " + name + " is of unknown type.";
847
+ _throwInternal(logger, 1 /* eLoggingSeverity.CRITICAL */, output[field], null, true);
848
+ }
849
+ });
850
+ }
851
+ return output;
852
+ }
853
+ });
854
+ }
855
+ // Removed Stub for Serializer.prototype.serialize.
856
+ // This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
857
+ // non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
858
+ Serializer.__ieDyn=1;
859
+
860
+ return Serializer;
861
+ }());
862
+
863
+ /*
864
+ * Application Insights JavaScript SDK - Channel, 3.3.9
865
+ * Copyright (c) Microsoft and contributors. All rights reserved.
866
+ */
867
+
868
+ // (Magic number) DJB algorithm can't work on shorter strings (results in poor distribution
869
+ var MIN_INPUT_LENGTH = 8;
870
+ var HashCodeScoreGenerator = /** @class */ (function () {
871
+ function HashCodeScoreGenerator() {
872
+ }
873
+ HashCodeScoreGenerator.prototype.getHashCodeScore = function (key) {
874
+ var score = this.getHashCode(key) / HashCodeScoreGenerator.INT_MAX_VALUE;
875
+ return score * 100;
876
+ };
877
+ HashCodeScoreGenerator.prototype.getHashCode = function (input) {
878
+ if (input === "") {
879
+ return 0;
880
+ }
881
+ while (input[_DYN_LENGTH /* @min:%2elength */] < MIN_INPUT_LENGTH) {
882
+ input = input[_DYN_CONCAT /* @min:%2econcat */](input);
883
+ }
884
+ // 5381 is a magic number: http://stackoverflow.com/questions/10696223/reason-for-5381-number-in-djb-hash-function
885
+ var hash = 5381;
886
+ for (var i = 0; i < input[_DYN_LENGTH /* @min:%2elength */]; ++i) {
887
+ hash = ((hash << 5) + hash) + input.charCodeAt(i);
888
+ // 'hash' is of number type which means 53 bit integer (http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types-number-type)
889
+ // 'hash & hash' will keep it 32 bit integer - just to make it clearer what the result is.
890
+ hash = hash & hash;
891
+ }
892
+ return Math.abs(hash);
893
+ };
894
+ // We're using 32 bit math, hence max value is (2^31 - 1)
895
+ HashCodeScoreGenerator.INT_MAX_VALUE = 2147483647;
896
+ return HashCodeScoreGenerator;
897
+ }());
898
+
899
+ /*
900
+ * Application Insights JavaScript SDK - Channel, 3.3.9
901
+ * Copyright (c) Microsoft and contributors. All rights reserved.
902
+ */
903
+
904
+ var SamplingScoreGenerator = /** @class */ (function () {
905
+ function SamplingScoreGenerator() {
906
+ var _self = this;
907
+ var hashCodeGenerator = new HashCodeScoreGenerator();
908
+ var keys = new ContextTagKeys();
909
+ _self.getSamplingScore = function (item) {
910
+ var score = 0;
911
+ if (item[_DYN_TAGS /* @min:%2etags */] && item[_DYN_TAGS /* @min:%2etags */][keys.userId]) { // search in tags first, then ext
912
+ score = hashCodeGenerator.getHashCodeScore(item[_DYN_TAGS /* @min:%2etags */][keys.userId]);
913
+ }
914
+ else if (item.ext && item.ext.user && item.ext.user.id) {
915
+ score = hashCodeGenerator[_DYN_GET_HASH_CODE_SCORE /* @min:%2egetHashCodeScore */](item.ext.user.id);
916
+ }
917
+ else if (item[_DYN_TAGS /* @min:%2etags */] && item[_DYN_TAGS /* @min:%2etags */][keys.operationId]) { // search in tags first, then ext
918
+ score = hashCodeGenerator.getHashCodeScore(item[_DYN_TAGS /* @min:%2etags */][keys.operationId]);
919
+ }
920
+ else if (item.ext && item.ext.telemetryTrace && item.ext.telemetryTrace[_DYN_TRACE_ID /* @min:%2etraceID */]) {
921
+ score = hashCodeGenerator.getHashCodeScore(item.ext.telemetryTrace[_DYN_TRACE_ID /* @min:%2etraceID */]);
922
+ }
923
+ else {
924
+ // tslint:disable-next-line:insecure-random
925
+ score = (Math.random() * 100);
926
+ }
927
+ return score;
928
+ };
929
+ }
930
+ return SamplingScoreGenerator;
931
+ }());
932
+
933
+ /*
934
+ * Application Insights JavaScript SDK - Channel, 3.3.9
935
+ * Copyright (c) Microsoft and contributors. All rights reserved.
936
+ */
937
+
938
+ var Sample = /** @class */ (function () {
939
+ function Sample(sampleRate, logger) {
940
+ // We're using 32 bit math, hence max value is (2^31 - 1)
941
+ this.INT_MAX_VALUE = 2147483647;
942
+ var _logger = logger || safeGetLogger(null);
943
+ if (sampleRate > 100 || sampleRate < 0) {
944
+ _logger.throwInternal(2 /* eLoggingSeverity.WARNING */, 58 /* _eInternalMessageId.SampleRateOutOfRange */, "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);
945
+ sampleRate = 100;
946
+ }
947
+ this[_DYN_SAMPLE_RATE /* @min:%2esampleRate */] = sampleRate;
948
+ this.samplingScoreGenerator = new SamplingScoreGenerator();
949
+ }
950
+ /**
951
+ * Determines if an envelope is sampled in (i.e. will be sent) or not (i.e. will be dropped).
952
+ */
953
+ Sample.prototype.isSampledIn = function (envelope) {
954
+ var samplingPercentage = this[_DYN_SAMPLE_RATE /* @min:%2esampleRate */]; // 0 - 100
955
+ var isSampledIn = false;
956
+ if (samplingPercentage === null || samplingPercentage === undefined || samplingPercentage >= 100) {
957
+ return true;
958
+ }
959
+ else if (envelope.baseType === Metric[_DYN_DATA_TYPE /* @min:%2edataType */]) {
960
+ // exclude MetricData telemetry from sampling
961
+ return true;
962
+ }
963
+ isSampledIn = this.samplingScoreGenerator.getSamplingScore(envelope) < samplingPercentage;
964
+ return isSampledIn;
965
+ };
966
+ return Sample;
967
+ }());
968
+
969
+ /*
970
+ * Application Insights JavaScript SDK - Channel, 3.3.9
971
+ * Copyright (c) Microsoft and contributors. All rights reserved.
972
+ */
973
+ var _a, _b;
974
+ var UNDEFINED_VALUE = undefined;
975
+ var EMPTY_STR = "";
976
+ var FetchSyncRequestSizeLimitBytes = 65000; // approx 64kb (the current Edge, Firefox and Chrome max limit)
977
+ function _getResponseText(xhr) {
978
+ try {
979
+ return xhr.responseText;
980
+ }
981
+ catch (e) {
982
+ // Best effort, as XHR may throw while XDR wont so just ignore
983
+ }
984
+ return null;
985
+ }
986
+ function isOverrideFn(httpXHROverride) {
987
+ return httpXHROverride && httpXHROverride.sendPOST;
988
+ }
989
+ var defaultAppInsightsChannelConfig = objDeepFreeze((_a = {
990
+ // Use the default value (handles empty string in the configuration)
991
+ endpointUrl: cfgDfValidate(isTruthy, DEFAULT_BREEZE_ENDPOINT + DEFAULT_BREEZE_PATH)
992
+ },
993
+ _a[_DYN_EMIT_LINE_DELIMITED_0 /* @min:emitLineDelimitedJson */] = cfgDfBoolean(),
994
+ _a.maxBatchInterval = 15000,
995
+ _a[_DYN_MAX_BATCH_SIZE_IN_BY1 /* @min:maxBatchSizeInBytes */] = 102400,
996
+ _a.disableTelemetry = cfgDfBoolean(),
997
+ _a[_DYN_ENABLE_SESSION_STORA5 /* @min:enableSessionStorageBuffer */] = cfgDfBoolean(true),
998
+ _a.isRetryDisabled = cfgDfBoolean(),
999
+ _a[_DYN_IS_BEACON_API_DISABL3 /* @min:isBeaconApiDisabled */] = cfgDfBoolean(true),
1000
+ _a[_DYN_DISABLE_SEND_BEACON_7 /* @min:disableSendBeaconSplit */] = cfgDfBoolean(true),
1001
+ _a.disableXhr = cfgDfBoolean(),
1002
+ _a[_DYN_ONUNLOAD_DISABLE_FET6 /* @min:onunloadDisableFetch */] = cfgDfBoolean(),
1003
+ _a[_DYN_ONUNLOAD_DISABLE_BEA2 /* @min:onunloadDisableBeacon */] = cfgDfBoolean(),
1004
+ _a[_DYN_INSTRUMENTATION_KEY /* @min:instrumentationKey */] = UNDEFINED_VALUE,
1005
+ _a.namePrefix = UNDEFINED_VALUE,
1006
+ _a.samplingPercentage = cfgDfValidate(_chkSampling, 100),
1007
+ _a[_DYN_CUSTOM_HEADERS /* @min:customHeaders */] = UNDEFINED_VALUE,
1008
+ _a.convertUndefined = UNDEFINED_VALUE,
1009
+ _a.eventsLimitInMem = 10000,
1010
+ _a[_DYN_BUFFER_OVERRIDE /* @min:bufferOverride */] = false,
1011
+ _a.httpXHROverride = { isVal: isOverrideFn, v: UNDEFINED_VALUE },
1012
+ _a[_DYN_ALWAYS_USE_XHR_OVERR4 /* @min:alwaysUseXhrOverride */] = cfgDfBoolean(),
1013
+ _a.transports = UNDEFINED_VALUE,
1014
+ _a.retryCodes = UNDEFINED_VALUE,
1015
+ _a.corsPolicy = UNDEFINED_VALUE,
1016
+ _a.maxRetryCnt = { isVal: isNumber, v: 10 },
1017
+ _a));
1018
+ var CrossOriginResourcePolicyHeader = "X-Set-Cross-Origin-Resource-Policy";
1019
+ function _chkSampling(value) {
1020
+ return !isNaN(value) && value > 0 && value <= 100;
1021
+ }
1022
+ var EnvelopeTypeCreator = (_b = {},
1023
+ _b[Event.dataType] = EventEnvelopeCreator,
1024
+ _b[Trace.dataType] = TraceEnvelopeCreator,
1025
+ _b[PageView.dataType] = PageViewEnvelopeCreator,
1026
+ _b[PageViewPerformance.dataType] = PageViewPerformanceEnvelopeCreator,
1027
+ _b[Exception.dataType] = ExceptionEnvelopeCreator,
1028
+ _b[Metric.dataType] = MetricEnvelopeCreator,
1029
+ _b[RemoteDependencyData.dataType] = DependencyEnvelopeCreator,
1030
+ _b);
1031
+ var Sender = /** @class */ (function (_super) {
1032
+ __extendsFn(Sender, _super);
1033
+ function Sender() {
1034
+ var _this = _super.call(this) || this;
1035
+ _this.priority = 1001;
1036
+ _this.identifier = BreezeChannelIdentifier;
1037
+ // Don't set the defaults here, set them in the _initDefaults() as this is also called during unload
1038
+ var _consecutiveErrors; // How many times in a row a retryable error condition has occurred.
1039
+ var _retryAt; // The time to retry at in milliseconds from 1970/01/01 (this makes the timer calculation easy).
1040
+ var _lastSend; // The time of the last send operation.
1041
+ var _paused; // Flag indicating that the sending should be paused
1042
+ var _timeoutHandle; // Handle to the timer for delayed sending of batches of data.
1043
+ var _serializer;
1044
+ var _stamp_specific_redirects;
1045
+ var _headers;
1046
+ var _syncFetchPayload = 0; // Keep track of the outstanding sync fetch payload total (as sync fetch has limits)
1047
+ var _syncUnloadSender; // The identified sender to use for the synchronous unload stage
1048
+ var _offlineListener;
1049
+ var _evtNamespace;
1050
+ var _endpointUrl;
1051
+ var _orgEndpointUrl;
1052
+ var _maxBatchSizeInBytes;
1053
+ var _beaconSupported;
1054
+ var _beaconOnUnloadSupported;
1055
+ var _beaconNormalSupported;
1056
+ var _customHeaders;
1057
+ var _disableTelemetry;
1058
+ var _instrumentationKey;
1059
+ var _convertUndefined;
1060
+ var _isRetryDisabled;
1061
+ var _maxBatchInterval;
1062
+ var _sessionStorageUsed;
1063
+ var _bufferOverrideUsed;
1064
+ var _namePrefix;
1065
+ var _enableSendPromise;
1066
+ var _alwaysUseCustomSend;
1067
+ var _disableXhr;
1068
+ var _fetchKeepAlive;
1069
+ var _xhrSend;
1070
+ var _fallbackSend;
1071
+ var _disableBeaconSplit;
1072
+ var _sendPostMgr;
1073
+ var _retryCodes;
1074
+ var _zipPayload;
1075
+ dynamicProto(Sender, _this, function (_self, _base) {
1076
+ _initDefaults();
1077
+ _self.pause = function () {
1078
+ _clearScheduledTimer();
1079
+ _paused = true;
1080
+ };
1081
+ _self.resume = function () {
1082
+ if (_paused) {
1083
+ _paused = false;
1084
+ _retryAt = null;
1085
+ // flush if we have exceeded the max-size already
1086
+ _checkMaxSize();
1087
+ _setupTimer();
1088
+ }
1089
+ };
1090
+ _self.flush = function (isAsync, callBack, sendReason) {
1091
+ if (isAsync === void 0) { isAsync = true; }
1092
+ if (!_paused) {
1093
+ // Clear the normal schedule timer as we are going to try and flush ASAP
1094
+ _clearScheduledTimer();
1095
+ try {
1096
+ return _self[_DYN_TRIGGER_SEND /* @min:%2etriggerSend */](isAsync, null, sendReason || 1 /* SendRequestReason.ManualFlush */);
1097
+ }
1098
+ catch (e) {
1099
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 22 /* _eInternalMessageId.FlushFailed */, "flush failed, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
1100
+ }
1101
+ }
1102
+ };
1103
+ _self.onunloadFlush = function () {
1104
+ if (!_paused) {
1105
+ if (_beaconSupported || _alwaysUseCustomSend) {
1106
+ try {
1107
+ return _self[_DYN_TRIGGER_SEND /* @min:%2etriggerSend */](true, _doUnloadSend, 2 /* SendRequestReason.Unload */);
1108
+ }
1109
+ catch (e) {
1110
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 20 /* _eInternalMessageId.FailedToSendQueuedTelemetry */, "failed to flush with beacon sender on page unload, telemetry will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
1111
+ }
1112
+ }
1113
+ else {
1114
+ _self.flush(false);
1115
+ }
1116
+ }
1117
+ };
1118
+ _self.addHeader = function (name, value) {
1119
+ _headers[name] = value;
1120
+ };
1121
+ _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, core, extensions, pluginChain) {
1122
+ if (_self.isInitialized()) {
1123
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 28 /* _eInternalMessageId.SenderNotInitialized */, "Sender is already initialized");
1124
+ }
1125
+ _base[_DYN_INITIALIZE /* @min:%2einitialize */](config, core, extensions, pluginChain);
1126
+ var identifier = _self.identifier;
1127
+ _serializer = new Serializer(core.logger);
1128
+ _consecutiveErrors = 0;
1129
+ _retryAt = null;
1130
+ _lastSend = 0;
1131
+ _self[_DYN__SENDER /* @min:%2e_sender */] = null;
1132
+ _stamp_specific_redirects = 0;
1133
+ var diagLog = _self[_DYN_DIAG_LOG /* @min:%2ediagLog */]();
1134
+ _evtNamespace = mergeEvtNamespace(createUniqueNamespace("Sender"), core.evtNamespace && core.evtNamespace());
1135
+ _offlineListener = createOfflineListener(_evtNamespace);
1136
+ // This function will be re-called whenever any referenced configuration is changed
1137
+ _self._addHook(onConfigChange(config, function (details) {
1138
+ var config = details.cfg;
1139
+ if (config.storagePrefix) {
1140
+ utlSetStoragePrefix(config.storagePrefix);
1141
+ }
1142
+ var ctx = createProcessTelemetryContext(null, config, core);
1143
+ // getExtCfg only finds undefined values from core
1144
+ var senderConfig = ctx.getExtCfg(identifier, defaultAppInsightsChannelConfig);
1145
+ var curExtUrl = senderConfig[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */];
1146
+ // if it is not inital change (_endpointUrl has value)
1147
+ // if current sender endpoint url is not changed directly
1148
+ // means ExtCfg is not changed directly
1149
+ // then we need to monitor endpoint url changes from core
1150
+ if (_endpointUrl && curExtUrl === _endpointUrl) {
1151
+ var coreUrl = config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */];
1152
+ // if core endpoint url is changed
1153
+ if (coreUrl && coreUrl !== curExtUrl) {
1154
+ // and endpoint promise changes is handled by this as well
1155
+ senderConfig[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = coreUrl;
1156
+ }
1157
+ }
1158
+ var csStream = getInst("CompressionStream");
1159
+ // Determine whether to enable payload compression (zipping).
1160
+ _zipPayload = isFeatureEnabled("zipPayload", config, false);
1161
+ if (!isFunction(csStream)) {
1162
+ _zipPayload = false;
1163
+ }
1164
+ var corsPolicy = senderConfig.corsPolicy;
1165
+ if (corsPolicy) {
1166
+ if (corsPolicy === "same-origin" || corsPolicy === "same-site" || corsPolicy === "cross-origin") {
1167
+ _this.addHeader(CrossOriginResourcePolicyHeader, corsPolicy);
1168
+ }
1169
+ }
1170
+ else {
1171
+ delete _headers[CrossOriginResourcePolicyHeader];
1172
+ }
1173
+ if (isPromiseLike(senderConfig[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */])) {
1174
+ // if it is promise, means the endpoint url is from core.endpointurl
1175
+ senderConfig[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */] = config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];
1176
+ }
1177
+ objDefine(_self, "_senderConfig", {
1178
+ g: function () {
1179
+ return senderConfig;
1180
+ }
1181
+ });
1182
+ // Only update the endpoint if the original config !== the current config
1183
+ // This is so any redirect endpointUrl is not overwritten
1184
+ if (_orgEndpointUrl !== senderConfig[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */]) {
1185
+ _endpointUrl = _orgEndpointUrl = senderConfig[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */];
1186
+ }
1187
+ // or is not string
1188
+ if (core.activeStatus() === ActiveStatus.PENDING) {
1189
+ // waiting for core promises to be resolved
1190
+ // NOTE: if active status is set to pending, stop sending, clear timer here
1191
+ _self.pause();
1192
+ }
1193
+ else if (core.activeStatus() === ActiveStatus.ACTIVE) {
1194
+ // core status changed from pending to other status
1195
+ _self.resume();
1196
+ }
1197
+ if (_customHeaders && _customHeaders !== senderConfig[_DYN_CUSTOM_HEADERS /* @min:%2ecustomHeaders */]) {
1198
+ // Removing any previously defined custom headers as they have changed
1199
+ arrForEach(_customHeaders, function (customHeader) {
1200
+ delete _headers[customHeader.header];
1201
+ });
1202
+ }
1203
+ _maxBatchSizeInBytes = senderConfig[_DYN_MAX_BATCH_SIZE_IN_BY1 /* @min:%2emaxBatchSizeInBytes */];
1204
+ _beaconSupported = (senderConfig[_DYN_ONUNLOAD_DISABLE_BEA2 /* @min:%2eonunloadDisableBeacon */] === false || senderConfig[_DYN_IS_BEACON_API_DISABL3 /* @min:%2eisBeaconApiDisabled */] === false) && isBeaconsSupported();
1205
+ _beaconOnUnloadSupported = senderConfig[_DYN_ONUNLOAD_DISABLE_BEA2 /* @min:%2eonunloadDisableBeacon */] === false && isBeaconsSupported();
1206
+ _beaconNormalSupported = senderConfig[_DYN_IS_BEACON_API_DISABL3 /* @min:%2eisBeaconApiDisabled */] === false && isBeaconsSupported();
1207
+ _alwaysUseCustomSend = senderConfig[_DYN_ALWAYS_USE_XHR_OVERR4 /* @min:%2ealwaysUseXhrOverride */];
1208
+ _disableXhr = !!senderConfig.disableXhr;
1209
+ _retryCodes = senderConfig.retryCodes;
1210
+ var bufferOverride = senderConfig[_DYN_BUFFER_OVERRIDE /* @min:%2ebufferOverride */];
1211
+ var canUseSessionStorage = !!senderConfig[_DYN_ENABLE_SESSION_STORA5 /* @min:%2eenableSessionStorageBuffer */] &&
1212
+ (!!bufferOverride || utlCanUseSessionStorage());
1213
+ var namePrefix = senderConfig.namePrefix;
1214
+ //Note: emitLineDelimitedJson and eventsLimitInMem is directly accessed via config in senderBuffer
1215
+ //Therefore, if canUseSessionStorage is not changed, we do not need to re initialize a new one
1216
+ var shouldUpdate = (canUseSessionStorage !== _sessionStorageUsed)
1217
+ || (canUseSessionStorage && (_namePrefix !== namePrefix)) // prefixName is only used in session storage
1218
+ || (canUseSessionStorage && (_bufferOverrideUsed !== bufferOverride));
1219
+ if (_self[_DYN__BUFFER /* @min:%2e_buffer */]) {
1220
+ // case1 (Pre and Now enableSessionStorageBuffer settings are same)
1221
+ // if namePrefix changes, transfer current buffer to new buffer
1222
+ // else no action needed
1223
+ //case2 (Pre and Now enableSessionStorageBuffer settings are changed)
1224
+ // transfer current buffer to new buffer
1225
+ if (shouldUpdate) {
1226
+ try {
1227
+ _self[_DYN__BUFFER /* @min:%2e_buffer */] = _self[_DYN__BUFFER /* @min:%2e_buffer */].createNew(diagLog, senderConfig, canUseSessionStorage);
1228
+ }
1229
+ catch (e) {
1230
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 12 /* _eInternalMessageId.FailedAddingTelemetryToBuffer */, "failed to transfer telemetry to different buffer storage, telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
1231
+ }
1232
+ }
1233
+ _checkMaxSize();
1234
+ }
1235
+ else {
1236
+ _self[_DYN__BUFFER /* @min:%2e_buffer */] = canUseSessionStorage
1237
+ ? new SessionStorageSendBuffer(diagLog, senderConfig) : new ArraySendBuffer(diagLog, senderConfig);
1238
+ }
1239
+ _namePrefix = namePrefix;
1240
+ _sessionStorageUsed = canUseSessionStorage;
1241
+ _bufferOverrideUsed = bufferOverride;
1242
+ _fetchKeepAlive = !senderConfig[_DYN_ONUNLOAD_DISABLE_FET6 /* @min:%2eonunloadDisableFetch */] && isFetchSupported(true);
1243
+ _disableBeaconSplit = !!senderConfig[_DYN_DISABLE_SEND_BEACON_7 /* @min:%2edisableSendBeaconSplit */];
1244
+ _self._sample = new Sample(senderConfig.samplingPercentage, diagLog);
1245
+ _instrumentationKey = senderConfig[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];
1246
+ if (!isPromiseLike(_instrumentationKey) && !_validateInstrumentationKey(_instrumentationKey, config)) {
1247
+ _throwInternal(diagLog, 1 /* eLoggingSeverity.CRITICAL */, 100 /* _eInternalMessageId.InvalidInstrumentationKey */, "Invalid Instrumentation key " + _instrumentationKey);
1248
+ }
1249
+ _customHeaders = senderConfig[_DYN_CUSTOM_HEADERS /* @min:%2ecustomHeaders */];
1250
+ if (isString(_endpointUrl) && !isInternalApplicationInsightsEndpoint(_endpointUrl) && _customHeaders && _customHeaders[_DYN_LENGTH /* @min:%2elength */] > 0) {
1251
+ arrForEach(_customHeaders, function (customHeader) {
1252
+ _this.addHeader(customHeader.header, customHeader.value);
1253
+ });
1254
+ }
1255
+ else {
1256
+ _customHeaders = null;
1257
+ }
1258
+ _enableSendPromise = senderConfig.enableSendPromise;
1259
+ var sendPostConfig = _getSendPostMgrConfig();
1260
+ // only init it once
1261
+ if (!_sendPostMgr) {
1262
+ _sendPostMgr = new SenderPostManager();
1263
+ _sendPostMgr[_DYN_INITIALIZE /* @min:%2einitialize */](sendPostConfig, diagLog);
1264
+ }
1265
+ else {
1266
+ _sendPostMgr.SetConfig(sendPostConfig);
1267
+ }
1268
+ var customInterface = senderConfig.httpXHROverride;
1269
+ var httpInterface = null;
1270
+ var syncInterface = null;
1271
+ // User requested transport(s) values > Beacon > Fetch > XHR
1272
+ // Beacon would be filtered out if user has set disableBeaconApi to true at _getSenderInterface
1273
+ var theTransports = prependTransports([3 /* TransportType.Beacon */, 1 /* TransportType.Xhr */, 2 /* TransportType.Fetch */], senderConfig.transports);
1274
+ httpInterface = _sendPostMgr && _sendPostMgr[_DYN_GET_SENDER_INST /* @min:%2egetSenderInst */](theTransports, false);
1275
+ var xhrInterface = _sendPostMgr && _sendPostMgr.getFallbackInst();
1276
+ _xhrSend = function (payload, isAsync) {
1277
+ return _doSend(xhrInterface, payload, isAsync);
1278
+ };
1279
+ _fallbackSend = function (payload, isAsync) {
1280
+ return _doSend(xhrInterface, payload, isAsync, false);
1281
+ };
1282
+ httpInterface = _alwaysUseCustomSend ? customInterface : (httpInterface || customInterface || xhrInterface);
1283
+ _self[_DYN__SENDER /* @min:%2e_sender */] = function (payload, isAsync) {
1284
+ return _doSend(httpInterface, payload, isAsync);
1285
+ };
1286
+ if (_fetchKeepAlive) {
1287
+ // Try and use the fetch with keepalive
1288
+ _syncUnloadSender = _fetchKeepAliveSender;
1289
+ }
1290
+ var syncTransports = prependTransports([3 /* TransportType.Beacon */, 1 /* TransportType.Xhr */], senderConfig.unloadTransports);
1291
+ if (!_fetchKeepAlive) {
1292
+ // remove fetch from theTransports
1293
+ syncTransports = syncTransports.filter(function (transport) { return transport !== 2 /* TransportType.Fetch */; });
1294
+ }
1295
+ syncInterface = _sendPostMgr && _sendPostMgr[_DYN_GET_SENDER_INST /* @min:%2egetSenderInst */](syncTransports, true);
1296
+ syncInterface = _alwaysUseCustomSend ? customInterface : (syncInterface || customInterface);
1297
+ if ((_alwaysUseCustomSend || senderConfig.unloadTransports || !_syncUnloadSender) && syncInterface) {
1298
+ _syncUnloadSender = function (payload, isAsync) {
1299
+ return _doSend(syncInterface, payload, isAsync);
1300
+ };
1301
+ }
1302
+ if (!_syncUnloadSender) {
1303
+ _syncUnloadSender = _xhrSend;
1304
+ }
1305
+ _disableTelemetry = senderConfig.disableTelemetry;
1306
+ _convertUndefined = senderConfig.convertUndefined || UNDEFINED_VALUE;
1307
+ _isRetryDisabled = senderConfig.isRetryDisabled;
1308
+ _maxBatchInterval = senderConfig.maxBatchInterval;
1309
+ }));
1310
+ };
1311
+ _self.processTelemetry = function (telemetryItem, itemCtx) {
1312
+ itemCtx = _self._getTelCtx(itemCtx);
1313
+ var diagLogger = itemCtx[_DYN_DIAG_LOG /* @min:%2ediagLog */]();
1314
+ try {
1315
+ var isValidate = _validate(telemetryItem, diagLogger);
1316
+ if (!isValidate) {
1317
+ return;
1318
+ }
1319
+ var aiEnvelope = _getEnvelope(telemetryItem, diagLogger);
1320
+ if (!aiEnvelope) {
1321
+ return;
1322
+ }
1323
+ // check if the incoming payload is too large, truncate if necessary
1324
+ var payload = _serializer.serialize(aiEnvelope);
1325
+ // flush if we would exceed the max-size limit by adding this item
1326
+ var buffer = _self[_DYN__BUFFER /* @min:%2e_buffer */];
1327
+ _checkMaxSize(payload);
1328
+ var payloadItem = {
1329
+ item: payload,
1330
+ cnt: 0 // inital cnt will always be 0
1331
+ };
1332
+ // enqueue the payload
1333
+ buffer[_DYN_ENQUEUE /* @min:%2eenqueue */](payloadItem);
1334
+ // ensure an invocation timeout is set
1335
+ _setupTimer();
1336
+ }
1337
+ catch (e) {
1338
+ _throwInternal(diagLogger, 2 /* eLoggingSeverity.WARNING */, 12 /* _eInternalMessageId.FailedAddingTelemetryToBuffer */, "Failed adding telemetry to the sender's buffer, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
1339
+ }
1340
+ // hand off the telemetry item to the next plugin
1341
+ _self.processNext(telemetryItem, itemCtx);
1342
+ };
1343
+ _self.isCompletelyIdle = function () {
1344
+ return !_paused && _syncFetchPayload === 0 && _self._buffer[_DYN_COUNT /* @min:%2ecount */]() === 0;
1345
+ };
1346
+ _self.getOfflineListener = function () {
1347
+ return _offlineListener;
1348
+ };
1349
+ /**
1350
+ * xhr state changes
1351
+ */
1352
+ _self._xhrReadyStateChange = function (xhr, payload, countOfItemsInPayload) {
1353
+ // since version 3.2.0, this function is no-op
1354
+ if (_isStringArr(payload)) {
1355
+ return;
1356
+ }
1357
+ return _xhrReadyStateChange(xhr, payload, countOfItemsInPayload);
1358
+ };
1359
+ /**
1360
+ * Immediately send buffered data
1361
+ * @param async - Indicates if the events should be sent asynchronously
1362
+ * @param forcedSender - Indicates the forcedSender, undefined if not passed
1363
+ */
1364
+ _self[_DYN_TRIGGER_SEND /* @min:%2etriggerSend */] = function (async, forcedSender, sendReason) {
1365
+ if (async === void 0) { async = true; }
1366
+ var result;
1367
+ if (!_paused) {
1368
+ try {
1369
+ var buffer = _self[_DYN__BUFFER /* @min:%2e_buffer */];
1370
+ // Send data only if disableTelemetry is false
1371
+ if (!_disableTelemetry) {
1372
+ if (buffer[_DYN_COUNT /* @min:%2ecount */]() > 0) {
1373
+ var payload = buffer.getItems();
1374
+ _notifySendRequest(sendReason || 0 /* SendRequestReason.Undefined */, async);
1375
+ // invoke send
1376
+ if (forcedSender) {
1377
+ result = forcedSender.call(_self, payload, async);
1378
+ }
1379
+ else {
1380
+ result = _self[_DYN__SENDER /* @min:%2e_sender */](payload, async);
1381
+ }
1382
+ }
1383
+ // update lastSend time to enable throttling
1384
+ _lastSend = +new Date;
1385
+ }
1386
+ else {
1387
+ buffer[_DYN_CLEAR /* @min:%2eclear */]();
1388
+ }
1389
+ _clearScheduledTimer();
1390
+ }
1391
+ catch (e) {
1392
+ /* Ignore this error for IE under v10 */
1393
+ var ieVer = getIEVersion();
1394
+ if (!ieVer || ieVer > 9) {
1395
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 40 /* _eInternalMessageId.TransmissionFailed */, "Telemetry transmission failed, some telemetry will be lost: " + getExceptionName(e), { exception: dumpObj(e) });
1396
+ }
1397
+ // potential place to call countException q3
1398
+ }
1399
+ }
1400
+ return result;
1401
+ };
1402
+ _self.getOfflineSupport = function () {
1403
+ return {
1404
+ getUrl: function () {
1405
+ return _endpointUrl;
1406
+ },
1407
+ createPayload: _createPayload,
1408
+ serialize: _serialize,
1409
+ batch: _batch,
1410
+ shouldProcess: function (evt) {
1411
+ return !!_validate(evt);
1412
+ }
1413
+ };
1414
+ };
1415
+ _self._doTeardown = function (unloadCtx, unloadState) {
1416
+ _self.onunloadFlush();
1417
+ runTargetUnload(_offlineListener, false);
1418
+ _initDefaults();
1419
+ };
1420
+ /**
1421
+ * error handler
1422
+ */
1423
+ _self[_DYN__ON_ERROR /* @min:%2e_onError */] = function (payload, message, event) {
1424
+ // since version 3.1.3, string[] is no-op
1425
+ if (_isStringArr(payload)) {
1426
+ return;
1427
+ }
1428
+ return _onError(payload, message);
1429
+ };
1430
+ /**
1431
+ * partial success handler
1432
+ */
1433
+ _self[_DYN__ON_PARTIAL_SUCCESS /* @min:%2e_onPartialSuccess */] = function (payload, results) {
1434
+ // since version 3.1.3, string[] is no-op
1435
+ if (_isStringArr(payload)) {
1436
+ return;
1437
+ }
1438
+ return _onPartialSuccess(payload, results);
1439
+ };
1440
+ /**
1441
+ * success handler
1442
+ */
1443
+ _self[_DYN__ON_SUCCESS /* @min:%2e_onSuccess */] = function (payload, countOfItemsInPayload) {
1444
+ // since version 3.1.3, string[] is no-op
1445
+ if (_isStringArr(payload)) {
1446
+ return;
1447
+ }
1448
+ return _onSuccess(payload);
1449
+ //_self._buffer && _self._buffer.clearSent(payload);
1450
+ };
1451
+ /**
1452
+ * xdr state changes
1453
+ */
1454
+ _self._xdrOnLoad = function (xdr, payload) {
1455
+ // since version 3.1.3, string[] is no-op
1456
+ if (_isStringArr(payload)) {
1457
+ return;
1458
+ }
1459
+ return _xdrOnLoad(xdr, payload);
1460
+ };
1461
+ // function _getStatsBeat() {
1462
+ // let statsBeatConfig: IStatsBeatState = {
1463
+ // cKey: _self._senderConfig.instrumentationKey,
1464
+ // endpoint: _endpointUrl,
1465
+ // sdkVer: EnvelopeCreator.Version,
1466
+ // type: eStatsType.SDK
1467
+ // };
1468
+ // let core = _self.core;
1469
+ // // During page unload the core may have been cleared and some async events may not have been sent yet
1470
+ // // resulting in the core being null. In this case we don't want to create a statsbeat instance
1471
+ // return core ? core.getStatsBeat(statsBeatConfig) : null;
1472
+ // }
1473
+ function _xdrOnLoad(xdr, payload) {
1474
+ var responseText = _getResponseText(xdr);
1475
+ if (xdr && (responseText + "" === "200" || responseText === "")) {
1476
+ _consecutiveErrors = 0;
1477
+ _self[_DYN__ON_SUCCESS /* @min:%2e_onSuccess */](payload, 0);
1478
+ }
1479
+ else {
1480
+ var results = parseResponse(responseText);
1481
+ if (results && results[_DYN_ITEMS_RECEIVED /* @min:%2eitemsReceived */] && results[_DYN_ITEMS_RECEIVED /* @min:%2eitemsReceived */] > results[_DYN_ITEMS_ACCEPTED /* @min:%2eitemsAccepted */]
1482
+ && !_isRetryDisabled) {
1483
+ _self[_DYN__ON_PARTIAL_SUCCESS /* @min:%2e_onPartialSuccess */](payload, results);
1484
+ }
1485
+ else {
1486
+ _self[_DYN__ON_ERROR /* @min:%2e_onError */](payload, formatErrorMessageXdr(xdr));
1487
+ }
1488
+ }
1489
+ }
1490
+ function _getSendPostMgrConfig() {
1491
+ try {
1492
+ var onCompleteFuncs = {
1493
+ xdrOnComplete: function (xdr, oncomplete, payload) {
1494
+ var payloadArr = _getPayloadArr(payload);
1495
+ if (!payloadArr) {
1496
+ return;
1497
+ }
1498
+ //const responseText = _getResponseText(xdr);
1499
+ // let statsbeat = _getStatsBeat();
1500
+ // if (statsbeat) {
1501
+ // if (xdr && (responseText + "" === "200" || responseText === "")) {
1502
+ // _consecutiveErrors = 0;
1503
+ // statsbeat.count(200, payload, _endpointUrl);
1504
+ // } else {
1505
+ // const results = parseResponse(responseText);
1506
+ // if (results && results.itemsReceived && results.itemsReceived > results.itemsAccepted
1507
+ // && !_isRetryDisabled) {
1508
+ // statsbeat.count(206, payload, _endpointUrl);
1509
+ // } else {
1510
+ // statsbeat.count(499, payload, _endpointUrl);
1511
+ // }
1512
+ // }
1513
+ // }
1514
+ return _xdrOnLoad(xdr, payloadArr);
1515
+ },
1516
+ fetchOnComplete: function (response, onComplete, resValue, payload) {
1517
+ var payloadArr = _getPayloadArr(payload);
1518
+ if (!payloadArr) {
1519
+ return;
1520
+ }
1521
+ // let statsbeat = _getStatsBeat();
1522
+ // if (statsbeat) {
1523
+ // statsbeat.count(response.status, payload, _endpointUrl);
1524
+ // }
1525
+ return _checkResponsStatus(response.status, payloadArr, response.url, payloadArr[_DYN_LENGTH /* @min:%2elength */], response.statusText, resValue || "");
1526
+ },
1527
+ xhrOnComplete: function (request, oncomplete, payload) {
1528
+ var payloadArr = _getPayloadArr(payload);
1529
+ if (!payloadArr) {
1530
+ return;
1531
+ }
1532
+ // let statsbeat = _getStatsBeat();
1533
+ // if (statsbeat && request.readyState === 4) {
1534
+ // statsbeat.count(request.status, payload, _endpointUrl);
1535
+ // }
1536
+ return _xhrReadyStateChange(request, payloadArr, payloadArr[_DYN_LENGTH /* @min:%2elength */]);
1537
+ },
1538
+ beaconOnRetry: function (data, onComplete, canSend) {
1539
+ // let statsbeat = _getStatsBeat();
1540
+ // if (statsbeat) {
1541
+ // statsbeat.count(499, data, _endpointUrl);
1542
+ // }
1543
+ return _onBeaconRetry(data, onComplete, canSend);
1544
+ }
1545
+ };
1546
+ var config = {
1547
+ enableSendPromise: _enableSendPromise,
1548
+ isOneDs: false,
1549
+ disableCredentials: false,
1550
+ disableXhr: _disableXhr,
1551
+ disableBeacon: !_beaconNormalSupported,
1552
+ disableBeaconSync: !_beaconOnUnloadSupported,
1553
+ senderOnCompleteCallBack: onCompleteFuncs
1554
+ };
1555
+ return config;
1556
+ }
1557
+ catch (e) {
1558
+ // eslint-disable-next-line no-empty
1559
+ }
1560
+ return null;
1561
+ }
1562
+ /**
1563
+ * xhr state changes
1564
+ */
1565
+ function _xhrReadyStateChange(xhr, payload, countOfItemsInPayload) {
1566
+ if (xhr.readyState === 4) {
1567
+ _checkResponsStatus(xhr.status, payload, xhr.responseURL, countOfItemsInPayload, formatErrorMessageXhr(xhr), _getResponseText(xhr) || xhr.response);
1568
+ }
1569
+ }
1570
+ /**
1571
+ * error handler
1572
+ */
1573
+ function _onError(payload, message, event) {
1574
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 26 /* _eInternalMessageId.OnError */, "Failed to send telemetry.", { message: message });
1575
+ _self._buffer && _self._buffer[_DYN_CLEAR_SENT /* @min:%2eclearSent */](payload);
1576
+ }
1577
+ /**
1578
+ * partial success handler
1579
+ */
1580
+ function _onPartialSuccess(payload, results) {
1581
+ var failed = [];
1582
+ var retry = [];
1583
+ // Iterate through the reversed array of errors so that splicing doesn't have invalid indexes after the first item.
1584
+ var errors = results.errors.reverse();
1585
+ for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {
1586
+ var error = errors_1[_i];
1587
+ var extracted = payload.splice(error.index, 1)[0];
1588
+ if (_isRetriable(error.statusCode)) {
1589
+ retry[_DYN_PUSH /* @min:%2epush */](extracted);
1590
+ }
1591
+ else {
1592
+ // All other errors, including: 402 (Monthly quota exceeded) and 439 (Too many requests and refresh cache).
1593
+ failed[_DYN_PUSH /* @min:%2epush */](extracted);
1594
+ }
1595
+ }
1596
+ if (payload[_DYN_LENGTH /* @min:%2elength */] > 0) {
1597
+ _self[_DYN__ON_SUCCESS /* @min:%2e_onSuccess */](payload, results[_DYN_ITEMS_ACCEPTED /* @min:%2eitemsAccepted */]);
1598
+ }
1599
+ if (failed[_DYN_LENGTH /* @min:%2elength */] > 0) {
1600
+ _self[_DYN__ON_ERROR /* @min:%2e_onError */](failed, formatErrorMessageXhr(null, ["partial success", results[_DYN_ITEMS_ACCEPTED /* @min:%2eitemsAccepted */], "of", results.itemsReceived].join(" ")));
1601
+ }
1602
+ if (retry[_DYN_LENGTH /* @min:%2elength */] > 0) {
1603
+ _resendPayload(retry);
1604
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 40 /* _eInternalMessageId.TransmissionFailed */, "Partial success. " +
1605
+ "Delivered: " + payload[_DYN_LENGTH /* @min:%2elength */] + ", Failed: " + failed[_DYN_LENGTH /* @min:%2elength */] +
1606
+ ". Will retry to send " + retry[_DYN_LENGTH /* @min:%2elength */] + " our of " + results[_DYN_ITEMS_RECEIVED /* @min:%2eitemsReceived */] + " items");
1607
+ }
1608
+ }
1609
+ /**
1610
+ * success handler
1611
+ */
1612
+ function _onSuccess(payload, countOfItemsInPayload) {
1613
+ _self._buffer && _self._buffer[_DYN_CLEAR_SENT /* @min:%2eclearSent */](payload);
1614
+ }
1615
+ function _getPayloadArr(payload) {
1616
+ try {
1617
+ if (payload) {
1618
+ var internalPayload = payload;
1619
+ var arr = internalPayload.oriPayload;
1620
+ if (arr && arr[_DYN_LENGTH /* @min:%2elength */]) {
1621
+ return arr;
1622
+ }
1623
+ return null;
1624
+ }
1625
+ }
1626
+ catch (e) {
1627
+ // eslint-disable-next-line no-empty
1628
+ }
1629
+ return null;
1630
+ }
1631
+ function _validate(telemetryItem, diagLogger) {
1632
+ if (_disableTelemetry) {
1633
+ // Do not send/save data
1634
+ return false;
1635
+ }
1636
+ // validate input
1637
+ if (!telemetryItem) {
1638
+ diagLogger && _throwInternal(diagLogger, 1 /* eLoggingSeverity.CRITICAL */, 7 /* _eInternalMessageId.CannotSendEmptyTelemetry */, "Cannot send empty telemetry");
1639
+ return false;
1640
+ }
1641
+ // validate event
1642
+ if (telemetryItem.baseData && !telemetryItem[_DYN_BASE_TYPE /* @min:%2ebaseType */]) {
1643
+ diagLogger && _throwInternal(diagLogger, 1 /* eLoggingSeverity.CRITICAL */, 70 /* _eInternalMessageId.InvalidEvent */, "Cannot send telemetry without baseData and baseType");
1644
+ return false;
1645
+ }
1646
+ if (!telemetryItem[_DYN_BASE_TYPE /* @min:%2ebaseType */]) {
1647
+ // Default
1648
+ telemetryItem[_DYN_BASE_TYPE /* @min:%2ebaseType */] = "EventData";
1649
+ }
1650
+ // ensure a sender was constructed
1651
+ if (!_self[_DYN__SENDER /* @min:%2e_sender */]) {
1652
+ diagLogger && _throwInternal(diagLogger, 1 /* eLoggingSeverity.CRITICAL */, 28 /* _eInternalMessageId.SenderNotInitialized */, "Sender was not initialized");
1653
+ return false;
1654
+ }
1655
+ // check if this item should be sampled in, else add sampleRate tag
1656
+ if (!_isSampledIn(telemetryItem)) {
1657
+ // Item is sampled out, do not send it
1658
+ diagLogger && _throwInternal(diagLogger, 2 /* eLoggingSeverity.WARNING */, 33 /* _eInternalMessageId.TelemetrySampledAndNotSent */, "Telemetry item was sampled out and not sent", { SampleRate: _self._sample[_DYN_SAMPLE_RATE /* @min:%2esampleRate */] });
1659
+ return false;
1660
+ }
1661
+ else {
1662
+ telemetryItem[SampleRate] = _self._sample[_DYN_SAMPLE_RATE /* @min:%2esampleRate */];
1663
+ }
1664
+ return true;
1665
+ }
1666
+ function _getEnvelope(telemetryItem, diagLogger) {
1667
+ // construct an envelope that Application Insights endpoint can understand
1668
+ // if ikey of telemetry is provided and not empty, envelope will use this iKey instead of senderConfig iKey
1669
+ var defaultEnvelopeIkey = telemetryItem.iKey || _instrumentationKey;
1670
+ var aiEnvelope = Sender.constructEnvelope(telemetryItem, defaultEnvelopeIkey, diagLogger, _convertUndefined);
1671
+ if (!aiEnvelope) {
1672
+ _throwInternal(diagLogger, 1 /* eLoggingSeverity.CRITICAL */, 47 /* _eInternalMessageId.CreateEnvelopeError */, "Unable to create an AppInsights envelope");
1673
+ return;
1674
+ }
1675
+ var doNotSendItem = false;
1676
+ // this is for running in legacy mode, where customer may already have a custom initializer present
1677
+ if (telemetryItem[_DYN_TAGS /* @min:%2etags */] && telemetryItem[_DYN_TAGS /* @min:%2etags */][ProcessLegacy]) {
1678
+ arrForEach(telemetryItem[_DYN_TAGS /* @min:%2etags */][ProcessLegacy], function (callBack) {
1679
+ try {
1680
+ if (callBack && callBack(aiEnvelope) === false) {
1681
+ doNotSendItem = true;
1682
+ _warnToConsole(diagLogger, "Telemetry processor check returns false");
1683
+ }
1684
+ }
1685
+ catch (e) {
1686
+ // log error but dont stop executing rest of the telemetry initializers
1687
+ // doNotSendItem = true;
1688
+ _throwInternal(diagLogger, 1 /* eLoggingSeverity.CRITICAL */, 64 /* _eInternalMessageId.TelemetryInitializerFailed */, "One of telemetry initializers failed, telemetry item will not be sent: " + getExceptionName(e), { exception: dumpObj(e) }, true);
1689
+ }
1690
+ });
1691
+ delete telemetryItem[_DYN_TAGS /* @min:%2etags */][ProcessLegacy];
1692
+ }
1693
+ if (doNotSendItem) {
1694
+ return; // do not send, no need to execute next plugin
1695
+ }
1696
+ return aiEnvelope;
1697
+ }
1698
+ function _serialize(item) {
1699
+ var rlt = EMPTY_STR;
1700
+ var diagLogger = _self[_DYN_DIAG_LOG /* @min:%2ediagLog */]();
1701
+ try {
1702
+ var valid = _validate(item, diagLogger);
1703
+ var envelope = null;
1704
+ if (valid) {
1705
+ envelope = _getEnvelope(item, diagLogger);
1706
+ }
1707
+ if (envelope) {
1708
+ rlt = _serializer.serialize(envelope);
1709
+ }
1710
+ }
1711
+ catch (e) {
1712
+ // eslint-disable-next-line no-empty
1713
+ }
1714
+ return rlt;
1715
+ }
1716
+ function _batch(arr) {
1717
+ var rlt = EMPTY_STR;
1718
+ if (arr && arr[_DYN_LENGTH /* @min:%2elength */]) {
1719
+ rlt = "[" + arr.join(",") + "]";
1720
+ }
1721
+ return rlt;
1722
+ }
1723
+ function _createPayload(data) {
1724
+ var headers = _getHeaders();
1725
+ return {
1726
+ urlString: _endpointUrl,
1727
+ data: data,
1728
+ headers: headers
1729
+ };
1730
+ }
1731
+ function _isSampledIn(envelope) {
1732
+ return _self._sample.isSampledIn(envelope);
1733
+ }
1734
+ function _getOnComplete(payload, status, headers, response) {
1735
+ // ***********************************************************************************************
1736
+ //TODO: handle other status codes
1737
+ if (status === 200 && payload) {
1738
+ _self._onSuccess(payload, payload[_DYN_LENGTH /* @min:%2elength */]);
1739
+ }
1740
+ else {
1741
+ response && _self[_DYN__ON_ERROR /* @min:%2e_onError */](payload, response);
1742
+ }
1743
+ }
1744
+ function _doSend(sendInterface, payload, isAsync, markAsSent) {
1745
+ if (markAsSent === void 0) { markAsSent = true; }
1746
+ var onComplete = function (status, headers, response) {
1747
+ // let statsbeat = _getStatsBeat();
1748
+ // if (statsbeat) {
1749
+ // statsbeat.count(status, payloadData, _endpointUrl);
1750
+ // }
1751
+ return _getOnComplete(payload, status, headers, response);
1752
+ };
1753
+ var payloadData = _getPayload(payload);
1754
+ // if (payloadData) {
1755
+ // payloadData.statsBeatData = {startTime: dateNow()};
1756
+ // }
1757
+ var sendPostFunc = sendInterface && sendInterface.sendPOST;
1758
+ if (sendPostFunc && payloadData) {
1759
+ // ***********************************************************************************************
1760
+ // mark payload as sent at the beginning of calling each send function
1761
+ if (markAsSent) {
1762
+ _self._buffer[_DYN_MARK_AS_SENT /* @min:%2emarkAsSent */](payload);
1763
+ }
1764
+ _sendPostMgr.preparePayload(function (processedPayload) {
1765
+ return sendPostFunc(processedPayload, onComplete, !isAsync);
1766
+ }, _zipPayload, payloadData, !isAsync);
1767
+ }
1768
+ return null;
1769
+ }
1770
+ function _getPayload(payload) {
1771
+ if (isArray(payload) && payload[_DYN_LENGTH /* @min:%2elength */] > 0) {
1772
+ var batch = _self[_DYN__BUFFER /* @min:%2e_buffer */].batchPayloads(payload);
1773
+ var headers = _getHeaders();
1774
+ var payloadData = {
1775
+ data: batch,
1776
+ urlString: _endpointUrl,
1777
+ headers: headers,
1778
+ disableXhrSync: _disableXhr,
1779
+ disableFetchKeepAlive: !_fetchKeepAlive,
1780
+ oriPayload: payload
1781
+ };
1782
+ return payloadData;
1783
+ }
1784
+ return null;
1785
+ }
1786
+ function _getHeaders() {
1787
+ try {
1788
+ var headers = _headers || {};
1789
+ if (isInternalApplicationInsightsEndpoint(_endpointUrl)) {
1790
+ headers[RequestHeaders[6 /* eRequestHeaders.sdkContextHeader */]] = RequestHeaders[7 /* eRequestHeaders.sdkContextHeaderAppIdRequest */];
1791
+ }
1792
+ return headers;
1793
+ }
1794
+ catch (e) {
1795
+ // eslint-disable-next-line no-empty
1796
+ }
1797
+ return null;
1798
+ }
1799
+ function _checkMaxSize(incomingPayload) {
1800
+ var incomingSize = incomingPayload ? incomingPayload[_DYN_LENGTH /* @min:%2elength */] : 0;
1801
+ if ((_self[_DYN__BUFFER /* @min:%2e_buffer */].size() + incomingSize) > _maxBatchSizeInBytes) {
1802
+ if (!_offlineListener || _offlineListener.isOnline()) { // only trigger send when currently online
1803
+ _self[_DYN_TRIGGER_SEND /* @min:%2etriggerSend */](true, null, 10 /* SendRequestReason.MaxBatchSize */);
1804
+ }
1805
+ return true;
1806
+ }
1807
+ return false;
1808
+ }
1809
+ function _checkResponsStatus(status, payload, responseUrl, countOfItemsInPayload, errorMessage, res) {
1810
+ var response = null;
1811
+ if (!_self._appId) {
1812
+ response = parseResponse(res);
1813
+ if (response && response.appId) {
1814
+ _self._appId = response.appId;
1815
+ }
1816
+ }
1817
+ if ((status < 200 || status >= 300) && status !== 0) {
1818
+ // Update End Point url if permanent redirect or moved permanently
1819
+ // Updates the end point url before retry
1820
+ if (status === 301 || status === 307 || status === 308) {
1821
+ if (!_checkAndUpdateEndPointUrl(responseUrl)) {
1822
+ _self[_DYN__ON_ERROR /* @min:%2e_onError */](payload, errorMessage);
1823
+ return;
1824
+ }
1825
+ }
1826
+ if (_offlineListener && !_offlineListener.isOnline()) { // offline
1827
+ // Note: Don't check for status == 0, since adblock gives this code
1828
+ if (!_isRetryDisabled) {
1829
+ var offlineBackOffMultiplier = 10; // arbritrary number
1830
+ _resendPayload(payload, offlineBackOffMultiplier);
1831
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 40 /* _eInternalMessageId.TransmissionFailed */, ". Offline - Response Code: ".concat(status, ". Offline status: ").concat(!_offlineListener.isOnline(), ". Will retry to send ").concat(payload.length, " items."));
1832
+ }
1833
+ return;
1834
+ }
1835
+ if (!_isRetryDisabled && _isRetriable(status)) {
1836
+ _resendPayload(payload);
1837
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 40 /* _eInternalMessageId.TransmissionFailed */, ". " +
1838
+ "Response code " + status + ". Will retry to send " + payload[_DYN_LENGTH /* @min:%2elength */] + " items.");
1839
+ }
1840
+ else {
1841
+ _self[_DYN__ON_ERROR /* @min:%2e_onError */](payload, errorMessage);
1842
+ }
1843
+ }
1844
+ else {
1845
+ // check if the xhr's responseURL or fetch's response.url is same as endpoint url
1846
+ // TODO after 10 redirects force send telemetry with 'redirect=false' as query parameter.
1847
+ _checkAndUpdateEndPointUrl(responseUrl);
1848
+ if (status === 206) {
1849
+ if (!response) {
1850
+ response = parseResponse(res);
1851
+ }
1852
+ if (response && !_isRetryDisabled) {
1853
+ _self[_DYN__ON_PARTIAL_SUCCESS /* @min:%2e_onPartialSuccess */](payload, response);
1854
+ }
1855
+ else {
1856
+ _self[_DYN__ON_ERROR /* @min:%2e_onError */](payload, errorMessage);
1857
+ }
1858
+ }
1859
+ else {
1860
+ _consecutiveErrors = 0;
1861
+ _self[_DYN__ON_SUCCESS /* @min:%2e_onSuccess */](payload, countOfItemsInPayload);
1862
+ }
1863
+ }
1864
+ }
1865
+ function _checkAndUpdateEndPointUrl(responseUrl) {
1866
+ // Maximum stamp specific redirects allowed(uncomment this when breeze is ready with not allowing redirects feature)
1867
+ if (_stamp_specific_redirects >= 10) {
1868
+ // _self._senderConfig.endpointUrl = () => Sender._getDefaultAppInsightsChannelConfig().endpointUrl()+"/?redirect=false";
1869
+ // _stamp_specific_redirects = 0;
1870
+ return false;
1871
+ }
1872
+ if (!isNullOrUndefined(responseUrl) && responseUrl !== "") {
1873
+ if (responseUrl !== _endpointUrl) {
1874
+ _endpointUrl = responseUrl;
1875
+ ++_stamp_specific_redirects;
1876
+ return true;
1877
+ }
1878
+ }
1879
+ return false;
1880
+ }
1881
+ function _doUnloadSend(payload, isAsync) {
1882
+ if (_syncUnloadSender) {
1883
+ // We are unloading so always call the sender with sync set to false
1884
+ _syncUnloadSender(payload, false);
1885
+ }
1886
+ else {
1887
+ // Fallback to the previous beacon Sender (which causes a CORB warning on chrome now)
1888
+ var beaconInst = _sendPostMgr && _sendPostMgr[_DYN_GET_SENDER_INST /* @min:%2egetSenderInst */]([3 /* TransportType.Beacon */], true);
1889
+ return _doSend(beaconInst, payload, isAsync);
1890
+ }
1891
+ }
1892
+ function _onBeaconRetry(payload, onComplete, canSend) {
1893
+ var internalPayload = payload;
1894
+ var data = internalPayload && internalPayload.oriPayload;
1895
+ if (!_disableBeaconSplit) {
1896
+ // Failed to send entire payload so try and split data and try to send as much events as possible
1897
+ var droppedPayload = [];
1898
+ for (var lp = 0; lp < data[_DYN_LENGTH /* @min:%2elength */]; lp++) {
1899
+ var thePayload = data[lp];
1900
+ var arr = [thePayload];
1901
+ var item = _getPayload(arr);
1902
+ if (!canSend(item, onComplete)) {
1903
+ // Can't send anymore, so split the batch and drop the rest
1904
+ droppedPayload[_DYN_PUSH /* @min:%2epush */](thePayload);
1905
+ }
1906
+ else {
1907
+ _self._onSuccess(arr, arr[_DYN_LENGTH /* @min:%2elength */]);
1908
+ }
1909
+ }
1910
+ if (droppedPayload[_DYN_LENGTH /* @min:%2elength */] > 0) {
1911
+ _fallbackSend && _fallbackSend(droppedPayload, true);
1912
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 40 /* _eInternalMessageId.TransmissionFailed */, ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
1913
+ }
1914
+ }
1915
+ else {
1916
+ _fallbackSend && _fallbackSend(data, true);
1917
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 40 /* _eInternalMessageId.TransmissionFailed */, ". " + "Failed to send telemetry with Beacon API, retried with normal sender.");
1918
+ }
1919
+ }
1920
+ function _isStringArr(arr) {
1921
+ try {
1922
+ if (arr && arr[_DYN_LENGTH /* @min:%2elength */]) {
1923
+ return (isString(arr[0]));
1924
+ }
1925
+ }
1926
+ catch (e) {
1927
+ //TODO: log, sender use IInternalStorageItem instead of string since 3.1.3
1928
+ }
1929
+ return null;
1930
+ }
1931
+ function _fetchKeepAliveSender(payload, isAsync) {
1932
+ var transport = null;
1933
+ if (isArray(payload)) {
1934
+ var payloadSize = payload[_DYN_LENGTH /* @min:%2elength */];
1935
+ for (var lp = 0; lp < payload[_DYN_LENGTH /* @min:%2elength */]; lp++) {
1936
+ payloadSize += payload[lp].item[_DYN_LENGTH /* @min:%2elength */];
1937
+ }
1938
+ var syncFetchPayload = _sendPostMgr.getSyncFetchPayload();
1939
+ if ((syncFetchPayload + payloadSize) <= FetchSyncRequestSizeLimitBytes) {
1940
+ transport = 2 /* TransportType.Fetch */;
1941
+ }
1942
+ else if (isBeaconsSupported()) {
1943
+ // Fallback to beacon sender as we at least get told which events can't be scheduled
1944
+ transport = 3 /* TransportType.Beacon */;
1945
+ }
1946
+ else {
1947
+ // Payload is going to be too big so just try and send via XHR
1948
+ transport = 1 /* TransportType.Xhr */;
1949
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 2 /* eLoggingSeverity.WARNING */, 40 /* _eInternalMessageId.TransmissionFailed */, ". " + "Failed to send telemetry with Beacon API, retried with xhrSender.");
1950
+ }
1951
+ var inst = _sendPostMgr && _sendPostMgr[_DYN_GET_SENDER_INST /* @min:%2egetSenderInst */]([transport], true);
1952
+ return _doSend(inst, payload, isAsync);
1953
+ }
1954
+ return null;
1955
+ }
1956
+ /**
1957
+ * Resend payload. Adds payload back to the send buffer and setup a send timer (with exponential backoff).
1958
+ * @param payload
1959
+ */
1960
+ function _resendPayload(payload, linearFactor) {
1961
+ if (linearFactor === void 0) { linearFactor = 1; }
1962
+ if (!payload || payload[_DYN_LENGTH /* @min:%2elength */] === 0) {
1963
+ return;
1964
+ }
1965
+ var buffer = _self[_DYN__BUFFER /* @min:%2e_buffer */];
1966
+ buffer[_DYN_CLEAR_SENT /* @min:%2eclearSent */](payload);
1967
+ _consecutiveErrors++;
1968
+ for (var _i = 0, payload_1 = payload; _i < payload_1.length; _i++) {
1969
+ var item = payload_1[_i];
1970
+ item.cnt = item.cnt || 0; // to make sure we have cnt for each payload
1971
+ item.cnt++; // when resend, increase cnt
1972
+ buffer[_DYN_ENQUEUE /* @min:%2eenqueue */](item);
1973
+ }
1974
+ // setup timer
1975
+ _setRetryTime(linearFactor);
1976
+ _setupTimer();
1977
+ }
1978
+ /**
1979
+ * Calculates the time to wait before retrying in case of an error based on
1980
+ * http://en.wikipedia.org/wiki/Exponential_backoff
1981
+ */
1982
+ function _setRetryTime(linearFactor) {
1983
+ var SlotDelayInSeconds = 10;
1984
+ var delayInSeconds;
1985
+ if (_consecutiveErrors <= 1) {
1986
+ delayInSeconds = SlotDelayInSeconds;
1987
+ }
1988
+ else {
1989
+ var backOffSlot = (Math.pow(2, _consecutiveErrors) - 1) / 2;
1990
+ // tslint:disable-next-line:insecure-random
1991
+ var backOffDelay = mathFloor(Math.random() * backOffSlot * SlotDelayInSeconds) + 1;
1992
+ backOffDelay = linearFactor * backOffDelay;
1993
+ delayInSeconds = mathMax(mathMin(backOffDelay, 3600), SlotDelayInSeconds);
1994
+ }
1995
+ // TODO: Log the backoff time like the C# version does.
1996
+ var retryAfterTimeSpan = utcNow() + (delayInSeconds * 1000);
1997
+ // TODO: Log the retry at time like the C# version does.
1998
+ _retryAt = retryAfterTimeSpan;
1999
+ }
2000
+ /**
2001
+ * Sets up the timer which triggers actually sending the data.
2002
+ */
2003
+ function _setupTimer() {
2004
+ if (!_timeoutHandle && !_paused) {
2005
+ var retryInterval = _retryAt ? mathMax(0, _retryAt - utcNow()) : 0;
2006
+ var timerValue = mathMax(_maxBatchInterval, retryInterval);
2007
+ _timeoutHandle = scheduleTimeout(function () {
2008
+ _timeoutHandle = null;
2009
+ _self[_DYN_TRIGGER_SEND /* @min:%2etriggerSend */](true, null, 1 /* SendRequestReason.NormalSchedule */);
2010
+ }, timerValue);
2011
+ }
2012
+ }
2013
+ function _clearScheduledTimer() {
2014
+ _timeoutHandle && _timeoutHandle.cancel();
2015
+ _timeoutHandle = null;
2016
+ _retryAt = null;
2017
+ }
2018
+ /**
2019
+ * Checks if the SDK should resend the payload after receiving this status code from the backend.
2020
+ * @param statusCode
2021
+ */
2022
+ function _isRetriable(statusCode) {
2023
+ // retryCodes = [] means should not retry
2024
+ if (!isNullOrUndefined(_retryCodes)) {
2025
+ return _retryCodes[_DYN_LENGTH /* @min:%2elength */] && _retryCodes.indexOf(statusCode) > -1;
2026
+ }
2027
+ return statusCode === 401 // Unauthorized
2028
+ // Removing as private links can return a 403 which causes excessive retries and session storage usage
2029
+ // || statusCode === 403 // Forbidden
2030
+ || statusCode === 408 // Timeout
2031
+ || statusCode === 429 // Too many requests.
2032
+ || statusCode === 500 // Internal server error.
2033
+ || statusCode === 502 // Bad Gateway.
2034
+ || statusCode === 503 // Service unavailable.
2035
+ || statusCode === 504; // Gateway timeout.
2036
+ }
2037
+ // Using function lookups for backward compatibility as the getNotifyMgr() did not exist until after v2.5.6
2038
+ function _getNotifyMgr() {
2039
+ var func = "getNotifyMgr";
2040
+ var result;
2041
+ var core = _self.core;
2042
+ if (core) {
2043
+ // During page unload the core may have been cleared and some async events may not have been sent yet
2044
+ // resulting in the core being null. In this case we don't want to create a statsbeat instance
2045
+ if (core[func]) {
2046
+ result = core[func]();
2047
+ }
2048
+ else {
2049
+ // using _self.core['_notificationManager'] for backward compatibility
2050
+ result = core["_notificationManager"];
2051
+ }
2052
+ }
2053
+ return result;
2054
+ }
2055
+ function _notifySendRequest(sendRequest, isAsync) {
2056
+ var manager = _getNotifyMgr();
2057
+ if (manager && manager.eventsSendRequest) {
2058
+ try {
2059
+ manager.eventsSendRequest(sendRequest, isAsync);
2060
+ }
2061
+ catch (e) {
2062
+ _throwInternal(_self[_DYN_DIAG_LOG /* @min:%2ediagLog */](), 1 /* eLoggingSeverity.CRITICAL */, 74 /* _eInternalMessageId.NotificationException */, "send request notification failed: " + getExceptionName(e), { exception: dumpObj(e) });
2063
+ }
2064
+ }
2065
+ }
2066
+ /**
2067
+ * Validate UUID Format
2068
+ * Specs taken from https://tools.ietf.org/html/rfc4122 and breeze repo
2069
+ */
2070
+ function _validateInstrumentationKey(instrumentationKey, config) {
2071
+ var disableValidation = config.disableInstrumentationKeyValidation;
2072
+ var disableIKeyValidationFlag = isNullOrUndefined(disableValidation) ? false : disableValidation;
2073
+ if (disableIKeyValidationFlag) {
2074
+ return true;
2075
+ }
2076
+ var UUID_Regex = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
2077
+ var regexp = new RegExp(UUID_Regex);
2078
+ return regexp.test(instrumentationKey);
2079
+ }
2080
+ function _initDefaults() {
2081
+ _self[_DYN__SENDER /* @min:%2e_sender */] = null;
2082
+ _self[_DYN__BUFFER /* @min:%2e_buffer */] = null;
2083
+ _self._appId = null;
2084
+ _self._sample = null;
2085
+ _headers = {};
2086
+ _offlineListener = null;
2087
+ _consecutiveErrors = 0;
2088
+ _retryAt = null;
2089
+ _lastSend = null;
2090
+ _paused = false;
2091
+ _timeoutHandle = null;
2092
+ _serializer = null;
2093
+ _stamp_specific_redirects = 0;
2094
+ _syncFetchPayload = 0;
2095
+ _syncUnloadSender = null;
2096
+ _evtNamespace = null;
2097
+ _endpointUrl = null;
2098
+ _orgEndpointUrl = null;
2099
+ _maxBatchSizeInBytes = 0;
2100
+ _beaconSupported = false;
2101
+ _customHeaders = null;
2102
+ _disableTelemetry = false;
2103
+ _instrumentationKey = null;
2104
+ _convertUndefined = UNDEFINED_VALUE;
2105
+ _isRetryDisabled = false;
2106
+ _sessionStorageUsed = null;
2107
+ _namePrefix = UNDEFINED_VALUE;
2108
+ _disableXhr = false;
2109
+ _fetchKeepAlive = false;
2110
+ _disableBeaconSplit = false;
2111
+ _xhrSend = null;
2112
+ _fallbackSend = null;
2113
+ _sendPostMgr = null;
2114
+ objDefine(_self, "_senderConfig", {
2115
+ g: function () {
2116
+ return objExtend({}, defaultAppInsightsChannelConfig);
2117
+ }
2118
+ });
2119
+ }
2120
+ });
2121
+ return _this;
2122
+ }
2123
+ Sender.constructEnvelope = function (orig, iKey, logger, convertUndefined) {
2124
+ var envelope;
2125
+ if (iKey !== orig.iKey && !isNullOrUndefined(iKey)) {
2126
+ envelope = __assignFn(__assignFn({}, orig), { iKey: iKey });
2127
+ }
2128
+ else {
2129
+ envelope = orig;
2130
+ }
2131
+ var creator = EnvelopeTypeCreator[envelope.baseType] || EventEnvelopeCreator;
2132
+ return creator(logger, envelope, convertUndefined);
2133
+ };
2134
+ // Removed Stub for Sender.prototype.pause.
2135
+ // Removed Stub for Sender.prototype.resume.
2136
+ // Removed Stub for Sender.prototype.flush.
2137
+ // Removed Stub for Sender.prototype.onunloadFlush.
2138
+ // Removed Stub for Sender.prototype.initialize.
2139
+ // Removed Stub for Sender.prototype.processTelemetry.
2140
+ // Removed Stub for Sender.prototype._xhrReadyStateChange.
2141
+ // Removed Stub for Sender.prototype.triggerSend.
2142
+ // Removed Stub for Sender.prototype._onError.
2143
+ // Removed Stub for Sender.prototype._onPartialSuccess.
2144
+ // Removed Stub for Sender.prototype._onSuccess.
2145
+ // Removed Stub for Sender.prototype._xdrOnLoad.
2146
+ // Removed Stub for Sender.prototype.addHeader.
2147
+ // Removed Stub for Sender.prototype.isCompletelyIdle.
2148
+ // Removed Stub for Sender.prototype.getOfflineSupport.
2149
+ // Removed Stub for Sender.prototype.getOfflineListener.
2150
+ return Sender;
2151
+ }(BaseTelemetryPlugin));
2152
+
2153
+ export { Sender as S };