index.js 187 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929
  1. /*
  2. Copyright (C) 2016 Timofey Kachalov <[email protected]>
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions are met:
  5. * Redistributions of source code must retain the above copyright
  6. notice, this list of conditions and the following disclaimer.
  7. * Redistributions in binary form must reproduce the above copyright
  8. notice, this list of conditions and the following disclaimer in the
  9. documentation and/or other materials provided with the distribution.
  10. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  11. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  12. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  13. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  14. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  15. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  16. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  17. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  18. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  19. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  20. */
  21. require("source-map-support").install();
  22. module.exports =
  23. /******/ (function(modules) { // webpackBootstrap
  24. /******/ // The module cache
  25. /******/ var installedModules = {};
  26. /******/
  27. /******/ // The require function
  28. /******/ function __webpack_require__(moduleId) {
  29. /******/
  30. /******/ // Check if module is in cache
  31. /******/ if(installedModules[moduleId])
  32. /******/ return installedModules[moduleId].exports;
  33. /******/
  34. /******/ // Create a new module (and put it into the cache)
  35. /******/ var module = installedModules[moduleId] = {
  36. /******/ i: moduleId,
  37. /******/ l: false,
  38. /******/ exports: {}
  39. /******/ };
  40. /******/
  41. /******/ // Execute the module function
  42. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  43. /******/
  44. /******/ // Flag the module as loaded
  45. /******/ module.l = true;
  46. /******/
  47. /******/ // Return the exports of the module
  48. /******/ return module.exports;
  49. /******/ }
  50. /******/
  51. /******/
  52. /******/ // expose the modules object (__webpack_modules__)
  53. /******/ __webpack_require__.m = modules;
  54. /******/
  55. /******/ // expose the module cache
  56. /******/ __webpack_require__.c = installedModules;
  57. /******/
  58. /******/ // identity function for calling harmory imports with the correct context
  59. /******/ __webpack_require__.i = function(value) { return value; };
  60. /******/
  61. /******/ // define getter function for harmory exports
  62. /******/ __webpack_require__.d = function(exports, name, getter) {
  63. /******/ Object.defineProperty(exports, name, {
  64. /******/ configurable: false,
  65. /******/ enumerable: true,
  66. /******/ get: getter
  67. /******/ });
  68. /******/ };
  69. /******/
  70. /******/ // getDefaultExport function for compatibility with non-harmony modules
  71. /******/ __webpack_require__.n = function(module) {
  72. /******/ var getter = module && module.__esModule ?
  73. /******/ function getDefault() { return module['default']; } :
  74. /******/ function getModuleExports() { return module; };
  75. /******/ __webpack_require__.d(getter, 'a', getter);
  76. /******/ return getter;
  77. /******/ };
  78. /******/
  79. /******/ // Object.prototype.hasOwnProperty.call
  80. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  81. /******/
  82. /******/ // __webpack_public_path__
  83. /******/ __webpack_require__.p = "";
  84. /******/
  85. /******/ // Load entry module and return exports
  86. /******/ return __webpack_require__(__webpack_require__.s = 80);
  87. /******/ })
  88. /************************************************************************/
  89. /******/ ([
  90. /* 0 */
  91. /***/ function(module, exports, __webpack_require__) {
  92. "use strict";
  93. "use strict";
  94. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  95. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  96. var chance_1 = __webpack_require__(75);
  97. var JSFuck_1 = __webpack_require__(19);
  98. var Utils = function () {
  99. function Utils() {
  100. _classCallCheck(this, Utils);
  101. }
  102. _createClass(Utils, null, [{
  103. key: 'arrayContains',
  104. value: function arrayContains(array, searchElement) {
  105. return array.indexOf(searchElement) >= 0;
  106. }
  107. }, {
  108. key: 'arrayRotate',
  109. value: function arrayRotate(array, times) {
  110. if (!array.length) {
  111. throw new ReferenceError('Cannot rotate empty array.');
  112. }
  113. if (times <= 0) {
  114. return array;
  115. }
  116. var newArray = array,
  117. temp = void 0;
  118. while (times--) {
  119. temp = newArray.pop();
  120. newArray.unshift(temp);
  121. }
  122. return newArray;
  123. }
  124. }, {
  125. key: 'btoa',
  126. value: function btoa(string) {
  127. var encode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  128. return new Buffer(encode ? encodeURI(string) : string).toString('base64');
  129. }
  130. }, {
  131. key: 'decToHex',
  132. value: function decToHex(dec) {
  133. var radix = 16;
  134. return Number(dec).toString(radix);
  135. }
  136. }, {
  137. key: 'extractDomainFromUrl',
  138. value: function extractDomainFromUrl(url) {
  139. var domain = void 0;
  140. if (url.indexOf('://') > -1 || url.indexOf('//') === 0) {
  141. domain = url.split('/')[2];
  142. } else {
  143. domain = url.split('/')[0];
  144. }
  145. domain = domain.split(':')[0];
  146. return domain;
  147. }
  148. }, {
  149. key: 'getRandomGenerator',
  150. value: function getRandomGenerator() {
  151. return Utils.randomGenerator;
  152. }
  153. }, {
  154. key: 'getRandomVariableName',
  155. value: function getRandomVariableName() {
  156. var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6;
  157. var rangeMinInteger = 10000,
  158. rangeMaxInteger = 99999999,
  159. prefix = '_0x';
  160. return '' + prefix + Utils.decToHex(Utils.getRandomGenerator().integer({
  161. min: rangeMinInteger,
  162. max: rangeMaxInteger
  163. })).substr(0, length);
  164. }
  165. }, {
  166. key: 'hideString',
  167. value: function hideString(str, length) {
  168. var escapeRegExp = function escapeRegExp(s) {
  169. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  170. };
  171. var randomMerge = function randomMerge(s1, s2) {
  172. var i1 = -1,
  173. i2 = -1,
  174. result = '';
  175. while (i1 < s1.length || i2 < s2.length) {
  176. if (Math.random() < 0.5 && i2 < s2.length) {
  177. result += s2.charAt(++i2);
  178. } else {
  179. result += s1.charAt(++i1);
  180. }
  181. }
  182. return result;
  183. };
  184. var customPool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
  185. var randomString = Utils.randomGenerator.string({ length: length, pool: customPool }),
  186. randomStringDiff = randomString.replace(new RegExp('[' + escapeRegExp(str) + ']', 'g'), ''),
  187. randomStringDiffArray = randomStringDiff.split('');
  188. Utils.randomGenerator.shuffle(randomStringDiffArray);
  189. randomStringDiff = randomStringDiffArray.join('');
  190. return [randomMerge(str, randomStringDiff), randomStringDiff];
  191. }
  192. }, {
  193. key: 'isInteger',
  194. value: function isInteger(number) {
  195. return number % 1 === 0;
  196. }
  197. }, {
  198. key: 'strEnumify',
  199. value: function strEnumify(obj) {
  200. return obj;
  201. }
  202. }, {
  203. key: 'stringToJSFuck',
  204. value: function stringToJSFuck(string) {
  205. return Array.from(string).map(function (character) {
  206. return JSFuck_1.JSFuck[character] || character;
  207. }).join(' + ');
  208. }
  209. }, {
  210. key: 'stringToUnicode',
  211. value: function stringToUnicode(string) {
  212. var radix = 16;
  213. var prefix = void 0,
  214. regexp = new RegExp('[\x00-\x7F]'),
  215. template = void 0;
  216. return '\'' + string.replace(/[\s\S]/g, function (escape) {
  217. if (regexp.test(escape)) {
  218. prefix = '\\x';
  219. template = '0'.repeat(2);
  220. } else {
  221. prefix = '\\u';
  222. template = '0'.repeat(4);
  223. }
  224. return '' + prefix + (template + escape.charCodeAt(0).toString(radix)).slice(-template.length);
  225. }) + '\'';
  226. }
  227. }]);
  228. return Utils;
  229. }();
  230. Utils.randomGenerator = new chance_1.Chance();
  231. exports.Utils = Utils;
  232. /***/ },
  233. /* 1 */
  234. /***/ function(module, exports, __webpack_require__) {
  235. "use strict";
  236. "use strict";
  237. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  238. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  239. var escodegen = __webpack_require__(11);
  240. var esprima = __webpack_require__(22);
  241. var estraverse = __webpack_require__(3);
  242. var NodeType_1 = __webpack_require__(6);
  243. var Nodes_1 = __webpack_require__(2);
  244. var Utils_1 = __webpack_require__(0);
  245. var NodeUtils = function () {
  246. function NodeUtils() {
  247. _classCallCheck(this, NodeUtils);
  248. }
  249. _createClass(NodeUtils, null, [{
  250. key: 'addXVerbatimPropertyToLiterals',
  251. value: function addXVerbatimPropertyToLiterals(node) {
  252. NodeUtils.typedReplace(node, NodeType_1.NodeType.Literal, {
  253. leave: function leave(node) {
  254. node['x-verbatim-property'] = {
  255. content: node.raw,
  256. precedence: escodegen.Precedence.Primary
  257. };
  258. }
  259. });
  260. }
  261. }, {
  262. key: 'appendNode',
  263. value: function appendNode(blockScopeBody, node) {
  264. if (!NodeUtils.validateNode(node)) {
  265. return;
  266. }
  267. blockScopeBody.push(node);
  268. }
  269. }, {
  270. key: 'convertCodeToStructure',
  271. value: function convertCodeToStructure(code) {
  272. var getBlockStatementNodeByIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  273. var structure = esprima.parse(code);
  274. NodeUtils.addXVerbatimPropertyToLiterals(structure);
  275. NodeUtils.parentize(structure);
  276. if (!getBlockStatementNodeByIndex) {
  277. return structure;
  278. }
  279. return NodeUtils.getBlockStatementNodeByIndex(structure);
  280. }
  281. }, {
  282. key: 'getBlockStatementNodeByIndex',
  283. value: function getBlockStatementNodeByIndex(node) {
  284. var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  285. if (Nodes_1.Nodes.isNodeHasBlockStatement(node)) {
  286. if (node.body[index] === undefined) {
  287. throw new ReferenceError('Wrong index `' + index + '`. Block-statement body length is `' + node.body.length + '`');
  288. }
  289. return node.body[index];
  290. }
  291. throw new TypeError('The specified node have no a block-statement');
  292. }
  293. }, {
  294. key: 'getBlockScopeOfNode',
  295. value: function getBlockScopeOfNode(node) {
  296. var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  297. var parentNode = node.parentNode;
  298. if (!parentNode) {
  299. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  300. }
  301. if (Nodes_1.Nodes.isBlockStatementNode(parentNode)) {
  302. if (!parentNode.parentNode) {
  303. throw new ReferenceError('`parentNode` property of `parentNode` of given node is `undefined`');
  304. }
  305. if (!Utils_1.Utils.arrayContains(NodeUtils.nodesWithBlockScope, parentNode.parentNode.type)) {
  306. return NodeUtils.getBlockScopeOfNode(parentNode, depth);
  307. } else if (depth > 0) {
  308. return NodeUtils.getBlockScopeOfNode(parentNode, --depth);
  309. }
  310. return parentNode;
  311. }
  312. if (Nodes_1.Nodes.isProgramNode(parentNode)) {
  313. return parentNode;
  314. }
  315. return NodeUtils.getBlockScopeOfNode(parentNode);
  316. }
  317. }, {
  318. key: 'insertNodeAtIndex',
  319. value: function insertNodeAtIndex(blockScopeBody, node, index) {
  320. if (!NodeUtils.validateNode(node)) {
  321. return;
  322. }
  323. blockScopeBody.splice(index, 0, node);
  324. }
  325. }, {
  326. key: 'parentize',
  327. value: function parentize(node) {
  328. var isRootNode = true;
  329. estraverse.replace(node, {
  330. enter: function enter(node, parentNode) {
  331. var value = void 0;
  332. if (isRootNode) {
  333. if (node.type === NodeType_1.NodeType.Program) {
  334. value = node;
  335. } else {
  336. value = Nodes_1.Nodes.getProgramNode([node]);
  337. value['parentNode'] = value;
  338. }
  339. isRootNode = false;
  340. } else {
  341. value = parentNode || node;
  342. }
  343. node['parentNode'] = value;
  344. node['obfuscated'] = false;
  345. }
  346. });
  347. }
  348. }, {
  349. key: 'prependNode',
  350. value: function prependNode(blockScopeBody, node) {
  351. if (!NodeUtils.validateNode(node)) {
  352. return;
  353. }
  354. blockScopeBody.unshift(node);
  355. }
  356. }, {
  357. key: 'typedReplace',
  358. value: function typedReplace(node, nodeType, visitor) {
  359. NodeUtils.typedTraverse(node, nodeType, visitor, 'replace');
  360. }
  361. }, {
  362. key: 'typedTraverse',
  363. value: function typedTraverse(node, nodeType, visitor) {
  364. var traverseType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'traverse';
  365. estraverse[traverseType](node, {
  366. enter: function enter(node, parentNode) {
  367. if (node.type === nodeType && visitor.enter) {
  368. visitor.enter(node, parentNode);
  369. }
  370. },
  371. leave: function leave(node, parentNode) {
  372. if (node.type === nodeType && visitor.leave) {
  373. visitor.leave(node, parentNode);
  374. }
  375. }
  376. });
  377. }
  378. }, {
  379. key: 'validateNode',
  380. value: function validateNode(node) {
  381. return !!node && node.hasOwnProperty('type');
  382. }
  383. }]);
  384. return NodeUtils;
  385. }();
  386. NodeUtils.nodesWithBlockScope = [NodeType_1.NodeType.ArrowFunctionExpression, NodeType_1.NodeType.FunctionDeclaration, NodeType_1.NodeType.FunctionExpression, NodeType_1.NodeType.MethodDefinition, NodeType_1.NodeType.Program];
  387. exports.NodeUtils = NodeUtils;
  388. /***/ },
  389. /* 2 */
  390. /***/ function(module, exports, __webpack_require__) {
  391. "use strict";
  392. "use strict";
  393. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  394. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  395. var NodeType_1 = __webpack_require__(6);
  396. var Nodes = function () {
  397. function Nodes() {
  398. _classCallCheck(this, Nodes);
  399. }
  400. _createClass(Nodes, null, [{
  401. key: 'getProgramNode',
  402. value: function getProgramNode(bodyNode) {
  403. return {
  404. 'type': NodeType_1.NodeType.Program,
  405. 'body': bodyNode,
  406. 'sourceType': 'script',
  407. 'obfuscated': false
  408. };
  409. }
  410. }, {
  411. key: 'isArrowFunctionExpressionNode',
  412. value: function isArrowFunctionExpressionNode(node) {
  413. return node.type === NodeType_1.NodeType.ArrowFunctionExpression;
  414. }
  415. }, {
  416. key: 'isBlockStatementNode',
  417. value: function isBlockStatementNode(node) {
  418. return node.type === NodeType_1.NodeType.BlockStatement;
  419. }
  420. }, {
  421. key: 'isCallExpressionNode',
  422. value: function isCallExpressionNode(node) {
  423. return node.type === NodeType_1.NodeType.CallExpression;
  424. }
  425. }, {
  426. key: 'isExpressionStatementNode',
  427. value: function isExpressionStatementNode(node) {
  428. return node.type === NodeType_1.NodeType.ExpressionStatement;
  429. }
  430. }, {
  431. key: 'isFunctionDeclarationNode',
  432. value: function isFunctionDeclarationNode(node) {
  433. return node.type === NodeType_1.NodeType.FunctionDeclaration;
  434. }
  435. }, {
  436. key: 'isFunctionExpressionNode',
  437. value: function isFunctionExpressionNode(node) {
  438. return node.type === NodeType_1.NodeType.FunctionExpression;
  439. }
  440. }, {
  441. key: 'isIdentifierNode',
  442. value: function isIdentifierNode(node) {
  443. return node.type === NodeType_1.NodeType.Identifier;
  444. }
  445. }, {
  446. key: 'isLiteralNode',
  447. value: function isLiteralNode(node) {
  448. return node.type === NodeType_1.NodeType.Literal;
  449. }
  450. }, {
  451. key: 'isMemberExpressionNode',
  452. value: function isMemberExpressionNode(node) {
  453. return node.type === NodeType_1.NodeType.MemberExpression;
  454. }
  455. }, {
  456. key: 'isProgramNode',
  457. value: function isProgramNode(node) {
  458. return node.type === NodeType_1.NodeType.Program;
  459. }
  460. }, {
  461. key: 'isPropertyNode',
  462. value: function isPropertyNode(node) {
  463. return node.type === NodeType_1.NodeType.Property;
  464. }
  465. }, {
  466. key: 'isReplaceableIdentifierNode',
  467. value: function isReplaceableIdentifierNode(node, parentNode) {
  468. if (!Nodes.isIdentifierNode(node)) {
  469. return false;
  470. }
  471. var parentNodeIsPropertyNode = Nodes.isPropertyNode(parentNode) && parentNode.key === node;
  472. var parentNodeIsMemberExpressionNode = Nodes.isMemberExpressionNode(parentNode) && parentNode.computed === false && parentNode.property === node;
  473. return !parentNodeIsPropertyNode && !parentNodeIsMemberExpressionNode;
  474. }
  475. }, {
  476. key: 'isVariableDeclarationNode',
  477. value: function isVariableDeclarationNode(node) {
  478. return node.type === NodeType_1.NodeType.VariableDeclaration;
  479. }
  480. }, {
  481. key: 'isVariableDeclaratorNode',
  482. value: function isVariableDeclaratorNode(node) {
  483. return node.type === NodeType_1.NodeType.VariableDeclarator;
  484. }
  485. }, {
  486. key: 'isNodeHasBlockStatement',
  487. value: function isNodeHasBlockStatement(node) {
  488. return node.hasOwnProperty('body') && Array.isArray(node.body);
  489. }
  490. }]);
  491. return Nodes;
  492. }();
  493. exports.Nodes = Nodes;
  494. /***/ },
  495. /* 3 */
  496. /***/ function(module, exports) {
  497. module.exports = require("estraverse");
  498. /***/ },
  499. /* 4 */
  500. /***/ function(module, exports) {
  501. "use strict";
  502. "use strict";
  503. (function (AppendState) {
  504. AppendState[AppendState["AfterObfuscation"] = 0] = "AfterObfuscation";
  505. AppendState[AppendState["BeforeObfuscation"] = 1] = "BeforeObfuscation";
  506. })(exports.AppendState || (exports.AppendState = {}));
  507. var AppendState = exports.AppendState;
  508. /***/ },
  509. /* 5 */
  510. /***/ function(module, exports) {
  511. "use strict";
  512. "use strict";
  513. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  514. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  515. var AbstractCustomNode = function () {
  516. function AbstractCustomNode(options) {
  517. _classCallCheck(this, AbstractCustomNode);
  518. this.options = options;
  519. }
  520. _createClass(AbstractCustomNode, [{
  521. key: "getAppendState",
  522. value: function getAppendState() {
  523. return this.appendState;
  524. }
  525. }, {
  526. key: "getNode",
  527. value: function getNode() {
  528. return this.getNodeStructure();
  529. }
  530. }]);
  531. return AbstractCustomNode;
  532. }();
  533. exports.AbstractCustomNode = AbstractCustomNode;
  534. /***/ },
  535. /* 6 */
  536. /***/ function(module, exports, __webpack_require__) {
  537. "use strict";
  538. "use strict";
  539. var Utils_1 = __webpack_require__(0);
  540. exports.NodeType = Utils_1.Utils.strEnumify({
  541. ArrayExpression: 'ArrayExpression',
  542. ArrowFunctionExpression: 'ArrowFunctionExpression',
  543. AssignmentExpression: 'AssignmentExpression',
  544. BinaryExpression: 'BinaryExpression',
  545. BlockStatement: 'BlockStatement',
  546. CallExpression: 'CallExpression',
  547. CatchClause: 'CatchClause',
  548. ClassDeclaration: 'ClassDeclaration',
  549. ExpressionStatement: 'ExpressionStatement',
  550. FunctionDeclaration: 'FunctionDeclaration',
  551. FunctionExpression: 'FunctionExpression',
  552. Identifier: 'Identifier',
  553. IfStatement: 'IfStatement',
  554. Literal: 'Literal',
  555. LogicalExpression: 'LogicalExpression',
  556. MemberExpression: 'MemberExpression',
  557. MethodDefinition: 'MethodDefinition',
  558. ObjectExpression: 'ObjectExpression',
  559. Program: 'Program',
  560. Property: 'Property',
  561. ReturnStatement: 'ReturnStatement',
  562. TryStatement: 'TryStatement',
  563. UnaryExpression: 'UnaryExpression',
  564. UpdateExpression: 'UpdateExpression',
  565. VariableDeclaration: 'VariableDeclaration',
  566. VariableDeclarator: 'VariableDeclarator',
  567. WhileStatement: 'WhileStatement'
  568. });
  569. /***/ },
  570. /* 7 */
  571. /***/ function(module, exports) {
  572. "use strict";
  573. "use strict";
  574. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  575. var AbstractNodeObfuscator = function AbstractNodeObfuscator(nodes, options) {
  576. _classCallCheck(this, AbstractNodeObfuscator);
  577. this.nodes = nodes;
  578. this.options = options;
  579. };
  580. exports.AbstractNodeObfuscator = AbstractNodeObfuscator;
  581. /***/ },
  582. /* 8 */
  583. /***/ function(module, exports) {
  584. module.exports = require("format-unicorn");
  585. /***/ },
  586. /* 9 */
  587. /***/ function(module, exports, __webpack_require__) {
  588. "use strict";
  589. "use strict";
  590. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  591. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  592. var JavaScriptObfuscatorCLI_1 = __webpack_require__(30);
  593. var JavaScriptObfuscatorInternal_1 = __webpack_require__(25);
  594. var JavaScriptObfuscator = function () {
  595. function JavaScriptObfuscator() {
  596. _classCallCheck(this, JavaScriptObfuscator);
  597. }
  598. _createClass(JavaScriptObfuscator, null, [{
  599. key: 'obfuscate',
  600. value: function obfuscate(sourceCode) {
  601. var obfuscatorOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  602. var javaScriptObfuscator = new JavaScriptObfuscatorInternal_1.JavaScriptObfuscatorInternal(sourceCode, obfuscatorOptions);
  603. javaScriptObfuscator.obfuscate();
  604. return javaScriptObfuscator.getObfuscationResult();
  605. }
  606. }, {
  607. key: 'runCLI',
  608. value: function runCLI(argv) {
  609. new JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI(argv).run();
  610. }
  611. }]);
  612. return JavaScriptObfuscator;
  613. }();
  614. exports.JavaScriptObfuscator = JavaScriptObfuscator;
  615. /***/ },
  616. /* 10 */
  617. /***/ function(module, exports) {
  618. "use strict";
  619. "use strict";
  620. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  621. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  622. var AbstractNodesGroup = function () {
  623. function AbstractNodesGroup(options) {
  624. _classCallCheck(this, AbstractNodesGroup);
  625. this.nodes = new Map();
  626. this.options = options;
  627. }
  628. _createClass(AbstractNodesGroup, [{
  629. key: "getNodes",
  630. value: function getNodes() {
  631. return this.nodes;
  632. }
  633. }]);
  634. return AbstractNodesGroup;
  635. }();
  636. exports.AbstractNodesGroup = AbstractNodesGroup;
  637. /***/ },
  638. /* 11 */
  639. /***/ function(module, exports) {
  640. module.exports = require("escodegen");
  641. /***/ },
  642. /* 12 */
  643. /***/ function(module, exports) {
  644. "use strict";
  645. "use strict";
  646. exports.SourceMapMode = {
  647. Inline: 'inline',
  648. Separate: 'separate'
  649. };
  650. /***/ },
  651. /* 13 */
  652. /***/ function(module, exports) {
  653. "use strict";
  654. "use strict";
  655. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  656. var AbstractReplacer = function AbstractReplacer(nodes, options) {
  657. _classCallCheck(this, AbstractReplacer);
  658. this.nodes = nodes;
  659. this.options = options;
  660. };
  661. exports.AbstractReplacer = AbstractReplacer;
  662. /***/ },
  663. /* 14 */
  664. /***/ function(module, exports, __webpack_require__) {
  665. "use strict";
  666. "use strict";
  667. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  668. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  669. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  670. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  671. var AbstractReplacer_1 = __webpack_require__(13);
  672. var Utils_1 = __webpack_require__(0);
  673. var IdentifierReplacer = function (_AbstractReplacer_1$A) {
  674. _inherits(IdentifierReplacer, _AbstractReplacer_1$A);
  675. function IdentifierReplacer() {
  676. _classCallCheck(this, IdentifierReplacer);
  677. var _this = _possibleConstructorReturn(this, (IdentifierReplacer.__proto__ || Object.getPrototypeOf(IdentifierReplacer)).apply(this, arguments));
  678. _this.namesMap = new Map();
  679. return _this;
  680. }
  681. _createClass(IdentifierReplacer, [{
  682. key: 'replace',
  683. value: function replace(nodeValue) {
  684. var obfuscatedIdentifierName = this.namesMap.get(nodeValue);
  685. if (!obfuscatedIdentifierName) {
  686. return nodeValue;
  687. }
  688. return obfuscatedIdentifierName;
  689. }
  690. }, {
  691. key: 'storeNames',
  692. value: function storeNames(nodeName) {
  693. if (!this.isReservedName(nodeName)) {
  694. this.namesMap.set(nodeName, Utils_1.Utils.getRandomVariableName());
  695. }
  696. }
  697. }, {
  698. key: 'isReservedName',
  699. value: function isReservedName(name) {
  700. return this.options.reservedNames.some(function (reservedName) {
  701. return new RegExp(reservedName, 'g').test(name);
  702. });
  703. }
  704. }]);
  705. return IdentifierReplacer;
  706. }(AbstractReplacer_1.AbstractReplacer);
  707. exports.IdentifierReplacer = IdentifierReplacer;
  708. /***/ },
  709. /* 15 */
  710. /***/ function(module, exports, __webpack_require__) {
  711. "use strict";
  712. "use strict";
  713. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  714. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  715. var NodeUtils_1 = __webpack_require__(1);
  716. var StackTraceAnalyzer_1 = __webpack_require__(58);
  717. var Utils_1 = __webpack_require__(0);
  718. var CustomNodeAppender = function () {
  719. function CustomNodeAppender() {
  720. _classCallCheck(this, CustomNodeAppender);
  721. }
  722. _createClass(CustomNodeAppender, null, [{
  723. key: 'appendNode',
  724. value: function appendNode(blockScopeBody, node) {
  725. var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  726. var blockScopeTraceData = new StackTraceAnalyzer_1.StackTraceAnalyzer(blockScopeBody).analyze();
  727. var targetBlockScopeBody = void 0;
  728. if (!blockScopeTraceData.length) {
  729. targetBlockScopeBody = blockScopeBody;
  730. } else {
  731. targetBlockScopeBody = CustomNodeAppender.getOptimalBlockScopeBody(blockScopeTraceData, index);
  732. }
  733. NodeUtils_1.NodeUtils.prependNode(targetBlockScopeBody, node);
  734. }
  735. }, {
  736. key: 'getIndexByThreshold',
  737. value: function getIndexByThreshold(blockStatementBodyLength) {
  738. var threshold = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.1;
  739. if (threshold < 0 || threshold > 1) {
  740. throw new RangeError('`threshold` parameter should has value between 0 and 1');
  741. }
  742. return Utils_1.Utils.getRandomGenerator().integer({
  743. min: 0,
  744. max: Math.round(blockStatementBodyLength * threshold)
  745. });
  746. }
  747. }, {
  748. key: 'getOptimalBlockScopeBody',
  749. value: function getOptimalBlockScopeBody(blockScopeTraceData, index) {
  750. var firstCall = blockScopeTraceData[index];
  751. if (firstCall.stackTrace.length) {
  752. return CustomNodeAppender.getOptimalBlockScopeBody(firstCall.stackTrace, 0);
  753. } else {
  754. return firstCall.callee.body;
  755. }
  756. }
  757. }]);
  758. return CustomNodeAppender;
  759. }();
  760. exports.CustomNodeAppender = CustomNodeAppender;
  761. /***/ },
  762. /* 16 */
  763. /***/ function(module, exports, __webpack_require__) {
  764. "use strict";
  765. "use strict";
  766. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  767. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  768. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  769. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  770. var AbstractReplacer_1 = __webpack_require__(13);
  771. var NumberLiteralReplacer_1 = __webpack_require__(20);
  772. var Utils_1 = __webpack_require__(0);
  773. var StringLiteralReplacer = function (_AbstractReplacer_1$A) {
  774. _inherits(StringLiteralReplacer, _AbstractReplacer_1$A);
  775. function StringLiteralReplacer() {
  776. _classCallCheck(this, StringLiteralReplacer);
  777. return _possibleConstructorReturn(this, (StringLiteralReplacer.__proto__ || Object.getPrototypeOf(StringLiteralReplacer)).apply(this, arguments));
  778. }
  779. _createClass(StringLiteralReplacer, [{
  780. key: 'replace',
  781. value: function replace(nodeValue) {
  782. var replaceWithUnicodeArrayFlag = Math.random() <= this.options.unicodeArrayThreshold;
  783. if (this.options.encodeUnicodeLiterals && replaceWithUnicodeArrayFlag) {
  784. nodeValue = Utils_1.Utils.btoa(nodeValue);
  785. }
  786. nodeValue = Utils_1.Utils.stringToUnicode(nodeValue);
  787. if (this.options.unicodeArray && replaceWithUnicodeArrayFlag) {
  788. return this.replaceStringLiteralWithUnicodeArrayCall(nodeValue);
  789. }
  790. return nodeValue;
  791. }
  792. }, {
  793. key: 'replaceStringLiteralWithUnicodeArrayCall',
  794. value: function replaceStringLiteralWithUnicodeArrayCall(value) {
  795. var unicodeArrayNode = this.nodes.get('unicodeArrayNode');
  796. if (!unicodeArrayNode) {
  797. throw new ReferenceError('`unicodeArrayNode` node is not found in Map with custom nodes.');
  798. }
  799. var unicodeArray = unicodeArrayNode.getNodeData(),
  800. indexOfExistingValue = unicodeArray.getIndexOf(value),
  801. indexOfValue = void 0,
  802. hexadecimalIndex = void 0;
  803. if (indexOfExistingValue >= 0) {
  804. indexOfValue = indexOfExistingValue;
  805. } else {
  806. indexOfValue = unicodeArray.getLength();
  807. unicodeArrayNode.updateNodeData(value);
  808. }
  809. hexadecimalIndex = new NumberLiteralReplacer_1.NumberLiteralReplacer(this.nodes, this.options).replace(indexOfValue);
  810. if (this.options.wrapUnicodeArrayCalls) {
  811. var unicodeArrayCallsWrapper = this.nodes.get('unicodeArrayCallsWrapper');
  812. if (!unicodeArrayCallsWrapper) {
  813. throw new ReferenceError('`unicodeArrayCallsWrapper` node is not found in Map with custom nodes.');
  814. }
  815. return unicodeArrayCallsWrapper.getNodeIdentifier() + '(\'' + hexadecimalIndex + '\')';
  816. }
  817. return unicodeArrayNode.getNodeIdentifier() + '[' + hexadecimalIndex + ']';
  818. }
  819. }]);
  820. return StringLiteralReplacer;
  821. }(AbstractReplacer_1.AbstractReplacer);
  822. exports.StringLiteralReplacer = StringLiteralReplacer;
  823. /***/ },
  824. /* 17 */
  825. /***/ function(module, exports, __webpack_require__) {
  826. "use strict";
  827. "use strict";
  828. var SourceMapMode_1 = __webpack_require__(12);
  829. exports.NO_CUSTOM_NODES_PRESET = Object.freeze({
  830. compact: true,
  831. debugProtection: false,
  832. debugProtectionInterval: false,
  833. disableConsoleOutput: false,
  834. domainLock: [],
  835. encodeUnicodeLiterals: false,
  836. reservedNames: [],
  837. rotateUnicodeArray: false,
  838. selfDefending: false,
  839. sourceMap: false,
  840. sourceMapBaseUrl: '',
  841. sourceMapFileName: '',
  842. sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
  843. unicodeArray: false,
  844. unicodeArrayThreshold: 0,
  845. wrapUnicodeArrayCalls: false
  846. });
  847. /***/ },
  848. /* 18 */
  849. /***/ function(module, exports) {
  850. "use strict";
  851. "use strict";
  852. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  853. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  854. var ObfuscationResult = function () {
  855. function ObfuscationResult(obfuscatedCode, sourceMap) {
  856. _classCallCheck(this, ObfuscationResult);
  857. this.obfuscatedCode = obfuscatedCode;
  858. this.sourceMap = sourceMap;
  859. }
  860. _createClass(ObfuscationResult, [{
  861. key: "getObfuscatedCode",
  862. value: function getObfuscatedCode() {
  863. return this.obfuscatedCode;
  864. }
  865. }, {
  866. key: "getSourceMap",
  867. value: function getSourceMap() {
  868. return this.sourceMap;
  869. }
  870. }, {
  871. key: "toString",
  872. value: function toString() {
  873. return this.obfuscatedCode;
  874. }
  875. }]);
  876. return ObfuscationResult;
  877. }();
  878. exports.ObfuscationResult = ObfuscationResult;
  879. /***/ },
  880. /* 19 */
  881. /***/ function(module, exports) {
  882. "use strict";
  883. "use strict";
  884. exports.JSFuck = {
  885. Window: '[]["filter"]["constructor"]("return this")()',
  886. False: '![]',
  887. True: '!![]',
  888. a: '(false+"")[1]',
  889. b: '([]["entries"]()+"")[2]',
  890. c: '([]["fill"]+"")[3]',
  891. d: '(undefined+"")[2]',
  892. e: '(true+"")[3]',
  893. f: '(false+"")[0]',
  894. g: '(false+[0]+String)[20]',
  895. h: '(+(101))["toString"](21)[1]',
  896. i: '([false]+undefined)[10]',
  897. j: '([]["entries"]()+"")[3]',
  898. k: '(+(20))["toString"](21)',
  899. l: '(false+"")[2]',
  900. m: '(Number+"")[11]',
  901. n: '(undefined+"")[1]',
  902. o: '(true+[]["fill"])[10]',
  903. p: '(+(211))["toString"](31)[1]',
  904. q: '(+(212))["toString"](31)[1]',
  905. r: '(true+"")[1]',
  906. s: '(false+"")[3]',
  907. t: '(true+"")[0]',
  908. u: '(undefined+"")[0]',
  909. v: '(+(31))["toString"](32)',
  910. w: '(+(32))["toString"](33)',
  911. x: '(+(101))["toString"](34)[1]',
  912. y: '(NaN+[Infinity])[10]',
  913. z: '(+(35))["toString"](36)',
  914. A: '(+[]+Array)[10]',
  915. B: '(+[]+Boolean)[10]',
  916. C: 'Function("return escape")()(("")["italics"]())[2]',
  917. D: 'Function("return escape")()([]["fill"])["slice"]("-1")',
  918. E: '(RegExp+"")[12]',
  919. F: '(+[]+Function)[10]',
  920. G: '(false+Function("return Date")()())[30]',
  921. H: '\'H\'',
  922. I: '(Infinity+"")[0]',
  923. J: '\'J\'',
  924. K: '\'K\'',
  925. L: '\'L\'',
  926. M: '(true+Function("return Date")()())[30]',
  927. N: '(NaN+"")[0]',
  928. O: '(NaN+Function("return{}")())[11]',
  929. P: '\'P\'',
  930. Q: '\'Q\'',
  931. R: '(+[]+RegExp)[10]',
  932. S: '(+[]+String)[10]',
  933. T: '(NaN+Function("return Date")()())[30]',
  934. U: '(NaN+Function("return{}")()["toString"]["call"]())[11]',
  935. V: '\'V\'',
  936. W: '\'W\'',
  937. X: '\'X\'',
  938. Y: '\'Y\'',
  939. Z: '\'Z\''
  940. };
  941. /***/ },
  942. /* 20 */
  943. /***/ function(module, exports, __webpack_require__) {
  944. "use strict";
  945. "use strict";
  946. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  947. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  948. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  949. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  950. var AbstractReplacer_1 = __webpack_require__(13);
  951. var Utils_1 = __webpack_require__(0);
  952. var NumberLiteralReplacer = function (_AbstractReplacer_1$A) {
  953. _inherits(NumberLiteralReplacer, _AbstractReplacer_1$A);
  954. function NumberLiteralReplacer() {
  955. _classCallCheck(this, NumberLiteralReplacer);
  956. return _possibleConstructorReturn(this, (NumberLiteralReplacer.__proto__ || Object.getPrototypeOf(NumberLiteralReplacer)).apply(this, arguments));
  957. }
  958. _createClass(NumberLiteralReplacer, [{
  959. key: 'replace',
  960. value: function replace(nodeValue) {
  961. var prefix = '0x';
  962. if (!Utils_1.Utils.isInteger(nodeValue)) {
  963. return String(nodeValue);
  964. }
  965. return '' + prefix + Utils_1.Utils.decToHex(nodeValue);
  966. }
  967. }]);
  968. return NumberLiteralReplacer;
  969. }(AbstractReplacer_1.AbstractReplacer);
  970. exports.NumberLiteralReplacer = NumberLiteralReplacer;
  971. /***/ },
  972. /* 21 */
  973. /***/ function(module, exports, __webpack_require__) {
  974. "use strict";
  975. "use strict";
  976. var SourceMapMode_1 = __webpack_require__(12);
  977. exports.DEFAULT_PRESET = Object.freeze({
  978. compact: true,
  979. debugProtection: false,
  980. debugProtectionInterval: false,
  981. disableConsoleOutput: true,
  982. domainLock: [],
  983. encodeUnicodeLiterals: false,
  984. reservedNames: [],
  985. rotateUnicodeArray: true,
  986. selfDefending: true,
  987. sourceMap: false,
  988. sourceMapBaseUrl: '',
  989. sourceMapFileName: '',
  990. sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
  991. unicodeArray: true,
  992. unicodeArrayThreshold: 0.8,
  993. wrapUnicodeArrayCalls: true
  994. });
  995. /***/ },
  996. /* 22 */
  997. /***/ function(module, exports) {
  998. module.exports = require("esprima");
  999. /***/ },
  1000. /* 23 */
  1001. /***/ function(module, exports) {
  1002. module.exports = require("path");
  1003. /***/ },
  1004. /* 24 */
  1005. /***/ function(module, exports) {
  1006. module.exports = require("babel-polyfill");
  1007. /***/ },
  1008. /* 25 */
  1009. /***/ function(module, exports, __webpack_require__) {
  1010. "use strict";
  1011. "use strict";
  1012. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1013. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1014. var esprima = __webpack_require__(22);
  1015. var escodegen = __webpack_require__(11);
  1016. var ObfuscationResult_1 = __webpack_require__(18);
  1017. var Obfuscator_1 = __webpack_require__(26);
  1018. var Options_1 = __webpack_require__(55);
  1019. var SourceMapCorrector_1 = __webpack_require__(27);
  1020. var JavaScriptObfuscatorInternal = function () {
  1021. function JavaScriptObfuscatorInternal(sourceCode) {
  1022. var obfuscatorOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1023. _classCallCheck(this, JavaScriptObfuscatorInternal);
  1024. this.sourceCode = sourceCode;
  1025. this.options = new Options_1.Options(obfuscatorOptions);
  1026. }
  1027. _createClass(JavaScriptObfuscatorInternal, [{
  1028. key: 'getObfuscationResult',
  1029. value: function getObfuscationResult() {
  1030. return new SourceMapCorrector_1.SourceMapCorrector(new ObfuscationResult_1.ObfuscationResult(this.generatorOutput.code, this.generatorOutput.map), this.options.sourceMapBaseUrl + this.options.sourceMapFileName, this.options.sourceMapMode).correct();
  1031. }
  1032. }, {
  1033. key: 'obfuscate',
  1034. value: function obfuscate() {
  1035. var astTree = esprima.parse(this.sourceCode, {
  1036. loc: true
  1037. });
  1038. astTree = new Obfuscator_1.Obfuscator(this.options).obfuscateNode(astTree);
  1039. this.generatorOutput = JavaScriptObfuscatorInternal.generateCode(this.sourceCode, astTree, this.options);
  1040. }
  1041. }], [{
  1042. key: 'generateCode',
  1043. value: function generateCode(sourceCode, astTree, options) {
  1044. var escodegenParams = Object.assign({}, JavaScriptObfuscatorInternal.escodegenParams);
  1045. if (options.sourceMap) {
  1046. escodegenParams.sourceMap = 'sourceMap';
  1047. escodegenParams.sourceContent = sourceCode;
  1048. }
  1049. escodegenParams.format = {
  1050. compact: options.compact
  1051. };
  1052. var generatorOutput = escodegen.generate(astTree, escodegenParams);
  1053. generatorOutput.map = generatorOutput.map ? generatorOutput.map.toString() : '';
  1054. return generatorOutput;
  1055. }
  1056. }]);
  1057. return JavaScriptObfuscatorInternal;
  1058. }();
  1059. JavaScriptObfuscatorInternal.escodegenParams = {
  1060. verbatim: 'x-verbatim-property',
  1061. sourceMapWithCode: true
  1062. };
  1063. exports.JavaScriptObfuscatorInternal = JavaScriptObfuscatorInternal;
  1064. /***/ },
  1065. /* 26 */
  1066. /***/ function(module, exports, __webpack_require__) {
  1067. "use strict";
  1068. "use strict";
  1069. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1070. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  1071. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1072. var estraverse = __webpack_require__(3);
  1073. var AppendState_1 = __webpack_require__(4);
  1074. var NodeType_1 = __webpack_require__(6);
  1075. var CatchClauseObfuscator_1 = __webpack_require__(46);
  1076. var ConsoleOutputNodesGroup_1 = __webpack_require__(41);
  1077. var DebugProtectionNodesGroup_1 = __webpack_require__(42);
  1078. var DomainLockNodesGroup_1 = __webpack_require__(43);
  1079. var FunctionDeclarationObfuscator_1 = __webpack_require__(47);
  1080. var FunctionObfuscator_1 = __webpack_require__(48);
  1081. var LiteralObfuscator_1 = __webpack_require__(49);
  1082. var MemberExpressionObfuscator_1 = __webpack_require__(50);
  1083. var MethodDefinitionObfuscator_1 = __webpack_require__(51);
  1084. var Nodes_1 = __webpack_require__(2);
  1085. var NodeUtils_1 = __webpack_require__(1);
  1086. var ObjectExpressionObfuscator_1 = __webpack_require__(52);
  1087. var SelfDefendingNodesGroup_1 = __webpack_require__(44);
  1088. var UnicodeArrayNodesGroup_1 = __webpack_require__(45);
  1089. var VariableDeclarationObfuscator_1 = __webpack_require__(53);
  1090. var Obfuscator = function () {
  1091. function Obfuscator(options) {
  1092. _classCallCheck(this, Obfuscator);
  1093. this.nodeObfuscators = new Map([[NodeType_1.NodeType.ArrowFunctionExpression, [FunctionObfuscator_1.FunctionObfuscator]], [NodeType_1.NodeType.ClassDeclaration, [FunctionDeclarationObfuscator_1.FunctionDeclarationObfuscator]], [NodeType_1.NodeType.CatchClause, [CatchClauseObfuscator_1.CatchClauseObfuscator]], [NodeType_1.NodeType.FunctionDeclaration, [FunctionDeclarationObfuscator_1.FunctionDeclarationObfuscator, FunctionObfuscator_1.FunctionObfuscator]], [NodeType_1.NodeType.FunctionExpression, [FunctionObfuscator_1.FunctionObfuscator]], [NodeType_1.NodeType.MemberExpression, [MemberExpressionObfuscator_1.MemberExpressionObfuscator]], [NodeType_1.NodeType.MethodDefinition, [MethodDefinitionObfuscator_1.MethodDefinitionObfuscator]], [NodeType_1.NodeType.ObjectExpression, [ObjectExpressionObfuscator_1.ObjectExpressionObfuscator]], [NodeType_1.NodeType.VariableDeclaration, [VariableDeclarationObfuscator_1.VariableDeclarationObfuscator]], [NodeType_1.NodeType.Literal, [LiteralObfuscator_1.LiteralObfuscator]]]);
  1094. this.options = options;
  1095. this.nodes = new Map([].concat(_toConsumableArray(new DomainLockNodesGroup_1.DomainLockNodesGroup(this.options).getNodes()), _toConsumableArray(new SelfDefendingNodesGroup_1.SelfDefendingNodesGroup(this.options).getNodes()), _toConsumableArray(new ConsoleOutputNodesGroup_1.ConsoleOutputNodesGroup(this.options).getNodes()), _toConsumableArray(new DebugProtectionNodesGroup_1.DebugProtectionNodesGroup(this.options).getNodes()), _toConsumableArray(new UnicodeArrayNodesGroup_1.UnicodeArrayNodesGroup(this.options).getNodes())));
  1096. }
  1097. _createClass(Obfuscator, [{
  1098. key: 'obfuscateNode',
  1099. value: function obfuscateNode(node) {
  1100. if (Nodes_1.Nodes.isProgramNode(node) && !node.body.length) {
  1101. return node;
  1102. }
  1103. NodeUtils_1.NodeUtils.parentize(node);
  1104. this.beforeObfuscation(node);
  1105. this.obfuscate(node);
  1106. this.afterObfuscation(node);
  1107. return node;
  1108. }
  1109. }, {
  1110. key: 'afterObfuscation',
  1111. value: function afterObfuscation(astTree) {
  1112. this.nodes.forEach(function (node) {
  1113. if (node.getAppendState() === AppendState_1.AppendState.AfterObfuscation) {
  1114. node.appendNode(astTree);
  1115. }
  1116. });
  1117. }
  1118. }, {
  1119. key: 'beforeObfuscation',
  1120. value: function beforeObfuscation(astTree) {
  1121. this.nodes.forEach(function (node) {
  1122. if (node.getAppendState() === AppendState_1.AppendState.BeforeObfuscation) {
  1123. node.appendNode(astTree);
  1124. }
  1125. });
  1126. }
  1127. }, {
  1128. key: 'initializeNodeObfuscators',
  1129. value: function initializeNodeObfuscators(node, parentNode) {
  1130. var _this = this;
  1131. var nodeObfuscators = this.nodeObfuscators.get(node.type);
  1132. if (!nodeObfuscators) {
  1133. return;
  1134. }
  1135. nodeObfuscators.forEach(function (obfuscator) {
  1136. new obfuscator(_this.nodes, _this.options).obfuscateNode(node, parentNode);
  1137. });
  1138. }
  1139. }, {
  1140. key: 'obfuscate',
  1141. value: function obfuscate(node) {
  1142. var _this2 = this;
  1143. estraverse.replace(node, {
  1144. enter: function enter(node, parentNode) {
  1145. _this2.initializeNodeObfuscators(node, parentNode);
  1146. }
  1147. });
  1148. }
  1149. }]);
  1150. return Obfuscator;
  1151. }();
  1152. exports.Obfuscator = Obfuscator;
  1153. /***/ },
  1154. /* 27 */
  1155. /***/ function(module, exports, __webpack_require__) {
  1156. "use strict";
  1157. "use strict";
  1158. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1159. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1160. var SourceMapMode_1 = __webpack_require__(12);
  1161. var ObfuscationResult_1 = __webpack_require__(18);
  1162. var Utils_1 = __webpack_require__(0);
  1163. var SourceMapCorrector = function () {
  1164. function SourceMapCorrector(obfuscationResult, sourceMapUrl, sourceMapMode) {
  1165. _classCallCheck(this, SourceMapCorrector);
  1166. this.obfuscatedCode = obfuscationResult.getObfuscatedCode();
  1167. this.sourceMap = obfuscationResult.getSourceMap();
  1168. this.sourceMapUrl = sourceMapUrl;
  1169. this.sourceMapMode = sourceMapMode;
  1170. }
  1171. _createClass(SourceMapCorrector, [{
  1172. key: 'correct',
  1173. value: function correct() {
  1174. return new ObfuscationResult_1.ObfuscationResult(this.correctObfuscatedCode(), this.sourceMap);
  1175. }
  1176. }, {
  1177. key: 'correctObfuscatedCode',
  1178. value: function correctObfuscatedCode() {
  1179. if (!this.sourceMap) {
  1180. return this.obfuscatedCode;
  1181. }
  1182. var sourceMappingUrl = '//# sourceMappingURL=';
  1183. switch (this.sourceMapMode) {
  1184. case SourceMapMode_1.SourceMapMode.Inline:
  1185. sourceMappingUrl += 'data:application/json;base64,' + Utils_1.Utils.btoa(this.sourceMap, false);
  1186. break;
  1187. case SourceMapMode_1.SourceMapMode.Separate:
  1188. default:
  1189. if (!this.sourceMapUrl) {
  1190. return this.obfuscatedCode;
  1191. }
  1192. sourceMappingUrl += this.sourceMapUrl;
  1193. break;
  1194. }
  1195. return this.obfuscatedCode + '\n' + sourceMappingUrl;
  1196. }
  1197. }]);
  1198. return SourceMapCorrector;
  1199. }();
  1200. exports.SourceMapCorrector = SourceMapCorrector;
  1201. /***/ },
  1202. /* 28 */
  1203. /***/ function(module, exports, __webpack_require__) {
  1204. "use strict";
  1205. "use strict";
  1206. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1207. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1208. var Utils_1 = __webpack_require__(0);
  1209. var UnicodeArray = function () {
  1210. function UnicodeArray() {
  1211. _classCallCheck(this, UnicodeArray);
  1212. this.array = [];
  1213. }
  1214. _createClass(UnicodeArray, [{
  1215. key: "addToArray",
  1216. value: function addToArray(value) {
  1217. this.array.push(value);
  1218. }
  1219. }, {
  1220. key: "getArray",
  1221. value: function getArray() {
  1222. return this.array;
  1223. }
  1224. }, {
  1225. key: "getIndexOf",
  1226. value: function getIndexOf(value) {
  1227. return this.array.indexOf(value);
  1228. }
  1229. }, {
  1230. key: "getLength",
  1231. value: function getLength() {
  1232. return this.array.length;
  1233. }
  1234. }, {
  1235. key: "rotateArray",
  1236. value: function rotateArray(rotationValue) {
  1237. this.array = Utils_1.Utils.arrayRotate(this.array, rotationValue);
  1238. }
  1239. }, {
  1240. key: "toString",
  1241. value: function toString() {
  1242. return this.array.toString();
  1243. }
  1244. }]);
  1245. return UnicodeArray;
  1246. }();
  1247. exports.UnicodeArray = UnicodeArray;
  1248. /***/ },
  1249. /* 29 */
  1250. /***/ function(module, exports, __webpack_require__) {
  1251. "use strict";
  1252. "use strict";
  1253. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1254. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1255. var fs = __webpack_require__(78);
  1256. var mkdirp = __webpack_require__(79);
  1257. var path = __webpack_require__(23);
  1258. var Utils_1 = __webpack_require__(0);
  1259. var CLIUtils = function () {
  1260. function CLIUtils() {
  1261. _classCallCheck(this, CLIUtils);
  1262. }
  1263. _createClass(CLIUtils, null, [{
  1264. key: 'getOutputCodePath',
  1265. value: function getOutputCodePath(outputPath, inputPath) {
  1266. if (outputPath) {
  1267. return outputPath;
  1268. }
  1269. return inputPath.split('.').map(function (value, index) {
  1270. return index === 0 ? value + '-obfuscated' : value;
  1271. }).join('.');
  1272. }
  1273. }, {
  1274. key: 'getOutputSourceMapPath',
  1275. value: function getOutputSourceMapPath(outputCodePath) {
  1276. var sourceMapFileName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  1277. if (sourceMapFileName) {
  1278. outputCodePath = outputCodePath.substr(0, outputCodePath.lastIndexOf('/')) + '/' + sourceMapFileName;
  1279. }
  1280. if (!/\.js\.map$/.test(outputCodePath)) {
  1281. outputCodePath = outputCodePath.split('.')[0] + '.js.map';
  1282. } else if (/\.js$/.test(outputCodePath)) {
  1283. outputCodePath += '.map';
  1284. }
  1285. return outputCodePath;
  1286. }
  1287. }, {
  1288. key: 'getPackageConfig',
  1289. value: function getPackageConfig() {
  1290. return JSON.parse(fs.readFileSync(path.join(path.dirname(fs.realpathSync(process.argv[1])), '../package.json'), CLIUtils.encoding));
  1291. }
  1292. }, {
  1293. key: 'isFilePath',
  1294. value: function isFilePath(filePath) {
  1295. try {
  1296. return fs.statSync(filePath).isFile();
  1297. } catch (e) {
  1298. return false;
  1299. }
  1300. }
  1301. }, {
  1302. key: 'readFile',
  1303. value: function readFile(inputPath) {
  1304. return fs.readFileSync(inputPath, CLIUtils.encoding);
  1305. }
  1306. }, {
  1307. key: 'validateInputPath',
  1308. value: function validateInputPath(inputPath) {
  1309. if (!CLIUtils.isFilePath(inputPath)) {
  1310. throw new ReferenceError('Given input path must be a valid file path');
  1311. }
  1312. if (!Utils_1.Utils.arrayContains(CLIUtils.availableInputExtensions, path.extname(inputPath))) {
  1313. throw new ReferenceError('Input file must have .js extension');
  1314. }
  1315. }
  1316. }, {
  1317. key: 'writeFile',
  1318. value: function writeFile(outputPath, data) {
  1319. mkdirp.sync(path.dirname(outputPath));
  1320. fs.writeFileSync(outputPath, data, {
  1321. encoding: CLIUtils.encoding
  1322. });
  1323. }
  1324. }]);
  1325. return CLIUtils;
  1326. }();
  1327. CLIUtils.availableInputExtensions = ['.js'];
  1328. CLIUtils.encoding = 'utf8';
  1329. exports.CLIUtils = CLIUtils;
  1330. /***/ },
  1331. /* 30 */
  1332. /***/ function(module, exports, __webpack_require__) {
  1333. "use strict";
  1334. "use strict";
  1335. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1336. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1337. var commander = __webpack_require__(77);
  1338. var path = __webpack_require__(23);
  1339. var SourceMapMode_1 = __webpack_require__(12);
  1340. var DefaultPreset_1 = __webpack_require__(21);
  1341. var CLIUtils_1 = __webpack_require__(29);
  1342. var JavaScriptObfuscator_1 = __webpack_require__(9);
  1343. var Utils_1 = __webpack_require__(0);
  1344. var JavaScriptObfuscatorCLI = function () {
  1345. function JavaScriptObfuscatorCLI(argv) {
  1346. _classCallCheck(this, JavaScriptObfuscatorCLI);
  1347. this.data = '';
  1348. this.rawArguments = argv;
  1349. this.arguments = this.rawArguments.slice(2);
  1350. }
  1351. _createClass(JavaScriptObfuscatorCLI, [{
  1352. key: 'run',
  1353. value: function run() {
  1354. this.configureCommands();
  1355. if (!this.arguments.length || Utils_1.Utils.arrayContains(this.arguments, '--help')) {
  1356. this.commands.outputHelp();
  1357. return;
  1358. }
  1359. this.inputPath = this.arguments[0];
  1360. CLIUtils_1.CLIUtils.validateInputPath(this.inputPath);
  1361. this.getData();
  1362. this.processData();
  1363. }
  1364. }, {
  1365. key: 'buildOptions',
  1366. value: function buildOptions() {
  1367. var obfuscatorOptions = {},
  1368. availableOptions = Object.keys(DefaultPreset_1.DEFAULT_PRESET);
  1369. for (var option in this.commands) {
  1370. if (!this.commands.hasOwnProperty(option)) {
  1371. continue;
  1372. }
  1373. if (!Utils_1.Utils.arrayContains(availableOptions, option)) {
  1374. continue;
  1375. }
  1376. obfuscatorOptions[option] = this.commands[option];
  1377. }
  1378. return Object.assign({}, DefaultPreset_1.DEFAULT_PRESET, obfuscatorOptions);
  1379. }
  1380. }, {
  1381. key: 'configureCommands',
  1382. value: function configureCommands() {
  1383. this.commands = new commander.Command().version(JavaScriptObfuscatorCLI.getBuildVersion(), '-v, --version').usage('<inputPath> [options]').option('-o, --output <path>', 'Output path for obfuscated code').option('--compact <boolean>', 'Disable one line output code compacting', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', JavaScriptObfuscatorCLI.parseBoolean).option('--encodeUnicodeLiterals <boolean>', 'All literals in Unicode array become encoded in Base64 (this option can slightly slow down your code speed)', JavaScriptObfuscatorCLI.parseBoolean).option('--reservedNames <list>', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', function (val) {
  1384. return val.split(',');
  1385. }).option('--rotateUnicodeArray <boolean>', 'Disable rotation of unicode array values during obfuscation', JavaScriptObfuscatorCLI.parseBoolean).option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', JavaScriptObfuscatorCLI.parseBoolean).option('--sourceMap <boolean>', 'Enables source map generation', JavaScriptObfuscatorCLI.parseBoolean).option('--sourceMapBaseUrl <string>', 'Sets base url to the source map import url when `--sourceMapMode=separate`').option('--sourceMapFileName <string>', 'Sets file name for output source map when `--sourceMapMode=separate`').option('--sourceMapMode <string> [inline, separate]', 'Specify source map output mode', JavaScriptObfuscatorCLI.parseSourceMapMode).option('--unicodeArray <boolean>', 'Disables gathering of all literal strings into an array and replacing every literal string with an array call', JavaScriptObfuscatorCLI.parseBoolean).option('--unicodeArrayThreshold <number>', 'The probability that the literal string will be inserted into unicodeArray (Default: 0.8, Min: 0, Max: 1)', parseFloat).option('--wrapUnicodeArrayCalls <boolean>', 'Disables usage of special access function instead of direct array call', JavaScriptObfuscatorCLI.parseBoolean).option('--domainLock <list>', 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)', function (val) {
  1386. return val.split(',');
  1387. }).parse(this.rawArguments);
  1388. this.commands.on('--help', function () {
  1389. console.log(' Examples:\n');
  1390. console.log(' %> javascript-obfuscator in.js --compact true --selfDefending false');
  1391. console.log(' %> javascript-obfuscator in.js --output out.js --compact true --selfDefending false');
  1392. console.log('');
  1393. });
  1394. }
  1395. }, {
  1396. key: 'getData',
  1397. value: function getData() {
  1398. this.data = CLIUtils_1.CLIUtils.readFile(this.inputPath);
  1399. }
  1400. }, {
  1401. key: 'processData',
  1402. value: function processData() {
  1403. var options = this.buildOptions(),
  1404. outputCodePath = CLIUtils_1.CLIUtils.getOutputCodePath(this.commands.output, this.inputPath);
  1405. if (options.sourceMap) {
  1406. this.processDataWithSourceMap(outputCodePath, options);
  1407. } else {
  1408. this.processDataWithoutSourceMap(outputCodePath, options);
  1409. }
  1410. }
  1411. }, {
  1412. key: 'processDataWithoutSourceMap',
  1413. value: function processDataWithoutSourceMap(outputCodePath, options) {
  1414. var obfuscatedCode = JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(this.data, options).getObfuscatedCode();
  1415. CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscatedCode);
  1416. }
  1417. }, {
  1418. key: 'processDataWithSourceMap',
  1419. value: function processDataWithSourceMap(outputCodePath, options) {
  1420. var outputSourceMapPath = CLIUtils_1.CLIUtils.getOutputSourceMapPath(outputCodePath, options.sourceMapFileName || '');
  1421. options.sourceMapFileName = path.basename(outputSourceMapPath);
  1422. var obfuscationResult = JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(this.data, options);
  1423. CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscationResult.getObfuscatedCode());
  1424. if (options.sourceMapMode === 'separate' && obfuscationResult.getSourceMap()) {
  1425. CLIUtils_1.CLIUtils.writeFile(outputSourceMapPath, obfuscationResult.getSourceMap());
  1426. }
  1427. }
  1428. }], [{
  1429. key: 'getBuildVersion',
  1430. value: function getBuildVersion() {
  1431. return CLIUtils_1.CLIUtils.getPackageConfig().version;
  1432. }
  1433. }, {
  1434. key: 'parseBoolean',
  1435. value: function parseBoolean(value) {
  1436. return value === 'true' || value === '1';
  1437. }
  1438. }, {
  1439. key: 'parseSourceMapMode',
  1440. value: function parseSourceMapMode(value) {
  1441. var availableMode = Object.keys(SourceMapMode_1.SourceMapMode).some(function (key) {
  1442. return SourceMapMode_1.SourceMapMode[key] === value;
  1443. });
  1444. if (!availableMode) {
  1445. throw new ReferenceError('Invalid value of `--sourceMapMode` option');
  1446. }
  1447. return value;
  1448. }
  1449. }]);
  1450. return JavaScriptObfuscatorCLI;
  1451. }();
  1452. exports.JavaScriptObfuscatorCLI = JavaScriptObfuscatorCLI;
  1453. /***/ },
  1454. /* 31 */
  1455. /***/ function(module, exports, __webpack_require__) {
  1456. "use strict";
  1457. "use strict";
  1458. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1459. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1460. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1461. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1462. var AppendState_1 = __webpack_require__(4);
  1463. var ConsoleOutputDisableExpressionTemplate_1 = __webpack_require__(62);
  1464. var AbstractCustomNode_1 = __webpack_require__(5);
  1465. var CustomNodeAppender_1 = __webpack_require__(15);
  1466. var NodeUtils_1 = __webpack_require__(1);
  1467. var ConsoleOutputDisableExpressionNode = function (_AbstractCustomNode_) {
  1468. _inherits(ConsoleOutputDisableExpressionNode, _AbstractCustomNode_);
  1469. function ConsoleOutputDisableExpressionNode() {
  1470. _classCallCheck(this, ConsoleOutputDisableExpressionNode);
  1471. var _this = _possibleConstructorReturn(this, (ConsoleOutputDisableExpressionNode.__proto__ || Object.getPrototypeOf(ConsoleOutputDisableExpressionNode)).apply(this, arguments));
  1472. _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
  1473. return _this;
  1474. }
  1475. _createClass(ConsoleOutputDisableExpressionNode, [{
  1476. key: 'appendNode',
  1477. value: function appendNode(blockScopeNode) {
  1478. CustomNodeAppender_1.CustomNodeAppender.appendNode(blockScopeNode.body, this.getNode(), CustomNodeAppender_1.CustomNodeAppender.getIndexByThreshold(blockScopeNode.body.length));
  1479. }
  1480. }, {
  1481. key: 'getNodeStructure',
  1482. value: function getNodeStructure() {
  1483. return NodeUtils_1.NodeUtils.convertCodeToStructure(ConsoleOutputDisableExpressionTemplate_1.ConsoleOutputDisableExpressionTemplate());
  1484. }
  1485. }]);
  1486. return ConsoleOutputDisableExpressionNode;
  1487. }(AbstractCustomNode_1.AbstractCustomNode);
  1488. exports.ConsoleOutputDisableExpressionNode = ConsoleOutputDisableExpressionNode;
  1489. /***/ },
  1490. /* 32 */
  1491. /***/ function(module, exports, __webpack_require__) {
  1492. "use strict";
  1493. "use strict";
  1494. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1495. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1496. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1497. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1498. __webpack_require__(8);
  1499. var AppendState_1 = __webpack_require__(4);
  1500. var DebufProtectionFunctionCallTemplate_1 = __webpack_require__(63);
  1501. var AbstractCustomNode_1 = __webpack_require__(5);
  1502. var NodeUtils_1 = __webpack_require__(1);
  1503. var DebugProtectionFunctionCallNode = function (_AbstractCustomNode_) {
  1504. _inherits(DebugProtectionFunctionCallNode, _AbstractCustomNode_);
  1505. function DebugProtectionFunctionCallNode(debugProtectionFunctionName, options) {
  1506. _classCallCheck(this, DebugProtectionFunctionCallNode);
  1507. var _this = _possibleConstructorReturn(this, (DebugProtectionFunctionCallNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionCallNode)).call(this, options));
  1508. _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
  1509. _this.debugProtectionFunctionName = debugProtectionFunctionName;
  1510. return _this;
  1511. }
  1512. _createClass(DebugProtectionFunctionCallNode, [{
  1513. key: 'appendNode',
  1514. value: function appendNode(blockScopeNode) {
  1515. NodeUtils_1.NodeUtils.appendNode(blockScopeNode.body, this.getNode());
  1516. }
  1517. }, {
  1518. key: 'getNodeStructure',
  1519. value: function getNodeStructure() {
  1520. return NodeUtils_1.NodeUtils.convertCodeToStructure(DebufProtectionFunctionCallTemplate_1.DebugProtectionFunctionCallTemplate().formatUnicorn({
  1521. debugProtectionFunctionName: this.debugProtectionFunctionName
  1522. }));
  1523. }
  1524. }]);
  1525. return DebugProtectionFunctionCallNode;
  1526. }(AbstractCustomNode_1.AbstractCustomNode);
  1527. exports.DebugProtectionFunctionCallNode = DebugProtectionFunctionCallNode;
  1528. /***/ },
  1529. /* 33 */
  1530. /***/ function(module, exports, __webpack_require__) {
  1531. "use strict";
  1532. "use strict";
  1533. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1534. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1535. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1536. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1537. __webpack_require__(8);
  1538. var AppendState_1 = __webpack_require__(4);
  1539. var DebugProtectionFunctionIntervalTemplate_1 = __webpack_require__(64);
  1540. var AbstractCustomNode_1 = __webpack_require__(5);
  1541. var NodeUtils_1 = __webpack_require__(1);
  1542. var DebugProtectionFunctionIntervalNode = function (_AbstractCustomNode_) {
  1543. _inherits(DebugProtectionFunctionIntervalNode, _AbstractCustomNode_);
  1544. function DebugProtectionFunctionIntervalNode(debugProtectionFunctionName, options) {
  1545. _classCallCheck(this, DebugProtectionFunctionIntervalNode);
  1546. var _this = _possibleConstructorReturn(this, (DebugProtectionFunctionIntervalNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionIntervalNode)).call(this, options));
  1547. _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
  1548. _this.debugProtectionFunctionName = debugProtectionFunctionName;
  1549. return _this;
  1550. }
  1551. _createClass(DebugProtectionFunctionIntervalNode, [{
  1552. key: 'appendNode',
  1553. value: function appendNode(blockScopeNode) {
  1554. NodeUtils_1.NodeUtils.appendNode(blockScopeNode.body, this.getNode());
  1555. }
  1556. }, {
  1557. key: 'getNodeStructure',
  1558. value: function getNodeStructure() {
  1559. return NodeUtils_1.NodeUtils.convertCodeToStructure(DebugProtectionFunctionIntervalTemplate_1.DebugProtectionFunctionIntervalTemplate().formatUnicorn({
  1560. debugProtectionFunctionName: this.debugProtectionFunctionName
  1561. }));
  1562. }
  1563. }]);
  1564. return DebugProtectionFunctionIntervalNode;
  1565. }(AbstractCustomNode_1.AbstractCustomNode);
  1566. exports.DebugProtectionFunctionIntervalNode = DebugProtectionFunctionIntervalNode;
  1567. /***/ },
  1568. /* 34 */
  1569. /***/ function(module, exports, __webpack_require__) {
  1570. "use strict";
  1571. "use strict";
  1572. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1573. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1574. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1575. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1576. __webpack_require__(8);
  1577. var AppendState_1 = __webpack_require__(4);
  1578. var DebugProtectionFunctionTemplate_1 = __webpack_require__(65);
  1579. var AbstractCustomNode_1 = __webpack_require__(5);
  1580. var NodeUtils_1 = __webpack_require__(1);
  1581. var Utils_1 = __webpack_require__(0);
  1582. var DebugProtectionFunctionNode = function (_AbstractCustomNode_) {
  1583. _inherits(DebugProtectionFunctionNode, _AbstractCustomNode_);
  1584. function DebugProtectionFunctionNode(debugProtectionFunctionName, options) {
  1585. _classCallCheck(this, DebugProtectionFunctionNode);
  1586. var _this = _possibleConstructorReturn(this, (DebugProtectionFunctionNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionNode)).call(this, options));
  1587. _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
  1588. _this.debugProtectionFunctionName = debugProtectionFunctionName;
  1589. return _this;
  1590. }
  1591. _createClass(DebugProtectionFunctionNode, [{
  1592. key: 'appendNode',
  1593. value: function appendNode(blockScopeNode) {
  1594. var programBodyLength = blockScopeNode.body.length,
  1595. randomIndex = Utils_1.Utils.getRandomGenerator().integer({
  1596. min: 0,
  1597. max: programBodyLength
  1598. });
  1599. NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), randomIndex);
  1600. }
  1601. }, {
  1602. key: 'getNodeIdentifier',
  1603. value: function getNodeIdentifier() {
  1604. return this.debugProtectionFunctionName;
  1605. }
  1606. }, {
  1607. key: 'getNodeStructure',
  1608. value: function getNodeStructure() {
  1609. return NodeUtils_1.NodeUtils.convertCodeToStructure(DebugProtectionFunctionTemplate_1.DebugProtectionFunctionTemplate().formatUnicorn({
  1610. debugProtectionFunctionName: this.debugProtectionFunctionName
  1611. }));
  1612. }
  1613. }]);
  1614. return DebugProtectionFunctionNode;
  1615. }(AbstractCustomNode_1.AbstractCustomNode);
  1616. exports.DebugProtectionFunctionNode = DebugProtectionFunctionNode;
  1617. /***/ },
  1618. /* 35 */
  1619. /***/ function(module, exports, __webpack_require__) {
  1620. "use strict";
  1621. "use strict";
  1622. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  1623. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1624. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1625. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1626. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1627. __webpack_require__(8);
  1628. var AppendState_1 = __webpack_require__(4);
  1629. var DomainLockNodeTemplate_1 = __webpack_require__(66);
  1630. var AbstractCustomNode_1 = __webpack_require__(5);
  1631. var CustomNodeAppender_1 = __webpack_require__(15);
  1632. var NodeUtils_1 = __webpack_require__(1);
  1633. var Utils_1 = __webpack_require__(0);
  1634. var DomainLockNode = function (_AbstractCustomNode_) {
  1635. _inherits(DomainLockNode, _AbstractCustomNode_);
  1636. function DomainLockNode() {
  1637. _classCallCheck(this, DomainLockNode);
  1638. var _this = _possibleConstructorReturn(this, (DomainLockNode.__proto__ || Object.getPrototypeOf(DomainLockNode)).apply(this, arguments));
  1639. _this.appendState = AppendState_1.AppendState.BeforeObfuscation;
  1640. return _this;
  1641. }
  1642. _createClass(DomainLockNode, [{
  1643. key: 'appendNode',
  1644. value: function appendNode(blockScopeNode) {
  1645. CustomNodeAppender_1.CustomNodeAppender.appendNode(blockScopeNode.body, this.getNode(), CustomNodeAppender_1.CustomNodeAppender.getIndexByThreshold(blockScopeNode.body.length));
  1646. }
  1647. }, {
  1648. key: 'getNodeStructure',
  1649. value: function getNodeStructure() {
  1650. var domainsString = this.options.domainLock.join(';');
  1651. var _Utils_1$Utils$hideSt = Utils_1.Utils.hideString(domainsString, domainsString.length * 3);
  1652. var _Utils_1$Utils$hideSt2 = _slicedToArray(_Utils_1$Utils$hideSt, 2);
  1653. var hiddenDomainsString = _Utils_1$Utils$hideSt2[0];
  1654. var diff = _Utils_1$Utils$hideSt2[1];
  1655. return NodeUtils_1.NodeUtils.convertCodeToStructure(DomainLockNodeTemplate_1.DomainLockNodeTemplate().formatUnicorn({
  1656. diff: diff,
  1657. domains: hiddenDomainsString
  1658. }));
  1659. }
  1660. }]);
  1661. return DomainLockNode;
  1662. }(AbstractCustomNode_1.AbstractCustomNode);
  1663. exports.DomainLockNode = DomainLockNode;
  1664. /***/ },
  1665. /* 36 */
  1666. /***/ function(module, exports, __webpack_require__) {
  1667. "use strict";
  1668. "use strict";
  1669. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1670. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1671. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1672. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1673. var AppendState_1 = __webpack_require__(4);
  1674. var NoCustomNodesPreset_1 = __webpack_require__(17);
  1675. var SelfDefendingTemplate_1 = __webpack_require__(67);
  1676. var AbstractCustomNode_1 = __webpack_require__(5);
  1677. var JavaScriptObfuscator_1 = __webpack_require__(9);
  1678. var NodeUtils_1 = __webpack_require__(1);
  1679. var CustomNodeAppender_1 = __webpack_require__(15);
  1680. var SelfDefendingUnicodeNode = function (_AbstractCustomNode_) {
  1681. _inherits(SelfDefendingUnicodeNode, _AbstractCustomNode_);
  1682. function SelfDefendingUnicodeNode() {
  1683. _classCallCheck(this, SelfDefendingUnicodeNode);
  1684. var _this = _possibleConstructorReturn(this, (SelfDefendingUnicodeNode.__proto__ || Object.getPrototypeOf(SelfDefendingUnicodeNode)).apply(this, arguments));
  1685. _this.appendState = AppendState_1.AppendState.AfterObfuscation;
  1686. return _this;
  1687. }
  1688. _createClass(SelfDefendingUnicodeNode, [{
  1689. key: 'appendNode',
  1690. value: function appendNode(blockScopeNode) {
  1691. CustomNodeAppender_1.CustomNodeAppender.appendNode(blockScopeNode.body, this.getNode(), CustomNodeAppender_1.CustomNodeAppender.getIndexByThreshold(blockScopeNode.body.length));
  1692. }
  1693. }, {
  1694. key: 'getNodeStructure',
  1695. value: function getNodeStructure() {
  1696. return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(SelfDefendingTemplate_1.SelfDefendingTemplate(), NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode());
  1697. }
  1698. }]);
  1699. return SelfDefendingUnicodeNode;
  1700. }(AbstractCustomNode_1.AbstractCustomNode);
  1701. exports.SelfDefendingUnicodeNode = SelfDefendingUnicodeNode;
  1702. /***/ },
  1703. /* 37 */
  1704. /***/ function(module, exports, __webpack_require__) {
  1705. "use strict";
  1706. "use strict";
  1707. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1708. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1709. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1710. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1711. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1712. __webpack_require__(8);
  1713. var AppendState_1 = __webpack_require__(4);
  1714. var UnicodeArrayCallsWrapperTemplate_1 = __webpack_require__(68);
  1715. var AbstractCustomNode_1 = __webpack_require__(5);
  1716. var NodeUtils_1 = __webpack_require__(1);
  1717. var Utils_1 = __webpack_require__(0);
  1718. var UnicodeArrayCallsWrapper = function (_AbstractCustomNode_) {
  1719. _inherits(UnicodeArrayCallsWrapper, _AbstractCustomNode_);
  1720. function UnicodeArrayCallsWrapper(unicodeArrayCallsWrapperName, unicodeArrayName, unicodeArray, options) {
  1721. _classCallCheck(this, UnicodeArrayCallsWrapper);
  1722. var _this = _possibleConstructorReturn(this, (UnicodeArrayCallsWrapper.__proto__ || Object.getPrototypeOf(UnicodeArrayCallsWrapper)).call(this, options));
  1723. _this.appendState = AppendState_1.AppendState.AfterObfuscation;
  1724. _this.unicodeArrayCallsWrapperName = unicodeArrayCallsWrapperName;
  1725. _this.unicodeArrayName = unicodeArrayName;
  1726. _this.unicodeArray = unicodeArray;
  1727. return _this;
  1728. }
  1729. _createClass(UnicodeArrayCallsWrapper, [{
  1730. key: 'appendNode',
  1731. value: function appendNode(blockScopeNode) {
  1732. if (!this.unicodeArray.getLength()) {
  1733. return;
  1734. }
  1735. NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
  1736. }
  1737. }, {
  1738. key: 'getNodeIdentifier',
  1739. value: function getNodeIdentifier() {
  1740. return this.unicodeArrayCallsWrapperName;
  1741. }
  1742. }, {
  1743. key: 'getNode',
  1744. value: function getNode() {
  1745. return _get(UnicodeArrayCallsWrapper.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayCallsWrapper.prototype), 'getNode', this).call(this);
  1746. }
  1747. }, {
  1748. key: 'getNodeStructure',
  1749. value: function getNodeStructure() {
  1750. var keyName = Utils_1.Utils.getRandomVariableName();
  1751. return NodeUtils_1.NodeUtils.convertCodeToStructure(UnicodeArrayCallsWrapperTemplate_1.UnicodeArrayCallsWrapperTemplate().formatUnicorn({
  1752. keyName: keyName,
  1753. unicodeArrayCallsWrapperName: this.unicodeArrayCallsWrapperName,
  1754. unicodeArrayName: this.unicodeArrayName
  1755. }));
  1756. }
  1757. }]);
  1758. return UnicodeArrayCallsWrapper;
  1759. }(AbstractCustomNode_1.AbstractCustomNode);
  1760. exports.UnicodeArrayCallsWrapper = UnicodeArrayCallsWrapper;
  1761. /***/ },
  1762. /* 38 */
  1763. /***/ function(module, exports, __webpack_require__) {
  1764. "use strict";
  1765. "use strict";
  1766. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1767. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1768. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1769. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1770. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1771. __webpack_require__(8);
  1772. var AppendState_1 = __webpack_require__(4);
  1773. var NoCustomNodesPreset_1 = __webpack_require__(17);
  1774. var AtobTemplate_1 = __webpack_require__(61);
  1775. var SelfDefendingTemplate_1 = __webpack_require__(69);
  1776. var UnicodeArrayDecodeNodeTemplate_1 = __webpack_require__(70);
  1777. var AbstractCustomNode_1 = __webpack_require__(5);
  1778. var JavaScriptObfuscator_1 = __webpack_require__(9);
  1779. var NodeUtils_1 = __webpack_require__(1);
  1780. var UnicodeArrayDecodeNode = function (_AbstractCustomNode_) {
  1781. _inherits(UnicodeArrayDecodeNode, _AbstractCustomNode_);
  1782. function UnicodeArrayDecodeNode(unicodeArrayName, unicodeArray, options) {
  1783. _classCallCheck(this, UnicodeArrayDecodeNode);
  1784. var _this = _possibleConstructorReturn(this, (UnicodeArrayDecodeNode.__proto__ || Object.getPrototypeOf(UnicodeArrayDecodeNode)).call(this, options));
  1785. _this.appendState = AppendState_1.AppendState.AfterObfuscation;
  1786. _this.unicodeArrayName = unicodeArrayName;
  1787. _this.unicodeArray = unicodeArray;
  1788. return _this;
  1789. }
  1790. _createClass(UnicodeArrayDecodeNode, [{
  1791. key: 'appendNode',
  1792. value: function appendNode(blockScopeNode) {
  1793. if (!this.unicodeArray.getLength()) {
  1794. return;
  1795. }
  1796. NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
  1797. }
  1798. }, {
  1799. key: 'getNode',
  1800. value: function getNode() {
  1801. return _get(UnicodeArrayDecodeNode.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayDecodeNode.prototype), 'getNode', this).call(this);
  1802. }
  1803. }, {
  1804. key: 'getNodeStructure',
  1805. value: function getNodeStructure() {
  1806. var forLoopFunctionName = 'forLoopFunc';
  1807. var code = void 0;
  1808. if (this.options.selfDefending) {
  1809. code = SelfDefendingTemplate_1.SelfDefendingTemplate().formatUnicorn({
  1810. forLoopFunctionName: forLoopFunctionName,
  1811. unicodeArrayName: this.unicodeArrayName
  1812. });
  1813. } else {
  1814. code = forLoopFunctionName + '();';
  1815. }
  1816. return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(UnicodeArrayDecodeNodeTemplate_1.UnicodeArrayDecodeNodeTemplate().formatUnicorn({
  1817. atobPolyfill: AtobTemplate_1.AtobTemplate(),
  1818. code: code,
  1819. forLoopFunctionName: forLoopFunctionName,
  1820. unicodeArrayName: this.unicodeArrayName
  1821. }), NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode());
  1822. }
  1823. }]);
  1824. return UnicodeArrayDecodeNode;
  1825. }(AbstractCustomNode_1.AbstractCustomNode);
  1826. exports.UnicodeArrayDecodeNode = UnicodeArrayDecodeNode;
  1827. /***/ },
  1828. /* 39 */
  1829. /***/ function(module, exports, __webpack_require__) {
  1830. "use strict";
  1831. "use strict";
  1832. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1833. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1834. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1835. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1836. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1837. __webpack_require__(8);
  1838. var AppendState_1 = __webpack_require__(4);
  1839. var UnicodeArrayTemplate_1 = __webpack_require__(71);
  1840. var AbstractCustomNode_1 = __webpack_require__(5);
  1841. var NodeUtils_1 = __webpack_require__(1);
  1842. var UnicodeArrayNode = function (_AbstractCustomNode_) {
  1843. _inherits(UnicodeArrayNode, _AbstractCustomNode_);
  1844. function UnicodeArrayNode(unicodeArray, unicodeArrayName) {
  1845. var unicodeArrayRotateValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  1846. var options = arguments[3];
  1847. _classCallCheck(this, UnicodeArrayNode);
  1848. var _this = _possibleConstructorReturn(this, (UnicodeArrayNode.__proto__ || Object.getPrototypeOf(UnicodeArrayNode)).call(this, options));
  1849. _this.appendState = AppendState_1.AppendState.AfterObfuscation;
  1850. _this.unicodeArray = unicodeArray;
  1851. _this.unicodeArrayName = unicodeArrayName;
  1852. _this.unicodeArrayRotateValue = unicodeArrayRotateValue;
  1853. return _this;
  1854. }
  1855. _createClass(UnicodeArrayNode, [{
  1856. key: 'appendNode',
  1857. value: function appendNode(blockScopeNode) {
  1858. if (!this.unicodeArray.getLength()) {
  1859. return;
  1860. }
  1861. NodeUtils_1.NodeUtils.prependNode(blockScopeNode.body, this.getNode());
  1862. }
  1863. }, {
  1864. key: 'getNodeIdentifier',
  1865. value: function getNodeIdentifier() {
  1866. return this.unicodeArrayName;
  1867. }
  1868. }, {
  1869. key: 'getNodeData',
  1870. value: function getNodeData() {
  1871. return this.unicodeArray;
  1872. }
  1873. }, {
  1874. key: 'getNode',
  1875. value: function getNode() {
  1876. this.unicodeArray.rotateArray(this.unicodeArrayRotateValue);
  1877. return _get(UnicodeArrayNode.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayNode.prototype), 'getNode', this).call(this);
  1878. }
  1879. }, {
  1880. key: 'updateNodeData',
  1881. value: function updateNodeData(data) {
  1882. this.unicodeArray.addToArray(data);
  1883. }
  1884. }, {
  1885. key: 'getNodeStructure',
  1886. value: function getNodeStructure() {
  1887. return NodeUtils_1.NodeUtils.convertCodeToStructure(UnicodeArrayTemplate_1.UnicodeArrayTemplate().formatUnicorn({
  1888. unicodeArrayName: this.unicodeArrayName,
  1889. unicodeArray: this.unicodeArray.toString()
  1890. }));
  1891. }
  1892. }]);
  1893. return UnicodeArrayNode;
  1894. }(AbstractCustomNode_1.AbstractCustomNode);
  1895. UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH = 4;
  1896. exports.UnicodeArrayNode = UnicodeArrayNode;
  1897. /***/ },
  1898. /* 40 */
  1899. /***/ function(module, exports, __webpack_require__) {
  1900. "use strict";
  1901. "use strict";
  1902. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1903. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1904. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1905. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1906. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1907. __webpack_require__(8);
  1908. var AppendState_1 = __webpack_require__(4);
  1909. var NoCustomNodesPreset_1 = __webpack_require__(17);
  1910. var SelfDefendingTemplate_1 = __webpack_require__(72);
  1911. var UnicodeArrayRotateFunctionTemplate_1 = __webpack_require__(73);
  1912. var AbstractCustomNode_1 = __webpack_require__(5);
  1913. var JavaScriptObfuscator_1 = __webpack_require__(9);
  1914. var NodeUtils_1 = __webpack_require__(1);
  1915. var Utils_1 = __webpack_require__(0);
  1916. var UnicodeArrayRotateFunctionNode = function (_AbstractCustomNode_) {
  1917. _inherits(UnicodeArrayRotateFunctionNode, _AbstractCustomNode_);
  1918. function UnicodeArrayRotateFunctionNode(unicodeArrayName, unicodeArray, unicodeArrayRotateValue, options) {
  1919. _classCallCheck(this, UnicodeArrayRotateFunctionNode);
  1920. var _this = _possibleConstructorReturn(this, (UnicodeArrayRotateFunctionNode.__proto__ || Object.getPrototypeOf(UnicodeArrayRotateFunctionNode)).call(this, options));
  1921. _this.appendState = AppendState_1.AppendState.AfterObfuscation;
  1922. _this.unicodeArrayName = unicodeArrayName;
  1923. _this.unicodeArray = unicodeArray;
  1924. _this.unicodeArrayRotateValue = unicodeArrayRotateValue;
  1925. return _this;
  1926. }
  1927. _createClass(UnicodeArrayRotateFunctionNode, [{
  1928. key: 'appendNode',
  1929. value: function appendNode(blockScopeNode) {
  1930. if (!this.unicodeArray.getLength()) {
  1931. return;
  1932. }
  1933. NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1);
  1934. }
  1935. }, {
  1936. key: 'getNode',
  1937. value: function getNode() {
  1938. return _get(UnicodeArrayRotateFunctionNode.prototype.__proto__ || Object.getPrototypeOf(UnicodeArrayRotateFunctionNode.prototype), 'getNode', this).call(this);
  1939. }
  1940. }, {
  1941. key: 'getNodeStructure',
  1942. value: function getNodeStructure() {
  1943. var code = '',
  1944. timesName = Utils_1.Utils.getRandomVariableName(),
  1945. whileFunctionName = Utils_1.Utils.getRandomVariableName();
  1946. if (this.options.selfDefending) {
  1947. code = SelfDefendingTemplate_1.SelfDefendingTemplate().formatUnicorn({
  1948. timesName: timesName,
  1949. whileFunctionName: whileFunctionName
  1950. });
  1951. } else {
  1952. code = whileFunctionName + '(++' + timesName + ')';
  1953. }
  1954. return NodeUtils_1.NodeUtils.convertCodeToStructure(JavaScriptObfuscator_1.JavaScriptObfuscator.obfuscate(UnicodeArrayRotateFunctionTemplate_1.UnicodeArrayRotateFunctionTemplate().formatUnicorn({
  1955. code: code,
  1956. timesName: timesName,
  1957. unicodeArrayName: this.unicodeArrayName,
  1958. unicodeArrayRotateValue: Utils_1.Utils.decToHex(this.unicodeArrayRotateValue),
  1959. whileFunctionName: whileFunctionName
  1960. }), NoCustomNodesPreset_1.NO_CUSTOM_NODES_PRESET).getObfuscatedCode());
  1961. }
  1962. }]);
  1963. return UnicodeArrayRotateFunctionNode;
  1964. }(AbstractCustomNode_1.AbstractCustomNode);
  1965. exports.UnicodeArrayRotateFunctionNode = UnicodeArrayRotateFunctionNode;
  1966. /***/ },
  1967. /* 41 */
  1968. /***/ function(module, exports, __webpack_require__) {
  1969. "use strict";
  1970. "use strict";
  1971. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1972. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1973. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1974. var AbstractNodesGroup_1 = __webpack_require__(10);
  1975. var ConsoleOutputDisableExpressionNode_1 = __webpack_require__(31);
  1976. var ConsoleOutputNodesGroup = function (_AbstractNodesGroup_) {
  1977. _inherits(ConsoleOutputNodesGroup, _AbstractNodesGroup_);
  1978. function ConsoleOutputNodesGroup(options) {
  1979. _classCallCheck(this, ConsoleOutputNodesGroup);
  1980. var _this = _possibleConstructorReturn(this, (ConsoleOutputNodesGroup.__proto__ || Object.getPrototypeOf(ConsoleOutputNodesGroup)).call(this, options));
  1981. if (!_this.options.disableConsoleOutput) {
  1982. return _possibleConstructorReturn(_this);
  1983. }
  1984. _this.nodes.set('consoleOutputDisableExpressionNode', new ConsoleOutputDisableExpressionNode_1.ConsoleOutputDisableExpressionNode(_this.options));
  1985. return _this;
  1986. }
  1987. return ConsoleOutputNodesGroup;
  1988. }(AbstractNodesGroup_1.AbstractNodesGroup);
  1989. exports.ConsoleOutputNodesGroup = ConsoleOutputNodesGroup;
  1990. /***/ },
  1991. /* 42 */
  1992. /***/ function(module, exports, __webpack_require__) {
  1993. "use strict";
  1994. "use strict";
  1995. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1996. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1997. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1998. var DebugProtectionFunctionCallNode_1 = __webpack_require__(32);
  1999. var DebugProtectionFunctionIntervalNode_1 = __webpack_require__(33);
  2000. var DebugProtectionFunctionNode_1 = __webpack_require__(34);
  2001. var AbstractNodesGroup_1 = __webpack_require__(10);
  2002. var Utils_1 = __webpack_require__(0);
  2003. var DebugProtectionNodesGroup = function (_AbstractNodesGroup_) {
  2004. _inherits(DebugProtectionNodesGroup, _AbstractNodesGroup_);
  2005. function DebugProtectionNodesGroup(options) {
  2006. _classCallCheck(this, DebugProtectionNodesGroup);
  2007. var _this = _possibleConstructorReturn(this, (DebugProtectionNodesGroup.__proto__ || Object.getPrototypeOf(DebugProtectionNodesGroup)).call(this, options));
  2008. _this.debugProtectionFunctionIdentifier = Utils_1.Utils.getRandomVariableName();
  2009. if (!_this.options.debugProtection) {
  2010. return _possibleConstructorReturn(_this);
  2011. }
  2012. _this.nodes.set('debugProtectionFunctionNode', new DebugProtectionFunctionNode_1.DebugProtectionFunctionNode(_this.debugProtectionFunctionIdentifier, _this.options));
  2013. _this.nodes.set('debugProtectionFunctionCallNode', new DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode(_this.debugProtectionFunctionIdentifier, _this.options));
  2014. if (_this.options.debugProtectionInterval) {
  2015. _this.nodes.set('debugProtectionFunctionIntervalNode', new DebugProtectionFunctionIntervalNode_1.DebugProtectionFunctionIntervalNode(_this.debugProtectionFunctionIdentifier, _this.options));
  2016. }
  2017. return _this;
  2018. }
  2019. return DebugProtectionNodesGroup;
  2020. }(AbstractNodesGroup_1.AbstractNodesGroup);
  2021. exports.DebugProtectionNodesGroup = DebugProtectionNodesGroup;
  2022. /***/ },
  2023. /* 43 */
  2024. /***/ function(module, exports, __webpack_require__) {
  2025. "use strict";
  2026. "use strict";
  2027. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2028. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2029. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2030. var AbstractNodesGroup_1 = __webpack_require__(10);
  2031. var DomainLockNode_1 = __webpack_require__(35);
  2032. var DomainLockNodesGroup = function (_AbstractNodesGroup_) {
  2033. _inherits(DomainLockNodesGroup, _AbstractNodesGroup_);
  2034. function DomainLockNodesGroup(options) {
  2035. _classCallCheck(this, DomainLockNodesGroup);
  2036. var _this = _possibleConstructorReturn(this, (DomainLockNodesGroup.__proto__ || Object.getPrototypeOf(DomainLockNodesGroup)).call(this, options));
  2037. if (!_this.options.domainLock.length) {
  2038. return _possibleConstructorReturn(_this);
  2039. }
  2040. _this.nodes.set('DomainLockNode', new DomainLockNode_1.DomainLockNode(_this.options));
  2041. return _this;
  2042. }
  2043. return DomainLockNodesGroup;
  2044. }(AbstractNodesGroup_1.AbstractNodesGroup);
  2045. exports.DomainLockNodesGroup = DomainLockNodesGroup;
  2046. /***/ },
  2047. /* 44 */
  2048. /***/ function(module, exports, __webpack_require__) {
  2049. "use strict";
  2050. "use strict";
  2051. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2052. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2053. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2054. var AbstractNodesGroup_1 = __webpack_require__(10);
  2055. var SelfDefendingUnicodeNode_1 = __webpack_require__(36);
  2056. var SelfDefendingNodesGroup = function (_AbstractNodesGroup_) {
  2057. _inherits(SelfDefendingNodesGroup, _AbstractNodesGroup_);
  2058. function SelfDefendingNodesGroup(options) {
  2059. _classCallCheck(this, SelfDefendingNodesGroup);
  2060. var _this = _possibleConstructorReturn(this, (SelfDefendingNodesGroup.__proto__ || Object.getPrototypeOf(SelfDefendingNodesGroup)).call(this, options));
  2061. if (!_this.options.selfDefending) {
  2062. return _possibleConstructorReturn(_this);
  2063. }
  2064. _this.nodes.set('selfDefendingUnicodeNode', new SelfDefendingUnicodeNode_1.SelfDefendingUnicodeNode(_this.options));
  2065. return _this;
  2066. }
  2067. return SelfDefendingNodesGroup;
  2068. }(AbstractNodesGroup_1.AbstractNodesGroup);
  2069. exports.SelfDefendingNodesGroup = SelfDefendingNodesGroup;
  2070. /***/ },
  2071. /* 45 */
  2072. /***/ function(module, exports, __webpack_require__) {
  2073. "use strict";
  2074. "use strict";
  2075. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2076. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2077. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2078. var AbstractNodesGroup_1 = __webpack_require__(10);
  2079. var UnicodeArray_1 = __webpack_require__(28);
  2080. var UnicodeArrayCallsWrapper_1 = __webpack_require__(37);
  2081. var UnicodeArrayDecodeNode_1 = __webpack_require__(38);
  2082. var UnicodeArrayNode_1 = __webpack_require__(39);
  2083. var UnicodeArrayRotateFunctionNode_1 = __webpack_require__(40);
  2084. var Utils_1 = __webpack_require__(0);
  2085. var UnicodeArrayNodesGroup = function (_AbstractNodesGroup_) {
  2086. _inherits(UnicodeArrayNodesGroup, _AbstractNodesGroup_);
  2087. function UnicodeArrayNodesGroup(options) {
  2088. _classCallCheck(this, UnicodeArrayNodesGroup);
  2089. var _this = _possibleConstructorReturn(this, (UnicodeArrayNodesGroup.__proto__ || Object.getPrototypeOf(UnicodeArrayNodesGroup)).call(this, options));
  2090. _this.unicodeArrayName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
  2091. _this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
  2092. if (!_this.options.unicodeArray) {
  2093. return _possibleConstructorReturn(_this);
  2094. }
  2095. if (_this.options.rotateUnicodeArray) {
  2096. _this.unicodeArrayRotateValue = Utils_1.Utils.getRandomGenerator().integer({
  2097. min: 100,
  2098. max: 500
  2099. });
  2100. } else {
  2101. _this.unicodeArrayRotateValue = 0;
  2102. }
  2103. var unicodeArray = new UnicodeArray_1.UnicodeArray(),
  2104. unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(unicodeArray, _this.unicodeArrayName, _this.unicodeArrayRotateValue, _this.options);
  2105. _this.nodes.set('unicodeArrayNode', unicodeArrayNode);
  2106. if (_this.options.wrapUnicodeArrayCalls) {
  2107. _this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(_this.unicodeArrayTranslatorName, _this.unicodeArrayName, unicodeArray, _this.options));
  2108. }
  2109. if (_this.options.encodeUnicodeLiterals) {
  2110. _this.nodes.set('unicodeArrayDecodeNode', new UnicodeArrayDecodeNode_1.UnicodeArrayDecodeNode(_this.unicodeArrayName, unicodeArray, _this.options));
  2111. }
  2112. if (_this.options.rotateUnicodeArray) {
  2113. _this.nodes.set('unicodeArrayRotateFunctionNode', new UnicodeArrayRotateFunctionNode_1.UnicodeArrayRotateFunctionNode(_this.unicodeArrayName, unicodeArray, _this.unicodeArrayRotateValue, _this.options));
  2114. }
  2115. return _this;
  2116. }
  2117. return UnicodeArrayNodesGroup;
  2118. }(AbstractNodesGroup_1.AbstractNodesGroup);
  2119. exports.UnicodeArrayNodesGroup = UnicodeArrayNodesGroup;
  2120. /***/ },
  2121. /* 46 */
  2122. /***/ function(module, exports, __webpack_require__) {
  2123. "use strict";
  2124. "use strict";
  2125. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2126. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2127. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2128. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2129. var estraverse = __webpack_require__(3);
  2130. var NodeType_1 = __webpack_require__(6);
  2131. var AbstractNodeObfuscator_1 = __webpack_require__(7);
  2132. var IdentifierReplacer_1 = __webpack_require__(14);
  2133. var Nodes_1 = __webpack_require__(2);
  2134. var NodeUtils_1 = __webpack_require__(1);
  2135. var CatchClauseObfuscator = function (_AbstractNodeObfuscat) {
  2136. _inherits(CatchClauseObfuscator, _AbstractNodeObfuscat);
  2137. function CatchClauseObfuscator(nodes, options) {
  2138. _classCallCheck(this, CatchClauseObfuscator);
  2139. var _this = _possibleConstructorReturn(this, (CatchClauseObfuscator.__proto__ || Object.getPrototypeOf(CatchClauseObfuscator)).call(this, nodes, options));
  2140. _this.identifierReplacer = new IdentifierReplacer_1.IdentifierReplacer(_this.nodes, _this.options);
  2141. return _this;
  2142. }
  2143. _createClass(CatchClauseObfuscator, [{
  2144. key: 'obfuscateNode',
  2145. value: function obfuscateNode(catchClauseNode) {
  2146. this.storeCatchClauseParam(catchClauseNode);
  2147. this.replaceCatchClauseParam(catchClauseNode);
  2148. }
  2149. }, {
  2150. key: 'storeCatchClauseParam',
  2151. value: function storeCatchClauseParam(catchClauseNode) {
  2152. var _this2 = this;
  2153. NodeUtils_1.NodeUtils.typedReplace(catchClauseNode.param, NodeType_1.NodeType.Identifier, {
  2154. enter: function enter(node) {
  2155. return _this2.identifierReplacer.storeNames(node.name);
  2156. }
  2157. });
  2158. }
  2159. }, {
  2160. key: 'replaceCatchClauseParam',
  2161. value: function replaceCatchClauseParam(catchClauseNode) {
  2162. var _this3 = this;
  2163. estraverse.replace(catchClauseNode, {
  2164. enter: function enter(node, parentNode) {
  2165. if (Nodes_1.Nodes.isReplaceableIdentifierNode(node, parentNode)) {
  2166. node.name = _this3.identifierReplacer.replace(node.name);
  2167. }
  2168. }
  2169. });
  2170. }
  2171. }]);
  2172. return CatchClauseObfuscator;
  2173. }(AbstractNodeObfuscator_1.AbstractNodeObfuscator);
  2174. exports.CatchClauseObfuscator = CatchClauseObfuscator;
  2175. /***/ },
  2176. /* 47 */
  2177. /***/ function(module, exports, __webpack_require__) {
  2178. "use strict";
  2179. "use strict";
  2180. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2181. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2182. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2183. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2184. var estraverse = __webpack_require__(3);
  2185. var NodeType_1 = __webpack_require__(6);
  2186. var AbstractNodeObfuscator_1 = __webpack_require__(7);
  2187. var IdentifierReplacer_1 = __webpack_require__(14);
  2188. var Nodes_1 = __webpack_require__(2);
  2189. var NodeUtils_1 = __webpack_require__(1);
  2190. var FunctionDeclarationObfuscator = function (_AbstractNodeObfuscat) {
  2191. _inherits(FunctionDeclarationObfuscator, _AbstractNodeObfuscat);
  2192. function FunctionDeclarationObfuscator(nodes, options) {
  2193. _classCallCheck(this, FunctionDeclarationObfuscator);
  2194. var _this = _possibleConstructorReturn(this, (FunctionDeclarationObfuscator.__proto__ || Object.getPrototypeOf(FunctionDeclarationObfuscator)).call(this, nodes, options));
  2195. _this.identifierReplacer = new IdentifierReplacer_1.IdentifierReplacer(_this.nodes, _this.options);
  2196. return _this;
  2197. }
  2198. _createClass(FunctionDeclarationObfuscator, [{
  2199. key: 'obfuscateNode',
  2200. value: function obfuscateNode(functionDeclarationNode, parentNode) {
  2201. if (parentNode.type === NodeType_1.NodeType.Program) {
  2202. return;
  2203. }
  2204. this.storeFunctionName(functionDeclarationNode);
  2205. this.replaceFunctionName(functionDeclarationNode);
  2206. }
  2207. }, {
  2208. key: 'storeFunctionName',
  2209. value: function storeFunctionName(functionDeclarationNode) {
  2210. var _this2 = this;
  2211. NodeUtils_1.NodeUtils.typedReplace(functionDeclarationNode.id, NodeType_1.NodeType.Identifier, {
  2212. enter: function enter(node) {
  2213. return _this2.identifierReplacer.storeNames(node.name);
  2214. }
  2215. });
  2216. }
  2217. }, {
  2218. key: 'replaceFunctionName',
  2219. value: function replaceFunctionName(functionDeclarationNode) {
  2220. var _this3 = this;
  2221. var scopeNode = NodeUtils_1.NodeUtils.getBlockScopeOfNode(functionDeclarationNode);
  2222. estraverse.replace(scopeNode, {
  2223. enter: function enter(node, parentNode) {
  2224. if (Nodes_1.Nodes.isReplaceableIdentifierNode(node, parentNode)) {
  2225. node.name = _this3.identifierReplacer.replace(node.name);
  2226. }
  2227. }
  2228. });
  2229. }
  2230. }]);
  2231. return FunctionDeclarationObfuscator;
  2232. }(AbstractNodeObfuscator_1.AbstractNodeObfuscator);
  2233. exports.FunctionDeclarationObfuscator = FunctionDeclarationObfuscator;
  2234. /***/ },
  2235. /* 48 */
  2236. /***/ function(module, exports, __webpack_require__) {
  2237. "use strict";
  2238. "use strict";
  2239. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2240. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2241. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2242. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2243. var estraverse = __webpack_require__(3);
  2244. var NodeType_1 = __webpack_require__(6);
  2245. var AbstractNodeObfuscator_1 = __webpack_require__(7);
  2246. var IdentifierReplacer_1 = __webpack_require__(14);
  2247. var Nodes_1 = __webpack_require__(2);
  2248. var NodeUtils_1 = __webpack_require__(1);
  2249. var FunctionObfuscator = function (_AbstractNodeObfuscat) {
  2250. _inherits(FunctionObfuscator, _AbstractNodeObfuscat);
  2251. function FunctionObfuscator(nodes, options) {
  2252. _classCallCheck(this, FunctionObfuscator);
  2253. var _this = _possibleConstructorReturn(this, (FunctionObfuscator.__proto__ || Object.getPrototypeOf(FunctionObfuscator)).call(this, nodes, options));
  2254. _this.identifierReplacer = new IdentifierReplacer_1.IdentifierReplacer(_this.nodes, _this.options);
  2255. return _this;
  2256. }
  2257. _createClass(FunctionObfuscator, [{
  2258. key: 'obfuscateNode',
  2259. value: function obfuscateNode(functionNode) {
  2260. this.storeFunctionParams(functionNode);
  2261. this.replaceFunctionParams(functionNode);
  2262. }
  2263. }, {
  2264. key: 'storeFunctionParams',
  2265. value: function storeFunctionParams(functionNode) {
  2266. var _this2 = this;
  2267. functionNode.params.forEach(function (paramsNode) {
  2268. NodeUtils_1.NodeUtils.typedReplace(paramsNode, NodeType_1.NodeType.Identifier, {
  2269. enter: function enter(node) {
  2270. return _this2.identifierReplacer.storeNames(node.name);
  2271. }
  2272. });
  2273. });
  2274. }
  2275. }, {
  2276. key: 'replaceFunctionParams',
  2277. value: function replaceFunctionParams(functionNode) {
  2278. var _this3 = this;
  2279. var replaceVisitor = {
  2280. enter: function enter(node, parentNode) {
  2281. if (Nodes_1.Nodes.isReplaceableIdentifierNode(node, parentNode)) {
  2282. var newNodeName = _this3.identifierReplacer.replace(node.name);
  2283. if (node.name !== newNodeName) {
  2284. node.name = newNodeName;
  2285. node.obfuscated = true;
  2286. }
  2287. }
  2288. }
  2289. };
  2290. functionNode.params.forEach(function (paramsNode) {
  2291. estraverse.replace(paramsNode, replaceVisitor);
  2292. });
  2293. estraverse.replace(functionNode.body, replaceVisitor);
  2294. }
  2295. }]);
  2296. return FunctionObfuscator;
  2297. }(AbstractNodeObfuscator_1.AbstractNodeObfuscator);
  2298. exports.FunctionObfuscator = FunctionObfuscator;
  2299. /***/ },
  2300. /* 49 */
  2301. /***/ function(module, exports, __webpack_require__) {
  2302. "use strict";
  2303. "use strict";
  2304. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  2305. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2306. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2307. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2308. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2309. var escodegen = __webpack_require__(11);
  2310. var AbstractNodeObfuscator_1 = __webpack_require__(7);
  2311. var BooleanLiteralReplacer_1 = __webpack_require__(54);
  2312. var Nodes_1 = __webpack_require__(2);
  2313. var NumberLiteralReplacer_1 = __webpack_require__(20);
  2314. var StringLiteralReplacer_1 = __webpack_require__(16);
  2315. var LiteralObfuscator = function (_AbstractNodeObfuscat) {
  2316. _inherits(LiteralObfuscator, _AbstractNodeObfuscat);
  2317. function LiteralObfuscator() {
  2318. _classCallCheck(this, LiteralObfuscator);
  2319. return _possibleConstructorReturn(this, (LiteralObfuscator.__proto__ || Object.getPrototypeOf(LiteralObfuscator)).apply(this, arguments));
  2320. }
  2321. _createClass(LiteralObfuscator, [{
  2322. key: 'obfuscateNode',
  2323. value: function obfuscateNode(literalNode, parentNode) {
  2324. if (Nodes_1.Nodes.isPropertyNode(parentNode) && parentNode.key === literalNode) {
  2325. return;
  2326. }
  2327. var content = void 0;
  2328. switch (_typeof(literalNode.value)) {
  2329. case 'boolean':
  2330. content = new BooleanLiteralReplacer_1.BooleanLiteralReplacer(this.nodes, this.options).replace(literalNode.value);
  2331. break;
  2332. case 'number':
  2333. content = new NumberLiteralReplacer_1.NumberLiteralReplacer(this.nodes, this.options).replace(literalNode.value);
  2334. break;
  2335. case 'string':
  2336. content = new StringLiteralReplacer_1.StringLiteralReplacer(this.nodes, this.options).replace(literalNode.value);
  2337. break;
  2338. default:
  2339. return;
  2340. }
  2341. literalNode['x-verbatim-property'] = {
  2342. content: content,
  2343. precedence: escodegen.Precedence.Primary
  2344. };
  2345. }
  2346. }]);
  2347. return LiteralObfuscator;
  2348. }(AbstractNodeObfuscator_1.AbstractNodeObfuscator);
  2349. exports.LiteralObfuscator = LiteralObfuscator;
  2350. /***/ },
  2351. /* 50 */
  2352. /***/ function(module, exports, __webpack_require__) {
  2353. "use strict";
  2354. "use strict";
  2355. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2356. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2357. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2358. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2359. var escodegen = __webpack_require__(11);
  2360. var estraverse = __webpack_require__(3);
  2361. var NodeType_1 = __webpack_require__(6);
  2362. var AbstractNodeObfuscator_1 = __webpack_require__(7);
  2363. var Nodes_1 = __webpack_require__(2);
  2364. var StringLiteralReplacer_1 = __webpack_require__(16);
  2365. var MemberExpressionObfuscator = function (_AbstractNodeObfuscat) {
  2366. _inherits(MemberExpressionObfuscator, _AbstractNodeObfuscat);
  2367. function MemberExpressionObfuscator() {
  2368. _classCallCheck(this, MemberExpressionObfuscator);
  2369. return _possibleConstructorReturn(this, (MemberExpressionObfuscator.__proto__ || Object.getPrototypeOf(MemberExpressionObfuscator)).apply(this, arguments));
  2370. }
  2371. _createClass(MemberExpressionObfuscator, [{
  2372. key: 'obfuscateNode',
  2373. value: function obfuscateNode(memberExpressionNode) {
  2374. var _this2 = this;
  2375. estraverse.replace(memberExpressionNode.property, {
  2376. enter: function enter(node, parentNode) {
  2377. if (Nodes_1.Nodes.isLiteralNode(node)) {
  2378. _this2.obfuscateLiteralProperty(node);
  2379. return;
  2380. }
  2381. if (Nodes_1.Nodes.isIdentifierNode(node)) {
  2382. if (memberExpressionNode.computed) {
  2383. return;
  2384. }
  2385. memberExpressionNode.computed = true;
  2386. _this2.obfuscateIdentifierProperty(node);
  2387. }
  2388. }
  2389. });
  2390. }
  2391. }, {
  2392. key: 'obfuscateIdentifierProperty',
  2393. value: function obfuscateIdentifierProperty(node) {
  2394. var nodeValue = node.name,
  2395. literalNode = {
  2396. raw: '\'' + nodeValue + '\'',
  2397. 'x-verbatim-property': {
  2398. content: new StringLiteralReplacer_1.StringLiteralReplacer(this.nodes, this.options).replace(nodeValue),
  2399. precedence: escodegen.Precedence.Primary
  2400. },
  2401. type: NodeType_1.NodeType.Literal,
  2402. value: nodeValue
  2403. };
  2404. delete node.name;
  2405. Object.assign(node, literalNode);
  2406. }
  2407. }, {
  2408. key: 'obfuscateLiteralProperty',
  2409. value: function obfuscateLiteralProperty(node) {
  2410. if (typeof node.value === 'string' && !node['x-verbatim-property']) {
  2411. node['x-verbatim-property'] = {
  2412. content: new StringLiteralReplacer_1.StringLiteralReplacer(this.nodes, this.options).replace(node.value),
  2413. precedence: escodegen.Precedence.Primary
  2414. };
  2415. }
  2416. }
  2417. }]);
  2418. return MemberExpressionObfuscator;
  2419. }(AbstractNodeObfuscator_1.AbstractNodeObfuscator);
  2420. exports.MemberExpressionObfuscator = MemberExpressionObfuscator;
  2421. /***/ },
  2422. /* 51 */
  2423. /***/ function(module, exports, __webpack_require__) {
  2424. "use strict";
  2425. "use strict";
  2426. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2427. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2428. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2429. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2430. var estraverse = __webpack_require__(3);
  2431. var AbstractNodeObfuscator_1 = __webpack_require__(7);
  2432. var Nodes_1 = __webpack_require__(2);
  2433. var Utils_1 = __webpack_require__(0);
  2434. var StringLiteralReplacer_1 = __webpack_require__(16);
  2435. var MethodDefinitionObfuscator = function (_AbstractNodeObfuscat) {
  2436. _inherits(MethodDefinitionObfuscator, _AbstractNodeObfuscat);
  2437. function MethodDefinitionObfuscator() {
  2438. _classCallCheck(this, MethodDefinitionObfuscator);
  2439. var _this = _possibleConstructorReturn(this, (MethodDefinitionObfuscator.__proto__ || Object.getPrototypeOf(MethodDefinitionObfuscator)).apply(this, arguments));
  2440. _this.ignoredNames = ['constructor'];
  2441. return _this;
  2442. }
  2443. _createClass(MethodDefinitionObfuscator, [{
  2444. key: 'obfuscateNode',
  2445. value: function obfuscateNode(methodDefinitionNode, parentNode) {
  2446. this.replaceMethodName(methodDefinitionNode);
  2447. }
  2448. }, {
  2449. key: 'replaceMethodName',
  2450. value: function replaceMethodName(methodDefinitionNode) {
  2451. var _this2 = this;
  2452. estraverse.replace(methodDefinitionNode.key, {
  2453. enter: function enter(node) {
  2454. if (Nodes_1.Nodes.isIdentifierNode(node) && !Utils_1.Utils.arrayContains(_this2.ignoredNames, node.name) && methodDefinitionNode.computed === false) {
  2455. methodDefinitionNode.computed = true;
  2456. node.name = new StringLiteralReplacer_1.StringLiteralReplacer(_this2.nodes, _this2.options).replace(node.name);
  2457. return;
  2458. }
  2459. return estraverse.VisitorOption.Skip;
  2460. }
  2461. });
  2462. }
  2463. }]);
  2464. return MethodDefinitionObfuscator;
  2465. }(AbstractNodeObfuscator_1.AbstractNodeObfuscator);
  2466. exports.MethodDefinitionObfuscator = MethodDefinitionObfuscator;
  2467. /***/ },
  2468. /* 52 */
  2469. /***/ function(module, exports, __webpack_require__) {
  2470. "use strict";
  2471. "use strict";
  2472. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2473. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2474. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2475. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2476. var escodegen = __webpack_require__(11);
  2477. var estraverse = __webpack_require__(3);
  2478. var NodeType_1 = __webpack_require__(6);
  2479. var AbstractNodeObfuscator_1 = __webpack_require__(7);
  2480. var Nodes_1 = __webpack_require__(2);
  2481. var Utils_1 = __webpack_require__(0);
  2482. var ObjectExpressionObfuscator = function (_AbstractNodeObfuscat) {
  2483. _inherits(ObjectExpressionObfuscator, _AbstractNodeObfuscat);
  2484. function ObjectExpressionObfuscator() {
  2485. _classCallCheck(this, ObjectExpressionObfuscator);
  2486. return _possibleConstructorReturn(this, (ObjectExpressionObfuscator.__proto__ || Object.getPrototypeOf(ObjectExpressionObfuscator)).apply(this, arguments));
  2487. }
  2488. _createClass(ObjectExpressionObfuscator, [{
  2489. key: 'obfuscateNode',
  2490. value: function obfuscateNode(objectExpressionNode) {
  2491. var _this2 = this;
  2492. objectExpressionNode.properties.forEach(function (property) {
  2493. if (property.shorthand) {
  2494. property.shorthand = false;
  2495. }
  2496. estraverse.replace(property.key, {
  2497. enter: function enter(node, parentNode) {
  2498. if (Nodes_1.Nodes.isLiteralNode(node)) {
  2499. _this2.obfuscateLiteralPropertyKey(node);
  2500. return;
  2501. }
  2502. if (Nodes_1.Nodes.isIdentifierNode(node)) {
  2503. _this2.obfuscateIdentifierPropertyKey(node);
  2504. }
  2505. }
  2506. });
  2507. });
  2508. }
  2509. }, {
  2510. key: 'obfuscateLiteralPropertyKey',
  2511. value: function obfuscateLiteralPropertyKey(node) {
  2512. if (typeof node.value === 'string' && !node['x-verbatim-property']) {
  2513. node['x-verbatim-property'] = {
  2514. content: Utils_1.Utils.stringToUnicode(node.value),
  2515. precedence: escodegen.Precedence.Primary
  2516. };
  2517. }
  2518. }
  2519. }, {
  2520. key: 'obfuscateIdentifierPropertyKey',
  2521. value: function obfuscateIdentifierPropertyKey(node) {
  2522. var nodeValue = node.name,
  2523. literalNode = {
  2524. raw: '\'' + nodeValue + '\'',
  2525. 'x-verbatim-property': {
  2526. content: Utils_1.Utils.stringToUnicode(nodeValue),
  2527. precedence: escodegen.Precedence.Primary
  2528. },
  2529. type: NodeType_1.NodeType.Literal,
  2530. value: nodeValue
  2531. };
  2532. delete node.name;
  2533. Object.assign(node, literalNode);
  2534. }
  2535. }]);
  2536. return ObjectExpressionObfuscator;
  2537. }(AbstractNodeObfuscator_1.AbstractNodeObfuscator);
  2538. exports.ObjectExpressionObfuscator = ObjectExpressionObfuscator;
  2539. /***/ },
  2540. /* 53 */
  2541. /***/ function(module, exports, __webpack_require__) {
  2542. "use strict";
  2543. "use strict";
  2544. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2545. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2546. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2547. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2548. var estraverse = __webpack_require__(3);
  2549. var NodeType_1 = __webpack_require__(6);
  2550. var AbstractNodeObfuscator_1 = __webpack_require__(7);
  2551. var IdentifierReplacer_1 = __webpack_require__(14);
  2552. var Nodes_1 = __webpack_require__(2);
  2553. var NodeUtils_1 = __webpack_require__(1);
  2554. var VariableDeclarationObfuscator = function (_AbstractNodeObfuscat) {
  2555. _inherits(VariableDeclarationObfuscator, _AbstractNodeObfuscat);
  2556. function VariableDeclarationObfuscator(nodes, options) {
  2557. _classCallCheck(this, VariableDeclarationObfuscator);
  2558. var _this = _possibleConstructorReturn(this, (VariableDeclarationObfuscator.__proto__ || Object.getPrototypeOf(VariableDeclarationObfuscator)).call(this, nodes, options));
  2559. _this.identifierReplacer = new IdentifierReplacer_1.IdentifierReplacer(_this.nodes, _this.options);
  2560. return _this;
  2561. }
  2562. _createClass(VariableDeclarationObfuscator, [{
  2563. key: 'obfuscateNode',
  2564. value: function obfuscateNode(variableDeclarationNode, parentNode) {
  2565. if (parentNode.type === NodeType_1.NodeType.Program) {
  2566. return;
  2567. }
  2568. this.storeVariableNames(variableDeclarationNode);
  2569. this.replaceVariableNames(variableDeclarationNode, parentNode);
  2570. }
  2571. }, {
  2572. key: 'storeVariableNames',
  2573. value: function storeVariableNames(variableDeclarationNode) {
  2574. var _this2 = this;
  2575. variableDeclarationNode.declarations.forEach(function (declarationNode) {
  2576. NodeUtils_1.NodeUtils.typedReplace(declarationNode.id, NodeType_1.NodeType.Identifier, {
  2577. enter: function enter(node) {
  2578. return _this2.identifierReplacer.storeNames(node.name);
  2579. }
  2580. });
  2581. });
  2582. }
  2583. }, {
  2584. key: 'replaceVariableNames',
  2585. value: function replaceVariableNames(variableDeclarationNode, variableParentNode) {
  2586. var _this3 = this;
  2587. var scopeNode = variableDeclarationNode.kind === 'var' ? NodeUtils_1.NodeUtils.getBlockScopeOfNode(variableDeclarationNode) : variableParentNode;
  2588. estraverse.replace(scopeNode, {
  2589. enter: function enter(node, parentNode) {
  2590. if (!node.obfuscated && Nodes_1.Nodes.isReplaceableIdentifierNode(node, parentNode)) {
  2591. node.name = _this3.identifierReplacer.replace(node.name);
  2592. }
  2593. }
  2594. });
  2595. }
  2596. }]);
  2597. return VariableDeclarationObfuscator;
  2598. }(AbstractNodeObfuscator_1.AbstractNodeObfuscator);
  2599. exports.VariableDeclarationObfuscator = VariableDeclarationObfuscator;
  2600. /***/ },
  2601. /* 54 */
  2602. /***/ function(module, exports, __webpack_require__) {
  2603. "use strict";
  2604. "use strict";
  2605. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2606. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2607. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2608. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2609. var JSFuck_1 = __webpack_require__(19);
  2610. var AbstractReplacer_1 = __webpack_require__(13);
  2611. var BooleanLiteralReplacer = function (_AbstractReplacer_1$A) {
  2612. _inherits(BooleanLiteralReplacer, _AbstractReplacer_1$A);
  2613. function BooleanLiteralReplacer() {
  2614. _classCallCheck(this, BooleanLiteralReplacer);
  2615. return _possibleConstructorReturn(this, (BooleanLiteralReplacer.__proto__ || Object.getPrototypeOf(BooleanLiteralReplacer)).apply(this, arguments));
  2616. }
  2617. _createClass(BooleanLiteralReplacer, [{
  2618. key: 'replace',
  2619. value: function replace(nodeValue) {
  2620. return nodeValue ? JSFuck_1.JSFuck.True : JSFuck_1.JSFuck.False;
  2621. }
  2622. }]);
  2623. return BooleanLiteralReplacer;
  2624. }(AbstractReplacer_1.AbstractReplacer);
  2625. exports.BooleanLiteralReplacer = BooleanLiteralReplacer;
  2626. /***/ },
  2627. /* 55 */
  2628. /***/ function(module, exports, __webpack_require__) {
  2629. "use strict";
  2630. "use strict";
  2631. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  2632. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2633. var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
  2634. var c = arguments.length,
  2635. r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
  2636. d;
  2637. if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
  2638. if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2639. }return c > 3 && r && Object.defineProperty(target, key, r), r;
  2640. };
  2641. var __metadata = undefined && undefined.__metadata || function (k, v) {
  2642. if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2643. };
  2644. var class_validator_1 = __webpack_require__(76);
  2645. var TSourceMapMode_1 = __webpack_require__(74);
  2646. var DefaultPreset_1 = __webpack_require__(21);
  2647. var OptionsNormalizer_1 = __webpack_require__(56);
  2648. var ValidationErrorsFormatter_1 = __webpack_require__(57);
  2649. var Options = function Options(obfuscatorOptions) {
  2650. _classCallCheck(this, Options);
  2651. Object.assign(this, DefaultPreset_1.DEFAULT_PRESET, obfuscatorOptions);
  2652. var errors = class_validator_1.validateSync(this, Options.validatorOptions);
  2653. if (errors.length) {
  2654. throw new ReferenceError("Validation failed. errors:\n" + ValidationErrorsFormatter_1.ValidationErrorsFormatter.format(errors));
  2655. }
  2656. Object.assign(this, OptionsNormalizer_1.OptionsNormalizer.normalizeOptions(this));
  2657. };
  2658. Options.validatorOptions = {
  2659. validationError: {
  2660. target: false
  2661. }
  2662. };
  2663. __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "compact", void 0);
  2664. __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "debugProtection", void 0);
  2665. __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "debugProtectionInterval", void 0);
  2666. __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "disableConsoleOutput", void 0);
  2667. __decorate([class_validator_1.IsArray(), class_validator_1.ArrayUnique(), class_validator_1.IsString({
  2668. each: true
  2669. }), __metadata('design:type', Array)], Options.prototype, "domainLock", void 0);
  2670. __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "encodeUnicodeLiterals", void 0);
  2671. __decorate([class_validator_1.IsArray(), class_validator_1.ArrayUnique(), class_validator_1.IsString({
  2672. each: true
  2673. }), __metadata('design:type', Array)], Options.prototype, "reservedNames", void 0);
  2674. __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "rotateUnicodeArray", void 0);
  2675. __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "selfDefending", void 0);
  2676. __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "sourceMap", void 0);
  2677. __decorate([class_validator_1.IsString(), class_validator_1.ValidateIf(function (options) {
  2678. return Boolean(options.sourceMapBaseUrl);
  2679. }), class_validator_1.IsUrl({
  2680. require_protocol: false,
  2681. require_valid_protocol: true
  2682. }), __metadata('design:type', String)], Options.prototype, "sourceMapBaseUrl", void 0);
  2683. __decorate([class_validator_1.IsString(), __metadata('design:type', String)], Options.prototype, "sourceMapFileName", void 0);
  2684. __decorate([class_validator_1.IsIn(['inline', 'separate']), __metadata('design:type', typeof (_a = typeof TSourceMapMode_1.TSourceMapMode !== 'undefined' && TSourceMapMode_1.TSourceMapMode) === 'function' && _a || Object)], Options.prototype, "sourceMapMode", void 0);
  2685. __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "unicodeArray", void 0);
  2686. __decorate([class_validator_1.IsNumber(), class_validator_1.Min(0), class_validator_1.Max(1), __metadata('design:type', Number)], Options.prototype, "unicodeArrayThreshold", void 0);
  2687. __decorate([class_validator_1.IsBoolean(), __metadata('design:type', Boolean)], Options.prototype, "wrapUnicodeArrayCalls", void 0);
  2688. exports.Options = Options;
  2689. var _a;
  2690. /***/ },
  2691. /* 56 */
  2692. /***/ function(module, exports, __webpack_require__) {
  2693. "use strict";
  2694. "use strict";
  2695. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2696. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2697. var Utils_1 = __webpack_require__(0);
  2698. var OptionsNormalizer = function () {
  2699. function OptionsNormalizer() {
  2700. _classCallCheck(this, OptionsNormalizer);
  2701. }
  2702. _createClass(OptionsNormalizer, null, [{
  2703. key: 'normalizeOptions',
  2704. value: function normalizeOptions(options) {
  2705. var normalizedOptions = Object.assign({}, options);
  2706. var _iteratorNormalCompletion = true;
  2707. var _didIteratorError = false;
  2708. var _iteratorError = undefined;
  2709. try {
  2710. for (var _iterator = OptionsNormalizer.normalizerRules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2711. var normalizerRule = _step.value;
  2712. normalizedOptions = normalizerRule(normalizedOptions);
  2713. }
  2714. } catch (err) {
  2715. _didIteratorError = true;
  2716. _iteratorError = err;
  2717. } finally {
  2718. try {
  2719. if (!_iteratorNormalCompletion && _iterator.return) {
  2720. _iterator.return();
  2721. }
  2722. } finally {
  2723. if (_didIteratorError) {
  2724. throw _iteratorError;
  2725. }
  2726. }
  2727. }
  2728. return normalizedOptions;
  2729. }
  2730. }, {
  2731. key: 'domainLockRule',
  2732. value: function domainLockRule(options) {
  2733. if (options.domainLock.length) {
  2734. var normalizedDomains = [];
  2735. var _iteratorNormalCompletion2 = true;
  2736. var _didIteratorError2 = false;
  2737. var _iteratorError2 = undefined;
  2738. try {
  2739. for (var _iterator2 = options.domainLock[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
  2740. var domain = _step2.value;
  2741. normalizedDomains.push(Utils_1.Utils.extractDomainFromUrl(domain));
  2742. }
  2743. } catch (err) {
  2744. _didIteratorError2 = true;
  2745. _iteratorError2 = err;
  2746. } finally {
  2747. try {
  2748. if (!_iteratorNormalCompletion2 && _iterator2.return) {
  2749. _iterator2.return();
  2750. }
  2751. } finally {
  2752. if (_didIteratorError2) {
  2753. throw _iteratorError2;
  2754. }
  2755. }
  2756. }
  2757. Object.assign(options, {
  2758. domainLock: normalizedDomains
  2759. });
  2760. }
  2761. return options;
  2762. }
  2763. }, {
  2764. key: 'encodeUnicodeLiteralsRule',
  2765. value: function encodeUnicodeLiteralsRule(options) {
  2766. if (options.unicodeArray && options.encodeUnicodeLiterals) {
  2767. Object.assign(options, OptionsNormalizer.ENCODE_UNICODE_LITERALS_OPTIONS);
  2768. }
  2769. return options;
  2770. }
  2771. }, {
  2772. key: 'selfDefendingRule',
  2773. value: function selfDefendingRule(options) {
  2774. if (options.selfDefending) {
  2775. Object.assign(options, OptionsNormalizer.SELF_DEFENDING_OPTIONS);
  2776. }
  2777. return options;
  2778. }
  2779. }, {
  2780. key: 'sourceMapBaseUrl',
  2781. value: function sourceMapBaseUrl(options) {
  2782. var sourceMapBaseUrl = options.sourceMapBaseUrl;
  2783. if (!options.sourceMapFileName) {
  2784. Object.assign(options, {
  2785. sourceMapBaseUrl: ''
  2786. });
  2787. return options;
  2788. }
  2789. if (sourceMapBaseUrl && !sourceMapBaseUrl.endsWith('/')) {
  2790. Object.assign(options, {
  2791. sourceMapBaseUrl: sourceMapBaseUrl + '/'
  2792. });
  2793. }
  2794. return options;
  2795. }
  2796. }, {
  2797. key: 'sourceMapFileName',
  2798. value: function sourceMapFileName(options) {
  2799. var sourceMapFileName = options.sourceMapFileName;
  2800. if (sourceMapFileName) {
  2801. sourceMapFileName = sourceMapFileName.replace(/^\/+/, '').split('.')[0];
  2802. Object.assign(options, {
  2803. sourceMapFileName: sourceMapFileName + '.js.map'
  2804. });
  2805. }
  2806. return options;
  2807. }
  2808. }, {
  2809. key: 'unicodeArrayRule',
  2810. value: function unicodeArrayRule(options) {
  2811. if (!options.unicodeArray) {
  2812. Object.assign(options, OptionsNormalizer.DISABLED_UNICODE_ARRAY_OPTIONS);
  2813. }
  2814. return options;
  2815. }
  2816. }, {
  2817. key: 'unicodeArrayThresholdRule',
  2818. value: function unicodeArrayThresholdRule(options) {
  2819. if (options.unicodeArrayThreshold === 0) {
  2820. Object.assign(options, OptionsNormalizer.DISABLED_UNICODE_ARRAY_OPTIONS);
  2821. }
  2822. return options;
  2823. }
  2824. }]);
  2825. return OptionsNormalizer;
  2826. }();
  2827. OptionsNormalizer.DISABLED_UNICODE_ARRAY_OPTIONS = {
  2828. encodeUnicodeLiterals: false,
  2829. rotateUnicodeArray: false,
  2830. unicodeArray: false,
  2831. unicodeArrayThreshold: 0,
  2832. wrapUnicodeArrayCalls: false
  2833. };
  2834. OptionsNormalizer.ENCODE_UNICODE_LITERALS_OPTIONS = {
  2835. encodeUnicodeLiterals: true,
  2836. wrapUnicodeArrayCalls: true
  2837. };
  2838. OptionsNormalizer.SELF_DEFENDING_OPTIONS = {
  2839. compact: true,
  2840. selfDefending: true
  2841. };
  2842. OptionsNormalizer.normalizerRules = [OptionsNormalizer.domainLockRule, OptionsNormalizer.unicodeArrayRule, OptionsNormalizer.unicodeArrayThresholdRule, OptionsNormalizer.encodeUnicodeLiteralsRule, OptionsNormalizer.sourceMapBaseUrl, OptionsNormalizer.sourceMapFileName, OptionsNormalizer.selfDefendingRule];
  2843. exports.OptionsNormalizer = OptionsNormalizer;
  2844. /***/ },
  2845. /* 57 */
  2846. /***/ function(module, exports) {
  2847. "use strict";
  2848. "use strict";
  2849. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2850. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2851. var ValidationErrorsFormatter = function () {
  2852. function ValidationErrorsFormatter() {
  2853. _classCallCheck(this, ValidationErrorsFormatter);
  2854. }
  2855. _createClass(ValidationErrorsFormatter, null, [{
  2856. key: "format",
  2857. value: function format(validationErrors) {
  2858. var errorsArray = [];
  2859. var _iteratorNormalCompletion = true;
  2860. var _didIteratorError = false;
  2861. var _iteratorError = undefined;
  2862. try {
  2863. for (var _iterator = validationErrors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2864. var error = _step.value;
  2865. errorsArray.push(ValidationErrorsFormatter.formatError(error));
  2866. }
  2867. } catch (err) {
  2868. _didIteratorError = true;
  2869. _iteratorError = err;
  2870. } finally {
  2871. try {
  2872. if (!_iteratorNormalCompletion && _iterator.return) {
  2873. _iterator.return();
  2874. }
  2875. } finally {
  2876. if (_didIteratorError) {
  2877. throw _iteratorError;
  2878. }
  2879. }
  2880. }
  2881. return errorsArray.join('\n');
  2882. }
  2883. }, {
  2884. key: "formatError",
  2885. value: function formatError(validationError) {
  2886. var errorString = "`" + validationError.property + "` errors:\n",
  2887. constraints = validationError.constraints;
  2888. for (var constraint in constraints) {
  2889. if (!constraints.hasOwnProperty(constraint)) {
  2890. continue;
  2891. }
  2892. errorString += " - " + constraints[constraint] + "\n";
  2893. }
  2894. return errorString;
  2895. }
  2896. }]);
  2897. return ValidationErrorsFormatter;
  2898. }();
  2899. exports.ValidationErrorsFormatter = ValidationErrorsFormatter;
  2900. /***/ },
  2901. /* 58 */
  2902. /***/ function(module, exports, __webpack_require__) {
  2903. "use strict";
  2904. "use strict";
  2905. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2906. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2907. var estraverse = __webpack_require__(3);
  2908. var NodeType_1 = __webpack_require__(6);
  2909. var FunctionDeclarationCalleeDataExtractor_1 = __webpack_require__(59);
  2910. var FunctionExpressionCalleeDataExtractor_1 = __webpack_require__(60);
  2911. var Nodes_1 = __webpack_require__(2);
  2912. var NodeUtils_1 = __webpack_require__(1);
  2913. var StackTraceAnalyzer = function () {
  2914. function StackTraceAnalyzer(blockScopeBody) {
  2915. _classCallCheck(this, StackTraceAnalyzer);
  2916. this.calleeDataExtractors = new Map([[NodeType_1.NodeType.FunctionDeclaration, FunctionDeclarationCalleeDataExtractor_1.FunctionDeclarationCalleeDataExtractor], [NodeType_1.NodeType.FunctionExpression, FunctionExpressionCalleeDataExtractor_1.FunctionExpressionCalleeDataExtractor]]);
  2917. this.blockScopeBody = blockScopeBody;
  2918. }
  2919. _createClass(StackTraceAnalyzer, [{
  2920. key: 'analyze',
  2921. value: function analyze() {
  2922. return this.analyzeRecursive(this.blockScopeBody);
  2923. }
  2924. }, {
  2925. key: 'analyzeRecursive',
  2926. value: function analyzeRecursive(blockScopeBody) {
  2927. var _this = this;
  2928. var stackTraceData = [];
  2929. var _iteratorNormalCompletion = true;
  2930. var _didIteratorError = false;
  2931. var _iteratorError = undefined;
  2932. try {
  2933. var _loop = function _loop() {
  2934. var rootNode = _step.value;
  2935. estraverse.traverse(rootNode, {
  2936. enter: function enter(node) {
  2937. if (!Nodes_1.Nodes.isCallExpressionNode(node) || rootNode.parentNode !== NodeUtils_1.NodeUtils.getBlockScopeOfNode(node)) {
  2938. return;
  2939. }
  2940. _this.calleeDataExtractors.forEach(function (calleeDataExtractor) {
  2941. var calleeData = new calleeDataExtractor(blockScopeBody, node.callee).extract();
  2942. if (!calleeData) {
  2943. return;
  2944. }
  2945. stackTraceData.push(Object.assign({}, calleeData, {
  2946. stackTrace: _this.analyzeRecursive(calleeData.callee.body)
  2947. }));
  2948. });
  2949. }
  2950. });
  2951. };
  2952. for (var _iterator = blockScopeBody[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2953. _loop();
  2954. }
  2955. } catch (err) {
  2956. _didIteratorError = true;
  2957. _iteratorError = err;
  2958. } finally {
  2959. try {
  2960. if (!_iteratorNormalCompletion && _iterator.return) {
  2961. _iterator.return();
  2962. }
  2963. } finally {
  2964. if (_didIteratorError) {
  2965. throw _iteratorError;
  2966. }
  2967. }
  2968. }
  2969. return stackTraceData;
  2970. }
  2971. }]);
  2972. return StackTraceAnalyzer;
  2973. }();
  2974. exports.StackTraceAnalyzer = StackTraceAnalyzer;
  2975. /***/ },
  2976. /* 59 */
  2977. /***/ function(module, exports, __webpack_require__) {
  2978. "use strict";
  2979. "use strict";
  2980. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2981. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2982. var estraverse = __webpack_require__(3);
  2983. var Nodes_1 = __webpack_require__(2);
  2984. var NodeUtils_1 = __webpack_require__(1);
  2985. var FunctionDeclarationCalleeDataExtractor = function () {
  2986. function FunctionDeclarationCalleeDataExtractor(blockScopeBody, callee) {
  2987. _classCallCheck(this, FunctionDeclarationCalleeDataExtractor);
  2988. this.blockScopeBody = blockScopeBody;
  2989. this.callee = callee;
  2990. }
  2991. _createClass(FunctionDeclarationCalleeDataExtractor, [{
  2992. key: 'extract',
  2993. value: function extract() {
  2994. var calleeBlockStatement = null;
  2995. if (Nodes_1.Nodes.isIdentifierNode(this.callee)) {
  2996. calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopeOfNode(this.blockScopeBody[0]), this.callee.name);
  2997. }
  2998. if (!calleeBlockStatement) {
  2999. return null;
  3000. }
  3001. return {
  3002. callee: calleeBlockStatement,
  3003. name: this.callee.name
  3004. };
  3005. }
  3006. }, {
  3007. key: 'getCalleeBlockStatement',
  3008. value: function getCalleeBlockStatement(node, name) {
  3009. var calleeBlockStatement = null;
  3010. estraverse.traverse(node, {
  3011. enter: function enter(node) {
  3012. if (Nodes_1.Nodes.isFunctionDeclarationNode(node) && node.id.name === name) {
  3013. calleeBlockStatement = node.body;
  3014. return estraverse.VisitorOption.Break;
  3015. }
  3016. }
  3017. });
  3018. return calleeBlockStatement;
  3019. }
  3020. }]);
  3021. return FunctionDeclarationCalleeDataExtractor;
  3022. }();
  3023. exports.FunctionDeclarationCalleeDataExtractor = FunctionDeclarationCalleeDataExtractor;
  3024. /***/ },
  3025. /* 60 */
  3026. /***/ function(module, exports, __webpack_require__) {
  3027. "use strict";
  3028. "use strict";
  3029. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3030. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3031. var estraverse = __webpack_require__(3);
  3032. var Nodes_1 = __webpack_require__(2);
  3033. var NodeUtils_1 = __webpack_require__(1);
  3034. var FunctionExpressionCalleeDataExtractor = function () {
  3035. function FunctionExpressionCalleeDataExtractor(blockScopeBody, callee) {
  3036. _classCallCheck(this, FunctionExpressionCalleeDataExtractor);
  3037. this.blockScopeBody = blockScopeBody;
  3038. this.callee = callee;
  3039. }
  3040. _createClass(FunctionExpressionCalleeDataExtractor, [{
  3041. key: 'extract',
  3042. value: function extract() {
  3043. var calleeBlockStatement = null;
  3044. if (Nodes_1.Nodes.isIdentifierNode(this.callee)) {
  3045. calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopeOfNode(this.blockScopeBody[0]), this.callee.name);
  3046. }
  3047. if (!calleeBlockStatement) {
  3048. return null;
  3049. }
  3050. return {
  3051. callee: calleeBlockStatement,
  3052. name: this.callee.name
  3053. };
  3054. }
  3055. }, {
  3056. key: 'getCalleeBlockStatement',
  3057. value: function getCalleeBlockStatement(node, name) {
  3058. var calleeBlockStatement = null;
  3059. estraverse.traverse(node, {
  3060. enter: function enter(node, parentNode) {
  3061. if (Nodes_1.Nodes.isFunctionExpressionNode(node) && Nodes_1.Nodes.isVariableDeclaratorNode(parentNode) && Nodes_1.Nodes.isIdentifierNode(parentNode.id) && parentNode.id.name === name) {
  3062. calleeBlockStatement = node.body;
  3063. return estraverse.VisitorOption.Break;
  3064. }
  3065. }
  3066. });
  3067. return calleeBlockStatement;
  3068. }
  3069. }]);
  3070. return FunctionExpressionCalleeDataExtractor;
  3071. }();
  3072. exports.FunctionExpressionCalleeDataExtractor = FunctionExpressionCalleeDataExtractor;
  3073. /***/ },
  3074. /* 61 */
  3075. /***/ function(module, exports) {
  3076. "use strict";
  3077. "use strict";
  3078. function AtobTemplate() {
  3079. return "\n (function () {\n var object = []['filter']['constructor']('return this')();\n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n object.atob || (\n object.atob = function(input) {\n var str = String(input).replace(/=+$/, '');\n for (\n var bc = 0, bs, buffer, idx = 0, output = '';\n buffer = str.charAt(idx++);\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0\n ) {\n buffer = chars.indexOf(buffer);\n }\n return output;\n });\n })();\n ";
  3080. }
  3081. exports.AtobTemplate = AtobTemplate;
  3082. /***/ },
  3083. /* 62 */
  3084. /***/ function(module, exports) {
  3085. "use strict";
  3086. "use strict";
  3087. function ConsoleOutputDisableExpressionTemplate() {
  3088. return "\n (function () {\n var _ = '(\x04\x06\x03\x05[]' + '[\"filter\"][\"\x07tructor\"]' + '(\"return this\")()' + '.' + '\x03;\x06\x02\x05\x04};' + '_\x03.log\x01.in' + 'fo\x01.' + 'war' + 'n\x01.er' + 'r' + 'or\x01})();' + '\x01\x05_\x02;' + '_\x03\x02function' + '\x03\x07ole\x04\x02 ()' + '{\x05 = \x06var ' + '_\x07cons', \n Y, \n $;\n \n for (Y in $ = \"\x07\x06\x05\x04\x03\x02\x01\") {\n var arr = _.split($[Y]);\n _ = arr.join(arr.pop());\n }\n \n [][\"filter\"][\"constructor\"](_)();\n })()\n ";
  3089. }
  3090. exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate;
  3091. /***/ },
  3092. /* 63 */
  3093. /***/ function(module, exports) {
  3094. "use strict";
  3095. "use strict";
  3096. function DebugProtectionFunctionCallTemplate() {
  3097. return "{debugProtectionFunctionName}();";
  3098. }
  3099. exports.DebugProtectionFunctionCallTemplate = DebugProtectionFunctionCallTemplate;
  3100. /***/ },
  3101. /* 64 */
  3102. /***/ function(module, exports) {
  3103. "use strict";
  3104. "use strict";
  3105. function DebugProtectionFunctionIntervalTemplate() {
  3106. return "\n setInterval(function () {\n {debugProtectionFunctionName}();\n }, 4000);\n ";
  3107. }
  3108. exports.DebugProtectionFunctionIntervalTemplate = DebugProtectionFunctionIntervalTemplate;
  3109. /***/ },
  3110. /* 65 */
  3111. /***/ function(module, exports, __webpack_require__) {
  3112. "use strict";
  3113. "use strict";
  3114. var Utils_1 = __webpack_require__(0);
  3115. function DebugProtectionFunctionTemplate() {
  3116. return '\n var {debugProtectionFunctionName} = function () {\n function debuggerProtection (counter) {\n if ((\'\' + counter / counter)[\'length\'] !== 1 || counter % 20 === 0) {\n (function () {}.constructor(\'debugger\')());\n } else {\n [].filter.constructor(' + Utils_1.Utils.stringToJSFuck('debugger') + ')();\n }\n \n debuggerProtection(++counter);\n }\n \n try {\n debuggerProtection(0);\n } catch (y) {}\n };\n ';
  3117. }
  3118. exports.DebugProtectionFunctionTemplate = DebugProtectionFunctionTemplate;
  3119. /***/ },
  3120. /* 66 */
  3121. /***/ function(module, exports) {
  3122. "use strict";
  3123. "use strict";
  3124. function DomainLockNodeTemplate() {
  3125. return "\n (function () {\n var regExp = new RegExp(\"[{diff}]\", \"g\");\n var domains = \"{domains}\".replace(regExp, \"\").split(\";\");\n var eval = [][\"forEach\"][\"constructor\"];\n var window = eval(\"return this\")();\n \n for (var d in window) {\n if (d.length == 8 && d.charCodeAt(7) == 116 && d.charCodeAt(5) == 101 && d.charCodeAt(3) == 117 && d.charCodeAt(0) == 100) {\n break;\n }\n }\n\n for (var d1 in window[d]) {\n if (d1.length == 6 && d1.charCodeAt(5) == 110 && d1.charCodeAt(0) == 100) {\n break;\n }\n }\n\n var currentDomain = window[d][d1];\n \n if (!currentDomain) {\n return;\n }\n \n var ok = false;\n \n for (var i = 0; i < domains.length; i++) {\n var domain = domains[i];\n var position = currentDomain.length - domain.length;\n var lastIndex = currentDomain.indexOf(domain, position);\n var endsWith = lastIndex !== -1 && lastIndex === position;\n \n if (endsWith) {\n if (currentDomain.length == domain.length || domain.indexOf(\".\") === 0) {\n ok = true;\n }\n \n break;\n }\n }\n \n if (!ok) {\n eval('throw new Error()')();\n }\n })();\n ";
  3126. }
  3127. exports.DomainLockNodeTemplate = DomainLockNodeTemplate;
  3128. /***/ },
  3129. /* 67 */
  3130. /***/ function(module, exports, __webpack_require__) {
  3131. "use strict";
  3132. "use strict";
  3133. var Utils_1 = __webpack_require__(0);
  3134. function SelfDefendingTemplate() {
  3135. return '\n (function () { \n var func = function(){return \'dev\';},\n func2 = function () {\n return \'window\';\n };\n \n !Function(' + Utils_1.Utils.stringToUnicode('return/\\w+ *\\(\\) *{\\w+ *[\'|"].+[\'|"];? *}/') + ')().test(func.toString()) ? Function(' + Utils_1.Utils.stringToUnicode('return/(\\\\[x|u](\\w){2,4})+/') + ')().test(func2.toString()) ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(false){}\')() : [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(true){}\')() : [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(false){}\')();\n })();\n ';
  3136. }
  3137. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  3138. /***/ },
  3139. /* 68 */
  3140. /***/ function(module, exports) {
  3141. "use strict";
  3142. "use strict";
  3143. function UnicodeArrayCallsWrapperTemplate() {
  3144. return "\n var {unicodeArrayCallsWrapperName} = function ({keyName}) {\n return {unicodeArrayName}[parseInt({keyName}, 0x010)];\n };\n ";
  3145. }
  3146. exports.UnicodeArrayCallsWrapperTemplate = UnicodeArrayCallsWrapperTemplate;
  3147. /***/ },
  3148. /* 69 */
  3149. /***/ function(module, exports, __webpack_require__) {
  3150. "use strict";
  3151. "use strict";
  3152. var Utils_1 = __webpack_require__(0);
  3153. function SelfDefendingTemplate() {
  3154. return '\n var func = function(){return \'dev\';};\n \n Function(' + Utils_1.Utils.stringToUnicode('return/\\w+ *\\(\\) *{\\w+ *[\'|"].+[\'|"];? *}/') + ')()[\'test\'](func[\'toString\']()) !== true && !{unicodeArrayName}++ ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(true){}\')() : Function(\'a\', atob(' + Utils_1.Utils.stringToUnicode(Utils_1.Utils.btoa('a.call()')) + '))({forLoopFunctionName}) ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(false){}\')() : [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(false){}\')();\n ';
  3155. }
  3156. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  3157. /***/ },
  3158. /* 70 */
  3159. /***/ function(module, exports) {
  3160. "use strict";
  3161. "use strict";
  3162. function UnicodeArrayDecodeNodeTemplate() {
  3163. return "\n (function () {\n {atobPolyfill}\n \n var {forLoopFunctionName} = function () {\n var array = [];\n \n for (var i in {unicodeArrayName}) {\n array['push'](decodeURI(atob({unicodeArrayName}[i])));\n }\n \n {unicodeArrayName} = array;\n };\n \n {code}\n })();\n ";
  3164. }
  3165. exports.UnicodeArrayDecodeNodeTemplate = UnicodeArrayDecodeNodeTemplate;
  3166. /***/ },
  3167. /* 71 */
  3168. /***/ function(module, exports) {
  3169. "use strict";
  3170. "use strict";
  3171. function UnicodeArrayTemplate() {
  3172. return "\n var {unicodeArrayName} = [{unicodeArray}];\n ";
  3173. }
  3174. exports.UnicodeArrayTemplate = UnicodeArrayTemplate;
  3175. /***/ },
  3176. /* 72 */
  3177. /***/ function(module, exports, __webpack_require__) {
  3178. "use strict";
  3179. "use strict";
  3180. var Utils_1 = __webpack_require__(0);
  3181. function SelfDefendingTemplate() {
  3182. return '(function () {\n var func = function(){return \'dev\';};\n \n !Function(' + Utils_1.Utils.stringToUnicode('return/\\w+ *\\(\\) *{\\w+ *[\'|"].+[\'|"];? *}/') + ')().test(func.toString()) ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(true){}\')() : Function(\'a\', \'b\', \'a(++b)\')({whileFunctionName}, {timesName}) ? [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(false){}\')() : [][\'filter\'][\'constructor\'](' + Utils_1.Utils.stringToJSFuck('while') + ' + \'(false){}\')();\n })();';
  3183. }
  3184. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  3185. /***/ },
  3186. /* 73 */
  3187. /***/ function(module, exports) {
  3188. "use strict";
  3189. "use strict";
  3190. function UnicodeArrayRotateFunctionTemplate() {
  3191. return "\n (function (array, {timesName}) {\n var {whileFunctionName} = function (times) {\n while (--times) {\n array['push'](array['shift']());\n }\n };\n \n {code}\n })({unicodeArrayName}, 0x{unicodeArrayRotateValue});\n ";
  3192. }
  3193. exports.UnicodeArrayRotateFunctionTemplate = UnicodeArrayRotateFunctionTemplate;
  3194. /***/ },
  3195. /* 74 */
  3196. /***/ function(module, exports) {
  3197. "use strict";
  3198. "use strict";
  3199. /***/ },
  3200. /* 75 */
  3201. /***/ function(module, exports) {
  3202. module.exports = require("chance");
  3203. /***/ },
  3204. /* 76 */
  3205. /***/ function(module, exports) {
  3206. module.exports = require("class-validator");
  3207. /***/ },
  3208. /* 77 */
  3209. /***/ function(module, exports) {
  3210. module.exports = require("commander");
  3211. /***/ },
  3212. /* 78 */
  3213. /***/ function(module, exports) {
  3214. module.exports = require("fs");
  3215. /***/ },
  3216. /* 79 */
  3217. /***/ function(module, exports) {
  3218. module.exports = require("mkdirp");
  3219. /***/ },
  3220. /* 80 */
  3221. /***/ function(module, exports, __webpack_require__) {
  3222. "use strict";
  3223. "use strict";
  3224. var JavaScriptObfuscator_1 = __webpack_require__(9);
  3225. if (!global._babelPolyfill) {
  3226. __webpack_require__(24);
  3227. }
  3228. module.exports = JavaScriptObfuscator_1.JavaScriptObfuscator;
  3229. /***/ }
  3230. /******/ ]);
  3231. //# sourceMappingURL=index.js.map