Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
1,194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 239.63 KB | None | 0 0
  1. "object" != typeof JSON && (JSON = {}),
  2. function() {
  3. "use strict";
  4.  
  5. function f(e) {
  6. return 10 > e ? "0" + e : e
  7. }
  8.  
  9. function this_value() {
  10. return this.valueOf()
  11. }
  12.  
  13. function quote(e) {
  14. return rx_escapable.lastIndex = 0, rx_escapable.test(e) ? '"' + e.replace(rx_escapable, function(e) {
  15. var t = meta[e];
  16. return "string" == typeof t ? t : "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4)
  17. }) + '"' : '"' + e + '"'
  18. }
  19.  
  20. function str(e, t) {
  21. var n, o, a, i, r, s = gap,
  22. d = t[e];
  23. switch (d && "object" == typeof d && "function" == typeof d.toJSON && (d = d.toJSON(e)), "function" == typeof rep && (d = rep.call(t, e, d)), typeof d) {
  24. case "string":
  25. return quote(d);
  26. case "number":
  27. return isFinite(d) ? String(d) : "null";
  28. case "boolean":
  29. case "null":
  30. return String(d);
  31. case "object":
  32. if (!d) return "null";
  33. if (gap += indent, r = [], "[object Array]" === Object.prototype.toString.apply(d)) {
  34. for (i = d.length, n = 0; i > n; n += 1) r[n] = str(n, d) || "null";
  35. return a = 0 === r.length ? "[]" : gap ? "[\n" + gap + r.join(",\n" + gap) + "\n" + s + "]" : "[" + r.join(",") + "]", gap = s, a
  36. }
  37. if (rep && "object" == typeof rep)
  38. for (i = rep.length, n = 0; i > n; n += 1) "string" == typeof rep[n] && (o = rep[n], a = str(o, d), a && r.push(quote(o) + (gap ? ": " : ":") + a));
  39. else
  40. for (o in d) Object.prototype.hasOwnProperty.call(d, o) && (a = str(o, d), a && r.push(quote(o) + (gap ? ": " : ":") + a));
  41. return a = 0 === r.length ? "{}" : gap ? "{\n" + gap + r.join(",\n" + gap) + "\n" + s + "}" : "{" + r.join(",") + "}", gap = s, a
  42. }
  43. }
  44. var rx_one = /^[\],:{}\s]*$/,
  45. rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
  46. rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
  47. rx_four = /(?:^|:|,)(?:\s*\[)+/g,
  48. rx_escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  49. rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
  50. "function" != typeof Date.prototype.toJSON && (Date.prototype.toJSON = function() {
  51. return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null
  52. }, Boolean.prototype.toJSON = this_value, Number.prototype.toJSON = this_value, String.prototype.toJSON = this_value);
  53. var gap, indent, meta, rep;
  54. "function" != typeof JSON.stringify && (meta = {
  55. "\b": "\\b",
  56. " ": "\\t",
  57. "\n": "\\n",
  58. "\f": "\\f",
  59. "\r": "\\r",
  60. '"': '\\"',
  61. "\\": "\\\\"
  62. }, JSON.stringify = function(e, t, n) {
  63. var o;
  64. if (gap = "", indent = "", "number" == typeof n)
  65. for (o = 0; n > o; o += 1) indent += " ";
  66. else "string" == typeof n && (indent = n);
  67. if (rep = t, t && "function" != typeof t && ("object" != typeof t || "number" != typeof t.length)) throw new Error("JSON.stringify");
  68. return str("", {
  69. "": e
  70. })
  71. }), "function" != typeof JSON.parse && (JSON.parse = function(text, reviver) {
  72. function walk(e, t) {
  73. var n, o, a = e[t];
  74. if (a && "object" == typeof a)
  75. for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (o = walk(a, n), void 0 !== o ? a[n] = o : delete a[n]);
  76. return reviver.call(e, t, a)
  77. }
  78. var j;
  79. if (text = String(text), rx_dangerous.lastIndex = 0, rx_dangerous.test(text) && (text = text.replace(rx_dangerous, function(e) {
  80. return "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4)
  81. })), rx_one.test(text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, ""))) return j = eval("(" + text + ")"), "function" == typeof reviver ? walk({
  82. "": j
  83. }, "") : j;
  84. throw new SyntaxError("JSON.parse")
  85. })
  86. }(),
  87. function() {
  88. var e = window,
  89. t = e.$Debug = e.$Debug || {},
  90. n = e.$Config || {};
  91. t.options = {
  92. tracePagePath: !1
  93. }, t.fail = function(t) {
  94. var n = new Error(t + " "),
  95. o = e.$WebWatson;
  96. throw o && o.submitFromException(n, void 0, 33), n
  97. }, t.assert = function(o, a) {
  98. o || (a = "Assert failed: " + a, n.uxDebug && e.confirm(a + "\r\n\r\nBreak into debugger?") && t.fail(a))
  99. }, t.failIf = function(e, n) {
  100. e || t.fail(n)
  101. }, t.trace = function(n, o) {
  102. if (n || (n = ""), console && console.log) {
  103. if (t.options.tracePagePath) {
  104. var a = e.location.pathname;
  105. o = o ? a + ": " + o : a
  106. }
  107. o && (n = o + ": " + n), t.appendLog(n), console.log(n)
  108. }
  109. }
  110. }(),
  111. function() {
  112. var e = window,
  113. t = e.$Debug,
  114. n = e.Array.prototype;
  115. n.addRange || (n.addRange = function(e) {
  116. return e && this.push.apply(this, e), this
  117. }), n.exists || (n.exists = function(e) {
  118. return this.indexOf(e) >= 0
  119. }), n.contains || (n.contains = n.exists), n.clone || (n.clone = function() {
  120. return [].addRange(this)
  121. }), n.indexOf || (n.indexOf = function(e, t) {
  122. var n = this.length;
  123. for ((t = t || 0) < 0 && (t = Math.max(0, n + t)); n > t;)
  124. if (this[t++] === e) return t - 1;
  125. return -1
  126. }), n.forEach || (n.forEach = function(e, n) {
  127. t && t.assert(e, "fnCb must be provided");
  128. for (var o = this.length, a = 0; o > a; a++) e.call(n, this[a], a, this);
  129. t && t.assert(o == this.length, "Do not modify array during forEach")
  130. }), n.insert || (n.insert = function(e, t) {
  131. this.splice(e, 0, t)
  132. }), n.remove || (n.remove = function(e) {
  133. var t = this.indexOf(e);
  134. return t >= 0 && this.splice(t, 1), t >= 0
  135. })
  136. }(),
  137. function() {
  138. function e(e, t, o) {
  139. var a = o.s === t;
  140. if (!a) {
  141. t = t || 0;
  142. var i, r, s = e.charCodeAt(t);
  143. o.s = -1, 55296 > s || s > 57343 ? o.c = s : 56319 >= s ? (i = s, r = e.charCodeAt(t + 1), n && n.assert(!isNaN(r), "High surrogate not followed by low surrogate in fixedCharCodeAt()"), o.c = 1024 * (i - 55296) + (r - 56320) + 65536, o.s = t + 1) : (o.c = -1, a = !0)
  144. }
  145. return !a
  146. }
  147. var t = window,
  148. n = t.$Debug,
  149. o = t.String.prototype;
  150. o.endsWith = function(e) {
  151. return n && n.assert(e, "must provide suffix"), this.substr(this.length - e.length) == e
  152. }, o.startsWith = function(e) {
  153. return n && n.assert(e, "must provide prefix"), this.substr(0, e.length) == e
  154. }, o.lTrim = function() {
  155. return this.replace(/^\s*/, "")
  156. }, o.rTrim = function() {
  157. return this.replace(/\s*$/, "")
  158. }, o.trim = function() {
  159. return this.replace(/^\s+|\s+$/g, "")
  160. };
  161. var a = /\{\d+\}/g,
  162. i = /[\{\}]/g;
  163. o.format = function() {
  164. function e(e) {
  165. var o = t[e.replace(i, "")];
  166. return n && n.assert("undefined" != typeof o, "String Format- Provide argument at index " + e.replace(i, "")), null === o && (o = ""), o
  167. }
  168. var t = arguments;
  169. return this.replace(a, e)
  170. };
  171. var r = /[^\w.,-]/g;
  172. o.encodeXmlAttribute = o.encodeHtmlAttribute = function() {
  173. return this.replace(r, function(e) {
  174. return ["&#", e.charCodeAt(0), ";"].join("")
  175. })
  176. };
  177. var s = /[^\w .,-]/g;
  178. o.encodeXml = o.encodeHtml = function() {
  179. var t = {
  180. c: 0,
  181. s: -1
  182. };
  183. return this.replace(s, function(n, o, a) {
  184. return e(a, o, t) ? ["&#", t.c, ";"].join("") : ""
  185. })
  186. };
  187. var d = /[^\w.%-]/g;
  188. o.encodeURIComponent = o.encodeUrl = function() {
  189. return encodeURIComponent(this).replace(d, function(e) {
  190. var t = e.charCodeAt(0).toString(16);
  191. return "%" + (1 == t.length ? "0" + t : t).toUpperCase()
  192. })
  193. };
  194. var _ = /[^\w .,-]/g;
  195. o.encodeJson = function() {
  196. return this.replace(_, function(e) {
  197. var t = e.charCodeAt(0).toString(16),
  198. n = new Array(4 - t.length + 1).join("0");
  199. return "\\u" + n + t.toUpperCase()
  200. })
  201. }, o.decodeURIComponent = o.decodeUrl = function() {
  202. return decodeURIComponent(this)
  203. };
  204. var c = /([\\\.\{\}\(\)\[\]\/\+\*\?\|\^\$])/gi;
  205. o.escapeRegex = function(e) {
  206. return (0 === arguments.length ? this : e).replace(c, "\\$1")
  207. }, o.areEqualIgnoreCase = function(e) {
  208. var t = this;
  209. return t.toLowerCase() === e.toLowerCase() ? !0 : !1
  210. }, o.qs = function(e, t) {
  211. var n = new RegExp("([?&])" + e + "=([^&#]*)", "i");
  212. if (void 0 !== t && null !== t) return this.match(n) ? this.replace(n, "$1" + e + "=" + t) : this.indexOf("?") > 0 ? this + "&" + e + "=" + t : this + "?" + e + "=" + t;
  213. var o = n.exec(this);
  214. return null === o ? "" : o[2]
  215. }, o.upsertQueryStringParam = function(e, t) {
  216. return void 0 === t ? this : this.qs(e, t)
  217. }, o.removeQueryStringParam = function(e, t) {
  218. var n = new RegExp("([?&])" + t + "=.*?(&|$)", "i");
  219. return this.match(n) ? this.replace(n, "$1") : this
  220. }, o.getQueryStringParam = function(e) {
  221. if (!e) return "";
  222. var t = new RegExp("([?&])" + e + "=([^&#]*)", "i"),
  223. n = this.match(t);
  224. return n ? n[2] : ""
  225. }, o.getCookie = function(e) {
  226. for (var n, o, a = this.split(";"), i = 0; i < a.length; i++)
  227. if (n = a[i].substr(0, a[i].indexOf("=")).replace(/^\s+|\s+$/g, ""), o = a[i].substr(a[i].indexOf("=") + 1), n === e) return t.unescape(o)
  228. }, o.htmlEncode = function() {
  229. return $("<span/>").text(this).html()
  230. }, o.htmlDecode = function() {
  231. return $("<span/>").html(this).text()
  232. }
  233. }(),
  234. function() {
  235. var e = window.Object;
  236. "Object" != e.__typeName && (e.isString = function(e) {
  237. return "string" == typeof e || e && e.constructor === String
  238. }, e.isArray = function(e) {
  239. return e instanceof Array
  240. }, e.isFunction = function(e) {
  241. return "function" == typeof e
  242. }, e.isObject = function(e) {
  243. return e && "object" == typeof e
  244. }, e.isBoolean = function(e) {
  245. return "boolean" == typeof e || e && e.constructor === Boolean
  246. }, e.isNumber = function(e) {
  247. return "number" == typeof e || e && e.constructor === Number
  248. }, e.resolve = function(e) {
  249. try {
  250. "string" == typeof e ? e = Function.parse(e) : "object" == typeof e ? e = e.constructor : "function" != typeof e && (e = null)
  251. } catch (t) {
  252. return null
  253. }
  254. return e
  255. }, e.compare = function(e, t) {
  256. var n = this.resolve(e);
  257. return n && n == this.resolve(t)
  258. }, e.getType = function(t) {
  259. var n = t.constructor;
  260. return n && "function" == typeof n && n.__typeName && "Object" != n.__typeName ? n : e
  261. }, e.isNull = function(e) {
  262. return null === e || void 0 === e
  263. }, e.getTypeName = function(t) {
  264. return e.getType(t).__typeName
  265. }, e.__typeName = "Object")
  266. }(), $Do.when("jQuery", function() {
  267. function e(e, t, n, o, a) {
  268. var i = {
  269. canary: d.apiCanary,
  270. hpgid: d.hpgid || 0,
  271. hpgact: d.hpgact || 0,
  272. Accept: C
  273. };
  274. d.correlationId && (i[p] = d.correlationId);
  275. var s = t;
  276. return t && !r(t) && (s = JSON.stringify(t)), s && (s = s.replace(/\?/g, "\\u003F")), c && c.appendLog && c.appendLog("$Api.Json(" + e + ")"), jQuery.ajax({
  277. url: e,
  278. contentType: "application/json; charset=utf-8",
  279. dataType: "json",
  280. data: s,
  281. processData: !1,
  282. type: "POST",
  283. headers: i,
  284. timeout: a || l,
  285. success: n,
  286. error: o
  287. })
  288. }
  289.  
  290. function t(e) {
  291. return e ? "<span style='font-weight: bold;'>" + e.toString().encodeHtml() + ":</span> " : ""
  292. }
  293.  
  294. function n(e, n) {
  295. return n ? "<div>" + t(e) + n.toString().encodeHtml() + "</div>" : ""
  296. }
  297.  
  298. function o(e) {
  299. var t = [];
  300. if (e)
  301. for (var n = (e || "").split("\n"), o = 0; o < n.length; o++)
  302. for (var a = n[o], i = (a || "").split("\\r\\n"), r = 0; r < i.length; r++) {
  303. var s = (i[r] || "").replace("\\u000a", "").replace("\\u0028", "(").replace("\\u0029", ")").replace("\\u003a", ":").replace("\\u003c", "&lt;").replace("\\u003d", "=").replace("\\u003e", "&gt;").replace("\\u005c", "\\");
  304. t.push(s)
  305. }
  306. return t
  307. }
  308.  
  309. function a(e) {
  310. var t = "";
  311. if (e)
  312. for (var n = 0; n < e.length; n++) t += e[n] + "\n";
  313. return t
  314. }
  315.  
  316. function i(e, t) {
  317. if (S && e && e.error && (e.error.stackTrace || e.error.debugMessage)) {
  318. var i = o(e.error.stackTrace),
  319. r = null;
  320. if (e.error.isFatal || e.error.showError) r = a(i), _ && _.showError(e.error.code, "ApiRequest Error: " + (e.error.message || ""), t || "<none>", null, null, null, r, e.error.debugMessage, e.error.data, e.error.isFatal ? "#FFC0C0" : "#C0FFFF", !0);
  321. else if (window.$Debug && c.scriptConsole) {
  322. var s = c.scriptConsole;
  323. r = a(i), s.errorHtml(n("Url", t) + n("Error Code", e.error.code) + (e.error.message ? n("Message", e.error.message) : "") + (e.error.isFatal ? n("Is Fatal", e.error.isFatal) : "") + (e.error.debugMessage ? n("Debug", e.error.debugMessage) : ""), {
  324. url: t,
  325. code: e.error.code,
  326. data: e.error.data,
  327. stackTrace: i,
  328. rsp: e
  329. })
  330. }
  331. }
  332. }
  333.  
  334. function r(e) {
  335. return "string" === jQuery.type(e)
  336. }
  337. var s = window,
  338. d = s.$Config || {},
  339. _ = s.$WebWatson,
  340. c = s.$Debug || {},
  341. l = 3e4,
  342. u = 8e3,
  343. g = 8001,
  344. m = 8002,
  345. h = 100,
  346. p = "client-request-id",
  347. C = "application/json",
  348. f = s.$Api = {},
  349. E = f.Errors = [];
  350. f.ApiErrorCodes = {
  351. GeneralError: "6000",
  352. AuthFailure: "6001",
  353. InvalidArgs: "6002",
  354. Generic: u,
  355. Timeout: g,
  356. Aborted: m
  357. };
  358. var S = null;
  359. f.Json = function(t, n, o, a, r, s) {
  360. function c(e, t) {
  361. var n = {};
  362. if (500 == e.status) try {
  363. n = JSON.parse(e.responseText) || {}
  364. } catch (o) {}
  365. if (!n.error) {
  366. var a = !1,
  367. i = u,
  368. r = "Request Failed -- No Response from Server";
  369. switch (t) {
  370. case "timeout":
  371. i = g, r = "Timeout Error", a = !0;
  372. break;
  373. case "abort":
  374. i = m, r = "Aborted";
  375. break;
  376. case "error":
  377. e.status >= 400 && (a = !0);
  378. break;
  379. case "parsererror":
  380. r = "Unable to parse response", a = !0
  381. }
  382. n.error = {
  383. code: i,
  384. message: r,
  385. debugMessage: "(xhr status " + e.status + ") xhr.responseText: " + e.responseText,
  386. stackTrace: "",
  387. isFatal: a
  388. }
  389. }
  390. return n
  391. }
  392.  
  393. function l(e) {
  394. e = e || {};
  395. var n, r = e.error || null;
  396. if (e.apiCanary && (d.apiCanary = e.apiCanary, delete e.apiCanary), r) {
  397. n = r.stackTrace, n = n && n.encodeJson ? n.encodeJson() : "";
  398. var _ = '{"code": "' + r.code + '", "message": "' + r.message + '", "debug": "' + r.debugMessage + '", "stacktrace": "' + n + '", "requestUrl": "' + t + '"}';
  399. E.push(_), E.length > h && E.shift(), r.code != m && (i(e, t), a && a(e, s))
  400. } else o && o(e, s)
  401. }
  402.  
  403. function p() {
  404. return setTimeout(function() {
  405. var e = {
  406. error: {
  407. code: m,
  408. message: "Request Failed!",
  409. isFatal: !0
  410. }
  411. };
  412. l(e)
  413. }, 0), null
  414. }
  415. var C = o || a ? !0 : !1;
  416. return d.apiCanary ? (null === S && (S = !1, _ && d.isOneBox && (S = !0)), e(t, n, function(e) {
  417. C && l(e)
  418. }, function(e, t, n) {
  419. C && l(c(e, t, n))
  420. }, r)) : p()
  421. }, s.$Do && s.$Do.register("$Api")
  422. });
  423. var MSLogin = {},
  424. proxy = proxy || {};
  425. MSLogin.ErrorCodes = {
  426. IDP_ERROR: 2147776681,
  427. IDP_ERROR2: 2147776682,
  428. NAMESPACE_ERROR: 2147778860,
  429. PARSE_ERROR: 2147762276
  430. };
  431. var ErrorCodes = MSLogin.ErrorCodes;
  432. MSLogin.Constants = {
  433. REDIRECT_COUNTDOWN_DEFAULT: 3,
  434. FEDERATION_QUERY_PARAMETERS: "",
  435. CDN_IMAGE_PATH: "images/",
  436. LATENCY_THRESHOLD: 2e3,
  437. PREFETCH_URL: "",
  438. LATENCY_SENSITIVITY_DEFAULT: 1,
  439. OTHER_ACCOUNT_TEXT: "",
  440. MAX_TILE_TEXT_LENGTH: 25,
  441. MEMBER_NAME: "",
  442. REDIRECT_MESSAGES: {},
  443. METRICS_MODE: 1,
  444. SUBMIT_METRICS_ON_REDIRECT: !1,
  445. SUBMIT_METRICS_ON_POST: !1,
  446. INSTRUMENT_PLT: !1,
  447. MOBILE_WIDTH_THRESHOLD: 600,
  448. MOBILE_HEIGHT_THRESHOLD: 600,
  449. PARTNER_NAME: "",
  450. SAVED_USER_COOKIE: "MSSavedUser",
  451. PREFILL_USER_COOKIE: "MSPPre",
  452. SAVED_USER_COOKIE_INFO_DELIMITER: "$",
  453. SAVED_USER_COOKIE_USER_DELIMITER: "|",
  454. MAX_USER_TILES: 1,
  455. DIR: "ltr",
  456. TWOFA_POLLING_INTERVAL: null,
  457. TWOFA_MAX_POLLS: null,
  458. TWOFA_MAXMETHODS: 20,
  459. TWOFA_OTP_MAX_LEN: 6,
  460. TWOFA_TIMEOUT: 1e4,
  461. TWOFA_ANIMATION_INTERVAL: 3e3,
  462. TWOFA_AUTH_TIMEOUT: 12e4,
  463. TWOFA_REMEMBER_DEVICE_ENABLED: !1,
  464. SSPR_TIMEOUT: 1e4,
  465. EMAIL_DISCOVERY_SERVICE_TIMEOUT: 3e3,
  466. EMAIL_DISCOVERY_SERVICE_URI: "/GetUserRealmExtended.srf",
  467. EMAIL_DISCOVERY_DEFAULT_TILES: null,
  468. MSA_AUTH_URL: null,
  469. TENANT_BRANDING: null,
  470. LCID: null,
  471. MSA_ACCOUNT_IMG_ALT_TEXT: "",
  472. AAD_ACCOUNT_IMG_ALT_TEXT: "",
  473. MSA_ACCOUNT_TILE_ALT_TEXT: "",
  474. AAD_ACCOUNT_TILE_ALT_TEXT: "",
  475. HIP_IMAGE_ALT_TEXT: null,
  476. DEFAULT_ILLUSTRATION: "",
  477. DEFAULT_ILLUSTRATION_ALT: "",
  478. DEFAULT_LOGO: "",
  479. DEFAULT_LOGO_ALT: "",
  480. DEFAULT_BACKGROUND_COLOR: "#333333",
  481. GENERIC_ERROR_CODES: [ErrorCodes.IDP_ERROR, ErrorCodes.IDP_ERROR2, ErrorCodes.NAMESPACE_ERROR, ErrorCodes.PARSE_ERROR],
  482. REALM_RESOLVER_URL: "/GetUserRealm.srf",
  483. DYNAMIC_BRANDING_CTA_ENABLED: !0,
  484. USERNAME_HINT_TEXT: "someone@example.com",
  485. REGEX_PHONE: /^[\+]{0,1}([\(\)\- \*\.#/\[\]]*\d[\(\)\- \*\.#/\[\]]*){4,20}$/,
  486. REGEX_EMAIL: /^([\w-\.\'!#]+@([\w-]+\.)+[\w-]{2,46})?$/,
  487. USER_DOMAIN_HINT_CHANGED_EVENT_NAME: "MSLogin-User-UserDomainHintChanged"
  488. }, MSLogin.Constants.State = {
  489. NONE: 0,
  490. FEDERATED: 1,
  491. MANAGED: 2,
  492. INVALID: 3,
  493. PENDING: 4
  494. }, MSLogin.Constants.MSAccount = {
  495. EXISTS: 0,
  496. NOT_EXIST: 1,
  497. THROTTLED: 2
  498. }, MSLogin.Constants.TokenizedStringMsgs = {
  499. GENERIC_ERROR: "",
  500. UPN_DISAMBIGUATE_MESSAGE: ""
  501. }, MSLogin.Constants.NameSpaceType = {
  502. UNKNOWN: "Unknown",
  503. FEDERATED: "Federated",
  504. MANAGED: "Managed",
  505. CLOUDFEDERATED: "CloudFederated"
  506. }, MSLogin.Constants.FederationProtocol = {
  507. Saml20: "SAML20"
  508. }, MSLogin.Constants.EmailDiscoveryAccountState = {
  509. AAD_UNKNOWN_AND_MSA_NOT_EXIST: 0,
  510. AAD_UNKNOWN_AND_MSA_EXISTS: 1,
  511. AAD_UNKNOWN_AND_MSA_THROTTLED: 2,
  512. AAD_UNKNOWN_AND_MSA_TIMED_OUT: 3,
  513. AAD_FEDERATED_AND_MSA_NOT_EXIST: 4,
  514. AAD_FEDERATED_AND_MSA_EXISTS: 5,
  515. AAD_FEDERATED_AND_MSA_THROTTLED: 6,
  516. AAD_FEDERATED_AND_MSA_TIMED_OUT: 7,
  517. AAD_MANAGED_AND_MSA_NOT_EXIST: 8,
  518. AAD_MANAGED_AND_MSA_EXISTS: 9,
  519. AAD_MANAGED_AND_MSA_THROTTLED: 10,
  520. AAD_MANAGED_AND_MSA_TIMED_OUT: 11,
  521. AAD_TIMED_OUT_AND_MSA_NOT_EXIST: 12,
  522. AAD_TIMED_OUT_AND_MSA_EXISTS: 13,
  523. AAD_TIMED_OUT_AND_MSA_THROTTLED: 14,
  524. AAD_TIMED_OUT_AND_MSA_TIMED_OUT: 15,
  525. ERROR: 16,
  526. AAD_CLOUDFEDERATED_AND_MSA_NOT_EXIST: 17,
  527. AAD_CLOUDFEDERATED_AND_MSA_EXISTS: 18,
  528. AAD_CLOUDFEDERATED_AND_MSA_THROTTLED: 19,
  529. AAD_CLOUDFEDERATED_AND_MSA_TIMED_OUT: 20
  530. }, MSLogin.Constants.CancelAction = {
  531. FROM_REDIRECT_TO_LOGIN: 0,
  532. FROM_SHOW_USER_TO_TILES: 1,
  533. FROM_MANY_TO_EMAILDISCOVERY_INIT: 2,
  534. FROM_EMAILDISCOVERY_START_TO_TILES: 3,
  535. FROM_EMAILDISCOVERY_SPLITTER_TO_EMAILDISCOVERY_START: 4,
  536. FROM_EMAILDISCOVERY_AAD_LOGIN_TO_EMAILDISCOVERY_START: 5,
  537. FROM_EMAILDISCOVERY_AAD_LOGIN_TO_EMAILDISCOVERY_SPLITTER: 6,
  538. FROM_EMAILDISCOVERY_LOOKING_FOR_ACCOUNT_TO_EMAILDISCOVERY_START: 7,
  539. FROM_EMAILDISCOVERY_REDIRECT_TO_EMAILDISCOVERY_START: 8,
  540. FROM_EMAILDISCOVERY_REDIRECT_TO_EMAILDISCOVERY_SPLITTER: 9,
  541. FROM_EMAILDISCOVERY_SPLITTER_FALLBACK_TO_TILES: 10,
  542. FROM_DISAMBIGUATION_SCREEN_TO_LOGIN: 11,
  543. FROM_LOGIN_TO_DISAMBIGUATION_SCREEN: 12,
  544. FROM_REDIRECT_TO_DISAMBIGUATION_SCREEN: 13
  545. }, MSLogin.Constants.AuthNForwardType = {
  546. NORMAL: 0,
  547. MULTIAUTH_ADFS: 1,
  548. NON_MULTIAUTH_ADFS: 2,
  549. WIAORMULTIAUTHN_ADFS: 3
  550. }, MSLogin.BackActionStack = function() {
  551. this.BackActionStack = []
  552. }, MSLogin.BackActionStack.prototype.AddAction = function(e) {
  553. this.BackActionStack.push(e)
  554. }, MSLogin.BackActionStack.prototype.TriggerCancelAction = function() {
  555. Context.post_from_tile = !1;
  556. var e = this.BackActionStack.pop();
  557. switch (e) {
  558. case Constants.CancelAction.FROM_REDIRECT_TO_LOGIN:
  559. case Constants.CancelAction.FROM_SHOW_USER_TO_TILES:
  560. TenantBranding.RestoreDefaultPageBranding(), Tiles.CancelTileRedirect();
  561. break;
  562. case Constants.CancelAction.FROM_MANY_TO_EMAILDISCOVERY_INIT:
  563. EmailDiscovery.Init();
  564. break;
  565. case Constants.CancelAction.FROM_EMAILDISCOVERY_START_TO_TILES:
  566. EmailDiscovery.BackToUserTiles();
  567. break;
  568. case Constants.CancelAction.FROM_EMAILDISCOVERY_SPLITTER_TO_EMAILDISCOVERY_START:
  569. Context.username_state.last_checked_email = "", EmailDiscovery.HideSplitter(), EmailDiscovery.ShowEmailDiscovery();
  570. break;
  571. case Constants.CancelAction.FROM_EMAILDISCOVERY_AAD_LOGIN_TO_EMAILDISCOVERY_START:
  572. Context.username_state.last_checked_email = "", EmailDiscovery.HideAADLoginLayout(), EmailDiscovery.ShowEmailDiscovery();
  573. break;
  574. case Constants.CancelAction.FROM_EMAILDISCOVERY_AAD_LOGIN_TO_EMAILDISCOVERY_SPLITTER:
  575. EmailDiscovery.HideAADLoginLayout(), Context.email_discovery_use_msa_api ? this.TriggerCancelAction() : EmailDiscovery.ShowSplitter();
  576. break;
  577. case Constants.CancelAction.FROM_EMAILDISCOVERY_LOOKING_FOR_ACCOUNT_TO_EMAILDISCOVERY_START:
  578. Context.username_state.last_checked_email = "", EmailDiscovery.CancelLookingForAccount();
  579. break;
  580. case Constants.CancelAction.FROM_EMAILDISCOVERY_REDIRECT_TO_EMAILDISCOVERY_START:
  581. Context.username_state.last_checked_email = "", EmailDiscovery.CancelRedirect(), EmailDiscovery.ShowEmailDiscovery();
  582. break;
  583. case Constants.CancelAction.FROM_EMAILDISCOVERY_REDIRECT_TO_EMAILDISCOVERY_SPLITTER:
  584. EmailDiscovery.CancelRedirect(), Context.email_discovery_use_msa_api ? this.TriggerCancelAction() : EmailDiscovery.ShowSplitter();
  585. break;
  586. case Constants.CancelAction.FROM_EMAILDISCOVERY_SPLITTER_FALLBACK_TO_TILES:
  587. EmailDiscovery.HideSplitter(), this.TriggerCancelAction();
  588. break;
  589. case Constants.CancelAction.FROM_DISAMBIGUATION_SCREEN_TO_LOGIN:
  590. Context.username_state.last_checked_email = "", Tiles.hideDisambiguationScreen(), Tiles.showUserLoginPage();
  591. break;
  592. case Constants.CancelAction.FROM_LOGIN_TO_DISAMBIGUATION_SCREEN:
  593. MSLogin.SplitterControl.Render();
  594. break;
  595. case Constants.CancelAction.FROM_REDIRECT_TO_DISAMBIGUATION_SCREEN:
  596. User.CancelRedirect(), MSLogin.SplitterControl.Render()
  597. }
  598. }, MSLogin.Store = function() {
  599. this.Map = {}
  600. }, MSLogin.Store.prototype.Get = function(e) {
  601. var t = $.trim(e).toLowerCase();
  602. return this.Map[t]
  603. }, MSLogin.Store.prototype.Add = function(e, t) {
  604. var n = $.trim(e).toLowerCase();
  605. this.Map[n] = t
  606. }, MSLogin.BackActionStack.prototype.RemoveLastCancelAction = function() {
  607. this.BackActionStack.pop()
  608. }, MSLogin.BackActionStack.prototype.DoesCancelActionExist = function() {
  609. return this.BackActionStack.length > 0
  610. }, MSLogin.BackActionStack.prototype.ClearCancelActions = function() {
  611. this.BackActionStack = []
  612. };
  613. var Constants = MSLogin.Constants;
  614. MSLogin.Context = {
  615. whr: "",
  616. query_search_params: document.location.search,
  617. federated_domain: "",
  618. redirect_countdown: Constants.REDIRECT_COUNTDOWN_DEFAULT,
  619. redirect_auth_url: "",
  620. animationTid: null,
  621. redirectTid: null,
  622. metrics_on_redirect_submitted: !1,
  623. cobranding_image_visible: !1,
  624. prefetch_initiated: !1,
  625. user_tiles: null,
  626. email_discovery_lookup_xhr: null,
  627. email_discovery_mode: !1,
  628. email_discovery_tiles_mode: !1,
  629. email_discovery_response: null,
  630. email_discovery_timeout_occurred: !1,
  631. email_discovery_splitter_shown: !1,
  632. email_discovery_workflow_state: 0,
  633. email_discovery_easi_user: !1,
  634. email_discovery_use_msa_api: !0,
  635. cred_height: -1,
  636. has_forced_cred_block_height: !1,
  637. original_orientation: window.orientation,
  638. back_action_stack: new MSLogin.BackActionStack,
  639. tenant_branding_tid: null,
  640. tenant_branding_retry_count: 2e3,
  641. tenant_branding_polling_interval: 20,
  642. tenant_branding_ts: 0,
  643. authn_forward_state: 0,
  644. post_from_tile: !1,
  645. on_load_image_background_loaded: !1,
  646. password_reset_link_url: "",
  647. getuserrealmresult: null,
  648. nationalCloudFederated: !1
  649. }, MSLogin.Context.username_state = {
  650. is_empty: !0,
  651. is_partial: !1,
  652. is_timeout: !1,
  653. home_realm_state: 0,
  654. disable_password: !0,
  655. enable_guests: !0,
  656. enable_redirect: !1,
  657. enable_progress_bar: !1,
  658. last_checked_email: ""
  659. }, MSLogin.Context.TenantBranding = {
  660. key: null,
  661. user: null,
  662. prev_key: null,
  663. prev_obj: null,
  664. prev_user: null,
  665. prev_boiler_plate_height: 0,
  666. default_page: !1,
  667. whr_key: null,
  668. applied: !1,
  669. info: null,
  670. info_context: null,
  671. enabled: !1,
  672. has_logo: !1,
  673. has_background_img: !1,
  674. background_color: Constants.DEFAULT_BACKGROUND_COLOR,
  675. footer_height: 0,
  676. footer_height_saved: !1,
  677. cred_height: 0,
  678. cred_height_saved: !1,
  679. workload_branding_saved: !1,
  680. workload_branding_illustration: null,
  681. workload_branding_illustration_alt: null,
  682. workload_branding_logo: null,
  683. workload_branding_logo_alt: null,
  684. workload_branding_footer_height: 0,
  685. workload_branding_footer_height_saved: !1,
  686. workload_branding_color: null,
  687. workload_branding_height: 0,
  688. workload_branding_enabled: !1,
  689. workload_branding_login_cta_text: "",
  690. store: new MSLogin.Store,
  691. username_hint_changed: !1
  692. };
  693. var Context = MSLogin.Context;
  694. MSLogin.Background = {
  695. delayed_background_fetch_url: "",
  696. background_image_ratio: 0,
  697. background_image_loaded: !1,
  698. background_image_wait: null,
  699. winW: -1,
  700. winH: 460,
  701. viewport_height: 460,
  702. alt_image_path: "",
  703. alt_background_path: "",
  704. background_resized: !1
  705. };
  706. var Background = MSLogin.Background;
  707. MSLogin.Logo = {
  708. logo_image_loaded: !1,
  709. logo_image_wait: null,
  710. winW: -1,
  711. winH: 159,
  712. alt_image_path: "",
  713. alt_logo_path: ""
  714. };
  715. var Logo = MSLogin.Logo;
  716. MSLogin.Instrument = {
  717. latency_sensitivity: Constants.LATENCY_SENSITIVITY_DEFAULT,
  718. home_realm_start: null,
  719. home_realm_load_time: 0,
  720. prefetch_done: !1,
  721. prefetch_start: null,
  722. prefetch_load_time: 0,
  723. background_image_loaded: !1,
  724. background_image_start: null,
  725. background_image_load_time: 0,
  726. background_image_error: !1,
  727. logo_image_loaded: !1,
  728. logo_image_start: null,
  729. logo_image_load_time: 0,
  730. logo_image_error: null,
  731. email_discovery_ui_code: 0,
  732. email_discovery_splitter_choice: 0,
  733. possible_easi_user: 0,
  734. tenant_branding_start_time: (new Date).getTime(),
  735. tenant_branding_process_end_time: 0,
  736. tenant_branding_json_end_time: 0,
  737. tenant_branding_load_error: !1,
  738. has_tenant_branding: !1,
  739. has_dynamic_tenant_branding: !1,
  740. tenant_branding_total_time: 0,
  741. tenant_branding_number_of_switches: 0,
  742. tenant_branding_right_side_time: 0,
  743. logo_image_end_time: 0,
  744. background_image_end_time: 0,
  745. document_ready_end_time: 0,
  746. document_load_end_time: 0
  747. };
  748. var Instrument = MSLogin.Instrument;
  749. MSLogin.User = {
  750. UpdateUsernameState: function() {
  751. var e = $("input#cred_userid_inputtext"),
  752. t = $.trim(e.val());
  753. if (e.val(t), Context.username_state.is_empty = !1, Context.username_state.is_partial = !1, t != Context.username_state.last_checked_email && (Context.username_state.home_realm_state = Constants.State.NONE), "" == t && (Context.username_state.is_empty = !0, Context.username_state.is_partial = !0, Context.username_state.is_timeout = !1, Context.username_state.disable_password = !0, Context.username_state.enable_redirect = !1, Context.username_state.home_realm_state = Constants.State.NONE), Support.is_placeholder_supported() || User.togglePlaceHolder(e, Context.username_state.is_empty), !Support.validateUsernameCredInput(t))
  754. if (Constants.IS_MSA_PHONE_USERNAME_SUPPORTED && Constants.REGEX_PHONE.test(t)) Context.username_state.is_empty = !1, Context.username_state.is_partial = !1, Context.username_state.home_realm_state = Constants.State.NONE;
  755. else if (Context.username_state.is_empty = !1, Context.username_state.is_partial = !0, Context.username_state.home_realm_state = Constants.State.NONE, !Constants.IS_NAME_COEXISTENCE_ACCOUNT) {
  756. var n = 30064;
  757. null != t && t.indexOf("\\") > -1 && (n = 30066), Support.showClientError(n)
  758. }
  759. switch (Context.username_state.is_timeout && (Context.username_state.is_timeout = !0, Context.username_state.disable_password = !1, Context.username_state.enable_redirect = !1), Context.username_state.home_realm_state) {
  760. case Constants.State.FEDERATED:
  761. Context.username_state.is_timeout = !1, Context.username_state.disable_password = !0, Context.username_state.enable_redirect = !0;
  762. break;
  763. case Constants.State.MANAGED:
  764. Context.username_state.is_timeout = !1, Context.username_state.disable_password = !1, Context.username_state.enable_redirect = !1;
  765. break;
  766. case Constants.State.INVALID:
  767. Context.username_state.is_timeout = !1, Context.username_state.disable_password = !0, Context.username_state.enable_redirect = !1;
  768. break;
  769. default:
  770. Context.username_state.is_timeout = !1, Context.username_state.disable_password = !0, Context.username_state.enable_redirect = !1
  771. }
  772. $("#home_realm_discovery").val(Context.username_state.home_realm_state)
  773. },
  774. IsGuestUser: function() {
  775. var e = window.location.href;
  776. return null != e && (Context.query_search_params.indexOf("guests=1") > -1 || Context.query_search_params.indexOf("guest=1") > -1) ? !0 : !1
  777. },
  778. UsernameOnChangeHandler: function() {
  779. User.UpdateUsernameState(), $("#recover_container").removeClass("hidden"), $("#recover_container").css("opacity", 1), Context.username_state.enable_redirect ? ($("#cred_password_container").css("opacity", 0), $("#cred_password_container").addClass("hidden"), $("#redirect_message_container").removeClass("no_display"), $("#redirect_message_container").css("opacity", 1), $("#redirect_message_container").removeClass("hidden"), $(".login_guest_container").css("opacity", 0), $("#cred_sign_in_button").css("opacity", 0), $("#cred_sign_in_button").addClass("hidden")) : ($("#cred_password_container").removeClass("hidden"), $("#cred_password_container").css("opacity", 1), $("#redirect_message_container").css("opacity", 0), $("#redirect_message_container").addClass("hidden"), $("#redirect_message_container").addClass("no_display"), $(".login_guest_container").css("opacity", 1), $("#cred_sign_in_button").css("opacity", 1), $("#cred_sign_in_button").removeClass("hidden")), Context.username_state.enable_guests && User.IsGuestUser() ? ($("#guest_hint_text").show(), $("#alternative-identity-providers").hide(), $(".guest_redirect_container").show()) : ($("#guest_hint_text").hide(), $(".guest_redirect_container").hide()), Context.username_state.enable_progress_bar || (clearInterval(Context.animationTid), $("div.progress").css("visibility", "hidden"))
  780. },
  781. setupPrefetching: function() {
  782. Context.prefetch_initiated || Support.is_prefetch_supported() && "" != Constants.PREFETCH_URL && User.latencySensitivity() >= -1 && (Instrument.prefetch_start = Util.now(), Util.PrefetchContent(Constants.PREFETCH_URL), Context.prefetch_initiated = !0)
  783. },
  784. onLoadImage: function() {
  785. var e = $("#background_background_image");
  786. Background.background_image_ratio = Support.isDefined(e) && Support.isDefined(e[0]) && Support.isDefined(e[0].naturalWidth) && Support.isDefined(e[0].naturalHeight) && 0 != e[0].naturalHeight ? e[0].naturalWidth / e[0].naturalHeight : e.width() / e.height(), Background.background_image_loaded = !0, Util.debug_console("OnLoadImage: Called"), Background.background_resized && !Context.on_load_image_background_loaded && User.IsImageLoaded(e) && (Context.on_load_image_background_loaded = !0, TenantBranding.IsShowingDynamicBranding() ? Logo.logo_image_loaded && TenantBranding.onLoadImageHelper() : User.onLoadImageHelper())
  787. },
  788. onLoadImageHelper: function() {
  789. var e = $("#background_background_image");
  790. e.hide(), $("#background_background_image_old").remove(), $("#background_page_overlay").css("visibility", "visible"), e.show();
  791. var t = $("html").css("background-color");
  792. $("#background_page_overlay").css("background-color", t), $("#background_page_overlay").show(), $("#background_page_overlay").fadeOut(500, "linear"), Util.debug_console("OnLoadImage: Background was resized.")
  793. },
  794. updateGuestLink: function() {
  795. var e = $("#guest_redirect_link").attr("href");
  796. "" != e && void 0 != e && (e = User.addFederatedRedirectQSParameters(e), $("#guest_redirect_link").attr("href", e))
  797. },
  798. forceOrientationResize: function() {
  799. Context.original_orientation = -1, User.resize_bg(Context.original_orientation)
  800. },
  801. togglePlaceHolder: function(e, t) {
  802. e.css("background", t ? "transparent" : "#FFFFFF"), e.siblings(".placeholder").css("filter", "alpha(opacity={0})".format(t ? "100" : "0")), e.siblings(".placeholder").css("visibility", t ? "visible" : "hidden")
  803. },
  804. setupCredFieldsWithPlaceHolder: function() {
  805. var e = $("input#cred_userid_inputtext"),
  806. t = $("input#cred_password_inputtext");
  807. Constants.IS_HOLOGRAPHIC ? (e.keypress(function(e) {
  808. User.KeyPressEnter(e, Util.OnNext, 13)
  809. }), t.keypress(function(e) {
  810. User.KeyPressEnter(e, Util.OnNext, 13)
  811. })) : (e.focus(function() {
  812. Context.username_state.enable_redirect && User.CancelRedirect()
  813. }), /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) && e.blur(function() {
  814. User.forceOrientationResize()
  815. }), e.change(function() {
  816. User.RefreshDomainState(), User.UsernameOnChangeHandler()
  817. }), e.keydown(function(e) {
  818. User.KeyPressEnter(e, User.RefreshDomainState, 13), Context.email_discovery_workflow_state != EmailDiscovery.WorkflowStates.INIT && User.KeyPressEnter(e, User.RefreshDomainState, 9)
  819. }), t.keypress(function(e) {
  820. User.KeyPressEnter(e, Post.SubmitCreds, 13)
  821. }), $("input#cred_keep_me_signed_in_checkbox").keypress(function(e) {
  822. User.KeyPressEnter(e, Post.SubmitCreds, 13)
  823. }), $("input#cred_keep_me_signed_in_checkbox").change(function() {
  824. User.updateGuestLink()
  825. }), t.click(function() {
  826. User.UsernameOnChangeHandler(), Context.username_state.is_empty || Context.username_state.is_partial || User.RefreshDomainState()
  827. }), t.blur(function() {
  828. User.forceOrientationResize()
  829. }), Util.debug_console("placeholder supported: " + Support.is_placeholder_supported()), Support.is_placeholder_supported() || ($("input[placeholder]").each(function() {
  830. var e = $(this).attr("placeholder"),
  831. t = $(this).attr("id"),
  832. n = "";
  833. t && (n = 'id="' + t + '_placeholder_span"');
  834. var o = $('<span class="placeholder" ' + n + ">" + e + "</span>").appendTo($(this).parent());
  835. $(this).before(o), o.css("position", "absolute"), o.css("display", "block"), o.addClass("normaltext"), o.click(function() {
  836. $(this).siblings("input").focus()
  837. }), $(this).attr("placeholder", " "), User.togglePlaceHolder($(this), "" == $(this).val())
  838. }), $("input[placeholder]").focus(function() {
  839. User.togglePlaceHolder($(this), "" == $(this).val())
  840. }), $("input[placeholder]").keydown(function() {
  841. User.togglePlaceHolder($(this), !1)
  842. }), $("input[placeholder]").bind("paste", function() {
  843. User.togglePlaceHolder($(this), !1)
  844. }), $("input[placeholder]").keyup(function() {
  845. User.togglePlaceHolder($(this), "" == $(this).val())
  846. }), $("input[placeholder]").blur(function() {
  847. User.togglePlaceHolder($(this), "" == $(this).val())
  848. }), t.parent().click(function() {
  849. User.UsernameOnChangeHandler(), Context.username_state.is_empty || Context.username_state.is_partial || User.RefreshDomainState()
  850. })));
  851. var n = decodeURIComponent(Util.ExtractQSParam("username")),
  852. o = $("#cred_userid_inputtext").val();
  853. if ("" != n) {
  854. var a = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,46})?$/;
  855. a.test(n) && "" == o && $("#cred_userid_inputtext").val(n)
  856. }
  857. $("#redirect_cta_text").hide()
  858. },
  859. setupCallToActionMessages: function() {
  860. $.each(Constants.GENERIC_ERROR_CODES, function(e, t) {
  861. $("#cta_client_error_text").append($("<div/>").addClass("client_error_msg").addClass(t.toString()).html(Constants.TokenizedStringMsgs.GENERIC_ERROR.replace("#~#ErrorCode#~#", t)))
  862. })
  863. },
  864. resize_bg: function(e) {
  865. void 0 != e && (Context.original_orientation = e), document.body && document.body.offsetWidth && (Background.winW = document.body.offsetWidth, Background.winH = document.body.offsetHeight), "CSS1Compat" == document.compatMode && document.documentElement && document.documentElement.offsetWidth && (Background.winW = document.documentElement.offsetWidth, Background.winH = document.documentElement.offsetHeight), window.innerWidth && window.innerHeight && (Background.winW = window.innerWidth, Background.winH = window.innerHeight);
  866. var t = document.documentMode;
  867. if (Support.isDefined(document.documentElement) && Support.isDefined(document.documentElement.clientHeight) && (Background.viewport_height = document.documentElement.clientHeight), $.browser.msie && t >= 10 && (navigator.userAgent.match(/IEMobile/) && Background.viewport_height > 10 ? $("td#login_panel_center").css("height", Background.viewport_height - 10) : $("td#login_panel_center").css("height", Background.winH - 10)), !(!Background.background_image_loaded && null == Background.delayed_background_fetch_url || Background.background_resized && "undefined" != typeof window.orientation && Context.original_orientation == window.orientation || (Context.original_orientation = window.orientation, "1" == Util.ExtractQSParam("popupui")))) {
  868. Support.showIllustration() && null != Background.delayed_background_fetch_url && ($("#background_background_image").error(function() {
  869. Instrument.tenant_branding_load_error = !0
  870. }), User.UpdateBackground(Background.delayed_background_fetch_url, $("html").css("background-color"))), Util.debug_console("resize_bg Background: " + Background.winW + " x " + Background.winH);
  871. var n = Support.getViewport();
  872. if (Util.debug_console("resize_bg Viewport: " + n[0] + " x " + n[1]), Util.debug_console("resize_bg JQuery: " + $("body").width() + " x " + $("body").height()), $("img#background_background_image").error(function() {
  873. $(this).hide()
  874. }), !Background.background_image_loaded || 0 == Background.background_image_ratio) return void Util.debug_console("Background image not yet loaded.");
  875. var o = $(document).width() - 400,
  876. a = $(document).height(),
  877. i = o,
  878. r = Math.round(i / Background.background_image_ratio);
  879. $("#background_background_image").width(i), $("#background_background_image").height(r), a > r && (r = a, i = Math.round(r * Background.background_image_ratio), $("#background_background_image").width(i), $("#background_background_image").height(r)), Background.background_image_loaded && !Background.background_resized && (Util.debug_console("Background image loaded!"), Background.background_resized = !0, User.onLoadImage()), Util.debug_console("bg_image: " + i + " x " + r)
  880. }
  881. },
  882. getElementHeightSpacing: function(e, t) {
  883. var n = 0;
  884. return n += $(e).height(), t && (n += parseInt($(e).css("padding-top"), 10), n += parseInt($(e).css("padding-bottom"), 10)), n
  885. },
  886. getElementHeightMargin: function(e) {
  887. var t = 0;
  888. return t += parseInt($(e).css("margin-top"), 10), t += parseInt($(e).css("margin-bottom"), 10)
  889. },
  890. doesElementExist: function(e) {
  891. return null != $(e).height()
  892. },
  893. moveFooterToBottom: function() {},
  894. latencySensitivity: function() {
  895. var e = Constants.LATENCY_SENSITIVITY_DEFAULT,
  896. t = Util.ExtractQSParam("bandwidth");
  897. switch (t) {
  898. case "low":
  899. e = -1;
  900. break;
  901. case "high":
  902. e = 1;
  903. break;
  904. case "critical":
  905. e = -2
  906. }
  907. return Instrument.latency_sensitivity = e, e
  908. },
  909. updateClientMetricsMode: function() {
  910. switch (Constants.METRICS_MODE) {
  911. case 0:
  912. Constants.SUBMIT_METRICS_ON_REDIRECT = !1, Constants.SUBMIT_METRICS_ON_POST = !1, Constants.INSTRUMENT_PLT = !1;
  913. break;
  914. case 1:
  915. Constants.SUBMIT_METRICS_ON_REDIRECT = !1, Constants.SUBMIT_METRICS_ON_POST = !0, Constants.INSTRUMENT_PLT = !1;
  916. break;
  917. case 2:
  918. Constants.SUBMIT_METRICS_ON_REDIRECT = !0, Constants.SUBMIT_METRICS_ON_POST = !1, Constants.INSTRUMENT_PLT = !1;
  919. break;
  920. case 3:
  921. Constants.SUBMIT_METRICS_ON_REDIRECT = !0, Constants.SUBMIT_METRICS_ON_POST = !0, Constants.INSTRUMENT_PLT = !1;
  922. break;
  923. case 4:
  924. Constants.SUBMIT_METRICS_ON_REDIRECT = !1, Constants.SUBMIT_METRICS_ON_POST = !1, Constants.INSTRUMENT_PLT = !0;
  925. break;
  926. case 5:
  927. Constants.SUBMIT_METRICS_ON_REDIRECT = !1, Constants.SUBMIT_METRICS_ON_POST = !0, Constants.INSTRUMENT_PLT = !0;
  928. break;
  929. case 6:
  930. Constants.SUBMIT_METRICS_ON_REDIRECT = !0, Constants.SUBMIT_METRICS_ON_POST = !1, Constants.INSTRUMENT_PLT = !0;
  931. break;
  932. case 7:
  933. Constants.SUBMIT_METRICS_ON_REDIRECT = !0, Constants.SUBMIT_METRICS_ON_POST = !0, Constants.INSTRUMENT_PLT = !0;
  934. break;
  935. default:
  936. Constants.SUBMIT_METRICS_ON_REDIRECT = !1, Constants.SUBMIT_METRICS_ON_POST = !1
  937. }
  938. },
  939. instrumentPlt: function() {
  940. var e = window.$Config,
  941. t = {
  942. pn: e.pgid || "",
  943. sc: e.scid || 0,
  944. hpg: e.hpgid || 0,
  945. country: e.country,
  946. requestCountry: e.country,
  947. plt: window.performance.timing.loadEventEnd - window.performance.timing.fetchStart,
  948. hostBuildNumber: e.serverDetails.ver.v.join("."),
  949. serverExecutionTime: e.serverDetails.et
  950. },
  951. n = User.getPerformanceData();
  952. n && (t.performanceData = n), window.$Api.Json(e.urls.instr.pageload, t)
  953. },
  954. getPerformanceData: function() {
  955. var e = window.performance,
  956. t = {};
  957. if (!e) return null;
  958. if (e.navigation && (t.navigation = User.getPerformanceObjectData(e.navigation)), e.timing && (t.timing = User.getPerformanceObjectData(e.timing)), e.getEntries) {
  959. var n = e.getEntries();
  960. if (n) {
  961. t.entries = [];
  962. for (var o = 0, a = n.length; a > o; ++o) t.entries.push(User.getPerformanceObjectData(n[o]))
  963. }
  964. }
  965. return t
  966. },
  967. getPerformanceObjectData: function(e) {
  968. var t = {};
  969. if (e.toJSON) return e.toJSON();
  970. for (var n in e) t[n] = e[n];
  971. return t
  972. },
  973. GetHashedImagePath: function(e) {
  974. return e
  975. },
  976. UpdateBackground: function(e, t) {
  977. if ((null == t || "" == t || Constants.IS_CXH_REQUEST) && (t = $("html").css("background-color")), TenantBranding.IsShowingDynamicBranding() ? Context.TenantBranding.background_color = t : ($("#background_page_overlay").css("background-color", t), $("#background_background_image").css("background-color", t), $("#background_branding_container").css("background-color", t), $("html").css("background-color", t)), Background.winW < Constants.MOBILE_WIDTH_THRESHOLD) return Util.debug_console("Screen size too small to fetch background."), void(Background.delayed_background_fetch_url = e);
  978. if ($("#background_background_image").error(function() {
  979. $(this).show(), Context.TenantBranding.has_background_img = !1, TenantBranding.IsShowingDynamicBranding() && Logo.logo_image_loaded && TenantBranding.onLoadImageHelper()
  980. }), User.onLoadImage(), Background.delayed_background_fetch_url = null, !Support.showIllustration() || "" == e || User.latencySensitivity() < 0) Util.debug_console("Image load was cancelled."), $("#background_background_image").css("visibility", "hidden"), $("#background_company_name_text").css("opacity", 0), Context.on_load_image_background_loaded = !0, Background.background_resized = !1, TenantBranding.IsShowingDynamicBranding() && Logo.logo_image_loaded && TenantBranding.onLoadImageHelper(), setTimeout(function() {
  981. User.setupPrefetching()
  982. }, 1e3);
  983. else {
  984. var n = User.GetHashedImagePath(e);
  985. Context.on_load_image_background_loaded = !1, Background.background_resized = !1, Context.TenantBranding.has_background_img = !0, $("img#background_background_image").attr("src", n), $("img#background_background_image").css("visibility", "visible"), $("img#background_background_image").attr("alt", Constants.PARTNER_NAME), $("#background_company_name_text").css("opacity", 0), $("#background_company_name_text").attr("aria-hidden", "true"), Util.debug_console("Set background image: " + e), Instrument.background_image_start = Util.now()
  986. }
  987. Background.background_image_ratio = 0, Util.debug_console("Fetched background image.")
  988. },
  989. UpdateLogo: function(e, t) {
  990. "" == e && $(".login_workload_logo_container").empty(), Logo.logo_image_loaded = !1, $(".workload_img").remove();
  991. var n = User.GetHashedImagePath(e);
  992. if ("" == e) Constants.IS_CXH_REQUEST || $(".login_workload_logo_container").append($("<h1/>").attr("id", "login_workload_logo_text").css("visibility", "visible").addClass("workload_img_text").addClass("gianttext").text(Util.htmlDecode(t))), Context.TenantBranding.has_logo = !1, TenantBranding.IsShowingDynamicBranding() ? TenantBranding.onLoadLogoHelper() : TenantBranding.setUserIdHintAndKmsi(), Util.debug_console("Set logo image failover.");
  993. else if (Constants.IS_HOLOGRAPHIC) {
  994. $("header.body-header img.img-brand").remove(), TenantBranding.IsShowingDynamicBranding() && (Context.TenantBranding.has_logo = !0), Instrument.logo_image_start = Util.now();
  995. var o = $("<img/>").hide().addClass("img-brand").error(TenantBranding.onLoadErrorLogo).attr("id", "login_workload_logo_image").attr("alt", Constants.PARTNER_NAME);
  996. $("header.body-header").append(o), o.load(function() {
  997. Instrument.logo_image_end_time = Util.now(), o.show()
  998. }).attr("src", n)
  999. } else {
  1000. var a = $("<img/>");
  1001. Instrument.logo_image_start = Util.now(), TenantBranding.IsShowingDynamicBranding() ? (Context.TenantBranding.has_logo = !0, a.load(function() {
  1002. TenantBranding.onLoadLogo()
  1003. }), a.hide()) : (a.css("visibility", "visible"), a.load(function() {
  1004. Instrument.logo_image_end_time = Util.now()
  1005. }), TenantBranding.setUserIdHintAndKmsi()), a.error(function() {
  1006. TenantBranding.onLoadErrorLogo()
  1007. }), a.attr("id", "login_workload_logo_image").addClass("workload_img").attr("alt", Constants.PARTNER_NAME), Constants.IS_INCLUSIVEOOBE && a.addClass("microsoft-logo"), $(".login_workload_logo_container").append(a), a = $(".workload_img"), a.attr("src", n), $("#login_workload_logo_text").remove(), Util.debug_console("Set logo image: " + e)
  1008. }
  1009. },
  1010. RefreshDomainState: function() {
  1011. var e = !1,
  1012. t = $.trim($("#cred_userid_inputtext").val());
  1013. return User.UpdateUsernameState(), Support.UpdatePasswordResetLink(), "strongauthcheck.2.0" === $("meta[name=PageID]").attr("content") || "proofup.2.0" === $("meta[name=PageID]").attr("content") || "i5028.2.0" === $("meta[name=PageID]").attr("content") ? !1 : (Context.username_state.is_empty || Context.username_state.is_partial ? e = !1 : (t !== Context.username_state.last_checked_email || Constants.IS_HOLOGRAPHIC) && (e = !0), e ? User.CheckUser() : TenantBranding.RefreshDomainState(t), e)
  1014. },
  1015. CheckUser: function() {
  1016. Constants.IS_NAME_COEXISTENCE_ACCOUNT || (EmailDiscovery.ShouldPerformDiscovery() ? EmailDiscovery.PerformEmailBasedDiscovery() : User.PerformHomeRealmDiscovery())
  1017. },
  1018. PerformHomeRealmDiscovery: function() {
  1019. if (Context.username_state.home_realm_state != Constants.State.PENDING) {
  1020. var e = $.trim($("input#cred_userid_inputtext").val());
  1021. Constants.REGEX_PHONE.test(e) && (e = e.replace(/\D/g, "")), $("div.progress").css("visibility", "visible"), User.startAnimation(), Context.animationTid = setInterval(User.startAnimation, 3500), Context.username_state.enable_progress_bar = !0;
  1022. var t = Constants.Use_Client_Check_Msa_Flag ? Constants.IS_MSA_FED_SUPPORTED : !0;
  1023. Util.SetRoutingCookie(e), $.ajax({
  1024. headers: {
  1025. Accept: "application/json"
  1026. },
  1027. url: Constants.REALM_RESOLVER_URL.upsertQueryStringParam("user", encodeURIComponent(e)),
  1028. dataType: "json",
  1029. data: {
  1030. "api-version": "2.1",
  1031. stsRequest: Constants.CONTEXT,
  1032. checkForMicrosoftAccount: t
  1033. },
  1034. beforeSend: function() {
  1035. Instrument.home_realm_start = Util.now()
  1036. },
  1037. success: User.ReceiveTenantInfo,
  1038. error: User.ReceivedHomeRealmError
  1039. }), Context.username_state.home_realm_state = Constants.State.PENDING, Context.username_state.last_checked_email = e, User.resize_bg()
  1040. }
  1041. },
  1042. showGenericError: function(e) {
  1043. Support.hideClientErrorMessages(), Support.hideClientMessages(), Support.showClientError(e)
  1044. },
  1045. ReceivedHomeRealmError: function(e, t) {
  1046. $("div.progress").css("visibility", "hidden"), $("input#cred_password_inputtext").focus(), Util.debug_console("Received home realm error"), Context.username_state.home_realm_state = Constants.State.NONE, clearInterval(Context.animationTid), Context.username_state.home_realm_state = Constants.State.NONE, User.UsernameOnChangeHandler(), "parsererror" == t && User.showGenericError(ErrorCodes.PARSE_ERROR)
  1047. },
  1048. ReceiveTenantCustom: function(e) {
  1049. tenant_info.background_color = e.BackgroundColor, tenant_info.background_url = e.BackgroundPath, tenant_info.logo_url = e.LogoPath, tenant_info.boilerplate1 = e.BoilerPlate1, tenant_info.boilerplate2 = e.BoilerPlate2, tenant_info.cta1 = e.CTA1, tenant_info.cta2 = e.CTA2, Util.debug_console(e.LogoPath), clearInterval(Context.animationTid), Context.username_state.home_realm_state = Constants.State.MANAGED, User.UsernameOnChangeHandler(), $("#cred_userid_inputtext").blur(), Constants.IS_HOLOGRAPHIC || $("#cred_password_inputtext").focus(), setTimeout(User.resize_bg, 300)
  1050. },
  1051. KeyPressEnter: function(e, t, n, o) {
  1052. var a;
  1053. if (e && e.which ? a = e.which : window.event && (e = window.event, a = e.keyCode), a === n) {
  1054. if (o && o > 0) {
  1055. MSLogin.User.KeyPressEnterHandleOnceDelayTable = MSLogin.User.KeyPressEnterHandleOnceDelayTable || {};
  1056. var i = e.timeStamp;
  1057. if (MSLogin.User.KeyPressEnterHandleOnceDelayTable[n]) {
  1058. var r = MSLogin.User.KeyPressEnterHandleOnceDelayTable[n];
  1059. if (o > i - r) return n;
  1060. MSLogin.User.KeyPressEnterHandleOnceDelayTable[n] = i
  1061. } else MSLogin.User.KeyPressEnterHandleOnceDelayTable[n] = i
  1062. }
  1063. t()
  1064. }
  1065. return a
  1066. },
  1067. StartRedirection: function(e) {
  1068. return Context.redirect_countdown = Constants.REDIRECT_COUNTDOWN_DEFAULT, e && "none" === $("#cred_userid_container").css("display") || void 0 == $("#cred_userid_container").css("display") ? void 0 : (Util.EnableEmailDiscoveryIfEBD(), $("#cred_cancel_button").hide(), Context.username_state.enable_progress_bar = !0, Context.username_state.enable_redirect = !0, Context.username_state.enable_guests = !1, $("#cred_password_container").css("opacity", 0), User.UsernameOnChangeHandler(), Context.redirectTid = setTimeout(function() {
  1069. User.ShowRedirect(), $("a#redirect_cancel_link").focus()
  1070. }, 100), Constants.IS_CXH_REQUEST || Constants.IS_ADAL_REQUEST || $("#cred_sign_in_button").hide(), Context.redirectTid)
  1071. },
  1072. ReceiveTenantInfo: function(e) {
  1073. $(".30065,.30068").is(":visible") && (Support.hideClientError(30065), Support.hideClientError(30068));
  1074. var t = !0,
  1075. n = !1;
  1076. if (Instrument.home_realm_load_time = Util.now() - Instrument.home_realm_start, Context.username_state.enable_progress_bar = !1, Context.username_state.disable_password = !1, Context.username_state.last_checked_email = e.Login, 1 == Constants.IS_MSA_FED_SUPPORTED && Constants.HAS_ERROR !== !0)
  1077. if (0 === e.MicrosoftAccount && e.DomainName !== Context.whr) {
  1078. if (e.NameSpaceType == Constants.NameSpaceType.MANAGED || e.NameSpaceType == Constants.NameSpaceType.CLOUDFEDERATED || e.NameSpaceType == Constants.NameSpaceType.FEDERATED && !Util.isMSA(e.AuthURL)) return Context.getuserrealmresult = e, Context.back_action_stack.AddAction(Constants.CancelAction.FROM_DISAMBIGUATION_SCREEN_TO_LOGIN), void MSLogin.SplitterControl.Render();
  1079. e.NameSpaceType == Constants.NameSpaceType.UNKNOWN && MSLogin.SplitterControl.LoginMSA()
  1080. } else if (void 0 === e.MicrosoftAccount || 2 === e.MicrosoftAccount) return Context.getuserrealmresult = e, Context.back_action_stack.AddAction(Constants.CancelAction.FROM_DISAMBIGUATION_SCREEN_TO_LOGIN), void MSLogin.SplitterControl.Render();
  1081. e.NameSpaceType == Constants.NameSpaceType.FEDERATED || e.NameSpaceType == Constants.NameSpaceType.CLOUDFEDERATED ? e.federation_protocol == Constants.FederationProtocol.Saml20 && null != e.federation_saml_request ? t = MSLogin.User.PostToSamlIdp(e) : 0 !== e.MicrosoftAccount && Util.isMSA(e.AuthURL) ? (clearInterval(Context.animationTid), $("div.progress").css("visibility", "hidden"), t = Support.showUsernameOrDomainError(Util.htmlEncode(e.Login)), n = !0, Context.username_state.home_realm_state = Constants.State.INVALID) : (Context.back_action_stack.AddAction(MSLogin.Constants.CancelAction.FROM_REDIRECT_TO_LOGIN), t = MSLogin.User.ReceiveFederatedDomain(e)) : e.NameSpaceType == Constants.NameSpaceType.MANAGED ? t = MSLogin.User.ReceiveManagedDomain(e) : e.NameSpaceType == Constants.NameSpaceType.UNKNOWN && 0 !== e.MicrosoftAccount ? (clearInterval(Context.animationTid), $("div.progress").css("visibility", "hidden"), t = Support.showUsernameOrDomainError(Util.htmlEncode(e.Login)), n = !0, Context.username_state.home_realm_state = Constants.State.INVALID) : t = MSLogin.User.ReceiveUnknownDomain(e), Constants.IS_HOLOGRAPHIC ? (!t || n) && Util.OnBack() : t && ($("#cred_userid_inputtext").blur(), $("#cred_password_inputtext").focus())
  1082. },
  1083. ReceiveUnknownDomain: function(e) {
  1084. if (1 == e.State && !e.FederationGlobalVersion) return Context.username_state.home_realm_state = Constants.State.INVALID, User.UsernameOnChangeHandler(), Util.debug_console("federationGlobalVersion bad"), $("#cred_password_inputtext").blur(), $("#cred_userid_inputtext").focus(), !1;
  1085. var t = !Support.showUsernameOrDomainError(Util.htmlEncode(e.Login));
  1086. return Context.username_state.home_realm_state = Constants.State.INVALID, clearInterval(Context.animationTid), Constants.IS_HOLOGRAPHIC || User.UsernameOnChangeHandler(), Util.debug_console("Unknown home realm reply"), $("input#cred_password_inputtext").focus(), t
  1087. },
  1088. ReceiveFederatedDomain: function(e) {
  1089. var t = e.NameSpaceType == Constants.NameSpaceType.CLOUDFEDERATED;
  1090. return Context.username_state.home_realm_state = Constants.State.FEDERATED, tenant_info.company_name = "", tenant_info.domain = e.DomainName, Context.authn_forward_state = e.AuthNForwardType, e.DomainName.areEqualIgnoreCase(Constants.MSA_DOMAIN) && !Constants.IS_MSA_FED_SUPPORTED ? ($(".pip").stop(!0, !0), $(".pip").hide(), clearInterval(Context.animationTid), Context.username_state.enable_redirect = !1, Context.username_state.home_realm_state = Constants.State.INVALID, Context.back_action_stack.RemoveLastCancelAction(), Support.showClientError(30065), !1) : e.DomainName != Context.whr || User.IsGuestUser() ? (Context.federated_domain = e.DomainName, Context.nationalCloudFederated = t, Context.redirect_auth_url = t ? e.CrossCloudAuthUrl : e.AuthURL, e.TenantBrandingInfo && e.TenantBrandingInfo.length && (TenantBranding.StoreBrandingInfo(e.DomainName, e.TenantBrandingInfo), TenantBranding.getTenantBrandingContext(e.TenantBrandingInfo, Constants.LCID).KeepMeSignedInDisabled && ($("#cred_kmsi_container").hide(), $("#cred_keep_me_signed_in_checkbox").attr("checked", !1))), $("#cred_keep_me_signed_in_checkbox").is(":visible") && e.CheckKmsiByDefault && $("#cred_keep_me_signed_in_checkbox").attr("checked", "checked"), Util.updateRedirectionMessage(Context.redirect_auth_url, t), e.federation_protocol == Constants.FederationProtocol.Saml20 && null != e.federation_saml_request ? (MSLogin.User.PostToSamlIdp(e), !1) : (1 == e.FederationGlobalVersion && User.Redirect(User.addFederatedRedirectQSParameters(e.AuthURL)), User.StartRedirection(!1), !1)) : (Context.username_state.home_realm_state = Constants.State.MANAGED, Util.debug_console("whr set already"), User.UsernameOnChangeHandler(), $("#cred_userid_inputtext").blur(), $("#cred_password_inputtext").focus(), Context.back_action_stack.RemoveLastCancelAction(), !1)
  1091. },
  1092. ReceiveManagedDomain: function(e) {
  1093. return Context.whr = void 0 != e.DomainName ? e.DomainName : e.Login.split("@@")[1], null != e.TenantBrandingInfo && TenantBranding.StoreBrandingInfo(e.DomainName, e.TenantBrandingInfo), TenantBranding.PerformDynamicBranding(e.DomainName), Context.TenantBranding.user = e.Login, Context.username_state.home_realm_state = Constants.State.MANAGED, tenant_info.company_name = e.FederationBrandName, tenant_info.domain = e.DomainName, tenant_info.BackgroundColor = $("#background_branding_container").css("background"), tenant_info.BackgroundPath = $("#background_background_image").attr("src"), tenant_info.LogoPath = $("#login_workload_logo_image").attr("src"), tenant_info.BoilerPlate1 = "", tenant_info.BoilerPlate2 = "", tenant_info.CTA1 = $("#login_cta_text").text(), tenant_info.CTA2 = "", tenant_info.HadBoilerPlate = !1, Context.username_state.disable_password = !1, Context.username_state.enable_progress_bar = !1, Context.username_state.enable_redirect = !1, User.UsernameOnChangeHandler(), User.TriggerUserDomainHintChanged(e), $("#cred_keep_me_signed_in_checkbox").is(":visible") && e.CheckKmsiByDefault && $("#cred_keep_me_signed_in_checkbox").attr("checked", "checked"), !0
  1094. },
  1095. PostToSamlIdp: function(e) {
  1096. if (Context.federated_domain = e.DomainName, Context.redirect_auth_url = e.AuthURL, $("#samlform").attr("action", e.AuthURL), $("#samlrequest").val(decodeURIComponent(e.federation_saml_request)), null != e.federation_saml_request) $("#samlrelaystate").val(decodeURIComponent(e.federation_saml_relay_state));
  1097. else {
  1098. var t = Constants.FEDERATION_QUERY_PARAMETERS.qs("wctx");
  1099. $("#samlrelaystate").val(decodeURIComponent(t))
  1100. }
  1101. $("#samlform").submit()
  1102. },
  1103. Redirect: function(e) {
  1104. window.location.assign(e)
  1105. },
  1106. GetRedirectAction: function(e, t, n, o) {
  1107. var a;
  1108. return Constants.IS_MSA_REDIR_SUPPORTED ? (o && ("FormPost" === Constants.responseMode ? n.username = o : t = Util.appendQueryString(t, "username=" + encodeURIComponent(o))), a = User.GetRedirectWithOAuthResponseMode(Constants.responseMode, t, n)) : (o && (e = Util.appendQueryString(e, "username=" + encodeURIComponent(o))), a = function() {
  1109. window.location.assign(e)
  1110. }), a
  1111. },
  1112. GetRedirectWithOAuthResponseMode: function(e, t, n) {
  1113. var o;
  1114. return o = "FormPost" === e ? function() {
  1115. var e = $("<form />", {
  1116. method: "post",
  1117. action: t
  1118. });
  1119. e.append($.map(n, function(e, t) {
  1120. return $("<input>", {
  1121. type: "hidden",
  1122. name: t,
  1123. value: e
  1124. })
  1125. })), $("body").append(e), e.submit()
  1126. } : function() {
  1127. window.location.assign(t)
  1128. }
  1129. },
  1130. ShowRedirect: function() {
  1131. $("#signin_legend,#boilerplate_container,#body_header,#page_footer,#footer_content").hide(), $(".control-page").addClass("page_centered");
  1132. var e;
  1133. if (e = Constants.IS_MSA_REDIR_SUPPORTED && Util.isMSA(Context.redirect_auth_url) ? User.GetRedirectAction(null, Constants.appRedirectUrl, Constants.msaRedirErrorParams, User.getUsernameFromPage()) : Context.nationalCloudFederated ? Context.redirect_auth_url : User.addFederatedRedirectQSParameters(Context.redirect_auth_url), Constants.SUBMIT_METRICS_ON_REDIRECT && !Context.metrics_on_redirect_submitted && (Post.SubmitInstrumentation(), Context.metrics_on_redirect_submitted = !0), Context.username_state.enable_guests = !1, User.UsernameOnChangeHandler(), 0 == Context.redirect_countdown) return MSLogin.Util.LogCxhTelemetry("AADLoginPageFederationRedirect"), Constants.FLOW_TOKEN.length > 0 && Util.setCookieWithExpiration(Constants.FLOW_TOKEN_COOKIE_NAME, Constants.FLOW_TOKEN), void("function" == typeof e ? e() : User.Redirect(e));
  1134. 1 == Context.redirect_countdown && $("#background_page_overlay").css("z-index", 0), $("#cred_userid_container,#cred_password_container,.login_cta_container,#recover_container,input#cred_password_inputtext").hide(), $("#redirect_cta_text").show(), $("#redirect_company_name_text").empty();
  1135. var t = $("#redirect_message_container");
  1136. if (t.length > 0) {
  1137. var n = t.show().css("visibility", "visible").css("opacity", 1)[0];
  1138. n && n.removeAttribute("aria-hidden")
  1139. }
  1140. $("#windows_redirect_message_container").show(), $("#progress_text").focus(), Context.redirect_countdown = Context.redirect_countdown - 1, Context.redirectTid = setTimeout(function() {
  1141. User.ShowRedirect()
  1142. }, 1e3), Util.debug_console("Redirecting in " + Context.redirect_countdown)
  1143. },
  1144. CancelRedirect: function() {
  1145. clearTimeout(Context.redirectTid), User.tryShowCancelButton(), $("#cred_kmsi_container").show(), $("#cred_userid_container").show(), $("#cred_password_container").show(), $(".login_cta_container").show(), $("#credentials .login_cta_container").hide(), $("#recover_container").show(), $("#redirect_cta_text").hide(), $("#cred_password_container").css("opacity", 1), $("input#cred_password_inputtext").css("display", "inline-block"), $("#redirect_message_container").hide(), $("input#cred_password_inputtext").blur(), $("#redirect_company_name_text").empty(), Context.username_state.home_realm_state == Constants.State.FEDERATED && (Context.username_state.home_realm_state = Constants.State.NONE), Context.email_discovery_workflow_state = EmailDiscovery.WorkflowStates.NONE, Context.username_state.disable_password = !0, Context.username_state.enable_progress_bar = !1, Context.username_state.enable_redirect = !1, Context.username_state.enable_guests = !0, User.UsernameOnChangeHandler(), $("input#cred_userid_inputtext").focus()
  1146. },
  1147. startAnimation: function(e) {
  1148. var t = 100,
  1149. n = $(".login_footer_container").outerWidth();
  1150. e && (n = e.outerWidth()), $(".pip").stop(!0, !0), $(".pip").each(function() {
  1151. User.animatePip($(this), t, n), t += 100
  1152. })
  1153. },
  1154. animatePip: function(e, t, n) {
  1155. var o = n / 3,
  1156. a = n - 3;
  1157. "ltr" == Constants.DIR ? e.css("left", 0).hide().delay(t).show().animate({
  1158. left: o
  1159. }, {
  1160. duration: 1e3,
  1161. easing: "easeOutSine"
  1162. }).animate({
  1163. left: a
  1164. }, {
  1165. duration: 999,
  1166. easing: "easeInSine"
  1167. }) : e.css("right", 0).hide().delay(t).show().animate({
  1168. right: o
  1169. }, {
  1170. duration: 1e3,
  1171. easing: "easeOutSine"
  1172. }).animate({
  1173. right: a
  1174. }, {
  1175. duration: 999,
  1176. easing: "easeInSine"
  1177. })
  1178. },
  1179. addFederatedRedirectQSParameters: function(e) {
  1180. var t = e;
  1181. if (Util.isMSA(e)) {
  1182. e = Constants.MSA_AUTH_URL;
  1183. var n = decodeURIComponent(Util.ExtractQSParam("pcexp")),
  1184. o = decodeURIComponent(Util.ExtractQSParam("display"));
  1185. o.areEqualIgnoreCase("popup") && (n = !1), Background.winW < Constants.MOBILE_WIDTH_THRESHOLD && (n = !1), e.indexOf("pcexp") < 0 ? e += "&pcexp=" + encodeURIComponent(n) : Constants.IS_CXH_REQUEST || (e = e.replace(/pcexp=[^&]*/i, "pcexp=" + encodeURIComponent(n)));
  1186. var a = decodeURIComponent(Util.ExtractQSParam("vv"));
  1187. a && (e.indexOf("vv") < 0 ? e += "&vv=" + encodeURIComponent(a) : e = e.replace(/vv=[^&]*/i, "vv=" + encodeURIComponent(a))), e.indexOf("username") < 0 && (e = User.addUsernameQsParam(e))
  1188. }
  1189. User.resize_bg();
  1190. var i = decodeURIComponent(Util.ExtractQSParam("popupui"));
  1191. (Constants.IS_ADAL_REQUEST || Background.winW < Constants.MOBILE_WIDTH_THRESHOLD) && (i = 1), e.indexOf("popupui") < 0 ? e += "&popupui=" + encodeURIComponent(i) : e = e.replace(/popupui=[^&]*/i, "popupui=" + encodeURIComponent(i)), e = e.replace(/guests%3D1/i, "");
  1192. var r = t.qs("LoginOptions");
  1193. if ("" == r && (r = $("#cred_keep_me_signed_in_checkbox").attr("checked") ? "1" : ""), "" !== r) {
  1194. var s = e.qs("wreply");
  1195. "" != s ? (s += (s.indexOf("%3f") >= 0 ? "%26" : "%3f") + "LoginOptions%3d" + r, e = e.qs("wreply", s)) : (s = e.qs("wctx"), "" != s && (s += "%26LoginOptions%3d" + r, e = e.qs("wctx", s))), e = e.qs("LoginOptions", r)
  1196. }
  1197. return e
  1198. },
  1199. RegisterOnLoadImage: function() {
  1200. $("#background_background_image").load(function() {
  1201. void 0 != this.width && (Background.background_image_loaded = !0), User.onLoadImage(), 0 == Instrument.background_image_end_time && (Instrument.background_image_end_time = Util.now()), Instrument.background_image_load_time = Util.now() - Instrument.background_image_start, Instrument.background_image_loaded = !0, setTimeout(function() {
  1202. User.setupPrefetching()
  1203. }, 1e3), User.resize_bg()
  1204. }).error(function() {
  1205. $("#background_background_image").hide(), Instrument.background_image_loaded = !1, Instrument.background_image_load_time = Util.now() - Instrument.background_image_start, Instrument.background_image_error = !0, 0 == Instrument.background_image_end_time && (Instrument.background_image_end_time = Util.now())
  1206. })
  1207. },
  1208. IsImageLoaded: function(e) {
  1209. if (void 0 == e || null == e || void 0 == e[0] || null == e[0] || void 0 == e[0].complete || null == e[0].complete) return !1;
  1210. var t = e[0],
  1211. n = document.documentMode;
  1212. return t.complete || $.browser.msie && 8 >= n ? "undefined" != typeof t.naturalWidth && 0 == t.naturalWidth ? !1 : "undefined" != typeof t.naturalHeight && 0 == t.naturalHeight ? !1 : !0 : !1
  1213. },
  1214. isChxOrAdalOverride: function() {
  1215. return Constants.IS_CXH_REQUEST || Constants.IS_ADAL_REQUEST && Constants.ADAL_UX_OVERRIDE
  1216. },
  1217. getUsernameFromPage: function() {
  1218. var e = decodeURIComponent(Util.ExtractQSParam("username")),
  1219. t = $("#cred_userid_inputtext").val();
  1220. return t ? t : e ? e : ""
  1221. },
  1222. addUsernameQsParam: function(e) {
  1223. var t = User.getUsernameFromPage();
  1224. return t && (e = Util.appendQueryString(e, "username=" + encodeURIComponent(t))), e
  1225. },
  1226. shouldShowCancelButton: function() {
  1227. var e = ("FRX" === Constants.CxhFlow || "MOSET" === Constants.CxhFlow) && !Constants.IS_HOLOGRAPHIC,
  1228. t = Constants.IS_ADAL_REQUEST && !Constants.ADAL_UX_OVERRIDE,
  1229. n = Context.back_action_stack.DoesCancelActionExist(),
  1230. o = Tiles.users && Tiles.users.length && "other" !== Tiles.users[0].link && Constants.IS_USE_OTHER_ACCOUNT_VISIBLE;
  1231. return e || t || n || o
  1232. },
  1233. tryShowCancelButton: function() {
  1234. User.shouldShowCancelButton() ? $("#cred_cancel_button").show() : $("#cred_cancel_button").hide()
  1235. },
  1236. RegisterOnUserDomainHintChanged: function(e) {
  1237. $(document).on(Constants.USER_DOMAIN_HINT_CHANGED_EVENT_NAME, e)
  1238. },
  1239. TriggerUserDomainHintChanged: function(e) {
  1240. $(document).trigger(Constants.USER_DOMAIN_HINT_CHANGED_EVENT_NAME, [e])
  1241. }
  1242. };
  1243. var User = MSLogin.User;
  1244. $Do && $Do.when("jQuery", function() {
  1245. $Do.register("User", 0, !0)
  1246. }), MSLogin.SplitterControl = {
  1247. Template: '<a id="{1}_link" href="#" onclick="{0}(); return false;" tabindex="1" class="tile_link tooltip"> <table id="{1}" class="user_tile"> <tbody> <tr class="{1}" style="cursor: pointer"> <td> <img class="ad_glyph {1}" src="{2}" alt="{3}"> </td> <td class="tile_name"> <div class="bigtext tile_primary_name windows_tile_text wrap {1}" style="cursor: pointer">{3}</div> <div class="smallertext tile_secondary_name windows_tile_text text-caption2 {1}" style="cursor: pointer">{4}</div> <div class="smallertext tile_third_name windows_tile_text text-caption2 {1}" style="cursor: pointer">{5}</div> </td> </tr> </tbody> </table></a>',
  1248. Render: function() {
  1249. if (Constants.MEMBER_NAME === Context.username_state.last_checked_email && $(".view-error-details-container:visible").length) return $("div.progress").css("visibility", "hidden"), Context.username_state.home_realm_state == Constants.State.PENDING && (Context.username_state.home_realm_state = Constants.State.MANAGED), void $("#cred_password_inputtext").focus();
  1250. if ($(".login_cred_field_container").hide(), $(".login_cred_container .windows_cred_block").hide(), $(".login_cred_options_container").hide(), $(".login_user_chooser").hide(), $("#cta_error_message_text").hide(), User.tryShowCancelButton(), $(".login_cred_options_container").show(), $("#cred_sign_in_button").hide(), $("#recover_container").hide(), $("#alternative-identity-providers").hide(), $("#cred_kmsi_container").hide(), 0 != Context.getuserrealmresult.MicrosoftAccount || Context.getuserrealmresult.NameSpaceType != Constants.NameSpaceType.MANAGED && Context.getuserrealmresult.NameSpaceType != Constants.NameSpaceType.CLOUDFEDERATED && (Context.getuserrealmresult.NameSpaceType != Constants.NameSpaceType.FEDERATED || Util.isMSA(Context.getuserrealmresult.AuthURL))) Support.showClientMessage(30140);
  1251. else {
  1252. var e = $("input#cred_userid_inputtext").val().toLowerCase();
  1253. e = $.trim(e);
  1254. var t = Constants.TokenizedStringMsgs.UPN_DISAMBIGUATE_MESSAGE.replace("{0}", e);
  1255. $("#upn_needs_disambiguation_text").text(t), Support.showClientMessage(30139)
  1256. }
  1257. $("#splitter-tiles-container").empty(), $.each(Constants.SplitterControlData, function(e, t) {
  1258. var n = MSLogin.SplitterControl.Template.format(t.link, t.id, t.image, t.name, t.login, MSLogin.Util.htmlEncode(Context.username_state.last_checked_email));
  1259. $("#splitter-tiles-container").append(n)
  1260. }), $("#login-splitter-control").show(), $("#disambig-container").show()
  1261. },
  1262. LoginAAD: function() {
  1263. Context.username_state.home_realm_state = Constants.State.MANAGED, $(".login_cred_options_container").show(), $("#cred_sign_in_button").show(), User.tryShowCancelButton(), $("#recover_container").show(), $("#alternative-identity-providers").show(), $("#cred_kmsi_container").show(), $("#login-splitter-control").hide(), $("#disambig-container").hide(), $(".login_cred_field_container").show(), $(".login_cred_options_container").show(), $(".login_cred_container .windows_cred_block").show(), Support.hideClientErrorMessages(), Support.hideClientMessages();
  1264. var e = Context.getuserrealmresult;
  1265. null != e && (e.NameSpaceType == Constants.NameSpaceType.FEDERATED || e.NameSpaceType == Constants.NameSpaceType.CLOUDFEDERATED ? (Context.back_action_stack.AddAction(MSLogin.Constants.CancelAction.FROM_REDIRECT_TO_DISAMBIGUATION_SCREEN), User.ReceiveFederatedDomain(e)) : (Context.back_action_stack.AddAction(MSLogin.Constants.CancelAction.FROM_LOGIN_TO_DISAMBIGUATION_SCREEN), User.ReceiveManagedDomain(e))), Support.showClientMessage(1), $("#cred_userid_container").show(), $("div.progress").css("visibility", "hidden"), $("#cred_password_inputtext").focus()
  1266. },
  1267. LoginMSA: function() {
  1268. Context.username_state.home_realm_state = Constants.State.FEDERATED, $("#login-splitter-control").hide(), $("#disambig-container").hide(), $(".login_cred_field_container").show(), $(".login_cred_options_container").show(), Support.hideClientErrorMessages(), Support.hideClientMessages();
  1269. var e = {
  1270. DomainName: Constants.MSA_DOMAIN,
  1271. AuthURL: Constants.MSA_AUTH_URL
  1272. };
  1273. Context.back_action_stack.AddAction(MSLogin.Constants.CancelAction.FROM_REDIRECT_TO_DISAMBIGUATION_SCREEN), User.ReceiveFederatedDomain(e)
  1274. }
  1275. };
  1276. var tenant_info = {
  1277. company_name: "",
  1278. cta1: "",
  1279. cta2: "",
  1280. boilerplate1: "",
  1281. boilerplate2: "",
  1282. background_url: "",
  1283. background_color: "",
  1284. logo_url: "",
  1285. domain: "",
  1286. lang: ""
  1287. };
  1288. $Do.when(["doc.ready", "User"], function() {
  1289. if ($(".no_display").each(function(e, t) {
  1290. t.setAttribute("aria-hidden", "true")
  1291. }), $(".hidden").each(function(e, t) {
  1292. t.setAttribute("aria-hidden", "true")
  1293. }), $(".login_inner_container.no_display").removeClass("no_display"), $("#background_background_image").css("width", "auto"), $("#background_background_image").css("height", "auto"), User.RegisterOnLoadImage(), $.browser.msie && "8" == $.browser.version.slice(0, 1) ? document.body.onresize = function() {
  1294. User.resize_bg()
  1295. } : $(window).resize(function() {
  1296. User.resize_bg()
  1297. }), void 0 != $("#cred_userid_inputtext").val() && User.setupCredFieldsWithPlaceHolder(), Context.whr = decodeURIComponent(Util.ExtractQSParam("whr")), User.updateGuestLink(), $("#redirect_cancel_link").on("click", function(e) {
  1298. e.preventDefault(), Context.back_action_stack.TriggerCancelAction()
  1299. }), $("#login_panel").show(), $("#login_no_script_panel").hide(), $(".login_cred_container").append($("<input/>").attr("id", "home_realm_discovery").attr("type", "hidden").val(Context.username_state.home_realm_state)), Constants.IS_HOLOGRAPHIC) $("div.progress").css("visibility", "hidden");
  1300. else {
  1301. var e = $("#cred_sign_in_button"),
  1302. t = $("#cred_cancel_button");
  1303. if (e.click(Post.SubmitCreds), e.keydown(function(e) {
  1304. User.KeyPressEnter(e, Post.SubmitCreds, 13)
  1305. }), $(".refresh_domain_state").click(function() {
  1306. User.RefreshDomainState()
  1307. }), $("input[type=checkbox]").click(function() {
  1308. User.RefreshDomainState()
  1309. }), Constants.IS_INCLUSIVEOOBE && Util.SetCxhOnBackAction(Util.CancelCxhFlow), t.click(function() {
  1310. Context.back_action_stack.DoesCancelActionExist() ? Context.back_action_stack.TriggerCancelAction() : Constants.IS_CXH_REQUEST ? Util.CancelCxhFlow() : Constants.IS_ADAL_REQUEST && User.GetRedirectWithOAuthResponseMode(Constants.responseMode, Constants.CANCEL_REDIRECT_URL, Constants.cancelErrorParams)()
  1311. }), "i5030.2.0" === $("meta[name=PageID]").attr("content") && Constants.showOptInBanner) {
  1312. var n = $("#optInUserBanner");
  1313. $("#uxOptInLink").on("click", function(e) {
  1314. e.preventDefault(), $.ajax({
  1315. url: Constants.uxPreviewOptInUrl,
  1316. type: "GET",
  1317. timeout: 1e4,
  1318. cache: !1
  1319. }).done(function() {
  1320. document.location.replace(Constants.refreshUrl)
  1321. })
  1322. }), $("#bannerCloseLink").on("click", function(e) {
  1323. e.preventDefault(), n.css("visibility", "hidden")
  1324. }), n.css("visibility", "visible")
  1325. }
  1326. if ("KmsiInterrupt.2.0" === $("meta[name=PageID]").attr("content")) {
  1327. var o = $("#accept_kmsi"),
  1328. a = $("#decline_kmsi"),
  1329. i = document.getElementById("kmsi_fields");
  1330. o.focus();
  1331. var r = function() {
  1332. var e = document.getElementById("loginOptions");
  1333. e.value = 1, i.submit()
  1334. },
  1335. s = function() {
  1336. i.submit()
  1337. };
  1338. o.click(r), a.click(s)
  1339. }
  1340. }
  1341. $("#background_company_name_text").text(Constants.PARTNER_NAME), Constants.FEDERATION_QUERY_PARAMETERS = Constants.FEDERATION_QUERY_PARAMETERS.replace(/&username(=[^&]*)?|^username(=[^&]*)?&?/, ""), Support.renderBrowserSpecific(), Support.UpdatePasswordResetLink(), Constants.isChinaDC || ($("#footer_link_terms").click(function(e) {
  1342. MSLogin.Support.LegalActionLink(e, "tou")
  1343. }), $("#footer_link_privacy").click(function(e) {
  1344. MSLogin.Support.LegalActionLink(e, "privacy")
  1345. }), $("#legal-back-btn").click(function() {
  1346. $("#legal-section").hide(), $(".login_panel_layout").show()
  1347. })), Constants.IS_CXH_REQUEST && ($.ajax({
  1348. url: Constants.footerPrivacyUrl,
  1349. data: {
  1350. IsAjax: !0
  1351. },
  1352. success: function(e) {
  1353. $("#windows-privacy-content, #holo-privacy-content").text(e)
  1354. }
  1355. }), Constants.IS_HOLOGRAPHIC || $("#footer_link_privacy_windows").click(function(e) {
  1356. e.preventDefault();
  1357. var t = $("#footer_link_privacy_windows")[0],
  1358. n = $("#flyoutPrivacyStatement")[0];
  1359. if (n) {
  1360. var o = $(".body-container")[0].getBoundingClientRect().top + (window.pageYOffset || document.documentElement.scrollTop || 0);
  1361. n.style.marginTop = o + "px", n.winControl.show(t, "top", "left")
  1362. }
  1363. }));
  1364. var d = User.GetRedirectAction(Constants.msaSignupUrl, Constants.msaSignupUrl, Constants.msaRedirSignupErrorParams);
  1365. $("#idp-signup-link, #create_msa_account_link, #user-not-found-link-ebd").click(function(e) {
  1366. e.preventDefault(), d()
  1367. }), Constants.IS_ADAL_REQUEST && $("#account_not_found_title_text p").toggleClass("no_display"), Constants.desktopSsoConfig && $Do.when("Proxy.DesktopSso", function() {
  1368. proxy.DesktopSso.Initialize(Constants.desktopSsoConfig)
  1369. }), Instrument.document_ready_end_time = Util.now()
  1370. }), $Do.when("doc.load", function() {
  1371. if (Support.renderBrowserSpecific(), User.updateClientMetricsMode(), $("#cred_keep_me_signed_in_checkbox").removeAttr("checked"), !Constants.IS_HOLOGRAPHIC && !Constants.SSPR && !Constants.StrongAuth) {
  1372. var e = $("input#cred_userid_inputtext");
  1373. e.length && -1 !== e.val().indexOf("@") ? EmailDiscovery.ShouldPerformDiscovery() ? ($("#cred_continue_button").focus(), $("#redirect_message_container").hide(), $("#alternative-identity-providers").hide()) : (Context.username_state.home_realm_state = Constants.State.MANAGED, User.UsernameOnChangeHandler(), Util.debug_console("startup"), (Constants.IS_CXH_REQUEST && !Constants.IS_MOBILE || !Constants.IS_CXH_REQUEST) && e.focus()) : (User.UsernameOnChangeHandler(), (Constants.IS_CXH_REQUEST && !Constants.IS_MOBILE || !Constants.IS_CXH_REQUEST) && e.focus()), Constants.userRealmInfo && Constants.userRealmInfo.IsMicrosoftAccountSet && 1 !== Constants.userRealmInfo.MicrosoftAccount && (Context.getuserrealmresult = Constants.userRealmInfo, Context.back_action_stack.AddAction(Constants.CancelAction.FROM_DISAMBIGUATION_SCREEN_TO_LOGIN), Context.username_state.last_checked_email = Constants.MEMBER_NAME, MSLogin.SplitterControl.Render())
  1374. }
  1375. if (Util.EnableEmailDiscoveryIfEBD(), "1" == Util.ExtractQSParam("popupui")) {
  1376. try {
  1377. var t = $("meta[name=viewport]");
  1378. t.attr("content", "width=300, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, height=device-height")
  1379. } catch (n) {}
  1380. $("html").css("background-color", "#FFFFFF"), $("body").css("background-color", "#FFFFFF"), $("#background_branding_container").css("background-color", "#FFFFFF")
  1381. }
  1382. window.performance && window.performance.timing && Constants.INSTRUMENT_PLT && setTimeout(User.instrumentPlt, 0), Constants.onPremPasswordValidationConfig && Constants.onPremPasswordValidationConfig.isPollingRequired ? $Do.when("Proxy.MSOnPremPasswordValidation", window.proxy.MSOnPremPasswordValidation.startPolling) : Constants.onPremPasswordValidationConfig && Constants.onPremPasswordValidationConfig.isUserRealmPrecheckEnabled && $Do.when("Proxy.MSOnPremPasswordValidation", window.proxy.MSOnPremPasswordValidation.registerUserRealmDiscoveryListeners), Instrument.document_load_end_time = Util.now()
  1383. }), $Do.when("jQuery", function() {
  1384. $Do.register("MSLogin", 0, !0)
  1385. }),
  1386. function() {
  1387. var e = window,
  1388. t = e.MSLogin,
  1389. n = e.EmailDiscovery = t.EmailDiscovery = {
  1390. Strings: {},
  1391. WorkflowStates: {
  1392. NONE: 0,
  1393. INIT: 1,
  1394. LOOKING: 2,
  1395. SPLITTER: 3,
  1396. MSA: 4,
  1397. AAD: 5
  1398. },
  1399. is_enabled_workflow: !1,
  1400. IsDiscoveryPage: function() {
  1401. return n.is_enabled_workflow
  1402. },
  1403. ShouldPerformDiscovery: function() {
  1404. return Context.email_discovery_mode
  1405. },
  1406. IsTilesModeActivated: function() {
  1407. return Context.email_discovery_tiles_mode
  1408. },
  1409. Init: function() {
  1410. Context.email_discovery_mode = !0, n.ShouldPerformDiscovery() && (n.is_enabled_workflow = !0), $("#cred_sign_in_button").hide(), $("#cred_cancel_button").hide(), $("#cred_kmsi_container").hide(), $("#recover_container").hide(), $("#cred_password_container").hide(), $("#login_cta_text").hide(), $("#login_user_chooser").hide(), $("#forget_tile_container").hide(), $("#guest_hint_text").hide(), $(".guest_redirect_container").hide(), $(".login_cta_container").show(), $(".login_cred_options_container").addClass("email_discovery"), $("#cred_keep_me_signed_in_checkbox").removeAttr("checked"), $("#looking_container").hide(), $("div.progress").css("visibility", "hidden"), Context.username_state.last_checked_email = Context.username_state.last_checked_email || "", Context.username_state.home_realm_state = Constants.State.NONE, Context.email_discovery_workflow_state = n.WorkflowStates.NONE;
  1411. var e = decodeURIComponent(Util.ExtractQSParam("username")),
  1412. t = $("#cred_userid_inputtext").val();
  1413. n.IsTilesModeActivated() && e !== t && ($("input#cred_userid_inputtext").val(""), $("input#cred_userid_inputtext").focus()), n.HideSplitter(), n.ShowEmailDiscovery()
  1414. },
  1415. Initialize: function() {
  1416. $("input#cred_userid_inputtext").keydown(function(e) {
  1417. n.ShouldPerformDiscovery() && User.KeyPressEnter(e, function() {
  1418. e.preventDefault(), n.ValidateUserInput()
  1419. }, 13)
  1420. }), $("#cred_continue_button").keydown(function(e) {
  1421. n.ShouldPerformDiscovery() && User.KeyPressEnter(e, function() {
  1422. e.preventDefault(), n.ValidateUserInput(), User.RefreshDomainState()
  1423. }, 13)
  1424. }), $("#cred_try_again_button").keydown(function(e) {
  1425. n.ShouldPerformDiscovery() && User.KeyPressEnter(e, function() {
  1426. e.preventDefault(), n.ValidateUserInput(), User.RefreshDomainState()
  1427. }, 13)
  1428. }), $("#iDisambigRenameLink").click(function(t) {
  1429. t.preventDefault(), e.open(Constants.DisambigHelpUrl, "_blank")
  1430. }), $("a#looking_cancel_link").click(function(e) {
  1431. e.preventDefault(), Context.back_action_stack.TriggerCancelAction()
  1432. })
  1433. },
  1434. SetupTilesForSplitter: function() {
  1435. e.users != Constants.EMAIL_DISCOVERY_DEFAULT_TILES && (Context.email_discovery_splitter_shown = !0, Context.user_tiles = Tiles.users, Tiles.users = Constants.EMAIL_DISCOVERY_DEFAULT_TILES, e.users = Tiles.users, $.each(e.users, function(e, t) {
  1436. t.ignore_length = !0
  1437. }))
  1438. },
  1439. RevertUserTiles: function() {
  1440. e.users == Constants.EMAIL_DISCOVERY_DEFAULT_TILES && (Context.email_discovery_splitter_shown = !1, Tiles.users = Context.user_tiles, e.users = Tiles.users)
  1441. },
  1442. ShowPostErrorMessage: function() {
  1443. Context.email_discovery_mode = !1, n.is_enabled_workflow = !0, Context.email_discovery_splitter_shown = !1, -1 == $("meta[name=PageID]").attr("content").indexOf("EmailBasedDiscoveryTiles") && Context.back_action_stack.AddAction(Constants.CancelAction.FROM_MANY_TO_EMAILDISCOVERY_INIT), $("#cred_cancel_button").show()
  1444. },
  1445. ValidateUserInput: function() {
  1446. User.UpdateUsernameState(), Context.username_state.is_empty ? (Context.email_discovery_workflow_state = n.WorkflowStates.NONE, n.ShowEmailDiscovery(30127)) : Context.username_state.is_partial && (Context.email_discovery_workflow_state = n.WorkflowStates.NONE, n.ShowEmailDiscovery(30145))
  1447. },
  1448. PerformEmailBasedDiscovery: function() {
  1449. var e = $("input#cred_userid_inputtext").val().toLowerCase();
  1450. if (e = $.trim(e), Context.email_discovery_timeout_occurred = !1, Context.email_discovery_error_message = null, !Support.validateUsernameCredInput(e)) return Context.email_discovery_workflow_state = n.WorkflowStates.NONE, void n.ShowEmailDiscovery(30064);
  1451. var o = Constants.Use_Client_Check_Msa_Flag ? Constants.IS_MSA_FED_SUPPORTED : !0;
  1452. Util.SetRoutingCookie(e), Context.email_discovery_lookup_xhr = $.ajax({
  1453. headers: {
  1454. Accept: "application/json"
  1455. },
  1456. url: Constants.EMAIL_DISCOVERY_SERVICE_URI.replace("{0}", encodeURIComponent(e)),
  1457. dataType: "json",
  1458. data: {
  1459. stsRequest: Constants.CONTEXT,
  1460. checkForMicrosoftAccount: o
  1461. },
  1462. success: n.ReceiveHomeRealmInfo,
  1463. error: n.ReceiveHomeRealmError,
  1464. timeout: Constants.EMAIL_DISCOVERY_SERVICE_TIMEOUT
  1465. }), Context.username_state.last_checked_email = e, Context.username_state.home_realm_state = Constants.State.PENDING, t.EmailDiscovery.HideEmailDiscovery(), t.EmailDiscovery.ShowLookingForAccountLayout()
  1466. },
  1467. ReceiveHomeRealmInfo: function(e) {
  1468. Context.email_discovery_response = {
  1469. AAD: e
  1470. }, n.HideLookingForAccountLayout(), Context.back_action_stack.RemoveLastCancelAction();
  1471. var t = n.GetAccountStateFromResponse({
  1472. AAD: e
  1473. });
  1474. n.PerformUIAction(t)
  1475. },
  1476. GetAccountStateFromResponse: function(e) {
  1477. var t = Constants.EmailDiscoveryAccountState;
  1478. if (null === e || null === e.AAD) return Context.username_state.home_realm_state = Constants.State.INVALID, t.ERROR;
  1479. var o = e.AAD.MicrosoftAccount,
  1480. a = e.AAD,
  1481. i = "",
  1482. r = "";
  1483. if (null === o) i = "TIMED_OUT";
  1484. else if (i = n.GetEnumKeyName(Constants.MSAccount, o), null === i) return t.ERROR;
  1485. if ("timeout" === a) r = "TIMED_OUT", Context.username_state.home_realm_state = Constants.State.INVALID;
  1486. else {
  1487. r = n.GetEnumKeyName(Constants.NameSpaceType, a.NameSpaceType);
  1488. var s = a.NameSpaceType === Constants.NameSpaceType.FEDERATED && !a.AuthURL || a.NameSpaceType === Constants.NameSpaceType.CLOUDFEDERATED && !a.CrossCloudAuthUrl;
  1489. if (null === r || s) return Context.username_state.home_realm_state = Constants.State.INVALID, t.ERROR;
  1490. Context.username_state.home_realm_state = a.NameSpaceType === Constants.NameSpaceType.CLOUDFEDERATED ? Constants.State.FEDERATED : Constants.State[r]
  1491. }
  1492. var d = "AAD_" + r + "_AND_MSA_" + i,
  1493. _ = t[d];
  1494. return void 0 === _ ? t.Error : _
  1495. },
  1496. PerformUIAction: function(t) {
  1497. var o = Constants.EmailDiscoveryAccountState,
  1498. a = Context.email_discovery_response;
  1499. switch (Context.email_discovery_easi_user = !1, Context.email_discovery_splitter_shown = !1, Instrument.email_discovery_ui_code = t, t) {
  1500. case o.AAD_UNKNOWN_AND_MSA_NOT_EXIST:
  1501. Constants.SHOULD_HIDE_SIGNUP || $("#create_msa_account_container").show(), n.ShowEmailDiscovery(30146);
  1502. break;
  1503. case o.AAD_UNKNOWN_AND_MSA_EXISTS:
  1504. Context.email_discovery_easi_user = !0, n.LoginMSOAccount();
  1505. break;
  1506. case o.AAD_CLOUDFEDERATED_AND_MSA_NOT_EXIST:
  1507. case o.AAD_FEDERATED_AND_MSA_NOT_EXIST:
  1508. if (Util.isMSA(a.AAD.AuthURL)) {
  1509. Constants.SHOULD_HIDE_SIGNUP || $("#create_msa_account_container").show(), n.ShowEmailDiscovery(30146);
  1510. break
  1511. }
  1512. case o.AAD_MANAGED_AND_MSA_NOT_EXIST:
  1513. n.LoginAADAccount();
  1514. break;
  1515. case o.AAD_CLOUDFEDERATED_AND_MSA_EXISTS:
  1516. case o.AAD_FEDERATED_AND_MSA_EXISTS:
  1517. if (Util.isMSA(a.AAD.AuthURL)) {
  1518. n.LoginMSOAccount();
  1519. break
  1520. }
  1521. n.SetupTilesForSplitter(), Context.redirect_auth_url = t === o.AAD_CLOUDFEDERATED_AND_MSA_EXISTS ? a.AAD.CrossCloudAuthUrl : a.AAD.AuthURL, Context.federated_domain = a.AAD.DomainName, e.users[0].authUrl = Context.redirect_auth_url;
  1522. case o.AAD_MANAGED_AND_MSA_EXISTS:
  1523. Context.back_action_stack.AddAction(Constants.CancelAction.FROM_EMAILDISCOVERY_SPLITTER_TO_EMAILDISCOVERY_START), $("#cred_cancel_button").show(), n.ShowSplitter();
  1524. break;
  1525. case o.AAD_CLOUDFEDERATED_AND_MSA_THROTTLED:
  1526. case o.AAD_CLOUDFEDERATED_AND_MSA_TIMED_OUT:
  1527. case o.AAD_FEDERATED_AND_MSA_THROTTLED:
  1528. case o.AAD_FEDERATED_AND_MSA_TIMED_OUT:
  1529. n.SetupTilesForSplitter(), Context.redirect_auth_url = t === o.AAD_CLOUDFEDERATED_AND_MSA_EXISTS ? a.AAD.CrossCloudAuthUrl : a.AAD.AuthURL, Context.federated_domain = a.AAD.DomainName, e.users[0].authUrl = Context.redirect_auth_url, Context.email_discovery_timeout_occurred = !0, Context.back_action_stack.AddAction(Constants.CancelAction.FROM_EMAILDISCOVERY_SPLITTER_TO_EMAILDISCOVERY_START), n.ShowSplitter();
  1530. break;
  1531. case o.AAD_MANAGED_AND_MSA_THROTTLED:
  1532. case o.AAD_MANAGED_AND_MSA_TIMED_OUT:
  1533. Context.email_discovery_timeout_occurred = !0, Context.back_action_stack.AddAction(Constants.CancelAction.FROM_EMAILDISCOVERY_SPLITTER_TO_EMAILDISCOVERY_START), n.ShowSplitter();
  1534. break;
  1535. case o.AAD_TIMED_OUT_AND_MSA_THROTTLED:
  1536. case o.AAD_TIMED_OUT_AND_MSA_TIMED_OUT:
  1537. case o.AAD_UNKNOWN_AND_MSA_THROTTLED:
  1538. case o.AAD_UNKNOWN_AND_MSA_TIMED_OUT:
  1539. case o.AAD_TIMED_OUT_AND_MSA_NOT_EXIST:
  1540. case o.ERROR:
  1541. Constants.SHOULD_HIDE_SIGNUP || $("#create_msa_account_container").show();
  1542. case o.AAD_TIMED_OUT_AND_MSA_EXISTS:
  1543. default:
  1544. Context.email_discovery_timeout_occurred = !0, Context.email_discovery_use_msa_api ? Context.back_action_stack.AddAction(Constants.CancelAction.FROM_EMAILDISCOVERY_SPLITTER_TO_EMAILDISCOVERY_START) : n.IsTilesModeActivated() && Context.back_action_stack.AddAction(Constants.CancelAction.FROM_EMAILDISCOVERY_SPLITTER_FALLBACK_TO_TILES), n.ShowSplitter()
  1545. }
  1546. Context.email_discovery_easi_user && (Instrument.possible_easi_user = 1)
  1547. },
  1548. ReceiveHomeRealmError: function(e, t) {
  1549. "abort" == t ? (n.HideLookingForAccountLayout(), n.ShowEmailDiscovery()) : (Context.back_action_stack.RemoveLastCancelAction(), n.HandleTimeoutHomeRealmInfo())
  1550. },
  1551. HandleTimeoutHomeRealmInfo: function() {
  1552. Context.email_discovery_response = null, Context.email_discovery_timeout_occurred = !0, Context.username_state.home_realm_state = Constants.State.INVALID, n.HideLookingForAccountLayout(), n.PerformUIAction(Constants.EmailDiscoveryAccountState.ERROR)
  1553. },
  1554. ShowEmailDiscovery: function(e) {
  1555. if (Context.email_discovery_workflow_state !== n.WorkflowStates.INIT) {
  1556. if (Context.email_discovery_workflow_state = n.WorkflowStates.INIT, !Context.email_discovery_use_msa_api) return n.HideEmailDiscovery(), n.HandleTimeoutHomeRealmInfo(), void n.ShowSplitter();
  1557. var t = !1;
  1558. Support.hideClientErrorMessages(), Support.hideClientMessages(), Context.username_state.home_realm_state = Constants.State.NONE, Context.username_state.last_checked_email = Context.username_state.last_checked_email || "", void 0 === e ? Support.showClientMessage(30136) : (Support.showClientError(e), 30146 === e && (t = !0)), Constants.IS_HOLOGRAPHIC && $("#cred_userid_container ." + e).length > 0 && Util.OnBack(), $("#forget_tile_container").hide(), $("#cred_userid_container").show(), $("#cred_userid_inputtext").show(), $(".login_cred_field_container").show(), $(".login_cred_options_container").show(), $(".login_cred_options_container").addClass("email_discovery"), $("#cred_userid_inputtext").focus(), t ? ($("#cred_try_again_button").show(), $("#cred_continue_button").hide()) : ($("#cred_continue_button").show(), $("#cred_try_again_button").hide()), $("#cred_password_container").hide(), $("#recover_container").hide(), $("#cred_kmsi_container").hide(), $("#switch_user_container").hide(), $("#alternative-identity-providers").hide()
  1559. }
  1560. },
  1561. HideEmailDiscovery: function() {
  1562. $("#cred_userid_container").hide(), $("#cred_continue_button").hide(), $("#cred_cancel_button").hide(), $("#cred_try_again_button").hide(), $("#create_msa_account_container").hide(), Support.hideClientErrorMessages(), Support.hideClientMessages(), Context.username_state.enable_redirect = !1, Context.username_state.enable_guests = !1, User.UsernameOnChangeHandler()
  1563. },
  1564. BackToUserTiles: function() {
  1565. n.HideEmailDiscovery(), Context.email_discovery_mode = !1, n.RevertUserTiles(), Tiles.drawUsers(), $("#tiles_cta_text").show(), $(".login_cred_options_container").removeClass("email_discovery"), $("#create_msa_account_container").hide(), Context.username_state.home_realm_state = Constants.State.NONE, Tiles.CancelTileRedirect()
  1566. },
  1567. ShowLookingForAccountLayout: function() {
  1568. Context.email_discovery_workflow_state != n.WorkflowStates.LOOKING && (Context.email_discovery_workflow_state = n.WorkflowStates.LOOKING, Context.back_action_stack.AddAction(Constants.CancelAction.FROM_EMAILDISCOVERY_LOOKING_FOR_ACCOUNT_TO_EMAILDISCOVERY_START), $("#looking_container").show(), $("a#looking_cancel_link").focus(), $("div.progress").css("visibility", "visible"), User.startAnimation(), Context.animationTid = setInterval(User.startAnimation, 3500))
  1569. },
  1570. HideLookingForAccountLayout: function() {
  1571. $("#looking_container").hide(), $("div.progress").css("visibility", "hidden"), clearInterval(Context.animationTid)
  1572. },
  1573. CancelLookingForAccount: function() {
  1574. Context.email_discovery_lookup_xhr.abort()
  1575. },
  1576. ShowSplitter: function() {
  1577. if (Context.email_discovery_workflow_state !== n.WorkflowStates.SPLITTER)
  1578. if (Context.email_discovery_workflow_state = n.WorkflowStates.SPLITTER, Context.email_discovery_splitter_shown = !0, n.SetupTilesForSplitter(), $(".login_cta_container").show(), $("#login_user_chooser").show(), Tiles.drawUsers(), $("#disambig-container").show(), Context.back_action_stack.DoesCancelActionExist() && $("#cred_cancel_button").show(), Context.email_discovery_use_msa_api)
  1579. if ($(".login_cred_options_container").css("display", "block"), Context.email_discovery_timeout_occurred) Support.showClientMessage(30140);
  1580. else {
  1581. var e = $("input#cred_userid_inputtext").val().toLowerCase();
  1582. e = $.trim(e);
  1583. var t = Constants.TokenizedStringMsgs.UPN_DISAMBIGUATE_MESSAGE.replace("{0}", e);
  1584. $("#upn_needs_disambiguation_text").text(t), Support.showClientMessage(30139)
  1585. }
  1586. else n.IsTilesModeActivated() || $(".login_cred_options_container").removeClass("email_discovery"), $(".login_cred_options_container").css("display", "block"), $("#create_msa_account_container").show(), Support.showClientMessage(30173)
  1587. },
  1588. HideSplitter: function() {
  1589. $("#cred_cancel_button").hide(), $("#login_user_chooser").empty(), $(".login_user_chooser").hide(), $("#login_user_chooser").hide(), $("#disambig-container").hide(), $("#create_msa_account_container").hide(), Support.hideClientErrorMessages(), Support.hideClientMessages()
  1590. },
  1591. BackSplitter: function() {
  1592. n.HideSplitter(), n.ShowEmailDiscovery()
  1593. },
  1594. LoginMSOAccount: function() {
  1595. if (Context.email_discovery_workflow_state != n.WorkflowStates.MSA) {
  1596. Context.email_discovery_workflow_state = n.WorkflowStates.MSA;
  1597. var e = {
  1598. DomainName: Constants.MSA_DOMAIN,
  1599. AuthURL: Constants.MSA_AUTH_URL
  1600. };
  1601. n.HideSplitter(), n.InitRedirect(), User.ReceiveFederatedDomain(e)
  1602. }
  1603. },
  1604. LoginAADAccount: function() {
  1605. Context.email_discovery_workflow_state != n.WorkflowStates.AAD && (Context.email_discovery_workflow_state = n.WorkflowStates.AAD, n.HideSplitter(), !Context.email_discovery_use_msa_api || (Context.email_discovery_timeout_occurred || null === Context.email_discovery_response) && Context.username_state.home_realm_state == Constants.State.INVALID ? (n.ShowAADLoginLayout(), Context.username_state.home_realm_state = Constants.State.NONE, $("#cred_userid_inputtext").focus()) : Context.username_state.home_realm_state == Constants.State.FEDERATED ? (Context.email_discovery_timeout_occurred && !Util.isMSA(Context.email_discovery_response.AAD.AuthURL) && (Context.email_discovery_easi_user = !1), n.InitRedirect(), User.ReceiveFederatedDomain(Context.email_discovery_response.AAD)) : (n.ShowAADLoginLayout(), User.ReceiveManagedDomain(Context.email_discovery_response.AAD), $("#cred_password_inputtext").focus()))
  1606. },
  1607. InitRedirect: function() {
  1608. $("input#cred_userid_inputtext").hide(), $("#cred_userid_container").show(), $(".login_cred_field_container").show(), $(".login_cred_options_container").show(), $("#cred_kmsi_container").show(), Context.back_action_stack.AddAction(Context.email_discovery_splitter_shown ? Constants.CancelAction.FROM_EMAILDISCOVERY_REDIRECT_TO_EMAILDISCOVERY_SPLITTER : Constants.CancelAction.FROM_EMAILDISCOVERY_REDIRECT_TO_EMAILDISCOVERY_START), $("div.progress").css("visibility", "visible"), $(".login_cred_options_container").removeClass("email_discovery"), User.startAnimation(), Context.animationTid = setInterval(User.startAnimation, 3500)
  1609. },
  1610. ShowAADLoginLayout: function() {
  1611. Context.email_discovery_mode = !1, Context.back_action_stack.AddAction(Context.email_discovery_splitter_shown ? Constants.CancelAction.FROM_EMAILDISCOVERY_AAD_LOGIN_TO_EMAILDISCOVERY_SPLITTER : Constants.CancelAction.FROM_EMAILDISCOVERY_AAD_LOGIN_TO_EMAILDISCOVERY_START), $(".login_cred_field_container").show(), $(".login_cred_options_container").show(), $(".login_cred_options_container").removeClass("email_discovery"), $("#cred_userid_inputtext").show(), $("#cred_password_inputtext").show(), $("#cred_userid_container").show(), $("#cred_sign_in_button").show(), $("#cred_kmsi_container").show(), $("#recover_container").show(), $("#cred_password_container").show(), $("#login_cta_text").show(), $("#cred_cancel_button").show(), TenantBranding.setUserIdHintAndKmsi()
  1612. },
  1613. HideAADLoginLayout: function() {
  1614. Context.email_discovery_mode = !0, TenantBranding.RemoveTenantBrandingAndApplyWorkload(), $(".login_cred_options_container").addClass("email_discovery"), $("#cred_password_inputtext").val(""), $("#cred_sign_in_button").hide(), $("#cred_kmsi_container").hide(), $("#recover_container").hide(), $("#cred_password_container").hide(), $("#login_cta_text").hide(), $("#cred_cancel_button").hide()
  1615. },
  1616. CancelRedirect: function() {
  1617. clearTimeout(Context.redirectTid), Context.username_state.home_realm_state = Constants.State.NONE, $("div.progress").css("visibility", "hidden"), clearInterval(Context.animationTid), $("#redirect_message_container").hide(), $("#cred_sign_in_button").hide(), $("#redirect_cta_text").hide(), $("#redirect_company_name_text").empty(), $("#cred_kmsi_container").hide(), $(".login_cred_options_container").addClass("email_discovery"), $("#redirect_message_container").css("opacity", 0), $("#redirect_message_container").addClass("hidden"), $("#redirect_message_container").addClass("no_display"), Context.email_discovery_mode = !0
  1618. },
  1619. GetEnumKeyName: function(e, t) {
  1620. for (var n in e)
  1621. if (e[n] == t) return n;
  1622. return null
  1623. }
  1624. };
  1625. $Do.when("doc.ready", function() {
  1626. n.Initialize(), $Do.register("EmailDiscovery", 0, !0)
  1627. })
  1628. }(), $Do.when("jQuery.ready", function() {
  1629. var e = jQuery.fn.hide;
  1630. jQuery.fn.hide = function(t, n) {
  1631. if (t) {
  1632. var o = this;
  1633. e.apply(this, [t, function() {
  1634. o.each(function(e, t) {
  1635. t.setAttribute("aria-hidden", "true")
  1636. }), n && n.call(o)
  1637. }])
  1638. } else e.apply(this, arguments), this.each(function(e, t) {
  1639. t.setAttribute("aria-hidden", "true")
  1640. });
  1641. return this
  1642. };
  1643. var t = jQuery.fn.show;
  1644. jQuery.fn.show = function(e, n) {
  1645. if (e) {
  1646. var o = this;
  1647. t.apply(this, [e, function() {
  1648. o.each(function(e, t) {
  1649. t.removeAttribute("aria-hidden")
  1650. }), n && n.call(o)
  1651. }])
  1652. } else t.apply(this, arguments), this.each(function(e, t) {
  1653. t.removeAttribute("aria-hidden")
  1654. });
  1655. return this
  1656. };
  1657. var n = jQuery.fn.addClass;
  1658. jQuery.fn.addClass = function(e) {
  1659. return ("no_display" === e || "hidden" === e) && this.each(function(e, t) {
  1660. t.setAttribute("aria-hidden", "true")
  1661. }), n.apply(this, arguments), this
  1662. };
  1663. var o = jQuery.fn.removeClass;
  1664. jQuery.fn.removeClass = function(e) {
  1665. return ("no_display" === e || "hidden" === e) && this.each(function(e, t) {
  1666. t.removeAttribute("aria-hidden")
  1667. }), o.apply(this, arguments), this
  1668. }, jQuery.support.placeholder = function() {
  1669. return window.Support.is_placeholder_supported()
  1670. }()
  1671. }),
  1672. function() {
  1673. var e = window,
  1674. t = e.MSLogin,
  1675. n = e.Support = t.Support = {
  1676. clientErrorStrings: {},
  1677. is_placeholder_supported: function() {
  1678. if ($.browser.msie) {
  1679. var e = document.documentMode;
  1680. if (12 > e) return !1
  1681. }
  1682. if (navigator.userAgent.indexOf("rv:11.0") >= 0) return !1;
  1683. var t = document.createElement("input");
  1684. return "placeholder" in t
  1685. },
  1686. is_prefetch_supported: function() {
  1687. return navigator.userAgent.match(/iPad/) ? !1 : !0
  1688. },
  1689. showClientError: function(e) {
  1690. var o = !1,
  1691. a = [];
  1692. if (0 == e) $("#cta_error_message_text").hide(), $("#accessibleError").hide(), $("#login_cta_text").hide(), $("#cta_client_error_text").hide(), $("#login_cta_text").show(), $("#create_msa_account_container").removeClass("no-display"), Constants.IS_HOLOGRAPHIC && ($(".footer_inner_container").show(), $("#cred_user_error_messages div.client_error_msg").hide());
  1693. else {
  1694. if (Constants.IS_CXH_REQUEST && t.Util.LogCxhTelemetry("AADLoginPageClientError", e), $(".client_error_msg").each(function() {
  1695. $(this).hide(), $("#" + $(this).data("elementid")).removeClass("inputState_error")
  1696. }), $("#cta_error_message_text").hide(), $("#login_cta_text").hide(), Constants.IS_HOLOGRAPHIC && $(".footer_inner_container").hide(), $("#cta_client_error_text").show(), arguments.length > 1) {
  1697. a = new Array(arguments.length - 1);
  1698. for (var i = 0; i < a.length; i++) a[i] = arguments[i + 1]
  1699. }
  1700. $(".client_error_msg." + e).each(function() {
  1701. a.length >= 1 && (n.clientErrorStrings[e] || (n.clientErrorStrings[e] = $(this).html()), $(this).html(n.clientErrorStrings[e].format(a))), $(this).show(), $("#accessibleError").text($(this).text()), $("#accessibleError").show();
  1702. var t = $("#" + $(this).data("elementid"));
  1703. t.addClass("inputState_error"), t.length > 0 && (t[t.length - 1].focus(), o = !0)
  1704. })
  1705. }
  1706. return o
  1707. },
  1708. hideClientError: function(e) {
  1709. $(".client_error_msg." + e).hide(), $("#accessibleError").hide(), $("#login_cta_text").show(), $("#create_msa_account_container").removeClass("no-display")
  1710. },
  1711. hideClientErrorMessages: function() {
  1712. $("#cta_error_message_text").hide(), $("#accessibleError").hide(), $("#login_cta_text").hide(), $("#cta_client_error_text").hide(), $(".client_error_msg").hide(), $("#cta_error_message_text").hide(), $("#login_cta_text").show(), $("#create_msa_account_container").removeClass("no-display")
  1713. },
  1714. showClientMessage: function(e) {
  1715. $(".cta_message_text").hide(), $("#cta_client_message_text").show(), $(".cta_message_text." + e).show()
  1716. },
  1717. hideClientMessages: function() {
  1718. $(".cta_message_text").hide(), $("#cta_client_message_text").hide()
  1719. },
  1720. showUsernameOrDomainError: function(e) {
  1721. var t;
  1722. if (Constants.IS_MSA_FED_SUPPORTED) {
  1723. $("#user-not-found-link").off("click"), t = n.showClientError(30065, e);
  1724. var o = User.GetRedirectAction(Constants.msaSignupUrl, Constants.msaSignupUrl, Constants.msaRedirSignupErrorParams, e);
  1725. $("#user-not-found-link").click(function(e) {
  1726. e.preventDefault(), o()
  1727. })
  1728. } else t = n.showClientError(30068, e.substring(e.lastIndexOf("@") + 1));
  1729. return t
  1730. },
  1731. validateUsernameCredInput: function(e) {
  1732. var n = t.Constants;
  1733. return Constants.IS_MSA_PHONE_USERNAME_SUPPORTED && n && n.REGEX_EMAIL && n.REGEX_PHONE ? n.REGEX_EMAIL.test(e) || n.REGEX_PHONE.test(e) : n.REGEX_EMAIL.test(e)
  1734. },
  1735. validateCredInputs: function() {
  1736. var e = n.validateUsernameInput();
  1737. 0 === e && (e = n.validatePassword());
  1738. var t = !1;
  1739. if (Constants.IS_HOLOGRAPHIC || (t = n.showClientError(e)), e) {
  1740. if (!Constants.IS_HOLOGRAPHIC && !t) {
  1741. var o = $("input#cred_userid_inputtext"),
  1742. a = $("input#cred_password_inputtext"),
  1743. i = o.val().trim(),
  1744. r = a.val().trim();
  1745. o.is(":visible") ? "" === i ? o.focus() : "" === r ? a.focus() : o.focus() : a.focus()
  1746. }
  1747. return !1
  1748. }
  1749. return !0
  1750. },
  1751. validatePassword: function() {
  1752. var e = $("input#cred_password_inputtext").val(),
  1753. t = 0;
  1754. return "" == e && (t = 30111, Constants.IS_HOLOGRAPHIC || $("input#cred_password_inputtext").focus()), Constants.IS_HOLOGRAPHIC && n.showClientError(t), t
  1755. },
  1756. validateUsernameInput: function() {
  1757. var e = $("input#cred_userid_inputtext").val(),
  1758. t = 30067;
  1759. return e = e.toLowerCase(), "" == e ? t = 30127 : Constants.IS_NAME_COEXISTENCE_ACCOUNT || n.validateUsernameCredInput(e) ? t = 0 : (t = 30064, null != e && -1 != e.indexOf("\\") && (t = 30066)), Constants.IS_HOLOGRAPHIC && n.showClientError(t), t
  1760. },
  1761. forceCredBlockHeight: function() {},
  1762. renderBrowserSpecificForNarrowWidth: function(e) {
  1763. User.resize_bg(), Background.winW < Constants.MOBILE_WIDTH_THRESHOLD && ($.browser.msie && e >= 8 && $(".push").css("height", "2em"), $.browser.msie && 6 >= e && $(".login_panel").css("padding-left", "50px"))
  1764. },
  1765. renderBrowserSpecificForNarrowHeight: function() {
  1766. if (User.resize_bg(), Background.winH < Constants.MOBILE_HEIGHT_THRESHOLD || "1" == Util.ExtractQSParam("popupui")) {
  1767. var e = !0;
  1768. navigator.userAgent.match(/IEMobile/) && (e = !1), navigator.userAgent.match(/Android/) && (e = !1), navigator.userAgent.match(/iPhone/) && (e = !1), navigator.userAgent.match(/iPad/) && (e = !1), e ? $("#footer_links_container").addClass("sticky_footer") : $("#footer_links_container").removeClass("sticky_footer")
  1769. }
  1770. },
  1771. renderBrowserSpecific: function() {
  1772. var e = document.documentMode;
  1773. if ($.browser.msie && e >= 8 && ($(".push").css("display", "inline-block"), $(".push").css("height", "6em")), (navigator.userAgent.match(/iPad/) || navigator.userAgent.match(/iPhone/)) && (n.forceCredBlockHeight(), $(".cred").css("margin-bottom", "-3em"), $(".login_guest_container").css("margin-bottom", "0px")), $.browser.msie && e > 8 && $(".show_other").css("margin-left", "-5px"), $.browser.msie && 7 >= e && ($(".ie_legacy").css("display", "none"), $("body").css("background-color", $("html").css("background-color")), $("a.tile_link").css("margin-left", "0px"), $("table.user_tile").css("margin-left", "0px"), $("table.user_tile").css("margin-bottom", "10px"), $(".show_other").css("margin-left", "0px")), $.browser.msie && 6 >= e && $("body").css("overflow-y", "hidden"), $.browser.mozilla && $(".input_border").addClass("high_contrast_border"), navigator.userAgent.match(/IEMobile/), navigator.userAgent.match(/Android 2\.3/) && ("optin.2.0" != $("meta[name=PageID]").attr("content") && $("body").css("font-size", "0.5em"), $(".login_footer_container").css("margin-top", "-12em"), $(".login_guest_container").css("padding-top", "0px"), $(".cred").css("padding-bottom", "10em"), n.forceCredBlockHeight()), navigator.userAgent.match(/Android/) && $("body").css("height", "100vh"), $.browser.msie && 10 == e) {
  1774. $(".cred").css("padding-bottom", "100px");
  1775. var t = $(window).height() - $(".login_footer_container").height() + 30;
  1776. $("#login_panel_center").css("height", t + "px"), document.body.onresize = function() {
  1777. var e = $(window).height() - $(".login_footer_container").height() + 30;
  1778. $("#login_panel_center").css("height", e + "px")
  1779. }
  1780. }
  1781. var o = window.$B,
  1782. a = o && o.Edge;
  1783. if (!a && $.browser.webkit && $("form :input").blur(function() {
  1784. User.resize_bg()
  1785. }), n.renderBrowserSpecificForNarrowWidth(e), n.renderBrowserSpecificForNarrowHeight(e), $.browser.msie && document.documentMode < 11) {
  1786. $(".cred").css("padding-bottom", "0px");
  1787. var i = function() {
  1788. var e = $(window).height() - $("#true_inner").height() - $(".push").height() - 60;
  1789. $("#login_panel_center").css("height", e > 0 ? $(window).height() - 15 : "")
  1790. };
  1791. document.body.onresize = i, i()
  1792. }
  1793. },
  1794. getViewport: function() {
  1795. var e, t;
  1796. return "undefined" != typeof window.innerWidth ? (e = window.innerWidth, t = window.innerHeight) : "undefined" != typeof document.documentElement && "undefined" != typeof document.documentElement.clientWidth && 0 != document.documentElement.clientWidth ? (e = document.documentElement.clientWidth, t = document.documentElement.clientHeight) : (e = document.getElementsByTagName("body")[0].clientWidth, t = document.getElementsByTagName("body")[0].clientHeight), [e, t]
  1797. },
  1798. showIllustration: function() {
  1799. var e = n.getViewport(),
  1800. t = !0;
  1801. return Background.winW < Constants.MOBILE_WIDTH_THRESHOLD ? t = !1 : e[0] < Constants.MOBILE_WIDTH_THRESHOLD ? t = !1 : navigator.userAgent.match(/IEMobile/) ? t = !1 : navigator.userAgent.match(/Android 2\.3/) ? t = !1 : "1" == Util.ExtractQSParam("popupui") && (t = !1), t
  1802. },
  1803. showTileTooltips: function() {
  1804. var e = !0;
  1805. return navigator.userAgent.match(/iPad/) ? e = !1 : navigator.userAgent.match(/iPhone/) && (e = !1), e
  1806. },
  1807. isDefined: function(e) {
  1808. return null != e && void 0 != e && (e.length > 0 || "object" == typeof e || "boolean" == typeof e || "number" == typeof e)
  1809. },
  1810. getDomain: function(e) {
  1811. var t = $.trim(e),
  1812. o = function(e) {
  1813. return -1 != e.indexOf("@") && e.indexOf("@") < e.length
  1814. },
  1815. a = function(e) {
  1816. return n.isDefined(e) && o(e)
  1817. };
  1818. if (a(t)) {
  1819. var i = e.substring(t.indexOf("@") + 1);
  1820. if (i.length > 0) return i
  1821. }
  1822. return null
  1823. },
  1824. checkIfDomainsMatch: function(e, t) {
  1825. var o = n.getDomain(e),
  1826. a = n.getDomain(t);
  1827. return null != o && null != a ? o.toLowerCase() == a.toLowerCase() : !1
  1828. },
  1829. GetOriginalPasswordResetLinkUrl: function() {
  1830. var e = Context.password_reset_link_url;
  1831. if (!n.isDefined(e)) {
  1832. var t = $("a#cred_forgot_password_link");
  1833. n.isDefined(t) && n.isDefined(t.attr("href")) && (e = t.attr("href")), n.isDefined(e) ? Context.password_reset_link_url = e : e = null
  1834. }
  1835. return e
  1836. },
  1837. UpdatePasswordResetLink: function() {
  1838. var e = $("a#cred_forgot_password_link"),
  1839. t = n.GetOriginalPasswordResetLinkUrl();
  1840. if (n.isDefined(e) && n.isDefined(t)) {
  1841. var o = decodeURIComponent(Util.ExtractQSParam("whr")),
  1842. a = $("input#cred_userid_inputtext").val(); - 1 == t.indexOf("?") && (t += "?"), n.isDefined(o) && (t += "&whr=" + encodeURIComponent(o)), n.isDefined(a) && (t += "&username=" + encodeURIComponent(a)), e.attr("href", t)
  1843. }
  1844. },
  1845. IsBrowserVersionGreaterOrEqual: function(e, t) {
  1846. if ("*" == t) return !0;
  1847. if (!n.isDefined(e) || !n.isDefined(t)) return !1;
  1848. for (var o = e.split("."), a = t.split("."), i = !1, r = 0; r < a.length; r++) {
  1849. var s = parseInt(o[r], 10),
  1850. d = parseInt(a[r], 10);
  1851. if (isNaN(s) || isNaN(d)) return !1;
  1852. if (d > s) return !1;
  1853. if (s > d) return !0;
  1854. i = !0
  1855. }
  1856. return i
  1857. },
  1858. ViewErrorDetails: function() {
  1859. $(".view-error-details-title").toggleClass("no_display"), $(".view-error-details-content").toggleClass("no_display")
  1860. },
  1861. IForgotMyPassword: function() {
  1862. $(".i-forgot-my-password-content").toggleClass("no_display")
  1863. },
  1864. LegalActionLink: function(e, t) {
  1865. e.preventDefault();
  1866. var n = "tou" === t ? Constants.footerTermsUrl : Constants.footerPrivacyUrl;
  1867. Constants.IS_ADAL_REQUEST ? $.ajax({
  1868. url: n,
  1869. data: {
  1870. IsAjax: !0
  1871. },
  1872. success: function(e) {
  1873. $(".login_panel_layout").hide(), $("#legal-content").text(e).show(), $("#legal-section").show().scrollTop(0)
  1874. }
  1875. }) : window.open(n, "_blank")
  1876. }
  1877. }
  1878. }();
  1879. var MSLogout = {
  1880. logoutstate: null,
  1881. success: [],
  1882. error: [],
  1883. noOfIncompleteSites: 0,
  1884. thirdPartyCookieEnabled: -1,
  1885. showSignOutInfo: function() {
  1886. MSLogout.checkThirdPartyCookies(), $.each(MSLogout.logoutstate.sites, function(e, t) {
  1887. MSLogout.checkSiteCookies(t)
  1888. })
  1889. },
  1890. checkThirdPartyCookies: function() {
  1891. void 0 !== MSLogout.logoutstate.thirdPartyCookieURL && $("<img/>").attr("src", MSLogout.logoutstate.thirdPartyCookieURL).load(function() {
  1892. MSLogout.thirdPartyCookieEnabled = ThirdPartyCookieStates.ENABLED
  1893. }).error(function() {
  1894. MSLogout.thirdPartyCookieEnabled = ThirdPartyCookieStates.DISABLED
  1895. }()).addClass("hidden")
  1896. },
  1897. checkSiteCookies: function(e) {
  1898. var t = e;
  1899. MSLogout.noOfIncompleteSites++;
  1900. var n = $("<img/>").attr("src", t.url).load(function() {
  1901. var e = t;
  1902. return function() {
  1903. MSLogout.noOfIncompleteSites--, MSLogout.success.push(e)
  1904. }
  1905. }()).error(function() {
  1906. var e = t;
  1907. return function() {
  1908. MSLogout.noOfIncompleteSites--, MSLogout.error.push(e)
  1909. }
  1910. }()).addClass("hidden");
  1911. $("body").append(n)
  1912. },
  1913. displaySiteList: function() {
  1914. if (MSLogout.thirdPartyCookieEnabled != ThirdPartyCookieStates.NOT_LOADED && 0 == MSLogout.noOfIncompleteSites) {
  1915. $(".signed_out_sites").show(), $("#more_info_text").hide();
  1916. var e = "#success_signed_out_sites";
  1917. MSLogout.thirdPartyCookieEnabled == ThirdPartyCookieStates.DISABLED && (e = "#error_signed_out_sites"), $.each(MSLogout.success, function(t, n) {
  1918. $(e).append($("<div/>").attr("id", "site_" + n.id).text(n.name + " (" + n.id + ")"))
  1919. }), $.each(MSLogout.error, function(e, t) {
  1920. $("#error_signed_out_sites").append($("<div/>").attr("id", "site_" + t.id).text(t.name + " (" + t.id + ")"))
  1921. }), MSLogout.displaySAMLList()
  1922. }
  1923. },
  1924. displaySAMLList: function() {
  1925. var e, t = MSLogout.logoutstate.samlNamespace;
  1926. if (void 0 != t) {
  1927. e = t.status ? "#success_signed_out_sites" : "#error_signed_out_sites";
  1928. var n = $("<div/>").html(t.name).text();
  1929. $(e).append($("<div/>").attr("id", "site_saml").text(n + " (" + t.domain + ")"))
  1930. }
  1931. }
  1932. };
  1933. MSLogout.ThirdPartyCookieStates = {
  1934. NOT_LOADED: -1,
  1935. DISABLED: 0,
  1936. ENABLED: 1
  1937. };
  1938. var ThirdPartyCookieStates = MSLogout.ThirdPartyCookieStates,
  1939. PostType = {
  1940. INVALID: "0",
  1941. PASSWORD: "11",
  1942. FEDERATION: "13",
  1943. SHA1_PASSWORD: "15",
  1944. SHA1HASH_PASSWORD: "16"
  1945. },
  1946. LoginOption = {
  1947. EMPTY: "0",
  1948. REMEMBER_PASSWORD: "1",
  1949. REMEMBER_USER_TILE: "2",
  1950. NOTHING_CHECKED: "3"
  1951. };
  1952. ! function() {
  1953. var e = window,
  1954. t = e.MSLogin,
  1955. n = e.Post = t.Post = {
  1956. isSubmitting: !1,
  1957. DetermineBrowser: function() {
  1958. return $.browser.msie ? "MSIE" : $.browser.chrome ? "Chrome" : $.browser.webkit ? "Webkit" : $.browser.safari ? "Safari" : $.browser.mozilla ? "Firefox" : $.browser.opera ? "Opera" : "Unknown"
  1959. },
  1960. IsSubmitReady: function() {
  1961. switch (Context.username_state.home_realm_state) {
  1962. case Constants.State.FEDERATED:
  1963. return !1;
  1964. case Constants.State.MANAGED:
  1965. break;
  1966. case Constants.State.INVALID:
  1967. break;
  1968. case Constants.State.NONE:
  1969. var t = e.User;
  1970. if (t.UpdateUsernameState(), !Context.username_state.is_empty && !Context.username_state.is_partial && !Constants.IS_NAME_COEXISTENCE_ACCOUNT) return t.RefreshDomainState(), !1;
  1971. break;
  1972. default:
  1973. return !1
  1974. }
  1975. return e.Support.validateCredInputs() ? n.isSubmitting ? !1 : (n.isSubmitting = !0, !0) : !1
  1976. },
  1977. GetCredParameters: function(t) {
  1978. var o = e.Background,
  1979. a = e.Instrument,
  1980. i = e.Tiles,
  1981. r = [];
  1982. if (t) try {
  1983. var s = new Date,
  1984. d = s.getTime() - s.getMilliseconds() - 12e4,
  1985. _ = e.performance.timing;
  1986. r.push({
  1987. name: "n1",
  1988. value: _.navigationStart - d
  1989. }), r.push({
  1990. name: "n2",
  1991. value: _.redirectStart - d
  1992. }), r.push({
  1993. name: "n3",
  1994. value: _.redirectEnd - d
  1995. }), r.push({
  1996. name: "n4",
  1997. value: _.fetchStart - d
  1998. }), r.push({
  1999. name: "n5",
  2000. value: _.domainLookupStart - d
  2001. }), r.push({
  2002. name: "n6",
  2003. value: _.domainLookupEnd - d
  2004. }), r.push({
  2005. name: "n7",
  2006. value: _.connectStart - d
  2007. }), r.push({
  2008. name: "n8",
  2009. value: _.secureConnectionStart - d
  2010. }), r.push({
  2011. name: "n9",
  2012. value: _.connectEnd - d
  2013. }), r.push({
  2014. name: "n10",
  2015. value: _.requestStart - d
  2016. }), r.push({
  2017. name: "n11",
  2018. value: _.responseStart - d
  2019. }), r.push({
  2020. name: "n12",
  2021. value: _.responseEnd - d
  2022. }), r.push({
  2023. name: "n13",
  2024. value: _.domLoading - d
  2025. }), r.push({
  2026. name: "n14",
  2027. value: _.domInteractive - d
  2028. }), r.push({
  2029. name: "n15",
  2030. value: _.domContentLoadedEventEnd - _.domContentLoadedEventStart
  2031. }), r.push({
  2032. name: "n16",
  2033. value: _.domComplete - d
  2034. }), r.push({
  2035. name: "n17",
  2036. value: _.loadEventStart - d
  2037. }), r.push({
  2038. name: "n18",
  2039. value: _.loadEventEnd - d
  2040. }), r.push({
  2041. name: "n19",
  2042. value: a.home_realm_load_time
  2043. }), r.push({
  2044. name: "n20",
  2045. value: a.latency_sensitivity
  2046. }), r.push({
  2047. name: "n21",
  2048. value: a.prefetch_done ? 1 : 0
  2049. }), r.push({
  2050. name: "n22",
  2051. value: a.prefetch_load_time
  2052. }), r.push({
  2053. name: "n23",
  2054. value: a.background_image_loaded ? 1 : 0
  2055. }), r.push({
  2056. name: "n24",
  2057. value: a.background_image_load_time
  2058. }), r.push({
  2059. name: "n25",
  2060. value: null !== i.users ? i.users.length - 1 : 0
  2061. }), r.push({
  2062. name: "n26",
  2063. value: a.email_discovery_ui_code
  2064. }), r.push({
  2065. name: "n27",
  2066. value: a.email_discovery_splitter_choice
  2067. }), r.push({
  2068. name: "n28",
  2069. value: a.possible_easi_user
  2070. }), r.push({
  2071. name: "n29",
  2072. value: a.tenant_branding_process_end_time - a.tenant_branding_start_time
  2073. }), r.push({
  2074. name: "n30",
  2075. value: a.tenant_branding_json_end_time - a.tenant_branding_start_time
  2076. }), r.push({
  2077. name: "n31",
  2078. value: a.tenant_branding_load_error ? 1 : 0
  2079. }), r.push({
  2080. name: "n32",
  2081. value: a.has_tenant_branding ? 1 : 0
  2082. }), r.push({
  2083. name: "n33",
  2084. value: a.has_dynamic_tenant_branding ? 1 : 0
  2085. }), r.push({
  2086. name: "n34",
  2087. value: a.logo_image_load_time
  2088. }), r.push({
  2089. name: "n35",
  2090. value: a.background_image_error ? 1 : 0
  2091. }), r.push({
  2092. name: "n36",
  2093. value: a.logo_image_error ? 1 : 0
  2094. }), r.push({
  2095. name: "n37",
  2096. value: a.tenant_branding_total_time
  2097. }), r.push({
  2098. name: "n38",
  2099. value: a.tenant_branding_number_of_switches
  2100. }), r.push({
  2101. name: "n39",
  2102. value: a.tenant_branding_right_side_time
  2103. }), r.push({
  2104. name: "n40",
  2105. value: a.logo_image_end_time
  2106. }), r.push({
  2107. name: "n41",
  2108. value: a.background_image_end_time
  2109. }), r.push({
  2110. name: "n42",
  2111. value: a.document_ready_end_time
  2112. }), r.push({
  2113. name: "n43",
  2114. value: a.document_load_end_time
  2115. })
  2116. } catch (c) {}
  2117. r.push({
  2118. name: "type",
  2119. value: PostType.PASSWORD
  2120. }), r.push($("#cred_keep_me_signed_in_checkbox").attr("checked") ? {
  2121. name: "LoginOptions",
  2122. value: LoginOption.REMEMBER_PASSWORD
  2123. } : e.EmailDiscovery.IsDiscoveryPage() || Context.post_from_tile ? {
  2124. name: "LoginOptions",
  2125. value: LoginOption.REMEMBER_USER_TILE
  2126. } : {
  2127. name: "LoginOptions",
  2128. value: LoginOption.NOTHING_CHECKED
  2129. }), r.push({
  2130. name: "NewUser",
  2131. value: 1
  2132. }), r.push({
  2133. name: "idsbho",
  2134. value: 1
  2135. }), r.push({
  2136. name: "PwdPad",
  2137. value: ""
  2138. }), r.push({
  2139. name: "sso",
  2140. value: ""
  2141. });
  2142. var l = decodeURIComponent(e.Util.ExtractQSParam("vv"));
  2143. return r.push({
  2144. name: "vv",
  2145. value: l
  2146. }), r.push({
  2147. name: "uiver",
  2148. value: 1
  2149. }), r.push({
  2150. name: "i12",
  2151. value: "https:" == e.location.protocol ? 1 : 0
  2152. }), r.push({
  2153. name: "i13",
  2154. value: n.DetermineBrowser()
  2155. }), r.push({
  2156. name: "i14",
  2157. value: $.browser.version
  2158. }), r.push({
  2159. name: "i15",
  2160. value: o.winW
  2161. }), r.push({
  2162. name: "i16",
  2163. value: o.winH
  2164. }), r.push(Constants.IS_CXH_REQUEST ? {
  2165. name: "i20",
  2166. value: Constants.IS_CXH_REQUEST
  2167. } : {
  2168. name: "i20",
  2169. value: ""
  2170. }), r
  2171. },
  2172. SubmitCreds: function() {
  2173. if (n.IsSubmitReady()) {
  2174. $("#cred_password_inputtext").focus();
  2175. var e = [];
  2176. if (e = n.GetCredParameters(Constants.SUBMIT_METRICS_ON_POST), Constants.IS_CXH_REQUEST && Constants.CxhFlow && Constants.CxhFlow.toUpperCase().startsWith("FRX") && "undefined" != typeof CloudExperienceHost && "undefined" != typeof CloudExperienceHost.Bridge) try {
  2177. var t = new CloudExperienceHost.Bridge;
  2178. t.invoke("CloudExperienceHost.Storage.SharableData.addValue", "oobe-username", $("input#cred_userid_inputtext").val()), t.invoke("CloudExperienceHost.MSA.encryptUserData", $("input#cred_password_inputtext").val()).done(function(e) {
  2179. t.invoke("CloudExperienceHost.Storage.PrivateData.addItem", "oobe-password", e)
  2180. }, function() {
  2181. t.invoke("CloudExperienceHost.Storage.SharableData.addValue", "oobe-password", $("input#cred_password_inputtext").val())
  2182. }), e.push({
  2183. name: "i21",
  2184. value: ""
  2185. })
  2186. } catch (o) {
  2187. e.push({
  2188. name: "i21",
  2189. value: o.message
  2190. })
  2191. }
  2192. var a = [];
  2193. $.each(e, function(e, t) {
  2194. -1 === $.inArray(t.name, a) && void 0 !== t.value && ($("<input />").attr("type", "hidden").attr("name", t.name).attr("value", t.value).appendTo("#credentials"), a.push(t.name))
  2195. }), $("form#credentials").submit()
  2196. }
  2197. },
  2198. SubmitInstrumentation: function() {
  2199. var e = [];
  2200. e = n.GetCredParameters(Constants.SUBMIT_METRICS_ON_REDIRECT), e.login = "federated", e.passwd = "", e.LoginOptions = LoginOption.NOTHING_CHECKED;
  2201. var t = {};
  2202. $.each(e, function(e, n) {
  2203. void 0 !== n.value && (t[n.name] = n.value)
  2204. }), $.ajax({
  2205. headers: {
  2206. Accept: "application/json"
  2207. },
  2208. url: $("#credentials").attr("action") + "&clientMetrics&federatedDomain=" + Context.federated_domain,
  2209. type: "POST",
  2210. dataType: "json",
  2211. data: t,
  2212. async: !0,
  2213. timeout: 200
  2214. })
  2215. }
  2216. };
  2217. $Do.register("Post", 0, !0)
  2218. }(),
  2219. /**
  2220. * @preserve Copyright 2016 (C) Microsoft Corporation. All rights reserved.
  2221. */
  2222. function() {
  2223. function e() {
  2224. function e() {
  2225. $("#redirect_dots_animation").show(), $("#redirect_dots_animation").css("visibility", "visible"), User.setupCredFieldsWithPlaceHolder(), setTimeout(User.startAnimation, 0), I = setInterval(User.startAnimation, Constants.TWOFA_ANIMATION_INTERVAL), R = !0, u(Constants.StrongAuth.Context)
  2226. }
  2227.  
  2228. function a(e) {
  2229. L = e, M = e.AuthMethodId, R = !0, 0 === e.AuthMethodId.toUpperCase().indexOf("TWOWAYVOICE") ? ($(".tfa_results_text.30050").show(), $("#tfa_button_container").hide(), $("button#tfa_signin_button").prop("disabled", !0)) : 0 === e.AuthMethodId.toUpperCase().indexOf("TWOWAYSMS") ? ($(".tfa_results_text.30049").show(), Constants.IS_HOLOGRAPHIC && $("button#tfa_signin_button").prop("disabled", !0)) : 0 === e.AuthMethodId.toUpperCase().indexOf("PHONEAPPNOTIFICATION") && $(".tfa_results_text.30051").show(), "none" != e.MethodDisplayString ? ($("#tfa_phone_text").text(e.MethodDisplayString), $("#tfa_phone_text").show(), $(".tile_secondary_name").show(), $(".tile_secondary_name").text(e.MethodDisplayString)) : ($("#tfa_phone_text").hide(), $(".tile_secondary_name").hide()), $("#tfa_options_link_container").show();
  2230. var t = {
  2231. Method: "BeginAuth",
  2232. flowToken: Constants.StrongAuth.FlowToken,
  2233. ctx: Constants.StrongAuth.Ctx,
  2234. AuthMethodId: e.AuthMethodId
  2235. };
  2236. E(), i(JSON.stringify(t))
  2237. }
  2238.  
  2239. function i(e) {
  2240. D = (new Date).getTime(), U = Constants.TWOFA_POLLING_INTERVAL, Constants.TWOFA_AUTH_METHOD_POLLING_INTERVAL[M] && (U = 1e3 * Constants.TWOFA_AUTH_METHOD_POLLING_INTERVAL[M]), B = $.ajax({
  2241. headers: {
  2242. Accept: "application/json"
  2243. },
  2244. url: Constants.StrongAuth.SASControllerBeginAuthUrl,
  2245. timeout: Constants.TWOFA_TIMEOUT,
  2246. data: e,
  2247. dataType: "json",
  2248. type: "POST",
  2249. contentType: "application/json",
  2250. success: g,
  2251. error: l
  2252. })
  2253. }
  2254.  
  2255. function r(e) {
  2256. if (O)
  2257. if (x++, Constants.TWOFA_MAX_POLLS >= x) {
  2258. var t = {
  2259. Method: "EndAuth",
  2260. SessionId: e.SessionId,
  2261. FlowToken: e.FlowToken,
  2262. Ctx: e.Ctx,
  2263. AuthMethodId: e.AuthMethodId,
  2264. PollCount: x + 1,
  2265. LastPollStart: D,
  2266. LastPollEnd: k
  2267. };
  2268. s(JSON.stringify(t))
  2269. } else c(e)
  2270. }
  2271.  
  2272. function s(e) {
  2273. var t = U,
  2274. n = t;
  2275. 0 !== D && (n = D + t - (new Date).getTime(), 0 > n && (n = 0)), U *= Constants.TWOFA_POLLING_INTERVAL_BACKOFF, b = setTimeout(function() {
  2276. d(e)
  2277. }, n)
  2278. }
  2279.  
  2280. function d(e) {
  2281. D = (new Date).getTime(), B = $.ajax({
  2282. headers: {
  2283. Accept: "application/json"
  2284. },
  2285. url: Constants.StrongAuth.SASControllerEndAuthUrl,
  2286. timeout: Constants.TWOFA_TIMEOUT,
  2287. data: e,
  2288. dataType: "json",
  2289. type: "POST",
  2290. contentType: "application/json",
  2291. success: m,
  2292. error: l
  2293. })
  2294. }
  2295.  
  2296. function _(e) {
  2297. if (R) {
  2298. $("#cred_remember_mfa_container").hide();
  2299. var t = "30062";
  2300. switch (e.ResultValue) {
  2301. case "UserVoiceAuthFailedCallWentToVoicemail":
  2302. t = "30106";
  2303. break;
  2304. case "UserVoiceAuthFailedInvalidPhoneInput":
  2305. case "UserVoiceAuthFailedPhoneHungUp":
  2306. t = "30107";
  2307. break;
  2308. case "UserVoiceAuthFailedInvalidPhoneNumber":
  2309. case "UserVoiceAuthFailedInvalidExtension":
  2310. case "InvalidFormat":
  2311. t = "30109";
  2312. break;
  2313. case "UserAuthFailedDuplicateRequest":
  2314. case "UserVoiceAuthFailedPhoneUnreachable":
  2315. case "UserVoiceAuthFailedProviderCouldntSendCall":
  2316. t = "30108";
  2317. break;
  2318. case "User2WaySMSAuthFailedProviderCouldntSendSMS":
  2319. case "SMSAuthFailedProviderCouldntSendSMS":
  2320. t = "30434";
  2321. break;
  2322. case "User2WaySMSAuthFailedNoResponseTimeout":
  2323. t = "30435";
  2324. break;
  2325. case "SMSAuthFailedNoResponseTimeout":
  2326. case "SMSAuthFailedWrongCodeEntered":
  2327. case "OathCodeIncorrect":
  2328. case "OathCodeDuplicate":
  2329. case "OathCodeOld":
  2330. t = "30436";
  2331. break;
  2332. case "PhoneAppNoResponse":
  2333. t = "30437";
  2334. break;
  2335. case "User2WaySMSAuthFailedWrongCodeEntered":
  2336. t = "30438";
  2337. break;
  2338. case "PhoneAppInvalidResult":
  2339. t = "30439";
  2340. break;
  2341. case "PhoneAppDenied":
  2342. t = "30440";
  2343. break;
  2344. case "PhoneAppTokenChanged":
  2345. t = "30441";
  2346. break;
  2347. case "SMSAuthFailedMaxAllowedCodeRetryReached":
  2348. t = "30443"
  2349. }
  2350. null === L ? $(".tfa_results_text").hide() : 0 === L.AuthMethodId.toUpperCase().indexOf("ONEWAYSMS") ? $(".tfa_results_text.30167").show() : 0 === L.AuthMethodId.toUpperCase().indexOf("PHONEAPPOTP") ? $(".tfa_results_text.30166").show() : $(".tfa_results_text").hide(), $("#redirect_dots_animation").hide(), $(".tfa_error_text." + t).show(), f(e), clearInterval(I), D = 0, k = 0, U = Constants.TWOFA_POLLING_INTERVAL
  2351. }
  2352. }
  2353.  
  2354. function c(e) {
  2355. R && (null === L ? $(".tfa_results_text").hide() : 0 === L.AuthMethodId.toUpperCase().indexOf("ONEWAYSMS") ? $(".tfa_results_text.30167").show() : 0 === L.AuthMethodId.toUpperCase().indexOf("PHONEAPPOTP") ? $(".tfa_results_text.30166").show() : $(".tfa_results_text").hide(), $("#redirect_dots_animation").hide(), $(".tfa_error_text.30442").show(), f(e), clearInterval(I), y = !1)
  2356. }
  2357.  
  2358. function l(e, t) {
  2359. if (R) {
  2360. if (null === L ? $(".tfa_results_text").hide() : 0 === L.AuthMethodId.toUpperCase().indexOf("ONEWAYSMS") ? $(".tfa_results_text.30167").show() : 0 === L.AuthMethodId.toUpperCase().indexOf("PHONEAPPOTP") ? $(".tfa_results_text.30166").show() : $(".tfa_results_text").hide(), $("#redirect_dots_animation").hide(), "timeout" == t ? $(".tfa_error_text.30442").show() : $(".tfa_error_text.30062").show(), clearInterval(I), y = !1, D = 0, k = 0, U = Constants.TWOFA_POLLING_INTERVAL, L && L.SessionId) {
  2361. var n = w.errTemplate.format(L.SessionId ? Util.htmlEncode(L.SessionId) : "", L.CorrelationId ? Util.htmlEncode(L.CorrelationId) : "", (new Date).toISOString());
  2362. $("#tfa_error_text").html(n).show()
  2363. }
  2364. E()
  2365. }
  2366. }
  2367.  
  2368. function u(e) {
  2369. if ("true" == e.Result) {
  2370. if (N = e, null === e.DefaultMethod) return void $(".tfa_error_text.30126").show();
  2371. a(e.DefaultMethod)
  2372. }
  2373. }
  2374.  
  2375. function g(e) {
  2376. if (k = (new Date).getTime(), "true" == e.Result) {
  2377. P = e.FlowToken, F = e.Ctx, L.SessionId = e.SessionId, L.CorrelationId = e.CorrelationId;
  2378. var t, n = !1;
  2379. if (0 === e.AuthMethodId.toUpperCase().indexOf("ONEWAYSMS") && M && 0 === M.toUpperCase().indexOf("ONEWAYSMS") ? (t = "30167", n = !0) : 0 === e.AuthMethodId.toUpperCase().indexOf("PHONEAPPOTP") && M && 0 === M.toUpperCase().indexOf("PHONEAPPOTP") && (t = "30166", n = !0), n) clearInterval(I), Constants.IS_HOLOGRAPHIC && ("options" !== Util.HoloNavigationStack[Util.HoloNavigationStack.length - 1].name && Util.HoloNavigationStack.push({
  2380. name: "options",
  2381. show: T
  2382. }), Util.HoloNavigationStack.push({
  2383. name: "verifyCode",
  2384. show: null
  2385. })), $("#tfa_signin_button").show(), $("button#tfa_signin_button").prop("disabled", !1), $("input#tfa_code_inputtext").val(""), $("#redirect_dots_animation").hide(), $(".tfa_results_text").hide(), $(".tfa_results_text." + t).show(), $("#tfa_code_container").show(), $("#tfa_pin_container").length && ($("input#tfa_pin_inputtext").val(""), $("#tfa_pin_container").show(), $("input#tfa_pin_inputtext").keypress(function(e) {
  2386. User.KeyPressEnter(e, w.submitCode, 13)
  2387. })), $("#tfa_code_inputtext").focus(), $("#tfa_button_container").show(), $("input#tfa_code_inputtext").keypress(function(e) {
  2388. User.KeyPressEnter(e, w.submitCode, 13)
  2389. }), $("#tfa_signin_button").keypress(function(e) {
  2390. User.KeyPressEnter(e, w.submitCode, 13)
  2391. }), setTimeout(function() {
  2392. var t = e.SessionId;
  2393. if (L.SessionId === t && R && 0 === $("input#tfa_code_inputtext").val().length) {
  2394. $(".tfa_error_text.30442").show();
  2395. var n = w.errTemplate.format(L.SessionId ? Util.htmlEncode(L.SessionId) : "", L.CorrelationId ? Util.htmlEncode(L.CorrelationId) : "", (new Date).toISOString());
  2396. $("#tfa_error_text").html(n).show(), E()
  2397. }
  2398. }, Constants.TWOFA_AUTH_TIMEOUT), E();
  2399. else {
  2400. x = 0;
  2401. var o = {
  2402. Method: "EndAuth",
  2403. SessionId: e.SessionId,
  2404. FlowToken: e.FlowToken,
  2405. Ctx: e.Ctx,
  2406. AuthMethodId: e.AuthMethodId,
  2407. PollCount: x + 1,
  2408. LastPollStart: D,
  2409. LastPollEnd: k
  2410. };
  2411. E(), s(JSON.stringify(o))
  2412. }
  2413. } else _(e)
  2414. }
  2415.  
  2416. function m(e) {
  2417. return k = (new Date).getTime(), L.SessionId != e.SessionId ? (_(e), void(y = !1)) : void("true" == e.Result ? p(e) : "true" == e.Retry ? r(e) : (_(e), "SMSAuthFailedMaxAllowedCodeRetryReached" === e.ResultValue && h(), y = !1))
  2418. }
  2419.  
  2420. function h() {
  2421. $("#tfa_code_container").hide(), $("#tfa_results_container").hide(), $("#tfa_pin_results_container").hide(), $("#tfa_pin_container").hide(), $("#tfa_remember_my_device_container").hide(), $("#tfa_signin_button").hide()
  2422. }
  2423.  
  2424. function p(e) {
  2425. if (O) {
  2426. var t = n.createElement("form");
  2427. t.setAttribute("method", "post"), t.setAttribute("action", Constants.StrongAuth.SASControllerProcessAuthUrl);
  2428. var a = n.createElement("input");
  2429. a.setAttribute("type", "hidden"), a.setAttribute("name", "request"), a.setAttribute("value", e.Ctx), t.appendChild(a);
  2430. var i = n.createElement("input");
  2431. if (i.setAttribute("type", "hidden"), i.setAttribute("name", "flowToken"), i.setAttribute("value", e.FlowToken), t.appendChild(i), o && o.canary) {
  2432. var r = n.createElement("input");
  2433. r.setAttribute("type", "hidden"), r.setAttribute("name", "canary"), r.setAttribute("value", o.canary), t.appendChild(r)
  2434. }
  2435. var s = n.createElement("input");
  2436. s.setAttribute("type", "hidden"), s.setAttribute("name", "mfaAuthMethod"), s.setAttribute("value", e.AuthMethodId), t.appendChild(s);
  2437. var d = $("#cred_remember_mfa_checkbox").attr("checked") ? !0 : !1,
  2438. _ = n.createElement("input");
  2439. _.setAttribute("type", "hidden"), _.setAttribute("name", "rememberMFA"), _.setAttribute("value", d), t.appendChild(_);
  2440. var c = n.createElement("input");
  2441. c.setAttribute("type", "hidden"), c.setAttribute("name", "mfaLastPollStart"), c.setAttribute("value", D), t.appendChild(c);
  2442. var l = n.createElement("input");
  2443. l.setAttribute("type", "hidden"), l.setAttribute("name", "mfaLastPollEnd"), l.setAttribute("value", k), t.appendChild(l), n.body.appendChild(t), t.submit()
  2444. }
  2445. }
  2446.  
  2447. function C(e, t) {
  2448. if (e.length !== Constants.TWOFA_OTP_MAX_LEN || Math.ceil(e) !== Math.floor(e) || $("#tfa_pin_container").length && (0 === t.length || Math.ceil(t) !== Math.floor(t))) {
  2449. $("#tfa_client_side_error_text").show();
  2450. var n = w.errTemplate.format(L.SessionId ? Util.htmlEncode(L.SessionId) : "", L.CorrelationId ? Util.htmlEncode(L.CorrelationId) : "", (new Date).toISOString());
  2451. return $("#tfa_error_text").html(n).show(), E(), !1
  2452. }
  2453. return !0
  2454. }
  2455.  
  2456. function f(e) {
  2457. var t = w.errTemplateWithErrorCode.format(0 | e.ErrCode, e.SessionId ? Util.htmlEncode(e.SessionId) : "", e.CorrelationId ? Util.htmlEncode(e.CorrelationId) : "", (new Date).toISOString());
  2458. $("#tfa_error_text").html(t).show(), E()
  2459. }
  2460.  
  2461. function E() {
  2462. var e = $("#tfa_outer_list_container").height();
  2463. $(".cred").css("min-height", e)
  2464. }
  2465.  
  2466. function S() {
  2467. setTimeout(User.startAnimation, 0), I = setInterval(User.startAnimation, Constants.TWOFA_ANIMATION_INTERVAL), e()
  2468. }
  2469.  
  2470. function T() {
  2471. if (B && B.abort(), clearInterval(b), clearInterval(I), O = !1, R = !1, M = "", $("#tfa_remember_my_device_container").hide(), $("#redirect_dots_animation").hide(), $(".tfa_results_text").hide(), $("#tfa_phone_text").hide(), $("#tfa_title_text").hide(), $(".tfa_error_text").hide(), $("#tfa_options_link_container").hide(), $("#tfa_code_container").hide(), $("#tfa_pin_container").hide(), $("#tfa_button_container").hide(), $("#header_text").text(Constants.TWOFA_HEADER_TEXT_SELECTMETHOD), $("#tfa_client_side_error_text").hide(), $("#tfa_options_title_text").show(), Constants.IS_HOLOGRAPHIC) {
  2472. $("#tfa_back_button").addClass("no_display").parent().addClass("buttonGroup_fullWidth"), Util.HoloNavigationStack.push({
  2473. name: "options",
  2474. show: T
  2475. });
  2476. var e = $("#tfa_options_list").empty();
  2477. $.each(N.Methods, function(t, n) {
  2478. n.AuthMethodDeviceId && t < Constants.TWOFA_MAXMETHODS && e.append($("<option></option>").text(n.MethodDisplayString).val(t))
  2479. }), e.parent().removeClass("no_display")
  2480. } else $("#tfa_options_list").show(), $("button#tfa_signin_button").prop("disabled", !0), $.each(N.Methods, function(e, t) {
  2481. if (t.AuthMethodDeviceId && e < Constants.TWOFA_MAXMETHODS) {
  2482. var n = $("#link" + e);
  2483. n.text(t.MethodDisplayString), n.attr("href", "#"), n.off("click").on("click", function() {
  2484. w.beginAltAuth(e)
  2485. }), $("#listItem" + e).show();
  2486. var o = $("#link_icon" + e).removeClass("voice sms device");
  2487. o.addClass(t.AuthMethodId && -1 !== t.AuthMethodId.indexOf("Voice") ? "voice" : t.AuthMethodId && -1 !== t.AuthMethodId.indexOf("SMS") ? "sms" : "device")
  2488. }
  2489. })
  2490. }
  2491.  
  2492. function v() {
  2493. $("#compromised_landing_container").hide(), $("#compromised_landing_action").hide(), Constants.StrongAuth && S(), $("#tfa_signin_button").show(), $("#tfa_outer_list_container").show()
  2494. }
  2495.  
  2496. function A() {
  2497. var e = $("#fmProofup").attr("action"),
  2498. t = -1 == e.indexOf("?") ? "?" : "&";
  2499. $("#login_workload_logo_image").length > 0 && ($("#login_workload_logo_image").attr("src").toLowerCase().indexOf("office365") >= 0 ? $("#fmProofup").attr("action", e + t + "BrandContextID=O365") : $("#login_workload_logo_image").attr("src").toLowerCase().indexOf("/azure/logo.png") >= 0 && $("#fmProofup").attr("action", e + t + "BrandContextID=Azure")), n.fmProofup.submit()
  2500. }
  2501. var w = this,
  2502. I = 0,
  2503. b = 0,
  2504. x = 0,
  2505. D = 0,
  2506. k = 0,
  2507. O = !0,
  2508. U = Constants.TWOFA_POLLING_INTERVAL,
  2509. R = !1,
  2510. y = !1,
  2511. L = null,
  2512. M = "",
  2513. N = null,
  2514. B = null,
  2515. P = null,
  2516. F = null;
  2517. w.beginAltAuth = function(e) {
  2518. $("#redirect_dots_animation").show(), $("#tfa_phone_text").show(), $("#tfa_title_text").show(), $(".tfa_error_text").show(), $("#tfa_options_link_container").show(), $(".tfa_error_text").hide(), $("#tfa_options_title_text").hide(), $("#tfa_remember_my_device_container").show(), $("#header_text").text(Constants.TWOFA_HEADER_TEXT_PROTECTACCOUNT);
  2519. var t = N.Methods[e].AuthMethodId.toUpperCase();
  2520. (0 === t.indexOf("ONEWAYSMS") || 0 === t.indexOf("PHONEAPPOTP")) && ($("#tfa_code_container").show(), $("#tfa_results_container").show(), $("#tfa_pin_results_container").show(), $("#tfa_pin_container").show()), Constants.IS_HOLOGRAPHIC ? ($("#tfa_options_list").parent().addClass("no_display"), $("#tfa_back_button").removeClass("no_display").parent().removeClass("buttonGroup_fullWidth")) : $("#tfa_options_list").hide(), O = !0, y = !1, User.startAnimation(), I = setInterval(User.startAnimation, Constants.TWOFA_ANIMATION_INTERVAL), a(N.Methods[e])
  2521. }, w.submitCode = function() {
  2522. if ($(".tfa_error_text").hide(), !y) {
  2523. var e = $("input#tfa_code_inputtext").val();
  2524. e = $.trim(e);
  2525. var t = "";
  2526. if ($("#tfa_pin_container").length && (t = $("input#tfa_pin_inputtext").val(), t = $.trim(t)), C(e, t)) {
  2527. e += t, y = !0, $("#tfa_client_side_error_text").hide(), x = 0;
  2528. var n = {
  2529. Method: "EndAuth",
  2530. FlowToken: P,
  2531. SessionId: L.SessionId,
  2532. Ctx: F,
  2533. AuthMethodId: L.AuthMethodId,
  2534. AdditionalAuthData: e,
  2535. LastPollStart: D,
  2536. LastPollEnd: k
  2537. };
  2538. $("#redirect_dots_animation").show(), setTimeout(User.startAnimation, 0), I = setInterval(User.startAnimation, Constants.TWOFA_ANIMATION_INTERVAL), d(JSON.stringify(n))
  2539. }
  2540. }
  2541. }, w.init = function() {
  2542. var e = $("meta[name=PageID]").attr("content"),
  2543. n = "strongauthcheck.2.0" === e,
  2544. o = "proofup.2.0" === e;
  2545. if (n || o) {
  2546. if ($("#switch_user_link").length) {
  2547. var a = $("#switch_user_link").attr("href"),
  2548. i = /^\d+$/,
  2549. r = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
  2550. a = Util.AddQSParamIfNotExists(a, "id", i), a = Util.AddQSParamIfNotExists(a, "lc", i), a = Util.AddQSParamIfNotExists(a, "username", r), a = Util.AddQSParamIfNotExists(a, "ru"), a = Util.AddQSParamIfNotExists(a, "whr"), a = Util.AddQSParamIfNotExists(a, "wreply"), a = Util.AddQSParamIfNotExists(a, "wauth"), $("#switch_user_link").attr("href", a)
  2551. }
  2552. $("#show-options").on("click", function(e) {
  2553. e.preventDefault(), T()
  2554. }), $("#compromised_landing_action").on("click", function(e) {
  2555. e.preventDefault(), v()
  2556. }), Constants.IS_CXH_REQUEST && o ? ($("#tfa_signin_button").text(t.GetString("Mfa.SetItUpNow")), $("button#tfa_signin_button").prop("disabled", !1), $("#tfa_signin_button").on("click", A)) : (Constants.IS_HOLOGRAPHIC ? ($("#tfa_back_button").on("click", Util.OnBack), $("#tfa_signin_button").on("click", Util.OnNext), Util.HoloNavigationStack.push({
  2557. name: "finalBack",
  2558. show: Util.CancelCxhFlow
  2559. })) : ($("#tfa_setupnow_button").on("click", A), $("#tfa_signin_button").on("click", w.submitCode)), n && ($("#redirect_dots_animation").show(), $("#redirect_dots_animation").css("visibility", "visible"), User.setupCredFieldsWithPlaceHolder(), Constants.HAS_LANDING_PAGE || S()))
  2560. }
  2561. }
  2562. }
  2563. var t = window,
  2564. n = t.document,
  2565. o = t.$Config;
  2566. t.StrongAuthCheck = new e, $Do.when("doc.load", t.StrongAuthCheck.init)
  2567. }(), MSLogin.TenantBranding = {
  2568. IsDynamicBrandingEnabled: function() {
  2569. return $.browser.chrome && Support.IsBrowserVersionGreaterOrEqual($.browser.version, "42") || $.browser.webkit && Support.IsBrowserVersionGreaterOrEqual($.browser.version, "537.4") || $.browser.mozilla && Support.IsBrowserVersionGreaterOrEqual($.browser.version, "5.0") || $.browser.msie && Support.IsBrowserVersionGreaterOrEqual($.browser.version, "8.0") || $.browser.msie && window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf("Trident") > 0 ? !0 : !1
  2570. },
  2571. IsShowingDynamicBranding: function() {
  2572. return TenantBranding.IsDynamicBrandingEnabled() && Context.TenantBranding.enabled
  2573. },
  2574. IsShowingDynamicWorkloadBranding: function() {
  2575. return TenantBranding.IsShowingDynamicBranding() && Context.TenantBranding.workload_branding_enabled
  2576. },
  2577. IsShowingDynamicWhrBranding: function() {
  2578. return TenantBranding.IsShowingDynamicBranding() && Support.isDefined(Context.TenantBranding.whr_key) && Context.TenantBranding.whr_key == Context.TenantBranding.key
  2579. },
  2580. HideAndRemoveSlideAnimation: function(e) {
  2581. e.hide(), e.removeClass("slide")
  2582. },
  2583. RefreshDomainState: function(e) {
  2584. TenantBranding.IsDynamicBrandingEnabled() && Support.checkIfDomainsMatch(e, Context.TenantBranding.prev_user) && Support.isDefined(Context.TenantBranding.key) && TenantBranding.PerformDynamicBranding(TenantBranding.IsShowingDynamicWhrBranding() ? Context.TenantBranding.prev_key : Context.TenantBranding.key)
  2585. },
  2586. RemoveAllOldElements: function() {
  2587. var e = $(".workload_text_old");
  2588. e.remove();
  2589. var t = $(".workload_img_old");
  2590. t.hide(), t.remove(), $("#boiler_plate_old").remove(), void 0 != Constants.DEFAULT_BOILERPLATE_TEXT && Constants.DEFAULT_BOILERPLATE_TEXT.length > 0 && ($("#boiler_plate_header").remove(), $("#boiler_plate").remove(), TenantBranding.AddBoilerPlateText(Constants.DEFAULT_BOILERPLATE_TEXT, Constants.DEFAULT_BOILERPLATE_HEADER))
  2591. },
  2592. ConfigureElementsForDelayedRemoval: function() {
  2593. var e = $("#background_background_image").clone();
  2594. e.attr("id", "background_background_image_old").removeClass("slide"), $("#background_branding_container").prepend(e), $("#background_background_image").hide(), $(".workload_img").addClass("workload_img_old").removeClass("workload_img"), $(".workload_img_text").addClass("workload_text_old").removeClass("workload_text")
  2595. },
  2596. ResetOnLoadContext: function() {
  2597. Background.background_resized = !1, Context.TenantBranding.has_logo = !1, Context.TenantBranding.has_background_img = !1, Context.on_load_image_background_loaded = !1, Logo.logo_image_loaded = !1
  2598. },
  2599. ResetDynamicBrandingContext: function() {
  2600. "undefined" != typeof window.LoginTenantBranding && (Context.TenantBranding.prev_obj = window.LoginTenantBranding, window.LoginTenantBranding = null), Context.TenantBranding.prev_key = Context.TenantBranding.key, Context.TenantBranding.prev_user = Context.TenantBranding.user, Context.TenantBranding.applied = !1, Context.TenantBranding.has_logo = !1, Context.TenantBranding.has_background_img = !1
  2601. },
  2602. BackupWorkloadBranding: function() {
  2603. if (!Context.TenantBranding.workload_branding_saved && !Context.TenantBranding.default_page) {
  2604. Context.TenantBranding.workload_branding_saved = !0, Context.TenantBranding.workload_branding_illustration = $("#background_background_image").clone(), Context.TenantBranding.workload_branding_illustration_alt = $("#background_background_image").attr("alt"), Context.TenantBranding.workload_branding_logo = $("#login_workload_logo_image").clone(), Context.TenantBranding.workload_branding_logo_text = $("#login_workload_logo_text").clone(), Context.TenantBranding.workload_branding_logo_alt = $("#login_workload_logo_image").attr("alt"), Context.TenantBranding.workload_branding_color = $("html").css("background-color"), Context.TenantBranding.workload_branding_footer_height = $("#footer_links_container").height(), TenantBranding.BackupElementHeights();
  2605. var e = Context.TenantBranding.cred_height;
  2606. Context.TenantBranding.workload_branding_height = e
  2607. }
  2608. },
  2609. ShouldShowWhrBranding: function() {
  2610. return TenantBranding.IsShowingDynamicBranding() && Support.isDefined(Context.TenantBranding.whr_key) ? Context.TenantBranding.whr_key != Context.TenantBranding.key || TenantBranding.IsShowingDynamicWorkloadBranding() : !1
  2611. },
  2612. RemoveTenantBrandingAndApplyWorkload: function() {
  2613. TenantBranding.IsDynamicBrandingEnabled() && (Support.hideClientMessages(), Context.TenantBranding.enabled = !0, Support.isDefined(Context.TenantBranding.whr_key) ? TenantBranding.ShouldShowWhrBranding() && TenantBranding.PerformDynamicBranding(Context.TenantBranding.whr_key) : TenantBranding.IsShowingDynamicWorkloadBranding() || TenantBranding.ApplyWorkloadBranding())
  2614. },
  2615. RemoveWorkloadBranding: function() {
  2616. TenantBranding.BackupWorkloadBranding(), TenantBranding.ConfigureElementsForDelayedRemoval(), TenantBranding.ResetOnLoadContext()
  2617. },
  2618. PerformDynamicBranding: function(e) {
  2619. if (TenantBranding.IsDynamicBrandingEnabled() && !Constants.FORCED_SIGN_IN) {
  2620. if (void 0 == Context.TenantBranding.store.Get(e) && (e = null), TenantBranding.IsShowingDynamicBranding() && null != Context.TenantBranding.key && Context.TenantBranding.key == e && !TenantBranding.IsShowingDynamicWorkloadBranding()) return;
  2621. Instrument.tenant_branding_getuserrealm_time = Instrument.home_realm_load_time, void 0 == e || null == e || null != Context.TenantBranding.key && !TenantBranding.IsShowingDynamicWorkloadBranding() ? void 0 != e && null != e && null != Context.TenantBranding.key && e != Context.TenantBranding.key ? (Instrument.has_dynamic_tenant_branding = !0, Instrument.tenant_branding_number_of_switches++, Context.TenantBranding.default_page = !1, Context.TenantBranding.enabled = !0, TenantBranding.ReplaceTenantBranding(e)) : null == Context.TenantBranding.key || void 0 != e && null != e && "" != e || (Instrument.has_dynamic_tenant_branding = !0, Instrument.tenant_branding_number_of_switches++, Context.TenantBranding.default_page = !1, Context.TenantBranding.enabled = !0, TenantBranding.ApplyWorkloadBranding()) : (Context.TenantBranding.default_page = !1, Context.TenantBranding.enabled = !0, Instrument.has_dynamic_tenant_branding = !0, Instrument.tenant_branding_number_of_switches++, Util.debug_console("workload branding -> tenant branding"), TenantBranding.RemoveWorkloadBranding(), TenantBranding.GetBrandingInfo(e))
  2622. }
  2623. },
  2624. getTenantBrandingContext: function(e, t) {
  2625. var n = {},
  2626. o = [
  2627. ["BannerLogo", !0, Constants.DEFAULT_LOGO],
  2628. ["TileLogo", !0, ""],
  2629. ["TileDarkLogo", !0, ""],
  2630. ["Illustration", !0, Constants.DEFAULT_ILLUSTRATION],
  2631. ["BackgroundColor", !1, Constants.DEFAULT_BACKGROUND_COLOR],
  2632. ["CompanyName", !1, ""],
  2633. ["UserIdLabel", !1, Constants.USERNAME_HINT_TEXT],
  2634. ["BoilerPlateText", !1, ""],
  2635. ["KeepMeSignedInDisabled", !1, !1]
  2636. ];
  2637. return $.each(o, function(o, a) {
  2638. var i = a[0],
  2639. r = a[1];
  2640. n[i] = e[t] && e[t][i] ? e[t][i] : e[0] && e[0][i] ? e[0][i] : a[2], "string" == typeof n[i] && r && (n[i] = n[i].toLowerCase())
  2641. }), n
  2642. },
  2643. formatTenantBrandingData: function(e) {
  2644. var t = {};
  2645. return $.each(e, function(e, n) {
  2646. var o = n.Locale;
  2647. o >= 0 && (t[o] = n)
  2648. }), t
  2649. },
  2650. processTenantBranding: function(e) {
  2651. null != e && (Instrument.has_tenant_branding = !0, e = TenantBranding.formatTenantBrandingData(e), Context.TenantBranding.info = e, Context.TenantBranding.info_context = TenantBranding.getTenantBrandingContext(e, Constants.LCID), TenantBranding.IsShowingDynamicBranding() || (TenantBranding.ShowBrandedBoilerPlate(), TenantBranding.UpdateLoginCtaText()), TenantBranding.ShowBrandedLogo(), TenantBranding.ShowBrandedIllustration(), Instrument.tenant_branding_process_end_time = Util.now())
  2652. },
  2653. BackupElementHeights: function() {
  2654. Context.TenantBranding.footer_height_saved || (Context.TenantBranding.footer_height_saved = !0, Context.TenantBranding.footer_height = $("#footer_links_container").height()), Context.TenantBranding.cred_height_saved || (Context.TenantBranding.cred_height_saved = !0, Context.TenantBranding.cred_height = $(".cred").height())
  2655. },
  2656. AddBoilerPlateText: function(e, t) {
  2657. var n, o;
  2658. Constants.IS_HOLOGRAPHIC ? (n = $("<label/>").attr("id", "boiler_plate").text(Util.htmlDecode(e)), $(".footer_inner_container").html(n)) : Constants.IS_INCLUSIVEOOBE ? (o = $("<p/>").attr("id", "boiler_plate_header").addClass("secondary-text").text(Util.htmlDecode(t)), n = $("<p/>").attr("id", "boiler_plate").addClass("secondary-text").text(Util.htmlDecode(e)), $(".boilerplate_header_location").append(o).append(n)) : (o = $("<p/>").attr("id", "boiler_plate_header").attr("tabindex", "-1").addClass("boilerplate_header").text(Util.htmlDecode(t)), $(".boilerplate_header_location").before(o), n = $("<p/>").attr("id", "boiler_plate").attr("tabindex", "-1").addClass("tinytext").text(Util.htmlDecode(e)), $(".footer_inner_container").before(n))
  2659. },
  2660. ShowBrandedBoilerPlate: function() {
  2661. $("#boiler_plate").remove(), TenantBranding.BackupElementHeights(), $("#boiler_plate_header").remove();
  2662. var e = Context.TenantBranding.info_context;
  2663. TenantBranding.AddBoilerPlateText(e.BoilerPlateText || Constants.DEFAULT_BOILERPLATE_TEXT, null != e.BoilerPlateText ? Constants.BOILERPLATE_HEADER : Constants.DEFAULT_BOILERPLATE_HEADER), $("#boiler_plate").show(), TenantBranding.ShouldFadeInTenantBranding() && ($("#boiler_plate").removeClass("slide"), $("#boiler_plate").addClass("slide"));
  2664. var t = 50 + $("#boiler_plate").height() + 40;
  2665. $(".login_inner_container").css("margin-bottom", "-" + t + "px"), $(".login_footer_container").height(t), $(".push").height(t)
  2666. },
  2667. ShowBrandedLogo: function() {
  2668. var e = Context.TenantBranding.info_context,
  2669. t = Constants.IS_CXH_REQUEST ? Constants.USE_DARK_TILE_LOGO ? e.TileDarkLogo || e.TileLogo : e.TileLogo : e.BannerLogo;
  2670. void 0 != t && "" != t && (t += "?ts=" + Context.tenant_branding_ts), User.UpdateLogo(t, Constants.DEFAULT_LOGO_ALT), $("#login_workload_logo_text").hide()
  2671. },
  2672. ShowBrandedIllustration: function() {
  2673. var e = Context.TenantBranding.info_context,
  2674. t = e.Illustration;
  2675. void 0 != t && "" != t && (t += "?ts=" + Context.tenant_branding_ts), User.UpdateBackground(t, e.BackgroundColor)
  2676. },
  2677. StoreBrandingInfo: function(e, t) {
  2678. Context.TenantBranding.store.Add(e, t)
  2679. },
  2680. GetBrandingInfo: function(e) {
  2681. Instrument.tenant_branding_start_time = Util.now(), Context.tenant_branding_ts = "", Context.TenantBranding.key = e, Context.TenantBranding.default_page && (Context.TenantBranding.default_key = e), Context.TenantBranding.applied = !0, Context.TenantBranding.workload_branding_enabled = !1;
  2682. var t = Context.TenantBranding.store.Get(e);
  2683. void 0 != t && (window.LoginTenantBranding = t, TenantBranding.ApplyTenantBranding())
  2684. },
  2685. ApplyTenantBranding: function() {
  2686. "undefined" != typeof window.LoginTenantBranding && (Instrument.tenant_branding_json_end_time = Util.now(), Context.TenantBranding.store.Add(Context.TenantBranding.key, window.LoginTenantBranding), Constants.TENANT_BRANDING = window.LoginTenantBranding), null != Constants.TENANT_BRANDING && "" != Constants.TENANT_BRANDING && (clearInterval(Context.tenant_branding_tid), Context.tenant_branding_tid = null, TenantBranding.processTenantBranding(Constants.TENANT_BRANDING))
  2687. },
  2688. ReplaceTenantBranding: function(e) {
  2689. TenantBranding.RemoveTenantBrandingDelayed(), TenantBranding.GetBrandingInfo(e)
  2690. },
  2691. RemoveTenantBrandingDelayed: function() {
  2692. var e = $("#tenantbrandingscript");
  2693. void 0 != e && null != e && e.remove(), t = $(".workload_img_old"), void 0 != t && null != t && t.remove();
  2694. var t = $(".workload_img");
  2695. void 0 != t && null != t && t.addClass("workload_img_old").removeClass("workload_img");
  2696. var n = $(".workload_text");
  2697. void 0 != n && null != n && n.addClass("workload_text").removeClass("workload_text_old");
  2698. var o = $("#boiler_plate");
  2699. void 0 != o && null != o && o.attr("id", "boiler_plate_old");
  2700. var a = $("#background_background_image").clone();
  2701. a.removeClass("slide"), a.attr("id", "background_background_image_old"), $("#background_branding_container").prepend(a), $("#background_background_image").hide(), TenantBranding.ResetDynamicBrandingContext(), TenantBranding.ResetOnLoadContext(), TenantBranding.showKmsi(), TenantBranding.replaceUsernameHint()
  2702. },
  2703. RemoveTenantBranding: function() {
  2704. var e = $("#tenantbrandingscript");
  2705. void 0 != e && null != e && e.remove(), t = $(".workload_img_old"), void 0 != t && null != t && t.remove();
  2706. var t = $(".workload_img");
  2707. void 0 != t && null != t && t.remove();
  2708. var n = $(".workload_img_text");
  2709. void 0 != n && null != n && n.remove();
  2710. var o = $("#boiler_plate");
  2711. void 0 != o && null != o && (Constants.DEFAULT_BOILERPLATE_TEXT.length > 0 ? ($("#boiler_plate_header").text(Constants.DEFAULT_BOILERPLATE_HEADER), o.text(Constants.DEFAULT_BOILERPLATE_TEXT)) : o.remove(), $(".login_inner_container").css("margin-bottom", "-50px"), $(".push").height(50)), $("#background_background_image").remove(), TenantBranding.ResetDynamicBrandingContext(), TenantBranding.ResetOnLoadContext(), TenantBranding.showKmsi(), TenantBranding.replaceUsernameHint()
  2712. },
  2713. ApplyWorkloadBranding: function() {
  2714. if (Context.TenantBranding.workload_branding_enabled = !0, !Context.TenantBranding.workload_branding_saved || Context.TenantBranding.default_page) TenantBranding.RemoveTenantBrandingDelayed(), User.UpdateLogo(Constants.DEFAULT_LOGO, Constants.DEFAULT_LOGO_ALT), User.UpdateBackground(Constants.DEFAULT_ILLUSTRATION, Constants.DEFAULT_BACKGROUND_COLOR), $("#background_background_image").show(), Background.background_resized = !1, Context.on_load_image_background_loaded = !1, Logo.logo_image_loaded = !1;
  2715. else {
  2716. TenantBranding.RemoveTenantBranding(), Support.isDefined(Context.TenantBranding.workload_branding_illustration) && $("#background_branding_container").prepend(Context.TenantBranding.workload_branding_illustration.clone()), Support.isDefined(Context.TenantBranding.workload_branding_logo) && $(".login_workload_logo_container").append(Context.TenantBranding.workload_branding_logo.clone()), Support.isDefined(Context.TenantBranding.workload_branding_logo_text) && $(".login_workload_logo_container").append(Context.TenantBranding.workload_branding_logo_text.clone()), User.RegisterOnLoadImage();
  2717. var e = Context.TenantBranding.footer_height;
  2718. e > 0 && ($("#footer_links_container").css("height", e + "px"), $("#footer_links_container").css("margin-top", "-" + e + "px")), $("#background_page_overlay").css("background-color", Constants.DEFAULT_BACKGROUND_COLOR), $("#background_background_image").css("background-color", Constants.DEFAULT_BACKGROUND_COLOR), $("#background_branding_container").css("background-color", Constants.DEFAULT_BACKGROUND_COLOR), $("html").css("background-color", Constants.DEFAULT_BACKGROUND_COLOR), $("#background_background_image").removeClass("slide"), $(".workload_img").removeClass("slide"), $(".workload_img_text").removeClass("slide"), $("#background_background_image").hide(), $("#background_background_image").show(), $("#background_page_overlay").hide(), $(".workload_img").show(), $(".workload_img_text").show(), $("#background_background_image").addClass("slide"), $(".workload_img").addClass("slide"), $(".workload_img_text").addClass("slide"), Background.background_resized = !0, Context.on_load_image_background_loaded = !0, Logo.logo_image_loaded = !0
  2719. }
  2720. Context.TenantBranding.cred_height && $(".cred").css("min-height", Context.TenantBranding.cred_height), Support.isDefined(Context.TenantBranding.workload_branding_login_cta_text) && $("#login_cta_text").text(Context.TenantBranding.workload_branding_login_cta_text)
  2721. },
  2722. ShouldFadeInTenantBranding: function() {
  2723. return TenantBranding.IsDynamicBrandingEnabled() && (null != Context.TenantBranding.key || Context.TenantBranding.workload_branding_saved) && !Context.TenantBranding.default_page
  2724. },
  2725. UpdateLoginCtaText: function() {
  2726. if ("i5030.2.0" == $("meta[name=PageID]").attr("content")) {
  2727. ("" == Context.TenantBranding.workload_branding_login_cta_text || null == Context.TenantBranding.workload_branding_login_cta_text) && (Context.TenantBranding.workload_branding_login_cta_text = $("#login_cta_text").text());
  2728. var e = $(".workload_img"),
  2729. t = !1;
  2730. if (Support.isDefined(e)) {
  2731. var n = null;
  2732. n = e.attr("src"), Support.isDefined(n) && Support.isDefined(Constants.DEFAULT_LOGO) && (t = n.toLowerCase().indexOf(Constants.DEFAULT_LOGO.toLowerCase()) > -1)
  2733. }
  2734. Constants.DYNAMIC_BRANDING_CTA_ENABLED && !t && $("#login_cta_text").text(Constants.PARTNER_NAME)
  2735. }
  2736. },
  2737. onLoadLogoHelper: function() {
  2738. Logo.logo_image_loaded = !0;
  2739. var e = $(".workload_img");
  2740. TenantBranding.HideAndRemoveSlideAnimation(e);
  2741. var t = $(".workload_text");
  2742. if (TenantBranding.HideAndRemoveSlideAnimation(t), Context.TenantBranding.has_logo ? (e.show(), Instrument.logo_image_loaded = !0) : (t.show(), Instrument.logo_image_loaded = !1), Instrument.logo_image_load_time = Util.now() - Instrument.logo_image_start, Instrument.tenant_branding_right_side_time = Util.now() - Instrument.tenant_branding_start_time, TenantBranding.RemoveAllOldElements(), TenantBranding.IsShowingDynamicWorkloadBranding() || TenantBranding.ShowBrandedBoilerPlate(), TenantBranding.UpdateLoginCtaText(), TenantBranding.ShouldFadeInTenantBranding() && (e.addClass("slide"), t.addClass("slide")), Context.on_load_image_background_loaded) TenantBranding.onLoadImageHelper();
  2743. else {
  2744. $("#background_background_image_old").hide().remove();
  2745. var n = Context.TenantBranding.background_color;
  2746. $("#background_page_overlay").css("background-color", n), $("#background_branding_container").css("background-color", n), $("html").css("background-color", n), $("#background_background_image").css("background-color", n), $("#background_background_image").hide()
  2747. }
  2748. TenantBranding.setUserIdHintAndKmsi(), Util.debug_console("onLoadLogo: Logo successfully loaded.")
  2749. },
  2750. setUserIdHintAndKmsi: function() {
  2751. null != Context.TenantBranding.info_context && (Context.TenantBranding.info_context.KeepMeSignedInDisabled && !TenantBranding.IsShowingDynamicWorkloadBranding() ? ($("#cred_kmsi_container").hide(), $("#cred_keep_me_signed_in_checkbox").attr("checked", !1)) : TenantBranding.showKmsi(), null == Context.TenantBranding.info_context.UserIdLabel || 0 == Context.TenantBranding.info_context.UserIdLabel.length || TenantBranding.IsShowingDynamicWorkloadBranding() ? TenantBranding.replaceUsernameHint() : (TenantBranding.setUsernameHint(Context.TenantBranding.info_context.UserIdLabel), Context.TenantBranding.username_hint_changed = !0))
  2752. },
  2753. showKmsi: function() {
  2754. $("#cred_kmsi_container").show()
  2755. },
  2756. replaceUsernameHint: function() {
  2757. Context.TenantBranding.username_hint_changed && (TenantBranding.setUsernameHint(Constants.USERNAME_HINT_TEXT), Context.TenantBranding.username_hint_changed = !1)
  2758. },
  2759. setUsernameHint: function(e) {
  2760. var t = Util.htmlDecode(e);
  2761. Support.is_placeholder_supported() ? $("#cred_userid_inputtext").attr("placeholder", t) : $("#cred_userid_inputtext_placeholder_span").text(t), $("#cred_userid_inputtext").attr("alt", t)
  2762. },
  2763. onLoadImageHelper: function() {
  2764. if (Logo.logo_image_loaded) {
  2765. Instrument.tenant_branding_total_time = Util.now() - Instrument.tenant_branding_start_time;
  2766. var e = $("#background_background_image"),
  2767. t = $("#background_page_overlay");
  2768. TenantBranding.HideAndRemoveSlideAnimation(e), $("#background_background_image_old").remove(), t.css("visibility", "visible");
  2769. var n = $("html").css("background-color");
  2770. n = Context.TenantBranding.background_color, t.css("background-color", n), $("#background_branding_container").css("background-color", n), $("html").css("background-color", n), Context.TenantBranding.has_background_img && (e.show(), TenantBranding.ShouldFadeInTenantBranding() && e.addClass("slide"), e.css("background-color", n), t.css("z-index", "-1"), t.hide()), Util.debug_console("TenantBranding OnLoadImage: Background was resized.")
  2771. }
  2772. },
  2773. onLoadImageError: function() {
  2774. TenantBranding.IsShowingDynamicBranding() && (Context.TenantBranding.has_background_img = !1)
  2775. },
  2776. onLoadLogo: function() {
  2777. var e = $("#login_workload_logo_image");
  2778. Util.debug_console("onLoadLogo: Called"), !Logo.logo_image_loaded && User.IsImageLoaded(e) && TenantBranding.onLoadLogoHelper()
  2779. },
  2780. onLoadErrorLogo: function() {
  2781. if (!Logo.logo_image_loaded) {
  2782. User.UpdateLogo("", Constants.DEFAULT_LOGO_ALT);
  2783. var e = $(".workload_img_old");
  2784. e.hide(), e.remove(), Logo.logo_image_loaded = !0, Instrument.logo_image_error = !0
  2785. }
  2786. },
  2787. RestoreDefaultPageBranding: function() {
  2788. "undefined" != typeof Constants.DEFAULT_BRANDING ? Context.TenantBranding.applied && Context.TenantBranding.key == Constants.DEFAULT_BRANDING || TenantBranding.GetBrandingInfo(Constants.DEFAULT_BRANDING) : TenantBranding.RemoveTenantBrandingAndApplyWorkload()
  2789. }
  2790. };
  2791. var TenantBranding = MSLogin.TenantBranding;
  2792. $Do.register("TenantBranding", 0, !0);
  2793. var users = null;
  2794. MSLogin.Tiles = {
  2795. tile_showing_user_cred: !0,
  2796. users: null,
  2797. cred_length_resized: !1,
  2798. showUser: function(e, t, n, o) {
  2799. Tiles.tile_showing_user_cred || ($("#login_user_chooser table").hide(), $(".login_cta_container").css("visibility", "visible"), $("#login_cta_text").show(), $("#tiles_cta_text").hide(), Tiles.updateFirstUserTile(e, t, n), $("#login_user_chooser table:first").show(), $.each(users, function(a, i) {
  2800. i.login.toLowerCase() != e.toLowerCase() || i.isLive !== t && i.domainHint !== n || ("" != i.authUrl || "" != i.domainHint && "undefined" != typeof i.domainHint ? Tiles.showFederatedTileUser(i) : Tiles.showManagedTileUser(i, o))
  2801. }), Context.back_action_stack.AddAction(Constants.CancelAction.FROM_SHOW_USER_TO_TILES), Tiles.tile_showing_user_cred = !0)
  2802. },
  2803. hideDisambiguationScreen: function() {
  2804. $("#cred_kmsi_container").show(), $("#cred_sign_in_button").show(), User.tryShowCancelButton(), $("#recover_container").show(), $("#alternative-identity-providers").show(), $("#disambig-container").hide(), $("#login-splitter-control").hide(), $("#login_user_chooser").empty(), $(".login_user_chooser").hide(), $("#login_user_chooser").hide(), $("#create_msa_account_container").hide()
  2805. },
  2806. showUserLoginPage: function() {
  2807. $(".login_user_chooser").show(), $("#cta_error_message_text").show(), $("div.progress").css("visibility", "hidden"), clearInterval(Context.animationTid), Support.hideClientErrorMessages(), Support.hideClientMessages(), Context.username_state.home_realm_state = Constants.State.NONE, Context.username_state.last_checked_email = Context.username_state.last_checked_email || "", $(".cta_message_text").show(), $("#cred_userid_container").show(), $("#cred_userid_inputtext").show(), $(".login_cred_field_container").show(), $(".login_cred_options_container").show(), $("#cred_userid_inputtext").focus()
  2808. },
  2809. showManagedTileUser: function(e, t) {
  2810. Tiles.disableActiveTile(), Context.post_from_tile = !0, $(".login_cred_container").show(), $(".login_cred_field_container").show(), $(".login_cred_container li").show(), $("#disambig-container").hide(), $("#signin_legend").hide(), $("#cred_userid_inputtext").val(Util.htmlDecode(e.login)), $("#cred_password_container").show(), $(".login_cred_options_container").show(), Context.username_state.enable_guests = !1, $("#guest_hint_text").hide(), $(".guest_redirect_container").hide(), User.tryShowCancelButton(), Util.EnableEmailDiscoveryIfEBD(), $("#cred_sign_in_button").show(), $("#cred_password_inputtext").focus(), t || User.RefreshDomainState()
  2811. },
  2812. showFederatedTileUser: function(e) {
  2813. Context.username_state.home_realm_state = Constants.State.FEDERATED, Context.post_from_tile = !0, Tiles.disableActiveTile(), $("#cred_userid_inputtext").val(Util.htmlDecode(e.login)), $(".login_cred_field_container").show(), $(".login_cred_options_container").show(), $(".login_cred_options_container div.subtext").hide(), $("#cred_sign_in_button").hide(), $("#forget_tile_container").show(), $("#cred_password_container").hide(), $(".login_cta_container").hide(), $("#recover_container").hide(), $("#redirect_cta_text").show(), $("input#cred_password_inputtext").hide(), $("#redirect_company_name_text").empty(), $("#cred_kmsi_container").show(), $("#alternative-identity-providers").hide(), $("div.progress").css("visibility", "visible"), User.startAnimation(), Context.animationTid = setInterval(User.startAnimation, 3500), Context.username_state.enable_progress_bar = !0, Context.username_state.enable_redirect = !0, Context.username_state.enable_guests = !1, Util.EnableEmailDiscoveryIfEBD(), Util.updateRedirectionMessage(e.authUrl), Context.redirect_auth_url = e.authUrl, User.UsernameOnChangeHandler(), User.StartRedirection(!1)
  2814. },
  2815. disableActiveTile: function() {
  2816. $("#login_user_chooser .tile_link:first .user_tile").addClass("disabled_tile"), $("#login_user_chooser .tile_link:first").addClass("disabled_tile"), $("#login_user_chooser .tile_link:first").attr("tabindex", "-1"), $("#login_user_chooser .tile_link:first tr").css("cursor", "default"), $("#login_user_chooser .tile_link:first td.dots > div").hide(), $("#login_user_chooser .tile_link:first td.dots > div").attr("tabindex", "-1"), $(".tile_primary_name").css("cursor", "default"), $(".tile_secondary_name").css("cursor", "default")
  2817. },
  2818. enableActiveTile: function() {
  2819. $("#login_user_chooser .tile_link:first .user_tile").removeClass("disabled_tile"), $("#login_user_chooser .tile_link:first").removeClass("disabled_tile"), $("#login_user_chooser .tile_link:first").attr("tabindex", "1"), $("#login_user_chooser .tile_link:first tr").css("cursor", "pointer"), $("#login_user_chooser .tile_link:first td.dots > div").show(), $("#login_user_chooser .tile_link:first td.dots > div").attr("tabindex", "2"), $(".tile_primary_name").css("cursor", "pointer"), $(".tile_secondary_name").css("cursor", "pointer")
  2820. },
  2821. showOtherOption: function() {
  2822. if (!Tiles.tile_showing_user_cred) {
  2823. if ($("#alternative-identity-providers").show(), EmailDiscovery.IsTilesModeActivated() || EmailDiscovery.ShouldPerformDiscovery()) return Tiles.tile_showing_user_cred = !0, Context.back_action_stack.AddAction(Constants.CancelAction.FROM_EMAILDISCOVERY_START_TO_TILES), EmailDiscovery.Init(), void $("#cred_userid_inputtext").val("");
  2824. Context.back_action_stack.AddAction(Constants.CancelAction.FROM_SHOW_USER_TO_TILES), Context.username_state.enable_progress_bar = !0, User.UsernameOnChangeHandler(), $(".login_cred_container").show(), $(".login_cred_container .windows_cred_block").show(), $(".login_cred_field_container").addClass("show_other"), $(".login_cred_field_container").show(), $("#cred_userid_container").show(), $("#login_user_chooser").hide(), $(".login_cred_options_container").show(), $(".login_cta_container").css("visibility", "visible"), $("#login_cta_text").show(), $("#tiles_cta_text").hide(), $("#forget_tile_container").hide(), $("#cred_sign_in_button").show(), User.tryShowCancelButton(), $("#cred_keep_me_signed_in_checkbox").removeAttr("checked"), $("#cred_userid_inputtext").val(""), $("#cred_userid_inputtext").focus(), Context.username_state.enable_guests = !0, Tiles.tile_showing_user_cred = !0, Support.renderBrowserSpecific()
  2825. }
  2826. },
  2827. CancelTileRedirect: function() {
  2828. $("#cred_password_inputtext").val(""), Context.username_state.last_checked_email = "", Tiles.enableActiveTile(), $("#cred_password_inputtext").val(""), $("#cta_error_message_text").remove(), $(".login_cred_field_container").removeClass("show_other"), $(".login_cred_field_container").hide(), $(".login_cred_options_container").hide(), $(".login_userid_container").hide(), $(".login_cred_options_container div.subtext").show(), $("#create_msa_account_container").hide(), $("#cred_sign_in_button").show(), $("#cred_kmsi_container").show(), $("#forget_tile_container").show(), User.tryShowCancelButton(), Tiles.tile_showing_user_cred = !1, Support.hideClientErrorMessages(), User.CancelRedirect(), $("#login_user_chooser").empty(), Tiles.drawUsers()
  2829. },
  2830. getStringTileID: function(e, t) {
  2831. var n;
  2832. return void 0 == e.id ? (n = Util.htmlDecode(e.login), n = n.replace(/[@\. '#!]/g, "_"), (e.isLive || "msa" === e.domainHint) && (n += "-live"), t && (n = "use_another_account"), n = n.toLowerCase()) : n = e.id, n
  2833. },
  2834. drawTile: function(e, t, n) {
  2835. var o = e.name,
  2836. a = e.login,
  2837. i = e.name,
  2838. r = e.login,
  2839. s = null,
  2840. d = null,
  2841. _ = e.sessionID ? e.sessionID : "";
  2842. "" === o && "" !== a && (o = a, i = r, a = r = ""), o.toLowerCase() == a.toLowerCase() && (a = r = ""), e.isLive ? (s = Constants.MSA_ACCOUNT_TILE_ALT_TEXT.replace("{0}", o), d = Constants.MSA_ACCOUNT_IMG_ALT_TEXT) : (s = Constants.AAD_ACCOUNT_TILE_ALT_TEXT.replace("{0}", o), d = e.domainHint ? e.domainHint : Constants.AAD_ACCOUNT_IMG_ALT_TEXT);
  2843. var c = void 0 == e.ignore_length || 0 == e.ignore_length;
  2844. (!c || Util.htmlDecode(o).length < Constants.MAX_TILE_TEXT_LENGTH) && (i = ""), (!c || Util.htmlDecode(a).length < 1.6 * Constants.MAX_TILE_TEXT_LENGTH) && (r = "");
  2845. var l = !1,
  2846. u = "",
  2847. g = "",
  2848. m = null;
  2849. $("meta[name=PageID]").attr("content").indexOf("reauth") >= 0 ? (l = !0, u = "<div/>", g = "alt") : e.isWindows ? (u = "<a />", g = "href", m = e.sessionID && e.isSigned ? function() {
  2850. Util.SetRoutingCookie(Util.htmlDecode(e.login));
  2851. var t = Constants.BASE_URL + $.param({
  2852. sessionId: e.sessionID,
  2853. ctx: Constants.CONTEXT
  2854. });
  2855. User.Redirect(t)
  2856. } : function() {
  2857. Util.SetRoutingCookie(Util.htmlDecode(e.login)), window.WindowsBrowserSso.LoginWindowsUser(e.link, Tiles.getStringTileID(e, !1))
  2858. }) : Context.email_discovery_mode ? (u = "<a/>", g = "href", m = e.isLive ? function() {
  2859. Context.email_discovery_easi_user = !0, Instrument.email_discovery_splitter_choice = EmailDiscovery.WorkflowStates.MSA, EmailDiscovery.LoginMSOAccount()
  2860. } : function() {
  2861. Instrument.email_discovery_splitter_choice = EmailDiscovery.WorkflowStates.AAD, EmailDiscovery.LoginAADAccount()
  2862. }, s = e.name, d = e.name) : "other" == e.link ? (u = "<a/>", g = "href", m = Tiles.showOtherOption, s = e.name, d = e.name) : e.isSigned ? (u = "<a />", g = "href", m = Constants.IS_MSA_FED_SUPPORTED && e.isLive && !Constants.IS_LOGOUT_REQUEST ? User.GetRedirectAction(Constants.MSA_AUTH_URL, Constants.appRedirectUrl, Constants.msaRedirErrorParams, Util.htmlDecode(e.login)) : function() {
  2863. Util.SetRoutingCookie(Util.htmlDecode(e.login));
  2864. var t = Constants.BASE_URL + $.param({
  2865. sessionId: e.sessionID,
  2866. ctx: Constants.CONTEXT
  2867. });
  2868. User.Redirect(t)
  2869. }) : "" != e.link ? (u = "<a/>", g = "href", m = function() {
  2870. Tiles.showUser(e.link, e.isLive, e.domainHint)
  2871. }) : (u = "<div/>", g = "alt");
  2872. var h = "other" == e.link || Context.email_discovery_mode || l || n || !1,
  2873. p = Tiles.getStringTileID(e, h),
  2874. C = this.generateUserTileHtml(Util.htmlEncode(p), _, t, d, o, i, a, r, h ? null : e.isSigned ? e.isWindows ? Constants.CONNECTEDTOWINDOWS : Constants.SIGNEDIN : Constants.CLICKTOSIGNIN, h || e.isWindows || Constants.IS_LOGOUT_REQUEST ? null : e.isSigned ? "signedin" : "signedout", e.isWindows, e.login);
  2875. return $("#login_user_chooser").append($(u).attr("id", p + "_link").attr("data-session-id", _).attr(g, "#").addClass("tile_link").addClass("tooltip").click(m).append(C)), $("#" + p + "_link").each(function(e, t) {
  2876. t.setAttribute("aria-label", Util.htmlDecode(s))
  2877. }), $("#" + p + "_menulink").keydown(function(e) {
  2878. var t = $(this).attr("data-ref"),
  2879. n = $("#" + t + "-dropdown");
  2880. switch (e.which) {
  2881. case 32:
  2882. case 13:
  2883. $(this).click(), e.preventDefault();
  2884. break;
  2885. case 27:
  2886. n.hide()
  2887. }
  2888. }).click(function(e) {
  2889. e.preventDefault(), e.stopPropagation();
  2890. var t = $(this).attr("data-ref"),
  2891. n = $(this).attr("data-session-id"),
  2892. o = $("#" + t + "-dropdown"),
  2893. a = $(".dropdownPanel");
  2894. if (o.is(":visible")) a.hide();
  2895. else {
  2896. var i = $(this).position();
  2897. i && (a.hide(), o.removeClass("hidden").removeAttr("aria-hidden").css({
  2898. left: i.left - o.width() + 20 + "px",
  2899. top: i.top + 15 + "px"
  2900. }).show(), o.find("li").removeAttr("aria-hidden").attr("data-session-id", n).attr("tabindex", "3").show(), $("#login_panel").one("click", function() {
  2901. a.hide()
  2902. }))
  2903. }
  2904. }), p + "_link"
  2905. },
  2906. drawUsers: function() {
  2907. Tiles.users || (Tiles.users = users = []), Tiles.users.length > 1 || 1 === Tiles.users.length && "other" != Tiles.users[0].link ? ($(".login_cta_container").css("visibility", "visible"), $("#login_cta_text").hide(), $("#tiles_cta_text").show(), $(".login_cred_container li").hide(), $(".login_cred_container .windows_cred_block").hide(), $("#login_user_chooser").show(), $("#cred_userid_container").hide(), $("#switch_user_container").hide(), Tiles.drawUserTiles()) : Tiles.showOtherOption()
  2908. },
  2909. drawUserTiles: function() {
  2910. Tiles.cred_length_resized = !0;
  2911. var e = "";
  2912. if ($.each(users, function(t, n) {
  2913. e = Tiles.getUserImage(n);
  2914. var o = "";
  2915. if ("other" == n.link || t < Constants.MAX_USER_TILES || Context.email_discovery_mode) {
  2916. var a = !Constants.IS_MSA_FED_SUPPORTED && n.isLive;
  2917. o = Tiles.drawTile(n, e, a)
  2918. }
  2919. "" != o && 0 == t && $("#" + o).focus()
  2920. }), Tiles.tile_showing_user_cred = !1, Context.username_state.enable_guests = !0, !Tiles.cred_length_resized) {
  2921. var t = $(".cred").height();
  2922. t += $(".login_user_chooser").height(), $(".cred").css("min-height", t), Tiles.cred_length_resized = !0
  2923. }
  2924. Support.renderBrowserSpecific(), Context.TenantBranding.cred_height ? $(".cred").css("min-height", Context.TenantBranding.cred_height) : $(".cred").css("min-height", "")
  2925. },
  2926. forgetAccount: function() {
  2927. Tiles.tile_showing_user_cred = !1, $("#forget_tile_container").hide(), $("#cred_keep_me_signed_in_checkbox").removeAttr("checked"), $(".login_cta_container").css("visibility", "visible"), $("#login_cta_text").show(), $("#tiles_cta_text").hide(), Util.eraseCookie("MSPPre"), Tiles.CancelTileRedirect(), Tiles.showOtherOption(), User.tryShowCancelButton()
  2928. },
  2929. forceSignIn: function(e) {
  2930. Tiles.disableActiveTile(), Tiles.tile_showing_user_cred = !1, $("#login_cta_text").show(), $("#tiles_cta_text").hide(), $("#login_user_chooser table").hide(), $("#login_user_chooser table:first").show(), $("#switch_user_container").show();
  2931. var t = null;
  2932. $.each(users, function(n, o) {
  2933. o.login.toLowerCase() != e.toLowerCase() || o.isLive || "undefined" != typeof o.domainHint && "" != o.domainHint || (Tiles.showManagedTileUser(o), t = o)
  2934. }), User.tryShowCancelButton(), $("#forget_tile_container").hide();
  2935. var n = !1;
  2936. null != t && null != t.isLive && Tiles.ApplyToEachSavedUsers(function(o) {
  2937. 0 != o[0].length && o[0].toLowerCase() == e.toLowerCase() && o[1] == (t.isLive ? "1" : "0") && (n = !1)
  2938. }), n ? $("#cred_keep_me_signed_in_checkbox").attr("checked", "checked") : $("#cred_keep_me_signed_in_checkbox").removeAttr("checked"), $(".login_cta_container").show()
  2939. },
  2940. hasUserNameQS: function() {
  2941. var e = Util.ExtractQSParam("username") + Util.ExtractQSParam("login_hint");
  2942. return "" != e
  2943. },
  2944. showUserName: function() {
  2945. var e = Util.ExtractQSParam("username");
  2946. "" == e && (e = Util.ExtractQSParam("login_hint")), e = decodeURIComponent(e);
  2947. var t = null,
  2948. n = !1;
  2949. $.each(Tiles.users, function(o, a) {
  2950. Util.htmlDecode(a.login).toLowerCase() != e.toLowerCase() || n || (n = !0, t = a)
  2951. }), n ? (Tiles.showUser(t.login, t.isLive, t.domainHint), $("#cred_password_inputtext").focus()) : (Tiles.showOtherOption(), $("#cred_userid_inputtext").val(e), $("#cred_userid_inputtext").focus())
  2952. },
  2953. showIsNotMe: function(e, t, n) {
  2954. Tiles.drawUsers(), Tiles.showUser(e, t, n), $(".login_cred_container li").hide(), $("#login_user_chooser").show("slow"), $(".login_cta_container").show(), $(".login_cta_container").css("visibility", "visible"), $(".login_cred_options_container").show(), $(".login_cred_options_container div.subtext").hide(), $("#submit_button").hide(), $("#continue_as_user_container").show(), $("#continue_as_user_link").focus(), $("#switch_user_container").show()
  2955. },
  2956. updateContinueAsUserUrl: function(e) {
  2957. var t = $("#continue_as_user_link").attr("href");
  2958. t = t.replace("post.srf", "secure.srf"), t = t.replace(new RegExp("username=[^\\&]*", "gm"), ""), t.indexOf("msoptin-newui") < 0 && (t += "&msoptin-newui"), $("#continue_as_user_link").attr("href", t), t = Util.ExtractQSParam("ru"), "" != t && (t = e, $("#continue_as_user_link").attr("href", t))
  2959. },
  2960. ApplyToEachSavedUsers: function(e) {
  2961. var t = Util.getCookie(Constants.SAVED_USER_COOKIE),
  2962. n = Constants.SAVED_USER_COOKIE_USER_DELIMITER,
  2963. o = Constants.SAVED_USER_COOKIE_INFO_DELIMITER;
  2964. void 0 != t && null != t && "" != t && $.each(t.split(n), function(t, n) {
  2965. if (void 0 != n && null != n && "" != n) {
  2966. var a = n.split(o);
  2967. 3 == a.length && 0 != a[0].length && e(a)
  2968. }
  2969. })
  2970. },
  2971. getUser: function(e, t, n) {
  2972. e = e.toLowerCase();
  2973. var o = null;
  2974. return $.each(Tiles.users, function(a, i) {
  2975. (i.login.toLowerCase() == e && (i.isLive === t || i.domainHint === n) || i.sessionID == e) && (o = i)
  2976. }), o
  2977. },
  2978. forgetRememberedUser: function(e) {
  2979. var t = $(this).parent().attr("data-session-id");
  2980. Util.SetRoutingCookie($(this).parent().attr("data-upn")), Support.isDefined(t) ? $.ajax({
  2981. headers: {
  2982. Accept: "application/json"
  2983. },
  2984. url: Constants.forgetUrl,
  2985. dataType: "json",
  2986. data: {
  2987. sessionId: encodeURI(t)
  2988. },
  2989. success: function(e) {
  2990. Tiles.UpdateUsers(e)
  2991. },
  2992. error: function(e, t, n) {
  2993. Support.showClientError(n)
  2994. },
  2995. timeout: 2e3
  2996. }) : Util.debug_console("sessionId is not defined"), e.preventDefault()
  2997. },
  2998. indexOfPropValue: function(e, t, n) {
  2999. for (var o = "string" == typeof n ? n.toLowerCase() : n, a = 0; a < e.length; a++) {
  3000. var i = "string" == typeof e[a][t] ? e[a][t].toLowerCase() : e[a][t];
  3001. if (i == o) return a
  3002. }
  3003. return -1
  3004. },
  3005. mergeUsers: function(e, t) {
  3006. e = e.slice(0), t = t.slice(0);
  3007. for (var n = 0; n < e.length; n++) {
  3008. var o = e[n],
  3009. a = Tiles.indexOfPropValue(t, "login", Util.htmlDecode(o.login));
  3010. if (a > -1 && (o.isSigned || (e[n] = t[a]), t.splice(a, 1), 0 == t.length)) break
  3011. }
  3012. return e.concat(t)
  3013. },
  3014. UpdateUsers: function(e) {
  3015. Tiles.sso_users && (e = Tiles.mergeUsers(e, Tiles.sso_users)), Constants.IS_USE_OTHER_ACCOUNT_VISIBLE && e.push(Tiles.otherJSON), Tiles.users = users = e, $("#login_user_chooser").empty(), Tiles.drawUsers()
  3016. },
  3017. signoutAndForgetUser: function(e) {
  3018. e.preventDefault();
  3019. var t = $(this).parent().attr("data-session-id");
  3020. if (Support.isDefined(t)) {
  3021. var n = document.createElement("iframe");
  3022. n.name = "logoutFrame", n.style.display = "none";
  3023. var o = Constants.uxLogoutUrl;
  3024. o = o.upsertQueryStringParam("sessionId", encodeURIComponent(t)), o = o.upsertQueryStringParam("shouldForgetUser", encodeURIComponent(e.data.shouldForgetUser)), n.src = o, Util.SetRoutingCookie($(this).parent().attr("data-upn")), $("#title3_" + t).text(Constants.SIGNINGOUT), $(this).append(n)
  3025. } else Util.debug_console("seesionId is not defined")
  3026. },
  3027. updateFirstUserTile: function(e, t, n) {
  3028. $("input#cred_userid_inputtext").val(Util.htmlDecode(e)), $("#login_user_chooser").empty();
  3029. var o = Tiles.getUser(e, t, n),
  3030. a = Tiles.getUserImage(o),
  3031. i = Tiles.drawTile(o, a, !0);
  3032. $("#" + i).focus()
  3033. },
  3034. getUserImage: function(e) {
  3035. var t = "work_account.png";
  3036. return t = e.domainHint && !Constants.IS_CXH_REQUEST ? -1 != $.inArray(e.domainHint, ["amazon", "facebook", "google", "instagram", "linkedin", "qq", "renren", "twitter", "weibo", "yahoo"]) ? e.domainHint + "_80.png" : "msa" === e.domainHint ? "personal_account.png" : "use_another_account.png" : "other" === e.link ? "use_another_account.png" : e.isLive ? "personal_account.png" : "work_account.png", Constants.CDN_IMAGE_PATH + t
  3037. },
  3038. generateUserTileHtml: function(e, t, n, o, a, i, r, s, d, _, c, l) {
  3039. var u = "";
  3040. null != d ? u = ' <div class="smallertext tile_third_name windows_tile_text text-caption2 {0}" style="cursor: pointer" id="title3_{1}"> {2} </div>'.format(e, t, d) : Context.username_state.last_checked_email && (u = ' <div class="smallertext tile_third_name windows_tile_text text-caption2 {0}" style="cursor: pointer"> {1} </div>'.format(e, Context.username_state.last_checked_email));
  3041. var g = "";
  3042. null != _ && (g = (' <td class="dots" rowspan="2"> <div id="{0}_menulink" tabindex="0" data-ref="{2}" data-session-id="{1}" data-upn="{3}" title="' + Constants.CLICKFORMORE + '" aria-label="' + Constants.CLICKFORMORE + '"> &bull;&bull;&bull; </div> </td>').format(e, t, _, l));
  3043. var m = "";
  3044. c && (m = ' <div class="progress"> <div class="pip"></div> <div class="pip"></div> <div class="pip"></div> <div class="pip"></div> <div class="pip"></div> </div>');
  3045. var h = ('<table id="{0}" data-session-id="{1}" class="user_tile"> <tr> <td> <table> <tr> <td colspan="2">' + m + " </td>" + g + ' </tr> <tr class="{0} {1}" style="cursor: pointer"> <td> <img class="ad_glyph {0}" src="{2}" alt="{3}" /> </td> <td class="tile_name tile_name_padding"> <div class="bigtext tile_primary_name windows_tile_text wrap {0}" style="cursor: pointer" {5}> {4} </div> <div class="smallertext tile_secondary_name windows_tile_text text-caption2 {0}" style="cursor: pointer" {7}> {6} </div>' + u + " </td> </tr> </table> </td> </tr></table>").format(e, t, n, o, a, i ? 'title="' + i + '"' : "", r, s ? 'title="' + s + '"' : "");
  3046. return h
  3047. }
  3048. };
  3049. var Tiles = MSLogin.Tiles;
  3050. ! function() {
  3051. var e = window,
  3052. t = e.$Config,
  3053. n = e.MSLogin || {};
  3054. n.Util = {
  3055. HoloNavigationStack: [],
  3056. PrefetchContent: function(e) {
  3057. $("#login_prefetch_container").append($("<iframe/>").attr("src", e).attr("seamless", "seamless").attr("scrolling", "no").attr("id", "login_prefetch_iframe").load(function() {
  3058. Instrument.prefetch_load_time = new Date - Instrument.prefetch_start, Instrument.prefetch_done = !0
  3059. }))
  3060. },
  3061. CookieSafeRegex: /^[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]+$/,
  3062. IsCookieSafeValue: function(e) {
  3063. return Util.CookieSafeRegex.test(e)
  3064. },
  3065. SetRoutingCookie: function(e) {
  3066. Constants.USER_ROUTING_COOKIE && Util.IsCookieSafeValue(e) && (document.cookie = Constants.USER_ROUTING_COOKIE + "=" + e + ";path=" + (Constants.USER_ROUTING_COOKIE_PATH || "/") + ";domain=" + document.location.hostname + ("undefined" != typeof Constants.SET_COOKIE_SUFFIX ? Constants.SET_COOKIE_SUFFIX : ";secure"))
  3067. },
  3068. getCookie: function(e, t) {
  3069. var n, o, a, i = document.cookie.split(";");
  3070. for (n = 0; n < i.length; n++)
  3071. if (o = i[n].substr(0, i[n].indexOf("=")), a = i[n].substr(i[n].indexOf("=") + 1), o = o.replace(/^\s+|\s+$/g, ""), o == e) return (t || window.unescape)(a)
  3072. },
  3073. setCookieWithExpiration: function(e, t, n, o) {
  3074. var a = ";secure";
  3075. "undefined" != typeof Constants && "undefined" != typeof Constants.SET_COOKIE_SUFFIX && (a = Constants.SET_COOKIE_SUFFIX);
  3076. var i = t + (o ? ";domain=" + o : "") + ";path=/" + (n ? ";expires=" + n.toUTCString() : "") + a;
  3077. document.cookie = e + "=" + i
  3078. },
  3079. setCookie: function(e, t, n) {
  3080. var o = new Date;
  3081. o.setDate(o.getDate() + n);
  3082. var a = document.location.hostname.split("."),
  3083. i = a.length,
  3084. r = "." + a[i - 2] + "." + a[i - 1];
  3085. Util.setCookieWithExpiration(e, t, o, r)
  3086. },
  3087. eraseCookie: function(e) {
  3088. var t = document.location.hostname.split("."),
  3089. n = t.length,
  3090. o = e + "= ;domain=." + t[n - 2] + "." + t[n - 1] + ";path=/;expires=Thu, 30-Oct-1980 00:00:01 GMT;";
  3091. Util.debug_console(o), document.cookie = o, o = e + "= ;domain=." + document.location.hostname + ";path=/;expires=Thu, 30-Oct-1980 00:00:01 GMT;", Util.debug_console(o), document.cookie = o
  3092. },
  3093. exists: function(e) {
  3094. return e ? !0 : 0 == e || 0 == e || "" == e
  3095. },
  3096. valOrDefault: function(e, t) {
  3097. return Util.exists(e) ? e : t
  3098. },
  3099. debug_console: function() {},
  3100. ExtractToken: function(e, t, n, o, a) {
  3101. n = Util.valOrDefault(n, "&"), o = Util.valOrDefault(o, "=");
  3102. var i = Util.valOrDefault(a, null);
  3103. if (!e) return i;
  3104. var r = e.indexOf(t + o);
  3105. if (0 == r ? r += t.length + 1 : r > 0 && (r = e.indexOf(n + t + o), r > 0 && (r += n.length + t.length + 1)), -1 != r) {
  3106. var s = e.indexOf(n, r); - 1 == s && (s = e.length), i = e.substring(r, s)
  3107. }
  3108. return i
  3109. },
  3110. ExtractQSParam: function(e) {
  3111. var t = Context.query_search_params.toLowerCase();
  3112. return t && (t = t.substr(1)), Util.ExtractToken(t, e.toLowerCase(), "&", "=", "")
  3113. },
  3114. AddQSParamIfNotExists: function(e, t, n) {
  3115. var o = "[?&]" + t + "=([^&]+?)($|&)",
  3116. a = new RegExp(o, "i"),
  3117. i = e.match(a);
  3118. if (!i) {
  3119. var r = "([?&])" + t + "=?(&|$)",
  3120. s = new RegExp(r, "i");
  3121. e = e.replace(s, "$1");
  3122. var d = Util.ExtractQSParam(t);
  3123. !d || n && !n.test(d) || (-1 == e.indexOf("?") ? e += "?" : e.indexOf("?") < e.length - 1 && (e += "&"), e += t + "=" + d)
  3124. }
  3125. return e
  3126. },
  3127. appendQueryString: function(e, t) {
  3128. var n = -1 === e.indexOf("?") ? "?" : "&";
  3129. return e + n + t
  3130. },
  3131. isMSA: function(e) {
  3132. return !e || -1 == e.indexOf("login.live.com") && -1 == e.indexOf("login.live-int.com") && -1 == e.indexOf("login.microsoft.com") && -1 == e.indexOf("/MockLiveINT/") ? !1 : !0
  3133. },
  3134. supportCookies: function() {
  3135. var e = null;
  3136. switch (t.isCorpnet && (e = Util.ExtractQSParam("testcookie")), e) {
  3137. case "0":
  3138. return !1;
  3139. case "1":
  3140. return !0;
  3141. default:
  3142. return document.cookie = "testcookie=testcookie", -1 != document.cookie.indexOf("testcookie=testcookie") ? !0 : !1
  3143. }
  3144. },
  3145. updateRedirectionMessage: function(e, t) {
  3146. var n;
  3147. t ? (n = Constants.REDIRECT_MESSAGES.CLOUDFEDERATED, $("#alternative-identity-providers").hide()) : Util.isMSA(e) ? n = Constants.REDIRECT_MESSAGES.MSA : (n = Constants.REDIRECT_MESSAGES.AAD, $("#alternative-identity-providers").hide()), $("#redirect_message_text").text(n)
  3148. },
  3149. htmlEncode: function(e) {
  3150. return $("<span/>").text(e).html()
  3151. },
  3152. htmlDecode: function(e) {
  3153. return $("<span/>").html(e).text()
  3154. },
  3155. now: function() {
  3156. var e = window.performance || {};
  3157. return e.now = function() {
  3158. return e.now || e.webkitNow || e.msNow || e.oNow || e.mozNow || function() {
  3159. return (new Date).getTime()
  3160. }
  3161. }(), e.now()
  3162. },
  3163. StartLocalAccountCxhFlow: function() {
  3164. try {
  3165. var e = new CloudExperienceHost.Bridge;
  3166. return e.fireEvent(CloudExperienceHost.Events.loadIdentityProvider, CloudExperienceHost.SignInIdentityProviders.Local), !1
  3167. } catch (t) {}
  3168. return !0
  3169. },
  3170. CancelCxhFlow: function() {
  3171. try {
  3172. var e = new CloudExperienceHost.Bridge;
  3173. return e.fireEvent(CloudExperienceHost.Events.done, CloudExperienceHost.AppResult.cancel), !1
  3174. } catch (t) {}
  3175. return !0
  3176. },
  3177. SetCxhOnBackAction: function(e) {
  3178. try {
  3179. var t = new CloudExperienceHost.Bridge;
  3180. t.addEventListener("CloudExperienceHost.backButtonClicked", e), t.invoke("CloudExperienceHost.setShowBackButton", !0)
  3181. } catch (n) {}
  3182. },
  3183. OnBack: function() {
  3184. var e = Util.HoloNavigationStack;
  3185. return e.pop(), e[e.length - 1].show && e[e.length - 1].show(), !1
  3186. },
  3187. NavigateCxh: function(e) {
  3188. try {
  3189. var t = new CloudExperienceHost.Bridge;
  3190. return t.fireEvent(CloudExperienceHost.Events.navigate, e), !1
  3191. } catch (n) {}
  3192. return !0
  3193. },
  3194. LogCxhTelemetry: function(e, t) {
  3195. try {
  3196. var n = new CloudExperienceHost.Bridge;
  3197. void 0 == t ? n.invoke("CloudExperienceHost.Telemetry.logEvent", e) : n.invoke("CloudExperienceHost.Telemetry.logEvent", e, t)
  3198. } catch (o) {}
  3199. },
  3200. EnableEmailDiscoveryIfEBD: function() {
  3201. ("EmailBasedDiscovery.2.0" == $("meta[name=PageID]").attr("content") || "EmailBasedDiscoveryTiles.2.0" == $("meta[name=PageID]").attr("content")) && ($("#cred_keep_me_signed_in_checkbox").removeAttr("checked"), EmailDiscovery.is_enabled_workflow = !0)
  3202. }
  3203. }, e.Util = n.Util, $Do.register("MSLogin.Util", 0, !0)
  3204. }(),
  3205. function() {
  3206. MSLogin.BrowserCore = {
  3207. BrowserCoreProvider: function(e) {
  3208. this.extensionId = e
  3209. },
  3210. Error: function(e, t, n) {
  3211. this.code = e, this.description = t, this.ext = n
  3212. },
  3213. CreateProviderAsync: function(e, t) {
  3214. var n = document.createElement("div");
  3215. n.id = this._channelElementId, n.style = "display:none", document.body.appendChild(n), window.postMessage({
  3216. channel: this._channel,
  3217. responseId: this._resp(e, t),
  3218. body: {
  3219. method: "CreateProviderAsync"
  3220. }
  3221. }, "*")
  3222. },
  3223. _resp: function(e, t) {
  3224. return this._msgid++, this._respMap[this._msgid] = {
  3225. success: e,
  3226. fail: t
  3227. }, this._msgid
  3228. },
  3229. _resolveResponse: function(e) {
  3230. var t = this._respMap[e];
  3231. return delete this._respMap[e], t
  3232. },
  3233. _onChannelMessage: function(e) {
  3234. try {
  3235. var t = this,
  3236. n = e.body.method;
  3237. "CreateProviderAsync" === n ? setTimeout(function() {
  3238. t._onCreateProviderAsync(e)
  3239. }, 0) : "Response" === n && t._onExtensionResponse(e)
  3240. } catch (o) {
  3241. throw console.log("Page: Exception in the channel: " + o.toString()), o
  3242. }
  3243. },
  3244. _onExtensionResponse: function(e) {
  3245. var t = this._resolveResponse(e.responseId);
  3246. if (t) try {
  3247. var n = e.body.response;
  3248. "Success" === n.status ? t.success(n.result) : t.fail(new MSLogin.BrowserCore.Error(n.code, n.description, n.ext))
  3249. } catch (o) {
  3250. throw console.log("Page: Fail to deliver response: " + o.toString()), o
  3251. }
  3252. },
  3253. _onCreateProviderAsync: function(e) {
  3254. var t = this._resolveResponse(e.responseId);
  3255. if (t) try {
  3256. var n = this._channelElementId,
  3257. o = document.getElementById(n);
  3258. if (null !== o) {
  3259. var a = o.firstChild,
  3260. i = a ? a.id : null;
  3261. o.remove(), i && "" !== i ? t.success(new MSLogin.BrowserCore.BrowserCoreProvider(i)) : t.fail(new MSLogin.BrowserCore.Error("NoExtension", "Extension is not installed.", null))
  3262. } else t.fail(new MSLogin.BrowserCore.Error("PageException", "Need element with id " + n, null))
  3263. } catch (r) {
  3264. throw console.log("Page: Fail to deliver response: " + r.toString()), r
  3265. }
  3266. },
  3267. _channel: "53ee284d-920a-4b59-9d30-a60315b26836",
  3268. _channelElementId: "ch-53ee284d-920a-4b59-9d30-a60315b26836",
  3269. _respMap: {},
  3270. _msgid: 0
  3271. }, MSLogin.BrowserCore.BrowserCoreProvider.prototype.GetCookieAsync = function(e, t, n) {
  3272. window.postMessage({
  3273. channel: MSLogin.BrowserCore._channel,
  3274. extensionId: this.extensionId,
  3275. responseId: MSLogin.BrowserCore._resp(t, n),
  3276. body: {
  3277. method: "GetCookie",
  3278. uri: e
  3279. }
  3280. }, "*")
  3281. }, MSLogin.BrowserCore.Error.prototype.toString = function() {
  3282. return this.code + ": " + this.description
  3283. }, MSLogin.BrowserCore.Error.Codes = {
  3284. NoExtension: "NoExtension",
  3285. NoSupport: "NoSupport",
  3286. OSError: "OSError",
  3287. PageException: "PageException",
  3288. ContentError: "ContentError"
  3289. }, window.addEventListener && window.addEventListener("message", function(e) {
  3290. e.source == window && e.data.channel && e.data.channel === MSLogin.BrowserCore._channel && MSLogin.BrowserCore._onChannelMessage(e.data)
  3291. }, !1)
  3292. }(), window.WindowsBrowserSso = function(e) {
  3293. function t(e) {
  3294. var t = {
  3295. nonce: e.nonce
  3296. };
  3297. return e.type && (t.type = e.type), t
  3298. }
  3299.  
  3300. function n(e, t) {
  3301. return e && e.reportStates && -1 != e.reportStates.indexOf(t) ? !0 : !1
  3302. }
  3303.  
  3304. function o(e, t) {
  3305. return e && e.redirectEndStates && -1 != e.redirectEndStates.indexOf(t) ? !0 : !1
  3306. }
  3307.  
  3308. function a(a) {
  3309. if (a.message && C(a.message), n(I.telemetry, a.state)) {
  3310. E("result", a.state);
  3311. try {
  3312. $.ajax({
  3313. url: I.telemetry.url.upsertQueryStringParam("client-request-id", S.correlationId),
  3314. data: JSON.stringify(b),
  3315. type: "POST",
  3316. timeout: 500,
  3317. async: !1
  3318. })
  3319. } catch (i) {}
  3320. b = t(I.telemetry)
  3321. }
  3322. if (a.tileId) {
  3323. var r = e.User,
  3324. s = e.Context;
  3325. if (a.state == w.START) {
  3326. var d = $("#" + a.tileId + " .progress");
  3327. d.css("visibility", "visible"), r.startAnimation(d), s.animationTid = setInterval(function() {
  3328. r.startAnimation(d)
  3329. }, 3500)
  3330. } else(a.state == w.END || a.state == w.END_SSO) && (clearInterval(s.animationTid), $("#" + a.tileId + " .progress").css("visibility", "hidden"))
  3331. }
  3332. I.failureRedirectUrl && o(I, a.state) && (O ? m("redirect", function() {
  3333. C("Redirecting from State [" + a.state + "]"), e.location.replace(I.failureRedirectUrl)
  3334. }, 5e3) : (C("Redirecting from State [" + a.state + "]"), setTimeout(function() {
  3335. e.location.replace(I.failureRedirectUrl)
  3336. }, 0)))
  3337. }
  3338.  
  3339. function i() {
  3340. var n = e.Util;
  3341. b = t(T.telemetry), I = T || {
  3342. forceTiles: !1,
  3343. overallTimeoutMs: 4e3
  3344. }, I.initiatePullTimeoutMs = I.initiatePullTimeoutMs || I.overallTimeoutMs, I.initiatePullTimeoutAction = I.initiatePullTimeoutAction || "abort";
  3345. var o = n.ExtractQSParam("bsso").toLowerCase();
  3346. if (o)
  3347. for (var a = e.decodeURIComponent(o).split(";"), i = 0; i < a.length; i++) switch (a[i]) {
  3348. case "debug":
  3349. x = !0;
  3350. break;
  3351. case "test":
  3352. D = !0;
  3353. break;
  3354. case "disable":
  3355. k = !0;
  3356. break;
  3357. case "redirect":
  3358. O = !0
  3359. }
  3360. R = !0
  3361. }
  3362.  
  3363. function r(t, n) {
  3364. if (!e.navigator || !$.isFunction(e.navigator.msLaunchUri) || k) return f(w.START, null, n), E("BSSO.info", k ? "disabled" : "not-supported"), void f(w.END, k ? "Browser SSO is disabled" : "window.navigator.msLaunchUri is not available for LoginWindowsUser", n);
  3365. var o, a = e.Util;
  3366. $.when($.Deferred(function(e) {
  3367. o = g(t, e, "Windows user login", n)
  3368. })).then(function() {
  3369. var e, t = setInterval(function() {
  3370. if (a.getCookie(U.winSso)) {
  3371. clearInterval(t), clearTimeout(e);
  3372. var i = (new Date).getTime() - o;
  3373. E("ESTSSSO.cookie.ms", i), h(n)
  3374. }
  3375. }, 100);
  3376. e = setTimeout(function() {
  3377. clearInterval(t);
  3378. var e = (new Date).getTime() - o;
  3379. E("TB.response.timeout.ms", e), f(w.END, "Windows user login timed out.", n)
  3380. }, I.overallTimeoutMs)
  3381. })
  3382. }
  3383.  
  3384. function s() {
  3385. if (!e.navigator || !$.isFunction(e.navigator.msLaunchUri) || k) return f(w.START, null), E("BSSO.info", k ? "disabled" : "not-supported"), void f(w.END, k ? "Browser SSO is disabled" : "window.navigator.msLaunchUri is not available for pullBrowserSsoCookie");
  3386. var t = e.Util,
  3387. n = t.getCookie(U.ssoTiles) || I.forceTiles;
  3388. if (!n && t.getCookie(U.ssoPulled)) return f(w.START, null), E("BSSO.info", "throttled"), void f(w.END, "Cookie pull throttled");
  3389. var o, a = "tbauth://login.windows.net?context=" + encodeURIComponent(e.location.href.split("/", 3).join("/")) + (I.nonce ? "&request_nonce=" + encodeURIComponent(I.nonce) : "") + (I.rid ? "&rid=" + encodeURIComponent(I.rid) : "");
  3390. $.when($.Deferred(function(e) {
  3391. var i = a;
  3392. n && (i = t.appendQueryString(i, "user_id=*"), t.eraseCookie(U.ssoTiles)), o = g(i, e, "cookie pull")
  3393. })).then(function() {
  3394. var e, n = setInterval(function() {
  3395. var i, r = t.getCookie(U.userList, decodeURIComponent);
  3396. r ? (clearInterval(n), clearTimeout(e), i = (new Date).getTime() - o, E("ESTSUSERLIST.cookie.ms", i), f(w.INPROGRESS, "Users list cookie detected"), t.eraseCookie(U.userList), p(r.replace(/\+/g, " "), a)) : t.getCookie(U.winSso) && (clearInterval(n), clearTimeout(e), i = (new Date).getTime() - o, E("ESTSSSO.cookie.ms", i), h())
  3397. }, 250);
  3398. e = setTimeout(function() {
  3399. clearInterval(n);
  3400. var e = (new Date).getTime() - o;
  3401. E("TB.response.timeout.ms", e), f(w.END, "Pull cookie timed out.")
  3402. }, I.overallTimeoutMs)
  3403. })
  3404. }
  3405.  
  3406. function d() {
  3407. if (k) return f(w.START, null), E("BSSO.info", "disabled"), void f(w.END, "Browser SSO is disabled");
  3408. var t = e.Util;
  3409. return t.getCookie(U.ssoPulled) ? (f(w.START, null), E("BSSO.info", "throttled"), void f(w.END, "Cookie pull throttled")) : void c().then(l).then(u).fail(function(e) {
  3410. var t = e.toString();
  3411. e.ext && (t += " (ext: " + JSON.stringify(e.ext) + ")"), f(w.END, "Error: " + t)
  3412. })
  3413. }
  3414.  
  3415. function _() {
  3416. T.enabled && R && ("windows" == A ? s() : "chrome" == A && d())
  3417. }
  3418.  
  3419. function c() {
  3420. var t = $.Deferred();
  3421. return f(w.INPROGRESS, "Creating provider"), e.MSLogin.BrowserCore.CreateProviderAsync(function(e) {
  3422. t.resolve(e)
  3423. }, function(e) {
  3424. t.reject(e)
  3425. }), t.promise()
  3426. }
  3427.  
  3428. function l(t) {
  3429. var n = $.Deferred();
  3430. return E("extension.id", t.extensionId), f(w.INPROGRESS, "Pulling SSO cookies"), t.GetCookieAsync(e.location.href.upsertQueryStringParam("sso_nonce", I.nonce), function(e) {
  3431. n.resolve(e)
  3432. }, function(e) {
  3433. n.reject(e)
  3434. }), n.promise()
  3435. }
  3436.  
  3437. function u(t) {
  3438. var n = $.Deferred(),
  3439. o = null,
  3440. a = null,
  3441. i = e.Constants;
  3442. if (t && t.response && t.response.length) {
  3443. for (var r = 0, s = t.response.length; s > r; ++r) o = t.response[r].name, a = t.response[r].data, o && a && (a = a.replace("; httponly", ""), "undefined" != typeof i.SET_COOKIE_SUFFIX && -1 === i.SET_COOKIE_SUFFIX.indexOf("secure") && (a = a.replace("; secure", "")), document.cookie = o + "=" + a);
  3444. h(), n.resolve()
  3445. } else {
  3446. var d = e.MSLogin;
  3447. n.reject(new d.BrowserCore.Error(d.BrowserCore.Error.Codes.PageException, "Extension returned no cookies"))
  3448. }
  3449. return n.promise()
  3450. }
  3451.  
  3452. function g(t, n, o, a) {
  3453. f(w.START, "Initiating " + o, a);
  3454. var i, r = (new Date).getTime();
  3455. return e.navigator.msLaunchUri(t, function() {
  3456. clearTimeout(i);
  3457. var e = (new Date).getTime() - r;
  3458. n.resolve(), E("msLaunchUri.success.ms", e), f(w.INPROGRESS, o + " initiated successfully (took " + e + " ms)", a)
  3459. }, function() {
  3460. clearTimeout(i);
  3461. var e = (new Date).getTime() - r,
  3462. t = "pending" === n.state();
  3463. n.reject(), E("msLaunchUri.failure.ms", e), f(t ? w.END : w.INPROGRESS, o + " was NOT initiated successfully (took " + e + " ms)", a)
  3464. }), i = setTimeout(function() {
  3465. clearTimeout(i), "pending" === n.state() && ("abort" == I.initiatePullTimeoutAction ? (n.reject(), E("msLaunchUri.response", "timeout"), f(w.END, "Initiating " + o + " timed out.", a)) : (n.resolve(), E("msLaunchUri.response", "timeout-continue"), f(w.INPROGRESS, "Initiating " + o + " timed out but starting polling anyway in case cookie was pulled.", a)))
  3466. }, I.initiatePullTimeoutMs), r
  3467. }
  3468.  
  3469. function m(e, t, n) {
  3470. var o = y[e];
  3471. o || (o = [], y[e] = o);
  3472. var a = {
  3473. timeoutId: null,
  3474. trigger: function() {
  3475. var n = this,
  3476. a = !1,
  3477. i = !1;
  3478. n.timeoutId && (clearTimeout(n.timeoutId), n.timeoutId = null, a = !0);
  3479. for (var r = 0; r < o.length; r++)
  3480. if (o[r] == n) {
  3481. o.splice(r, 1), i = !0;
  3482. break
  3483. }
  3484. C("Triggering [" + e + "] callback. Timeout Cleared:" + a + ", Removed: " + i), t()
  3485. }
  3486. };
  3487. !D && n ? (a.timeoutId = setTimeout(a.trigger, 5e3), C("Test callback added [" + e + "] with 5 sec timeout")) : C("Test callback added [" + e + "]"), o.push(a)
  3488. }
  3489.  
  3490. function h(t) {
  3491. var n = e.Util,
  3492. o = new Date;
  3493. o.setSeconds(o.getSeconds() + 60), x ? (f(w.END_SSO, "SSO cookie detected. Refreshing page in 5 seconds (due to debug mode).", t), m("reload", function() {
  3494. n.setCookieWithExpiration(U.ssoPulled, "1", o), -1 == e.location.href.toLowerCase().indexOf("prompt=select_account") ? e.location.reload(!0) : e.location.replace(e.location.href.replace(/prompt=[^&]*/i, ""))
  3495. }, 5e3)) : (f(w.END_SSO, "SSO cookie detected. Refreshing page.", t), n.setCookieWithExpiration(U.ssoPulled, "1", o), -1 == e.location.href.toLowerCase().indexOf("prompt=select_account") ? setTimeout(function() {
  3496. e.location.reload(!0)
  3497. }, 0) : setTimeout(function() {
  3498. e.location.replace(e.location.href.replace(/prompt=[^&]*/i, ""))
  3499. }, 0))
  3500. }
  3501.  
  3502. function p(t, n) {
  3503. var o = e.Tiles,
  3504. a = e.Constants,
  3505. i = e.Context;
  3506. try {
  3507. if (o.users || (o.users = []), o.sso_users = [], $.each($.parseJSON(t).users, function(e, t) {
  3508. var a = {
  3509. name: t.display_name || "",
  3510. login: t.upn,
  3511. imageAAD: "work_account.png",
  3512. imageMSA: "personal_account.png",
  3513. isLive: !1,
  3514. isWindows: !0,
  3515. isSigned: !0,
  3516. link: n,
  3517. authUrl: "",
  3518. sessionID: "",
  3519. domainHint: ""
  3520. };
  3521. o.sso_users.push(a)
  3522. }), o.sso_users.length > 0) {
  3523. var r = i.email_discovery_mode;
  3524. i.email_discovery_mode = !1, a.IS_USE_OTHER_ACCOUNT_VISIBLE && o.users.splice(o.users.length - 1, 1), o.UpdateUsers(o.users), i.email_discovery_mode = r, f(w.END_USERS, "User list processed.")
  3525. } else f(w.END, "User list is empty.")
  3526. } catch (s) {
  3527. E("BSSO.exception", "processUsersList"), f(w.END, "processUsersList: exception: " + s)
  3528. }
  3529. }
  3530.  
  3531. function C(e) {
  3532. L.push(e), e && (b.traces = b.traces || [], b.traces.push(e))
  3533. }
  3534.  
  3535. function f(e, t, n) {
  3536. try {
  3537. a({
  3538. state: e,
  3539. message: t,
  3540. tileId: n
  3541. })
  3542. } catch (o) {
  3543. E("BSSO.exception", "updateStatus")
  3544. }
  3545. }
  3546.  
  3547. function E(e, t) {
  3548. b && (b.data = (b.data || "") + e + "=" + t + ";")
  3549. }
  3550. var S = e.$Config || {},
  3551. T = S.bsso || {},
  3552. v = e.$Do,
  3553. A = T.type,
  3554. w = T.states || {},
  3555. I = null,
  3556. b = null,
  3557. x = !1,
  3558. D = !1,
  3559. k = !1,
  3560. O = !1,
  3561. U = T.cookieNames,
  3562. R = !1,
  3563. y = {};
  3564. if (!T.enabled) return null;
  3565. var L = [];
  3566. v.when("doc.ready", function() {
  3567. i(T), _()
  3568. });
  3569. var M = {
  3570. LoginWindowsUser: function(e, t) {
  3571. r(e, t)
  3572. },
  3573. PullBrowserSsoCookie: function() {
  3574. _()
  3575. },
  3576. getLog: function() {
  3577. return L
  3578. },
  3579. isEnabled: function() {
  3580. return T.enabled && R || !1
  3581. }
  3582. };
  3583. return S.isOneBox && (M.triggerTestHook = function(e) {
  3584. var t = y[e];
  3585. return t && t.length > 0 ? (C("Manually triggering [" + e + "] callback"), t[0].trigger(), !0) : !1
  3586. }), M
  3587. }(window);
  3588. var proxy = function(e, t) {
  3589. "use strict";
  3590.  
  3591. function n() {
  3592. return e.tiles
  3593. }
  3594.  
  3595. function o() {
  3596. return !n()
  3597. }
  3598.  
  3599. function a(e) {
  3600. p++, p > S.onPremPasswordValidationConfig.maxPolls ? s({
  3601. statusText: "timeout"
  3602. }) : (u = e, $Do.when("$Api", function() {
  3603. t.$Api.Json(S.onPremPasswordValidationConfig.pollUrl, e, i, r, S.onPremPasswordValidationConfig.timeout)
  3604. }))
  3605. }
  3606.  
  3607. function i(e) {
  3608. e ? (f = 0, C = null, e.isJobPending ? t.setTimeout(function() {
  3609. a({
  3610. FlowToken: e.flowToken,
  3611. Ctx: e.ctx
  3612. })
  3613. }, S.onPremPasswordValidationConfig.pollingInterval) : _(e)) : r()
  3614. }
  3615.  
  3616. function r(e) {
  3617. C || (C = e), f++, f > S.onPremPasswordValidationConfig.maxPollsOnError || p > S.onPremPasswordValidationConfig.maxPolls ? s(C) : a(u)
  3618. }
  3619.  
  3620. function s(e) {
  3621. o() && ($("#redirect_cta_text").hide(), $("#redirect_dots_animation").hide(), $("#redirect_dots_animation").css("visibility", "hidden"), clearInterval(E), c(!0)), p = 0, d(e)
  3622. }
  3623.  
  3624. function d(o) {
  3625. var a;
  3626. a = t.GetString(o && "timeout" === o.statusText ? "OnPremPasswordValidation.TimeoutErrorMessage" : "OnPremPasswordValidation.GenericErrorMessage"), n() ? e.tiles.switchToLoginViewOnError(a) : $("#cta_client_error_text").text(a).show()
  3627. }
  3628.  
  3629. function _(e) {
  3630. $('#endonpremvalidation input[name="flowtoken"]').val(e.flowToken), $('#endonpremvalidation input[name="ctx"]').val(e.ctx), $("#endonpremvalidation").submit()
  3631. }
  3632.  
  3633. function c(e) {
  3634. e ? (g.show(), m && $("#cred_cancel_button").show()) : (g.hide(), m && $("#cred_cancel_button").hide(), $("#cred_continue_button").hide())
  3635. }
  3636.  
  3637. function l(e, t) {
  3638. var n = $('#credentials input[name="lrt"]'),
  3639. o = t && (t.is_lrt || t.result && t.result.is_lrt);
  3640. o && 0 === n.length && (n = $('<input type="hidden" name="lrt" value="true" />').appendTo("#credentials")), n.val(o ? "true" : "false")
  3641. }
  3642. var u, g, m, h = e.MSOnPremPasswordValidation = e.MSOnPremPasswordValidation || {},
  3643. p = 0,
  3644. C = null,
  3645. f = 0,
  3646. E = null,
  3647. S = t.$Config.constants || t.Constants;
  3648. return h.registerUserRealmDiscoveryListeners = function() {
  3649. o() ? t.User.RegisterOnUserDomainHintChanged(l) : $(e).on("BrandedUserLoaded", l)
  3650. }, h.startPolling = function() {
  3651. o() ? (g = $("#cred_userid_container,#cred_password_container,.login_cta_container,#recover_container,input#cred_password_inputtext,#cred_sign_in_button,#cred_kmsi_container"), m = $("#cred_cancel_button").is(":visible"), c(!1), $("#redirect_cta_text").text(t.GetString("OnPremPasswordValidation.AuthenticatingMessage")), $("#redirect_cta_text").show(), $("#redirect_dots_animation").show(), $("#redirect_dots_animation").css("visibility", "visible"), t.User.startAnimation(), E = setInterval(t.User.startAnimation, 3500)) : $("#redirect-message-text-pta").text(t.GetString("OnPremPasswordValidation.AuthenticatingMessage"));
  3652. var e = {
  3653. flowToken: S.onPremPasswordValidationConfig.flowToken,
  3654. ctx: S.CONTEXT
  3655. };
  3656. a(e)
  3657. }, $Do.register("Proxy.MSOnPremPasswordValidation", 0, !0), e
  3658. }(proxy || {}, window);
  3659. /**
  3660. * @preserve Copyright 2016 (C) Microsoft Corporation. All rights reserved.
  3661. */
  3662. $Do.when("jQuery", function() {
  3663. var e = window;
  3664. e.proxy = function(t, n, o) {
  3665. "use strict";
  3666.  
  3667. function a(n) {
  3668. M.push(n), t.utilities && t.utilities.logToConsole ? t.utilities.logToConsole(n) : e.Util && e.Util.debug_console && e.Util.debug_console(n)
  3669. }
  3670.  
  3671. function i(t) {
  3672. var n = {
  3673. resultCode: t,
  3674. ssoDelay: N,
  3675. log: ""
  3676. };
  3677. 0 !== t && (n.log = M.join("\n")), e.$Api.Json(o.urls.instr.dssostatus, n)
  3678. }
  3679.  
  3680. function r(e) {
  3681. return k.iwaEndpointUrlFormat.format(e)
  3682. }
  3683.  
  3684. function s(e, t) {
  3685. return -1 !== e.indexOf("?") ? e + "&" + t : e + "?" + t
  3686. }
  3687.  
  3688. function d(e) {
  3689. var t = document.createElement("a");
  3690. return t.href = e, t.protocol + "//" + t.host
  3691. }
  3692.  
  3693. function _(e) {
  3694. a("Submitting DesktopSSO auth token..."), P = !1, i(0), n("#dssoToken").val(e), n("#credentials").submit()
  3695. }
  3696.  
  3697. function c(e) {
  3698. a("Integrated Windows Authentication failed."), i(e), n("#dssoToken").val(""), l()
  3699. }
  3700.  
  3701. function l() {
  3702. P && (x() ? (n("#redirect_cta_text").hide(), n("#redirect_dots_animation").hide(), clearInterval(L), $(!0)) : t.tiles.switchToLoginView(), P = !1)
  3703. }
  3704.  
  3705. function u(e) {
  3706. a("IFrame listener called.");
  3707. var t = d(y);
  3708. if (-1 !== t.indexOf(":443") && (t = t.replace(":443", "")), t.toLowerCase() !== e.originalEvent.origin) return a("FrameListener: event origin not valid."), void i(5);
  3709. var n = {};
  3710. try {
  3711. n = JSON.parse(e.originalEvent.data)
  3712. } catch (o) {
  3713. return a("FrameListener: invalid response: " + o), void c(6)
  3714. }
  3715. if (n.messageType === B || (a("FrameListener: messageType was not of the expected value."), void 0 !== n.ssoDelay && void 0 !== n.resultCode && void 0 !== n.message)) {
  3716. var r = parseInt(n.ssoDelay, 10);
  3717. isNaN(r) || (N = n.ssoDelay), 100 == n.resultCode ? _(n.message) : (a("FrameListener: Frame returned code " + n.resultCode + " with message " + n.message), c(n.resultCode))
  3718. }
  3719. }
  3720.  
  3721. function g() {
  3722. var e = (new Date).getTime();
  3723. n.ajax({
  3724. url: y,
  3725. type: "GET",
  3726. dataType: "text",
  3727. cache: !1,
  3728. xhrFields: {
  3729. withCredentials: !0
  3730. },
  3731. timeout: k.iwaRequestTimeoutInMs
  3732. }).done(function(t, n, o) {
  3733. N = (new Date).getTime() - e, 200 === o.status ? _(t) : (a("attemptSsoLoginDirect finished with non-success status " + o.status), c(3))
  3734. }).fail(function(t) {
  3735. N = (new Date).getTime() - e, a("attemptSsoLoginDirect failed with status " + t.status), c(4)
  3736. })
  3737. }
  3738.  
  3739. function m() {
  3740. return o.browser.Chrome ? (a("Detected Browser: Chrome"), !0) : !1
  3741. }
  3742.  
  3743. function h() {
  3744. return o.browser._WinPh ? (a("Detected Browser: WindowsPhone"), !1) : o.browser.IE && null !== o.browser.b && o.browser.b.major >= 10 ? (a("Detected Browser: IE10+"), !0) : !1
  3745. }
  3746.  
  3747. function p() {
  3748. return o.browser.Firefox ? (a("Detected Browser: Firefox"), !0) : !1
  3749. }
  3750.  
  3751. function C() {
  3752. return o.browser.PhantomJS ? (a("Detected Browser: PhantomJS"), !0) : !1
  3753. }
  3754.  
  3755. function f() {
  3756. return o.browser.Edge ? (a("Detected Browser: Edge"), !0) : !1
  3757. }
  3758.  
  3759. function E() {
  3760. return o.browser.Safari ? (a("Detected Browser: Safari"), !0) : !1
  3761. }
  3762.  
  3763. function S() {
  3764. a("Attempting to perform Integrated Windows Authentication..."), n(e).on("message", u);
  3765. var t = document.createElement("iframe");
  3766. t.id = "dsso_iframe", t.style.display = "none", t.src = s(y, "iframe=1"), t.onload = function() {
  3767. a("SSO IFrame loaded");
  3768. var e = d(y);
  3769. a("targetDomain is " + e);
  3770. var n = k.iwaRequestTimeoutInMs + "|" + y;
  3771. t.contentWindow.postMessage(n, e)
  3772. }, document.body.appendChild(t)
  3773. }
  3774.  
  3775. function T() {
  3776. var e = document.createElement("img");
  3777. e.setAttribute("height", "1"), e.setAttribute("width", "1"), e.onload = function() {
  3778. g()
  3779. }, e.onerror = function() {
  3780. c(2)
  3781. };
  3782. var t = s(y, "probe=1&_=" + (new Date).getTime());
  3783. a("Attempting probe with url " + t), e.setAttribute("src", t)
  3784. }
  3785.  
  3786. function v(e) {
  3787. y = r(e), y = s(y, "client-request-id=" + o.correlationId), a("IWA url is " + y), m() ? T() : h() || p() || C() || f() && k.isEdgeAllowed || E() && k.isSafariAllowed ? S() : (a("User agent is not supported."), c(1))
  3788. }
  3789.  
  3790. function A(e) {
  3791. return k.lastUsernameTried !== e
  3792. }
  3793.  
  3794. function w(e, t) {
  3795. var n = t.result;
  3796. n && n.is_dsso_enabled && n.DomainName && A(n.Login) && v(n.DomainName)
  3797. }
  3798.  
  3799. function I(e, t) {
  3800. t && t.is_dsso_enabled && t.DomainName && A(t.Login) && v(t.DomainName)
  3801. }
  3802.  
  3803. function b() {
  3804. e.User ? e.User.RegisterOnUserDomainHintChanged(I) : n(t).on("BrandedUserLoaded", w)
  3805. }
  3806.  
  3807. function x() {
  3808. return !t.tiles
  3809. }
  3810.  
  3811. function $(e) {
  3812. e ? (O.show(), U && n("#cred_cancel_button").show()) : (O.hide(), U && n("#cred_cancel_button").hide(), n("#cred_continue_button").hide())
  3813. }
  3814.  
  3815. function D() {
  3816. k.startDesktopSsoOnPageLoad && k.hintedDomainName && (P = !0, x() && (O = n("#cred_userid_container,#cred_password_container,.login_cta_container,#recover_container,input#cred_password_inputtext,#cred_sign_in_button,#cred_kmsi_container"), U = n("#cred_cancel_button").is(":visible"), $(!1), n("#redirect_cta_text").text(e.GetString("DesktopSso.AuthenticatingMessage")), n("#redirect_cta_text").show(), n("#redirect_dots_animation").show(), n("#redirect_dots_animation").css("visibility", "visible"), e.User.startAnimation(), L = setInterval(e.User.startAnimation, 3500)), setTimeout(l, k.progressAnimationTimeout), v(k.hintedDomainName))
  3817. }
  3818. var k, O, U, R = t.DesktopSso = t.DesktopSso || {},
  3819. y = "",
  3820. L = 0,
  3821. M = [],
  3822. N = 0,
  3823. B = "dssoResult",
  3824. P = !1;
  3825. return R.Initialize = function(e) {
  3826. k = e, b(), D(), a("Successfully initialized DesktopSSO.")
  3827. }, t
  3828. }(e.proxy || {}, jQuery, e.$Config), $Do.register("Proxy.DesktopSso", 0, !0)
  3829. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement