Skip to content

Instantly share code, notes, and snippets.

@snapp1
Created October 28, 2022 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snapp1/3fbaa90361f1806c08330b353d868412 to your computer and use it in GitHub Desktop.
Save snapp1/3fbaa90361f1806c08330b353d868412 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<title> Custom Visual Host v2+ </title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible"
content="IE=edge">
<STYLE>
html {
margin: 0;
padding: 0;
height: 100%;
}
body.visual-sandbox {
border: none;
overflow: hidden;
color: var(--neutral-dark-color, #212121);
font-family: 'Segoe UI', 'wf_segoe-ui_normal', helvetica, arial, sans-serif;
font-size: 16px;
cursor: pointer;
margin: 0;
padding: 0;
height: 100%;
-webkit-touch-callout: none;
/* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust: none;
-moz-text-size-adjust: none;
-ms-text-size-adjust: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
/* prevent copy paste, to allow, change 'none' to 'text' */
}
body.visual-sandbox #sandbox-host {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
body.visual-sandbox .tooltip-container .tooltip-row {
font-size: 9px;
}
li {
list-style: none;
font-size: 12px;
}
</STYLE>
</head>
<body class="visual-sandbox">
<div id="sandbox-host"
class="visual"></div>
<script>
var powerbi = {
common: {}
};
</script>
<SCRIPT>
this.parseTimeMarkers = this.parseTimeMarkers || {};
var marker = this.parseTimeMarkers['visualSandbox.minimal.externals.min.js'] || (this.parseTimeMarkers['visualSandbox.minimal.externals.min.js'] = {});
marker.startEval = window.jsCommon && window.jsCommon.performance && window.jsCommon.performance.now ? window.jsCommon.performance.now() : Date.now(); marker.isExternal = false;
if (window.perfTracking && window.perfTracking.startBundleEval) window.perfTracking.startBundleEval('visualSandbox.minimal.externals.min.js');/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function e(n,t){for(var r=null==n?0:n.length;r--&&t(n[r],r,n)!==!1;);return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;
return!0}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!!(null==n?0:n.length)&&y(n,t,0)>-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);
return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n){return n.split("")}function _(n){return n.match($t)||[]}function v(n,t,r){var e;return r(n,(function(n,r,u){if(t(n,r,u))return e=r,!1})),e}function g(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function y(n,t,r){return t===t?Z(n,t,r):g(n,b,r)}function d(n,t,r,e){
for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function b(n){return n!==n}function w(n,t){var r=null==n?0:n.length;return r?k(n,t)/r:Cn}function m(n){return function(t){return null==t?X:t[n]}}function x(n){return function(t){return null==n?X:n[t]}}function j(n,t,r,e,u){return u(n,(function(n,u,i){r=e?(e=!1,n):t(r,n,u,i)})),r}function A(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}function k(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==X&&(r=r===X?i:r+i);
}return r}function O(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function I(n,t){return c(t,(function(t){return[t,n[t]]}))}function R(n){return n?n.slice(0,H(n)+1).replace(Lt,""):n}function z(n){return function(t){return n(t)}}function E(n,t){return c(t,(function(t){return n[t]}))}function S(n,t){return n.has(t)}function W(n,t){for(var r=-1,e=n.length;++r<e&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function C(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;
return e}function U(n){return"\\"+Yr[n]}function B(n,t){return null==n?X:n[t]}function T(n){return Nr.test(n)}function $(n){return Pr.test(n)}function D(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function M(n){var t=-1,r=Array(n.size);return n.forEach((function(n,e){r[++t]=[e,n]})),r}function F(n,t){return function(r){return n(t(r))}}function N(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==cn||(n[r]=cn,i[u++]=r)}return i}function P(n){var t=-1,r=Array(n.size);
return n.forEach((function(n){r[++t]=n})),r}function q(n){var t=-1,r=Array(n.size);return n.forEach((function(n){r[++t]=[n,n]})),r}function Z(n,t,r){for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}function V(n){return T(n)?J(n):_e(n)}function G(n){return T(n)?Y(n):p(n)}function H(n){for(var t=n.length;t--&&Ct.test(n.charAt(t)););return t}function J(n){for(var t=Mr.lastIndex=0;Mr.test(n);)++t;return t}function Y(n){return n.match(Mr)||[];
}function Q(n){return n.match(Fr)||[]}var X,nn="4.17.21",tn=200,rn="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",en="Expected a function",un="Invalid `variable` option passed into `_.template`",on="__lodash_hash_undefined__",fn=500,cn="__lodash_placeholder__",an=1,ln=2,sn=4,hn=1,pn=2,_n=1,vn=2,gn=4,yn=8,dn=16,bn=32,wn=64,mn=128,xn=256,jn=512,An=30,kn="...",On=800,In=16,Rn=1,zn=2,En=3,Sn=1/0,Wn=9007199254740991,Ln=1.7976931348623157e308,Cn=NaN,Un=4294967295,Bn=Un-1,Tn=Un>>>1,$n=[["ary",mn],["bind",_n],["bindKey",vn],["curry",yn],["curryRight",dn],["flip",jn],["partial",bn],["partialRight",wn],["rearg",xn]],Dn="[object Arguments]",Mn="[object Array]",Fn="[object AsyncFunction]",Nn="[object Boolean]",Pn="[object Date]",qn="[object DOMException]",Zn="[object Error]",Kn="[object Function]",Vn="[object GeneratorFunction]",Gn="[object Map]",Hn="[object Number]",Jn="[object Null]",Yn="[object Object]",Qn="[object Promise]",Xn="[object Proxy]",nt="[object RegExp]",tt="[object Set]",rt="[object String]",et="[object Symbol]",ut="[object Undefined]",it="[object WeakMap]",ot="[object WeakSet]",ft="[object ArrayBuffer]",ct="[object DataView]",at="[object Float32Array]",lt="[object Float64Array]",st="[object Int8Array]",ht="[object Int16Array]",pt="[object Int32Array]",_t="[object Uint8Array]",vt="[object Uint8ClampedArray]",gt="[object Uint16Array]",yt="[object Uint32Array]",dt=/\b__p \+= '';/g,bt=/\b(__p \+=) '' \+/g,wt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,xt=/[&<>"']/g,jt=RegExp(mt.source),At=RegExp(xt.source),kt=/<%-([\s\S]+?)%>/g,Ot=/<%([\s\S]+?)%>/g,It=/<%=([\s\S]+?)%>/g,Rt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zt=/^\w*$/,Et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,St=/[\\^$.*+?()[\]{}|]/g,Wt=RegExp(St.source),Lt=/^\s+/,Ct=/\s/,Ut=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Bt=/\{\n\/\* \[wrapped with (.+)\] \*/,Tt=/,? & /,$t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dt=/[()=,{}\[\]\/\s]/,Mt=/\\(\\)?/g,Ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nt=/\w*$/,Pt=/^[-+]0x[0-9a-f]+$/i,qt=/^0b[01]+$/i,Zt=/^\[object .+?Constructor\]$/,Kt=/^0o[0-7]+$/i,Vt=/^(?:0|[1-9]\d*)$/,Gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ht=/($^)/,Jt=/['\n\r\u2028\u2029\\]/g,Yt="\\ud800-\\udfff",Qt="\\u0300-\\u036f",Xt="\\ufe20-\\ufe2f",nr="\\u20d0-\\u20ff",tr=Qt+Xt+nr,rr="\\u2700-\\u27bf",er="a-z\\xdf-\\xf6\\xf8-\\xff",ur="\\xac\\xb1\\xd7\\xf7",ir="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",or="\\u2000-\\u206f",fr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",cr="A-Z\\xc0-\\xd6\\xd8-\\xde",ar="\\ufe0e\\ufe0f",lr=ur+ir+or+fr,sr="['\u2019]",hr="["+Yt+"]",pr="["+lr+"]",_r="["+tr+"]",vr="\\d+",gr="["+rr+"]",yr="["+er+"]",dr="[^"+Yt+lr+vr+rr+er+cr+"]",br="\\ud83c[\\udffb-\\udfff]",wr="(?:"+_r+"|"+br+")",mr="[^"+Yt+"]",xr="(?:\\ud83c[\\udde6-\\uddff]){2}",jr="[\\ud800-\\udbff][\\udc00-\\udfff]",Ar="["+cr+"]",kr="\\u200d",Or="(?:"+yr+"|"+dr+")",Ir="(?:"+Ar+"|"+dr+")",Rr="(?:"+sr+"(?:d|ll|m|re|s|t|ve))?",zr="(?:"+sr+"(?:D|LL|M|RE|S|T|VE))?",Er=wr+"?",Sr="["+ar+"]?",Wr="(?:"+kr+"(?:"+[mr,xr,jr].join("|")+")"+Sr+Er+")*",Lr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Cr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ur=Sr+Er+Wr,Br="(?:"+[gr,xr,jr].join("|")+")"+Ur,Tr="(?:"+[mr+_r+"?",_r,xr,jr,hr].join("|")+")",$r=RegExp(sr,"g"),Dr=RegExp(_r,"g"),Mr=RegExp(br+"(?="+br+")|"+Tr+Ur,"g"),Fr=RegExp([Ar+"?"+yr+"+"+Rr+"(?="+[pr,Ar,"$"].join("|")+")",Ir+"+"+zr+"(?="+[pr,Ar+Or,"$"].join("|")+")",Ar+"?"+Or+"+"+Rr,Ar+"+"+zr,Cr,Lr,vr,Br].join("|"),"g"),Nr=RegExp("["+kr+Yt+tr+ar+"]"),Pr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,qr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Zr=-1,Kr={};
Kr[at]=Kr[lt]=Kr[st]=Kr[ht]=Kr[pt]=Kr[_t]=Kr[vt]=Kr[gt]=Kr[yt]=!0,Kr[Dn]=Kr[Mn]=Kr[ft]=Kr[Nn]=Kr[ct]=Kr[Pn]=Kr[Zn]=Kr[Kn]=Kr[Gn]=Kr[Hn]=Kr[Yn]=Kr[nt]=Kr[tt]=Kr[rt]=Kr[it]=!1;var Vr={};Vr[Dn]=Vr[Mn]=Vr[ft]=Vr[ct]=Vr[Nn]=Vr[Pn]=Vr[at]=Vr[lt]=Vr[st]=Vr[ht]=Vr[pt]=Vr[Gn]=Vr[Hn]=Vr[Yn]=Vr[nt]=Vr[tt]=Vr[rt]=Vr[et]=Vr[_t]=Vr[vt]=Vr[gt]=Vr[yt]=!0,Vr[Zn]=Vr[Kn]=Vr[it]=!1;var Gr={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a",
"\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae",
"\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g",
"\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O",
"\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w",
"\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},Hr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Jr={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Yr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qr=parseFloat,Xr=parseInt,ne="object"==typeof global&&global&&global.Object===Object&&global,te="object"==typeof self&&self&&self.Object===Object&&self,re=ne||te||Function("return this")(),ee="object"==typeof exports&&exports&&!exports.nodeType&&exports,ue=ee&&"object"==typeof module&&module&&!module.nodeType&&module,ie=ue&&ue.exports===ee,oe=ie&&ne.process,fe=(function(){
try{var n=ue&&ue.require&&ue.require("util").types;return n?n:oe&&oe.binding&&oe.binding("util")}catch(n){}})(),ce=fe&&fe.isArrayBuffer,ae=fe&&fe.isDate,le=fe&&fe.isMap,se=fe&&fe.isRegExp,he=fe&&fe.isSet,pe=fe&&fe.isTypedArray,_e=m("length"),ve=x(Gr),ge=x(Hr),ye=x(Jr),de=function p(x){function Z(n){if(cc(n)&&!bh(n)&&!(n instanceof Ct)){if(n instanceof Y)return n;if(bl.call(n,"__wrapped__"))return eo(n)}return new Y(n)}function J(){}function Y(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,
this.__index__=0,this.__values__=X}function Ct(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Un,this.__views__=[]}function $t(){var n=new Ct(this.__wrapped__);return n.__actions__=Tu(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Tu(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Tu(this.__views__),n}function Yt(){if(this.__filtered__){var n=new Ct(this);n.__dir__=-1,
n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function Qt(){var n=this.__wrapped__.value(),t=this.__dir__,r=bh(n),e=t<0,u=r?n.length:0,i=Oi(0,u,this.__views__),o=i.start,f=i.end,c=f-o,a=e?f:o-1,l=this.__iteratees__,s=l.length,h=0,p=Hl(c,this.__takeCount__);if(!r||!e&&u==c&&p==c)return wu(n,this.__actions__);var _=[];n:for(;c--&&h<p;){a+=t;for(var v=-1,g=n[a];++v<s;){var y=l[v],d=y.iteratee,b=y.type,w=d(g);if(b==zn)g=w;else if(!w){if(b==Rn)continue n;break n}}_[h++]=g}return _}function Xt(n){
var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function nr(){this.__data__=is?is(null):{},this.size=0}function tr(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}function rr(n){var t=this.__data__;if(is){var r=t[n];return r===on?X:r}return bl.call(t,n)?t[n]:X}function er(n){var t=this.__data__;return is?t[n]!==X:bl.call(t,n)}function ur(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=is&&t===X?on:t,this}function ir(n){
var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function or(){this.__data__=[],this.size=0}function fr(n){var t=this.__data__,r=Wr(t,n);return!(r<0)&&(r==t.length-1?t.pop():Ll.call(t,r,1),--this.size,!0)}function cr(n){var t=this.__data__,r=Wr(t,n);return r<0?X:t[r][1]}function ar(n){return Wr(this.__data__,n)>-1}function lr(n,t){var r=this.__data__,e=Wr(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this}function sr(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){
var e=n[t];this.set(e[0],e[1])}}function hr(){this.size=0,this.__data__={hash:new Xt,map:new(ts||ir),string:new Xt}}function pr(n){var t=xi(this,n).delete(n);return this.size-=t?1:0,t}function _r(n){return xi(this,n).get(n)}function vr(n){return xi(this,n).has(n)}function gr(n,t){var r=xi(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this}function yr(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new sr;++t<r;)this.add(n[t])}function dr(n){return this.__data__.set(n,on),this}function br(n){
return this.__data__.has(n)}function wr(n){this.size=(this.__data__=new ir(n)).size}function mr(){this.__data__=new ir,this.size=0}function xr(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r}function jr(n){return this.__data__.get(n)}function Ar(n){return this.__data__.has(n)}function kr(n,t){var r=this.__data__;if(r instanceof ir){var e=r.__data__;if(!ts||e.length<tn-1)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new sr(e)}return r.set(n,t),this.size=r.size,this}function Or(n,t){
var r=bh(n),e=!r&&dh(n),u=!r&&!e&&mh(n),i=!r&&!e&&!u&&Oh(n),o=r||e||u||i,f=o?O(n.length,hl):[],c=f.length;for(var a in n)!t&&!bl.call(n,a)||o&&("length"==a||u&&("offset"==a||"parent"==a)||i&&("buffer"==a||"byteLength"==a||"byteOffset"==a)||Ci(a,c))||f.push(a);return f}function Ir(n){var t=n.length;return t?n[tu(0,t-1)]:X}function Rr(n,t){return Xi(Tu(n),Mr(t,0,n.length))}function zr(n){return Xi(Tu(n))}function Er(n,t,r){(r===X||Gf(n[t],r))&&(r!==X||t in n)||Br(n,t,r)}function Sr(n,t,r){var e=n[t];
bl.call(n,t)&&Gf(e,r)&&(r!==X||t in n)||Br(n,t,r)}function Wr(n,t){for(var r=n.length;r--;)if(Gf(n[r][0],t))return r;return-1}function Lr(n,t,r,e){return ys(n,(function(n,u,i){t(e,n,r(n),i)})),e}function Cr(n,t){return n&&$u(t,Pc(t),n)}function Ur(n,t){return n&&$u(t,qc(t),n)}function Br(n,t,r){"__proto__"==t&&Tl?Tl(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function Tr(n,t){for(var r=-1,e=t.length,u=il(e),i=null==n;++r<e;)u[r]=i?X:Mc(n,t[r]);return u}function Mr(n,t,r){return n===n&&(r!==X&&(n=n<=r?n:r),
t!==X&&(n=n>=t?n:t)),n}function Fr(n,t,e,u,i,o){var f,c=t&an,a=t&ln,l=t&sn;if(e&&(f=i?e(n,u,i,o):e(n)),f!==X)return f;if(!fc(n))return n;var s=bh(n);if(s){if(f=zi(n),!c)return Tu(n,f)}else{var h=zs(n),p=h==Kn||h==Vn;if(mh(n))return Iu(n,c);if(h==Yn||h==Dn||p&&!i){if(f=a||p?{}:Ei(n),!c)return a?Mu(n,Ur(f,n)):Du(n,Cr(f,n))}else{if(!Vr[h])return i?n:{};f=Si(n,h,c)}}o||(o=new wr);var _=o.get(n);if(_)return _;o.set(n,f),kh(n)?n.forEach((function(r){f.add(Fr(r,t,e,r,n,o))})):jh(n)&&n.forEach((function(r,u){
f.set(u,Fr(r,t,e,u,n,o))}));var v=l?a?di:yi:a?qc:Pc,g=s?X:v(n);return r(g||n,(function(r,u){g&&(u=r,r=n[u]),Sr(f,u,Fr(r,t,e,u,n,o))})),f}function Nr(n){var t=Pc(n);return function(r){return Pr(r,n,t)}}function Pr(n,t,r){var e=r.length;if(null==n)return!e;for(n=ll(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===X&&!(u in n)||!i(o))return!1}return!0}function Gr(n,t,r){if("function"!=typeof n)throw new pl(en);return Ws((function(){n.apply(X,r)}),t)}function Hr(n,t,r,e){var u=-1,i=o,a=!0,l=n.length,s=[],h=t.length;
if(!l)return s;r&&(t=c(t,z(r))),e?(i=f,a=!1):t.length>=tn&&(i=S,a=!1,t=new yr(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p);if(p=e||0!==p?p:0,a&&_===_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else i(t,_,e)||s.push(p)}return s}function Jr(n,t){var r=!0;return ys(n,(function(n,e,u){return r=!!t(n,e,u)})),r}function Yr(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===X?o===o&&!bc(o):r(o,f)))var f=o,c=i}return c}function ne(n,t,r,e){var u=n.length;for(r=kc(r),r<0&&(r=-r>u?0:u+r),
e=e===X||e>u?u:kc(e),e<0&&(e+=u),e=r>e?0:Oc(e);r<e;)n[r++]=t;return n}function te(n,t){var r=[];return ys(n,(function(n,e,u){t(n,e,u)&&r.push(n)})),r}function ee(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=Li),u||(u=[]);++i<o;){var f=n[i];t>0&&r(f)?t>1?ee(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function ue(n,t){return n&&bs(n,t,Pc)}function oe(n,t){return n&&ws(n,t,Pc)}function fe(n,t){return i(t,(function(t){return uc(n[t])}))}function _e(n,t){t=ku(t,n);for(var r=0,e=t.length;null!=n&&r<e;)n=n[no(t[r++])];
return r&&r==e?n:X}function de(n,t,r){var e=t(n);return bh(n)?e:a(e,r(n))}function we(n){return null==n?n===X?ut:Jn:Bl&&Bl in ll(n)?ki(n):Ki(n)}function me(n,t){return n>t}function xe(n,t){return null!=n&&bl.call(n,t)}function je(n,t){return null!=n&&t in ll(n)}function Ae(n,t,r){return n>=Hl(t,r)&&n<Gl(t,r)}function ke(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=il(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,z(t))),s=Hl(p.length,s),l[a]=!r&&(t||u>=120&&p.length>=120)?new yr(a&&p):X}p=n[0];
var _=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],y=t?t(g):g;if(g=r||0!==g?g:0,!(v?S(v,y):e(h,y,r))){for(a=i;--a;){var d=l[a];if(!(d?S(d,y):e(n[a],y,r)))continue n}v&&v.push(y),h.push(g)}}return h}function Oe(n,t,r,e){return ue(n,(function(n,u,i){t(e,r(n),u,i)})),e}function Ie(t,r,e){r=ku(r,t),t=Gi(t,r);var u=null==t?t:t[no(jo(r))];return null==u?X:n(u,t,e)}function Re(n){return cc(n)&&we(n)==Dn}function ze(n){return cc(n)&&we(n)==ft}function Ee(n){return cc(n)&&we(n)==Pn}function Se(n,t,r,e,u){
return n===t||(null==n||null==t||!cc(n)&&!cc(t)?n!==n&&t!==t:We(n,t,r,e,Se,u))}function We(n,t,r,e,u,i){var o=bh(n),f=bh(t),c=o?Mn:zs(n),a=f?Mn:zs(t);c=c==Dn?Yn:c,a=a==Dn?Yn:a;var l=c==Yn,s=a==Yn,h=c==a;if(h&&mh(n)){if(!mh(t))return!1;o=!0,l=!1}if(h&&!l)return i||(i=new wr),o||Oh(n)?pi(n,t,r,e,u,i):_i(n,t,c,r,e,u,i);if(!(r&hn)){var p=l&&bl.call(n,"__wrapped__"),_=s&&bl.call(t,"__wrapped__");if(p||_){var v=p?n.value():n,g=_?t.value():t;return i||(i=new wr),u(v,g,r,e,i)}}return!!h&&(i||(i=new wr),vi(n,t,r,e,u,i));
}function Le(n){return cc(n)&&zs(n)==Gn}function Ce(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=ll(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++u<i;){f=r[u];var c=f[0],a=n[c],l=f[1];if(o&&f[2]){if(a===X&&!(c in n))return!1}else{var s=new wr;if(e)var h=e(a,l,c,n,t,s);if(!(h===X?Se(l,a,hn|pn,e,s):h))return!1}}return!0}function Ue(n){return!(!fc(n)||Di(n))&&(uc(n)?kl:Zt).test(to(n))}function Be(n){return cc(n)&&we(n)==nt}function Te(n){return cc(n)&&zs(n)==tt;
}function $e(n){return cc(n)&&oc(n.length)&&!!Kr[we(n)]}function De(n){return"function"==typeof n?n:null==n?La:"object"==typeof n?bh(n)?Ze(n[0],n[1]):qe(n):Fa(n)}function Me(n){if(!Mi(n))return Vl(n);var t=[];for(var r in ll(n))bl.call(n,r)&&"constructor"!=r&&t.push(r);return t}function Fe(n){if(!fc(n))return Zi(n);var t=Mi(n),r=[];for(var e in n)("constructor"!=e||!t&&bl.call(n,e))&&r.push(e);return r}function Ne(n,t){return n<t}function Pe(n,t){var r=-1,e=Hf(n)?il(n.length):[];return ys(n,(function(n,u,i){
e[++r]=t(n,u,i)})),e}function qe(n){var t=ji(n);return 1==t.length&&t[0][2]?Ni(t[0][0],t[0][1]):function(r){return r===n||Ce(r,n,t)}}function Ze(n,t){return Bi(n)&&Fi(t)?Ni(no(n),t):function(r){var e=Mc(r,n);return e===X&&e===t?Nc(r,n):Se(t,e,hn|pn)}}function Ke(n,t,r,e,u){n!==t&&bs(t,(function(i,o){if(u||(u=new wr),fc(i))Ve(n,t,o,r,Ke,e,u);else{var f=e?e(Ji(n,o),i,o+"",n,t,u):X;f===X&&(f=i),Er(n,o,f)}}),qc)}function Ve(n,t,r,e,u,i,o){var f=Ji(n,r),c=Ji(t,r),a=o.get(c);if(a)return Er(n,r,a),X;var l=i?i(f,c,r+"",n,t,o):X,s=l===X;
if(s){var h=bh(c),p=!h&&mh(c),_=!h&&!p&&Oh(c);l=c,h||p||_?bh(f)?l=f:Jf(f)?l=Tu(f):p?(s=!1,l=Iu(c,!0)):_?(s=!1,l=Wu(c,!0)):l=[]:gc(c)||dh(c)?(l=f,dh(f)?l=Rc(f):fc(f)&&!uc(f)||(l=Ei(c))):s=!1}s&&(o.set(c,l),u(l,c,e,i,o),o.delete(c)),Er(n,r,l)}function Ge(n,t){var r=n.length;if(r)return t+=t<0?r:0,Ci(t,r)?n[t]:X}function He(n,t,r){t=t.length?c(t,(function(n){return bh(n)?function(t){return _e(t,1===n.length?n[0]:n)}:n})):[La];var e=-1;return t=c(t,z(mi())),A(Pe(n,(function(n,r,u){return{criteria:c(t,(function(t){
return t(n)})),index:++e,value:n}})),(function(n,t){return Cu(n,t,r)}))}function Je(n,t){return Ye(n,t,(function(t,r){return Nc(n,r)}))}function Ye(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=_e(n,o);r(f,o)&&fu(i,ku(o,n),f)}return i}function Qe(n){return function(t){return _e(t,n)}}function Xe(n,t,r,e){var u=e?d:y,i=-1,o=t.length,f=n;for(n===t&&(t=Tu(t)),r&&(f=c(n,z(r)));++i<o;)for(var a=0,l=t[i],s=r?r(l):l;(a=u(f,s,a,e))>-1;)f!==n&&Ll.call(f,a,1),Ll.call(n,a,1);return n}function nu(n,t){for(var r=n?t.length:0,e=r-1;r--;){
var u=t[r];if(r==e||u!==i){var i=u;Ci(u)?Ll.call(n,u,1):yu(n,u)}}return n}function tu(n,t){return n+Nl(Ql()*(t-n+1))}function ru(n,t,r,e){for(var u=-1,i=Gl(Fl((t-n)/(r||1)),0),o=il(i);i--;)o[e?i:++u]=n,n+=r;return o}function eu(n,t){var r="";if(!n||t<1||t>Wn)return r;do t%2&&(r+=n),t=Nl(t/2),t&&(n+=n);while(t);return r}function uu(n,t){return Ls(Vi(n,t,La),n+"")}function iu(n){return Ir(ra(n))}function ou(n,t){var r=ra(n);return Xi(r,Mr(t,0,r.length))}function fu(n,t,r,e){if(!fc(n))return n;t=ku(t,n);
for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++u<i;){var c=no(t[u]),a=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return n;if(u!=o){var l=f[c];a=e?e(l,c,f):X,a===X&&(a=fc(l)?l:Ci(t[u+1])?[]:{})}Sr(f,c,a),f=f[c]}return n}function cu(n){return Xi(ra(n))}function au(n,t,r){var e=-1,u=n.length;t<0&&(t=-t>u?0:u+t),r=r>u?u:r,r<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=il(u);++e<u;)i[e]=n[e+t];return i}function lu(n,t){var r;return ys(n,(function(n,e,u){return r=t(n,e,u),!r})),!!r}function su(n,t,r){
var e=0,u=null==n?e:n.length;if("number"==typeof t&&t===t&&u<=Tn){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!bc(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return hu(n,t,La,r)}function hu(n,t,r,e){var u=0,i=null==n?0:n.length;if(0===i)return 0;t=r(t);for(var o=t!==t,f=null===t,c=bc(t),a=t===X;u<i;){var l=Nl((u+i)/2),s=r(n[l]),h=s!==X,p=null===s,_=s===s,v=bc(s);if(o)var g=e||_;else g=a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):!p&&!v&&(e?s<=t:s<t);g?u=l+1:i=l}return Hl(i,Bn)}function pu(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){
var o=n[r],f=t?t(o):o;if(!r||!Gf(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function _u(n){return"number"==typeof n?n:bc(n)?Cn:+n}function vu(n){if("string"==typeof n)return n;if(bh(n))return c(n,vu)+"";if(bc(n))return vs?vs.call(n):"";var t=n+"";return"0"==t&&1/n==-Sn?"-0":t}function gu(n,t,r){var e=-1,u=o,i=n.length,c=!0,a=[],l=a;if(r)c=!1,u=f;else if(i>=tn){var s=t?null:ks(n);if(s)return P(s);c=!1,u=S,l=new yr}else l=t?[]:a;n:for(;++e<i;){var h=n[e],p=t?t(h):h;if(h=r||0!==h?h:0,c&&p===p){for(var _=l.length;_--;)if(l[_]===p)continue n;
t&&l.push(p),a.push(h)}else u(l,p,r)||(l!==a&&l.push(p),a.push(h))}return a}function yu(n,t){return t=ku(t,n),n=Gi(n,t),null==n||delete n[no(jo(t))]}function du(n,t,r,e){return fu(n,t,r(_e(n,t)),e)}function bu(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?au(n,e?0:i,e?i+1:u):au(n,e?i+1:0,e?u:i)}function wu(n,t){var r=n;return r instanceof Ct&&(r=r.value()),l(t,(function(n,t){return t.func.apply(t.thisArg,a([n],t.args))}),r)}function mu(n,t,r){var e=n.length;if(e<2)return e?gu(n[0]):[];
for(var u=-1,i=il(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=Hr(i[u]||o,n[f],t,r));return gu(ee(i,1),t,r)}function xu(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;){r(o,n[e],e<i?t[e]:X)}return o}function ju(n){return Jf(n)?n:[]}function Au(n){return"function"==typeof n?n:La}function ku(n,t){return bh(n)?n:Bi(n,t)?[n]:Cs(Ec(n))}function Ou(n,t,r){var e=n.length;return r=r===X?e:r,!t&&r>=e?n:au(n,t,r)}function Iu(n,t){if(t)return n.slice();var r=n.length,e=zl?zl(r):new n.constructor(r);
return n.copy(e),e}function Ru(n){var t=new n.constructor(n.byteLength);return new Rl(t).set(new Rl(n)),t}function zu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.byteLength)}function Eu(n){var t=new n.constructor(n.source,Nt.exec(n));return t.lastIndex=n.lastIndex,t}function Su(n){return _s?ll(_s.call(n)):{}}function Wu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.length)}function Lu(n,t){if(n!==t){var r=n!==X,e=null===n,u=n===n,i=bc(n),o=t!==X,f=null===t,c=t===t,a=bc(t);
if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return-1}return 0}function Cu(n,t,r){for(var e=-1,u=n.criteria,i=t.criteria,o=u.length,f=r.length;++e<o;){var c=Lu(u[e],i[e]);if(c){if(e>=f)return c;return c*("desc"==r[e]?-1:1)}}return n.index-t.index}function Uu(n,t,r,e){for(var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Gl(i-o,0),l=il(c+a),s=!e;++f<c;)l[f]=t[f];for(;++u<o;)(s||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++];return l;
}function Bu(n,t,r,e){for(var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Gl(i-f,0),s=il(l+a),h=!e;++u<l;)s[u]=n[u];for(var p=u;++c<a;)s[p+c]=t[c];for(;++o<f;)(h||u<i)&&(s[p+r[o]]=n[u++]);return s}function Tu(n,t){var r=-1,e=n.length;for(t||(t=il(e));++r<e;)t[r]=n[r];return t}function $u(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):X;c===X&&(c=n[f]),u?Br(r,f,c):Sr(r,f,c)}return r}function Du(n,t){return $u(n,Is(n),t)}function Mu(n,t){return $u(n,Rs(n),t);
}function Fu(n,r){return function(e,u){var i=bh(e)?t:Lr,o=r?r():{};return i(e,n,mi(u,2),o)}}function Nu(n){return uu((function(t,r){var e=-1,u=r.length,i=u>1?r[u-1]:X,o=u>2?r[2]:X;for(i=n.length>3&&"function"==typeof i?(u--,i):X,o&&Ui(r[0],r[1],o)&&(i=u<3?X:i,u=1),t=ll(t);++e<u;){var f=r[e];f&&n(t,f,e,i)}return t}))}function Pu(n,t){return function(r,e){if(null==r)return r;if(!Hf(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=ll(r);(t?i--:++i<u)&&e(o[i],i,o)!==!1;);return r}}function qu(n){return function(t,r,e){
for(var u=-1,i=ll(t),o=e(t),f=o.length;f--;){var c=o[n?f:++u];if(r(i[c],c,i)===!1)break}return t}}function Zu(n,t,r){function e(){return(this&&this!==re&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=t&_n,i=Gu(n);return e}function Ku(n){return function(t){t=Ec(t);var r=T(t)?G(t):X,e=r?r[0]:t.charAt(0),u=r?Ou(r,1).join(""):t.slice(1);return e[n]()+u}}function Vu(n){return function(t){return l(Ra(ca(t).replace($r,"")),n,"")}}function Gu(n){return function(){var t=arguments;switch(t.length){
case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=gs(n.prototype),e=n.apply(r,t);return fc(e)?e:r}}function Hu(t,r,e){function u(){for(var o=arguments.length,f=il(o),c=o,a=wi(u);c--;)f[c]=arguments[c];var l=o<3&&f[0]!==a&&f[o-1]!==a?[]:N(f,a);
return o-=l.length,o<e?oi(t,r,Qu,u.placeholder,X,f,l,X,X,e-o):n(this&&this!==re&&this instanceof u?i:t,this,f)}var i=Gu(t);return u}function Ju(n){return function(t,r,e){var u=ll(t);if(!Hf(t)){var i=mi(r,3);t=Pc(t),r=function(n){return i(u[n],n,u)}}var o=n(t,r,e);return o>-1?u[i?t[o]:o]:X}}function Yu(n){return gi((function(t){var r=t.length,e=r,u=Y.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if("function"!=typeof i)throw new pl(en);if(u&&!o&&"wrapper"==bi(i))var o=new Y([],!0)}for(e=o?e:r;++e<r;){
i=t[e];var f=bi(i),c="wrapper"==f?Os(i):X;o=c&&$i(c[0])&&c[1]==(mn|yn|bn|xn)&&!c[4].length&&1==c[9]?o[bi(c[0])].apply(o,c[3]):1==i.length&&$i(i)?o[f]():o.thru(i)}return function(){var n=arguments,e=n[0];if(o&&1==n.length&&bh(e))return o.plant(e).value();for(var u=0,i=r?t[u].apply(this,n):e;++u<r;)i=t[u].call(this,i);return i}}))}function Qu(n,t,r,e,u,i,o,f,c,a){function l(){for(var y=arguments.length,d=il(y),b=y;b--;)d[b]=arguments[b];if(_)var w=wi(l),m=C(d,w);if(e&&(d=Uu(d,e,u,_)),i&&(d=Bu(d,i,o,_)),
y-=m,_&&y<a){return oi(n,t,Qu,l.placeholder,r,d,N(d,w),f,c,a-y)}var x=h?r:this,j=p?x[n]:n;return y=d.length,f?d=Hi(d,f):v&&y>1&&d.reverse(),s&&c<y&&(d.length=c),this&&this!==re&&this instanceof l&&(j=g||Gu(j)),j.apply(x,d)}var s=t&mn,h=t&_n,p=t&vn,_=t&(yn|dn),v=t&jn,g=p?X:Gu(n);return l}function Xu(n,t){return function(r,e){return Oe(r,n,t(e),{})}}function ni(n,t){return function(r,e){var u;if(r===X&&e===X)return t;if(r!==X&&(u=r),e!==X){if(u===X)return e;"string"==typeof r||"string"==typeof e?(r=vu(r),
e=vu(e)):(r=_u(r),e=_u(e)),u=n(r,e)}return u}}function ti(t){return gi((function(r){return r=c(r,z(mi())),uu((function(e){var u=this;return t(r,(function(t){return n(t,u,e)}))}))}))}function ri(n,t){t=t===X?" ":vu(t);var r=t.length;if(r<2)return r?eu(t,n):t;var e=eu(t,Fl(n/V(t)));return T(t)?Ou(G(e),0,n).join(""):e.slice(0,n)}function ei(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=il(l+c),h=this&&this!==re&&this instanceof i?f:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++r];
return n(h,o?e:this,s)}var o=r&_n,f=Gu(t);return i}function ui(n){return function(t,r,e){return e&&"number"!=typeof e&&Ui(t,r,e)&&(r=e=X),t=Ac(t),r===X?(r=t,t=0):r=Ac(r),e=e===X?t<r?1:-1:Ac(e),ru(t,r,e,n)}}function ii(n){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=Ic(t),r=Ic(r)),n(t,r)}}function oi(n,t,r,e,u,i,o,f,c,a){var l=t&yn,s=l?o:X,h=l?X:o,p=l?i:X,_=l?X:i;t|=l?bn:wn,t&=~(l?wn:bn),t&gn||(t&=~(_n|vn));var v=[n,t,u,p,s,_,h,f,c,a],g=r.apply(X,v);return $i(n)&&Ss(g,v),g.placeholder=e,
Yi(g,n,t)}function fi(n){var t=al[n];return function(n,r){if(n=Ic(n),r=null==r?0:Hl(kc(r),292),r&&Zl(n)){var e=(Ec(n)+"e").split("e");return e=(Ec(t(e[0]+"e"+(+e[1]+r)))+"e").split("e"),+(e[0]+"e"+(+e[1]-r))}return t(n)}}function ci(n){return function(t){var r=zs(t);return r==Gn?M(t):r==tt?q(t):I(t,n(t))}}function ai(n,t,r,e,u,i,o,f){var c=t&vn;if(!c&&"function"!=typeof n)throw new pl(en);var a=e?e.length:0;if(a||(t&=~(bn|wn),e=u=X),o=o===X?o:Gl(kc(o),0),f=f===X?f:kc(f),a-=u?u.length:0,t&wn){var l=e,s=u;
e=u=X}var h=c?X:Os(n),p=[n,t,r,e,u,l,s,i,o,f];if(h&&qi(p,h),n=p[0],t=p[1],r=p[2],e=p[3],u=p[4],f=p[9]=p[9]===X?c?0:n.length:Gl(p[9]-a,0),!f&&t&(yn|dn)&&(t&=~(yn|dn)),t&&t!=_n)_=t==yn||t==dn?Hu(n,t,f):t!=bn&&t!=(_n|bn)||u.length?Qu.apply(X,p):ei(n,t,r,e);else var _=Zu(n,t,r);return Yi((h?ms:Ss)(_,p),n,t)}function li(n,t,r,e){return n===X||Gf(n,gl[r])&&!bl.call(e,r)?t:n}function si(n,t,r,e,u,i){return fc(n)&&fc(t)&&(i.set(t,n),Ke(n,t,X,si,i),i.delete(t)),n}function hi(n){return gc(n)?X:n}function pi(n,t,r,e,u,i){
var o=r&hn,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return!1;var a=i.get(n),l=i.get(t);if(a&&l)return a==t&&l==n;var s=-1,p=!0,_=r&pn?new yr:X;for(i.set(n,t),i.set(t,n);++s<f;){var v=n[s],g=t[s];if(e)var y=o?e(g,v,s,t,n,i):e(v,g,s,n,t,i);if(y!==X){if(y)continue;p=!1;break}if(_){if(!h(t,(function(n,t){if(!S(_,t)&&(v===n||u(v,n,r,e,i)))return _.push(t)}))){p=!1;break}}else if(v!==g&&!u(v,g,r,e,i)){p=!1;break}}return i.delete(n),i.delete(t),p}function _i(n,t,r,e,u,i,o){switch(r){case ct:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;
n=n.buffer,t=t.buffer;case ft:return!(n.byteLength!=t.byteLength||!i(new Rl(n),new Rl(t)));case Nn:case Pn:case Hn:return Gf(+n,+t);case Zn:return n.name==t.name&&n.message==t.message;case nt:case rt:return n==t+"";case Gn:var f=M;case tt:var c=e&hn;if(f||(f=P),n.size!=t.size&&!c)return!1;var a=o.get(n);if(a)return a==t;e|=pn,o.set(n,t);var l=pi(f(n),f(t),e,u,i,o);return o.delete(n),l;case et:if(_s)return _s.call(n)==_s.call(t)}return!1}function vi(n,t,r,e,u,i){var o=r&hn,f=yi(n),c=f.length;if(c!=yi(t).length&&!o)return!1;
for(var a=c;a--;){var l=f[a];if(!(o?l in t:bl.call(t,l)))return!1}var s=i.get(n),h=i.get(t);if(s&&h)return s==t&&h==n;var p=!0;i.set(n,t),i.set(t,n);for(var _=o;++a<c;){l=f[a];var v=n[l],g=t[l];if(e)var y=o?e(g,v,l,t,n,i):e(v,g,l,n,t,i);if(!(y===X?v===g||u(v,g,r,e,i):y)){p=!1;break}_||(_="constructor"==l)}if(p&&!_){var d=n.constructor,b=t.constructor;d!=b&&"constructor"in n&&"constructor"in t&&!("function"==typeof d&&d instanceof d&&"function"==typeof b&&b instanceof b)&&(p=!1)}return i.delete(n),
i.delete(t),p}function gi(n){return Ls(Vi(n,X,_o),n+"")}function yi(n){return de(n,Pc,Is)}function di(n){return de(n,qc,Rs)}function bi(n){for(var t=n.name+"",r=fs[t],e=bl.call(fs,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function wi(n){return(bl.call(Z,"placeholder")?Z:n).placeholder}function mi(){var n=Z.iteratee||Ca;return n=n===Ca?De:n,arguments.length?n(arguments[0],arguments[1]):n}function xi(n,t){var r=n.__data__;return Ti(t)?r["string"==typeof t?"string":"hash"]:r.map;
}function ji(n){for(var t=Pc(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,Fi(u)]}return t}function Ai(n,t){var r=B(n,t);return Ue(r)?r:X}function ki(n){var t=bl.call(n,Bl),r=n[Bl];try{n[Bl]=X;var e=!0}catch(n){}var u=xl.call(n);return e&&(t?n[Bl]=r:delete n[Bl]),u}function Oi(n,t,r){for(var e=-1,u=r.length;++e<u;){var i=r[e],o=i.size;switch(i.type){case"drop":n+=o;break;case"dropRight":t-=o;break;case"take":t=Hl(t,n+o);break;case"takeRight":n=Gl(n,t-o)}}return{start:n,end:t}}function Ii(n){var t=n.match(Bt);
return t?t[1].split(Tt):[]}function Ri(n,t,r){t=ku(t,n);for(var e=-1,u=t.length,i=!1;++e<u;){var o=no(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:(u=null==n?0:n.length,!!u&&oc(u)&&Ci(o,u)&&(bh(n)||dh(n)))}function zi(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&bl.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ei(n){return"function"!=typeof n.constructor||Mi(n)?{}:gs(El(n))}function Si(n,t,r){var e=n.constructor;switch(t){case ft:return Ru(n);
case Nn:case Pn:return new e(+n);case ct:return zu(n,r);case at:case lt:case st:case ht:case pt:case _t:case vt:case gt:case yt:return Wu(n,r);case Gn:return new e;case Hn:case rt:return new e(n);case nt:return Eu(n);case tt:return new e;case et:return Su(n)}}function Wi(n,t){var r=t.length;if(!r)return n;var e=r-1;return t[e]=(r>1?"& ":"")+t[e],t=t.join(r>2?", ":" "),n.replace(Ut,"{\n/* [wrapped with "+t+"] */\n")}function Li(n){return bh(n)||dh(n)||!!(Cl&&n&&n[Cl])}function Ci(n,t){var r=typeof n;
return t=null==t?Wn:t,!!t&&("number"==r||"symbol"!=r&&Vt.test(n))&&n>-1&&n%1==0&&n<t}function Ui(n,t,r){if(!fc(r))return!1;var e=typeof t;return!!("number"==e?Hf(r)&&Ci(t,r.length):"string"==e&&t in r)&&Gf(r[t],n)}function Bi(n,t){if(bh(n))return!1;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!bc(n))||(zt.test(n)||!Rt.test(n)||null!=t&&n in ll(t))}function Ti(n){var t=typeof n;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==n:null===n}function $i(n){
var t=bi(n),r=Z[t];if("function"!=typeof r||!(t in Ct.prototype))return!1;if(n===r)return!0;var e=Os(r);return!!e&&n===e[0]}function Di(n){return!!ml&&ml in n}function Mi(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||gl)}function Fi(n){return n===n&&!fc(n)}function Ni(n,t){return function(r){return null!=r&&(r[n]===t&&(t!==X||n in ll(r)))}}function Pi(n){var t=Cf(n,(function(n){return r.size===fn&&r.clear(),n})),r=t.cache;return t}function qi(n,t){var r=n[1],e=t[1],u=r|e,i=u<(_n|vn|mn),o=e==mn&&r==yn||e==mn&&r==xn&&n[7].length<=t[8]||e==(mn|xn)&&t[7].length<=t[8]&&r==yn;
if(!i&&!o)return n;e&_n&&(n[2]=t[2],u|=r&_n?0:gn);var f=t[3];if(f){var c=n[3];n[3]=c?Uu(c,f,t[4]):f,n[4]=c?N(n[3],cn):t[4]}return f=t[5],f&&(c=n[5],n[5]=c?Bu(c,f,t[6]):f,n[6]=c?N(n[5],cn):t[6]),f=t[7],f&&(n[7]=f),e&mn&&(n[8]=null==n[8]?t[8]:Hl(n[8],t[8])),null==n[9]&&(n[9]=t[9]),n[0]=t[0],n[1]=u,n}function Zi(n){var t=[];if(null!=n)for(var r in ll(n))t.push(r);return t}function Ki(n){return xl.call(n)}function Vi(t,r,e){return r=Gl(r===X?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Gl(u.length-r,0),f=il(o);++i<o;)f[i]=u[r+i];
i=-1;for(var c=il(r+1);++i<r;)c[i]=u[i];return c[r]=e(f),n(t,this,c)}}function Gi(n,t){return t.length<2?n:_e(n,au(t,0,-1))}function Hi(n,t){for(var r=n.length,e=Hl(t.length,r),u=Tu(n);e--;){var i=t[e];n[e]=Ci(i,r)?u[i]:X}return n}function Ji(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}function Yi(n,t,r){var e=t+"";return Ls(n,Wi(e,ro(Ii(e),r)))}function Qi(n){var t=0,r=0;return function(){var e=Jl(),u=In-(e-r);if(r=e,u>0){if(++t>=On)return arguments[0]}else t=0;
return n.apply(X,arguments)}}function Xi(n,t){var r=-1,e=n.length,u=e-1;for(t=t===X?e:t;++r<t;){var i=tu(r,u),o=n[i];n[i]=n[r],n[r]=o}return n.length=t,n}function no(n){if("string"==typeof n||bc(n))return n;var t=n+"";return"0"==t&&1/n==-Sn?"-0":t}function to(n){if(null!=n){try{return dl.call(n)}catch(n){}try{return n+""}catch(n){}}return""}function ro(n,t){return r($n,(function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e)})),n.sort()}function eo(n){if(n instanceof Ct)return n.clone();var t=new Y(n.__wrapped__,n.__chain__);
return t.__actions__=Tu(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function uo(n,t,r){t=(r?Ui(n,t,r):t===X)?1:Gl(kc(t),0);var e=null==n?0:n.length;if(!e||t<1)return[];for(var u=0,i=0,o=il(Fl(e/t));u<e;)o[i++]=au(n,u,u+=t);return o}function io(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){var i=n[t];i&&(u[e++]=i)}return u}function oo(){var n=arguments.length;if(!n)return[];for(var t=il(n-1),r=arguments[0],e=n;e--;)t[e-1]=arguments[e];return a(bh(r)?Tu(r):[r],ee(t,1));
}function fo(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),au(n,t<0?0:t,e)):[]}function co(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),t=e-t,au(n,0,t<0?0:t)):[]}function ao(n,t){return n&&n.length?bu(n,mi(t,3),!0,!0):[]}function lo(n,t){return n&&n.length?bu(n,mi(t,3),!0):[]}function so(n,t,r,e){var u=null==n?0:n.length;return u?(r&&"number"!=typeof r&&Ui(n,t,r)&&(r=0,e=u),ne(n,t,r,e)):[]}function ho(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:kc(r);
return u<0&&(u=Gl(e+u,0)),g(n,mi(t,3),u)}function po(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==X&&(u=kc(r),u=r<0?Gl(e+u,0):Hl(u,e-1)),g(n,mi(t,3),u,!0)}function _o(n){return(null==n?0:n.length)?ee(n,1):[]}function vo(n){return(null==n?0:n.length)?ee(n,Sn):[]}function go(n,t){return(null==n?0:n.length)?(t=t===X?1:kc(t),ee(n,t)):[]}function yo(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e}function bo(n){return n&&n.length?n[0]:X}function wo(n,t,r){
var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:kc(r);return u<0&&(u=Gl(e+u,0)),y(n,t,u)}function mo(n){return(null==n?0:n.length)?au(n,0,-1):[]}function xo(n,t){return null==n?"":Kl.call(n,t)}function jo(n){var t=null==n?0:n.length;return t?n[t-1]:X}function Ao(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;return r!==X&&(u=kc(r),u=u<0?Gl(e+u,0):Hl(u,e-1)),t===t?K(n,t,u):g(n,b,u,!0)}function ko(n,t){return n&&n.length?Ge(n,kc(t)):X}function Oo(n,t){return n&&n.length&&t&&t.length?Xe(n,t):n;
}function Io(n,t,r){return n&&n.length&&t&&t.length?Xe(n,t,mi(r,2)):n}function Ro(n,t,r){return n&&n.length&&t&&t.length?Xe(n,t,X,r):n}function zo(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=mi(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),u.push(e))}return nu(n,u),r}function Eo(n){return null==n?n:Xl.call(n)}function So(n,t,r){var e=null==n?0:n.length;return e?(r&&"number"!=typeof r&&Ui(n,t,r)?(t=0,r=e):(t=null==t?0:kc(t),r=r===X?e:kc(r)),au(n,t,r)):[]}function Wo(n,t){
return su(n,t)}function Lo(n,t,r){return hu(n,t,mi(r,2))}function Co(n,t){var r=null==n?0:n.length;if(r){var e=su(n,t);if(e<r&&Gf(n[e],t))return e}return-1}function Uo(n,t){return su(n,t,!0)}function Bo(n,t,r){return hu(n,t,mi(r,2),!0)}function To(n,t){if(null==n?0:n.length){var r=su(n,t,!0)-1;if(Gf(n[r],t))return r}return-1}function $o(n){return n&&n.length?pu(n):[]}function Do(n,t){return n&&n.length?pu(n,mi(t,2)):[]}function Mo(n){var t=null==n?0:n.length;return t?au(n,1,t):[]}function Fo(n,t,r){
return n&&n.length?(t=r||t===X?1:kc(t),au(n,0,t<0?0:t)):[]}function No(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),t=e-t,au(n,t<0?0:t,e)):[]}function Po(n,t){return n&&n.length?bu(n,mi(t,3),!1,!0):[]}function qo(n,t){return n&&n.length?bu(n,mi(t,3)):[]}function Zo(n){return n&&n.length?gu(n):[]}function Ko(n,t){return n&&n.length?gu(n,mi(t,2)):[]}function Vo(n,t){return t="function"==typeof t?t:X,n&&n.length?gu(n,X,t):[]}function Go(n){if(!n||!n.length)return[];var t=0;return n=i(n,(function(n){
if(Jf(n))return t=Gl(n.length,t),!0})),O(t,(function(t){return c(n,m(t))}))}function Ho(t,r){if(!t||!t.length)return[];var e=Go(t);return null==r?e:c(e,(function(t){return n(r,X,t)}))}function Jo(n,t){return xu(n||[],t||[],Sr)}function Yo(n,t){return xu(n||[],t||[],fu)}function Qo(n){var t=Z(n);return t.__chain__=!0,t}function Xo(n,t){return t(n),n}function nf(n,t){return t(n)}function tf(){return Qo(this)}function rf(){return new Y(this.value(),this.__chain__)}function ef(){this.__values__===X&&(this.__values__=jc(this.value()));
var n=this.__index__>=this.__values__.length;return{done:n,value:n?X:this.__values__[this.__index__++]}}function uf(){return this}function of(n){for(var t,r=this;r instanceof J;){var e=eo(r);e.__index__=0,e.__values__=X,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t}function ff(){var n=this.__wrapped__;if(n instanceof Ct){var t=n;return this.__actions__.length&&(t=new Ct(this)),t=t.reverse(),t.__actions__.push({func:nf,args:[Eo],thisArg:X}),new Y(t,this.__chain__)}return this.thru(Eo);
}function cf(){return wu(this.__wrapped__,this.__actions__)}function af(n,t,r){var e=bh(n)?u:Jr;return r&&Ui(n,t,r)&&(t=X),e(n,mi(t,3))}function lf(n,t){return(bh(n)?i:te)(n,mi(t,3))}function sf(n,t){return ee(yf(n,t),1)}function hf(n,t){return ee(yf(n,t),Sn)}function pf(n,t,r){return r=r===X?1:kc(r),ee(yf(n,t),r)}function _f(n,t){return(bh(n)?r:ys)(n,mi(t,3))}function vf(n,t){return(bh(n)?e:ds)(n,mi(t,3))}function gf(n,t,r,e){n=Hf(n)?n:ra(n),r=r&&!e?kc(r):0;var u=n.length;return r<0&&(r=Gl(u+r,0)),
dc(n)?r<=u&&n.indexOf(t,r)>-1:!!u&&y(n,t,r)>-1}function yf(n,t){return(bh(n)?c:Pe)(n,mi(t,3))}function df(n,t,r,e){return null==n?[]:(bh(t)||(t=null==t?[]:[t]),r=e?X:r,bh(r)||(r=null==r?[]:[r]),He(n,t,r))}function bf(n,t,r){var e=bh(n)?l:j,u=arguments.length<3;return e(n,mi(t,4),r,u,ys)}function wf(n,t,r){var e=bh(n)?s:j,u=arguments.length<3;return e(n,mi(t,4),r,u,ds)}function mf(n,t){return(bh(n)?i:te)(n,Uf(mi(t,3)))}function xf(n){return(bh(n)?Ir:iu)(n)}function jf(n,t,r){return t=(r?Ui(n,t,r):t===X)?1:kc(t),
(bh(n)?Rr:ou)(n,t)}function Af(n){return(bh(n)?zr:cu)(n)}function kf(n){if(null==n)return 0;if(Hf(n))return dc(n)?V(n):n.length;var t=zs(n);return t==Gn||t==tt?n.size:Me(n).length}function Of(n,t,r){var e=bh(n)?h:lu;return r&&Ui(n,t,r)&&(t=X),e(n,mi(t,3))}function If(n,t){if("function"!=typeof t)throw new pl(en);return n=kc(n),function(){if(--n<1)return t.apply(this,arguments)}}function Rf(n,t,r){return t=r?X:t,t=n&&null==t?n.length:t,ai(n,mn,X,X,X,X,t)}function zf(n,t){var r;if("function"!=typeof t)throw new pl(en);
return n=kc(n),function(){return--n>0&&(r=t.apply(this,arguments)),n<=1&&(t=X),r}}function Ef(n,t,r){t=r?X:t;var e=ai(n,yn,X,X,X,X,X,t);return e.placeholder=Ef.placeholder,e}function Sf(n,t,r){t=r?X:t;var e=ai(n,dn,X,X,X,X,X,t);return e.placeholder=Sf.placeholder,e}function Wf(n,t,r){function e(t){var r=h,e=p;return h=p=X,d=t,v=n.apply(e,r)}function u(n){return d=n,g=Ws(f,t),b?e(n):v}function i(n){var r=n-y,e=n-d,u=t-r;return w?Hl(u,_-e):u}function o(n){var r=n-y,e=n-d;return y===X||r>=t||r<0||w&&e>=_;
}function f(){var n=fh();return o(n)?c(n):(g=Ws(f,i(n)),X)}function c(n){return g=X,m&&h?e(n):(h=p=X,v)}function a(){g!==X&&As(g),d=0,h=y=p=g=X}function l(){return g===X?v:c(fh())}function s(){var n=fh(),r=o(n);if(h=arguments,p=this,y=n,r){if(g===X)return u(y);if(w)return As(g),g=Ws(f,t),e(y)}return g===X&&(g=Ws(f,t)),v}var h,p,_,v,g,y,d=0,b=!1,w=!1,m=!0;if("function"!=typeof n)throw new pl(en);return t=Ic(t)||0,fc(r)&&(b=!!r.leading,w="maxWait"in r,_=w?Gl(Ic(r.maxWait)||0,t):_,m="trailing"in r?!!r.trailing:m),
s.cancel=a,s.flush=l,s}function Lf(n){return ai(n,jn)}function Cf(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new pl(en);var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;if(i.has(u))return i.get(u);var o=n.apply(this,e);return r.cache=i.set(u,o)||i,o};return r.cache=new(Cf.Cache||sr),r}function Uf(n){if("function"!=typeof n)throw new pl(en);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:
return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function Bf(n){return zf(2,n)}function Tf(n,t){if("function"!=typeof n)throw new pl(en);return t=t===X?t:kc(t),uu(n,t)}function $f(t,r){if("function"!=typeof t)throw new pl(en);return r=null==r?0:Gl(kc(r),0),uu((function(e){var u=e[r],i=Ou(e,0,r);return u&&a(i,u),n(t,this,i)}))}function Df(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new pl(en);return fc(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),
Wf(n,t,{leading:e,maxWait:t,trailing:u})}function Mf(n){return Rf(n,1)}function Ff(n,t){return ph(Au(t),n)}function Nf(){if(!arguments.length)return[];var n=arguments[0];return bh(n)?n:[n]}function Pf(n){return Fr(n,sn)}function qf(n,t){return t="function"==typeof t?t:X,Fr(n,sn,t)}function Zf(n){return Fr(n,an|sn)}function Kf(n,t){return t="function"==typeof t?t:X,Fr(n,an|sn,t)}function Vf(n,t){return null==t||Pr(n,t,Pc(t))}function Gf(n,t){return n===t||n!==n&&t!==t}function Hf(n){return null!=n&&oc(n.length)&&!uc(n);
}function Jf(n){return cc(n)&&Hf(n)}function Yf(n){return n===!0||n===!1||cc(n)&&we(n)==Nn}function Qf(n){return cc(n)&&1===n.nodeType&&!gc(n)}function Xf(n){if(null==n)return!0;if(Hf(n)&&(bh(n)||"string"==typeof n||"function"==typeof n.splice||mh(n)||Oh(n)||dh(n)))return!n.length;var t=zs(n);if(t==Gn||t==tt)return!n.size;if(Mi(n))return!Me(n).length;for(var r in n)if(bl.call(n,r))return!1;return!0}function nc(n,t){return Se(n,t)}function tc(n,t,r){r="function"==typeof r?r:X;var e=r?r(n,t):X;return e===X?Se(n,t,X,r):!!e;
}function rc(n){if(!cc(n))return!1;var t=we(n);return t==Zn||t==qn||"string"==typeof n.message&&"string"==typeof n.name&&!gc(n)}function ec(n){return"number"==typeof n&&Zl(n)}function uc(n){if(!fc(n))return!1;var t=we(n);return t==Kn||t==Vn||t==Fn||t==Xn}function ic(n){return"number"==typeof n&&n==kc(n)}function oc(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=Wn}function fc(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function cc(n){return null!=n&&"object"==typeof n}function ac(n,t){
return n===t||Ce(n,t,ji(t))}function lc(n,t,r){return r="function"==typeof r?r:X,Ce(n,t,ji(t),r)}function sc(n){return vc(n)&&n!=+n}function hc(n){if(Es(n))throw new fl(rn);return Ue(n)}function pc(n){return null===n}function _c(n){return null==n}function vc(n){return"number"==typeof n||cc(n)&&we(n)==Hn}function gc(n){if(!cc(n)||we(n)!=Yn)return!1;var t=El(n);if(null===t)return!0;var r=bl.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&dl.call(r)==jl}function yc(n){
return ic(n)&&n>=-Wn&&n<=Wn}function dc(n){return"string"==typeof n||!bh(n)&&cc(n)&&we(n)==rt}function bc(n){return"symbol"==typeof n||cc(n)&&we(n)==et}function wc(n){return n===X}function mc(n){return cc(n)&&zs(n)==it}function xc(n){return cc(n)&&we(n)==ot}function jc(n){if(!n)return[];if(Hf(n))return dc(n)?G(n):Tu(n);if(Ul&&n[Ul])return D(n[Ul]());var t=zs(n);return(t==Gn?M:t==tt?P:ra)(n)}function Ac(n){if(!n)return 0===n?n:0;if(n=Ic(n),n===Sn||n===-Sn){return(n<0?-1:1)*Ln}return n===n?n:0}function kc(n){
var t=Ac(n),r=t%1;return t===t?r?t-r:t:0}function Oc(n){return n?Mr(kc(n),0,Un):0}function Ic(n){if("number"==typeof n)return n;if(bc(n))return Cn;if(fc(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=fc(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=R(n);var r=qt.test(n);return r||Kt.test(n)?Xr(n.slice(2),r?2:8):Pt.test(n)?Cn:+n}function Rc(n){return $u(n,qc(n))}function zc(n){return n?Mr(kc(n),-Wn,Wn):0===n?n:0}function Ec(n){return null==n?"":vu(n)}function Sc(n,t){var r=gs(n);return null==t?r:Cr(r,t);
}function Wc(n,t){return v(n,mi(t,3),ue)}function Lc(n,t){return v(n,mi(t,3),oe)}function Cc(n,t){return null==n?n:bs(n,mi(t,3),qc)}function Uc(n,t){return null==n?n:ws(n,mi(t,3),qc)}function Bc(n,t){return n&&ue(n,mi(t,3))}function Tc(n,t){return n&&oe(n,mi(t,3))}function $c(n){return null==n?[]:fe(n,Pc(n))}function Dc(n){return null==n?[]:fe(n,qc(n))}function Mc(n,t,r){var e=null==n?X:_e(n,t);return e===X?r:e}function Fc(n,t){return null!=n&&Ri(n,t,xe)}function Nc(n,t){return null!=n&&Ri(n,t,je);
}function Pc(n){return Hf(n)?Or(n):Me(n)}function qc(n){return Hf(n)?Or(n,!0):Fe(n)}function Zc(n,t){var r={};return t=mi(t,3),ue(n,(function(n,e,u){Br(r,t(n,e,u),n)})),r}function Kc(n,t){var r={};return t=mi(t,3),ue(n,(function(n,e,u){Br(r,e,t(n,e,u))})),r}function Vc(n,t){return Gc(n,Uf(mi(t)))}function Gc(n,t){if(null==n)return{};var r=c(di(n),(function(n){return[n]}));return t=mi(t),Ye(n,r,(function(n,r){return t(n,r[0])}))}function Hc(n,t,r){t=ku(t,n);var e=-1,u=t.length;for(u||(u=1,n=X);++e<u;){var i=null==n?X:n[no(t[e])];
i===X&&(e=u,i=r),n=uc(i)?i.call(n):i}return n}function Jc(n,t,r){return null==n?n:fu(n,t,r)}function Yc(n,t,r,e){return e="function"==typeof e?e:X,null==n?n:fu(n,t,r,e)}function Qc(n,t,e){var u=bh(n),i=u||mh(n)||Oh(n);if(t=mi(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:fc(n)&&uc(o)?gs(El(n)):{}}return(i?r:ue)(n,(function(n,r,u){return t(e,n,r,u)})),e}function Xc(n,t){return null==n||yu(n,t)}function na(n,t,r){return null==n?n:du(n,t,Au(r))}function ta(n,t,r,e){return e="function"==typeof e?e:X,
null==n?n:du(n,t,Au(r),e)}function ra(n){return null==n?[]:E(n,Pc(n))}function ea(n){return null==n?[]:E(n,qc(n))}function ua(n,t,r){return r===X&&(r=t,t=X),r!==X&&(r=Ic(r),r=r===r?r:0),t!==X&&(t=Ic(t),t=t===t?t:0),Mr(Ic(n),t,r)}function ia(n,t,r){return t=Ac(t),r===X?(r=t,t=0):r=Ac(r),n=Ic(n),Ae(n,t,r)}function oa(n,t,r){if(r&&"boolean"!=typeof r&&Ui(n,t,r)&&(t=r=X),r===X&&("boolean"==typeof t?(r=t,t=X):"boolean"==typeof n&&(r=n,n=X)),n===X&&t===X?(n=0,t=1):(n=Ac(n),t===X?(t=n,n=0):t=Ac(t)),n>t){
var e=n;n=t,t=e}if(r||n%1||t%1){var u=Ql();return Hl(n+u*(t-n+Qr("1e-"+((u+"").length-1))),t)}return tu(n,t)}function fa(n){return Qh(Ec(n).toLowerCase())}function ca(n){return n=Ec(n),n&&n.replace(Gt,ve).replace(Dr,"")}function aa(n,t,r){n=Ec(n),t=vu(t);var e=n.length;r=r===X?e:Mr(kc(r),0,e);var u=r;return r-=t.length,r>=0&&n.slice(r,u)==t}function la(n){return n=Ec(n),n&&At.test(n)?n.replace(xt,ge):n}function sa(n){return n=Ec(n),n&&Wt.test(n)?n.replace(St,"\\$&"):n}function ha(n,t,r){n=Ec(n),t=kc(t);
var e=t?V(n):0;if(!t||e>=t)return n;var u=(t-e)/2;return ri(Nl(u),r)+n+ri(Fl(u),r)}function pa(n,t,r){n=Ec(n),t=kc(t);var e=t?V(n):0;return t&&e<t?n+ri(t-e,r):n}function _a(n,t,r){n=Ec(n),t=kc(t);var e=t?V(n):0;return t&&e<t?ri(t-e,r)+n:n}function va(n,t,r){return r||null==t?t=0:t&&(t=+t),Yl(Ec(n).replace(Lt,""),t||0)}function ga(n,t,r){return t=(r?Ui(n,t,r):t===X)?1:kc(t),eu(Ec(n),t)}function ya(){var n=arguments,t=Ec(n[0]);return n.length<3?t:t.replace(n[1],n[2])}function da(n,t,r){return r&&"number"!=typeof r&&Ui(n,t,r)&&(t=r=X),
(r=r===X?Un:r>>>0)?(n=Ec(n),n&&("string"==typeof t||null!=t&&!Ah(t))&&(t=vu(t),!t&&T(n))?Ou(G(n),0,r):n.split(t,r)):[]}function ba(n,t,r){return n=Ec(n),r=null==r?0:Mr(kc(r),0,n.length),t=vu(t),n.slice(r,r+t.length)==t}function wa(n,t,r){var e=Z.templateSettings;r&&Ui(n,t,r)&&(t=X),n=Ec(n),t=Sh({},t,e,li);var u,i,o=Sh({},t.imports,e.imports,li),f=Pc(o),c=E(o,f),a=0,l=t.interpolate||Ht,s="__p += '",h=sl((t.escape||Ht).source+"|"+l.source+"|"+(l===It?Ft:Ht).source+"|"+(t.evaluate||Ht).source+"|$","g"),p="//# sourceURL="+(bl.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zr+"]")+"\n";
n.replace(h,(function(t,r,e,o,f,c){return e||(e=o),s+=n.slice(a,c).replace(Jt,U),r&&(u=!0,s+="' +\n__e("+r+") +\n'"),f&&(i=!0,s+="';\n"+f+";\n__p += '"),e&&(s+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),a=c+t.length,t})),s+="';\n";var _=bl.call(t,"variable")&&t.variable;if(_){if(Dt.test(_))throw new fl(un)}else s="with (obj) {\n"+s+"\n}\n";s=(i?s.replace(dt,""):s).replace(bt,"$1").replace(wt,"$1;"),s="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+s+"return __p\n}";
var v=Xh((function(){return cl(f,p+"return "+s).apply(X,c)}));if(v.source=s,rc(v))throw v;return v}function ma(n){return Ec(n).toLowerCase()}function xa(n){return Ec(n).toUpperCase()}function ja(n,t,r){if(n=Ec(n),n&&(r||t===X))return R(n);if(!n||!(t=vu(t)))return n;var e=G(n),u=G(t);return Ou(e,W(e,u),L(e,u)+1).join("")}function Aa(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.slice(0,H(n)+1);if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,0,L(e,G(t))+1).join("")}function ka(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.replace(Lt,"");
if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,W(e,G(t))).join("")}function Oa(n,t){var r=An,e=kn;if(fc(t)){var u="separator"in t?t.separator:u;r="length"in t?kc(t.length):r,e="omission"in t?vu(t.omission):e}n=Ec(n);var i=n.length;if(T(n)){var o=G(n);i=o.length}if(r>=i)return n;var f=r-V(e);if(f<1)return e;var c=o?Ou(o,0,f).join(""):n.slice(0,f);if(u===X)return c+e;if(o&&(f+=c.length-f),Ah(u)){if(n.slice(f).search(u)){var a,l=c;for(u.global||(u=sl(u.source,Ec(Nt.exec(u))+"g")),u.lastIndex=0;a=u.exec(l);)var s=a.index;
c=c.slice(0,s===X?f:s)}}else if(n.indexOf(vu(u),f)!=f){var h=c.lastIndexOf(u);h>-1&&(c=c.slice(0,h))}return c+e}function Ia(n){return n=Ec(n),n&&jt.test(n)?n.replace(mt,ye):n}function Ra(n,t,r){return n=Ec(n),t=r?X:t,t===X?$(n)?Q(n):_(n):n.match(t)||[]}function za(t){var r=null==t?0:t.length,e=mi();return t=r?c(t,(function(n){if("function"!=typeof n[1])throw new pl(en);return[e(n[0]),n[1]]})):[],uu((function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}}))}function Ea(n){
return Nr(Fr(n,an))}function Sa(n){return function(){return n}}function Wa(n,t){return null==n||n!==n?t:n}function La(n){return n}function Ca(n){return De("function"==typeof n?n:Fr(n,an))}function Ua(n){return qe(Fr(n,an))}function Ba(n,t){return Ze(n,Fr(t,an))}function Ta(n,t,e){var u=Pc(t),i=fe(t,u);null!=e||fc(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=fe(t,Pc(t)));var o=!(fc(e)&&"chain"in e&&!e.chain),f=uc(n);return r(i,(function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;
if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Tu(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})})),n}function $a(){return re._===this&&(re._=Al),this}function Da(){}function Ma(n){return n=kc(n),uu((function(t){return Ge(t,n)}))}function Fa(n){return Bi(n)?m(no(n)):Qe(n)}function Na(n){return function(t){return null==n?X:_e(n,t)}}function Pa(){return[]}function qa(){return!1}function Za(){return{}}function Ka(){return"";
}function Va(){return!0}function Ga(n,t){if(n=kc(n),n<1||n>Wn)return[];var r=Un,e=Hl(n,Un);t=mi(t),n-=Un;for(var u=O(e,t);++r<n;)t(r);return u}function Ha(n){return bh(n)?c(n,no):bc(n)?[n]:Tu(Cs(Ec(n)))}function Ja(n){var t=++wl;return Ec(n)+t}function Ya(n){return n&&n.length?Yr(n,La,me):X}function Qa(n,t){return n&&n.length?Yr(n,mi(t,2),me):X}function Xa(n){return w(n,La)}function nl(n,t){return w(n,mi(t,2))}function tl(n){return n&&n.length?Yr(n,La,Ne):X}function rl(n,t){return n&&n.length?Yr(n,mi(t,2),Ne):X;
}function el(n){return n&&n.length?k(n,La):0}function ul(n,t){return n&&n.length?k(n,mi(t,2)):0}x=null==x?re:be.defaults(re.Object(),x,be.pick(re,qr));var il=x.Array,ol=x.Date,fl=x.Error,cl=x.Function,al=x.Math,ll=x.Object,sl=x.RegExp,hl=x.String,pl=x.TypeError,_l=il.prototype,vl=cl.prototype,gl=ll.prototype,yl=x["__core-js_shared__"],dl=vl.toString,bl=gl.hasOwnProperty,wl=0,ml=(function(){var n=/[^.]+$/.exec(yl&&yl.keys&&yl.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})(),xl=gl.toString,jl=dl.call(ll),Al=re._,kl=sl("^"+dl.call(bl).replace(St,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ol=ie?x.Buffer:X,Il=x.Symbol,Rl=x.Uint8Array,zl=Ol?Ol.allocUnsafe:X,El=F(ll.getPrototypeOf,ll),Sl=ll.create,Wl=gl.propertyIsEnumerable,Ll=_l.splice,Cl=Il?Il.isConcatSpreadable:X,Ul=Il?Il.iterator:X,Bl=Il?Il.toStringTag:X,Tl=(function(){
try{var n=Ai(ll,"defineProperty");return n({},"",{}),n}catch(n){}})(),$l=x.clearTimeout!==re.clearTimeout&&x.clearTimeout,Dl=ol&&ol.now!==re.Date.now&&ol.now,Ml=x.setTimeout!==re.setTimeout&&x.setTimeout,Fl=al.ceil,Nl=al.floor,Pl=ll.getOwnPropertySymbols,ql=Ol?Ol.isBuffer:X,Zl=x.isFinite,Kl=_l.join,Vl=F(ll.keys,ll),Gl=al.max,Hl=al.min,Jl=ol.now,Yl=x.parseInt,Ql=al.random,Xl=_l.reverse,ns=Ai(x,"DataView"),ts=Ai(x,"Map"),rs=Ai(x,"Promise"),es=Ai(x,"Set"),us=Ai(x,"WeakMap"),is=Ai(ll,"create"),os=us&&new us,fs={},cs=to(ns),as=to(ts),ls=to(rs),ss=to(es),hs=to(us),ps=Il?Il.prototype:X,_s=ps?ps.valueOf:X,vs=ps?ps.toString:X,gs=(function(){
function n(){}return function(t){if(!fc(t))return{};if(Sl)return Sl(t);n.prototype=t;var r=new n;return n.prototype=X,r}})();Z.templateSettings={escape:kt,evaluate:Ot,interpolate:It,variable:"",imports:{_:Z}},Z.prototype=J.prototype,Z.prototype.constructor=Z,Y.prototype=gs(J.prototype),Y.prototype.constructor=Y,Ct.prototype=gs(J.prototype),Ct.prototype.constructor=Ct,Xt.prototype.clear=nr,Xt.prototype.delete=tr,Xt.prototype.get=rr,Xt.prototype.has=er,Xt.prototype.set=ur,ir.prototype.clear=or,ir.prototype.delete=fr,
ir.prototype.get=cr,ir.prototype.has=ar,ir.prototype.set=lr,sr.prototype.clear=hr,sr.prototype.delete=pr,sr.prototype.get=_r,sr.prototype.has=vr,sr.prototype.set=gr,yr.prototype.add=yr.prototype.push=dr,yr.prototype.has=br,wr.prototype.clear=mr,wr.prototype.delete=xr,wr.prototype.get=jr,wr.prototype.has=Ar,wr.prototype.set=kr;var ys=Pu(ue),ds=Pu(oe,!0),bs=qu(),ws=qu(!0),ms=os?function(n,t){return os.set(n,t),n}:La,xs=Tl?function(n,t){return Tl(n,"toString",{configurable:!0,enumerable:!1,value:Sa(t),
writable:!0})}:La,js=uu,As=$l||function(n){return re.clearTimeout(n)},ks=es&&1/P(new es([,-0]))[1]==Sn?function(n){return new es(n)}:Da,Os=os?function(n){return os.get(n)}:Da,Is=Pl?function(n){return null==n?[]:(n=ll(n),i(Pl(n),(function(t){return Wl.call(n,t)})))}:Pa,Rs=Pl?function(n){for(var t=[];n;)a(t,Is(n)),n=El(n);return t}:Pa,zs=we;(ns&&zs(new ns(new ArrayBuffer(1)))!=ct||ts&&zs(new ts)!=Gn||rs&&zs(rs.resolve())!=Qn||es&&zs(new es)!=tt||us&&zs(new us)!=it)&&(zs=function(n){var t=we(n),r=t==Yn?n.constructor:X,e=r?to(r):"";
if(e)switch(e){case cs:return ct;case as:return Gn;case ls:return Qn;case ss:return tt;case hs:return it}return t});var Es=yl?uc:qa,Ss=Qi(ms),Ws=Ml||function(n,t){return re.setTimeout(n,t)},Ls=Qi(xs),Cs=Pi((function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(Et,(function(n,r,e,u){t.push(e?u.replace(Mt,"$1"):r||n)})),t})),Us=uu((function(n,t){return Jf(n)?Hr(n,ee(t,1,Jf,!0)):[]})),Bs=uu((function(n,t){var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),mi(r,2)):[]})),Ts=uu((function(n,t){
var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),X,r):[]})),$s=uu((function(n){var t=c(n,ju);return t.length&&t[0]===n[0]?ke(t):[]})),Ds=uu((function(n){var t=jo(n),r=c(n,ju);return t===jo(r)?t=X:r.pop(),r.length&&r[0]===n[0]?ke(r,mi(t,2)):[]})),Ms=uu((function(n){var t=jo(n),r=c(n,ju);return t="function"==typeof t?t:X,t&&r.pop(),r.length&&r[0]===n[0]?ke(r,X,t):[]})),Fs=uu(Oo),Ns=gi((function(n,t){var r=null==n?0:n.length,e=Tr(n,t);return nu(n,c(t,(function(n){return Ci(n,r)?+n:n})).sort(Lu)),e})),Ps=uu((function(n){
return gu(ee(n,1,Jf,!0))})),qs=uu((function(n){var t=jo(n);return Jf(t)&&(t=X),gu(ee(n,1,Jf,!0),mi(t,2))})),Zs=uu((function(n){var t=jo(n);return t="function"==typeof t?t:X,gu(ee(n,1,Jf,!0),X,t)})),Ks=uu((function(n,t){return Jf(n)?Hr(n,t):[]})),Vs=uu((function(n){return mu(i(n,Jf))})),Gs=uu((function(n){var t=jo(n);return Jf(t)&&(t=X),mu(i(n,Jf),mi(t,2))})),Hs=uu((function(n){var t=jo(n);return t="function"==typeof t?t:X,mu(i(n,Jf),X,t)})),Js=uu(Go),Ys=uu((function(n){var t=n.length,r=t>1?n[t-1]:X;return r="function"==typeof r?(n.pop(),
r):X,Ho(n,r)})),Qs=gi((function(n){var t=n.length,r=t?n[0]:0,e=this.__wrapped__,u=function(t){return Tr(t,n)};return!(t>1||this.__actions__.length)&&e instanceof Ct&&Ci(r)?(e=e.slice(r,+r+(t?1:0)),e.__actions__.push({func:nf,args:[u],thisArg:X}),new Y(e,this.__chain__).thru((function(n){return t&&!n.length&&n.push(X),n}))):this.thru(u)})),Xs=Fu((function(n,t,r){bl.call(n,r)?++n[r]:Br(n,r,1)})),nh=Ju(ho),th=Ju(po),rh=Fu((function(n,t,r){bl.call(n,r)?n[r].push(t):Br(n,r,[t])})),eh=uu((function(t,r,e){var u=-1,i="function"==typeof r,o=Hf(t)?il(t.length):[];
return ys(t,(function(t){o[++u]=i?n(r,t,e):Ie(t,r,e)})),o})),uh=Fu((function(n,t,r){Br(n,r,t)})),ih=Fu((function(n,t,r){n[r?0:1].push(t)}),(function(){return[[],[]]})),oh=uu((function(n,t){if(null==n)return[];var r=t.length;return r>1&&Ui(n,t[0],t[1])?t=[]:r>2&&Ui(t[0],t[1],t[2])&&(t=[t[0]]),He(n,ee(t,1),[])})),fh=Dl||function(){return re.Date.now()},ch=uu((function(n,t,r){var e=_n;if(r.length){var u=N(r,wi(ch));e|=bn}return ai(n,e,t,r,u)})),ah=uu((function(n,t,r){var e=_n|vn;if(r.length){var u=N(r,wi(ah));e|=bn;
}return ai(t,e,n,r,u)})),lh=uu((function(n,t){return Gr(n,1,t)})),sh=uu((function(n,t,r){return Gr(n,Ic(t)||0,r)}));Cf.Cache=sr;var hh=js((function(t,r){r=1==r.length&&bh(r[0])?c(r[0],z(mi())):c(ee(r,1),z(mi()));var e=r.length;return uu((function(u){for(var i=-1,o=Hl(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]);return n(t,this,u)}))})),ph=uu((function(n,t){return ai(n,bn,X,t,N(t,wi(ph)))})),_h=uu((function(n,t){return ai(n,wn,X,t,N(t,wi(_h)))})),vh=gi((function(n,t){return ai(n,xn,X,X,X,t)})),gh=ii(me),yh=ii((function(n,t){
return n>=t})),dh=Re(function(){return arguments}())?Re:function(n){return cc(n)&&bl.call(n,"callee")&&!Wl.call(n,"callee")},bh=il.isArray,wh=ce?z(ce):ze,mh=ql||qa,xh=ae?z(ae):Ee,jh=le?z(le):Le,Ah=se?z(se):Be,kh=he?z(he):Te,Oh=pe?z(pe):$e,Ih=ii(Ne),Rh=ii((function(n,t){return n<=t})),zh=Nu((function(n,t){if(Mi(t)||Hf(t))return $u(t,Pc(t),n),X;for(var r in t)bl.call(t,r)&&Sr(n,r,t[r])})),Eh=Nu((function(n,t){$u(t,qc(t),n)})),Sh=Nu((function(n,t,r,e){$u(t,qc(t),n,e)})),Wh=Nu((function(n,t,r,e){$u(t,Pc(t),n,e);
})),Lh=gi(Tr),Ch=uu((function(n,t){n=ll(n);var r=-1,e=t.length,u=e>2?t[2]:X;for(u&&Ui(t[0],t[1],u)&&(e=1);++r<e;)for(var i=t[r],o=qc(i),f=-1,c=o.length;++f<c;){var a=o[f],l=n[a];(l===X||Gf(l,gl[a])&&!bl.call(n,a))&&(n[a]=i[a])}return n})),Uh=uu((function(t){return t.push(X,si),n(Mh,X,t)})),Bh=Xu((function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=xl.call(t)),n[t]=r}),Sa(La)),Th=Xu((function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=xl.call(t)),bl.call(n,t)?n[t].push(r):n[t]=[r]}),mi),$h=uu(Ie),Dh=Nu((function(n,t,r){
Ke(n,t,r)})),Mh=Nu((function(n,t,r,e){Ke(n,t,r,e)})),Fh=gi((function(n,t){var r={};if(null==n)return r;var e=!1;t=c(t,(function(t){return t=ku(t,n),e||(e=t.length>1),t})),$u(n,di(n),r),e&&(r=Fr(r,an|ln|sn,hi));for(var u=t.length;u--;)yu(r,t[u]);return r})),Nh=gi((function(n,t){return null==n?{}:Je(n,t)})),Ph=ci(Pc),qh=ci(qc),Zh=Vu((function(n,t,r){return t=t.toLowerCase(),n+(r?fa(t):t)})),Kh=Vu((function(n,t,r){return n+(r?"-":"")+t.toLowerCase()})),Vh=Vu((function(n,t,r){return n+(r?" ":"")+t.toLowerCase()})),Gh=Ku("toLowerCase"),Hh=Vu((function(n,t,r){
return n+(r?"_":"")+t.toLowerCase()})),Jh=Vu((function(n,t,r){return n+(r?" ":"")+Qh(t)})),Yh=Vu((function(n,t,r){return n+(r?" ":"")+t.toUpperCase()})),Qh=Ku("toUpperCase"),Xh=uu((function(t,r){try{return n(t,X,r)}catch(n){return rc(n)?n:new fl(n)}})),np=gi((function(n,t){return r(t,(function(t){t=no(t),Br(n,t,ch(n[t],n))})),n})),tp=Yu(),rp=Yu(!0),ep=uu((function(n,t){return function(r){return Ie(r,n,t)}})),up=uu((function(n,t){return function(r){return Ie(n,r,t)}})),ip=ti(c),op=ti(u),fp=ti(h),cp=ui(),ap=ui(!0),lp=ni((function(n,t){
return n+t}),0),sp=fi("ceil"),hp=ni((function(n,t){return n/t}),1),pp=fi("floor"),_p=ni((function(n,t){return n*t}),1),vp=fi("round"),gp=ni((function(n,t){return n-t}),0);return Z.after=If,Z.ary=Rf,Z.assign=zh,Z.assignIn=Eh,Z.assignInWith=Sh,Z.assignWith=Wh,Z.at=Lh,Z.before=zf,Z.bind=ch,Z.bindAll=np,Z.bindKey=ah,Z.castArray=Nf,Z.chain=Qo,Z.chunk=uo,Z.compact=io,Z.concat=oo,Z.cond=za,Z.conforms=Ea,Z.constant=Sa,Z.countBy=Xs,Z.create=Sc,Z.curry=Ef,Z.curryRight=Sf,Z.debounce=Wf,Z.defaults=Ch,Z.defaultsDeep=Uh,
Z.defer=lh,Z.delay=sh,Z.difference=Us,Z.differenceBy=Bs,Z.differenceWith=Ts,Z.drop=fo,Z.dropRight=co,Z.dropRightWhile=ao,Z.dropWhile=lo,Z.fill=so,Z.filter=lf,Z.flatMap=sf,Z.flatMapDeep=hf,Z.flatMapDepth=pf,Z.flatten=_o,Z.flattenDeep=vo,Z.flattenDepth=go,Z.flip=Lf,Z.flow=tp,Z.flowRight=rp,Z.fromPairs=yo,Z.functions=$c,Z.functionsIn=Dc,Z.groupBy=rh,Z.initial=mo,Z.intersection=$s,Z.intersectionBy=Ds,Z.intersectionWith=Ms,Z.invert=Bh,Z.invertBy=Th,Z.invokeMap=eh,Z.iteratee=Ca,Z.keyBy=uh,Z.keys=Pc,Z.keysIn=qc,
Z.map=yf,Z.mapKeys=Zc,Z.mapValues=Kc,Z.matches=Ua,Z.matchesProperty=Ba,Z.memoize=Cf,Z.merge=Dh,Z.mergeWith=Mh,Z.method=ep,Z.methodOf=up,Z.mixin=Ta,Z.negate=Uf,Z.nthArg=Ma,Z.omit=Fh,Z.omitBy=Vc,Z.once=Bf,Z.orderBy=df,Z.over=ip,Z.overArgs=hh,Z.overEvery=op,Z.overSome=fp,Z.partial=ph,Z.partialRight=_h,Z.partition=ih,Z.pick=Nh,Z.pickBy=Gc,Z.property=Fa,Z.propertyOf=Na,Z.pull=Fs,Z.pullAll=Oo,Z.pullAllBy=Io,Z.pullAllWith=Ro,Z.pullAt=Ns,Z.range=cp,Z.rangeRight=ap,Z.rearg=vh,Z.reject=mf,Z.remove=zo,Z.rest=Tf,
Z.reverse=Eo,Z.sampleSize=jf,Z.set=Jc,Z.setWith=Yc,Z.shuffle=Af,Z.slice=So,Z.sortBy=oh,Z.sortedUniq=$o,Z.sortedUniqBy=Do,Z.split=da,Z.spread=$f,Z.tail=Mo,Z.take=Fo,Z.takeRight=No,Z.takeRightWhile=Po,Z.takeWhile=qo,Z.tap=Xo,Z.throttle=Df,Z.thru=nf,Z.toArray=jc,Z.toPairs=Ph,Z.toPairsIn=qh,Z.toPath=Ha,Z.toPlainObject=Rc,Z.transform=Qc,Z.unary=Mf,Z.union=Ps,Z.unionBy=qs,Z.unionWith=Zs,Z.uniq=Zo,Z.uniqBy=Ko,Z.uniqWith=Vo,Z.unset=Xc,Z.unzip=Go,Z.unzipWith=Ho,Z.update=na,Z.updateWith=ta,Z.values=ra,Z.valuesIn=ea,
Z.without=Ks,Z.words=Ra,Z.wrap=Ff,Z.xor=Vs,Z.xorBy=Gs,Z.xorWith=Hs,Z.zip=Js,Z.zipObject=Jo,Z.zipObjectDeep=Yo,Z.zipWith=Ys,Z.entries=Ph,Z.entriesIn=qh,Z.extend=Eh,Z.extendWith=Sh,Ta(Z,Z),Z.add=lp,Z.attempt=Xh,Z.camelCase=Zh,Z.capitalize=fa,Z.ceil=sp,Z.clamp=ua,Z.clone=Pf,Z.cloneDeep=Zf,Z.cloneDeepWith=Kf,Z.cloneWith=qf,Z.conformsTo=Vf,Z.deburr=ca,Z.defaultTo=Wa,Z.divide=hp,Z.endsWith=aa,Z.eq=Gf,Z.escape=la,Z.escapeRegExp=sa,Z.every=af,Z.find=nh,Z.findIndex=ho,Z.findKey=Wc,Z.findLast=th,Z.findLastIndex=po,
Z.findLastKey=Lc,Z.floor=pp,Z.forEach=_f,Z.forEachRight=vf,Z.forIn=Cc,Z.forInRight=Uc,Z.forOwn=Bc,Z.forOwnRight=Tc,Z.get=Mc,Z.gt=gh,Z.gte=yh,Z.has=Fc,Z.hasIn=Nc,Z.head=bo,Z.identity=La,Z.includes=gf,Z.indexOf=wo,Z.inRange=ia,Z.invoke=$h,Z.isArguments=dh,Z.isArray=bh,Z.isArrayBuffer=wh,Z.isArrayLike=Hf,Z.isArrayLikeObject=Jf,Z.isBoolean=Yf,Z.isBuffer=mh,Z.isDate=xh,Z.isElement=Qf,Z.isEmpty=Xf,Z.isEqual=nc,Z.isEqualWith=tc,Z.isError=rc,Z.isFinite=ec,Z.isFunction=uc,Z.isInteger=ic,Z.isLength=oc,Z.isMap=jh,
Z.isMatch=ac,Z.isMatchWith=lc,Z.isNaN=sc,Z.isNative=hc,Z.isNil=_c,Z.isNull=pc,Z.isNumber=vc,Z.isObject=fc,Z.isObjectLike=cc,Z.isPlainObject=gc,Z.isRegExp=Ah,Z.isSafeInteger=yc,Z.isSet=kh,Z.isString=dc,Z.isSymbol=bc,Z.isTypedArray=Oh,Z.isUndefined=wc,Z.isWeakMap=mc,Z.isWeakSet=xc,Z.join=xo,Z.kebabCase=Kh,Z.last=jo,Z.lastIndexOf=Ao,Z.lowerCase=Vh,Z.lowerFirst=Gh,Z.lt=Ih,Z.lte=Rh,Z.max=Ya,Z.maxBy=Qa,Z.mean=Xa,Z.meanBy=nl,Z.min=tl,Z.minBy=rl,Z.stubArray=Pa,Z.stubFalse=qa,Z.stubObject=Za,Z.stubString=Ka,
Z.stubTrue=Va,Z.multiply=_p,Z.nth=ko,Z.noConflict=$a,Z.noop=Da,Z.now=fh,Z.pad=ha,Z.padEnd=pa,Z.padStart=_a,Z.parseInt=va,Z.random=oa,Z.reduce=bf,Z.reduceRight=wf,Z.repeat=ga,Z.replace=ya,Z.result=Hc,Z.round=vp,Z.runInContext=p,Z.sample=xf,Z.size=kf,Z.snakeCase=Hh,Z.some=Of,Z.sortedIndex=Wo,Z.sortedIndexBy=Lo,Z.sortedIndexOf=Co,Z.sortedLastIndex=Uo,Z.sortedLastIndexBy=Bo,Z.sortedLastIndexOf=To,Z.startCase=Jh,Z.startsWith=ba,Z.subtract=gp,Z.sum=el,Z.sumBy=ul,Z.template=wa,Z.times=Ga,Z.toFinite=Ac,Z.toInteger=kc,
Z.toLength=Oc,Z.toLower=ma,Z.toNumber=Ic,Z.toSafeInteger=zc,Z.toString=Ec,Z.toUpper=xa,Z.trim=ja,Z.trimEnd=Aa,Z.trimStart=ka,Z.truncate=Oa,Z.unescape=Ia,Z.uniqueId=Ja,Z.upperCase=Yh,Z.upperFirst=Qh,Z.each=_f,Z.eachRight=vf,Z.first=bo,Ta(Z,(function(){var n={};return ue(Z,(function(t,r){bl.call(Z.prototype,r)||(n[r]=t)})),n})(),{chain:!1}),Z.VERSION=nn,r(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(n){Z[n].placeholder=Z})),r(["drop","take"],(function(n,t){Ct.prototype[n]=function(r){
r=r===X?1:Gl(kc(r),0);var e=this.__filtered__&&!t?new Ct(this):this.clone();return e.__filtered__?e.__takeCount__=Hl(r,e.__takeCount__):e.__views__.push({size:Hl(r,Un),type:n+(e.__dir__<0?"Right":"")}),e},Ct.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}})),r(["filter","map","takeWhile"],(function(n,t){var r=t+1,e=r==Rn||r==En;Ct.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:mi(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}})),r(["head","last"],(function(n,t){
var r="take"+(t?"Right":"");Ct.prototype[n]=function(){return this[r](1).value()[0]}})),r(["initial","tail"],(function(n,t){var r="drop"+(t?"":"Right");Ct.prototype[n]=function(){return this.__filtered__?new Ct(this):this[r](1)}})),Ct.prototype.compact=function(){return this.filter(La)},Ct.prototype.find=function(n){return this.filter(n).head()},Ct.prototype.findLast=function(n){return this.reverse().find(n)},Ct.prototype.invokeMap=uu((function(n,t){return"function"==typeof n?new Ct(this):this.map((function(r){
return Ie(r,n,t)}))})),Ct.prototype.reject=function(n){return this.filter(Uf(mi(n)))},Ct.prototype.slice=function(n,t){n=kc(n);var r=this;return r.__filtered__&&(n>0||t<0)?new Ct(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==X&&(t=kc(t),r=t<0?r.dropRight(-t):r.take(t-n)),r)},Ct.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ct.prototype.toArray=function(){return this.take(Un)},ue(Ct.prototype,(function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=Z[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);
u&&(Z.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof Ct,c=o[0],l=f||bh(t),s=function(n){var t=u.apply(Z,a([n],o));return e&&h?t[0]:t};l&&r&&"function"==typeof c&&1!=c.length&&(f=l=!1);var h=this.__chain__,p=!!this.__actions__.length,_=i&&!h,v=f&&!p;if(!i&&l){t=v?t:new Ct(this);var g=n.apply(t,o);return g.__actions__.push({func:nf,args:[s],thisArg:X}),new Y(g,h)}return _&&v?n.apply(this,o):(g=this.thru(s),_?e?g.value()[0]:g.value():g)})})),r(["pop","push","shift","sort","splice","unshift"],(function(n){
var t=_l[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);Z.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(bh(u)?u:[],n)}return this[r]((function(r){return t.apply(bh(r)?r:[],n)}))}})),ue(Ct.prototype,(function(n,t){var r=Z[t];if(r){var e=r.name+"";bl.call(fs,e)||(fs[e]=[]),fs[e].push({name:t,func:r})}})),fs[Qu(X,vn).name]=[{name:"wrapper",func:X}],Ct.prototype.clone=$t,Ct.prototype.reverse=Yt,Ct.prototype.value=Qt,Z.prototype.at=Qs,
Z.prototype.chain=tf,Z.prototype.commit=rf,Z.prototype.next=ef,Z.prototype.plant=of,Z.prototype.reverse=ff,Z.prototype.toJSON=Z.prototype.valueOf=Z.prototype.value=cf,Z.prototype.first=Z.prototype.head,Ul&&(Z.prototype[Ul]=uf),Z},be=de();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(re._=be,define((function(){return be}))):ue?((ue.exports=be)._=be,ee._=be):re._=be}).call(this);;
/*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */
!(function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)})("undefined"!=typeof window?window:this,(function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,(function(e,t){return n.call(e,t,e)})))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,(function(e,t){return(t+1)%2})))},odd:function(){return this.pushStack(S.grep(this,(function(e,t){return t%2})))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),(function(e,t){n["[object "+t+"]"]=t.toLowerCase()}));var d=(function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",B=new RegExp(M+"+","g"),$=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le((function(o){return o=+o,le((function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))}))}))}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce((function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),d.attributes=ce((function(e){return e.className="i",!e.getAttribute("className")})),d.getElementsByTagName=ce((function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length})),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce((function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length})),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce((function(e){var t;a.appendChild(e).innerHTML="<a id='"+S+"'></a><select id='"+S+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")})),ce((function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")}))),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce((function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)})),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!=C&&T(e),y(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&j.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==r?r:d.attributes||!E?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(D),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,(function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(B," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(h,e,t,g,v){var y="nth"!==h.slice(0,3),m="last"!==h.slice(-4),x="of-type"===e;return 1===g&&0===v?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=y!==m?"nextSibling":"previousSibling",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(y){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l="only"===h&&!u&&"nextSibling"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[k,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[k,d]),a===e))break;return(d-=v)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le((function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])})):function(e){return a(e,0,t)}):a}},pseudos:{not:le((function(e){var r=[],i=[],s=f(e.replace($,"$1"));return s[S]?le((function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))})):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}})),has:le((function(t){return function(e){return 0<se(t,e).length}})),contains:le((function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}})),lang:le((function(n){return V.test(n||"")||se.error("unsupported lang: "+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=E?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}})),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve((function(){return[0]})),last:ve((function(e,t){return[t-1]})),eq:ve((function(e,t,n){return[n<0?n+t:n]})),even:ve((function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e})),odd:ve((function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e})),lt:ve((function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e})),gt:ve((function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e}))}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&"parentNode"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[k,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[S]||(e[S]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===k&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Te(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Ce(d,h,g,v,y,e){return v&&!v[S]&&(v=Ce(v)),y&&!y[S]&&(y=Ce(y,e)),le((function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||(function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n})(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?y||(e?d:l||v)?[]:t:f;if(g&&g(f,p,n,r),v){i=Te(p,u),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(y||d){if(y){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);y(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=y?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),y?y(null,t,p,r):H.apply(t,p)}))}function Ee(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=be((function(e){return e===i}),a,!0),l=be((function(e){return-1<P(i,e)}),a,!0),c=[function(e,t,n){var r=!o&&(n||t!==w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[be(we(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace($,"$1"),t,s<n&&Ee(e.slice(s,n)),n<r&&Ee(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace($," ")}),a=a.slice(n.length)),b.filter)!(r=G[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,v,y,m,x,r,i=[],o=[],a=A[e+" "];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Ee(t[n]))[S]?i.push(a):o.push(a);(a=A(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=k+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==C||(T(o),n=!E);while(s=v[a++])if(s(o,t||C,n)){r.push(o);break}i&&(k=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&se.uniqueSort(r)}return i&&(k=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&h(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&E&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(te,ne),ee.test(o[0].type)&&ye(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!E,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},d.sortStable=S.split("").sort(D).join("")===S,d.detectDuplicates=!!l,T(),d.sortDetached=ce((function(e){return 1&e.compareDocumentPosition(C.createElement("fieldset"))})),ce((function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")}))||fe("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),d.attributes&&ce((function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||fe("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),ce((function(e){return null==e.getAttribute("disabled")}))||fe(R,(function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null})),se})(C);S.find=d,S.expr=d.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=d.uniqueSort,S.text=d.getText,S.isXMLDoc=d.isXML,S.contains=d.contains,S.escapeSelector=d.escape;var h=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&S(e).is(n))break;r.push(e)}return r},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=S.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var N=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,(function(e,t){return!!n.call(e,t,e)!==r})):n.nodeType?S.grep(e,(function(e){return e===n!==r})):"string"!=typeof n?S.grep(e,(function(e){return-1<i.call(n,e)!==r})):S.filter(n,e,r)}S.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?S.find.matchesSelector(r,e)?[r]:[]:S.find.matches(e,S.grep(t,(function(e){return 1===e.nodeType})))},S.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(S(e).filter((function(){for(t=0;t<r;t++)if(S.contains(i[t],this))return!0})));for(n=this.pushStack([]),t=0;t<r;t++)S.find(e,i[t],n);return 1<r?S.uniqueSort(n):n},filter:function(e){return this.pushStack(D(this,e||[],!1))},not:function(e){return this.pushStack(D(this,e||[],!0))},is:function(e){return!!D(this,"string"==typeof e&&k.test(e)?S(e):e||[],!1).length}});var j,q=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter((function(){for(var e=0;e<n;e++)if(S.contains(this,t[e]))return!0}))},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&S(e);if(!k.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&S.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?S.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?i.call(S(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return h(e,"parentNode")},parentsUntil:function(e,t,n){return h(e,"parentNode",n)},next:function(e){return O(e,"nextSibling")},prev:function(e){return O(e,"previousSibling")},nextAll:function(e){return h(e,"nextSibling")},prevAll:function(e){return h(e,"previousSibling")},nextUntil:function(e,t,n){return h(e,"nextSibling",n)},prevUntil:function(e,t,n){return h(e,"previousSibling",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),S.merge([],e.childNodes))}},(function(r,i){S.fn[r]=function(e,t){var n=S.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=S.filter(t,n)),1<this.length&&(H[r]||S.uniqueSort(n),L.test(r)&&n.reverse()),this.pushStack(n)}}));var P=/[^\x20\t\r\n\f]+/g;function R(e){return e}function M(e){throw e}function I(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}S.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},S.each(e.match(P)||[],(function(e,t){n[t]=!0})),n):S.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),(function n(e){S.each(e,(function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==w(t)&&n(t)}))})(arguments),t&&!i&&c()),this},remove:function(){return S.each(arguments,(function(e,t){var n;while(-1<(n=S.inArray(t,s,n)))s.splice(n,1),n<=l&&l--})),this},has:function(e){return e?-1<S.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},S.extend({Deferred:function(e){var o=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return S.Deferred((function(r){S.each(o,(function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]]((function(){var e=n&&n.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)}))})),i=null})).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,m(t)?s?t.call(e,l(u,o,R,s),l(u,o,M,s)):(u++,t.call(e,l(u,o,R,s),l(u,o,M,s),l(u,o,R,o.notifyWith))):(a!==R&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){S.Deferred.exceptionHook&&S.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==M&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(S.Deferred.getStackHook&&(t.stackTrace=S.Deferred.getStackHook()),C.setTimeout(t))}}return S.Deferred((function(e){o[0][3].add(l(0,e,m(r)?r:R,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:R)),o[2][3].add(l(0,e,m(n)?n:M))})).promise()},promise:function(e){return null!=e?S.extend(e,a):a}},s={};return S.each(o,(function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add((function(){i=r}),o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith})),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=s.call(arguments),o=S.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(I(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)I(i[t],a(t),o.reject);return o.promise()}});var W=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&W.test(e.name)&&C.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},S.readyException=function(e){C.setTimeout((function(){throw e}))};var F=S.Deferred();function B(){E.removeEventListener("DOMContentLoaded",B),C.removeEventListener("load",B),S.ready()}S.fn.ready=function(e){return F.then(e)["catch"]((function(e){S.readyException(e)})),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0)!==e&&0<--S.readyWait||F.resolveWith(E,[S])}}),S.ready.then=F.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?C.setTimeout(S.ready):(E.addEventListener("DOMContentLoaded",B),C.addEventListener("load",B));var $=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===w(n))for(s in i=!0,n)$(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(S(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},_=/^-ms-/,z=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function X(e){return e.replace(_,"ms-").replace(z,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=S.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[X(t)]=n;else for(r in t)i[X(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][X(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(X):(t=X(t))in r?[t]:t.match(P)||[]).length;while(n--)delete r[t[n]]}(void 0===t||S.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!S.isEmptyObject(t)}};var Y=new G,Q=new G,J=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/[A-Z]/g;function Z(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(K,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:J.test(i)?JSON.parse(i):i)}catch(e){}Q.set(e,t,n)}else n=void 0;return n}S.extend({hasData:function(e){return Q.hasData(e)||Y.hasData(e)},data:function(e,t,n){return Q.access(e,t,n)},removeData:function(e,t){Q.remove(e,t)},_data:function(e,t,n){return Y.access(e,t,n)},_removeData:function(e,t){Y.remove(e,t)}}),S.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=Q.get(o),1===o.nodeType&&!Y.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=X(r.slice(5)),Z(o,r,i[r]));Y.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each((function(){Q.set(this,n)})):$(this,(function(e){var t;if(o&&void 0===e)return void 0!==(t=Q.get(o,n))?t:void 0!==(t=Z(o,n))?t:void 0;this.each((function(){Q.set(this,n,e)}))}),null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each((function(){Q.remove(this,e)}))}}),S.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Y.get(e,t),n&&(!r||Array.isArray(n)?r=Y.access(e,t,S.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=S.queue(e,t),r=n.length,i=n.shift(),o=S._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,(function(){S.dequeue(e,t)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y.get(e,n)||Y.access(e,n,{empty:S.Callbacks("once memory").add((function(){Y.remove(e,[t+"queue",n])}))})}}),S.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?S.queue(this[0],t):void 0===n?this:this.each((function(){var e=S.queue(this,t,n);S._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&S.dequeue(this,t)}))},dequeue:function(e){return this.each((function(){S.dequeue(this,e)}))},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=S.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=Y.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,te=new RegExp("^(?:([+-])=|)("+ee+")([a-z%]*)$","i"),ne=["Top","Right","Bottom","Left"],re=E.documentElement,ie=function(e){return S.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return S.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ie(e)&&"none"===S.css(e,"display")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return S.css(e,t,"")},u=s(),l=n&&n[3]||(S.cssNumber[t]?"":"px"),c=e.nodeType&&(S.cssNumber[t]||"px"!==l&&+u)&&te.exec(S.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)S.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,S.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ue={};function le(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=Y.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ae(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ue[s])||(o=a.body.appendChild(a.createElement(s)),u=S.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ue[s]=u)))):"none"!==n&&(l[c]="none",Y.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}S.fn.extend({show:function(){return le(this,!0)},hide:function(){return le(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each((function(){ae(this)?S(this).show():S(this).hide()}))}});var ce,fe,pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="<option></option>",y.option=!!ce.lastChild;var ge={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)Y.set(e[n],"globalEval",!t||Y.get(t[n],"globalEval"))}ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,y.option||(ge.optgroup=ge.option=[1,"<select multiple='multiple'>","</select>"]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===w(o))S.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+S.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;S.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<S.inArray(o,r))i&&i.push(o);else if(l=ie(o),a=ve(f.appendChild(o),"script"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}var be=/^key/,we=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Te=/^([^.]*)(?:\.(.+)|)/;function Ce(){return!0}function Ee(){return!1}function Se(e,t){return e===(function(){try{return E.activeElement}catch(e){}})()==("focus"===t)}function ke(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)ke(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Ee;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each((function(){S.event.add(this,t,i,r,n)}))}function Ae(e,i,o){o?(Y.set(e,i,!1),S.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(S.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Y.set(this,i,{value:S.event.trigger(S.extend(r[0],S.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,i)&&S.event.add(e,i,Ce)}S.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.get(t);if(V(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&S.find.matchesSelector(re,i),n.guid||(n.guid=S.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(P)||[""]).length;while(l--)d=g=(s=Te.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=S.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=S.event.special[d]||{},c=S.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&S.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),S.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.hasData(e)&&Y.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(P)||[""]).length;while(l--)if(d=g=(s=Te.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=S.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||S.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)S.event.remove(e,d+t[l],n,r,!0);S.isEmptyObject(u)&&Y.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=S.event.fix(e),l=(Y.get(this,"events")||Object.create(null))[u.type]||[],c=S.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=S.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((S.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<S(i,this).index(l):S.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(S.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[S.expando]?e:new S.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ae(t,"click",Ce),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ae(t,"click"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,"input")&&Y.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},S.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},S.Event=function(e,t){if(!(this instanceof S.Event))return new S.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ce:Ee,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&S.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[S.expando]=!0},S.Event.prototype={constructor:S.Event,isDefaultPrevented:Ee,isPropagationStopped:Ee,isImmediatePropagationStopped:Ee,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ce,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ce,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ce,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},S.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&be.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&we.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},S.event.addProp),S.each({focus:"focusin",blur:"focusout"},(function(e,t){S.event.special[e]={setup:function(){return Ae(this,e,Se),!1},trigger:function(){return Ae(this,e),!0},delegateType:t}})),S.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},(function(e,i){S.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||S.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}})),S.fn.extend({on:function(e,t,n,r){return ke(this,e,t,n,r)},one:function(e,t,n,r){return ke(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,S(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Ee),this.each((function(){S.event.remove(this,e,n,t)}))}});var Ne=/<script|<style|<link/i,De=/checked\s*(?:[^=]|=\s*.checked.)/i,je=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)S.event.add(t,i,s[i][n]);Q.hasData(e)&&(o=Q.access(e),a=S.extend({},o),Q.set(t,a))}}function Pe(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=m(d);if(h||1<f&&"string"==typeof d&&!y.checkClone&&De.test(d))return n.each((function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),Pe(t,r,i,o)}));if(f&&(t=(e=xe(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=S.map(ve(e,"script"),Le)).length;c<f;c++)u=e,c!==p&&(u=S.clone(u,!0,!0),s&&S.merge(a,ve(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,S.map(a,He),c=0;c<s;c++)u=a[c],he.test(u.type||"")&&!Y.access(u,"globalEval")&&S.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?S._evalUrl&&!u.noModule&&S._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):b(u.textContent.replace(je,""),u,l))}return n}function Re(e,t,n){for(var r,i=t?S.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||S.cleanData(ve(r)),r.parentNode&&(n&&ie(r)&&ye(ve(r,"script")),r.parentNode.removeChild(r));return e}S.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=ie(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ve(e),a=a||ve(c),r=0,i=o.length;r<i;r++)Oe(o[r],a[r]);else Oe(e,c);return 0<(a=ve(c,"script")).length&&ye(a,!f&&ve(e,"script")),c},cleanData:function(e){for(var t,n,r,i=S.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?S.event.remove(n,r):S.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),S.fn.extend({detach:function(e){return Re(this,e,!0)},remove:function(e){return Re(this,e)},text:function(e){return $(this,(function(e){return void 0===e?S.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Pe(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||qe(this,e).appendChild(e)}))},prepend:function(){return Pe(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=qe(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Pe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Pe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(S.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return S.clone(this,e,t)}))},html:function(e){return $(this,(function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ne.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(S.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)}),null,e,arguments.length)},replaceWith:function(){var n=[];return Pe(this,arguments,(function(e){var t=this.parentNode;S.inArray(this,n)<0&&(S.cleanData(ve(this)),t&&t.replaceChild(e,this))}),n)}}),S.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(e,a){S.fn[e]=function(e){for(var t,n=[],r=S(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),S(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}}));var Me=new RegExp("^("+ee+")(?!px)[a-z%]+$","i"),Ie=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},We=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Fe=new RegExp(ne.join("|"),"i");function Be(e,t,n){var r,i,o,a,s=e.style;return(n=n||Ie(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||ie(e)||(a=S.style(e,t)),!y.pixelBoxStyles()&&Me.test(a)&&Fe.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function $e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!(function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",re.appendChild(u).appendChild(l);var e=C.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),re.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=E.createElement("div"),l=E.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===l.style.backgroundClip,S.extend(y,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=E.createElement("table"),t=E.createElement("tr"),n=E.createElement("div"),e.style.cssText="position:absolute;left:-11111px",t.style.height="1px",n.style.height="9px",re.appendChild(e).appendChild(t).appendChild(n),r=C.getComputedStyle(t),a=3<parseInt(r.height),re.removeChild(e)),a}}))})();var _e=["Webkit","Moz","ms"],ze=E.createElement("div").style,Ue={};function Xe(e){var t=S.cssProps[e]||Ue[e];return t||(e in ze?e:Ue[e]=(function(e){var t=e[0].toUpperCase()+e.slice(1),n=_e.length;while(n--)if((e=_e[n]+t)in ze)return e})(e)||e)}var Ve=/^(none|table(?!-c[ea]).+)/,Ge=/^--/,Ye={position:"absolute",visibility:"hidden",display:"block"},Qe={letterSpacing:"0",fontWeight:"400"};function Je(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ke(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=S.css(e,n+ne[a],!0,i)),r?("content"===n&&(u-=S.css(e,"padding"+ne[a],!0,i)),"margin"!==n&&(u-=S.css(e,"border"+ne[a]+"Width",!0,i))):(u+=S.css(e,"padding"+ne[a],!0,i),"padding"!==n?u+=S.css(e,"border"+ne[a]+"Width",!0,i):s+=S.css(e,"border"+ne[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function Ze(e,t,n){var r=Ie(e),i=(!y.boxSizingReliable()||n)&&"border-box"===S.css(e,"boxSizing",!1,r),o=i,a=Be(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Me.test(a)){if(!n)return a;a="auto"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&A(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===S.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===S.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Ke(e,t,n||(i?"border":"content"),o,r,a)+"px"}function et(e,t,n,r,i){return new et.prototype.init(e,t,n,r,i)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Be(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),u=Ge.test(t),l=e.style;if(u||(t=Xe(s)),a=S.cssHooks[t]||S.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=te.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(S.cssNumber[s]?"":"px")),y.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=X(t);return Ge.test(t)||(t=Xe(s)),(a=S.cssHooks[t]||S.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Be(e,t,r)),"normal"===i&&t in Qe&&(i=Qe[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),S.each(["height","width"],(function(e,u){S.cssHooks[u]={get:function(e,t,n){if(t)return!Ve.test(S.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Ze(e,u,n):We(e,Ye,(function(){return Ze(e,u,n)}))},set:function(e,t,n){var r,i=Ie(e),o=!y.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===S.css(e,"boxSizing",!1,i),s=n?Ke(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-Ke(e,u,"border",!1,i)-.5)),s&&(r=te.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=S.css(e,u)),Je(0,t,s)}}})),S.cssHooks.marginLeft=$e(y.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(Be(e,"marginLeft"))||e.getBoundingClientRect().left-We(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),S.each({margin:"",padding:"",border:"Width"},(function(i,o){S.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+ne[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(S.cssHooks[i+o].set=Je)})),S.fn.extend({css:function(e,t){return $(this,(function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Ie(e),i=t.length;a<i;a++)o[t[a]]=S.css(e,t[a],!1,r);return o}return void 0!==n?S.style(e,t,n):S.css(e,t)}),e,t,1<arguments.length)}}),((S.Tween=et).prototype={constructor:et,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?"":"px")},cur:function(){var e=et.propHooks[this.prop];return e&&e.get?e.get(this):et.propHooks._default.get(this)},run:function(e){var t,n=et.propHooks[this.prop];return this.options.duration?this.pos=t=S.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):et.propHooks._default.set(this),this}}).init.prototype=et.prototype,(et.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=S.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||!S.cssHooks[e.prop]&&null==e.elem.style[Xe(e.prop)]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=et.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},S.fx=et.prototype.init,S.fx.step={};var tt,nt,rt,it,ot=/^(?:toggle|show|hide)$/,at=/queueHooks$/;function st(){nt&&(!1===E.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(st):C.setTimeout(st,S.fx.interval),S.fx.tick())}function ut(){return C.setTimeout((function(){tt=void 0})),tt=Date.now()}function lt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ct(e,t,n){for(var r,i=(ft.tweeners[t]||[]).concat(ft.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ft(o,e,t){var n,a,r=0,i=ft.prefilters.length,s=S.Deferred().always((function(){delete u.elem})),u=function(){if(a)return!1;for(var e=tt||ut(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:S.extend({},e),opts:S.extend(!0,{specialEasing:{},easing:S.easing._default},t),originalProperties:e,originalOptions:t,startTime:tt||ut(),duration:t.duration,tweens:[],createTween:function(e,t){var n=S.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!(function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=X(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=S.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i})(c,l.opts.specialEasing);r<i;r++)if(n=ft.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(S._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return S.map(c,ct,l),m(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),S.fx.timer(S.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}S.Animation=S.extend(ft,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(P);for(var n,r=0,i=e.length;r<i;r++)n=e[r],ft.tweeners[n]=ft.tweeners[n]||[],ft.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),v=Y.get(e,"fxshow");for(r in n.queue||(null==(a=S._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always((function(){p.always((function(){a.unqueued--,S.queue(e,"fx").length||a.empty.fire()}))}))),t)if(i=t[r],ot.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||S.style(e,r)}if((u=!S.isEmptyObject(t))||!S.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=Y.get(e,"display")),"none"===(c=S.css(e,"display"))&&(l?c=l:(le([e],!0),l=e.style.display||l,c=S.css(e,"display"),le([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===S.css(e,"float")&&(u||(p.done((function(){h.display=l})),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always((function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]}))),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=Y.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&le([e],!0),p.done((function(){for(r in g||le([e]),Y.remove(e,"fxshow"),d)S.style(e,r,d[r])}))),u=ct(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?ft.prefilters.unshift(e):ft.prefilters.push(e)}}),S.speed=function(e,t,n){var r=e&&"object"==typeof e?S.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return S.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in S.fx.speeds?r.duration=S.fx.speeds[r.duration]:r.duration=S.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&S.dequeue(this,r.queue)},r},S.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=S.isEmptyObject(t),o=S.speed(e,n,r),a=function(){var e=ft(this,S.extend({},t),o);(i||Y.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each((function(){var e=!0,t=null!=i&&i+"queueHooks",n=S.timers,r=Y.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&at.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||S.dequeue(this,i)}))},finish:function(a){return!1!==a&&(a=a||"fx"),this.each((function(){var e,t=Y.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=S.timers,o=n?n.length:0;for(t.finish=!0,S.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish}))}}),S.each(["toggle","show","hide"],(function(e,r){var i=S.fn[r];S.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(lt(r,!0),e,t,n)}})),S.each({slideDown:lt("show"),slideUp:lt("hide"),slideToggle:lt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},(function(e,r){S.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}})),S.timers=[],S.fx.tick=function(){var e,t=0,n=S.timers;for(tt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||S.fx.stop(),tt=void 0},S.fx.timer=function(e){S.timers.push(e),S.fx.start()},S.fx.interval=13,S.fx.start=function(){nt||(nt=!0,st())},S.fx.stop=function(){nt=null},S.fx.speeds={slow:600,fast:200,_default:400},S.fn.delay=function(r,e){return r=S.fx&&S.fx.speeds[r]||r,e=e||"fx",this.queue(e,(function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}}))},rt=E.createElement("input"),it=E.createElement("select").appendChild(E.createElement("option")),rt.type="checkbox",y.checkOn=""!==rt.value,y.optSelected=it.selected,(rt=E.createElement("input")).value="t",rt.type="radio",y.radioValue="t"===rt.value;var pt,dt=S.expr.attrHandle;S.fn.extend({attr:function(e,t){return $(this,S.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each((function(){S.removeAttr(this,e)}))}}),S.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?S.prop(e,t,n):(1===o&&S.isXMLDoc(e)||(i=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?pt:void 0)),void 0!==n?null===n?void S.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=S.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(P);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),pt={set:function(e,t,n){return!1===t?S.removeAttr(e,n):e.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\w+/g),(function(e,t){var a=dt[t]||S.find.attr;dt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=dt[o],dt[o]=r,r=null!=a(e,t,n)?o:null,dt[o]=i),r}}));var ht=/^(?:input|select|textarea|button)$/i,gt=/^(?:a|area)$/i;function vt(e){return(e.match(P)||[]).join(" ")}function yt(e){return e.getAttribute&&e.getAttribute("class")||""}function mt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(P)||[]}S.fn.extend({prop:function(e,t){return $(this,S.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each((function(){delete this[S.propFix[e]||e]}))}}),S.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&S.isXMLDoc(e)||(t=S.propFix[t]||t,i=S.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=S.find.attr(e,"tabindex");return t?parseInt(t,10):ht.test(e.nodeName)||gt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),y.optSelected||(S.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){S.propFix[this.toLowerCase()]=this})),S.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each((function(e){S(this).addClass(t.call(this,e,yt(this)))}));if((e=mt(t)).length)while(n=this[u++])if(i=yt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=e[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each((function(e){S(this).removeClass(t.call(this,e,yt(this)))}));if(!arguments.length)return this.attr("class","");if((e=mt(t)).length)while(n=this[u++])if(i=yt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=e[a++])while(-1<r.indexOf(" "+o+" "))r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(i,t){var o=typeof i,a="string"===o||Array.isArray(i);return"boolean"==typeof t&&a?t?this.addClass(i):this.removeClass(i):m(i)?this.each((function(e){S(this).toggleClass(i.call(this,e,yt(this),t),t)})):this.each((function(){var e,t,n,r;if(a){t=0,n=S(this),r=mt(i);while(e=r[t++])n.hasClass(e)?n.removeClass(e):n.addClass(e)}else void 0!==i&&"boolean"!==o||((e=yt(this))&&Y.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===i?"":Y.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+vt(yt(n))+" ").indexOf(t))return!0;return!1}});var xt=/\r/g;S.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each((function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,S(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=S.map(t,(function(e){return null==e?"":e+""}))),(r=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))}))):t?(r=S.valHooks[t.type]||S.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(xt,""):null==e?"":e:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,"value");return null!=t?t:vt(S.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(t=S(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=S.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<S.inArray(S.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),S.each(["radio","checkbox"],(function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<S.inArray(S(e).val(),t)}},y.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})})),y.focusin="onfocusin"in C;var bt=/^(?:focusinfocus|focusoutblur)$/,wt=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||E],d=v.call(e,"type")?e.type:e,h=v.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!bt.test(d+S.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[S.expando]?e:new S.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:S.makeArray(t,[e]),c=S.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,bt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||E)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Y.get(o,"events")||Object.create(null))[e.type]&&Y.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&V(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!V(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),S.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,wt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,wt),S.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=S.extend(new S.Event,n,{type:e,isSimulated:!0});S.event.trigger(r,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each((function(){S.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return S.event.trigger(e,t,n,!0)}}),y.focusin||S.each({focus:"focusin",blur:"focusout"},(function(n,r){var i=function(e){S.event.simulate(r,e.target,S.event.fix(e))};S.event.special[r]={setup:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r);t||e.addEventListener(n,i,!0),Y.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r)-1;t?Y.access(e,r,t):(e.removeEventListener(n,i,!0),Y.remove(e,r))}}}));var Tt=C.location,Ct={guid:Date.now()},Et=/\?/;S.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||S.error("Invalid XML: "+e),t};var St=/\[\]$/,kt=/\r?\n/g,At=/^(?:submit|button|image|reset|file)$/i,Nt=/^(?:input|select|textarea|keygen)/i;function Dt(n,e,r,i){var t;if(Array.isArray(e))S.each(e,(function(e,t){r||St.test(n)?i(n,t):Dt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)}));else if(r||"object"!==w(e))i(n,e);else for(t in e)Dt(n+"["+t+"]",e[t],r,i)}S.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!S.isPlainObject(e))S.each(e,(function(){i(this.name,this.value)}));else for(n in e)Dt(n,e[n],t,i);return r.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=S.prop(this,"elements");return e?S.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!S(this).is(":disabled")&&Nt.test(this.nodeName)&&!At.test(e)&&(this.checked||!pe.test(e))})).map((function(e,t){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,(function(e){return{name:t.name,value:e.replace(kt,"\r\n")}})):{name:t.name,value:n.replace(kt,"\r\n")}})).get()}});var jt=/%20/g,qt=/#.*$/,Lt=/([?&])_=[^&]*/,Ht=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ot=/^(?:GET|HEAD)$/,Pt=/^\/\//,Rt={},Mt={},It="*/".concat("*"),Wt=E.createElement("a");function Ft(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Bt(t,i,o,a){var s={},u=t===Mt;function l(e){var r;return s[e]=!0,S.each(t[e]||[],(function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)})),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function $t(e,t){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&S.extend(!0,e,r),e}Wt.href=Tt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Tt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Tt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":It,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?$t($t(e,S.ajaxSettings),t):$t(S.ajaxSettings,e)},ajaxPrefilter:Ft(Rt),ajaxTransport:Ft(Mt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=S.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?S(y):S.event,x=S.Deferred(),b=S.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Ht.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Tt.href)+"").replace(Pt,Tt.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(P)||[""],null==v.crossDomain){r=E.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Wt.protocol+"//"+Wt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Bt(Rt,v,t,T),h)return T;for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ot.test(v.type),f=v.url.replace(qt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(jt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(Et.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Lt,"$1"),o=(Et.test(f)?"&":"?")+"_="+Ct.guid+++o),v.url=f+o),v.ifModified&&(S.lastModified[f]&&T.setRequestHeader("If-Modified-Since",S.lastModified[f]),S.etag[f]&&T.setRequestHeader("If-None-Match",S.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+It+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Bt(Mt,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=C.setTimeout((function(){T.abort("timeout")}),v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&C.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=(function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]})(v,T,n)),!i&&-1<S.inArray("script",v.dataTypes)&&(v.converters["text script"]=function(){}),s=(function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}})(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(S.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(S.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--S.active||S.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return S.get(e,t,n,"json")},getScript:function(e,t){return S.get(e,void 0,t,"script")}}),S.each(["get","post"],(function(e,i){S[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),S.ajax(S.extend({url:e,type:i,dataType:r,data:t,success:n},S.isPlainObject(e)&&e))}})),S.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),S._evalUrl=function(e,t,n){return S.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){S.globalEval(e,t,n)}})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=S(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(n){return m(n)?this.each((function(e){S(this).wrapInner(n.call(this,e))})):this.each((function(){var e=S(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)}))},wrap:function(t){var n=m(t);return this.each((function(e){S(this).wrapAll(n?t.call(this,e):t)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){S(this).replaceWith(this.childNodes)})),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var _t={0:200,1223:204},zt=S.ajaxSettings.xhr();y.cors=!!zt&&"withCredentials"in zt,y.ajax=zt=!!zt,S.ajaxTransport((function(i){var o,a;if(y.cors||zt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(_t[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&C.setTimeout((function(){o&&a()}))},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}})),S.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),S.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return S.globalEval(e),e}}}),S.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),S.ajaxTransport("script",(function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=S("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}}));var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",(function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always((function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0})),"script"})),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=vt(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&S.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done((function(e){o=arguments,a.html(r?S("<div>").append(S.parseHTML(e)).find(r):e)})).always(n&&function(e,t){a.each((function(){n.apply(this,o||[e.responseText,t,e])}))}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,(function(e){return t===e.elem})).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each((function(e){S.offset.setOffset(this,t,e)}));var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re}))}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,(function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n}),t,e,arguments.length)}})),S.each(["top","left"],(function(e,n){S.cssHooks[n]=$e(y.pixelPosition,(function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t}))})),S.each({Height:"height",Width:"width"},(function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},(function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,(function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)}),s,n?e:void 0,n)}}))})),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(e,t){S.fn[t]=function(e){return this.on(t,e)}})),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),(function(e,n){S.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}}));var Gt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;S.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||S.guid++,i},S.holdReady=function(e){e?S.readyWait++:S.ready(!0)},S.isArray=Array.isArray,S.parseJSON=JSON.parse,S.nodeName=A,S.isFunction=m,S.isWindow=x,S.camelCase=X,S.type=w,S.now=Date.now,S.isNumeric=function(e){var t=S.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},S.trim=function(e){return null==e?"":(e+"").replace(Gt,"")},"function"==typeof define&&define.amd&&define("jquery",[],(function(){return S}));var Yt=C.jQuery,Qt=C.$;return S.noConflict=function(e){return C.$===S&&(C.$=Qt),e&&C.jQuery===S&&(C.jQuery=Yt),S},"undefined"==typeof e&&(C.jQuery=C.$=S),S}));
this.parseTimeMarkers = this.parseTimeMarkers || {};
var marker = this.parseTimeMarkers['visualSandbox.minimal.externals.min.js'] || (this.parseTimeMarkers['visualSandbox.minimal.externals.min.js'] = {});
marker.endEval = window.jsCommon && window.jsCommon.performance && window.jsCommon.performance.now ? window.jsCommon.performance.now() : Date.now(); marker.isExternal = false;
</SCRIPT>
<SCRIPT>
'use strict';
'use strict';
this.parseTimeMarkers = this.parseTimeMarkers || {};
var marker = this.parseTimeMarkers['customVisualsHost.bundle.min.js'] || (this.parseTimeMarkers['customVisualsHost.bundle.min.js'] = {});
marker.startEval = window.jsCommon && window.jsCommon.performance && window.jsCommon.performance.now ? window.jsCommon.performance.now() : Date.now(); marker.isExternal = false;
if (window.perfTracking && window.perfTracking.startBundleEval) window.perfTracking.startBundleEval('customVisualsHost.bundle.min.js');
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
/// <disable>JS2025.InsertSpaceBeforeCommentText,JS2027.PunctuateCommentsCorrectly,JS2076.IdentifierIsMiscased,JS3085.VariableDeclaredMultipleTimes, JS3116.PreviousDeclarationWasHere, JS2074.IdentifierNameIsMisspelled, JS2030.FollowKeywordsWithSpace, JS2023.UseDoubleQuotesForStringLiterals, JS2028.UseCPlusPlusStyleComments, JS2026.CapitalizeComments, JS2008.DoNotUseCookies, JS2005.UseShortFormInitializations, JS2064.SpecifyNewWhenCallingConstructor, JS2024.DoNotQuoteObjectLiteralPropertyNames, JS2043.RemoveDebugCode, JS3045.MissingInputFile</disable>
/// <dictionary target='comment'>args,aspx,autocompletion,enqueue,Firefox,Hardcoded,interdependant,Kinda,Moderncop,Nav,param,params,powerview, secweb, serializer, sharepoint, silverlight, src, stylesheet, theming, untokenized, Xmla </dictionary>
// ModernCop Rules and Settings - Disabling some non critical warnings that we currently have per:
// http://secweb01/MSEC/Tools/Lists/MSEC%20Tool%20Errors%20and%20Warnings/AllItems.aspx?FilterField1=Tool&FilterValue1=Moderncop
/// <disable>JS2085.EnableStrictMode</disable>
// Justification: The violation is that strict mode is enabled for global scope, which could lead
// to unexpected behavior if the target JS file of this project is concatenated with other JS files.
// The target JS file of this project is not concatenated with other files.
"use strict";
this.parseTimeMarkers = this.parseTimeMarkers || {};
var marker = this.parseTimeMarkers['customVisualsCore.bundle.min.js'] || (this.parseTimeMarkers['customVisualsCore.bundle.min.js'] = {});
marker.startEval = window.jsCommon && window.jsCommon.performance && window.jsCommon.performance.now ? window.jsCommon.performance.now() : Date.now(); marker.isExternal = false;
if (window.perfTracking && window.perfTracking.startBundleEval) window.perfTracking.startBundleEval('customVisualsCore.bundle.min.js');
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
var VisualDataRoleKind;
(function (VisualDataRoleKind) {
/** Indicates that the role should be bound to something that evaluates to a grouping of values. */
VisualDataRoleKind[VisualDataRoleKind["Grouping"] = 0] = "Grouping";
/** Indicates that the role should be bound to something that evaluates to a single value in a scope. */
VisualDataRoleKind[VisualDataRoleKind["Measure"] = 1] = "Measure";
/** Indicates that the role can be bound to either Grouping or Measure. */
VisualDataRoleKind[VisualDataRoleKind["GroupingOrMeasure"] = 2] = "GroupingOrMeasure";
})(VisualDataRoleKind = powerbi.VisualDataRoleKind || (powerbi.VisualDataRoleKind = {}));
var VisualDataChangeOperationKind;
(function (VisualDataChangeOperationKind) {
VisualDataChangeOperationKind[VisualDataChangeOperationKind["Create"] = 0] = "Create";
VisualDataChangeOperationKind[VisualDataChangeOperationKind["Append"] = 1] = "Append";
VisualDataChangeOperationKind[VisualDataChangeOperationKind["Segment"] = 2] = "Segment";
VisualDataChangeOperationKind[VisualDataChangeOperationKind["None"] = 3] = "None";
})(VisualDataChangeOperationKind = powerbi.VisualDataChangeOperationKind || (powerbi.VisualDataChangeOperationKind = {}));
var VisualUpdateType;
(function (VisualUpdateType) {
VisualUpdateType[VisualUpdateType["Data"] = 2] = "Data";
VisualUpdateType[VisualUpdateType["Resize"] = 4] = "Resize";
VisualUpdateType[VisualUpdateType["ViewMode"] = 8] = "ViewMode";
VisualUpdateType[VisualUpdateType["Style"] = 16] = "Style";
VisualUpdateType[VisualUpdateType["ResizeEnd"] = 32] = "ResizeEnd";
VisualUpdateType[VisualUpdateType["FormattingSubSelectionChange"] = 64] = "FormattingSubSelectionChange";
VisualUpdateType[VisualUpdateType["FormatModeChange"] = 128] = "FormatModeChange";
VisualUpdateType[VisualUpdateType["All"] = 254] = "All";
})(VisualUpdateType = powerbi.VisualUpdateType || (powerbi.VisualUpdateType = {}));
var VisualPermissions;
(function (VisualPermissions) {
})(VisualPermissions = powerbi.VisualPermissions || (powerbi.VisualPermissions = {}));
})(powerbi || (powerbi = {}));
/**
* Use `tsconfig.json` to manage source files.
*
* `_references.ts` is not used anymore and will be removed soon. Removing this
* file requires updating all .ts files so we temporary keep it to simplify
* review of changes associated with moving build system to `pbi-gulp-tools`.
*/
;
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
/// <disable>JS2025.InsertSpaceBeforeCommentText,JS2027.PunctuateCommentsCorrectly,JS2076.IdentifierIsMiscased,JS3085.VariableDeclaredMultipleTimes, JS3116.PreviousDeclarationWasHere, JS2074.IdentifierNameIsMisspelled, JS2030.FollowKeywordsWithSpace, JS2023.UseDoubleQuotesForStringLiterals, JS2028.UseCPlusPlusStyleComments, JS2026.CapitalizeComments, JS2008.DoNotUseCookies, JS2005.UseShortFormInitializations, JS2064.SpecifyNewWhenCallingConstructor, JS2024.DoNotQuoteObjectLiteralPropertyNames, JS2043.RemoveDebugCode, JS3045.MissingInputFile</disable>
/// <dictionary target='comment'>args,aspx,autocompletion,enqueue,Firefox,Hardcoded,interdependant,Kinda,Moderncop,Nav,param,params,powerview, secweb, serializer, sharepoint, silverlight, src, stylesheet, theming, untokenized, Xmla </dictionary>
// ModernCop Rules and Settings - Disabling some non critical warnings that we currently have per:
// http://secweb01/MSEC/Tools/Lists/MSEC%20Tool%20Errors%20and%20Warnings/AllItems.aspx?FilterField1=Tool&FilterValue1=Moderncop
/// <disable>JS2085.EnableStrictMode</disable>
// Justification: The violation is that strict mode is enabled for global scope, which could lead
// to unexpected behavior if the target JS file of this project is concatenated with other JS files.
// The target JS file of this project is not concatenated with other files.
"use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// This file keeps logic related to assignment global variable from uglify.js to window.DEBUG
// -----------------------------------------------------------------------
function initializeDebug() {
if (debugIntialized)
return;
window.DEBUG = typeof DEBUG === "undefined" ? true : !!DEBUG;
debugIntialized = true;
}
var debugIntialized = false;
initializeDebug();
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi_1) {
function ensurePowerbi() {
if (!window.powerbi)
window.powerbi = {};
return window.powerbi;
}
powerbi_1.ensurePowerbi = ensurePowerbi;
function ensurePowerbiCommon() {
var powerbi = ensurePowerbi();
if (!powerbi.common)
powerbi.common = {};
return powerbi.common;
}
powerbi_1.ensurePowerbiCommon = ensurePowerbiCommon;
function ensurePowerbiVisuals() {
var powerbi = ensurePowerbi();
if (!powerbi.visuals)
powerbi.visuals = {};
return powerbi.visuals;
}
powerbi_1.ensurePowerbiVisuals = ensurePowerbiVisuals;
function ensureJsCommon() {
if (!window.jsCommon)
window.jsCommon = {};
return window.jsCommon;
}
powerbi_1.ensureJsCommon = ensureJsCommon;
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
/**
* CSS constants.
*/
var CssConstants;
(function (CssConstants) {
function createClassAndSelector(className) {
return {
class: className,
selector: '.' + className,
};
}
CssConstants.createClassAndSelector = createClassAndSelector;
CssConstants.styleAttribute = 'style';
CssConstants.pixelUnits = 'px';
CssConstants.heightProperty = 'height';
CssConstants.widthProperty = 'width';
CssConstants.topProperty = 'top';
CssConstants.bottomProperty = 'bottom';
CssConstants.leftProperty = 'left';
CssConstants.rightProperty = 'right';
CssConstants.marginTopProperty = 'margin-top';
CssConstants.marginLeftProperty = 'margin-left';
CssConstants.displayProperty = 'display';
CssConstants.backgroundProperty = 'background';
CssConstants.backgroundColorProperty = 'background-color';
CssConstants.backgroundRepeatProperty = 'background-repeat';
CssConstants.backgroundSizeProperty = 'background-size';
CssConstants.backgroundImageProperty = 'background-image';
CssConstants.textShadowProperty = 'text-shadow';
CssConstants.textAlignProperty = 'text-align';
CssConstants.borderProperty = 'border';
CssConstants.borderTopWidthProperty = 'border-top-width';
CssConstants.borderBottomWidthProperty = 'border-bottom-width';
CssConstants.borderLeftWidthProperty = 'border-left-width';
CssConstants.borderRightWidthProperty = 'border-right-width';
CssConstants.borderRadiusProperty = 'border-radius';
CssConstants.borderColorProperty = 'border-color';
CssConstants.boxShadowProperty = 'box-shadow';
CssConstants.fontFamilyProperty = 'font-family';
CssConstants.fontSizeProperty = 'font-size';
CssConstants.fontWeightProperty = 'font-weight';
CssConstants.fontStyleProperty = 'font-style';
CssConstants.textDecoration = 'text-decoration';
CssConstants.colorProperty = 'color';
CssConstants.opacityProperty = 'opacity';
CssConstants.paddingProperty = 'padding';
CssConstants.paddingLeftProperty = 'padding-left';
CssConstants.paddingRightProperty = 'padding-right';
CssConstants.positionProperty = 'position';
CssConstants.maxWidthProperty = 'max-width';
CssConstants.minWidthProperty = 'min-width';
CssConstants.overflowProperty = 'overflow';
CssConstants.overflowXProperty = 'overflow-x';
CssConstants.overflowYProperty = 'overflow-y';
CssConstants.transformProperty = 'transform';
CssConstants.webkitTransformProperty = '-webkit-transform';
CssConstants.cursorProperty = 'cursor';
CssConstants.visibilityProperty = 'visibility';
CssConstants.fillProperty = 'fill';
CssConstants.absoluteValue = 'absolute';
CssConstants.zeroPixelValue = '0px';
CssConstants.autoValue = 'auto';
CssConstants.hiddenValue = 'hidden';
CssConstants.noneValue = 'none';
CssConstants.blockValue = 'block';
CssConstants.inlineBlockValue = 'inline-block';
CssConstants.transparentValue = 'transparent';
CssConstants.normalValue = 'normal';
CssConstants.boldValue = 'bold';
CssConstants.italicValue = 'italic';
CssConstants.underlineValue = 'underline';
CssConstants.visibleValue = 'visible';
CssConstants.tableRowValue = 'table-row';
CssConstants.coverValue = 'cover';
CssConstants.pointerValue = 'pointer';
CssConstants.scrollValue = 'scroll';
})(CssConstants = jsCommon.CssConstants || (jsCommon.CssConstants = {}));
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
/**
* DOM constants.
*/
var DOMConstants;
(function (DOMConstants) {
DOMConstants.scanModeKeys = [
50 /* twoKeyCode */,
51 /* threeKeyCode */,
52 /* fourKeyCode */,
53 /* fiveKeyCode */,
54 /* sixKeyCode */,
72 /* hKeyCode */,
75 /* kKeyCode */,
66 /* bKeyCode */,
84 /* tKeyCode */, // tables
];
/**
* Names must match specification
* https://www.w3.org/TR/uievents-code/#key-alphanumeric-writing-system
* Because keyCode is deprecated
* https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
* after code is implemented for IE \ Edge
* https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
* We want to switch using code.
*/
var KeyDictionary;
(function (KeyDictionary) {
KeyDictionary[KeyDictionary["Enter"] = 13] = "Enter";
KeyDictionary[KeyDictionary["F1"] = 112] = "F1";
KeyDictionary[KeyDictionary["F2"] = 113] = "F2";
KeyDictionary[KeyDictionary["F6"] = 117] = "F6";
KeyDictionary[KeyDictionary["F10"] = 121] = "F10";
KeyDictionary[KeyDictionary["ArrowRight"] = 39] = "ArrowRight";
KeyDictionary[KeyDictionary["KeyT"] = 84] = "KeyT";
})(KeyDictionary = DOMConstants.KeyDictionary || (DOMConstants.KeyDictionary = {}));
var MouseButton;
(function (MouseButton) {
MouseButton[MouseButton["Main"] = 0] = "Main";
MouseButton[MouseButton["Auxilary"] = 1] = "Auxilary";
MouseButton[MouseButton["Secondary"] = 2] = "Secondary";
MouseButton[MouseButton["Fourth"] = 3] = "Fourth";
MouseButton[MouseButton["Fifth"] = 4] = "Fifth"; // Fifth button, typically the Browser Forward button
})(MouseButton = DOMConstants.MouseButton || (DOMConstants.MouseButton = {}));
/**
* DOM Elements.
*/
DOMConstants.DocumentBody = 'body';
DOMConstants.Anchor = 'a';
DOMConstants.EditableTextElements = ':text, textarea';
DOMConstants.EditableNumericElements = '[type="number"]';
/**
* DOM Attributes and values.
*/
DOMConstants.disabledAttributeOrValue = 'disabled';
DOMConstants.readonlyAttributeOrValue = 'readonly';
DOMConstants.idAttribute = 'id';
DOMConstants.styleAttribute = 'style';
DOMConstants.hrefAttribute = 'href';
DOMConstants.targetAttribute = 'target';
DOMConstants.blankValue = '_blank';
DOMConstants.selfValue = '_self';
DOMConstants.classAttribute = 'class';
DOMConstants.titleAttribute = 'title';
DOMConstants.srcAttribute = 'src';
DOMConstants.contentEditableAttribute = 'contenteditable';
DOMConstants.skipChildrenFocusAttribute = 'skip-children-focus';
/**
* DOM event names.
*/
DOMConstants.contextmenuEventName = 'contextmenu';
DOMConstants.blurEventName = 'blur';
DOMConstants.keyUpEventName = 'keyup';
DOMConstants.inputEventName = 'input';
DOMConstants.changeEventName = 'change';
DOMConstants.cutEventName = 'cut';
DOMConstants.keyDownEventName = 'keydown';
DOMConstants.mouseMoveEventName = 'mousemove';
DOMConstants.mouseDownEventName = 'mousedown';
DOMConstants.mouseEnterEventName = 'mouseenter';
DOMConstants.mouseLeaveEventName = 'mouseleave';
DOMConstants.mouseOverEventName = 'mouseover';
DOMConstants.mouseOutEventName = 'mouseout';
DOMConstants.mouseUpEventName = 'mouseup';
DOMConstants.mouseWheelScroll = 'wheel';
DOMConstants.mouseClickEventName = 'click';
DOMConstants.mouseDblClickEventName = 'dblclick';
DOMConstants.pasteEventName = 'paste';
DOMConstants.scrollEventName = 'scroll';
DOMConstants.dropEventName = 'drop';
DOMConstants.hoverEventName = 'hover';
DOMConstants.focusEventName = 'focus';
DOMConstants.focusInEventName = 'focusin';
DOMConstants.focusOutEventName = 'focusout';
DOMConstants.selectEventName = 'select';
DOMConstants.messageEventName = 'message';
DOMConstants.loadEventName = 'load';
DOMConstants.beforeUnload = 'beforeunload';
DOMConstants.pointerMoveEventName = 'pointermove';
DOMConstants.pointerUpEventName = 'pointerup';
DOMConstants.pointerDownEventName = 'pointerdown';
DOMConstants.pointerOutEventName = 'pointerout';
DOMConstants.pointerEnterEventName = 'pointerenter';
DOMConstants.pointerLeaveEventName = 'pointerleave';
DOMConstants.pointerOverEventName = 'pointerover';
/**
* Common DOM event combination names.
*/
DOMConstants.inputAndSelectEventNames = 'input, select';
})(DOMConstants = jsCommon.DOMConstants || (jsCommon.DOMConstants = {}));
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
// NOTE: this file includes standalone utilities that should have no dependencies on external libraries, including jQuery.
var LogicExtensions;
(function (LogicExtensions) {
function XOR(a, b) {
return (a || b) && !(a && b);
}
LogicExtensions.XOR = XOR;
})(LogicExtensions = jsCommon.LogicExtensions || (jsCommon.LogicExtensions = {}));
var JsonComparer;
(function (JsonComparer) {
/**
* Performs JSON-style comparison of two objects.
*/
function equals(x, y) {
if (x === y)
return true;
return JSON.stringify(x) === JSON.stringify(y);
}
JsonComparer.equals = equals;
})(JsonComparer = jsCommon.JsonComparer || (jsCommon.JsonComparer = {}));
/**
* Values are in terms of 'pt'
* Convert to pixels using PixelConverter.fromPoint
*/
var TextSizeDefaults;
(function (TextSizeDefaults) {
/**
* Stored in terms of 'pt'
* Convert to pixels using PixelConverter.fromPoint
*/
TextSizeDefaults.TextSizeMin = 8;
/**
* Stored in terms of 'pt'
* Convert to pixels using PixelConverter.fromPoint
*/
TextSizeDefaults.TextSizeMax = 60;
var TextSizeRange = TextSizeDefaults.TextSizeMax - TextSizeDefaults.TextSizeMin;
/**
* Returns the percentage of this value relative to the TextSizeMax
* @param textSize - should be given in terms of 'pt'
*/
function getScale(textSize) {
return (textSize - TextSizeDefaults.TextSizeMin) / TextSizeRange;
}
TextSizeDefaults.getScale = getScale;
})(TextSizeDefaults = jsCommon.TextSizeDefaults || (jsCommon.TextSizeDefaults = {}));
var PixelConverter = /** @class */ (function () {
function PixelConverter() {
}
/**
* Converts point value (pt) to pixels
* Returns a string for font-size property
* e.g. fromPoint(8) => '24px'
*/
PixelConverter.fromPoint = function (pt) {
return PixelConverter.toString(PixelConverter.fromPointToPixel(pt));
};
/**
* Converts point value (pt) to pixels
* Returns a number for font-size property
* e.g. fromPoint(8) => 24px
*/
PixelConverter.fromPointToPixel = function (pt) {
return (PixelConverter.PxPtRatio * pt);
};
/**
* Converts pixel value (px) to pt
* e.g. toPoint(24) => 8
*/
PixelConverter.toPoint = function (px) {
return px / PixelConverter.PxPtRatio;
};
/**
* Appends 'px' to the end of number value for use as pixel string in styles
*/
PixelConverter.toString = function (px) {
return px + PixelConverter.PixelString;
};
PixelConverter.PxPtRatio = 4 / 3;
PixelConverter.PixelString = 'px';
return PixelConverter;
}());
jsCommon.PixelConverter = PixelConverter;
var RegExpExtensions;
(function (RegExpExtensions) {
/**
* Runs exec on regex starting from 0 index
* This is the expected behavior but RegExp actually remember
* the last index they stopped at (found match at) and will
* return unexpected results when run in sequence.
* @param regex - regular expression object
* @param value - string to search wiht regex
* @param start - index within value to start regex
*/
function run(regex, value, start) {
debug.assertValue(regex, 'regex');
regex.lastIndex = start || 0;
return regex.exec(value);
}
RegExpExtensions.run = run;
})(RegExpExtensions = jsCommon.RegExpExtensions || (jsCommon.RegExpExtensions = {}));
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
// NOTE: this file includes standalone utilities that should have no dependencies on external libraries, including jQuery.
/**
* Extensions for Enumerations.
*/
var EnumExtensions;
(function (EnumExtensions) {
/**
* Gets a value indicating whether the value has the bit flags set.
*/
function hasFlag(value, flag) {
debug.assert(!!flag, 'flag must be specified and nonzero.');
return (value & flag) === flag;
}
EnumExtensions.hasFlag = hasFlag;
/**
* Sets a value of a flag without modifying any other flags.
*/
function setFlag(value, flag) {
debug.assert(!!flag, "flag must be specified and nonzero.");
return value |= flag;
}
EnumExtensions.setFlag = setFlag;
/**
* Resets a value of a flag without modifying any other flags.
*/
function resetFlag(value, flag) {
debug.assert(!!flag, "flag must be specified and nonzero.");
return value &= ~flag;
}
EnumExtensions.resetFlag = resetFlag;
/**
* According to the TypeScript Handbook, this is safe to do.
*/
function toString(enumType, value) {
return enumType[value];
}
EnumExtensions.toString = toString;
/**
* Returns the number of 1's in the specified value that is a set of binary bit flags.
*/
function getBitCount(value) {
if (value === null || value % 1 !== 0)
return 0;
var bitCount = 0;
var shiftingValue = value;
while (shiftingValue !== 0) {
if ((shiftingValue & 1) === 1) {
bitCount++;
}
shiftingValue = shiftingValue >>> 1;
}
return bitCount;
}
EnumExtensions.getBitCount = getBitCount;
})(EnumExtensions = jsCommon.EnumExtensions || (jsCommon.EnumExtensions = {}));
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
/**
* Represents a lazily instantiated value.
*/
var Lazy = /** @class */ (function () {
function Lazy(factoryMethod) {
debug.assertValue(factoryMethod, 'factoryMethod');
this.factoryMethod = factoryMethod;
}
Lazy.prototype.getValue = function () {
if (this.factoryMethod !== null) {
this.value = this.factoryMethod();
// Optimization: Release the factoryMethod, as it could be holding a large object graph.
this.factoryMethod = null;
}
return this.value;
};
return Lazy;
}());
jsCommon.Lazy = Lazy;
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
var Prototype;
(function (Prototype) {
/**
* Returns a new object with the provided obj as its prototype.
*/
function inherit(obj, extension) {
if (obj === null)
return null;
var inherited = Object.create(obj);
if (extension)
extension(inherited);
return inherited;
}
Prototype.inherit = inherit;
/**
* Returns a new object with the provided obj as its prototype
* if, and only if, the prototype has not been previously set
*/
function inheritSingle(obj) {
if (obj === null)
return null;
var proto = Object.getPrototypeOf(obj);
if (proto === Object.prototype || proto === Array.prototype)
obj = inherit(obj);
return obj;
}
Prototype.inheritSingle = inheritSingle;
/**
* Uses the provided callback function to selectively replace contents in the provided array.
* @return A new array with those values overriden
* or undefined if no overrides are necessary.
*/
function overrideArray(prototype, override) {
if (prototype == null)
return;
var overwritten;
for (var i = 0, len = prototype.length; i < len; i++) {
var value = override(prototype[i]);
if (value) {
if (!overwritten)
overwritten = inherit(prototype);
overwritten[i] = value;
}
}
return overwritten;
}
Prototype.overrideArray = overrideArray;
/**
* Helper usually called after _.cloneDeep().
* Current version of lodash doesn't copy the prototype of each object.
* The function recursively copies the prototype of the "from" object to the "to" and its descendants if needed.
* @param from - object which its prototype recursively will be copied.
* @param to - object which its prototype will be updated.
*
*/
function copyPrototypeDeep(from, to) {
if (!from || !to || typeof from !== "object")
return;
if (Object.getPrototypeOf(from) !== Object.getPrototypeOf(to)) {
to.__proto__ = from.__proto__;
}
for (var key in from) {
copyPrototypeDeep(from[key], to[key]);
}
}
Prototype.copyPrototypeDeep = copyPrototypeDeep;
})(Prototype = powerbi.Prototype || (powerbi.Prototype = {}));
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* Defines a Debug object. Calls to any functions in this object removed by the minifier.
* The functions within this class are not minified away, so we use the preprocessor-style
* comments to have the minifier remove those as well.
*/
///#DEBUG
var debug = /** @class */ (function () {
function debug() {
}
debug.setAssertFailFunction = function (f) {
debug.assertFailFunction = f;
};
/**
* Asserts that the condition is true, fails otherwise.
*/
debug.assert = function (condition, message) {
if (message === void 0) { message = ('condition: ' + condition); }
if (condition !== true) {
// Write assert to console including message and call stack
if (console) {
if (console.assert) {
console.assert(condition, message);
}
if (console.trace) {
console.trace('Assert call stack');
}
}
debug.assertFail(message);
}
};
debug.setAssert = function (f) {
debug.assert = f;
};
/**
* Asserts that the value is neither null nor undefined, fails otherwise.
*/
debug.assertValue = function (value, message) {
debug.assert(value !== null && value !== undefined, message);
};
/**
* Asserts that the value is neither null nor undefined, and has a length property that returns greater than zero, fails otherwise.
*/
debug.assertNonEmpty = function (value, message) {
debug.assert(value != null && value.length > 0, message);
};
/**
* Makes no assertion on the given value.
* This is documentation/placeholder that a value is possibly null or undefined (unlike assertValue).
*/
debug.assertAnyValue = function (value, message) {
};
debug.assertFail = function (message) {
(debug.assertFailFunction || alert)("Debug Assert failed: " + message);
};
debug.log = function (message) {
var optionalParams = [];
for (var _i = 1; _i < arguments.length; _i++) {
optionalParams[_i - 1] = arguments[_i];
}
console.log.apply(console, __spreadArray([message], (optionalParams || [])));
};
debug.logDebug = function (message) {
var optionalParams = [];
for (var _i = 1; _i < arguments.length; _i++) {
optionalParams[_i - 1] = arguments[_i];
}
console.debug.apply(console, __spreadArray([message], (optionalParams || [])));
};
debug.warn = function (message) {
var optionalParams = [];
for (var _i = 1; _i < arguments.length; _i++) {
optionalParams[_i - 1] = arguments[_i];
}
if (console && console.warn) {
console.warn.apply(console, __spreadArray([message], (optionalParams || [])));
}
else {
debug.log.apply(debug, __spreadArray([message], (optionalParams || [])));
}
};
/**
* Throws an error if called. This is never expected to be called, and should cause a compiler error if the
* compiler can tell that it will get called.
*/
debug.assertNever = function (neverValue) {
debug.assertFail('Expected to never have value ' + neverValue);
};
debug.breakDebugger = function () {
// eslint-disable-next-line no-debugger
debugger;
};
debug.execute = function (action) {
action();
};
return debug;
}());
///#ENDDEBUG
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
/**
* Module Double contains a set of constants and precision based utility methods
* for dealing with doubles and their decimal garbage in the javascript.
*/
var Double;
(function (Double) {
// Constants.
Double.MIN_VALUE = -Number.MAX_VALUE;
Double.MAX_VALUE = Number.MAX_VALUE;
Double.MIN_EXP = -308;
Double.MAX_EXP = 308;
Double.EPSILON = 1E-323;
Double.DEFAULT_PRECISION = 0.0001;
Double.DEFAULT_PRECISION_IN_DECIMAL_DIGITS = 12;
Double.LOG_E_10 = Math.log(10);
Double.POSITIVE_POWERS = [
1E0, 1E1, 1E2, 1E3, 1E4, 1E5, 1E6, 1E7, 1E8, 1E9, 1E10, 1E11, 1E12, 1E13, 1E14, 1E15, 1E16, 1E17, 1E18, 1E19, 1E20, 1E21, 1E22, 1E23, 1E24, 1E25, 1E26, 1E27, 1E28, 1E29, 1E30, 1E31, 1E32, 1E33, 1E34, 1E35, 1E36, 1E37, 1E38, 1E39, 1E40, 1E41, 1E42, 1E43, 1E44, 1E45, 1E46, 1E47, 1E48, 1E49, 1E50, 1E51, 1E52, 1E53, 1E54, 1E55, 1E56, 1E57, 1E58, 1E59, 1E60, 1E61, 1E62, 1E63, 1E64, 1E65, 1E66, 1E67, 1E68, 1E69, 1E70, 1E71, 1E72, 1E73, 1E74, 1E75, 1E76, 1E77, 1E78, 1E79, 1E80, 1E81, 1E82, 1E83, 1E84, 1E85, 1E86, 1E87, 1E88, 1E89, 1E90, 1E91, 1E92, 1E93, 1E94, 1E95, 1E96, 1E97, 1E98, 1E99,
1E100, 1E101, 1E102, 1E103, 1E104, 1E105, 1E106, 1E107, 1E108, 1E109, 1E110, 1E111, 1E112, 1E113, 1E114, 1E115, 1E116, 1E117, 1E118, 1E119, 1E120, 1E121, 1E122, 1E123, 1E124, 1E125, 1E126, 1E127, 1E128, 1E129, 1E130, 1E131, 1E132, 1E133, 1E134, 1E135, 1E136, 1E137, 1E138, 1E139, 1E140, 1E141, 1E142, 1E143, 1E144, 1E145, 1E146, 1E147, 1E148, 1E149, 1E150, 1E151, 1E152, 1E153, 1E154, 1E155, 1E156, 1E157, 1E158, 1E159, 1E160, 1E161, 1E162, 1E163, 1E164, 1E165, 1E166, 1E167, 1E168, 1E169, 1E170, 1E171, 1E172, 1E173, 1E174, 1E175, 1E176, 1E177, 1E178, 1E179, 1E180, 1E181, 1E182, 1E183, 1E184, 1E185, 1E186, 1E187, 1E188, 1E189, 1E190, 1E191, 1E192, 1E193, 1E194, 1E195, 1E196, 1E197, 1E198, 1E199,
1E200, 1E201, 1E202, 1E203, 1E204, 1E205, 1E206, 1E207, 1E208, 1E209, 1E210, 1E211, 1E212, 1E213, 1E214, 1E215, 1E216, 1E217, 1E218, 1E219, 1E220, 1E221, 1E222, 1E223, 1E224, 1E225, 1E226, 1E227, 1E228, 1E229, 1E230, 1E231, 1E232, 1E233, 1E234, 1E235, 1E236, 1E237, 1E238, 1E239, 1E240, 1E241, 1E242, 1E243, 1E244, 1E245, 1E246, 1E247, 1E248, 1E249, 1E250, 1E251, 1E252, 1E253, 1E254, 1E255, 1E256, 1E257, 1E258, 1E259, 1E260, 1E261, 1E262, 1E263, 1E264, 1E265, 1E266, 1E267, 1E268, 1E269, 1E270, 1E271, 1E272, 1E273, 1E274, 1E275, 1E276, 1E277, 1E278, 1E279, 1E280, 1E281, 1E282, 1E283, 1E284, 1E285, 1E286, 1E287, 1E288, 1E289, 1E290, 1E291, 1E292, 1E293, 1E294, 1E295, 1E296, 1E297, 1E298, 1E299,
1E300, 1E301, 1E302, 1E303, 1E304, 1E305, 1E306, 1E307, 1E308
];
Double.NEGATIVE_POWERS = [
1E0, 1E-1, 1E-2, 1E-3, 1E-4, 1E-5, 1E-6, 1E-7, 1E-8, 1E-9, 1E-10, 1E-11, 1E-12, 1E-13, 1E-14, 1E-15, 1E-16, 1E-17, 1E-18, 1E-19, 1E-20, 1E-21, 1E-22, 1E-23, 1E-24, 1E-25, 1E-26, 1E-27, 1E-28, 1E-29, 1E-30, 1E-31, 1E-32, 1E-33, 1E-34, 1E-35, 1E-36, 1E-37, 1E-38, 1E-39, 1E-40, 1E-41, 1E-42, 1E-43, 1E-44, 1E-45, 1E-46, 1E-47, 1E-48, 1E-49, 1E-50, 1E-51, 1E-52, 1E-53, 1E-54, 1E-55, 1E-56, 1E-57, 1E-58, 1E-59, 1E-60, 1E-61, 1E-62, 1E-63, 1E-64, 1E-65, 1E-66, 1E-67, 1E-68, 1E-69, 1E-70, 1E-71, 1E-72, 1E-73, 1E-74, 1E-75, 1E-76, 1E-77, 1E-78, 1E-79, 1E-80, 1E-81, 1E-82, 1E-83, 1E-84, 1E-85, 1E-86, 1E-87, 1E-88, 1E-89, 1E-90, 1E-91, 1E-92, 1E-93, 1E-94, 1E-95, 1E-96, 1E-97, 1E-98, 1E-99,
1E-100, 1E-101, 1E-102, 1E-103, 1E-104, 1E-105, 1E-106, 1E-107, 1E-108, 1E-109, 1E-110, 1E-111, 1E-112, 1E-113, 1E-114, 1E-115, 1E-116, 1E-117, 1E-118, 1E-119, 1E-120, 1E-121, 1E-122, 1E-123, 1E-124, 1E-125, 1E-126, 1E-127, 1E-128, 1E-129, 1E-130, 1E-131, 1E-132, 1E-133, 1E-134, 1E-135, 1E-136, 1E-137, 1E-138, 1E-139, 1E-140, 1E-141, 1E-142, 1E-143, 1E-144, 1E-145, 1E-146, 1E-147, 1E-148, 1E-149, 1E-150, 1E-151, 1E-152, 1E-153, 1E-154, 1E-155, 1E-156, 1E-157, 1E-158, 1E-159, 1E-160, 1E-161, 1E-162, 1E-163, 1E-164, 1E-165, 1E-166, 1E-167, 1E-168, 1E-169, 1E-170, 1E-171, 1E-172, 1E-173, 1E-174, 1E-175, 1E-176, 1E-177, 1E-178, 1E-179, 1E-180, 1E-181, 1E-182, 1E-183, 1E-184, 1E-185, 1E-186, 1E-187, 1E-188, 1E-189, 1E-190, 1E-191, 1E-192, 1E-193, 1E-194, 1E-195, 1E-196, 1E-197, 1E-198, 1E-199,
1E-200, 1E-201, 1E-202, 1E-203, 1E-204, 1E-205, 1E-206, 1E-207, 1E-208, 1E-209, 1E-210, 1E-211, 1E-212, 1E-213, 1E-214, 1E-215, 1E-216, 1E-217, 1E-218, 1E-219, 1E-220, 1E-221, 1E-222, 1E-223, 1E-224, 1E-225, 1E-226, 1E-227, 1E-228, 1E-229, 1E-230, 1E-231, 1E-232, 1E-233, 1E-234, 1E-235, 1E-236, 1E-237, 1E-238, 1E-239, 1E-240, 1E-241, 1E-242, 1E-243, 1E-244, 1E-245, 1E-246, 1E-247, 1E-248, 1E-249, 1E-250, 1E-251, 1E-252, 1E-253, 1E-254, 1E-255, 1E-256, 1E-257, 1E-258, 1E-259, 1E-260, 1E-261, 1E-262, 1E-263, 1E-264, 1E-265, 1E-266, 1E-267, 1E-268, 1E-269, 1E-270, 1E-271, 1E-272, 1E-273, 1E-274, 1E-275, 1E-276, 1E-277, 1E-278, 1E-279, 1E-280, 1E-281, 1E-282, 1E-283, 1E-284, 1E-285, 1E-286, 1E-287, 1E-288, 1E-289, 1E-290, 1E-291, 1E-292, 1E-293, 1E-294, 1E-295, 1E-296, 1E-297, 1E-298, 1E-299,
1E-300, 1E-301, 1E-302, 1E-303, 1E-304, 1E-305, 1E-306, 1E-307, 1E-308, 1E-309, 1E-310, 1E-311, 1E-312, 1E-313, 1E-314, 1E-315, 1E-316, 1E-317, 1E-318, 1E-319, 1E-320, 1E-321, 1E-322, 1E-323, 1E-324
];
/**
* Returns powers of 10.
* Unlike the Math.pow this function produces no decimal garbage.
* @param exp Exponent.
*/
function pow10(exp) {
debug.assertValue(exp, "exp");
// Positive & zero
if (exp >= 0) {
if (exp < Double.POSITIVE_POWERS.length) {
return Double.POSITIVE_POWERS[exp];
}
else {
return Infinity;
}
}
// Negative
exp = -exp;
if (exp > 0 && exp < Double.NEGATIVE_POWERS.length) { // if exp==int.MIN_VALUE then changing the sign will overflow and keep the number negative - we need to check for exp > 0 to filter out this corner case
return Double.NEGATIVE_POWERS[exp];
}
else {
return 0;
}
}
Double.pow10 = pow10;
/**
* Returns the 10 base logarithm of the number.
* Unlike Math.log function this produces integer results with no decimal garbage.
* @param val Positive value or zero.
*/
function log10(val) {
debug.assert(val >= 0, "val");
// Fast Log10() algorithm
if (val > 1 && val < 1E16) {
if (val < 1E8) {
if (val < 1E4) {
if (val < 1E2) {
if (val < 1E1) {
return 0;
}
else {
return 1;
}
}
else {
if (val < 1E3) {
return 2;
}
else {
return 3;
}
}
}
else {
if (val < 1E6) {
if (val < 1E5) {
return 4;
}
else {
return 5;
}
}
else {
if (val < 1E7) {
return 6;
}
else {
return 7;
}
}
}
}
else {
if (val < 1E12) {
if (val < 1E10) {
if (val < 1E9) {
return 8;
}
else {
return 9;
}
}
else {
if (val < 1E11) {
return 10;
}
else {
return 11;
}
}
}
else {
if (val < 1E14) {
if (val < 1E13) {
return 12;
}
else {
return 13;
}
}
else {
if (val < 1E15) {
return 14;
}
else {
return 15;
}
}
}
}
}
if (val > 1E-16 && val < 1) {
if (val < 1E-8) {
if (val < 1E-12) {
if (val < 1E-14) {
if (val < 1E-15) {
return -16;
}
else {
return -15;
}
}
else {
if (val < 1E-13) {
return -14;
}
else {
return -13;
}
}
}
else {
if (val < 1E-10) {
if (val < 1E-11) {
return -12;
}
else {
return -11;
}
}
else {
if (val < 1E-9) {
return -10;
}
else {
return -9;
}
}
}
}
else {
if (val < 1E-4) {
if (val < 1E-6) {
if (val < 1E-7) {
return -8;
}
else {
return -7;
}
}
else {
if (val < 1E-5) {
return -6;
}
else {
return -5;
}
}
}
else {
if (val < 1E-2) {
if (val < 1E-3) {
return -4;
}
else {
return -3;
}
}
else {
if (val < 1E-1) {
return -2;
}
else {
return -1;
}
}
}
}
}
// JS Math provides only natural log function so we need to calc the 10 base logarithm:
// logb(x) = logk(x)/logk(b);
var log10 = Math.log(val) / Double.LOG_E_10;
return Double.floorWithPrecision(log10);
}
Double.log10 = log10;
/**
* Returns a power of 10 representing precision of the number based on the number of meaningful decimal digits.
* For example the precision of 56,263.3767 with the 6 meaningful decimal digit is 0.1.
* @param x Value.
* @param decimalDigits How many decimal digits are meaningfull.
*/
function getPrecision(x, decimalDigits) {
if (decimalDigits === undefined) {
decimalDigits = Double.DEFAULT_PRECISION_IN_DECIMAL_DIGITS;
}
else {
debug.assert(decimalDigits >= 0, "decimalDigits");
}
if (!x || !isFinite(x)) {
return undefined;
}
var exp = Double.log10(Math.abs(x));
if (exp < Double.MIN_EXP) {
return 0;
}
var precisionExp = Math.max(exp - decimalDigits, -Double.NEGATIVE_POWERS.length + 1);
return Double.pow10(precisionExp);
}
Double.getPrecision = getPrecision;
/**
* Checks if a delta between 2 numbers is less than provided precision.
* @param x One value.
* @param y Another value.
* @param precision Precision value.
*/
function equalWithPrecision(x, y, precision) {
precision = detectPrecision(precision, x, y);
debug.assert(precision >= 0, "precision");
return x === y || Math.abs(x - y) < precision;
}
Double.equalWithPrecision = equalWithPrecision;
/**
* Checks if a first value is less than another taking
* into account the loose precision based equality.
* @param x One value.
* @param y Another value.
* @param precision Precision value.
*/
function lessWithPrecision(x, y, precision) {
precision = detectPrecision(precision, x, y);
debug.assert(precision >= 0, "precision");
return x < y && Math.abs(x - y) > precision;
}
Double.lessWithPrecision = lessWithPrecision;
/**
* Checks if a first value is less or equal than another taking
* into account the loose precision based equality.
* @param x One value.
* @param y Another value.
* @param precision Precision value.
*/
function lessOrEqualWithPrecision(x, y, precision) {
precision = detectPrecision(precision, x, y);
debug.assert(precision >= 0, "precision");
return x < y || Math.abs(x - y) < precision;
}
Double.lessOrEqualWithPrecision = lessOrEqualWithPrecision;
/**
* Checks if a first value is greater than another taking
* into account the loose precision based equality.
* @param x One value.
* @param y Another value.
* @param precision Precision value.
*/
function greaterWithPrecision(x, y, precision) {
precision = detectPrecision(precision, x, y);
debug.assert(precision >= 0, "precision");
return x > y && Math.abs(x - y) > precision;
}
Double.greaterWithPrecision = greaterWithPrecision;
/**
* Checks if a first value is greater or equal to another taking
* into account the loose precision based equality.
* @param x One value.
* @param y Another value.
* @param precision Precision value.
*/
function greaterOrEqualWithPrecision(x, y, precision) {
precision = detectPrecision(precision, x, y);
debug.assert(precision >= 0, "precision");
return x > y || Math.abs(x - y) < precision;
}
Double.greaterOrEqualWithPrecision = greaterOrEqualWithPrecision;
/**
* Floors the number unless it's withing the precision distance from the higher int.
* @param x One value.
* @param precision Precision value.
*/
function floorWithPrecision(x, precision) {
precision = precision != null ? precision : Double.DEFAULT_PRECISION;
debug.assert(precision >= 0, "precision");
var roundX = Math.round(x);
if (Math.abs(x - roundX) < precision) {
return roundX;
}
else {
return Math.floor(x);
}
}
Double.floorWithPrecision = floorWithPrecision;
/**
* Ceils the number unless it's withing the precision distance from the lower int.
* @param x One value.
* @param precision Precision value.
*/
function ceilWithPrecision(x, precision) {
precision = detectPrecision(precision, Double.DEFAULT_PRECISION);
debug.assert(precision >= 0, "precision");
var roundX = Math.round(x);
if (Math.abs(x - roundX) < precision) {
return roundX;
}
else {
return Math.ceil(x);
}
}
Double.ceilWithPrecision = ceilWithPrecision;
/**
* Floors the number to the provided precision.
* For example 234,578 floored to 1,000 precision is 234,000.
* @param x One value.
* @param precision Precision value.
*/
function floorToPrecision(x, precision) {
precision = detectPrecision(precision, Double.DEFAULT_PRECISION);
debug.assert(precision >= 0, "precision");
if (precision === 0 || x === 0) {
return x;
}
//Precision must be a Power of 10
return Math.floor(x / precision) * precision;
}
Double.floorToPrecision = floorToPrecision;
/**
* Ceils the number to the provided precision.
* For example 234,578 floored to 1,000 precision is 235,000.
* @param x One value.
* @param precision Precision value.
*/
function ceilToPrecision(x, precision) {
precision = detectPrecision(precision, Double.DEFAULT_PRECISION);
debug.assert(precision >= 0, "precision");
if (precision === 0 || x === 0) {
return x;
}
//Precision must be a Power of 10
return Math.ceil(x / precision) * precision;
}
Double.ceilToPrecision = ceilToPrecision;
/**
* Rounds the number to the provided precision.
* For example 234,578 floored to 1,000 precision is 235,000.
* @param x One value.
* @param precision Precision value.
*/
function roundToPrecision(x, precision) {
precision = detectPrecision(precision, Double.DEFAULT_PRECISION);
debug.assert(precision >= 0, "precision");
if (precision === 0 || x === 0) {
return x;
}
//Precision must be a Power of 10
var result = Math.round(x / precision) * precision;
var decimalDigits = Math.round(Double.log10(Math.abs(x)) - Double.log10(precision)) + 1;
if (decimalDigits > 0 && decimalDigits < 16) {
result = parseFloat(result.toPrecision(decimalDigits));
}
return result;
}
Double.roundToPrecision = roundToPrecision;
/**
* Returns the value making sure that it's restricted to the provided range.
* @param x One value.
* @param min Range min boundary.
* @param max Range max boundary.
*/
function ensureInRange(x, min, max) {
debug.assert(min <= max, "min must be less or equal to max");
if (x === undefined || x === null) {
return x;
}
if (x < min) {
return min;
}
if (x > max) {
return max;
}
return x;
}
Double.ensureInRange = ensureInRange;
/**
* Rounds the value - this method is actually faster than Math.round - used in the graphics utils.
* @param x Value to round.
*/
function round(x) {
debug.assert(x >= 0, "x must be greater or equal to 0");
return (0.5 + x) << 0;
}
Double.round = round;
/**
* Projects the value from the source range into the target range.
* @param value Value to project.
* @param fromMin Minimum of the source range.
* @param toMin Minimum of the target range.
* @param toMax Maximum of the target range.
*/
function project(value, fromMin, fromSize, toMin, toSize) {
if (fromSize === 0 || toSize === 0) {
if (fromMin <= value && value <= fromMin + fromSize) {
return toMin;
}
else {
return NaN;
}
}
var relativeX = (value - fromMin) / fromSize;
var projectedX = toMin + relativeX * toSize;
return projectedX;
}
Double.project = project;
/**
* Removes decimal noise.
* @param value Value to be processed.
*/
function removeDecimalNoise(value) {
return roundToPrecision(value, getPrecision(value));
}
Double.removeDecimalNoise = removeDecimalNoise;
/**
* Checks whether the number is integer.
* @param value Value to be checked.
*/
function isInteger(value) {
return value !== null && value % 1 === 0;
}
Double.isInteger = isInteger;
/**
* Dividing by increment will give us count of increments
* Round out the rough edges into even integer
* Multiply back by increment to get rounded value
* e.g. Rounder.toIncrement(0.647291, 0.05) => 0.65
* @param value - value to round to nearest increment
* @param increment - smallest increment to round toward
*/
function toIncrement(value, increment) {
return Math.round(value / increment) * increment;
}
Double.toIncrement = toIncrement;
/**
* Overrides the given precision with defaults if necessary. Exported only for tests
*
* precision defined returns precision
* x defined with y undefined returns twelve digits of precision based on x
* x defined but zero with y defined; returns twelve digits of precision based on y
* x and y defined returns twelve digits of precision based on the minimum of the two
* if no applicable precision is found based on those (such as x and y being zero), the default precision is used
*/
function detectPrecision(precision, x, y) {
if (precision !== undefined) {
return precision;
}
var calculatedPrecision;
if (!y) {
calculatedPrecision = Double.getPrecision(x);
}
else if (!x) {
calculatedPrecision = Double.getPrecision(y);
}
else {
calculatedPrecision = Double.getPrecision(Math.min(Math.abs(x), Math.abs(y)));
}
return calculatedPrecision || Double.DEFAULT_PRECISION;
}
Double.detectPrecision = detectPrecision;
})(Double = powerbi.Double || (powerbi.Double = {}));
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
var _a;
function createJQueryPromiseFactory() {
return new JQueryPromiseFactory();
}
powerbi.createJQueryPromiseFactory = createJQueryPromiseFactory;
/**
* Values that JQueryPromise.state() may return. No better place for it.
*/
var JQueryPromiseState;
(function (JQueryPromiseState) {
JQueryPromiseState[JQueryPromiseState["pending"] = 0] = "pending";
JQueryPromiseState[JQueryPromiseState["resolved"] = 1] = "resolved";
JQueryPromiseState[JQueryPromiseState["rejected"] = 2] = "rejected";
})(JQueryPromiseState = powerbi.JQueryPromiseState || (powerbi.JQueryPromiseState = {}));
/**
* jQuery-based implementation of IPromiseFactory.
* This is useful for cases when Angular is not present, or when immediate promise resolving (not tied to Angular digest cycle) is desired.
*/
var JQueryPromiseFactory = /** @class */ (function () {
function JQueryPromiseFactory() {
}
JQueryPromiseFactory.prototype.defer = function (_) {
// No need to add a special handling here for telemetryV2Enabled switch as it is not planned to be used.
return new JQueryDeferredWrapper($.Deferred());
};
JQueryPromiseFactory.prototype.reject = function (reason) {
var deferred = this.defer();
deferred.reject(reason);
return deferred.promise;
};
JQueryPromiseFactory.prototype.resolve = function (value) {
var deferred = this.defer();
deferred.resolve(value);
return deferred.promise;
};
JQueryPromiseFactory.prototype.all = function (promises) {
return this.when.apply(this, promises).then((function () { return Array.prototype.slice.call(arguments); }));
};
JQueryPromiseFactory.prototype.allSettled = function (promises) {
var deferred = this.defer();
var promiseCount = promises.length;
if (promiseCount > 0) {
var resolvedCount_1 = 0;
var results_1 = [];
var _loop_1 = function (i) {
promises[i].then((function (result) {
results_1[i] = {
value: result,
type: 0 /* Success */
};
})).catch((function (result) {
results_1[i] = {
value: result,
type: 1 /* Failure */
};
})).finally((function () {
resolvedCount_1++;
if (resolvedCount_1 === promiseCount) {
deferred.resolve(results_1);
}
}));
};
for (var i = 0; i < promiseCount; i++) {
_loop_1(i);
}
}
else {
deferred.resolve([]);
}
return deferred.promise;
};
JQueryPromiseFactory.prototype.when = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var unwrappedPromises = args.map((function (value) { return value && value.promise ? value.promise : value; }));
if (unwrappedPromises.length === 1) {
var unwrappedPromise = unwrappedPromises[0];
if (unwrappedPromise === null || unwrappedPromise === void 0 ? void 0 : unwrappedPromise.pipe) {
return new JQueryPromiseWrapper(unwrappedPromise);
}
else {
return this.resolve(unwrappedPromise);
}
}
else {
return new JQueryPromiseWrapper($.when.apply($, unwrappedPromises));
}
};
return JQueryPromiseFactory;
}());
/**
* Implements IDeferred via a wrapped a jQuery Deferred.
*/
var JQueryDeferredWrapper = /** @class */ (function () {
function JQueryDeferredWrapper(deferred) {
debug.assertValue(deferred, 'deferred');
this.deferred = deferred;
this.promise = new JQueryPromiseWrapper(deferred.promise());
}
JQueryDeferredWrapper.prototype.resolve = function (value) {
this.deferred.resolveWith(this.deferred.promise, [value]);
};
JQueryDeferredWrapper.prototype.reject = function (reason) {
this.deferred.rejectWith(this.deferred.promise, [reason]);
};
return JQueryDeferredWrapper;
}());
/**
* Implements IDeferred via a wrapped a jQuery Promise.
*/
var JQueryPromiseWrapper = /** @class */ (function () {
function JQueryPromiseWrapper(promise) {
this[_a] = 'Promise';
debug.assertValue(promise, 'promise');
this.promise = promise;
}
JQueryPromiseWrapper.prototype.then = function (successCallback, errorCallback) {
var successPromise = JQueryPromiseWrapper.wrapCallback(successCallback);
var errorPromise = JQueryPromiseWrapper.wrapCallback(errorCallback);
var chained;
// Compiler has an issue validating promise.pipe(fn|null, fn)
// But considers both pipe(fn, fun) and pipe(null, fn) correct
if (successPromise)
chained = this.promise.pipe(successPromise, errorPromise);
else
chained = this.promise.pipe(null, errorPromise);
return new JQueryPromiseWrapper(chained);
};
// TODO Fix Explicit Any
JQueryPromiseWrapper.prototype.catch = function (callback) {
return this.then(null, callback);
};
// TODO Fix Explicit Any
JQueryPromiseWrapper.prototype.finally = function (callback) {
this.promise.always(JQueryPromiseWrapper.wrapCallback(callback));
return this;
};
/**
* Wraps a callback, which may return a IPromise.
*/
JQueryPromiseWrapper.wrapCallback = function (callback) {
if (callback)
return function () {
var value = callback.apply(this, arguments);
// If the callback returns a Promise, unwrap that to allow jQuery to chain.
if (value instanceof JQueryPromiseWrapper)
return value.promise;
return value;
};
return callback;
};
return JQueryPromiseWrapper;
}());
_a = Symbol.toStringTag;
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
var ArrayExtensions;
(function (ArrayExtensions) {
/**
* Returns items that exist in target and other.
*/
function intersect(target, other) {
var result = [];
for (var i = target.length - 1; i >= 0; --i) {
if (other.indexOf(target[i]) !== -1) {
result.push(target[i]);
}
}
return result;
}
ArrayExtensions.intersect = intersect;
/**
* Return elements exists in target but not exists in other.
*/
function diff(target, other) {
var result = [];
for (var i = target.length - 1; i >= 0; --i) {
var value = target[i];
if (other.indexOf(value) === -1) {
result.push(value);
}
}
return result;
}
ArrayExtensions.diff = diff;
/**
* Return an array with only the distinct items in the source.
*/
function distinct(source) {
var result = [];
for (var i = 0, len = source.length; i < len; i++) {
var value = source[i];
if (result.indexOf(value) === -1) {
result.push(value);
}
}
return result;
}
ArrayExtensions.distinct = distinct;
/**
* Pushes content of source onto target,
* for parts of course that do not already exist in target.
*/
function union(target, source) {
for (var i = 0, len = source.length; i < len; ++i) {
unionSingle(target, source[i]);
}
}
ArrayExtensions.union = union;
/**
* Pushes value onto target, if value does not already exist in target.
*/
function unionSingle(target, value) {
if (target.indexOf(value) < 0) {
target.push(value);
}
}
ArrayExtensions.unionSingle = unionSingle;
/**
* Returns an array with a range of items from source,
* including the startIndex & endIndex.
*/
function range(source, startIndex, endIndex) {
debug.assert(startIndex >= 0 && startIndex < source.length, 'startIndex is out of range.');
debug.assert(endIndex >= 0 && endIndex < source.length, 'endIndex is out of range.');
var result = [];
for (var i = startIndex; i <= endIndex; ++i) {
result.push(source[i]);
}
return result;
}
ArrayExtensions.range = range;
/**
* Returns an array that includes items from source, up to the specified count.
*/
function take(source, count) {
debug.assert(count >= 0, 'Count is negative.');
debug.assert(count <= source.length, 'Count is too large.');
var result = [];
for (var i = 0; i < count; ++i) {
result.push(source[i]);
}
return result;
}
ArrayExtensions.take = take;
function copy(source) {
debug.assertValue(source, 'source');
return take(source, source.length);
}
ArrayExtensions.copy = copy;
/**
* Returns a value indicating whether the arrays have the same values in the same sequence.
*/
function sequenceEqual(left, right, comparison) {
var _a;
// Normalize falsy to null
if (!left) {
left = null;
}
if (!right) {
right = null;
}
// T can be same as U, and it is possible for left and right to be the same array object...
if (left === right) {
return true;
}
if (!!left !== !!right) {
return false;
}
var len = (_a = (left === null || left === void 0 ? void 0 : left.length)) !== null && _a !== void 0 ? _a : 0;
if (len !== (right === null || right === void 0 ? void 0 : right.length)) {
return false;
}
var i = 0;
while (i < len && comparison(left === null || left === void 0 ? void 0 : left[i], right === null || right === void 0 ? void 0 : right[i])) {
++i;
}
return i === len;
}
ArrayExtensions.sequenceEqual = sequenceEqual;
/**
* Returns null if the specified array is empty.
* Otherwise returns the specified array.
*/
function emptyToNull(array) {
if (array && array.length === 0) {
return null;
}
return array;
}
ArrayExtensions.emptyToNull = emptyToNull;
function indexOf(array, predicate) {
debug.assertValue(array, 'array');
debug.assertValue(predicate, 'predicate');
for (var i = 0, len = array.length; i < len; ++i) {
if (predicate(array[i])) {
return i;
}
}
return -1;
}
ArrayExtensions.indexOf = indexOf;
/**
* Returns a copy of the array rotated by the specified offset.
*/
function rotate(array, offset) {
if (offset === 0)
return array.slice();
var rotated = array.slice(offset);
Array.prototype.push.apply(rotated, array.slice(0, offset));
return rotated;
}
ArrayExtensions.rotate = rotate;
function createWithId() {
return extendWithId([]);
}
ArrayExtensions.createWithId = createWithId;
function extendWithId(array) {
debug.assertValue(array, 'array');
var extended = array;
extended.withId = withId;
return extended;
}
ArrayExtensions.extendWithId = extendWithId;
/**
* Finds and returns the first item with a matching ID.
*/
function findWithId(array, id) {
for (var i = 0, len = array.length; i < len; i++) {
var item = array[i];
if (item.id === id)
return item;
}
}
ArrayExtensions.findWithId = findWithId;
function withId(id) {
return ArrayExtensions.findWithId(this, id);
}
function createWithName() {
return extendWithName([]);
}
ArrayExtensions.createWithName = createWithName;
function extendWithName(array) {
debug.assertValue(array, 'array');
var extended = array;
extended.withName = withName;
return extended;
}
ArrayExtensions.extendWithName = extendWithName;
function findItemWithName(array, name) {
var index = indexWithName(array, name);
if (index >= 0)
return array[index];
}
ArrayExtensions.findItemWithName = findItemWithName;
function indexWithName(array, name) {
for (var i = 0, len = array.length; i < len; i++) {
var item = array[i];
if (item.name === name)
return i;
}
return -1;
}
ArrayExtensions.indexWithName = indexWithName;
/**
* Inserts a number in sorted order into a list of numbers already in sorted order.
* @returns True if the item was added, false if it already existed.
*/
function insertSorted(list, value) {
debug.assertValue(list, 'list');
debug.assertValue(value, 'value');
var len = list.length;
// NOTE: iterate backwards because incoming values tend to be sorted already.
for (var i = len - 1; i >= 0; i--) {
var diff_1 = list[i] - value;
if (diff_1 === 0)
return false;
if (diff_1 > 0)
continue;
// diff < 0
list.splice(i + 1, 0, value);
return true;
}
list.unshift(value);
return true;
}
ArrayExtensions.insertSorted = insertSorted;
/**
* Inserts the number if array doesn't contain one already.
* @returns true if item was inserted.
*/
function insertUnique(list, value) {
debug.assertValue(list, 'list');
debug.assertValue(value, 'value');
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
var item = list_1[_i];
if (item === value)
return false;
}
list.push(value);
return true;
}
ArrayExtensions.insertUnique = insertUnique;
/**
* Removes the first occurrence of a value from a list if it exists.
* @returns True if the value was removed, false if it did not exist in the list.
*/
function removeFirst(list, value) {
var index = list.indexOf(value);
if (index < 0)
return false;
list.splice(index, 1);
return true;
}
ArrayExtensions.removeFirst = removeFirst;
/**
* Finds and returns the first item with a matching name.
*/
function withName(name) {
var array = this;
return findItemWithName(array, name);
}
/**
* Deletes all items from the array.
*/
function clear(array) {
if (!array)
return;
while (array.length > 0)
array.pop();
}
ArrayExtensions.clear = clear;
/**
* This method is deprecated, should use _.isEmpty.
* Cannot remove at this time due to usage by custom visuals.
*/
function isUndefinedOrEmpty(array) {
if (!array || array.length === 0) {
return true;
}
return false;
}
ArrayExtensions.isUndefinedOrEmpty = isUndefinedOrEmpty;
function swap(array, firstIndex, secondIndex) {
var temp = array[firstIndex];
array[firstIndex] = array[secondIndex];
array[secondIndex] = temp;
}
ArrayExtensions.swap = swap;
function isInArray(array, lookupItem, compareCallback) {
return _.some(array, (function (item) { return compareCallback(item, lookupItem); }));
}
ArrayExtensions.isInArray = isInArray;
/** Checks if the given object is an Array, and looking all the way up the prototype chain. */
function isArrayOrInheritedArray(obj) {
debug.assertValue(obj, 'obj');
var nextPrototype = obj;
while (nextPrototype != null) {
if (_.isArray(nextPrototype))
return true;
nextPrototype = Object.getPrototypeOf(nextPrototype);
}
return false;
}
ArrayExtensions.isArrayOrInheritedArray = isArrayOrInheritedArray;
/**
* Returns true if the specified values array is sorted in an order as determined by the specified compareFunction.
*/
function isSorted(values, compareFunction) {
debug.assertValue(values, 'values');
debug.assertValue(compareFunction, 'compareFunction');
var ilen = values.length;
if (ilen >= 2) {
for (var i = 1; i < ilen; i++) {
if (compareFunction(values[i - 1], values[i]) > 0) {
return false;
}
}
}
return true;
}
ArrayExtensions.isSorted = isSorted;
/**
* Returns true if the specified number values array is sorted in ascending order
* (or descending order if the specified descendingOrder is truthy).
*/
function isSortedNumeric(values, descendingOrder) {
debug.assertValue(values, 'values');
debug.assertAnyValue(descendingOrder, 'descendingOrder');
var compareFunction = descendingOrder ?
function (a, b) { return b - a; } :
function (a, b) { return a - b; };
return isSorted(values, compareFunction);
}
ArrayExtensions.isSortedNumeric = isSortedNumeric;
/**
* Ensures that the given T || T[] is in array form, either returning the array or
* converting single items into an array of length one.
*/
function ensureArray(value) {
if (_.isArray(value)) {
return value;
}
return [value];
}
ArrayExtensions.ensureArray = ensureArray;
/**
* Verifies there are no duplicate names in the given items.
*/
function hasUniqueNames(items) {
return _.uniqBy(items, (function (pod) { return pod.name; })).length === items.length;
}
ArrayExtensions.hasUniqueNames = hasUniqueNames;
/**
* Rewrites an immutable array. The `rewriter` is called for each item in the array, if any of
* the values returned is not referentially equal to the original value then a new array is allocated
* to hold the new values.
*
* The `rewriter` should not mutate the input.
*/
function rewriteArray(array, rewriter) {
debug.assertValue(array, 'array');
var rewrittenResult;
for (var i = 0, len = array.length; i < len; i++) {
var item = array[i], rewrittenItem = rewriter(item);
if (item !== rewrittenItem && !rewrittenResult)
rewrittenResult = ArrayExtensions.take(array, i);
if (rewrittenResult)
rewrittenResult.push(rewrittenItem);
}
return rewrittenResult || array;
}
ArrayExtensions.rewriteArray = rewriteArray;
/**
* Splices values into an immutable array. The `splicer` is called for each item in the array, if
* it does not simply return an array of the original value, then a new array is allocated to hold
* the new values. All values in the returned array will be inserted into the array, replacing the
* original value. If returned array is empty, original value will be deleted.
*/
function spliceArray(array, splicer) {
debug.assertValue(array, 'array');
var rewrittenResult;
for (var i = 0, len = array.length; i < len; i++) {
var item = array[i], replaceItems = splicer(item, i), shouldReplace = replaceItems.length !== 1 || replaceItems[0] !== item;
if (shouldReplace && !rewrittenResult)
rewrittenResult = ArrayExtensions.take(array, i);
if (rewrittenResult) {
if (shouldReplace)
rewrittenResult.push.apply(rewrittenResult, (replaceItems || []));
else
rewrittenResult.push(item);
}
}
return rewrittenResult || array;
}
ArrayExtensions.spliceArray = spliceArray;
/**
* Filters an array using the filterTest function; the filterTest function is called for each item in the array.
* If filterTest returns false for an element, the element will be removed and a new array allocated to hold
* the remaining values.
*
* If no elements should be filtered out, the original array will be returned unaltered
*
* @param array The array to be filtered
* @param filterTest Function that returns true to keep the element and false to remove the element
*/
function filterArray(array, filterTest) {
debug.assertValue(array, 'array');
var filteredArray;
for (var i = 0, len = array.length; i < len; i++) {
var item = array[i], keepElement = filterTest(item, i);
if (!keepElement && !filteredArray)
filteredArray = ArrayExtensions.take(array, i);
if (filteredArray && keepElement)
filteredArray.push(item);
}
return filteredArray || array;
}
ArrayExtensions.filterArray = filterArray;
/**
* Checks that arrays have the same values.
*/
function hasSameValues(left, right, isEqual) {
if (_.isEmpty(left) || _.isEmpty(right))
return _.isEmpty(left) && _.isEmpty(right);
if (left.length !== right.length)
return false;
// We need to keep the visited map to avoid duplication.
return contains(left, right, isEqual);
}
ArrayExtensions.hasSameValues = hasSameValues;
/**
* Checks that source arrays is subset of target array.
*/
function isSubset(source, target, isEqual) {
debug.assertValue(isEqual, 'isSubset isEqual cant be null');
if (_.isEmpty(source) || _.isEmpty(target))
return _.isEmpty(source) && _.isEmpty(target);
if (source.length > target.length)
return false;
// We need to keep the visited map to avoid duplication.
return contains(source, target, isEqual);
}
ArrayExtensions.isSubset = isSubset;
function contains(source, target, isEqual) {
var visitedMap = new Array(target.length);
for (var _i = 0, source_1 = source; _i < source_1.length; _i++) {
var leftValue = source_1[_i];
var found = false;
for (var i = 0; i < target.length; i++) {
if (!visitedMap[i] && isEqual(leftValue, target[i])) {
found = true;
visitedMap[i] = true;
break;
}
}
if (!found)
return false;
}
return true;
}
/**
* Find the longest common subsequence between two array sequences.
* Implementation based on the commonly-known dynamic programming solution:
* https://en.wikipedia.org/wiki/Longest_common_subsequence_problem
*
* Brief explanation:
*
* Consider LCS(sequenceA, sequenceB) to be a function for finding the length of the LCS of two sequences. Say sequenceA is of length [0..m-1]
* and sequenceB is of length [0..n-1], We can note two properties about these sequences:
*
* 1. If the last symbol in each sequence is the same then LCS([0..m-1], [0..n-1]) = LCS([0..m-2], [0..n-2]) + 1
* 2. If the last symbols are not equal then LCS([0..m-1], [0..n-1]) = Math.max(LCS([0..m-1], [0..n-2]), LCS([0..m-2], [0..n-1]))
*
* Which lends itself to a recursive structure. To speed up the algorithm we can cache results of individual sequences and build up the table
* from the bottom up.
*/
function getLongestCommonSubsequence(target, source, equals) {
// Used to build up the table. Each entry (x, y) is an integer representing the length of the LCS for projections[0..x-1] and otherProjections[0..y-1]
if (_.isEmpty(target) || _.isEmpty(source))
return [];
var sequenceCache = [];
for (var targetIndex = 0; targetIndex <= target.length; targetIndex++) {
sequenceCache[targetIndex] = [];
for (var sourceIndex = 0; sourceIndex <= source.length; sourceIndex++) {
if (targetIndex === 0 || sourceIndex === 0)
sequenceCache[targetIndex][sourceIndex] = 0;
else if (equals(target[targetIndex - 1], source[sourceIndex - 1]))
sequenceCache[targetIndex][sourceIndex] = sequenceCache[targetIndex - 1][sourceIndex - 1] + 1;
else
sequenceCache[targetIndex][sourceIndex] = Math.max(sequenceCache[targetIndex - 1][sourceIndex], sequenceCache[targetIndex][sourceIndex - 1]);
}
}
// Now we backtrack through the table to create the actual LCS array
var sequence = [];
var index = sequenceCache[target.length][source.length];
var i = target.length;
var j = source.length;
while (i > 0 && j > 0) {
if (equals(target[i - 1], source[j - 1])) {
sequence[index - 1] = target[i - 1];
i--;
j--;
index--;
}
else if (sequenceCache[i - 1][j] > sequenceCache[i][j - 1])
i--;
else
j--;
}
return sequence;
}
ArrayExtensions.getLongestCommonSubsequence = getLongestCommonSubsequence;
})(ArrayExtensions = jsCommon.ArrayExtensions || (jsCommon.ArrayExtensions = {}));
// TODO: move to a separate file
var DictionaryExtensions;
(function (DictionaryExtensions) {
/**
* Rewrites an immutable dictionary. The `rewriter` is called for each item in the dictionary, if any of
* the values returned is not referentially equal to the original value then a new dictionary is allocated
* to hold the new values.
*
* The `rewriter` should not mutate the input.
*/
function rewriteDictionary(dictionary, rewriter) {
debug.assertValue(dictionary, 'dictionary');
var rewrittenResult;
var keys = Object.getOwnPropertyNames(dictionary);
for (var i = 0, len = keys.length; i < len; i++) {
var key = keys[i], value = dictionary[key], rewrittenValue = rewriter(key, value);
if (value !== rewrittenValue && !rewrittenResult)
rewrittenResult = _.pick(dictionary, ArrayExtensions.take(keys, i));
if (rewrittenResult)
rewrittenResult[key] = rewrittenValue;
}
return rewrittenResult || dictionary;
}
DictionaryExtensions.rewriteDictionary = rewriteDictionary;
})(DictionaryExtensions = jsCommon.DictionaryExtensions || (jsCommon.DictionaryExtensions = {}));
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
var Double = powerbi.Double;
var Color;
(function (Color) {
function rotate(rgbString, rotateFactor) {
if (rotateFactor === 0)
return rgbString;
var originalRgb = parseColorString(rgbString);
if (!originalRgb)
return;
var originalHsv = rgbToHsv(originalRgb);
if (!originalHsv)
return;
var rotatedHsv = rotateHsv(originalHsv, rotateFactor);
if (!rotatedHsv)
return;
var rotatedRgb = hsvToRgb(rotatedHsv);
if (!rotatedRgb)
return;
return hexString(rotatedRgb);
}
Color.rotate = rotate;
function normalizeToHexString(color) {
var rgb = parseColorString(color);
if (rgb)
return hexString(rgb);
}
Color.normalizeToHexString = normalizeToHexString;
function parseColorString(color) {
if (color.indexOf('#') >= 0) {
if (color.length === 7) {
// #RRGGBB
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color);
if (result == null || result.length < 4)
return;
return {
R: parseInt(result[1], 16),
G: parseInt(result[2], 16),
B: parseInt(result[3], 16),
};
}
else if (color.length === 4) {
// #RGB
var result = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(color);
if (result == null || result.length < 4)
return;
return {
R: parseInt(result[1] + result[1], 16),
G: parseInt(result[2] + result[2], 16),
B: parseInt(result[3] + result[3], 16),
};
}
}
else if (color.indexOf('rgb(') >= 0) {
// rgb(R, G, B)
var result = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/.exec(color);
if (result == null || result.length < 4)
return;
return {
R: parseInt(result[1], 10),
G: parseInt(result[2], 10),
B: parseInt(result[3], 10),
};
}
else if (color.indexOf('rgba(') >= 0) {
// rgba(R, G, B, A)
var result = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*(?:\.\d+)?)\)$/.exec(color);
if (result == null || result.length < 5)
return;
return {
R: parseInt(result[1], 10),
G: parseInt(result[2], 10),
B: parseInt(result[3], 10),
A: parseFloat(result[4]),
};
}
}
Color.parseColorString = parseColorString;
function rgbToHsv(rgbColor) {
if (!rgbColor)
return;
var s, h;
var r = rgbColor.R / 255, g = rgbColor.G / 255, b = rgbColor.B / 255;
var min = Math.min(r, Math.min(g, b));
var max = Math.max(r, Math.max(g, b));
var v = max;
var delta = max - min;
if (max === 0 || delta === 0) {
// R, G, and B must be 0.0, or all the same.
// In this case, S is 0.0, and H is undefined.
// Using H = 0.0 is as good as any...
s = 0;
h = 0;
}
else {
s = delta / max;
if (r === max) {
// Between Yellow and Magenta
h = (g - b) / delta;
}
else if (g === max) {
// Between Cyan and Yellow
h = 2 + (b - r) / delta;
}
else {
// Between Magenta and Cyan
h = 4 + (r - g) / delta;
}
}
// Scale h to be between 0.0 and 1.
// This may require adding 1, if the value
// is negative.
h /= 6;
if (h < 0) {
h += 1;
}
return {
H: h,
S: s,
V: v,
};
}
function hsvToRgb(hsvColor) {
var r, g, b;
var h = hsvColor.H, s = hsvColor.S, v = hsvColor.V;
if (s === 0) {
// If s is 0, all colors are the same.
// This is some flavor of gray.
r = v;
g = v;
b = v;
}
else {
var p = void 0, q = void 0, t = void 0, fractionalSector = void 0, sectorNumber = void 0, sectorPos = void 0;
// The color wheel consists of 6 sectors.
// Figure out which sector you//re in.
sectorPos = h * 6;
sectorNumber = Math.floor(sectorPos);
// get the fractional part of the sector.
// That is, how many degrees into the sector
// are you?
fractionalSector = sectorPos - sectorNumber;
// Calculate values for the three axes
// of the color.
p = v * (1.0 - s);
q = v * (1.0 - (s * fractionalSector));
t = v * (1.0 - (s * (1 - fractionalSector)));
// Assign the fractional colors to r, g, and b
// based on the sector the angle is in.
switch (sectorNumber) {
case 0:
r = v;
g = t;
b = p;
break;
case 1:
r = q;
g = v;
b = p;
break;
case 2:
r = p;
g = v;
b = t;
break;
case 3:
r = p;
g = q;
b = v;
break;
case 4:
r = t;
g = p;
b = v;
break;
case 5:
r = v;
g = p;
b = q;
break;
default:
debug.assertFail('unexpected');
return;
}
}
return {
R: Math.floor(r * 255),
G: Math.floor(g * 255),
B: Math.floor(b * 255),
};
}
function rotateHsv(hsvColor, rotateFactor) {
var newH = hsvColor.H + rotateFactor;
return {
H: newH > 1 ? newH - 1 : newH,
S: hsvColor.S,
V: hsvColor.V,
};
}
function darken(color, diff) {
var flooredNumber = Math.floor(diff);
return {
R: Math.max(0, color.R - flooredNumber),
G: Math.max(0, color.G - flooredNumber),
B: Math.max(0, color.B - flooredNumber),
};
}
Color.darken = darken;
function setOpacity(color, opacity) {
color.A = opacity;
return color;
}
Color.setOpacity = setOpacity;
function getTransparencyFromString(colorString) {
var rgbColor = parseColorString(colorString);
if (rgbColor)
return getTransparencyFromRGb(rgbColor);
}
Color.getTransparencyFromString = getTransparencyFromString;
function getTransparencyFromRGb(rgbColor) {
return _.isNumber(rgbColor.A) ? Math.round((1 - rgbColor.A) * 100) : 0;
}
Color.getTransparencyFromRGb = getTransparencyFromRGb;
function convertTransparencyToOpacity(transparency) {
// Transparency is specified as a number 0 - 100, while opacity is required to be 0 - 1
return 1 - (transparency / 100);
}
Color.convertTransparencyToOpacity = convertTransparencyToOpacity;
function rgbString(color) {
if (color.A == null)
return "rgb(" + color.R + "," + color.G + "," + color.B + ")";
return "rgba(" + color.R + "," + color.G + "," + color.B + "," + color.A + ")";
}
Color.rgbString = rgbString;
function hexString(color) {
return "#" + componentToHex(color.R) + componentToHex(color.G) + componentToHex(color.B);
}
Color.hexString = hexString;
function isHexString(color) {
return /^#([0-9a-f]{6}|[0-9a-f]{3})$/i.test(color);
}
Color.isHexString = isHexString;
function isHtmlSafeColor(color) {
// evaluating if string contains any characters that could break the color style: '" and dangling left parentheses ([
if (color == null || jsCommon.StringExtensions.hasDanglingLeftParenthesis(color) || color.indexOf("'") !== -1 || color.indexOf('"') !== -1) {
return false;
}
return true;
}
Color.isHtmlSafeColor = isHtmlSafeColor;
function isFullHexString(color) {
return /^#[0-9a-f]{6}$/i.test(color);
}
Color.isFullHexString = isFullHexString;
/**
* Tests if the color string is any valid form of non-named css: Hex, RGB, RGBA, HSL, or HSLA
* Before the first pipe checks for valid hex using 3 or 6 digits
* After the first pipe but before the second checks for RGBa and HSLa, and allows percentages and decimals
* After the second pipe checks for RGB or HSL, and allows percentages and decimals
* Global matching and ignores case
* @param color The color string to test
*/
function isValidCssString(color) {
return /(#([\da-f]{3}){1,2}|(rgb|hsl)a\((\d{1,3}%?,\s?){3}(1.0|1|0|0?\.\d+)\)|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?){2}\))/ig.test(color);
}
Color.isValidCssString = isValidCssString;
/**
* Overlays a color with opacity over a background color
* @param {string} foreColor Color to overlay
* @param {number} opacity number between 0 (transparent) to 1 (opaque)
* @param {string} backColor Background color
* @returns Result color
*/
function hexBlend(foreColor, opacity, backColor) {
var foreColorAsRbg = parseColorString(foreColor);
var backColorAsRbg = parseColorString(backColor);
if (!foreColorAsRbg || !backColorAsRbg)
return;
return hexString(rgbBlend(foreColorAsRbg, opacity, backColorAsRbg));
}
Color.hexBlend = hexBlend;
/**
* Overlays a color with opacity over a background color. Any alpha-channel is ignored.
* @param {RgbColor} foreColor Color to overlay
* @param {number} opacity number between 0 (transparent) to 1 (opaque). Any value out of range will be corrected.
* @param {RgbColor} backColor Background color
* @returns
*/
function rgbBlend(foreColor, opacity, backColor) {
// correct opacity
opacity = Double.ensureInRange(opacity, 0, 1);
return {
R: channelBlend(foreColor.R, opacity, backColor.R),
G: channelBlend(foreColor.G, opacity, backColor.G),
B: channelBlend(foreColor.B, opacity, backColor.B)
};
}
Color.rgbBlend = rgbBlend;
/**
* Blend a single channel for two colors
* @param {number} foreChannel Channel of foreground color. Will be enforced to be between 0 and 255.
* @param {number} opacity opacity of the foreground color. Will be enforced to be between 0 and 1.
* @param {number} backChannel channel of the background color. Will be enforced to be between 0 and 255.
* @returns result channel value
*/
function channelBlend(foreChannel, opacity, backChannel) {
opacity = Double.ensureInRange(opacity, 0, 1);
foreChannel = Double.ensureInRange(foreChannel, 0, 255);
backChannel = Double.ensureInRange(backChannel, 0, 255);
return Math.round((opacity * foreChannel) +
((1 - opacity) * backChannel));
}
Color.channelBlend = channelBlend;
/**
* Calculate the highlight color from the rgbColor based on the lumianceThreshold and delta.
* @param {RgbColor} rgbColor The original color.
* @param {number} lumianceThreshold The lumiance threshold used, the highlight color will be brighter when the lumiance is smaller the threshold, otherwise the highlight color will be darker. Will be enforced to be between 0 and 1.
* @param {number} delta the highlight color will be calculated based on the delta. Will be enforced to be between 0 and 1. lumianceThreshold + delta cannot greater than 1.
* @returns result highlight color value
*/
function calculateHighlightColor(rgbColor, lumianceThreshold, delta) {
var hsvColor = rgbToHsv(rgbColor);
if (!hsvColor)
return;
// For invalid lumianceThreshold and delta value, use default.
if (lumianceThreshold + delta > 1 || lumianceThreshold <= 0 || delta <= 0) {
debug.assert(false, 'Invalid lumianceThreshold and highlightColor adjusting delta.');
lumianceThreshold = 0.8;
delta = 0.2;
}
// Make it lighter when the lumianceValue is less than 200, otherwise make it darker.
if (hsvColor.V < lumianceThreshold)
hsvColor.V = hsvColor.V + delta;
else
hsvColor.V = hsvColor.V - delta;
var resultRGB = hsvToRgb(hsvColor);
if (resultRGB)
return hexString(resultRGB);
}
Color.calculateHighlightColor = calculateHighlightColor;
function componentToHex(hexComponent) {
var clamped = Double.ensureInRange(hexComponent, 0, 255);
var hex = clamped.toString(16).toUpperCase();
return hex.length === 1 ? "0" + hex : hex;
}
function createLinearColorScale(domain, range, clamp) {
debug.assert(domain.length === range.length, "createLinearColorScale - domain and range must be the same size");
debug.assert(domain.length > 1, "createLinearColorScale - domain and range must contain at least 2 values");
var rangeColors = range.map((function (v) { return Color.parseColorString(v); }));
return function (value) {
// treat undefined and NULL as 0
if (value == null)
value = 0;
// Returns undefined for NaN values
if (isNaN(value))
return;
if (clamp) {
var domainMax_1 = _.last(domain);
if (domainMax_1 == null || value >= domainMax_1)
return _.last(range);
if (value <= domain[0])
return range[0];
}
var domainMin, domainMax, rangeMin, rangeMax;
for (var i = 1, len = domain.length; i < len; i++) {
domainMin = domain[i - 1];
domainMax = domain[i];
// In case the domain is from -Infinity to Infinity and Mid point is NaN
// The first segment will be from -Infinity to NaN
// We should color the value as the end color
// This needs to special cased as comparisons against NaN always fail
if (domainMin === Number.NEGATIVE_INFINITY && isNaN(domainMax))
return range[i];
// If min or max are NaN, we can't color any value
if (isNaN(domainMin) || isNaN(domainMax))
return;
if (value === domainMax)
return range[i];
if (value >= domainMin && value <= domainMax) {
rangeMin = rangeColors[i - 1];
rangeMax = rangeColors[i];
break;
}
}
if (domainMin === undefined || domainMax === undefined || rangeMin === undefined || rangeMax === undefined)
return;
var newValue = {
R: interpolateValue(value, domainMin, domainMax, rangeMin.R, rangeMax.R),
G: interpolateValue(value, domainMin, domainMax, rangeMin.G, rangeMax.G),
B: interpolateValue(value, domainMin, domainMax, rangeMin.B, rangeMax.B)
};
return Color.hexString(newValue);
};
}
Color.createLinearColorScale = createLinearColorScale;
/** create a monochrome color scale from light to dark based on a single color */
function createMonochromeScale(color, valueOffset) {
if (valueOffset === void 0) { valueOffset = 0.25; }
debug.assert(valueOffset > 0 && valueOffset <= 0.5, 'valueOffset must be positive and less than 0.5');
var rgbColor = parseColorString(color);
var hsvColor = rgbToHsv(rgbColor);
if (!hsvColor)
return;
hsvColor.V = hsvColor.V > (1.0 - valueOffset) ? (1.0 - valueOffset) : hsvColor.V < valueOffset ? valueOffset : hsvColor.V;
var hsvLight = _.clone(hsvColor);
var hsvDark = _.clone(hsvColor);
hsvLight.V = Math.min(hsvColor.V + valueOffset, 1.0);
hsvDark.V = Math.max(hsvColor.V - valueOffset, 0);
var rgbLight = hsvToRgb(hsvLight);
var rgbDark = hsvToRgb(hsvDark);
if (!rgbLight || !rgbDark)
return;
var hexLight = hexString(rgbLight);
var hexDark = hexString(rgbDark);
return Color.createLinearColorScale([0.0, 1.0], [hexLight, hexDark], true);
}
Color.createMonochromeScale = createMonochromeScale;
function interpolateValue(value, domainMin, domainMax, rangeMin, rangeMax) {
// In case the range is from Infinitiy to -Infinity with no midpoint
// All values should be colored as the half-way color
if (domainMin === Number.NEGATIVE_INFINITY && domainMax === Number.POSITIVE_INFINITY)
return Math.round((rangeMax + rangeMin) / 2);
if (domainMin === Number.NEGATIVE_INFINITY)
return rangeMax;
if (domainMax === Number.POSITIVE_INFINITY)
return rangeMin;
return Math.round(rangeMin + (((value - domainMin) * (rangeMax - rangeMin)) / (domainMax - domainMin)));
}
/**
* Convert string hex expression to number, calculate percentage and R, G, B channels.
* Apply percentage for each channel and return back hex value as string with pound sign.
*/
function shadeColor(color, percent) {
var hexNum = parseInt(color.slice(1), 16);
var t = percent < 0 ? 0 : 255;
var p = percent < 0 ? percent * -1 : percent;
var R = hexNum >> 16;
var G = hexNum >> 8 & 0x00FF;
var B = hexNum & 0x0000FF;
var hexString = "#" + (0x1000000 + (Math.round((t - R) * p) + R) * 0x10000 + (Math.round((t - G) * p) + G) * 0x100 + (Math.round((t - B) * p) + B)).toString(16).slice(1);
return hexString;
}
Color.shadeColor = shadeColor;
// Source: https://www.w3.org/TR/css-color-3/
var cssColorMap = {
aliceblue: '#f0f8ff',
antiquewhite: '#faebd7',
aqua: '#00ffff',
aquamarine: '#7fffd4',
azure: '#f0ffff',
beige: '#f5f5dc',
bisque: '#ffe4c4',
black: '#000000',
blanchedalmond: '#ffebcd',
blue: '#0000ff',
blueviolet: '#8a2be2',
brown: '#a52a2a',
burlywood: '#deb887',
cadetblue: '#5f9ea0',
chartreuse: '#7fff00',
chocolate: '#d2691e',
coral: '#ff7f50',
cornflowerblue: '#6495ed',
cornsilk: '#fff8dc',
crimson: '#dc143c',
cyan: '#00ffff',
darkblue: '#00008b',
darkcyan: '#008b8b',
darkgoldenrod: '#b8860b',
darkgray: '#a9a9a9',
darkgreen: '#006400',
darkgrey: '#a9a9a9',
darkkhaki: '#bdb76b',
darkmagenta: '#8b008b',
darkolivegreen: '#556b2f',
darkorange: '#ff8c00',
darkorchid: '#9932cc',
darkred: '#8b0000',
darksalmon: '#e9967a',
darkseagreen: '#8fbc8f',
darkslateblue: '#483d8b',
darkslategray: '#2f4f4f',
darkslategrey: '#2f4f4f',
darkturquoise: '#00ced1',
darkviolet: '#9400d3',
deeppink: '#ff1493',
deepskyblue: '#00bfff',
dimgray: '#696969',
dimgrey: '#696969',
dodgerblue: '#1e90ff',
firebrick: '#b22222',
floralwhite: '#fffaf0',
forestgreen: '#228b22',
fuchsia: '#ff00ff',
gainsboro: '#dcdcdc',
ghostwhite: '#f8f8ff',
gold: '#ffd700',
goldenrod: '#daa520',
gray: '#808080',
green: '#008000',
greenyellow: '#adff2f',
grey: '#808080',
honeydew: '#f0fff0',
hotpink: '#ff69b4',
indianred: '#cd5c5c',
indigo: '#4b0082',
ivory: '#fffff0',
khaki: '#f0e68c',
lavender: '#e6e6fa',
lavenderblush: '#fff0f5',
lawngreen: '#7cfc00',
lemonchiffon: '#fffacd',
lightblue: '#add8e6',
lightcoral: '#f08080',
lightcyan: '#e0ffff',
lightgoldenrodyellow: '#fafad2',
lightgray: '#d3d3d3',
lightgreen: '#90ee90',
lightgrey: '#d3d3d3',
lightpink: '#ffb6c1',
lightsalmon: '#ffa07a',
lightseagreen: '#20b2aa',
lightskyblue: '#87cefa',
lightslategray: '#778899',
lightslategrey: '#778899',
lightsteelblue: '#b0c4de',
lightyellow: '#ffffe0',
lime: '#00ff00',
limegreen: '#32cd32',
linen: '#faf0e6',
magenta: '#ff00ff',
maroon: '#800000',
mediumaquamarine: '#66cdaa',
mediumblue: '#0000cd',
mediumorchid: '#ba55d3',
mediumpurple: '#9370d8',
mediumseagreen: '#3cb371',
mediumslateblue: '#7b68ee',
mediumspringgreen: '#00fa9a',
mediumturquoise: '#48d1cc',
mediumvioletred: '#c71585',
midnightblue: '#191970',
mintcream: '#f5fffa',
mistyrose: '#ffe4e1',
moccasin: '#ffe4b5',
navajowhite: '#ffdead',
navy: '#000080',
oldlace: '#fdf5e6',
olive: '#808000',
olivedrab: '#6b8e23',
orange: '#ffa500',
orangered: '#ff4500',
orchid: '#da70d6',
palegoldenrod: '#eee8aa',
palegreen: '#98fb98',
paleturquoise: '#afeeee',
palevioletred: '#d87093',
papayawhip: '#ffefd5',
peachpuff: '#ffdab9',
peru: '#cd853f',
pink: '#ffc0cb',
plum: '#dda0dd',
powderblue: '#b0e0e6',
purple: '#800080',
red: '#ff0000',
rosybrown: '#bc8f8f',
royalblue: '#4169e1',
saddlebrown: '#8b4513',
salmon: '#fa8072',
sandybrown: '#f4a460',
seagreen: '#2e8b57',
seashell: '#fff5ee',
sienna: '#a0522d',
silver: '#c0c0c0',
skyblue: '#87ceeb',
slateblue: '#6a5acd',
slategray: '#708090',
slategrey: '#708090',
snow: '#fffafa',
springgreen: '#00ff7f',
steelblue: '#4682b4',
tan: '#d2b48c',
teal: '#008080',
thistle: '#d8bfd8',
tomato: '#ff6347',
turquoise: '#40e0d0',
violet: '#ee82ee',
wheat: '#f5deb3',
white: '#ffffff',
whitesmoke: '#f5f5f5',
yellow: '#ffff00',
yellowgreen: '#9acd32'
};
function getWebColorValue(colorName) {
debug.assertValue(colorName, 'getWebColorValue - colorName');
return cssColorMap[colorName.toLocaleLowerCase()];
}
Color.getWebColorValue = getWebColorValue;
})(Color = jsCommon.Color || (jsCommon.Color = {}));
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var performance;
(function (performance) {
function determineNowFunc() {
// Prefer to use high resolution timer, fallback to Date.now()
if (typeof window.performance !== 'undefined' && window.performance.now && window.performance.timeOrigin) {
return function () {
return window.performance.now() + window.performance.timeOrigin;
};
}
else {
return Date.now;
}
}
performance.now = determineNowFunc();
})(performance = jsCommon.performance || (jsCommon.performance = {}));
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
// Angular 2+ zone overrides the window setTimeout, setInterval etc and runs those in the zone/digest circles which causes perf issues in numerous non-angular components
// So we have a special "non-angular" zone allowing to run async code outside of the angular digests
//
// Non-angular components should call the jsCommon.Zone.setTimeout/setInterval/requestAnimationFrame/runOutsideAngular to optimize the perf and avoid long digests.
var NoAngularZone = /** @class */ (function () {
function NoAngularZone() {
}
NoAngularZone.prototype.initialize = function (ngZone) {
this.runOutsideAngular = function (func) { return ngZone.runOutsideAngular(func); };
};
NoAngularZone.prototype.setInterval = function (action, delay) {
return this.runOutsideAngular((function () { return setInterval(action, delay); }));
};
NoAngularZone.prototype.setTimeout = function (action, delay) {
return this.runOutsideAngular((function () { return setTimeout(action, delay); }));
};
NoAngularZone.prototype.requestAnimationFrame = function (action) {
this.runOutsideAngular((function () { return requestAnimationFrame(action); }));
};
NoAngularZone.prototype.runOutsideAngular = function (func) {
return func(); // If the angular app is not initialized then just run the func
};
return NoAngularZone;
}());
jsCommon.NoAngularZone = NoAngularZone;
jsCommon.Zone = new NoAngularZone();
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon_1) {
var commonGlobals = window;
var staticContentLocation = window.location.protocol + '//' + window.location.host;
/**
* A faster version of JQuery.data which does a lot of unnecessary work.
* Note that it takes the DOM node, not a JQuery.
*
* If value is undefined, fetches the current value. Otherwise it is the value
* to set (which is also returned).
*/
var DataPropertyName = "__DataProperty__5941464455110614";
function data(element, key, value) {
debug.assertValue(element, 'element');
if (element == null) {
return;
}
var dict = element[DataPropertyName];
if (!dict) {
if (value === undefined)
return;
dict = element[DataPropertyName] = {};
}
if (value === undefined)
return dict[key];
return dict[key] = value;
}
jsCommon_1.data = data;
/**
* Other HTTP Constants.
*/
var HttpConstants;
(function (HttpConstants) {
HttpConstants.ApplicationOctetStream = 'application/octet-stream';
HttpConstants.JsonContentType = 'application/json';
HttpConstants.JpegContentType = 'image/jpeg';
HttpConstants.Blob = 'blob';
HttpConstants.ArrayBuffer = 'arraybuffer';
HttpConstants.Accept = 'Accept';
})(HttpConstants = jsCommon_1.HttpConstants || (jsCommon_1.HttpConstants = {}));
/**
* Extensions to String class.
*/
var StringExtensions;
(function (StringExtensions) {
var HtmlTagRegex = new RegExp('[<>]', 'g');
function format() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var s = args[0];
if (isNullOrUndefinedOrWhiteSpaceString(s))
return s;
for (var i = 0; i < args.length - 1; i++) {
var reg = new RegExp("\\{" + i + "\\}", "gm");
s = s.replace(reg, args[i + 1]);
}
return s;
}
StringExtensions.format = format;
/**
* Compares two strings for equality, ignoring case.
*/
function equalIgnoreCase(a, b) {
return StringExtensions.normalizeCase(a) === StringExtensions.normalizeCase(b);
}
StringExtensions.equalIgnoreCase = equalIgnoreCase;
function startsWithIgnoreCase(a, b) {
var normalizedSearchString = StringExtensions.normalizeCase(b);
return StringExtensions.normalizeCase(a).indexOf(normalizedSearchString) === 0;
}
StringExtensions.startsWithIgnoreCase = startsWithIgnoreCase;
/** Determines whether a string contains a specified substring (by case-sensitive comparison). */
function contains(source, substring) {
if (source == null)
return false;
return source.indexOf(substring) !== -1;
}
StringExtensions.contains = contains;
/** Determines whether a string contains a specified substring (while ignoring case). */
function containsIgnoreCase(source, substring) {
if (source == null)
return false;
return contains(normalizeCase(source), normalizeCase(substring));
}
StringExtensions.containsIgnoreCase = containsIgnoreCase;
/**
* Normalizes case for a string.
* Used by equalIgnoreCase method.
*/
function normalizeCase(value) {
Utility.throwIfNullOrUndefined(value, Utility, 'normalizeCase', 'value');
return value.toUpperCase();
}
StringExtensions.normalizeCase = normalizeCase;
/**
* Returns true if the string is null, undefined, empty, or only includes white spaces.
* @return True if the str is null, undefined, empty, or only includes white spaces,
* otherwise false.
*/
function isNullOrUndefinedOrWhiteSpaceString(str) {
return _.isEmpty(str) || _.isEmpty(str.trim());
}
StringExtensions.isNullOrUndefinedOrWhiteSpaceString = isNullOrUndefinedOrWhiteSpaceString;
/**
* Returns a value indicating whether the str contains any whitespace.
*/
function containsWhitespace(str) {
Utility.throwIfNullOrUndefined(str, Utility, 'containsWhitespace', 'str');
var expr = /\s/;
return expr.test(str);
}
StringExtensions.containsWhitespace = containsWhitespace;
/**
* Returns a value indicating whether the str is a whitespace string.
*/
function isWhitespace(str) {
return _.trim(str) === '';
}
StringExtensions.isWhitespace = isWhitespace;
/**
* Returns the string with any trailing whitespace from str removed.
*/
function trimTrailingWhitespace(str) {
Utility.throwIfNullOrUndefined(str, Utility, 'trimTrailingWhitespace', 'str');
return str.replace(/\s+$/, '');
}
StringExtensions.trimTrailingWhitespace = trimTrailingWhitespace;
/**
* Returns the string with any leading and trailing whitespace from str removed.
*/
function trimWhitespace(str) {
Utility.throwIfNullOrUndefined(str, Utility, 'trimWhitespace', 'str');
return str.replace(/^\s+/, '').replace(/\s+$/, '');
}
StringExtensions.trimWhitespace = trimWhitespace;
/**
* @param str
* @returns str with no whitespace
*/
function removeAllWhitespace(str) {
return str.replace(/\s/g, '');
}
StringExtensions.removeAllWhitespace = removeAllWhitespace;
/**
* Replace all the occurrences of the textToFind in the text with the textToReplace.
* @param text The original string.
* @param textToFind Text to find in the original string.
* @param textToReplace New text replacing the textToFind.
*/
function replaceAll(text, textToFind, textToReplace) {
if (!textToFind)
return text;
var pattern = escapeStringForRegex(textToFind);
return text.replace(new RegExp(pattern, 'gi'), textToReplace);
}
StringExtensions.replaceAll = replaceAll;
function ensureUniqueNames(names) {
debug.assertValue(names, 'names');
var usedNames = {};
// Make sure we are giving fair chance for all columns to stay with their original name
// First we fill the used names map to contain all the original unique names from the list.
for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
var name_1 = names_1[_i];
usedNames[name_1] = false;
}
var uniqueNames = [];
// Now we go over all names and find a unique name for each
for (var _a = 0, names_2 = names; _a < names_2.length; _a++) {
var name_2 = names_2[_a];
var uniqueName = name_2;
// If the (original) column name is already taken lets try to find another name
if (usedNames[uniqueName]) {
var counter = 0;
// Find a name that is not already in the map
while (usedNames[uniqueName] !== undefined) {
uniqueName = name_2 + "." + (++counter);
}
}
uniqueNames.push(uniqueName);
usedNames[uniqueName] = true;
}
return uniqueNames;
}
StringExtensions.ensureUniqueNames = ensureUniqueNames;
/**
* Returns a name that is not specified in the values.
*/
function findUniqueName(usedNames, baseName, startSuffix) {
debug.assertValue(usedNames, 'usedNames');
debug.assertValue(baseName, 'baseName');
debug.assert(startSuffix == null || startSuffix >= 0, 'startSuffix == null || startSuffix >= 0');
var i = startSuffix || 0, uniqueName = baseName;
if (startSuffix)
uniqueName += startSuffix;
// Find a unique name
while (usedNames[uniqueName]) {
uniqueName = baseName + (++i);
}
return uniqueName;
}
StringExtensions.findUniqueName = findUniqueName;
function constructNameFromList(list, separator, maxCharacter) {
var labels = [];
var exceeded = false;
var length = 0;
for (var _i = 0, list_2 = list; _i < list_2.length; _i++) {
var item = list_2[_i];
if (length + item.length > maxCharacter && labels.length > 0) {
exceeded = true;
break;
}
labels.push(item);
length += item.length;
}
var separatorWithSpace = ' ' + separator + ' ';
var name = labels.join(separatorWithSpace);
if (exceeded)
name += separatorWithSpace + "...";
return name;
}
StringExtensions.constructNameFromList = constructNameFromList;
function constructCommaSeparatedList(list, resourceProvider, maxValue) {
if (!list || list.length === 0)
return '';
if (maxValue === null || maxValue === undefined)
maxValue = Number.MAX_VALUE;
var length = Math.min(maxValue, list.length);
var replacedList = [];
// Only need to replace user entries of {0} and {1} since we build the list in pairs.
for (var j = 0; j < 2; j++) {
var targetValue = '{' + j + '}';
var replaceValue = '_|_<' + j + '>_|_';
for (var i = 0; i < length; i++) {
if (list[i].indexOf(targetValue) > -1) {
list[i] = list[i].replace(targetValue, replaceValue);
replacedList.push({ targetValue: targetValue, replaceValue: replaceValue });
}
}
}
var commaSeparatedList = '';
for (var i = 0; i < length; i++) {
if (i === 0)
commaSeparatedList = list[i];
else
commaSeparatedList = StringExtensions.format(resourceProvider.get('PowerBI_TwoStrings_SeperateWithCommaAndVisualSpace'), commaSeparatedList, list[i]);
}
for (var _i = 0, replacedList_1 = replacedList; _i < replacedList_1.length; _i++) {
var replacedItem = replacedList_1[_i];
commaSeparatedList = commaSeparatedList.replace(replacedItem.replaceValue, replacedItem.targetValue);
}
return commaSeparatedList;
}
StringExtensions.constructCommaSeparatedList = constructCommaSeparatedList;
function escapeStringForRegex(s) {
return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1');
}
StringExtensions.escapeStringForRegex = escapeStringForRegex;
/**
* Remove file name reserved characters <>:"/\|?* from input string.
*/
function normalizeFileName(fileName) {
debug.assertValue(fileName, 'fileName');
return fileName.replace(/[\<\>\:"\/\\\|\?*]/g, '');
}
StringExtensions.normalizeFileName = normalizeFileName;
/**
* Similar to JSON.stringify, but strips away escape sequences so that the resulting
* string is human-readable (and parsable by JSON formatting/validating tools).
*/
function stringifyAsPrettyJSON(object) {
//let specialCharacterRemover = (key: string, value: string) => value.replace(/[^\w\s]/gi, '');
return JSON.stringify(object /*, specialCharacterRemover*/);
}
StringExtensions.stringifyAsPrettyJSON = stringifyAsPrettyJSON;
/**
* Derive a CLS-compliant name from a specified string. If no allowed characters are present, return a fallback string instead.
* TODO (6708134): this should have a fully Unicode-aware implementation
*/
function deriveClsCompliantName(input, fallback) {
debug.assertValue(input, 'input');
var result = input.replace(/^[^A-Za-z]*/g, '').replace(/[ :\.\/\\\-\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]/g, '_').replace(/[\W]/g, '');
return result.length > 0 ? result : fallback;
}
StringExtensions.deriveClsCompliantName = deriveClsCompliantName;
/** Performs cheap sanitization by stripping away HTML tag (<>) characters. */
function stripTagDelimiters(s) {
return s.replace(HtmlTagRegex, '');
}
StringExtensions.stripTagDelimiters = stripTagDelimiters;
/**
* Converts string into the HTML encoded string. This is the same as the .NET HttpUtility.HtmlEncode() method.
* Encodes certain characters (for example '<','>','"') into html entities (&lt;&gt;&quot;) so the returned string is safe to be used inside of the div/spans tags or inside quoted attributes except inside url/event handlers.
* @param value - value to be html encoded
* @param encodeSpaces - should the spaces be encoded as nonbreakable spaces (&nbsp;) - this is usefull when spaces should be preserved & shown in the html as in the original text
*/
function encodeHtml(value, encodeSpaces) {
if (encodeSpaces === void 0) { encodeSpaces = false; }
if (!value) {
return value;
}
var result = value
.replace(/&/g, "&amp;") // &
.replace(/</g, "&lt;") // <
.replace(/>/g, "&gt;") // >
.replace(/\"/g, "&quot;") // "
.replace(/\'/g, "&#39;") // '
.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, (function (match) {
var hi = match.charCodeAt(0);
var low = match.charCodeAt(1);
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
}))
.replace(/([^!-~ ])/g, (function (match) {
return '&#' + match.charCodeAt(0) + ';';
}));
if (encodeSpaces) {
result = result.replace(/\ /g, "&nbsp;"); // space
}
return result;
}
StringExtensions.encodeHtml = encodeHtml;
/**
* check for a string if it has dangling left parenthesis: ()), () returns false and (, ))(( or (() returns true
* @param string string to check.
* @returns booean value for if there's dangling left parenthesis.
*/
function hasDanglingLeftParenthesis(string) {
var squareCounter = 0, roundCounter = 0;
for (var _i = 0, string_1 = string; _i < string_1.length; _i++) {
var char = string_1[_i];
switch (char) {
case "[":
squareCounter++;
break;
case "(":
roundCounter++;
break;
case "]":
if (squareCounter > 0)
squareCounter--;
break;
case ")":
if (roundCounter > 0)
roundCounter--;
break;
}
}
return squareCounter > 0 || roundCounter > 0;
}
StringExtensions.hasDanglingLeftParenthesis = hasDanglingLeftParenthesis;
/**
* Check if a char is a single code point char
* As an example, most emojis use two code points
* @param charCode char code to check
* @returns true if the char code falls within single code point char ranges
*/
function isSingleCodePointChar(charCode) {
return (charCode >= 0x0000 && charCode <= 0xD7FF) || (charCode >= 0xE000 && charCode <= 0xFFFF);
}
StringExtensions.isSingleCodePointChar = isSingleCodePointChar;
})(StringExtensions = jsCommon_1.StringExtensions || (jsCommon_1.StringExtensions = {}));
var Utility = /** @class */ (function () {
function Utility() {
}
/**
* When rethrowing an error, if it does not have a stack convert to Error make sure it is an Error so a stack has been captured
*/
Utility.ensureError = function (error) {
if (!(error instanceof Error)) {
error = new Error(!error ? "<null-or-undefined> error was thrown" : (error.message || error.toString()));
}
return error;
};
/**
* Ensures the specified value is not null or undefined. Throws a relevent exception if it is.
* @param value The value to check.
* @param context The context from which the check originated.
* @param methodName The name of the method that initiated the check.
* @param parameterName The parameter name of the value to check.
*/
Utility.throwIfNullOrUndefined = function (value, context, methodName, parameterName) {
if (value === null) {
this.throwException(jsCommon_1.Errors.argumentNull(this.getComponentName(context) + methodName + '.' + parameterName));
}
else if (value === undefined) {
this.throwException(jsCommon_1.Errors.argumentUndefined(this.getComponentName(context) + methodName + '.' + parameterName));
}
};
/**
* Ensures the specified string is not null, undefined or empty. Throws a relevent exception if it is.
* @param value The value to check.
* @param context The context from which the check originated.
* @param methodName The name of the method that initiated the check.
* @param parameterName The parameter name of the value to check.
*/
Utility.throwIfNullOrEmptyString = function (value, context, methodName, parameterName) {
this.throwIfNullOrUndefined(value, context, methodName, parameterName);
if (value.length < 1) {
this.throwException(jsCommon_1.Errors.argumentOutOfRange(this.getComponentName(context) + methodName + '.' + parameterName));
}
};
/**
* Checks if the value is defined and returns it, else, returns undefined
* @param {T} value Value to check
* @param {T} defaultValue Default value to return if value is undefined
* @returns value if defined, else defaultValue
*/
Utility.valueOrDefault = function (value, defaultValue) {
if (value != null)
return value;
return defaultValue;
};
/**
* Combine a base url and a path.
* @param baseUrl The base url.
* @param path The path to add on to the base url.
* @returns The combined url.
*/
Utility.urlCombine = function (baseUrl, path) {
this.throwIfNullOrUndefined(baseUrl, Utility, "urlCombine", "baseUrl");
this.throwIfNullOrUndefined(path, Utility, "urlCombine", "path");
// should any of the components be empty, fail gracefuly - this is important when using the test page
if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(path)) {
return baseUrl;
}
if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(baseUrl)) {
return path;
}
var finalUrl = baseUrl;
if (finalUrl.charAt(finalUrl.length - 1) === '/') {
if (path.charAt(0) === '/')
path = path.slice(1);
}
else {
if (path.charAt(0) !== '/')
path = '/' + path;
}
return finalUrl + path;
};
Utility.getAbsoluteUri = function (path) {
this.throwIfNullOrUndefined(path, Utility, "getAbsoluteUri", "path");
var url = path;
// Make absolute
if (url && url.indexOf('http') === -1) {
url = this.urlCombine(commonGlobals.clusterUri, url);
}
return url;
};
Utility.getStaticResourceUri = function (path) {
this.throwIfNullOrUndefined(path, Utility, "getStaticResourceUri", "path");
var url = path;
// Make absolute
if (url && url.indexOf('http') === -1) {
url = this.urlCombine(staticContentLocation, url);
}
return url;
};
// TODO Fix Explicit Any
Utility.getComponentName = function (context) {
return !context ? '' : (typeof context).toString() + '.';
};
Utility.throwException = function (e) {
jsCommon_1.Trace.error("Throwing exception: " + JSON.stringify(e),
/*includeStackTrace*/ e.stack != null ? false : true);
throw this.ensureError(e);
};
Utility.createClassSelector = function (className) {
this.throwIfNullOrEmptyString(className, null, 'CreateClassSelector', 'className');
return '.' + className;
};
Utility.createIdSelector = function (id) {
this.throwIfNullOrEmptyString(id, null, 'CreateIdSelector', 'id');
return '#' + id;
};
/**
* Take numeric value, min and max and normalize it to be greater than
* or equal to the min number and less than or equal to the max number.
* @param value The value to be normalized
* @param min min value allowed
* @param max max value allowed
*/
Utility.clampValue = function (value, min, max) {
debug.assert(min <= max, "min value must be less than or equal the max value");
value = Math.min(value, max);
value = Math.max(value, min);
return value;
};
/**
* Creates a client-side Guid string.
* @returns A string representation of a Guid.
*/
Utility.generateGuid = function () {
var guid = "", idx = 0;
for (idx = 0; idx < 32; idx += 1) {
var guidDigitsItem = Math.random() * 16 | 0;
switch (idx) {
case 8:
case 12:
case 16:
case 20:
guid += "-";
break;
}
guid += guidDigitsItem.toString(16);
}
return guid;
};
/**
* Try extract a cookie from {@link document.cookie} identified by key.
*/
Utility.getCookieValue = function (key) {
// the cookie is of the format <key1=value1>; <key2=value2>. Split by ';', then by '='
// to search for the key
var keyValuePairs = document.cookie.split(';');
for (var _i = 0, keyValuePairs_1 = keyValuePairs; _i < keyValuePairs_1.length; _i++) {
var keyValue = keyValuePairs_1[_i];
var split = keyValue.split('=');
if (split.length > 0 && split[0].trim() === key) {
return keyValue.substr(keyValue.indexOf('=') + 1);
}
}
return null;
};
/**
* Extracts the protocol://hostname section of a url.
* @param url The URL from which to extract the section.
* @returns The protocol://hostname portion of the given URL.
*/
Utility.getDomainForUrl = function (url) {
var hrefObject = this.getHrefObjectFromUrl(url);
return hrefObject.prop('protocol') + '//' + hrefObject.prop('hostname');
};
/**
* Extracts the hostname and absolute path sections of a url.
* @param url The URL from which to extract the section.
* @returns The hostname and absolute path portion of the given URL.
*/
Utility.getHostNameForUrl = function (url) {
var hrefObject = this.getHrefObjectFromUrl(url);
return this.urlCombine(hrefObject.prop('hostname'), hrefObject.prop('pathname'));
};
/**
* Return the original url with query string stripped.
* @param url The URL from which to extract the section.
* @returns the original url with query string stripped.
*/
Utility.getUrlWithoutQueryString = function (url) {
var hrefObject = this.getHrefObjectFromUrl(url);
return hrefObject.prop('protocol') + '//' + this.urlCombine(hrefObject.prop('host'), hrefObject.prop('pathname'));
};
/**
* Extracts the protocol section of a url.
* @param url The URL from which to extract the section.
* @returns The protocol for the current URL.
*/
Utility.getProtocolFromUrl = function (url) {
return this.getHrefObjectFromUrl(url).prop('protocol').replace(':', '');
};
/**
* Returns a formatted href object from a URL.
* @param url The URL used to generate the object.
* @returns A jQuery object with the url.
*/
Utility.getHrefObjectFromUrl = function (url) {
var aObject = $('<a>');
aObject = aObject.prop('href', url);
return aObject;
};
Utility.getDateFromWcfJsonString = function (jsonDate, fromUtcMilliseconds) {
if (_.isEmpty(jsonDate)) {
return null;
}
var begIndex = jsonDate.indexOf('(');
var endIndex = jsonDate.indexOf(')');
if (begIndex !== -1 && endIndex !== -1) {
var milliseconds = parseInt(jsonDate.substring(begIndex + 1, endIndex), 10);
if (isNaN(milliseconds))
milliseconds = 0; // fallback
if (fromUtcMilliseconds) {
return new Date(milliseconds);
}
else {
var retValue = new Date(0);
retValue.setUTCMilliseconds(milliseconds);
return retValue;
}
}
return null;
};
/**
* Verifies image data url of images.
*/
Utility.isValidImageDataUrl = function (url) {
return this.ImageDataRegex.test(url);
};
Utility.encodeUriForImageDataSvg = function (url) {
if (this.ImageDataSvgRegex.test(url)) {
var splitter = url.indexOf(',');
if (splitter > -1) {
// remove any charset or base64 parameters
var params = url.substring(0, splitter).split(';');
var svg = url.substring(splitter + 1);
try {
svg = decodeURIComponent(svg);
}
catch (e) { } // decoding can fail if the svg uses the percent sign (%)
return params[0] + "," + encodeURIComponent(svg);
}
}
return url;
};
Utility.isLocalUrl = function (url) {
return _.startsWith(url, "data:") || _.startsWith(url, "blob:");
};
/**
* Extract the filename out of a full path delimited by '\' or '/'.
* @param filePath File path.
* @returns filename File name.
*/
Utility.extractFileNameFromPath = function (filePath) {
return filePath.replace(/^.*[\\\/]/, '');
};
Utility.is64BitOperatingSystem = function () {
return navigator.userAgent.indexOf("WOW64") !== -1 ||
navigator.userAgent.indexOf("Win64") !== -1;
};
Utility.isWindows10 = function () {
return navigator.userAgent.indexOf("Windows NT 10.0") !== -1;
};
Utility.parseNumber = function (value, defaultValue) {
if (value === null)
return null;
if (value === undefined)
return defaultValue;
var result = Number(value);
if (isFinite(result))
return result;
if (isNaN(result) && !(typeof value === "number" || value === "NaN"))
return defaultValue;
return result;
};
Utility.getURLParamValue = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) {
return null;
}
else {
return results[1] || 0;
}
};
/**
* Return local timezone.
* This function uses summer and winter offset to determine local time zone.
* The result localTimeZoneString must be a subset of the strings used by server,
* as documented here: https://msdn.microsoft.com/en-us/library/gg154758.aspx (Dynamic Daylight Savings Time (Compact 2013)).
* @return Local timezone string or UTC if timezone cannot be found.
*/
Utility.getLocalTimeZoneString = function () {
var timeSummer = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0));
var summerOffset = -1 * timeSummer.getTimezoneOffset();
var timeWinter = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0));
var winterOffset = -1 * timeWinter.getTimezoneOffset();
var localTimeZoneString;
if (-720 === summerOffset && -720 === winterOffset) {
localTimeZoneString = 'Dateline Standard Time';
}
else if (-660 === summerOffset && -660 === winterOffset) {
localTimeZoneString = 'UTC-11';
}
else if (-660 === summerOffset && -660 === winterOffset) {
localTimeZoneString = 'Samoa Standard Time';
}
else if (-600 === summerOffset && -600 === winterOffset) {
localTimeZoneString = 'Hawaiian Standard Time';
}
else if (-480 === summerOffset && -540 === winterOffset) {
localTimeZoneString = 'Alaskan Standard Time';
}
else if (-420 === summerOffset && -480 === winterOffset) {
localTimeZoneString = 'Pacific Standard Time';
}
else if (-420 === summerOffset && -420 === winterOffset) {
localTimeZoneString = 'US Mountain Standard Time';
}
else if (-360 === summerOffset && -420 === winterOffset) {
localTimeZoneString = 'Mountain Standard Time';
}
else if (-360 === summerOffset && -360 === winterOffset) {
localTimeZoneString = 'Central America Standard Time';
}
else if (-300 === summerOffset && -360 === winterOffset) {
localTimeZoneString = 'Central Standard Time';
}
else if (-300 === summerOffset && -300 === winterOffset) {
localTimeZoneString = 'SA Pacific Standard Time';
}
else if (-240 === summerOffset && -300 === winterOffset) {
localTimeZoneString = 'Eastern Standard Time';
}
else if (-270 === summerOffset && -270 === winterOffset) {
localTimeZoneString = 'Venezuela Standard Time';
}
else if (-240 === summerOffset && -240 === winterOffset) {
localTimeZoneString = 'SA Western Standard Time';
}
else if (-240 === summerOffset && -180 === winterOffset) {
localTimeZoneString = 'Central Brazilian Standard Time';
}
else if (-180 === summerOffset && -240 === winterOffset) {
localTimeZoneString = 'Atlantic Standard Time';
}
else if (-180 === summerOffset && -180 === winterOffset) {
localTimeZoneString = 'Montevideo Standard Time';
}
else if (-180 === summerOffset && -120 === winterOffset) {
localTimeZoneString = 'E. South America Standard Time';
}
else if (-150 === summerOffset && -210 === winterOffset) {
localTimeZoneString = 'Mid-Atlantic Standard Time';
}
else if (-120 === summerOffset && -120 === winterOffset) {
localTimeZoneString = 'SA Eastern Standard Time';
}
else if (0 === summerOffset && 0 === winterOffset) {
localTimeZoneString = 'UTC';
}
else if (60 === summerOffset && 0 === winterOffset) {
localTimeZoneString = 'GMT Standard Time';
}
else if (60 === summerOffset && 120 === winterOffset) {
localTimeZoneString = 'Namibia Standard Time';
}
else if (120 === summerOffset && 60 === winterOffset) {
localTimeZoneString = 'Romance Standard Time';
}
else if (120 === summerOffset && 120 === winterOffset) {
localTimeZoneString = 'South Africa Standard Time';
}
else if (180 === summerOffset && 120 === winterOffset) {
localTimeZoneString = 'GTB Standard Time';
}
else if (180 === summerOffset && 180 === winterOffset) {
localTimeZoneString = 'E. Africa Standard Time';
}
else if (240 === summerOffset && 180 === winterOffset) {
localTimeZoneString = 'Russian Standard Time';
}
else if (240 === summerOffset && 240 === winterOffset) {
localTimeZoneString = 'Arabian Standard Time';
}
else if (270 === summerOffset && 210 === winterOffset) {
localTimeZoneString = 'Iran Standard Time';
}
else if (270 === summerOffset && 270 === winterOffset) {
localTimeZoneString = 'Afghanistan Standard Time';
}
else if (300 === summerOffset && 240 === winterOffset) {
localTimeZoneString = 'Pakistan Standard Time';
}
else if (300 === summerOffset && 300 === winterOffset) {
localTimeZoneString = 'West Asia Standard Time';
}
else if (330 === summerOffset && 330 === winterOffset) {
localTimeZoneString = 'India Standard Time';
}
else if (345 === summerOffset && 345 === winterOffset) {
localTimeZoneString = 'Nepal Standard Time';
}
else if (360 === summerOffset && 300 === winterOffset) {
localTimeZoneString = 'N. Central Asia Standard Time';
}
else if (360 === summerOffset && 360 === winterOffset) {
localTimeZoneString = 'Central Asia Standard Time';
}
else if (390 === summerOffset && 390 === winterOffset) {
localTimeZoneString = 'Myanmar Standard Time';
}
else if (420 === summerOffset && 360 === winterOffset) {
localTimeZoneString = 'North Asia Standard Time';
}
else if (420 === summerOffset && 420 === winterOffset) {
localTimeZoneString = 'SE Asia Standard Time';
}
else if (480 === summerOffset && 420 === winterOffset) {
localTimeZoneString = 'North Asia East Standard Time';
}
else if (480 === summerOffset && 480 === winterOffset) {
localTimeZoneString = 'China Standard Time';
}
else if (540 === summerOffset && 480 === winterOffset) {
localTimeZoneString = 'Yakutsk Standard Time';
}
else if (540 === summerOffset && 540 === winterOffset) {
localTimeZoneString = 'Tokyo Standard Time';
}
else if (570 === summerOffset && 570 === winterOffset) {
localTimeZoneString = 'Cen. Australia Standard Time';
}
else if (600 === summerOffset && 600 === winterOffset) {
localTimeZoneString = 'E. Australia Standard Time';
}
else if (600 === summerOffset && 660 === winterOffset) {
localTimeZoneString = 'AUS Eastern Standard Time';
}
else if (660 === summerOffset && 600 === winterOffset) {
localTimeZoneString = 'Tasmania Standard Time';
}
else if (660 === summerOffset && 660 === winterOffset) {
localTimeZoneString = 'West Pacific Standard Time';
}
else if (690 === summerOffset && 690 === winterOffset) {
localTimeZoneString = 'Central Pacific Standard Time';
}
else if (720 === summerOffset && 660 === winterOffset) {
localTimeZoneString = 'Magadan Standard Time';
}
else if (720 === summerOffset && 720 === winterOffset) {
localTimeZoneString = 'Fiji Standard Time';
}
else if (720 === summerOffset && 780 === winterOffset) {
localTimeZoneString = 'New Zealand Standard Time';
}
else if (780 === summerOffset && 780 === winterOffset) {
localTimeZoneString = 'Tonga Standard Time';
}
else {
localTimeZoneString = 'UTC';
}
return localTimeZoneString;
};
Utility.ImageDataRegex = new RegExp('data:(image\/(png|jpg|jpeg|gif|svg))');
Utility.ImageDataSvgRegex = new RegExp('data:(image\/svg)');
return Utility;
}());
jsCommon_1.Utility = Utility;
var VersionUtility = /** @class */ (function () {
function VersionUtility() {
}
/**
* Compares 2 version strings.
* @param versionA The first version string.
* @param versionB The second version string.
* @returns A result for the comparison.
*/
VersionUtility.compareVersions = function (versionA, versionB) {
var a = versionA.split('.').map(parseFloat);
var b = versionB.split('.').map(parseFloat);
var versionParts = Math.max(a.length, b.length);
for (var i = 0; i < versionParts; i++) {
var partA = a[i] || 0;
var partB = b[i] || 0;
if (partA > partB)
return 1;
if (partA < partB)
return -1;
}
return 0;
};
return VersionUtility;
}());
jsCommon_1.VersionUtility = VersionUtility;
var PerfTimer;
(function (PerfTimer) {
/** We use this to give unique names to different operations that run concurrently with the same name */
var OperationCounter = 0;
/** Begins a perf marker that can be completed by invoking the returned function. */
function start(name) {
var performance = window.performance;
if (!performance || !performance.mark)
return function () { return 0; };
name = ++OperationCounter + " " + name;
var startMark = 'Begin ' + name;
performance.mark(startMark);
var startTime = jsCommon.performance.now();
return function () {
var end = 'End ' + name;
performance.mark(end);
// NOTE: Chromium supports performance.mark but not performance.measure.
if (performance.measure)
performance.measure(name, startMark, end);
return jsCommon.performance.now() - startTime;
};
}
PerfTimer.start = start;
function mark(name) {
var performance = window.performance;
if (!performance || !performance.mark)
return;
name = ++OperationCounter + " " + name;
performance.mark(name);
}
PerfTimer.mark = mark;
/** Returns the duration to execute the action in ms */
function logTime(action) {
// Desktop's old Chromium doesn't support use of Performance Markers yet
var start = jsCommon.performance.now();
action();
return jsCommon.performance.now() - start;
}
PerfTimer.logTime = logTime;
})(PerfTimer = jsCommon_1.PerfTimer || (jsCommon_1.PerfTimer = {}));
var DeferUtility;
(function (DeferUtility) {
/**
* Wraps a callback and returns a new function.
* The function can be called many times but the callback
* will only be executed once on the next frame.
* Use this to throttle big UI updates and access to DOM.
*/
function deferUntilNextFrame(callback) {
// TODO Fix Explicit Any
var isWaiting, args, context;
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = function (func) { return setTimeout(func, 1000 / 50); };
}
return function () {
if (!isWaiting) {
isWaiting = true;
args = arguments;
context = this;
jsCommon.Zone.requestAnimationFrame((function () {
isWaiting = false;
callback.apply(context, args);
}));
}
};
}
DeferUtility.deferUntilNextFrame = deferUntilNextFrame;
})(DeferUtility = jsCommon_1.DeferUtility || (jsCommon_1.DeferUtility = {}));
var NumberExtensions;
(function (NumberExtensions) {
/** Determines whether the input number is a decimal number (e.g 0.5, 1.5). Null or undefined input will return false*/
function isDecimal(value) {
return !(value == null) && value % 1 !== 0;
}
NumberExtensions.isDecimal = isDecimal;
})(NumberExtensions = jsCommon_1.NumberExtensions || (jsCommon_1.NumberExtensions = {}));
function ensureJsCommonStringExtensions() {
var jsCommon = powerbi.ensureJsCommon();
if (!jsCommon.StringExtensions)
jsCommon.StringExtensions = {};
return jsCommon.StringExtensions;
}
jsCommon_1.ensureJsCommonStringExtensions = ensureJsCommonStringExtensions;
function exportStringExtensionsFormatToGlobal() {
if (exported)
return;
var orgFormat = jsCommon.StringExtensions.format;
ensureJsCommonStringExtensions().format = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return orgFormat.apply(void 0, args);
};
exported = true;
}
jsCommon_1.exportStringExtensionsFormatToGlobal = exportStringExtensionsFormatToGlobal;
var exported = false;
exportStringExtensionsFormatToGlobal();
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var promiseWindow = window;
var powerbi;
(function (powerbi) {
var _a;
/**
* @deprecated powerbi.Promise has been deprecated, if possible please use a native promise instead.
*
* A Promise class that enables using TypeScript's async/await functionality. TS's ES5 emulation
* relies on a class such as this being the return value of an async function.
*
* NOTE: Exceptions thrown during continuations result in the promise chain being rejected with the exception.
*
* Example:
* async function asyncStuff(abc): Promise<number> {
* try {
* let xyz = await callServer(abc);
* // do work based on xyz response...
* }
* catch (reason) {
* // handle errors from callServer
* }
* }
*/
var Promise = /** @class */ (function () {
function Promise(init) {
var _this = this;
this[_a] = 'Promise';
if (promiseWindow.globalUseNativePromise === "true")
Promise.useNativePromise = true;
if (Promise.useNativePromise)
return generateNativePromiseForPowerBIPromise(init);
this.defer = Promise.ensureFactory().defer();
init((function (value) { return _this.onResolve(value); }), (function (reason) { return _this.onReject(reason); }));
}
Promise.prototype.then = function (successCallback, errorCallback) {
this.hasRejectionHandling = this.hasRejectionHandling || (errorCallback !== undefined);
return this.defer.promise.then(successCallback, errorCallback);
};
Promise.prototype.catch = function (onRejected) {
this.hasRejectionHandling = this.hasRejectionHandling || (onRejected !== undefined);
return this.defer.promise.catch(onRejected);
};
Promise.prototype.finally = function (finallyCallback) {
return this.defer.promise.finally(finallyCallback);
};
Promise.init = function (promiseFactory, exceptionHandler, defaultFactoryIsOk, useNativePromise) {
debug.assertValue(promiseFactory, 'promiseFactory');
debug.assertAnyValue(exceptionHandler, 'exceptionHandler');
debug.assert(defaultFactoryIsOk || !Promise.defaultFactoryWasProvided, "powerbi.Promise was used before being initialized - that is legitimate in test scenarios only");
// NOTE: In production code, we expect only one Angular app bootstrapped on the page, and
// the registered promise factory & exceptionHandler should use that one.
if (useNativePromise !== undefined)
Promise.useNativePromise = useNativePromise;
Promise.factory = promiseFactory;
Promise.exceptions = exceptionHandler;
Promise.defaultFactoryWasProvided = false;
};
Promise.ensureFactory = function () {
var factory = Promise.factory;
if (!factory) {
// When unspecified, fall back on the jQuery promise factory.
factory = Promise.factory = powerbi.createJQueryPromiseFactory();
Promise.defaultFactoryWasProvided = true;
}
return factory;
};
Promise.resolve = function (value) {
if (Promise.useNativePromise)
return window.Promise.resolve(value);
return new Promise(function (resolve, _) { return resolve(value); });
};
Promise.reject = function (reason) {
if (Promise.useNativePromise)
return window.Promise.reject(reason);
return new Promise(function (_, reject) { return reject(reason); });
};
Promise.allSettled = function (promises) {
if (Promise.useNativePromise)
return window.Promise.allSettled(promises);
return new Promise(function (resolve, reject) {
var promiseCount = promises.length;
if (promiseCount > 0) {
var results_2 = [];
for (var i = 0; i < promiseCount; i++) {
promises[i]
.then((function (value) { return results_2.push({
value: value,
type: 0 /* Success */
}); }))
.catch((function (reason) { return results_2.push({
value: reason,
type: 1 /* Failure */
}); }))
.finally((function () {
if (results_2.length === promiseCount) {
resolve(results_2);
}
}));
}
}
else {
resolve([]);
}
});
};
Promise.prototype.onResolve = function (value) {
var _this = this;
debug.assertAnyValue(value, 'value');
if (isPromise(value)) {
// NOTE: this should be recursive
value.then((function (chainedValue) { return _this.onResolve(chainedValue); }), (function (chainedValue) { return _this.onReject(chainedValue); }));
}
else {
this.defer.resolve(value);
}
};
Promise.prototype.onReject = function (error) {
debug.assertAnyValue(error, 'error');
if (!this.hasRejectionHandling &&
error instanceof Error &&
!error.suppressExceptionHandler) {
var exceptionHandler = Promise.exceptions;
if (exceptionHandler) {
// Mark the Error as handled to avoid multiple notifications from chained promises.
error.suppressExceptionHandler = true;
// NOTE: Prior to Angular 1.6, unhandled exceptions in promises were passed to the
// $exceptionHandler. As of 1.6, exceptions are treated like regular rejections and
// NOT passed to the $exceptionHandler.
//
// This promsie class is consistent with Angular <1.6 exception handling:
// 1) Notify the $exceptionHandler service of "unhandled" exceptions
// 2) continue with the Promise "rejection" path
exceptionHandler(error);
}
}
this.defer.reject(error);
};
return Promise;
}());
_a = Symbol.toStringTag;
powerbi.Promise = Promise;
var Deferred = /** @class */ (function () {
function Deferred() {
var _this = this;
// name space is needed to match the name-patching for ZoneJS
this.promise = new powerbi.Promise(function (resolve, reject) { _this.resolver = resolve; _this.rejector = reject; });
}
Deferred.prototype.resolve = function (value) {
this.resolver(value);
};
Deferred.prototype.reject = function (reason) {
this.rejector(reason);
};
return Deferred;
}());
powerbi.Deferred = Deferred;
// TODO Fix Explicit Any
function isPromise(value) {
return value && _.isFunction(value.then);
}
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
function generateNativePromiseForPowerBIPromise(executer) {
return new Promise(executer);
}
var powerbi;
(function (powerbi) {
/**
* Check if a value is a Promise. The current standard is to have a then method.
*
* @param {Any} value
* @return {Boolean} true if it is a promise.
*/
function isPromise(value) {
return value && _.isObject(value) && value.then && _.isFunction(value.then);
}
powerbi.isPromise = isPromise;
/**
* Check if a value is a Promise and, if it is,
* return the `then` method of that promise.
*
* @param {Any} value
* @return {Function|Null} then method or null if not a promise
*/
function getThen(value) {
return isPromise(value) ? value.then : null;
}
powerbi.getThen = getThen;
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
function isDateWithEpochValue(value) {
return value instanceof Date && typeof (value.epochTimeStamp) === 'number';
}
powerbi.isDateWithEpochValue = isDateWithEpochValue;
function cloneDateWithEpochValue(original) {
var date = new Date(original.getTime());
date.epochTimeStamp = original.epochTimeStamp;
return date;
}
powerbi.cloneDateWithEpochValue = cloneDateWithEpochValue;
/** Creates a DateView backward-compatible Date object from date parts*/
function createDateWithEpochValue(year, monthIndex, day, hours, minutes, seconds, ms) {
if (monthIndex === void 0) { monthIndex = 0; }
if (day === void 0) { day = 1; }
if (hours === void 0) { hours = 0; }
if (minutes === void 0) { minutes = 0; }
if (seconds === void 0) { seconds = 0; }
if (ms === void 0) { ms = 0; }
var value = new Date(year, monthIndex, day, hours, minutes, seconds, ms);
value.epochTimeStamp = Date.UTC(year, monthIndex, day, hours, minutes, seconds, ms);
return value;
}
powerbi.createDateWithEpochValue = createDateWithEpochValue;
/** Creates a DateView backward-compatible Date object using **local values** from a Date */
function dateWithEpochValueFromLocalDate(localDate) {
var date = localDate;
date.epochTimeStamp = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
return date;
}
powerbi.dateWithEpochValueFromLocalDate = dateWithEpochValueFromLocalDate;
/** Creates a DateView backward-compatible Date object using **local values** from a timestamp */
function dateWithEpochValueFromLocalTimeStamp(localTimeStamp) {
return dateWithEpochValueFromLocalDate(new Date(localTimeStamp));
}
powerbi.dateWithEpochValueFromLocalTimeStamp = dateWithEpochValueFromLocalTimeStamp;
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
/**
* Forces all properties in the given prototype to be enumerable.
* This is to work around a change in behavior in TS 3.9
* @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#getterssetters-are-no-longer-enumerable
* @param prototype Prototype to force all properties to be enumerated
*/
function forceEnumeration(prototype) {
if (!prototype) {
return;
}
Object.getOwnPropertyNames(prototype).forEach((function (property) {
if (property === 'constructor') {
return;
}
Object.defineProperty(prototype, property, { enumerable: true });
}));
}
jsCommon.forceEnumeration = forceEnumeration;
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
var Errors;
(function (Errors) {
var NamedError = /** @class */ (function (_super) {
__extends(NamedError, _super);
function NamedError(name, message) {
var _this = _super.call(this, message) || this;
_this.name = name;
return _this;
}
return NamedError;
}(Error));
var ArgumentError = /** @class */ (function (_super) {
__extends(ArgumentError, _super);
function ArgumentError(name, message, argument) {
var _this = _super.call(this, name, message + ': ' + argument) || this;
_this.argument = argument;
return _this;
}
return ArgumentError;
}(NamedError));
function argumentNull(argumentName) {
return new ArgumentError('argumentNull', 'Argument was null', argumentName);
}
Errors.argumentNull = argumentNull;
function argumentUndefined(argumentName) {
return new ArgumentError('argumentUndefined', 'Argument was undefined', argumentName);
}
Errors.argumentUndefined = argumentUndefined;
function argumentOutOfRange(argumentName) {
return new ArgumentError('argumentOutOfRange', 'Argument was out of range', argumentName);
}
Errors.argumentOutOfRange = argumentOutOfRange;
function notImplementedException(what) {
return new NamedError('notImplementedException', "not implemented: " + what);
}
Errors.notImplementedException = notImplementedException;
var TypeAssertionError = /** @class */ (function (_super) {
__extends(TypeAssertionError, _super);
function TypeAssertionError(type) {
return _super.call(this, type) || this;
}
return TypeAssertionError;
}(Error));
Errors.TypeAssertionError = TypeAssertionError;
})(Errors = jsCommon.Errors || (jsCommon.Errors = {}));
/**
* Captures the stack trace, if available.
* It optionally takes the number of frames to remove from the stack trace.
* By default, it removes the last frame to consider the calling type's
* constructor and the temporary error used to capture the stack trace (below).
* More levels can be requested as needed e..g. when an error is created
* from a helper method. <Min requirement: IE10, Chrome, Firefox, Opera>.
*/
function getStackTrace(leadingFramesToRemove) {
if (leadingFramesToRemove === void 0) { leadingFramesToRemove = 1; }
var stackTrace, stackSegments;
try {
// needs to throw for stack trace to work in IE
throw new Error();
}
catch (error) {
stackTrace = error.stack;
if (stackTrace != null) {
stackSegments = stackTrace.split('\n');
stackSegments.splice(1, leadingFramesToRemove);
// Finally
stackTrace = stackSegments.join('\n');
}
}
return stackTrace;
}
jsCommon.getStackTrace = getStackTrace;
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
/**
* The types of possible traces within the system, this aligns to the traces available in Cloud Platform.
*/
var TraceType;
(function (TraceType) {
TraceType[TraceType["Information"] = 0] = "Information";
TraceType[TraceType["Verbose"] = 1] = "Verbose";
TraceType[TraceType["Warning"] = 2] = "Warning";
TraceType[TraceType["Error"] = 3] = "Error";
TraceType[TraceType["ExpectedError"] = 4] = "ExpectedError";
TraceType[TraceType["UnexpectedError"] = 5] = "UnexpectedError";
TraceType[TraceType["Fatal"] = 6] = "Fatal";
})(TraceType = jsCommon.TraceType || (jsCommon.TraceType = {}));
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
var ConsoleTracer = /** @class */ (function () {
function ConsoleTracer() {
}
ConsoleTracer.prototype.logTrace = function (trace) {
if (window.DEBUG) {
switch (trace.type) {
case jsCommon.TraceType.Information:
console.info(trace.toString());
break;
case jsCommon.TraceType.UnexpectedError:
case jsCommon.TraceType.Error:
case jsCommon.TraceType.Fatal:
console.error(trace.toString());
break;
case jsCommon.TraceType.ExpectedError:
case jsCommon.TraceType.Warning:
console.warn(trace.toString());
break;
case jsCommon.TraceType.Verbose:
console.log(trace.toString());
break;
default:
console.log(trace.toString());
break;
}
}
};
return ConsoleTracer;
}());
jsCommon.ConsoleTracer = ConsoleTracer;
var defaultListener = new ConsoleTracer();
var traceMaxCount = 1000;
var Trace = /** @class */ (function () {
function Trace() {
}
Trace.assertFail = function (message) {
debug.assertValue(message, 'message');
debug.assertFail(message);
this.error(message, /*includeStackTrace*/ true);
};
/**
* Trace a warning. Please ensure that no PII is being logged.
*/
Trace.warning = function (text, requestId, additionalInfo) {
debug.assertValue(text, 'text');
this.logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Warning, this.sessionId, requestId, additionalInfo));
};
/**
* Trace an error. Please ensure that no PII is being logged.
*/
Trace.error = function (text, includeStackTrace, requestId, additionalInfo) {
debug.assertValue(text, 'text');
if (includeStackTrace)
text = jsCommon.StringExtensions.format("{0}.\nStack:\n{1}", text, jsCommon.getStackTrace());
this.logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Error, this.sessionId, requestId, additionalInfo));
};
/**
* Trace an information. Please ensure that no PII is being logged.
*/
Trace.information = function (text, requestId, additionalInfo) {
debug.assertValue(text, 'text');
this.logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Information, this.sessionId, requestId, additionalInfo));
};
/**
* Trace an information. Please ensure that no PII is being logged.
*/
Trace.verbose = function (text, requestId, additionalInfo) {
debug.assertValue(text, 'text');
this.logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Verbose, this.sessionId, requestId, additionalInfo));
};
Trace.addListener = function (listener) {
debug.assertValue(listener, 'listener');
this.listeners.push(listener);
};
Trace.removeListener = function (listener) {
debug.assertValue(listener, 'listener');
var index = this.listeners.indexOf(listener);
if (index >= 0)
this.listeners.splice(index, 1);
};
Trace.resetListeners = function () {
this.listeners = new Array(defaultListener);
};
Trace.reset = function () {
this.lastTraceIndex = -1;
};
Trace.getTraces = function () {
if (this.lastTraceIndex < 0)
return [];
var result = new Array(this.lastTraceIndex + 1);
for (var i = 0; i <= this.lastTraceIndex; i++)
result[i] = this.traces[i];
return result;
};
/**
* Note: Used for unit-test only.
*/
Trace.disableDefaultListener = function () {
this.removeListener(defaultListener);
};
Trace.enableDefaultListener = function () {
this.addListener(defaultListener);
};
Trace.logTraceInternal = function (trace) {
if ((this.lastTraceIndex + 1) >= traceMaxCount)
this.reset();
this.traces[++this.lastTraceIndex] = trace;
for (var i = 0, len = this.listeners.length; i < len; i++)
this.listeners[i].logTrace(trace);
};
Trace.traces = new Array(traceMaxCount);
Trace.lastTraceIndex = -1;
Trace.listeners = new Array(defaultListener);
return Trace;
}());
jsCommon.Trace = Trace;
// src/Clients/PowerBIVisuals/VisualsCommon/services/localStorageCache.ts is accessing Trace without hard dependency
// this ensures it is still avaialble after conversion to external modules.
powerbi.ensureJsCommon().Trace = Trace;
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
var TraceItem = /** @class */ (function () {
function TraceItem(text, type, sessionId, requestId, additionalInfo) {
this.text = text;
this.type = type;
this.sessionId = sessionId;
this.requestId = requestId;
this.timeStamp = new Date();
this.additionalInfo = additionalInfo;
}
TraceItem.prototype.toString = function () {
var resultString = '';
resultString += TraceItem.traceTypeStrings[this.type] + " (" + this.timeStamp.toUTCString() + "): " + this.text;
if (this.requestId)
resultString += ('\n(Request id: ' + this.requestId + ')');
if (this.additionalInfo)
resultString += ('\nAdditional info: ' + JSON.stringify(this.additionalInfo));
return resultString;
};
TraceItem.traceTypeStrings = [
'INFORMATION',
'VERBOSE',
'WARNING',
'ERROR',
'EXPECTEDERROR',
'UNEXPECTEDERROR',
'FATAL',
];
return TraceItem;
}());
jsCommon.TraceItem = TraceItem;
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
var visuals;
(function (visuals) {
var ArrayExtensions = jsCommon.ArrayExtensions;
var DataColorPalette = /** @class */ (function () {
/**
* Creates a DataColorPalette using the given theme, or the default theme.
*/
function DataColorPalette(colors, sentimentColors, gradientColors) {
var _a;
// Hardcoded values for Color Picker.
this.basePickerColors = [
{ value: '#FFFFFF' },
{ value: '#000000' },
];
this.colors = colors || DefaultColorManager.getDefaultColors();
this.sentimentColors = sentimentColors || DefaultColorManager.defaultSentimentColors;
this.gradientColors = gradientColors || DefaultColorManager.defaultGradientColors;
this.scales = {};
(_a = this.basePickerColors).push.apply(_a, _.take(this.colors, 8));
}
DataColorPalette.prototype.getColorScaleByKey = function (key) {
var scale = this.scales[key];
if (scale === undefined) {
scale = this.createScale();
this.scales[key] = scale;
}
return scale;
};
DataColorPalette.prototype.getNewColorScale = function () {
return this.createScale();
};
DataColorPalette.prototype.getColorByIndex = function (index) {
debug.assert(index >= 0 && index < this.colors.length, 'index is out of bounds');
return this.colors[index];
};
DataColorPalette.prototype.getSentimentColors = function () {
return this.sentimentColors;
};
DataColorPalette.prototype.getGradientColors = function () {
return this.gradientColors;
};
DataColorPalette.prototype.getBasePickerColors = function () {
return this.basePickerColors;
};
DataColorPalette.prototype.getBaseColors = function () {
return _.take(this.colors, 8);
};
DataColorPalette.prototype.getAllColors = function () {
return this.colors;
};
DataColorPalette.prototype.createScale = function () {
return D3ColorScale.createFromColors(this.colors);
};
return DataColorPalette;
}());
visuals.DataColorPalette = DataColorPalette;
var D3ColorScale = /** @class */ (function () {
function D3ColorScale(scale) {
this.scale = scale;
}
D3ColorScale.prototype.getColor = function (key) {
return this.scale(key);
};
D3ColorScale.prototype.clearAndRotateScale = function () {
var offset = this.scale.domain().length;
var rotatedColors = ArrayExtensions.rotate(this.scale.range(), offset);
this.scale = d3.scaleOrdinal().range(rotatedColors);
};
D3ColorScale.prototype.clone = function () {
return new D3ColorScale(this.scale.copy());
};
D3ColorScale.prototype.getDomain = function () {
return this.scale.domain();
};
D3ColorScale.createFromColors = function (colors) {
return new D3ColorScale(d3.scaleOrdinal().range(colors));
};
return D3ColorScale;
}());
visuals.D3ColorScale = D3ColorScale;
var DefaultColorManager = /** @class */ (function () {
function DefaultColorManager() {
}
DefaultColorManager.getDefaultColors = function () {
if (!DefaultColorManager.defaultColors) {
// Extend the list of available colors by cycling the base colors
DefaultColorManager.defaultColors = [];
var baseColors = DefaultColorManager.defaultBaseColors;
for (var i = 0; i < DefaultColorManager.colorSectorCount; ++i) {
for (var j = 0, jlen = baseColors.length; j < jlen; ++j) {
var color = jsCommon.Color.rotate(baseColors[j].value, i / DefaultColorManager.colorSectorCount);
// If rotating the color fails (because baseColors[j].value is not a valid rgbString, falling back to the same (invalud) rgbString
DefaultColorManager.defaultColors.push({ value: color !== null && color !== void 0 ? color : baseColors[j].value });
}
}
}
return DefaultColorManager.defaultColors;
};
DefaultColorManager.colorSectorCount = 12;
// declare the Theme code as a private implementation detail inside the DataColorPalette so that the code stays hidden
// until it's ready for wider use.
DefaultColorManager.defaultBaseColors = [
// First loop
{ value: '#01B8AA' },
{ value: '#374649' },
{ value: '#FD625E' },
{ value: '#F2C80F' },
{ value: '#5F6B6D' },
{ value: '#8AD4EB' },
{ value: '#FE9666' },
{ value: '#A66999' },
{ value: '#3599B8' },
{ value: '#DFBFBF' },
// Second loop
{ value: '#4AC5BB' },
{ value: '#5F6B6D' },
{ value: '#FB8281' },
{ value: '#F4D25A' },
{ value: '#7F898A' },
{ value: '#A4DDEE' },
{ value: '#FDAB89' },
{ value: '#B687AC' },
{ value: '#28738A' },
{ value: '#A78F8F' },
// Third loop
{ value: '#168980' },
{ value: '#293537' },
{ value: '#BB4A4A' },
{ value: '#B59525' },
{ value: '#475052' },
{ value: '#6A9FB0' },
{ value: '#BD7150' },
{ value: '#7B4F71' },
{ value: '#1B4D5C' },
{ value: '#706060' },
// Fourth loop
{ value: '#0F5C55' },
{ value: '#1C2325' },
{ value: '#7D3231' },
{ value: '#796419' },
{ value: '#303637' },
{ value: '#476A75' },
{ value: '#7E4B36' },
{ value: '#52354C' },
{ value: '#0D262E' },
{ value: '#544848' },
];
DefaultColorManager.defaultSentimentColors = {
bad: { value: '#E81123' },
neutral: { value: '#F2C811' },
good: { value: '#3bb44a' }, // Green
};
DefaultColorManager.defaultGradientColors = {
minColor: { value: '#FD625E' },
midColor: { value: '#F5D33F' },
maxColor: { value: '#01B8AA' },
nullColor: { value: '#FF7F48' },
};
return DefaultColorManager;
}());
visuals.DefaultColorManager = DefaultColorManager;
})(visuals = powerbi.visuals || (powerbi.visuals = {}));
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
var _a, _b;
var EnumExtensions = jsCommon.EnumExtensions;
/** Describes a data value type, including a primitive type and extended type if any (derived from data category). */
var ValueType = /** @class */ (function () {
/** Do not call the ValueType constructor directly. Use the ValueType.fromXXX methods. */
function ValueType(type, category, enumType, flagsEnumType, variantTypes, sparklineTypeDescriptor) {
debug.assert((!!type && powerbi.ExtendedTypeNames[type] != null) || type === 0 /* Null */, 'type');
debug.assert(!!category || category === null, 'category');
debug.assert(type !== 26214401 /* Enumeration */ || !!enumType, 'enumType');
debug.assert(type !== 26280196 /* FlagsEnumeration */ || !!flagsEnumType, 'flagsEnumType');
this.underlyingType = type;
this.category = category;
if (EnumExtensions.hasFlag(type, 512 /* Temporal */)) {
this.temporalType = new TemporalType(type);
}
if (EnumExtensions.hasFlag(type, 1024 /* Geography */)) {
this.geographyType = new GeographyType(type);
}
if (EnumExtensions.hasFlag(type, 2048 /* Miscellaneous */)) {
this.miscType = new MiscellaneousType(type, sparklineTypeDescriptor);
}
if (EnumExtensions.hasFlag(type, 4096 /* Formatting */)) {
this.formattingType = new FormattingType(type);
}
if (EnumExtensions.hasFlag(type, 26214401 /* Enumeration */)) {
this.enumType = enumType;
}
if (EnumExtensions.hasFlag(type, 26280196 /* FlagsEnumeration */)) {
this.flagsEnumType = flagsEnumType;
}
if (EnumExtensions.hasFlag(type, 8192 /* Scripting */)) {
this.scriptingType = new ScriptType(type);
}
if (EnumExtensions.hasFlag(type, 16384 /* Reference */)) {
this.referenceType = new ReferenceType(type);
}
if (EnumExtensions.hasFlag(type, 13 /* Variant */)) {
this.variationTypes = variantTypes;
}
}
/** Creates or retrieves a ValueType object based on the specified ValueTypeDescriptor. */
ValueType.fromDescriptor = function (descriptor) {
descriptor = descriptor || {};
// Extended types
if (descriptor.scripting) {
if (descriptor.scripting.source)
return ValueType.fromExtendedType(32776193 /* ScriptSource */);
}
if (descriptor.enumeration)
return ValueType.fromEnum(descriptor.enumeration);
if (descriptor.flagsEnumeration)
return ValueType.fromFlagsEnum(descriptor.flagsEnumeration);
if (descriptor.temporal) {
if (descriptor.temporal.year)
return ValueType.fromExtendedType(66308 /* Years_Integer */);
if (descriptor.temporal.quarter)
return ValueType.fromExtendedType(262916 /* Quarters_Integer */);
if (descriptor.temporal.month)
return ValueType.fromExtendedType(131844 /* Months_Integer */);
if (descriptor.temporal.day)
return ValueType.fromExtendedType(328452 /* DayOfMonth_Integer */);
if (descriptor.temporal.paddedDateTableDate)
return ValueType.fromExtendedType(197127 /* PaddedDateTableDates */);
}
if (descriptor.geography) {
if (descriptor.geography.address)
return ValueType.fromExtendedType(6554625 /* Address */);
if (descriptor.geography.city)
return ValueType.fromExtendedType(6620161 /* City */);
if (descriptor.geography.continent)
return ValueType.fromExtendedType(6685697 /* Continent */);
if (descriptor.geography.country)
return ValueType.fromExtendedType(6751233 /* Country */);
if (descriptor.geography.county)
return ValueType.fromExtendedType(6816769 /* County */);
if (descriptor.geography.region)
return ValueType.fromExtendedType(6882305 /* Region */);
if (descriptor.geography.postalCode)
return ValueType.fromExtendedType(6947841 /* PostalCode_Text */);
if (descriptor.geography.stateOrProvince)
return ValueType.fromExtendedType(7013377 /* StateOrProvince */);
if (descriptor.geography.place)
return ValueType.fromExtendedType(7078913 /* Place */);
if (descriptor.geography.latitude)
return ValueType.fromExtendedType(7144707 /* Latitude_Double */);
if (descriptor.geography.longitude)
return ValueType.fromExtendedType(7210243 /* Longitude_Double */);
}
if (descriptor.misc) {
if (descriptor.misc.image)
return ValueType.fromExtendedType(13109259 /* Image */);
if (descriptor.misc.imageUrl)
return ValueType.fromExtendedType(13174785 /* ImageUrl */);
if (descriptor.misc.webUrl)
return ValueType.fromExtendedType(13240321 /* WebUrl */);
if (descriptor.misc.barcode)
return ValueType.fromExtendedType(13305857 /* Barcode_Text */);
if (descriptor.misc.sparkline)
return ValueType.fromSparklineType(descriptor.misc.sparkline);
}
if (descriptor.formatting) {
if (descriptor.formatting.color)
return ValueType.fromExtendedType(19664897 /* Color */);
if (descriptor.formatting.formatString)
return ValueType.fromExtendedType(19730433 /* FormatString */);
if (descriptor.formatting.alignment)
return ValueType.fromExtendedType(20058113 /* Alignment */);
if (descriptor.formatting.labelDisplayUnits)
return ValueType.fromExtendedType(20123649 /* LabelDisplayUnits */);
if (descriptor.formatting.displayUnitsWithoutAuto)
return ValueType.fromExtendedType(20516865 /* DisplayUnitsWithoutAuto */);
if (descriptor.formatting.fontFamily)
return ValueType.fromExtendedType(20385793 /* FontFamily */);
if (descriptor.formatting.fontSize)
return ValueType.fromExtendedType(20189443 /* FontSize */);
if (descriptor.formatting.altText)
return ValueType.fromExtendedType(20451329 /* AltText */);
if (descriptor.formatting.stylePreset)
return ValueType.fromExtendedType(20582401 /* StylePreset */);
}
// Simplified primitive types
if (descriptor.text)
return ValueType.fromExtendedType(1 /* Text */);
if (descriptor.integer)
return ValueType.fromExtendedType(260 /* Integer */);
if (descriptor.numeric)
return ValueType.fromExtendedType(259 /* Double */);
if (descriptor.bool)
return ValueType.fromExtendedType(5 /* Boolean */);
if (descriptor.dateTime)
return ValueType.fromExtendedType(519 /* DateTime */);
if (descriptor.duration)
return ValueType.fromExtendedType(10 /* Duration */);
if (descriptor.binary)
return ValueType.fromExtendedType(11 /* Binary */);
if (descriptor.json)
return ValueType.fromExtendedType(14 /* Json */);
if (descriptor.none)
return ValueType.fromExtendedType(12 /* None */);
if (descriptor.extendedType) {
return ValueType.fromExtendedType(descriptor.extendedType);
}
if (descriptor.operations) {
if (descriptor.operations.searchEnabled)
return ValueType.fromExtendedType(65541 /* SearchEnabled */);
}
if (descriptor.reference) {
if (descriptor.reference.bookmark)
return ValueType.fromExtendedType(39337985 /* BookmarkRef */);
if (descriptor.reference.bookmarkGroup)
return ValueType.fromExtendedType(39534593 /* BookmarkGroupRef */);
if (descriptor.reference.section)
return ValueType.fromExtendedType(39403521 /* SectionRef */);
if (descriptor.reference.perspective)
return ValueType.fromExtendedType(39469057 /* PerspectiveRef */);
if (descriptor.reference.rowRefText)
return ValueType.fromExtendedType(39600129 /* RowRefText */);
}
if (descriptor.variant) {
var variantTypes = _.map(descriptor.variant, (function (variantType) { return ValueType.fromDescriptor(variantType); }));
return ValueType.fromVariant(variantTypes);
}
return ValueType.fromExtendedType(0 /* Null */);
};
/** Advanced: Generally use fromDescriptor instead. Creates or retrieves a ValueType object for the specified ExtendedType. */
ValueType.fromExtendedType = function (extendedType) {
extendedType = extendedType || 0 /* Null */;
var primitiveType = getPrimitiveType(extendedType), category = getCategoryFromExtendedType(extendedType);
debug.assert(primitiveType !== 0 /* Null */ || extendedType === 0 /* Null */, 'Cannot create ValueType for abstract extended type. Consider using fromDescriptor instead.');
return ValueType.fromPrimitiveTypeAndCategory(primitiveType, category);
};
/** Creates or retrieves a ValueType object for the specified PrimitiveType and data category. */
ValueType.fromPrimitiveTypeAndCategory = function (primitiveType, category) {
primitiveType = primitiveType || 0 /* Null */;
category = category || null;
var id = primitiveType.toString();
if (category)
id += '|' + category;
return ValueType.typeCache[id] || (ValueType.typeCache[id] = new ValueType(toExtendedType(primitiveType, category), category));
};
/** Creates a ValueType to describe the given IEnumType. */
ValueType.fromEnum = function (enumType) {
debug.assertValue(enumType, 'enumType');
return new ValueType(26214401 /* Enumeration */, null, enumType);
};
/** Creates a ValueType to describe the given IEnumType. */
ValueType.fromFlagsEnum = function (enumType) {
debug.assertValue(enumType, 'enumType');
return new ValueType(26280196 /* FlagsEnumeration */, null /*category*/, null /*enumType*/, enumType);
};
/** Creates a ValueType to describe the given Variant type. */
ValueType.fromVariant = function (variantTypes) {
debug.assertValue(variantTypes, 'variantTypes');
return new ValueType(13 /* Variant */, /* category */ null, /* enumType */ null, /*flagsEnumType*/ null, variantTypes);
};
ValueType.fromSparklineType = function (sparklineTypeDescriptor) {
return new ValueType(13371406 /* Sparkline */, 'Sparkline', /* enumType */ null, /*flagsEnumType*/ null, /*variantTypes*/ null, sparklineTypeDescriptor);
};
/**
* Determines if the specified type is compatible to the otherType or from otherType
*/
ValueType.isCompatibleFromAny = function (type, otherType, strictNumeric) {
debug.assertValue(type, 'type');
debug.assertValue(otherType, 'otherType');
var valueType = ValueType.fromDescriptor(type);
if (ValueType.isCompatibleTo(valueType, [otherType], strictNumeric)) {
return true;
}
else {
return valueType && valueType.isCompatibleFrom(ValueType.fromDescriptor(otherType), strictNumeric);
}
};
/**
* Determines if the specified type is compatible from at least one of the otherTypes.
* Note: non-integer numerics are only convertable into integer numerics if the strict flag is set to false.
*/
ValueType.isCompatibleTo = function (type, otherTypes, strictNumeric) {
debug.assertValue(type, 'type');
debug.assertValue(otherTypes, 'otherTypes');
var valueType = ValueType.fromDescriptor(type);
for (var _i = 0, otherTypes_1 = otherTypes; _i < otherTypes_1.length; _i++) {
var otherType = otherTypes_1[_i];
var otherValueType = ValueType.fromDescriptor(otherType);
if (otherValueType.isCompatibleFrom(valueType, strictNumeric))
return true;
}
return false;
};
/**
* Determines if the instance ValueType is convertable from the 'other' ValueType.
* Note: non-integer numerics are only convertable into integer numerics if the strict flag is set to false.
*/
ValueType.prototype.isCompatibleFrom = function (other, strictNumeric) {
debug.assertValue(other, 'other');
if (this === other)
return true;
// If the 'other' value type is a variant type, all of its variation types need to be convertable into
// the instance value type.
if (other.variant) {
for (var _i = 0, _a = other.variant; _i < _a.length; _i++) {
var otherType = _a[_i];
if (!this.isCompatibleFrom(otherType, strictNumeric))
return false;
}
}
// If the instance value type is a variant type, return true if 'other' is convertable into
// at least one of the variation types.
if (this.variant) {
for (var _b = 0, _c = this.variant; _b < _c.length; _b++) {
var variantType = _c[_b];
if (variantType.isCompatibleFrom(other, strictNumeric))
return true;
}
}
var otherPrimitiveType = other.primitiveType;
return this.primitiveType === otherPrimitiveType ||
otherPrimitiveType === 0 /* Null */ ||
// Return true if both types are numbers
(this.numeric && other.numeric && (!strictNumeric || !this.integer || other.integer));
};
/**
* Determines if the instance ValueType is equal to the 'other' ValueType
* @param {ValueType} other the other ValueType to check equality against
* @returns True if the instance ValueType is equal to the 'other' ValueType
*/
ValueType.prototype.equals = function (other) {
return _.isEqual(this, other);
};
Object.defineProperty(ValueType.prototype, "primitiveType", {
/** Gets the exact primitive type of this ValueType. */
get: function () {
return getPrimitiveType(this.underlyingType);
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "extendedType", {
/** Gets the exact extended type of this ValueType. */
get: function () {
return this.underlyingType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "categoryString", {
/** Gets the data category string (if any) for this ValueType. */
get: function () {
return this.category;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "text", {
// Simplified primitive types
/** Indicates whether the type represents text values. */
get: function () {
return this.primitiveType === 1 /* Text */;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "numeric", {
/** Indicates whether the type represents any numeric value. */
get: function () {
return EnumExtensions.hasFlag(this.underlyingType, 256 /* Numeric */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "integer", {
/** Indicates whether the type represents integer numeric values. */
get: function () {
return this.primitiveType === 4 /* Integer */;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "bool", {
/** Indicates whether the type represents Boolean values. */
get: function () {
return this.primitiveType === 5 /* Boolean */;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "dateTime", {
/** Indicates whether the type represents any date/time values. */
get: function () {
return this.primitiveType === 7 /* DateTime */ ||
this.primitiveType === 6 /* Date */ ||
this.primitiveType === 9 /* Time */;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "duration", {
/** Indicates whether the type represents duration values. */
get: function () {
return this.primitiveType === 10 /* Duration */;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "binary", {
/** Indicates whether the type represents binary values. */
get: function () {
return this.primitiveType === 11 /* Binary */;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "json", {
/** Indicates whether the type represents json values. */
get: function () {
return this.primitiveType === 14 /* Json */;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "none", {
/** Indicates whether the type represents none values. */
get: function () {
return this.primitiveType === 12 /* None */;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "temporal", {
// Extended types
/** Returns an object describing temporal values represented by the type, if it represents a temporal type. */
get: function () {
return this.temporalType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "geography", {
/** Returns an object describing geographic values represented by the type, if it represents a geographic type. */
get: function () {
return this.geographyType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "misc", {
/** Returns an object describing the specific values represented by the type, if it represents a miscellaneous extended type. */
get: function () {
return this.miscType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "formatting", {
/** Returns an object describing the formatting values represented by the type, if it represents a formatting type. */
get: function () {
return this.formattingType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "enum", {
/** Returns an object describing the enum values represented by the type, if it represents an enumeration type. */
get: function () {
return this.enumType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "flagsEnum", {
/** Returns an object describing the enum values represented by the type, if it represents a flags enumeration type. */
get: function () {
return this.flagsEnumType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "scripting", {
get: function () {
return this.scriptingType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "reference", {
get: function () {
return this.referenceType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ValueType.prototype, "variant", {
/** Returns an array describing the variant values represented by the type, if it represents an Variant type. */
get: function () {
return this.variationTypes;
},
enumerable: false,
configurable: true
});
ValueType.typeCache = {};
return ValueType;
}());
powerbi.ValueType = ValueType;
jsCommon.forceEnumeration(ValueType.prototype);
var ScriptType = /** @class */ (function () {
function ScriptType(type) {
debug.assert(!!type && EnumExtensions.hasFlag(type, 8192 /* Scripting */), 'type');
this.underlyingType = type;
}
Object.defineProperty(ScriptType.prototype, "source", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 32776193 /* ScriptSource */);
},
enumerable: false,
configurable: true
});
return ScriptType;
}());
var TemporalType = /** @class */ (function () {
function TemporalType(type) {
debug.assert(!!type && EnumExtensions.hasFlag(type, 512 /* Temporal */), 'type');
this.underlyingType = type;
}
Object.defineProperty(TemporalType.prototype, "year", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 66048 /* Years */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(TemporalType.prototype, "quarter", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 262656 /* Quarters */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(TemporalType.prototype, "month", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 131584 /* Months */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(TemporalType.prototype, "day", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 328192 /* DayOfMonth */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(TemporalType.prototype, "paddedDateTableDate", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 197127 /* PaddedDateTableDates */);
},
enumerable: false,
configurable: true
});
return TemporalType;
}());
var GeographyType = /** @class */ (function () {
function GeographyType(type) {
debug.assert(!!type && EnumExtensions.hasFlag(type, 1024 /* Geography */), 'type');
this.underlyingType = type;
}
Object.defineProperty(GeographyType.prototype, "address", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 6554625 /* Address */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GeographyType.prototype, "city", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 6620161 /* City */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GeographyType.prototype, "continent", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 6685697 /* Continent */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GeographyType.prototype, "country", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 6751233 /* Country */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GeographyType.prototype, "county", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 6816769 /* County */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GeographyType.prototype, "region", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 6882305 /* Region */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GeographyType.prototype, "postalCode", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 6947840 /* PostalCode */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GeographyType.prototype, "stateOrProvince", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 7013377 /* StateOrProvince */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GeographyType.prototype, "place", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 7078913 /* Place */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GeographyType.prototype, "latitude", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 7144448 /* Latitude */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(GeographyType.prototype, "longitude", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 7209984 /* Longitude */);
},
enumerable: false,
configurable: true
});
return GeographyType;
}());
var MiscellaneousType = /** @class */ (function () {
function MiscellaneousType(type, sparklineType) {
debug.assert(!!type && EnumExtensions.hasFlag(type, 2048 /* Miscellaneous */), 'type');
this.underlyingType = type;
this.sparklineType = sparklineType;
}
Object.defineProperty(MiscellaneousType.prototype, "image", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 13109259 /* Image */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(MiscellaneousType.prototype, "imageUrl", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 13174785 /* ImageUrl */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(MiscellaneousType.prototype, "webUrl", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 13240321 /* WebUrl */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(MiscellaneousType.prototype, "barcode", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 13305856 /* Barcode */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(MiscellaneousType.prototype, "sparkline", {
get: function () {
if (matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 13371406 /* Sparkline */))
return this.sparklineType;
},
enumerable: false,
configurable: true
});
return MiscellaneousType;
}());
// method ExploreUIShell\utils\propertyPaneUtils.ts:getExtendedKey expects these fields to be enumerable
Object.getOwnPropertyNames(MiscellaneousType.prototype).forEach((function (p) {
if (p === "constructor")
return;
Object.defineProperty(MiscellaneousType.prototype, p, { enumerable: true });
}));
var ReferenceType = /** @class */ (function () {
function ReferenceType(type) {
debug.assert(!!type && EnumExtensions.hasFlag(type, 16384 /* Reference */), 'type');
this.underlyingType = type;
}
Object.defineProperty(ReferenceType.prototype, "bookmark", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 39337985 /* BookmarkRef */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(ReferenceType.prototype, "bookmarkGroup", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 39534593 /* BookmarkGroupRef */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(ReferenceType.prototype, "section", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 39403521 /* SectionRef */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(ReferenceType.prototype, "perspective", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 39469057 /* PerspectiveRef */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(ReferenceType.prototype, "rowRefText", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 39600129 /* RowRefText */);
},
enumerable: false,
configurable: true
});
return ReferenceType;
}());
var FormattingType = /** @class */ (function () {
function FormattingType(type) {
debug.assert(!!type && EnumExtensions.hasFlag(type, 4096 /* Formatting */), 'type');
this.underlyingType = type;
}
Object.defineProperty(FormattingType.prototype, "color", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 19664897 /* Color */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(FormattingType.prototype, "formatString", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 19730433 /* FormatString */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(FormattingType.prototype, "alignment", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 20058113 /* Alignment */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(FormattingType.prototype, "labelDisplayUnits", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 20123649 /* LabelDisplayUnits */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(FormattingType.prototype, "displayUnitsWithoutAuto", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 20516865 /* DisplayUnitsWithoutAuto */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(FormattingType.prototype, "fontFamily", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 20385793 /* FontFamily */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(FormattingType.prototype, "fontSize", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 20189443 /* FontSize */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(FormattingType.prototype, "altText", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 20451329 /* AltText */);
},
enumerable: false,
configurable: true
});
Object.defineProperty(FormattingType.prototype, "stylePreset", {
get: function () {
return matchesExtendedTypeWithAnyPrimitive(this.underlyingType, 20582401 /* StylePreset */);
},
enumerable: false,
configurable: true
});
return FormattingType;
}());
// method ExploreUIShell\utils\propertyPaneUtils.ts:getExtendedKey expects these fields to be enumerable
Object.getOwnPropertyNames(FormattingType.prototype).forEach((function (p) {
if (p === "constructor")
return;
Object.defineProperty(FormattingType.prototype, p, { enumerable: true });
}));
powerbi.PrimitiveTypeNames = (_a = {},
_a[0 /* Null */] = 'Null',
_a[1 /* Text */] = 'Text',
_a[2 /* Decimal */] = 'Decimal',
_a[3 /* Double */] = 'Double',
_a[4 /* Integer */] = 'Integer',
_a[5 /* Boolean */] = 'Boolean',
_a[6 /* Date */] = 'Date',
_a[7 /* DateTime */] = 'DateTime',
_a[8 /* DateTimeZone */] = 'DateTimeZone',
_a[9 /* Time */] = 'Time',
_a[10 /* Duration */] = 'Duration',
_a[11 /* Binary */] = 'Binary',
_a[12 /* None */] = 'None',
_a[13 /* Variant */] = 'Variant',
_a[14 /* Json */] = 'Json',
_a);
powerbi.ExtendedTypeNames = (_b = {},
_b[256 /* Numeric */] = 'Numeric',
_b[512 /* Temporal */] = 'Temporal',
_b[1024 /* Geography */] = 'Geography',
_b[2048 /* Miscellaneous */] = 'Miscellaneous',
_b[4096 /* Formatting */] = 'Formatting',
_b[8192 /* Scripting */] = 'Scripting',
_b[0 /* Null */] = 'Null',
_b[1 /* Text */] = 'Text',
_b[258 /* Decimal */] = 'Decimal',
_b[259 /* Double */] = 'Double',
_b[260 /* Integer */] = 'Integer',
_b[5 /* Boolean */] = 'Boolean',
_b[518 /* Date */] = 'Date',
_b[519 /* DateTime */] = 'DateTime',
_b[520 /* DateTimeZone */] = 'DateTimeZone',
_b[521 /* Time */] = 'Time',
_b[10 /* Duration */] = 'Duration',
_b[11 /* Binary */] = 'Binary',
_b[12 /* None */] = 'None',
_b[13 /* Variant */] = 'Variant',
_b[66048 /* Years */] = 'Years',
_b[66049 /* Years_Text */] = 'Years_Text',
_b[66308 /* Years_Integer */] = 'Years_Integer',
_b[66054 /* Years_Date */] = 'Years_Date',
_b[66055 /* Years_DateTime */] = 'Years_DateTime',
_b[131584 /* Months */] = 'Months',
_b[131585 /* Months_Text */] = 'Months_Text',
_b[131844 /* Months_Integer */] = 'Months_Integer',
_b[131590 /* Months_Date */] = 'Months_Date',
_b[131591 /* Months_DateTime */] = 'Months_DateTime',
_b[197127 /* PaddedDateTableDates */] = 'PaddedDateTableDates',
_b[262656 /* Quarters */] = 'Quarters',
_b[262657 /* Quarters_Text */] = 'Quarters_Text',
_b[262916 /* Quarters_Integer */] = 'Quarters_Integer',
_b[262662 /* Quarters_Date */] = 'Quarters_Date',
_b[262663 /* Quarters_DateTime */] = 'Quarters_DateTime',
_b[328192 /* DayOfMonth */] = 'DayOfMonth',
_b[328193 /* DayOfMonth_Text */] = 'DayOfMonth_Text',
_b[328452 /* DayOfMonth_Integer */] = 'DayOfMonth_Integer',
_b[328198 /* DayOfMonth_Date */] = 'DayOfMonth_Date',
_b[328199 /* DayOfMonth_DateTime */] = 'DayOfMonth_DateTime',
_b[6554625 /* Address */] = 'Address',
_b[6620161 /* City */] = 'City',
_b[6685697 /* Continent */] = 'Continent',
_b[6751233 /* Country */] = 'Country',
_b[6816769 /* County */] = 'County',
_b[6882305 /* Region */] = 'Region',
_b[6947840 /* PostalCode */] = 'PostalCode',
_b[6947841 /* PostalCode_Text */] = 'PostalCode_Text',
_b[6948100 /* PostalCode_Integer */] = 'PostalCode_Integer',
_b[7013377 /* StateOrProvince */] = 'StateOrProvince',
_b[7078913 /* Place */] = 'Place',
_b[7144448 /* Latitude */] = 'Latitude',
_b[7144706 /* Latitude_Decimal */] = 'Latitude_Decimal',
_b[7144707 /* Latitude_Double */] = 'Latitude_Double',
_b[7209984 /* Longitude */] = 'Longitude',
_b[7210242 /* Longitude_Decimal */] = 'Longitude_Decimal',
_b[7210243 /* Longitude_Double */] = 'Longitude_Double',
_b[13109259 /* Image */] = 'Image',
_b[13174785 /* ImageUrl */] = 'ImageUrl',
_b[13240321 /* WebUrl */] = 'WebUrl',
_b[13305856 /* Barcode */] = 'Barcode',
_b[13305857 /* Barcode_Text */] = 'Barcode_Text',
_b[13306116 /* Barcode_Integer */] = 'Barcode_Integer',
_b[19664897 /* Color */] = 'Color',
_b[19730433 /* FormatString */] = 'FormatString',
_b[20058113 /* Alignment */] = 'Alignment',
_b[20123649 /* LabelDisplayUnits */] = 'LabelDisplayUnits',
_b[20516865 /* DisplayUnitsWithoutAuto */] = 'DisplayUnitsWithoutAuto',
_b[20385793 /* FontFamily */] = 'FontFamily',
_b[20451329 /* AltText */] = 'AltText',
_b[20189443 /* FontSize */] = 'FontSize',
_b[26214401 /* Enumeration */] = 'Enumeration',
_b[26280196 /* FlagsEnumeration */] = 'FlagsEnumeration',
_b[32776193 /* ScriptSource */] = 'ScriptSource',
_b[65541 /* SearchEnabled */] = 'SearchEnabled',
_b[39337985 /* BookmarkRef */] = 'BookmarkRef',
_b[39534593 /* BookmarkGroupRef */] = 'BookmarkGroupRef',
_b[39403521 /* SectionRef */] = 'SectionRef',
_b[20582401 /* StylePreset */] = 'StylePreset',
_b[39469057 /* PerspectiveRef */] = 'PerspectiveRef',
_b[16384 /* Reference */] = 'Reference',
_b[14 /* Json */] = 'Json',
_b[13371406 /* Sparkline */] = 'Sparkline',
_b[39600129 /* RowRefText */] = 'RowRefText',
_b);
var ExtendedTypes = {
Numeric: 256 /* Numeric */,
Temporal: 512 /* Temporal */,
Geography: 1024 /* Geography */,
Miscellaneous: 2048 /* Miscellaneous */,
Formatting: 4096 /* Formatting */,
Scripting: 8192 /* Scripting */,
Null: 0 /* Null */,
Text: 1 /* Text */,
Decimal: 258 /* Decimal */,
Double: 259 /* Double */,
Integer: 260 /* Integer */,
Boolean: 5 /* Boolean */,
Date: 518 /* Date */,
DateTime: 519 /* DateTime */,
DateTimeZone: 520 /* DateTimeZone */,
Time: 521 /* Time */,
Duration: 10 /* Duration */,
Binary: 11 /* Binary */,
None: 12 /* None */,
Variant: 13 /* Variant */,
Years: 66048 /* Years */,
Years_Text: 66049 /* Years_Text */,
Years_Integer: 66308 /* Years_Integer */,
Years_Date: 66054 /* Years_Date */,
Years_DateTime: 66055 /* Years_DateTime */,
Months: 131584 /* Months */,
Months_Text: 131585 /* Months_Text */,
Months_Integer: 131844 /* Months_Integer */,
Months_Date: 131590 /* Months_Date */,
Months_DateTime: 131591 /* Months_DateTime */,
PaddedDateTableDates: 197127 /* PaddedDateTableDates */,
Quarters: 262656 /* Quarters */,
Quarters_Text: 262657 /* Quarters_Text */,
Quarters_Integer: 262916 /* Quarters_Integer */,
Quarters_Date: 262662 /* Quarters_Date */,
Quarters_DateTime: 262663 /* Quarters_DateTime */,
DayOfMonth: 328192 /* DayOfMonth */,
DayOfMonth_Text: 328193 /* DayOfMonth_Text */,
DayOfMonth_Integer: 328452 /* DayOfMonth_Integer */,
DayOfMonth_Date: 328198 /* DayOfMonth_Date */,
DayOfMonth_DateTime: 328199 /* DayOfMonth_DateTime */,
Address: 6554625 /* Address */,
City: 6620161 /* City */,
Continent: 6685697 /* Continent */,
Country: 6751233 /* Country */,
County: 6816769 /* County */,
Region: 6882305 /* Region */,
PostalCode: 6947840 /* PostalCode */,
PostalCode_Text: 6947841 /* PostalCode_Text */,
PostalCode_Integer: 6948100 /* PostalCode_Integer */,
StateOrProvince: 7013377 /* StateOrProvince */,
Place: 7078913 /* Place */,
Latitude: 7144448 /* Latitude */,
Latitude_Decimal: 7144706 /* Latitude_Decimal */,
Latitude_Double: 7144707 /* Latitude_Double */,
Longitude: 7209984 /* Longitude */,
Longitude_Decimal: 7210242 /* Longitude_Decimal */,
Longitude_Double: 7210243 /* Longitude_Double */,
Image: 13109259 /* Image */,
ImageUrl: 13174785 /* ImageUrl */,
WebUrl: 13240321 /* WebUrl */,
Barcode: 13305856 /* Barcode */,
Barcode_Text: 13305857 /* Barcode_Text */,
Barcode_Integer: 13306116 /* Barcode_Integer */,
Color: 19664897 /* Color */,
FormatString: 19730433 /* FormatString */,
Alignment: 20058113 /* Alignment */,
LabelDisplayUnits: 20123649 /* LabelDisplayUnits */,
DisplayUnitsWithoutAuto: 20516865 /* DisplayUnitsWithoutAuto */,
FontFamily: 20385793 /* FontFamily */,
AltText: 20451329 /* AltText */,
FontSize: 20189443 /* FontSize */,
Enumeration: 26214401 /* Enumeration */,
FlagsEnumeration: 26280196 /* FlagsEnumeration */,
ScriptSource: 32776193 /* ScriptSource */,
SearchEnabled: 65541 /* SearchEnabled */,
BookmarkRef: 39337985 /* BookmarkRef */,
BookmarkGroupRef: 39534593 /* BookmarkGroupRef */,
SectionRef: 39403521 /* SectionRef */,
StylePreset: 20582401 /* StylePreset */,
PerspectiveRef: 39469057 /* PerspectiveRef */,
Reference: 16384 /* Reference */,
Json: 14 /* Json */,
Sparkline: 13371406 /* Sparkline */,
RowRefText: 39600129 /* RowRefText */,
};
var PrimitiveTypeMask = 0xFF;
var PrimitiveTypeWithFlagsMask = 0xFFFF;
var PrimitiveTypeFlagsExcludedMask = 0xFFFF0000;
function getPrimitiveType(extendedType) {
return extendedType & PrimitiveTypeMask;
}
function isPrimitiveType(extendedType) {
return (extendedType & PrimitiveTypeWithFlagsMask) === extendedType;
}
function getCategoryFromExtendedType(extendedType) {
if (isPrimitiveType(extendedType))
return null;
var category = powerbi.ExtendedTypeNames[extendedType];
if (!category)
return null;
// Check for ExtendedType declaration without a primitive type.
// If exists, use it as category (e.g. Longitude rather than Longitude_Double)
// Otherwise use the ExtendedType declaration with a primitive type (e.g. Address)
var delimIdx = category.lastIndexOf('_');
if (delimIdx > 0) {
var baseCategory = category.slice(0, delimIdx);
if (baseCategory in ExtendedTypes) {
debug.assert((extendedType & PrimitiveTypeFlagsExcludedMask) === (extendedType & PrimitiveTypeFlagsExcludedMask), 'Unexpected value for ExtendedType base member of ' + extendedType);
category = baseCategory;
}
}
return category;
}
function toExtendedType(primitiveType, category) {
var primitiveString = powerbi.PrimitiveTypeNames[primitiveType];
var t = ExtendedTypes[primitiveString];
if (t == null) {
debug.assertFail('Unexpected primitiveType ' + primitiveType);
t = 0 /* Null */;
}
if (primitiveType && category) {
var categoryType = ExtendedTypes[category];
if (categoryType) {
var categoryPrimitiveType = getPrimitiveType(categoryType);
if (categoryPrimitiveType === 0 /* Null */) {
// Category supports multiple primitive types, check if requested primitive type is supported
// (note: important to use t here rather than primitiveType as it may include primitive type flags)
categoryType = t | categoryType;
if (powerbi.ExtendedTypeNames[categoryType]) {
debug.assert(powerbi.ExtendedTypeNames[categoryType] === (category + '_' + primitiveString), 'Unexpected name for ExtendedType member ' + categoryType);
t = categoryType;
}
}
else if (categoryPrimitiveType === primitiveType) {
// Primitive type matches the single supported type for the category
t = categoryType;
}
}
}
return t;
}
function matchesExtendedTypeWithAnyPrimitive(a, b) {
return (a & PrimitiveTypeFlagsExcludedMask) === (b & PrimitiveTypeFlagsExcludedMask);
}
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
function createEnumType(members) {
return new EnumType(members);
}
powerbi.createEnumType = createEnumType;
var EnumType = /** @class */ (function () {
function EnumType(allMembers) {
debug.assertValue(allMembers, 'allMembers');
this.allMembers = allMembers;
}
EnumType.prototype.members = function (validMembers) {
var allMembers = this.allMembers;
if (!validMembers)
return allMembers;
var membersToReturn = [];
for (var _i = 0, allMembers_1 = allMembers; _i < allMembers_1.length; _i++) {
var member = allMembers_1[_i];
if (_.includes(validMembers, member.value))
membersToReturn.push(member);
}
return membersToReturn;
};
return EnumType;
}());
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
var data;
(function (data) {
function createDisplayNameGetter(displayNameKey) {
return function (resourceProvider) { return resourceProvider.get(displayNameKey); };
}
data.createDisplayNameGetter = createDisplayNameGetter;
function getDisplayName(displayNameGetter, resourceProvider) {
if (typeof displayNameGetter === 'function')
return displayNameGetter(resourceProvider);
if (typeof displayNameGetter === 'string')
return displayNameGetter;
}
data.getDisplayName = getDisplayName;
})(data = powerbi.data || (powerbi.data = {}));
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
var data;
(function (data) {
var PrimitiveValueEncoding;
(function (PrimitiveValueEncoding) {
var SingleQuoteRegex = /'/g;
var DateTimeZeroMillisecondsRegex = /\.000$/;
function decimal(value) {
debug.assertValue(value, 'value');
return value + 'M';
}
PrimitiveValueEncoding.decimal = decimal;
function double(value) {
debug.assertValue(value, 'value');
return value + 'D';
}
PrimitiveValueEncoding.double = double;
function integer(value) {
debug.assertValue(value, 'value');
return value + 'L';
}
PrimitiveValueEncoding.integer = integer;
function text(value) {
debug.assertValue(value, 'value');
return "'" + value.replace(SingleQuoteRegex, "''") + "'";
}
PrimitiveValueEncoding.text = text;
function nullEncoding() {
return 'null';
}
PrimitiveValueEncoding.nullEncoding = nullEncoding;
function boolean(value) {
return value ? 'true' : 'false';
}
PrimitiveValueEncoding.boolean = boolean;
/**
* Converts a PrimitiveValue to TypeEncodedValue
* Server/DSE expects type encoded values in a Semantic Query
*/
function toTypeEncoded(value, type) {
if (value === null)
return nullEncoding();
var primitiveType = type.primitiveType;
switch (primitiveType) {
case 4 /* Integer */:
debug.assert(_.isString(value) || _.isNumber(value), "Expected either a string or number value to encode for type " + type);
return value + 'L';
case 2 /* Decimal */:
debug.assert(_.isString(value) || _.isNumber(value), "Expected either a string or number value to encode for type " + type);
return value + 'M';
case 3 /* Double */:
debug.assert(_.isString(value) || _.isNumber(value), "Expected either a string or number value to encode for type " + type);
return value + 'D';
case 7 /* DateTime */:
case 6 /* Date */:
var dateTimeString = void 0;
// If the string value was sent in the Dsr (v1 and non-optimized Dates in V2), we use that value directly in the else branch.
// When the dsr optimizes a DateTime as a number, we get the constructed Date object here rather than the number.
if (value instanceof Date) {
// The below conversion fails for datetime which lie in the 1 hour bucket when clocks switch ahead in any timezone which has daylight savings.
// Hence for core visuals, we save the epochtimestamp as well and in formattingservice, we regenerate the correct date and override getters to
// return UTC times. If we do have the epochTimestamp, use that to get the correct dates.
if (powerbi.isDateWithEpochValue(value)) {
var epochTimeStamp = value.epochTimeStamp;
dateTimeString = new Date(epochTimeStamp).toISOString();
}
else {
// with DsrV2, client can receive milliseconds since unix epoch which is UTC based
// When such a date is read, the date time value gets converted to local time zone based after its read.
// We add the time zone difference when reading the date to handle this. Hence re-adjust for the time zone when
// encoding it. While adjusting the time zone difference we use the UTC date timezone difference and account for
// cases of daylight saving time changes. The value here thus is equivalent to actual dsr utc values. Hence we do not
// need to do any additional adjustment here to timezonesoffset.
// getTimezoneOffset returns the difference in minutes between UTC and local time zone. getTime is in milliseconds.
// Hence the 60000 factor (60 sec/min * 1000 ms/sec).
dateTimeString = new Date(value.getTime() - value.getTimezoneOffset() * 60000).toISOString();
}
// If it ends with Z, we want to get rid of it, because with trailing Z, it will assume the dateTime is UTC, but we don't want any timeZone information, so
// we will drop it.
// Also, we need to add Prefix and Suffix to match the dsr value format for dateTime object.
// TODO: doesn't toISOString always convert to UTC based time and thus has Z ?
if (_.endsWith(dateTimeString, 'Z'))
dateTimeString = dateTimeString.substr(0, dateTimeString.length - 1);
// For DsrV2, the dates are returned in unix epoch and always have milliseconds. When returned as strings, they are
// optimized and do not contain milliseconds if 0. Hence for equality, we strip out the milliseconds if they are 0.
dateTimeString = dateTimeString.replace(DateTimeZeroMillisecondsRegex, "");
}
else {
debug.assert(_.isString(value), "Expected a string or a Date value for type " + type);
dateTimeString = value;
}
return "datetime'" + dateTimeString + "'";
case 1 /* Text */:
debug.assert(_.isString(value), "Expected a string value to encode for type " + type);
return text(value);
case 5 /* Boolean */:
debug.assert(_.isBoolean(value), "Expected boolean values for type " + type);
return boolean(value);
case 13 /* Variant */:
debug.assert(_.isString(value), "Expected string values to encode for type " + type);
return value;
default:
debug.assertFail("unsupported dsrValue for type " + type);
}
}
PrimitiveValueEncoding.toTypeEncoded = toTypeEncoded;
})(PrimitiveValueEncoding = data.PrimitiveValueEncoding || (data.PrimitiveValueEncoding = {}));
})(data = powerbi.data || (powerbi.data = {}));
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
var data;
(function (data) {
var segmentation;
(function (segmentation) {
var DataViewMerger;
(function (DataViewMerger) {
function mergeDataViews(source, segment) {
if (!source.matrix) {
// Only Matrix allows different number of columns between segments
// This happens if the new segment was retrieved after an Expand/Collapse action that changed number of levels
debug.assert(powerbi.DataViewUtils.isMetadataEquivalent(source.metadata, segment.metadata), "Cannot merge data views with different metadata columns");
}
if (!segment.metadata.segment) {
// The last segment is complete. We mark the source as complete.
delete source.metadata.segment;
}
else {
// If the Segment has more data, we mark the source as incomplete
// This can happen if we triggered LoadMore after an Expansion, where the original DataView was complete
source.metadata.segment = segment.metadata.segment;
}
if (source.table && segment.table)
mergeTables(source.table, segment.table);
if (source.categorical && segment.categorical)
mergeCategorical(source.categorical, segment.categorical);
// Tree cannot support subtotals hence we can get into situations
// where a node has no children in one segment and more than 1 child
// in another segment.
if (source.tree && segment.tree)
mergeTreeNodes(source.tree.root, segment.tree.root, true /*allowDifferentStructure*/);
if (source.matrix && segment.matrix) {
// When merging after an Expand/Collapse action that affected number of active projections,
// we may end up with a segment having a different number of levels.
// If we add levels (Expand), we need to add Total child nodes to source segment to indicate they are Collapsed nodes
// If we remove levels (Collapse), this means that all nodes in source segment were Collapsed, so we can safely remove their child Total nodes
debug.assertValue(source.matrix.rows, "source.matrix.rows");
debug.assertValue(source.matrix.rows.levels, "source.matrix.rows.levels");
debug.assertValue(segment.matrix.rows, "segment.matrix.rows");
debug.assertValue(segment.matrix.rows.levels, "segment.matrix.rows.levels");
debug.assertValue(source.metadata, "source.metadata");
debug.assertValue(source.metadata.columns, "source.metadata.columns");
debug.assertValue(segment.metadata, "segment.metadata");
debug.assertValue(segment.metadata.columns, "segment.metadata.columns");
var sourceLevelsCount = source.matrix.rows.levels.length;
var segmentLevelsCount = segment.matrix.rows.levels.length;
if (sourceLevelsCount > segmentLevelsCount) {
// We remove columns that do not exist in the segment data view.
_.remove(source.metadata.columns, (function (column) { return column.index != null
&& !_.some(segment.metadata.columns, (function (source) { return source.index === column.index; })); }));
source.metadata.columns.length = segment.metadata.columns.length;
collapseMatrix(source.matrix.rows, segment.matrix.rows);
}
else if (sourceLevelsCount < segmentLevelsCount) {
// Select indices always match and in the same order because those are all the selects and not
// only the active selects of the query. This means we can use indexes
// to find missing levels sources.
var missingColumns = _.filter(segment.metadata.columns, (function (column) { return column.index != null
&& !_.some(source.metadata.columns, (function (source) { return source.index === column.index; })); }));
var index = 0;
for (var _i = 0, missingColumns_1 = missingColumns; _i < missingColumns_1.length; _i++) {
var column = missingColumns_1[_i];
// we also need to skip any dynamic formatting columns
// which do not have any indexes.
while (index < source.metadata.columns.length
&& (source.metadata.columns[index].index == null || source.metadata.columns[index].index < column.index)) {
index++;
}
source.metadata.columns.splice(index, 0, column);
}
expandMatrix(source.matrix.rows, segment.matrix.rows);
}
mergeTreeNodes(source.matrix.rows.root, segment.matrix.rows.root, sourceLevelsCount !== segmentLevelsCount /*allowDifferentStructure*/);
}
}
DataViewMerger.mergeDataViews = mergeDataViews;
/** Note: Public for testability */
function mergeTables(source, segment) {
debug.assertValue(source, 'source');
debug.assertValue(segment, 'segment');
if (_.isEmpty(segment.rows))
return;
var mergeIndex = segment.lastMergeIndex + 1;
merge(source.rows, segment.rows, mergeIndex);
debug.assert(!source.identity === !segment.identity, 'The existence of identity in the new segment is different than the source');
if (segment.identity)
merge(source.identity, segment.identity, mergeIndex);
}
DataViewMerger.mergeTables = mergeTables;
/**
* Merge categories values and identities
*
* Note: Public for testability
*/
function mergeCategorical(source, segment) {
debug.assertValue(source, 'source');
debug.assertValue(segment, 'segment');
debug.assert(_.size(source.categories) === _.size(segment.categories), "pre-condition: source categories and segment categories should have the same length");
debug.assert(_.every(source.categories, (function (category) { return source.categories[0].identity === category.identity; })), 'pre-condition: the identity property of all category columns are expected to be the same array object');
// Merge categories values and identities
if (!_.isEmpty(source.categories) && !_.isEmpty(segment.categories)) {
var mergeIndex = segment.lastMergeIndex + 1;
var segmentCategoriesLength = segment.categories.length;
for (var categoryIndex = 0; categoryIndex < segmentCategoriesLength; categoryIndex++) {
var segmentCategory = segment.categories[categoryIndex];
var sourceCategory = source.categories[categoryIndex];
debug.assert(powerbi.DataViewUtils.areMetadataColumnsEquivalent(sourceCategory.source, segmentCategory.source), "Source and segment category have different sources.");
debug.assert(sourceCategory.values === undefined ? sourceCategory.identity === undefined : true, 'Source category is missing values but has identities.');
if (segmentCategory.values) {
merge(sourceCategory.values, segmentCategory.values, mergeIndex);
}
}
// the identity property of all category columns are expected to be the same array object,
// hence merge it at most once and only on the first category column
if (segment.categories[0].identity) {
merge(source.categories[0].identity, segment.categories[0].identity, mergeIndex);
}
}
// Merge values for each value column
if (source.values && segment.values) {
var segmentValuesLength = segment.values.length;
debug.assert(source.values.length === segmentValuesLength, "Source and segment values have different lengths.");
for (var valueIndex = 0; valueIndex < segmentValuesLength; valueIndex++) {
var segmentValue = segment.values[valueIndex];
var sourceValue = source.values[valueIndex];
debug.assert(powerbi.DataViewUtils.areMetadataColumnsEquivalent(sourceValue.source, segmentValue.source), "Source and segment value have different sources.");
if (!sourceValue.values && segmentValue.values) {
sourceValue.values = [];
}
var mergeIndex = segment.lastMergeIndex + 1;
if (segmentValue.values) {
merge(sourceValue.values, segmentValue.values, mergeIndex);
}
if (segmentValue.highlights) {
merge(sourceValue.highlights, segmentValue.highlights, mergeIndex);
}
}
}
}
DataViewMerger.mergeCategorical = mergeCategorical;
/**
* Merges the segment array starting at the specified index into the source array
* and returns the segment slice that wasn't merged.
* The segment array is spliced up to specified index in the process.
*/
function merge(source, segment, index) {
if (index >= segment.length)
return segment;
var result = [];
if (index !== undefined)
result = segment.splice(0, index);
Array.prototype.push.apply(source, segment);
return result;
}
/** Note: Public for testability */
function mergeTreeNodes(sourceRoot, segmentRoot, allowDifferentStructure) {
debug.assertValue(sourceRoot, 'sourceRoot');
debug.assertValue(segmentRoot, 'segmentRoot');
if (!segmentRoot.children || segmentRoot.children.length === 0)
return;
if (allowDifferentStructure && (!sourceRoot.children || sourceRoot.children.length === 0)) {
sourceRoot.children = segmentRoot.children;
return;
}
debug.assert(sourceRoot.children && sourceRoot.children.length >= 0, "Source tree has different structure than segment.");
var firstAppendIndex = findFirstAppendIndex(segmentRoot.children);
var lastSourceChild = sourceRoot.children[sourceRoot.children.length - 1];
var mergedChildren = merge(sourceRoot.children, segmentRoot.children, firstAppendIndex);
if (mergedChildren.length > 0)
mergeTreeNodes(lastSourceChild, mergedChildren[mergedChildren.length - 1], allowDifferentStructure);
}
DataViewMerger.mergeTreeNodes = mergeTreeNodes;
function findFirstAppendIndex(children) {
if (children.length === 0)
return 0;
var i = 0;
for (; i < children.length; i++) {
var childSegment = children[i];
if (!childSegment.isMerge)
break;
}
return i;
}
/**
* Attempt to remove all Nodes in-place from a Hierarchy starting from a given Node.
* Node is identified by index per level.
* Return true if successful
*/
function pruneTree(root, pruneAfter) {
debug.assertValue(root, 'dataViewMerger.pruneTree - root');
debug.assertNonEmpty(pruneAfter, 'dataViewMerger.pruneTree - Zero-depth index');
var nodes;
for (var _i = 0, pruneAfter_1 = pruneAfter; _i < pruneAfter_1.length; _i++) {
var nodeIndex = pruneAfter_1[_i];
nodes = root.children;
if (_.isEmpty(nodes)) {
// Subtree ended prematurely
// This can happen when the Segment information was built with more levels than current
return true;
}
if (nodeIndex >= nodes.length) {
// Index out of bounds
return false;
}
// Removing all Nodes after the node index
nodes.length = nodeIndex + 1;
root = _.last(nodes);
}
return true;
}
DataViewMerger.pruneTree = pruneTree;
/**
* Update the index of last Node of the Segment
*/
function updateTreeLastNodeIndex(newSegmentRoot, lastIndex) {
var nodes = newSegmentRoot.children;
debug.assertNonEmpty(newSegmentRoot.children, 'Empty segment');
var level = 0;
var wasParentMerged = true;
while (!_.isEmpty(nodes)) {
var firstAppendedIndex = findFirstAppendIndex(nodes);
if (firstAppendedIndex >= nodes.length) {
// No nodes will be appended. Do not update lastIndex on this level
wasParentMerged = true;
}
else {
// Some nodes were appended. If parent was merged, increase lastIndex, else set it
var appendedNodesCount = nodes.length - firstAppendedIndex;
if (wasParentMerged) {
if (lastIndex[level] === undefined)
lastIndex[level] = appendedNodesCount - 1;
else
lastIndex[level] += appendedNodesCount;
}
else {
lastIndex[level] = appendedNodesCount - 1;
}
wasParentMerged = false;
}
nodes = _.last(nodes).children;
level++;
}
// If lastIndex has more items, remove them
if (level < lastIndex.length)
lastIndex.length = level;
}
DataViewMerger.updateTreeLastNodeIndex = updateTreeLastNodeIndex;
function collapseMatrix(source, segment) {
var targetDepth = segment.levels.length;
// Remove extra levels
source.levels.length = targetDepth;
debug.assert(_.isEqual(source.levels, segment.levels), 'Segments have different levels');
/*
Get all nodes from the Source segment at the targetDepth
They are expected to all be Collapsed nodes (each having a single subtotal node)
*/
var leaves = [];
getNodesAtLevel(source.root.children, targetDepth - 1, leaves);
for (var _i = 0, leaves_1 = leaves; _i < leaves_1.length; _i++) {
var node = leaves_1[_i];
collapseNode(node);
}
}
function collapseNode(node) {
if (_.isEmpty(node.children))
return;
// Move the values from the subtotal child to self
var subtotalChild = _.find(node.children, (function (child) { return child.isSubtotal; }));
// There are cases where we couldn't find a subtotal among the children. It can happen that
// we will never get a subtotal because the subtotal for this level was turned off in the backend.
// In that case we could have a fallback to say if there is only 1 non total child, get the value of that.
if (subtotalChild)
node.values = subtotalChild.values;
// Remove the children
delete node.children;
delete node.childIdentityFields;
}
function expandMatrix(source, segment) {
var targetDepth = segment.levels.length;
var sourceDepth = source.levels.length;
// Add extra levels
for (var i = sourceDepth; i < targetDepth; i++) {
source.levels.push(segment.levels[i]);
}
debug.assert(_.isEqual(source.levels, segment.levels), 'Segments have different levels');
/*
Add a Total child to all leaf nodes.
If the first branch on the new Segment is going to be merged,
we should not add a Total child to the last leaf node of the original segment.
because there will be a total node on the next segment or a subsequent one
Example:
Segment:
1992 Q1
Q2
Q3
Q4
Total
1993 Q1
Q2
Q3
Q4
Total
Source:
1990
1991
1992
We should not add a Total to 1992, as there is expected a Total on the subsequent segments
*/
var leafNodes = [];
getNodesAtLevel(source.root.children, sourceDepth - 1, leafNodes);
for (var _i = 0, leafNodes_1 = leafNodes; _i < leafNodes_1.length; _i++) {
var leafNode = leafNodes_1[_i];
expandNode(leafNode, sourceDepth);
}
if (isFirstBranchMerged(segment, sourceDepth)) {
// Remove the added subtotal child because the merged segment has a Subtotal
// However, a subtotal is not guaranteed to be part of the current merged segment
// and could be part of a subsequent segment. In that case we rely on rerunning this codepath
// for a subsequent segment.
delete _.last(leafNodes).children;
}
}
function expandNode(node, expectedLeafDepth) {
if (node.isSubtotal) {
// Subtotal nodes can be at any depth, they shouldn't be modified
return;
}
debug.assert(node.level === expectedLeafDepth - 1, 'Leaf was found on a non-last level');
debug.assert(_.size(node.children) === 0, 'Node has children');
// Add a Subtotal Child and move Values to it
node.children = [{
isSubtotal: true,
level: expectedLeafDepth,
values: node.values,
}];
delete node.values;
}
function getNodesAtLevel(nodes, level, result) {
debug.assertValue(nodes, "nodes");
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
var node = nodes_1[_i];
if (node.isSubtotal) {
// Subtotal nodes can be at any depth, they shouldn't be modified
continue;
}
if (node.level === level) {
result.push(node);
}
else if (!_.isEmpty(node.children) && (node.level !== undefined && node.level < level)) {
// Recurse into the children if we haven't gone beyond the level and there are children to visit.
getNodesAtLevel(node.children, level, result);
}
}
}
/**
* Checks if the first branch of the segment up to a certain depth will be merged
*/
function isFirstBranchMerged(segment, depth) {
var node = segment.root;
for (var level = 0; level < depth; level++) {
if (_.isEmpty(node.children))
return false;
node = node.children[0];
debug.assertValue(node, 'Segment has fewer levels than expected');
if (!node.isMerge || node.isSubtotal)
return false;
}
return true;
}
})(DataViewMerger = segmentation.DataViewMerger || (segmentation.DataViewMerger = {}));
})(segmentation = data.segmentation || (data.segmentation = {}));
})(data = powerbi.data || (powerbi.data = {}));
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var powerbi;
(function (powerbi) {
var DataViewUtils;
(function (DataViewUtils) {
function areMetadataColumnsEquivalent(column1, column2) {
if (!column1 && !column2)
return true;
if (!column1 || !column2)
return false;
if (column1.displayName !== column2.displayName)
return false;
if (column1.queryName !== column2.queryName)
return false;
if (column1.isMeasure !== column2.isMeasure)
return false;
if (column1.type !== column2.type)
return false;
if (column1.sort !== column2.sort)
return false;
return true;
}
DataViewUtils.areMetadataColumnsEquivalent = areMetadataColumnsEquivalent;
/* Returns true if the metadata columns at the same positions in the array are equivalent. */
function isMetadataEquivalent(metadata1, metadata2) {
if (!metadata1 && !metadata2)
return true;
if (!metadata1 || !metadata2)
return false;
var previousColumnsLength = metadata1.columns.length;
var newColumnsLength = metadata2.columns.length;
if (previousColumnsLength !== newColumnsLength)
return false;
for (var i = 0; i < newColumnsLength; i++) {
if (!DataViewUtils.areMetadataColumnsEquivalent(metadata1.columns[i], metadata2.columns[i]))
return false;
}
return true;
}
DataViewUtils.isMetadataEquivalent = isMetadataEquivalent;
function isDataViewValueColumnGroup(column) {
return column && column.values && column.values[0] && !!column.values[0].values;
}
DataViewUtils.isDataViewValueColumnGroup = isDataViewValueColumnGroup;
function isDataViewCategoryColumnList(column) {
return column && column.length !== undefined;
}
DataViewUtils.isDataViewCategoryColumnList = isDataViewCategoryColumnList;
function hasDataViewKind(dataView, kinds) {
debug.assert(kinds !== 0 /* None */);
if (!dataView)
return false;
if ((kinds & 1 /* Categorical */) && dataView.categorical)
return true;
if ((kinds & 2 /* Matrix */) && dataView.matrix)
return true;
if ((kinds & 4 /* Single */) && dataView.single)
return true;
if ((kinds & 8 /* Table */) && dataView.table)
return true;
if ((kinds & 16 /* Tree */) && dataView.tree)
return true;
return false;
}
DataViewUtils.hasDataViewKind = hasDataViewKind;
})(DataViewUtils = powerbi.DataViewUtils || (powerbi.DataViewUtils = {}));
})(powerbi || (powerbi = {}));
this.parseTimeMarkers = this.parseTimeMarkers || {};
var marker = this.parseTimeMarkers['customVisualsCore.bundle.min.js'] || (this.parseTimeMarkers['customVisualsCore.bundle.min.js'] = {});
marker.endEval = window.jsCommon && window.jsCommon.performance && window.jsCommon.performance.now ? window.jsCommon.performance.now() : Date.now(); marker.isExternal = false;
;
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var Base64Utils;
(function (Base64Utils) {
/** Check if input is valid base64 string. */
function isBase64(text) {
try {
return btoa(atob(text)) === text;
}
catch (err) {
return false;
}
}
Base64Utils.isBase64 = isBase64;
})(Base64Utils = jsCommon.Base64Utils || (jsCommon.Base64Utils = {}));
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var UnionExtensions;
(function (UnionExtensions) {
/**
* Merges objects representing parts of a union type into a single object.
* arg1 may be modified during the merge.
*/
function mergeUnionType(arg1, arg2, arg3) {
if (!arg1 && !arg2 && !arg3)
return;
// In most cases, our union types are used in a mutually exclusive way,
// so only one object will be populated.
if (arg1 && !arg2 && !arg3)
return arg1;
if (!arg1 && arg2 && !arg3)
return arg2;
if (!arg1 && !arg2 && arg3)
return arg3;
return $.extend(arg1, arg2, arg3);
}
UnionExtensions.mergeUnionType = mergeUnionType;
})(UnionExtensions = jsCommon.UnionExtensions || (jsCommon.UnionExtensions = {}));
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
/**
* A simple cache with a FIFO eviction policy.
*
* Implementation details:
* We use a dictionary to accomplish most of our caching needs. (this.cache)
* However, we also track insertion order using a doubly-linked list - required for FIFO eviction. (this.linkedList)
* The overall solution is a dictionary where the key is a string, and the value is a pointer to a node in a doubly-linked list.
* As items are put into the cache, we update our dictionary and insert those items as nodes at the head of the list.
* If our cache is full and we try to insert more items, we can make room for the new items by evicting from the tail of the list.
* This solution allows all operations, including cache eviction to happen in O(1) time.
*
* @example -
* Consider a cache with a capacity of 2 and the following usage:
* Put(1) - Adds 1 to the cache, cache is now size 1 (contains [1])
* Put(2) - Adds 2 to the cache, cache is now size 2 (contains [1,2])
* Put(3) - Add 3 to the cache, cache is now size 3 (contains [1,2,3])
* Since size is now greater than capacity, we need to evict an item.
* The FIFO policy means we will evict the first item that was added (1).
* After eviction, the cache is size 2 (contains [2,3])
*/
var FifoCache = /** @class */ (function () {
function FifoCache(size) {
this.cache = {};
this.capacity = size;
this.linkedList = new powerbi.LinkedList();
}
/**
* Return the value corresponding to the given key in the cache.
* If the specified key is not currently in the cache, returns undefined.
*/
FifoCache.prototype.get = function (key) {
if (key in this.cache) {
var cacheEntry = this.cache[key].value;
return cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.value;
}
};
/**
* Removes the item with the specified key from the cache.
*/
FifoCache.prototype.remove = function (key) {
if (!this.cache[key]) {
return;
}
var nodeToRemove = this.cache[key];
this.linkedList.remove(nodeToRemove);
delete this.cache[key];
};
/**
* Adds the given key/value to the cache.
* If the key already exists in the cache, removes the existing entry.
* If consumers would like to prevent removal if there is already a cache entry, they can check via this.containsKey() before attemping to call put().
* If the put would result in the cache exceeding it's capacity, we will evict the cache entry at the tail.
*/
FifoCache.prototype.put = function (key, value) {
if (key in this.cache) {
this.remove(key);
}
var newCacheEntry = new CacheEntry(key, value);
var nodeToAdd = new powerbi.LinkedListNode(newCacheEntry);
this.cache[key] = nodeToAdd;
this.linkedList.insertToHead(nodeToAdd);
if (this.size() > this.capacity) {
debug.assert(this.size() === this.capacity + 1, "cache has exceeded expected maximum capacity");
var tailNode = this.linkedList.tail();
var cacheEntryToEvict = tailNode.value;
delete this.cache[cacheEntryToEvict.key];
this.linkedList.removeFromTail();
}
};
/**
* Returns true iff the specified key is in the cache.
*/
FifoCache.prototype.containsKey = function (key) {
return key in this.cache;
};
/**
* Returns the number of items currently in the cache.
*/
FifoCache.prototype.size = function () {
return this.keys().length;
};
/**
* Returns a list of all keys currently in the cache.
*/
FifoCache.prototype.keys = function () {
return Object.keys(this.cache);
};
/**
* Returns true iff the cache is full.
*/
FifoCache.prototype.isFull = function () {
return this.size() === this.capacity;
};
return FifoCache;
}());
powerbi.FifoCache = FifoCache;
/**
* A cache with an LRU eviction policy.
*
* Implementation details:
* We use a dictionary to accomplish most of our caching needs. (this.cache)
* However, we also track order using a doubly-linked list - which tracks the order that an item was used. (this.linkedList)
* The overall solution is a dictionary where the key is a string, and the value is a pointer to a node in a doubly-linked list.
* As items are put into or accessed from the cache, we update our dictionary and insert those items as nodes at the head of the list.
* If our cache is full and we try to insert more items, we can make room for the new items by evicting from the tail of the list.
* If at any point in the above process we access a value in the cache, we need to move that node to the head of the list.
* This solution allows all operations, including cache eviction to happen in O(1) time.
*
* @example -
* Consider a cache with a capacity of 2 and the following usage:
* Put(1) - Adds 1 to the cache, cache is now size 1 (contains [1])
* Put(2) - Adds 2 to the cache, cache is now size 2 (contains [1,2])
* Get(1) - Accesses the value associated with 1. (cache is reordered to [2,1])
* Put(3) - Add 3 to the cache, cache is now size 3 (contains [2,1,3])
* Since size is now greater than capacity, we need to evict an item.
* The LRU policy means we will evict the least-recently used item (2).
* After eviction, the cache is size 2 (contains [1,3])
*/
var LruCache = /** @class */ (function () {
function LruCache(size) {
this.cache = {};
this.capacity = size;
this.linkedList = new powerbi.LinkedList();
}
/**
* Given a key, returns the value stored in the cache.
* @param key - Lookup key used to find associated value in the cache.
*/
LruCache.prototype.get = function (key) {
if (key in this.cache) {
// Anytime we use a node, move it to the head of the list.
// This ensures that the head will contain the most-recently used
// and the tail will be the least-recently used.
var nodeToMove = this.cache[key];
this.linkedList.remove(nodeToMove);
this.linkedList.insertToHead(nodeToMove);
var cacheEntry = nodeToMove.value;
return cacheEntry.value;
}
};
/**
* Given a key, removes the cache entry associated with that key from the cache.
* @param key - The entry we want to remove from the cache
*/
LruCache.prototype.remove = function (key) {
if (!(key in this.cache)) {
return;
}
var nodeToRemove = this.cache[key];
this.linkedList.remove(nodeToRemove);
delete this.cache[key];
};
/**
* Stores an item (value) into the cache associated with a given key (key).
* @param key - The key where we would like to store the given value
* @param value - The item we would like to store in the cache.
*/
LruCache.prototype.put = function (key, value) {
if (key in this.cache) {
this.remove(key);
}
var newCacheEntry = new CacheEntry(key, value);
var nodeToAdd = new powerbi.LinkedListNode(newCacheEntry);
this.cache[key] = nodeToAdd;
this.linkedList.insertToHead(nodeToAdd);
if (this.size() > this.capacity) {
debug.assert(this.size() === this.capacity + 1, "cache has exceeded expected maximum capacity");
var tailNode = this.linkedList.tail();
var cacheEntryToEvict = tailNode.value;
delete this.cache[cacheEntryToEvict.key];
this.linkedList.removeFromTail();
}
};
/**
* Returns true iff the specified key is in the cache.
*/
LruCache.prototype.containsKey = function (key) {
return key in this.cache;
};
/**
* Returns the number of items currently in the cache.
*/
LruCache.prototype.size = function () {
return this.keys().length;
};
/**
* Returns a list of all keys currently in the cache.
*/
LruCache.prototype.keys = function () {
return Object.keys(this.cache);
};
/**
* Returns true iff the cache is full.
*/
LruCache.prototype.isFull = function () {
return this.size() === this.capacity;
};
return LruCache;
}());
powerbi.LruCache = LruCache;
var CacheEntry = /** @class */ (function () {
function CacheEntry(key, value) {
this.key = key;
this.value = value;
}
return CacheEntry;
}());
})(powerbi || (powerbi = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var ModalDialogNotificationType;
(function (ModalDialogNotificationType) {
ModalDialogNotificationType[ModalDialogNotificationType["Info"] = 0] = "Info";
ModalDialogNotificationType[ModalDialogNotificationType["Warning"] = 1] = "Warning";
ModalDialogNotificationType[ModalDialogNotificationType["SecurityWarning"] = 2] = "SecurityWarning";
})(ModalDialogNotificationType = jsCommon.ModalDialogNotificationType || (jsCommon.ModalDialogNotificationType = {}));
jsCommon.PowerBIDefaultHelpPage = 'https://support.powerbi.com';
var AnimationSpeedMs = 250;
var CopySuccessFadeTimeout = 3000;
var modalDialogClassSelector = '.' + "infonav-modalDialog" /* modalDialog */;
var dialogTitleClassSelector = '.' + "infonav-dialogTitle" /* dialogTitle */;
var dialogCloseIconClassSelector = '.' + "infonav-dialogCloseIcon" /* dialogCloseIcon */;
var dialogContentClassSelector = '.' + "infonav-dialogContent" /* dialogContent */;
var dialogActionsClassSelector = '.' + "infonav-dialogActions" /* dialogActions */;
var dialogNotificationIconClassSelector = '.' + "glyphicon" /* dialogNotificationIcon */;
var dialogContentNotificationTextClassSelector = '.' + "infonav-dialogContentNotificationText" /* dialogContentNotificationText */;
var modalDialogContainerHostClassName = 'infonav-modalContainerHost';
var modalDialogContainerHostClassSelector = '.' + modalDialogContainerHostClassName;
var modalDialogHtmlMessageClassSelector = '.' + "dialogMessage" /* dialogHtmlMessage */;
var modalDialogAriaDescribeById = 'infonav-describedBy';
var ModalDialogHtml = '<div tabindex="0" prevent-focus-loss="true" focus-nav-mode="Group" class="infonav-modalContainer' + (location.search.indexOf('renderAsModalDialog') !== -1 ? ' small' : '') + '">' +
'<div class="' + "infonav-modalDialog" /* modalDialog */ + '" tabindex="-1">' +
'<div class="infonav-dialogLayout themeableElement">' +
'<div class="' + "infonav-dialogTitle" /* dialogTitle */ + '" id=' + modalDialogAriaDescribeById + ' role="heading" aria-level="1"></div>' +
'<input type="button" class="' + "infonav-dialogCloseIcon" /* dialogCloseIcon */ + '"></input>' +
'<div class="' + "infonav-dialogContent" /* dialogContent */ + '">' +
'<div class="' + "infonav-dialogActions" /* dialogActions */ + '"></div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
var notificationForModalDialogHtml = '<div class="' + "infonav-dialogContentNotification" /* dialogContentNotification */ + '">' +
'<span class="' + "glyphicon" /* dialogNotificationIcon */ + '"></span>' +
'<span class= "' + "infonav-dialogContentNotificationText" /* dialogContentNotificationText */ + '" > </span>' +
'</div>';
var NewButtonSelector = '<input type="button"></input>';
var checkboxSelector = '<input type="checkbox"></input>';
var checkboxLabelSelectorOpen = '<label class="' + "form-label" /* dialogCheckboxLabel */ + '">';
var checkboxLabelSelectorClose = '</label>';
/** The modal dialog client side control */
var ModalDialog = /** @class */ (function () {
/**
* ModalDialog is currently used for showing initialization error messages and hence
* we need to be careful about what code do we put here.
*/
function ModalDialog(dialogHost, localizationMap) {
this.dialogHost = dialogHost;
this.localizationMap = localizationMap;
this.messageQueue = [];
this.isReady = false;
this.messageCurrentlyShown = false;
this.initialized = false;
}
/**
* @deprecated this is only needed when a modal removes all its input elements without being hidden
* causing it to lose focus. You should not need this.
*/
ModalDialog.prototype.refocus = function () {
this.modalContainer.focus();
};
/**
* Displays a dismissable message to the user
* The only action available to the user is "Close"
* @param messageTitle - The title of the dialog
* @param messageText - The message to display to the user
*/
ModalDialog.prototype.showMessage = function (messageTitle, messageText, buttonText, learnMoreLink) {
var _this = this;
this.ensureInitialized();
var actions = [];
var cssClass = 'primary';
var dialogContent;
if (!buttonText)
buttonText = this.localizationMap ? this.localizationMap.closePromptText : InJs.UnlocalizedStrings.dialogCloseActionLabel;
if (learnMoreLink) {
var link = $('<a target="_blank"></a>').text(learnMoreLink.label).attr('href', learnMoreLink.url);
dialogContent = $('<div></div>').text(messageText + ' ').append(link);
messageText = undefined;
}
actions[0] = this.createButton(buttonText, (function () {
_this.hideDialog();
}), null, cssClass);
this.pushMessage(messageTitle, messageText, dialogContent, actions, true);
};
/**
* Displays a customizable prompt to the user
* @param promptTitle - The tile of the prompt dialog
* @param promptText - The message to display to the user
* @param promptActions - An array of ModalDialogAction objects describing the possible actions in the prompt
* @param isDismissable - Whether the dialog should include a close button
*/
ModalDialog.prototype.showPrompt = function (promptTitle, promptText, promptActions, isDismissable) {
this.ensureInitialized();
var actionButtons = new Array();
for (var i = 0; i < promptActions.length; i++) {
var thisAction = promptActions[i];
var cssClass = thisAction.cssClass;
if (i === 0) {
cssClass = cssClass + ' primary';
}
actionButtons[i] = this.createButton(thisAction.labelText, thisAction.actionCallback, thisAction.data, cssClass, thisAction.disabled);
}
this.pushMessage(promptTitle, promptText, undefined, actionButtons, !!isDismissable);
};
/**
* Displays an error message to the user
* @param errorText - The message to display to the user
* @param errorType - The type of error be displayed to the user
* @param request - The (optional) request that triggered the error for showing additional technical details
*/
// TODO Fix Explicit Any
ModalDialog.prototype.showError = function (errorText, errorType, additionalErrorInfo, afterDismissCallback, dialogOptions) {
this.showCustomError(InJs.UnlocalizedStrings.errorDialogTitle, errorText, errorType, errorType !== jsCommon.TraceType.Fatal, additionalErrorInfo, afterDismissCallback, dialogOptions);
};
/**
* Displays an error message to the user
* @param errorTitle - The title to display to the user
* @param errorText - The message to display to the user
* @param errorType - The type of error be displayed to the user
* @param request - The (optional) request that triggered the error for showing additional technical details
*/
ModalDialog.prototype.showCustomError = function (errorTitle, errorText, errorType, isDismissable, additionalErrorInfo,
// TODO Fix Explicit Any
afterDismissCallback, dialogOptions, helpLink,
// TODO Fix Explicit Any
onDialogClosed, jQueryMessage, customErrorDialogHelperText, dialogCssClass, containerCssClass) {
var _this = this;
this.ensureInitialized();
var actions = new Array();
if (dialogOptions) {
dialogOptions.forEach((function (element) {
actions.push(_this.createButton(element.label, (function () {
_this.hideDialog();
if ($.isFunction(afterDismissCallback)) {
afterDismissCallback(element.resultValue);
}
}), null, element.cssClass, element.disabled));
}));
}
else if (errorType !== jsCommon.TraceType.Fatal) {
actions[0] = this.createButton(this.localizationMap ? this.localizationMap.closePromptText : InJs.UnlocalizedStrings.dialogCloseActionLabel, (function () {
_this.hideDialog();
if ($.isFunction(afterDismissCallback)) {
afterDismissCallback(0);
}
}));
}
else {
actions[0] = this.createButton(this.localizationMap ? this.localizationMap.refreshPagePromptText : InJs.UnlocalizedStrings.dialogRefreshPageActionLabel, (function () {
window.location.reload();
}), null, 'primary');
}
var dialogContent;
if (jQueryMessage) {
dialogContent = $('<div></div>').append(jQueryMessage);
}
else {
dialogContent = $('<div></div>').text(errorText);
}
var dialogFooter = $('<div></div>').addClass("infonav-dialogFooter" /* dialogFooter */);
var errorHelperText;
if (!_.isEmpty(additionalErrorInfo)) {
errorHelperText = this.localizationMap && this.localizationMap.errorDialogHelperText ? this.localizationMap.errorDialogHelperText : InJs.UnlocalizedStrings.errorDialogHelperText;
if (customErrorDialogHelperText)
errorHelperText = customErrorDialogHelperText;
dialogContent.append($('<br/>')).append(errorHelperText);
// If we have additional error details, add the Copy to Clipboard button next to the help link
var copyText_1 = this.localizationMap ? this.localizationMap.copyPromptText : InJs.UnlocalizedStrings.CopyActionLabel;
var copySuccessText_1 = this.localizationMap ? this.localizationMap.copySuccessText : InJs.UnlocalizedStrings.SuccessActionLabel;
var errorDetails_1 = {
title: errorTitle,
message: jQueryMessage ? jQueryMessage.text() : errorText,
helperText: errorHelperText,
additionalErrorInfo: additionalErrorInfo,
};
var copyClipboardButton_1 = $("<button></button>")
.text(copyText_1)
.addClass("modalCopyToClipboard")
.click((function () {
if (_this.tryCopyToClipboard(errorDetails_1)) {
copyClipboardButton_1.text(copySuccessText_1).addClass("modalCopySuccess");
setTimeout((function () {
copyClipboardButton_1.text(copyText_1).removeClass("modalCopySuccess");
}), CopySuccessFadeTimeout);
}
}));
dialogFooter.prepend(copyClipboardButton_1);
}
this.addAdditionalErrorInfo(dialogContent, additionalErrorInfo, this.localizationMap ? this.localizationMap.showTechnicalDetailsText : InJs.UnlocalizedStrings.showDetailsText);
if (helpLink) {
// if help link exists and is not the default link, add the get help button as the first button
if (helpLink.url !== jsCommon.PowerBIDefaultHelpPage && !helpLink.isGetHelpTextReplaced) { /*TODO: Refactor when 'Learn more' replaces 'Get Help' for all dialogs, currently only approved for Refresh History Dialog */
actions.unshift(this.createButton(helpLink.label, (function () {
window.open(helpLink.url);
}), null, 'primary'));
}
else {
dialogFooter
.prepend($('<a class="modalErrorHelpLink" target="_blank"></a>')
.text(helpLink.label)
.attr('href', helpLink.url));
}
}
dialogContent.append(dialogFooter);
this.pushMessage(errorTitle || InJs.UnlocalizedStrings.errorDialogTitle, undefined, dialogContent, actions, isDismissable, onDialogClosed, undefined, undefined, dialogCssClass, containerCssClass);
};
/**
* Displays a custom message to the user
* @param titleText - The tile of the custom dialog
* @param messageContent - The html element to display to the user
* @param dialogActions - An array of ModalDialogAction objects describing the possible actions in the prompt
* @param onDialogDisplayed - Callback invoked when the modal dialog is displayed
* @param isDismissable - Whether the dialog is dismissable
* @param focusOnFirstButton - Whether to focus on the first button after the dialog presents
* @returns The host element for the dialog
*/
ModalDialog.prototype.showCustomDialog = function (titleText, dialogContent, dialogActions, onDialogDisplayed, isDismissable, focusOnFirstButton, dialogCssClass, containerCssClass, onDialogClosed, notificationType, notificationText, noActiveButtons, htmlMessageText, flipContentAndNotificationOrder, checkboxAction, closeOnEsc) {
this.ensureInitialized();
//Attaching event handler to update the position(make it center) of the modal dialog when browser window is minimized.
//Removed the attached event handler in hideDialog() function.
this.modalDialogResizeHandler = this.modalDialogResizeHandler.bind(this);
$(window).on('resize.modalDialog', this.modalDialogResizeHandler);
var actionsButtons = [];
if (checkboxAction) {
actionsButtons[0] = this.createCheckbox(checkboxAction.labelText, checkboxAction.actionCallback, checkboxAction.data);
}
for (var i = 0; i < dialogActions.length; i++) {
var thisAction = dialogActions[i];
var cssClass = thisAction.cssClass;
if (!noActiveButtons && i === 0) {
cssClass = cssClass + ' primary';
}
var index = checkboxAction ? i + 1 : i;
actionsButtons[index] = this.createButton(thisAction.labelText, thisAction.actionCallback, thisAction.data, cssClass, thisAction.disabled);
}
this.pushMessage(titleText, undefined, dialogContent, actionsButtons, !!isDismissable, onDialogClosed, onDialogDisplayed, focusOnFirstButton, dialogCssClass, containerCssClass, notificationType, notificationText, noActiveButtons, htmlMessageText, flipContentAndNotificationOrder, closeOnEsc);
return this.dialogContent;
};
/** Hides the current contents of the modal dialog */
ModalDialog.prototype.hideDialog = function () {
var _this = this;
this.ensureInitialized();
$(window).off('resize.modalDialog');
this.modalContainer.fadeTo(AnimationSpeedMs, 0, (function () {
_this.modalContainer.css(jsCommon.CssConstants.displayProperty, jsCommon.CssConstants.noneValue);
_this.modalDialogElement.removeClass(_this.modalDialogCustomClass);
_this.modalContainer.removeClass(_this.modalContainerCustomClass);
if (_this.currentModalDialogMessage && _this.currentModalDialogMessage.onDialogClosed) {
_this.currentModalDialogMessage.onDialogClosed();
}
_this.messageCurrentlyShown = false;
var nextMessage = _this.messageQueue.shift();
if (nextMessage) {
_this.showDialogInternal(nextMessage);
}
else {
_this.modalContainer.off();
_this.modalContainer.remove();
$(modalDialogContainerHostClassSelector).off();
$(modalDialogContainerHostClassSelector).remove();
_this.initialized = false;
if (_this.unregisterFocusManager)
_this.unregisterFocusManager();
}
}));
};
ModalDialog.prototype.ensureInitialized = function () {
var _this = this;
if (this.initialized)
return;
this.modalContainer = $(ModalDialogHtml);
this.modalDialogElement = this.modalContainer.find(modalDialogClassSelector);
this.dialogTitle = this.modalContainer.find(dialogTitleClassSelector);
this.dialogCloseButton = this.modalContainer.find(dialogCloseIconClassSelector);
this.dialogContent = this.modalContainer.find(dialogContentClassSelector);
this.dialogActions = this.modalContainer.find(dialogActionsClassSelector);
this.dialogCloseButton
.on(jsCommon.DOMConstants.mouseClickEventName, (function () { return _this.hideDialog(); }))
.on('keydown', (function (e) { if (e.keyCode === 27 /* escKeyCode */)
_this.hideDialog(); }))
.attr('aria-label', this.localizationMap ? this.localizationMap.closePromptText : InJs.UnlocalizedStrings.dialogCloseActionLabel)
.attr('name', this.localizationMap ? this.localizationMap.closePromptText : InJs.UnlocalizedStrings.dialogCloseActionLabel)
.attr('title', this.localizationMap ? this.localizationMap.closePromptText : InJs.UnlocalizedStrings.dialogCloseActionLabel);
if (!this.dialogHost) {
var containerHost = $(modalDialogContainerHostClassSelector);
// Remove modal container host if it already exists
if (!_.isEmpty(containerHost))
containerHost.remove();
containerHost = InJs.DomFactory.div().addClass(modalDialogContainerHostClassName);
containerHost.attr('role', 'dialog');
containerHost.attr('aria-labelledby', modalDialogAriaDescribeById);
this.dialogHost = $(jsCommon.DOMConstants.DocumentBody).append(containerHost);
this.dialogHost = containerHost;
}
this.dialogHost.append(this.modalContainer);
this.isReady = true;
if (this.messageQueue.length > 0) {
this.showDialogInternal(this.messageQueue.shift());
}
this.initialized = true;
this.unregisterFocusManager = jsCommon.FocusManager.getInstance().register(this.dialogHost.get(0), true);
// After initialization, we no longer need to reference the host directly.
this.dialogHost = undefined;
};
ModalDialog.prototype.updatePosition = function (animate) {
var offsetTop = (this.modalContainer.height() - this.modalDialogElement.height()) / 2;
var offsetLeft = (this.modalContainer.width() - this.modalDialogElement.width()) / 2;
/**
Note: No need to treat RTL differently, since we're centering the dialog in its container
Using jQuery instead of rtl service because angular could fail to load and the error message would be displayed incorrectly.
*/
var newPosition = {
'top': offsetTop + jsCommon.CssConstants.pixelUnits,
'left': offsetLeft + jsCommon.CssConstants.pixelUnits,
};
if (animate) {
this.modalDialogElement.animate(newPosition, AnimationSpeedMs);
}
else {
this.modalDialogElement.css(newPosition);
}
};
ModalDialog.prototype.addAdditionalErrorInfo = function (dialogContent, additionalErrorInfoKeyValuePairs, localizedString) {
var _this = this;
if (!_.isEmpty(additionalErrorInfoKeyValuePairs)) {
var additionalErrorInfo = $('<p ></p>');
for (var _i = 0, _a = additionalErrorInfoKeyValuePairs; _i < _a.length; _i++) {
var pair = _a[_i];
additionalErrorInfo.append(InJs.InfoNavUtility.constructErrorField(pair.errorInfoKey, pair.errorInfoValue));
}
var additionalErrorInfoContainer = InJs.InfoNavUtility.constructShowDetailsContainer(additionalErrorInfo, localizedString);
dialogContent.append($('<br />'));
dialogContent.append(additionalErrorInfoContainer);
dialogContent.find('.showAdditionalDetailsLink').on(jsCommon.DOMConstants.mouseClickEventName, (function () {
_this.updatePosition(true);
}));
}
};
ModalDialog.prototype.pushMessage = function (titleText, messageText, dialogContent, dialogButtons, isDismissable, onDialogClosed, onDialogDisplayed, focusOnFirstButton, dialogCssClass, containerCssClass, notificationType, notificationText, noActiveButtons, htmlMessageText, flipContentAndNotificationOrder, closeOnEsc) {
if (typeof isDismissable === 'undefined') {
isDismissable = true;
}
if (typeof dialogCssClass === 'undefined') {
dialogCssClass = '';
}
if (typeof containerCssClass === 'undefined') {
containerCssClass = '';
}
var nextMessage = {
titleText: titleText,
messageText: messageText,
dialogContent: dialogContent,
dialogButtons: dialogButtons,
onDialogDisplayed: onDialogDisplayed,
isDismissable: isDismissable,
dialogCssClass: dialogCssClass,
containerCssClass: containerCssClass,
onDialogClosed: onDialogClosed,
notificationType: notificationType,
notificationText: notificationText,
htmlMessageText: htmlMessageText
};
this.messageQueue.push(nextMessage);
if (!this.messageCurrentlyShown && this.isReady) {
this.showDialogInternal(this.messageQueue.shift(), focusOnFirstButton, noActiveButtons, flipContentAndNotificationOrder, closeOnEsc);
}
};
ModalDialog.prototype.tryCopyToClipboard = function (errorDialogContent) {
if (!errorDialogContent)
return false;
// Copy the relevant text from the error dialog: title, error messages, technical details
var errorDetails = [];
if (errorDialogContent.title) {
errorDetails.push(errorDialogContent.title);
}
if (errorDialogContent.message) {
errorDetails.push(errorDialogContent.message);
}
if (errorDialogContent.helperText) {
errorDetails.push(errorDialogContent.helperText);
}
if (errorDialogContent.additionalErrorInfo) {
for (var _i = 0, _a = errorDialogContent.additionalErrorInfo; _i < _a.length; _i++) {
var detail = _a[_i];
errorDetails.push(detail.errorInfoKey + ": " + detail.errorInfoValue);
}
}
var errorCopyText = errorDetails.join('\n');
try {
var copyPasteService = powerbi.CopyPasteService.create();
copyPasteService.copyText(errorCopyText);
return true;
}
catch (_b) {
return false;
}
};
ModalDialog.prototype.showDialogInternal = function (message, focusOnFirstButton, noActiveButtons, flipContentAndNotificationOrder, closeOnEsc) {
var _this = this;
this.currentModalDialogMessage = message;
this.messageCurrentlyShown = true;
this.dialogContentNotification = $(notificationForModalDialogHtml);
this.dialogContentNotificationIcon = this.dialogContentNotification.find(dialogNotificationIconClassSelector);
this.dialogContentNotificationText = this.dialogContentNotification.find(dialogContentNotificationTextClassSelector);
this.dialogTitle.empty();
this.dialogContent.empty();
this.dialogActions.empty();
this.dialogTitle
.text(message.titleText)
.attr("title", message.titleText);
if (!flipContentAndNotificationOrder) {
this.appendMessageText(message.dialogContent, message.messageText, message.htmlMessageText);
this.appendNotification(message.notificationType, message.notificationText);
}
else {
this.appendNotification(message.notificationType, message.notificationText);
this.appendMessageText(message.dialogContent, message.messageText, message.htmlMessageText);
}
if (message.isDismissable) {
this.dialogCloseButton.css(jsCommon.CssConstants.displayProperty, jsCommon.CssConstants.blockValue);
}
else {
this.dialogCloseButton.css(jsCommon.CssConstants.displayProperty, jsCommon.CssConstants.noneValue);
}
if (message.dialogButtons.length > 0) {
this.dialogActions.show();
for (var _i = 0, _a = message.dialogButtons; _i < _a.length; _i++) {
var button = _a[_i];
this.dialogActions.append(button);
}
}
else {
this.dialogActions.hide();
}
// If the dialog has a footer section, add the action buttons to that. Otherwise add after the content section.
var footer = this.dialogContent.find("." + "infonav-dialogFooter" /* dialogFooter */);
if (footer.length > 0) {
footer.append(this.dialogActions);
}
else {
this.dialogContent.after(this.dialogActions);
}
if (message.dialogCssClass) {
this.modalDialogElement.addClass(message.dialogCssClass);
this.modalDialogCustomClass = message.dialogCssClass;
}
if (message.containerCssClass) {
this.modalContainer.addClass(message.containerCssClass);
this.modalContainerCustomClass = message.containerCssClass;
}
var fadingElem = (this.modalContainer.css(jsCommon.CssConstants.displayProperty) === jsCommon.CssConstants.noneValue) ? this.modalContainer : this.modalDialogElement;
fadingElem.fadeTo(0, 0);
this.updatePosition(false);
fadingElem.fadeTo(AnimationSpeedMs, 1, (function () {
if (message.onDialogDisplayed) {
message.onDialogDisplayed(_this.dialogContent);
}
// If this is new dialog-frame don't set focus.
// Old dialogs have different layout and we shouldn't break the logic.
if (_this.modalDialogElement.find('dialog-frame').length > 0)
return;
// Steal the focus away from whatever else is happening
if (_this.modalDialogElement.find(":focus").length === 0) {
_this.modalDialogElement.focus();
}
if (closeOnEsc) {
_this.modalDialogElement.keydown((function (e) {
if (e.keyCode === 27 /* escKeyCode */)
_this.hideDialog();
}));
}
var buttons = _this.dialogActions.find("input");
if (!noActiveButtons && buttons.length > 0) {
buttons[0].focus();
}
if (focusOnFirstButton) {
_this.dialogContent.parent().find('.infonav-dialogActions input[type=button]:first').focus();
}
}));
};
ModalDialog.prototype.appendMessageText = function (dialogContent, messageText, htmlMessageText) {
// if there was not a string message provided, render using DialogContent
if (_.isEmpty(messageText) && dialogContent) {
this.dialogContent.append(dialogContent);
}
else {
this.dialogContent.text(messageText);
}
if (!_.isEmpty(htmlMessageText)) {
this.dialogContentMessage = this.dialogContent.find(modalDialogHtmlMessageClassSelector);
this.dialogContentMessage.html(htmlMessageText);
}
};
ModalDialog.prototype.appendNotification = function (notificationType, notificationText) {
if (notificationType !== null && !_.isEmpty(notificationText)) {
switch (notificationType) {
case ModalDialogNotificationType.Info:
this.dialogContentNotificationIcon.addClass("pbi-glyph-info glyph-mini" /* dialogInfoIcon */);
this.dialogContentNotification.addClass("typeInfo" /* notificationInfo */);
break;
case ModalDialogNotificationType.Warning:
this.dialogContentNotificationIcon.addClass("pbi-glyph-warning glyph-mini" /* dialogWarningIcon */);
this.dialogContentNotification.addClass("typeWarning" /* notificationWarning */);
break;
case ModalDialogNotificationType.SecurityWarning:
this.dialogContentNotificationIcon.addClass("pbi-glyph-securityalert glyph-mini" /* dialogSecurityWarningIcon */);
this.dialogContentNotification.addClass("typeSecurityWarning" /* notificationSecurityWarning */);
break;
}
this.dialogContentNotificationText.html(notificationText);
this.dialogContent.append(this.dialogContentNotification);
}
};
ModalDialog.prototype.createButton = function (labelText, action, data, cssClass, disabled) {
var _this = this;
var button = $(NewButtonSelector);
button.attr('value', labelText);
button.on(jsCommon.DOMConstants.mouseClickEventName, (function () {
action(button, _this.dialogContent, data);
}));
if (cssClass) {
button.addClass(cssClass);
}
if (disabled) {
button.prop("disabled", true);
}
return button;
};
ModalDialog.prototype.createCheckbox = function (labelText, action, data) {
var _this = this;
var checkboxDivHtml = '<div class="' + "pbi-input checkbox" /* dialogCheckbox */ + '">' +
checkboxSelector +
checkboxLabelSelectorOpen + labelText + checkboxLabelSelectorClose +
'</div>';
var checkboxDivElement = $(checkboxDivHtml);
var checkbox = checkboxDivElement.find('input');
checkbox.on(jsCommon.DOMConstants.changeEventName, (function () {
action(checkbox, _this.dialogContent, data);
}));
return checkboxDivElement;
};
ModalDialog.prototype.modalDialogResizeHandler = function () {
this.updatePosition(false);
};
return ModalDialog;
}());
jsCommon.ModalDialog = ModalDialog;
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var InJs;
(function (InJs) {
/** This class represents an action, bound to a button, inside a modal dialog */
var ModalDialogAction = /** @class */ (function () {
function ModalDialogAction(labelText, actionCallback, data, cssClass, disabled) {
this.labelText = labelText;
this.actionCallback = actionCallback;
this.data = data;
this.cssClass = cssClass;
this.disabled = !!disabled;
}
return ModalDialogAction;
}());
InJs.ModalDialogAction = ModalDialogAction;
})(InJs || (InJs = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
/**
* Simple circular stack that allows to limint amount of items per stack.
* When overflow happens overrides old items.
*/
var CircularStack = /** @class */ (function () {
function CircularStack(size) {
this.count = 0;
this.top = -1;
debug.assert(size >= 1, 'Size cant be less than 1');
this.size = size;
this.data = new Array(size);
}
CircularStack.prototype.item = function (index) {
debug.assert(index >= 0 && index < this.count, 'index out of range');
var bottom = this.top - (this.count - 1);
if (bottom < 0)
bottom += this.size;
return this.data[(index + bottom) % this.size];
};
CircularStack.prototype.push = function (item) {
if (this.count < this.size) {
this.count++;
}
this.top = ++this.top % this.size;
this.data[this.top] = item;
};
CircularStack.prototype.pop = function () {
if (this.count === 0)
return;
this.count--;
var item = this.data[this.top];
delete this.data[this.top];
if (--this.top === -1 && this.count > 0) {
this.top = this.size - 1;
}
return item;
};
CircularStack.prototype.peek = function () {
return this.data[this.top];
};
CircularStack.prototype.clear = function () {
this.count = 0;
this.top = -1;
this.data = new Array(this.size);
};
Object.defineProperty(CircularStack.prototype, "length", {
get: function () {
return this.count;
},
enumerable: false,
configurable: true
});
return CircularStack;
}());
jsCommon.CircularStack = CircularStack;
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var Double = powerbi.Double;
var StringExtensions;
(function (StringExtensions) {
/** Parses a non-empty substring that must be all integer digits. Returns null on failure. */
function parseIntSubstrFast(fullString, from, length) {
debug.assertValue(fullString, 'fullString');
debug.assertValue(from, 'from');
debug.assertValue(length, 'length');
debug.assert(from >= 0, 'from >= 0');
debug.assert(length >= 0, 'length >= 0');
debug.assert((from + length) <= fullString.length, '(from + length) <= fullString.length');
if (length === 0)
return null;
// In one pass on the full string, in reverse, add together digit * 10^exponent
var value = 0;
for (var digitExponent = 0, charIndex = from + length - 1; digitExponent < length; digitExponent++, charIndex--) {
var digit = fullString.charCodeAt(charIndex) - 48;
if (digit < 0 || 9 < digit)
return null;
value += digit * Double.pow10(digitExponent);
}
return value;
}
StringExtensions.parseIntSubstrFast = parseIntSubstrFast;
/** Transform a string into a regex to be matched literally */
function literalStringToRegex(string, flags) {
debug.assertValue(string, 'literalStringToRegex - string');
debug.assertAnyValue(flags, 'literalStringToRegex - flags');
return new RegExp(string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), flags);
}
StringExtensions.literalStringToRegex = literalStringToRegex;
})(StringExtensions = jsCommon.StringExtensions || (jsCommon.StringExtensions = {}));
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var Double = powerbi.Double;
var contract = powerbi.contract;
var parseIntSubstrFast = jsCommon.StringExtensions.parseIntSubstrFast;
/** Extensions to Date class */
var DateExtensions;
(function (DateExtensions) {
var datePrefix = '/Date(';
var dateSuffix = ')\/';
/** Gets a value indicating whether the specified date has a midnight time portion in local time. */
function isLocalMidnight(date) {
debug.assertValue(date, 'date');
return ((date.getTime() - date.getTimezoneOffset() * 60000 /* MillisecondsPerMinute */) % 86400000 /* MillisecondsPerDay */) === 0;
}
DateExtensions.isLocalMidnight = isLocalMidnight;
/** Returns whether moment is present */
function isMomentPresent() {
return typeof moment !== 'undefined';
}
DateExtensions.isMomentPresent = isMomentPresent;
/**
* Parses an ISO 8601 formatted date string and creates a Date object.
* If timezone information is not present in the date the local timezone will be assumed.
* If the string cannot be parsed successfully the return value will be null.
*/
function parseIsoDate(isoDate) {
// Optimization: Moment's date parsing can be slow. Attempt to parse common ISO date format using some faster code.
var parsedDate = parseIsoDateFast(isoDate);
if (parsedDate)
return parsedDate;
debug.assert(isMomentPresent(), 'Moment.js should be loaded for non-fast parseIsoDate.');
var momentDate = moment(isoDate);
return momentDate.isValid() ? momentDate.toDate() : null;
}
DateExtensions.parseIsoDate = parseIsoDate;
// Exported for testability
/**
* An optimized parser for an ISO 8601 date with unspecified timezone offset. This is the common case produced from PowerBI backends.
* This is a very hot codepath so please update with care.
*/
function parseIsoDateFast(isoDate) {
if (!isoDate)
return;
// ISO Format: YYYY-MM-DDTHH:mm:SS.ffffff
// Indices: 01234567890123456789012345
// NOTE: Trailing subsecond precision is optional.
// NOTE: Trailing Z for UTC is also optional.
// Backend may produce seven trailing subsecond digits as well as trailing Z for UTC.
var length = isoDate.length;
if (length <= 18 || length > 28)
return;
var dateTimeDelimiter = isoDate[10];
if (isoDate[4] !== '-' ||
isoDate[7] !== '-' ||
(dateTimeDelimiter !== 'T' && dateTimeDelimiter !== ' ') ||
isoDate[13] !== ':' ||
isoDate[16] !== ':')
return;
var year = parseIntSubstrFast(isoDate, 0, 4);
var month = parseIntSubstrFast(isoDate, 5, 2);
var day = parseIntSubstrFast(isoDate, 8, 2);
var hour = parseIntSubstrFast(isoDate, 11, 2);
var minute = parseIntSubstrFast(isoDate, 14, 2);
var second = parseIntSubstrFast(isoDate, 17, 2);
// ISO Date ending with a 'Z' implies UTC time.
var utc = isoDate.charAt(length - 1) === 'Z';
if (utc)
length--;
var milliseconds = 0;
if (length > 19) {
// The date includes a sub-second component.
if (isoDate[19] !== '.')
return;
var numSubsecondDigits = length - 20;
var subsecondValue = parseIntSubstrFast(isoDate, 20, numSubsecondDigits);
if (subsecondValue === null)
return;
var factorForMilliseconds = Double.pow10(3 - numSubsecondDigits);
milliseconds = subsecondValue * factorForMilliseconds;
}
if (year === null ||
month === null ||
day === null ||
hour === null ||
minute === null ||
second === null ||
milliseconds === null)
return;
if (utc) {
return new Date(Date.UTC(year, month - 1, // Months are zero-indexed
day, hour, minute, second, milliseconds));
}
return powerbi.createDateWithEpochValue(year, month - 1, // Months are zero-indexed
day, hour, minute, second, milliseconds);
}
DateExtensions.parseIsoDateFast = parseIsoDateFast;
function parseUtcDate(isoDate) {
debug.assert(isMomentPresent(), 'Moment.js should be loaded for parseUtcDate.');
return moment.utc(isoDate).toDate();
}
DateExtensions.parseUtcDate = parseUtcDate;
function serializeDate(date) {
debug.assertValue(date, 'date');
return datePrefix + date.getTime().toString() + dateSuffix;
}
DateExtensions.serializeDate = serializeDate;
function deserializeDate(data) {
jsCommon.Utility.throwIfNullOrEmptyString(data, null, 'deserializeDate', 'Cannot deserialize empty string');
contract.check(data.indexOf(datePrefix) === 0 && _.endsWith(data, dateSuffix), 'Cannot deserialize empty string');
if (DateExtensions.isMomentPresent()) {
// Prefer to use moment, which has a more complete implementation.
var parsedValue = moment(data);
contract.check(parsedValue.isValid(), 'parsedValue.isValid must be true');
return parsedValue.toDate();
}
var ticksString = data.substring(datePrefix.length, data.length - dateSuffix.length);
contract.check(/^\-?\d+$/.test(ticksString), 'Cannot deserialize invalid date');
var ticksValue = parseInt(ticksString, 10);
contract.check(!isNaN(ticksValue), 'Cannot deserialize invalid date');
return new Date(ticksValue);
}
DateExtensions.deserializeDate = deserializeDate;
function tryDeserializeDate(data) {
try {
return deserializeDate(data);
}
catch (e) { }
}
DateExtensions.tryDeserializeDate = tryDeserializeDate;
function isContainedInTimeFrame(date, unit, amount, shouldGoToStart) {
debug.assertValue(date, 'date');
var dateForComparison = moment().subtract(amount, unit);
if (shouldGoToStart) {
dateForComparison = dateForComparison.startOf(unit);
}
return moment(date) >= dateForComparison;
}
DateExtensions.isContainedInTimeFrame = isContainedInTimeFrame;
function GetTime(locale, date) {
debug.assertValue(date, 'date');
// The format should be (roughly, depending on browser implementation) "2:52:10 PM"
return date.toLocaleTimeString(locale, {
second: 'numeric',
minute: 'numeric',
hour: 'numeric'
});
}
DateExtensions.GetTime = GetTime;
function GetDayWithTime(locale, date) {
debug.assertValue(date, 'date');
// The format should be (roughly, depending on browser implementation) "Thu 2:52:10 PM"
return date.toLocaleDateString(locale, {
second: 'numeric',
minute: 'numeric',
hour: 'numeric',
weekday: 'short'
});
}
DateExtensions.GetDayWithTime = GetDayWithTime;
function GetFullDateWithTime(locale, date) {
debug.assertValue(date, 'date');
// The format should be (roughly, depending on browser implementation) "Jul 21, 2016 2:52:10 PM"
return date.toLocaleDateString(locale, {
second: 'numeric',
minute: 'numeric',
hour: 'numeric',
day: 'numeric',
month: 'short',
year: 'numeric'
});
}
DateExtensions.GetFullDateWithTime = GetFullDateWithTime;
function getCurrentUTCTimeString() {
return (new Date()).toISOString();
}
DateExtensions.getCurrentUTCTimeString = getCurrentUTCTimeString;
})(DateExtensions = jsCommon.DateExtensions || (jsCommon.DateExtensions = {}));
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi_1) {
function ensurePowerbiTelemetry() {
var powerbi = powerbi_1.ensurePowerbi();
if (!powerbi.telemetry)
powerbi.telemetry = {};
return powerbi.telemetry;
}
powerbi_1.ensurePowerbiTelemetry = ensurePowerbiTelemetry;
function ensurePowerbiSession() {
var powerbi = powerbi_1.ensurePowerbi();
if (!powerbi.session)
powerbi.session = {};
return powerbi.session;
}
powerbi_1.ensurePowerbiSession = ensurePowerbiSession;
function ensurePowerbiHelpers() {
var powerbi = powerbi_1.ensurePowerbi();
if (!powerbi.helpers)
powerbi.helpers = {};
return powerbi.helpers;
}
powerbi_1.ensurePowerbiHelpers = ensurePowerbiHelpers;
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var ExceptionHelper;
(function (ExceptionHelper) {
function stripPII(_exception) {
// TODO: Add any removal of PII from errors before logging here
}
ExceptionHelper.stripPII = stripPII;
/** Clean exception stack so it is safe to include in telemetry */
function cleanExceptionStack(exception) {
try {
if (!exception) {
return;
}
var stack = exception.stack;
if (!stack) {
return;
}
// Remove message from stack
var lineFeedIndex = stack.indexOf('\n');
if (lineFeedIndex === -1) {
return;
}
stack = stack.substring(lineFeedIndex + 1);
// Replace URLs with filenames
stack = stack.replace(/\s*((ms-pbi|https):\/\/\S*|\(.*?\))/g, (function (text) {
var matches = text.match(/([\w\.-]+\.(js|html)(:\d+:\d+)?)/);
return matches != null ? " (" + matches[1] + ")" : '';
}));
return stack;
}
catch (_a) {
return "Error at cleanExceptionStack";
}
}
ExceptionHelper.cleanExceptionStack = cleanExceptionStack;
/** Clean exception stack so it is safe to include in telemetry */
function cleanExceptionMessage(exception) {
var _a;
try {
if (exception instanceof TypeError || exception instanceof ReferenceError) {
return exception.message;
}
if (exception) {
return "Error of type " + exception.name + " had a " + ((_a = exception.message) === null || _a === void 0 ? void 0 : _a.length) + " characters long message";
}
}
catch (_b) {
return "Error at cleanExceptionMessage";
}
}
ExceptionHelper.cleanExceptionMessage = cleanExceptionMessage;
function handleErrorAndLogTelemetry(telemetryService, eventFactory, error, parentActivity) {
// If the error is not a type of Error, wrap it in an Error
if (!(error instanceof Error)) {
try {
throw new Error("Error wrapper for thrown object: " + JSON.stringify(error));
}
catch (e) {
error = e;
}
}
// TODO - There seems to be an issue where errors thrown from Promises are not being handed to ErrorHandler.
// Uncomment the below code when errors from Promises are actually being handed to the ErrorHandler.
// Zone.js wraps uncaught errors from ZoneAwarePromise, where the original error is stored in `rejection` property (see the link below).
// The wrapped error contains the original error's stack as part of its message, and this behavior makes `message` very verbose,
// making it difficult to aggregate the errors by message. Here we attempt unwrap the original error based on the implementation detail.
// See lines 193-202: https://github.com/angular/zone.js/blob/47dd3f49c3f3749385dafc5d0f51b8e4fd650f21/lib/common/promise.ts
// if (error.rejection && error.rejection instanceof Error) {
// error = error.rejection;
// }
// Avoid logging the ignorable clientErrors in async code
if (error.rejection && (error.rejection.clientError && error.rejection.clientError.ignorable || /** see comments above*/ error.rejection.ignorable)) {
console.warn(error);
return;
}
ExceptionHelper.stripPII(error);
var message = error.message;
var stack = error.stack;
// JS minifier will remove all console.* messages
console.error(message + "\n" + stack);
try {
if (!parentActivity) {
telemetryService.logEvent(eventFactory, { stack: stack, message: message });
}
else {
telemetryService.logChildEvent(parentActivity.event, eventFactory, { stack: stack, message: message });
}
}
catch (e) {
console.error(e);
}
}
ExceptionHelper.handleErrorAndLogTelemetry = handleErrorAndLogTelemetry;
function getExceptionHandler(telemetryService, customTraceLoggerService, eventFactory) {
return function (exception, cause) {
var title = "UnhandledAngularException: ";
stripPII(exception);
var message = exception.message + ' (caused by "' + cause + '")\n';
var exceptionStack = (exception.stack || exception).toString();
var formattedError = message + exceptionStack;
// js minifier will remove all console.* messages
console.error(title + formattedError);
try {
// Log unhandled Angular errors to telemetry gracefully
telemetryService.logEvent(eventFactory, { stack: exceptionStack, message: message });
var logEntry = {
consoleMessage: formattedError,
type: 'console_log',
createdTime: new Date(),
};
customTraceLoggerService.addLogEntry(logEntry);
}
catch (exception) {
console.error(exception);
}
};
}
ExceptionHelper.getExceptionHandler = getExceptionHandler;
function getWindowOnErrorWrapper(telemetryService, originalWindowOnError, eventFactoryNoStack, eventFactoryWithStack) {
return function (messageObj, source, lineNumber, columnNumber, errorObj) {
if (lineNumber === 2 && columnNumber === 8228 && _.includes(source, 'powerbiportal.dependencies.bundle')) {
//Known unhandled jQuery Exception; see TFS Bug 7711158
return;
}
if (errorObj && errorObj.message && errorObj.stack) {
stripPII(errorObj);
var message = errorObj.message;
var stack = errorObj.stack;
telemetryService.logEvent(eventFactoryWithStack, { source: jsCommon.QueryStringUtil.clearAllQueriesFromUrl(source), lineNumber: lineNumber, columnNumber: columnNumber || 0, stack: stack, message: message });
}
else if (typeof messageObj === 'object' && messageObj.message && messageObj.stack) {
stripPII(messageObj);
var message = messageObj.message;
var stack = messageObj.stack;
telemetryService.logEvent(eventFactoryWithStack, { source: jsCommon.QueryStringUtil.clearAllQueriesFromUrl(source), lineNumber: lineNumber, columnNumber: columnNumber || 0, stack: stack, message: message });
}
else {
var message = JSON.stringify(messageObj, Object.getOwnPropertyNames(messageObj));
telemetryService.logEvent(eventFactoryNoStack, { source: jsCommon.QueryStringUtil.clearAllQueriesFromUrl(source), lineNumber: lineNumber, columnNumber: columnNumber || 0, message: message });
}
originalWindowOnError(messageObj, source, lineNumber, columnNumber, errorObj);
return true;
};
}
ExceptionHelper.getWindowOnErrorWrapper = getWindowOnErrorWrapper;
})(ExceptionHelper = jsCommon.ExceptionHelper || (jsCommon.ExceptionHelper = {}));
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var jsCommon;
(function (jsCommon_1) {
var checkedQueryParams = {};
/**
* Utility class to manupilate the search query string in a Url.
* Note: search query string has to begin with '?'
*/
var QueryStringUtil = /** @class */ (function () {
function QueryStringUtil() {
}
/** Remove a given query from the query */
QueryStringUtil.clearQueryString = function (queryField) {
var queries = QueryStringUtil.parseQueryString();
delete queries[queryField];
return QueryStringUtil.rebuildQueryString(queries);
};
/** Remove a multiple queries from the query */
QueryStringUtil.clearQueryStrings = function (queryFields) {
var queries = QueryStringUtil.parseQueryString();
for (var _i = 0, queryFields_1 = queryFields; _i < queryFields_1.length; _i++) {
var queryField = queryFields_1[_i];
delete queries[queryField];
}
return QueryStringUtil.rebuildQueryString(queries);
};
/**
* Add or update existing query field to new value
* Note: queryField and queryValue do not need to be encoded
*/
QueryStringUtil.addOrUpdateQueryString = function (queryField, queryValue) {
var queries = QueryStringUtil.parseQueryString();
queries[queryField] = queryValue;
return QueryStringUtil.rebuildQueryString(queries);
};
/**
* Add or update existing URL with query strings
* @param url - The URL to be updated
* @param queries - The dictionary of new queries in the format of key/value pairs
* @returns The URL with the new queries added
*/
QueryStringUtil.addOrUpdateQueryStringToUrl = function (url, queries) {
var combinedQueries = QueryStringUtil.parseUrl(url);
var baseUrl = QueryStringUtil.clearAllQueriesFromUrl(url);
for (var _i = 0, _a = Object.keys(queries); _i < _a.length; _i++) {
var key = _a[_i];
combinedQueries[key] = queries[key];
}
return baseUrl + QueryStringUtil.rebuildQueryString(combinedQueries);
};
/**
* Returns the value of a URL parameter
* @param key - The key of the URL parameter
* @returns The (decoded) value of the URL parameter
*/
QueryStringUtil.getQueryStringValue = function (key) {
var queries = QueryStringUtil.parseQueryString();
return queries[key];
};
QueryStringUtil.isQueryParamSet = function (key, canCache) {
var value = checkedQueryParams[key];
if (!canCache || value === undefined) {
var queryValue = QueryStringUtil.getQueryStringValue(key);
value = queryValue != null && queryValue !== 'false' && (queryValue === '1'
|| queryValue.toLowerCase() === 'true'
|| queryValue.length > 1);
if (canCache)
checkedQueryParams[key] = value;
}
return value;
};
/**
* Parse the search query string in a URL into key/value pairs
* @param url - The full URL that may contain queries
*/
QueryStringUtil.parseUrl = function (url) {
var queryStartIndex = url.indexOf('?');
var queryString = queryStartIndex >= 0 ? url.substr(queryStartIndex) : undefined;
return QueryStringUtil.parseQueryString(queryString);
};
/**
* Parse the search query string into key/value pairs
* Note: both key and value are decoded.
*/
QueryStringUtil.parseQueryString = function (queryString) {
if (queryString === void 0) { queryString = window.location.search; }
var queryStringDictionary = {};
var search = queryString;
if (search && search.substr(0, 1) === '?') {
// skip the '?'
var pairs = search.substr(1).split("&");
for (var _i = 0, pairs_1 = pairs; _i < pairs_1.length; _i++) {
var pair = pairs_1[_i];
var _a = pair.split("="), key = _a[0], rest = _a.slice(1);
var value = rest.join('=');
queryStringDictionary[decodeURIComponent(key)] = decodeURIComponent(value);
}
}
return queryStringDictionary;
};
/**
* Parse the search query string into key/values pairs
* Note: both key and value are decoded.
*/
QueryStringUtil.parseQueryStringWithMultipleKeyValues = function (queryString) {
if (queryString === void 0) { queryString = window.location.search; }
var queryStringDictionary = {};
var search = queryString;
if (search && search.substr(0, 1) === '?') {
// skip the '?'
var pairs = search.substr(1).split("&");
for (var _i = 0, pairs_2 = pairs; _i < pairs_2.length; _i++) {
var pair = pairs_2[_i];
var _a = pair.split("="), key = _a[0], rest = _a.slice(1);
var value = rest.join('=');
var decodedValue = decodeURIComponent(value);
if (!queryStringDictionary[decodeURIComponent(key)]) {
queryStringDictionary[decodeURIComponent(key)] = [decodedValue];
}
else {
queryStringDictionary[decodeURIComponent(key)].push(decodedValue);
}
}
}
return queryStringDictionary;
};
/**
* Reconstruct the search string based on the key/value pair of individual query.
* Note: both query field and query value will be encoded in the returned value.
*/
QueryStringUtil.rebuildQueryString = function (queries) {
var queryString = "";
var isEmpty = true;
for (var queryField in queries) {
if (!isEmpty) {
queryString += '&';
}
queryString += encodeURIComponent(queryField) + '=';
if (queries[queryField]) {
queryString += encodeURIComponent(queries[queryField]);
}
isEmpty = false;
}
if (!isEmpty) {
queryString = '?' + queryString;
}
return queryString;
};
/** Return a URL with the string starting with '?' removed */
QueryStringUtil.clearAllQueriesFromUrl = function (url) {
var queryStartIndex = url.indexOf('?');
var fragmentStartIndex = url.indexOf('#');
if (fragmentStartIndex >= 0 && (fragmentStartIndex < queryStartIndex || queryStartIndex === -1)) {
queryStartIndex = fragmentStartIndex;
}
return queryStartIndex >= 0 ? url.substr(0, queryStartIndex) : url;
};
QueryStringUtil.fileOfUrl = function (url) {
url = QueryStringUtil.clearAllQueriesFromUrl(url);
var slash = url.lastIndexOf('/');
if (slash !== -1) {
url = url.substring(slash + 1);
}
return url;
};
QueryStringUtil.OriginClientActivityIdParameterName = 'caid';
QueryStringUtil.OriginRootActivityIdParameterName = 'raid';
QueryStringUtil.OriginActivityIdParameterName = 'aid';
return QueryStringUtil;
}());
jsCommon_1.QueryStringUtil = QueryStringUtil;
function ensureJsCommonQueryStringUtil() {
var jsCommon = powerbi.ensureJsCommon();
if (!jsCommon.QueryStringUtil)
jsCommon.QueryStringUtil = {};
return jsCommon.QueryStringUtil;
}
function exportQueryStringUtilToGlobal() {
if (exported)
return;
// needed by src\Clients\Externals\ThirdPartyIP\Angular\1.8.0\angular.js
var orgGetQueryStringValue = jsCommon.QueryStringUtil.getQueryStringValue;
ensureJsCommonQueryStringUtil().getQueryStringValue = function (key) { return orgGetQueryStringValue(key); };
var orgParseQueryString = jsCommon.QueryStringUtil.parseQueryString;
ensureJsCommonQueryStringUtil().parseQueryString = function (queryString) {
if (queryString === void 0) { queryString = window.location.search; }
return orgParseQueryString(queryString);
};
exported = true;
}
jsCommon_1.exportQueryStringUtilToGlobal = exportQueryStringUtilToGlobal;
var exported = false;
exportQueryStringUtilToGlobal();
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var _a;
/** Instantiates a RejectablePromise that wraps the given Deferred object. */
function createRejectablePromise2(deferred) {
return new RejectablePromiseImpl(deferred);
}
powerbi.createRejectablePromise2 = createRejectablePromise2;
function createRejectablePromise(deferred) {
return new RejectablePromiseImpl(deferred);
}
powerbi.createRejectablePromise = createRejectablePromise;
var RejectablePromiseImpl = /** @class */ (function () {
function RejectablePromiseImpl(deferred) {
var _this = this;
this[_a] = 'Promise';
debug.assertValue(deferred, 'deferred');
this.deferred = deferred;
this.state = 0 /* Pending */;
deferred.promise.then((function () { return _this.state = 1 /* Resolved */; }), (function () { return _this.state = 2 /* Rejected */; }));
}
/**
* Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected.
* This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback.
*/
// TODO Fix Explicit Any
RejectablePromiseImpl.prototype.then = function (successCallback, errorCallback) {
return this.deferred.promise.then(successCallback, errorCallback);
};
/** Shorthand for promise.then(null, errorCallback) */
// TODO Fix Explicit Any
RejectablePromiseImpl.prototype.catch = function (callback) {
return this.deferred.promise.catch(callback);
};
/**
* Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information.
* Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible.
*/
// TODO Fix Explicit Any
RejectablePromiseImpl.prototype.finally = function (callback) {
return this.deferred.promise.finally(callback);
};
/**
* Indicates if a promise is resolved.
*/
RejectablePromiseImpl.prototype.resolved = function () {
return this.state === 1 /* Resolved */;
};
/**
* Indicates if a promise is rejected.
*/
RejectablePromiseImpl.prototype.rejected = function () {
return this.state === 2 /* Rejected */;
};
/**
* Indicates if a promise is pending. A promise is pending if it is not rejected or resolved.
*/
RejectablePromiseImpl.prototype.pending = function () {
return this.state === 0 /* Pending */;
};
/**
* Rejects a pending promise
*/
RejectablePromiseImpl.prototype.reject = function (reason) {
if (this.pending()) {
this.deferred.reject(reason);
this.state = 2 /* Rejected */;
}
};
return RejectablePromiseImpl;
}());
_a = Symbol.toStringTag;
})(powerbi || (powerbi = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var DefaultMaxCacheEntries = 500;
/**
* @class
* A cache of Rejectable Promises
* Note that this is a copy of the older cache, pre-refactoring to allow different eviction strategies.
* This will be deleted in the near future, replaced with RejectablePromiseCache.
* It is only kept as a backup due to the severity of issues that could arise from cache breakages.
*/
var LegacyRejectablePromiseCache = /** @class */ (function () {
/**
* Constructor of RejectablePromiseCache
* @param {IPromiseFactory} promiseFactory - factory used to create promises
* @param {number} maxCacheEntries - maxiumum number of cache entries allowed before cache items are removed via FIFO policy
*/
function LegacyRejectablePromiseCache(promiseFactory, maxCacheEntries) {
this.maxCacheEntries = maxCacheEntries ? maxCacheEntries : DefaultMaxCacheEntries;
this.cache = {};
this.promiseFactory = promiseFactory;
}
/**
* Returns the number of entries in the cache
*/
LegacyRejectablePromiseCache.prototype.getEntryCount = function () {
return Object.keys(this.cache).length;
};
/**
* Indicates if there is an entry in the cache for the provided key
* @param {string} cacheKey - Identifier of the cache entry
*/
LegacyRejectablePromiseCache.prototype.hasCacheEntry = function (cacheKey) {
debug.assertValue(cacheKey, 'cacheKey');
return !!this.getCacheEntry(cacheKey);
};
/**
* Creates a cache entry associated with the provided key. If the key is already
* pointing to a cache entry, 'undefined' is returned.
* @param {string} cacheKey - Identifier of the cache entry
* @param rewriteResult - Rewrites the Query result. This affects `cacheEntry.result` as well as the result which `cacheEntry.promise` is resolved with.
* @param rewriteCachedResult - Rewrites `cacheEntry.result` only. This does'nt affect the result which `cacheEntry.promise` is resolved with.
*/
LegacyRejectablePromiseCache.prototype.createCacheEntry = function (cacheKey, context, rewriteResult, rewriteCachedResult, telemetryV2Enabled) {
var _this = this;
debug.assertValue(cacheKey, 'cacheKey');
var cacheEntry = this.getCacheEntry(cacheKey);
// if cacheKey is undefined/empty string or there is a cache entry, return undefined
if (!cacheKey || cacheEntry)
return;
var promiseFactory = this.promiseFactory;
var queryCache = this.cache;
var deferred = promiseFactory.defer(telemetryV2Enabled);
var promise = powerbi.createRejectablePromise(deferred);
var entryDeferred = promiseFactory.defer(telemetryV2Enabled);
var entryPromise = powerbi.createRejectablePromise2(entryDeferred);
cacheEntry = {
promise: entryPromise,
refCount: 0,
context: context,
};
this.appendCacheEntryInternal(cacheKey, cacheEntry);
// remove first item cache if it reaches max
// do not delete them (values) as they may be pending and referenced by other objects
if (this.getEntryCount() > this.maxCacheEntries) {
this.removeCacheEntryInternal(this.firstKey);
}
promise
.then((function (result) {
// We know cacheEntry won't be reassigned before this continuation
cacheEntry = cacheEntry;
if (cacheEntry.updateResult)
result = cacheEntry.updateResult(result);
if (result && rewriteResult)
result = rewriteResult(result);
cacheEntry.result = rewriteCachedResult ? rewriteCachedResult(result) : result;
entryDeferred.resolve(result);
}), (function (reason) { return entryDeferred.reject(reason); }))
.finally((function () {
delete cacheEntry.updateResult;
}));
entryPromise
.finally((function () {
if (queryCache[cacheKey]) {
delete queryCache[cacheKey].promise;
// if promise is rejected, delete the cache entry to allow for future re-execution of the same query
if (entryPromise.rejected())
_this.removeCacheEntryInternal(cacheKey);
}
}))
.catch((function (errorReason) { return promise.reject(errorReason); }));
return { deferred: deferred, promise: promise };
};
/**
* clears the cache from the entry associated with the provided cache key
* @param {string} cacheKey - Identifier of the cache entry
* @param {boolean} rejectPromise - indicates of the promise should be reject. Promise is reject only if it is pending
*/
LegacyRejectablePromiseCache.prototype.clearEntry = function (cacheKey, rejectPromise) {
var cacheEntry = this.getCacheEntry(cacheKey);
if (cacheEntry) {
var cachePromise = cacheEntry.promise;
if (rejectPromise && cachePromise) {
// It is sufficient to just reject the promise since
// reject will finally delete the cache as well (see implementation of createCacheEntry)
cachePromise.reject();
}
else {
this.removeCacheEntryInternal(cacheKey);
}
return true;
}
return false;
};
/**
* clears the cache from the entry associated with the provided cache key
* @param {boolean} rejectPromise - indicates of promises shouputCacheResultld be reject. A Promise is reject only if it is pending
*/
LegacyRejectablePromiseCache.prototype.clearAllEntries = function (rejectPromise) {
for (var cacheKey in this.cache) {
this.clearEntry(cacheKey, rejectPromise);
}
};
/**
* Bind a new promise to cached query results and returns the promise. Once results are available deferred is resolved.
* If bindingResultRewriter is specified, its return value will be used for resolving the returned promise.
* Note that bindingResultRewriter MUST NOT modify its input argument object, otherwise the rewrites would be reflected in the result of the original cache entry.
* Instead, bindingResultRewriter should clone or inherit from the input argument object, apply rewrites on the clone or inherited object, and then return it.
* @param {string} cacheKey - Identifier of the cache entry
* @param {IBindingResultRewriter} bindingResultRewriter - If specified, its return value will be used for resolving the returned promise. See comments on this function for details.
*/
LegacyRejectablePromiseCache.prototype.bindCacheEntry = function (cacheKey, bindingResultRewriter, telemetryV2Enabled) {
debug.assertValue(cacheKey, 'cacheKey');
var cacheEntry = this.getCacheEntry(cacheKey);
// if there is no cache entry for this key, return
if (cacheEntry === undefined)
return;
var deferred = this.promiseFactory.defer(telemetryV2Enabled);
var promise = powerbi.createRejectablePromise2(deferred);
if (cacheEntry.result) {
var bindingResult = bindingResultRewriter ? bindingResultRewriter(cacheEntry.result) : cacheEntry.result;
deferred.resolve(bindingResult);
return promise;
}
var cachePromise = cacheEntry.promise;
if (!cachePromise) {
deferred.reject(undefined);
return promise;
}
cacheEntry.refCount++;
// once promise is complete, decrement the reference county
var finallyCallback = function (errorReason) {
cacheEntry.refCount--;
// if cache promise is pending and there is no one references it, it is no longer needed so reject it
if (cacheEntry.refCount === 0 && cachePromise.pending())
cachePromise.reject(errorReason);
};
promise.then((function () { return finallyCallback(); }), (function (errorReason) { return finallyCallback(errorReason); }));
// bind cache to deferred
// once cached promise is resolved, if it is rejected, remove it from cache
cachePromise.then((function (result) {
var bindingResult = bindingResultRewriter ? bindingResultRewriter(result) : result;
deferred.resolve(bindingResult);
}), (function (errorReason) { return deferred.reject(errorReason); }));
return promise;
};
/**
* Returns the context defined for the specified cached item.
* @param {string} cacheKey - Identifier of the cache entry
*/
LegacyRejectablePromiseCache.prototype.getEntryContext = function (cacheKey) {
debug.assertValue(cacheKey, 'cacheKey');
var cacheEntry = this.getCacheEntry(cacheKey);
if (cacheEntry)
return cacheEntry.context;
};
/** Returns all cache keys currently in the cache. */
LegacyRejectablePromiseCache.prototype.keys = function () {
return Object.keys(this.cache);
};
LegacyRejectablePromiseCache.prototype.isFull = function () {
return this.getEntryCount() === DefaultMaxCacheEntries; // Technically the cache may have been constructed with something other than the default -- realistically it isn't. Also, this class will be deleted soon anyway.
};
/**
* Enumerates over cache entries and passes each to the rewriter
* @param {IRejectablePromiseCacheRewriter} rewriter - rewriter of cache key
* rewriter may indicate that rewrite is completed.
*/
LegacyRejectablePromiseCache.prototype.rewriteAllEntries = function (rewriter) {
var keyUpdates = [];
var hasRewriteKey = !!rewriter.rewriteKey;
var hasRewriteResult = !!rewriter.rewriteResult;
var queryCache = this.cache;
for (var cacheKey in queryCache) {
if (hasRewriteKey) {
var newKey = rewriter.rewriteKey(cacheKey);
if (newKey !== cacheKey)
keyUpdates.push({ oldKey: cacheKey, newKey: newKey });
}
if (hasRewriteResult) {
var entry = queryCache[cacheKey];
if (entry && entry.result && rewriter.rewriteResult) {
entry.result = rewriter.rewriteResult(entry.result, cacheKey);
}
else {
entry.updateResult = function (result) { return (rewriter.rewriteResult && rewriter.rewriteResult(result, cacheKey)) || result; };
}
}
}
for (var i = 0, length_1 = keyUpdates.length; i < length_1; i++)
this.changeCacheKey(keyUpdates[i].oldKey, keyUpdates[i].newKey);
};
/**
* Puts an updated value for an existing cache item with the specified key.
*/
LegacyRejectablePromiseCache.prototype.putCacheResult = function (cacheKey, newResult, rewriteCacheEntryResult) {
debug.assertValue(cacheKey, 'cacheKey');
var cacheEntry = this.getCacheEntry(cacheKey);
if (!cacheEntry) {
debug.assertFail("cannot update no-existing cacheEntry for key '" + cacheKey + "' with result '" + newResult + "'");
return;
}
if (cacheEntry.result) {
cacheEntry.result = rewriteCacheEntryResult ? rewriteCacheEntryResult(newResult) : newResult;
}
else {
cacheEntry.updateResult = function () {
return newResult;
};
}
};
LegacyRejectablePromiseCache.prototype.appendCacheEntryInternal = function (cacheKey, cacheEntry) {
// Seems like it cannot happen but createCacheEntry is using getCacheEntry() to prevent duplicate insertions
// and that method excludes entries with no promise or result so maybe a null or undefined result can get in
// there allowing a key to be added twice which corrupts the data structure which maybe accounts for Defect 9735664:
// Frown: Cannot set property 'previousKey' of undefined ... (//sqlbuvsts01:8080/Main/SQL%20Server/_workItems#id=9735664&triage=true&fullScreen=false&_a=edit)
if (this.cache[cacheKey])
this.removeCacheEntryInternal(cacheKey);
// If this is the first entry, we need to initialize the variables for the start/end of the list
if (!this.firstKey) {
this.firstKey = cacheKey;
this.lastKey = cacheKey;
// Explicitly set these as we should not trust callers to set them correctly
cacheEntry.nextKey = undefined;
cacheEntry.previousKey = undefined;
}
else {
var previousLast = this.cache[this.lastKey];
previousLast.nextKey = cacheKey;
cacheEntry.previousKey = this.lastKey;
this.lastKey = cacheKey;
// Explicitly set this as we should not trust callers to set it correctly
cacheEntry.nextKey = undefined;
}
this.cache[cacheKey] = cacheEntry;
};
/**
* Removes a cache key safely by repairing the linked list pointers after removal
*/
LegacyRejectablePromiseCache.prototype.removeCacheEntryInternal = function (cacheKey) {
var cacheEntry = this.cache[cacheKey];
if (cacheEntry) {
var previousKey = cacheEntry.previousKey;
var nextKey = cacheEntry.nextKey;
if (previousKey) {
var previousEntry = this.cache[previousKey];
previousEntry.nextKey = nextKey;
}
else {
// If there is no previous key, we must be removing the first item in the list
this.firstKey = nextKey;
}
if (nextKey) {
var nextEntry = this.cache[nextKey];
nextEntry.previousKey = previousKey;
}
else {
// If there is no next key, we must be removing the last item in the list
this.lastKey = previousKey;
}
delete this.cache[cacheKey];
}
};
/**
* Change cache Key (rekey). It will check for collision before changing the key
* If rekey is successful, this function will return true, otherwise it will return false
*/
LegacyRejectablePromiseCache.prototype.changeCacheKey = function (oldKey, newKey) {
//delete cache if newkey is undefined/null/emptystring
if (!newKey) {
return this.clearEntry(oldKey, true /*reject promise*/);
}
// avoid collision
// avoid changes where oldkey is invalid
if (this.hasCacheEntry(newKey) || !this.hasCacheEntry(oldKey))
return false;
var cacheEntry = this.getCacheEntry(oldKey);
this.removeCacheEntryInternal(oldKey);
this.appendCacheEntryInternal(newKey, cacheEntry);
return true;
};
/**
* Gets cache entry associated with the provided key
* @param {string} cacheKey - Identifier of the cache entry
*/
LegacyRejectablePromiseCache.prototype.getCacheEntry = function (cacheKey) {
debug.assertValue(cacheKey, 'cacheKey');
var entry;
if (!!cacheKey &&
(entry = this.cache[cacheKey]) &&
(entry.promise || entry.result)) {
return entry;
}
return;
};
return LegacyRejectablePromiseCache;
}());
powerbi.LegacyRejectablePromiseCache = LegacyRejectablePromiseCache;
/**
* @class
* A cache of Rejectable Promises
*/
var RejectablePromiseCache = /** @class */ (function () {
/**
* Constructor of RejectablePromiseCache
* @param {IPromiseFactory} promiseFactory - factory used to create promises
* @param {EvictionPolicy} evictionPolicy - policy used to determine how we should evict items from a full cache
* @param {number} maxCacheEntries - the maximum number of entries allowed in the cache. If not set, we default to DefaultMaxCacheEntries.
*/
function RejectablePromiseCache(promiseFactory, evictionPolicy, maxCacheEntries) {
if (!maxCacheEntries) {
maxCacheEntries = DefaultMaxCacheEntries;
}
switch (evictionPolicy) {
case 1 /* LRU */:
this.cache = new powerbi.LruCache(maxCacheEntries);
break;
case 0 /* FIFO */:
default:
this.cache = new powerbi.FifoCache(maxCacheEntries);
break;
}
this.promiseFactory = promiseFactory;
}
/**
* Returns the number of entries in the cache
*/
RejectablePromiseCache.prototype.getEntryCount = function () {
return this.cache.size();
};
/**
* Indicates if there is an entry in the cache for the provided key
* @param {string} cacheKey - Identifier of the cache entry
*/
RejectablePromiseCache.prototype.hasCacheEntry = function (cacheKey) {
debug.assertValue(cacheKey, 'cacheKey');
return !!this.getCacheEntry(cacheKey);
};
/**
* Creates a cache entry associated with the provided key. If the key is already
* pointing to a cache entry, 'undefined' is returned.
* @param {string} cacheKey - Identifier of the cache entry
* @param rewriteResult - Rewrites the Query result. This affects `cacheEntry.result` as well as the result which `cacheEntry.promise` is resolved with.
* @param rewriteCachedResult - Rewrites `cacheEntry.result` only. This does'nt affect the result which `cacheEntry.promise` is resolved with.
*/
RejectablePromiseCache.prototype.createCacheEntry = function (cacheKey, context, rewriteResult, rewriteCachedResult, telemetryV2Enabled) {
var _this = this;
debug.assertValue(cacheKey, 'cacheKey');
var cacheEntry = this.getCacheEntry(cacheKey);
// if cacheKey is undefined/empty string or there is a cache entry, return undefined
if (!cacheKey || cacheEntry)
return;
var promiseFactory = this.promiseFactory;
var queryCache = this.cache;
var deferred = promiseFactory.defer(telemetryV2Enabled);
var promise = powerbi.createRejectablePromise(deferred);
var entryDeferred = promiseFactory.defer(telemetryV2Enabled);
var entryPromise = powerbi.createRejectablePromise2(entryDeferred);
cacheEntry = {
promise: entryPromise,
refCount: 0,
context: context,
};
this.appendCacheEntryInternal(cacheKey, cacheEntry);
promise
.then((function (result) {
// We know cacheEntry won't be reassigned before this continuation
cacheEntry = cacheEntry;
if (cacheEntry.updateResult)
result = cacheEntry.updateResult(result);
if (result && rewriteResult)
result = rewriteResult(result);
cacheEntry.result = rewriteCachedResult ? rewriteCachedResult(result) : result;
entryDeferred.resolve(result);
}), (function (reason) { return entryDeferred.reject(reason); }))
.finally((function () {
delete cacheEntry.updateResult;
}));
entryPromise
.finally((function () {
if (queryCache.containsKey(cacheKey)) {
delete queryCache.get(cacheKey).promise;
// if promise is rejected, delete the cache entry to allow for future re-execution of the same query
if (entryPromise.rejected())
_this.removeCacheEntryInternal(cacheKey);
}
}))
.catch((function (errorReason) { return promise.reject(errorReason); }));
return { deferred: deferred, promise: promise };
};
/**
* clears the cache from the entry associated with the provided cache key
* @param {string} cacheKey - Identifier of the cache entry
* @param {boolean} rejectPromise - indicates of the promise should be reject. Promise is reject only if it is pending
*/
RejectablePromiseCache.prototype.clearEntry = function (cacheKey, rejectPromise) {
var cacheEntry = this.getCacheEntry(cacheKey);
if (cacheEntry) {
var cachePromise = cacheEntry.promise;
if (rejectPromise && cachePromise) {
// It is sufficient to just reject the promise since
// reject will finally delete the cache as well (see implementation of createCacheEntry)
cachePromise.reject();
}
else {
this.removeCacheEntryInternal(cacheKey);
}
return true;
}
return false;
};
/**
* clears the cache from the entry associated with the provided cache key
* @param {boolean} rejectPromise - indicates of promises shouputCacheResultld be reject. A Promise is reject only if it is pending
*/
RejectablePromiseCache.prototype.clearAllEntries = function (rejectPromise) {
for (var _i = 0, _a = this.cache.keys(); _i < _a.length; _i++) {
var cacheKey = _a[_i];
this.clearEntry(cacheKey, rejectPromise);
}
};
/**
* Bind a new promise to cached query results and returns the promise. Once results are available deferred is resolved.
* If bindingResultRewriter is specified, its return value will be used for resolving the returned promise.
* Note that bindingResultRewriter MUST NOT modify its input argument object, otherwise the rewrites would be reflected in the result of the original cache entry.
* Instead, bindingResultRewriter should clone or inherit from the input argument object, apply rewrites on the clone or inherited object, and then return it.
* @param {string} cacheKey - Identifier of the cache entry
* @param {IBindingResultRewriter} bindingResultRewriter - If specified, its return value will be used for resolving the returned promise. See comments on this function for details.
*/
RejectablePromiseCache.prototype.bindCacheEntry = function (cacheKey, bindingResultRewriter, telemetryV2Enabled) {
debug.assertValue(cacheKey, 'cacheKey');
var cacheEntry = this.getCacheEntry(cacheKey);
// if there is no cache entry for this key, return
if (cacheEntry === undefined)
return;
var deferred = this.promiseFactory.defer(telemetryV2Enabled);
var promise = powerbi.createRejectablePromise2(deferred);
if (cacheEntry.result) {
var bindingResult = bindingResultRewriter ? bindingResultRewriter(cacheEntry.result) : cacheEntry.result;
deferred.resolve(bindingResult);
return promise;
}
var cachePromise = cacheEntry.promise;
if (!cachePromise) {
deferred.reject(undefined);
return promise;
}
cacheEntry.refCount++;
// once promise is complete, decrement the reference count
var finallyCallback = function (errorReason) {
cacheEntry.refCount--;
// if cache promise is pending and there is no one references it, it is no longer needed so reject it
if (cacheEntry.refCount === 0 && cachePromise.pending())
cachePromise.reject(errorReason);
};
promise.then((function () { return finallyCallback(); }), (function (errorReason) { return finallyCallback(errorReason); }));
// bind cache to deferred
// once cached promise is resolved, if it is rejected, remove it from cache
cachePromise.then((function (result) {
var bindingResult = bindingResultRewriter ? bindingResultRewriter(result) : result;
deferred.resolve(bindingResult);
}), (function (errorReason) { return deferred.reject(errorReason); }));
return promise;
};
/**
* Returns the context defined for the specified cached item.
* @param {string} cacheKey - Identifier of the cache entry
*/
RejectablePromiseCache.prototype.getEntryContext = function (cacheKey) {
debug.assertValue(cacheKey, 'cacheKey');
var cacheEntry = this.getCacheEntry(cacheKey);
if (cacheEntry)
return cacheEntry.context;
};
/** Returns all cache keys currently in the cache. */
RejectablePromiseCache.prototype.keys = function () {
return this.cache.keys();
};
RejectablePromiseCache.prototype.isFull = function () {
return this.cache.isFull();
};
/**
* Enumerates over cache entries and passes each to the rewriter
* @param {IRejectablePromiseCacheRewriter} rewriter - rewriter of cache key
* rewriter may indicate that rewrite is completed.
*/
RejectablePromiseCache.prototype.rewriteAllEntries = function (rewriter) {
var keyUpdates = [];
var hasRewriteKey = !!rewriter.rewriteKey;
var hasRewriteResult = !!rewriter.rewriteResult;
var queryCache = this.cache;
var _loop_1 = function (cacheKey) {
if (hasRewriteKey) {
var newKey = rewriter.rewriteKey(cacheKey);
if (newKey !== cacheKey)
keyUpdates.push({ oldKey: cacheKey, newKey: newKey });
}
if (hasRewriteResult) {
var entry = queryCache.get(cacheKey);
if (entry) {
if (entry.result && rewriter.rewriteResult) {
entry.result = rewriter.rewriteResult(entry.result, cacheKey);
}
else {
entry.updateResult = function (result) { return (rewriter.rewriteResult && rewriter.rewriteResult(result, cacheKey)) || result; };
}
}
}
};
for (var _i = 0, _a = queryCache.keys(); _i < _a.length; _i++) {
var cacheKey = _a[_i];
_loop_1(cacheKey);
}
for (var i = 0, length_2 = keyUpdates.length; i < length_2; i++)
this.changeCacheKey(keyUpdates[i].oldKey, keyUpdates[i].newKey);
};
/**
* Puts an updated value for an existing cache item with the specified key.
*/
RejectablePromiseCache.prototype.putCacheResult = function (cacheKey, newResult, rewriteCacheEntryResult) {
debug.assertValue(cacheKey, 'cacheKey');
var cacheEntry = this.getCacheEntry(cacheKey);
if (!cacheEntry) {
debug.assertFail("cannot update no-existing cacheEntry for key '" + cacheKey + "' with result '" + newResult + "'");
return;
}
if (cacheEntry.result) {
cacheEntry.result = rewriteCacheEntryResult ? rewriteCacheEntryResult(newResult) : newResult;
}
else {
cacheEntry.updateResult = function () {
return newResult;
};
}
};
RejectablePromiseCache.prototype.appendCacheEntryInternal = function (cacheKey, cacheEntry) {
// Seems like it cannot happen but createCacheEntry is using getCacheEntry() to prevent duplicate insertions
// and that method excludes entries with no promise or result so maybe a null or undefined result can get in
// there allowing a key to be added twice which corrupts the data structure which maybe accounts for Defect 9735664:
// Frown: Cannot set property 'previousKey' of undefined ... (//sqlbuvsts01:8080/Main/SQL%20Server/_workItems#id=9735664&triage=true&fullScreen=false&_a=edit)
if (this.cache.containsKey(cacheKey)) {
this.removeCacheEntryInternal(cacheKey);
}
this.cache.put(cacheKey, cacheEntry);
};
/**
* Removes a cache key safely by repairing the linked list pointers after removal
*/
RejectablePromiseCache.prototype.removeCacheEntryInternal = function (cacheKey) {
this.cache.remove(cacheKey);
};
/**
* Change cache Key (rekey). It will check for collision before changing the key
* If rekey is successful, this function will return true, otherwise it will return false
*/
RejectablePromiseCache.prototype.changeCacheKey = function (oldKey, newKey) {
//delete cache if newkey is undefined/null/emptystring
if (!newKey) {
return this.clearEntry(oldKey, true /*reject promise*/);
}
// avoid collision
// avoid changes where oldkey is invalid
if (this.hasCacheEntry(newKey) || !this.hasCacheEntry(oldKey))
return false;
var cacheEntry = this.getCacheEntry(oldKey);
this.removeCacheEntryInternal(oldKey);
this.appendCacheEntryInternal(newKey, cacheEntry);
return true;
};
/**
* Gets cache entry associated with the provided key
* @param {string} cacheKey - Identifier of the cache entry
*/
RejectablePromiseCache.prototype.getCacheEntry = function (cacheKey) {
debug.assertValue(cacheKey, 'cacheKey');
var entry;
if (!!cacheKey &&
(entry = this.cache.get(cacheKey)) &&
(entry.promise || entry.result)) {
return entry;
}
return;
};
return RejectablePromiseCache;
}());
powerbi.RejectablePromiseCache = RejectablePromiseCache;
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var events;
(function (events) {
var KeyUtils = jsCommon.KeyUtils;
events.visualThemeChanged = {
type: 2 /* Visual */,
name: 'visualThemeChanged',
};
/**
* Helper function to decide whether to short-circuit keyboard event handlers when modifier keys are repeating
* (e.g., someone holds down the CTRL key while multi-selecting visual data points).
*
* @param event The "KeyboardEvent" that triggered the event listener
* @returns Whether the event should short-circuit and quit immediately
*/
function isKeyboardEventIncomplete(event) {
// if these properties don't exist (useragent didn't set modern properties), just accept
if (event.composed == null || event.repeat == null)
return false;
return !event.composed ||
(event.repeat && (event.keyCode === 17 /* ctrlKeyCode */ || KeyUtils.isNudgeModifierKey(event.keyCode)));
}
events.isKeyboardEventIncomplete = isKeyboardEventIncomplete;
})(events = powerbi.events || (powerbi.events = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var ArrayExtensions = jsCommon.ArrayExtensions;
/** Functions to help manage a list of items that can be grouped and nested. The tree is
* immutable, meaning lists and items will not be mutated but instead allocate a new instance.
* TNode may either be a leaf node or a group node. */
var ItemGroupingManager;
(function (ItemGroupingManager) {
/** Find a node within the item list using given id. */
function find(name, itemList) {
if (!name || !itemList)
return;
var foundNode;
executeByNameImmutable(name, itemList, (function (list, item, _index) {
foundNode = item;
return list;
}));
return foundNode;
}
ItemGroupingManager.find = find;
/** Get a the sibling list of a given node from the whole tree. */
function getSiblingList(item, itemList) {
var foundList;
executeByNameImmutable(item.name, itemList, (function (list, _item, _index) {
foundList = list;
return list;
}));
return foundList;
}
ItemGroupingManager.getSiblingList = getSiblingList;
/** Add item to item list; returns a new instance of item list array. */
function add(itemList) {
var items = [];
for (var _i = 1; _i < arguments.length; _i++) {
items[_i - 1] = arguments[_i];
}
return __spreadArray(__spreadArray([], (itemList || [])), (items || []));
}
ItemGroupingManager.add = add;
function addToGroup(newItem, group, itemList) {
return executeByNameImmutable(group.name, itemList, (function (list, item, _index) {
if (!isGroupItem(item)) {
debug.assertFail('should find group item');
return list;
}
var newGroup = item.clone ? item.clone() : _.clone(item);
newGroup.children = __spreadArray(__spreadArray([], (item.children || [])), [newItem]);
for (var _i = 0, _a = newGroup.children; _i < _a.length; _i++) {
var child = _a[_i];
child.parentGroup = newGroup; // adjust parentGroup reference with new instance
}
return ArrayExtensions.rewriteArray(list, (function (node) { return node === item ? newGroup : node; }));
}));
}
ItemGroupingManager.addToGroup = addToGroup;
/** Remove given node from the item list. */
function remove(item, itemList, isCleanUpEmptyGroup) {
if (isCleanUpEmptyGroup === void 0) { isCleanUpEmptyGroup = true; }
itemList = executeByNameImmutable(item.name, itemList, (function (list, item, _index) {
return ArrayExtensions.filterArray(list, (function (node) { return item !== node; }));
}));
// remove is called from move as well, and if we are moving above a group to be called it would be faulty
if (isCleanUpEmptyGroup)
itemList = cleanUpEmptyGroups(itemList);
return itemList;
}
ItemGroupingManager.remove = remove;
/** Remove all given nodes in removeList from the item list. */
function removeMultiple(removeList, itemList, isCleanUpEmptyGroup) {
if (isCleanUpEmptyGroup === void 0) { isCleanUpEmptyGroup = true; }
itemList = executeAllImmutable(itemList, (function (list) {
var afterRemovedList = _.differenceWith(list, removeList, (function (a, b) { return a.name === b.name; }));
if (afterRemovedList.length === list.length) {
// return original array
return list;
}
return afterRemovedList;
}));
// remove is called from move as well, and if we are moving above a group to be called it would be faulty
if (isCleanUpEmptyGroup)
itemList = cleanUpEmptyGroups(itemList);
return itemList;
}
ItemGroupingManager.removeMultiple = removeMultiple;
/** Remove nodes from the item list that return true for the given predicate. */
function removeBy(itemList, predicate) {
itemList = executeAllImmutable(itemList, (function (list) {
return ArrayExtensions.filterArray(list, (function (node) { return !predicate(node); }));
}));
return cleanUpEmptyGroups(itemList);
}
ItemGroupingManager.removeBy = removeBy;
/** Move source nodes to be positioned before or after target node within the item list based on append flag. */
function move(sources, target, itemList, append) {
// first clear parentGroup reference, which will be mapped as necessary during executeByNameImmutable
sources.forEach((function (source) { return source.parentGroup = undefined; }));
itemList = removeMultiple(sources, itemList, false);
itemList = executeByNameImmutable(target.name, itemList, (function (list, item, _index) {
return ArrayExtensions.spliceArray(list, (function (node) {
if (node === item)
return append ? __spreadArray([node], sources) : __spreadArray(__spreadArray([], sources), [node]);
else
return [node];
}));
}));
// clean up empty groups after moving
return cleanUpEmptyGroups(itemList);
}
ItemGroupingManager.move = move;
/** Add a new group to the list. All children nodes of newGroup must already exist in item list. */
function group(newGroup, itemList) {
for (var _i = 0, _a = newGroup.children; _i < _a.length; _i++) {
var child = _a[_i];
child.parentGroup = newGroup;
}
itemList = groupInternal(newGroup.children, newGroup, itemList);
return cleanUpEmptyGroups(itemList);
}
ItemGroupingManager.group = group;
/** Ungroup the given group within the list. All children nodes will remain in item list. */
function ungroup(group, itemList) {
// first clear parentGroup references; they will be mapped as necessary during executeByNameImmutable
for (var _i = 0, _a = group.children; _i < _a.length; _i++) {
var child = _a[_i];
child.parentGroup = undefined;
}
return executeByNameImmutable(group.name, itemList, (function (list, _item, _index) {
return ArrayExtensions.spliceArray(list, (function (node) { return node === group ? group.children : [node]; }));
}));
}
ItemGroupingManager.ungroup = ungroup;
/** Flatten all items in item list. A type guard for the leaf node type must be provided. Given a flattenedList,
* flattened items will be appened to the provided list. */
// TODO Fix Explicit Any
function flattenItems(itemList, isItemType, flattenedList) {
var currentList = flattenedList || [];
for (var _i = 0, itemList_1 = itemList; _i < itemList_1.length; _i++) {
var item = itemList_1[_i];
if (isGroupItem(item)) {
currentList = flattenItems(item.children, isItemType, currentList);
}
else if (isItemType(item)) {
currentList = __spreadArray(__spreadArray([], (currentList || [])), [item]);
}
}
return currentList;
}
ItemGroupingManager.flattenItems = flattenItems;
/** Given a list of items that are being grouped and the new group that they're already a child of,
* we search the tree for the 1st item in the group and replace it with the entire group. We also
* remove any of the remaining grouped nodes from the tree. */
function groupInternal(groupedItems, newGroup, itemList) {
return executeAllImmutable(itemList, (function (list) {
return ArrayExtensions.spliceArray(list, (function (node) {
if (node === groupedItems[0])
return [newGroup];
else if (_.includes(groupedItems, node))
return [];
else
return [node];
}));
}));
}
function cleanUpEmptyGroups(itemList) {
return executeAllImmutable(itemList, (function (list) {
return ArrayExtensions.filterArray(list, (function (node) { return !isGroupItem(node) || !_.isEmpty(node.children); }));
}));
}
/**
* Traverses the tree of groupable items and calls callback on the node that matches target name.
* Callback should return either a new instance of the item list or the original list; it should
* not mutate the given item list. If the list has been updated, all parent nodes will be updated
* with new instances.
*
* Returns once the target node has been found.
*/
function executeByNameImmutable(targetName, itemList, callback) {
debug.assertValue(itemList, 'itemGrouping - itemList');
debug.assertValue(targetName, 'itemGrouping - targetName');
debug.assertValue(callback, 'itemGrouping - callback');
var _loop_2 = function (index) {
var item = itemList[index];
if (item.name === targetName) {
return { value: callback(itemList, item, index) };
}
if (isGroupItem(item)) {
var newChildren = executeByNameImmutable(targetName, item.children, callback);
if (newChildren !== item.children) {
var newGroup_1 = item.clone ? item.clone() : _.clone(item);
newGroup_1.children = newChildren;
for (var _i = 0, _a = newGroup_1.children; _i < _a.length; _i++) {
var child = _a[_i];
child.parentGroup = newGroup_1; // adjust parentGroup reference with new instance
}
return { value: ArrayExtensions.rewriteArray(itemList, (function (node) { return node === item ? newGroup_1 : node; })) };
}
}
};
for (var index = 0; index < itemList.length; index++) {
var state_1 = _loop_2(index);
if (typeof state_1 === "object")
return state_1.value;
}
return itemList;
}
/**
* Traverses the full tree of groupable items and calls callback on all levels' item lists.
* Callback should return either a new instance of the item list or the original list; it should
* not mutate the given item list. If the list has been updated, all parent nodes will be updated
* with new instances.
*/
function executeAllImmutable(itemList, callback) {
debug.assertValue(itemList, 'itemGrouping - itemList');
debug.assertValue(callback, 'itemGrouping - callback');
var _loop_3 = function (item) {
if (isGroupItem(item)) {
var childrenList = executeAllImmutable(item.children, callback);
if (childrenList !== item.children) {
var newGroup_2 = item.clone ? item.clone() : _.clone(item);
newGroup_2.children = childrenList;
for (var _a = 0, _b = newGroup_2.children; _a < _b.length; _a++) {
var child = _b[_a];
child.parentGroup = newGroup_2; // adjust parentGroup reference with new instance
}
itemList = ArrayExtensions.rewriteArray(itemList, (function (node) { return node === item ? newGroup_2 : node; }));
}
}
};
for (var _i = 0, itemList_2 = itemList; _i < itemList_2.length; _i++) {
var item = itemList_2[_i];
_loop_3(item);
}
itemList = callback(itemList);
return itemList;
}
function isGroupItem(item) {
return item.children !== undefined;
}
})(ItemGroupingManager = powerbi.ItemGroupingManager || (powerbi.ItemGroupingManager = {}));
})(powerbi || (powerbi = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
/** Do not instantiate directly. Call CopyPasteService.create() instead. */
var CopyPasteService = /** @class */ (function () {
function CopyPasteService(_telemetryService) {
this.element = document.createElement('textarea');
this.element.style.position = 'absolute';
this.element.style.left = '-9999px';
}
CopyPasteService.prototype.copyText = function (value, telemetryService, visualType) {
debug.assertValue(value, "copyText didn't get a value");
var text;
if (typeof value === "string")
text = value;
else if (typeof value === "function")
text = value();
else
debug.assertNever(value);
this.copyToClipboard(text);
this.logTelemetry(telemetryService, "Value" /* Value */, visualType);
};
CopyPasteService.prototype.copyGrid = function (selectionValues, telemetryService, visualType) {
var _this = this;
debug.assertValue(selectionValues, "copyGrid didn't get a value");
var _a = selectionValues(), grid = _a.grid, coveragePercentage = _a.coveragePercentage;
var lines = [];
if (!_.isEmpty(grid)) {
for (var _i = 0, grid_1 = grid; _i < grid_1.length; _i++) {
var row = grid_1[_i];
if (!_.isEmpty(row)) {
lines.push(_.map(row, (function (cell) { return cell == null ? "" : _this.removeBreaks(cell); }))
.join('\t'));
}
}
}
this.copyToClipboard(lines.join('\n'));
this.logTelemetry(telemetryService, "Selection" /* Selection */, visualType, coveragePercentage);
};
CopyPasteService.prototype.removeBreaks = function (text) {
return text
.replace(new RegExp('\t', 'g'), ' ')
.replace(new RegExp('\r\n', 'g'), ' ')
.replace(new RegExp('\n', 'g'), ' ');
};
CopyPasteService.prototype.copyToClipboard = function (text) {
this.element.value = text;
document.body.appendChild(this.element);
// Capture currently focused element
var activeElement = document.activeElement;
this.element.select();
document.execCommand('copy');
document.body.removeChild(this.element);
// Return focus
if (activeElement)
activeElement.focus();
};
CopyPasteService.prototype.logTelemetry = function (telemetryService, copyType, visualType, coveragePercentage) {
if (!telemetryService)
return;
telemetryService.logEvent(powerbi.telemetry.EXCopyActionClicked, { copyType: copyType, visualType: visualType || "(unknown)", copySelectionPercentage: coveragePercentage || 0 });
};
return CopyPasteService;
}());
powerbi.CopyPasteService = CopyPasteService;
(function (CopyPasteService) {
var instance;
function create() {
if (!instance)
instance = new CopyPasteService();
return instance;
}
CopyPasteService.create = create;
})(CopyPasteService = powerbi.CopyPasteService || (powerbi.CopyPasteService = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var telemetry;
(function (telemetry) {
telemetry.EventFactories = {};
})(telemetry = powerbi.telemetry || (powerbi.telemetry = {}));
})(powerbi || (powerbi = {}));
(function (powerbi) {
var generateGuid = jsCommon.Utility.generateGuid;
// The following telelmetry fields are restricted from override.
var OverrideRestrictedFields = ["sessionId", "tenantObjectId", "userObjectId", "userId", "isInternalUser", "sessionSource"];
function getHashCode(inputStr) {
var hash = 0, i, chrCode, len;
if (inputStr.length === 0)
return hash;
var lowerInputString = inputStr.toLowerCase();
for (i = 0, len = lowerInputString.length; i < len; i++) {
chrCode = lowerInputString.charCodeAt(i);
hash = ((hash << 5) - hash) + chrCode;
hash |= 0;
}
return hash;
}
powerbi.getHashCode = getHashCode;
function obfuscate(inputStr) {
return getHashCode(inputStr).toString();
}
powerbi.obfuscate = obfuscate;
function extendFormatted(requiredFields, optionalFields, target) {
debug.assertAnyValue(requiredFields, 'requiredFields');
debug.assertAnyValue(optionalFields, 'optionalFields');
debug.assertAnyValue(target, 'target');
var result = target || requiredFields || {};
if (target && requiredFields)
target = jsCommon.UnionExtensions.mergeUnionType(target, requiredFields);
if (optionalFields) {
for (var key in optionalFields) {
if (!optionalFields.hasOwnProperty(key))
continue;
var value = optionalFields[key];
if (value !== undefined && value !== false)
result[key] = value;
}
}
return result;
}
powerbi.extendFormatted = extendFormatted;
function extendFormattedEx(toEventObject, fromEventObject, fieldsToExcludeIfUndefinedOrFalse) {
// Clear fields that are defind as excluded if undefined or false
if (fieldsToExcludeIfUndefinedOrFalse) {
var keys = [];
for (var field in fieldsToExcludeIfUndefinedOrFalse) {
// @ts-ignore: No Implicit Any
var value = fromEventObject[fieldsToExcludeIfUndefinedOrFalse[field]];
if (value === undefined || value === false) {
keys.push(fieldsToExcludeIfUndefinedOrFalse[field]);
}
}
fromEventObject = _.omit(fromEventObject, keys);
}
_.extend(toEventObject, fromEventObject);
return toEventObject;
}
powerbi.extendFormattedEx = extendFormattedEx;
/**
* Single implementation for the factory method of the telemetry events
*/
function telemetryEventFactory(parameters) {
if (parameters === void 0) { parameters = {}; }
var base = telemetryBaseEventFactory(parameters);
return __assign(__assign({ time: jsCommon.performance.now(), id: generateGuid() }, parameters), { info: base.info, formatted: base.formatted });
}
powerbi.telemetryEventFactory = telemetryEventFactory;
function telemetryBaseEventFactory(parameters) {
var _a, _b;
if (parameters === void 0) { parameters = {}; }
var baseEventInfo = (_b = (_a = parameters === null || parameters === void 0 ? void 0 : parameters.baseEvent) === null || _a === void 0 ? void 0 : _a.info) !== null && _b !== void 0 ? _b : {};
var baseEvent = parameters === null || parameters === void 0 ? void 0 : parameters.baseEvent;
var info = __assign(__assign({}, baseEventInfo), parameters.info);
var optionalParameters = parameters.optionalParameters
? (baseEvent === null || baseEvent === void 0 ? void 0 : baseEvent.optionalParameters)
? __spreadArray(__spreadArray([], parameters.optionalParameters), baseEvent === null || baseEvent === void 0 ? void 0 : baseEvent.optionalParameters) : parameters.optionalParameters
: baseEvent === null || baseEvent === void 0 ? void 0 : baseEvent.optionalParameters;
var event = {
formatted: function () { return extendFormattedEx({}, info, optionalParameters); },
optionalParameters: optionalParameters,
info: info
};
return event;
}
powerbi.telemetryBaseEventFactory = telemetryBaseEventFactory;
/**
* Will fill the currently running event in ZoneJS with the provided
* @param eventName Textual representation of event name as mentioned in bond file. Used for verification.
* @param info The provided key/value pairs to be added to current event.
*/
function fillTelemetryEvent(eventName, info) {
debug.assert(!_.isEmpty(eventName), 'eventName');
debug.assertValue(info, 'info');
debug.assertValue(Zone, 'Zone');
var currentZone = Zone.current;
if (!currentZone || currentZone.name !== eventName) {
debug.assertFail("This method is expected to be used with ZoneJS and current Zone match the event name. event=" + eventName + ", currentZone=" + (currentZone && currentZone.name));
return;
}
var data = currentZone.get('data');
if (!data) {
debug.assertFail('No data field is stored in current zone');
return;
}
// Throw on any field restricted from override.
for (var _i = 0, OverrideRestrictedFields_1 = OverrideRestrictedFields; _i < OverrideRestrictedFields_1.length; _i++) {
var field = OverrideRestrictedFields_1[_i];
// @ts-ignore: No Implicit Any
if (info[field] !== undefined) {
throw new Error("Field '" + field + "' is restricted from override.");
}
}
var currentEvent = data.monitoredActivity && data.monitoredActivity.activityEvent;
_.extend(currentEvent.info, info);
}
powerbi.fillTelemetryEvent = fillTelemetryEvent;
/**
* In certain situation, AngularJS code needs to trigger a digest cycle and this happens under the NgZone by force.
* In such case, we pass around the current Zone, and then, we can use this utility to run the code under the correct zone.
*/
function zoneify(currentZone, fn, thisArg) {
if (currentZone) {
return currentZone.run((function () { return fn.apply(thisArg); }));
}
else {
if (thisArg) {
return thisArg.fn();
}
else {
return fn();
}
}
}
powerbi.zoneify = zoneify;
/**
* Checks if the provided zone to check is rooted to `angular` zone or not.
* NOTE: For any zone, reading a property will go to read it from the zone then it will move to parent nodes traversing
* the tree up till it finds with the first parent that has this property defined.
*/
function isAngularZone(zone) {
return zone && zone.get('isAngularZone') === true;
}
powerbi.isAngularZone = isAngularZone;
/**
* Checks if all the branch has 0 count of Microtasks by traversing the tree starting from the provided zone till we exit from the
* `angular` zone branch of the tree.
* @param zone provided zone to use. *
*/
function hasPendingMicrotasks(zone) {
var result = false;
var currentZone = zone;
while (!!currentZone && isAngularZone(currentZone)) {
// NOTE: we are accessing an internal implementation of ZoneJS.
// There is a risk here for a breaking change if the version of ZoneJS is upgraded.
// Unfortunately, this information is not exposed.
// TODO: add a UT to break if this implementation changed
var counts = currentZone._zoneDelegate._taskCounts;
if (counts['microTask'] > 0) {
result = true;
break;
}
currentZone = currentZone.parent;
}
return result;
}
powerbi.hasPendingMicrotasks = hasPendingMicrotasks;
})(powerbi || (powerbi = {}));
/* tslint:disable */
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Tool : bondc, Version=3.0.1, Build=bond-git.retail.not
// Template : bondTypeScriptTransform.TT
// File : commonTelemetryEvents.generated.ts
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var telemetry;
(function (telemetry) {
var Utility = jsCommon.Utility;
// @ts-ignore: ignore since it may trigger noUnusedLocals error
var telemetryEventFactory = powerbi.telemetryEventFactory;
// @ts-ignore: ignore since it may trigger noUnusedLocals error
var telemetryBaseEventFactory = powerbi.telemetryBaseEventFactory;
// @ts-ignore: ignore since it may trigger noUnusedLocals error
var EventFactories = powerbi.telemetry.EventFactories;
// @ts-ignore
var generateGuid;
if (Utility) {
generateGuid = Utility.generateGuid;
}
else {
// NOTE: This code may run in an environment where Utility is not available (e.g., Desktop ResourceLoader.htm).
// In this case, we fall back to a no-op implementation.
generateGuid = Function.prototype;
}
telemetry.BaseEventEventName = 'BaseEvent';
/**
* Base Event class
*/
telemetry.BaseEvent = EventFactories[telemetry.BaseEventEventName] = function (parameters) {
return telemetryBaseEventFactory({
info: __assign({ isError: false, isCancelled: false, isFireAndForget: false, inTeams: false }, parameters),
optionalParameters: ['isError', 'errorSource', 'errorCode', 'activityName', 'activityId', 'isCancelled', 'pingLatency', 'errorMessage', 'folderId', 'activeFolderCapacityId', 'baseVersion', 'isFireAndForget', 'inTeams', 'expAssignment', 'hostPlatformType', 'hostPlatformName'],
});
};
telemetry.TimedEventEventName = 'TimedEvent';
/**
* An event for which we're capturing timing info (start and end)
*/
telemetry.TimedEvent = EventFactories[telemetry.TimedEventEventName] = function (parameters) {
return telemetryBaseEventFactory({
info: parameters,
baseEvent: telemetry.BaseEvent(parameters),
});
};
telemetry.VerboseEventName = 'Verbose';
/**
* Telemetry event used when logging child events.
*/
telemetry.Verbose = EventFactories[telemetry.VerboseEventName] = function (parameters) {
return telemetryBaseEventFactory({
info: parameters,
baseEvent: telemetry.BaseEvent(parameters),
});
};
telemetry.VerboseTimedEventEventName = 'VerboseTimedEvent';
/**
* A verbose event for which we're capturing timing info (start and end)
*/
telemetry.VerboseTimedEvent = EventFactories[telemetry.VerboseTimedEventEventName] = function (parameters) {
return telemetryBaseEventFactory({
info: parameters,
baseEvent: telemetry.Verbose(parameters),
});
};
telemetry.TraceEventName = 'Trace';
/**
* Trace event
*/
telemetry.Trace = EventFactories[telemetry.TraceEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TraceEventName,
info: parameters,
category: powerbi.TelemetryCategory.Trace,
loggers: telemetry.TraceLoggers,
});
return event;
};
telemetry.ErrorEventName = 'Error';
/**
* Event is fired when an unexpected error is encountered. This event isn't fired when an action fails and is handled by the parent code.
*/
telemetry.Error = EventFactories[telemetry.ErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.ErrorEventName,
info: parameters,
category: powerbi.TelemetryCategory.CriticalError,
loggers: telemetry.ErrorLoggers,
});
return event;
};
telemetry.ErrorWithStackTraceEventName = 'ErrorWithStackTrace';
/**
* Event is fired when an unexpected error is encountered. Event properties include the exception stack trace.
*/
telemetry.ErrorWithStackTrace = EventFactories[telemetry.ErrorWithStackTraceEventName] = function (parameters) {
return telemetryBaseEventFactory({
info: parameters,
});
};
telemetry.ErrorWithStackTraceAndSourceDetailsEventName = 'ErrorWithStackTraceAndSourceDetails';
/**
* Event is fired when an unexpected error is encountered. Event properties include the source URL, line and column number.
*/
telemetry.ErrorWithStackTraceAndSourceDetails = EventFactories[telemetry.ErrorWithStackTraceAndSourceDetailsEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.ErrorWithStackTraceAndSourceDetailsEventName,
baseEvent: telemetry.ErrorWithStackTrace(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CriticalError,
loggers: telemetry.ErrorWithStackTraceAndSourceDetailsLoggers,
});
return event;
};
telemetry.CustomerActionEventName = 'CustomerAction';
/**
* Telemetry event used when logging top level customer actions.
*/
telemetry.CustomerAction = EventFactories[telemetry.CustomerActionEventName] = function (parameters) {
return telemetryBaseEventFactory({
info: parameters,
baseEvent: telemetry.BaseEvent(parameters),
});
};
telemetry.DashboardRootSessionEventName = 'PBI.Dashboard.RootSession';
/**
* Event is fired when the PBI Dashboard is first loaded, and subsequently every time the session timeout is reset.
*/
telemetry.DashboardRootSession = EventFactories[telemetry.DashboardRootSessionEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DashboardRootSessionEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.DashboardRootSessionLoggers,
});
return event;
};
telemetry.WFEErrorEventName = 'PBI.WFE.Error';
/**
* Fired when there is an error.
*/
telemetry.WFEError = EventFactories[telemetry.WFEErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.WFEErrorEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.WFEErrorLoggers,
});
return event;
};
telemetry.TeamsRedirectTabConfigPageEventName = 'PBI.TeamsRedirect.TabConfigPage';
/**
* Event traced when we are redirected from teams.powerbi.com for Config page.
*/
telemetry.TeamsRedirectTabConfigPage = EventFactories[telemetry.TeamsRedirectTabConfigPageEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsRedirectTabConfigPageEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsRedirectTabConfigPageLoggers,
});
return event;
};
telemetry.TeamsRedirectPersonalAppEventName = 'PBI.TeamsRedirect.PersonalApp';
/**
* Event traced when we are redirected from teams.powerbi.com for Personal App
*/
telemetry.TeamsRedirectPersonalApp = EventFactories[telemetry.TeamsRedirectPersonalAppEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsRedirectPersonalAppEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsRedirectPersonalAppLoggers,
});
return event;
};
telemetry.TeamsRedirectTabReportEventName = 'PBI.TeamsRedirect.TabReport';
/**
* Event traced when we are redirected from teams.powerbi.com for a Report in Tab
*/
telemetry.TeamsRedirectTabReport = EventFactories[telemetry.TeamsRedirectTabReportEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsRedirectTabReportEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsRedirectTabReportLoggers,
});
return event;
};
telemetry.TeamsRedirectUpdateTabUrlEventName = 'PBI.TeamsRedirect.UpdateTabUrl';
/**
* Event traced when we update the url for Teams Tab Report from old embed url to new url
*/
telemetry.TeamsRedirectUpdateTabUrl = EventFactories[telemetry.TeamsRedirectUpdateTabUrlEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsRedirectUpdateTabUrlEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsRedirectUpdateTabUrlLoggers,
});
return event;
};
telemetry.TeamsAuthenticationSSOSuccessEventName = 'PBI.TeamsAuthentication.SSOSuccess';
/**
* Event traced when Teams SSO succeeds.
*/
telemetry.TeamsAuthenticationSSOSuccess = EventFactories[telemetry.TeamsAuthenticationSSOSuccessEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationSSOSuccessEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationSSOSuccessLoggers,
});
return event;
};
telemetry.TeamsAuthenticationSSOFailedEventName = 'PBI.TeamsAuthentication.SSOFailed';
/**
* Event traced when Teams SSO fails.
*/
telemetry.TeamsAuthenticationSSOFailed = EventFactories[telemetry.TeamsAuthenticationSSOFailedEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationSSOFailedEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationSSOFailedLoggers,
});
return event;
};
telemetry.TeamsAuthenticationTokenFromLocalStorageExpiredEventName = 'PBI.TeamsAuthentication.TokenFromLocalStorageExpired';
/**
* Event traced when Teams power bi token from local storage is expired.
*/
telemetry.TeamsAuthenticationTokenFromLocalStorageExpired = EventFactories[telemetry.TeamsAuthenticationTokenFromLocalStorageExpiredEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationTokenFromLocalStorageExpiredEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationTokenFromLocalStorageExpiredLoggers,
});
return event;
};
telemetry.TeamsAuthenticationTokenIsFromLocalStorageEventName = 'PBI.TeamsAuthentication.TokenIsFromLocalStorage';
/**
* Event traced when Teams power bi token is obtained from local storage.
*/
telemetry.TeamsAuthenticationTokenIsFromLocalStorage = EventFactories[telemetry.TeamsAuthenticationTokenIsFromLocalStorageEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationTokenIsFromLocalStorageEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationTokenIsFromLocalStorageLoggers,
});
return event;
};
telemetry.TeamsAuthenticationTokenIsFromAuthContextCacheEventName = 'PBI.TeamsAuthentication.TokenIsFromAuthContextCache';
/**
* Event traced when Teams power bi token is obtained from Auth context cache.
*/
telemetry.TeamsAuthenticationTokenIsFromAuthContextCache = EventFactories[telemetry.TeamsAuthenticationTokenIsFromAuthContextCacheEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationTokenIsFromAuthContextCacheEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationTokenIsFromAuthContextCacheLoggers,
});
return event;
};
telemetry.TeamsAuthenticationTokenIsFromMSALCacheEventName = 'PBI.TeamsAuthentication.TokenIsFromMSALCache';
/**
* Event traced when Teams power bi token is obtained from MSAL cache.
*/
telemetry.TeamsAuthenticationTokenIsFromMSALCache = EventFactories[telemetry.TeamsAuthenticationTokenIsFromMSALCacheEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationTokenIsFromMSALCacheEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationTokenIsFromMSALCacheLoggers,
});
return event;
};
telemetry.TeamsAuthenticationTokenFromMSALWrongAudienceEventName = 'PBI.TeamsAuthentication.TokenFromMSALWrongAudience';
/**
* Event traced when Teams power bi token obtained from MSAL has wrong audience.
*/
telemetry.TeamsAuthenticationTokenFromMSALWrongAudience = EventFactories[telemetry.TeamsAuthenticationTokenFromMSALWrongAudienceEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationTokenFromMSALWrongAudienceEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationTokenFromMSALWrongAudienceLoggers,
});
return event;
};
telemetry.TeamsAuthenticationTokenFromMSALParseErrorEventName = 'PBI.TeamsAuthentication.TokenFromMSALParseError';
/**
* Event traced when Teams power bi token obtained from MSAL has parsing error.
*/
telemetry.TeamsAuthenticationTokenFromMSALParseError = EventFactories[telemetry.TeamsAuthenticationTokenFromMSALParseErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationTokenFromMSALParseErrorEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationTokenFromMSALParseErrorLoggers,
});
return event;
};
telemetry.TeamsAuthenticationTokenFromMSALNotPresentEventName = 'PBI.TeamsAuthentication.TokenFromMSALNotPresent';
/**
* Event traced when we did not get Teams power bi token from MSAL.
*/
telemetry.TeamsAuthenticationTokenFromMSALNotPresent = EventFactories[telemetry.TeamsAuthenticationTokenFromMSALNotPresentEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationTokenFromMSALNotPresentEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationTokenFromMSALNotPresentLoggers,
});
return event;
};
telemetry.TeamsAuthenticationTokenIsFromTeamsSDKEventName = 'PBI.TeamsAuthentication.TokenIsFromTeamsSDK';
/**
* Event traced when Teams power bi token is obtained from teams SDK.
*/
telemetry.TeamsAuthenticationTokenIsFromTeamsSDK = EventFactories[telemetry.TeamsAuthenticationTokenIsFromTeamsSDKEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationTokenIsFromTeamsSDKEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationTokenIsFromTeamsSDKLoggers,
});
return event;
};
telemetry.TeamsAuthenticationErrorEventName = 'PBI.TeamsAuthentication.Error';
/**
* Fired when there is an error in teams authentication
*/
telemetry.TeamsAuthenticationError = EventFactories[telemetry.TeamsAuthenticationErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationErrorEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.TeamsAuthenticationErrorLoggers,
});
return event;
};
telemetry.TeamsAuthenticationHostPlatformInformationErrorEventName = 'PBI.TeamsAuthentication.HostPlatformInformationError';
/**
* Event traced when Teams power bi meta os fails to get host platform information from the sdk.
*/
telemetry.TeamsAuthenticationHostPlatformInformationError = EventFactories[telemetry.TeamsAuthenticationHostPlatformInformationErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsAuthenticationHostPlatformInformationErrorEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsAuthenticationHostPlatformInformationErrorLoggers,
});
return event;
};
telemetry.StaticTeamsSignUpPbiSourceRewriteErrorEventName = 'PBI.StaticTeamsSignUp.PbiSourceRewriteError';
/**
* Fired when there is an error during re-writing url with pbiSource
*/
telemetry.StaticTeamsSignUpPbiSourceRewriteError = EventFactories[telemetry.StaticTeamsSignUpPbiSourceRewriteErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.StaticTeamsSignUpPbiSourceRewriteErrorEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.StaticTeamsSignUpPbiSourceRewriteErrorLoggers,
});
return event;
};
telemetry.StaticTeamsSignUpAuthCompleteRemovalErrorEventName = 'PBI.StaticTeamsSignUp.AuthCompleteRemovalError';
/**
* Fired when there is an error during removing authCompelte query param
*/
telemetry.StaticTeamsSignUpAuthCompleteRemovalError = EventFactories[telemetry.StaticTeamsSignUpAuthCompleteRemovalErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.StaticTeamsSignUpAuthCompleteRemovalErrorEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.StaticTeamsSignUpAuthCompleteRemovalErrorLoggers,
});
return event;
};
telemetry.TeamsLoginResultTokenAcquiredSuccessEventName = 'PBI.TeamsLoginResult.TokenAcquiredSuccess';
/**
* Fired when token is successfully acquired using MSAL for teams fallback auth
*/
telemetry.TeamsLoginResultTokenAcquiredSuccess = EventFactories[telemetry.TeamsLoginResultTokenAcquiredSuccessEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsLoginResultTokenAcquiredSuccessEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsLoginResultTokenAcquiredSuccessLoggers,
});
return event;
};
telemetry.TeamsLoginResultAcquiringTokenUsingMSALEventName = 'PBI.TeamsLoginResult.AcquiringTokenUsingMSAL';
/**
* Fired when token is being acquired using MSAL
*/
telemetry.TeamsLoginResultAcquiringTokenUsingMSAL = EventFactories[telemetry.TeamsLoginResultAcquiringTokenUsingMSALEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsLoginResultAcquiringTokenUsingMSALEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsLoginResultAcquiringTokenUsingMSALLoggers,
});
return event;
};
telemetry.TeamsLoginResultTokenParseErrorEventName = 'PBI.TeamsLoginResult.TokenParseError';
/**
* Fired when there is an error in parsing token acquired using MSAL for teams fallback auth
*/
telemetry.TeamsLoginResultTokenParseError = EventFactories[telemetry.TeamsLoginResultTokenParseErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsLoginResultTokenParseErrorEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsLoginResultTokenParseErrorLoggers,
});
return event;
};
telemetry.TeamsLoginResultNoTokenEventName = 'PBI.TeamsLoginResult.NoToken';
/**
* Fired when there is no token acquired using MSAL for teams fallback auth
*/
telemetry.TeamsLoginResultNoToken = EventFactories[telemetry.TeamsLoginResultNoTokenEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsLoginResultNoTokenEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsLoginResultNoTokenLoggers,
});
return event;
};
telemetry.TeamsLoginResultWrongTokenEventName = 'PBI.TeamsLoginResult.WrongToken';
/**
* Fired when non power bi resource token is acquired using MSAL for teams fallback auth
*/
telemetry.TeamsLoginResultWrongToken = EventFactories[telemetry.TeamsLoginResultWrongTokenEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsLoginResultWrongTokenEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsLoginResultWrongTokenLoggers,
});
return event;
};
telemetry.TeamsLoginResultLoginRedirectErrorEventName = 'PBI.TeamsLoginResult.LoginRedirectError';
/**
* Fired when loginRedirect throws error when using MSAL for teams fallback auth
*/
telemetry.TeamsLoginResultLoginRedirectError = EventFactories[telemetry.TeamsLoginResultLoginRedirectErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsLoginResultLoginRedirectErrorEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsLoginResultLoginRedirectErrorLoggers,
});
return event;
};
telemetry.TeamsLoginResultHandleRedirectPromiseErrorEventName = 'PBI.TeamsLoginResult.HandleRedirectPromiseError';
/**
* Fired when handleRedirectPromise throws error when using MSAL for teams fallback auth
*/
telemetry.TeamsLoginResultHandleRedirectPromiseError = EventFactories[telemetry.TeamsLoginResultHandleRedirectPromiseErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.TeamsLoginResultHandleRedirectPromiseErrorEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.TeamsLoginResultHandleRedirectPromiseErrorLoggers,
});
return event;
};
telemetry.DashboardErrorDialogEventName = 'PBI.Dashboard.ErrorDialog';
/**
* Event fired when an error dialog is shown to the user.
*/
telemetry.DashboardErrorDialog = EventFactories[telemetry.DashboardErrorDialogEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DashboardErrorDialogEventName,
info: __assign({}, parameters),
category: powerbi.TelemetryCategory.CriticalError,
optionalParameters: ['errorSource'],
loggers: telemetry.DashboardErrorDialogLoggers,
});
return event;
};
telemetry.MobileLandingContinuedToWebEventName = 'PBI.MobileLanding.ContinuedToWeb';
/**
* Mobile user arrived at landing page and chose to continue to website
*/
telemetry.MobileLandingContinuedToWeb = EventFactories[telemetry.MobileLandingContinuedToWebEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.MobileLandingContinuedToWebEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.MobileLandingContinuedToWebLoggers,
});
return event;
};
telemetry.MobileLandingDownloadAppEventName = 'PBI.MobileLanding.DownloadApp';
/**
* Mobile user arrived at landing page and chose to download the mobile application
*/
telemetry.MobileLandingDownloadApp = EventFactories[telemetry.MobileLandingDownloadAppEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.MobileLandingDownloadAppEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.MobileLandingDownloadAppLoggers,
});
return event;
};
telemetry.DashboardUnhandledAngularExceptionEventName = 'PBI.Dashboard.UnhandledAngularException';
/**
* Event fired for uncaught exception in Angular expressions.
*/
telemetry.DashboardUnhandledAngularException = EventFactories[telemetry.DashboardUnhandledAngularExceptionEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DashboardUnhandledAngularExceptionEventName,
baseEvent: telemetry.ErrorWithStackTrace(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CriticalError,
loggers: telemetry.DashboardUnhandledAngularExceptionLoggers,
});
return event;
};
telemetry.DataExceptionEventName = 'PBI.Data.Exception';
/**
* Event fired for any error ocurring during the data query
*/
telemetry.DataException = EventFactories[telemetry.DataExceptionEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DataExceptionEventName,
info: parameters,
category: powerbi.TelemetryCategory.CriticalError,
loggers: telemetry.DataExceptionLoggers,
});
return event;
};
telemetry.VisualExceptionEventName = 'PBI.Visual.Exception';
/**
* Event fired for uncaught exception in IVisual.
*/
telemetry.VisualException = EventFactories[telemetry.VisualExceptionEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.VisualExceptionEventName,
info: parameters,
category: powerbi.TelemetryCategory.CriticalError,
optionalParameters: ['visualName'],
loggers: telemetry.VisualExceptionLoggers,
});
return event;
};
telemetry.DashboardUnhandledExceptionEventName = 'PBI.Dashboard.UnhandledException';
/**
* Event fired for global unhandled exceptions.
*/
telemetry.DashboardUnhandledException = EventFactories[telemetry.DashboardUnhandledExceptionEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DashboardUnhandledExceptionEventName,
info: parameters,
category: powerbi.TelemetryCategory.CriticalError,
loggers: telemetry.DashboardUnhandledExceptionLoggers,
});
return event;
};
telemetry.HandledExceptionEventName = 'PBI.HandledException';
/**
* Event fired for handled exceptions.
*/
telemetry.HandledException = EventFactories[telemetry.HandledExceptionEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.HandledExceptionEventName,
baseEvent: telemetry.ErrorWithStackTrace(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CriticalError,
loggers: telemetry.HandledExceptionLoggers,
});
return event;
};
telemetry.DashboardReportTilePopulateExceptionEventName = 'PBI.Dashboard.ReportTilePopulateException';
/**
* Event fired for handled exception when trying to render report tile.
*/
telemetry.DashboardReportTilePopulateException = EventFactories[telemetry.DashboardReportTilePopulateExceptionEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DashboardReportTilePopulateExceptionEventName,
baseEvent: telemetry.ErrorWithStackTrace(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CriticalError,
loggers: telemetry.DashboardReportTilePopulateExceptionLoggers,
});
return event;
};
telemetry.DashboardUnhandledStacklessExceptionEventName = 'PBI.Dashboard.UnhandledStacklessException';
/**
* Event fired for global unhandled exceptions with missing stack or message information.
*/
telemetry.DashboardUnhandledStacklessException = EventFactories[telemetry.DashboardUnhandledStacklessExceptionEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DashboardUnhandledStacklessExceptionEventName,
info: parameters,
category: powerbi.TelemetryCategory.CriticalError,
loggers: telemetry.DashboardUnhandledStacklessExceptionLoggers,
logRatio: 0.0001,
});
return event;
};
telemetry.VisualErrorEventName = 'PBI.Visual.Error';
/**
* Event fired when a per-visual error will be displayed in the UX.
*/
telemetry.VisualError = EventFactories[telemetry.VisualErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.VisualErrorEventName,
info: parameters,
category: powerbi.TelemetryCategory.CriticalError,
loggers: telemetry.VisualErrorLoggers,
});
return event;
};
telemetry.WFEReopenUserAccountEventName = 'PBI.WFE.ReopenUserAccount';
/**
* Event triggered when user reopens an account that they closed
*/
telemetry.WFEReopenUserAccount = EventFactories[telemetry.WFEReopenUserAccountEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.WFEReopenUserAccountEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.WFEReopenUserAccountLoggers,
});
return event;
};
telemetry.WFEAccountClosedPageEventName = 'PBI.WFE.AccountClosedPage';
/**
* Event triggered when user is redirected and shown the AccountClosed page
*/
telemetry.WFEAccountClosedPage = EventFactories[telemetry.WFEAccountClosedPageEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.WFEAccountClosedPageEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.WFEAccountClosedPageLoggers,
});
return event;
};
telemetry.WFEAbtSignoutRedirectPageEventName = 'PBI.WFE.AbtSignoutRedirectPage';
/**
* Event triggered when user is redirected after automactically signed out by ABT.
*/
telemetry.WFEAbtSignoutRedirectPage = EventFactories[telemetry.WFEAbtSignoutRedirectPageEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.WFEAbtSignoutRedirectPageEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.WFEAbtSignoutRedirectPageLoggers,
});
return event;
};
telemetry.VisualWarningEventName = 'PBI.Visual.Warning';
/**
* Event fired when a per-visual warning will be displayed in the UX.
*/
telemetry.VisualWarning = EventFactories[telemetry.VisualWarningEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.VisualWarningEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.VisualWarningLoggers,
});
return event;
};
telemetry.VisualApiUsageEventName = 'PBI.Visual.ApiUsage';
/**
* Event fired when a visual is loaded through the VisualSafeExecutionWrapper
*/
telemetry.VisualApiUsage = EventFactories[telemetry.VisualApiUsageEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.VisualApiUsageEventName,
baseEvent: telemetry.VerboseTimedEvent(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
optionalParameters: ['visualName'],
loggers: telemetry.VisualApiUsageLoggers,
});
return event;
};
telemetry.VisualCustomVisualsGenericEventEventName = 'PBI.Visual.CustomVisualsGenericEvent';
/**
* Event fired when a visual use a custom visuals feature
*/
telemetry.VisualCustomVisualsGenericEvent = EventFactories[telemetry.VisualCustomVisualsGenericEventEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.VisualCustomVisualsGenericEventEventName,
baseEvent: telemetry.VerboseTimedEvent(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.VisualCustomVisualsGenericEventLoggers,
});
return event;
};
telemetry.EXCopyActionClickedEventName = 'PBI.EX.CopyActionClicked';
/**
* Activity tracking selecting copy value/selection
*/
telemetry.EXCopyActionClicked = EventFactories[telemetry.EXCopyActionClickedEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.EXCopyActionClickedEventName,
baseEvent: telemetry.CustomerAction(parameters),
info: parameters,
category: powerbi.TelemetryCategory.CustomerAction,
loggers: telemetry.EXCopyActionClickedLoggers,
});
return event;
};
telemetry.StartActivityEventName = 'StartActivity';
/**
* A verbose event for which we're capturing the start of an activity
*/
telemetry.StartActivity = EventFactories[telemetry.StartActivityEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.StartActivityEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.StartActivityLoggers,
});
return event;
};
telemetry.EndActivityEventName = 'EndActivity';
/**
* A verbose event for which we're capturing the end of an activity
*/
telemetry.EndActivity = EventFactories[telemetry.EndActivityEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.EndActivityEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.EndActivityLoggers,
});
return event;
};
telemetry.AppSignInErrorEventName = 'PBI.App.SignInError';
/**
* Error occurring during sign-in, in SignInProvider
*/
telemetry.AppSignInError = EventFactories[telemetry.AppSignInErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.AppSignInErrorEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.AppSignInErrorLoggers,
});
return event;
};
telemetry.AppTokenRefreshErrorEventName = 'PBI.App.TokenRefreshError';
/**
* Error occurring during token refresh, in SignInProvider
*/
telemetry.AppTokenRefreshError = EventFactories[telemetry.AppTokenRefreshErrorEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.AppTokenRefreshErrorEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.AppTokenRefreshErrorLoggers,
});
return event;
};
telemetry.StorytellingBrowserNotSupportedLoadedEventName = 'PBI.Storytelling.BrowserNotSupportedLoaded';
/**
* Event fired when browser not supported screen shown
*/
telemetry.StorytellingBrowserNotSupportedLoaded = EventFactories[telemetry.StorytellingBrowserNotSupportedLoadedEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.StorytellingBrowserNotSupportedLoadedEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.StorytellingBrowserNotSupportedLoadedLoggers,
});
return event;
};
})(telemetry = powerbi.telemetry || (powerbi.telemetry = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var EnumExtensions = jsCommon.EnumExtensions;
var PBI_TELEMETRY_V2 = 'v2';
/**
* Method decorator which allows to do the following
* a. Start a new telemetry activity to monitor execution of subsequent business logic until the activity is resolved
* b. End currently tracking telemetry activity after executing the business logic
* c. Start a new telemetry activity and end it once the business logic in the decorated method finishes.
* @param eventName Telemetry event name
* @param activityAction Start a new activity; end an existing activity; or wrap the method within a new activity
* @param activityMode Indicates whether the underlying telemetry event should block the parent event or not.
*/
function MonitorWith(eventName, activityAction, activityMode) {
if (activityAction === void 0) { activityAction = 3 /* StartAndEnd */; }
if (activityMode === void 0) { activityMode = 0 /* Awaited */; }
return function (target, propertyKey, descriptor) {
debug.assertValue(target, 'target');
debug.assertValue(propertyKey, 'propertyKey');
var originalMethod = descriptor.value;
descriptor.value = function () {
var _this = this;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
debug.assert(!_.isEmpty(eventName), 'eventName');
debug.assert(activityAction !== 0 /* None */, 'activityAction');
/* To address bug (164789) where the depenedent services are not available on the
current window, but on the parent window */
var currentWindow = jsCommon.WindowUtils.GetWindowObject();
while (currentWindow != window.top &&
!((currentWindow.featureSwitchService) &&
(currentWindow.telemetryService)))
currentWindow = currentWindow.parent;
var featureSwitchService = currentWindow.featureSwitchService;
var telemetryService = currentWindow.telemetryService;
// TODO: we need to add a debug.assertValue for `featureSwitchService` and `telemetryService`.
// But, it will fail many UTs. For now, we are silently falling back to original code state.
var executeOriginalWithoutZoneJS = false;
var result;
if (!featureSwitchService ||
!featureSwitchService.isFeatureSwitchesRegistered() ||
!featureSwitchService.featureSwitches ||
!featureSwitchService.featureSwitches.telemetryV2 ||
!telemetryService) {
// Just execute the original method; no ZoneJS
executeOriginalWithoutZoneJS = true;
}
if (executeOriginalWithoutZoneJS) {
result = originalMethod.apply(this, args);
return result;
}
// ZoneJS is enabled
// Get the currently executing activity from the Zone
var currentZone = Zone && Zone.current;
var zoneData = currentZone && currentZone.get('data');
var activity = zoneData && zoneData.monitoredActivity;
// Start a new activity if requested
if (EnumExtensions.hasFlag(activityAction, 1 /* Start */)) {
activity = telemetryService.startMonitoredActivity(activity, eventName, {
baseVersion: PBI_TELEMETRY_V2,
isFireAndForget: activityMode === 1 /* FireAndForget */ ? true : undefined
});
currentZone = activity.currentZone;
}
debug.assertValue(currentZone, 'currentZone');
try {
// Executing the original method under the current zone.
currentZone.run((function () { return result = originalMethod.apply(_this, args); }));
}
catch (error) {
// For sync call that throws exception, propagate exception to
// caller if activity end is not requested
if (!EnumExtensions.hasFlag(activityAction, 2 /* End */)) {
throw error;
}
else {
handleActivity(activity, error);
return;
}
}
// Resolve the activity if requested
if (EnumExtensions.hasFlag(activityAction, 2 /* End */)) {
debug.assert(currentZone.name === eventName, "Event name should be same as the current zone name");
// TODO: Move this to a utility function
// @ts-ignore: No Implicit Any
if (result && _.isObject(result) && result.then && _.isFunction(result.then)) {
// @ts-ignore: No Implicit Any
result.then((function () {
handleActivity(activity);
// TODO Fix Explicit Any
}), (function (reason) {
handleActivity(activity, reason);
}));
}
else {
debug.assertValue(activity, 'Decorated method called without a start action');
handleActivity(activity);
}
}
return result;
};
return descriptor;
};
}
powerbi.MonitorWith = MonitorWith;
function handleActivity(activity, error) {
debug.assertValue(activity, 'Decorated method called without a start action');
if (activity) {
if (error) {
activity.reject(error);
}
else {
activity.resolve();
}
}
}
/**
* Method decorator which allows to do the following
* a. executing the decorated method and logging an event which contains the API name.
* b. log additional information if needed.
* @param apiName the API name which the decorated method belongs to.
* @param useTelemetryContext Indicate whether you want to log additional information or not.
* @param visualTypeIdx Index of visualType/visualId in the original method parameters.
* Both useTelemetryContext and visualTypeIdx are optionals params.
* To log additional information useTelemetryContext should be true, and add as a last optional parameter a callback: setTelemetryArgs?: <T>(telemetryContext: T) => void.
* T will be the type of your interface that you declare for the telemetry context, it will contains fields (additional information) that you may want to log.
* If the decoration was not in sandboxVisualDelegate.ts, pass the visualType index (visualTypeIdx).
*/
function CustomVisualsTelemetryWrapper(apiName, useTelemetryContext, visualTypeIdx) {
return function (target, propertyKey, descriptor) {
debug.assertValue(target, 'target');
debug.assertValue(propertyKey, 'propertyKey');
var originalMethod = descriptor.value;
var originParamsLength = descriptor.value.length;
var contextIdx = originParamsLength - 1;
descriptor.value = function () {
var _a, _b;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var argsLen = args.length;
var telemetryContext;
var callBack = function (telemetryArgs) {
telemetryContext = telemetryArgs;
};
var correctUseOfContext = originParamsLength > argsLen;
if (useTelemetryContext && !correctUseOfContext || (visualTypeIdx && (visualTypeIdx >= argsLen))) {
debug.assertFail("Wrong use of the decorator, check documentation in decorators.ts.`");
}
args = useTelemetryContext && correctUseOfContext ? args.concat(__spreadArray(__spreadArray([], Array(contextIdx - args.length)), [callBack /* telemetryContext */])) : args;
var instance = this; //'this' here refers to the instance of the class that the method we are decorating belongs to.
var pluginName = (_b = (_a = instance.proxy) === null || _a === void 0 ? void 0 : _a.plugin) === null || _b === void 0 ? void 0 : _b.name;
var visualType = visualTypeIdx && (visualTypeIdx < argsLen) ? args[visualTypeIdx] : (pluginName ? pluginName : "");
//Getting the instance of the telemetry service.
var currentWindow = jsCommon.WindowUtils.GetWindowObject();
while (currentWindow !== window.top && !(currentWindow.telemetryService)) {
currentWindow = currentWindow.parent;
}
var telemetryService = currentWindow.telemetryService;
//Executing the original method.
try {
var result = originalMethod.apply(this, args);
//the decorated method returns a promise.
if (result && _.isObject(result) && result.then && _.isFunction(result.then)) {
return result.then((function (value) {
var additionalInfo = useTelemetryContext ? JSON.stringify(telemetryContext) : undefined;
telemetryService === null || telemetryService === void 0 ? void 0 : telemetryService.logEvent(powerbi.telemetry.VisualCustomVisualsGenericEvent, {
apiName: apiName,
visualType: visualType,
errorOccurred: false,
additionalInfo: additionalInfo
});
return value;
}), (function (reason) {
var additionalInfo = useTelemetryContext ? JSON.stringify(telemetryContext) : undefined;
telemetryService === null || telemetryService === void 0 ? void 0 : telemetryService.logEvent(powerbi.telemetry.VisualCustomVisualsGenericEvent, {
apiName: apiName,
visualType: visualType,
errorOccurred: true,
reason: reason,
additionalInfo: additionalInfo
});
throw reason;
}));
}
else {
var additionalInfo = useTelemetryContext ? JSON.stringify(telemetryContext) : undefined;
telemetryService === null || telemetryService === void 0 ? void 0 : telemetryService.logEvent(powerbi.telemetry.VisualCustomVisualsGenericEvent, {
apiName: apiName,
visualType: visualType,
errorOccurred: false,
additionalInfo: additionalInfo
});
}
return result;
}
catch (error) { //If an error was thrown from a sync method, we will catch it and throw it again.
telemetryService === null || telemetryService === void 0 ? void 0 : telemetryService.logEvent(powerbi.telemetry.VisualCustomVisualsGenericEvent, {
apiName: apiName,
visualType: visualType,
errorOccurred: true,
reason: error,
});
throw error;
}
};
return descriptor;
};
}
powerbi.CustomVisualsTelemetryWrapper = CustomVisualsTelemetryWrapper;
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var errorDetailsHelper;
(function (errorDetailsHelper) {
function getErrorSource(exceptionCulprit) {
switch (exceptionCulprit) {
case 2 /* External */:
return "External" /* External */;
case 1 /* User */:
return "User" /* User */;
case 0 /* System */:
default:
return "PowerBI" /* PowerBI */;
}
}
errorDetailsHelper.getErrorSource = getErrorSource;
function getTelemetryErrorDetailsWithResourceKey(error, resourceKey, httpStatusCode) {
var details = getTelemetryErrorDetails(error, httpStatusCode);
if (details)
details.errorMessage = resourceKey;
return details;
}
errorDetailsHelper.getTelemetryErrorDetailsWithResourceKey = getTelemetryErrorDetailsWithResourceKey;
function getTelemetryErrorDetailsWithErrorMessage(error, httpStatusCode) {
var details = getTelemetryErrorDetails(error, httpStatusCode);
if (details)
details.errorMessage = error.message;
return details;
}
errorDetailsHelper.getTelemetryErrorDetailsWithErrorMessage = getTelemetryErrorDetailsWithErrorMessage;
function getTelemetryErrorDetails(error, httpStatusCode) {
if (error && error.code) {
var errorCode = error.code;
var exceptionCulprit = error['pbi.error'] && error['pbi.error'].exceptionCulprit;
if (exceptionCulprit != null) {
return { errorCode: errorCode, errorSource: getTelemetryErrorSourceFromExceptionCulprit(exceptionCulprit) };
}
if (httpStatusCode != null && (httpStatusCode === 401 /* Unauthorized */ || httpStatusCode === 403 /* Forbidden */)) {
return { errorCode: errorCode, errorSource: "User" /* User */ };
}
return { errorCode: errorCode, errorSource: "PowerBI" /* PowerBI */ };
}
if (httpStatusCode != null) {
return { errorCode: "HttpStatusCode = " + httpStatusCode, errorSource: "PowerBI" /* PowerBI */ };
}
}
errorDetailsHelper.getTelemetryErrorDetails = getTelemetryErrorDetails;
function getTelemetryErrorDetailsFromHttpStatus(error, httpStatusCode) {
var telemetryErrorDetails = getTelemetryErrorDetails(error, httpStatusCode);
if (!telemetryErrorDetails) {
return;
}
if (httpStatusCode != null && (httpStatusCode === 400 /* BadRequest */ || httpStatusCode === 401 /* Unauthorized */ || httpStatusCode === 403 /* Forbidden */ || httpStatusCode === 429 /* TooManyRequests */ || httpStatusCode === 404 /* NotFound */)) {
telemetryErrorDetails.errorSource = "User" /* User */;
}
return telemetryErrorDetails;
}
errorDetailsHelper.getTelemetryErrorDetailsFromHttpStatus = getTelemetryErrorDetailsFromHttpStatus;
function getTelemetryErrorDetailsFromServiceError(error) {
if (!error)
return;
return {
errorCode: error.errorCode,
errorMessage: 'StatusCode=' + error.statusCode,
errorSource: error.exceptionCulprit != null ? getTelemetryErrorSourceFromExceptionCulpritString(error.exceptionCulprit) : undefined
};
}
errorDetailsHelper.getTelemetryErrorDetailsFromServiceError = getTelemetryErrorDetailsFromServiceError;
function getErrorCode(errorResponse) {
if (errorResponse) {
if (errorResponse.error)
return errorResponse.error.code;
else if (errorResponse.status)
return errorResponse.status.toString();
}
}
errorDetailsHelper.getErrorCode = getErrorCode;
function getTelemetryErrorSourceFromExceptionCulpritString(culprit) {
switch (culprit) {
case powerbi.ExceptionCulpritExternal:
return "External" /* External */;
case powerbi.ExceptionCulpritUser:
return "User" /* User */;
case powerbi.ExceptionCulpritSystem:
default:
return "PowerBI" /* PowerBI */;
}
}
errorDetailsHelper.getTelemetryErrorSourceFromExceptionCulpritString = getTelemetryErrorSourceFromExceptionCulpritString;
// there are 2 such enums, one defined in \src\Clients\PowerBIVisuals\VisualsCommon\clientError.ts
// and one in JsCommon\telemetry\commonTelemetryEvents.bond to be used by telemetry events
function getTelemetryErrorSourceFromExceptionCulprit(exceptionCulprit) {
switch (exceptionCulprit) {
case 2 /* External */:
return "External" /* External */;
case 1 /* User */:
return "User" /* User */;
case 0 /* System */:
default:
return "PowerBI" /* PowerBI */;
}
}
})(errorDetailsHelper = powerbi.errorDetailsHelper || (powerbi.errorDetailsHelper = {}));
})(powerbi || (powerbi = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
var ArrayExtensions;
(function (ArrayExtensions) {
/**
* Returns a value indicating whether the items in the two arrays are equal
* (as determined by the IComparable.equals() function).
*/
function comparableSequenceEqual(array1, array2) {
if (!array1 && !array2)
return true;
if (!!array1 !== !!array2 || array1.length !== array2.length)
return false;
for (var i = 0, len = array1.length; i < len; i++)
if (!array1[i].equals(array2[i]))
return false;
return true;
}
ArrayExtensions.comparableSequenceEqual = comparableSequenceEqual;
})(ArrayExtensions = jsCommon.ArrayExtensions || (jsCommon.ArrayExtensions = {}));
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var contextActivity;
(function (contextActivity) {
function isOpenReportActivity(activity) {
return !!activity && activity.getProperty('name') === "Open Report" /* OpenReport */;
}
contextActivity.isOpenReportActivity = isOpenReportActivity;
function getAncestorActivityPropertiesOfEvent(predicate, performanceActivity) {
return performanceActivity && getAncestorActivityProperties(predicate, performanceActivity.getProperty("parent"));
}
contextActivity.getAncestorActivityPropertiesOfEvent = getAncestorActivityPropertiesOfEvent;
function getAncestorActivityProperties(predicate, properties) {
while (properties) {
if (predicate(properties))
return properties;
properties = properties.parent;
}
}
contextActivity.getAncestorActivityProperties = getAncestorActivityProperties;
})(contextActivity || (contextActivity = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var session;
(function (session) {
function getUserInfo() {
return powerbi.ensurePowerbiSession().userInfo;
}
session.getUserInfo = getUserInfo;
function setUserInfo(userInfo) {
powerbi.ensurePowerbiSession().userInfo = userInfo;
}
session.setUserInfo = setUserInfo;
var UserInfoUtils = /** @class */ (function () {
function UserInfoUtils() {
}
UserInfoUtils.getFullName = function () {
var userInfo = getUserInfo();
return userInfo.givenName + ' ' + userInfo.surname;
};
UserInfoUtils.isInternalUser = function () {
// Internal email addresses are in the format someone@microsoft.com, or someone@xxxxx.microsoft.com (ie. someone@ntdev.microsoft.com)
var userInfo = getUserInfo();
if (!userInfo || !userInfo.name)
return false;
var lowerUserName = userInfo.name.toLowerCase();
return lowerUserName.indexOf('@microsoft.com') >= 0 || lowerUserName.indexOf('.microsoft.com') >= 0;
};
UserInfoUtils.getUPN = function () {
//UPN (Universal Principal Name) is an Internet-style login name for a user based on the Internet standard RFC 822. The UPN is shorter than the distinguished name and easier to remember. By convention, this should map to the user email name.
return getUserInfo().name;
};
UserInfoUtils.getEmailAddressForReceivingMail = function () {
// the UPN the user logged in with may not be a real mailbox and/or the user may have a preferred email address
// when contacting the user via email the address returned by this function should be used
var userInfo = getUserInfo();
if (userInfo == null) {
return '';
}
return _.isEmpty(userInfo.alternateEmail)
? userInfo.name
: userInfo.alternateEmail;
};
return UserInfoUtils;
}());
session.UserInfoUtils = UserInfoUtils;
})(session = powerbi.session || (powerbi.session = {}));
})(powerbi || (powerbi = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var telemetryConstants;
(function (telemetryConstants) {
telemetryConstants.pbiClientName = "PowerBI.com";
telemetryConstants.httpActivityIdHeader = 'ActivityId';
telemetryConstants.httpRequestIdHeader = 'RequestId';
})(telemetryConstants = powerbi.telemetryConstants || (powerbi.telemetryConstants = {}));
function exportTelemetryWFEErrorToGlobal() {
if (exported)
return;
var WFEError = powerbi.telemetry.WFEError;
powerbi.ensurePowerbiTelemetry().WFEError = function (parameters) { return WFEError(parameters); };
exported = true;
}
powerbi.exportTelemetryWFEErrorToGlobal = exportTelemetryWFEErrorToGlobal;
function exportTelemetrySignInErrorToGlobal() {
if (exported)
return;
var AppSignInError = powerbi.telemetry.AppSignInError;
powerbi.ensurePowerbiTelemetry().AppSignInError = function (parameters) { return AppSignInError(parameters); };
exported = true;
}
powerbi.exportTelemetrySignInErrorToGlobal = exportTelemetrySignInErrorToGlobal;
function exportTelemetryTokenRefreshErrorToGlobal() {
if (exported)
return;
var AppTokenRefreshError = powerbi.telemetry.AppTokenRefreshError;
powerbi.ensurePowerbiTelemetry().AppTokenRefreshError = function (parameters) { return AppTokenRefreshError(parameters); };
exported = true;
}
powerbi.exportTelemetryTokenRefreshErrorToGlobal = exportTelemetryTokenRefreshErrorToGlobal;
var exported = false;
exportTelemetryWFEErrorToGlobal();
exportTelemetrySignInErrorToGlobal();
exportTelemetryTokenRefreshErrorToGlobal();
})(powerbi || (powerbi = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var InJs;
(function (InJs) {
/** Strings in this file are unlocalized. New strings should not be added here. */
var UnlocalizedStrings;
(function (UnlocalizedStrings) {
/** Template for the Error Code displayed on a server error (when a Power BI Q&A error is present). */
UnlocalizedStrings.infoNavErrorCodeTemplate = "{0} ({1})";
/** The display title for the error field containing an error code */
UnlocalizedStrings.errorCodeText = "Error Code";
/** The display title for the error field containing an activity id */
UnlocalizedStrings.errorActivityIdText = "Activity Id";
/** The display title for the error field containing an request id */
UnlocalizedStrings.errorRequestIdText = "Request Id";
/** The display title for the error field containing an correlation id */
UnlocalizedStrings.correlationIdText = "Correlation Id";
/** The display title for the error field containing a line number */
UnlocalizedStrings.errorLineNumberText = "Line number";
/** The display title for the error field containing a column number */
UnlocalizedStrings.errorColumnNumberText = "Column number";
/** The display title for the error field containing a stack trace */
UnlocalizedStrings.errorStackTraceText = "Stack trace";
/** The display title for the error field containing a source file */
UnlocalizedStrings.errorSourceFileText = "Source file";
/** The display title for the error field containing a timestamp */
UnlocalizedStrings.errorTimestampText = "Time";
/** Link text displayed to show additional error details */
UnlocalizedStrings.showDetailsText = "Show technical details";
/** The label for the button used to close a dialog */
UnlocalizedStrings.dialogCloseActionLabel = "Close";
/** The label for the dialog button used to refresh the page in case of a fatal error */
UnlocalizedStrings.dialogRefreshPageActionLabel = "Refresh Page";
/** The title for the error dialogs within the app */
UnlocalizedStrings.errorDialogTitle = "oops, something went wrong";
/** The title of the window notifying the user that they are running on an unsupported browser */
UnlocalizedStrings.unsupportedBrowserMessageTitle = "Unsupported browser detected";
/** The contents of the window notifying the user that they are running on an unsupported browser */
UnlocalizedStrings.unsupportedBrowserMessageText = "Power BI Q&A requires Internet Explorer 10 or higher, please upgrade your browser and try again";
/** The contents of the error dialog notifying the user that they should include technical details when contacting us */
UnlocalizedStrings.errorDialogHelperText = "Please try again later or contact support. If you contact support, please provide these details.";
/** The label for the dialog button used to copy the error contents to the clipboard */
UnlocalizedStrings.CopyActionLabel = "Copy";
/** The label for indicating an action was successful (e.g. successfully copying contents to the clipboard) */
UnlocalizedStrings.SuccessActionLabel = "Success!";
})(UnlocalizedStrings = InJs.UnlocalizedStrings || (InJs.UnlocalizedStrings = {}));
})(InJs || (InJs = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var BrowserUtility;
(function (BrowserUtility) {
/**
* Used during initialization. If returns false a ModalDialog will be displayed on the
* messaging target as specified by the particular connection group.
*/
function isBrowserSupported() {
// Note that IE9 will be dismissed by not supporting CORS. We could technically work around that but still
// there are issues with the QuestionBox which does not work properly in IE9 (e.g. unrecognized terms or term selection)
return browserSupportsEssentials() &&
supportsFunctionBind() &&
supportsCors();
}
BrowserUtility.isBrowserSupported = isBrowserSupported;
/** Used while interpreting the script. If returns false a ModalDialog will be displayed on the body. */
function browserSupportsEssentials() {
return supportsDefineProperty();
}
BrowserUtility.browserSupportsEssentials = browserSupportsEssentials;
/**
* Determines if the current browser is Internet Explorer
*/
function isInternetExplorerBrowser() {
var agent = window.navigator.userAgent.toLowerCase();
return (agent.indexOf("msie ") > -1 || agent.indexOf("trident/") > -1);
}
BrowserUtility.isInternetExplorerBrowser = isInternetExplorerBrowser;
/**
* Determines if the current browser is Edge
*/
function isEdgeBrowser() {
var agent = window.navigator.userAgent.toLowerCase();
return agent.indexOf("edge/") > -1;
}
BrowserUtility.isEdgeBrowser = isEdgeBrowser;
function isSafari() {
return /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
}
BrowserUtility.isSafari = isSafari;
function isChrome() {
return !isEdgeBrowser() && / chrome\/([0-9]+)(\.[0-9]+)+/i.test(window.navigator.userAgent);
}
BrowserUtility.isChrome = isChrome;
function isFirefox() {
return / firefox\/([0-9]+)(\.[0-9]+)+/i.test(window.navigator.userAgent);
}
BrowserUtility.isFirefox = isFirefox;
/**
* Get the current version of IE
* @returns The version of Internet Explorer or a 0 (indicating the use of another browser).
*/
function getInternetExplorerVersion() {
var retValue = 0;
if (navigator.appName === 'Microsoft Internet Explorer' || window.navigator.userAgent.indexOf('MSIE') >= 0) {
var re = new RegExp('MSIE ([0-9]{1,}[\\.0-9]{0,})');
var result = re.exec(window.navigator.userAgent);
if (result) {
retValue = parseFloat(result[1]);
}
}
return retValue;
}
BrowserUtility.getInternetExplorerVersion = getInternetExplorerVersion;
/**
* IE8 will fail this check. Without this function available we cannot even load the script.
* This is because we compile our script expecting support for ECMA Script 5.
*/
function supportsDefineProperty() {
if (!Object.defineProperty)
return false;
// We also have to verify runtime since IE8 will have Object.defineProperty yet won't
// allow defining properties on anything but DOM objects.
try {
var customObject = {};
var propertyDescriptor = { get: function () { return true; }, enumerable: true, configurable: false };
Object.defineProperty(customObject, "customProperty", propertyDescriptor);
return true;
}
catch (e) {
return false;
}
}
/** IE8 will fail this check */
function supportsFunctionBind() {
// TS2774: This condition will always return true since the function is always defined.
return Function.prototype.bind ? true : false;
}
/** IE9 will fail this check */
function supportsCors() {
return !!$.support.cors;
}
})(BrowserUtility = jsCommon.BrowserUtility || (jsCommon.BrowserUtility = {}));
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var CookieUtil;
(function (CookieUtil) {
function getCookie(key, window) {
if (window && window.document && window.document.cookie) {
var keyValuePairs = window.document.cookie.split(';');
for (var _i = 0, keyValuePairs_1 = keyValuePairs; _i < keyValuePairs_1.length; _i++) {
var keyValuePair = keyValuePairs_1[_i];
var split = keyValuePair.split('=');
if (split.length > 0 && split[0].trim() === key) {
return split[1];
}
}
}
}
CookieUtil.getCookie = getCookie;
function setCookie(key, value, window) {
if (window && window.document) {
window.document.cookie = key + ' = ' + value + ';secure';
}
}
CookieUtil.setCookie = setCookie;
})(CookieUtil = jsCommon.CookieUtil || (jsCommon.CookieUtil = {}));
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
// TODO 106190: This is Explore specific and should be refactored out of PowerBICommon.
var ExplorationContainer = jsCommon.CssConstants.createClassAndSelector('explorationContainer');
var DropPosition;
(function (DropPosition) {
function isAbove(position) {
return !!(position & 1 /* Above */);
}
DropPosition.isAbove = isAbove;
function isRightOf(position) {
return !!(position & 2 /* RightOf */);
}
DropPosition.isRightOf = isRightOf;
function isBelow(position) {
return !!(position & 4 /* Below */);
}
DropPosition.isBelow = isBelow;
function isLeftOf(position) {
return !!(position & 8 /* LeftOf */);
}
DropPosition.isLeftOf = isLeftOf;
function isVerticalMiddle(position) {
return !!(position & 16 /* VerticalMiddle */);
}
DropPosition.isVerticalMiddle = isVerticalMiddle;
function isHorizontalMiddle(position) {
return !!(position & 32 /* HorizontalMiddle */);
}
DropPosition.isHorizontalMiddle = isHorizontalMiddle;
})(DropPosition = jsCommon.DropPosition || (jsCommon.DropPosition = {}));
var HighlightClasses;
(function (HighlightClasses) {
HighlightClasses.None = jsCommon.CssConstants.createClassAndSelector('notDroppable');
HighlightClasses.Replace = jsCommon.CssConstants.createClassAndSelector('dropover');
HighlightClasses.Prepend = jsCommon.CssConstants.createClassAndSelector('prepend');
HighlightClasses.Append = jsCommon.CssConstants.createClassAndSelector('append');
})(HighlightClasses = jsCommon.HighlightClasses || (jsCommon.HighlightClasses = {}));
var DragDropUtils;
(function (DragDropUtils) {
DragDropUtils.DragoverClass = 'dragover';
DragDropUtils.DragAttribute = 'drag';
/** Returns the DragSource's type (e.g., "field", "slides", etc.) */
function getDragSourceType(dragSource) {
return dragSource.attr(DragDropUtils.DragAttribute);
}
DragDropUtils.getDragSourceType = getDragSourceType;
/** Prepares and returns the Drag Helper */
function prepareDragHelper(element) {
var clone = element.clone();
// Remove all ID attributes from the helper to prevent creating duplicates in the DOM. Having multiple IDs can lead to unwanted behavior.
clone.find('[id]').removeAttr(jsCommon.DOMConstants.idAttribute);
clone.addClass('dragHelper');
return clone;
}
DragDropUtils.prepareDragHelper = prepareDragHelper;
/** Gets the appropriate DOM element to append the drag helper to */
function getElementToAppendDragHelper(element) {
// In the web, QnA and ReportContainer both have exploration containers. Append the drag helper only to the parent instance.
var appendToElement = element.parents(ExplorationContainer.selector);
debug.assert(appendToElement.length <= 1, 'We should only append the drag helper to 1 DOM element.');
return appendToElement;
}
DragDropUtils.getElementToAppendDragHelper = getElementToAppendDragHelper;
// TODO: Deprecate once visuals handle scaling.
/** Uses the function parameter to find a child target and save it with the draggable. Success or failure can be used to determine if the drop should be handled. */
function tryFindChildDropTarget(draggable, getTarget) {
var target = getTarget();
if (target) {
// @ts-ignore: No Implicit Any
draggable.data[DragDropDataKeys.DropTarget] = target;
return true;
}
// @ts-ignore: No Implicit Any
draggable.data[DragDropDataKeys.DropEventHandled] = true;
return false;
}
DragDropUtils.tryFindChildDropTarget = tryFindChildDropTarget;
// TODO: Deprecate once visuals handle scaling.
/** Determines if the drop is on the expected target based on the dragData */
function isDropOnExpectedTarget(draggable, expectedTarget) {
// @ts-ignore: No Implicit Any
if (draggable.data[DragDropDataKeys.DropEventHandled] || draggable.data[DragDropDataKeys.DropTarget] !== expectedTarget)
return false;
// @ts-ignore: No Implicit Any
draggable.data[DragDropDataKeys.DropEventHandled] = true;
return true;
}
DragDropUtils.isDropOnExpectedTarget = isDropOnExpectedTarget;
function getDropPosition(event, $element) {
var height = $element.height();
var width = $element.width();
var elementOffset = $element.offset();
var mouseTop = event.pageY;
var mouseLeft = event.pageX;
var dropPosition = 0;
if (elementOffset.top + (height / 2) > mouseTop) {
dropPosition |= 1 /* Above */;
}
else {
dropPosition |= 4 /* Below */;
}
if (elementOffset.left + (width / 2) > mouseLeft) {
dropPosition |= 8 /* LeftOf */;
}
else {
dropPosition |= 2 /* RightOf */;
}
if (elementOffset.top + (height / 3) < mouseTop
&& elementOffset.top + (height / 3) * 2 > mouseTop) {
dropPosition |= 16 /* VerticalMiddle */;
}
if (elementOffset.left + (width / 3) < mouseLeft
&& elementOffset.left + (width / 3) * 2 > mouseLeft) {
dropPosition |= 32 /* HorizontalMiddle */;
}
return dropPosition;
}
DragDropUtils.getDropPosition = getDropPosition;
function isValidDropLocation(dragSource, validDrops) {
// If there's no drag element, the drop likely came from an external source,
// such as a visual, that isn't annotated with our custom <drop> directive.
// If this happens, assume the drop is valid.
if (!dragSource)
return true;
var dragType = DragDropUtils.getDragSourceType(dragSource);
return validDrops.indexOf(dragType) >= 0;
}
DragDropUtils.isValidDropLocation = isValidDropLocation;
})(DragDropUtils = jsCommon.DragDropUtils || (jsCommon.DragDropUtils = {}));
var DragDropDataKeys;
(function (DragDropDataKeys) {
DragDropDataKeys.DragScrollHandler = 'DragScrollHandler';
// TODO: Deprecate once visuals handle scaling.
DragDropDataKeys.DropEventHandled = 'DropEventHandled';
DragDropDataKeys.DropTarget = 'DropTarget';
})(DragDropDataKeys = jsCommon.DragDropDataKeys || (jsCommon.DragDropDataKeys = {}));
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var HttpUtils;
(function (HttpUtils) {
function getPerformanceTimingByUrl(url) {
var perfItems = window.performance.getEntriesByType('resource').filter((function (e) { return e.initiatorType === 'xmlhttprequest' && e.name.indexOf(url) !== -1; }));
// Only return if there is a single performance timing item that matches the given url
if (perfItems && perfItems.length === 1) {
var perfItem = perfItems[0];
return perfItem;
}
}
HttpUtils.getPerformanceTimingByUrl = getPerformanceTimingByUrl;
function attachPerformanceTimingByUrl(url, info) {
var perfTiming = getPerformanceTimingByUrl(url);
if (!perfTiming)
return false;
attachPerformanceTiming(perfTiming, info);
return true;
}
HttpUtils.attachPerformanceTimingByUrl = attachPerformanceTimingByUrl;
function attachPerformanceTiming(perfTiming, resourceTiming) {
if (!perfTiming)
return;
resourceTiming.timeOrigin = window.performance.timeOrigin;
resourceTiming.decodedBodySize = perfTiming.decodedBodySize;
resourceTiming.duration = perfTiming.duration;
resourceTiming.encodedBodySize = perfTiming.encodedBodySize;
resourceTiming.transferSize = perfTiming.transferSize;
resourceTiming.connectEnd = perfTiming.connectEnd;
resourceTiming.connectStart = perfTiming.connectStart;
resourceTiming.domainLookupEnd = perfTiming.domainLookupEnd;
resourceTiming.domainLookupStart = perfTiming.domainLookupStart;
resourceTiming.fetchStart = perfTiming.fetchStart;
resourceTiming.redirectEnd = perfTiming.redirectEnd;
resourceTiming.redirectStart = perfTiming.redirectStart;
resourceTiming.requestStart = perfTiming.requestStart;
resourceTiming.responseEnd = perfTiming.responseEnd;
resourceTiming.responseStart = perfTiming.responseStart;
resourceTiming.secureConnectionStart = perfTiming.secureConnectionStart;
resourceTiming.startTime = perfTiming.startTime;
resourceTiming.workerStart = perfTiming.workerStart;
if (perfTiming.responseStart != null && perfTiming.startTime != null)
resourceTiming.timeToFirstByte = perfTiming.responseStart - perfTiming.startTime;
}
HttpUtils.attachPerformanceTiming = attachPerformanceTiming;
function clientAndServerRequestIdMatch(result) {
// Treat null responseRequestId or requestId as null for a match so the telemetry will log null
// If we recieve null on the client it likely means that the allow header is missing
if (result && result.requestId && result.responseRequestId) {
return result.requestId === result.responseRequestId;
}
return null;
}
HttpUtils.clientAndServerRequestIdMatch = clientAndServerRequestIdMatch;
function getResponseRequestId(result) {
if (result && result.responseRequestId) {
return result.responseRequestId;
}
return null;
}
HttpUtils.getResponseRequestId = getResponseRequestId;
function shouldRetryRequest(statusCode) {
switch (statusCode) {
case 401 /* Unauthorized */:
case 403 /* Forbidden */:
case 413 /* RequestEntityTooLarge */:
case 400 /* BadRequest */:
case 404 /* NotFound */:
case 409 /* Conflict */:
case 412 /* PreconditionFailed */:
case 422 /* UnprocessableEntity */:
case 415 /* UnsupportedMediaType */:
return false;
default:
return true;
}
}
HttpUtils.shouldRetryRequest = shouldRetryRequest;
function isServerError(statusCode) {
switch (statusCode) {
case 500 /* InternalServerError */:
case 503 /* ServiceUnavailable */:
return true;
default:
return false;
}
}
HttpUtils.isServerError = isServerError;
})(HttpUtils = jsCommon.HttpUtils || (jsCommon.HttpUtils = {}));
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var InJs;
(function (InJs) {
InJs.RtlDirAttrVal = 'rtl';
var InfoNavUtility;
(function (InfoNavUtility) {
// Error Templates
// TODO: Move Error Templating code to a shared control
var infonavAdditionalErrorClass = 'infonav-additionalError';
var infonavShowAdditionalErrorClass = 'infonav-showAdditionalError';
var infoNavErrorInfoFieldTemplate = '<div class="infonav-errorInfoItem">' +
'<span class="infonav-errorInfoHeader">{FieldTitle}</span>' +
'<span class="infonav-errorInfoText">{FieldValue}</span>' +
'</div>';
/**
* Create a container that can show additional error info when a user clicks a show details link
* @param additionalErrorInfo - The additional error info to display
* @returns The container
*/
function constructShowDetailsContainer(additionalErrorInfo, localizedString) {
var additionalErrorInfoContainer = $('<div ></div>');
var showDetailsLink = $('<a class="showAdditionalDetailsLink" href=\'javascript:\' ></a>');
showDetailsLink.addClass(infonavShowAdditionalErrorClass);
showDetailsLink.text(localizedString || InJs.UnlocalizedStrings.showDetailsText);
showDetailsLink.on(jsCommon.DOMConstants.mouseClickEventName, (function () {
additionalErrorInfoContainer.find(jsCommon.Utility.createClassSelector(infonavShowAdditionalErrorClass)).remove();
additionalErrorInfoContainer.find(jsCommon.Utility.createClassSelector(infonavAdditionalErrorClass)).css(jsCommon.CssConstants.displayProperty, jsCommon.CssConstants.blockValue);
}));
additionalErrorInfo.css(jsCommon.CssConstants.displayProperty, jsCommon.CssConstants.noneValue);
additionalErrorInfo.addClass(infonavAdditionalErrorClass);
additionalErrorInfoContainer.append(showDetailsLink);
additionalErrorInfoContainer.append(additionalErrorInfo);
return additionalErrorInfoContainer;
}
InfoNavUtility.constructShowDetailsContainer = constructShowDetailsContainer;
/**
* Helper method to construct an error field
* @param fieldTitle - The title of the field
* @param fieldValue - The value for the field
* @returns An html fragment for the error field
*/
function constructErrorField(fieldTitle, fieldValue) {
var retValue = $(infoNavErrorInfoFieldTemplate.replace('{FieldTitle}', fieldTitle));
retValue.find('.infonav-errorInfoText').multiline(fieldValue || '');
return retValue;
}
InfoNavUtility.constructErrorField = constructErrorField;
function isRTL() {
var getDirAttr = $('html').attr('dir');
return getDirAttr === InJs.RtlDirAttrVal;
}
InfoNavUtility.isRTL = isRTL;
})(InfoNavUtility = InJs.InfoNavUtility || (InJs.InfoNavUtility = {}));
})(InJs || (InJs = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var JsonExtensions;
(function (JsonExtensions) {
/* tslint:disable ban */
function tryParseJSON(jsonString, reviver, logExceptions) {
try {
return JSON.parse(jsonString, reviver);
}
catch (ex) {
if (logExceptions)
console.error(ex);
}
}
JsonExtensions.tryParseJSON = tryParseJSON;
function isJsonString(jsonString) {
if (jsonString && typeof jsonString === "string") {
try {
JSON.parse(jsonString);
}
catch (e) {
return false;
}
return true;
}
return false;
}
JsonExtensions.isJsonString = isJsonString;
/* tslint:enable ban */
})(JsonExtensions = jsCommon.JsonExtensions || (jsCommon.JsonExtensions = {}));
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var MathExtensions;
(function (MathExtensions) {
/** Returns the smaller of two numbers, while taking non-numerics (e.g., undefined or NaN) into account. */
function min(number1, number2) {
if (number1 == null || isNaN(number1))
return number2;
if (number2 == null || isNaN(number2))
return number1;
return Math.min(number1, number2);
}
MathExtensions.min = min;
/** Returns the larger of two numbers, while taking non-numerics (e.g., undefined or NaN) into account. */
function max(number1, number2) {
if (number1 == null || isNaN(number1))
return number2;
if (number2 == null || isNaN(number2))
return number1;
return Math.max(number1, number2);
}
MathExtensions.max = max;
})(MathExtensions = jsCommon.MathExtensions || (jsCommon.MathExtensions = {}));
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
powerbi.ThemePrecedenceList = ['highContrastTheme', 'customTheme', 'baseTheme'];
function getThemeMetadata(name, type, version) {
return {
name: name,
version: version,
type: type,
};
}
powerbi.getThemeMetadata = getThemeMetadata;
})(powerbi || (powerbi = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var iFrameUtility;
(function (iFrameUtility) {
function isHostedInIFrame() {
try {
return window.self !== window.top;
}
catch (e) {
return true;
}
}
iFrameUtility.isHostedInIFrame = isHostedInIFrame;
function isHostedInCrossDomainIFrame() {
// This doesn't work if we redirect at any point, since document.referrer will change
// return isHostedInIFrame() && getHostName(document.referrer) !== getHostName(document.URL);
// This should work instead:
var parentOrigin;
try {
parentOrigin = window.parent.origin;
}
catch (e) {
debug.log('isHostedInCrossDomainIFrame(): Caught exception when trying to access parent, most likely because the parent is cross-origin.');
parentOrigin = 'blockedBecauseCrossOrigin';
}
return window.origin !== parentOrigin;
}
iFrameUtility.isHostedInCrossDomainIFrame = isHostedInCrossDomainIFrame;
function getHostName(url) {
if (url && url.trim() !== '') {
var elem = document.createElement('a');
elem.href = url;
return elem.hostname;
}
return '';
}
iFrameUtility.getHostName = getHostName;
})(iFrameUtility = jsCommon.iFrameUtility || (jsCommon.iFrameUtility = {}));
var GzipUtility;
(function (GzipUtility) {
/**
* Uncompresses after decoding string
* @param encoded - A gzipped and Base64 encoded string
* @returns Decoded and uncompressed string
*/
function uncompress(encoded) {
if (encoded) {
try {
var decoded = atob(encoded);
var uncompressed = pako.inflate(decoded, { to: 'string' });
return uncompressed;
}
catch (e) {
jsCommon.Trace.error("Error while uncompressing TileData: " + JSON.stringify(e),
/*includeStackTrace*/ e.stack != null ? false : true);
}
}
return null;
}
GzipUtility.uncompress = uncompress;
/**
* Compress and then Base64-encode the string
* @param data - String to be gzipped and Base64 encoded
* @returns Compressed and Base64-encoded string
*/
function compress(data) {
if (data) {
try {
var compressed = pako.gzip(data, { to: 'string' });
var encoded = btoa(compressed);
return encoded;
}
catch (e) {
jsCommon.Trace.error("Error while compressing data: " + JSON.stringify(e),
/*includeStackTrace*/ e.stack != null ? false : true);
}
}
return null;
}
GzipUtility.compress = compress;
})(GzipUtility = jsCommon.GzipUtility || (jsCommon.GzipUtility = {}));
var E2EUtils;
(function (E2EUtils) {
E2EUtils.isE2EV2Run = (function () {
var isE2EV2;
return function () {
if (isE2EV2 == null) {
isE2EV2 = !!jsCommon.QueryStringUtil.getQueryStringValue('isE2ERun2');
}
return isE2EV2;
};
})();
})(E2EUtils = jsCommon.E2EUtils || (jsCommon.E2EUtils = {}));
var WindowUtils;
(function (WindowUtils) {
function GetWindowObject() {
return window;
}
WindowUtils.GetWindowObject = GetWindowObject;
})(WindowUtils = jsCommon.WindowUtils || (jsCommon.WindowUtils = {}));
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var FocusNavigationUtility;
(function (FocusNavigationUtility) {
/**
* Check whether the focus switch should happen.
* Some elements have native handle for key press. We should respect this.
*/
function isElementContentEditable(element) {
return $(element).closest('[contentEditable]').length > 0;
}
FocusNavigationUtility.isElementContentEditable = isElementContentEditable;
/**
* Check whether element is text element.
*/
function isTextElement(element) {
if ($(element).is(':disabled'))
return false;
var nodeName = element.nodeName.toLowerCase();
return ((element.nodeType === Node.ELEMENT_NODE && (nodeName === "textarea" || nodeName === 'select' ||
(nodeName === "input" && /^(?:text|email|number|search|tel|url|password)$/i.test(element.type)))));
}
FocusNavigationUtility.isTextElement = isTextElement;
/**
* Checks if the given parent element contains the given child element
*
* @param parent - The parent element
* @param child - The child element to be checked
*/
function contains(parent, child) {
// tslint:disable-next-line:no-bitwise
return (child.compareDocumentPosition(parent) & Node.DOCUMENT_POSITION_CONTAINS) !== 0;
}
FocusNavigationUtility.contains = contains;
/**
* Returns the first ancestor of the given element for which the matcher callback returns true.
*/
function getFirstMatchingAncestor(element, matcher, root, includeSelf) {
if (includeSelf === void 0) { includeSelf = true; }
root = root || document.body;
var currentElement = element;
if (currentElement === root && (!includeSelf || !matcher(currentElement)))
return undefined;
if (!includeSelf && element) {
currentElement = currentElement.parentElement || currentElement.parentNode || undefined;
}
while (currentElement && currentElement !== document.body && currentElement.nodeType === Node.ELEMENT_NODE) {
if (matcher(currentElement)) {
return currentElement;
}
if (currentElement === root) {
break;
}
currentElement = currentElement.parentElement || currentElement.parentNode || undefined;
}
return undefined;
}
FocusNavigationUtility.getFirstMatchingAncestor = getFirstMatchingAncestor;
/**
* Checks if an element is tabbable (or focusable). Focusable
*/
function isElementTabbable(element) {
return $(element).is(':tabbable') === true;
}
FocusNavigationUtility.isElementTabbable = isElementTabbable;
/**
* Gets the first focusable parent of a given element.
* if root is not defined, defaults the document body
* @returns The focusable parent if it exists, otherwise undefined
*
* @remarks The input element itself does not need to be focusable.
*/
function getTabbableParent(element, root) {
root = root || document.body;
return getFirstMatchingAncestor(element, isElementTabbable, root, false);
}
FocusNavigationUtility.getTabbableParent = getTabbableParent;
/**
* Gets the first focusable child of a given element.
*/
function getFirstTabbableChild(element) {
return getTabbableChildren(element)[0];
}
FocusNavigationUtility.getFirstTabbableChild = getFirstTabbableChild;
/**
* Gets all the descendants of the given element's Focusable Sub-Tree. The order is the same as
* the default tab order of the elements.
*/
function getTabbableDescendants(element) {
return $(element).find(':tabbable').get();
}
FocusNavigationUtility.getTabbableDescendants = getTabbableDescendants;
/**
* Gets all the immediate children of the given element's Tabbable Sub-Tree.
*/
function getTabbableChildren(element) {
return _.filter(getTabbableDescendants(element), (function (descendent) { return !$.contains(element, getTabbableParent(descendent, element)); }));
}
FocusNavigationUtility.getTabbableChildren = getTabbableChildren;
/**
* Gets the tabbable siblings of the element that match siblingMatcher
*/
function getTabbableSiblingsMatch(element, siblingMatcher, root) {
if (root === void 0) { root = document.body; }
var siblings = FocusNavigationUtility.getTabbableSiblings(element, root);
var filteredSiblings = _.filter(siblings, siblingMatcher);
return filteredSiblings;
}
FocusNavigationUtility.getTabbableSiblingsMatch = getTabbableSiblingsMatch;
/**
* Gets the next matching sibling of the given element (assuming circular navigation)
*/
function getNextTabbableMatchingSibling(element, siblingMatcher, root) {
root = root || document.body;
var siblings = getTabbableSiblingsMatch(element, siblingMatcher, root);
if (siblings.length > 0) {
return siblings[0];
}
else {
return undefined;
}
}
FocusNavigationUtility.getNextTabbableMatchingSibling = getNextTabbableMatchingSibling;
/**
* Gets the previous matching sibling of the given element (assuming circular navigation)
*/
function getPrevTabbableMatchingSibling(element, siblingMatcher, root) {
root = root || document.body;
var siblings = getTabbableSiblingsMatch(element, siblingMatcher, root);
if (siblings.length > 0) {
return siblings[siblings.length - 1];
}
else {
return undefined;
}
}
FocusNavigationUtility.getPrevTabbableMatchingSibling = getPrevTabbableMatchingSibling;
/**
* Gets all the siblings of the given element inside the given root's Tabbable Sub-Tree.
* The root defaults to document body. Result is zero-indexed at the sibling next to (after) the element.
*
* @remarks The siblings are calculated by finding the parent and then returning its Tabbable children.
* Therefore, the input element itself does not need to be a Tabbable element.
*
* Example Output: [nextSibling, nextSibling+1 (last element of the children in DOM), prevSibling-1, prevSibling (next element would be currently focused element)]
*/
function getTabbableSiblings(element, root) {
root = root || document.body;
var parent = getTabbableParent(element, root);
if (!parent || root && $.contains(parent, root))
parent = root;
if (parent) {
var children = getTabbableChildren(parent);
// Remove input element and its children and start the list from its next sibling
var siblings = [];
var insertPointer = 0;
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
var child = children_1[_i];
if (child !== element && !contains(element, child)) {
siblings.splice(insertPointer++, 0, child);
}
else {
insertPointer = 0;
}
}
return siblings;
}
return [];
}
FocusNavigationUtility.getTabbableSiblings = getTabbableSiblings;
/**
* Gets the next tabbable sibling of the given element (assuming circular navigation)
*/
function getNextTabbableSibling(element, root) {
root = root || document.body;
var siblings = getTabbableSiblings(element, root);
return siblings[0];
}
FocusNavigationUtility.getNextTabbableSibling = getNextTabbableSibling;
/**
* Gets the previous tabbable sibling of the given element (assuming circular navigation)
*/
function getPrevTabbableSibling(element, root) {
root = root || document.body;
var siblings = getTabbableSiblings(element, root);
return siblings[siblings.length - 1];
}
FocusNavigationUtility.getPrevTabbableSibling = getPrevTabbableSibling;
/**
* Check whether the element is visible.
*/
function isElementVisible(element) {
return $(element).is(':visible');
}
FocusNavigationUtility.isElementVisible = isElementVisible;
function getParentFocusElement(element) {
return $(element).parents(":tabbable:first").get(0);
}
FocusNavigationUtility.getParentFocusElement = getParentFocusElement;
})(FocusNavigationUtility = jsCommon.FocusNavigationUtility || (jsCommon.FocusNavigationUtility = {}));
})(jsCommon || (jsCommon = {}));
/*
* Power BI Visualizations
*
* Copyright (c) Microsoft Corporation
* All rights reserved.
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the ""Software""), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var jsCommon;
(function (jsCommon) {
/** event will be with trigger => bubbles and calls .event() */
jsCommon.FocusManagerFocusEventName = "focusManager_focus";
/** event will be with triggerHandler => does not bubble and call .event() */
jsCommon.FocusManagerFocusOnEventName = "focusManager_focusOn";
function isTabbable(element) {
return $(element).is(':tabbable') === true && $(element).is(':disabled') === false;
}
jsCommon.isTabbable = isTabbable;
jsCommon.FocusNavModeAttribute = 'focus-nav-mode';
jsCommon.TabOrderEnabledAttribute = 'tab-order-enabled';
jsCommon.TabOrderRecursiveEnabledAttribute = 'tab-order-recursive-enabled';
jsCommon.TabOrderAttribute = 'tab-order';
jsCommon.ActiveElementAttribute = 'tab-active';
jsCommon.TabOrderChildAttribute = 'tab-order-child';
jsCommon.TabIndexAttribute = 'tabindex';
jsCommon.SkipArrowNavigationAttribute = 'skip-arrow-navigation';
jsCommon.FocusNavModeGroupMatcher = "[" + jsCommon.FocusNavModeAttribute + "=\"" + "Group" /* Group */ + "\"]:first";
jsCommon.FocusNavModeHierarchicalTabOrderMatcher = "[" + jsCommon.FocusNavModeAttribute + "=\"" + "HierarchicalTabOrder" /* HierarchicalTabOrder */ + "\"]:first";
/**
* Responsible for locking tab/arrow key focus inside the group.
* Control the focus by specifying attributes focus-nav-mode
*
* focus-nav-mode = 'Browser'. It means we are not applying customized focus behavior within
* root element
*
* focus-nav-mode = 'Group', It means we are handling focus behaviors among the immediate tabble children.
* It supports:
* ---right/down arrow key: move focus to next sibling
* ---left/up arrow key: move focus to previous sibling
* ---tab/shift+tab: move focus to next/previous sibling
* ---escape: move focus to first tabbable ancestor
*
* focus-nav-mode = 'Hierarchy'. It means we are handling focus behaviors within the root.
* It supports:
* ---tab/shift+tab: move focus to next/previous tabbable sibling
* ---escape: move focus to first tabbable ancestor
* ---enter: move focus to first tabbable descendent
*
* focus-nav-mode = 'HierarchicalTabOrder'. It means we are handling focus behavior using tab-orders in a hierarchical way.
* It supports:
* ---right/down arrow key: move focus to next sibling
* ---left/up arrow key: move focus to previous sibling
* ---tab/shift+tab: move focus to next/previous tabbable sibling
* ---escape: move focus to tabbable parent
* ---enter: move focus to tabbable child
*
* focus-nav-mode = 'Skip'. If you have large DOM inside of Group or Hierarchy it takes long time to walk it so we can mark islands of the DOM to be skipped from the walk
*
* Element should be a tabbable element. It means that whether you specify tabindex > -1 or use
* one of the input/button/select/a[href]/area/textarea/object
*
* For detecting tabbable we use JQueryUI :tabbable selector. The difference between focusable and tabbable is that
* input with tabindex=-1 is focusable but not tabbable
*
* skip-children-focus
* Adding this attribute on element will skip all its tabbable children and traverse forward to its sibling in the DOM tree
*/
var FocusManager = /** @class */ (function () {
function FocusManager() {
this.registeredElements = [];
this.shortcutContainer = new jsCommon.ShortcutContainer();
}
Object.defineProperty(FocusManager.prototype, "keyboardFocused", {
get: function () {
return FocusManager.keyboardFocused;
},
set: function (value) {
FocusManager.keyboardFocused = value;
},
enumerable: false,
configurable: true
});
FocusManager.getInstance = function () {
return this._instance || (this._instance = new FocusManager());
};
/*
* isolate: when true focusManager stops propagation on keypress unless you are focused on a text element
* otherwise any non-focus related keypress(tab/arrows/esc) will be handled by other listeners
*/
FocusManager.prototype.register = function (container, isolate, disableCaptureTabFocusInsideGroup) {
var _this = this;
if (isolate === void 0) { isolate = false; }
if (disableCaptureTabFocusInsideGroup === void 0) { disableCaptureTabFocusInsideGroup = false; }
var navModes = [
new jsCommon.FocusGroupNavigation(disableCaptureTabFocusInsideGroup),
new jsCommon.HierarchicalNavigation(),
new jsCommon.HierarchicalTabOrderNavigation(),
];
var eventHandler = function (event) { return _this.handleKeyPress(event, isolate, navModes); };
// Only add another listener if we don't already have a listener for this element
if (!_.includes(this.registeredElements, container)) {
container.addEventListener('keydown', eventHandler);
this.registeredElements.push(container);
}
// Even if "container" is already registered, we still return an unregister function for it
var element = _.find(this.registeredElements, container);
var unregisterFn = function () {
element.removeEventListener('keydown', eventHandler);
_.pull(_this.registeredElements, container);
};
return unregisterFn;
};
FocusManager.prototype.registerShortcut = function (shortcut) {
this.shortcutContainer.add(shortcut);
};
FocusManager.prototype.unregisterShortcut = function (shortcut) {
this.shortcutContainer.remove(shortcut);
};
/**
* Focuses the first focusable child element inside a focus group if any.
* The element should have appropriate attributes focus-nav-mode Group and tabbable.
*/
FocusManager.focusChildInGroup = function (element, fromKeyboard) {
var groupElement = element.getAttribute(jsCommon.FocusNavModeAttribute) === "Group" /* Group */ ? element
: $(element).find(jsCommon.FocusNavModeGroupMatcher).get(0);
// We dont want the focus to go out of the element.
if (!groupElement) {
return;
}
FocusManager.focus(jsCommon.FocusGroupNavigation.getFocusNextElement(true, groupElement), fromKeyboard);
};
FocusManager.focusChildInCanvas = function (element) {
var isParentCanvasElement = element.getAttribute(jsCommon.FocusNavModeAttribute) === "HierarchicalTabOrder" /* HierarchicalTabOrder */;
var canvasElement = isParentCanvasElement ? element : $(element).find(jsCommon.FocusNavModeHierarchicalTabOrderMatcher)[0];
if (canvasElement)
FocusManager.focus(jsCommon.HierarchicalTabOrderNavigation.getFocusNextElement(canvasElement, true /* forward */, true /* traverseDown */));
};
FocusManager.focus = function (element, fromKeyboard) {
if (fromKeyboard === void 0) { fromKeyboard = true; }
if (!element)
return;
var currentActiveElement = document.activeElement;
// wait for any existing scope to finish digest
jsCommon.Zone.setTimeout((function () {
jsCommon.BrowserUtils.focus(element);
$(element).triggerHandler(jsCommon.FocusManagerFocusOnEventName, currentActiveElement);
$(element).trigger(jsCommon.FocusManagerFocusEventName, currentActiveElement);
// Treat focus source as "key" for focus events fired from FocusManager
if (fromKeyboard) {
FocusManager.keyboardFocused = true;
$("html").attr("data-focus-source", "key");
}
if (element) {
$(element).removeAttr(jsCommon.ActiveElementAttribute);
}
}));
};
FocusManager.prototype.focus = function (element, fromKeyboard) {
if (fromKeyboard === void 0) { fromKeyboard = true; }
FocusManager.focus(element, fromKeyboard);
};
FocusManager.prototype.focusOnGroupByIndex = function (keyCode, shift, alt, ctrl, focusPriority) {
this.shortcutContainer.handleByPriority(keyCode, shift, alt, ctrl, focusPriority);
};
FocusManager.setFocusOnPreviousElementOnDestroy = function (element, onlyUseFirstReturnElement, onlyReturnIfCurrentFocusIsInsideElement) {
var returnFocusElement = null;
// We don't want nested group to propagate event to the parent group cause it leads to unpredictable behavior.
// Focus event should be only consumed within its scope.
element.on(jsCommon.FocusManagerFocusEventName, (function (event, previousFocus) {
event.stopPropagation();
// store previous focus element if it is the first time focus has landed within this focus group
if (previousFocus && (!onlyUseFirstReturnElement || !returnFocusElement) && !$.contains(element[0], previousFocus)) {
returnFocusElement = previousFocus;
}
}));
return function () {
var currentActiveElement = document.activeElement;
// return focus to previous focus element if it is still attached to dom and current focus is within this focus group
if (returnFocusElement
&& $(returnFocusElement).closest(document.documentElement)
&& (!onlyReturnIfCurrentFocusIsInsideElement || $.contains(element[0], currentActiveElement))) {
jsCommon.FocusManager.focus(returnFocusElement, false);
}
};
};
FocusManager.prototype.handleKeyPress = function (event, isolate, navModes) {
if (this.handleShortcut(event)) {
event.stopPropagation();
event.preventDefault();
return;
}
var activeElement = document.activeElement;
if (!activeElement)
return;
var elementToFocus;
var modeRoot = jsCommon.FocusNavigationUtility.getFirstMatchingAncestor(activeElement, (function (e) { return e.hasAttribute(jsCommon.FocusNavModeAttribute); }), document.body);
var _loop_4 = function () {
var modeName = modeRoot.getAttribute(jsCommon.FocusNavModeAttribute);
// Browser mode means focus manager should do nothing
if (modeName === "Browser" /* Browser */) {
return { value: void 0 };
}
var mode = _.find(navModes, (function (m) { return m.name === modeName; }));
if (mode && mode.shouldHandleFocus(activeElement, modeRoot)) {
elementToFocus = mode.findNextElementToFocus(activeElement, event, modeRoot);
}
if (elementToFocus) {
return "break";
}
else {
// If this mode does not handle the event, check for parent modes
modeRoot = jsCommon.FocusNavigationUtility.getFirstMatchingAncestor(modeRoot, (function (e) { return e.hasAttribute(jsCommon.FocusNavModeAttribute); }), document.body, false);
}
};
while (modeRoot && modeRoot !== document.body) {
var state_2 = _loop_4();
if (typeof state_2 === "object")
return state_2.value;
if (state_2 === "break")
break;
}
if (elementToFocus) {
FocusManager.focus(elementToFocus);
}
// in case of isolate we want to stop propagation.
// this is usually the case for dialogs and popups.
if (isolate) {
event.stopPropagation();
}
if (!!elementToFocus && event.keyCode !== 13 /* enterKeyCode */
&& event.keyCode !== 32 /* spaceKeyCode */) {
event.stopPropagation();
event.preventDefault();
}
};
/**
* Searches all the shortcuts that match current pattern.
* If there are multiple of those than focus the next element
* based on registration order.
*/
FocusManager.prototype.handleShortcut = function (event) {
return this.shortcutContainer.handle(event);
};
FocusManager.prototype.focusNextElement = function (element) {
FocusManager.focus(jsCommon.FocusGroupNavigation.getFocusNextElement(true, element));
};
FocusManager.keyboardFocused = false;
return FocusManager;
}());
jsCommon.FocusManager = FocusManager;
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
/**
* Uses dom order on element for finding next focusable element.
*/
var DomOrderFocusFinder = /** @class */ (function () {
function DomOrderFocusFinder(focusNavMode) {
if (focusNavMode === void 0) { focusNavMode = "Group" /* Group */; }
this.focusNavMode = focusNavMode;
}
DomOrderFocusFinder.prototype.findNext = function (element, forward, traverseDown) {
if (forward === void 0) { forward = true; }
if (traverseDown === void 0) { traverseDown = false; }
var walker = this.getDomWalker(forward);
// If the element is focus group we only search it child elements.
// This is useful when focus on shortcut element.
var modeName = element.getAttribute(jsCommon.FocusNavModeAttribute);
if (modeName === "Group" /* Group */ || modeName === "Browser" /* Browser */ || traverseDown) {
return this.traverseDown(element, walker);
}
return this.searchFocusElement(element, walker);
};
DomOrderFocusFinder.prototype.searchFocusElement = function (element, walker) {
var focusable = this.traverseForward(walker.getNextSibling(element), walker);
if (!focusable) {
if (element.parentElement && element.parentElement.getAttribute(jsCommon.FocusNavModeAttribute) !== this.focusNavMode) {
focusable = this.searchFocusElement(element.parentElement, walker);
}
// for IE 11's sake, check if a parentElement exists by looking in the parentNode (and constrain to nodeType === ELEMENT_NODE)
else if (element.parentNode && element.parentNode.nodeType === Node.ELEMENT_NODE &&
element.parentNode.getAttribute(jsCommon.FocusNavModeAttribute) !== this.focusNavMode) {
focusable = this.searchFocusElement(element.parentNode, walker);
}
}
return focusable;
};
DomOrderFocusFinder.prototype.traverseForward = function (element, walker) {
if (!element)
return;
if (jsCommon.isTabbable(element)) {
return element;
}
var focusable;
if (element.getAttribute(jsCommon.DOMConstants.skipChildrenFocusAttribute) == null) {
focusable = this.traverseDown(element, walker);
}
if (!focusable) {
focusable = this.traverseForward(walker.getNextSibling(element), walker);
}
return focusable;
};
DomOrderFocusFinder.prototype.traverseDown = function (element, walker) {
if (!element || element.getAttribute(jsCommon.FocusNavModeAttribute) === "Skip" /* Skip */)
return;
return this.traverseForward(walker.getNextChild(element), walker);
};
DomOrderFocusFinder.prototype.getDomWalker = function (forward) {
var _this = this;
if (forward) {
return {
getNextSibling: function (element) {
return element.nextElementSibling;
},
getNextChild: function (element) {
if (!_.isEmpty(element.children)) {
return element.children[0];
}
// IE 11 treats some elements that *should* inherit from `Element` as inheriting from `Node` (one level up) instead,
// so for elements such as `SVGElement`, the children property will be undefined although children exist on the node.
if (element.hasChildNodes()) {
return _this.getNextChildNodes(element, forward);
}
}
};
}
else {
return {
getNextSibling: function (element) {
return element.previousElementSibling;
},
getNextChild: function (element) {
if (!_.isEmpty(element.children)) {
return element.children[element.children.length - 1];
}
// IE 11 treats some elements that *should* inherit from `Element` as inheriting from `Node` (one level up) instead,
// so for elements such as `SVGElement`, the children property will be undefined although children exist on the node.
if (element.hasChildNodes()) {
return _this.getNextChildNodes(element, forward);
}
}
};
}
};
DomOrderFocusFinder.prototype.getNextChildNodes = function (element, forward) {
var childNodes = element.childNodes;
var numChildren = childNodes.length;
var incrementor = forward ? 1 : -1;
var i = forward ? 0 : numChildren - 1;
do {
var child = childNodes[i];
// we only want Nodes of type ELEMENT_NODE
// (essentially, what `.children` should return on the original element)
if (child && child.nodeType === Node.ELEMENT_NODE)
return child;
i += incrementor;
} while (i >= 0 && i < numChildren);
};
return DomOrderFocusFinder;
}());
jsCommon.DomOrderFocusFinder = DomOrderFocusFinder;
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
/**
* Uses tab order attribute on element for finding next focusable element.
* The parent of the list of element should have tab-order-eneabled attribute.
* tab-order will not search through the children but stays on 1st level siblings
* <parent-div tab-order-enabled>
* <div tab-order="100">Last Focused</div>
* <div tab-order="300">First Focused</div>
* <div tab-order="200">Second Focused</div>
* </parent-div>
*/
var TabOrderFocusFinder = /** @class */ (function () {
function TabOrderFocusFinder(focusNavMode) {
if (focusNavMode === void 0) { focusNavMode = "Group" /* Group */; }
this.focusNavMode = focusNavMode;
}
TabOrderFocusFinder.prototype.findNext = function (element, forward, cycleBack, traverseDown) {
if (forward === void 0) { forward = true; }
if (cycleBack === void 0) { cycleBack = true; }
if (traverseDown === void 0) { traverseDown = false; }
var nextElement;
if (traverseDown || hasTabOrderEnabledAttribute(element)) {
// find child with getFirstActiveChild attribute to give priority
nextElement = this.getFirstActiveChild(element);
if (!nextElement) {
nextElement = this.getNextTabOrderChild(element, forward, getInitialTabOrder(forward));
}
}
else if (hasTabOrderAttribute(element)) {
// find sibling
nextElement = this.getNextTabOrderSibling(element, forward, cycleBack);
}
else if (hasTabOrderChildAttribute(element)) {
// find sibling w.r.t parent tab-order element
var parentElement = findTabOrderParentElement(element);
nextElement = this.getNextTabOrderSibling(parentElement, forward, cycleBack);
}
return nextElement;
};
TabOrderFocusFinder.prototype.getNextTabOrderSibling = function (element, forward, cycleBack) {
var currentTabOrderAttr = element.getAttribute(jsCommon.TabOrderAttribute);
var currentTabOrder = parseFloat(currentTabOrderAttr);
var isTabOrderInitialized = !isNaN(currentTabOrder);
var siblingToReturn;
if (isTabOrderInitialized) {
var tabOrderContainer = findParentNavElement(element, this.focusNavMode);
if (!tabOrderContainer)
return;
siblingToReturn = this.getNextTabOrderChild(tabOrderContainer, forward, currentTabOrder);
if (!siblingToReturn && cycleBack) {
// at extremity, cycle back
siblingToReturn = this.getNextTabOrderChild(tabOrderContainer, forward, getInitialTabOrder(forward));
}
}
// if tab order is not initialized, return undefined
// to designate to DomOrderFocusFinder
return siblingToReturn;
};
/**
* Method returns child element with ActiveElementAttribute
* @param parent parent container of DOM elements to find active element
* @returns DOM element
*/
TabOrderFocusFinder.prototype.getFirstActiveChild = function (parent) {
var next;
var tabOrderElements = $(parent).find("[" + jsCommon.ActiveElementAttribute + "]");
tabOrderElements.each((function (_index, elem) {
// if element has tab-active attribute force focus to element
if (hasActiveElementAttribute(elem)) {
next = elem;
return;
}
}));
// if we cannot find the next child with tab order, meaning its not initialized, return undefined
// to designate to DomOrderFocusFinder
return next;
};
TabOrderFocusFinder.prototype.getNextTabOrderChild = function (parent, forward, currentTabIndex) {
var next;
var nextTabIndex;
var tabOrderElements = $(parent).find("[" + jsCommon.TabOrderAttribute + "]");
if (this.focusNavMode === "HierarchicalTabOrder" /* HierarchicalTabOrder */)
tabOrderElements = tabOrderElements.filter((function (_index, element) { return jsCommon.FocusNavigationUtility.getTabbableParent(element) === parent; }));
tabOrderElements.each((function (_index, elem) {
var elementTabIndex = getTabOrder(elem);
// if element has ActiveElementAttribute attribute force focus to element
if (hasActiveElementAttribute(elem)) {
next = elem;
return;
}
if (jsCommon.FocusNavigationUtility.isElementTabbable(elem)) {
// for forward, we are finding the next biggest tab order smaller than current
// for !forward we are finding the next smallest bigger than current
if (forward ? elementTabIndex < currentTabIndex : elementTabIndex > currentTabIndex) {
var firstPotential = next === undefined && nextTabIndex === undefined;
var consequentPotential = forward ? elementTabIndex > nextTabIndex : elementTabIndex < nextTabIndex;
if (firstPotential || consequentPotential) {
nextTabIndex = elementTabIndex;
next = elem;
}
}
}
}));
// if we cannot find the next child with tab order, meaning its not initialized, return undefined
// to designate to DomOrderFocusFinder
return next;
};
return TabOrderFocusFinder;
}());
jsCommon.TabOrderFocusFinder = TabOrderFocusFinder;
function getTabOrder(element) {
if (element.hasAttribute(jsCommon.TabOrderAttribute))
return parseFloat(element.getAttribute(jsCommon.TabOrderAttribute));
}
jsCommon.getTabOrder = getTabOrder;
function hasTabOrderAttribute(element) {
return element.getAttribute(jsCommon.TabOrderAttribute) != null;
}
jsCommon.hasTabOrderAttribute = hasTabOrderAttribute;
function hasTabOrderEnabledAttribute(element) {
return element.getAttribute(jsCommon.TabOrderEnabledAttribute) != null;
}
jsCommon.hasTabOrderEnabledAttribute = hasTabOrderEnabledAttribute;
function hasActiveElementAttribute(element) {
return element.getAttribute(jsCommon.ActiveElementAttribute) != null;
}
jsCommon.hasActiveElementAttribute = hasActiveElementAttribute;
function hasTabOrderChildAttribute(element) {
return element.getAttribute(jsCommon.TabOrderChildAttribute) != null;
}
jsCommon.hasTabOrderChildAttribute = hasTabOrderChildAttribute;
function getInitialTabOrder(forward) {
// CanvasListOrderingConstants upper limit is 10000000, and min is -10000000
return forward ? 10000001 : -10000001;
}
function findTabOrderParentElement(element) {
return findParentElementOnAttribute(element, jsCommon.TabOrderAttribute);
}
function findParentNavElement(element, focusNavMode) {
var matcher = focusNavMode === "HierarchicalTabOrder" /* HierarchicalTabOrder */ ? jsCommon.FocusNavModeHierarchicalTabOrderMatcher : jsCommon.FocusNavModeGroupMatcher;
return $(element).parents(matcher)[0];
}
function findParentElementOnAttribute(element, attribute) {
var parent = $(element).closest("[" + attribute + "]");
return parent && parent.get(0);
}
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var FocusGroupNavigation = /** @class */ (function () {
function FocusGroupNavigation(skipCyclicNavigation) {
if (skipCyclicNavigation === void 0) { skipCyclicNavigation = false; }
this.skipCyclicNavigation = skipCyclicNavigation;
}
Object.defineProperty(FocusGroupNavigation.prototype, "name", {
get: function () {
return "Group" /* Group */;
},
enumerable: false,
configurable: true
});
FocusGroupNavigation.prototype.shouldHandleFocus = function (element, modeRoot) {
// Check that there aren't any tabbable parents between element and mode root
return !$.contains(modeRoot, jsCommon.FocusNavigationUtility.getTabbableParent(element, modeRoot));
};
/* tslint:disable:no-unused-variable */
FocusGroupNavigation.prototype.findNextElementToFocus = function (activeElement, event) {
var groupElement = FocusGroupNavigation.getGroupNavigationElement(activeElement);
switch (event.keyCode) {
case 39 /* rightArrowKeyCode */:
case 40 /* downArrowKeyCode */:
if (FocusGroupNavigation.groupElementSupportsArrows(groupElement) && !FocusGroupNavigation.canHandleKeyEvents(activeElement)) {
return FocusGroupNavigation.getFocusNextElement(true /* forward */);
}
break;
case 38 /* upArrowKeyCode */:
case 37 /* leftArrowKeyCode */:
if (FocusGroupNavigation.groupElementSupportsArrows(groupElement) && !FocusGroupNavigation.canHandleKeyEvents(activeElement)) {
return FocusGroupNavigation.getFocusNextElement(false);
}
break;
case 9 /* tabKeyCode */:
if (!jsCommon.FocusNavigationUtility.isElementContentEditable(activeElement)) {
return FocusGroupNavigation.getFocusNextElement(!event.shiftKey, undefined /* focusedElement */, this.skipCyclicNavigation);
}
break;
case 27 /* escKeyCode */:
return jsCommon.FocusNavigationUtility.getTabbableParent(document.activeElement);
case 13 /* enterKeyCode */:
if (groupElement && groupElement.getAttribute(jsCommon.TabOrderRecursiveEnabledAttribute) != null) {
return jsCommon.FocusNavigationUtility.getFirstTabbableChild(document.activeElement);
}
}
};
FocusGroupNavigation.getFocusNextElement = function (forward, focusedElement, skipCyclicNavigation) {
if (focusedElement === void 0) { focusedElement = null; }
if (skipCyclicNavigation === void 0) { skipCyclicNavigation = false; }
var activeElement = document.activeElement;
focusedElement = focusedElement || FocusGroupNavigation.getFirstFocusableParent(activeElement);
if (focusedElement) {
var groupElement = FocusGroupNavigation.getGroupNavigationElement(focusedElement);
var focusFinder = void 0;
var elementToFocus = void 0;
if (groupElement && groupElement.getAttribute(jsCommon.TabOrderRecursiveEnabledAttribute) != null) {
focusFinder = new jsCommon.TabOrderRecursiveFocusFinder(groupElement);
elementToFocus = focusFinder.findNext(focusedElement, forward);
}
else {
var isTabOrderEnabled = jsCommon.hasTabOrderEnabledAttribute(focusedElement) || jsCommon.hasTabOrderAttribute(focusedElement);
if (isTabOrderEnabled) {
focusFinder = new jsCommon.TabOrderFocusFinder();
elementToFocus = focusFinder.findNext(focusedElement, forward);
}
if (!elementToFocus || !isTabOrderEnabled) {
focusFinder = new jsCommon.DomOrderFocusFinder();
elementToFocus = focusFinder.findNext(focusedElement, forward);
}
}
if (elementToFocus) {
return elementToFocus;
}
// If there is no focus element try to search from the start.
// This happens in case if the last element was in focus.
if (focusedElement.getAttribute(jsCommon.FocusNavModeAttribute) !== "Group" /* Group */ && !skipCyclicNavigation) {
var groupElement_1 = FocusGroupNavigation.getParentGroupElement(focusedElement);
return groupElement_1 ? focusFinder.findNext(groupElement_1, forward) : undefined;
}
}
};
FocusGroupNavigation.getGroupNavigationElement = function (focusedElement) {
// Get the group element to determine if we need to do a recursive search
var focusedIsGroup = focusedElement.getAttribute(jsCommon.FocusNavModeAttribute);
var groupElement = focusedIsGroup && focusedIsGroup === "Group" /* Group */ ? focusedElement : FocusGroupNavigation.getParentGroupElement(focusedElement);
return groupElement;
};
/**
* Returns first focusable element. There are three cases here
* 1. Return element if it's tabbable
* 2. Return parent if it's tabbable or if a Group element.
*/
FocusGroupNavigation.getFirstFocusableParent = function (element) {
if (!element)
return null;
if (jsCommon.isTabbable(element)
|| element.getAttribute(jsCommon.FocusNavModeAttribute) === "Group" /* Group */) {
return element;
}
// In IE 11, SVG nodes don't consider themselves an `HTMLElement` and do not implement `parentElement`.
// Instead, check that `parentNode` is an ELEMENT_NODE in leiu of `parentElement`.
var parent = element.parentElement ||
element.parentNode && element.parentNode.nodeType === Node.ELEMENT_NODE ?
element.parentNode :
null;
while (parent) {
if (jsCommon.isTabbable(parent) || parent.getAttribute(jsCommon.FocusNavModeAttribute) === "Group" /* Group */)
return parent;
parent = parent.parentElement ||
parent.parentNode && parent.parentNode.nodeType === Node.ELEMENT_NODE ?
parent.parentNode :
null;
}
return parent;
};
FocusGroupNavigation.getParentGroupElement = function (element) {
return $(element).parents(jsCommon.FocusNavModeGroupMatcher).get(0);
};
/**
* Detects whether element supports key events.
*/
FocusGroupNavigation.canHandleKeyEvents = function (element) {
return jsCommon.FocusNavigationUtility.isElementContentEditable(element) || jsCommon.FocusNavigationUtility.isTextElement(element);
};
FocusGroupNavigation.groupElementSupportsArrows = function (groupElement) {
return !groupElement ||
groupElement.getAttribute(jsCommon.TabOrderRecursiveEnabledAttribute) == null ||
groupElement.getAttribute(jsCommon.SkipArrowNavigationAttribute) == null;
};
return FocusGroupNavigation;
}());
jsCommon.FocusGroupNavigation = FocusGroupNavigation;
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
/**
* Hierarchical Naigation: Instead of depth-first tab order that is browsers default behavior, tab and shift tab
* will only navigate through focusable siblings. Pressing Enter takes the focus to the first focusable child
* and pressing Escape takes the focus to focusable parent.
*/
var HierarchicalNavigation = /** @class */ (function () {
function HierarchicalNavigation() {
}
Object.defineProperty(HierarchicalNavigation.prototype, "name", {
get: function () {
return "Hierarchy" /* Hierarchy */;
},
enumerable: false,
configurable: true
});
HierarchicalNavigation.prototype.shouldHandleFocus = function () {
return true;
};
HierarchicalNavigation.prototype.findNextElementToFocus = function (activeElement, event, modeRoot) {
switch (event.keyCode) {
case 9 /* tabKeyCode */:
if (jsCommon.FocusNavigationUtility.isElementContentEditable(activeElement))
return undefined;
var topChildren = jsCommon.FocusNavigationUtility.getTabbableChildren(modeRoot);
// Check if the mode root is a tabbable parent of the current element. If it is, we will focus trap
// and cycle focus among the children of the mode root.
var isRootTabbableParent = jsCommon.FocusNavigationUtility.getTabbableParent(activeElement, modeRoot) === modeRoot;
if (!event.shiftKey) { // tab
if (topChildren.length > 0 && (activeElement !== topChildren[topChildren.length - 1] || isRootTabbableParent)) {
return jsCommon.FocusNavigationUtility.getNextTabbableSibling(activeElement, modeRoot);
}
else {
// If this is the last focusable child of the root and root is not tabbable, we need to let go of the focus
// Since the next focus might be outside of our managed tree, we just set the focus
// to the last focusable element of our tree and let the browser handle the event.
// Note: In Hierarchical Navigation, the first focusable child is also the first focusable descendent
// But the last focusable child may not be the last focusable descendent
var descendents = jsCommon.FocusNavigationUtility.getTabbableDescendants(modeRoot);
if (descendents.length > 0) {
descendents[descendents.length - 1].focus();
return undefined;
}
}
}
else { // shift tab
// If this is the first focusable child of the root and root is not tabbable, don't handle the focus so it can go out
if (topChildren.length > 0 && (activeElement !== topChildren[0] || isRootTabbableParent)) {
return jsCommon.FocusNavigationUtility.getPrevTabbableSibling(activeElement, modeRoot);
}
}
break;
case 27 /* escKeyCode */:
if (activeElement !== modeRoot) {
return jsCommon.FocusNavigationUtility.getTabbableParent(activeElement);
}
break;
case 13 /* enterKeyCode */:
return jsCommon.FocusNavigationUtility.getFirstTabbableChild(activeElement);
}
};
return HierarchicalNavigation;
}());
jsCommon.HierarchicalNavigation = HierarchicalNavigation;
})(jsCommon || (jsCommon = {}));
//----------------------------------------------------------
// Copyright (C) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------
var powerbi;
(function (powerbi) {
var host;
(function (host) {
var events;
(function (events) {
var LuciaSessionStateChangedEventArgs = /** @class */ (function () {
function LuciaSessionStateChangedEventArgs() {
}
return LuciaSessionStateChangedEventArgs;
}());
events.LuciaSessionStateChangedEventArgs = LuciaSessionStateChangedEventArgs;
})(events = host.events || (host.events = {}));
})(host = powerbi.host || (powerbi.host = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var host;
(function (host) {
var global;
(function (global) {
global.events = {
SaveEndedEvent: {
type: 4 /* Global */,
name: 'SaveEndedEvent'
},
LuciaDomainModelChangedEvent: {
type: 4 /* Global */,
name: 'LuciaDomainModelChangedEvent'
},
QnaSettingsChangedEvent: {
type: 4 /* Global */,
name: 'QnaSettingsChangedEvent'
},
ReportContentsReplacedEvent: {
type: 4 /* Global */,
name: 'ReportContentsReplacedEvent'
},
ModelChangedEvent: {
type: 4 /* Global */,
name: 'ModelChangedEvent'
},
SignInStatusChangedEvent: {
type: 4 /* Global */,
name: 'SignInStatusChangedEvent'
},
WindowStateChangedEvent: {
type: 4 /* Global */,
name: 'WindowStateChangedEvent'
},
ReportQueriesChangedEvent: {
type: 4 /* Global */,
name: 'ReportQueriesChangedEvent'
},
UpdateAvailableEvent: {
type: 4 /* Global */,
name: 'UpdateAvailableEvent'
},
SelectedSensitivityLabelChangedEvent: {
type: 4 /* Global */,
name: 'SelectedSensitivityLabelChangedEvent'
},
OpenFileMenuEvent: {
type: 4 /* Global */,
name: 'OpenFileMenuEvent',
}
};
})(global = host.global || (host.global = {}));
})(host = powerbi.host || (powerbi.host = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
/** Shared definitions for lazy-loaded modules in PowerBICommon. */
var powerbi;
(function (powerbi) {
var common;
(function (common) {
var modules;
(function (modules) {
modules.JQueryUIModule = {
javascript: 'jquery-ui',
css: ['jquery-ui'],
};
})(modules = common.modules || (common.modules = {}));
})(common = powerbi.common || (powerbi.common = {}));
})(powerbi || (powerbi = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var LinkedList = /** @class */ (function () {
function LinkedList() {
this._head = new LinkedListNode();
this._tail = new LinkedListNode();
this._head.next = this._tail;
this._tail.prev = this._head;
this._length = 0;
}
/**
* Before insertion: this.head <-> ... <-> this.tail
* After insertion: this.head <-> node <-> ... <-> this.tail
*/
LinkedList.prototype.insertToHead = function (node) {
// Pointers from the node we're inserting.
node.next = this._head.next;
node.prev = this._head;
// Pointers to the node we're inserting.
this._head.next = node;
node.next.prev = node;
this._length++;
};
/**
* Returns the head node of the linked list, iff it exists.
*/
LinkedList.prototype.head = function () {
if (this._length > 0) {
return this._head.next;
}
};
/**
* Returns the tail node of the linked list, iff it exists.
*/
LinkedList.prototype.tail = function () {
if (this._length > 0) {
return this._tail.prev;
}
};
/**
* Helper method to remove the last item in the linked list.
*/
LinkedList.prototype.removeFromTail = function () {
if (this._length > 0) {
var nodeToRemove = this._tail.prev;
this.remove(nodeToRemove);
}
};
/**
* Before removal: this.head <-> ... <-> node <-> this.tail
* node.key is in this.cache
* After removal: this.head <-> ... <-> this.tail
* node.key is removed from this.cache
*/
LinkedList.prototype.remove = function (nodeToRemove) {
if (this._length <= 0 || nodeToRemove.prev === undefined || nodeToRemove.next === undefined) {
// Any node we want to remove should have prev and next defined.
return;
}
nodeToRemove.prev.next = nodeToRemove.next;
nodeToRemove.next.prev = nodeToRemove.prev;
this._length--;
};
/**
* Returns the number of nodes currently in the linked list.
*/
LinkedList.prototype.length = function () {
return this._length;
};
return LinkedList;
}());
powerbi.LinkedList = LinkedList;
/**
* Simple linked list node with helper constructor
*/
var LinkedListNode = /** @class */ (function () {
function LinkedListNode(value) {
if (value === void 0) { value = undefined; }
this.value = value;
}
return LinkedListNode;
}());
powerbi.LinkedListNode = LinkedListNode;
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var parseIntSubstrFast = jsCommon.StringExtensions.parseIntSubstrFast;
var Version;
(function (Version) {
Version.Zero = { major: 0, minor: 0, patch: 0 };
Version.ZeroStr = "0.0";
Version.LargestVersion = "99.9";
/** Parses the input string into a Version. */
function tryParse(versionString) {
debug.assertValue(versionString, "versionString");
var major = 0, minor = 0, patch = 0, prerel, currentPart = 0 /* Major */;
for (var i = 0, currentPartStart = 0, len = versionString.length; i <= len; i++) {
var charCode = i === len
? 46 /* Dot */
: versionString.charCodeAt(i);
switch (charCode) {
case 46 /* Dot */:
case 45 /* Dash */:
if (i === currentPartStart) {
// Empty part -- invalid.
return;
}
var partValue = parseIntSubstrFast(versionString, currentPartStart, i - currentPartStart);
if (partValue == null) {
// Non-numeric part -- invalid.
return;
}
switch (currentPart) {
case 0 /* Major */:
major = partValue;
break;
case 1 /* Minor */:
minor = partValue;
break;
case 2 /* Patch */:
patch = partValue;
break;
default:
// Malformed version (too many parts).
return;
}
currentPart++;
currentPartStart = i + 1;
if (charCode === 45 /* Dash */) {
if (currentPart !== 3 /* Prerel */) {
// Prerel is too early.
return;
}
prerel = versionString.substr(i + 1);
if (!validPrerel(prerel))
return;
// This reads the rest of the string, jump to the end.
i = len;
}
break;
default:
if (charCode < 48 /* Zero */ || charCode > 57 /* Nine */) {
// Invalid characters.
return;
}
break;
}
}
var version = {
major: major,
minor: minor,
patch: patch,
};
if (prerel) {
// Need to cast to ignore readonly.
version.prerel = prerel;
}
return version;
}
Version.tryParse = tryParse;
/** Validates prerel string. Allows only alphanumeric and dash characters. */
function validPrerel(prerel) {
debug.assertValue(prerel, 'prerel');
for (var i = 0, len = prerel.length; i < len; i++) {
var charCode = prerel.charCodeAt(i);
if ((65 /* A */ <= charCode && charCode <= 90 /* Z */) ||
(97 /* a */ <= charCode && charCode <= 122 /* z */) ||
(48 /* Zero */ <= charCode && charCode <= 57 /* Nine */) ||
charCode === 45 /* Dash */ ||
charCode === 46 /* Dot */) {
continue;
}
// If we made it here -- invalid character.
return false;
}
return true;
}
function toString(version) {
debug.assertValue(version, 'version');
if (_.isString(version)) {
debug.assertValue(tryParse(version), 'tryParse(version)');
return version;
}
if (version.prerel == null)
return version.major + "." + version.minor + "." + version.patch;
return version.major + "." + version.minor + "." + version.patch + "-" + version.prerel;
}
Version.toString = toString;
/** checks whether v1 is greater than v2 */
function gt(v1, v2) {
debug.assertValue(v1, 'v1');
debug.assertValue(v2, 'v2');
return cmp(normalize(v1), normalize(v2)) > 0;
}
Version.gt = gt;
/** checks whether v1 is less than to v2 */
function lt(v1, v2) {
debug.assertValue(v1, 'v1');
debug.assertValue(v2, 'v2');
return cmp(normalize(v1), normalize(v2)) < 0;
}
Version.lt = lt;
/** checks whether v1 is greater than or equal to v2 */
function ge(v1, v2) {
debug.assertValue(v1, 'v1');
debug.assertValue(v2, 'v2');
return cmp(normalize(v1), normalize(v2)) >= 0;
}
Version.ge = ge;
/** checks whether v1 is equal to v2 */
function eq(v1, v2) {
debug.assertValue(v1, 'v1');
debug.assertValue(v2, 'v2');
v1 = normalize(v1);
v2 = normalize(v2);
return !cmp(normalize(v1), normalize(v2));
}
Version.eq = eq;
function max(v1, v2) {
return gt(normalize(v1), normalize(v2)) ? v1 : v2;
}
Version.max = max;
function normalize(version) {
if (_.isString(version))
return tryParse(version) || Version.Zero;
return version;
}
function cmp(v1, v2) {
var result = cmpPart(v1.major, v2.major);
if (result)
return result;
result = cmpPart(v1.minor, v2.minor);
if (result)
return result;
result = cmpPart(v1.patch, v2.patch);
if (result)
return result;
return cmpRel(v1.prerel, v2.prerel);
}
function cmpPart(v1, v2) {
v1 = v1 || 0;
v2 = v2 || 0;
var diff = v1 - v2;
if (diff === 0)
return 0;
if (diff < 0)
return -1;
debug.assert(diff > 0, 'diff > 0');
return 1;
}
function cmpRel(v1, v2) {
var v1IsEmpty = _.isEmpty(v1);
var v2IsEmpty = _.isEmpty(v2);
if (v1IsEmpty) {
if (v2IsEmpty)
return 0;
return 1;
}
if (v2IsEmpty) {
return -1;
}
// Handle pure-numeric prerel cases for consistency with semver.
var v1Number = parseIntSubstrFast(v1, 0, v1.length);
var v2Number = parseIntSubstrFast(v2, 0, v2.length);
if (v1Number != null) {
if (v2Number != null) {
return cmpPart(v1Number, v2Number);
}
// Numeric is lower precedence than non-numeric
return -1;
}
if (v2Number != null) {
// Numeric is lower precedence than non-numeric
return 1;
}
// NOTE: the C# implementation uses StringComparer.Ordinal, which isn't available in JavaScript.
// Approximating it with locale-specific comparison.
return v1.localeCompare(v2);
}
})(Version = jsCommon.Version || (jsCommon.Version = {}));
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var FontPickerUtility;
(function (FontPickerUtility) {
function getCustomFontPickerInfo(newFontFamily) {
debug.assert(!_.isEmpty(newFontFamily), "Font family should exist");
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-family
var match = newFontFamily.match(/^(?:\s)*('|")?((?:\w|\s|-|\\.)+)(?:\1(?=,|$))/);
return match && match[2] || newFontFamily;
}
FontPickerUtility.getCustomFontPickerInfo = getCustomFontPickerInfo;
})(FontPickerUtility = jsCommon.FontPickerUtility || (jsCommon.FontPickerUtility = {}));
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var common;
(function (common) {
var utils;
(function (utils) {
var DateExtensions = jsCommon.DateExtensions;
var DateFormatter;
(function (DateFormatter) {
/** Returns a date from the past, pretty-formatted relative to the current date; using text yesterday or today when relevant */
/** e.g. today at 2:42 PM, yesterday at 4:00 AM, 3 days ago etc */
function getRelativeDateWithText(givenTime, localize, capitalizeFirstLetter) {
if (capitalizeFirstLetter === void 0) { capitalizeFirstLetter = false; }
var todayDateTime = new Date();
// DateTimeFormat adds am/pm for locales that require it
var time = Intl.DateTimeFormat(localize.currentLanguageLocale, { hour: 'numeric', minute: 'numeric' }).format(givenTime);
if (isSameDay(givenTime, todayDateTime))
return localize.format('TodayAt', time);
var yesterdayDateTime = new Date();
yesterdayDateTime.setDate(todayDateTime.getDate() - 1);
if (isSameDay(givenTime, yesterdayDateTime))
return localize.format('YesterdayAt', time);
return getPrettyRelativeDate(givenTime, localize, capitalizeFirstLetter);
}
DateFormatter.getRelativeDateWithText = getRelativeDateWithText;
/** Returns a date from the past, pretty-formatted relative to the current date. */
function getPrettyRelativeDate(date, localize, capitalizeFirstLetter) {
if (capitalizeFirstLetter === void 0) { capitalizeFirstLetter = false; }
debug.assert(DateExtensions.isMomentPresent(), "Moment not available");
if (!date) {
return "-";
}
var diff = moment().diff(date), // Difference between current date and the one provided
interval = moment.duration(diff), floor = Math.floor;
debug.assert(interval.asMilliseconds() >= 0, 'This function is intended to be used only with dates from the past.');
var years = floor(interval.asYears());
if (years > 1)
return localize.format("RelativeDate_YearsAgo", [years]);
if (years === 1)
return localize.get(useCapitalizeVersion("RelativeDate_YearAgo", capitalizeFirstLetter));
var months = floor(interval.asMonths());
if (months > 1)
return localize.format("RelativeDate_MonthsAgo", [months]);
if (months === 1)
return localize.get(useCapitalizeVersion("RelativeDate_MonthAgo", capitalizeFirstLetter));
var days = floor(interval.asDays());
if (days > 1)
return localize.format("RelativeDate_DaysAgo", [days]);
if (days === 1)
return localize.get(useCapitalizeVersion("RelativeDate_DayAgo", capitalizeFirstLetter));
var hours = floor(interval.asHours());
if (hours > 1)
return localize.format("RelativeDate_HoursAgo", [hours]);
if (hours === 1)
return localize.get(useCapitalizeVersion("RelativeDate_HourAgo", capitalizeFirstLetter));
var minutes = floor(interval.asMinutes());
if (minutes > 1)
return localize.format("RelativeDate_MinutesAgo", [minutes]);
if (minutes === 1)
return localize.get(useCapitalizeVersion("RelativeDate_MinuteAgo", capitalizeFirstLetter));
var seconds = floor(interval.asSeconds());
if (seconds >= 30)
return localize.format("RelativeDate_SecondsAgo", [seconds]);
return localize.get("RelativeDate_Now");
}
DateFormatter.getPrettyRelativeDate = getPrettyRelativeDate;
/**
* @param dateTimeDisplayStringKey Key of the string for displaying date-time related information. This string should
* require 2 parameters, one for date and one for time. If not specified, 'DisplayDateTime_Common' is used.
* Transform a timestamp into either 'Today at 12:03pm or Yesterday at 12:10pm or 03/14/2022 at 1:44pm'
*/
function getFriendlyDateTimeString(timestamp, localizationService, dateTimeDisplayStringKey, useUpperCase) {
if (dateTimeDisplayStringKey === void 0) { dateTimeDisplayStringKey = 'DisplayDateTime_Common'; }
if (useUpperCase === void 0) { useUpperCase = false; }
debug.assertValue(timestamp, "timestamp is required param");
debug.assertValue(localizationService, 'localizationService is required param');
var dateDisplayString = getFriendlyDateString(timestamp, localizationService, useUpperCase);
var timeDisplayString = new Date(timestamp).toLocaleTimeString(localizationService.currentLanguageLocale, { hour: 'numeric', minute: 'numeric' });
return localizationService.format(dateTimeDisplayStringKey, [dateDisplayString, timeDisplayString]);
}
DateFormatter.getFriendlyDateTimeString = getFriendlyDateTimeString;
function getFriendlyDateString(timestamp, localizationService, useUpperCase) {
if (useUpperCase === void 0) { useUpperCase = false; }
debug.assertValue(timestamp, 'timestamp is required param');
debug.assertValue(localizationService, 'localizationService is required param');
var givenTime = new Date(timestamp);
var todayDateTime = new Date();
if (isSameDay(givenTime, todayDateTime))
return localizationService.get(useUpperCase ? 'TodayTitle' : 'Today');
var yesterdayDateTime = new Date();
yesterdayDateTime.setDate(todayDateTime.getDate() - 1);
if (isSameDay(givenTime, yesterdayDateTime))
return localizationService.get(useUpperCase ? 'YesterdayTitle' : 'Yesterday');
return new Date(timestamp).toLocaleDateString(localizationService.currentLanguageLocale, { day: 'numeric', month: 'numeric', year: 'numeric' });
}
DateFormatter.getFriendlyDateString = getFriendlyDateString;
function prettyRelativeDateIndexOrder(date) {
debug.assert(DateExtensions.isMomentPresent(), "Moment not available");
if (!date) {
return 0;
}
var diff = moment().diff(date), // Difference between current date and the one provided
interval = moment.duration(diff), floor = Math.floor;
if (!(interval.asMilliseconds() >= 0)) {
return 0;
}
var years = floor(interval.asYears());
if (years >= 1)
return 1000000 + years;
var months = floor(interval.asMonths());
if (months >= 1)
return 100000 + months;
var days = floor(interval.asDays());
if (days >= 1)
return 10000 + days;
var hours = floor(interval.asHours());
if (hours >= 1)
return 1000 + hours;
var minutes = floor(interval.asMinutes());
if (minutes >= 1)
return 100 + minutes;
var seconds = floor(interval.asSeconds());
if (seconds >= 30)
return seconds;
return 0;
}
DateFormatter.prettyRelativeDateIndexOrder = prettyRelativeDateIndexOrder;
function useCapitalizeVersion(target, useCapitalizeVersion) {
return useCapitalizeVersion ? target + '_Capitalize' : target;
}
function isSameDay(dateTime1, dateTime2) {
return dateTime1.getFullYear() === dateTime2.getFullYear() && dateTime1.getMonth() === dateTime2.getMonth() && dateTime1.getDate() === dateTime2.getDate();
}
})(DateFormatter = utils.DateFormatter || (utils.DateFormatter = {}));
})(utils = common.utils || (common.utils = {}));
})(common = powerbi.common || (powerbi.common = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
var HierarchicalTabOrderNavigation = /** @class */ (function () {
function HierarchicalTabOrderNavigation() {
}
Object.defineProperty(HierarchicalTabOrderNavigation.prototype, "name", {
get: function () {
return "HierarchicalTabOrder" /* HierarchicalTabOrder */;
},
enumerable: false,
configurable: true
});
HierarchicalTabOrderNavigation.prototype.shouldHandleFocus = function (element) {
return !jsCommon.FocusNavigationUtility.isElementContentEditable(element);
};
HierarchicalTabOrderNavigation.prototype.findNextElementToFocus = function (activeElement, event) {
var isRootElement = activeElement.hasAttribute(jsCommon.TabOrderEnabledAttribute);
var isParentCanvasElement = activeElement.getAttribute(jsCommon.FocusNavModeAttribute) === "HierarchicalTabOrder" /* HierarchicalTabOrder */;
var nextElement;
switch (event.keyCode) {
case 39 /* rightArrowKeyCode */:
case 40 /* downArrowKeyCode */:
nextElement = HierarchicalTabOrderNavigation.getFocusNextElement(activeElement, true /* forward */, isRootElement /* traverseDown */);
break;
case 38 /* upArrowKeyCode */:
case 37 /* leftArrowKeyCode */:
nextElement = HierarchicalTabOrderNavigation.getFocusNextElement(activeElement, false /* forward */, isRootElement /* traverseDown */);
break;
case 9 /* tabKeyCode */:
nextElement = HierarchicalTabOrderNavigation.getFocusNextElement(activeElement, !event.shiftKey /* forward */, isRootElement /* traverseDown */);
break;
case 27 /* escKeyCode */:
nextElement = jsCommon.FocusNavigationUtility.getTabbableParent(document.activeElement);
break;
case 13 /* enterKeyCode */:
nextElement = isParentCanvasElement ? HierarchicalTabOrderNavigation.getFocusNextElement(activeElement, true /* forward */, true /* traverseDown */) : undefined;
break;
}
return nextElement;
};
HierarchicalTabOrderNavigation.getFocusNextElement = function (element, forward, traverseDown) {
var isRootElement = element.hasAttribute(jsCommon.TabOrderEnabledAttribute);
var tabOrder = jsCommon.getTabOrder(element);
var nextElement;
if (tabOrder !== undefined || isRootElement) {
var tabOrderfocusFinder = new jsCommon.TabOrderFocusFinder("HierarchicalTabOrder" /* HierarchicalTabOrder */);
nextElement = tabOrderfocusFinder.findNext(element, forward, true /* cycleBack */, traverseDown);
}
if (!nextElement) {
var domOrderFocusFinder = new jsCommon.DomOrderFocusFinder("HierarchicalTabOrder" /* HierarchicalTabOrder */);
nextElement = domOrderFocusFinder.findNext(element, forward, traverseDown);
if (!nextElement && !traverseDown) { // cycle around and search the rest of the siblings
var parentCanvasElement = $(element).parents(jsCommon.FocusNavModeHierarchicalTabOrderMatcher)[0];
nextElement = domOrderFocusFinder.findNext(parentCanvasElement, forward, true /* traverseDown */);
}
}
return nextElement;
};
return HierarchicalTabOrderNavigation;
}());
jsCommon.HierarchicalTabOrderNavigation = HierarchicalTabOrderNavigation;
})(jsCommon || (jsCommon = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var jsCommon;
(function (jsCommon) {
/**
* Uses tab order attribute on element for finding next focusable element.
* The parent of the list of element should have tab-order-eneabled attribute.
* tab-order will not search through the children but stays on 1st level siblings
* <parent-div tab-order-enabled>
* <div tab-order="100">Last Focused</div>
* <div tab-order="300">First Focused</div>
* <div tab-order="200">Second Focused</div>
* </parent-div>
*/
var TabOrderRecursiveFocusFinder = /** @class */ (function () {
function TabOrderRecursiveFocusFinder(groupElement) {
this.groupElement = groupElement;
}
TabOrderRecursiveFocusFinder.prototype.findNext = function (element, forward) {
var _this = this;
if (forward === void 0) { forward = true; }
var currentTabOrder = element === this.groupElement ? -1 : this.getTabIndex(element);
var isTabOrderInitialized = element !== this.groupElement && !isNaN(currentTabOrder);
var nextTabOrder = forward ? Infinity : 0;
if (!isTabOrderInitialized) {
currentTabOrder = forward ? -1 : Infinity;
}
var siblingToReturn;
var tabOrders = this.buildTabOrderMany([].slice.call(this.groupElement.children));
tabOrders.forEach((function (tabOrderElem) {
// we're looking for the next logical item, so get everything between that range.
var siblingOrder = _this.getTabIndex(tabOrderElem.elem);
if (!isNaN(siblingOrder)) {
var siblingCondition = forward ? (siblingOrder > currentTabOrder && siblingOrder <= nextTabOrder) :
(siblingOrder < currentTabOrder && siblingOrder >= nextTabOrder);
if (siblingCondition) {
nextTabOrder = siblingOrder;
siblingToReturn = tabOrderElem.elem;
}
}
}));
return siblingToReturn;
};
TabOrderRecursiveFocusFinder.prototype.getTabIndex = function (element) {
return parseFloat(element.getAttribute(jsCommon.TabIndexAttribute));
};
TabOrderRecursiveFocusFinder.prototype.buildTabOrderMany = function (elements) {
var _this = this;
var elems = [];
elements.forEach((function (element) {
if (element.getAttribute(jsCommon.DOMConstants.skipChildrenFocusAttribute) == null) {
elems = _.concat(elems, _this.buildTabOrders(element));
}
}));
return elems;
};
TabOrderRecursiveFocusFinder.prototype.buildTabOrders = function (element) {
var currTabIndex = this.getTabIndex(element);
if (!isNaN(currTabIndex)) {
return [{ tabOrder: currTabIndex, elem: element }];
}
return this.buildTabOrderMany([].slice.call(element.children));
};
return TabOrderRecursiveFocusFinder;
}());
jsCommon.TabOrderRecursiveFocusFinder = TabOrderRecursiveFocusFinder;
})(jsCommon || (jsCommon = {}));
var jsCommon;
(function (jsCommon) {
var Max_KeyCode_Value = 256;
var Ctrl_F6_Mask = 1141;
var Ctrl_Shift_F6_Mask = 1653;
jsCommon.FocusPriorityAttribute = "focus-priority";
jsCommon.KeyboardShortcutsAttribute = "keyboard-shortcuts";
jsCommon.extendedShortcutScopeAttribute = "extended-shortcut-scope";
/**
* Handles the shortcut related scope for focusManagerInstance.
*/
var ShortcutContainer = /** @class */ (function () {
function ShortcutContainer() {
this.shortcuts = [];
this.scopedShortcuts = [];
}
ShortcutContainer.prototype.add = function (shortcut) {
var mask = this.getKeyCode(shortcut.keycode, shortcut.shift, shortcut.alt, shortcut.ctrl);
var shortcutStorage = shortcut.scoped ? this.scopedShortcuts : this.shortcuts;
if (shortcutStorage[mask]
&& !_.find(shortcutStorage[mask], (function (sc) { return $(sc.element).is(shortcut.element); }))) {
shortcutStorage[mask].push(shortcut);
}
else if (_.isEmpty(this.shortcuts[mask])) {
shortcutStorage[mask] = [shortcut];
}
};
ShortcutContainer.prototype.remove = function (shortcut) {
var mask = this.getKeyCode(shortcut.keycode, shortcut.shift, shortcut.alt, shortcut.ctrl);
var shortcutStorage = shortcut.scoped ? this.scopedShortcuts : this.shortcuts;
_.remove(shortcutStorage[mask], (function (sc) { return $(sc.element).is(shortcut.element); }));
};
ShortcutContainer.prototype.handle = function (event) {
// the key code shouldn't be bigger than 256.
if (event.keyCode > Max_KeyCode_Value)
return false;
var isCtrlOrMeta = jsCommon.BrowserUtils.isCtrlOrMeta(event);
var mask = this.getKeyCode(event.keyCode, event.shiftKey, event.altKey, isCtrlOrMeta);
var reverseDirection = event.shiftKey && isCtrlOrMeta && (mask === Ctrl_Shift_F6_Mask);
var elementToFocus = this.findScopedShortcut(mask);
if (!elementToFocus) {
// If using the ctrl-shift-f6, we can reuse the same shortcuts for ctrl-f6
var shortcuts = this.filterGroups(this.shortcuts[(reverseDirection) ? Ctrl_F6_Mask : mask]);
if (_.isEmpty(shortcuts))
return false;
elementToFocus = this.getNextShortcutElementToFocus(shortcuts, undefined /*focusPriority*/, reverseDirection);
}
if (elementToFocus) {
this.focusOnGroup(elementToFocus);
return true;
}
return false;
};
ShortcutContainer.prototype.handleByPriority = function (keycode, shift, alt, ctrl, focusPriority) {
this.focusOnGroup(this.getNextShortcutElementToFocus(this.filterGroups(this.shortcuts[this.getKeyCode(keycode, shift, alt, ctrl)]), focusPriority));
};
ShortcutContainer.prototype.focusOnGroup = function (elementToFocus) {
if (elementToFocus.getAttribute(jsCommon.FocusNavModeAttribute) === "HierarchicalTabOrder" /* HierarchicalTabOrder */)
jsCommon.FocusManager.focus(jsCommon.HierarchicalTabOrderNavigation.getFocusNextElement(elementToFocus, true /* forward */, true /* traverseDown */));
else
jsCommon.FocusManager.focus(jsCommon.FocusGroupNavigation.getFocusNextElement(true, elementToFocus));
};
/**
* Creates the code for keypress to control keys.
* first 8 (256 keycodes) bits reserved for keycode https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode;
* 9 bit - shift
* 10 bit - ctrl
* 11 bit - alt
*/
ShortcutContainer.prototype.getKeyCode = function (keycode, shift, alt, ctrl) {
var index = keycode;
if (shift)
index |= 512 /* SHIFT */;
if (ctrl)
index |= 1024 /* CTRL */;
if (alt)
index |= 2048 /* ALT */;
return index;
};
ShortcutContainer.prototype.filterGroups = function (shortcuts) {
// Group element must be visible and the group must have a focusbale element.
// Otherwise the tabbing will stop at the previous group and will keep failing to move to the next
return _.filter(shortcuts, (function (shortcut) {
var isElementVisible = jsCommon.FocusNavigationUtility.isElementVisible(shortcut.element);
if (shortcut.element.getAttribute(jsCommon.FocusNavModeAttribute) === "HierarchicalTabOrder" /* HierarchicalTabOrder */)
return isElementVisible && !!jsCommon.HierarchicalTabOrderNavigation.getFocusNextElement(shortcut.element, true /* forward */, true /* traverseDown */);
else
return isElementVisible && !!jsCommon.FocusGroupNavigation.getFocusNextElement(true /* forward */, shortcut.element);
}));
};
ShortcutContainer.getFocusPriority = function (element, searchParents) {
if (searchParents === void 0) { searchParents = true; }
if (element) {
var focusPriority = element.getAttribute(jsCommon.FocusPriorityAttribute);
if (focusPriority != null)
return parseInt(focusPriority, 10);
if (element.parentElement != null && searchParents)
return this.getFocusPriority(element.parentElement);
}
};
ShortcutContainer.prototype.getFocusPriority = function (element, searchParents) {
if (searchParents === void 0) { searchParents = true; }
return ShortcutContainer.getFocusPriority(element, searchParents);
};
/**
* Searches first available scoped shortcut.
* Scoped means that the currently focused element and the parent focus-element
* of the shortcut element are the same elements or the currently focused element
* is the child of the scopedElement.
*/
ShortcutContainer.prototype.findScopedShortcut = function (mask) {
var scope = document.activeElement;
var extendedScope = this.findExtendedScope(scope);
var shortcuts = this.scopedShortcuts[mask];
var shortcutElements = this.filterGroups(shortcuts);
if (!_.isEmpty(shortcutElements) && scope) {
for (var _i = 0, shortcutElements_1 = shortcutElements; _i < shortcutElements_1.length; _i++) {
var shortcutElement = shortcutElements_1[_i];
if (!shortcutElement) {
continue;
}
if (($(scope).is(shortcutElement.element) || $.contains(scope, shortcutElement.element))) {
return shortcutElement.element;
}
if (extendedScope &&
($(extendedScope).is(shortcutElement.element) || $.contains(extendedScope, shortcutElement.element))) {
return shortcutElement.element;
}
}
}
};
ShortcutContainer.prototype.findExtendedScope = function (scope) {
var currScope = scope;
while (currScope) {
var attr = currScope.attributes.getNamedItem(jsCommon.extendedShortcutScopeAttribute);
if (attr) {
return currScope;
}
currScope = currScope.parentElement;
}
return undefined;
};
/**
* Searches within focused element parents with the following shortcut string.
* This is used to simplify the search for currently focused shortcut element.
*/
ShortcutContainer.prototype.findCurrentFocusedShortcutElement = function (shortcutString) {
if (!document.activeElement)
return;
var element = document.activeElement;
while (element) {
var shortcut = element.getAttribute(jsCommon.KeyboardShortcutsAttribute);
if (shortcut === shortcutString)
return element;
element = element.parentElement;
}
};
/**
* The order is defined by the focus-priority.
* And currently focused element.
*/
ShortcutContainer.prototype.getNextShortcutElementToFocus = function (shortcuts, focusPriority, reverseDirection) {
if (reverseDirection === void 0) { reverseDirection = false; }
// Sort by the priority. If the priority is null the order will be
// the same is the elements were added to the DOM.
shortcuts = _.sortBy(shortcuts, (function (sc) { return sc.focusPriority; }));
var shortcutToFocus = shortcuts[0];
// If there are multiple shortcuts we will focus next to one that is currently in focus.
if (document.activeElement && shortcuts.length > 1) {
var currentFocusedElement = focusPriority == null ? this.findCurrentFocusedShortcutElement(shortcutToFocus.shortcutString) : null;
for (var i = 0; i <= shortcuts.length - 1; i++) {
var shortcut = shortcuts[i];
if ((focusPriority != null && focusPriority > (shortcut.focusPriority || -1))
|| (currentFocusedElement && $(currentFocusedElement).is(shortcut.element))) {
var previousIndex = ((i === 0) ? shortcuts.length - 1 : (i - 1));
var nextIndex = i + 1;
shortcutToFocus = shortcuts[(reverseDirection ? previousIndex : nextIndex) % shortcuts.length];
break;
}
}
}
return shortcutToFocus === null || shortcutToFocus === void 0 ? void 0 : shortcutToFocus.element;
};
return ShortcutContainer;
}());
jsCommon.ShortcutContainer = ShortcutContainer;
})(jsCommon || (jsCommon = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
function getTelemetrySamplingRules() {
return window.powerbi.telemetrySamplingRules;
}
powerbi.getTelemetrySamplingRules = getTelemetrySamplingRules;
function setTelemetrySamplingRules(rules) {
window.powerbi.telemetrySamplingRules = rules;
}
powerbi.setTelemetrySamplingRules = setTelemetrySamplingRules;
var TelemetryCategory;
(function (TelemetryCategory) {
TelemetryCategory[TelemetryCategory["Verbose"] = 0] = "Verbose";
TelemetryCategory[TelemetryCategory["CustomerAction"] = 1] = "CustomerAction";
TelemetryCategory[TelemetryCategory["CriticalError"] = 2] = "CriticalError";
TelemetryCategory[TelemetryCategory["Trace"] = 3] = "Trace";
TelemetryCategory[TelemetryCategory["SnapShotEmbedUserAction"] = 4] = "SnapShotEmbedUserAction";
})(TelemetryCategory = powerbi.TelemetryCategory || (powerbi.TelemetryCategory = {}));
var LoggerServiceType;
(function (LoggerServiceType) {
LoggerServiceType[LoggerServiceType["LocalyticsDeprecated"] = 1] = "LocalyticsDeprecated";
LoggerServiceType[LoggerServiceType["AppInsightDeprecated"] = 2] = "AppInsightDeprecated";
LoggerServiceType[LoggerServiceType["AppInsight"] = 4] = "AppInsight";
LoggerServiceType[LoggerServiceType["Etw"] = 8] = "Etw";
LoggerServiceType[LoggerServiceType["Mobile"] = 16] = "Mobile";
LoggerServiceType[LoggerServiceType["WinJs"] = 32] = "WinJs";
LoggerServiceType[LoggerServiceType["Designer"] = 64] = "Designer";
LoggerServiceType[LoggerServiceType["NgRx"] = 128] = "NgRx";
LoggerServiceType[LoggerServiceType["MetaOSStandardizedClientReporting"] = 352] = "MetaOSStandardizedClientReporting";
})(LoggerServiceType = powerbi.LoggerServiceType || (powerbi.LoggerServiceType = {}));
// NOTE: Consider using $q to address the issues with the Angular digest chain being broken. This can be done either in
// this class, or in the TelemetryService above.
var DeferredTelemetryEvent = /** @class */ (function () {
function DeferredTelemetryEvent(event, end) {
var _this = this;
this.end = end;
debug.assertValue(event, 'event');
debug.assertValue(end, 'end');
this.event = event;
this.promise = new powerbi.Promise(function (resolve, reject) {
_this.onResolve = resolve;
_this.onReject = reject;
});
this.isEnded = false;
}
DeferredTelemetryEvent.prototype.resolve = function () {
if (this.isActive()) {
this.isEnded = true;
if (this.end)
this.end(this.event);
this.onResolve(this.event);
}
};
DeferredTelemetryEvent.prototype.cancel = function (ignorable) {
this.event.info.isCancelled = true;
this.event.info.isIgnorable = ignorable;
if (ignorable)
return this.resolve();
else
return this.reject({ isCancelled: true, errorCode: 'non-ignorable cancellation of deferred telemety event' });
};
DeferredTelemetryEvent.prototype.reject = function (errorDetails) {
if (this.isActive()) {
this.isEnded = true;
var event_1 = this.event;
event_1.info.isError = true;
// The default errorSource for failed events should always be PowerBI, as we want to assume that all errors/bugs are ours
// unless we explicitly specify it to be otherwise.
event_1.info.errorSource = errorDetails && errorDetails.errorSource ? errorDetails.errorSource : "PowerBI" /* PowerBI */;
event_1.info.errorCode = errorDetails ? errorDetails.errorCode : "UnknownError";
event_1.info.errorMessage = errorDetails ? errorDetails.errorMessage : undefined;
event_1.info.asErrorCode = errorDetails && errorDetails.asErrorCode;
if (this.end)
this.end(event_1);
this.onReject(event_1);
}
};
DeferredTelemetryEvent.prototype.isActive = function () {
return !this.isEnded;
};
return DeferredTelemetryEvent;
}());
powerbi.DeferredTelemetryEvent = DeferredTelemetryEvent;
})(powerbi || (powerbi = {}));
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
;
// -----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
/// <disable>JS2025.InsertSpaceBeforeCommentText,JS2027.PunctuateCommentsCorrectly,JS2076.IdentifierIsMiscased,JS3085.VariableDeclaredMultipleTimes, JS3116.PreviousDeclarationWasHere, JS2074.IdentifierNameIsMisspelled, JS2030.FollowKeywordsWithSpace, JS2023.UseDoubleQuotesForStringLiterals, JS2028.UseCPlusPlusStyleComments, JS2026.CapitalizeComments, JS2008.DoNotUseCookies, JS2005.UseShortFormInitializations, JS2064.SpecifyNewWhenCallingConstructor, JS2024.DoNotQuoteObjectLiteralPropertyNames, JS2043.RemoveDebugCode, JS3045.MissingInputFile</disable>
/// <dictionary target='comment'>args,aspx,autocompletion,enqueue,Firefox,Hardcoded,interdependant,Kinda,Moderncop,Nav,param,params,powerview, secweb, serializer, sharepoint, silverlight, src, stylesheet, theming, untokenized, Xmla </dictionary>
// ModernCop Rules and Settings - Disabling some non critical warnings that we currently have per:
// http://secweb01/MSEC/Tools/Lists/MSEC%20Tool%20Errors%20and%20Warnings/AllItems.aspx?FilterField1=Tool&FilterValue1=Moderncop
/// <disable>JS2085.EnableStrictMode</disable>
// Justification: The violation is that strict mode is enabled for global scope, which could lead
// to unexpected behavior if the target JS file of this project is concatenated with other JS files.
// The target JS file of this project is not concatenated with other files.
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/* tslint:disable */
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Tool : bondc, Version=3.0.1, Build=bond-git.retail.not
// Template : bondTypeScriptTransform.TT
// File : events.generated.ts
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var telemetry;
(function (telemetry) {
var Utility = jsCommon.Utility;
// @ts-ignore: ignore since it may trigger noUnusedLocals error
var telemetryEventFactory = powerbi.telemetryEventFactory;
// @ts-ignore: ignore since it may trigger noUnusedLocals error
var EventFactories = powerbi.telemetry.EventFactories;
// @ts-ignore
var generateGuid;
if (Utility) {
generateGuid = Utility.generateGuid;
}
else {
// NOTE: This code may run in an environment where Utility is not available (e.g., Desktop ResourceLoader.htm).
// In this case, we fall back to a no-op implementation.
generateGuid = Function.prototype;
}
telemetry.DataQueryDataEventName = 'PBI.Data.QueryData';
/**
* Event fired when the QueryData (execute semantic query) HTTP request is made to the server
*/
telemetry.DataQueryData = EventFactories[telemetry.DataQueryDataEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DataQueryDataEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
optionalParameters: ['requestId', 'synchronous', 'fromCache', 'resultCount', 'timeOrigin'],
loggers: telemetry.DataQueryDataLoggers,
});
return event;
};
telemetry.DataQueryCancellationEventName = 'PBI.Data.QueryCancellation';
/**
* Event fired when a query in progress is cancelled.
*/
telemetry.DataQueryCancellation = EventFactories[telemetry.DataQueryCancellationEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DataQueryCancellationEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.DataQueryCancellationLoggers,
logRatio: 0.0001,
});
return event;
};
telemetry.DataClientCacheHitEventName = 'PBI.Data.ClientCacheHit';
/**
* Event fired when we access the client cache. Sets cacheHit to true if in cache, false otherwise
*/
telemetry.DataClientCacheHit = EventFactories[telemetry.DataClientCacheHitEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DataClientCacheHitEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.DataClientCacheHitLoggers,
logRatio: 0.0001,
});
return event;
};
telemetry.DataGetConceptualSchemaEventName = 'PBI.Data.GetConceptualSchema';
/**
* Event fired when the conceptual schema is retrieved
*/
telemetry.DataGetConceptualSchema = EventFactories[telemetry.DataGetConceptualSchemaEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DataGetConceptualSchemaEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
optionalParameters: ['requestId'],
loggers: telemetry.DataGetConceptualSchemaLoggers,
});
return event;
};
telemetry.DataClearConceptualSchemaCacheEventName = 'PBI.Data.ClearConceptualSchemaCache';
/**
* Event fired when the conceptual schema cache is cleared
*/
telemetry.DataClearConceptualSchemaCache = EventFactories[telemetry.DataClearConceptualSchemaCacheEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DataClearConceptualSchemaCacheEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.DataClearConceptualSchemaCacheLoggers,
});
return event;
};
telemetry.DataExecuteQueryEventName = 'PBI.Data.ExecuteQuery';
/**
* Event fired when a data proxy executes a query against a data provider for a visual
*/
telemetry.DataExecuteQuery = EventFactories[telemetry.DataExecuteQueryEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DataExecuteQueryEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
optionalParameters: ['requestId'],
loggers: telemetry.DataExecuteQueryLoggers,
});
return event;
};
telemetry.DataDsrToDataViewEventName = 'PBI.Data.DsrToDataView';
/**
* Event fired when dsr is parsed into DataView
*/
telemetry.DataDsrToDataView = EventFactories[telemetry.DataDsrToDataViewEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DataDsrToDataViewEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
optionalParameters: ['jsonparse', 'categorical', 'table', 'tree', 'matrix', 'single', 'script'],
loggers: telemetry.DataDsrToDataViewLoggers,
logRatio: 0.0001,
});
return event;
};
telemetry.DataSampledDataViewKindAccessEventName = 'PBI.Data.SampledDataViewKindAccess';
/**
* DataView accessed properties
*/
telemetry.DataSampledDataViewKindAccess = EventFactories[telemetry.DataSampledDataViewKindAccessEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DataSampledDataViewKindAccessEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.DataSampledDataViewKindAccessLoggers,
logRatio: 0.0001,
});
return event;
};
telemetry.DataDataViewKindAccessEventName = 'PBI.Data.DataViewKindAccess';
/**
* DataView accessed properties without LogRatio
*/
telemetry.DataDataViewKindAccess = EventFactories[telemetry.DataDataViewKindAccessEventName] = function (parameters) {
var event = telemetryEventFactory({
name: telemetry.DataDataViewKindAccessEventName,
baseEvent: telemetry.Verbose(parameters),
info: parameters,
category: powerbi.TelemetryCategory.Verbose,
loggers: telemetry.DataDataViewKindAccessLoggers,
});
return event;
};
})(telemetry = powerbi.telemetry || (powerbi.telemetry = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var data;
(function (data) {
/**
* Represents the versions of the semantic query structure.
* NOTE Keep this file in sync with the Sql\InfoNav\src\Data\Contracts\SemanticQuery\QueryVersions.cs
* file in the TFS Dev branch.
*/
var SemanticQueryVersions;
(function (SemanticQueryVersions) {
/** The initial version of semantic query */
SemanticQueryVersions[SemanticQueryVersions["Version0"] = 0] = "Version0";
/** EDM references removed, Property split into Column/Measure, Filter targets are fixed */
SemanticQueryVersions[SemanticQueryVersions["Version1"] = 1] = "Version1";
/** Constants/DatePart replaced with Literal/DateSpan */
SemanticQueryVersions[SemanticQueryVersions["Version2"] = 2] = "Version2";
})(SemanticQueryVersions = data.SemanticQueryVersions || (data.SemanticQueryVersions = {}));
})(data = powerbi.data || (powerbi.data = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var data;
(function (data) {
var services;
(function (services) {
// If a string resource provider is not defined we will assume direction strings should be returned.
var directStringResourceProvider = {
get: function (value) { return value; },
getOptional: function (value) { return value; },
format: function (id) { return id; }
};
var DataViewObjectDescriptorSerializer;
(function (DataViewObjectDescriptorSerializer) {
function serialize(objectDescriptors, resourceProvider) {
debug.assertValue(objectDescriptors, 'objectDescriptors');
var result = {};
for (var key in objectDescriptors) {
result[key] = serializeObjectDescriptor(objectDescriptors[key], resourceProvider || directStringResourceProvider);
}
return result;
}
DataViewObjectDescriptorSerializer.serialize = serialize;
function deserialize(wireObjectDescriptors) {
debug.assertValue(wireObjectDescriptors, 'wireObjectDescriptors');
var result = {};
for (var key in wireObjectDescriptors) {
result[key] = deserializeObjectDescriptor(wireObjectDescriptors[key]);
}
return result;
}
DataViewObjectDescriptorSerializer.deserialize = deserialize;
function serializeObjectDescriptor(objectDescriptor, resourceProvider) {
if (!objectDescriptor) {
return;
}
var result = {
properties: {}
};
if (objectDescriptor.displayName) {
result.displayName = data.getDisplayName(objectDescriptor.displayName, resourceProvider);
}
if (objectDescriptor.description) {
result.description = data.getDisplayName(objectDescriptor.description, resourceProvider);
}
for (var key in objectDescriptor.properties) {
result.properties[key] = serializePropertyDescriptor(objectDescriptor.properties[key], resourceProvider);
}
return result;
}
function deserializeObjectDescriptor(value) {
var result = {
properties: {}
};
if (value.displayName) {
result.displayName = data.createDisplayNameGetter(value.displayName);
}
if (value.description) {
result.description = data.createDisplayNameGetter(value.description);
}
for (var key in value.properties) {
result.properties[key] = deserializePropertyDescriptor(value.properties[key]);
}
return result;
}
function serializePropertyDescriptor(propertyDescriptor, resourceProvider) {
var result = {
type: serializePropertyTypeDescriptor(propertyDescriptor.type, resourceProvider)
};
if (propertyDescriptor.rule) {
result.rule = propertyDescriptor.rule;
}
// TODO: This is not completely accurate. The sandbox iframe does not load the localized resources.
// The sandbox string resource provider will return the resource key which will then be wrapped in a displayName getter during deserialization.
if (propertyDescriptor.displayName) {
result.displayName = data.getDisplayName(propertyDescriptor.displayName, resourceProvider);
}
if (propertyDescriptor.description) {
result.description = data.getDisplayName(propertyDescriptor.description, resourceProvider);
}
if (propertyDescriptor.placeHolderText) {
result.placeHolderText = data.getDisplayName(propertyDescriptor.placeHolderText, resourceProvider);
}
return result;
}
DataViewObjectDescriptorSerializer.serializePropertyDescriptor = serializePropertyDescriptor;
function deserializePropertyDescriptor(value) {
var result = {
type: deserializePropertyTypeDescriptor(value.type)
};
if (value.displayName) {
result.displayName = data.createDisplayNameGetter(value.displayName);
}
if (value.description) {
result.description = data.createDisplayNameGetter(value.description);
}
if (value.placeHolderText) {
result.placeHolderText = data.createDisplayNameGetter(value.placeHolderText);
}
if (value.rule) {
result.rule = value.rule;
}
return result;
}
DataViewObjectDescriptorSerializer.deserializePropertyDescriptor = deserializePropertyDescriptor;
function serializePropertyTypeDescriptor(typeDescriptor, resourceProvider) {
var valueType = powerbi.ValueType.fromDescriptor(typeDescriptor);
var result;
if (valueType && valueType.enum) {
result = {
enumeration: serializeEnumType(valueType.enum, resourceProvider)
};
}
else if (valueType === null || valueType === void 0 ? void 0 : valueType.flagsEnum) {
result = {
flagsEnumeration: serializeEnumType(valueType.flagsEnum, resourceProvider)
};
}
else {
result = typeDescriptor;
}
return result;
}
function deserializePropertyTypeDescriptor(value) {
var result;
if (powerbi.ValueType.fromDescriptor(value)) {
result = deserializeValueTypeDescriptor(value);
}
else {
result = value;
}
return result;
}
function deserializeValueTypeDescriptor(value) {
var result;
if (value.enumeration) {
var enumType = deserializeEnumType(value.enumeration);
result = {
enumeration: enumType
};
}
else if (value.flagsEnumeration) {
result = { flagsEnumeration: deserializeEnumType(value.flagsEnumeration) };
}
else {
result = {};
for (var key in value) {
// @ts-ignore: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'ValueTypeDescriptor'. ;; No index signature with a parameter of type 'string' was found on type 'ValueTypeDescriptor'.
result[key] = value[key];
}
}
return result;
}
function serializeEnumType(enumType, resourceProvider) {
return _.map(enumType.members(), (function (member) {
return serializeEnumMember(member, resourceProvider);
}));
}
function deserializeEnumType(value) {
return powerbi.createEnumType(value);
}
function serializeEnumMember(member, resourceProvider) {
return {
displayName: data.getDisplayName(member.displayName, resourceProvider),
value: member.value
};
}
})(DataViewObjectDescriptorSerializer = services.DataViewObjectDescriptorSerializer || (services.DataViewObjectDescriptorSerializer = {}));
})(services = data.services || (data.services = {}));
})(data = powerbi.data || (powerbi.data = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var data;
(function (data) {
var DateExtensions = jsCommon.DateExtensions;
var PrimitiveValueEncoding;
(function (PrimitiveValueEncoding) {
var DoubleQuoteRegex = /''/g;
var binaryPrefix = "base64\'";
var DateTimeZeroMillisecondsRegex = /\.000'$/;
/** Parses a typed value in a Data Shape Result. */
// TODO: Rename to parseTypeEncoded
function parseValue(dsrValue) {
return parseTypeEncodedValue(dsrValue);
}
PrimitiveValueEncoding.parseValue = parseValue;
// TODO: Rename to parseTypeEncodedToSQExpr
function parseValueToSQExpr(dsrValue) {
return parseTypeEncodedValue(dsrValue, true);
}
PrimitiveValueEncoding.parseValueToSQExpr = parseValueToSQExpr;
function parseBinary(value) {
if (!value)
return null;
if (_.startsWith(value, binaryPrefix)) {
var binaryValue = value.substring(binaryPrefix.length, value.length - 1);
return binaryValue;
}
return null;
}
PrimitiveValueEncoding.parseBinary = parseBinary;
/**
* Encoding for DsrV2 values are optimized for various types
*
* String - Dictionary Encoding may apply
* Variant - Variant Encoding (Default), Dictionary Encoding may apply
* Numeric (Integer, Double, Decimal) - Native Encoding (Default), String (when conversion is lossy from .NET to JS and for special values NaN, Pos/Neg Infitinty)
* DateTime - Milliseconds since UNIX Epoch (Default), ISO86021 String (for dates before January 1, 1970 12:00 AM or contains sub-milliseconds)
* NOTE: AS as of 2017 doesn't hold timezone information thus the DateTime values recieved in DSR don't have timezone encoded
* Boolean - Numeric Encoding (Default) (0 - false, 1 - true, null)
*/
function parseOptimizedValue(dsrValue, type) {
debug.assert(dsrValue !== undefined, 'Undefined dsrValue indicates a DSR parsing bug');
if (dsrValue === null)
return null;
switch (type) {
case 4 /* Integer */:
debug.assert(typeof (dsrValue) === 'string' || typeof (dsrValue) === 'number', "Expected only string or number values for type " + type);
if (typeof (dsrValue) === 'number')
return dsrValue;
else
return parseInt(dsrValue, /*radix*/ 10);
case 2 /* Decimal */:
case 3 /* Double */:
debug.assert(typeof (dsrValue) === 'string' || typeof (dsrValue) === 'number', "Expected only string or number values for type " + type);
if (typeof (dsrValue) === 'number')
return dsrValue;
else
return parseFloatExtended(dsrValue);
case 7 /* DateTime */:
case 6 /* Date */:
debug.assert(typeof (dsrValue) === 'string' || typeof (dsrValue) === 'number', "Expected only string or number values for type " + type);
if (typeof (dsrValue) === 'number') {
debug.assert(dsrValue >= 0, "Expected positive miliseconds since UNIX epoch for type " + type);
// With DsrV2, client can receive milliseconds since unix epoch which is UTC based. When such a date is read,
// the date time value gets converted to local time zone based in javascript after its read. Since timezones
// aren't supported yet, the product should display dates in UTC so add the timezone offset.
var date = new Date(dsrValue);
var date_utc = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
// getTimezoneOffset returns the difference in minutes between UTC and local time zone. getTime is in milliseconds.
// Hence the 60000 factor (60 sec/min * 1000 ms/sec).
// Note: the date.getTimezoneOffset() * 60000 can be computed and cached when loading the script. Gave an ~18% perf improvement for 5M data points.
// For the offset, we use the UTC date offset. This is to avoid conversion issues when we have date time coinciding with daylight time saving changes
// Eg: Consider you are in Canberra (AUS) which is UTC + 10 hrs. Dsr value is unix epoch for date is 30 Sept 1972 16:00 hrs. The date object created
// for this by JS would be localized to UTC + 10 which is 1 Oct 1972 02:00 AM but this is the time when daylight saving starts there so the actual JS
// date is 1 Oct 1972 03:00 AM. If you do a getTimezoneOffset on this, it will give you 11 hours as the offset (-660 min). If you use this to adjust
// unix epoch, the result is epoch value equivalent to 30 Sept 1972 05:00. Now you create the JS date on this which would result in UTC + 10 which is
// 30 Sept 1972 15:00 hrs and as this has not crossed the daylight time change boundary, it would not account for the additional one hour difference
// and we end up with wrong time.
var result = new Date(date.getTime() + date_utc.getTimezoneOffset() * 60000);
// The above conversion fails for datetime which lie in the 1 hour bucket when clocks switch ahead in any timezone which has daylight savings. Eg:The
// server date is 11th Mar 2018 02:00:00 am. In PST, this is when DST started and clocks moved ahead. hence this time does not exist. Thus the above
// adjustment fails as JS changes date to 3:00 am. The right way to avoid this issue is to use UTC times as we do not support timezones yet. If we remove
// this above adjustment to use UTC, custom visuals will fail with wrong dates thus we need to keep this. Hence for core visuals, we save the epochtimestamp
// as well and in formattingservice, we regenerate the correct date and override getters to return UTC times.
result.epochTimeStamp = dsrValue;
return result;
}
else {
// Date object created using new Date(iso8601 date string without timezone) has different behavior on different browsers
// especially for date.toIsoString() so use parseIsoDate to build Date object
var parsedIsoDate = DateExtensions.parseIsoDate(dsrValue);
return parsedIsoDate && powerbi.dateWithEpochValueFromLocalDate(parsedIsoDate);
}
case 1 /* Text */:
debug.assert(typeof (dsrValue) === 'string', "Expected only string values for type " + type);
return dsrValue;
case 5 /* Boolean */:
debug.assert(typeof (dsrValue) === 'number' || typeof (dsrValue) === 'boolean', "Expected number or boolean values for type " + type);
if (typeof (dsrValue) === 'number')
return dsrValue === 1 ? true : false;
else
return dsrValue;
case 13 /* Variant */:
debug.assert(typeof (dsrValue) === 'string' || typeof (dsrValue) === 'boolean', "Expected only string or boolean values for type " + type);
return parseTypeEncodedValue(dsrValue);
default:
debug.assertFail("unsupported dsrValue for type " + type);
}
}
PrimitiveValueEncoding.parseOptimizedValue = parseOptimizedValue;
function parseOptimizedValueToSQExpr(value, dsrValue, type) {
if (value === null)
return data.SQExprBuilder.nullConstant();
switch (type) {
case 4 /* Integer */:
if (typeof (dsrValue) === 'number')
return data.SQExprBuilder.integer(+value);
else
return data.SQExprBuilder.fromRawValue(260 /* Integer */, +value, dsrValue.toString());
case 2 /* Decimal */:
if (typeof (dsrValue) === 'number')
return data.SQExprBuilder.decimal(+value);
else
return data.SQExprBuilder.fromRawValue(258 /* Decimal */, +value, dsrValue.toString());
case 3 /* Double */:
if (typeof (dsrValue) === 'number')
return data.SQExprBuilder.double(+value);
else
return data.SQExprBuilder.fromRawValue(259 /* Double */, +value, dsrValue.toString());
case 7 /* DateTime */:
case 6 /* Date */:
if (typeof (dsrValue) === 'number')
return new data.SQConstantExpr(powerbi.ValueType.fromExtendedType(519 /* DateTime */), value);
else
return data.SQExprBuilder.fromRawValue(519 /* DateTime */, value, dsrValue.toString());
case 1 /* Text */:
return data.SQExprBuilder.text(value.toString());
case 5 /* Boolean */:
return data.SQExprBuilder.boolean(!!value);
case 13 /* Variant */:
return parseTypeEncodedValue(dsrValue, /*toSQExpr*/ true);
default:
debug.assertFail("unsupported dsrValue for type " + type);
}
}
PrimitiveValueEncoding.parseOptimizedValueToSQExpr = parseOptimizedValueToSQExpr;
function parseTypeEncodedValue(dsrValue, toSQExpr) {
var dsrValueType = typeof (dsrValue);
if (dsrValueType === "string") {
// Integer
if (_.endsWith(dsrValue, 'L')) {
var intValue = parseInt(dsrValue, /*radix*/ 10);
return toSQExpr ? data.SQExprBuilder.integer(intValue, dsrValue) : intValue;
}
// Double precision
if (_.endsWith(dsrValue, 'D')) {
var doubleValue = parseFloatExtended(dsrValue);
return toSQExpr ? data.SQExprBuilder.double(doubleValue, dsrValue) : doubleValue;
}
// Decimal precision
if (_.endsWith(dsrValue, 'M')) {
var decimalValue = parseFloatExtended(dsrValue);
return toSQExpr ? data.SQExprBuilder.decimal(decimalValue, dsrValue) : decimalValue;
}
if (_.endsWith(dsrValue, "'")) {
// String
if (dsrValue.charAt(0) === "'") {
var stringValue = dsrValue.substring(1, dsrValue.length - 1).replace(DoubleQuoteRegex, "'");
return toSQExpr ? data.SQExprBuilder.text(stringValue, dsrValue) : stringValue;
}
// DateTime
if (dsrValue.indexOf("datetime'") === 0) {
// VSTS:11447521 - Issue with Power KPI Matrix Custom Visual where the cells don't highlight due to difference in milliseconds precision with date values.
// For DsrV2, the dates are returned in unix epoch and always have milliseconds. When returned as strings, they are
// optimized and do not contain milliseconds if 0. Hence for equality, we strip out the milliseconds if they are 0.
// Some pbix's have been saved with the old date serialization logic for Dsr V2 where dates used without milliseconds precision
// were serialized with the milliseconds precision ie HH::MM::SS.000.
// Also without this change, there would be an incompatibility with DsrV1 date values which don't have the miliseconds precision when there are no milliseconds in the date value.
var dsrValueOptimized = dsrValue.replace(DateTimeZeroMillisecondsRegex, "'");
var isoDate = dsrValue.substring(9, dsrValueOptimized.length - 1);
var dateValue = DateExtensions.parseIsoDate(isoDate);
return toSQExpr ? data.SQExprBuilder.dateTime(dateValue, dsrValueOptimized) : dateValue;
}
}
// Null
if (dsrValue === 'null')
return toSQExpr ? data.SQExprBuilder.nullConstant() : null;
// Boolean
if (dsrValue === 'true')
return toSQExpr ? data.SQExprBuilder.boolean(true) : true;
if (dsrValue === 'false')
return toSQExpr ? data.SQExprBuilder.boolean(false) : false;
}
//The server is sending boolean dsr value as true and false instead of 'true' and 'false'.
if (dsrValueType === "boolean")
return toSQExpr ? data.SQExprBuilder.boolean(dsrValue) : dsrValue;
//The server is sending null dsr value as null instead of 'null'.
if (dsrValue === null)
return toSQExpr ? data.SQExprBuilder.nullConstant() : null;
return dsrValue;
}
PrimitiveValueEncoding.parseTypeEncodedValue = parseTypeEncodedValue;
/** An extended implementation of Typescript's parseFloat which supports representations of Infinity such as 'INF'
* used in DSR's.
*/
function parseFloatExtended(value) {
// The mainline case is when we have a finite number, so try to parse the raw string first and then fall back
// to checking for Infinity if we get NaN as a result.
var rawResult = parseFloat(value);
if (isNaN(rawResult)) {
// Try to differentiate between Infinity and NaN. Running it through the parser again is slower than trying to
// detect Infinity ourselves, but since this isn't the mainline case it should be ok to take the safer option
// of the parser to catch the different cases of Infinity (e.g. positive/negative Infinity, suffixes).
return parseFloat(value.replace('INF', 'Infinity'));
}
return rawResult;
}
})(PrimitiveValueEncoding = data.PrimitiveValueEncoding || (data.PrimitiveValueEncoding = {}));
})(data = powerbi.data || (powerbi.data = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var data;
(function (data) {
/** Aids in building a SemanticQuery from a QueryDefinition. */
var SemanticQueryBuilder = /** @class */ (function () {
function SemanticQueryBuilder(from) {
debug.assertValue(from, 'from');
this.clauses = {
from: from,
select: [],
};
}
SemanticQueryBuilder.prototype.addWhere = function (filter) {
debug.assertValue(filter, 'filter');
var clauses = this.clauses;
if (!clauses.where)
clauses.where = [];
clauses.where.push(filter);
};
SemanticQueryBuilder.prototype.addWheres = function (filters) {
debug.assertValue(filters, 'filters');
var clauses = this.clauses;
if (!clauses.where)
clauses.where = [];
for (var _i = 0, filters_1 = filters; _i < filters_1.length; _i++) {
var filter = filters_1[_i];
clauses.where.push(filter);
}
};
SemanticQueryBuilder.prototype.addOrderBy = function (sort) {
debug.assertValue(sort, 'sort');
var clauses = this.clauses;
if (!clauses.orderBy)
clauses.orderBy = [];
clauses.orderBy.push(sort);
};
SemanticQueryBuilder.prototype.addSelect = function (select) {
debug.assertValue(select, 'select');
this.clauses.select.push(select);
};
SemanticQueryBuilder.prototype.addGroupBy = function (groupBy) {
debug.assertValue(groupBy, 'groupBy');
var clauses = this.clauses;
if (!clauses.groupBy)
clauses.groupBy = [];
clauses.groupBy.push(groupBy);
};
SemanticQueryBuilder.prototype.addTransform = function (transformItem) {
debug.assertValue(transformItem, 'transformItem');
var clauses = this.clauses;
if (!clauses.transforms)
clauses.transforms = [];
clauses.transforms.push(transformItem);
};
SemanticQueryBuilder.prototype.setTop = function (top) {
this.clauses.top = top;
};
SemanticQueryBuilder.prototype.toQuery = function () {
return data.SemanticQuery.createWith(this.clauses, /*suppressNormalization*/ true);
};
SemanticQueryBuilder.prototype.toFilter = function () {
var clauses = this.clauses;
debug.assert(!clauses.orderBy && clauses.select.length === 0, 'toFilter must not have orderBy/select specified.');
if (clauses.from && clauses.where)
return new data.SemanticFilter(clauses.from, clauses.where);
};
return SemanticQueryBuilder;
}());
data.SemanticQueryBuilder = SemanticQueryBuilder;
})(data = powerbi.data || (powerbi.data = {}));
})(powerbi || (powerbi = {}));
//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
var powerbi;
(function (powerbi) {
var data;
(function (data) {
var services;
(function (services) {
var FilterKindDetector = powerbi.data.FilterKindDetector;
var SQFromEntitySource = powerbi.data.SQFromEntitySource;
var SQFromPodSource = powerbi.data.SQFromPodSource;
var SQFromSubquerySource = powerbi.data.SQFromSubquerySource;
var StringExtensions = jsCommon.StringExtensions;
var SemanticQuerySerializer = /** @class */ (function () {
function SemanticQuerySerializer() {
}
/** Returns the QueryDefinition that this SemanticQuery represents, including optional additional filter. */
SemanticQuerySerializer.serializeQuery = function (query, standalone, serializeAnnotations) {
if (standalone === void 0) { standalone = false; }
if (serializeAnnotations === void 0) { serializeAnnotations = false; }
debug.assertValue(query, 'query');
// From
var queryFrom = [], from = query.from();
this.serializeFrom(from, queryFrom);
// Where
var queryWhere = this.serializeQueryFilters(query.where(), QueryExpressionBuilder.create, false);
// Transforms
var transforms, transformItems = query.transforms();
if (!_.isEmpty(transformItems)) {
transforms = [];
for (var _i = 0, transformItems_1 = transformItems; _i < transformItems_1.length; _i++) {
var transformItem = transformItems_1[_i];
var parameters = _.map(transformItem.input.parameters, (function (p) { return QueryExpressionBuilder.createNamed(p, standalone); }));
var transform = {
Name: transformItem.name,
Algorithm: transformItem.algorithm,
Input: {
Parameters: parameters,
},
Output: undefined
};
if (transformItem.input.table) {
var inputColumns = this.serializeTransformTableColumns(transformItem.input.table.columns);
transform.Input.Table = {
Name: transformItem.input.table.name,
Columns: inputColumns
};
}
if (transformItem.output && transformItem.output.table) {
var outputColumns = this.serializeTransformTableColumns(transformItem.output.table.columns);
transform.Output = {
Table: {
Name: transformItem.output.table.name,
Columns: outputColumns
}
};
}
transforms.push(transform);
}
}
// OrderBy
var queryOrderBy = this.serializeSortDefinitions(query.orderBy(), standalone);
// Select
var querySelect = [], selectItems = query.select();
for (var i = 0, len = selectItems.length; i < len; i++)
querySelect.push(QueryExpressionBuilder.createNamed(selectItems[i], standalone, serializeAnnotations));
// GroupBy
var queryGroupBy, groupByItems = query.groupBy();
if (groupByItems && groupByItems.length) {
queryGroupBy = [];
for (var i = 0, len = groupByItems.length; i < len; i++)
queryGroupBy.push(QueryExpressionBuilder.createNamed(groupByItems[i], standalone));
}
var contract = {
Version: data.SemanticQueryVersions.Version2,
From: queryFrom,
Select: querySelect,
};
if (queryWhere)
contract.Where = queryWhere;
if (transforms)
contract.Transform = transforms;
if (queryOrderBy)
contract.OrderBy = queryOrderBy;
if (queryGroupBy)
contract.GroupBy = queryGroupBy;
if (query.top())
contract.Top = query.top();
return contract;
};
SemanticQuerySerializer.serializeSortDefinitions = function (orderByItems, standalone) {
var queryOrderBy;
if (orderByItems && orderByItems.length) {
queryOrderBy = [];
for (var i = 0, len = orderByItems.length; i < len; i++) {
var clause = orderByItems[i];
queryOrderBy.push({
Direction: clause.direction,
Expression: QueryExpressionBuilder.create(clause.expr, standalone),
});
}
}
return queryOrderBy;
};
/**
* This method will try to deserialize a semantic query, and if it succeedes and the query is well formed it will return it.
* If it fails it returns undefined.
*/
SemanticQuerySerializer.tryDeserializeQuery = function (contract) {
var semanticQuery;
try {
semanticQuery = this.deserializeQuery(contract);
}
catch (e) {
// Intentionally do nothing because we need to verify the query isn't malformed anyways
}
if (semanticQuery && !this.isMalformed(semanticQuery)) {
return semanticQuery;
}
};
/*
* A malformed semantic query means an old version (2+ years ago) of the semantic query which basically is 'impossible' for us to decipher
* We could actually make sense of it by sending a query to the Data Shape Engine, but this is expensive because we need the schema,
* Any malformed semantic query will be deprived of most of the functionalities other tiles have (inFocusMode, insights, etc.)
*/
SemanticQuerySerializer.isMalformed = function (query) {
for (var _i = 0, _a = query.select(); _i < _a.length; _i++) {
var select = _a[_i];
if (!select.expr)
return true;
}
return false;
};
SemanticQuerySerializer.serializeQueryFilters = function (filters, queryExpressionBuilderInstance, standalone) {
var queryFilters;
if (!_.isEmpty(filters)) {
queryFilters = [];
for (var _i = 0, filters_2 = filters; _i < filters_2.length; _i++) {
var filter = filters_2[_i];
var queryClause = {
Condition: queryExpressionBuilderInstance(filter.condition, standalone),
};
if (!_.isEmpty(filter.target)) {
queryClause.Target = [];
for (var _a = 0, _b = filter.target; _a < _b.length; _a++) {
var target = _b[_a];
queryClause.Target.push(queryExpressionBuilderInstance(target, standalone));
}
}
if (filter.annotations)
queryClause.Annotations = filter.annotations;
queryFilters.push(queryClause);
}
}
return queryFilters;
};
SemanticQuerySerializer.deserializeQuery = function (contract) {
debug.assertValue(contract, 'contract');
var queryVersion = contract.Version ? contract.Version : data.SemanticQueryVersions.Version0;
var upgradeToV1 = queryVersion < data.SemanticQueryVersions.Version1;
// From
var from = Deserializer.from(contract.From);
var builder = new data.SemanticQueryBuilder(from);
// Where
var where = contract.Where;
if (where) {
for (var i = 0, len = where.length; i < len; i++) {
var whereItem = Deserializer.filter(where[i], from);
if (whereItem) {
// DEVNOTE this is temporary code to upgrade the filter to the latest
// version of semantic query; once the upgrade is done on the
// server side this code should turn into an assert.
if (upgradeToV1) {
whereItem = FilterTargetUpgrader.Upgrade(queryVersion, whereItem);
}
builder.addWhere(whereItem);
}
}
}
// Transforms
var transform = contract.Transform;
var fromWithTransforms = from;
if (!_.isEmpty(transform)) {
var allEntities = {};
var keys = from.keys();
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var key = keys_1[_i];
allEntities[key] = from.source(key);
}
for (var i = 0, len = transform.length; i < len; i++) {
if (transform[i].Input && transform[i].Input.Table) {
var tableName = transform[i].Input.Table.Name;
allEntities[tableName] = new SQFromEntitySource(undefined /*schema*/, tableName);
}
if (transform[i].Output && transform[i].Output.Table) {
var tableName = transform[i].Output.Table.Name;
allEntities[tableName] = new SQFromEntitySource(undefined /*schema*/, tableName);
}
}
fromWithTransforms = new data.SQFrom(allEntities);
for (var i = 0, len = transform.length; i < len; i++) {
builder.addTransform(Deserializer.transform(transform[i], fromWithTransforms));
}
}
// OrderBy
var orderBy = contract.OrderBy;
if (orderBy) {
for (var i = 0, len = orderBy.length; i < len; i++)
builder.addOrderBy(Deserializer.sort(orderBy[i], from));
}
// Select
var select = contract.Select, selectNames = {};
for (var i = 0, len = select.length; i < len; i++) {
builder.addSelect(Deserializer.select(select[i], selectNames, fromWithTransforms));
}
// GroupBy
var groupBy = contract.GroupBy;
if (groupBy) {
var groupByNames = {};
for (var i = 0, len = groupBy.length; i < len; i++)
builder.addGroupBy(Deserializer.groupBy(groupBy[i], groupByNames, from));
}
// Top
if (contract.Top)
builder.setTop(contract.Top);
return builder.toQuery();
};
SemanticQuerySerializer.deserializeSortDefinitions = function (orderBy, from) {
if (_.isEmpty(orderBy))
return [];
return _.map(orderBy, (function (sort) { return Deserializer.sort(sort, from); }));
};
SemanticQuerySerializer.serializeFilter = function (filter) {
// From
var queryFrom = [], from = filter.from();
this.serializeFrom(from, queryFrom);
// Where
var queryWhere = this.serializeQueryFilters(filter.where(), QueryExpressionBuilder.create, false);
var contract = {
Version: data.SemanticQueryVersions.Version2,
From: queryFrom,
Where: queryWhere,
};
return contract;
};
SemanticQuerySerializer.serializeFrom = function (from, queryFrom) {
var fromKeys = from.keys();
var sqFromSerializer = new SQFromSourceSerializer(from);
for (var i = 0, len = fromKeys.length; i < len; i++)
queryFrom.push(from.source(fromKeys[i]).accept(sqFromSerializer, i));
};
SemanticQuerySerializer.deserializeFrom = function (input) {
return Deserializer.from(input);
};
SemanticQuerySerializer.deserializeFilter = function (contract, errorContext) {
debug.assertValue(contract, 'contract');
var filterVersion = contract.Version ? contract.Version : data.SemanticQueryVersions.Version0;
var upgradeToV1 = filterVersion < data.SemanticQueryVersions.Version1;
// From
var from = Deserializer.from(contract.From);
var builder = new data.SemanticQueryBuilder(from);
// Where
var where = contract.Where;
if (where) {
for (var i = 0, len = where.length; i < len; i++) {
var whereItem = Deserializer.filter(where[i], from);
if (whereItem) {
// DEVNOTE this is temporary code to upgrade the filter to the latest
// version of semantic query; once the upgrade is done on the
// server side this code should turn into an assert.
if (upgradeToV1) {
whereItem = FilterTargetUpgrader.Upgrade(filterVersion, whereItem);
}
builder.addWhere(whereItem);
}
else if (errorContext) {
if (_.isEmpty(errorContext.RemovedIndexes))
errorContext.RemovedIndexes = [];
errorContext.RemovedIndexes.push(i);
}
}
}
return builder.toFilter();
};
SemanticQuerySerializer.serializeExpr = function (contract, serializeAnnotations) {
if (serializeAnnotations === void 0) { serializeAnnotations = false; }
debug.assertValue(contract, 'contract');
debug.assertValue(serializeAnnotations, 'serializeAnnotations');
return QueryExpressionBuilder.create(contract, /*standalone*/ true, serializeAnnotations);
};
SemanticQuerySerializer.serializeExprWithRef = function (contract, serializeAnnotations) {
if (serializeAnnotations === void 0) { serializeAnnotations = false; }
debug.assertValue(contract, 'contract');
debug.assertValue(serializeAnnotations, 'serializeAnnotations');
return QueryExpressionBuilder.create(contract, /*standalone*/ false, serializeAnnotations);
};
SemanticQuerySerializer.deserializeExpr = function (input) {
debug.assertValue(input, 'input');
return ExprBuilder.createStandalone(input);
};
SemanticQuerySerializer.deserializeExprWithRef = function (input, from) {
debug.assertValue(input, 'input');
return ExprBuilder.create(input, from);
};
SemanticQuerySerializer.serializeTransformTableColumns = function (columns) {
debug.assertValue(columns, 'columns');
return _.map(columns, (function (c) {
var column = {
Expression: QueryExpressionBuilder.createNamed(c.expression)
};
if (c.role)
column.Role = c.role;
return column;
}));
};
return SemanticQuerySerializer;
}());
services.SemanticQuerySerializer = SemanticQuerySerializer;
var Deserializer = /** @class */ (function () {
function Deserializer() {
}
Deserializer.from = function (contract) {
debug.assertValue(contract, 'contract');
var sources = {};
if (contract) {
for (var i = 0, len = contract.length; i < len; i++) {
var source = contract[i];
switch (source.Type) {
case 2 /* Expression */:
if (source.Expression.Subquery) {
sources[source.Name] = new SQFromSubquerySource(SemanticQuerySerializer.deserializeQuery(source.Expression.Subquery.Query));
}
else {
sources[source.Name] = new data.SQFromExprSource(ExprBuilder.createFromSourceExpression(source.Expression));
}
break;
case 1 /* Pod */:
sources[source.Name] = new SQFromPodSource(source.Schema, source.Entity);
break;
default:
sources[source.Name] = new SQFromEntitySource(source.Schema, source.Entity);
}
}
}
return new data.SQFrom(sources);
};
Deserializer.filter = function (contract, from) {
debug.assertValue(contract, 'contract');
var condition = from ? ExprBuilder.create(contract.Condition, from) : ExprBuilder.createStandalone(contract.Condition);
if (!condition)
return;
var sqFilter = {
condition: condition,
};
if (contract.Target) {
sqFilter.target = [];
for (var _i = 0, _a = contract.Target; _i < _a.length; _i++) {
var target = _a[_i];
var targetExpr = from ? ExprBuilder.create(target, from) : ExprBuilder.createStandalone(target);
if (!targetExpr)
return;
sqFilter.target.push(targetExpr);
}
}
if (contract.Annotations)
sqFilter.annotations = contract.Annotations;
return sqFilter;
};
Deserializer.sort = function (contract, from) {
debug.assertValue(contract, 'contract');
return {
direction: contract.Direction,
expr: ExprBuilder.create(contract.Expression, from),
};
};
Deserializer.select = function (contract, selectNames, from) {
return Deserializer.toNamedQueryExpression(contract, selectNames, from);
};
Deserializer.groupBy = function (contract, groupByNames, from) {
return Deserializer.toNamedQueryExpression(contract, groupByNames, from);
};
Deserializer.transform = function (contract, from) {
var parameters = _.map(contract.Input.Parameters, (function (p) { return Deserializer.toNamedQueryExpression(p, {}, from); }));
var transform = {
name: contract.Name,
algorithm: contract.Algorithm,
input: {
parameters: parameters,
},
output: {},
};
if (contract.Input.Table) {
var inputColumns = this.deserializeTransformTableColumns(contract.Input.Table.Columns, from);
transform.input.table = {
name: contract.Input.Table.Name,
columns: inputColumns,
};
}
if (contract.Output && contract.Output.Table) {
var outputColumns = this.deserializeTransformTableColumns(contract.Output.Table.Columns, from);
transform.output.table = {
name: contract.Output.Table.Name,
columns: outputColumns,
};
}
return transform;
};
Deserializer.toNamedQueryExpression = function (contract, names, from) {
debug.assertValue(contract, 'contract');
debug.assertValue(from, 'from');
var expr = ExprBuilder.create(contract, from);
var name = contract.Name || StringExtensions.findUniqueName(names, data.SQExprUtils.defaultName(expr));
names[name] = true;
var namedExpr = {
name: name,
expr: expr
};
if (contract.NativeReferenceName)
namedExpr.nativeReferenceName = contract.NativeReferenceName;
return namedExpr;
};
Deserializer.deserializeTransformTableColumns = function (columns, from) {
debug.assertValue(columns, 'columns');
var columnNames = {};
return _.map(columns, (function (c) {
return {
role: c.Role,
expression: Deserializer.toNamedQueryExpression(c.Expression, columnNames, from),
};
}));
};
return Deserializer;
}());
var SQFromSourceSerializer = /** @class */ (function () {
function SQFromSourceSerializer(from) {
this.from = from;
}
SQFromSourceSerializer.prototype.visitEntity = function (source, index) {
var entitySource = {
Name: this.from.keys()[index],
Entity: source.entity,
Schema: source.schema,
// a QueryDefinition From EntitySource may not have 'Type' property set, then it means it has the default
// value EntitySourceType.Type, when we serialize a SQFromSource we always set the 'Type' property value
Type: 0 /* Table */,
};
return entitySource;
};
SQFromSourceSerializer.prototype.visitPod = function (source, index) {
var entitySource = {
Name: this.from.keys()[index],
Entity: source.pod,
Schema: source.schema,
Type: 1 /* Pod */,
};
return entitySource;
};
SQFromSourceSerializer.prototype.visitSubquery = function (source, index) {
return {
Name: this.from.keys()[index],
Expression: {
Subquery: {
Query: SemanticQuerySerializer.serializeQuery(source.subquery),
}
},
Type: 2 /* Expression */,
};
};
SQFromSourceSerializer.prototype.visitExpr = function (source, index) {
return {
Name: this.from.keys()[index],
Expression: SemanticQuerySerializer.serializeExpr(source.expr),
Type: 2 /* Expression */,
};
};
return SQFromSourceSerializer;
}());
var QueryExpressionBuilder = /** @class */ (function () {
function QueryExpressionBuilder(standalone, serializeAnnotations) {
this.standalone = standalone;
this.serializeAnnotations = serializeAnnotations;
}
QueryExpressionBuilder.getInstance = function (standalond, serializeAnnotations) {
if (!standalond) {
standalond = false;
}
if (!serializeAnnotations) {
serializeAnnotations = false;
}
var index = [+standalond, +serializeAnnotations].reduce((function (result, x) { return result << 1 | x; }));
var instance = QueryExpressionBuilder.instances[index];
if (!instance)
instance = new QueryExpressionBuilder(standalond, serializeAnnotations);
return instance;
};
/** Standalone === true will serializes standalone expressions, which include entity names directly rather than variable references. */
/** Standalone == false will serialize expressions with references */
QueryExpressionBuilder.create = function (expr, standalone, serializeAnnotations) {
if (standalone === void 0) { standalone = false; }
if (serializeAnnotations === void 0) { serializeAnnotations = false; }
return expr.accept(QueryExpressionBuilder.getInstance(standalone, serializeAnnotations));
};
QueryExpressionBuilder.createNamed = function (namedExpr, standalone, serializeAnnotations) {
if (standalone === void 0) { standalone = false; }
if (serializeAnnotations === void 0) { serializeAnnotations = false; }
var instance = QueryExpressionBuilder.getInstance(standalone, serializeAnnotations);
var container = namedExpr.expr.accept(instance);
if (namedExpr.name)
container.Name = namedExpr.name;
if (namedExpr.nativeReferenceName)
container.NativeReferenceName = namedExpr.nativeReferenceName;
return container;
};
QueryExpressionBuilder.prototype.visitColumnRef = function (expr) {
return this.addAnnotations(expr, {
Column: {
Expression: expr.source.accept(this),
Property: expr.ref,
}
});
};
QueryExpressionBuilder.prototype.visitMeasureRef = function (expr) {
return this.addAnnotations(expr, {
Measure: {
Expression: expr.source.accept(this),
Property: expr.ref,
}
});
};
QueryExpressionBuilder.prototype.visitNativeMeasure = function (expr) {
var nativeMeasure = {
Language: expr.language,
Expression: expr.expression,
DataType: expr.dataType,
};
if (expr.proposedName)
nativeMeasure.ProposedName = expr.proposedName;
if (expr.format)
nativeMeasure.Format = expr.format;
var contentCache = expr.expressionContentCache;
if (!contentCache || (!contentCache.dependencies && contentCache.unrecognizedIdentifiers == null))
return { NativeMeasure: nativeMeasure };
nativeMeasure.ExpressionContentCache = {};
if (contentCache.dependencies)
nativeMeasure.ExpressionContentCache.Dependencies = this.serializeAll(contentCache.dependencies);
if (contentCache.unrecognizedIdentifiers != null)
nativeMeasure.ExpressionContentCache.UnrecognizedIdentifiers = contentCache.unrecognizedIdentifiers;
return this.addAnnotations(expr, {
NativeMeasure: nativeMeasure
});
};
QueryExpressionBuilder.prototype.visitNativeColumn = function (expr) {
var nativeColumn = {
Language: expr.language,
Expression: expr.expression,
DataType: expr.dataType,
Source: expr.source.accept(this),
};
if (expr.proposedName)
nativeColumn.ProposedName = expr.proposedName;
if (expr.format)
nativeColumn.Format = expr.format;
var contentCache = expr.expressionContentCache;
if (!contentCache || (!contentCache.dependencies && contentCache.unrecognizedIdentifiers == null)) {
return this.addAnnotations(expr, {
NativeColumn: nativeColumn
});
}
nativeColumn.ExpressionContentCache = {};
if (contentCache.dependencies)
nativeColumn.ExpressionContentCache.Dependencies = this.serializeAll(contentCache.dependencies);
if (contentCache.unrecognizedIdentifiers != null)
nativeColumn.ExpressionContentCache.UnrecognizedIdentifiers = contentCache.unrecognizedIdentifiers;
return this.addAnnotations(expr, {
NativeColumn: nativeColumn
});
};
QueryExpressionBuilder.prototype.visitAggr = function (expr) {
return this.addAnnotations(expr, {
Aggregation: {
Expression: expr.arg.accept(this),
Function: expr.func,
},
});
};
QueryExpressionBuilder.prototype.visitPercentile = function (expr) {
var result = this.addAnnotations(expr, {
Percentile: {
Expression: expr.arg.accept(this),
K: expr.k,
}
});
// NOTE: the Exclusive property is optional in the server-side DataContract.
if (expr.exclusive) {
result.Percentile.Exclusive = expr.exclusive;
}
return result;
};
QueryExpressionBuilder.prototype.visitRangePercent = function (expr) {
return this.addAnnotations(expr, {
RangePercent: {
Min: expr.min.accept(this),
Max: expr.max.accept(this),
Percent: expr.percent,
}
});
};
QueryExpressionBuilder.prototype.visitHierarchy = function (expr) {
return this.addAnnotations(expr, {
Hierarchy: {
Expression: expr.arg.accept(this),
Hierarchy: expr.hierarchy,
}
});
};
QueryExpressionBuilder.prototype.visitPropertyVariationSource = function (expr) {
var source = expr.arg.accept(this);
var property = expr.property;
var name = expr.name;
return this.addAnnotations(expr, {
PropertyVariationSource: {
Expression: {
SourceRef: source.SourceRef
},
Name: name,
Property: property,
}
});
};
QueryExpressionBuilder.prototype.visitHierarchyLevel = function (expr) {
return this.addAnnotations(expr, {
HierarchyLevel: {
Expression: expr.arg.accept(this),
Level: expr.level,
}
});
};
QueryExpressionBuilder.prototype.visitSelectRef = function (expr) {
// When 'attributeKind' is serialized and this assert is removed, the visual container version must be bumped.
debug.assert(expr.attributeKind === undefined || expr.attributeKind == null, 'Serialization of expr.attributeKind is not supported.');
return this.addAnnotations(expr, {
SelectRef: {
ExpressionName: expr.expressionName,
}
});
};
QueryExpressionBuilder.prototype.visitBetween = function (expr) {
return this.addAnnotations(expr, {
Between: {
Expression: expr.arg.accept(this),
LowerBound: expr.lower.accept(this),
UpperBound: expr.upper.accept(this),
}
});
};
QueryExpressionBuilder.prototype.visitIn = function (expr) {
var expressions = this.serializeAll(expr.args);
var values = expr.values;
if (values) {
var valuesSerialized = [];
for (var i = 0, len = values.length; i < len; i++)
valuesSerialized.push(this.serializeAll(values[i]));
return this.addAnnotations(expr, {
In: {
Expressions: expressions,
Values: valuesSerialized,
}
});
}
else {
return this.addAnnotations(expr, {
In: {
Expressions: this.serializeAll(expr.args),
Table: expr.table.accept(this),
}
});
}
};
QueryExpressionBuilder.prototype.visitEntity = function (expr) {
debug.assertValue(expr, 'expr');
var sourceRef;
if (this.standalone) {
var standaloneExpr = {
Schema: expr.schema,
Entity: expr.entity,
};
sourceRef = standaloneExpr;
}
else {
debug.assertValue(expr.variable, 'expr.variable');
sourceRef = { Source: expr.variable };
}
return this.addAnnotations(expr, {
SourceRef: sourceRef
});
};
QueryExpressionBuilder.prototype.visitSubqueryRef = function (expr) {
debug.assertValue(expr, 'expr');
if (expr.variable && !expr.query) {
return this.addAnnotations(expr, {
SourceRef: { Source: expr.variable },
});
}
else {
if (this.standalone) {
return this.addAnnotations(expr, {
// The inlined subquery should be serialized in normal mode as there should always be a reference to the from statement
Subquery: { Query: SemanticQuerySerializer.serializeQuery(expr.query, false, this.serializeAnnotations) },
});
}
else {
debug.assertFail('The inlined subquery is only expected to be there in standalone mode.');
}
}
};
QueryExpressionBuilder.prototype.visitNamedQueryRef = function (expr) {
if (this.standalone) {
return this.addAnnotations(expr, {
NamedQueryReference: {
Name: expr.queryName,
}
});
}
else {
debug.assertValue(expr.variable, 'expr.variable');
return this.addAnnotations(expr, {
SourceRef: { Source: expr.variable }
});
}
};
QueryExpressionBuilder.prototype.visitAnd = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
And: {
Left: expr.left.accept(this),
Right: expr.right.accept(this),
},
});
};
QueryExpressionBuilder.prototype.visitOr = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
Or: {
Left: expr.left.accept(this),
Right: expr.right.accept(this),
}
});
};
QueryExpressionBuilder.prototype.visitCompare = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
Comparison: {
ComparisonKind: expr.comparison,
Left: expr.left.accept(this),
Right: expr.right.accept(this),
}
});
};
QueryExpressionBuilder.prototype.visitConditional = function (expr) {
var _this = this;
debug.assertValue(expr, 'expr');
var output = this.addAnnotations(expr, {
Conditional: {
Cases: _.map(expr.cases, (function (c) { return _this.visitCase(c); })),
},
});
var defaultValue = expr.defaultValue;
if (defaultValue)
output.Conditional.DefaultValue = defaultValue.accept(this);
return output;
};
QueryExpressionBuilder.prototype.visitCase = function (conditionalCase) {
return {
Condition: conditionalCase.condition.accept(this),
Value: conditionalCase.value.accept(this),
};
};
QueryExpressionBuilder.prototype.visitContains = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
Contains: {
Left: expr.left.accept(this),
Right: expr.right.accept(this),
}
});
};
QueryExpressionBuilder.prototype.visitDateAdd = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
DateAdd: {
Expression: expr.arg.accept(this),
Amount: expr.amount,
TimeUnit: expr.unit,
}
});
};
QueryExpressionBuilder.prototype.visitDateSpan = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
DateSpan: {
Expression: expr.arg.accept(this),
TimeUnit: expr.unit
}
});
};
QueryExpressionBuilder.prototype.visitExists = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
Exists: {
Expression: expr.arg.accept(this),
}
});
};
QueryExpressionBuilder.prototype.visitNot = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
Not: {
Expression: expr.arg.accept(this),
}
});
};
QueryExpressionBuilder.prototype.visitNow = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
Now: {}
});
};
QueryExpressionBuilder.prototype.visitDefaultValue = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
DefaultValue: {}
});
};
QueryExpressionBuilder.prototype.visitAnyValue = function (expr) {
debug.assertValue(expr, 'expr');
var anyValue = {};
if (expr.defaultValueOverridesAncestors != null)
anyValue.DefaultValueOverridesAncestors = expr.defaultValueOverridesAncestors;
return this.addAnnotations(expr, {
AnyValue: anyValue
});
};
QueryExpressionBuilder.prototype.visitFillRule = function (expr) {
debug.assertValue(expr, 'expr');
var serializedRule = {};
var rule = expr.rule;
if (rule.linearGradient2)
serializedRule.linearGradient2 = this.visitLinearGradient2(rule.linearGradient2);
if (rule.linearGradient3)
serializedRule.linearGradient3 = this.visitLinearGradient3(rule.linearGradient3);
return this.addAnnotations(expr, {
FillRule: {
Input: expr.input.accept(this),
FillRule: serializedRule,
}
});
};
QueryExpressionBuilder.prototype.visitLinearGradient2 = function (gradient) {
debug.assertValue(gradient, 'visitLinearGradient2 - gradient');
var output = {
min: this.visitRuleStop(gradient.min),
max: this.visitRuleStop(gradient.max),
};
var strategy = this.visitNullColoringStrategy(gradient.nullColoringStrategy);
if (strategy)
output.nullColoringStrategy = strategy;
return output;
};
QueryExpressionBuilder.prototype.visitLinearGradient3 = function (gradient) {
debug.assertValue(gradient, 'visitLinearGradient3 - gradient');
var output = {
min: this.visitRuleStop(gradient.min),
mid: this.visitRuleStop(gradient.mid),
max: this.visitRuleStop(gradient.max),
};
var strategy = this.visitNullColoringStrategy(gradient.nullColoringStrategy);
if (strategy)
output.nullColoringStrategy = strategy;
return output;
};
QueryExpressionBuilder.prototype.visitRuleStop = function (stop) {
debug.assertValue(stop, 'stop');
var serialized = {
color: stop.color.accept(this),
};
var value = stop.value;
if (value) {
serialized.value = stop.value.accept(this);
}
return serialized;
};
QueryExpressionBuilder.prototype.visitNullColoringStrategy = function (input) {
if (!input)
return;
debug.assertValue(input.strategy, 'visitNullColoringStrategy - input.strategy');
var output = {
strategy: input.strategy.accept(this),
};
if (input.color)
output.color = input.color.accept(this);
return output;
};
QueryExpressionBuilder.prototype.visitThemeDataColor = function (expr) {
return this.addAnnotations(expr, {
ThemeDataColor: {
ColorId: expr.colorId,
Percent: expr.percent,
}
});
};
QueryExpressionBuilder.prototype.visitStartsWith = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
StartsWith: {
Left: expr.left.accept(this),
Right: expr.right.accept(this),
}
});
};
QueryExpressionBuilder.prototype.visitGroupRef = function (expr) {
var _this = this;
debug.assertValue(expr, 'expr');
// TODO : Add Version Upgrade for adding this expr
return this.addAnnotations(expr, {
GroupRef: {
Expression: expr.source.accept(this),
Property: expr.ref,
GroupedColumns: _.map(expr.groupedExprs, (function (groupedExpr) { return groupedExpr.accept(_this); }))
}
});
};
QueryExpressionBuilder.prototype.visitConstant = function (expr) {
debug.assertValue(expr, 'expr');
switch (expr.type.primitiveType) {
case 5 /* Boolean */:
case 7 /* DateTime */:
case 2 /* Decimal */:
case 4 /* Integer */:
case 3 /* Double */:
case 0 /* Null */:
case 1 /* Text */:
return this.addAnnotations(expr, {
Literal: { Value: expr.valueEncoded }
});
default:
debug.assertFail('Unrecognized kind: ' + expr.type.primitiveType);
}
};
QueryExpressionBuilder.prototype.visitArithmetic = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
Arithmetic: {
Left: expr.left.accept(this),
Right: expr.right.accept(this),
Operator: expr.operator
}
});
};
QueryExpressionBuilder.prototype.visitFloor = function (expr) {
debug.assertValue(expr, 'expr');
var result = this.addAnnotations(expr, {
Floor: {
Expression: expr.arg.accept(this),
Size: expr.size,
}
});
if (expr.timeUnit != null) {
result.Floor.TimeUnit = expr.timeUnit;
}
return result;
};
QueryExpressionBuilder.prototype.visitResourcePackageItem = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
ResourcePackageItem: {
PackageName: expr.packageName,
PackageType: expr.packageType,
ItemName: expr.itemName
}
});
};
QueryExpressionBuilder.prototype.visitScopedEval = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
ScopedEval: {
Expression: expr.expression.accept(this),
Scope: this.serializeAll(expr.scope)
}
});
};
QueryExpressionBuilder.prototype.visitFilteredEval = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
FilteredEval: {
Expression: expr.expression.accept(this),
Filters: SemanticQuerySerializer.serializeQueryFilters(expr.filters, QueryExpressionBuilder.create, this.standalone)
}
});
};
QueryExpressionBuilder.prototype.visitWithRef = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
WithRef: {
ExpressionName: expr.expressionName
}
});
};
QueryExpressionBuilder.prototype.visitTransformTableRef = function (expr) {
return this.addAnnotations(expr, {
TransformTableRef: {
Source: expr.source,
}
});
};
QueryExpressionBuilder.prototype.visitTransformOutputRoleRef = function (expr) {
return this.addAnnotations(expr, {
TransformOutputRoleRef: {
Role: expr.role,
Transform: expr.transform,
}
});
};
QueryExpressionBuilder.prototype.visitRoleRef = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
RoleRef: {
Role: expr.role,
}
});
};
QueryExpressionBuilder.prototype.visitSummaryValueRef = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
SummaryValueRef: {
Name: expr.name,
}
});
};
QueryExpressionBuilder.prototype.visitAllRolesRef = function (expr) {
debug.assertValue(expr, 'expr');
return this.addAnnotations(expr, {
AllRolesRef: {},
});
};
QueryExpressionBuilder.prototype.visitDiscretize = function (expr) {
return this.addAnnotations(expr, {
Discretize: {
Expression: expr.source.accept(this),
Count: expr.count,
}
});
};
QueryExpressionBuilder.prototype.visitMember = function (expr) {
return this.addAnnotations(expr, {
Member: {
Expression: expr.source.accept(this),
Member: expr.member,
}
});
};
QueryExpressionBuilder.prototype.visitSparklineData = function (expr) {
var serialized = {
SparklineData: {
Measure: expr.measure.accept(this),
Groupings: this.serializeAll(expr.grouping),
PointsPerSparkline: expr.pointsPerSparkline,
}
};
if (expr.scalarKey)
serialized.SparklineData.ScalarKey = expr.scalarKey.accept(this);
if (expr.includeMinGroupingInterval)
serialized.SparklineData.IncludeMinGroupingInterval = expr.includeMinGroupingInterval;
return serialized;
};
QueryExpressionBuilder.prototype.serializeAll = function (exprs) {
var result = [];
for (var i = 0, len = exprs.length; i < len; i++)
result.push(exprs[i].accept(this));
return result;
};
QueryExpressionBuilder.prototype.visitNativeVisualCalc = function (expr, arg) {
var nativeVisualCalc = {
Language: expr.language,
Expression: expr.expression,
Name: expr.name
};
return this.addAnnotations(expr, {
NativeVisualCalculation: nativeVisualCalc
});
};
QueryExpressionBuilder.prototype.addAnnotations = function (expr, container) {
if (this.serializeAnnotations) {
var annotations = expr.getAnnotations();
if (annotations) {
container.Annotations = annotations;
}
}
return container;
};
QueryExpressionBuilder.instances = [];
return QueryExpressionBuilder;
}());
var FilterTargetUpgrader = /** @class */ (function () {
function FilterTargetUpgrader() {
}
FilterTargetUpgrader.Upgrade = function (fromVersion, filter) {
if (!filter)
return null;
if (!filter.condition)
return null;
// DEVNOTE if we are deserializing a version 0 filter and the filter is
// not an exists filter, drop the target.
var filterKind = FilterKindDetector.runDetector(filter.condition);
if (fromVersion === data.SemanticQueryVersions.Version0 && filterKind !== 2 /* Exists */) {
return {
condition: filter.condition
};
}
return filter;
};
return FilterTargetUpgrader;
}());
var ExprBuilder;
(function (ExprBuilder) {
function create(contract, from) {
debug.assertValue(contract, 'contract');
return fromColumnRef(contract, from)
|| fromMeasureRef(contract, from)
|| fromNativeMeasure(contract, from)
|| fromNativeColumn(contract, from)
|| fromSourceRef(contract, from)
|| fromAggr(contract, from)
|| fromSelectRef(contract, from)
|| fromPercentile(contract, from)
|| fromRangePercent(contract, from)
|| fromArithmetic(contract, from)
|| fromFloor(contract, from)
|| fromDiscretize(contract, from)
|| fromMember(contract, from)
|| fromHierarchy(contract, from)
|| fromHierarchyLevel(contract, from)
|| fromPropertyVariationSource(contract, from)
|| fromAnd(contract, from)
|| fromBetween(contract, from)
|| fromIn(contract, from)
|| fromOr(contract, from)
|| fromContains(contract, from)
|| fromCompare(contract, from)
|| fromConditional(contract, from)
|| fromDateAdd(contract, from)
|| fromDateSpan(contract, from)
|| fromExists(contract, from)
|| fromNot(contract, from)
|| fromNow(contract)
|| fromDefaultValue(contract)
|| fromAnyValue(contract)
|| fromStartsWith(contract, from)
|| fromFillRule(contract, from)
|| fromThemeDataColor(contract)
|| fromResourcePackageItem(contract, from)
|| fromScopedEval(contract, from)
|| fromFilteredEval(contract, from)
|| fromWithRef(contract, from)
|| fromTransformTableRef(contract, from)
|| fromTransformOutputRoleRef(contract, from)
|| fromLiteral(contract)
|| fromGroupRef(contract, from)
|| fromRoleRef(contract)
|| fromAllRolesRef(contract)
|| fromNamedQueryRef(contract)
|| fromSubqueryRef(contract)
|| createConst(contract)
|| fromSummaryValueRef(contract)
|| fromSparklineData(contract, from)
|| fromNativeVisualCalc(contract);
}
ExprBuilder.create = create;
function createStandalone(contract) {
return create(contract, null);
}
ExprBuilder.createStandalone = createStandalone;
function createArray(contracts, from) {
var result = [];
for (var i = 0, len = contracts.length; i < len; i++)
result.push(create(contracts[i], from));
return result;
}
function createConst(contract) {
return fromBool(contract)
|| fromDateTime(contract)
|| fromDateTimeSecond(contract)
|| fromDateTime(contract)
|| fromDecimal(contract)
|| fromInteger(contract)
|| fromNull(contract)
|| fromNumber(contract)
|| fromString(contract);
}
ExprBuilder.createConst = createConst;
function createFromSourceExpression(contract) {
var expr = createStandalone(contract);
return expr;
}
ExprBuilder.createFromSourceExpression = createFromSourceExpression;
function fromSourceRef(contract, from) {
if (!contract.SourceRef)
return;
if (from) {
// Normal mode: deserialize as a QuerySourceRefExpression (with a variable reference to the from).
var sourceRef = contract.SourceRef;
var sourceName = sourceRef.Source;
var source = from.source(sourceName);
if (source) {
if (data.isSQFromEntitySource(source))
return data.SQExprBuilder.entity(source.schema, source.entity, sourceName, contract.Annotations);
if (data.isSQFromPodSource(source))
return data.SQExprBuilder.entity(source.schema, source.pod, sourceName);
if (data.isSQFromSubquerySource(source))
return data.SQExprBuilder.subqueryRef(sourceName, contract.Annotations);
debug.assert(data.isSQFromExprSource(source), 'Expected an ExpressionSource');
return source.expr.as(sourceName);
}
}
else {
// Standalone mode: deserialize as a StandaloneEntityRefExpression (with schema & entity names).
var entityRef = contract.SourceRef;
return data.SQExprBuilder.entity(entityRef.Schema, entityRef.Entity, /* variable */ undefined, contract.Annotations);
}
}
function fromArithmetic(contract, from) {
if (contract.Arithmetic) {
var left = create(contract.Arithmetic.Left, from);
var right = create(contract.Arithmetic.Right, from);
if (left && right)
return data.SQExprBuilder.arithmetic(left, right, contract.Arithmetic.Operator, contract.Annotations);
}
}
function fromFloor(contract, from) {
if (contract.Floor) {
var expression = create(contract.Floor.Expression, from);
if (expression)
return data.SQExprBuilder.floor(expression, contract.Floor.Size, contract.Floor.TimeUnit, contract.Annotations);
}
}
function fromDiscretize(contract, from) {
if (contract.Discretize) {
var expression = create(contract.Discretize.Expression, from);
if (expression)
return data.SQExprBuilder.discretize(expression, contract.Discretize.Count, contract.Annotations);
}
}
function fromMember(contract, from) {
if (contract.Member) {
var expression = create(contract.Member.Expression, from);
if (expression)
return data.SQExprBuilder.member(expression, contract.Member.Member, contract.Annotations);
}
}
function fromColumnRef(contract, from) {
if (contract.Column) {
var source = create(contract.Column.Expression, from);
if (source)
return data.SQExprBuilder.columnRef(source, contract.Column.Property, contract.Annotations);
}
}
function fromPropertyVariationSource(contract, from) {
if (contract.PropertyVariationSource) {
var source = create(contract.PropertyVariationSource.Expression, from);
if (source)
return data.SQExprBuilder.propertyVariationSource(source, contract.PropertyVariationSource.Name, contract.PropertyVariationSource.Property, contract.Annotations);
}
}
function fromHierarchy(contract, from) {
if (contract.Hierarchy) {
var source = create(contract.Hierarchy.Expression, from);
if (source)
return data.SQExprBuilder.hierarchy(source, contract.Hierarchy.Hierarchy, contract.Annotations);
}
}
function fromHierarchyLevel(contract, from) {
if (contract.HierarchyLevel) {
var source = create(contract.HierarchyLevel.Expression, from);
if (source)
return data.SQExprBuilder.hierarchyLevel(source, contract.HierarchyLevel.Level, contract.Annotations);
}
}
function fromMeasureRef(contract, from) {
if (contract.Measure) {
var source = create(contract.Measure.Expression, from);
if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment