theme-material-debug.js 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219
  1. var $jscomp = $jscomp || {};
  2. $jscomp.scope = {};
  3. $jscomp.ASSUME_ES5 = false;
  4. $jscomp.ASSUME_NO_NATIVE_MAP = false;
  5. $jscomp.ASSUME_NO_NATIVE_SET = false;
  6. $jscomp.defineProperty = $jscomp.ASSUME_ES5 || typeof Object.defineProperties == 'function' ? Object.defineProperty : function(target, property, descriptor) {
  7. descriptor = descriptor;
  8. if (target == Array.prototype || target == Object.prototype) {
  9. return;
  10. }
  11. target[property] = descriptor.value;
  12. };
  13. $jscomp.getGlobal = function(maybeGlobal) {
  14. return typeof window != 'undefined' && window === maybeGlobal ? maybeGlobal : typeof global != 'undefined' && global != null ? global : maybeGlobal;
  15. };
  16. $jscomp.global = $jscomp.getGlobal(this);
  17. $jscomp.polyfill = function(target, polyfill, fromLang, toLang) {
  18. if (!polyfill) {
  19. return;
  20. }
  21. var obj = $jscomp.global;
  22. var split = target.split('.');
  23. for (var i = 0; i < split.length - 1; i++) {
  24. var key = split[i];
  25. if (!(key in obj)) {
  26. obj[key] = {};
  27. }
  28. obj = obj[key];
  29. }
  30. var property = split[split.length - 1];
  31. var orig = obj[property];
  32. var impl = polyfill(orig);
  33. if (impl == orig || impl == null) {
  34. return;
  35. }
  36. $jscomp.defineProperty(obj, property, {configurable:true, writable:true, value:impl});
  37. };
  38. $jscomp.polyfill('Array.prototype.copyWithin', function(orig) {
  39. if (orig) {
  40. return orig;
  41. }
  42. var polyfill = function(target, start, opt_end) {
  43. var len = this.length;
  44. target = Number(target);
  45. start = Number(start);
  46. opt_end = Number(opt_end != null ? opt_end : len);
  47. if (target < start) {
  48. opt_end = Math.min(opt_end, len);
  49. while (start < opt_end) {
  50. if (start in this) {
  51. this[target++] = this[start++];
  52. } else {
  53. delete this[target++];
  54. start++;
  55. }
  56. }
  57. } else {
  58. opt_end = Math.min(opt_end, len + start - target);
  59. target += opt_end - start;
  60. while (opt_end > start) {
  61. if (--opt_end in this) {
  62. this[--target] = this[opt_end];
  63. } else {
  64. delete this[target];
  65. }
  66. }
  67. }
  68. return this;
  69. };
  70. return polyfill;
  71. }, 'es6', 'es3');
  72. $jscomp.SYMBOL_PREFIX = 'jscomp_symbol_';
  73. $jscomp.initSymbol = function() {
  74. $jscomp.initSymbol = function() {
  75. };
  76. if (!$jscomp.global['Symbol']) {
  77. $jscomp.global['Symbol'] = $jscomp.Symbol;
  78. }
  79. };
  80. $jscomp.Symbol = function() {
  81. var counter = 0;
  82. function Symbol(opt_description) {
  83. return $jscomp.SYMBOL_PREFIX + (opt_description || '') + counter++;
  84. }
  85. return Symbol;
  86. }();
  87. $jscomp.initSymbolIterator = function() {
  88. $jscomp.initSymbol();
  89. var symbolIterator = $jscomp.global['Symbol'].iterator;
  90. if (!symbolIterator) {
  91. symbolIterator = $jscomp.global['Symbol'].iterator = $jscomp.global['Symbol']('iterator');
  92. }
  93. if (typeof Array.prototype[symbolIterator] != 'function') {
  94. $jscomp.defineProperty(Array.prototype, symbolIterator, {configurable:true, writable:true, value:function() {
  95. return $jscomp.arrayIterator(this);
  96. }});
  97. }
  98. $jscomp.initSymbolIterator = function() {
  99. };
  100. };
  101. $jscomp.arrayIterator = function(array) {
  102. var index = 0;
  103. return $jscomp.iteratorPrototype(function() {
  104. if (index < array.length) {
  105. return {done:false, value:array[index++]};
  106. } else {
  107. return {done:true};
  108. }
  109. });
  110. };
  111. $jscomp.iteratorPrototype = function(next) {
  112. $jscomp.initSymbolIterator();
  113. var iterator = {next:next};
  114. iterator[$jscomp.global['Symbol'].iterator] = function() {
  115. return this;
  116. };
  117. return iterator;
  118. };
  119. $jscomp.iteratorFromArray = function(array, transform) {
  120. $jscomp.initSymbolIterator();
  121. if (array instanceof String) {
  122. array = array + '';
  123. }
  124. var i = 0;
  125. var iter = {next:function() {
  126. if (i < array.length) {
  127. var index = i++;
  128. return {value:transform(index, array[index]), done:false};
  129. }
  130. iter.next = function() {
  131. return {done:true, value:void 0};
  132. };
  133. return iter.next();
  134. }};
  135. iter[Symbol.iterator] = function() {
  136. return iter;
  137. };
  138. return iter;
  139. };
  140. $jscomp.polyfill('Array.prototype.entries', function(orig) {
  141. if (orig) {
  142. return orig;
  143. }
  144. var polyfill = function() {
  145. return $jscomp.iteratorFromArray(this, function(i, v) {
  146. return [i, v];
  147. });
  148. };
  149. return polyfill;
  150. }, 'es6', 'es3');
  151. $jscomp.polyfill('Array.prototype.fill', function(orig) {
  152. if (orig) {
  153. return orig;
  154. }
  155. var polyfill = function(value, opt_start, opt_end) {
  156. var length = this.length || 0;
  157. if (opt_start < 0) {
  158. opt_start = Math.max(0, length + opt_start);
  159. }
  160. if (opt_end == null || opt_end > length) {
  161. opt_end = length;
  162. }
  163. opt_end = Number(opt_end);
  164. if (opt_end < 0) {
  165. opt_end = Math.max(0, length + opt_end);
  166. }
  167. for (var i = Number(opt_start || 0); i < opt_end; i++) {
  168. this[i] = value;
  169. }
  170. return this;
  171. };
  172. return polyfill;
  173. }, 'es6', 'es3');
  174. $jscomp.findInternal = function(array, callback, thisArg) {
  175. if (array instanceof String) {
  176. array = String(array);
  177. }
  178. var len = array.length;
  179. for (var i = 0; i < len; i++) {
  180. var value = array[i];
  181. if (callback.call(thisArg, value, i, array)) {
  182. return {i:i, v:value};
  183. }
  184. }
  185. return {i:-1, v:void 0};
  186. };
  187. $jscomp.polyfill('Array.prototype.find', function(orig) {
  188. if (orig) {
  189. return orig;
  190. }
  191. var polyfill = function(callback, opt_thisArg) {
  192. return $jscomp.findInternal(this, callback, opt_thisArg).v;
  193. };
  194. return polyfill;
  195. }, 'es6', 'es3');
  196. $jscomp.polyfill('Array.prototype.findIndex', function(orig) {
  197. if (orig) {
  198. return orig;
  199. }
  200. var polyfill = function(callback, opt_thisArg) {
  201. return $jscomp.findInternal(this, callback, opt_thisArg).i;
  202. };
  203. return polyfill;
  204. }, 'es6', 'es3');
  205. $jscomp.polyfill('Array.from', function(orig) {
  206. if (orig) {
  207. return orig;
  208. }
  209. var polyfill = function(arrayLike, opt_mapFn, opt_thisArg) {
  210. $jscomp.initSymbolIterator();
  211. opt_mapFn = opt_mapFn != null ? opt_mapFn : function(x) {
  212. return x;
  213. };
  214. var result = [];
  215. var iteratorFunction = arrayLike[Symbol.iterator];
  216. if (typeof iteratorFunction == 'function') {
  217. arrayLike = iteratorFunction.call(arrayLike);
  218. var next;
  219. var k = 0;
  220. while (!(next = arrayLike.next()).done) {
  221. result.push(opt_mapFn.call(opt_thisArg, next.value, k++));
  222. }
  223. } else {
  224. var len = arrayLike.length;
  225. for (var i = 0; i < len; i++) {
  226. result.push(opt_mapFn.call(opt_thisArg, arrayLike[i], i));
  227. }
  228. }
  229. return result;
  230. };
  231. return polyfill;
  232. }, 'es6', 'es3');
  233. $jscomp.polyfill('Object.is', function(orig) {
  234. if (orig) {
  235. return orig;
  236. }
  237. var polyfill = function(left, right) {
  238. if (left === right) {
  239. return left !== 0 || 1 / left === 1 / right;
  240. } else {
  241. return left !== left && right !== right;
  242. }
  243. };
  244. return polyfill;
  245. }, 'es6', 'es3');
  246. $jscomp.polyfill('Array.prototype.includes', function(orig) {
  247. if (orig) {
  248. return orig;
  249. }
  250. var includes = function(searchElement, opt_fromIndex) {
  251. var array = this;
  252. if (array instanceof String) {
  253. array = String(array);
  254. }
  255. var len = array.length;
  256. var i = opt_fromIndex || 0;
  257. if (i < 0) {
  258. i = Math.max(i + len, 0);
  259. }
  260. for (; i < len; i++) {
  261. var element = array[i];
  262. if (element === searchElement || Object.is(element, searchElement)) {
  263. return true;
  264. }
  265. }
  266. return false;
  267. };
  268. return includes;
  269. }, 'es7', 'es3');
  270. $jscomp.polyfill('Array.prototype.keys', function(orig) {
  271. if (orig) {
  272. return orig;
  273. }
  274. var polyfill = function() {
  275. return $jscomp.iteratorFromArray(this, function(i) {
  276. return i;
  277. });
  278. };
  279. return polyfill;
  280. }, 'es6', 'es3');
  281. $jscomp.polyfill('Array.of', function(orig) {
  282. if (orig) {
  283. return orig;
  284. }
  285. var polyfill = function(var_args) {
  286. return Array.from(arguments);
  287. };
  288. return polyfill;
  289. }, 'es6', 'es3');
  290. $jscomp.polyfill('Array.prototype.values', function(orig) {
  291. if (orig) {
  292. return orig;
  293. }
  294. var polyfill = function() {
  295. return $jscomp.iteratorFromArray(this, function(k, v) {
  296. return v;
  297. });
  298. };
  299. return polyfill;
  300. }, 'es8', 'es3');
  301. $jscomp.makeIterator = function(iterable) {
  302. $jscomp.initSymbolIterator();
  303. var iteratorFunction = iterable[Symbol.iterator];
  304. return iteratorFunction ? iteratorFunction.call(iterable) : $jscomp.arrayIterator(iterable);
  305. };
  306. $jscomp.FORCE_POLYFILL_PROMISE = false;
  307. $jscomp.polyfill('Promise', function(NativePromise) {
  308. if (NativePromise && !$jscomp.FORCE_POLYFILL_PROMISE) {
  309. return NativePromise;
  310. }
  311. function AsyncExecutor() {
  312. this.batch_ = null;
  313. }
  314. AsyncExecutor.prototype.asyncExecute = function(f) {
  315. if (this.batch_ == null) {
  316. this.batch_ = [];
  317. this.asyncExecuteBatch_();
  318. }
  319. this.batch_.push(f);
  320. return this;
  321. };
  322. AsyncExecutor.prototype.asyncExecuteBatch_ = function() {
  323. var self = this;
  324. this.asyncExecuteFunction(function() {
  325. self.executeBatch_();
  326. });
  327. };
  328. var nativeSetTimeout = $jscomp.global['setTimeout'];
  329. AsyncExecutor.prototype.asyncExecuteFunction = function(f) {
  330. nativeSetTimeout(f, 0);
  331. };
  332. AsyncExecutor.prototype.executeBatch_ = function() {
  333. while (this.batch_ && this.batch_.length) {
  334. var executingBatch = this.batch_;
  335. this.batch_ = [];
  336. for (var i = 0; i < executingBatch.length; ++i) {
  337. var f = executingBatch[i];
  338. executingBatch[i] = null;
  339. try {
  340. f();
  341. } catch (error) {
  342. this.asyncThrow_(error);
  343. }
  344. }
  345. }
  346. this.batch_ = null;
  347. };
  348. AsyncExecutor.prototype.asyncThrow_ = function(exception) {
  349. this.asyncExecuteFunction(function() {
  350. throw exception;
  351. });
  352. };
  353. var PromiseState = {PENDING:0, FULFILLED:1, REJECTED:2};
  354. var PolyfillPromise = function(executor) {
  355. this.state_ = PromiseState.PENDING;
  356. this.result_ = undefined;
  357. this.onSettledCallbacks_ = [];
  358. var resolveAndReject = this.createResolveAndReject_();
  359. try {
  360. executor(resolveAndReject.resolve, resolveAndReject.reject);
  361. } catch (e) {
  362. resolveAndReject.reject(e);
  363. }
  364. };
  365. PolyfillPromise.prototype.createResolveAndReject_ = function() {
  366. var thisPromise = this;
  367. var alreadyCalled = false;
  368. function firstCallWins(method) {
  369. return function(x) {
  370. if (!alreadyCalled) {
  371. alreadyCalled = true;
  372. method.call(thisPromise, x);
  373. }
  374. };
  375. }
  376. return {resolve:firstCallWins(this.resolveTo_), reject:firstCallWins(this.reject_)};
  377. };
  378. PolyfillPromise.prototype.resolveTo_ = function(value) {
  379. if (value === this) {
  380. this.reject_(new TypeError('A Promise cannot resolve to itself'));
  381. } else {
  382. if (value instanceof PolyfillPromise) {
  383. this.settleSameAsPromise_(value);
  384. } else {
  385. if (isObject(value)) {
  386. this.resolveToNonPromiseObj_(value);
  387. } else {
  388. this.fulfill_(value);
  389. }
  390. }
  391. }
  392. };
  393. PolyfillPromise.prototype.resolveToNonPromiseObj_ = function(obj) {
  394. var thenMethod = undefined;
  395. try {
  396. thenMethod = obj.then;
  397. } catch (error) {
  398. this.reject_(error);
  399. return;
  400. }
  401. if (typeof thenMethod == 'function') {
  402. this.settleSameAsThenable_(thenMethod, obj);
  403. } else {
  404. this.fulfill_(obj);
  405. }
  406. };
  407. function isObject(value) {
  408. switch(typeof value) {
  409. case 'object':
  410. return value != null;
  411. case 'function':
  412. return true;
  413. default:
  414. return false;
  415. }
  416. }
  417. PolyfillPromise.prototype.reject_ = function(reason) {
  418. this.settle_(PromiseState.REJECTED, reason);
  419. };
  420. PolyfillPromise.prototype.fulfill_ = function(value) {
  421. this.settle_(PromiseState.FULFILLED, value);
  422. };
  423. PolyfillPromise.prototype.settle_ = function(settledState, valueOrReason) {
  424. if (this.state_ != PromiseState.PENDING) {
  425. throw new Error('Cannot settle(' + settledState + ', ' + valueOrReason + '): Promise already settled in state' + this.state_);
  426. }
  427. this.state_ = settledState;
  428. this.result_ = valueOrReason;
  429. this.executeOnSettledCallbacks_();
  430. };
  431. PolyfillPromise.prototype.executeOnSettledCallbacks_ = function() {
  432. if (this.onSettledCallbacks_ != null) {
  433. for (var i = 0; i < this.onSettledCallbacks_.length; ++i) {
  434. asyncExecutor.asyncExecute(this.onSettledCallbacks_[i]);
  435. }
  436. this.onSettledCallbacks_ = null;
  437. }
  438. };
  439. var asyncExecutor = new AsyncExecutor;
  440. PolyfillPromise.prototype.settleSameAsPromise_ = function(promise) {
  441. var methods = this.createResolveAndReject_();
  442. promise.callWhenSettled_(methods.resolve, methods.reject);
  443. };
  444. PolyfillPromise.prototype.settleSameAsThenable_ = function(thenMethod, thenable) {
  445. var methods = this.createResolveAndReject_();
  446. try {
  447. thenMethod.call(thenable, methods.resolve, methods.reject);
  448. } catch (error) {
  449. methods.reject(error);
  450. }
  451. };
  452. PolyfillPromise.prototype.then = function(onFulfilled, onRejected) {
  453. var resolveChild;
  454. var rejectChild;
  455. var childPromise = new PolyfillPromise(function(resolve, reject) {
  456. resolveChild = resolve;
  457. rejectChild = reject;
  458. });
  459. function createCallback(paramF, defaultF) {
  460. if (typeof paramF == 'function') {
  461. return function(x) {
  462. try {
  463. resolveChild(paramF(x));
  464. } catch (error) {
  465. rejectChild(error);
  466. }
  467. };
  468. } else {
  469. return defaultF;
  470. }
  471. }
  472. this.callWhenSettled_(createCallback(onFulfilled, resolveChild), createCallback(onRejected, rejectChild));
  473. return childPromise;
  474. };
  475. PolyfillPromise.prototype['catch'] = function(onRejected) {
  476. return this.then(undefined, onRejected);
  477. };
  478. PolyfillPromise.prototype.callWhenSettled_ = function(onFulfilled, onRejected) {
  479. var thisPromise = this;
  480. function callback() {
  481. switch(thisPromise.state_) {
  482. case PromiseState.FULFILLED:
  483. onFulfilled(thisPromise.result_);
  484. break;
  485. case PromiseState.REJECTED:
  486. onRejected(thisPromise.result_);
  487. break;
  488. default:
  489. throw new Error('Unexpected state: ' + thisPromise.state_);
  490. }
  491. }
  492. if (this.onSettledCallbacks_ == null) {
  493. asyncExecutor.asyncExecute(callback);
  494. } else {
  495. this.onSettledCallbacks_.push(callback);
  496. }
  497. };
  498. function resolvingPromise(opt_value) {
  499. if (opt_value instanceof PolyfillPromise) {
  500. return opt_value;
  501. } else {
  502. return new PolyfillPromise(function(resolve, reject) {
  503. resolve(opt_value);
  504. });
  505. }
  506. }
  507. PolyfillPromise['resolve'] = resolvingPromise;
  508. PolyfillPromise['reject'] = function(opt_reason) {
  509. return new PolyfillPromise(function(resolve, reject) {
  510. reject(opt_reason);
  511. });
  512. };
  513. PolyfillPromise['race'] = function(thenablesOrValues) {
  514. return new PolyfillPromise(function(resolve, reject) {
  515. var iterator = $jscomp.makeIterator(thenablesOrValues);
  516. for (var iterRec = iterator.next(); !iterRec.done; iterRec = iterator.next()) {
  517. resolvingPromise(iterRec.value).callWhenSettled_(resolve, reject);
  518. }
  519. });
  520. };
  521. PolyfillPromise['all'] = function(thenablesOrValues) {
  522. var iterator = $jscomp.makeIterator(thenablesOrValues);
  523. var iterRec = iterator.next();
  524. if (iterRec.done) {
  525. return resolvingPromise([]);
  526. } else {
  527. return new PolyfillPromise(function(resolveAll, rejectAll) {
  528. var resultsArray = [];
  529. var unresolvedCount = 0;
  530. function onFulfilled(i) {
  531. return function(ithResult) {
  532. resultsArray[i] = ithResult;
  533. unresolvedCount--;
  534. if (unresolvedCount == 0) {
  535. resolveAll(resultsArray);
  536. }
  537. };
  538. }
  539. do {
  540. resultsArray.push(undefined);
  541. unresolvedCount++;
  542. resolvingPromise(iterRec.value).callWhenSettled_(onFulfilled(resultsArray.length - 1), rejectAll);
  543. iterRec = iterator.next();
  544. } while (!iterRec.done);
  545. });
  546. }
  547. };
  548. return PolyfillPromise;
  549. }, 'es6', 'es3');
  550. $jscomp.polyfill('Promise.prototype.finally', function(orig) {
  551. if (orig) {
  552. return orig;
  553. }
  554. var polyfill = function(onFinally) {
  555. return this.then(function(value) {
  556. var promise = Promise.resolve(onFinally());
  557. return promise.then(function() {
  558. return value;
  559. });
  560. }, function(reason) {
  561. var promise = Promise.resolve(onFinally());
  562. return promise.then(function() {
  563. throw reason;
  564. });
  565. });
  566. };
  567. return polyfill;
  568. }, 'es9', 'es3');
  569. $jscomp.underscoreProtoCanBeSet = function() {
  570. var x = {a:true};
  571. var y = {};
  572. try {
  573. y.__proto__ = x;
  574. return y.a;
  575. } catch (e) {
  576. }
  577. return false;
  578. };
  579. $jscomp.setPrototypeOf = typeof Object.setPrototypeOf == 'function' ? Object.setPrototypeOf : $jscomp.underscoreProtoCanBeSet() ? function(target, proto) {
  580. target.__proto__ = proto;
  581. if (target.__proto__ !== proto) {
  582. throw new TypeError(target + ' is not extensible');
  583. }
  584. return target;
  585. } : null;
  586. $jscomp.generator = {};
  587. $jscomp.generator.ensureIteratorResultIsObject_ = function(result) {
  588. if (result instanceof Object) {
  589. return;
  590. }
  591. throw new TypeError('Iterator result ' + result + ' is not an object');
  592. };
  593. $jscomp.generator.Context = function() {
  594. this.isRunning_ = false;
  595. this.yieldAllIterator_ = null;
  596. this.yieldResult = undefined;
  597. this.nextAddress = 1;
  598. this.catchAddress_ = 0;
  599. this.finallyAddress_ = 0;
  600. this.abruptCompletion_ = null;
  601. this.finallyContexts_ = null;
  602. };
  603. $jscomp.generator.Context.prototype.start_ = function() {
  604. if (this.isRunning_) {
  605. throw new TypeError('Generator is already running');
  606. }
  607. this.isRunning_ = true;
  608. };
  609. $jscomp.generator.Context.prototype.stop_ = function() {
  610. this.isRunning_ = false;
  611. };
  612. $jscomp.generator.Context.prototype.jumpToErrorHandler_ = function() {
  613. this.nextAddress = this.catchAddress_ || this.finallyAddress_;
  614. };
  615. $jscomp.generator.Context.prototype.next_ = function(value) {
  616. this.yieldResult = value;
  617. };
  618. $jscomp.generator.Context.prototype.throw_ = function(e) {
  619. this.abruptCompletion_ = {exception:e, isException:true};
  620. this.jumpToErrorHandler_();
  621. };
  622. $jscomp.generator.Context.prototype['return'] = function(value) {
  623. this.abruptCompletion_ = {'return':value};
  624. this.nextAddress = this.finallyAddress_;
  625. };
  626. $jscomp.generator.Context.prototype.jumpThroughFinallyBlocks = function(nextAddress) {
  627. this.abruptCompletion_ = {jumpTo:nextAddress};
  628. this.nextAddress = this.finallyAddress_;
  629. };
  630. $jscomp.generator.Context.prototype.yield = function(value, resumeAddress) {
  631. this.nextAddress = resumeAddress;
  632. return {value:value};
  633. };
  634. $jscomp.generator.Context.prototype.yieldAll = function(iterable, resumeAddress) {
  635. var iterator = $jscomp.makeIterator(iterable);
  636. var result = iterator.next();
  637. $jscomp.generator.ensureIteratorResultIsObject_(result);
  638. if (result.done) {
  639. this.yieldResult = result.value;
  640. this.nextAddress = resumeAddress;
  641. return;
  642. }
  643. this.yieldAllIterator_ = iterator;
  644. return this.yield(result.value, resumeAddress);
  645. };
  646. $jscomp.generator.Context.prototype.jumpTo = function(nextAddress) {
  647. this.nextAddress = nextAddress;
  648. };
  649. $jscomp.generator.Context.prototype.jumpToEnd = function() {
  650. this.nextAddress = 0;
  651. };
  652. $jscomp.generator.Context.prototype.setCatchFinallyBlocks = function(catchAddress, finallyAddress) {
  653. this.catchAddress_ = catchAddress;
  654. if (finallyAddress != undefined) {
  655. this.finallyAddress_ = finallyAddress;
  656. }
  657. };
  658. $jscomp.generator.Context.prototype.setFinallyBlock = function(finallyAddress) {
  659. this.catchAddress_ = 0;
  660. this.finallyAddress_ = finallyAddress || 0;
  661. };
  662. $jscomp.generator.Context.prototype.leaveTryBlock = function(nextAddress, catchAddress) {
  663. this.nextAddress = nextAddress;
  664. this.catchAddress_ = catchAddress || 0;
  665. };
  666. $jscomp.generator.Context.prototype.enterCatchBlock = function(nextCatchBlockAddress) {
  667. this.catchAddress_ = nextCatchBlockAddress || 0;
  668. var exception = this.abruptCompletion_.exception;
  669. this.abruptCompletion_ = null;
  670. return exception;
  671. };
  672. $jscomp.generator.Context.prototype.enterFinallyBlock = function(nextCatchAddress, nextFinallyAddress, finallyDepth) {
  673. if (!finallyDepth) {
  674. this.finallyContexts_ = [this.abruptCompletion_];
  675. } else {
  676. this.finallyContexts_[finallyDepth] = this.abruptCompletion_;
  677. }
  678. this.catchAddress_ = nextCatchAddress || 0;
  679. this.finallyAddress_ = nextFinallyAddress || 0;
  680. };
  681. $jscomp.generator.Context.prototype.leaveFinallyBlock = function(nextAddress, finallyDepth) {
  682. var preservedContext = this.finallyContexts_.splice(finallyDepth || 0)[0];
  683. var abruptCompletion = this.abruptCompletion_ = this.abruptCompletion_ || preservedContext;
  684. if (abruptCompletion) {
  685. if (abruptCompletion.isException) {
  686. return this.jumpToErrorHandler_();
  687. }
  688. if (abruptCompletion.jumpTo != undefined && this.finallyAddress_ < abruptCompletion.jumpTo) {
  689. this.nextAddress = abruptCompletion.jumpTo;
  690. this.abruptCompletion_ = null;
  691. } else {
  692. this.nextAddress = this.finallyAddress_;
  693. }
  694. } else {
  695. this.nextAddress = nextAddress;
  696. }
  697. };
  698. $jscomp.generator.Context.prototype.forIn = function(object) {
  699. return new $jscomp.generator.Context.PropertyIterator(object);
  700. };
  701. $jscomp.generator.Context.PropertyIterator = function(object) {
  702. this.object_ = object;
  703. this.properties_ = [];
  704. for (var property in object) {
  705. this.properties_.push(property);
  706. }
  707. this.properties_.reverse();
  708. };
  709. $jscomp.generator.Context.PropertyIterator.prototype.getNext = function() {
  710. while (this.properties_.length > 0) {
  711. var property = this.properties_.pop();
  712. if (property in this.object_) {
  713. return property;
  714. }
  715. }
  716. return null;
  717. };
  718. $jscomp.generator.Engine_ = function(program) {
  719. this.context_ = new $jscomp.generator.Context;
  720. this.program_ = program;
  721. };
  722. $jscomp.generator.Engine_.prototype.next_ = function(value) {
  723. this.context_.start_();
  724. if (this.context_.yieldAllIterator_) {
  725. return this.yieldAllStep_(this.context_.yieldAllIterator_.next, value, this.context_.next_);
  726. }
  727. this.context_.next_(value);
  728. return this.nextStep_();
  729. };
  730. $jscomp.generator.Engine_.prototype.return_ = function(value) {
  731. this.context_.start_();
  732. var yieldAllIterator = this.context_.yieldAllIterator_;
  733. if (yieldAllIterator) {
  734. var returnFunction = 'return' in yieldAllIterator ? yieldAllIterator['return'] : function(v) {
  735. return {value:v, done:true};
  736. };
  737. return this.yieldAllStep_(returnFunction, value, this.context_['return']);
  738. }
  739. this.context_['return'](value);
  740. return this.nextStep_();
  741. };
  742. $jscomp.generator.Engine_.prototype.throw_ = function(exception) {
  743. this.context_.start_();
  744. if (this.context_.yieldAllIterator_) {
  745. return this.yieldAllStep_(this.context_.yieldAllIterator_['throw'], exception, this.context_.next_);
  746. }
  747. this.context_.throw_(exception);
  748. return this.nextStep_();
  749. };
  750. $jscomp.generator.Engine_.prototype.yieldAllStep_ = function(action, value, nextAction) {
  751. try {
  752. var result = action.call(this.context_.yieldAllIterator_, value);
  753. $jscomp.generator.ensureIteratorResultIsObject_(result);
  754. if (!result.done) {
  755. this.context_.stop_();
  756. return result;
  757. }
  758. var resultValue = result.value;
  759. } catch (e) {
  760. this.context_.yieldAllIterator_ = null;
  761. this.context_.throw_(e);
  762. return this.nextStep_();
  763. }
  764. this.context_.yieldAllIterator_ = null;
  765. nextAction.call(this.context_, resultValue);
  766. return this.nextStep_();
  767. };
  768. $jscomp.generator.Engine_.prototype.nextStep_ = function() {
  769. while (this.context_.nextAddress) {
  770. try {
  771. var yieldValue = this.program_(this.context_);
  772. if (yieldValue) {
  773. this.context_.stop_();
  774. return {value:yieldValue.value, done:false};
  775. }
  776. } catch (e) {
  777. this.context_.yieldResult = undefined;
  778. this.context_.throw_(e);
  779. }
  780. }
  781. this.context_.stop_();
  782. if (this.context_.abruptCompletion_) {
  783. var abruptCompletion = this.context_.abruptCompletion_;
  784. this.context_.abruptCompletion_ = null;
  785. if (abruptCompletion.isException) {
  786. throw abruptCompletion.exception;
  787. }
  788. return {value:abruptCompletion['return'], done:true};
  789. }
  790. return {value:undefined, done:true};
  791. };
  792. $jscomp.generator.Generator_ = function(engine) {
  793. this.next = function(opt_value) {
  794. return engine.next_(opt_value);
  795. };
  796. this['throw'] = function(exception) {
  797. return engine.throw_(exception);
  798. };
  799. this['return'] = function(value) {
  800. return engine.return_(value);
  801. };
  802. $jscomp.initSymbolIterator();
  803. this[Symbol.iterator] = function() {
  804. return this;
  805. };
  806. };
  807. $jscomp.generator.createGenerator = function(generator, program) {
  808. var result = new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(program));
  809. if ($jscomp.setPrototypeOf) {
  810. $jscomp.setPrototypeOf(result, generator.prototype);
  811. }
  812. return result;
  813. };
  814. $jscomp.asyncExecutePromiseGenerator = function(generator) {
  815. function passValueToGenerator(value) {
  816. return generator.next(value);
  817. }
  818. function passErrorToGenerator(error) {
  819. return generator['throw'](error);
  820. }
  821. return new Promise(function(resolve, reject) {
  822. function handleGeneratorRecord(genRec) {
  823. if (genRec.done) {
  824. resolve(genRec.value);
  825. } else {
  826. Promise.resolve(genRec.value).then(passValueToGenerator, passErrorToGenerator).then(handleGeneratorRecord, reject);
  827. }
  828. }
  829. handleGeneratorRecord(generator.next());
  830. });
  831. };
  832. $jscomp.asyncExecutePromiseGeneratorFunction = function(generatorFunction) {
  833. return $jscomp.asyncExecutePromiseGenerator(generatorFunction());
  834. };
  835. $jscomp.asyncExecutePromiseGeneratorProgram = function(program) {
  836. return $jscomp.asyncExecutePromiseGenerator(new $jscomp.generator.Generator_(new $jscomp.generator.Engine_(program)));
  837. };
  838. $jscomp.checkEs6ConformanceViaProxy = function() {
  839. try {
  840. var proxied = {};
  841. var proxy = Object.create(new $jscomp.global['Proxy'](proxied, {'get':function(target, key, receiver) {
  842. return target == proxied && key == 'q' && receiver == proxy;
  843. }}));
  844. return proxy['q'] === true;
  845. } catch (err) {
  846. return false;
  847. }
  848. };
  849. $jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS = false;
  850. $jscomp.ES6_CONFORMANCE = $jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS && $jscomp.checkEs6ConformanceViaProxy();
  851. $jscomp.owns = function(obj, prop) {
  852. return Object.prototype.hasOwnProperty.call(obj, prop);
  853. };
  854. $jscomp.polyfill('WeakMap', function(NativeWeakMap) {
  855. function isConformant() {
  856. if (!NativeWeakMap || !Object.seal) {
  857. return false;
  858. }
  859. try {
  860. var x = Object.seal({});
  861. var y = Object.seal({});
  862. var map = new NativeWeakMap([[x, 2], [y, 3]]);
  863. if (map.get(x) != 2 || map.get(y) != 3) {
  864. return false;
  865. }
  866. map['delete'](x);
  867. map.set(y, 4);
  868. return !map.has(x) && map.get(y) == 4;
  869. } catch (err) {
  870. return false;
  871. }
  872. }
  873. if ($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS) {
  874. if (NativeWeakMap && $jscomp.ES6_CONFORMANCE) {
  875. return NativeWeakMap;
  876. }
  877. } else {
  878. if (isConformant()) {
  879. return NativeWeakMap;
  880. }
  881. }
  882. var prop = '$jscomp_hidden_' + Math.random();
  883. function insert(target) {
  884. if (!$jscomp.owns(target, prop)) {
  885. var obj = {};
  886. $jscomp.defineProperty(target, prop, {value:obj});
  887. }
  888. }
  889. function patch(name) {
  890. var prev = Object[name];
  891. if (prev) {
  892. Object[name] = function(target) {
  893. insert(target);
  894. return prev(target);
  895. };
  896. }
  897. }
  898. patch('freeze');
  899. patch('preventExtensions');
  900. patch('seal');
  901. var index = 0;
  902. var PolyfillWeakMap = function(opt_iterable) {
  903. this.id_ = (index += Math.random() + 1).toString();
  904. if (opt_iterable) {
  905. $jscomp.initSymbol();
  906. $jscomp.initSymbolIterator();
  907. var iter = $jscomp.makeIterator(opt_iterable);
  908. var entry;
  909. while (!(entry = iter.next()).done) {
  910. var item = entry.value;
  911. this.set(item[0], item[1]);
  912. }
  913. }
  914. };
  915. PolyfillWeakMap.prototype.set = function(key, value) {
  916. insert(key);
  917. if (!$jscomp.owns(key, prop)) {
  918. throw new Error('WeakMap key fail: ' + key);
  919. }
  920. key[prop][this.id_] = value;
  921. return this;
  922. };
  923. PolyfillWeakMap.prototype.get = function(key) {
  924. return $jscomp.owns(key, prop) ? key[prop][this.id_] : undefined;
  925. };
  926. PolyfillWeakMap.prototype.has = function(key) {
  927. return $jscomp.owns(key, prop) && $jscomp.owns(key[prop], this.id_);
  928. };
  929. PolyfillWeakMap.prototype['delete'] = function(key) {
  930. if (!$jscomp.owns(key, prop) || !$jscomp.owns(key[prop], this.id_)) {
  931. return false;
  932. }
  933. return delete key[prop][this.id_];
  934. };
  935. return PolyfillWeakMap;
  936. }, 'es6', 'es3');
  937. $jscomp.MapEntry = function() {
  938. this.previous;
  939. this.next;
  940. this.head;
  941. this.key;
  942. this.value;
  943. };
  944. $jscomp.polyfill('Map', function(NativeMap) {
  945. function isConformant() {
  946. if ($jscomp.ASSUME_NO_NATIVE_MAP || !NativeMap || typeof NativeMap != 'function' || !NativeMap.prototype.entries || typeof Object.seal != 'function') {
  947. return false;
  948. }
  949. try {
  950. NativeMap = NativeMap;
  951. var key = Object.seal({x:4});
  952. var map = new NativeMap($jscomp.makeIterator([[key, 's']]));
  953. if (map.get(key) != 's' || map.size != 1 || map.get({x:4}) || map.set({x:4}, 't') != map || map.size != 2) {
  954. return false;
  955. }
  956. var iter = map.entries();
  957. var item = iter.next();
  958. if (item.done || item.value[0] != key || item.value[1] != 's') {
  959. return false;
  960. }
  961. item = iter.next();
  962. if (item.done || item.value[0].x != 4 || item.value[1] != 't' || !iter.next().done) {
  963. return false;
  964. }
  965. return true;
  966. } catch (err) {
  967. return false;
  968. }
  969. }
  970. if ($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS) {
  971. if (NativeMap && $jscomp.ES6_CONFORMANCE) {
  972. return NativeMap;
  973. }
  974. } else {
  975. if (isConformant()) {
  976. return NativeMap;
  977. }
  978. }
  979. $jscomp.initSymbol();
  980. $jscomp.initSymbolIterator();
  981. var idMap = new WeakMap;
  982. var PolyfillMap = function(opt_iterable) {
  983. this.data_ = {};
  984. this.head_ = createHead();
  985. this.size = 0;
  986. if (opt_iterable) {
  987. var iter = $jscomp.makeIterator(opt_iterable);
  988. var entry;
  989. while (!(entry = iter.next()).done) {
  990. var item = entry.value;
  991. this.set(item[0], item[1]);
  992. }
  993. }
  994. };
  995. PolyfillMap.prototype.set = function(key, value) {
  996. key = key === 0 ? 0 : key;
  997. var r = maybeGetEntry(this, key);
  998. if (!r.list) {
  999. r.list = this.data_[r.id] = [];
  1000. }
  1001. if (!r.entry) {
  1002. r.entry = {next:this.head_, previous:this.head_.previous, head:this.head_, key:key, value:value};
  1003. r.list.push(r.entry);
  1004. this.head_.previous.next = r.entry;
  1005. this.head_.previous = r.entry;
  1006. this.size++;
  1007. } else {
  1008. r.entry.value = value;
  1009. }
  1010. return this;
  1011. };
  1012. PolyfillMap.prototype['delete'] = function(key) {
  1013. var r = maybeGetEntry(this, key);
  1014. if (r.entry && r.list) {
  1015. r.list.splice(r.index, 1);
  1016. if (!r.list.length) {
  1017. delete this.data_[r.id];
  1018. }
  1019. r.entry.previous.next = r.entry.next;
  1020. r.entry.next.previous = r.entry.previous;
  1021. r.entry.head = null;
  1022. this.size--;
  1023. return true;
  1024. }
  1025. return false;
  1026. };
  1027. PolyfillMap.prototype.clear = function() {
  1028. this.data_ = {};
  1029. this.head_ = this.head_.previous = createHead();
  1030. this.size = 0;
  1031. };
  1032. PolyfillMap.prototype.has = function(key) {
  1033. return !!maybeGetEntry(this, key).entry;
  1034. };
  1035. PolyfillMap.prototype.get = function(key) {
  1036. var entry = maybeGetEntry(this, key).entry;
  1037. return entry && entry.value;
  1038. };
  1039. PolyfillMap.prototype.entries = function() {
  1040. return makeIterator(this, function(entry) {
  1041. return [entry.key, entry.value];
  1042. });
  1043. };
  1044. PolyfillMap.prototype.keys = function() {
  1045. return makeIterator(this, function(entry) {
  1046. return entry.key;
  1047. });
  1048. };
  1049. PolyfillMap.prototype.values = function() {
  1050. return makeIterator(this, function(entry) {
  1051. return entry.value;
  1052. });
  1053. };
  1054. PolyfillMap.prototype.forEach = function(callback, opt_thisArg) {
  1055. var iter = this.entries();
  1056. var item;
  1057. while (!(item = iter.next()).done) {
  1058. var entry = item.value;
  1059. callback.call(opt_thisArg, entry[1], entry[0], this);
  1060. }
  1061. };
  1062. PolyfillMap.prototype[Symbol.iterator] = PolyfillMap.prototype.entries;
  1063. var maybeGetEntry = function(map, key) {
  1064. var id = getId(key);
  1065. var list = map.data_[id];
  1066. if (list && $jscomp.owns(map.data_, id)) {
  1067. for (var index = 0; index < list.length; index++) {
  1068. var entry = list[index];
  1069. if (key !== key && entry.key !== entry.key || key === entry.key) {
  1070. return {id:id, list:list, index:index, entry:entry};
  1071. }
  1072. }
  1073. }
  1074. return {id:id, list:list, index:-1, entry:undefined};
  1075. };
  1076. var makeIterator = function(map, func) {
  1077. var entry = map.head_;
  1078. return $jscomp.iteratorPrototype(function() {
  1079. if (entry) {
  1080. while (entry.head != map.head_) {
  1081. entry = entry.previous;
  1082. }
  1083. while (entry.next != entry.head) {
  1084. entry = entry.next;
  1085. return {done:false, value:func(entry)};
  1086. }
  1087. entry = null;
  1088. }
  1089. return {done:true, value:void 0};
  1090. });
  1091. };
  1092. var createHead = function() {
  1093. var head = {};
  1094. head.previous = head.next = head.head = head;
  1095. return head;
  1096. };
  1097. var mapIndex = 0;
  1098. var getId = function(obj) {
  1099. var type = obj && typeof obj;
  1100. if (type == 'object' || type == 'function') {
  1101. obj = obj;
  1102. if (!idMap.has(obj)) {
  1103. var id = '' + ++mapIndex;
  1104. idMap.set(obj, id);
  1105. return id;
  1106. }
  1107. return idMap.get(obj);
  1108. }
  1109. return 'p_' + obj;
  1110. };
  1111. return PolyfillMap;
  1112. }, 'es6', 'es3');
  1113. $jscomp.polyfill('Math.acosh', function(orig) {
  1114. if (orig) {
  1115. return orig;
  1116. }
  1117. var polyfill = function(x) {
  1118. x = Number(x);
  1119. return Math.log(x + Math.sqrt(x * x - 1));
  1120. };
  1121. return polyfill;
  1122. }, 'es6', 'es3');
  1123. $jscomp.polyfill('Math.asinh', function(orig) {
  1124. if (orig) {
  1125. return orig;
  1126. }
  1127. var polyfill = function(x) {
  1128. x = Number(x);
  1129. if (x === 0) {
  1130. return x;
  1131. }
  1132. var y = Math.log(Math.abs(x) + Math.sqrt(x * x + 1));
  1133. return x < 0 ? -y : y;
  1134. };
  1135. return polyfill;
  1136. }, 'es6', 'es3');
  1137. $jscomp.polyfill('Math.log1p', function(orig) {
  1138. if (orig) {
  1139. return orig;
  1140. }
  1141. var polyfill = function(x) {
  1142. x = Number(x);
  1143. if (x < 0.25 && x > -0.25) {
  1144. var y = x;
  1145. var d = 1;
  1146. var z = x;
  1147. var zPrev = 0;
  1148. var s = 1;
  1149. while (zPrev != z) {
  1150. y *= x;
  1151. s *= -1;
  1152. z = (zPrev = z) + s * y / ++d;
  1153. }
  1154. return z;
  1155. }
  1156. return Math.log(1 + x);
  1157. };
  1158. return polyfill;
  1159. }, 'es6', 'es3');
  1160. $jscomp.polyfill('Math.atanh', function(orig) {
  1161. if (orig) {
  1162. return orig;
  1163. }
  1164. var log1p = Math.log1p;
  1165. var polyfill = function(x) {
  1166. x = Number(x);
  1167. return (log1p(x) - log1p(-x)) / 2;
  1168. };
  1169. return polyfill;
  1170. }, 'es6', 'es3');
  1171. $jscomp.polyfill('Math.cbrt', function(orig) {
  1172. if (orig) {
  1173. return orig;
  1174. }
  1175. var polyfill = function(x) {
  1176. if (x === 0) {
  1177. return x;
  1178. }
  1179. x = Number(x);
  1180. var y = Math.pow(Math.abs(x), 1 / 3);
  1181. return x < 0 ? -y : y;
  1182. };
  1183. return polyfill;
  1184. }, 'es6', 'es3');
  1185. $jscomp.polyfill('Math.clz32', function(orig) {
  1186. if (orig) {
  1187. return orig;
  1188. }
  1189. var polyfill = function(x) {
  1190. x = Number(x) >>> 0;
  1191. if (x === 0) {
  1192. return 32;
  1193. }
  1194. var result = 0;
  1195. if ((x & 4294901760) === 0) {
  1196. x <<= 16;
  1197. result += 16;
  1198. }
  1199. if ((x & 4278190080) === 0) {
  1200. x <<= 8;
  1201. result += 8;
  1202. }
  1203. if ((x & 4026531840) === 0) {
  1204. x <<= 4;
  1205. result += 4;
  1206. }
  1207. if ((x & 3221225472) === 0) {
  1208. x <<= 2;
  1209. result += 2;
  1210. }
  1211. if ((x & 2147483648) === 0) {
  1212. result++;
  1213. }
  1214. return result;
  1215. };
  1216. return polyfill;
  1217. }, 'es6', 'es3');
  1218. $jscomp.polyfill('Math.cosh', function(orig) {
  1219. if (orig) {
  1220. return orig;
  1221. }
  1222. var exp = Math.exp;
  1223. var polyfill = function(x) {
  1224. x = Number(x);
  1225. return (exp(x) + exp(-x)) / 2;
  1226. };
  1227. return polyfill;
  1228. }, 'es6', 'es3');
  1229. $jscomp.polyfill('Math.expm1', function(orig) {
  1230. if (orig) {
  1231. return orig;
  1232. }
  1233. var polyfill = function(x) {
  1234. x = Number(x);
  1235. if (x < .25 && x > -.25) {
  1236. var y = x;
  1237. var d = 1;
  1238. var z = x;
  1239. var zPrev = 0;
  1240. while (zPrev != z) {
  1241. y *= x / ++d;
  1242. z = (zPrev = z) + y;
  1243. }
  1244. return z;
  1245. }
  1246. return Math.exp(x) - 1;
  1247. };
  1248. return polyfill;
  1249. }, 'es6', 'es3');
  1250. $jscomp.polyfill('Math.hypot', function(orig) {
  1251. if (orig) {
  1252. return orig;
  1253. }
  1254. var polyfill = function(x, y, var_args) {
  1255. x = Number(x);
  1256. y = Number(y);
  1257. var i, z, sum;
  1258. var max = Math.max(Math.abs(x), Math.abs(y));
  1259. for (i = 2; i < arguments.length; i++) {
  1260. max = Math.max(max, Math.abs(arguments[i]));
  1261. }
  1262. if (max > 1e100 || max < 1e-100) {
  1263. if (!max) {
  1264. return max;
  1265. }
  1266. x = x / max;
  1267. y = y / max;
  1268. sum = x * x + y * y;
  1269. for (i = 2; i < arguments.length; i++) {
  1270. z = Number(arguments[i]) / max;
  1271. sum += z * z;
  1272. }
  1273. return Math.sqrt(sum) * max;
  1274. } else {
  1275. sum = x * x + y * y;
  1276. for (i = 2; i < arguments.length; i++) {
  1277. z = Number(arguments[i]);
  1278. sum += z * z;
  1279. }
  1280. return Math.sqrt(sum);
  1281. }
  1282. };
  1283. return polyfill;
  1284. }, 'es6', 'es3');
  1285. $jscomp.polyfill('Math.imul', function(orig) {
  1286. if (orig) {
  1287. return orig;
  1288. }
  1289. var polyfill = function(a, b) {
  1290. a = Number(a);
  1291. b = Number(b);
  1292. var ah = a >>> 16 & 65535;
  1293. var al = a & 65535;
  1294. var bh = b >>> 16 & 65535;
  1295. var bl = b & 65535;
  1296. var lh = ah * bl + al * bh << 16 >>> 0;
  1297. return al * bl + lh | 0;
  1298. };
  1299. return polyfill;
  1300. }, 'es6', 'es3');
  1301. $jscomp.polyfill('Math.log10', function(orig) {
  1302. if (orig) {
  1303. return orig;
  1304. }
  1305. var polyfill = function(x) {
  1306. return Math.log(x) / Math.LN10;
  1307. };
  1308. return polyfill;
  1309. }, 'es6', 'es3');
  1310. $jscomp.polyfill('Math.log2', function(orig) {
  1311. if (orig) {
  1312. return orig;
  1313. }
  1314. var polyfill = function(x) {
  1315. return Math.log(x) / Math.LN2;
  1316. };
  1317. return polyfill;
  1318. }, 'es6', 'es3');
  1319. $jscomp.polyfill('Math.sign', function(orig) {
  1320. if (orig) {
  1321. return orig;
  1322. }
  1323. var polyfill = function(x) {
  1324. x = Number(x);
  1325. return x === 0 || isNaN(x) ? x : x > 0 ? 1 : -1;
  1326. };
  1327. return polyfill;
  1328. }, 'es6', 'es3');
  1329. $jscomp.polyfill('Math.sinh', function(orig) {
  1330. if (orig) {
  1331. return orig;
  1332. }
  1333. var exp = Math.exp;
  1334. var polyfill = function(x) {
  1335. x = Number(x);
  1336. if (x === 0) {
  1337. return x;
  1338. }
  1339. return (exp(x) - exp(-x)) / 2;
  1340. };
  1341. return polyfill;
  1342. }, 'es6', 'es3');
  1343. $jscomp.polyfill('Math.tanh', function(orig) {
  1344. if (orig) {
  1345. return orig;
  1346. }
  1347. var polyfill = function(x) {
  1348. x = Number(x);
  1349. if (x === 0) {
  1350. return x;
  1351. }
  1352. var y = Math.exp(-2 * Math.abs(x));
  1353. var z = (1 - y) / (1 + y);
  1354. return x < 0 ? -z : z;
  1355. };
  1356. return polyfill;
  1357. }, 'es6', 'es3');
  1358. $jscomp.polyfill('Math.trunc', function(orig) {
  1359. if (orig) {
  1360. return orig;
  1361. }
  1362. var polyfill = function(x) {
  1363. x = Number(x);
  1364. if (isNaN(x) || x === Infinity || x === -Infinity || x === 0) {
  1365. return x;
  1366. }
  1367. var y = Math.floor(Math.abs(x));
  1368. return x < 0 ? -y : y;
  1369. };
  1370. return polyfill;
  1371. }, 'es6', 'es3');
  1372. $jscomp.polyfill('Number.EPSILON', function(orig) {
  1373. return Math.pow(2, -52);
  1374. }, 'es6', 'es3');
  1375. $jscomp.polyfill('Number.MAX_SAFE_INTEGER', function() {
  1376. return 9007199254740991;
  1377. }, 'es6', 'es3');
  1378. $jscomp.polyfill('Number.MIN_SAFE_INTEGER', function() {
  1379. return -9007199254740991;
  1380. }, 'es6', 'es3');
  1381. $jscomp.polyfill('Number.isFinite', function(orig) {
  1382. if (orig) {
  1383. return orig;
  1384. }
  1385. var polyfill = function(x) {
  1386. if (typeof x !== 'number') {
  1387. return false;
  1388. }
  1389. return !isNaN(x) && x !== Infinity && x !== -Infinity;
  1390. };
  1391. return polyfill;
  1392. }, 'es6', 'es3');
  1393. $jscomp.polyfill('Number.isInteger', function(orig) {
  1394. if (orig) {
  1395. return orig;
  1396. }
  1397. var polyfill = function(x) {
  1398. if (!Number.isFinite(x)) {
  1399. return false;
  1400. }
  1401. return x === Math.floor(x);
  1402. };
  1403. return polyfill;
  1404. }, 'es6', 'es3');
  1405. $jscomp.polyfill('Number.isNaN', function(orig) {
  1406. if (orig) {
  1407. return orig;
  1408. }
  1409. var polyfill = function(x) {
  1410. return typeof x === 'number' && isNaN(x);
  1411. };
  1412. return polyfill;
  1413. }, 'es6', 'es3');
  1414. $jscomp.polyfill('Number.isSafeInteger', function(orig) {
  1415. if (orig) {
  1416. return orig;
  1417. }
  1418. var polyfill = function(x) {
  1419. return Number.isInteger(x) && Math.abs(x) <= Number.MAX_SAFE_INTEGER;
  1420. };
  1421. return polyfill;
  1422. }, 'es6', 'es3');
  1423. $jscomp.polyfill('Number.parseFloat', function(orig) {
  1424. return orig || parseFloat;
  1425. }, 'es6', 'es3');
  1426. $jscomp.polyfill('Number.parseInt', function(orig) {
  1427. return orig || parseInt;
  1428. }, 'es6', 'es3');
  1429. $jscomp.assign = typeof Object.assign == 'function' ? Object.assign : function(target, var_args) {
  1430. for (var i = 1; i < arguments.length; i++) {
  1431. var source = arguments[i];
  1432. if (!source) {
  1433. continue;
  1434. }
  1435. for (var key in source) {
  1436. if ($jscomp.owns(source, key)) {
  1437. target[key] = source[key];
  1438. }
  1439. }
  1440. }
  1441. return target;
  1442. };
  1443. $jscomp.polyfill('Object.assign', function(orig) {
  1444. return orig || $jscomp.assign;
  1445. }, 'es6', 'es3');
  1446. $jscomp.polyfill('Object.entries', function(orig) {
  1447. if (orig) {
  1448. return orig;
  1449. }
  1450. var entries = function(obj) {
  1451. var result = [];
  1452. for (var key in obj) {
  1453. if ($jscomp.owns(obj, key)) {
  1454. result.push([key, obj[key]]);
  1455. }
  1456. }
  1457. return result;
  1458. };
  1459. return entries;
  1460. }, 'es8', 'es3');
  1461. $jscomp.polyfill('Object.getOwnPropertySymbols', function(orig) {
  1462. if (orig) {
  1463. return orig;
  1464. }
  1465. return function() {
  1466. return [];
  1467. };
  1468. }, 'es6', 'es5');
  1469. $jscomp.polyfill('Reflect.ownKeys', function(orig) {
  1470. if (orig) {
  1471. return orig;
  1472. }
  1473. var symbolPrefix = 'jscomp_symbol_';
  1474. function isSymbol(key) {
  1475. return key.substring(0, symbolPrefix.length) == symbolPrefix;
  1476. }
  1477. var polyfill = function(target) {
  1478. var keys = [];
  1479. var names = Object.getOwnPropertyNames(target);
  1480. var symbols = Object.getOwnPropertySymbols(target);
  1481. for (var i = 0; i < names.length; i++) {
  1482. (isSymbol(names[i]) ? symbols : keys).push(names[i]);
  1483. }
  1484. return keys.concat(symbols);
  1485. };
  1486. return polyfill;
  1487. }, 'es6', 'es5');
  1488. $jscomp.polyfill('Object.getOwnPropertyDescriptors', function(orig) {
  1489. if (orig) {
  1490. return orig;
  1491. }
  1492. var getOwnPropertyDescriptors = function(obj) {
  1493. var result = {};
  1494. var keys = Reflect.ownKeys(obj);
  1495. for (var i = 0; i < keys.length; i++) {
  1496. result[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
  1497. }
  1498. return result;
  1499. };
  1500. return getOwnPropertyDescriptors;
  1501. }, 'es8', 'es5');
  1502. $jscomp.polyfill('Object.setPrototypeOf', function(orig) {
  1503. return orig || $jscomp.setPrototypeOf;
  1504. }, 'es6', 'es5');
  1505. $jscomp.polyfill('Object.values', function(orig) {
  1506. if (orig) {
  1507. return orig;
  1508. }
  1509. var values = function(obj) {
  1510. var result = [];
  1511. for (var key in obj) {
  1512. if ($jscomp.owns(obj, key)) {
  1513. result.push(obj[key]);
  1514. }
  1515. }
  1516. return result;
  1517. };
  1518. return values;
  1519. }, 'es8', 'es3');
  1520. $jscomp.polyfill('Reflect.apply', function(orig) {
  1521. if (orig) {
  1522. return orig;
  1523. }
  1524. var apply = Function.prototype.apply;
  1525. var polyfill = function(target, thisArg, argList) {
  1526. return apply.call(target, thisArg, argList);
  1527. };
  1528. return polyfill;
  1529. }, 'es6', 'es3');
  1530. $jscomp.objectCreate = $jscomp.ASSUME_ES5 || typeof Object.create == 'function' ? Object.create : function(prototype) {
  1531. var ctor = function() {
  1532. };
  1533. ctor.prototype = prototype;
  1534. return new ctor;
  1535. };
  1536. $jscomp.construct = function() {
  1537. function reflectConstructWorks() {
  1538. function Base() {
  1539. }
  1540. function Derived() {
  1541. }
  1542. new Base;
  1543. Reflect.construct(Base, [], Derived);
  1544. return new Base instanceof Base;
  1545. }
  1546. if (typeof Reflect != 'undefined' && Reflect.construct) {
  1547. if (reflectConstructWorks()) {
  1548. return Reflect.construct;
  1549. }
  1550. var brokenConstruct = Reflect.construct;
  1551. var patchedConstruct = function(target, argList, opt_newTarget) {
  1552. var out = brokenConstruct(target, argList);
  1553. if (opt_newTarget) {
  1554. Reflect.setPrototypeOf(out, opt_newTarget.prototype);
  1555. }
  1556. return out;
  1557. };
  1558. return patchedConstruct;
  1559. }
  1560. function construct(target, argList, opt_newTarget) {
  1561. if (opt_newTarget === undefined) {
  1562. opt_newTarget = target;
  1563. }
  1564. var proto = opt_newTarget.prototype || Object.prototype;
  1565. var obj = $jscomp.objectCreate(proto);
  1566. var apply = Function.prototype.apply;
  1567. var out = apply.call(target, obj, argList);
  1568. return out || obj;
  1569. }
  1570. return construct;
  1571. }();
  1572. $jscomp.polyfill('Reflect.construct', function(orig) {
  1573. return $jscomp.construct;
  1574. }, 'es6', 'es3');
  1575. $jscomp.polyfill('Reflect.defineProperty', function(orig) {
  1576. if (orig) {
  1577. return orig;
  1578. }
  1579. var polyfill = function(target, propertyKey, attributes) {
  1580. try {
  1581. Object.defineProperty(target, propertyKey, attributes);
  1582. var desc = Object.getOwnPropertyDescriptor(target, propertyKey);
  1583. if (!desc) {
  1584. return false;
  1585. }
  1586. return desc.configurable === (attributes.configurable || false) && desc.enumerable === (attributes.enumerable || false) && ('value' in desc ? desc.value === attributes.value && desc.writable === (attributes.writable || false) : desc.get === attributes.get && desc.set === attributes.set);
  1587. } catch (err) {
  1588. return false;
  1589. }
  1590. };
  1591. return polyfill;
  1592. }, 'es6', 'es5');
  1593. $jscomp.polyfill('Reflect.deleteProperty', function(orig) {
  1594. if (orig) {
  1595. return orig;
  1596. }
  1597. var polyfill = function(target, propertyKey) {
  1598. if (!$jscomp.owns(target, propertyKey)) {
  1599. return true;
  1600. }
  1601. try {
  1602. return delete target[propertyKey];
  1603. } catch (err) {
  1604. return false;
  1605. }
  1606. };
  1607. return polyfill;
  1608. }, 'es6', 'es3');
  1609. $jscomp.polyfill('Reflect.getOwnPropertyDescriptor', function(orig) {
  1610. return orig || Object.getOwnPropertyDescriptor;
  1611. }, 'es6', 'es5');
  1612. $jscomp.polyfill('Reflect.getPrototypeOf', function(orig) {
  1613. return orig || Object.getPrototypeOf;
  1614. }, 'es6', 'es5');
  1615. $jscomp.findDescriptor = function(target, propertyKey) {
  1616. var obj = target;
  1617. while (obj) {
  1618. var property = Reflect.getOwnPropertyDescriptor(obj, propertyKey);
  1619. if (property) {
  1620. return property;
  1621. }
  1622. obj = Reflect.getPrototypeOf(obj);
  1623. }
  1624. return undefined;
  1625. };
  1626. $jscomp.polyfill('Reflect.get', function(orig) {
  1627. if (orig) {
  1628. return orig;
  1629. }
  1630. var polyfill = function(target, propertyKey, opt_receiver) {
  1631. if (arguments.length <= 2) {
  1632. return target[propertyKey];
  1633. }
  1634. var property = $jscomp.findDescriptor(target, propertyKey);
  1635. if (property) {
  1636. return property.get ? property.get.call(opt_receiver) : property.value;
  1637. }
  1638. return undefined;
  1639. };
  1640. return polyfill;
  1641. }, 'es6', 'es5');
  1642. $jscomp.polyfill('Reflect.has', function(orig) {
  1643. if (orig) {
  1644. return orig;
  1645. }
  1646. var polyfill = function(target, propertyKey) {
  1647. return propertyKey in target;
  1648. };
  1649. return polyfill;
  1650. }, 'es6', 'es3');
  1651. $jscomp.polyfill('Reflect.isExtensible', function(orig) {
  1652. if (orig) {
  1653. return orig;
  1654. }
  1655. if ($jscomp.ASSUME_ES5 || typeof Object.isExtensible == 'function') {
  1656. return Object.isExtensible;
  1657. }
  1658. return function() {
  1659. return true;
  1660. };
  1661. }, 'es6', 'es3');
  1662. $jscomp.polyfill('Reflect.preventExtensions', function(orig) {
  1663. if (orig) {
  1664. return orig;
  1665. }
  1666. if (!($jscomp.ASSUME_ES5 || typeof Object.preventExtensions == 'function')) {
  1667. return function() {
  1668. return false;
  1669. };
  1670. }
  1671. var polyfill = function(target) {
  1672. Object.preventExtensions(target);
  1673. return !Object.isExtensible(target);
  1674. };
  1675. return polyfill;
  1676. }, 'es6', 'es3');
  1677. $jscomp.polyfill('Reflect.set', function(orig) {
  1678. if (orig) {
  1679. return orig;
  1680. }
  1681. var polyfill = function(target, propertyKey, value, opt_receiver) {
  1682. var property = $jscomp.findDescriptor(target, propertyKey);
  1683. if (!property) {
  1684. if (Reflect.isExtensible(target)) {
  1685. target[propertyKey] = value;
  1686. return true;
  1687. }
  1688. return false;
  1689. }
  1690. if (property.set) {
  1691. property.set.call(arguments.length > 3 ? opt_receiver : target, value);
  1692. return true;
  1693. } else {
  1694. if (property.writable && !Object.isFrozen(target)) {
  1695. target[propertyKey] = value;
  1696. return true;
  1697. }
  1698. }
  1699. return false;
  1700. };
  1701. return polyfill;
  1702. }, 'es6', 'es5');
  1703. $jscomp.polyfill('Reflect.setPrototypeOf', function(orig) {
  1704. if (orig) {
  1705. return orig;
  1706. } else {
  1707. if ($jscomp.setPrototypeOf) {
  1708. var setPrototypeOf = $jscomp.setPrototypeOf;
  1709. var polyfill = function(target, proto) {
  1710. try {
  1711. setPrototypeOf(target, proto);
  1712. return true;
  1713. } catch (e) {
  1714. return false;
  1715. }
  1716. };
  1717. return polyfill;
  1718. } else {
  1719. return null;
  1720. }
  1721. }
  1722. }, 'es6', 'es5');
  1723. $jscomp.polyfill('Set', function(NativeSet) {
  1724. function isConformant() {
  1725. if ($jscomp.ASSUME_NO_NATIVE_SET || !NativeSet || typeof NativeSet != 'function' || !NativeSet.prototype.entries || typeof Object.seal != 'function') {
  1726. return false;
  1727. }
  1728. try {
  1729. NativeSet = NativeSet;
  1730. var value = Object.seal({x:4});
  1731. var set = new NativeSet($jscomp.makeIterator([value]));
  1732. if (!set.has(value) || set.size != 1 || set.add(value) != set || set.size != 1 || set.add({x:4}) != set || set.size != 2) {
  1733. return false;
  1734. }
  1735. var iter = set.entries();
  1736. var item = iter.next();
  1737. if (item.done || item.value[0] != value || item.value[1] != value) {
  1738. return false;
  1739. }
  1740. item = iter.next();
  1741. if (item.done || item.value[0] == value || item.value[0].x != 4 || item.value[1] != item.value[0]) {
  1742. return false;
  1743. }
  1744. return iter.next().done;
  1745. } catch (err) {
  1746. return false;
  1747. }
  1748. }
  1749. if ($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS) {
  1750. if (NativeSet && $jscomp.ES6_CONFORMANCE) {
  1751. return NativeSet;
  1752. }
  1753. } else {
  1754. if (isConformant()) {
  1755. return NativeSet;
  1756. }
  1757. }
  1758. $jscomp.initSymbol();
  1759. $jscomp.initSymbolIterator();
  1760. var PolyfillSet = function(opt_iterable) {
  1761. this.map_ = new Map;
  1762. if (opt_iterable) {
  1763. var iter = $jscomp.makeIterator(opt_iterable);
  1764. var entry;
  1765. while (!(entry = iter.next()).done) {
  1766. var item = entry.value;
  1767. this.add(item);
  1768. }
  1769. }
  1770. this.size = this.map_.size;
  1771. };
  1772. PolyfillSet.prototype.add = function(value) {
  1773. value = value === 0 ? 0 : value;
  1774. this.map_.set(value, value);
  1775. this.size = this.map_.size;
  1776. return this;
  1777. };
  1778. PolyfillSet.prototype['delete'] = function(value) {
  1779. var result = this.map_['delete'](value);
  1780. this.size = this.map_.size;
  1781. return result;
  1782. };
  1783. PolyfillSet.prototype.clear = function() {
  1784. this.map_.clear();
  1785. this.size = 0;
  1786. };
  1787. PolyfillSet.prototype.has = function(value) {
  1788. return this.map_.has(value);
  1789. };
  1790. PolyfillSet.prototype.entries = function() {
  1791. return this.map_.entries();
  1792. };
  1793. PolyfillSet.prototype.values = function() {
  1794. return this.map_.values();
  1795. };
  1796. PolyfillSet.prototype.keys = PolyfillSet.prototype.values;
  1797. PolyfillSet.prototype[Symbol.iterator] = PolyfillSet.prototype.values;
  1798. PolyfillSet.prototype.forEach = function(callback, opt_thisArg) {
  1799. var set = this;
  1800. this.map_.forEach(function(value) {
  1801. return callback.call(opt_thisArg, value, value, set);
  1802. });
  1803. };
  1804. return PolyfillSet;
  1805. }, 'es6', 'es3');
  1806. $jscomp.checkStringArgs = function(thisArg, arg, func) {
  1807. if (thisArg == null) {
  1808. throw new TypeError("The 'this' value for String.prototype." + func + ' must not be null or undefined');
  1809. }
  1810. if (arg instanceof RegExp) {
  1811. throw new TypeError('First argument to String.prototype.' + func + ' must not be a regular expression');
  1812. }
  1813. return thisArg + '';
  1814. };
  1815. $jscomp.polyfill('String.prototype.codePointAt', function(orig) {
  1816. if (orig) {
  1817. return orig;
  1818. }
  1819. var polyfill = function(position) {
  1820. var string = $jscomp.checkStringArgs(this, null, 'codePointAt');
  1821. var size = string.length;
  1822. position = Number(position) || 0;
  1823. if (!(position >= 0 && position < size)) {
  1824. return void 0;
  1825. }
  1826. position = position | 0;
  1827. var first = string.charCodeAt(position);
  1828. if (first < 55296 || first > 56319 || position + 1 === size) {
  1829. return first;
  1830. }
  1831. var second = string.charCodeAt(position + 1);
  1832. if (second < 56320 || second > 57343) {
  1833. return first;
  1834. }
  1835. return (first - 55296) * 1024 + second + 9216;
  1836. };
  1837. return polyfill;
  1838. }, 'es6', 'es3');
  1839. $jscomp.polyfill('String.prototype.endsWith', function(orig) {
  1840. if (orig) {
  1841. return orig;
  1842. }
  1843. var polyfill = function(searchString, opt_position) {
  1844. var string = $jscomp.checkStringArgs(this, searchString, 'endsWith');
  1845. searchString = searchString + '';
  1846. if (opt_position === void 0) {
  1847. opt_position = string.length;
  1848. }
  1849. var i = Math.max(0, Math.min(opt_position | 0, string.length));
  1850. var j = searchString.length;
  1851. while (j > 0 && i > 0) {
  1852. if (string[--i] != searchString[--j]) {
  1853. return false;
  1854. }
  1855. }
  1856. return j <= 0;
  1857. };
  1858. return polyfill;
  1859. }, 'es6', 'es3');
  1860. $jscomp.polyfill('String.fromCodePoint', function(orig) {
  1861. if (orig) {
  1862. return orig;
  1863. }
  1864. var polyfill = function(var_args) {
  1865. var result = '';
  1866. for (var i = 0; i < arguments.length; i++) {
  1867. var code = Number(arguments[i]);
  1868. if (code < 0 || code > 1114111 || code !== Math.floor(code)) {
  1869. throw new RangeError('invalid_code_point ' + code);
  1870. }
  1871. if (code <= 65535) {
  1872. result += String.fromCharCode(code);
  1873. } else {
  1874. code -= 65536;
  1875. result += String.fromCharCode(code >>> 10 & 1023 | 55296);
  1876. result += String.fromCharCode(code & 1023 | 56320);
  1877. }
  1878. }
  1879. return result;
  1880. };
  1881. return polyfill;
  1882. }, 'es6', 'es3');
  1883. $jscomp.polyfill('String.prototype.includes', function(orig) {
  1884. if (orig) {
  1885. return orig;
  1886. }
  1887. var polyfill = function(searchString, opt_position) {
  1888. var string = $jscomp.checkStringArgs(this, searchString, 'includes');
  1889. return string.indexOf(searchString, opt_position || 0) !== -1;
  1890. };
  1891. return polyfill;
  1892. }, 'es6', 'es3');
  1893. $jscomp.polyfill('String.prototype.repeat', function(orig) {
  1894. if (orig) {
  1895. return orig;
  1896. }
  1897. var polyfill = function(copies) {
  1898. var string = $jscomp.checkStringArgs(this, null, 'repeat');
  1899. if (copies < 0 || copies > 1342177279) {
  1900. throw new RangeError('Invalid count value');
  1901. }
  1902. copies = copies | 0;
  1903. var result = '';
  1904. while (copies) {
  1905. if (copies & 1) {
  1906. result += string;
  1907. }
  1908. if (copies >>>= 1) {
  1909. string += string;
  1910. }
  1911. }
  1912. return result;
  1913. };
  1914. return polyfill;
  1915. }, 'es6', 'es3');
  1916. $jscomp.stringPadding = function(padString, padLength) {
  1917. var padding = padString !== undefined ? String(padString) : ' ';
  1918. if (!(padLength > 0) || !padding) {
  1919. return '';
  1920. }
  1921. var repeats = Math.ceil(padLength / padding.length);
  1922. return padding.repeat(repeats).substring(0, padLength);
  1923. };
  1924. $jscomp.polyfill('String.prototype.padEnd', function(orig) {
  1925. if (orig) {
  1926. return orig;
  1927. }
  1928. var padEnd = function(targetLength, opt_padString) {
  1929. var string = $jscomp.checkStringArgs(this, null, 'padStart');
  1930. var padLength = targetLength - string.length;
  1931. return string + $jscomp.stringPadding(opt_padString, padLength);
  1932. };
  1933. return padEnd;
  1934. }, 'es8', 'es3');
  1935. $jscomp.polyfill('String.prototype.padStart', function(orig) {
  1936. if (orig) {
  1937. return orig;
  1938. }
  1939. var padStart = function(targetLength, opt_padString) {
  1940. var string = $jscomp.checkStringArgs(this, null, 'padStart');
  1941. var padLength = targetLength - string.length;
  1942. return $jscomp.stringPadding(opt_padString, padLength) + string;
  1943. };
  1944. return padStart;
  1945. }, 'es8', 'es3');
  1946. $jscomp.polyfill('String.prototype.startsWith', function(orig) {
  1947. if (orig) {
  1948. return orig;
  1949. }
  1950. var polyfill = function(searchString, opt_position) {
  1951. var string = $jscomp.checkStringArgs(this, searchString, 'startsWith');
  1952. searchString = searchString + '';
  1953. var strLen = string.length;
  1954. var searchLen = searchString.length;
  1955. var i = Math.max(0, Math.min(opt_position | 0, string.length));
  1956. var j = 0;
  1957. while (j < searchLen && i < strLen) {
  1958. if (string[i++] != searchString[j++]) {
  1959. return false;
  1960. }
  1961. }
  1962. return j >= searchLen;
  1963. };
  1964. return polyfill;
  1965. }, 'es6', 'es3');
  1966. $jscomp.arrayFromIterator = function(iterator) {
  1967. var i;
  1968. var arr = [];
  1969. while (!(i = iterator.next()).done) {
  1970. arr.push(i.value);
  1971. }
  1972. return arr;
  1973. };
  1974. $jscomp.arrayFromIterable = function(iterable) {
  1975. if (iterable instanceof Array) {
  1976. return iterable;
  1977. } else {
  1978. return $jscomp.arrayFromIterator($jscomp.makeIterator(iterable));
  1979. }
  1980. };
  1981. $jscomp.inherits = function(childCtor, parentCtor) {
  1982. childCtor.prototype = $jscomp.objectCreate(parentCtor.prototype);
  1983. childCtor.prototype.constructor = childCtor;
  1984. if ($jscomp.setPrototypeOf) {
  1985. var setPrototypeOf = $jscomp.setPrototypeOf;
  1986. setPrototypeOf(childCtor, parentCtor);
  1987. } else {
  1988. for (var p in parentCtor) {
  1989. if (p == 'prototype') {
  1990. continue;
  1991. }
  1992. if (Object.defineProperties) {
  1993. var descriptor = Object.getOwnPropertyDescriptor(parentCtor, p);
  1994. if (descriptor) {
  1995. Object.defineProperty(childCtor, p, descriptor);
  1996. }
  1997. } else {
  1998. childCtor[p] = parentCtor[p];
  1999. }
  2000. }
  2001. }
  2002. childCtor.superClass_ = parentCtor.prototype;
  2003. };
  2004. $jscomp.polyfill('WeakSet', function(NativeWeakSet) {
  2005. function isConformant() {
  2006. if (!NativeWeakSet || !Object.seal) {
  2007. return false;
  2008. }
  2009. try {
  2010. var x = Object.seal({});
  2011. var y = Object.seal({});
  2012. var set = new NativeWeakSet([x]);
  2013. if (!set.has(x) || set.has(y)) {
  2014. return false;
  2015. }
  2016. set['delete'](x);
  2017. set.add(y);
  2018. return !set.has(x) && set.has(y);
  2019. } catch (err) {
  2020. return false;
  2021. }
  2022. }
  2023. if ($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS) {
  2024. if (NativeWeakSet && $jscomp.ES6_CONFORMANCE) {
  2025. return NativeWeakSet;
  2026. }
  2027. } else {
  2028. if (isConformant()) {
  2029. return NativeWeakSet;
  2030. }
  2031. }
  2032. var PolyfillWeakSet = function(opt_iterable) {
  2033. this.map_ = new WeakMap;
  2034. if (opt_iterable) {
  2035. $jscomp.initSymbol();
  2036. $jscomp.initSymbolIterator();
  2037. var iter = $jscomp.makeIterator(opt_iterable);
  2038. var entry;
  2039. while (!(entry = iter.next()).done) {
  2040. var item = entry.value;
  2041. this.add(item);
  2042. }
  2043. }
  2044. };
  2045. PolyfillWeakSet.prototype.add = function(elem) {
  2046. this.map_.set(elem, true);
  2047. return this;
  2048. };
  2049. PolyfillWeakSet.prototype.has = function(elem) {
  2050. return this.map_.has(elem);
  2051. };
  2052. PolyfillWeakSet.prototype['delete'] = function(elem) {
  2053. return this.map_['delete'](elem);
  2054. };
  2055. return PolyfillWeakSet;
  2056. }, 'es6', 'es3');
  2057. try {
  2058. if (Array.prototype.values.toString().indexOf('[native code]') == -1) {
  2059. delete Array.prototype.values;
  2060. }
  2061. } catch (e) {
  2062. }
  2063. Ext.define('Ext.overrides.dom.Element', {override:'Ext.dom.Element', rippleShowTimeout:300});
  2064. Ext.define('Ext.theme.material.Widget', {override:'Ext.Widget', statics:{floatInset:16 / (window.devicePixelRatio || 1)}});
  2065. Ext.define('Ext.theme.material.list.Tree', {override:'Ext.list.Tree', config:{itemRipple:{release:true, delegate:'.' + Ext.baseCSSPrefix + 'treelist-row', color:'default'}}});
  2066. Ext.define('Ext.theme.material.Button', {override:'Ext.Button', config:{ripple:{delegate:'.' + Ext.baseCSSPrefix + 'inner-el'}}, materialIconRe:/^md-icon[-|_](.*)/, applyIconCls:function(classList) {
  2067. var len, i, cls, materialMatch;
  2068. if (classList) {
  2069. classList = Ext.dom.Element.splitCls(classList);
  2070. len = classList.length;
  2071. for (i = 0; i < len; i++) {
  2072. cls = classList[i];
  2073. materialMatch = cls && cls.match(this.materialIconRe);
  2074. if (materialMatch && materialMatch.length > 1) {
  2075. classList.unshift('md-icon');
  2076. break;
  2077. }
  2078. }
  2079. return classList.join(' ');
  2080. }
  2081. return classList;
  2082. }});
  2083. Ext.define('Ext.theme.material.Tool', {override:'Ext.Tool', config:{ripple:{bound:false, color:'default', centered:true}}});
  2084. Ext.define('Ext.theme.material.Panel', {override:'Ext.Panel', config:{buttonAlign:'right', buttonToolbar:{defaultButtonUI:null}}});
  2085. Ext.define('Ext.theme.material.menu.Item', {override:'Ext.menu.Item', config:{ripple:{delegate:'.' + Ext.baseCSSPrefix + 'body-el'}}, shouldRipple:function() {
  2086. var me = this, rippleDelay = me.el.rippleShowTimeout;
  2087. me.clickHideDelay = me.clickHideDelay > rippleDelay ? me.clickHideDelay : rippleDelay;
  2088. return this.getRipple();
  2089. }});
  2090. Ext.define('Ext.theme.material.menu.Menu', {override:'Ext.menu.Menu', config:{indented:false}});
  2091. Ext.define('Ext.theme.material.SplitButton', {override:'Ext.SplitButton', config:{splitRipple:{delegate:'.x-splitInner-el'}, arrowRipple:{delegate:'.x-splitArrow-el'}}, menuShowDelay:0, doDestroy:function() {
  2092. var me = this;
  2093. if (me.hasOwnProperty('menuShowTimeout')) {
  2094. Ext.undefer(me.menuShowTimeout);
  2095. }
  2096. me.callParent();
  2097. }});
  2098. Ext.define('Ext.theme.material.layout.overflow.Scroller', {override:'Ext.layout.overflow.Scroller', config:{backwardTool:{ripple:{centered:false, bound:true, diameterLimit:false}}, forwardTool:{ripple:{centered:false, bound:true, diameterLimit:false}}}});
  2099. Ext.define('Ext.theme.material.field.Field', {override:'Ext.field.Field', config:{labelAlign:'top'}});
  2100. Ext.define('Ext.theme.material.field.Text', {override:'Ext.field.Text', config:{labelAlign:'placeholder', animateUnderline:true}});
  2101. Ext.define('Ext.theme.neptune.Titlebar', {override:'Ext.TitleBar', config:{defaultButtonUI:'alt'}});
  2102. Ext.define('Ext.theme.material.TitleBar', {override:'Ext.TitleBar', config:{titleAlign:'left', defaultButtonUI:'alt'}});
  2103. Ext.define('Ext.theme.material.Toast', {override:'Ext.Toast', config:{alignment:'b-b'}});
  2104. Ext.define('Ext.theme.material.dataview.Abstract', {override:'Ext.dataview.Abstract', config:{itemRipple:{release:true, color:'default'}}});
  2105. Ext.define('Ext.theme.material.dataview.List', {override:'Ext.dataview.List', config:{rowLines:false}});
  2106. Ext.define('Ext.theme.material.dataview.IndexBar', {override:'Ext.dataview.IndexBar', config:{autoHide:true, letters:['*', '#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']}});
  2107. Ext.define('Ext.theme.material.dataview.NestedList', {override:'Ext.dataview.NestedList', config:{backText:'', useTitleAsBackText:false, backButton:{iconCls:'md-icon-arrow-back', hidden:true}}});
  2108. Ext.define('Ext.theme.material.dataview.pullrefresh.PullRefresh', {override:'Ext.dataview.pullrefresh.PullRefresh', config:{overlay:true, widget:{xtype:'pullrefreshspinner'}}});
  2109. Ext.define('Ext.theme.material.field.Checkbox', {override:'Ext.field.Checkbox', config:{labelAlign:'left', bodyAlign:'end', ripple:{delegate:'.' + Ext.baseCSSPrefix + 'icon-el', bound:false, color:'default'}}});
  2110. Ext.define('Ext.theme.neptune.panel.Date', {override:'Ext.panel.Date', border:true});
  2111. Ext.define('Ext.theme.material.panel.Date', {override:'Ext.panel.Date', config:{headerFormat:'D, M j', hideCaptions:false, hideOutside:true, navigationPosition:'caption', selectOnNavigate:false, showTodayButton:false, splitTitle:true, titleAnimation:false, tools:{previousYear:null, nextYear:null}}});
  2112. Ext.define('Ext.theme.material.field.Date', {override:'Ext.field.Date', config:{floatedPicker:{selectOnNavigate:true, header:{hidden:true}}}});
  2113. Ext.define('Ext.theme.material.form.Borders', {override:'Ext.form.Borders', config:{fieldSeparators:false, inputBorders:true}});
  2114. Ext.define('Ext.theme.material.field.Toggle', {override:'Ext.field.Toggle', config:{ripple:{delegate:'.' + Ext.baseCSSPrefix + 'thumb', bound:false, fit:false, color:'default'}}});
  2115. Ext.define('Ext.theme.material.grid.cell.Check', {override:'Ext.grid.cell.Check', config:{ripple:{delegate:'.' + Ext.baseCSSPrefix + 'checkbox-el', bound:false, color:'default', centered:true}}});
  2116. Ext.define('Ext.theme.material.grid.Grid', {override:'Ext.grid.Grid', config:{rowLines:true, striped:false}});
  2117. Ext.define('Ext.theme.material.navigation.Bar', {override:'Ext.navigation.Bar', config:{defaultBackButtonText:'', useTitleForBackButtonText:false, backButton:{align:'left', ui:'back', hidden:true, iconCls:'md-icon-arrow-back'}}});
  2118. Ext.define('Ext.theme.material.panel.Header', {override:'Ext.panel.Header', config:{titleAlign:'left'}});
  2119. Ext.define('Ext.theme.material.tab.Tab', {override:'Ext.tab.Tab', config:{iconAlign:'top', flex:1}, platformConfig:{desktop:{maxWidth:200}}});
  2120. Ext.define('Ext.theme.material.tab.Bar', {override:'Ext.tab.Bar', config:{animateIndicator:true}, platformConfig:{desktop:{layout:{pack:'center'}}}});
  2121. Ext.namespace('Ext.theme.is').Neptune = true;
  2122. Ext.theme.name = 'Neptune';
  2123. Ext.theme.getDocCls = function() {
  2124. return Ext.platformTags.desktop ? '' : 'x-big';
  2125. };
  2126. Ext.define('Ext.theme.Material', {singleton:true, _autoUpdateMeta:true, _defaultWeight:'500', _colors:{'red':{50:'#ffebee', 100:'#ffcdd2', 200:'#ef9a9a', 300:'#e57373', 400:'#ef5350', 500:'#f44336', 600:'#e53935', 700:'#d32f2f', 800:'#c62828', 900:'#b71c1c', 'a100':'#ff8a80', 'a200':'#ff5252', 'a400':'#ff1744', 'a700':'#d50000'}, 'pink':{50:'#fce4ec', 100:'#f8bbd0', 200:'#f48fb1', 300:'#f06292', 400:'#ec407a', 500:'#e91e63', 600:'#d81b60', 700:'#c2185b', 800:'#ad1457', 900:'#880e4f', 'a100':'#ff80ab',
  2127. 'a200':'#ff4081', 'a400':'#f50057', 'a700':'#c51162'}, 'purple':{50:'#f3e5f5', 100:'#e1bee7', 200:'#ce93d8', 300:'#ba68c8', 400:'#ab47bc', 500:'#9c27b0', 600:'#8e24aa', 700:'#7b1fa2', 800:'#6a1b9a', 900:'#4a148c', 'a100':'#ea80fc', 'a200':'#e040fb', 'a400':'#d500f9', 'a700':'#aa00ff'}, 'deep-purple':{50:'#ede7f6', 100:'#d1c4e9', 200:'#b39ddb', 300:'#9575cd', 400:'#7e57c2', 500:'#673ab7', 600:'#5e35b1', 700:'#512da8', 800:'#4527a0', 900:'#311b92', 'a100':'#b388ff', 'a200':'#7c4dff', 'a400':'#651fff',
  2128. 'a700':'#6200ea'}, 'indigo':{50:'#e8eaf6', 100:'#c5cae9', 200:'#9fa8da', 300:'#7986cb', 400:'#5c6bc0', 500:'#3f51b5', 600:'#3949ab', 700:'#303f9f', 800:'#283593', 900:'#1a237e', 'a100':'#8c9eff', 'a200':'#536dfe', 'a400':'#3d5afe', 'a700':'#304ffe'}, 'blue':{50:'#e3f2fd', 100:'#bbdefb', 200:'#90caf9', 300:'#64b5f6', 400:'#42a5f5', 500:'#2196f3', 600:'#1e88e5', 700:'#1976d2', 800:'#1565c0', 900:'#0d47a1', 'a100':'#82b1ff', 'a200':'#448aff', 'a400':'#2979ff', 'a700':'#2962ff'}, 'light-blue':{50:'#e1f5fe',
  2129. 100:'#b3e5fc', 200:'#81d4fa', 300:'#4fc3f7', 400:'#29b6f6', 500:'#03a9f4', 600:'#039be5', 700:'#0288d1', 800:'#0277bd', 900:'#01579b', 'a100':'#80d8ff', 'a200':'#40c4ff', 'a400':'#00b0ff', 'a700':'#0091ea'}, 'cyan':{50:'#e0f7fa', 100:'#b2ebf2', 200:'#80deea', 300:'#4dd0e1', 400:'#26c6da', 500:'#00bcd4', 600:'#00acc1', 700:'#0097a7', 800:'#00838f', 900:'#006064', 'a100':'#84ffff', 'a200':'#18ffff', 'a400':'#00e5ff', 'a700':'#00b8d4'}, 'teal':{50:'#e0f2f1', 100:'#b2dfdb', 200:'#80cbc4', 300:'#4db6ac',
  2130. 400:'#26a69a', 500:'#009688', 600:'#00897b', 700:'#00796b', 800:'#00695c', 900:'#004d40', 'a100':'#a7ffeb', 'a200':'#64ffda', 'a400':'#1de9b6', 'a700':'#00bfa5'}, 'green':{50:'#e8f5e9', 100:'#c8e6c9', 200:'#a5d6a7', 300:'#81c784', 400:'#66bb6a', 500:'#4caf50', 600:'#43a047', 700:'#388e3c', 800:'#2e7d32', 900:'#1b5e20', 'a100':'#b9f6ca', 'a200':'#69f0ae', 'a400':'#00e676', 'a700':'#00c853'}, 'light-green':{50:'#f1f8e9', 100:'#dcedc8', 200:'#c5e1a5', 300:'#aed581', 400:'#9ccc65', 500:'#8bc34a', 600:'#7cb342',
  2131. 700:'#689f38', 800:'#558b2f', 900:'#33691e', 'a100':'#ccff90', 'a200':'#b2ff59', 'a400':'#76ff03', 'a700':'#64dd17'}, 'lime':{50:'#f9fbe7', 100:'#f0f4c3', 200:'#e6ee9c', 300:'#dce775', 400:'#d4e157', 500:'#cddc39', 600:'#c0ca33', 700:'#afb42b', 800:'#9e9d24', 900:'#827717', 'a100':'#f4ff81', 'a200':'#eeff41', 'a400':'#c6ff00', 'a700':'#aeea00'}, 'yellow':{50:'#fffde7', 100:'#fff9c4', 200:'#fff59d', 300:'#fff176', 400:'#ffee58', 500:'#ffeb3b', 600:'#fdd835', 700:'#fbc02d', 800:'#f9a825', 900:'#f57f17',
  2132. 'a100':'#ffff8d', 'a200':'#ffff00', 'a400':'#ffea00', 'a700':'#ffd600'}, 'amber':{50:'#fff8e1', 100:'#ffecb3', 200:'#ffe082', 300:'#ffd54f', 400:'#ffca28', 500:'#ffc107', 600:'#ffb300', 700:'#ffa000', 800:'#ff8f00', 900:'#ff6f00', 'a100':'#ffe57f', 'a200':'#ffd740', 'a400':'#ffc400', 'a700':'#ffab00'}, 'orange':{50:'#fff3e0', 100:'#ffe0b2', 200:'#ffcc80', 300:'#ffb74d', 400:'#ffa726', 500:'#ff9800', 600:'#fb8c00', 700:'#f57c00', 800:'#ef6c00', 900:'#e65100', 'a100':'#ffd180', 'a200':'#ffab40', 'a400':'#ff9100',
  2133. 'a700':'#ff6d00'}, 'deep-orange':{50:'#fbe9e7', 100:'#ffccbc', 200:'#ffab91', 300:'#ff8a65', 400:'#ff7043', 500:'#ff5722', 600:'#f4511e', 700:'#e64a19', 800:'#d84315', 900:'#bf360c', 'a100':'#ff9e80', 'a200':'#ff6e40', 'a400':'#ff3d00', 'a700':'#dd2c00'}, 'brown':{50:'#efebe9', 100:'#d7ccc8', 200:'#bcaaa4', 300:'#a1887f', 400:'#8d6e63', 500:'#795548', 600:'#6d4c41', 700:'#5d4037', 800:'#4e342e', 900:'#3e2723'}, 'grey':{50:'#fafafa', 100:'#f5f5f5', 200:'#eeeeee', 300:'#e0e0e0', 400:'#bdbdbd', 500:'#9e9e9e',
  2134. 600:'#757575', 700:'#616161', 800:'#424242', 900:'#212121'}, 'blue-grey':{50:'#eceff1', 100:'#cfd8dc', 200:'#b0bec5', 300:'#90a4ae', 400:'#78909c', 500:'#607d8b', 600:'#546e7a', 700:'#455a64', 800:'#37474f', 900:'#263238', 1E3:'#11171a'}}, hasFashion:function() {
  2135. return !!window.Fashion && !!Fashion.css && Fashion.css.setVariables;
  2136. }, setAutoUpdateMeta:function(value) {
  2137. this._autoUpdateMeta = value;
  2138. }, getAutoUpdateMeta:function() {
  2139. return this._autoUpdateMeta;
  2140. }, getDefaultWeight:function() {
  2141. return this._defaultWeight;
  2142. }, setDarkMode:function(value) {
  2143. if (!this.hasFashion()) {
  2144. Ext.Logger.warn('Fashion was not found and is required to set CSS Variables for Material Theme');
  2145. return;
  2146. }
  2147. Fashion.css.setVariables({'dark-mode':value ? 'true' : 'false'});
  2148. }, setColors:function(colorsConfig) {
  2149. var obj = {}, baseColor, accentColor;
  2150. if (!this.hasFashion()) {
  2151. Ext.Logger.warn('Fashion was not found and is required to set CSS Variables for Material Theme');
  2152. return;
  2153. }
  2154. colorsConfig = Ext.merge({baseWeight:this.getDefaultWeight(), accentWeight:this.getDefaultWeight()}, colorsConfig);
  2155. baseColor = this._colors[colorsConfig.base];
  2156. accentColor = this._colors[colorsConfig.accent];
  2157. if (baseColor) {
  2158. if (baseColor[colorsConfig.baseWeight]) {
  2159. obj['base-color-name'] = colorsConfig.base;
  2160. if (this.getAutoUpdateMeta()) {
  2161. this.updateMetaThemeColor(colorsConfig.base, colorsConfig.baseWeight);
  2162. }
  2163. } else {
  2164. Ext.Logger.warn('Base color weight: ' + colorsConfig.baseWeight + ' is not a valid weight', this);
  2165. }
  2166. } else {
  2167. if (colorsConfig.base) {
  2168. Ext.Logger.warn('Base color: ' + colorsConfig.base + ' is not a valid material color', this);
  2169. }
  2170. }
  2171. if (accentColor) {
  2172. if (accentColor[colorsConfig.accentWeight]) {
  2173. obj['accent-color-name'] = colorsConfig.accent;
  2174. } else {
  2175. Ext.Logger.warn('Accent color weight: ' + colorsConfig.accentWeight + ' is not a valid weight', this);
  2176. }
  2177. } else {
  2178. if (colorsConfig.accent) {
  2179. Ext.Logger.warn('Accent color: ' + colorsConfig.accent + ' is not a valid material color', this);
  2180. }
  2181. }
  2182. if (colorsConfig.darkMode !== null) {
  2183. obj['dark-mode'] = colorsConfig.darkMode ? 'true' : 'false';
  2184. }
  2185. Fashion.css.setVariables(obj);
  2186. }, updateMetaThemeColor:function(colorName, weight) {
  2187. var color = this._colors[colorName], toolbarIsDynamic = Ext.manifest.material.toolbar.dynamic, meta;
  2188. if (!weight) {
  2189. weight = this.getDefaultWeight();
  2190. }
  2191. if (Ext.platformTags.android && Ext.platformTags.chrome && toolbarIsDynamic && color) {
  2192. color = color[weight];
  2193. meta = Ext.query('meta[name\x3d"theme-color"]')[0];
  2194. if (meta) {
  2195. meta.setAttribute('content', color);
  2196. }
  2197. }
  2198. }, getColors:function() {
  2199. return this._colors;
  2200. }});
  2201. var color, toolbarIsDynamic, head, meta;
  2202. Ext.require('Ext.theme.Material');
  2203. if (Ext.platformTags.android && Ext.platformTags.chrome && Ext.manifest.material && Ext.manifest.material.toolbar) {
  2204. color = Ext.manifest.material.toolbar.color;
  2205. toolbarIsDynamic = Ext.manifest.material.toolbar.dynamic;
  2206. head = document.head;
  2207. if (toolbarIsDynamic && Ext.supports.CSSVariables) {
  2208. color = getComputedStyle(document.body).getPropertyValue('--primary-color-md');
  2209. color = color.replace(/ /g, '').replace(/^#(?:\\3)?/, '#');
  2210. }
  2211. if (color) {
  2212. meta = document.createElement('meta');
  2213. meta.setAttribute('name', 'theme-color');
  2214. meta.setAttribute('content', color);
  2215. head.appendChild(meta);
  2216. }
  2217. }
  2218. Ext.namespace('Ext.theme.is').Material = true;
  2219. Ext.theme.name = 'Material';