index.js 503 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837
  1. /*!
  2. Copyright (C) 2017 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. /******/ // define getter function for harmony exports
  59. /******/ __webpack_require__.d = function(exports, name, getter) {
  60. /******/ if(!__webpack_require__.o(exports, name)) {
  61. /******/ Object.defineProperty(exports, name, {
  62. /******/ configurable: false,
  63. /******/ enumerable: true,
  64. /******/ get: getter
  65. /******/ });
  66. /******/ }
  67. /******/ };
  68. /******/
  69. /******/ // getDefaultExport function for compatibility with non-harmony modules
  70. /******/ __webpack_require__.n = function(module) {
  71. /******/ var getter = module && module.__esModule ?
  72. /******/ function getDefault() { return module['default']; } :
  73. /******/ function getModuleExports() { return module; };
  74. /******/ __webpack_require__.d(getter, 'a', getter);
  75. /******/ return getter;
  76. /******/ };
  77. /******/
  78. /******/ // Object.prototype.hasOwnProperty.call
  79. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  80. /******/
  81. /******/ // __webpack_public_path__
  82. /******/ __webpack_require__.p = "";
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 44);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ([
  89. /* 0 */
  90. /***/ (function(module, exports) {
  91. module.exports = require("inversify");
  92. /***/ }),
  93. /* 1 */
  94. /***/ (function(module, exports, __webpack_require__) {
  95. "use strict";
  96. Object.defineProperty(exports, "__esModule", { value: true });
  97. var ServiceIdentifiers;
  98. (function (ServiceIdentifiers) {
  99. ServiceIdentifiers["Factory__ICalleeDataExtractor"] = "Factory<ICalleeDataExtractor>";
  100. ServiceIdentifiers["Factory__IControlFlowCustomNode"] = "Factory<IControlFlowCustomNode>";
  101. ServiceIdentifiers["Factory__IControlFlowReplacer"] = "Factory<IControlFlowReplacer>";
  102. ServiceIdentifiers["Factory__ICustomNode"] = "Factory<ICustomNode>";
  103. ServiceIdentifiers["Factory__ICustomNodeGroup"] = "Factory<ICustomNodeGroup>";
  104. ServiceIdentifiers["Factory__IIdentifierObfuscatingReplacer"] = "Factory<IIdentifierObfuscatingReplacer>";
  105. ServiceIdentifiers["Factory__INodeGuard"] = "Factory<INodeGuard>";
  106. ServiceIdentifiers["Factory__INodeTransformer"] = "Factory<INodeTransformer[]>";
  107. ServiceIdentifiers["Factory__IObfuscationResult"] = "Factory<IObfuscationResult>";
  108. ServiceIdentifiers["Factory__IObfuscatingReplacer"] = "Factory<IObfuscatingReplacer>";
  109. ServiceIdentifiers["Factory__TControlFlowStorage"] = "Factory<TControlFlowStorage>";
  110. ServiceIdentifiers["IArrayUtils"] = "IArrayUtils";
  111. ServiceIdentifiers["ICalleeDataExtractor"] = "ICalleeDataExtractor";
  112. ServiceIdentifiers["ICryptUtils"] = "ICryptUtils";
  113. ServiceIdentifiers["ICustomNode"] = "ICustomNode";
  114. ServiceIdentifiers["ICustomNodeGroup"] = "ICustomNodeGroup";
  115. ServiceIdentifiers["IControlFlowReplacer"] = "IControlFlowReplacer";
  116. ServiceIdentifiers["IDeadCodeInjectionReplacer"] = "IDeadCodeInjectionReplacer";
  117. ServiceIdentifiers["IEscapeSequenceEncoder"] = "IEscapeSequenceEncoder";
  118. ServiceIdentifiers["IIdentifierObfuscatingReplacer"] = "IIdentifierObfuscatingReplacer";
  119. ServiceIdentifiers["IJavaScriptObfuscator"] = "IJavaScriptObfuscator";
  120. ServiceIdentifiers["ILogger"] = "ILogger";
  121. ServiceIdentifiers["INodeGuard"] = "INodeGuard";
  122. ServiceIdentifiers["INodeTransformer"] = "INodeTransformer";
  123. ServiceIdentifiers["IObfuscationEventEmitter"] = "IObfuscationEventEmitter";
  124. ServiceIdentifiers["IObfuscationResult"] = "IObfuscationResult";
  125. ServiceIdentifiers["IOptions"] = "IOptions";
  126. ServiceIdentifiers["IObfuscatingReplacer"] = "IObfuscatingReplacer";
  127. ServiceIdentifiers["IRandomGenerator"] = "IRandomGenerator";
  128. ServiceIdentifiers["ISourceCode"] = "ISourceCode";
  129. ServiceIdentifiers["ISourceMapCorrector"] = "ISourceMapCorrector";
  130. ServiceIdentifiers["IStackTraceAnalyzer"] = "IStackTraceAnalyzer";
  131. ServiceIdentifiers["ITransformersRunner"] = "ITransformersRunner";
  132. ServiceIdentifiers["Newable__ICustomNode"] = "Newable<ICustomNode>";
  133. ServiceIdentifiers["Newable__TControlFlowStorage"] = "Newable<TControlFlowStorage>";
  134. ServiceIdentifiers["TCustomNodeGroupStorage"] = "TCustomNodeGroupStorage";
  135. ServiceIdentifiers["TStringArrayStorage"] = "TStringArrayStorage";
  136. })(ServiceIdentifiers = exports.ServiceIdentifiers || (exports.ServiceIdentifiers = {}));
  137. /***/ }),
  138. /* 2 */
  139. /***/ (function(module, exports) {
  140. module.exports = require("tslib");
  141. /***/ }),
  142. /* 3 */
  143. /***/ (function(module, exports, __webpack_require__) {
  144. "use strict";
  145. Object.defineProperty(exports, "__esModule", { value: true });
  146. function initializable() {
  147. var initializeMethodKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'initialize';
  148. var decoratorName = Object.keys(this)[0];
  149. return function (target, propertyKey) {
  150. var descriptor = {
  151. configurable: true,
  152. enumerable: true
  153. };
  154. var initializeMethod = target[initializeMethodKey];
  155. if (!initializeMethod || typeof initializeMethod !== 'function') {
  156. throw new Error("`" + initializeMethodKey + "` method with initialization logic not found. `@" + decoratorName + "` decorator requires `" + initializeMethodKey + "` method");
  157. }
  158. var metadataPropertyKey = "_" + propertyKey;
  159. var propertyDescriptor = Object.getOwnPropertyDescriptor(target, metadataPropertyKey) || descriptor;
  160. var methodDescriptor = Object.getOwnPropertyDescriptor(target, initializeMethodKey) || descriptor;
  161. var originalMethod = methodDescriptor.value;
  162. Object.defineProperty(target, propertyKey, Object.assign({}, propertyDescriptor, { get: function get() {
  163. if (this[metadataPropertyKey] === undefined) {
  164. throw new Error("Property `" + propertyKey + "` is not initialized! Initialize it first!");
  165. }
  166. return this[metadataPropertyKey];
  167. }, set: function set(newVal) {
  168. this[metadataPropertyKey] = newVal;
  169. } }));
  170. Object.defineProperty(target, initializeMethodKey, Object.assign({}, methodDescriptor, { value: function value() {
  171. originalMethod.apply(this, arguments);
  172. if (this[propertyKey]) {}
  173. } }));
  174. return propertyDescriptor;
  175. };
  176. }
  177. exports.initializable = initializable;
  178. /***/ }),
  179. /* 4 */
  180. /***/ (function(module, exports, __webpack_require__) {
  181. "use strict";
  182. 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; };
  183. 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; }; })();
  184. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  185. Object.defineProperty(exports, "__esModule", { value: true });
  186. var escodegen = __webpack_require__(28);
  187. var esprima = __webpack_require__(36);
  188. var estraverse = __webpack_require__(8);
  189. var NodeType_1 = __webpack_require__(10);
  190. var NodeGuards_1 = __webpack_require__(5);
  191. var NodeUtils = function () {
  192. function NodeUtils() {
  193. _classCallCheck(this, NodeUtils);
  194. }
  195. _createClass(NodeUtils, null, [{
  196. key: "addXVerbatimPropertyToLiterals",
  197. value: function addXVerbatimPropertyToLiterals(astTree) {
  198. NodeUtils.typedReplace(astTree, NodeType_1.NodeType.Literal, {
  199. leave: function leave(literalNode) {
  200. literalNode['x-verbatim-property'] = {
  201. content: literalNode.raw,
  202. precedence: escodegen.Precedence.Primary
  203. };
  204. }
  205. });
  206. return astTree;
  207. }
  208. }, {
  209. key: "clone",
  210. value: function clone(astTree) {
  211. var cloneRecursive = function cloneRecursive(node) {
  212. if (node === null) {
  213. return node;
  214. }
  215. var copy = {};
  216. Object.keys(node).filter(function (property) {
  217. return property !== 'parentNode';
  218. }).forEach(function (property) {
  219. var value = node[property];
  220. var clonedValue = void 0;
  221. if (value === null || value instanceof RegExp) {
  222. clonedValue = value;
  223. } else if (Array.isArray(value)) {
  224. clonedValue = value.map(cloneRecursive);
  225. } else if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === 'object') {
  226. clonedValue = cloneRecursive(value);
  227. } else {
  228. clonedValue = value;
  229. }
  230. copy[property] = clonedValue;
  231. });
  232. return copy;
  233. };
  234. return NodeUtils.parentize(cloneRecursive(astTree));
  235. }
  236. }, {
  237. key: "convertCodeToStructure",
  238. value: function convertCodeToStructure(code) {
  239. var structure = esprima.parseScript(code);
  240. structure = NodeUtils.addXVerbatimPropertyToLiterals(structure);
  241. structure = NodeUtils.parentize(structure);
  242. return structure.body;
  243. }
  244. }, {
  245. key: "convertStructureToCode",
  246. value: function convertStructureToCode(structure) {
  247. var code = '';
  248. structure.forEach(function (node) {
  249. code += escodegen.generate(node, {
  250. sourceMapWithCode: true
  251. }).code;
  252. });
  253. return code;
  254. }
  255. }, {
  256. key: "getBlockStatementNodeByIndex",
  257. value: function getBlockStatementNodeByIndex(node) {
  258. var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  259. if (NodeGuards_1.NodeGuards.isNodeHasBlockStatement(node)) {
  260. if (node.body[index] === undefined) {
  261. throw new ReferenceError("Wrong index `" + index + "`. Block-statement body length is `" + node.body.length + "`");
  262. }
  263. return node.body[index];
  264. }
  265. throw new TypeError('The specified node have no a block-statement');
  266. }
  267. }, {
  268. key: "getBlockScopesOfNode",
  269. value: function getBlockScopesOfNode(node) {
  270. var blockScopes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  271. var parentNode = node.parentNode;
  272. if (!parentNode) {
  273. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  274. }
  275. if (NodeGuards_1.NodeGuards.isBlockStatementNode(parentNode)) {
  276. if (!parentNode.parentNode) {
  277. throw new ReferenceError('`parentNode` property of `parentNode` of given node is `undefined`');
  278. }
  279. if (NodeUtils.nodesWithBlockScope.indexOf(parentNode.parentNode.type) !== -1) {
  280. blockScopes.push(parentNode);
  281. }
  282. }
  283. if (node !== parentNode) {
  284. return NodeUtils.getBlockScopesOfNode(parentNode, blockScopes);
  285. }
  286. if (NodeGuards_1.NodeGuards.isNodeHasBlockStatement(parentNode)) {
  287. blockScopes.push(parentNode);
  288. }
  289. return blockScopes;
  290. }
  291. }, {
  292. key: "getNodeBlockScopeDepth",
  293. value: function getNodeBlockScopeDepth(node) {
  294. var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  295. var parentNode = node.parentNode;
  296. if (!parentNode) {
  297. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  298. }
  299. if (NodeGuards_1.NodeGuards.isProgramNode(parentNode)) {
  300. return depth;
  301. }
  302. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node) && NodeUtils.nodesWithBlockScope.indexOf(parentNode.type) !== -1) {
  303. return NodeUtils.getNodeBlockScopeDepth(parentNode, ++depth);
  304. }
  305. return NodeUtils.getNodeBlockScopeDepth(parentNode, depth);
  306. }
  307. }, {
  308. key: "getUnaryExpressionArgumentNode",
  309. value: function getUnaryExpressionArgumentNode(unaryExpressionNode) {
  310. if (NodeGuards_1.NodeGuards.isUnaryExpressionNode(unaryExpressionNode.argument)) {
  311. return NodeUtils.getUnaryExpressionArgumentNode(unaryExpressionNode.argument);
  312. }
  313. return unaryExpressionNode.argument;
  314. }
  315. }, {
  316. key: "parentize",
  317. value: function parentize(astTree) {
  318. estraverse.traverse(astTree, {
  319. enter: NodeUtils.parentizeNode
  320. });
  321. return astTree;
  322. }
  323. }, {
  324. key: "parentizeNode",
  325. value: function parentizeNode(node, parentNode) {
  326. node.parentNode = parentNode || node;
  327. node.obfuscatedNode = false;
  328. return node;
  329. }
  330. }, {
  331. key: "typedReplace",
  332. value: function typedReplace(astTree, nodeType, visitor) {
  333. NodeUtils.typedTraverse(astTree, nodeType, visitor, 'replace');
  334. }
  335. }, {
  336. key: "typedTraverse",
  337. value: function typedTraverse(astTree, nodeType, visitor) {
  338. var traverseType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'traverse';
  339. estraverse[traverseType](astTree, {
  340. enter: function enter(node, parentNode) {
  341. if (node.type === nodeType && visitor.enter) {
  342. return visitor.enter(node, parentNode);
  343. }
  344. },
  345. leave: function leave(node, parentNode) {
  346. if (node.type === nodeType && visitor.leave) {
  347. return visitor.leave(node, parentNode);
  348. }
  349. }
  350. });
  351. }
  352. }]);
  353. return NodeUtils;
  354. }();
  355. NodeUtils.nodesWithBlockScope = [NodeType_1.NodeType.ArrowFunctionExpression, NodeType_1.NodeType.FunctionDeclaration, NodeType_1.NodeType.FunctionExpression, NodeType_1.NodeType.MethodDefinition, NodeType_1.NodeType.Program];
  356. exports.NodeUtils = NodeUtils;
  357. /***/ }),
  358. /* 5 */
  359. /***/ (function(module, exports, __webpack_require__) {
  360. "use strict";
  361. 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; }; })();
  362. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  363. Object.defineProperty(exports, "__esModule", { value: true });
  364. var NodeType_1 = __webpack_require__(10);
  365. var NodeGuards = function () {
  366. function NodeGuards() {
  367. _classCallCheck(this, NodeGuards);
  368. }
  369. _createClass(NodeGuards, null, [{
  370. key: "isArrowFunctionExpressionNode",
  371. value: function isArrowFunctionExpressionNode(node) {
  372. return node.type === NodeType_1.NodeType.ArrowFunctionExpression;
  373. }
  374. }, {
  375. key: "isAssignmentPatternNode",
  376. value: function isAssignmentPatternNode(node) {
  377. return node.type === NodeType_1.NodeType.AssignmentPattern;
  378. }
  379. }, {
  380. key: "isBlockStatementNode",
  381. value: function isBlockStatementNode(node) {
  382. return node.type === NodeType_1.NodeType.BlockStatement;
  383. }
  384. }, {
  385. key: "isBreakStatementNode",
  386. value: function isBreakStatementNode(node) {
  387. return node.type === NodeType_1.NodeType.BreakStatement;
  388. }
  389. }, {
  390. key: "isCallExpressionNode",
  391. value: function isCallExpressionNode(node) {
  392. return node.type === NodeType_1.NodeType.CallExpression;
  393. }
  394. }, {
  395. key: "isCatchClauseNode",
  396. value: function isCatchClauseNode(node) {
  397. return node.type === NodeType_1.NodeType.CatchClause;
  398. }
  399. }, {
  400. key: "isClassDeclarationNode",
  401. value: function isClassDeclarationNode(node) {
  402. return node.type === NodeType_1.NodeType.ClassDeclaration;
  403. }
  404. }, {
  405. key: "isContinueStatementNode",
  406. value: function isContinueStatementNode(node) {
  407. return node.type === NodeType_1.NodeType.ContinueStatement;
  408. }
  409. }, {
  410. key: "isExpressionStatementNode",
  411. value: function isExpressionStatementNode(node) {
  412. return node.type === NodeType_1.NodeType.ExpressionStatement;
  413. }
  414. }, {
  415. key: "isFunctionDeclarationNode",
  416. value: function isFunctionDeclarationNode(node) {
  417. return node.type === NodeType_1.NodeType.FunctionDeclaration;
  418. }
  419. }, {
  420. key: "isFunctionExpressionNode",
  421. value: function isFunctionExpressionNode(node) {
  422. return node.type === NodeType_1.NodeType.FunctionExpression;
  423. }
  424. }, {
  425. key: "isIdentifierNode",
  426. value: function isIdentifierNode(node) {
  427. return node.type === NodeType_1.NodeType.Identifier;
  428. }
  429. }, {
  430. key: "isIfStatementNode",
  431. value: function isIfStatementNode(node) {
  432. return node.type === NodeType_1.NodeType.IfStatement;
  433. }
  434. }, {
  435. key: "isLabelIdentifierNode",
  436. value: function isLabelIdentifierNode(node, parentNode) {
  437. var parentNodeIsLabeledStatementNode = NodeGuards.isLabeledStatementNode(parentNode) && parentNode.label === node;
  438. var parentNodeIsContinueStatementNode = NodeGuards.isContinueStatementNode(parentNode) && parentNode.label === node;
  439. var parentNodeIsBreakStatementNode = NodeGuards.isBreakStatementNode(parentNode) && parentNode.label === node;
  440. return parentNodeIsLabeledStatementNode || parentNodeIsContinueStatementNode || parentNodeIsBreakStatementNode;
  441. }
  442. }, {
  443. key: "isLabeledStatementNode",
  444. value: function isLabeledStatementNode(node) {
  445. return node.type === NodeType_1.NodeType.LabeledStatement;
  446. }
  447. }, {
  448. key: "isLiteralNode",
  449. value: function isLiteralNode(node) {
  450. return node.type === NodeType_1.NodeType.Literal;
  451. }
  452. }, {
  453. key: "isMemberExpressionNode",
  454. value: function isMemberExpressionNode(node) {
  455. return node.type === NodeType_1.NodeType.MemberExpression;
  456. }
  457. }, {
  458. key: "isMethodDefinitionNode",
  459. value: function isMethodDefinitionNode(node) {
  460. return node.type === NodeType_1.NodeType.MethodDefinition;
  461. }
  462. }, {
  463. key: "isNode",
  464. value: function isNode(object) {
  465. return object && !object.type !== undefined;
  466. }
  467. }, {
  468. key: "isNodeHasBlockStatement",
  469. value: function isNodeHasBlockStatement(node) {
  470. return Array.isArray(node.body);
  471. }
  472. }, {
  473. key: "isObjectPatternNode",
  474. value: function isObjectPatternNode(node) {
  475. return node.type === NodeType_1.NodeType.ObjectPattern;
  476. }
  477. }, {
  478. key: "isObjectExpressionNode",
  479. value: function isObjectExpressionNode(node) {
  480. return node.type === NodeType_1.NodeType.ObjectExpression;
  481. }
  482. }, {
  483. key: "isProgramNode",
  484. value: function isProgramNode(node) {
  485. return node.type === NodeType_1.NodeType.Program;
  486. }
  487. }, {
  488. key: "isPropertyNode",
  489. value: function isPropertyNode(node) {
  490. return node.type === NodeType_1.NodeType.Property;
  491. }
  492. }, {
  493. key: "isReplaceableIdentifierNode",
  494. value: function isReplaceableIdentifierNode(node, parentNode) {
  495. if (!NodeGuards.isIdentifierNode(node)) {
  496. return false;
  497. }
  498. var parentNodeIsPropertyNode = NodeGuards.isPropertyNode(parentNode) && !parentNode.computed && parentNode.key === node;
  499. var parentNodeIsMemberExpressionNode = NodeGuards.isMemberExpressionNode(parentNode) && parentNode.computed === false && parentNode.property === node;
  500. return !parentNodeIsPropertyNode && !parentNodeIsMemberExpressionNode && !NodeGuards.isLabelIdentifierNode(node, parentNode);
  501. }
  502. }, {
  503. key: "isTemplateLiteralNode",
  504. value: function isTemplateLiteralNode(node) {
  505. return node.type === NodeType_1.NodeType.TemplateLiteral;
  506. }
  507. }, {
  508. key: "isUnaryExpressionNode",
  509. value: function isUnaryExpressionNode(node) {
  510. return node.type === NodeType_1.NodeType.UnaryExpression;
  511. }
  512. }, {
  513. key: "isUseStrictOperator",
  514. value: function isUseStrictOperator(node) {
  515. return node.type === NodeType_1.NodeType.ExpressionStatement && node.directive === 'use strict';
  516. }
  517. }, {
  518. key: "isVariableDeclarationNode",
  519. value: function isVariableDeclarationNode(node) {
  520. return node.type === NodeType_1.NodeType.VariableDeclaration;
  521. }
  522. }, {
  523. key: "isVariableDeclaratorNode",
  524. value: function isVariableDeclaratorNode(node) {
  525. return node.type === NodeType_1.NodeType.VariableDeclarator;
  526. }
  527. }, {
  528. key: "isWhileStatementNode",
  529. value: function isWhileStatementNode(node) {
  530. return node.type === NodeType_1.NodeType.WhileStatement;
  531. }
  532. }]);
  533. return NodeGuards;
  534. }();
  535. exports.NodeGuards = NodeGuards;
  536. /***/ }),
  537. /* 6 */
  538. /***/ (function(module, exports, __webpack_require__) {
  539. "use strict";
  540. 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; }; })();
  541. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  542. Object.defineProperty(exports, "__esModule", { value: true });
  543. var tslib_1 = __webpack_require__(2);
  544. var inversify_1 = __webpack_require__(0);
  545. var ServiceIdentifiers_1 = __webpack_require__(1);
  546. var GlobalVariableTemplate1_1 = __webpack_require__(71);
  547. var GlobalVariableTemplate2_1 = __webpack_require__(72);
  548. var NodeUtils_1 = __webpack_require__(4);
  549. var AbstractCustomNode = AbstractCustomNode_1 = function () {
  550. function AbstractCustomNode(randomGenerator, options) {
  551. _classCallCheck(this, AbstractCustomNode);
  552. this.randomGenerator = randomGenerator;
  553. this.options = options;
  554. }
  555. _createClass(AbstractCustomNode, [{
  556. key: "getCode",
  557. value: function getCode() {
  558. if (!this.cachedCode) {
  559. this.cachedCode = NodeUtils_1.NodeUtils.convertStructureToCode(this.getNode());
  560. }
  561. return this.cachedCode;
  562. }
  563. }, {
  564. key: "getNode",
  565. value: function getNode() {
  566. if (!this.cachedNode) {
  567. this.cachedNode = this.getNodeStructure();
  568. }
  569. return this.cachedNode;
  570. }
  571. }, {
  572. key: "getGlobalVariableTemplate",
  573. value: function getGlobalVariableTemplate() {
  574. return this.randomGenerator.getRandomGenerator().pickone(AbstractCustomNode_1.globalVariableTemplateFunctions);
  575. }
  576. }]);
  577. return AbstractCustomNode;
  578. }();
  579. AbstractCustomNode.globalVariableTemplateFunctions = [GlobalVariableTemplate1_1.GlobalVariableTemplate1(), GlobalVariableTemplate2_1.GlobalVariableTemplate2()];
  580. AbstractCustomNode = AbstractCustomNode_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], AbstractCustomNode);
  581. exports.AbstractCustomNode = AbstractCustomNode;
  582. var AbstractCustomNode_1;
  583. /***/ }),
  584. /* 7 */
  585. /***/ (function(module, exports, __webpack_require__) {
  586. "use strict";
  587. 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; }; })();
  588. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  589. Object.defineProperty(exports, "__esModule", { value: true });
  590. var tslib_1 = __webpack_require__(2);
  591. var inversify_1 = __webpack_require__(0);
  592. var ServiceIdentifiers_1 = __webpack_require__(1);
  593. var Initializable_1 = __webpack_require__(3);
  594. var AbstractNodeTransformer = function () {
  595. function AbstractNodeTransformer(randomGenerator, options) {
  596. _classCallCheck(this, AbstractNodeTransformer);
  597. this.randomGenerator = randomGenerator;
  598. this.options = options;
  599. }
  600. _createClass(AbstractNodeTransformer, [{
  601. key: "initialize",
  602. value: function initialize() {
  603. this.nodeIdentifier = this.randomGenerator.getRandomInteger(0, 10000);
  604. }
  605. }]);
  606. return AbstractNodeTransformer;
  607. }();
  608. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], AbstractNodeTransformer.prototype, "nodeIdentifier", void 0);
  609. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], AbstractNodeTransformer.prototype, "initialize", null);
  610. AbstractNodeTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], AbstractNodeTransformer);
  611. exports.AbstractNodeTransformer = AbstractNodeTransformer;
  612. /***/ }),
  613. /* 8 */
  614. /***/ (function(module, exports) {
  615. module.exports = require("estraverse");
  616. /***/ }),
  617. /* 9 */
  618. /***/ (function(module, exports, __webpack_require__) {
  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. Object.defineProperty(exports, "__esModule", { value: true });
  623. var escodegen = __webpack_require__(28);
  624. var NodeType_1 = __webpack_require__(10);
  625. var Nodes = function () {
  626. function Nodes() {
  627. _classCallCheck(this, Nodes);
  628. }
  629. _createClass(Nodes, null, [{
  630. key: "getProgramNode",
  631. value: function getProgramNode() {
  632. var body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  633. return {
  634. type: NodeType_1.NodeType.Program,
  635. body: body,
  636. sourceType: 'script',
  637. obfuscatedNode: false
  638. };
  639. }
  640. }, {
  641. key: "getArrayExpressionNode",
  642. value: function getArrayExpressionNode() {
  643. var elements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  644. return {
  645. type: NodeType_1.NodeType.ArrayExpression,
  646. elements: elements
  647. };
  648. }
  649. }, {
  650. key: "getAssignmentExpressionNode",
  651. value: function getAssignmentExpressionNode(operator, left, right) {
  652. return {
  653. type: NodeType_1.NodeType.AssignmentExpression,
  654. operator: operator,
  655. left: left,
  656. right: right,
  657. obfuscatedNode: false
  658. };
  659. }
  660. }, {
  661. key: "getBinaryExpressionNode",
  662. value: function getBinaryExpressionNode(operator, left, right) {
  663. return {
  664. type: NodeType_1.NodeType.BinaryExpression,
  665. operator: operator,
  666. left: left,
  667. right: right,
  668. obfuscatedNode: false
  669. };
  670. }
  671. }, {
  672. key: "getBlockStatementNode",
  673. value: function getBlockStatementNode() {
  674. var body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  675. return {
  676. type: NodeType_1.NodeType.BlockStatement,
  677. body: body,
  678. obfuscatedNode: false
  679. };
  680. }
  681. }, {
  682. key: "getBreakStatement",
  683. value: function getBreakStatement(label) {
  684. var breakStatementNode = {
  685. type: NodeType_1.NodeType.BreakStatement,
  686. obfuscatedNode: false
  687. };
  688. if (label) {
  689. breakStatementNode.label = label;
  690. }
  691. return breakStatementNode;
  692. }
  693. }, {
  694. key: "getCatchClauseNode",
  695. value: function getCatchClauseNode() {
  696. var body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  697. return {
  698. type: NodeType_1.NodeType.CatchClause,
  699. param: Nodes.getIdentifierNode('err'),
  700. body: Nodes.getBlockStatementNode(body),
  701. obfuscatedNode: false
  702. };
  703. }
  704. }, {
  705. key: "getCallExpressionNode",
  706. value: function getCallExpressionNode(callee) {
  707. var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  708. return {
  709. type: NodeType_1.NodeType.CallExpression,
  710. callee: callee,
  711. arguments: args,
  712. obfuscatedNode: false
  713. };
  714. }
  715. }, {
  716. key: "getContinueStatement",
  717. value: function getContinueStatement(label) {
  718. var continueStatementNode = {
  719. type: NodeType_1.NodeType.ContinueStatement,
  720. obfuscatedNode: false
  721. };
  722. if (label) {
  723. continueStatementNode.label = label;
  724. }
  725. return continueStatementNode;
  726. }
  727. }, {
  728. key: "getExpressionStatementNode",
  729. value: function getExpressionStatementNode(expression) {
  730. return {
  731. type: NodeType_1.NodeType.ExpressionStatement,
  732. expression: expression,
  733. obfuscatedNode: false
  734. };
  735. }
  736. }, {
  737. key: "getFunctionDeclarationNode",
  738. value: function getFunctionDeclarationNode(functionName, params, body) {
  739. return {
  740. type: NodeType_1.NodeType.FunctionDeclaration,
  741. id: Nodes.getIdentifierNode(functionName),
  742. params: params,
  743. body: body,
  744. generator: false,
  745. obfuscatedNode: false
  746. };
  747. }
  748. }, {
  749. key: "getFunctionExpressionNode",
  750. value: function getFunctionExpressionNode(params, body) {
  751. return {
  752. type: NodeType_1.NodeType.FunctionExpression,
  753. params: params,
  754. body: body,
  755. generator: false,
  756. obfuscatedNode: false
  757. };
  758. }
  759. }, {
  760. key: "getIfStatementNode",
  761. value: function getIfStatementNode(test, consequent, alternate) {
  762. return Object.assign({ type: NodeType_1.NodeType.IfStatement, test: test,
  763. consequent: consequent }, alternate && { alternate: alternate }, { obfuscatedNode: false });
  764. }
  765. }, {
  766. key: "getIdentifierNode",
  767. value: function getIdentifierNode(name) {
  768. return {
  769. type: NodeType_1.NodeType.Identifier,
  770. name: name,
  771. obfuscatedNode: false
  772. };
  773. }
  774. }, {
  775. key: "getLabeledStatement",
  776. value: function getLabeledStatement(label, body) {
  777. return {
  778. type: NodeType_1.NodeType.LabeledStatement,
  779. label: label,
  780. body: body,
  781. obfuscatedNode: false
  782. };
  783. }
  784. }, {
  785. key: "getLiteralNode",
  786. value: function getLiteralNode(value, raw) {
  787. raw = raw !== undefined ? raw : "'" + value + "'";
  788. return {
  789. type: NodeType_1.NodeType.Literal,
  790. value: value,
  791. raw: raw,
  792. 'x-verbatim-property': {
  793. content: raw,
  794. precedence: escodegen.Precedence.Primary
  795. },
  796. obfuscatedNode: false
  797. };
  798. }
  799. }, {
  800. key: "getLogicalExpressionNode",
  801. value: function getLogicalExpressionNode(operator, left, right) {
  802. return {
  803. type: NodeType_1.NodeType.LogicalExpression,
  804. operator: operator,
  805. left: left,
  806. right: right,
  807. obfuscatedNode: false
  808. };
  809. }
  810. }, {
  811. key: "getMemberExpressionNode",
  812. value: function getMemberExpressionNode(object, property) {
  813. var computed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  814. return {
  815. type: NodeType_1.NodeType.MemberExpression,
  816. computed: computed,
  817. object: object,
  818. property: property,
  819. obfuscatedNode: false
  820. };
  821. }
  822. }, {
  823. key: "getObjectExpressionNode",
  824. value: function getObjectExpressionNode(properties) {
  825. return {
  826. type: NodeType_1.NodeType.ObjectExpression,
  827. properties: properties,
  828. obfuscatedNode: false
  829. };
  830. }
  831. }, {
  832. key: "getPropertyNode",
  833. value: function getPropertyNode(key, value) {
  834. var computed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  835. return {
  836. type: NodeType_1.NodeType.Property,
  837. key: key,
  838. value: value,
  839. kind: 'init',
  840. method: false,
  841. shorthand: false,
  842. computed: computed,
  843. obfuscatedNode: false
  844. };
  845. }
  846. }, {
  847. key: "getUnaryExpressionNode",
  848. value: function getUnaryExpressionNode(operator, argument) {
  849. var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  850. return {
  851. type: NodeType_1.NodeType.UnaryExpression,
  852. operator: operator,
  853. argument: argument,
  854. prefix: prefix,
  855. obfuscatedNode: false
  856. };
  857. }
  858. }, {
  859. key: "getReturnStatementNode",
  860. value: function getReturnStatementNode(argument) {
  861. return {
  862. type: NodeType_1.NodeType.ReturnStatement,
  863. argument: argument,
  864. obfuscatedNode: false
  865. };
  866. }
  867. }, {
  868. key: "getSwitchStatementNode",
  869. value: function getSwitchStatementNode(discriminant, cases) {
  870. return {
  871. type: NodeType_1.NodeType.SwitchStatement,
  872. discriminant: discriminant,
  873. cases: cases,
  874. obfuscatedNode: false
  875. };
  876. }
  877. }, {
  878. key: "getSwitchCaseNode",
  879. value: function getSwitchCaseNode(test, consequent) {
  880. return {
  881. type: NodeType_1.NodeType.SwitchCase,
  882. test: test,
  883. consequent: consequent,
  884. obfuscatedNode: false
  885. };
  886. }
  887. }, {
  888. key: "getUpdateExpressionNode",
  889. value: function getUpdateExpressionNode(operator, argumentExpr) {
  890. return {
  891. type: NodeType_1.NodeType.UpdateExpression,
  892. operator: operator,
  893. argument: argumentExpr,
  894. prefix: false,
  895. obfuscatedNode: false
  896. };
  897. }
  898. }, {
  899. key: "getVariableDeclarationNode",
  900. value: function getVariableDeclarationNode() {
  901. var declarations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  902. var kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'var';
  903. return {
  904. type: NodeType_1.NodeType.VariableDeclaration,
  905. declarations: declarations,
  906. kind: kind,
  907. obfuscatedNode: false
  908. };
  909. }
  910. }, {
  911. key: "getVariableDeclaratorNode",
  912. value: function getVariableDeclaratorNode(id, init) {
  913. return {
  914. type: NodeType_1.NodeType.VariableDeclarator,
  915. id: id,
  916. init: init,
  917. obfuscatedNode: false
  918. };
  919. }
  920. }, {
  921. key: "getWhileStatementNode",
  922. value: function getWhileStatementNode(test, body) {
  923. return {
  924. type: NodeType_1.NodeType.WhileStatement,
  925. test: test,
  926. body: body,
  927. obfuscatedNode: false
  928. };
  929. }
  930. }]);
  931. return Nodes;
  932. }();
  933. exports.Nodes = Nodes;
  934. /***/ }),
  935. /* 10 */
  936. /***/ (function(module, exports, __webpack_require__) {
  937. "use strict";
  938. Object.defineProperty(exports, "__esModule", { value: true });
  939. var NodeType;
  940. (function (NodeType) {
  941. NodeType["ArrayExpression"] = "ArrayExpression";
  942. NodeType["ArrowFunctionExpression"] = "ArrowFunctionExpression";
  943. NodeType["AssignmentExpression"] = "AssignmentExpression";
  944. NodeType["AssignmentPattern"] = "AssignmentPattern";
  945. NodeType["BinaryExpression"] = "BinaryExpression";
  946. NodeType["BlockStatement"] = "BlockStatement";
  947. NodeType["BreakStatement"] = "BreakStatement";
  948. NodeType["CallExpression"] = "CallExpression";
  949. NodeType["CatchClause"] = "CatchClause";
  950. NodeType["ClassDeclaration"] = "ClassDeclaration";
  951. NodeType["ContinueStatement"] = "ContinueStatement";
  952. NodeType["ExpressionStatement"] = "ExpressionStatement";
  953. NodeType["FunctionDeclaration"] = "FunctionDeclaration";
  954. NodeType["FunctionExpression"] = "FunctionExpression";
  955. NodeType["Identifier"] = "Identifier";
  956. NodeType["IfStatement"] = "IfStatement";
  957. NodeType["LabeledStatement"] = "LabeledStatement";
  958. NodeType["Literal"] = "Literal";
  959. NodeType["LogicalExpression"] = "LogicalExpression";
  960. NodeType["MemberExpression"] = "MemberExpression";
  961. NodeType["MethodDefinition"] = "MethodDefinition";
  962. NodeType["ObjectExpression"] = "ObjectExpression";
  963. NodeType["ObjectPattern"] = "ObjectPattern";
  964. NodeType["Program"] = "Program";
  965. NodeType["Property"] = "Property";
  966. NodeType["ReturnStatement"] = "ReturnStatement";
  967. NodeType["SwitchCase"] = "SwitchCase";
  968. NodeType["SwitchStatement"] = "SwitchStatement";
  969. NodeType["TemplateLiteral"] = "TemplateLiteral";
  970. NodeType["TryStatement"] = "TryStatement";
  971. NodeType["UnaryExpression"] = "UnaryExpression";
  972. NodeType["UpdateExpression"] = "UpdateExpression";
  973. NodeType["VariableDeclaration"] = "VariableDeclaration";
  974. NodeType["VariableDeclarator"] = "VariableDeclarator";
  975. NodeType["WhileStatement"] = "WhileStatement";
  976. })(NodeType = exports.NodeType || (exports.NodeType = {}));
  977. /***/ }),
  978. /* 11 */
  979. /***/ (function(module, exports) {
  980. module.exports = require("string-template");
  981. /***/ }),
  982. /* 12 */
  983. /***/ (function(module, exports, __webpack_require__) {
  984. "use strict";
  985. Object.defineProperty(exports, "__esModule", { value: true });
  986. var ControlFlowCustomNode;
  987. (function (ControlFlowCustomNode) {
  988. ControlFlowCustomNode[ControlFlowCustomNode["BinaryExpressionFunctionNode"] = 0] = "BinaryExpressionFunctionNode";
  989. ControlFlowCustomNode[ControlFlowCustomNode["BlockStatementControlFlowFlatteningNode"] = 1] = "BlockStatementControlFlowFlatteningNode";
  990. ControlFlowCustomNode[ControlFlowCustomNode["CallExpressionControlFlowStorageCallNode"] = 2] = "CallExpressionControlFlowStorageCallNode";
  991. ControlFlowCustomNode[ControlFlowCustomNode["CallExpressionFunctionNode"] = 3] = "CallExpressionFunctionNode";
  992. ControlFlowCustomNode[ControlFlowCustomNode["ControlFlowStorageNode"] = 4] = "ControlFlowStorageNode";
  993. ControlFlowCustomNode[ControlFlowCustomNode["ExpressionWithOperatorControlFlowStorageCallNode"] = 5] = "ExpressionWithOperatorControlFlowStorageCallNode";
  994. ControlFlowCustomNode[ControlFlowCustomNode["LogicalExpressionFunctionNode"] = 6] = "LogicalExpressionFunctionNode";
  995. ControlFlowCustomNode[ControlFlowCustomNode["StringLiteralControlFlowStorageCallNode"] = 7] = "StringLiteralControlFlowStorageCallNode";
  996. ControlFlowCustomNode[ControlFlowCustomNode["StringLiteralNode"] = 8] = "StringLiteralNode";
  997. })(ControlFlowCustomNode = exports.ControlFlowCustomNode || (exports.ControlFlowCustomNode = {}));
  998. /***/ }),
  999. /* 13 */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. Object.defineProperty(exports, "__esModule", { value: true });
  1003. var ObfuscationTarget;
  1004. (function (ObfuscationTarget) {
  1005. ObfuscationTarget["Browser"] = "browser";
  1006. ObfuscationTarget["Extension"] = "extension";
  1007. ObfuscationTarget["Node"] = "node";
  1008. })(ObfuscationTarget = exports.ObfuscationTarget || (exports.ObfuscationTarget = {}));
  1009. /***/ }),
  1010. /* 14 */
  1011. /***/ (function(module, exports, __webpack_require__) {
  1012. "use strict";
  1013. 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; }; })();
  1014. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1015. Object.defineProperty(exports, "__esModule", { value: true });
  1016. var inversify_1 = __webpack_require__(0);
  1017. var ServiceIdentifiers_1 = __webpack_require__(1);
  1018. var AnalyzersModule_1 = __webpack_require__(46);
  1019. var ControlFlowTransformersModule_1 = __webpack_require__(51);
  1020. var ConvertingTransformersModule_1 = __webpack_require__(59);
  1021. var CustomNodesModule_1 = __webpack_require__(63);
  1022. var NodeTransformersModule_1 = __webpack_require__(109);
  1023. var ObfuscatingTransformersModule_1 = __webpack_require__(110);
  1024. var PreparingTransformersModule_1 = __webpack_require__(123);
  1025. var StoragesModule_1 = __webpack_require__(128);
  1026. var UtilsModule_1 = __webpack_require__(135);
  1027. var JavaScriptObfuscator_1 = __webpack_require__(139);
  1028. var Logger_1 = __webpack_require__(142);
  1029. var ObfuscationEventEmitter_1 = __webpack_require__(144);
  1030. var ObfuscationResult_1 = __webpack_require__(146);
  1031. var Options_1 = __webpack_require__(147);
  1032. var SourceCode_1 = __webpack_require__(161);
  1033. var SourceMapCorrector_1 = __webpack_require__(162);
  1034. var TransformersRunner_1 = __webpack_require__(163);
  1035. var InversifyContainerFacade = function () {
  1036. function InversifyContainerFacade() {
  1037. _classCallCheck(this, InversifyContainerFacade);
  1038. this.container = new inversify_1.Container();
  1039. }
  1040. _createClass(InversifyContainerFacade, [{
  1041. key: "get",
  1042. value: function get(serviceIdentifier) {
  1043. return this.container.get(serviceIdentifier);
  1044. }
  1045. }, {
  1046. key: "getNamed",
  1047. value: function getNamed(serviceIdentifier, named) {
  1048. return this.container.getNamed(serviceIdentifier, named);
  1049. }
  1050. }, {
  1051. key: "load",
  1052. value: function load(sourceCode, options) {
  1053. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ISourceCode).toDynamicValue(function () {
  1054. return new SourceCode_1.SourceCode(sourceCode);
  1055. }).inSingletonScope();
  1056. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IOptions).toDynamicValue(function () {
  1057. return new Options_1.Options(options);
  1058. }).inSingletonScope();
  1059. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ILogger).to(Logger_1.Logger).inSingletonScope();
  1060. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IJavaScriptObfuscator).to(JavaScriptObfuscator_1.JavaScriptObfuscator).inSingletonScope();
  1061. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ITransformersRunner).to(TransformersRunner_1.TransformersRunner).inSingletonScope();
  1062. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationResult).to(ObfuscationResult_1.ObfuscationResult).inSingletonScope();
  1063. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationResult).toFactory(function (context) {
  1064. return function (obfuscatedCode, sourceMap) {
  1065. var obfuscationResult = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationResult);
  1066. obfuscationResult.initialize(obfuscatedCode, sourceMap);
  1067. return obfuscationResult;
  1068. };
  1069. });
  1070. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.ISourceMapCorrector).to(SourceMapCorrector_1.SourceMapCorrector).inSingletonScope();
  1071. this.container.bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter).to(ObfuscationEventEmitter_1.ObfuscationEventEmitter).inSingletonScope();
  1072. this.container.load(AnalyzersModule_1.analyzersModule);
  1073. this.container.load(ControlFlowTransformersModule_1.controlFlowTransformersModule);
  1074. this.container.load(ConvertingTransformersModule_1.convertingTransformersModule);
  1075. this.container.load(CustomNodesModule_1.customNodesModule);
  1076. this.container.load(NodeTransformersModule_1.nodeTransformersModule);
  1077. this.container.load(ObfuscatingTransformersModule_1.obfuscatingTransformersModule);
  1078. this.container.load(PreparingTransformersModule_1.preparingTransformersModule);
  1079. this.container.load(StoragesModule_1.storagesModule);
  1080. this.container.load(UtilsModule_1.utilsModule);
  1081. }
  1082. }, {
  1083. key: "unload",
  1084. value: function unload() {
  1085. this.container.unbindAll();
  1086. }
  1087. }], [{
  1088. key: "getFactory",
  1089. value: function getFactory(serviceIdentifier) {
  1090. return function (context) {
  1091. return function (bindingName) {
  1092. return context.container.getNamed(serviceIdentifier, bindingName);
  1093. };
  1094. };
  1095. }
  1096. }, {
  1097. key: "getCacheFactory",
  1098. value: function getCacheFactory(serviceIdentifier) {
  1099. return function (context) {
  1100. var cache = new Map();
  1101. return function (bindingName) {
  1102. if (cache.has(bindingName)) {
  1103. return cache.get(bindingName);
  1104. }
  1105. var object = context.container.getNamed(serviceIdentifier, bindingName);
  1106. cache.set(bindingName, object);
  1107. return object;
  1108. };
  1109. };
  1110. }
  1111. }, {
  1112. key: "getConstructorFactory",
  1113. value: function getConstructorFactory(serviceIdentifier) {
  1114. for (var _len = arguments.length, dependencies = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  1115. dependencies[_key - 1] = arguments[_key];
  1116. }
  1117. return function (context) {
  1118. var cache = new Map();
  1119. var cachedDependencies = [];
  1120. return function (bindingName) {
  1121. dependencies.forEach(function (dependency, index) {
  1122. if (!cachedDependencies[index]) {
  1123. cachedDependencies[index] = context.container.get(dependency);
  1124. }
  1125. });
  1126. if (cache.has(bindingName)) {
  1127. return new (Function.prototype.bind.apply(cache.get(bindingName), [null].concat(cachedDependencies)))();
  1128. }
  1129. var constructor = context.container.getNamed(serviceIdentifier, bindingName);
  1130. cache.set(bindingName, constructor);
  1131. return new (Function.prototype.bind.apply(constructor, [null].concat(cachedDependencies)))();
  1132. };
  1133. };
  1134. }
  1135. }]);
  1136. return InversifyContainerFacade;
  1137. }();
  1138. exports.InversifyContainerFacade = InversifyContainerFacade;
  1139. /***/ }),
  1140. /* 15 */
  1141. /***/ (function(module, exports, __webpack_require__) {
  1142. "use strict";
  1143. Object.defineProperty(exports, "__esModule", { value: true });
  1144. var ObfuscationEvent;
  1145. (function (ObfuscationEvent) {
  1146. ObfuscationEvent["AfterObfuscation"] = "afterObfuscation";
  1147. ObfuscationEvent["BeforeObfuscation"] = "beforeObfuscation";
  1148. })(ObfuscationEvent = exports.ObfuscationEvent || (exports.ObfuscationEvent = {}));
  1149. /***/ }),
  1150. /* 16 */
  1151. /***/ (function(module, exports, __webpack_require__) {
  1152. "use strict";
  1153. 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; }; })();
  1154. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1155. Object.defineProperty(exports, "__esModule", { value: true });
  1156. var JSFuck_1 = __webpack_require__(69);
  1157. var Utils = function () {
  1158. function Utils() {
  1159. _classCallCheck(this, Utils);
  1160. }
  1161. _createClass(Utils, null, [{
  1162. key: "decToHex",
  1163. value: function decToHex(dec) {
  1164. var radix = 16;
  1165. return dec.toString(radix);
  1166. }
  1167. }, {
  1168. key: "extractDomainFromUrl",
  1169. value: function extractDomainFromUrl(url) {
  1170. var domain = void 0;
  1171. if (url.indexOf('://') > -1 || url.indexOf('//') === 0) {
  1172. domain = url.split('/')[2];
  1173. } else {
  1174. domain = url.split('/')[0];
  1175. }
  1176. domain = domain.split(':')[0];
  1177. return domain;
  1178. }
  1179. }, {
  1180. key: "isCeilNumber",
  1181. value: function isCeilNumber(number) {
  1182. return number % 1 === 0;
  1183. }
  1184. }, {
  1185. key: "stringRotate",
  1186. value: function stringRotate(string, times) {
  1187. if (!string) {
  1188. throw new ReferenceError("Cannot rotate empty string.");
  1189. }
  1190. for (var i = 0; i < times; i++) {
  1191. string = string[string.length - 1] + string.substring(0, string.length - 1);
  1192. }
  1193. return string;
  1194. }
  1195. }, {
  1196. key: "stringToJSFuck",
  1197. value: function stringToJSFuck(string) {
  1198. return Array.from(string).map(function (character) {
  1199. return JSFuck_1.JSFuck[character] || character;
  1200. }).join(' + ');
  1201. }
  1202. }]);
  1203. return Utils;
  1204. }();
  1205. Utils.hexadecimalPrefix = '0x';
  1206. exports.Utils = Utils;
  1207. /***/ }),
  1208. /* 17 */
  1209. /***/ (function(module, exports, __webpack_require__) {
  1210. "use strict";
  1211. Object.defineProperty(exports, "__esModule", { value: true });
  1212. var IdentifierObfuscatingReplacer;
  1213. (function (IdentifierObfuscatingReplacer) {
  1214. IdentifierObfuscatingReplacer[IdentifierObfuscatingReplacer["BaseIdentifierObfuscatingReplacer"] = 0] = "BaseIdentifierObfuscatingReplacer";
  1215. })(IdentifierObfuscatingReplacer = exports.IdentifierObfuscatingReplacer || (exports.IdentifierObfuscatingReplacer = {}));
  1216. /***/ }),
  1217. /* 18 */
  1218. /***/ (function(module, exports, __webpack_require__) {
  1219. "use strict";
  1220. 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; }; })();
  1221. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1222. Object.defineProperty(exports, "__esModule", { value: true });
  1223. __webpack_require__(45);
  1224. var ServiceIdentifiers_1 = __webpack_require__(1);
  1225. var InversifyContainerFacade_1 = __webpack_require__(14);
  1226. var JavaScriptObfuscatorCLI_1 = __webpack_require__(33);
  1227. var JavaScriptObfuscatorFacade = function () {
  1228. function JavaScriptObfuscatorFacade() {
  1229. _classCallCheck(this, JavaScriptObfuscatorFacade);
  1230. }
  1231. _createClass(JavaScriptObfuscatorFacade, null, [{
  1232. key: "obfuscate",
  1233. value: function obfuscate(sourceCode) {
  1234. var inputOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1235. var inversifyContainerFacade = new InversifyContainerFacade_1.InversifyContainerFacade();
  1236. inversifyContainerFacade.load(sourceCode, inputOptions);
  1237. var javaScriptObfuscator = inversifyContainerFacade.get(ServiceIdentifiers_1.ServiceIdentifiers.IJavaScriptObfuscator);
  1238. var obfuscationResult = javaScriptObfuscator.obfuscate(sourceCode);
  1239. inversifyContainerFacade.unload();
  1240. return obfuscationResult;
  1241. }
  1242. }, {
  1243. key: "runCLI",
  1244. value: function runCLI(argv) {
  1245. var javaScriptObfuscatorCLI = new JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI(argv);
  1246. javaScriptObfuscatorCLI.initialize();
  1247. javaScriptObfuscatorCLI.run();
  1248. }
  1249. }]);
  1250. return JavaScriptObfuscatorFacade;
  1251. }();
  1252. exports.JavaScriptObfuscator = JavaScriptObfuscatorFacade;
  1253. /***/ }),
  1254. /* 19 */
  1255. /***/ (function(module, exports, __webpack_require__) {
  1256. "use strict";
  1257. 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; }; })();
  1258. 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); } }
  1259. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1260. Object.defineProperty(exports, "__esModule", { value: true });
  1261. var NodeAppender = function () {
  1262. function NodeAppender() {
  1263. _classCallCheck(this, NodeAppender);
  1264. }
  1265. _createClass(NodeAppender, null, [{
  1266. key: "appendNode",
  1267. value: function appendNode(blockScopeNode, nodeBodyStatements) {
  1268. if (!NodeAppender.validateBodyStatements(nodeBodyStatements)) {
  1269. nodeBodyStatements = [];
  1270. }
  1271. nodeBodyStatements = NodeAppender.parentizeBodyStatementsBeforeAppend(blockScopeNode, nodeBodyStatements);
  1272. blockScopeNode.body = [].concat(_toConsumableArray(blockScopeNode.body), _toConsumableArray(nodeBodyStatements));
  1273. }
  1274. }, {
  1275. key: "appendNodeToOptimalBlockScope",
  1276. value: function appendNodeToOptimalBlockScope(blockScopeStackTraceData, blockScopeNode, nodeBodyStatements) {
  1277. var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  1278. var targetBlockScope = void 0;
  1279. if (!blockScopeStackTraceData.length) {
  1280. targetBlockScope = blockScopeNode;
  1281. } else {
  1282. targetBlockScope = NodeAppender.getOptimalBlockScope(blockScopeStackTraceData, index);
  1283. }
  1284. NodeAppender.prependNode(targetBlockScope, nodeBodyStatements);
  1285. }
  1286. }, {
  1287. key: "getOptimalBlockScope",
  1288. value: function getOptimalBlockScope(blockScopeTraceData, index) {
  1289. var deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
  1290. var firstCall = blockScopeTraceData[index];
  1291. if (deep <= 0) {
  1292. throw new Error("Invalid `deep` argument value. Value should be bigger then 0.");
  1293. }
  1294. if (deep > 1 && firstCall.stackTrace.length) {
  1295. return NodeAppender.getOptimalBlockScope(firstCall.stackTrace, 0, --deep);
  1296. } else {
  1297. return firstCall.callee;
  1298. }
  1299. }
  1300. }, {
  1301. key: "insertNodeAtIndex",
  1302. value: function insertNodeAtIndex(blockScopeNode, nodeBodyStatements, index) {
  1303. if (!NodeAppender.validateBodyStatements(nodeBodyStatements)) {
  1304. nodeBodyStatements = [];
  1305. }
  1306. nodeBodyStatements = NodeAppender.parentizeBodyStatementsBeforeAppend(blockScopeNode, nodeBodyStatements);
  1307. blockScopeNode.body = [].concat(_toConsumableArray(blockScopeNode.body.slice(0, index)), _toConsumableArray(nodeBodyStatements), _toConsumableArray(blockScopeNode.body.slice(index)));
  1308. }
  1309. }, {
  1310. key: "prependNode",
  1311. value: function prependNode(blockScopeNode, nodeBodyStatements) {
  1312. if (!NodeAppender.validateBodyStatements(nodeBodyStatements)) {
  1313. nodeBodyStatements = [];
  1314. }
  1315. nodeBodyStatements = NodeAppender.parentizeBodyStatementsBeforeAppend(blockScopeNode, nodeBodyStatements);
  1316. blockScopeNode.body = [].concat(_toConsumableArray(nodeBodyStatements), _toConsumableArray(blockScopeNode.body));
  1317. }
  1318. }, {
  1319. key: "parentizeBodyStatementsBeforeAppend",
  1320. value: function parentizeBodyStatementsBeforeAppend(blockScopeNode, nodeBodyStatements) {
  1321. nodeBodyStatements.forEach(function (statement) {
  1322. statement.parentNode = blockScopeNode;
  1323. });
  1324. return nodeBodyStatements;
  1325. }
  1326. }, {
  1327. key: "validateBodyStatements",
  1328. value: function validateBodyStatements(nodeBodyStatements) {
  1329. return nodeBodyStatements.every(function (statementNode) {
  1330. return !!statementNode && statementNode.hasOwnProperty('type');
  1331. });
  1332. }
  1333. }]);
  1334. return NodeAppender;
  1335. }();
  1336. exports.NodeAppender = NodeAppender;
  1337. /***/ }),
  1338. /* 20 */
  1339. /***/ (function(module, exports, __webpack_require__) {
  1340. "use strict";
  1341. Object.defineProperty(exports, "__esModule", { value: true });
  1342. var CustomNode;
  1343. (function (CustomNode) {
  1344. CustomNode[CustomNode["ConsoleOutputDisableExpressionNode"] = 0] = "ConsoleOutputDisableExpressionNode";
  1345. CustomNode[CustomNode["DebugProtectionFunctionCallNode"] = 1] = "DebugProtectionFunctionCallNode";
  1346. CustomNode[CustomNode["DebugProtectionFunctionIntervalNode"] = 2] = "DebugProtectionFunctionIntervalNode";
  1347. CustomNode[CustomNode["DebugProtectionFunctionNode"] = 3] = "DebugProtectionFunctionNode";
  1348. CustomNode[CustomNode["DomainLockNode"] = 4] = "DomainLockNode";
  1349. CustomNode[CustomNode["NodeCallsControllerFunctionNode"] = 5] = "NodeCallsControllerFunctionNode";
  1350. CustomNode[CustomNode["SelfDefendingUnicodeNode"] = 6] = "SelfDefendingUnicodeNode";
  1351. CustomNode[CustomNode["StringArrayCallsWrapper"] = 7] = "StringArrayCallsWrapper";
  1352. CustomNode[CustomNode["StringArrayNode"] = 8] = "StringArrayNode";
  1353. CustomNode[CustomNode["StringArrayRotateFunctionNode"] = 9] = "StringArrayRotateFunctionNode";
  1354. })(CustomNode = exports.CustomNode || (exports.CustomNode = {}));
  1355. /***/ }),
  1356. /* 21 */
  1357. /***/ (function(module, exports, __webpack_require__) {
  1358. "use strict";
  1359. Object.defineProperty(exports, "__esModule", { value: true });
  1360. var NodeTransformer;
  1361. (function (NodeTransformer) {
  1362. NodeTransformer[NodeTransformer["BlockStatementControlFlowTransformer"] = 0] = "BlockStatementControlFlowTransformer";
  1363. NodeTransformer[NodeTransformer["ClassDeclarationTransformer"] = 1] = "ClassDeclarationTransformer";
  1364. NodeTransformer[NodeTransformer["DeadCodeInjectionTransformer"] = 2] = "DeadCodeInjectionTransformer";
  1365. NodeTransformer[NodeTransformer["FunctionControlFlowTransformer"] = 3] = "FunctionControlFlowTransformer";
  1366. NodeTransformer[NodeTransformer["CatchClauseTransformer"] = 4] = "CatchClauseTransformer";
  1367. NodeTransformer[NodeTransformer["FunctionDeclarationTransformer"] = 5] = "FunctionDeclarationTransformer";
  1368. NodeTransformer[NodeTransformer["FunctionTransformer"] = 6] = "FunctionTransformer";
  1369. NodeTransformer[NodeTransformer["LabeledStatementTransformer"] = 7] = "LabeledStatementTransformer";
  1370. NodeTransformer[NodeTransformer["LiteralTransformer"] = 8] = "LiteralTransformer";
  1371. NodeTransformer[NodeTransformer["MemberExpressionTransformer"] = 9] = "MemberExpressionTransformer";
  1372. NodeTransformer[NodeTransformer["MethodDefinitionTransformer"] = 10] = "MethodDefinitionTransformer";
  1373. NodeTransformer[NodeTransformer["ObfuscatingGuardsTransformer"] = 11] = "ObfuscatingGuardsTransformer";
  1374. NodeTransformer[NodeTransformer["ObjectExpressionTransformer"] = 12] = "ObjectExpressionTransformer";
  1375. NodeTransformer[NodeTransformer["ParentificationTransformer"] = 13] = "ParentificationTransformer";
  1376. NodeTransformer[NodeTransformer["TemplateLiteralTransformer"] = 14] = "TemplateLiteralTransformer";
  1377. NodeTransformer[NodeTransformer["VariableDeclarationTransformer"] = 15] = "VariableDeclarationTransformer";
  1378. })(NodeTransformer = exports.NodeTransformer || (exports.NodeTransformer = {}));
  1379. /***/ }),
  1380. /* 22 */
  1381. /***/ (function(module, exports, __webpack_require__) {
  1382. "use strict";
  1383. 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; }; })();
  1384. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1385. Object.defineProperty(exports, "__esModule", { value: true });
  1386. var tslib_1 = __webpack_require__(2);
  1387. var inversify_1 = __webpack_require__(0);
  1388. var ServiceIdentifiers_1 = __webpack_require__(1);
  1389. var AbstractCustomNodeGroup = function () {
  1390. function AbstractCustomNodeGroup(randomGenerator, options) {
  1391. _classCallCheck(this, AbstractCustomNodeGroup);
  1392. this.randomGenerator = randomGenerator;
  1393. this.options = options;
  1394. }
  1395. _createClass(AbstractCustomNodeGroup, [{
  1396. key: "getAppendEvent",
  1397. value: function getAppendEvent() {
  1398. return this.appendEvent;
  1399. }
  1400. }, {
  1401. key: "getCustomNodes",
  1402. value: function getCustomNodes() {
  1403. return this.customNodes;
  1404. }
  1405. }, {
  1406. key: "appendCustomNodeIfExist",
  1407. value: function appendCustomNodeIfExist(customNodeName, callback) {
  1408. var customNode = this.customNodes.get(customNodeName);
  1409. if (!customNode) {
  1410. return;
  1411. }
  1412. callback(customNode);
  1413. }
  1414. }, {
  1415. key: "getRandomStackTraceIndex",
  1416. value: function getRandomStackTraceIndex(stackTraceLength) {
  1417. return this.randomGenerator.getRandomInteger(0, Math.max(0, Math.round(stackTraceLength - 1)));
  1418. }
  1419. }]);
  1420. return AbstractCustomNodeGroup;
  1421. }();
  1422. AbstractCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], AbstractCustomNodeGroup);
  1423. exports.AbstractCustomNodeGroup = AbstractCustomNodeGroup;
  1424. /***/ }),
  1425. /* 23 */
  1426. /***/ (function(module, exports, __webpack_require__) {
  1427. "use strict";
  1428. Object.defineProperty(exports, "__esModule", { value: true });
  1429. var SourceMapMode;
  1430. (function (SourceMapMode) {
  1431. SourceMapMode["Inline"] = "inline";
  1432. SourceMapMode["Separate"] = "separate";
  1433. })(SourceMapMode = exports.SourceMapMode || (exports.SourceMapMode = {}));
  1434. /***/ }),
  1435. /* 24 */
  1436. /***/ (function(module, exports, __webpack_require__) {
  1437. "use strict";
  1438. Object.defineProperty(exports, "__esModule", { value: true });
  1439. var StringArrayEncoding;
  1440. (function (StringArrayEncoding) {
  1441. StringArrayEncoding["Base64"] = "base64";
  1442. StringArrayEncoding["Rc4"] = "rc4";
  1443. })(StringArrayEncoding = exports.StringArrayEncoding || (exports.StringArrayEncoding = {}));
  1444. /***/ }),
  1445. /* 25 */
  1446. /***/ (function(module, exports, __webpack_require__) {
  1447. "use strict";
  1448. Object.defineProperty(exports, "__esModule", { value: true });
  1449. var ObfuscationTarget_1 = __webpack_require__(13);
  1450. var SourceMapMode_1 = __webpack_require__(23);
  1451. exports.NO_CUSTOM_NODES_PRESET = Object.freeze({
  1452. compact: true,
  1453. controlFlowFlattening: false,
  1454. controlFlowFlatteningThreshold: 0,
  1455. deadCodeInjection: false,
  1456. deadCodeInjectionThreshold: 0,
  1457. debugProtection: false,
  1458. debugProtectionInterval: false,
  1459. disableConsoleOutput: false,
  1460. domainLock: [],
  1461. log: false,
  1462. mangle: false,
  1463. renameGlobals: false,
  1464. reservedNames: [],
  1465. rotateStringArray: false,
  1466. seed: 0,
  1467. selfDefending: false,
  1468. sourceMap: false,
  1469. sourceMapBaseUrl: '',
  1470. sourceMapFileName: '',
  1471. sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
  1472. stringArray: false,
  1473. stringArrayEncoding: false,
  1474. stringArrayThreshold: 0,
  1475. target: ObfuscationTarget_1.ObfuscationTarget.Browser,
  1476. unicodeEscapeSequence: false
  1477. });
  1478. /***/ }),
  1479. /* 26 */
  1480. /***/ (function(module, exports, __webpack_require__) {
  1481. "use strict";
  1482. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1483. Object.defineProperty(exports, "__esModule", { value: true });
  1484. var tslib_1 = __webpack_require__(2);
  1485. var inversify_1 = __webpack_require__(0);
  1486. var ServiceIdentifiers_1 = __webpack_require__(1);
  1487. var AbstractObfuscatingReplacer = function AbstractObfuscatingReplacer(options) {
  1488. _classCallCheck(this, AbstractObfuscatingReplacer);
  1489. this.options = options;
  1490. };
  1491. AbstractObfuscatingReplacer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object])], AbstractObfuscatingReplacer);
  1492. exports.AbstractObfuscatingReplacer = AbstractObfuscatingReplacer;
  1493. /***/ }),
  1494. /* 27 */
  1495. /***/ (function(module, exports, __webpack_require__) {
  1496. "use strict";
  1497. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1498. Object.defineProperty(exports, "__esModule", { value: true });
  1499. var tslib_1 = __webpack_require__(2);
  1500. var inversify_1 = __webpack_require__(0);
  1501. var AbstractCalleeDataExtractor = function AbstractCalleeDataExtractor() {
  1502. _classCallCheck(this, AbstractCalleeDataExtractor);
  1503. };
  1504. AbstractCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], AbstractCalleeDataExtractor);
  1505. exports.AbstractCalleeDataExtractor = AbstractCalleeDataExtractor;
  1506. /***/ }),
  1507. /* 28 */
  1508. /***/ (function(module, exports) {
  1509. module.exports = require("escodegen-wallaby");
  1510. /***/ }),
  1511. /* 29 */
  1512. /***/ (function(module, exports, __webpack_require__) {
  1513. "use strict";
  1514. 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; }; })();
  1515. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1516. Object.defineProperty(exports, "__esModule", { value: true });
  1517. var tslib_1 = __webpack_require__(2);
  1518. var inversify_1 = __webpack_require__(0);
  1519. var ServiceIdentifiers_1 = __webpack_require__(1);
  1520. var AbstractControlFlowReplacer = AbstractControlFlowReplacer_1 = function () {
  1521. function AbstractControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  1522. _classCallCheck(this, AbstractControlFlowReplacer);
  1523. this.replacerDataByControlFlowStorageId = new Map();
  1524. this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  1525. this.randomGenerator = randomGenerator;
  1526. this.options = options;
  1527. }
  1528. _createClass(AbstractControlFlowReplacer, [{
  1529. key: "insertCustomNodeToControlFlowStorage",
  1530. value: function insertCustomNodeToControlFlowStorage(customNode, controlFlowStorage, replacerId, usingExistingIdentifierChance) {
  1531. var _this = this;
  1532. var controlFlowStorageId = controlFlowStorage.getStorageId();
  1533. var storageKeysById = AbstractControlFlowReplacer_1.getStorageKeysByIdForCurrentStorage(this.replacerDataByControlFlowStorageId, controlFlowStorageId);
  1534. var storageKeysForCurrentId = storageKeysById.get(replacerId);
  1535. if (this.randomGenerator.getMathRandom() < usingExistingIdentifierChance && storageKeysForCurrentId && storageKeysForCurrentId.length) {
  1536. return this.randomGenerator.getRandomGenerator().pickone(storageKeysForCurrentId);
  1537. }
  1538. var generateStorageKey = function generateStorageKey(length) {
  1539. var key = _this.randomGenerator.getRandomString(length);
  1540. if (controlFlowStorage.getStorage().has(key)) {
  1541. return generateStorageKey(length);
  1542. }
  1543. return key;
  1544. };
  1545. var storageKey = generateStorageKey(5);
  1546. storageKeysById.set(replacerId, [storageKey]);
  1547. this.replacerDataByControlFlowStorageId.set(controlFlowStorageId, storageKeysById);
  1548. controlFlowStorage.set(storageKey, customNode);
  1549. return storageKey;
  1550. }
  1551. }], [{
  1552. key: "getStorageKeysByIdForCurrentStorage",
  1553. value: function getStorageKeysByIdForCurrentStorage(identifierDataByControlFlowStorageId, controlFlowStorageId) {
  1554. var storageKeysById = void 0;
  1555. if (identifierDataByControlFlowStorageId.has(controlFlowStorageId)) {
  1556. storageKeysById = identifierDataByControlFlowStorageId.get(controlFlowStorageId);
  1557. } else {
  1558. storageKeysById = new Map();
  1559. }
  1560. return storageKeysById;
  1561. }
  1562. }]);
  1563. return AbstractControlFlowReplacer;
  1564. }();
  1565. AbstractControlFlowReplacer = AbstractControlFlowReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], AbstractControlFlowReplacer);
  1566. exports.AbstractControlFlowReplacer = AbstractControlFlowReplacer;
  1567. var AbstractControlFlowReplacer_1;
  1568. /***/ }),
  1569. /* 30 */
  1570. /***/ (function(module, exports, __webpack_require__) {
  1571. "use strict";
  1572. Object.defineProperty(exports, "__esModule", { value: true });
  1573. function GlobalVariableNoEvalTemplate() {
  1574. return "\n var that = (typeof window !== 'undefined'\n ? window\n : (typeof process === 'object' &&\n typeof require === 'function' &&\n typeof global === 'object')\n ? global\n : this);\n ";
  1575. }
  1576. exports.GlobalVariableNoEvalTemplate = GlobalVariableNoEvalTemplate;
  1577. /***/ }),
  1578. /* 31 */
  1579. /***/ (function(module, exports, __webpack_require__) {
  1580. "use strict";
  1581. 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; }; })();
  1582. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1583. Object.defineProperty(exports, "__esModule", { value: true });
  1584. var tslib_1 = __webpack_require__(2);
  1585. var inversify_1 = __webpack_require__(0);
  1586. var ServiceIdentifiers_1 = __webpack_require__(1);
  1587. var md5 = __webpack_require__(133);
  1588. var chance_1 = __webpack_require__(134);
  1589. var Initializable_1 = __webpack_require__(3);
  1590. var Utils_1 = __webpack_require__(16);
  1591. var RandomGenerator = RandomGenerator_1 = function () {
  1592. function RandomGenerator(sourceCode, options) {
  1593. _classCallCheck(this, RandomGenerator);
  1594. this.randomVariableNameSet = new Set();
  1595. this.sourceCode = sourceCode;
  1596. this.options = options;
  1597. }
  1598. _createClass(RandomGenerator, [{
  1599. key: "initialize",
  1600. value: function initialize() {
  1601. var _this = this;
  1602. var getRandomInteger = function getRandomInteger(min, max) {
  1603. return Math.floor(Math.random() * (max - min + 1) + min);
  1604. };
  1605. var getSeed = function getSeed() {
  1606. var md5Hash = md5(_this.sourceCode.getSourceCode());
  1607. return _this.seed + Number(md5Hash.replace(/\D/g, ''));
  1608. };
  1609. this.seed = this.options.seed !== 0 ? this.options.seed : getRandomInteger(0, 999999999);
  1610. this.randomGenerator = new chance_1.Chance(getSeed());
  1611. }
  1612. }, {
  1613. key: "getMathRandom",
  1614. value: function getMathRandom() {
  1615. return this.getRandomInteger(0, 99999) / 100000;
  1616. }
  1617. }, {
  1618. key: "getRandomFloat",
  1619. value: function getRandomFloat(min, max) {
  1620. return this.getRandomGenerator().floating({
  1621. min: min,
  1622. max: max,
  1623. fixed: 7
  1624. });
  1625. }
  1626. }, {
  1627. key: "getRandomGenerator",
  1628. value: function getRandomGenerator() {
  1629. return this.randomGenerator;
  1630. }
  1631. }, {
  1632. key: "getRandomInteger",
  1633. value: function getRandomInteger(min, max) {
  1634. return this.getRandomGenerator().integer({
  1635. min: min,
  1636. max: max
  1637. });
  1638. }
  1639. }, {
  1640. key: "getRandomString",
  1641. value: function getRandomString(length) {
  1642. var pool = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : RandomGenerator_1.randomGeneratorPool;
  1643. return this.getRandomGenerator().string({ length: length, pool: pool });
  1644. }
  1645. }, {
  1646. key: "getRandomVariableName",
  1647. value: function getRandomVariableName(length) {
  1648. var prefix = "_" + Utils_1.Utils.hexadecimalPrefix;
  1649. var rangeMinInteger = 10000;
  1650. var rangeMaxInteger = 99999999;
  1651. var randomInteger = this.getRandomInteger(rangeMinInteger, rangeMaxInteger);
  1652. var hexadecimalNumber = Utils_1.Utils.decToHex(randomInteger);
  1653. var randomVariableName = "" + prefix + hexadecimalNumber.substr(0, length);
  1654. if (this.randomVariableNameSet.has(randomVariableName)) {
  1655. return this.getRandomVariableName(length);
  1656. }
  1657. this.randomVariableNameSet.add(randomVariableName);
  1658. return randomVariableName;
  1659. }
  1660. }, {
  1661. key: "getSeed",
  1662. value: function getSeed() {
  1663. return this.seed;
  1664. }
  1665. }]);
  1666. return RandomGenerator;
  1667. }();
  1668. RandomGenerator.randomGeneratorPool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  1669. RandomGenerator.randomGeneratorPoolNumbers = '0123456789';
  1670. RandomGenerator.randomGeneratorPoolHexadecimal = "abcdef" + RandomGenerator_1.randomGeneratorPoolNumbers;
  1671. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], RandomGenerator.prototype, "randomGenerator", void 0);
  1672. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], RandomGenerator.prototype, "seed", void 0);
  1673. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], RandomGenerator.prototype, "initialize", null);
  1674. RandomGenerator = RandomGenerator_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ISourceCode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], RandomGenerator);
  1675. exports.RandomGenerator = RandomGenerator;
  1676. var RandomGenerator_1;
  1677. /***/ }),
  1678. /* 32 */
  1679. /***/ (function(module, exports, __webpack_require__) {
  1680. "use strict";
  1681. Object.defineProperty(exports, "__esModule", { value: true });
  1682. var ObfuscationTarget_1 = __webpack_require__(13);
  1683. var SourceMapMode_1 = __webpack_require__(23);
  1684. exports.DEFAULT_PRESET = Object.freeze({
  1685. compact: true,
  1686. config: '',
  1687. controlFlowFlattening: false,
  1688. controlFlowFlatteningThreshold: 0.75,
  1689. deadCodeInjection: false,
  1690. deadCodeInjectionThreshold: 0.4,
  1691. debugProtection: false,
  1692. debugProtectionInterval: false,
  1693. disableConsoleOutput: false,
  1694. domainLock: [],
  1695. log: false,
  1696. mangle: false,
  1697. renameGlobals: false,
  1698. reservedNames: [],
  1699. rotateStringArray: true,
  1700. seed: 0,
  1701. selfDefending: false,
  1702. sourceMap: false,
  1703. sourceMapBaseUrl: '',
  1704. sourceMapFileName: '',
  1705. sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
  1706. stringArray: true,
  1707. stringArrayEncoding: false,
  1708. stringArrayThreshold: 0.75,
  1709. target: ObfuscationTarget_1.ObfuscationTarget.Browser,
  1710. unicodeEscapeSequence: false
  1711. });
  1712. /***/ }),
  1713. /* 33 */
  1714. /***/ (function(module, exports, __webpack_require__) {
  1715. "use strict";
  1716. 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; }; })();
  1717. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1718. Object.defineProperty(exports, "__esModule", { value: true });
  1719. var tslib_1 = __webpack_require__(2);
  1720. var commander = __webpack_require__(165);
  1721. var path = __webpack_require__(34);
  1722. var Initializable_1 = __webpack_require__(3);
  1723. var Default_1 = __webpack_require__(32);
  1724. var ArraySanitizer_1 = __webpack_require__(166);
  1725. var BooleanSanitizer_1 = __webpack_require__(167);
  1726. var ObfuscatingTargetSanitizer_1 = __webpack_require__(168);
  1727. var SourceMapModeSanitizer_1 = __webpack_require__(169);
  1728. var StringArrayEncodingSanitizer_1 = __webpack_require__(170);
  1729. var CLIUtils_1 = __webpack_require__(171);
  1730. var JavaScriptObfuscatorFacade_1 = __webpack_require__(18);
  1731. var SourceCodeReader_1 = __webpack_require__(174);
  1732. var JavaScriptObfuscatorCLI = function () {
  1733. function JavaScriptObfuscatorCLI(argv) {
  1734. _classCallCheck(this, JavaScriptObfuscatorCLI);
  1735. this.rawArguments = argv;
  1736. this.arguments = argv.slice(2);
  1737. }
  1738. _createClass(JavaScriptObfuscatorCLI, [{
  1739. key: "initialize",
  1740. value: function initialize() {
  1741. this.inputPath = this.arguments[0] || '';
  1742. this.commands = new commander.Command();
  1743. this.configureCommands();
  1744. this.configureHelp();
  1745. this.inputCLIOptions = this.commands.opts();
  1746. }
  1747. }, {
  1748. key: "run",
  1749. value: function run() {
  1750. var canShowHelp = !this.arguments.length || this.arguments.indexOf('--help') !== -1;
  1751. if (canShowHelp) {
  1752. return this.commands.outputHelp();
  1753. }
  1754. var sourceCodeData = SourceCodeReader_1.SourceCodeReader.readSourceCode(this.inputPath);
  1755. this.processSourceCodeData(sourceCodeData);
  1756. }
  1757. }, {
  1758. key: "buildOptions",
  1759. value: function buildOptions() {
  1760. var inputCLIOptions = JavaScriptObfuscatorCLI.filterOptions(this.inputCLIOptions);
  1761. var configFilePath = this.inputCLIOptions.config;
  1762. var configFileLocation = configFilePath ? path.resolve(configFilePath, '.') : '';
  1763. var configFileOptions = configFileLocation ? CLIUtils_1.CLIUtils.getUserConfig(configFileLocation) : {};
  1764. return Object.assign({}, Default_1.DEFAULT_PRESET, configFileOptions, inputCLIOptions);
  1765. }
  1766. }, {
  1767. key: "configureCommands",
  1768. value: function configureCommands() {
  1769. this.commands.usage('<inputPath> [options]').version(CLIUtils_1.CLIUtils.getPackageConfig().version, '-v, --version').option('-o, --output <path>', 'Output path for obfuscated code').option('--compact <boolean>', 'Disable one line output code compacting', BooleanSanitizer_1.BooleanSanitizer).option('--config <boolean>', 'Name of js / json config file').option('--controlFlowFlattening <boolean>', 'Enables control flow flattening', BooleanSanitizer_1.BooleanSanitizer).option('--controlFlowFlatteningThreshold <number>', 'The probability that the control flow flattening transformation will be applied to the node', parseFloat).option('--deadCodeInjection <boolean>', 'Enables dead code injection', BooleanSanitizer_1.BooleanSanitizer).option('--deadCodeInjectionThreshold <number>', 'The probability that the dead code injection transformation will be applied to the node', parseFloat).option('--debugProtection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', BooleanSanitizer_1.BooleanSanitizer).option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', BooleanSanitizer_1.BooleanSanitizer).option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', BooleanSanitizer_1.BooleanSanitizer).option('--domainLock \'<list>\' (comma separated)', 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)', ArraySanitizer_1.ArraySanitizer).option('--log <boolean>', 'Enables logging of the information to the console', BooleanSanitizer_1.BooleanSanitizer).option('--mangle <boolean>', 'Enables mangling of variable names', BooleanSanitizer_1.BooleanSanitizer).option('--reservedNames \'<list>\' (comma separated)', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', ArraySanitizer_1.ArraySanitizer).option('--renameGlobals <boolean>', 'Allows to enable obfuscation of global variable and function names with declaration.', BooleanSanitizer_1.BooleanSanitizer).option('--rotateStringArray <boolean>', 'Disable rotation of unicode array values during obfuscation', BooleanSanitizer_1.BooleanSanitizer).option('--seed <number>', 'Sets seed for random generator. This is useful for creating repeatable results.', parseFloat).option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', BooleanSanitizer_1.BooleanSanitizer).option('--sourceMap <boolean>', 'Enables source map generation', BooleanSanitizer_1.BooleanSanitizer).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', SourceMapModeSanitizer_1.SourceMapModeSanitizer).option('--stringArray <boolean>', 'Disables gathering of all literal strings into an array and replacing every literal string with an array call', BooleanSanitizer_1.BooleanSanitizer).option('--stringArrayEncoding <boolean|string> [true, false, base64, rc4]', 'Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed', StringArrayEncodingSanitizer_1.StringArrayEncodingSanitizer).option('--stringArrayThreshold <number>', 'The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)', parseFloat).option('--target <string>', 'Allows to set target environment for obfuscated code.', ObfuscatingTargetSanitizer_1.ObfuscationTargetSanitizer).option('--unicodeEscapeSequence <boolean>', 'Allows to enable/disable string conversion to unicode escape sequence', BooleanSanitizer_1.BooleanSanitizer).parse(this.rawArguments);
  1770. }
  1771. }, {
  1772. key: "configureHelp",
  1773. value: function configureHelp() {
  1774. this.commands.on('--help', function () {
  1775. console.log(' Examples:\n');
  1776. console.log(' %> javascript-obfuscator input_file_name.js --compact true --selfDefending false');
  1777. console.log(' %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --selfDefending false');
  1778. console.log(' %> javascript-obfuscator input_directory_name --compact true --selfDefending false');
  1779. console.log('');
  1780. });
  1781. }
  1782. }, {
  1783. key: "processSourceCodeData",
  1784. value: function processSourceCodeData(sourceCodeData) {
  1785. var _this = this;
  1786. if (!Array.isArray(sourceCodeData)) {
  1787. var outputCodePath = this.inputCLIOptions.output || CLIUtils_1.CLIUtils.getOutputCodePath(this.inputPath);
  1788. this.processSourceCode(sourceCodeData, outputCodePath);
  1789. } else {
  1790. sourceCodeData.forEach(function (_ref) {
  1791. var filePath = _ref.filePath,
  1792. content = _ref.content;
  1793. var outputCodePath = CLIUtils_1.CLIUtils.getOutputCodePath(filePath);
  1794. _this.processSourceCode(content, outputCodePath);
  1795. });
  1796. }
  1797. }
  1798. }, {
  1799. key: "processSourceCode",
  1800. value: function processSourceCode(sourceCode, outputCodePath) {
  1801. var options = this.buildOptions();
  1802. if (options.sourceMap) {
  1803. JavaScriptObfuscatorCLI.processSourceCodeWithSourceMap(sourceCode, outputCodePath, options);
  1804. } else {
  1805. JavaScriptObfuscatorCLI.processSourceCodeWithoutSourceMap(sourceCode, outputCodePath, options);
  1806. }
  1807. }
  1808. }], [{
  1809. key: "filterOptions",
  1810. value: function filterOptions(options) {
  1811. var filteredOptions = {};
  1812. for (var option in options) {
  1813. if (!options.hasOwnProperty(option) || options[option] === undefined) {
  1814. continue;
  1815. }
  1816. filteredOptions[option] = options[option];
  1817. }
  1818. return filteredOptions;
  1819. }
  1820. }, {
  1821. key: "processSourceCodeWithoutSourceMap",
  1822. value: function processSourceCodeWithoutSourceMap(sourceCode, outputCodePath, options) {
  1823. var obfuscatedCode = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(sourceCode, options).getObfuscatedCode();
  1824. CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscatedCode);
  1825. }
  1826. }, {
  1827. key: "processSourceCodeWithSourceMap",
  1828. value: function processSourceCodeWithSourceMap(sourceCode, outputCodePath, options) {
  1829. var outputSourceMapPath = CLIUtils_1.CLIUtils.getOutputSourceMapPath(outputCodePath, options.sourceMapFileName || '');
  1830. options = Object.assign({}, options, { sourceMapFileName: path.basename(outputSourceMapPath) });
  1831. var obfuscationResult = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(sourceCode, options);
  1832. CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscationResult.getObfuscatedCode());
  1833. if (options.sourceMapMode === 'separate' && obfuscationResult.getSourceMap()) {
  1834. CLIUtils_1.CLIUtils.writeFile(outputSourceMapPath, obfuscationResult.getSourceMap());
  1835. }
  1836. }
  1837. }]);
  1838. return JavaScriptObfuscatorCLI;
  1839. }();
  1840. JavaScriptObfuscatorCLI.availableInputExtensions = ['.js'];
  1841. JavaScriptObfuscatorCLI.encoding = 'utf8';
  1842. JavaScriptObfuscatorCLI.obfuscatedFilePrefix = '-obfuscated';
  1843. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], JavaScriptObfuscatorCLI.prototype, "commands", void 0);
  1844. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], JavaScriptObfuscatorCLI.prototype, "inputCLIOptions", void 0);
  1845. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], JavaScriptObfuscatorCLI.prototype, "inputPath", void 0);
  1846. exports.JavaScriptObfuscatorCLI = JavaScriptObfuscatorCLI;
  1847. /***/ }),
  1848. /* 34 */
  1849. /***/ (function(module, exports) {
  1850. module.exports = require("path");
  1851. /***/ }),
  1852. /* 35 */
  1853. /***/ (function(module, exports, __webpack_require__) {
  1854. "use strict";
  1855. Object.defineProperty(exports, "__esModule", { value: true });
  1856. var CalleeDataExtractor;
  1857. (function (CalleeDataExtractor) {
  1858. CalleeDataExtractor[CalleeDataExtractor["FunctionDeclarationCalleeDataExtractor"] = 0] = "FunctionDeclarationCalleeDataExtractor";
  1859. CalleeDataExtractor[CalleeDataExtractor["FunctionExpressionCalleeDataExtractor"] = 1] = "FunctionExpressionCalleeDataExtractor";
  1860. CalleeDataExtractor[CalleeDataExtractor["ObjectExpressionCalleeDataExtractor"] = 2] = "ObjectExpressionCalleeDataExtractor";
  1861. })(CalleeDataExtractor = exports.CalleeDataExtractor || (exports.CalleeDataExtractor = {}));
  1862. /***/ }),
  1863. /* 36 */
  1864. /***/ (function(module, exports) {
  1865. module.exports = require("esprima");
  1866. /***/ }),
  1867. /* 37 */
  1868. /***/ (function(module, exports, __webpack_require__) {
  1869. "use strict";
  1870. Object.defineProperty(exports, "__esModule", { value: true });
  1871. var ControlFlowReplacer;
  1872. (function (ControlFlowReplacer) {
  1873. ControlFlowReplacer[ControlFlowReplacer["BinaryExpressionControlFlowReplacer"] = 0] = "BinaryExpressionControlFlowReplacer";
  1874. ControlFlowReplacer[ControlFlowReplacer["CallExpressionControlFlowReplacer"] = 1] = "CallExpressionControlFlowReplacer";
  1875. ControlFlowReplacer[ControlFlowReplacer["LogicalExpressionControlFlowReplacer"] = 2] = "LogicalExpressionControlFlowReplacer";
  1876. ControlFlowReplacer[ControlFlowReplacer["StringLiteralControlFlowReplacer"] = 3] = "StringLiteralControlFlowReplacer";
  1877. })(ControlFlowReplacer = exports.ControlFlowReplacer || (exports.ControlFlowReplacer = {}));
  1878. /***/ }),
  1879. /* 38 */
  1880. /***/ (function(module, exports, __webpack_require__) {
  1881. "use strict";
  1882. 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; }; })();
  1883. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1884. 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; }
  1885. 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; }
  1886. Object.defineProperty(exports, "__esModule", { value: true });
  1887. var tslib_1 = __webpack_require__(2);
  1888. var inversify_1 = __webpack_require__(0);
  1889. var ServiceIdentifiers_1 = __webpack_require__(1);
  1890. var ControlFlowCustomNode_1 = __webpack_require__(12);
  1891. var AbstractControlFlowReplacer_1 = __webpack_require__(29);
  1892. var NodeGuards_1 = __webpack_require__(5);
  1893. var ExpressionWithOperatorControlFlowReplacer = function (_AbstractControlFlowR) {
  1894. _inherits(ExpressionWithOperatorControlFlowReplacer, _AbstractControlFlowR);
  1895. function ExpressionWithOperatorControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  1896. _classCallCheck(this, ExpressionWithOperatorControlFlowReplacer);
  1897. var _this = _possibleConstructorReturn(this, (ExpressionWithOperatorControlFlowReplacer.__proto__ || Object.getPrototypeOf(ExpressionWithOperatorControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  1898. _this.replacerDataByControlFlowStorageId = new Map();
  1899. return _this;
  1900. }
  1901. _createClass(ExpressionWithOperatorControlFlowReplacer, [{
  1902. key: "getControlFlowStorageCallNode",
  1903. value: function getControlFlowStorageCallNode(controlFlowStorageId, storageKey, leftExpression, rightExpression) {
  1904. var controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode);
  1905. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey, leftExpression, rightExpression);
  1906. var statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  1907. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  1908. throw new Error("`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");
  1909. }
  1910. return statementNode.expression;
  1911. }
  1912. }]);
  1913. return ExpressionWithOperatorControlFlowReplacer;
  1914. }(AbstractControlFlowReplacer_1.AbstractControlFlowReplacer);
  1915. ExpressionWithOperatorControlFlowReplacer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], ExpressionWithOperatorControlFlowReplacer);
  1916. exports.ExpressionWithOperatorControlFlowReplacer = ExpressionWithOperatorControlFlowReplacer;
  1917. /***/ }),
  1918. /* 39 */
  1919. /***/ (function(module, exports, __webpack_require__) {
  1920. "use strict";
  1921. Object.defineProperty(exports, "__esModule", { value: true });
  1922. var CustomNodeGroup;
  1923. (function (CustomNodeGroup) {
  1924. CustomNodeGroup[CustomNodeGroup["ConsoleOutputCustomNodeGroup"] = 0] = "ConsoleOutputCustomNodeGroup";
  1925. CustomNodeGroup[CustomNodeGroup["DebugProtectionCustomNodeGroup"] = 1] = "DebugProtectionCustomNodeGroup";
  1926. CustomNodeGroup[CustomNodeGroup["DomainLockCustomNodeGroup"] = 2] = "DomainLockCustomNodeGroup";
  1927. CustomNodeGroup[CustomNodeGroup["SelfDefendingCustomNodeGroup"] = 3] = "SelfDefendingCustomNodeGroup";
  1928. CustomNodeGroup[CustomNodeGroup["StringArrayCustomNodeGroup"] = 4] = "StringArrayCustomNodeGroup";
  1929. })(CustomNodeGroup = exports.CustomNodeGroup || (exports.CustomNodeGroup = {}));
  1930. /***/ }),
  1931. /* 40 */
  1932. /***/ (function(module, exports, __webpack_require__) {
  1933. "use strict";
  1934. Object.defineProperty(exports, "__esModule", { value: true });
  1935. var LiteralObfuscatingReplacer;
  1936. (function (LiteralObfuscatingReplacer) {
  1937. LiteralObfuscatingReplacer[LiteralObfuscatingReplacer["BooleanLiteralObfuscatingReplacer"] = 0] = "BooleanLiteralObfuscatingReplacer";
  1938. LiteralObfuscatingReplacer[LiteralObfuscatingReplacer["NumberLiteralObfuscatingReplacer"] = 1] = "NumberLiteralObfuscatingReplacer";
  1939. LiteralObfuscatingReplacer[LiteralObfuscatingReplacer["StringLiteralObfuscatingReplacer"] = 2] = "StringLiteralObfuscatingReplacer";
  1940. })(LiteralObfuscatingReplacer = exports.LiteralObfuscatingReplacer || (exports.LiteralObfuscatingReplacer = {}));
  1941. /***/ }),
  1942. /* 41 */
  1943. /***/ (function(module, exports, __webpack_require__) {
  1944. "use strict";
  1945. Object.defineProperty(exports, "__esModule", { value: true });
  1946. var ObfuscatingGuard;
  1947. (function (ObfuscatingGuard) {
  1948. ObfuscatingGuard[ObfuscatingGuard["BlackListNodeGuard"] = 0] = "BlackListNodeGuard";
  1949. ObfuscatingGuard[ObfuscatingGuard["ConditionalCommentNodeGuard"] = 1] = "ConditionalCommentNodeGuard";
  1950. })(ObfuscatingGuard = exports.ObfuscatingGuard || (exports.ObfuscatingGuard = {}));
  1951. /***/ }),
  1952. /* 42 */
  1953. /***/ (function(module, exports, __webpack_require__) {
  1954. "use strict";
  1955. 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"); } }; })();
  1956. 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; }; })();
  1957. 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); } }
  1958. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1959. Object.defineProperty(exports, "__esModule", { value: true });
  1960. var tslib_1 = __webpack_require__(2);
  1961. var inversify_1 = __webpack_require__(0);
  1962. var ServiceIdentifiers_1 = __webpack_require__(1);
  1963. var Initializable_1 = __webpack_require__(3);
  1964. var MapStorage = function () {
  1965. function MapStorage(randomGenerator) {
  1966. _classCallCheck(this, MapStorage);
  1967. this.randomGenerator = randomGenerator;
  1968. }
  1969. _createClass(MapStorage, [{
  1970. key: "initialize",
  1971. value: function initialize() {
  1972. this.storage = new Map();
  1973. this.storageId = this.randomGenerator.getRandomString(6);
  1974. }
  1975. }, {
  1976. key: "get",
  1977. value: function get(key) {
  1978. var value = this.storage.get(key);
  1979. if (!value) {
  1980. throw new Error("No value found in map storage with key `" + key + "`");
  1981. }
  1982. return value;
  1983. }
  1984. }, {
  1985. key: "getKeyOf",
  1986. value: function getKeyOf(value) {
  1987. var _iteratorNormalCompletion = true;
  1988. var _didIteratorError = false;
  1989. var _iteratorError = undefined;
  1990. try {
  1991. for (var _iterator = this.storage[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  1992. var _step$value = _slicedToArray(_step.value, 2),
  1993. key = _step$value[0],
  1994. storageValue = _step$value[1];
  1995. if (value === storageValue) {
  1996. return key;
  1997. }
  1998. }
  1999. } catch (err) {
  2000. _didIteratorError = true;
  2001. _iteratorError = err;
  2002. } finally {
  2003. try {
  2004. if (!_iteratorNormalCompletion && _iterator.return) {
  2005. _iterator.return();
  2006. }
  2007. } finally {
  2008. if (_didIteratorError) {
  2009. throw _iteratorError;
  2010. }
  2011. }
  2012. }
  2013. return null;
  2014. }
  2015. }, {
  2016. key: "getLength",
  2017. value: function getLength() {
  2018. return this.storage.size;
  2019. }
  2020. }, {
  2021. key: "getStorage",
  2022. value: function getStorage() {
  2023. return this.storage;
  2024. }
  2025. }, {
  2026. key: "getStorageId",
  2027. value: function getStorageId() {
  2028. return this.storageId;
  2029. }
  2030. }, {
  2031. key: "mergeWith",
  2032. value: function mergeWith(storage) {
  2033. var mergeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2034. this.storage = new Map([].concat(_toConsumableArray(this.storage), _toConsumableArray(storage.getStorage())));
  2035. if (mergeId) {
  2036. this.storageId = storage.getStorageId();
  2037. }
  2038. }
  2039. }, {
  2040. key: "set",
  2041. value: function set(key, value) {
  2042. this.storage.set(key, value);
  2043. }
  2044. }]);
  2045. return MapStorage;
  2046. }();
  2047. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], MapStorage.prototype, "storageId", void 0);
  2048. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], MapStorage.prototype, "storage", void 0);
  2049. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], MapStorage.prototype, "initialize", null);
  2050. MapStorage = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__metadata("design:paramtypes", [Object])], MapStorage);
  2051. exports.MapStorage = MapStorage;
  2052. /***/ }),
  2053. /* 43 */
  2054. /***/ (function(module, exports) {
  2055. module.exports = require("fs");
  2056. /***/ }),
  2057. /* 44 */
  2058. /***/ (function(module, exports, __webpack_require__) {
  2059. "use strict";
  2060. Object.defineProperty(exports, "__esModule", { value: true });
  2061. var JavaScriptObfuscatorFacade_1 = __webpack_require__(18);
  2062. module.exports = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator;
  2063. /***/ }),
  2064. /* 45 */
  2065. /***/ (function(module, exports) {
  2066. module.exports = require("reflect-metadata");
  2067. /***/ }),
  2068. /* 46 */
  2069. /***/ (function(module, exports, __webpack_require__) {
  2070. "use strict";
  2071. Object.defineProperty(exports, "__esModule", { value: true });
  2072. var InversifyContainerFacade_1 = __webpack_require__(14);
  2073. var inversify_1 = __webpack_require__(0);
  2074. var ServiceIdentifiers_1 = __webpack_require__(1);
  2075. var CalleeDataExtractor_1 = __webpack_require__(35);
  2076. var FunctionDeclarationCalleeDataExtractor_1 = __webpack_require__(47);
  2077. var FunctionExpressionCalleeDataExtractor_1 = __webpack_require__(48);
  2078. var ObjectExpressionCalleeDataExtractor_1 = __webpack_require__(49);
  2079. var StackTraceAnalyzer_1 = __webpack_require__(50);
  2080. exports.analyzersModule = new inversify_1.ContainerModule(function (bind) {
  2081. bind(ServiceIdentifiers_1.ServiceIdentifiers.IStackTraceAnalyzer).to(StackTraceAnalyzer_1.StackTraceAnalyzer).inSingletonScope();
  2082. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor).to(FunctionDeclarationCalleeDataExtractor_1.FunctionDeclarationCalleeDataExtractor).whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor);
  2083. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor).to(FunctionExpressionCalleeDataExtractor_1.FunctionExpressionCalleeDataExtractor).whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor);
  2084. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor).to(ObjectExpressionCalleeDataExtractor_1.ObjectExpressionCalleeDataExtractor).whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor);
  2085. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICalleeDataExtractor).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor));
  2086. });
  2087. /***/ }),
  2088. /* 47 */
  2089. /***/ (function(module, exports, __webpack_require__) {
  2090. "use strict";
  2091. 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; }; })();
  2092. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2093. 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; }
  2094. 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; }
  2095. Object.defineProperty(exports, "__esModule", { value: true });
  2096. var tslib_1 = __webpack_require__(2);
  2097. var inversify_1 = __webpack_require__(0);
  2098. var estraverse = __webpack_require__(8);
  2099. var AbstractCalleeDataExtractor_1 = __webpack_require__(27);
  2100. var NodeGuards_1 = __webpack_require__(5);
  2101. var NodeUtils_1 = __webpack_require__(4);
  2102. var FunctionDeclarationCalleeDataExtractor = function (_AbstractCalleeDataEx) {
  2103. _inherits(FunctionDeclarationCalleeDataExtractor, _AbstractCalleeDataEx);
  2104. function FunctionDeclarationCalleeDataExtractor() {
  2105. _classCallCheck(this, FunctionDeclarationCalleeDataExtractor);
  2106. return _possibleConstructorReturn(this, (FunctionDeclarationCalleeDataExtractor.__proto__ || Object.getPrototypeOf(FunctionDeclarationCalleeDataExtractor)).apply(this, arguments));
  2107. }
  2108. _createClass(FunctionDeclarationCalleeDataExtractor, [{
  2109. key: "extract",
  2110. value: function extract(blockScopeBody, callee) {
  2111. if (!NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  2112. return null;
  2113. }
  2114. var calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0], callee.name);
  2115. if (!calleeBlockStatement) {
  2116. return null;
  2117. }
  2118. return {
  2119. callee: calleeBlockStatement,
  2120. name: callee.name
  2121. };
  2122. }
  2123. }, {
  2124. key: "getCalleeBlockStatement",
  2125. value: function getCalleeBlockStatement(targetNode, name) {
  2126. var calleeBlockStatement = null;
  2127. estraverse.traverse(targetNode, {
  2128. enter: function enter(node) {
  2129. if (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) && node.id.name === name) {
  2130. calleeBlockStatement = node.body;
  2131. return estraverse.VisitorOption.Break;
  2132. }
  2133. }
  2134. });
  2135. return calleeBlockStatement;
  2136. }
  2137. }]);
  2138. return FunctionDeclarationCalleeDataExtractor;
  2139. }(AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor);
  2140. FunctionDeclarationCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], FunctionDeclarationCalleeDataExtractor);
  2141. exports.FunctionDeclarationCalleeDataExtractor = FunctionDeclarationCalleeDataExtractor;
  2142. /***/ }),
  2143. /* 48 */
  2144. /***/ (function(module, exports, __webpack_require__) {
  2145. "use strict";
  2146. 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; }; })();
  2147. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2148. 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; }
  2149. 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; }
  2150. Object.defineProperty(exports, "__esModule", { value: true });
  2151. var tslib_1 = __webpack_require__(2);
  2152. var inversify_1 = __webpack_require__(0);
  2153. var estraverse = __webpack_require__(8);
  2154. var AbstractCalleeDataExtractor_1 = __webpack_require__(27);
  2155. var NodeGuards_1 = __webpack_require__(5);
  2156. var NodeUtils_1 = __webpack_require__(4);
  2157. var FunctionExpressionCalleeDataExtractor = function (_AbstractCalleeDataEx) {
  2158. _inherits(FunctionExpressionCalleeDataExtractor, _AbstractCalleeDataEx);
  2159. function FunctionExpressionCalleeDataExtractor() {
  2160. _classCallCheck(this, FunctionExpressionCalleeDataExtractor);
  2161. return _possibleConstructorReturn(this, (FunctionExpressionCalleeDataExtractor.__proto__ || Object.getPrototypeOf(FunctionExpressionCalleeDataExtractor)).apply(this, arguments));
  2162. }
  2163. _createClass(FunctionExpressionCalleeDataExtractor, [{
  2164. key: "extract",
  2165. value: function extract(blockScopeBody, callee) {
  2166. var calleeBlockStatement = null;
  2167. if (NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  2168. calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0], callee.name);
  2169. }
  2170. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(callee)) {
  2171. calleeBlockStatement = callee.body;
  2172. }
  2173. if (!calleeBlockStatement) {
  2174. return null;
  2175. }
  2176. return {
  2177. callee: calleeBlockStatement,
  2178. name: callee.name || null
  2179. };
  2180. }
  2181. }, {
  2182. key: "getCalleeBlockStatement",
  2183. value: function getCalleeBlockStatement(targetNode, name) {
  2184. var calleeBlockStatement = null;
  2185. estraverse.traverse(targetNode, {
  2186. enter: function enter(node, parentNode) {
  2187. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) && NodeGuards_1.NodeGuards.isVariableDeclaratorNode(parentNode) && NodeGuards_1.NodeGuards.isIdentifierNode(parentNode.id) && parentNode.id.name === name) {
  2188. calleeBlockStatement = node.body;
  2189. return estraverse.VisitorOption.Break;
  2190. }
  2191. }
  2192. });
  2193. return calleeBlockStatement;
  2194. }
  2195. }]);
  2196. return FunctionExpressionCalleeDataExtractor;
  2197. }(AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor);
  2198. FunctionExpressionCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], FunctionExpressionCalleeDataExtractor);
  2199. exports.FunctionExpressionCalleeDataExtractor = FunctionExpressionCalleeDataExtractor;
  2200. /***/ }),
  2201. /* 49 */
  2202. /***/ (function(module, exports, __webpack_require__) {
  2203. "use strict";
  2204. 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; }; })();
  2205. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2206. 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; }
  2207. 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; }
  2208. Object.defineProperty(exports, "__esModule", { value: true });
  2209. var tslib_1 = __webpack_require__(2);
  2210. var inversify_1 = __webpack_require__(0);
  2211. var estraverse = __webpack_require__(8);
  2212. var AbstractCalleeDataExtractor_1 = __webpack_require__(27);
  2213. var NodeGuards_1 = __webpack_require__(5);
  2214. var NodeUtils_1 = __webpack_require__(4);
  2215. var ObjectExpressionCalleeDataExtractor = function (_AbstractCalleeDataEx) {
  2216. _inherits(ObjectExpressionCalleeDataExtractor, _AbstractCalleeDataEx);
  2217. function ObjectExpressionCalleeDataExtractor() {
  2218. _classCallCheck(this, ObjectExpressionCalleeDataExtractor);
  2219. return _possibleConstructorReturn(this, (ObjectExpressionCalleeDataExtractor.__proto__ || Object.getPrototypeOf(ObjectExpressionCalleeDataExtractor)).apply(this, arguments));
  2220. }
  2221. _createClass(ObjectExpressionCalleeDataExtractor, [{
  2222. key: "extract",
  2223. value: function extract(blockScopeBody, callee) {
  2224. if (!NodeGuards_1.NodeGuards.isMemberExpressionNode(callee)) {
  2225. return null;
  2226. }
  2227. var objectMembersCallsChain = this.createObjectMembersCallsChain([], callee);
  2228. if (!objectMembersCallsChain.length) {
  2229. return null;
  2230. }
  2231. var functionExpressionName = objectMembersCallsChain[objectMembersCallsChain.length - 1];
  2232. var calleeBlockStatement = this.getCalleeBlockStatement(NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockScopeBody[0])[0], objectMembersCallsChain);
  2233. if (!calleeBlockStatement) {
  2234. return null;
  2235. }
  2236. return {
  2237. callee: calleeBlockStatement,
  2238. name: functionExpressionName
  2239. };
  2240. }
  2241. }, {
  2242. key: "createObjectMembersCallsChain",
  2243. value: function createObjectMembersCallsChain(currentChain, memberExpression) {
  2244. if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpression.property) && memberExpression.computed === false) {
  2245. currentChain.unshift(memberExpression.property.name);
  2246. } else if (NodeGuards_1.NodeGuards.isLiteralNode(memberExpression.property) && (typeof memberExpression.property.value === 'string' || typeof memberExpression.property.value === 'number')) {
  2247. currentChain.unshift(memberExpression.property.value);
  2248. } else {
  2249. return currentChain;
  2250. }
  2251. if (NodeGuards_1.NodeGuards.isMemberExpressionNode(memberExpression.object)) {
  2252. return this.createObjectMembersCallsChain(currentChain, memberExpression.object);
  2253. } else if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpression.object)) {
  2254. currentChain.unshift(memberExpression.object.name);
  2255. }
  2256. return currentChain;
  2257. }
  2258. }, {
  2259. key: "getCalleeBlockStatement",
  2260. value: function getCalleeBlockStatement(targetNode, objectMembersCallsChain) {
  2261. var _this2 = this;
  2262. var objectName = objectMembersCallsChain.shift();
  2263. if (!objectName) {
  2264. return null;
  2265. }
  2266. var calleeBlockStatement = null;
  2267. estraverse.traverse(targetNode, {
  2268. enter: function enter(node, parentNode) {
  2269. if (NodeGuards_1.NodeGuards.isVariableDeclaratorNode(node) && NodeGuards_1.NodeGuards.isIdentifierNode(node.id) && node.init && NodeGuards_1.NodeGuards.isObjectExpressionNode(node.init) && node.id.name === objectName) {
  2270. calleeBlockStatement = _this2.findCalleeBlockStatement(node.init.properties, objectMembersCallsChain);
  2271. return estraverse.VisitorOption.Break;
  2272. }
  2273. }
  2274. });
  2275. return calleeBlockStatement;
  2276. }
  2277. }, {
  2278. key: "findCalleeBlockStatement",
  2279. value: function findCalleeBlockStatement(objectExpressionProperties, objectMembersCallsChain) {
  2280. var nextItemInCallsChain = objectMembersCallsChain.shift();
  2281. if (!nextItemInCallsChain) {
  2282. return null;
  2283. }
  2284. var _iteratorNormalCompletion = true;
  2285. var _didIteratorError = false;
  2286. var _iteratorError = undefined;
  2287. try {
  2288. for (var _iterator = objectExpressionProperties[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2289. var propertyNode = _step.value;
  2290. var isTargetPropertyNodeWithIdentifierKey = NodeGuards_1.NodeGuards.isIdentifierNode(propertyNode.key) && propertyNode.key.name === nextItemInCallsChain;
  2291. var isTargetPropertyNodeWithLiteralKey = NodeGuards_1.NodeGuards.isLiteralNode(propertyNode.key) && Boolean(propertyNode.key.value) && propertyNode.key.value === nextItemInCallsChain;
  2292. if (!isTargetPropertyNodeWithIdentifierKey && !isTargetPropertyNodeWithLiteralKey) {
  2293. continue;
  2294. }
  2295. if (NodeGuards_1.NodeGuards.isObjectExpressionNode(propertyNode.value)) {
  2296. return this.findCalleeBlockStatement(propertyNode.value.properties, objectMembersCallsChain);
  2297. }
  2298. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(propertyNode.value)) {
  2299. return propertyNode.value.body;
  2300. }
  2301. }
  2302. } catch (err) {
  2303. _didIteratorError = true;
  2304. _iteratorError = err;
  2305. } finally {
  2306. try {
  2307. if (!_iteratorNormalCompletion && _iterator.return) {
  2308. _iterator.return();
  2309. }
  2310. } finally {
  2311. if (_didIteratorError) {
  2312. throw _iteratorError;
  2313. }
  2314. }
  2315. }
  2316. return null;
  2317. }
  2318. }]);
  2319. return ObjectExpressionCalleeDataExtractor;
  2320. }(AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor);
  2321. ObjectExpressionCalleeDataExtractor = tslib_1.__decorate([inversify_1.injectable()], ObjectExpressionCalleeDataExtractor);
  2322. exports.ObjectExpressionCalleeDataExtractor = ObjectExpressionCalleeDataExtractor;
  2323. /***/ }),
  2324. /* 50 */
  2325. /***/ (function(module, exports, __webpack_require__) {
  2326. "use strict";
  2327. 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; }; })();
  2328. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2329. Object.defineProperty(exports, "__esModule", { value: true });
  2330. var tslib_1 = __webpack_require__(2);
  2331. var inversify_1 = __webpack_require__(0);
  2332. var ServiceIdentifiers_1 = __webpack_require__(1);
  2333. var estraverse = __webpack_require__(8);
  2334. var CalleeDataExtractor_1 = __webpack_require__(35);
  2335. var NodeGuards_1 = __webpack_require__(5);
  2336. var NodeUtils_1 = __webpack_require__(4);
  2337. var StackTraceAnalyzer = StackTraceAnalyzer_1 = function () {
  2338. function StackTraceAnalyzer(calleeDataExtractorFactory) {
  2339. _classCallCheck(this, StackTraceAnalyzer);
  2340. this.calleeDataExtractorFactory = calleeDataExtractorFactory;
  2341. }
  2342. _createClass(StackTraceAnalyzer, [{
  2343. key: "analyze",
  2344. value: function analyze(astTree) {
  2345. return this.analyzeRecursive(astTree.body);
  2346. }
  2347. }, {
  2348. key: "analyzeRecursive",
  2349. value: function analyzeRecursive(blockScopeBody) {
  2350. var _this = this;
  2351. var limitIndex = StackTraceAnalyzer_1.getLimitIndex(blockScopeBody.length);
  2352. var stackTraceData = [];
  2353. var blockScopeBodyLength = blockScopeBody.length;
  2354. var _loop = function _loop(index) {
  2355. if (index > limitIndex) {
  2356. return "break";
  2357. }
  2358. var blockScopeBodyNode = blockScopeBody[index];
  2359. estraverse.traverse(blockScopeBodyNode, {
  2360. enter: function enter(node) {
  2361. if (!NodeGuards_1.NodeGuards.isCallExpressionNode(node)) {
  2362. return;
  2363. }
  2364. if (blockScopeBodyNode.parentNode !== NodeUtils_1.NodeUtils.getBlockScopesOfNode(node)[0]) {
  2365. return estraverse.VisitorOption.Skip;
  2366. }
  2367. _this.analyzeCallExpressionNode(stackTraceData, blockScopeBody, node);
  2368. }
  2369. });
  2370. };
  2371. for (var index = 0; index < blockScopeBodyLength; index++) {
  2372. var _ret = _loop(index);
  2373. if (_ret === "break") break;
  2374. }
  2375. return stackTraceData;
  2376. }
  2377. }, {
  2378. key: "analyzeCallExpressionNode",
  2379. value: function analyzeCallExpressionNode(stackTraceData, blockScopeBody, callExpressionNode) {
  2380. var _this2 = this;
  2381. StackTraceAnalyzer_1.calleeDataExtractorsList.forEach(function (calleeDataExtractorName) {
  2382. var calleeData = _this2.calleeDataExtractorFactory(calleeDataExtractorName).extract(blockScopeBody, callExpressionNode.callee);
  2383. if (!calleeData) {
  2384. return;
  2385. }
  2386. stackTraceData.push(Object.assign({}, calleeData, { stackTrace: _this2.analyzeRecursive(calleeData.callee.body) }));
  2387. });
  2388. }
  2389. }], [{
  2390. key: "getLimitIndex",
  2391. value: function getLimitIndex(blockScopeBodyLength) {
  2392. var lastIndex = blockScopeBodyLength - 1;
  2393. var limitThresholdActivationIndex = StackTraceAnalyzer_1.limitThresholdActivationLength - 1;
  2394. var limitIndex = lastIndex;
  2395. if (lastIndex > limitThresholdActivationIndex) {
  2396. limitIndex = Math.round(limitThresholdActivationIndex + lastIndex * StackTraceAnalyzer_1.limitThreshold);
  2397. if (limitIndex > lastIndex) {
  2398. limitIndex = lastIndex;
  2399. }
  2400. }
  2401. return limitIndex;
  2402. }
  2403. }]);
  2404. return StackTraceAnalyzer;
  2405. }();
  2406. StackTraceAnalyzer.calleeDataExtractorsList = [CalleeDataExtractor_1.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor, CalleeDataExtractor_1.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor, CalleeDataExtractor_1.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor];
  2407. StackTraceAnalyzer.limitThresholdActivationLength = 25;
  2408. StackTraceAnalyzer.limitThreshold = 0.002;
  2409. StackTraceAnalyzer = StackTraceAnalyzer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICalleeDataExtractor)), tslib_1.__metadata("design:paramtypes", [Function])], StackTraceAnalyzer);
  2410. exports.StackTraceAnalyzer = StackTraceAnalyzer;
  2411. var StackTraceAnalyzer_1;
  2412. /***/ }),
  2413. /* 51 */
  2414. /***/ (function(module, exports, __webpack_require__) {
  2415. "use strict";
  2416. Object.defineProperty(exports, "__esModule", { value: true });
  2417. var InversifyContainerFacade_1 = __webpack_require__(14);
  2418. var inversify_1 = __webpack_require__(0);
  2419. var ServiceIdentifiers_1 = __webpack_require__(1);
  2420. var ControlFlowReplacer_1 = __webpack_require__(37);
  2421. var NodeTransformer_1 = __webpack_require__(21);
  2422. var BinaryExpressionControlFlowReplacer_1 = __webpack_require__(52);
  2423. var BlockStatementControlFlowTransformer_1 = __webpack_require__(53);
  2424. var CallExpressionControlFlowReplacer_1 = __webpack_require__(54);
  2425. var DeadCodeInjectionTransformer_1 = __webpack_require__(55);
  2426. var FunctionControlFlowTransformer_1 = __webpack_require__(56);
  2427. var LogicalExpressionControlFlowReplacer_1 = __webpack_require__(57);
  2428. var StringLiteralControlFlowReplacer_1 = __webpack_require__(58);
  2429. exports.controlFlowTransformersModule = new inversify_1.ContainerModule(function (bind) {
  2430. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(BlockStatementControlFlowTransformer_1.BlockStatementControlFlowTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.BlockStatementControlFlowTransformer);
  2431. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(DeadCodeInjectionTransformer_1.DeadCodeInjectionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.DeadCodeInjectionTransformer);
  2432. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(FunctionControlFlowTransformer_1.FunctionControlFlowTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.FunctionControlFlowTransformer);
  2433. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(BinaryExpressionControlFlowReplacer_1.BinaryExpressionControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.BinaryExpressionControlFlowReplacer);
  2434. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(CallExpressionControlFlowReplacer_1.CallExpressionControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.CallExpressionControlFlowReplacer);
  2435. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(LogicalExpressionControlFlowReplacer_1.LogicalExpressionControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.LogicalExpressionControlFlowReplacer);
  2436. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer).to(StringLiteralControlFlowReplacer_1.StringLiteralControlFlowReplacer).whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.StringLiteralControlFlowReplacer);
  2437. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowReplacer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer));
  2438. });
  2439. /***/ }),
  2440. /* 52 */
  2441. /***/ (function(module, exports, __webpack_require__) {
  2442. "use strict";
  2443. 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; }; })();
  2444. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2445. 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; }
  2446. 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; }
  2447. Object.defineProperty(exports, "__esModule", { value: true });
  2448. var tslib_1 = __webpack_require__(2);
  2449. var inversify_1 = __webpack_require__(0);
  2450. var ServiceIdentifiers_1 = __webpack_require__(1);
  2451. var ControlFlowCustomNode_1 = __webpack_require__(12);
  2452. var ExpressionWithOperatorControlFlowReplacer_1 = __webpack_require__(38);
  2453. var BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer_1 = function (_ExpressionWithOperat) {
  2454. _inherits(BinaryExpressionControlFlowReplacer, _ExpressionWithOperat);
  2455. function BinaryExpressionControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  2456. _classCallCheck(this, BinaryExpressionControlFlowReplacer);
  2457. return _possibleConstructorReturn(this, (BinaryExpressionControlFlowReplacer.__proto__ || Object.getPrototypeOf(BinaryExpressionControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  2458. }
  2459. _createClass(BinaryExpressionControlFlowReplacer, [{
  2460. key: "replace",
  2461. value: function replace(binaryExpressionNode, parentNode, controlFlowStorage) {
  2462. var replacerId = binaryExpressionNode.operator;
  2463. var binaryExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.BinaryExpressionFunctionNode);
  2464. binaryExpressionFunctionCustomNode.initialize(replacerId);
  2465. var storageKey = this.insertCustomNodeToControlFlowStorage(binaryExpressionFunctionCustomNode, controlFlowStorage, replacerId, BinaryExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  2466. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, binaryExpressionNode.left, binaryExpressionNode.right);
  2467. }
  2468. }]);
  2469. return BinaryExpressionControlFlowReplacer;
  2470. }(ExpressionWithOperatorControlFlowReplacer_1.ExpressionWithOperatorControlFlowReplacer);
  2471. BinaryExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  2472. BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], BinaryExpressionControlFlowReplacer);
  2473. exports.BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer;
  2474. var BinaryExpressionControlFlowReplacer_1;
  2475. /***/ }),
  2476. /* 53 */
  2477. /***/ (function(module, exports, __webpack_require__) {
  2478. "use strict";
  2479. 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; }; })();
  2480. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2481. 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; }
  2482. 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; }
  2483. Object.defineProperty(exports, "__esModule", { value: true });
  2484. var tslib_1 = __webpack_require__(2);
  2485. var inversify_1 = __webpack_require__(0);
  2486. var ServiceIdentifiers_1 = __webpack_require__(1);
  2487. var estraverse = __webpack_require__(8);
  2488. var ControlFlowCustomNode_1 = __webpack_require__(12);
  2489. var AbstractNodeTransformer_1 = __webpack_require__(7);
  2490. var NodeGuards_1 = __webpack_require__(5);
  2491. var BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer_1 = function (_AbstractNodeTransfor) {
  2492. _inherits(BlockStatementControlFlowTransformer, _AbstractNodeTransfor);
  2493. function BlockStatementControlFlowTransformer(controlFlowCustomNodeFactory, arrayUtils, randomGenerator, options) {
  2494. _classCallCheck(this, BlockStatementControlFlowTransformer);
  2495. var _this = _possibleConstructorReturn(this, (BlockStatementControlFlowTransformer.__proto__ || Object.getPrototypeOf(BlockStatementControlFlowTransformer)).call(this, randomGenerator, options));
  2496. _this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  2497. _this.arrayUtils = arrayUtils;
  2498. return _this;
  2499. }
  2500. _createClass(BlockStatementControlFlowTransformer, [{
  2501. key: "getVisitor",
  2502. value: function getVisitor() {
  2503. var _this2 = this;
  2504. return {
  2505. leave: function leave(node, parentNode) {
  2506. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  2507. return _this2.transformNode(node, parentNode);
  2508. }
  2509. }
  2510. };
  2511. }
  2512. }, {
  2513. key: "transformNode",
  2514. value: function transformNode(blockStatementNode, parentNode) {
  2515. if (this.randomGenerator.getMathRandom() > this.options.controlFlowFlatteningThreshold || !BlockStatementControlFlowTransformer_1.canTransformBlockStatementNode(blockStatementNode)) {
  2516. return blockStatementNode;
  2517. }
  2518. var blockStatementBody = blockStatementNode.body;
  2519. var originalKeys = this.arrayUtils.arrayRange(blockStatementBody.length);
  2520. var shuffledKeys = this.arrayUtils.arrayShuffle(originalKeys);
  2521. var originalKeysIndexesInShuffledArray = originalKeys.map(function (key) {
  2522. return shuffledKeys.indexOf(key);
  2523. });
  2524. var blockStatementControlFlowFlatteningCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);
  2525. blockStatementControlFlowFlatteningCustomNode.initialize(blockStatementBody, shuffledKeys, originalKeysIndexesInShuffledArray);
  2526. return blockStatementControlFlowFlatteningCustomNode.getNode()[0];
  2527. }
  2528. }], [{
  2529. key: "blockStatementHasProhibitedStatements",
  2530. value: function blockStatementHasProhibitedStatements(blockStatementNode) {
  2531. return blockStatementNode.body.some(function (statement) {
  2532. var isBreakOrContinueStatement = NodeGuards_1.NodeGuards.isBreakStatementNode(statement) || NodeGuards_1.NodeGuards.isContinueStatementNode(statement);
  2533. var isVariableDeclarationWithLetOrConstKind = NodeGuards_1.NodeGuards.isVariableDeclarationNode(statement) && (statement.kind === 'const' || statement.kind === 'let');
  2534. return NodeGuards_1.NodeGuards.isFunctionDeclarationNode(statement) || isBreakOrContinueStatement || isVariableDeclarationWithLetOrConstKind;
  2535. });
  2536. }
  2537. }, {
  2538. key: "canTransformBlockStatementNode",
  2539. value: function canTransformBlockStatementNode(blockStatementNode) {
  2540. var canTransform = true;
  2541. estraverse.traverse(blockStatementNode, {
  2542. enter: function enter(node) {
  2543. if (NodeGuards_1.NodeGuards.isWhileStatementNode(node)) {
  2544. return estraverse.VisitorOption.Skip;
  2545. }
  2546. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node) && BlockStatementControlFlowTransformer_1.blockStatementHasProhibitedStatements(node)) {
  2547. canTransform = false;
  2548. }
  2549. }
  2550. });
  2551. if (blockStatementNode.body.length <= 4) {
  2552. canTransform = false;
  2553. }
  2554. return canTransform;
  2555. }
  2556. }]);
  2557. return BlockStatementControlFlowTransformer;
  2558. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  2559. BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], BlockStatementControlFlowTransformer);
  2560. exports.BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer;
  2561. var BlockStatementControlFlowTransformer_1;
  2562. /***/ }),
  2563. /* 54 */
  2564. /***/ (function(module, exports, __webpack_require__) {
  2565. "use strict";
  2566. 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; }; })();
  2567. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2568. 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; }
  2569. 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; }
  2570. Object.defineProperty(exports, "__esModule", { value: true });
  2571. var tslib_1 = __webpack_require__(2);
  2572. var inversify_1 = __webpack_require__(0);
  2573. var ServiceIdentifiers_1 = __webpack_require__(1);
  2574. var ControlFlowCustomNode_1 = __webpack_require__(12);
  2575. var AbstractControlFlowReplacer_1 = __webpack_require__(29);
  2576. var NodeGuards_1 = __webpack_require__(5);
  2577. var CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer_1 = function (_AbstractControlFlowR) {
  2578. _inherits(CallExpressionControlFlowReplacer, _AbstractControlFlowR);
  2579. function CallExpressionControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  2580. _classCallCheck(this, CallExpressionControlFlowReplacer);
  2581. return _possibleConstructorReturn(this, (CallExpressionControlFlowReplacer.__proto__ || Object.getPrototypeOf(CallExpressionControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  2582. }
  2583. _createClass(CallExpressionControlFlowReplacer, [{
  2584. key: "replace",
  2585. value: function replace(callExpressionNode, parentNode, controlFlowStorage) {
  2586. var callee = callExpressionNode.callee;
  2587. if (!NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  2588. return callExpressionNode;
  2589. }
  2590. var replacerId = String(callExpressionNode.arguments.length);
  2591. var callExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionFunctionNode);
  2592. var expressionArguments = callExpressionNode.arguments;
  2593. callExpressionFunctionCustomNode.initialize(expressionArguments);
  2594. var storageKey = this.insertCustomNodeToControlFlowStorage(callExpressionFunctionCustomNode, controlFlowStorage, replacerId, CallExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  2595. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, callee, expressionArguments);
  2596. }
  2597. }, {
  2598. key: "getControlFlowStorageCallNode",
  2599. value: function getControlFlowStorageCallNode(controlFlowStorageId, storageKey, callee, expressionArguments) {
  2600. var controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode);
  2601. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey, callee, expressionArguments);
  2602. var statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  2603. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  2604. throw new Error("`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");
  2605. }
  2606. return statementNode.expression;
  2607. }
  2608. }]);
  2609. return CallExpressionControlFlowReplacer;
  2610. }(AbstractControlFlowReplacer_1.AbstractControlFlowReplacer);
  2611. CallExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  2612. CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], CallExpressionControlFlowReplacer);
  2613. exports.CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer;
  2614. var CallExpressionControlFlowReplacer_1;
  2615. /***/ }),
  2616. /* 55 */
  2617. /***/ (function(module, exports, __webpack_require__) {
  2618. "use strict";
  2619. 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"); } }; })();
  2620. 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; }; })();
  2621. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2622. 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; }
  2623. 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; }
  2624. Object.defineProperty(exports, "__esModule", { value: true });
  2625. var tslib_1 = __webpack_require__(2);
  2626. var inversify_1 = __webpack_require__(0);
  2627. var ServiceIdentifiers_1 = __webpack_require__(1);
  2628. var estraverse = __webpack_require__(8);
  2629. var NodeType_1 = __webpack_require__(10);
  2630. var AbstractNodeTransformer_1 = __webpack_require__(7);
  2631. var NodeGuards_1 = __webpack_require__(5);
  2632. var Nodes_1 = __webpack_require__(9);
  2633. var NodeUtils_1 = __webpack_require__(4);
  2634. var DeadCodeInjectionTransformer = DeadCodeInjectionTransformer_1 = function (_AbstractNodeTransfor) {
  2635. _inherits(DeadCodeInjectionTransformer, _AbstractNodeTransfor);
  2636. function DeadCodeInjectionTransformer(randomGenerator, options) {
  2637. _classCallCheck(this, DeadCodeInjectionTransformer);
  2638. var _this = _possibleConstructorReturn(this, (DeadCodeInjectionTransformer.__proto__ || Object.getPrototypeOf(DeadCodeInjectionTransformer)).call(this, randomGenerator, options));
  2639. _this.collectedBlockStatements = [];
  2640. return _this;
  2641. }
  2642. _createClass(DeadCodeInjectionTransformer, [{
  2643. key: "getVisitor",
  2644. value: function getVisitor() {
  2645. var _this2 = this;
  2646. return {
  2647. enter: function enter(node, parentNode) {
  2648. if (NodeGuards_1.NodeGuards.isProgramNode(node)) {
  2649. _this2.analyzeNode(node, parentNode);
  2650. return node;
  2651. }
  2652. },
  2653. leave: function leave(node, parentNode) {
  2654. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  2655. return _this2.transformNode(node, parentNode);
  2656. }
  2657. }
  2658. };
  2659. }
  2660. }, {
  2661. key: "analyzeNode",
  2662. value: function analyzeNode(programNode, parentNode) {
  2663. var _this3 = this;
  2664. estraverse.traverse(programNode, {
  2665. enter: function enter(node) {
  2666. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  2667. _this3.collectBlockStatementNodes(node, _this3.collectedBlockStatements);
  2668. }
  2669. }
  2670. });
  2671. this.collectedBlockStatementsLength = this.collectedBlockStatements.length;
  2672. }
  2673. }, {
  2674. key: "transformNode",
  2675. value: function transformNode(blockStatementNode, parentNode) {
  2676. if (this.collectedBlockStatementsLength < DeadCodeInjectionTransformer_1.minCollectedBlockStatementsCount) {
  2677. return estraverse.VisitorOption.Break;
  2678. }
  2679. if (!this.collectedBlockStatements.length) {
  2680. return estraverse.VisitorOption.Break;
  2681. }
  2682. if (this.randomGenerator.getMathRandom() > this.options.deadCodeInjectionThreshold) {
  2683. return blockStatementNode;
  2684. }
  2685. var blockScopeOfBlockStatementNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(blockStatementNode)[0];
  2686. if (blockScopeOfBlockStatementNode.type === NodeType_1.NodeType.Program) {
  2687. return blockStatementNode;
  2688. }
  2689. var minInteger = 0;
  2690. var maxInteger = this.collectedBlockStatements.length - 1;
  2691. var randomIndex = this.randomGenerator.getRandomInteger(minInteger, maxInteger);
  2692. var randomBlockStatementNode = this.collectedBlockStatements.splice(randomIndex, 1)[0];
  2693. if (randomBlockStatementNode === blockStatementNode) {
  2694. return blockStatementNode;
  2695. }
  2696. return this.replaceBlockStatementNode(blockStatementNode, randomBlockStatementNode);
  2697. }
  2698. }, {
  2699. key: "collectBlockStatementNodes",
  2700. value: function collectBlockStatementNodes(blockStatementNode, collectedBlockStatements) {
  2701. var _this4 = this;
  2702. var clonedBlockStatementNode = NodeUtils_1.NodeUtils.clone(blockStatementNode);
  2703. var nestedBlockStatementsCount = 0,
  2704. isValidBlockStatementNode = true;
  2705. estraverse.replace(clonedBlockStatementNode, {
  2706. enter: function enter(node, parentNode) {
  2707. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  2708. nestedBlockStatementsCount++;
  2709. }
  2710. if (nestedBlockStatementsCount > DeadCodeInjectionTransformer_1.maxNestedBlockStatementsCount || NodeGuards_1.NodeGuards.isBreakStatementNode(node) || NodeGuards_1.NodeGuards.isContinueStatementNode(node)) {
  2711. isValidBlockStatementNode = false;
  2712. return estraverse.VisitorOption.Break;
  2713. }
  2714. if (NodeGuards_1.NodeGuards.isIdentifierNode(node) && !NodeGuards_1.NodeGuards.isMemberExpressionNode(parentNode)) {
  2715. node.name = _this4.randomGenerator.getRandomVariableName(6);
  2716. }
  2717. return node;
  2718. }
  2719. });
  2720. if (!isValidBlockStatementNode) {
  2721. return;
  2722. }
  2723. collectedBlockStatements.push(clonedBlockStatementNode);
  2724. }
  2725. }, {
  2726. key: "replaceBlockStatementNode",
  2727. value: function replaceBlockStatementNode(blockStatementNode, randomBlockStatementNode) {
  2728. var random1 = this.randomGenerator.getMathRandom() > 0.5;
  2729. var random2 = this.randomGenerator.getMathRandom() > 0.5;
  2730. var operator = random1 ? '===' : '!==';
  2731. var leftString = this.randomGenerator.getRandomString(3);
  2732. var rightString = random2 ? leftString : this.randomGenerator.getRandomString(3);
  2733. var _ref = random1 === random2 ? [blockStatementNode, randomBlockStatementNode] : [randomBlockStatementNode, blockStatementNode],
  2734. _ref2 = _slicedToArray(_ref, 2),
  2735. consequent = _ref2[0],
  2736. alternate = _ref2[1];
  2737. var newBlockStatementNode = Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getIfStatementNode(Nodes_1.Nodes.getBinaryExpressionNode(operator, Nodes_1.Nodes.getLiteralNode(leftString), Nodes_1.Nodes.getLiteralNode(rightString)), consequent, alternate)]);
  2738. newBlockStatementNode = NodeUtils_1.NodeUtils.parentize(newBlockStatementNode);
  2739. return newBlockStatementNode;
  2740. }
  2741. }]);
  2742. return DeadCodeInjectionTransformer;
  2743. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  2744. DeadCodeInjectionTransformer.maxNestedBlockStatementsCount = 4;
  2745. DeadCodeInjectionTransformer.minCollectedBlockStatementsCount = 5;
  2746. DeadCodeInjectionTransformer = DeadCodeInjectionTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], DeadCodeInjectionTransformer);
  2747. exports.DeadCodeInjectionTransformer = DeadCodeInjectionTransformer;
  2748. var DeadCodeInjectionTransformer_1;
  2749. /***/ }),
  2750. /* 56 */
  2751. /***/ (function(module, exports, __webpack_require__) {
  2752. "use strict";
  2753. 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; }; })();
  2754. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2755. 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; }
  2756. 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; }
  2757. Object.defineProperty(exports, "__esModule", { value: true });
  2758. var tslib_1 = __webpack_require__(2);
  2759. var inversify_1 = __webpack_require__(0);
  2760. var ServiceIdentifiers_1 = __webpack_require__(1);
  2761. var estraverse = __webpack_require__(8);
  2762. var ControlFlowCustomNode_1 = __webpack_require__(12);
  2763. var ControlFlowReplacer_1 = __webpack_require__(37);
  2764. var NodeType_1 = __webpack_require__(10);
  2765. var AbstractNodeTransformer_1 = __webpack_require__(7);
  2766. var NodeGuards_1 = __webpack_require__(5);
  2767. var NodeAppender_1 = __webpack_require__(19);
  2768. var NodeUtils_1 = __webpack_require__(4);
  2769. var FunctionControlFlowTransformer = FunctionControlFlowTransformer_1 = function (_AbstractNodeTransfor) {
  2770. _inherits(FunctionControlFlowTransformer, _AbstractNodeTransfor);
  2771. function FunctionControlFlowTransformer(controlFlowStorageFactory, controlFlowReplacerFactory, controlFlowCustomNodeFactory, randomGenerator, options) {
  2772. _classCallCheck(this, FunctionControlFlowTransformer);
  2773. var _this = _possibleConstructorReturn(this, (FunctionControlFlowTransformer.__proto__ || Object.getPrototypeOf(FunctionControlFlowTransformer)).call(this, randomGenerator, options));
  2774. _this.controlFlowData = new Map();
  2775. _this.visitedFunctionNodes = new Set();
  2776. _this.hostNodesWithControlFlowNode = new Set();
  2777. _this.controlFlowStorageFactory = controlFlowStorageFactory;
  2778. _this.controlFlowReplacerFactory = controlFlowReplacerFactory;
  2779. _this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  2780. return _this;
  2781. }
  2782. _createClass(FunctionControlFlowTransformer, [{
  2783. key: "getVisitor",
  2784. value: function getVisitor() {
  2785. var _this2 = this;
  2786. return {
  2787. leave: function leave(node, parentNode) {
  2788. if (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) || NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) || NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node)) {
  2789. return _this2.transformNode(node, parentNode);
  2790. }
  2791. }
  2792. };
  2793. }
  2794. }, {
  2795. key: "transformNode",
  2796. value: function transformNode(functionNode, parentNode) {
  2797. this.visitedFunctionNodes.add(functionNode);
  2798. if (!NodeGuards_1.NodeGuards.isBlockStatementNode(functionNode.body)) {
  2799. return functionNode;
  2800. }
  2801. var hostNode = this.getHostNode(functionNode.body);
  2802. var controlFlowStorage = this.getControlFlowStorage(hostNode);
  2803. this.controlFlowData.set(hostNode, controlFlowStorage);
  2804. this.transformFunctionBody(functionNode.body, controlFlowStorage);
  2805. if (!controlFlowStorage.getLength()) {
  2806. return functionNode;
  2807. }
  2808. var controlFlowStorageCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.ControlFlowStorageNode);
  2809. controlFlowStorageCustomNode.initialize(controlFlowStorage);
  2810. NodeAppender_1.NodeAppender.prependNode(hostNode, controlFlowStorageCustomNode.getNode());
  2811. this.hostNodesWithControlFlowNode.add(hostNode);
  2812. return functionNode;
  2813. }
  2814. }, {
  2815. key: "getControlFlowStorage",
  2816. value: function getControlFlowStorage(hostNode) {
  2817. var controlFlowStorage = this.controlFlowStorageFactory();
  2818. if (this.controlFlowData.has(hostNode)) {
  2819. if (this.hostNodesWithControlFlowNode.has(hostNode)) {
  2820. hostNode.body.shift();
  2821. }
  2822. var hostControlFlowStorage = this.controlFlowData.get(hostNode);
  2823. controlFlowStorage.mergeWith(hostControlFlowStorage, true);
  2824. }
  2825. return controlFlowStorage;
  2826. }
  2827. }, {
  2828. key: "getHostNode",
  2829. value: function getHostNode(functionNodeBody) {
  2830. var blockScopesOfNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(functionNodeBody);
  2831. if (blockScopesOfNode.length === 1) {
  2832. return functionNodeBody;
  2833. } else {
  2834. blockScopesOfNode.pop();
  2835. }
  2836. if (blockScopesOfNode.length > FunctionControlFlowTransformer_1.hostNodeSearchMinDepth) {
  2837. blockScopesOfNode.splice(0, FunctionControlFlowTransformer_1.hostNodeSearchMinDepth);
  2838. }
  2839. if (blockScopesOfNode.length > FunctionControlFlowTransformer_1.hostNodeSearchMaxDepth) {
  2840. blockScopesOfNode.length = FunctionControlFlowTransformer_1.hostNodeSearchMaxDepth;
  2841. }
  2842. return this.randomGenerator.getRandomGenerator().pickone(blockScopesOfNode);
  2843. }
  2844. }, {
  2845. key: "isVisitedFunctionNode",
  2846. value: function isVisitedFunctionNode(node) {
  2847. return (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) || NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) || NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node)) && this.visitedFunctionNodes.has(node);
  2848. }
  2849. }, {
  2850. key: "transformFunctionBody",
  2851. value: function transformFunctionBody(functionNodeBody, controlFlowStorage) {
  2852. var _this3 = this;
  2853. estraverse.replace(functionNodeBody, {
  2854. enter: function enter(node, parentNode) {
  2855. if (_this3.isVisitedFunctionNode(node)) {
  2856. return estraverse.VisitorOption.Skip;
  2857. }
  2858. if (!FunctionControlFlowTransformer_1.controlFlowReplacersMap.has(node.type)) {
  2859. return node;
  2860. }
  2861. if (_this3.randomGenerator.getMathRandom() > _this3.options.controlFlowFlatteningThreshold) {
  2862. return node;
  2863. }
  2864. var controlFlowReplacerName = FunctionControlFlowTransformer_1.controlFlowReplacersMap.get(node.type);
  2865. if (controlFlowReplacerName === undefined) {
  2866. return node;
  2867. }
  2868. return Object.assign({}, _this3.controlFlowReplacerFactory(controlFlowReplacerName).replace(node, parentNode, controlFlowStorage), { parentNode: parentNode });
  2869. }
  2870. });
  2871. }
  2872. }]);
  2873. return FunctionControlFlowTransformer;
  2874. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  2875. FunctionControlFlowTransformer.controlFlowReplacersMap = new Map([[NodeType_1.NodeType.BinaryExpression, ControlFlowReplacer_1.ControlFlowReplacer.BinaryExpressionControlFlowReplacer], [NodeType_1.NodeType.CallExpression, ControlFlowReplacer_1.ControlFlowReplacer.CallExpressionControlFlowReplacer], [NodeType_1.NodeType.LogicalExpression, ControlFlowReplacer_1.ControlFlowReplacer.LogicalExpressionControlFlowReplacer], [NodeType_1.NodeType.Literal, ControlFlowReplacer_1.ControlFlowReplacer.StringLiteralControlFlowReplacer]]);
  2876. FunctionControlFlowTransformer.hostNodeSearchMinDepth = 0;
  2877. FunctionControlFlowTransformer.hostNodeSearchMaxDepth = 2;
  2878. FunctionControlFlowTransformer = FunctionControlFlowTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__TControlFlowStorage)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowReplacer)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Function, Function, Object, Object])], FunctionControlFlowTransformer);
  2879. exports.FunctionControlFlowTransformer = FunctionControlFlowTransformer;
  2880. var FunctionControlFlowTransformer_1;
  2881. /***/ }),
  2882. /* 57 */
  2883. /***/ (function(module, exports, __webpack_require__) {
  2884. "use strict";
  2885. 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; }; })();
  2886. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2887. 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; }
  2888. 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; }
  2889. Object.defineProperty(exports, "__esModule", { value: true });
  2890. var tslib_1 = __webpack_require__(2);
  2891. var inversify_1 = __webpack_require__(0);
  2892. var ServiceIdentifiers_1 = __webpack_require__(1);
  2893. var ControlFlowCustomNode_1 = __webpack_require__(12);
  2894. var ExpressionWithOperatorControlFlowReplacer_1 = __webpack_require__(38);
  2895. var NodeGuards_1 = __webpack_require__(5);
  2896. var NodeUtils_1 = __webpack_require__(4);
  2897. var LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer_1 = function (_ExpressionWithOperat) {
  2898. _inherits(LogicalExpressionControlFlowReplacer, _ExpressionWithOperat);
  2899. function LogicalExpressionControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  2900. _classCallCheck(this, LogicalExpressionControlFlowReplacer);
  2901. return _possibleConstructorReturn(this, (LogicalExpressionControlFlowReplacer.__proto__ || Object.getPrototypeOf(LogicalExpressionControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  2902. }
  2903. _createClass(LogicalExpressionControlFlowReplacer, [{
  2904. key: "replace",
  2905. value: function replace(logicalExpressionNode, parentNode, controlFlowStorage) {
  2906. if (this.checkForProhibitedExpressions(logicalExpressionNode.left, logicalExpressionNode.right)) {
  2907. return logicalExpressionNode;
  2908. }
  2909. var replacerId = logicalExpressionNode.operator;
  2910. var logicalExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.LogicalExpressionFunctionNode);
  2911. logicalExpressionFunctionCustomNode.initialize(replacerId);
  2912. var storageKey = this.insertCustomNodeToControlFlowStorage(logicalExpressionFunctionCustomNode, controlFlowStorage, replacerId, LogicalExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  2913. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, logicalExpressionNode.left, logicalExpressionNode.right);
  2914. }
  2915. }, {
  2916. key: "checkForProhibitedExpressions",
  2917. value: function checkForProhibitedExpressions(leftExpression, rightExpression) {
  2918. return [leftExpression, rightExpression].some(function (expressionNode) {
  2919. var nodeForCheck = void 0;
  2920. if (!NodeGuards_1.NodeGuards.isUnaryExpressionNode(expressionNode)) {
  2921. nodeForCheck = expressionNode;
  2922. } else {
  2923. nodeForCheck = NodeUtils_1.NodeUtils.getUnaryExpressionArgumentNode(expressionNode);
  2924. }
  2925. return !NodeGuards_1.NodeGuards.isLiteralNode(nodeForCheck) && !NodeGuards_1.NodeGuards.isIdentifierNode(nodeForCheck) && !NodeGuards_1.NodeGuards.isObjectExpressionNode(nodeForCheck) && !NodeGuards_1.NodeGuards.isExpressionStatementNode(nodeForCheck);
  2926. });
  2927. }
  2928. }]);
  2929. return LogicalExpressionControlFlowReplacer;
  2930. }(ExpressionWithOperatorControlFlowReplacer_1.ExpressionWithOperatorControlFlowReplacer);
  2931. LogicalExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  2932. LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], LogicalExpressionControlFlowReplacer);
  2933. exports.LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer;
  2934. var LogicalExpressionControlFlowReplacer_1;
  2935. /***/ }),
  2936. /* 58 */
  2937. /***/ (function(module, exports, __webpack_require__) {
  2938. "use strict";
  2939. 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; }; })();
  2940. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2941. 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; }
  2942. 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; }
  2943. Object.defineProperty(exports, "__esModule", { value: true });
  2944. var tslib_1 = __webpack_require__(2);
  2945. var inversify_1 = __webpack_require__(0);
  2946. var ServiceIdentifiers_1 = __webpack_require__(1);
  2947. var ControlFlowCustomNode_1 = __webpack_require__(12);
  2948. var AbstractControlFlowReplacer_1 = __webpack_require__(29);
  2949. var NodeGuards_1 = __webpack_require__(5);
  2950. var StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer_1 = function (_AbstractControlFlowR) {
  2951. _inherits(StringLiteralControlFlowReplacer, _AbstractControlFlowR);
  2952. function StringLiteralControlFlowReplacer(controlFlowCustomNodeFactory, randomGenerator, options) {
  2953. _classCallCheck(this, StringLiteralControlFlowReplacer);
  2954. return _possibleConstructorReturn(this, (StringLiteralControlFlowReplacer.__proto__ || Object.getPrototypeOf(StringLiteralControlFlowReplacer)).call(this, controlFlowCustomNodeFactory, randomGenerator, options));
  2955. }
  2956. _createClass(StringLiteralControlFlowReplacer, [{
  2957. key: "replace",
  2958. value: function replace(literalNode, parentNode, controlFlowStorage) {
  2959. if (NodeGuards_1.NodeGuards.isPropertyNode(parentNode) && parentNode.key === literalNode) {
  2960. return literalNode;
  2961. }
  2962. if (typeof literalNode.value !== 'string' || literalNode.value.length < 3) {
  2963. return literalNode;
  2964. }
  2965. var replacerId = String(literalNode.value);
  2966. var literalFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralNode);
  2967. literalFunctionCustomNode.initialize(literalNode.value);
  2968. var storageKey = this.insertCustomNodeToControlFlowStorage(literalFunctionCustomNode, controlFlowStorage, replacerId, StringLiteralControlFlowReplacer_1.usingExistingIdentifierChance);
  2969. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey);
  2970. }
  2971. }, {
  2972. key: "getControlFlowStorageCallNode",
  2973. value: function getControlFlowStorageCallNode(controlFlowStorageId, storageKey) {
  2974. var controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);
  2975. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey);
  2976. var statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  2977. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  2978. throw new Error("`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node");
  2979. }
  2980. return statementNode.expression;
  2981. }
  2982. }]);
  2983. return StringLiteralControlFlowReplacer;
  2984. }(AbstractControlFlowReplacer_1.AbstractControlFlowReplacer);
  2985. StringLiteralControlFlowReplacer.usingExistingIdentifierChance = 1;
  2986. StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], StringLiteralControlFlowReplacer);
  2987. exports.StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer;
  2988. var StringLiteralControlFlowReplacer_1;
  2989. /***/ }),
  2990. /* 59 */
  2991. /***/ (function(module, exports, __webpack_require__) {
  2992. "use strict";
  2993. Object.defineProperty(exports, "__esModule", { value: true });
  2994. var inversify_1 = __webpack_require__(0);
  2995. var ServiceIdentifiers_1 = __webpack_require__(1);
  2996. var NodeTransformer_1 = __webpack_require__(21);
  2997. var MemberExpressionTransformer_1 = __webpack_require__(60);
  2998. var MethodDefinitionTransformer_1 = __webpack_require__(61);
  2999. var TemplateLiteralTransformer_1 = __webpack_require__(62);
  3000. exports.convertingTransformersModule = new inversify_1.ContainerModule(function (bind) {
  3001. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(MemberExpressionTransformer_1.MemberExpressionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.MemberExpressionTransformer);
  3002. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(MethodDefinitionTransformer_1.MethodDefinitionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.MethodDefinitionTransformer);
  3003. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(TemplateLiteralTransformer_1.TemplateLiteralTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.TemplateLiteralTransformer);
  3004. });
  3005. /***/ }),
  3006. /* 60 */
  3007. /***/ (function(module, exports, __webpack_require__) {
  3008. "use strict";
  3009. 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; }; })();
  3010. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3011. 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; }
  3012. 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; }
  3013. Object.defineProperty(exports, "__esModule", { value: true });
  3014. var tslib_1 = __webpack_require__(2);
  3015. var inversify_1 = __webpack_require__(0);
  3016. var ServiceIdentifiers_1 = __webpack_require__(1);
  3017. var NodeType_1 = __webpack_require__(10);
  3018. var AbstractNodeTransformer_1 = __webpack_require__(7);
  3019. var NodeGuards_1 = __webpack_require__(5);
  3020. var MemberExpressionTransformer = function (_AbstractNodeTransfor) {
  3021. _inherits(MemberExpressionTransformer, _AbstractNodeTransfor);
  3022. function MemberExpressionTransformer(randomGenerator, options) {
  3023. _classCallCheck(this, MemberExpressionTransformer);
  3024. return _possibleConstructorReturn(this, (MemberExpressionTransformer.__proto__ || Object.getPrototypeOf(MemberExpressionTransformer)).call(this, randomGenerator, options));
  3025. }
  3026. _createClass(MemberExpressionTransformer, [{
  3027. key: "getVisitor",
  3028. value: function getVisitor() {
  3029. var _this2 = this;
  3030. return {
  3031. enter: function enter(node, parentNode) {
  3032. if (NodeGuards_1.NodeGuards.isMemberExpressionNode(node)) {
  3033. return _this2.transformNode(node, parentNode);
  3034. }
  3035. }
  3036. };
  3037. }
  3038. }, {
  3039. key: "transformNode",
  3040. value: function transformNode(memberExpressionNode, parentNode) {
  3041. if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpressionNode.property)) {
  3042. if (memberExpressionNode.computed) {
  3043. return memberExpressionNode;
  3044. }
  3045. memberExpressionNode.computed = true;
  3046. memberExpressionNode.property = {
  3047. type: NodeType_1.NodeType.Literal,
  3048. value: memberExpressionNode.property.name,
  3049. raw: "'" + memberExpressionNode.property.name + "'"
  3050. };
  3051. }
  3052. return memberExpressionNode;
  3053. }
  3054. }]);
  3055. return MemberExpressionTransformer;
  3056. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3057. MemberExpressionTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], MemberExpressionTransformer);
  3058. exports.MemberExpressionTransformer = MemberExpressionTransformer;
  3059. /***/ }),
  3060. /* 61 */
  3061. /***/ (function(module, exports, __webpack_require__) {
  3062. "use strict";
  3063. 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; }; })();
  3064. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3065. 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; }
  3066. 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; }
  3067. Object.defineProperty(exports, "__esModule", { value: true });
  3068. var tslib_1 = __webpack_require__(2);
  3069. var inversify_1 = __webpack_require__(0);
  3070. var ServiceIdentifiers_1 = __webpack_require__(1);
  3071. var NodeType_1 = __webpack_require__(10);
  3072. var AbstractNodeTransformer_1 = __webpack_require__(7);
  3073. var NodeGuards_1 = __webpack_require__(5);
  3074. var MethodDefinitionTransformer = MethodDefinitionTransformer_1 = function (_AbstractNodeTransfor) {
  3075. _inherits(MethodDefinitionTransformer, _AbstractNodeTransfor);
  3076. function MethodDefinitionTransformer(randomGenerator, options) {
  3077. _classCallCheck(this, MethodDefinitionTransformer);
  3078. return _possibleConstructorReturn(this, (MethodDefinitionTransformer.__proto__ || Object.getPrototypeOf(MethodDefinitionTransformer)).call(this, randomGenerator, options));
  3079. }
  3080. _createClass(MethodDefinitionTransformer, [{
  3081. key: "getVisitor",
  3082. value: function getVisitor() {
  3083. var _this2 = this;
  3084. return {
  3085. enter: function enter(node, parentNode) {
  3086. if (NodeGuards_1.NodeGuards.isMethodDefinitionNode(node)) {
  3087. return _this2.transformNode(node, parentNode);
  3088. }
  3089. }
  3090. };
  3091. }
  3092. }, {
  3093. key: "transformNode",
  3094. value: function transformNode(methodDefinitionNode, parentNode) {
  3095. if (NodeGuards_1.NodeGuards.isIdentifierNode(methodDefinitionNode.key) && !(MethodDefinitionTransformer_1.ignoredNames.indexOf(methodDefinitionNode.key.name) !== -1) && methodDefinitionNode.computed === false) {
  3096. methodDefinitionNode.computed = true;
  3097. methodDefinitionNode.key = {
  3098. type: NodeType_1.NodeType.Literal,
  3099. value: methodDefinitionNode.key.name,
  3100. raw: "'" + methodDefinitionNode.key.name + "'"
  3101. };
  3102. }
  3103. return methodDefinitionNode;
  3104. }
  3105. }]);
  3106. return MethodDefinitionTransformer;
  3107. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3108. MethodDefinitionTransformer.ignoredNames = ['constructor'];
  3109. MethodDefinitionTransformer = MethodDefinitionTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], MethodDefinitionTransformer);
  3110. exports.MethodDefinitionTransformer = MethodDefinitionTransformer;
  3111. var MethodDefinitionTransformer_1;
  3112. /***/ }),
  3113. /* 62 */
  3114. /***/ (function(module, exports, __webpack_require__) {
  3115. "use strict";
  3116. 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; }; })();
  3117. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3118. 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; }
  3119. 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; }
  3120. Object.defineProperty(exports, "__esModule", { value: true });
  3121. var tslib_1 = __webpack_require__(2);
  3122. var inversify_1 = __webpack_require__(0);
  3123. var ServiceIdentifiers_1 = __webpack_require__(1);
  3124. var AbstractNodeTransformer_1 = __webpack_require__(7);
  3125. var NodeGuards_1 = __webpack_require__(5);
  3126. var Nodes_1 = __webpack_require__(9);
  3127. var TemplateLiteralTransformer = TemplateLiteralTransformer_1 = function (_AbstractNodeTransfor) {
  3128. _inherits(TemplateLiteralTransformer, _AbstractNodeTransfor);
  3129. function TemplateLiteralTransformer(randomGenerator, options) {
  3130. _classCallCheck(this, TemplateLiteralTransformer);
  3131. return _possibleConstructorReturn(this, (TemplateLiteralTransformer.__proto__ || Object.getPrototypeOf(TemplateLiteralTransformer)).call(this, randomGenerator, options));
  3132. }
  3133. _createClass(TemplateLiteralTransformer, [{
  3134. key: "getVisitor",
  3135. value: function getVisitor() {
  3136. var _this2 = this;
  3137. return {
  3138. enter: function enter(node, parentNode) {
  3139. if (NodeGuards_1.NodeGuards.isTemplateLiteralNode(node)) {
  3140. return _this2.transformNode(node, parentNode);
  3141. }
  3142. }
  3143. };
  3144. }
  3145. }, {
  3146. key: "transformNode",
  3147. value: function transformNode(templateLiteralNode, parentNode) {
  3148. var templateLiteralExpressions = templateLiteralNode.expressions;
  3149. var nodes = [];
  3150. templateLiteralNode.quasis.forEach(function (templateElement) {
  3151. nodes.push(Nodes_1.Nodes.getLiteralNode(templateElement.value.cooked));
  3152. var expression = templateLiteralExpressions.shift();
  3153. if (!expression) {
  3154. return;
  3155. }
  3156. nodes.push(expression);
  3157. });
  3158. nodes = nodes.filter(function (node) {
  3159. return !(NodeGuards_1.NodeGuards.isLiteralNode(node) && node.value === '');
  3160. });
  3161. if (!TemplateLiteralTransformer_1.isLiteralNodeWithStringValue(nodes[0]) && !TemplateLiteralTransformer_1.isLiteralNodeWithStringValue(nodes[1])) {
  3162. nodes.unshift(Nodes_1.Nodes.getLiteralNode(''));
  3163. }
  3164. if (nodes.length > 1) {
  3165. var root = Nodes_1.Nodes.getBinaryExpressionNode('+', nodes.shift(), nodes.shift());
  3166. nodes.forEach(function (node) {
  3167. root = Nodes_1.Nodes.getBinaryExpressionNode('+', root, node);
  3168. });
  3169. return root;
  3170. }
  3171. return nodes[0];
  3172. }
  3173. }], [{
  3174. key: "isLiteralNodeWithStringValue",
  3175. value: function isLiteralNodeWithStringValue(node) {
  3176. return node && NodeGuards_1.NodeGuards.isLiteralNode(node) && typeof node.value === 'string';
  3177. }
  3178. }]);
  3179. return TemplateLiteralTransformer;
  3180. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  3181. TemplateLiteralTransformer = TemplateLiteralTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], TemplateLiteralTransformer);
  3182. exports.TemplateLiteralTransformer = TemplateLiteralTransformer;
  3183. var TemplateLiteralTransformer_1;
  3184. /***/ }),
  3185. /* 63 */
  3186. /***/ (function(module, exports, __webpack_require__) {
  3187. "use strict";
  3188. Object.defineProperty(exports, "__esModule", { value: true });
  3189. var InversifyContainerFacade_1 = __webpack_require__(14);
  3190. var inversify_1 = __webpack_require__(0);
  3191. var ServiceIdentifiers_1 = __webpack_require__(1);
  3192. var ControlFlowCustomNode_1 = __webpack_require__(12);
  3193. var CustomNode_1 = __webpack_require__(20);
  3194. var CustomNodeGroup_1 = __webpack_require__(39);
  3195. var ConsoleOutputCustomNodeGroup_1 = __webpack_require__(64);
  3196. var DebugProtectionCustomNodeGroup_1 = __webpack_require__(65);
  3197. var DomainLockCustomNodeGroup_1 = __webpack_require__(66);
  3198. var SelfDefendingCustomNodeGroup_1 = __webpack_require__(67);
  3199. var StringArrayCustomNodeGroup_1 = __webpack_require__(68);
  3200. var BinaryExpressionFunctionNode_1 = __webpack_require__(70);
  3201. var BlockStatementControlFlowFlatteningNode_1 = __webpack_require__(73);
  3202. var CallExpressionControlFlowStorageCallNode_1 = __webpack_require__(74);
  3203. var CallExpressionFunctionNode_1 = __webpack_require__(75);
  3204. var ControlFlowStorageNode_1 = __webpack_require__(76);
  3205. var ConsoleOutputDisableExpressionNode_1 = __webpack_require__(77);
  3206. var DebugProtectionFunctionCallNode_1 = __webpack_require__(79);
  3207. var DebugProtectionFunctionIntervalNode_1 = __webpack_require__(81);
  3208. var DebugProtectionFunctionNode_1 = __webpack_require__(83);
  3209. var DomainLockNode_1 = __webpack_require__(87);
  3210. var ExpressionWithOperatorControlFlowStorageCallNode_1 = __webpack_require__(89);
  3211. var LogicalExpressionFunctionNode_1 = __webpack_require__(90);
  3212. var NodeCallsControllerFunctionNode_1 = __webpack_require__(91);
  3213. var SelfDefendingUnicodeNode_1 = __webpack_require__(93);
  3214. var StringArrayCallsWrapper_1 = __webpack_require__(95);
  3215. var StringArrayNode_1 = __webpack_require__(102);
  3216. var StringArrayRotateFunctionNode_1 = __webpack_require__(104);
  3217. var StringLiteralControlFlowStorageCallNode_1 = __webpack_require__(107);
  3218. var StringLiteralNode_1 = __webpack_require__(108);
  3219. exports.customNodesModule = new inversify_1.ContainerModule(function (bind) {
  3220. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(ConsoleOutputDisableExpressionNode_1.ConsoleOutputDisableExpressionNode).whenTargetNamed(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode);
  3221. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode).whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode);
  3222. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DebugProtectionFunctionIntervalNode_1.DebugProtectionFunctionIntervalNode).whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode);
  3223. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DebugProtectionFunctionNode_1.DebugProtectionFunctionNode).whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionNode);
  3224. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(DomainLockNode_1.DomainLockNode).whenTargetNamed(CustomNode_1.CustomNode.DomainLockNode);
  3225. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(NodeCallsControllerFunctionNode_1.NodeCallsControllerFunctionNode).whenTargetNamed(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3226. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(SelfDefendingUnicodeNode_1.SelfDefendingUnicodeNode).whenTargetNamed(CustomNode_1.CustomNode.SelfDefendingUnicodeNode);
  3227. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(StringArrayCallsWrapper_1.StringArrayCallsWrapper).whenTargetNamed(CustomNode_1.CustomNode.StringArrayCallsWrapper);
  3228. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(StringArrayNode_1.StringArrayNode).whenTargetNamed(CustomNode_1.CustomNode.StringArrayNode);
  3229. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode).to(StringArrayRotateFunctionNode_1.StringArrayRotateFunctionNode).whenTargetNamed(CustomNode_1.CustomNode.StringArrayRotateFunctionNode);
  3230. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(BinaryExpressionFunctionNode_1.BinaryExpressionFunctionNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.BinaryExpressionFunctionNode);
  3231. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(BlockStatementControlFlowFlatteningNode_1.BlockStatementControlFlowFlatteningNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);
  3232. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(CallExpressionControlFlowStorageCallNode_1.CallExpressionControlFlowStorageCallNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode);
  3233. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(CallExpressionFunctionNode_1.CallExpressionFunctionNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionFunctionNode);
  3234. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(ControlFlowStorageNode_1.ControlFlowStorageNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.ControlFlowStorageNode);
  3235. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(ExpressionWithOperatorControlFlowStorageCallNode_1.ExpressionWithOperatorControlFlowStorageCallNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode);
  3236. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(LogicalExpressionFunctionNode_1.LogicalExpressionFunctionNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.LogicalExpressionFunctionNode);
  3237. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(StringLiteralNode_1.StringLiteralNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralNode);
  3238. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode).toConstructor(StringLiteralControlFlowStorageCallNode_1.StringLiteralControlFlowStorageCallNode).whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);
  3239. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(ConsoleOutputCustomNodeGroup_1.ConsoleOutputCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.ConsoleOutputCustomNodeGroup);
  3240. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(DebugProtectionCustomNodeGroup_1.DebugProtectionCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.DebugProtectionCustomNodeGroup);
  3241. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(DomainLockCustomNodeGroup_1.DomainLockCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.DomainLockCustomNodeGroup);
  3242. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(SelfDefendingCustomNodeGroup_1.SelfDefendingCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.SelfDefendingCustomNodeGroup);
  3243. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup).to(StringArrayCustomNodeGroup_1.StringArrayCustomNodeGroup).whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.StringArrayCustomNodeGroup);
  3244. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode));
  3245. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getConstructorFactory(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode, ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator, ServiceIdentifiers_1.ServiceIdentifiers.IOptions));
  3246. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNodeGroup).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup));
  3247. });
  3248. /***/ }),
  3249. /* 64 */
  3250. /***/ (function(module, exports, __webpack_require__) {
  3251. "use strict";
  3252. 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; }; })();
  3253. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3254. 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; }
  3255. 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; }
  3256. Object.defineProperty(exports, "__esModule", { value: true });
  3257. var tslib_1 = __webpack_require__(2);
  3258. var inversify_1 = __webpack_require__(0);
  3259. var ServiceIdentifiers_1 = __webpack_require__(1);
  3260. var Initializable_1 = __webpack_require__(3);
  3261. var CustomNode_1 = __webpack_require__(20);
  3262. var ObfuscationEvent_1 = __webpack_require__(15);
  3263. var AbstractCustomNodeGroup_1 = __webpack_require__(22);
  3264. var NodeAppender_1 = __webpack_require__(19);
  3265. var ConsoleOutputCustomNodeGroup = function (_AbstractCustomNodeGr) {
  3266. _inherits(ConsoleOutputCustomNodeGroup, _AbstractCustomNodeGr);
  3267. function ConsoleOutputCustomNodeGroup(customNodeFactory, obfuscationEventEmitter, randomGenerator, options) {
  3268. _classCallCheck(this, ConsoleOutputCustomNodeGroup);
  3269. var _this = _possibleConstructorReturn(this, (ConsoleOutputCustomNodeGroup.__proto__ || Object.getPrototypeOf(ConsoleOutputCustomNodeGroup)).call(this, randomGenerator, options));
  3270. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  3271. _this.customNodeFactory = customNodeFactory;
  3272. _this.obfuscationEventEmitter = obfuscationEventEmitter;
  3273. return _this;
  3274. }
  3275. _createClass(ConsoleOutputCustomNodeGroup, [{
  3276. key: "appendCustomNodes",
  3277. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  3278. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  3279. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode, function (customNode) {
  3280. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  3281. });
  3282. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  3283. var targetBlockScope = void 0;
  3284. if (stackTraceData.length) {
  3285. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  3286. } else {
  3287. targetBlockScope = blockScopeNode;
  3288. }
  3289. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  3290. });
  3291. }
  3292. }, {
  3293. key: "initialize",
  3294. value: function initialize() {
  3295. this.customNodes = new Map();
  3296. if (!this.options.disableConsoleOutput) {
  3297. return;
  3298. }
  3299. var callsControllerFunctionName = this.randomGenerator.getRandomVariableName(6);
  3300. var consoleOutputDisableExpressionNode = this.customNodeFactory(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode);
  3301. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3302. consoleOutputDisableExpressionNode.initialize(callsControllerFunctionName);
  3303. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  3304. this.customNodes.set(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode, consoleOutputDisableExpressionNode);
  3305. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  3306. }
  3307. }]);
  3308. return ConsoleOutputCustomNodeGroup;
  3309. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  3310. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], ConsoleOutputCustomNodeGroup.prototype, "customNodes", void 0);
  3311. ConsoleOutputCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], ConsoleOutputCustomNodeGroup);
  3312. exports.ConsoleOutputCustomNodeGroup = ConsoleOutputCustomNodeGroup;
  3313. /***/ }),
  3314. /* 65 */
  3315. /***/ (function(module, exports, __webpack_require__) {
  3316. "use strict";
  3317. 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; }; })();
  3318. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3319. 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; }
  3320. 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; }
  3321. Object.defineProperty(exports, "__esModule", { value: true });
  3322. var tslib_1 = __webpack_require__(2);
  3323. var inversify_1 = __webpack_require__(0);
  3324. var ServiceIdentifiers_1 = __webpack_require__(1);
  3325. var Initializable_1 = __webpack_require__(3);
  3326. var CustomNode_1 = __webpack_require__(20);
  3327. var ObfuscationEvent_1 = __webpack_require__(15);
  3328. var AbstractCustomNodeGroup_1 = __webpack_require__(22);
  3329. var NodeAppender_1 = __webpack_require__(19);
  3330. var DebugProtectionCustomNodeGroup = function (_AbstractCustomNodeGr) {
  3331. _inherits(DebugProtectionCustomNodeGroup, _AbstractCustomNodeGr);
  3332. function DebugProtectionCustomNodeGroup(customNodeFactory, obfuscationEventEmitter, randomGenerator, options) {
  3333. _classCallCheck(this, DebugProtectionCustomNodeGroup);
  3334. var _this = _possibleConstructorReturn(this, (DebugProtectionCustomNodeGroup.__proto__ || Object.getPrototypeOf(DebugProtectionCustomNodeGroup)).call(this, randomGenerator, options));
  3335. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  3336. _this.customNodeFactory = customNodeFactory;
  3337. _this.obfuscationEventEmitter = obfuscationEventEmitter;
  3338. return _this;
  3339. }
  3340. _createClass(DebugProtectionCustomNodeGroup, [{
  3341. key: "appendCustomNodes",
  3342. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  3343. var _this2 = this;
  3344. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  3345. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode, function (customNode) {
  3346. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  3347. });
  3348. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionNode, function (customNode) {
  3349. NodeAppender_1.NodeAppender.appendNode(blockScopeNode, customNode.getNode());
  3350. });
  3351. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode, function (customNode) {
  3352. var programBodyLength = blockScopeNode.body.length;
  3353. var randomIndex = _this2.randomGenerator.getRandomInteger(0, programBodyLength);
  3354. NodeAppender_1.NodeAppender.insertNodeAtIndex(blockScopeNode, customNode.getNode(), randomIndex);
  3355. });
  3356. }
  3357. }, {
  3358. key: "initialize",
  3359. value: function initialize() {
  3360. this.customNodes = new Map();
  3361. if (!this.options.debugProtection) {
  3362. return;
  3363. }
  3364. var debugProtectionFunctionName = this.randomGenerator.getRandomVariableName(6);
  3365. var debugProtectionFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionNode);
  3366. var debugProtectionFunctionCallNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode);
  3367. var debugProtectionFunctionIntervalNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode);
  3368. debugProtectionFunctionNode.initialize(debugProtectionFunctionName);
  3369. debugProtectionFunctionCallNode.initialize(debugProtectionFunctionName);
  3370. debugProtectionFunctionIntervalNode.initialize(debugProtectionFunctionName);
  3371. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionNode, debugProtectionFunctionNode);
  3372. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode, debugProtectionFunctionCallNode);
  3373. if (this.options.debugProtectionInterval) {
  3374. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode, debugProtectionFunctionIntervalNode);
  3375. }
  3376. }
  3377. }]);
  3378. return DebugProtectionCustomNodeGroup;
  3379. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  3380. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], DebugProtectionCustomNodeGroup.prototype, "customNodes", void 0);
  3381. DebugProtectionCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], DebugProtectionCustomNodeGroup);
  3382. exports.DebugProtectionCustomNodeGroup = DebugProtectionCustomNodeGroup;
  3383. /***/ }),
  3384. /* 66 */
  3385. /***/ (function(module, exports, __webpack_require__) {
  3386. "use strict";
  3387. 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; }; })();
  3388. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3389. 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; }
  3390. 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; }
  3391. Object.defineProperty(exports, "__esModule", { value: true });
  3392. var tslib_1 = __webpack_require__(2);
  3393. var inversify_1 = __webpack_require__(0);
  3394. var ServiceIdentifiers_1 = __webpack_require__(1);
  3395. var Initializable_1 = __webpack_require__(3);
  3396. var CustomNode_1 = __webpack_require__(20);
  3397. var ObfuscationEvent_1 = __webpack_require__(15);
  3398. var AbstractCustomNodeGroup_1 = __webpack_require__(22);
  3399. var NodeAppender_1 = __webpack_require__(19);
  3400. var DomainLockCustomNodeGroup = function (_AbstractCustomNodeGr) {
  3401. _inherits(DomainLockCustomNodeGroup, _AbstractCustomNodeGr);
  3402. function DomainLockCustomNodeGroup(customNodeFactory, obfuscationEventEmitter, randomGenerator, options) {
  3403. _classCallCheck(this, DomainLockCustomNodeGroup);
  3404. var _this = _possibleConstructorReturn(this, (DomainLockCustomNodeGroup.__proto__ || Object.getPrototypeOf(DomainLockCustomNodeGroup)).call(this, randomGenerator, options));
  3405. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  3406. _this.customNodeFactory = customNodeFactory;
  3407. _this.obfuscationEventEmitter = obfuscationEventEmitter;
  3408. return _this;
  3409. }
  3410. _createClass(DomainLockCustomNodeGroup, [{
  3411. key: "appendCustomNodes",
  3412. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  3413. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  3414. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DomainLockNode, function (customNode) {
  3415. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  3416. });
  3417. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  3418. var targetBlockScope = void 0;
  3419. if (stackTraceData.length) {
  3420. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  3421. } else {
  3422. targetBlockScope = blockScopeNode;
  3423. }
  3424. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  3425. });
  3426. }
  3427. }, {
  3428. key: "initialize",
  3429. value: function initialize() {
  3430. this.customNodes = new Map();
  3431. if (!this.options.domainLock.length) {
  3432. return;
  3433. }
  3434. var callsControllerFunctionName = this.randomGenerator.getRandomVariableName(6);
  3435. var domainLockNode = this.customNodeFactory(CustomNode_1.CustomNode.DomainLockNode);
  3436. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3437. domainLockNode.initialize(callsControllerFunctionName);
  3438. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  3439. this.customNodes.set(CustomNode_1.CustomNode.DomainLockNode, domainLockNode);
  3440. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  3441. }
  3442. }]);
  3443. return DomainLockCustomNodeGroup;
  3444. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  3445. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], DomainLockCustomNodeGroup.prototype, "customNodes", void 0);
  3446. DomainLockCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], DomainLockCustomNodeGroup);
  3447. exports.DomainLockCustomNodeGroup = DomainLockCustomNodeGroup;
  3448. /***/ }),
  3449. /* 67 */
  3450. /***/ (function(module, exports, __webpack_require__) {
  3451. "use strict";
  3452. 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; }; })();
  3453. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3454. 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; }
  3455. 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; }
  3456. Object.defineProperty(exports, "__esModule", { value: true });
  3457. var tslib_1 = __webpack_require__(2);
  3458. var inversify_1 = __webpack_require__(0);
  3459. var ServiceIdentifiers_1 = __webpack_require__(1);
  3460. var Initializable_1 = __webpack_require__(3);
  3461. var CustomNode_1 = __webpack_require__(20);
  3462. var ObfuscationEvent_1 = __webpack_require__(15);
  3463. var AbstractCustomNodeGroup_1 = __webpack_require__(22);
  3464. var NodeAppender_1 = __webpack_require__(19);
  3465. var SelfDefendingCustomNodeGroup = function (_AbstractCustomNodeGr) {
  3466. _inherits(SelfDefendingCustomNodeGroup, _AbstractCustomNodeGr);
  3467. function SelfDefendingCustomNodeGroup(customNodeFactory, obfuscationEventEmitter, randomGenerator, options) {
  3468. _classCallCheck(this, SelfDefendingCustomNodeGroup);
  3469. var _this = _possibleConstructorReturn(this, (SelfDefendingCustomNodeGroup.__proto__ || Object.getPrototypeOf(SelfDefendingCustomNodeGroup)).call(this, randomGenerator, options));
  3470. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation;
  3471. _this.customNodeFactory = customNodeFactory;
  3472. _this.obfuscationEventEmitter = obfuscationEventEmitter;
  3473. return _this;
  3474. }
  3475. _createClass(SelfDefendingCustomNodeGroup, [{
  3476. key: "appendCustomNodes",
  3477. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  3478. var randomStackTraceIndex = this.getRandomStackTraceIndex(stackTraceData.length);
  3479. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.SelfDefendingUnicodeNode, function (customNode) {
  3480. NodeAppender_1.NodeAppender.appendNodeToOptimalBlockScope(stackTraceData, blockScopeNode, customNode.getNode(), randomStackTraceIndex);
  3481. });
  3482. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, function (customNode) {
  3483. var targetBlockScope = void 0;
  3484. if (stackTraceData.length) {
  3485. targetBlockScope = NodeAppender_1.NodeAppender.getOptimalBlockScope(stackTraceData, randomStackTraceIndex, 1);
  3486. } else {
  3487. targetBlockScope = blockScopeNode;
  3488. }
  3489. NodeAppender_1.NodeAppender.prependNode(targetBlockScope, customNode.getNode());
  3490. });
  3491. }
  3492. }, {
  3493. key: "initialize",
  3494. value: function initialize() {
  3495. this.customNodes = new Map();
  3496. if (!this.options.selfDefending) {
  3497. return;
  3498. }
  3499. var callsControllerFunctionName = this.randomGenerator.getRandomVariableName(6);
  3500. var selfDefendingUnicodeNode = this.customNodeFactory(CustomNode_1.CustomNode.SelfDefendingUnicodeNode);
  3501. var nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3502. selfDefendingUnicodeNode.initialize(callsControllerFunctionName);
  3503. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  3504. this.customNodes.set(CustomNode_1.CustomNode.SelfDefendingUnicodeNode, selfDefendingUnicodeNode);
  3505. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  3506. }
  3507. }]);
  3508. return SelfDefendingCustomNodeGroup;
  3509. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  3510. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], SelfDefendingCustomNodeGroup.prototype, "customNodes", void 0);
  3511. SelfDefendingCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object])], SelfDefendingCustomNodeGroup);
  3512. exports.SelfDefendingCustomNodeGroup = SelfDefendingCustomNodeGroup;
  3513. /***/ }),
  3514. /* 68 */
  3515. /***/ (function(module, exports, __webpack_require__) {
  3516. "use strict";
  3517. 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; }; })();
  3518. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3519. 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; }
  3520. 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; }
  3521. Object.defineProperty(exports, "__esModule", { value: true });
  3522. var tslib_1 = __webpack_require__(2);
  3523. var inversify_1 = __webpack_require__(0);
  3524. var ServiceIdentifiers_1 = __webpack_require__(1);
  3525. var Initializable_1 = __webpack_require__(3);
  3526. var CustomNode_1 = __webpack_require__(20);
  3527. var ObfuscationEvent_1 = __webpack_require__(15);
  3528. var AbstractCustomNodeGroup_1 = __webpack_require__(22);
  3529. var NodeAppender_1 = __webpack_require__(19);
  3530. var Utils_1 = __webpack_require__(16);
  3531. var StringArrayCustomNodeGroup = function (_AbstractCustomNodeGr) {
  3532. _inherits(StringArrayCustomNodeGroup, _AbstractCustomNodeGr);
  3533. function StringArrayCustomNodeGroup(customNodeFactory, obfuscationEventEmitter, randomGenerator, stringArrayStorage, options) {
  3534. _classCallCheck(this, StringArrayCustomNodeGroup);
  3535. var _this = _possibleConstructorReturn(this, (StringArrayCustomNodeGroup.__proto__ || Object.getPrototypeOf(StringArrayCustomNodeGroup)).call(this, randomGenerator, options));
  3536. _this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation;
  3537. _this.customNodeFactory = customNodeFactory;
  3538. _this.obfuscationEventEmitter = obfuscationEventEmitter;
  3539. _this.stringArrayStorage = stringArrayStorage;
  3540. return _this;
  3541. }
  3542. _createClass(StringArrayCustomNodeGroup, [{
  3543. key: "appendCustomNodes",
  3544. value: function appendCustomNodes(blockScopeNode, stackTraceData) {
  3545. if (!this.stringArrayStorage.getLength()) {
  3546. return;
  3547. }
  3548. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayNode, function (customNode) {
  3549. NodeAppender_1.NodeAppender.prependNode(blockScopeNode, customNode.getNode());
  3550. });
  3551. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayCallsWrapper, function (customNode) {
  3552. NodeAppender_1.NodeAppender.insertNodeAtIndex(blockScopeNode, customNode.getNode(), 1);
  3553. });
  3554. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayRotateFunctionNode, function (customNode) {
  3555. NodeAppender_1.NodeAppender.insertNodeAtIndex(blockScopeNode, customNode.getNode(), 1);
  3556. });
  3557. }
  3558. }, {
  3559. key: "initialize",
  3560. value: function initialize() {
  3561. this.customNodes = new Map();
  3562. if (!this.options.stringArray) {
  3563. return;
  3564. }
  3565. var stringArrayNode = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayNode);
  3566. var stringArrayCallsWrapper = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayCallsWrapper);
  3567. var stringArrayRotateFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayRotateFunctionNode);
  3568. var stringArrayStorageId = this.stringArrayStorage.getStorageId();
  3569. var stringArrayName = "_" + Utils_1.Utils.hexadecimalPrefix + stringArrayStorageId;
  3570. var stringArrayCallsWrapperName = "_" + Utils_1.Utils.hexadecimalPrefix + Utils_1.Utils.stringRotate(stringArrayStorageId, 1);
  3571. var stringArrayRotateValue = void 0;
  3572. if (this.options.rotateStringArray) {
  3573. stringArrayRotateValue = this.randomGenerator.getRandomInteger(100, 500);
  3574. } else {
  3575. stringArrayRotateValue = 0;
  3576. }
  3577. stringArrayNode.initialize(this.stringArrayStorage, stringArrayName, stringArrayRotateValue);
  3578. stringArrayCallsWrapper.initialize(this.stringArrayStorage, stringArrayName, stringArrayCallsWrapperName);
  3579. stringArrayRotateFunctionNode.initialize(this.stringArrayStorage, stringArrayName, stringArrayRotateValue);
  3580. this.customNodes.set(CustomNode_1.CustomNode.StringArrayNode, stringArrayNode);
  3581. this.customNodes.set(CustomNode_1.CustomNode.StringArrayCallsWrapper, stringArrayCallsWrapper);
  3582. if (this.options.rotateStringArray) {
  3583. this.customNodes.set(CustomNode_1.CustomNode.StringArrayRotateFunctionNode, stringArrayRotateFunctionNode);
  3584. }
  3585. }
  3586. }]);
  3587. return StringArrayCustomNodeGroup;
  3588. }(AbstractCustomNodeGroup_1.AbstractCustomNodeGroup);
  3589. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Map)], StringArrayCustomNodeGroup.prototype, "customNodes", void 0);
  3590. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], StringArrayCustomNodeGroup.prototype, "stringArrayStorage", void 0);
  3591. StringArrayCustomNodeGroup = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.TStringArrayStorage)), tslib_1.__param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object, Object, Object])], StringArrayCustomNodeGroup);
  3592. exports.StringArrayCustomNodeGroup = StringArrayCustomNodeGroup;
  3593. /***/ }),
  3594. /* 69 */
  3595. /***/ (function(module, exports, __webpack_require__) {
  3596. "use strict";
  3597. Object.defineProperty(exports, "__esModule", { value: true });
  3598. var JSFuck;
  3599. (function (JSFuck) {
  3600. JSFuck["False"] = "![]";
  3601. JSFuck["True"] = "!![]";
  3602. JSFuck["a"] = "(false+\"\")[1]";
  3603. JSFuck["b"] = "([][\"entries\"]()+\"\")[2]";
  3604. JSFuck["c"] = "([][\"fill\"]+\"\")[3]";
  3605. JSFuck["d"] = "(undefined+\"\")[2]";
  3606. JSFuck["e"] = "(true+\"\")[3]";
  3607. JSFuck["f"] = "(false+\"\")[0]";
  3608. JSFuck["g"] = "(false+[0]+String)[20]";
  3609. JSFuck["h"] = "(+(101))[\"toString\"](21)[1]";
  3610. JSFuck["i"] = "([false]+undefined)[10]";
  3611. JSFuck["j"] = "([][\"entries\"]()+\"\")[3]";
  3612. JSFuck["k"] = "(+(20))[\"toString\"](21)";
  3613. JSFuck["l"] = "(false+\"\")[2]";
  3614. JSFuck["m"] = "(Number+\"\")[11]";
  3615. JSFuck["n"] = "(undefined+\"\")[1]";
  3616. JSFuck["o"] = "(true+[][\"fill\"])[10]";
  3617. JSFuck["p"] = "(+(211))[\"toString\"](31)[1]";
  3618. JSFuck["q"] = "(+(212))[\"toString\"](31)[1]";
  3619. JSFuck["r"] = "(true+\"\")[1]";
  3620. JSFuck["s"] = "(false+\"\")[3]";
  3621. JSFuck["t"] = "(true+\"\")[0]";
  3622. JSFuck["u"] = "(undefined+\"\")[0]";
  3623. JSFuck["v"] = "(+(31))[\"toString\"](32)";
  3624. JSFuck["w"] = "(+(32))[\"toString\"](33)";
  3625. JSFuck["x"] = "(+(101))[\"toString\"](34)[1]";
  3626. JSFuck["y"] = "(NaN+[Infinity])[10]";
  3627. JSFuck["z"] = "(+(35))[\"toString\"](36)";
  3628. JSFuck["A"] = "(+[]+Array)[10]";
  3629. JSFuck["B"] = "(+[]+Boolean)[10]";
  3630. JSFuck["C"] = "Function(\"return escape\")()((\"\")[\"italics\"]())[2]";
  3631. JSFuck["D"] = "Function(\"return escape\")()([][\"fill\"])[\"slice\"](\"-1\")";
  3632. JSFuck["E"] = "(RegExp+\"\")[12]";
  3633. JSFuck["F"] = "(+[]+Function)[10]";
  3634. JSFuck["G"] = "(false+Function(\"return Date\")()())[30]";
  3635. JSFuck["H"] = "'H'";
  3636. JSFuck["I"] = "(Infinity+\"\")[0]";
  3637. JSFuck["J"] = "'J'";
  3638. JSFuck["K"] = "'K'";
  3639. JSFuck["L"] = "'L'";
  3640. JSFuck["M"] = "(true+Function(\"return Date\")()())[30]";
  3641. JSFuck["N"] = "(NaN+\"\")[0]";
  3642. JSFuck["O"] = "(NaN+Function(\"return{}\")())[11]";
  3643. JSFuck["P"] = "'P'";
  3644. JSFuck["Q"] = "'Q'";
  3645. JSFuck["R"] = "(+[]+RegExp)[10]";
  3646. JSFuck["S"] = "(+[]+String)[10]";
  3647. JSFuck["T"] = "(NaN+Function(\"return Date\")()())[30]";
  3648. JSFuck["U"] = "(NaN+Function(\"return{}\")()[\"toString\"][\"call\"]())[11]";
  3649. JSFuck["V"] = "'V'";
  3650. JSFuck["W"] = "'W'";
  3651. JSFuck["X"] = "'X'";
  3652. JSFuck["Y"] = "'Y'";
  3653. JSFuck["Z"] = "'Z'";
  3654. })(JSFuck = exports.JSFuck || (exports.JSFuck = {}));
  3655. /***/ }),
  3656. /* 70 */
  3657. /***/ (function(module, exports, __webpack_require__) {
  3658. "use strict";
  3659. 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; }; })();
  3660. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3661. 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; }
  3662. 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; }
  3663. Object.defineProperty(exports, "__esModule", { value: true });
  3664. var tslib_1 = __webpack_require__(2);
  3665. var inversify_1 = __webpack_require__(0);
  3666. var ServiceIdentifiers_1 = __webpack_require__(1);
  3667. var Initializable_1 = __webpack_require__(3);
  3668. var AbstractCustomNode_1 = __webpack_require__(6);
  3669. var Nodes_1 = __webpack_require__(9);
  3670. var NodeUtils_1 = __webpack_require__(4);
  3671. var BinaryExpressionFunctionNode = function (_AbstractCustomNode_) {
  3672. _inherits(BinaryExpressionFunctionNode, _AbstractCustomNode_);
  3673. function BinaryExpressionFunctionNode(randomGenerator, options) {
  3674. _classCallCheck(this, BinaryExpressionFunctionNode);
  3675. return _possibleConstructorReturn(this, (BinaryExpressionFunctionNode.__proto__ || Object.getPrototypeOf(BinaryExpressionFunctionNode)).call(this, randomGenerator, options));
  3676. }
  3677. _createClass(BinaryExpressionFunctionNode, [{
  3678. key: "initialize",
  3679. value: function initialize(operator) {
  3680. this.operator = operator;
  3681. }
  3682. }, {
  3683. key: "getNodeStructure",
  3684. value: function getNodeStructure() {
  3685. var structure = Nodes_1.Nodes.getFunctionDeclarationNode(this.randomGenerator.getRandomString(3), [Nodes_1.Nodes.getIdentifierNode('x'), Nodes_1.Nodes.getIdentifierNode('y')], Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getReturnStatementNode(Nodes_1.Nodes.getBinaryExpressionNode(this.operator, Nodes_1.Nodes.getIdentifierNode('x'), Nodes_1.Nodes.getIdentifierNode('y')))]));
  3686. NodeUtils_1.NodeUtils.parentize(structure);
  3687. return [structure];
  3688. }
  3689. }]);
  3690. return BinaryExpressionFunctionNode;
  3691. }(AbstractCustomNode_1.AbstractCustomNode);
  3692. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], BinaryExpressionFunctionNode.prototype, "operator", void 0);
  3693. BinaryExpressionFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], BinaryExpressionFunctionNode);
  3694. exports.BinaryExpressionFunctionNode = BinaryExpressionFunctionNode;
  3695. /***/ }),
  3696. /* 71 */
  3697. /***/ (function(module, exports, __webpack_require__) {
  3698. "use strict";
  3699. Object.defineProperty(exports, "__esModule", { value: true });
  3700. function GlobalVariableTemplate1() {
  3701. return "\n var that;\n \n try { \n var getGlobal = Function('return (function() ' + '{}.constructor(\"return this\")( )' + ');');\n \n that = getGlobal(); \n } catch (e) { \n that = window; \n }\n ";
  3702. }
  3703. exports.GlobalVariableTemplate1 = GlobalVariableTemplate1;
  3704. /***/ }),
  3705. /* 72 */
  3706. /***/ (function(module, exports, __webpack_require__) {
  3707. "use strict";
  3708. Object.defineProperty(exports, "__esModule", { value: true });
  3709. function GlobalVariableTemplate2() {
  3710. return "\n var getGlobal = function () {\n var globalObject;\n \n try { \n globalObject = Function('return (function() ' + '{}.constructor(\"return this\")( )' + ');')(); \n } catch (e) { \n globalObject = window; \n }\n \n return globalObject;\n };\n var that = getGlobal();\n ";
  3711. }
  3712. exports.GlobalVariableTemplate2 = GlobalVariableTemplate2;
  3713. /***/ }),
  3714. /* 73 */
  3715. /***/ (function(module, exports, __webpack_require__) {
  3716. "use strict";
  3717. 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; }; })();
  3718. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3719. 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; }
  3720. 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; }
  3721. Object.defineProperty(exports, "__esModule", { value: true });
  3722. var tslib_1 = __webpack_require__(2);
  3723. var inversify_1 = __webpack_require__(0);
  3724. var ServiceIdentifiers_1 = __webpack_require__(1);
  3725. var Initializable_1 = __webpack_require__(3);
  3726. var AbstractCustomNode_1 = __webpack_require__(6);
  3727. var Nodes_1 = __webpack_require__(9);
  3728. var NodeUtils_1 = __webpack_require__(4);
  3729. var BlockStatementControlFlowFlatteningNode = function (_AbstractCustomNode_) {
  3730. _inherits(BlockStatementControlFlowFlatteningNode, _AbstractCustomNode_);
  3731. function BlockStatementControlFlowFlatteningNode(randomGenerator, options) {
  3732. _classCallCheck(this, BlockStatementControlFlowFlatteningNode);
  3733. return _possibleConstructorReturn(this, (BlockStatementControlFlowFlatteningNode.__proto__ || Object.getPrototypeOf(BlockStatementControlFlowFlatteningNode)).call(this, randomGenerator, options));
  3734. }
  3735. _createClass(BlockStatementControlFlowFlatteningNode, [{
  3736. key: "initialize",
  3737. value: function initialize(blockStatementBody, shuffledKeys, originalKeysIndexesInShuffledArray) {
  3738. this.blockStatementBody = blockStatementBody;
  3739. this.shuffledKeys = shuffledKeys;
  3740. this.originalKeysIndexesInShuffledArray = originalKeysIndexesInShuffledArray;
  3741. }
  3742. }, {
  3743. key: "getNodeStructure",
  3744. value: function getNodeStructure() {
  3745. var _this2 = this;
  3746. var controllerIdentifierName = this.randomGenerator.getRandomString(6);
  3747. var indexIdentifierName = this.randomGenerator.getRandomString(6);
  3748. var structure = Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getVariableDeclarationNode([Nodes_1.Nodes.getVariableDeclaratorNode(Nodes_1.Nodes.getIdentifierNode(controllerIdentifierName), Nodes_1.Nodes.getCallExpressionNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getLiteralNode(this.originalKeysIndexesInShuffledArray.join('|')), Nodes_1.Nodes.getIdentifierNode('split')), [Nodes_1.Nodes.getLiteralNode('|')])), Nodes_1.Nodes.getVariableDeclaratorNode(Nodes_1.Nodes.getIdentifierNode(indexIdentifierName), Nodes_1.Nodes.getLiteralNode(0))]), Nodes_1.Nodes.getWhileStatementNode(Nodes_1.Nodes.getLiteralNode(true), Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getSwitchStatementNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getIdentifierNode(controllerIdentifierName), Nodes_1.Nodes.getUpdateExpressionNode('++', Nodes_1.Nodes.getIdentifierNode(indexIdentifierName)), true), this.shuffledKeys.map(function (key, index) {
  3749. return Nodes_1.Nodes.getSwitchCaseNode(Nodes_1.Nodes.getLiteralNode(String(index)), [_this2.blockStatementBody[key], Nodes_1.Nodes.getContinueStatement()]);
  3750. })), Nodes_1.Nodes.getBreakStatement()]))]);
  3751. NodeUtils_1.NodeUtils.parentize(structure);
  3752. return [structure];
  3753. }
  3754. }]);
  3755. return BlockStatementControlFlowFlatteningNode;
  3756. }(AbstractCustomNode_1.AbstractCustomNode);
  3757. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], BlockStatementControlFlowFlatteningNode.prototype, "blockStatementBody", void 0);
  3758. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], BlockStatementControlFlowFlatteningNode.prototype, "originalKeysIndexesInShuffledArray", void 0);
  3759. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], BlockStatementControlFlowFlatteningNode.prototype, "shuffledKeys", void 0);
  3760. BlockStatementControlFlowFlatteningNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], BlockStatementControlFlowFlatteningNode);
  3761. exports.BlockStatementControlFlowFlatteningNode = BlockStatementControlFlowFlatteningNode;
  3762. /***/ }),
  3763. /* 74 */
  3764. /***/ (function(module, exports, __webpack_require__) {
  3765. "use strict";
  3766. 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; }; })();
  3767. 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); } }
  3768. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3769. 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; }
  3770. 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; }
  3771. Object.defineProperty(exports, "__esModule", { value: true });
  3772. var tslib_1 = __webpack_require__(2);
  3773. var inversify_1 = __webpack_require__(0);
  3774. var ServiceIdentifiers_1 = __webpack_require__(1);
  3775. var Initializable_1 = __webpack_require__(3);
  3776. var AbstractCustomNode_1 = __webpack_require__(6);
  3777. var Nodes_1 = __webpack_require__(9);
  3778. var NodeUtils_1 = __webpack_require__(4);
  3779. var CallExpressionControlFlowStorageCallNode = function (_AbstractCustomNode_) {
  3780. _inherits(CallExpressionControlFlowStorageCallNode, _AbstractCustomNode_);
  3781. function CallExpressionControlFlowStorageCallNode(randomGenerator, options) {
  3782. _classCallCheck(this, CallExpressionControlFlowStorageCallNode);
  3783. return _possibleConstructorReturn(this, (CallExpressionControlFlowStorageCallNode.__proto__ || Object.getPrototypeOf(CallExpressionControlFlowStorageCallNode)).call(this, randomGenerator, options));
  3784. }
  3785. _createClass(CallExpressionControlFlowStorageCallNode, [{
  3786. key: "initialize",
  3787. value: function initialize(controlFlowStorageName, controlFlowStorageKey, callee, expressionArguments) {
  3788. this.controlFlowStorageName = controlFlowStorageName;
  3789. this.controlFlowStorageKey = controlFlowStorageKey;
  3790. this.callee = callee;
  3791. this.expressionArguments = expressionArguments;
  3792. }
  3793. }, {
  3794. key: "getNodeStructure",
  3795. value: function getNodeStructure() {
  3796. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getCallExpressionNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageName), Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageKey)), [this.callee].concat(_toConsumableArray(this.expressionArguments))));
  3797. NodeUtils_1.NodeUtils.parentize(structure);
  3798. return [structure];
  3799. }
  3800. }]);
  3801. return CallExpressionControlFlowStorageCallNode;
  3802. }(AbstractCustomNode_1.AbstractCustomNode);
  3803. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], CallExpressionControlFlowStorageCallNode.prototype, "callee", void 0);
  3804. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], CallExpressionControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  3805. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], CallExpressionControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  3806. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], CallExpressionControlFlowStorageCallNode.prototype, "expressionArguments", void 0);
  3807. CallExpressionControlFlowStorageCallNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], CallExpressionControlFlowStorageCallNode);
  3808. exports.CallExpressionControlFlowStorageCallNode = CallExpressionControlFlowStorageCallNode;
  3809. /***/ }),
  3810. /* 75 */
  3811. /***/ (function(module, exports, __webpack_require__) {
  3812. "use strict";
  3813. 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; }; })();
  3814. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3815. 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; }
  3816. 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; }
  3817. Object.defineProperty(exports, "__esModule", { value: true });
  3818. var tslib_1 = __webpack_require__(2);
  3819. var inversify_1 = __webpack_require__(0);
  3820. var ServiceIdentifiers_1 = __webpack_require__(1);
  3821. var Initializable_1 = __webpack_require__(3);
  3822. var AbstractCustomNode_1 = __webpack_require__(6);
  3823. var Nodes_1 = __webpack_require__(9);
  3824. var NodeUtils_1 = __webpack_require__(4);
  3825. var CallExpressionFunctionNode = function (_AbstractCustomNode_) {
  3826. _inherits(CallExpressionFunctionNode, _AbstractCustomNode_);
  3827. function CallExpressionFunctionNode(randomGenerator, options) {
  3828. _classCallCheck(this, CallExpressionFunctionNode);
  3829. return _possibleConstructorReturn(this, (CallExpressionFunctionNode.__proto__ || Object.getPrototypeOf(CallExpressionFunctionNode)).call(this, randomGenerator, options));
  3830. }
  3831. _createClass(CallExpressionFunctionNode, [{
  3832. key: "initialize",
  3833. value: function initialize(expressionArguments) {
  3834. this.expressionArguments = expressionArguments;
  3835. }
  3836. }, {
  3837. key: "getNodeStructure",
  3838. value: function getNodeStructure() {
  3839. var calleeIdentifier = Nodes_1.Nodes.getIdentifierNode('callee');
  3840. var params = [];
  3841. var argumentsLength = this.expressionArguments.length;
  3842. for (var i = 0; i < argumentsLength; i++) {
  3843. params.push(Nodes_1.Nodes.getIdentifierNode("param" + (i + 1)));
  3844. }
  3845. var structure = Nodes_1.Nodes.getFunctionDeclarationNode(this.randomGenerator.getRandomString(3), [calleeIdentifier].concat(params), Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getReturnStatementNode(Nodes_1.Nodes.getCallExpressionNode(calleeIdentifier, params))]));
  3846. NodeUtils_1.NodeUtils.parentize(structure);
  3847. return [structure];
  3848. }
  3849. }]);
  3850. return CallExpressionFunctionNode;
  3851. }(AbstractCustomNode_1.AbstractCustomNode);
  3852. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], CallExpressionFunctionNode.prototype, "expressionArguments", void 0);
  3853. CallExpressionFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], CallExpressionFunctionNode);
  3854. exports.CallExpressionFunctionNode = CallExpressionFunctionNode;
  3855. /***/ }),
  3856. /* 76 */
  3857. /***/ (function(module, exports, __webpack_require__) {
  3858. "use strict";
  3859. 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"); } }; })();
  3860. 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; }; })();
  3861. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3862. 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; }
  3863. 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; }
  3864. Object.defineProperty(exports, "__esModule", { value: true });
  3865. var tslib_1 = __webpack_require__(2);
  3866. var inversify_1 = __webpack_require__(0);
  3867. var ServiceIdentifiers_1 = __webpack_require__(1);
  3868. var Initializable_1 = __webpack_require__(3);
  3869. var AbstractCustomNode_1 = __webpack_require__(6);
  3870. var Nodes_1 = __webpack_require__(9);
  3871. var NodeUtils_1 = __webpack_require__(4);
  3872. var ControlFlowStorageNode = function (_AbstractCustomNode_) {
  3873. _inherits(ControlFlowStorageNode, _AbstractCustomNode_);
  3874. function ControlFlowStorageNode(randomGenerator, options) {
  3875. _classCallCheck(this, ControlFlowStorageNode);
  3876. return _possibleConstructorReturn(this, (ControlFlowStorageNode.__proto__ || Object.getPrototypeOf(ControlFlowStorageNode)).call(this, randomGenerator, options));
  3877. }
  3878. _createClass(ControlFlowStorageNode, [{
  3879. key: "initialize",
  3880. value: function initialize(controlFlowStorage) {
  3881. this.controlFlowStorage = controlFlowStorage;
  3882. }
  3883. }, {
  3884. key: "getNodeStructure",
  3885. value: function getNodeStructure() {
  3886. var structure = Nodes_1.Nodes.getVariableDeclarationNode([Nodes_1.Nodes.getVariableDeclaratorNode(Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorage.getStorageId()), Nodes_1.Nodes.getObjectExpressionNode(Array.from(this.controlFlowStorage.getStorage()).map(function (_ref) {
  3887. var _ref2 = _slicedToArray(_ref, 2),
  3888. key = _ref2[0],
  3889. value = _ref2[1];
  3890. return Nodes_1.Nodes.getPropertyNode(Nodes_1.Nodes.getIdentifierNode(key), value.getNode()[0]);
  3891. })))]);
  3892. structure = NodeUtils_1.NodeUtils.parentize(structure);
  3893. return [structure];
  3894. }
  3895. }]);
  3896. return ControlFlowStorageNode;
  3897. }(AbstractCustomNode_1.AbstractCustomNode);
  3898. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], ControlFlowStorageNode.prototype, "controlFlowStorage", void 0);
  3899. ControlFlowStorageNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], ControlFlowStorageNode);
  3900. exports.ControlFlowStorageNode = ControlFlowStorageNode;
  3901. /***/ }),
  3902. /* 77 */
  3903. /***/ (function(module, exports, __webpack_require__) {
  3904. "use strict";
  3905. 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; }; })();
  3906. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3907. 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; }
  3908. 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; }
  3909. Object.defineProperty(exports, "__esModule", { value: true });
  3910. var tslib_1 = __webpack_require__(2);
  3911. var inversify_1 = __webpack_require__(0);
  3912. var ServiceIdentifiers_1 = __webpack_require__(1);
  3913. var format = __webpack_require__(11);
  3914. var ObfuscationTarget_1 = __webpack_require__(13);
  3915. var ConsoleOutputDisableExpressionTemplate_1 = __webpack_require__(78);
  3916. var GlobalVariableNoEvalTemplate_1 = __webpack_require__(30);
  3917. var Initializable_1 = __webpack_require__(3);
  3918. var AbstractCustomNode_1 = __webpack_require__(6);
  3919. var NodeUtils_1 = __webpack_require__(4);
  3920. var ConsoleOutputDisableExpressionNode = function (_AbstractCustomNode_) {
  3921. _inherits(ConsoleOutputDisableExpressionNode, _AbstractCustomNode_);
  3922. function ConsoleOutputDisableExpressionNode(randomGenerator, options) {
  3923. _classCallCheck(this, ConsoleOutputDisableExpressionNode);
  3924. return _possibleConstructorReturn(this, (ConsoleOutputDisableExpressionNode.__proto__ || Object.getPrototypeOf(ConsoleOutputDisableExpressionNode)).call(this, randomGenerator, options));
  3925. }
  3926. _createClass(ConsoleOutputDisableExpressionNode, [{
  3927. key: "initialize",
  3928. value: function initialize(callsControllerFunctionName) {
  3929. this.callsControllerFunctionName = callsControllerFunctionName;
  3930. }
  3931. }, {
  3932. key: "getNodeStructure",
  3933. value: function getNodeStructure() {
  3934. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  3935. }
  3936. }, {
  3937. key: "getTemplate",
  3938. value: function getTemplate() {
  3939. var globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? this.getGlobalVariableTemplate() : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  3940. return format(ConsoleOutputDisableExpressionTemplate_1.ConsoleOutputDisableExpressionTemplate(), {
  3941. consoleLogDisableFunctionName: this.randomGenerator.getRandomVariableName(6),
  3942. globalVariableTemplate: globalVariableTemplate,
  3943. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  3944. });
  3945. }
  3946. }]);
  3947. return ConsoleOutputDisableExpressionNode;
  3948. }(AbstractCustomNode_1.AbstractCustomNode);
  3949. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ConsoleOutputDisableExpressionNode.prototype, "callsControllerFunctionName", void 0);
  3950. ConsoleOutputDisableExpressionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], ConsoleOutputDisableExpressionNode);
  3951. exports.ConsoleOutputDisableExpressionNode = ConsoleOutputDisableExpressionNode;
  3952. /***/ }),
  3953. /* 78 */
  3954. /***/ (function(module, exports, __webpack_require__) {
  3955. "use strict";
  3956. Object.defineProperty(exports, "__esModule", { value: true });
  3957. function ConsoleOutputDisableExpressionTemplate() {
  3958. return "\n var {consoleLogDisableFunctionName} = {singleNodeCallControllerFunctionName}(this, function () { \n var func = function () {};\n \n {globalVariableTemplate}\n \n if (!that.console) {\n that.console = (function (func){ \n var c = {}; \n \n c.log = func;\n c.warn = func; \n c.debug = func;\n c.info = func;\n c.error = func;\n c.exception = func;\n c.trace = func;\n \n return c; \n })(func);\n } else {\n that.console.log = func;\n that.console.warn = func; \n that.console.debug = func;\n that.console.info = func;\n that.console.error = func;\n that.console.exception = func;\n that.console.trace = func;\n }\n });\n \n {consoleLogDisableFunctionName}();\n ";
  3959. }
  3960. exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate;
  3961. /***/ }),
  3962. /* 79 */
  3963. /***/ (function(module, exports, __webpack_require__) {
  3964. "use strict";
  3965. 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; }; })();
  3966. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3967. 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; }
  3968. 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; }
  3969. Object.defineProperty(exports, "__esModule", { value: true });
  3970. var tslib_1 = __webpack_require__(2);
  3971. var inversify_1 = __webpack_require__(0);
  3972. var ServiceIdentifiers_1 = __webpack_require__(1);
  3973. var format = __webpack_require__(11);
  3974. var Initializable_1 = __webpack_require__(3);
  3975. var DebufProtectionFunctionCallTemplate_1 = __webpack_require__(80);
  3976. var AbstractCustomNode_1 = __webpack_require__(6);
  3977. var NodeUtils_1 = __webpack_require__(4);
  3978. var DebugProtectionFunctionCallNode = function (_AbstractCustomNode_) {
  3979. _inherits(DebugProtectionFunctionCallNode, _AbstractCustomNode_);
  3980. function DebugProtectionFunctionCallNode(randomGenerator, options) {
  3981. _classCallCheck(this, DebugProtectionFunctionCallNode);
  3982. return _possibleConstructorReturn(this, (DebugProtectionFunctionCallNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionCallNode)).call(this, randomGenerator, options));
  3983. }
  3984. _createClass(DebugProtectionFunctionCallNode, [{
  3985. key: "initialize",
  3986. value: function initialize(debugProtectionFunctionName) {
  3987. this.debugProtectionFunctionName = debugProtectionFunctionName;
  3988. }
  3989. }, {
  3990. key: "getNodeStructure",
  3991. value: function getNodeStructure() {
  3992. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  3993. }
  3994. }, {
  3995. key: "getTemplate",
  3996. value: function getTemplate() {
  3997. return format(DebufProtectionFunctionCallTemplate_1.DebugProtectionFunctionCallTemplate(), {
  3998. debugProtectionFunctionName: this.debugProtectionFunctionName
  3999. });
  4000. }
  4001. }]);
  4002. return DebugProtectionFunctionCallNode;
  4003. }(AbstractCustomNode_1.AbstractCustomNode);
  4004. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionCallNode.prototype, "debugProtectionFunctionName", void 0);
  4005. DebugProtectionFunctionCallNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], DebugProtectionFunctionCallNode);
  4006. exports.DebugProtectionFunctionCallNode = DebugProtectionFunctionCallNode;
  4007. /***/ }),
  4008. /* 80 */
  4009. /***/ (function(module, exports, __webpack_require__) {
  4010. "use strict";
  4011. Object.defineProperty(exports, "__esModule", { value: true });
  4012. function DebugProtectionFunctionCallTemplate() {
  4013. return "\n (function () {\n var regExp1 = new RegExp('function *\\\\( *\\\\)');\n var regExp2 = new RegExp('\\\\+\\\\+ *_0x([a-f0-9]){4,6}');\n var result = {debugProtectionFunctionName}('init');\n \n if (!regExp1.test(result + 'chain') || !regExp2.test(result + 'input')) {\n result('0');\n } else {\n {debugProtectionFunctionName}();\n }\n })();\n ";
  4014. }
  4015. exports.DebugProtectionFunctionCallTemplate = DebugProtectionFunctionCallTemplate;
  4016. /***/ }),
  4017. /* 81 */
  4018. /***/ (function(module, exports, __webpack_require__) {
  4019. "use strict";
  4020. 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; }; })();
  4021. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4022. 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; }
  4023. 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; }
  4024. Object.defineProperty(exports, "__esModule", { value: true });
  4025. var tslib_1 = __webpack_require__(2);
  4026. var inversify_1 = __webpack_require__(0);
  4027. var ServiceIdentifiers_1 = __webpack_require__(1);
  4028. var format = __webpack_require__(11);
  4029. var Initializable_1 = __webpack_require__(3);
  4030. var DebugProtectionFunctionIntervalTemplate_1 = __webpack_require__(82);
  4031. var AbstractCustomNode_1 = __webpack_require__(6);
  4032. var NodeUtils_1 = __webpack_require__(4);
  4033. var DebugProtectionFunctionIntervalNode = function (_AbstractCustomNode_) {
  4034. _inherits(DebugProtectionFunctionIntervalNode, _AbstractCustomNode_);
  4035. function DebugProtectionFunctionIntervalNode(randomGenerator, options) {
  4036. _classCallCheck(this, DebugProtectionFunctionIntervalNode);
  4037. return _possibleConstructorReturn(this, (DebugProtectionFunctionIntervalNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionIntervalNode)).call(this, randomGenerator, options));
  4038. }
  4039. _createClass(DebugProtectionFunctionIntervalNode, [{
  4040. key: "initialize",
  4041. value: function initialize(debugProtectionFunctionName) {
  4042. this.debugProtectionFunctionName = debugProtectionFunctionName;
  4043. }
  4044. }, {
  4045. key: "getNodeStructure",
  4046. value: function getNodeStructure() {
  4047. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4048. }
  4049. }, {
  4050. key: "getTemplate",
  4051. value: function getTemplate() {
  4052. return format(DebugProtectionFunctionIntervalTemplate_1.DebugProtectionFunctionIntervalTemplate(), {
  4053. debugProtectionFunctionName: this.debugProtectionFunctionName
  4054. });
  4055. }
  4056. }]);
  4057. return DebugProtectionFunctionIntervalNode;
  4058. }(AbstractCustomNode_1.AbstractCustomNode);
  4059. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionIntervalNode.prototype, "debugProtectionFunctionName", void 0);
  4060. DebugProtectionFunctionIntervalNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], DebugProtectionFunctionIntervalNode);
  4061. exports.DebugProtectionFunctionIntervalNode = DebugProtectionFunctionIntervalNode;
  4062. /***/ }),
  4063. /* 82 */
  4064. /***/ (function(module, exports, __webpack_require__) {
  4065. "use strict";
  4066. Object.defineProperty(exports, "__esModule", { value: true });
  4067. function DebugProtectionFunctionIntervalTemplate() {
  4068. return "\n setInterval(function () {\n {debugProtectionFunctionName}();\n }, 4000);\n ";
  4069. }
  4070. exports.DebugProtectionFunctionIntervalTemplate = DebugProtectionFunctionIntervalTemplate;
  4071. /***/ }),
  4072. /* 83 */
  4073. /***/ (function(module, exports, __webpack_require__) {
  4074. "use strict";
  4075. 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; }; })();
  4076. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4077. 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; }
  4078. 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; }
  4079. Object.defineProperty(exports, "__esModule", { value: true });
  4080. var tslib_1 = __webpack_require__(2);
  4081. var inversify_1 = __webpack_require__(0);
  4082. var ServiceIdentifiers_1 = __webpack_require__(1);
  4083. var format = __webpack_require__(11);
  4084. var ObfuscationTarget_1 = __webpack_require__(13);
  4085. var Initializable_1 = __webpack_require__(3);
  4086. var DebuggerTemplate_1 = __webpack_require__(84);
  4087. var DebuggerTemplateNoEval_1 = __webpack_require__(85);
  4088. var DebugProtectionFunctionTemplate_1 = __webpack_require__(86);
  4089. var AbstractCustomNode_1 = __webpack_require__(6);
  4090. var NodeUtils_1 = __webpack_require__(4);
  4091. var DebugProtectionFunctionNode = function (_AbstractCustomNode_) {
  4092. _inherits(DebugProtectionFunctionNode, _AbstractCustomNode_);
  4093. function DebugProtectionFunctionNode(randomGenerator, options) {
  4094. _classCallCheck(this, DebugProtectionFunctionNode);
  4095. return _possibleConstructorReturn(this, (DebugProtectionFunctionNode.__proto__ || Object.getPrototypeOf(DebugProtectionFunctionNode)).call(this, randomGenerator, options));
  4096. }
  4097. _createClass(DebugProtectionFunctionNode, [{
  4098. key: "initialize",
  4099. value: function initialize(debugProtectionFunctionName) {
  4100. this.debugProtectionFunctionName = debugProtectionFunctionName;
  4101. }
  4102. }, {
  4103. key: "getNodeStructure",
  4104. value: function getNodeStructure() {
  4105. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4106. }
  4107. }, {
  4108. key: "getTemplate",
  4109. value: function getTemplate() {
  4110. var debuggerTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? DebuggerTemplate_1.DebuggerTemplate() : DebuggerTemplateNoEval_1.DebuggerTemplateNoEval();
  4111. return format(DebugProtectionFunctionTemplate_1.DebugProtectionFunctionTemplate(), {
  4112. debuggerTemplate: debuggerTemplate,
  4113. debugProtectionFunctionName: this.debugProtectionFunctionName
  4114. });
  4115. }
  4116. }]);
  4117. return DebugProtectionFunctionNode;
  4118. }(AbstractCustomNode_1.AbstractCustomNode);
  4119. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DebugProtectionFunctionNode.prototype, "debugProtectionFunctionName", void 0);
  4120. DebugProtectionFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], DebugProtectionFunctionNode);
  4121. exports.DebugProtectionFunctionNode = DebugProtectionFunctionNode;
  4122. /***/ }),
  4123. /* 84 */
  4124. /***/ (function(module, exports, __webpack_require__) {
  4125. "use strict";
  4126. Object.defineProperty(exports, "__esModule", { value: true });
  4127. function DebuggerTemplate() {
  4128. return " \n if (typeof counter === 'string') {\n return (function (arg) {}.constructor('while (true) {}').apply('counter'));\n } else {\n if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {\n (function () {return true;}.constructor('debu' + 'gger').call('action'));\n } else {\n (function () {return false;}.constructor('debu' + 'gger').apply('stateObject'));\n }\n \n }\n ";
  4129. }
  4130. exports.DebuggerTemplate = DebuggerTemplate;
  4131. /***/ }),
  4132. /* 85 */
  4133. /***/ (function(module, exports, __webpack_require__) {
  4134. "use strict";
  4135. Object.defineProperty(exports, "__esModule", { value: true });
  4136. function DebuggerTemplateNoEval() {
  4137. return " \n if (typeof counter === 'string') {\n var func = function () {\n while (true) {}\n };\n \n return func();\n } else {\n if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {\n debugger;\n } else {\n debugger;\n }\n \n }\n ";
  4138. }
  4139. exports.DebuggerTemplateNoEval = DebuggerTemplateNoEval;
  4140. /***/ }),
  4141. /* 86 */
  4142. /***/ (function(module, exports, __webpack_require__) {
  4143. "use strict";
  4144. Object.defineProperty(exports, "__esModule", { value: true });
  4145. function DebugProtectionFunctionTemplate() {
  4146. return " \n function {debugProtectionFunctionName} (ret) {\n function debuggerProtection (counter) {\n \n {debuggerTemplate}\n \n debuggerProtection(++counter);\n }\n \n try {\n if (ret) {\n return debuggerProtection;\n } else {\n debuggerProtection(0);\n }\n } catch (y) {}\n }\n ";
  4147. }
  4148. exports.DebugProtectionFunctionTemplate = DebugProtectionFunctionTemplate;
  4149. /***/ }),
  4150. /* 87 */
  4151. /***/ (function(module, exports, __webpack_require__) {
  4152. "use strict";
  4153. 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"); } }; })();
  4154. 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; }; })();
  4155. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4156. 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; }
  4157. 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; }
  4158. Object.defineProperty(exports, "__esModule", { value: true });
  4159. var tslib_1 = __webpack_require__(2);
  4160. var inversify_1 = __webpack_require__(0);
  4161. var ServiceIdentifiers_1 = __webpack_require__(1);
  4162. var format = __webpack_require__(11);
  4163. var ObfuscationTarget_1 = __webpack_require__(13);
  4164. var Initializable_1 = __webpack_require__(3);
  4165. var DomainLockNodeTemplate_1 = __webpack_require__(88);
  4166. var GlobalVariableNoEvalTemplate_1 = __webpack_require__(30);
  4167. var AbstractCustomNode_1 = __webpack_require__(6);
  4168. var NodeUtils_1 = __webpack_require__(4);
  4169. var DomainLockNode = function (_AbstractCustomNode_) {
  4170. _inherits(DomainLockNode, _AbstractCustomNode_);
  4171. function DomainLockNode(randomGenerator, cryptUtils, options) {
  4172. _classCallCheck(this, DomainLockNode);
  4173. var _this = _possibleConstructorReturn(this, (DomainLockNode.__proto__ || Object.getPrototypeOf(DomainLockNode)).call(this, randomGenerator, options));
  4174. _this.cryptUtils = cryptUtils;
  4175. return _this;
  4176. }
  4177. _createClass(DomainLockNode, [{
  4178. key: "initialize",
  4179. value: function initialize(callsControllerFunctionName) {
  4180. this.callsControllerFunctionName = callsControllerFunctionName;
  4181. }
  4182. }, {
  4183. key: "getNodeStructure",
  4184. value: function getNodeStructure() {
  4185. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4186. }
  4187. }, {
  4188. key: "getTemplate",
  4189. value: function getTemplate() {
  4190. var domainsString = this.options.domainLock.join(';');
  4191. var _cryptUtils$hideStrin = this.cryptUtils.hideString(domainsString, domainsString.length * 3),
  4192. _cryptUtils$hideStrin2 = _slicedToArray(_cryptUtils$hideStrin, 2),
  4193. hiddenDomainsString = _cryptUtils$hideStrin2[0],
  4194. diff = _cryptUtils$hideStrin2[1];
  4195. var globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? this.getGlobalVariableTemplate() : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  4196. return format(DomainLockNodeTemplate_1.DomainLockNodeTemplate(), {
  4197. domainLockFunctionName: this.randomGenerator.getRandomVariableName(6),
  4198. diff: diff,
  4199. domains: hiddenDomainsString,
  4200. globalVariableTemplate: globalVariableTemplate,
  4201. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4202. });
  4203. }
  4204. }]);
  4205. return DomainLockNode;
  4206. }(AbstractCustomNode_1.AbstractCustomNode);
  4207. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], DomainLockNode.prototype, "callsControllerFunctionName", void 0);
  4208. DomainLockNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object, Object])], DomainLockNode);
  4209. exports.DomainLockNode = DomainLockNode;
  4210. /***/ }),
  4211. /* 88 */
  4212. /***/ (function(module, exports, __webpack_require__) {
  4213. "use strict";
  4214. Object.defineProperty(exports, "__esModule", { value: true });
  4215. function DomainLockNodeTemplate() {
  4216. return "\n var {domainLockFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {\n \n {globalVariableTemplate}\n \n var func = function () { \n return {\n key: 'item',\n value: 'attribute',\n getAttribute: function () {\n for (var i = 0; i < 1000; i--) {\n var isPositive = i > 0;\n \n switch (isPositive) {\n case true:\n return this.item + '_' + this.value + '_' + i;\n default:\n this.item + '_' + this.value;\n }\n }\n }()\n };\n };\n \n var regExp = new RegExp(\"[{diff}]\", \"g\");\n var domains = \"{domains}\".replace(regExp, \"\").split(\";\");\n var document;\n var domain;\n \n for (var d in that) {\n if (d.length == 8 && d.charCodeAt(7) == 116 && d.charCodeAt(5) == 101 && d.charCodeAt(3) == 117 && d.charCodeAt(0) == 100) {\n document = d;\n \n break;\n }\n }\n\n for (var d1 in that[document]) {\n if (d1.length == 6 && d1.charCodeAt(5) == 110 && d1.charCodeAt(0) == 100) {\n domain = d1;\n \n break;\n }\n }\n \n if ((!document && !domain) || (!that[document] && !that[document][domain])) {\n return;\n }\n \n var currentDomain = that[document][domain];\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 data;\n } else {\n return;\n }\n \n func();\n });\n\n {domainLockFunctionName}();\n ";
  4217. }
  4218. exports.DomainLockNodeTemplate = DomainLockNodeTemplate;
  4219. /***/ }),
  4220. /* 89 */
  4221. /***/ (function(module, exports, __webpack_require__) {
  4222. "use strict";
  4223. 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; }; })();
  4224. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4225. 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; }
  4226. 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; }
  4227. Object.defineProperty(exports, "__esModule", { value: true });
  4228. var tslib_1 = __webpack_require__(2);
  4229. var inversify_1 = __webpack_require__(0);
  4230. var ServiceIdentifiers_1 = __webpack_require__(1);
  4231. var Initializable_1 = __webpack_require__(3);
  4232. var AbstractCustomNode_1 = __webpack_require__(6);
  4233. var Nodes_1 = __webpack_require__(9);
  4234. var NodeUtils_1 = __webpack_require__(4);
  4235. var ExpressionWithOperatorControlFlowStorageCallNode = function (_AbstractCustomNode_) {
  4236. _inherits(ExpressionWithOperatorControlFlowStorageCallNode, _AbstractCustomNode_);
  4237. function ExpressionWithOperatorControlFlowStorageCallNode(randomGenerator, options) {
  4238. _classCallCheck(this, ExpressionWithOperatorControlFlowStorageCallNode);
  4239. return _possibleConstructorReturn(this, (ExpressionWithOperatorControlFlowStorageCallNode.__proto__ || Object.getPrototypeOf(ExpressionWithOperatorControlFlowStorageCallNode)).call(this, randomGenerator, options));
  4240. }
  4241. _createClass(ExpressionWithOperatorControlFlowStorageCallNode, [{
  4242. key: "initialize",
  4243. value: function initialize(controlFlowStorageName, controlFlowStorageKey, leftValue, rightValue) {
  4244. this.controlFlowStorageName = controlFlowStorageName;
  4245. this.controlFlowStorageKey = controlFlowStorageKey;
  4246. this.leftValue = leftValue;
  4247. this.rightValue = rightValue;
  4248. }
  4249. }, {
  4250. key: "getNodeStructure",
  4251. value: function getNodeStructure() {
  4252. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getCallExpressionNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageName), Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageKey)), [this.leftValue, this.rightValue]));
  4253. NodeUtils_1.NodeUtils.parentize(structure);
  4254. return [structure];
  4255. }
  4256. }]);
  4257. return ExpressionWithOperatorControlFlowStorageCallNode;
  4258. }(AbstractCustomNode_1.AbstractCustomNode);
  4259. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  4260. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  4261. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "leftValue", void 0);
  4262. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "rightValue", void 0);
  4263. ExpressionWithOperatorControlFlowStorageCallNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], ExpressionWithOperatorControlFlowStorageCallNode);
  4264. exports.ExpressionWithOperatorControlFlowStorageCallNode = ExpressionWithOperatorControlFlowStorageCallNode;
  4265. /***/ }),
  4266. /* 90 */
  4267. /***/ (function(module, exports, __webpack_require__) {
  4268. "use strict";
  4269. 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; }; })();
  4270. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4271. 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; }
  4272. 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; }
  4273. Object.defineProperty(exports, "__esModule", { value: true });
  4274. var tslib_1 = __webpack_require__(2);
  4275. var inversify_1 = __webpack_require__(0);
  4276. var ServiceIdentifiers_1 = __webpack_require__(1);
  4277. var Initializable_1 = __webpack_require__(3);
  4278. var AbstractCustomNode_1 = __webpack_require__(6);
  4279. var Nodes_1 = __webpack_require__(9);
  4280. var NodeUtils_1 = __webpack_require__(4);
  4281. var LogicalExpressionFunctionNode = function (_AbstractCustomNode_) {
  4282. _inherits(LogicalExpressionFunctionNode, _AbstractCustomNode_);
  4283. function LogicalExpressionFunctionNode(randomGenerator, options) {
  4284. _classCallCheck(this, LogicalExpressionFunctionNode);
  4285. return _possibleConstructorReturn(this, (LogicalExpressionFunctionNode.__proto__ || Object.getPrototypeOf(LogicalExpressionFunctionNode)).call(this, randomGenerator, options));
  4286. }
  4287. _createClass(LogicalExpressionFunctionNode, [{
  4288. key: "initialize",
  4289. value: function initialize(operator) {
  4290. this.operator = operator;
  4291. }
  4292. }, {
  4293. key: "getNodeStructure",
  4294. value: function getNodeStructure() {
  4295. var structure = Nodes_1.Nodes.getFunctionDeclarationNode(this.randomGenerator.getRandomString(3), [Nodes_1.Nodes.getIdentifierNode('x'), Nodes_1.Nodes.getIdentifierNode('y')], Nodes_1.Nodes.getBlockStatementNode([Nodes_1.Nodes.getReturnStatementNode(Nodes_1.Nodes.getLogicalExpressionNode(this.operator, Nodes_1.Nodes.getIdentifierNode('x'), Nodes_1.Nodes.getIdentifierNode('y')))]));
  4296. NodeUtils_1.NodeUtils.parentize(structure);
  4297. return [structure];
  4298. }
  4299. }]);
  4300. return LogicalExpressionFunctionNode;
  4301. }(AbstractCustomNode_1.AbstractCustomNode);
  4302. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], LogicalExpressionFunctionNode.prototype, "operator", void 0);
  4303. LogicalExpressionFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], LogicalExpressionFunctionNode);
  4304. exports.LogicalExpressionFunctionNode = LogicalExpressionFunctionNode;
  4305. /***/ }),
  4306. /* 91 */
  4307. /***/ (function(module, exports, __webpack_require__) {
  4308. "use strict";
  4309. 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; }; })();
  4310. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4311. 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; }
  4312. 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; }
  4313. Object.defineProperty(exports, "__esModule", { value: true });
  4314. var tslib_1 = __webpack_require__(2);
  4315. var inversify_1 = __webpack_require__(0);
  4316. var ServiceIdentifiers_1 = __webpack_require__(1);
  4317. var format = __webpack_require__(11);
  4318. var ObfuscationEvent_1 = __webpack_require__(15);
  4319. var Initializable_1 = __webpack_require__(3);
  4320. var SingleNodeCallControllerTemplate_1 = __webpack_require__(92);
  4321. var NoCustomNodes_1 = __webpack_require__(25);
  4322. var AbstractCustomNode_1 = __webpack_require__(6);
  4323. var JavaScriptObfuscatorFacade_1 = __webpack_require__(18);
  4324. var NodeUtils_1 = __webpack_require__(4);
  4325. var NodeCallsControllerFunctionNode = function (_AbstractCustomNode_) {
  4326. _inherits(NodeCallsControllerFunctionNode, _AbstractCustomNode_);
  4327. function NodeCallsControllerFunctionNode(randomGenerator, options) {
  4328. _classCallCheck(this, NodeCallsControllerFunctionNode);
  4329. return _possibleConstructorReturn(this, (NodeCallsControllerFunctionNode.__proto__ || Object.getPrototypeOf(NodeCallsControllerFunctionNode)).call(this, randomGenerator, options));
  4330. }
  4331. _createClass(NodeCallsControllerFunctionNode, [{
  4332. key: "initialize",
  4333. value: function initialize(appendEvent, callsControllerFunctionName) {
  4334. this.appendEvent = appendEvent;
  4335. this.callsControllerFunctionName = callsControllerFunctionName;
  4336. }
  4337. }, {
  4338. key: "getNodeStructure",
  4339. value: function getNodeStructure() {
  4340. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4341. }
  4342. }, {
  4343. key: "getTemplate",
  4344. value: function getTemplate() {
  4345. if (this.appendEvent === ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation) {
  4346. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(format(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
  4347. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4348. }), Object.assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
  4349. }
  4350. return format(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
  4351. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4352. });
  4353. }
  4354. }]);
  4355. return NodeCallsControllerFunctionNode;
  4356. }(AbstractCustomNode_1.AbstractCustomNode);
  4357. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], NodeCallsControllerFunctionNode.prototype, "callsControllerFunctionName", void 0);
  4358. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], NodeCallsControllerFunctionNode.prototype, "appendEvent", void 0);
  4359. NodeCallsControllerFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], NodeCallsControllerFunctionNode);
  4360. exports.NodeCallsControllerFunctionNode = NodeCallsControllerFunctionNode;
  4361. /***/ }),
  4362. /* 92 */
  4363. /***/ (function(module, exports, __webpack_require__) {
  4364. "use strict";
  4365. Object.defineProperty(exports, "__esModule", { value: true });
  4366. function SingleNodeCallControllerTemplate() {
  4367. return "\n var {singleNodeCallControllerFunctionName} = (function(){\n var firstCall = true;\n \n return function (context, fn){\t\n var rfn = firstCall ? function(){\n if(fn){\n var res = fn.apply(context, arguments);\n fn = null;\n return res;\n }\n } : function(){}\n \n firstCall = false;\n \n return rfn;\n }\n })();\n ";
  4368. }
  4369. exports.SingleNodeCallControllerTemplate = SingleNodeCallControllerTemplate;
  4370. /***/ }),
  4371. /* 93 */
  4372. /***/ (function(module, exports, __webpack_require__) {
  4373. "use strict";
  4374. 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; }; })();
  4375. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4376. 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; }
  4377. 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; }
  4378. Object.defineProperty(exports, "__esModule", { value: true });
  4379. var tslib_1 = __webpack_require__(2);
  4380. var inversify_1 = __webpack_require__(0);
  4381. var ServiceIdentifiers_1 = __webpack_require__(1);
  4382. var format = __webpack_require__(11);
  4383. var Initializable_1 = __webpack_require__(3);
  4384. var NoCustomNodes_1 = __webpack_require__(25);
  4385. var SelfDefendingTemplate_1 = __webpack_require__(94);
  4386. var AbstractCustomNode_1 = __webpack_require__(6);
  4387. var JavaScriptObfuscatorFacade_1 = __webpack_require__(18);
  4388. var NodeUtils_1 = __webpack_require__(4);
  4389. var SelfDefendingUnicodeNode = function (_AbstractCustomNode_) {
  4390. _inherits(SelfDefendingUnicodeNode, _AbstractCustomNode_);
  4391. function SelfDefendingUnicodeNode(randomGenerator, escapeSequenceEncoder, options) {
  4392. _classCallCheck(this, SelfDefendingUnicodeNode);
  4393. var _this = _possibleConstructorReturn(this, (SelfDefendingUnicodeNode.__proto__ || Object.getPrototypeOf(SelfDefendingUnicodeNode)).call(this, randomGenerator, options));
  4394. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  4395. return _this;
  4396. }
  4397. _createClass(SelfDefendingUnicodeNode, [{
  4398. key: "initialize",
  4399. value: function initialize(callsControllerFunctionName) {
  4400. this.callsControllerFunctionName = callsControllerFunctionName;
  4401. }
  4402. }, {
  4403. key: "getNodeStructure",
  4404. value: function getNodeStructure() {
  4405. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4406. }
  4407. }, {
  4408. key: "getTemplate",
  4409. value: function getTemplate() {
  4410. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(format(SelfDefendingTemplate_1.SelfDefendingTemplate(this.escapeSequenceEncoder), {
  4411. selfDefendingFunctionName: this.randomGenerator.getRandomVariableName(6),
  4412. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  4413. }), Object.assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed, unicodeEscapeSequence: true })).getObfuscatedCode();
  4414. }
  4415. }]);
  4416. return SelfDefendingUnicodeNode;
  4417. }(AbstractCustomNode_1.AbstractCustomNode);
  4418. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], SelfDefendingUnicodeNode.prototype, "callsControllerFunctionName", void 0);
  4419. SelfDefendingUnicodeNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object, Object])], SelfDefendingUnicodeNode);
  4420. exports.SelfDefendingUnicodeNode = SelfDefendingUnicodeNode;
  4421. /***/ }),
  4422. /* 94 */
  4423. /***/ (function(module, exports, __webpack_require__) {
  4424. "use strict";
  4425. Object.defineProperty(exports, "__esModule", { value: true });
  4426. function SelfDefendingTemplate(escapeSequenceEncoder) {
  4427. return "\n var {selfDefendingFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {\n var func1 = function(){return 'dev';},\n func2 = function () {\n return 'window';\n };\n \n var test1 = function () {\n var regExp = new RegExp('" + escapeSequenceEncoder.encode("\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}", true) + "');\n \n return !regExp.test(func1.toString());\n };\n \n var test2 = function () {\n var regExp = new RegExp('" + escapeSequenceEncoder.encode("(\\\\[x|u](\\w){2,4})+", true) + "');\n \n return regExp.test(func2.toString());\n };\n \n var recursiveFunc1 = function (string) {\n var i = ~-1 >> 1 + 255 % 0;\n \n if (string.indexOf('i' === i)) {\n recursiveFunc2(string)\n }\n };\n \n var recursiveFunc2 = function (string) {\n var i = ~-4 >> 1 + 255 % 0;\n \n if (string.indexOf((true+\"\")[3]) !== i) {\n recursiveFunc1(string)\n }\n };\n \n if (!test1()) {\n if (!test2()) {\n recursiveFunc1('ind\u0435xOf');\n } else {\n recursiveFunc1('indexOf');\n }\n } else {\n recursiveFunc1('ind\u0435xOf');\n }\n })\n \n {selfDefendingFunctionName}();\n ";
  4428. }
  4429. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  4430. /***/ }),
  4431. /* 95 */
  4432. /***/ (function(module, exports, __webpack_require__) {
  4433. "use strict";
  4434. 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; }; })();
  4435. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4436. 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; }
  4437. 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; }
  4438. Object.defineProperty(exports, "__esModule", { value: true });
  4439. var tslib_1 = __webpack_require__(2);
  4440. var inversify_1 = __webpack_require__(0);
  4441. var ServiceIdentifiers_1 = __webpack_require__(1);
  4442. var format = __webpack_require__(11);
  4443. var ObfuscationTarget_1 = __webpack_require__(13);
  4444. var StringArrayEncoding_1 = __webpack_require__(24);
  4445. var Initializable_1 = __webpack_require__(3);
  4446. var NoCustomNodes_1 = __webpack_require__(25);
  4447. var AtobTemplate_1 = __webpack_require__(96);
  4448. var GlobalVariableNoEvalTemplate_1 = __webpack_require__(30);
  4449. var Rc4Template_1 = __webpack_require__(97);
  4450. var SelfDefendingTemplate_1 = __webpack_require__(98);
  4451. var StringArrayBase64DecodeNodeTemplate_1 = __webpack_require__(99);
  4452. var StringArrayCallsWrapperTemplate_1 = __webpack_require__(100);
  4453. var StringArrayRC4DecodeNodeTemplate_1 = __webpack_require__(101);
  4454. var AbstractCustomNode_1 = __webpack_require__(6);
  4455. var JavaScriptObfuscatorFacade_1 = __webpack_require__(18);
  4456. var NodeUtils_1 = __webpack_require__(4);
  4457. var StringArrayCallsWrapper = function (_AbstractCustomNode_) {
  4458. _inherits(StringArrayCallsWrapper, _AbstractCustomNode_);
  4459. function StringArrayCallsWrapper(randomGenerator, escapeSequenceEncoder, options) {
  4460. _classCallCheck(this, StringArrayCallsWrapper);
  4461. var _this = _possibleConstructorReturn(this, (StringArrayCallsWrapper.__proto__ || Object.getPrototypeOf(StringArrayCallsWrapper)).call(this, randomGenerator, options));
  4462. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  4463. return _this;
  4464. }
  4465. _createClass(StringArrayCallsWrapper, [{
  4466. key: "initialize",
  4467. value: function initialize(stringArrayStorage, stringArrayName, stringArrayCallsWrapperName) {
  4468. this.stringArrayStorage = stringArrayStorage;
  4469. this.stringArrayName = stringArrayName;
  4470. this.stringArrayCallsWrapperName = stringArrayCallsWrapperName;
  4471. }
  4472. }, {
  4473. key: "getNodeStructure",
  4474. value: function getNodeStructure() {
  4475. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4476. }
  4477. }, {
  4478. key: "getTemplate",
  4479. value: function getTemplate() {
  4480. var decodeNodeTemplate = this.getDecodeStringArrayTemplate();
  4481. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(format(StringArrayCallsWrapperTemplate_1.StringArrayCallsWrapperTemplate(), {
  4482. decodeNodeTemplate: decodeNodeTemplate,
  4483. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
  4484. stringArrayName: this.stringArrayName
  4485. }), Object.assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
  4486. }
  4487. }, {
  4488. key: "getDecodeStringArrayTemplate",
  4489. value: function getDecodeStringArrayTemplate() {
  4490. var globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.Extension ? this.getGlobalVariableTemplate() : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  4491. var atobPolyfill = format(AtobTemplate_1.AtobTemplate(), { globalVariableTemplate: globalVariableTemplate });
  4492. var decodeStringArrayTemplate = '',
  4493. selfDefendingCode = '';
  4494. if (this.options.selfDefending) {
  4495. selfDefendingCode = format(SelfDefendingTemplate_1.SelfDefendingTemplate(this.escapeSequenceEncoder), {
  4496. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
  4497. stringArrayName: this.stringArrayName
  4498. });
  4499. }
  4500. switch (this.options.stringArrayEncoding) {
  4501. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  4502. decodeStringArrayTemplate = format(StringArrayRC4DecodeNodeTemplate_1.StringArrayRc4DecodeNodeTemplate(), {
  4503. atobPolyfill: atobPolyfill,
  4504. rc4Polyfill: Rc4Template_1.Rc4Template(),
  4505. selfDefendingCode: selfDefendingCode,
  4506. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
  4507. });
  4508. break;
  4509. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  4510. decodeStringArrayTemplate = format(StringArrayBase64DecodeNodeTemplate_1.StringArrayBase64DecodeNodeTemplate(), {
  4511. atobPolyfill: atobPolyfill,
  4512. selfDefendingCode: selfDefendingCode,
  4513. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
  4514. });
  4515. break;
  4516. }
  4517. return decodeStringArrayTemplate;
  4518. }
  4519. }]);
  4520. return StringArrayCallsWrapper;
  4521. }(AbstractCustomNode_1.AbstractCustomNode);
  4522. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], StringArrayCallsWrapper.prototype, "stringArrayStorage", void 0);
  4523. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayCallsWrapper.prototype, "stringArrayName", void 0);
  4524. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayCallsWrapper.prototype, "stringArrayCallsWrapperName", void 0);
  4525. StringArrayCallsWrapper = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object, Object])], StringArrayCallsWrapper);
  4526. exports.StringArrayCallsWrapper = StringArrayCallsWrapper;
  4527. /***/ }),
  4528. /* 96 */
  4529. /***/ (function(module, exports, __webpack_require__) {
  4530. "use strict";
  4531. Object.defineProperty(exports, "__esModule", { value: true });
  4532. function AtobTemplate() {
  4533. return "\n (function () {\n {globalVariableTemplate}\n \n var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n that.atob || (\n that.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 ";
  4534. }
  4535. exports.AtobTemplate = AtobTemplate;
  4536. /***/ }),
  4537. /* 97 */
  4538. /***/ (function(module, exports, __webpack_require__) {
  4539. "use strict";
  4540. Object.defineProperty(exports, "__esModule", { value: true });
  4541. function Rc4Template() {
  4542. return "\n var rc4 = function (str, key) {\n var s = [], j = 0, x, res = '', newStr = '';\n \n str = atob(str);\n \n for (var k = 0, length = str.length; k < length; k++) {\n newStr += '%' + ('00' + str.charCodeAt(k).toString(16)).slice(-2);\n }\n \n str = decodeURIComponent(newStr);\n \t \n\t for (var i = 0; i < 256; i++) {\n s[i] = i;\n }\n \n for (i = 0; i < 256; i++) {\n j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;\n x = s[i];\n s[i] = s[j];\n s[j] = x;\n }\n \n i = 0;\n j = 0;\n \n for (var y = 0; y < str.length; y++) {\n i = (i + 1) % 256;\n j = (j + s[i]) % 256;\n x = s[i];\n s[i] = s[j];\n s[j] = x;\n res += String.fromCharCode(str.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);\n }\n \n return res;\n }\n ";
  4543. }
  4544. exports.Rc4Template = Rc4Template;
  4545. /***/ }),
  4546. /* 98 */
  4547. /***/ (function(module, exports, __webpack_require__) {
  4548. "use strict";
  4549. Object.defineProperty(exports, "__esModule", { value: true });
  4550. function SelfDefendingTemplate(escapeSequenceEncoder) {
  4551. return "\n var StatesClass = function (rc4Bytes) {\n this.rc4Bytes = rc4Bytes;\n this.states = [1, 0, 0];\n this.newState = function(){return 'newState';};\n this.firstState = '" + escapeSequenceEncoder.encode("\\w+ *\\(\\) *{\\w+ *", true) + "';\n this.secondState = '" + escapeSequenceEncoder.encode("['|\"].+['|\"];? *}", true) + "';\n };\n \n StatesClass.prototype.checkState = function () {\n var regExp = new RegExp(this.firstState + this.secondState);\n\n return this.runState(regExp.test(this.newState.toString()) ? --this.states[1] : --this.states[0]);\n };\n \n StatesClass.prototype.runState = function (stateResult) {\n if (!Boolean(~stateResult)) {\n return stateResult;\n }\n \n return this.getState(this.rc4Bytes);\n };\n\n StatesClass.prototype.getState = function (rc4Bytes) {\n for (var i = 0, len = this.states.length; i < len; i++) {\n this.states.push(Math.round(Math.random()));\n len = this.states.length;\n }\n \n return rc4Bytes(this.states[0]);\n };\n\n new StatesClass({stringArrayCallsWrapperName}).checkState();\n ";
  4552. }
  4553. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  4554. /***/ }),
  4555. /* 99 */
  4556. /***/ (function(module, exports, __webpack_require__) {
  4557. "use strict";
  4558. Object.defineProperty(exports, "__esModule", { value: true });
  4559. function StringArrayBase64DecodeNodeTemplate() {
  4560. return " \n if ({stringArrayCallsWrapperName}.initialized === undefined) {\n {atobPolyfill}\n \n {stringArrayCallsWrapperName}.base64DecodeUnicode = function (str) {\n var string = atob(str);\n var newStringChars = [];\n \n for (var i = 0, length = string.length; i < length; i++) {\n newStringChars += '%' + ('00' + string.charCodeAt(i).toString(16)).slice(-2);\n }\n \n return decodeURIComponent(newStringChars);\n };\n \n {stringArrayCallsWrapperName}.data = {};\n \n {stringArrayCallsWrapperName}.initialized = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}.data[index];\n \n if (cachedValue === undefined) {\n {selfDefendingCode}\n \n value = {stringArrayCallsWrapperName}.base64DecodeUnicode(value);\n {stringArrayCallsWrapperName}.data[index] = value;\n } else {\n value = cachedValue;\n } \n ";
  4561. }
  4562. exports.StringArrayBase64DecodeNodeTemplate = StringArrayBase64DecodeNodeTemplate;
  4563. /***/ }),
  4564. /* 100 */
  4565. /***/ (function(module, exports, __webpack_require__) {
  4566. "use strict";
  4567. Object.defineProperty(exports, "__esModule", { value: true });
  4568. function StringArrayCallsWrapperTemplate() {
  4569. return "\n var {stringArrayCallsWrapperName} = function (index, key) {\n index = index - 0;\n \n var value = {stringArrayName}[index];\n \n {decodeNodeTemplate}\n \n return value;\n };\n ";
  4570. }
  4571. exports.StringArrayCallsWrapperTemplate = StringArrayCallsWrapperTemplate;
  4572. /***/ }),
  4573. /* 101 */
  4574. /***/ (function(module, exports, __webpack_require__) {
  4575. "use strict";
  4576. Object.defineProperty(exports, "__esModule", { value: true });
  4577. function StringArrayRc4DecodeNodeTemplate() {
  4578. return "\n if ({stringArrayCallsWrapperName}.initialized === undefined) {\n {atobPolyfill}\n \n {rc4Polyfill}\n {stringArrayCallsWrapperName}.rc4 = rc4;\n \n {stringArrayCallsWrapperName}.data = {};\n \n {stringArrayCallsWrapperName}.initialized = true;\n }\n \n var cachedValue = {stringArrayCallsWrapperName}.data[index];\n\n if (cachedValue === undefined) {\n if ({stringArrayCallsWrapperName}.once === undefined) {\n {selfDefendingCode}\n \n {stringArrayCallsWrapperName}.once = true;\n }\n \n value = {stringArrayCallsWrapperName}.rc4(value, key);\n {stringArrayCallsWrapperName}.data[index] = value;\n } else {\n value = cachedValue;\n }\n ";
  4579. }
  4580. exports.StringArrayRc4DecodeNodeTemplate = StringArrayRc4DecodeNodeTemplate;
  4581. /***/ }),
  4582. /* 102 */
  4583. /***/ (function(module, exports, __webpack_require__) {
  4584. "use strict";
  4585. 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; }; })();
  4586. 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); } });
  4587. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4588. 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; }
  4589. 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; }
  4590. Object.defineProperty(exports, "__esModule", { value: true });
  4591. var tslib_1 = __webpack_require__(2);
  4592. var inversify_1 = __webpack_require__(0);
  4593. var ServiceIdentifiers_1 = __webpack_require__(1);
  4594. var format = __webpack_require__(11);
  4595. var Initializable_1 = __webpack_require__(3);
  4596. var StringArrayTemplate_1 = __webpack_require__(103);
  4597. var AbstractCustomNode_1 = __webpack_require__(6);
  4598. var NodeUtils_1 = __webpack_require__(4);
  4599. var StringArrayNode = function (_AbstractCustomNode_) {
  4600. _inherits(StringArrayNode, _AbstractCustomNode_);
  4601. function StringArrayNode(randomGenerator, options) {
  4602. _classCallCheck(this, StringArrayNode);
  4603. return _possibleConstructorReturn(this, (StringArrayNode.__proto__ || Object.getPrototypeOf(StringArrayNode)).call(this, randomGenerator, options));
  4604. }
  4605. _createClass(StringArrayNode, [{
  4606. key: "initialize",
  4607. value: function initialize(stringArrayStorage, stringArrayName, stringArrayRotateValue) {
  4608. this.stringArrayStorage = stringArrayStorage;
  4609. this.stringArrayName = stringArrayName;
  4610. this.stringArrayRotateValue = stringArrayRotateValue;
  4611. }
  4612. }, {
  4613. key: "getNode",
  4614. value: function getNode() {
  4615. this.stringArrayStorage.rotateArray(this.stringArrayRotateValue);
  4616. return _get(StringArrayNode.prototype.__proto__ || Object.getPrototypeOf(StringArrayNode.prototype), "getNode", this).call(this);
  4617. }
  4618. }, {
  4619. key: "getNodeStructure",
  4620. value: function getNodeStructure() {
  4621. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4622. }
  4623. }, {
  4624. key: "getTemplate",
  4625. value: function getTemplate() {
  4626. return format(StringArrayTemplate_1.StringArrayTemplate(), {
  4627. stringArrayName: this.stringArrayName,
  4628. stringArray: this.stringArrayStorage.toString()
  4629. });
  4630. }
  4631. }]);
  4632. return StringArrayNode;
  4633. }(AbstractCustomNode_1.AbstractCustomNode);
  4634. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], StringArrayNode.prototype, "stringArrayStorage", void 0);
  4635. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayNode.prototype, "stringArrayName", void 0);
  4636. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], StringArrayNode.prototype, "stringArrayRotateValue", void 0);
  4637. StringArrayNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], StringArrayNode);
  4638. exports.StringArrayNode = StringArrayNode;
  4639. /***/ }),
  4640. /* 103 */
  4641. /***/ (function(module, exports, __webpack_require__) {
  4642. "use strict";
  4643. Object.defineProperty(exports, "__esModule", { value: true });
  4644. function StringArrayTemplate() {
  4645. return "\n var {stringArrayName} = [{stringArray}];\n ";
  4646. }
  4647. exports.StringArrayTemplate = StringArrayTemplate;
  4648. /***/ }),
  4649. /* 104 */
  4650. /***/ (function(module, exports, __webpack_require__) {
  4651. "use strict";
  4652. 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; }; })();
  4653. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4654. 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; }
  4655. 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; }
  4656. Object.defineProperty(exports, "__esModule", { value: true });
  4657. var tslib_1 = __webpack_require__(2);
  4658. var inversify_1 = __webpack_require__(0);
  4659. var ServiceIdentifiers_1 = __webpack_require__(1);
  4660. var format = __webpack_require__(11);
  4661. var Initializable_1 = __webpack_require__(3);
  4662. var NoCustomNodes_1 = __webpack_require__(25);
  4663. var SelfDefendingTemplate_1 = __webpack_require__(105);
  4664. var StringArrayRotateFunctionTemplate_1 = __webpack_require__(106);
  4665. var AbstractCustomNode_1 = __webpack_require__(6);
  4666. var JavaScriptObfuscatorFacade_1 = __webpack_require__(18);
  4667. var NodeUtils_1 = __webpack_require__(4);
  4668. var Utils_1 = __webpack_require__(16);
  4669. var StringArrayRotateFunctionNode = function (_AbstractCustomNode_) {
  4670. _inherits(StringArrayRotateFunctionNode, _AbstractCustomNode_);
  4671. function StringArrayRotateFunctionNode(randomGenerator, escapeSequenceEncoder, options) {
  4672. _classCallCheck(this, StringArrayRotateFunctionNode);
  4673. var _this = _possibleConstructorReturn(this, (StringArrayRotateFunctionNode.__proto__ || Object.getPrototypeOf(StringArrayRotateFunctionNode)).call(this, randomGenerator, options));
  4674. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  4675. return _this;
  4676. }
  4677. _createClass(StringArrayRotateFunctionNode, [{
  4678. key: "initialize",
  4679. value: function initialize(stringArrayStorage, stringArrayName, stringArrayRotateValue) {
  4680. this.stringArrayStorage = stringArrayStorage;
  4681. this.stringArrayName = stringArrayName;
  4682. this.stringArrayRotateValue = stringArrayRotateValue;
  4683. }
  4684. }, {
  4685. key: "getNodeStructure",
  4686. value: function getNodeStructure() {
  4687. return NodeUtils_1.NodeUtils.convertCodeToStructure(this.getTemplate());
  4688. }
  4689. }, {
  4690. key: "getTemplate",
  4691. value: function getTemplate() {
  4692. var timesName = this.randomGenerator.getRandomVariableName(6);
  4693. var whileFunctionName = this.randomGenerator.getRandomVariableName(6);
  4694. var code = '';
  4695. if (this.options.selfDefending) {
  4696. code = format(SelfDefendingTemplate_1.SelfDefendingTemplate(this.escapeSequenceEncoder), {
  4697. timesName: timesName,
  4698. whileFunctionName: whileFunctionName
  4699. });
  4700. } else {
  4701. code = whileFunctionName + "(++" + timesName + ")";
  4702. }
  4703. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(format(StringArrayRotateFunctionTemplate_1.StringArrayRotateFunctionTemplate(), {
  4704. code: code,
  4705. timesName: timesName,
  4706. stringArrayName: this.stringArrayName,
  4707. stringArrayRotateValue: Utils_1.Utils.decToHex(this.stringArrayRotateValue),
  4708. whileFunctionName: whileFunctionName
  4709. }), Object.assign({}, NoCustomNodes_1.NO_CUSTOM_NODES_PRESET, { seed: this.options.seed })).getObfuscatedCode();
  4710. }
  4711. }]);
  4712. return StringArrayRotateFunctionNode;
  4713. }(AbstractCustomNode_1.AbstractCustomNode);
  4714. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Object)], StringArrayRotateFunctionNode.prototype, "stringArrayStorage", void 0);
  4715. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringArrayRotateFunctionNode.prototype, "stringArrayName", void 0);
  4716. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Number)], StringArrayRotateFunctionNode.prototype, "stringArrayRotateValue", void 0);
  4717. StringArrayRotateFunctionNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object, Object])], StringArrayRotateFunctionNode);
  4718. exports.StringArrayRotateFunctionNode = StringArrayRotateFunctionNode;
  4719. /***/ }),
  4720. /* 105 */
  4721. /***/ (function(module, exports, __webpack_require__) {
  4722. "use strict";
  4723. Object.defineProperty(exports, "__esModule", { value: true });
  4724. function SelfDefendingTemplate(escapeSequenceEncoder) {
  4725. return "\n var selfDefendingFunc = function () { \n var object = {\n data: {\n key: 'cookie',\n value: 'timeout'\n },\n setCookie: function (options, name, value, document) {\n document = document || {};\n \n var updatedCookie = name + \"=\" + value;\n\n var i = 0;\n \n for (var i = 0, len = options.length; i < len; i++) { \n var propName = options[i];\n \n updatedCookie += \"; \" + propName;\n \n var propValue = options[propName];\n \n options.push(propValue);\n len = options.length;\n \n if (propValue !== true) {\n updatedCookie += \"=\" + propValue;\n }\n }\n\n document['cookie'] = updatedCookie;\n },\n removeCookie: function(){return 'dev';},\n getCookie: function (document, name) { \n document = document || function (value) { return value };\n var matches = document(new RegExp(\n \"(?:^|; )\" + name.replace(/([.$?*|{}()[]\\/+^])/g, '\\$1') + \"=([^;]*)\"\n ));\n \n var func = function (param1, param2) {\n param1(++param2);\n };\n \n func({whileFunctionName}, {timesName});\n \n return matches ? decodeURIComponent(matches[1]) : undefined;\n }\n };\n \n var test1 = function () {\n var regExp = new RegExp('" + escapeSequenceEncoder.encode("\\w+ *\\(\\) *{\\w+ *['|\"].+['|\"];? *}", true) + "');\n \n return regExp.test(object.removeCookie.toString());\n };\n \n object['updateCookie'] = test1;\n \n var cookie = '';\n var result = object['updateCookie']();\n \n if (!result) {\n object['setCookie'](['*'], 'counter', 1);\n } else if (result) {\n cookie = object['getCookie'](null, 'counter'); \n } else {\n object['removeCookie']();\n }\n };\n \n selfDefendingFunc();\n ";
  4726. }
  4727. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  4728. /***/ }),
  4729. /* 106 */
  4730. /***/ (function(module, exports, __webpack_require__) {
  4731. "use strict";
  4732. Object.defineProperty(exports, "__esModule", { value: true });
  4733. function StringArrayRotateFunctionTemplate() {
  4734. return "\n (function (array, {timesName}) {\n var {whileFunctionName} = function (times) {\n while (--times) {\n array['push'](array['shift']());\n }\n };\n \n {code}\n })({stringArrayName}, 0x{stringArrayRotateValue});\n ";
  4735. }
  4736. exports.StringArrayRotateFunctionTemplate = StringArrayRotateFunctionTemplate;
  4737. /***/ }),
  4738. /* 107 */
  4739. /***/ (function(module, exports, __webpack_require__) {
  4740. "use strict";
  4741. 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; }; })();
  4742. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4743. 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; }
  4744. 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; }
  4745. Object.defineProperty(exports, "__esModule", { value: true });
  4746. var tslib_1 = __webpack_require__(2);
  4747. var inversify_1 = __webpack_require__(0);
  4748. var ServiceIdentifiers_1 = __webpack_require__(1);
  4749. var Initializable_1 = __webpack_require__(3);
  4750. var AbstractCustomNode_1 = __webpack_require__(6);
  4751. var Nodes_1 = __webpack_require__(9);
  4752. var NodeUtils_1 = __webpack_require__(4);
  4753. var StringLiteralControlFlowStorageCallNode = function (_AbstractCustomNode_) {
  4754. _inherits(StringLiteralControlFlowStorageCallNode, _AbstractCustomNode_);
  4755. function StringLiteralControlFlowStorageCallNode(randomGenerator, options) {
  4756. _classCallCheck(this, StringLiteralControlFlowStorageCallNode);
  4757. return _possibleConstructorReturn(this, (StringLiteralControlFlowStorageCallNode.__proto__ || Object.getPrototypeOf(StringLiteralControlFlowStorageCallNode)).call(this, randomGenerator, options));
  4758. }
  4759. _createClass(StringLiteralControlFlowStorageCallNode, [{
  4760. key: "initialize",
  4761. value: function initialize(controlFlowStorageName, controlFlowStorageKey) {
  4762. this.controlFlowStorageName = controlFlowStorageName;
  4763. this.controlFlowStorageKey = controlFlowStorageKey;
  4764. }
  4765. }, {
  4766. key: "getNodeStructure",
  4767. value: function getNodeStructure() {
  4768. var structure = Nodes_1.Nodes.getExpressionStatementNode(Nodes_1.Nodes.getMemberExpressionNode(Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageName), Nodes_1.Nodes.getIdentifierNode(this.controlFlowStorageKey)));
  4769. NodeUtils_1.NodeUtils.parentize(structure);
  4770. return [structure];
  4771. }
  4772. }]);
  4773. return StringLiteralControlFlowStorageCallNode;
  4774. }(AbstractCustomNode_1.AbstractCustomNode);
  4775. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringLiteralControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  4776. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringLiteralControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  4777. StringLiteralControlFlowStorageCallNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], StringLiteralControlFlowStorageCallNode);
  4778. exports.StringLiteralControlFlowStorageCallNode = StringLiteralControlFlowStorageCallNode;
  4779. /***/ }),
  4780. /* 108 */
  4781. /***/ (function(module, exports, __webpack_require__) {
  4782. "use strict";
  4783. 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; }; })();
  4784. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4785. 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; }
  4786. 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; }
  4787. Object.defineProperty(exports, "__esModule", { value: true });
  4788. var tslib_1 = __webpack_require__(2);
  4789. var inversify_1 = __webpack_require__(0);
  4790. var ServiceIdentifiers_1 = __webpack_require__(1);
  4791. var Initializable_1 = __webpack_require__(3);
  4792. var AbstractCustomNode_1 = __webpack_require__(6);
  4793. var Nodes_1 = __webpack_require__(9);
  4794. var StringLiteralNode = function (_AbstractCustomNode_) {
  4795. _inherits(StringLiteralNode, _AbstractCustomNode_);
  4796. function StringLiteralNode(randomGenerator, options) {
  4797. _classCallCheck(this, StringLiteralNode);
  4798. return _possibleConstructorReturn(this, (StringLiteralNode.__proto__ || Object.getPrototypeOf(StringLiteralNode)).call(this, randomGenerator, options));
  4799. }
  4800. _createClass(StringLiteralNode, [{
  4801. key: "initialize",
  4802. value: function initialize(literalValue) {
  4803. this.literalValue = literalValue;
  4804. }
  4805. }, {
  4806. key: "getNodeStructure",
  4807. value: function getNodeStructure() {
  4808. var structure = Nodes_1.Nodes.getLiteralNode(this.literalValue);
  4809. return [structure];
  4810. }
  4811. }]);
  4812. return StringLiteralNode;
  4813. }(AbstractCustomNode_1.AbstractCustomNode);
  4814. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], StringLiteralNode.prototype, "literalValue", void 0);
  4815. StringLiteralNode = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], StringLiteralNode);
  4816. exports.StringLiteralNode = StringLiteralNode;
  4817. /***/ }),
  4818. /* 109 */
  4819. /***/ (function(module, exports, __webpack_require__) {
  4820. "use strict";
  4821. Object.defineProperty(exports, "__esModule", { value: true });
  4822. var InversifyContainerFacade_1 = __webpack_require__(14);
  4823. var inversify_1 = __webpack_require__(0);
  4824. var ServiceIdentifiers_1 = __webpack_require__(1);
  4825. exports.nodeTransformersModule = new inversify_1.ContainerModule(function (bind) {
  4826. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeTransformer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer));
  4827. });
  4828. /***/ }),
  4829. /* 110 */
  4830. /***/ (function(module, exports, __webpack_require__) {
  4831. "use strict";
  4832. Object.defineProperty(exports, "__esModule", { value: true });
  4833. var InversifyContainerFacade_1 = __webpack_require__(14);
  4834. var inversify_1 = __webpack_require__(0);
  4835. var ServiceIdentifiers_1 = __webpack_require__(1);
  4836. var IdentifierObfuscatingReplacer_1 = __webpack_require__(17);
  4837. var LiteralObfuscatingReplacer_1 = __webpack_require__(40);
  4838. var NodeTransformer_1 = __webpack_require__(21);
  4839. var BaseIdentifierObfuscatingReplacer_1 = __webpack_require__(111);
  4840. var BooleanLiteralObfuscatingReplacer_1 = __webpack_require__(112);
  4841. var CatchClauseTransformer_1 = __webpack_require__(113);
  4842. var ClassDeclarationTransformer_1 = __webpack_require__(114);
  4843. var FunctionDeclarationTransformer_1 = __webpack_require__(115);
  4844. var FunctionTransformer_1 = __webpack_require__(116);
  4845. var LabeledStatementTransformer_1 = __webpack_require__(117);
  4846. var LiteralTransformer_1 = __webpack_require__(118);
  4847. var NumberLiteralObfuscatingReplacer_1 = __webpack_require__(119);
  4848. var ObjectExpressionTransformer_1 = __webpack_require__(120);
  4849. var StringLiteralObfuscatingReplacer_1 = __webpack_require__(121);
  4850. var VariableDeclarationTransformer_1 = __webpack_require__(122);
  4851. exports.obfuscatingTransformersModule = new inversify_1.ContainerModule(function (bind) {
  4852. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(CatchClauseTransformer_1.CatchClauseTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.CatchClauseTransformer);
  4853. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ClassDeclarationTransformer_1.ClassDeclarationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ClassDeclarationTransformer);
  4854. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(FunctionDeclarationTransformer_1.FunctionDeclarationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.FunctionDeclarationTransformer);
  4855. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(FunctionTransformer_1.FunctionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.FunctionTransformer);
  4856. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(LabeledStatementTransformer_1.LabeledStatementTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.LabeledStatementTransformer);
  4857. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(LiteralTransformer_1.LiteralTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.LiteralTransformer);
  4858. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ObjectExpressionTransformer_1.ObjectExpressionTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ObjectExpressionTransformer);
  4859. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(VariableDeclarationTransformer_1.VariableDeclarationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.VariableDeclarationTransformer);
  4860. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(BooleanLiteralObfuscatingReplacer_1.BooleanLiteralObfuscatingReplacer).whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer);
  4861. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(NumberLiteralObfuscatingReplacer_1.NumberLiteralObfuscatingReplacer).whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer);
  4862. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer).to(StringLiteralObfuscatingReplacer_1.StringLiteralObfuscatingReplacer).whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer);
  4863. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierObfuscatingReplacer).to(BaseIdentifierObfuscatingReplacer_1.BaseIdentifierObfuscatingReplacer).whenTargetNamed(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  4864. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer));
  4865. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierObfuscatingReplacer));
  4866. });
  4867. /***/ }),
  4868. /* 111 */
  4869. /***/ (function(module, exports, __webpack_require__) {
  4870. "use strict";
  4871. 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; }; })();
  4872. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4873. 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; }
  4874. 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; }
  4875. Object.defineProperty(exports, "__esModule", { value: true });
  4876. var tslib_1 = __webpack_require__(2);
  4877. var inversify_1 = __webpack_require__(0);
  4878. var ServiceIdentifiers_1 = __webpack_require__(1);
  4879. var AbstractObfuscatingReplacer_1 = __webpack_require__(26);
  4880. var Nodes_1 = __webpack_require__(9);
  4881. var BaseIdentifierObfuscatingReplacer = function (_AbstractObfuscatingR) {
  4882. _inherits(BaseIdentifierObfuscatingReplacer, _AbstractObfuscatingR);
  4883. function BaseIdentifierObfuscatingReplacer(randomGenerator, options) {
  4884. _classCallCheck(this, BaseIdentifierObfuscatingReplacer);
  4885. var _this = _possibleConstructorReturn(this, (BaseIdentifierObfuscatingReplacer.__proto__ || Object.getPrototypeOf(BaseIdentifierObfuscatingReplacer)).call(this, options));
  4886. _this.namesMap = new Map();
  4887. _this.randomGenerator = randomGenerator;
  4888. return _this;
  4889. }
  4890. _createClass(BaseIdentifierObfuscatingReplacer, [{
  4891. key: "replace",
  4892. value: function replace(nodeValue, nodeIdentifier) {
  4893. var mapKey = nodeValue + "-" + String(nodeIdentifier);
  4894. if (this.namesMap.has(mapKey)) {
  4895. nodeValue = this.namesMap.get(mapKey);
  4896. }
  4897. return Nodes_1.Nodes.getIdentifierNode(nodeValue);
  4898. }
  4899. }, {
  4900. key: "storeNames",
  4901. value: function storeNames(nodeName, nodeIdentifier) {
  4902. if (!this.isReservedName(nodeName)) {
  4903. this.namesMap.set(nodeName + "-" + String(nodeIdentifier), this.randomGenerator.getRandomVariableName(6));
  4904. }
  4905. }
  4906. }, {
  4907. key: "isReservedName",
  4908. value: function isReservedName(name) {
  4909. return this.options.reservedNames.some(function (reservedName) {
  4910. return new RegExp(reservedName, 'g').exec(name) !== null;
  4911. });
  4912. }
  4913. }]);
  4914. return BaseIdentifierObfuscatingReplacer;
  4915. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  4916. BaseIdentifierObfuscatingReplacer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], BaseIdentifierObfuscatingReplacer);
  4917. exports.BaseIdentifierObfuscatingReplacer = BaseIdentifierObfuscatingReplacer;
  4918. /***/ }),
  4919. /* 112 */
  4920. /***/ (function(module, exports, __webpack_require__) {
  4921. "use strict";
  4922. 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; }; })();
  4923. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4924. 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; }
  4925. 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; }
  4926. Object.defineProperty(exports, "__esModule", { value: true });
  4927. var tslib_1 = __webpack_require__(2);
  4928. var inversify_1 = __webpack_require__(0);
  4929. var ServiceIdentifiers_1 = __webpack_require__(1);
  4930. var AbstractObfuscatingReplacer_1 = __webpack_require__(26);
  4931. var Nodes_1 = __webpack_require__(9);
  4932. var BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer_1 = function (_AbstractObfuscatingR) {
  4933. _inherits(BooleanLiteralObfuscatingReplacer, _AbstractObfuscatingR);
  4934. function BooleanLiteralObfuscatingReplacer(options) {
  4935. _classCallCheck(this, BooleanLiteralObfuscatingReplacer);
  4936. return _possibleConstructorReturn(this, (BooleanLiteralObfuscatingReplacer.__proto__ || Object.getPrototypeOf(BooleanLiteralObfuscatingReplacer)).call(this, options));
  4937. }
  4938. _createClass(BooleanLiteralObfuscatingReplacer, [{
  4939. key: "replace",
  4940. value: function replace(nodeValue) {
  4941. return nodeValue ? BooleanLiteralObfuscatingReplacer_1.getTrueUnaryExpressionNode() : BooleanLiteralObfuscatingReplacer_1.getFalseUnaryExpressionNode();
  4942. }
  4943. }], [{
  4944. key: "getTrueUnaryExpressionNode",
  4945. value: function getTrueUnaryExpressionNode() {
  4946. return Nodes_1.Nodes.getUnaryExpressionNode('!', BooleanLiteralObfuscatingReplacer_1.getFalseUnaryExpressionNode());
  4947. }
  4948. }, {
  4949. key: "getFalseUnaryExpressionNode",
  4950. value: function getFalseUnaryExpressionNode() {
  4951. return Nodes_1.Nodes.getUnaryExpressionNode('!', Nodes_1.Nodes.getArrayExpressionNode());
  4952. }
  4953. }]);
  4954. return BooleanLiteralObfuscatingReplacer;
  4955. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  4956. BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object])], BooleanLiteralObfuscatingReplacer);
  4957. exports.BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer;
  4958. var BooleanLiteralObfuscatingReplacer_1;
  4959. /***/ }),
  4960. /* 113 */
  4961. /***/ (function(module, exports, __webpack_require__) {
  4962. "use strict";
  4963. 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; }; })();
  4964. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4965. 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; }
  4966. 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; }
  4967. Object.defineProperty(exports, "__esModule", { value: true });
  4968. var tslib_1 = __webpack_require__(2);
  4969. var inversify_1 = __webpack_require__(0);
  4970. var ServiceIdentifiers_1 = __webpack_require__(1);
  4971. var estraverse = __webpack_require__(8);
  4972. var IdentifierObfuscatingReplacer_1 = __webpack_require__(17);
  4973. var AbstractNodeTransformer_1 = __webpack_require__(7);
  4974. var NodeGuards_1 = __webpack_require__(5);
  4975. var CatchClauseTransformer = function (_AbstractNodeTransfor) {
  4976. _inherits(CatchClauseTransformer, _AbstractNodeTransfor);
  4977. function CatchClauseTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  4978. _classCallCheck(this, CatchClauseTransformer);
  4979. var _this = _possibleConstructorReturn(this, (CatchClauseTransformer.__proto__ || Object.getPrototypeOf(CatchClauseTransformer)).call(this, randomGenerator, options));
  4980. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  4981. return _this;
  4982. }
  4983. _createClass(CatchClauseTransformer, [{
  4984. key: "getVisitor",
  4985. value: function getVisitor() {
  4986. var _this2 = this;
  4987. return {
  4988. enter: function enter(node, parentNode) {
  4989. if (NodeGuards_1.NodeGuards.isCatchClauseNode(node)) {
  4990. return _this2.transformNode(node, parentNode);
  4991. }
  4992. }
  4993. };
  4994. }
  4995. }, {
  4996. key: "transformNode",
  4997. value: function transformNode(catchClauseNode, parentNode) {
  4998. var nodeIdentifier = this.nodeIdentifier++;
  4999. this.storeCatchClauseParam(catchClauseNode, nodeIdentifier);
  5000. this.replaceCatchClauseParam(catchClauseNode, nodeIdentifier);
  5001. return catchClauseNode;
  5002. }
  5003. }, {
  5004. key: "storeCatchClauseParam",
  5005. value: function storeCatchClauseParam(catchClauseNode, nodeIdentifier) {
  5006. if (NodeGuards_1.NodeGuards.isIdentifierNode(catchClauseNode.param)) {
  5007. this.identifierObfuscatingReplacer.storeNames(catchClauseNode.param.name, nodeIdentifier);
  5008. }
  5009. }
  5010. }, {
  5011. key: "replaceCatchClauseParam",
  5012. value: function replaceCatchClauseParam(catchClauseNode, nodeIdentifier) {
  5013. var _this3 = this;
  5014. estraverse.replace(catchClauseNode, {
  5015. enter: function enter(node, parentNode) {
  5016. if (NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  5017. var newIdentifier = _this3.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5018. var newIdentifierName = newIdentifier.name;
  5019. if (node.name !== newIdentifierName) {
  5020. node.name = newIdentifierName;
  5021. node.obfuscatedNode = true;
  5022. }
  5023. }
  5024. }
  5025. });
  5026. }
  5027. }]);
  5028. return CatchClauseTransformer;
  5029. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5030. CatchClauseTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], CatchClauseTransformer);
  5031. exports.CatchClauseTransformer = CatchClauseTransformer;
  5032. /***/ }),
  5033. /* 114 */
  5034. /***/ (function(module, exports, __webpack_require__) {
  5035. "use strict";
  5036. 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; }; })();
  5037. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5038. 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; }
  5039. 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; }
  5040. Object.defineProperty(exports, "__esModule", { value: true });
  5041. var tslib_1 = __webpack_require__(2);
  5042. var inversify_1 = __webpack_require__(0);
  5043. var ServiceIdentifiers_1 = __webpack_require__(1);
  5044. var estraverse = __webpack_require__(8);
  5045. var IdentifierObfuscatingReplacer_1 = __webpack_require__(17);
  5046. var NodeType_1 = __webpack_require__(10);
  5047. var AbstractNodeTransformer_1 = __webpack_require__(7);
  5048. var NodeGuards_1 = __webpack_require__(5);
  5049. var NodeUtils_1 = __webpack_require__(4);
  5050. var ClassDeclarationTransformer = function (_AbstractNodeTransfor) {
  5051. _inherits(ClassDeclarationTransformer, _AbstractNodeTransfor);
  5052. function ClassDeclarationTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  5053. _classCallCheck(this, ClassDeclarationTransformer);
  5054. var _this = _possibleConstructorReturn(this, (ClassDeclarationTransformer.__proto__ || Object.getPrototypeOf(ClassDeclarationTransformer)).call(this, randomGenerator, options));
  5055. _this.replaceableIdentifiers = new Map();
  5056. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5057. return _this;
  5058. }
  5059. _createClass(ClassDeclarationTransformer, [{
  5060. key: "getVisitor",
  5061. value: function getVisitor() {
  5062. var _this2 = this;
  5063. return {
  5064. enter: function enter(node, parentNode) {
  5065. if (NodeGuards_1.NodeGuards.isClassDeclarationNode(node)) {
  5066. return _this2.transformNode(node, parentNode);
  5067. }
  5068. }
  5069. };
  5070. }
  5071. }, {
  5072. key: "transformNode",
  5073. value: function transformNode(classDeclarationNode, parentNode) {
  5074. var nodeIdentifier = this.nodeIdentifier++;
  5075. var blockScopeOfClassDeclarationNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(classDeclarationNode)[0];
  5076. if (!this.options.renameGlobals && blockScopeOfClassDeclarationNode.type === NodeType_1.NodeType.Program) {
  5077. return classDeclarationNode;
  5078. }
  5079. this.storeClassName(classDeclarationNode, nodeIdentifier);
  5080. if (this.replaceableIdentifiers.has(blockScopeOfClassDeclarationNode)) {
  5081. this.replaceScopeCachedIdentifiers(blockScopeOfClassDeclarationNode, nodeIdentifier);
  5082. } else {
  5083. this.replaceScopeIdentifiers(blockScopeOfClassDeclarationNode, nodeIdentifier);
  5084. }
  5085. return classDeclarationNode;
  5086. }
  5087. }, {
  5088. key: "storeClassName",
  5089. value: function storeClassName(classDeclarationNode, nodeIdentifier) {
  5090. this.identifierObfuscatingReplacer.storeNames(classDeclarationNode.id.name, nodeIdentifier);
  5091. }
  5092. }, {
  5093. key: "replaceScopeCachedIdentifiers",
  5094. value: function replaceScopeCachedIdentifiers(scopeNode, nodeIdentifier) {
  5095. var _this3 = this;
  5096. var cachedReplaceableIdentifiers = this.replaceableIdentifiers.get(scopeNode);
  5097. cachedReplaceableIdentifiers.forEach(function (replaceableIdentifier) {
  5098. var newReplaceableIdentifier = _this3.identifierObfuscatingReplacer.replace(replaceableIdentifier.name, nodeIdentifier);
  5099. replaceableIdentifier.name = newReplaceableIdentifier.name;
  5100. });
  5101. }
  5102. }, {
  5103. key: "replaceScopeIdentifiers",
  5104. value: function replaceScopeIdentifiers(scopeNode, nodeIdentifier) {
  5105. var _this4 = this;
  5106. var storedReplaceableIdentifiers = [];
  5107. estraverse.replace(scopeNode, {
  5108. enter: function enter(node, parentNode) {
  5109. if (NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  5110. var newIdentifier = _this4.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5111. var newIdentifierName = newIdentifier.name;
  5112. if (node.name !== newIdentifierName) {
  5113. node.name = newIdentifierName;
  5114. } else {
  5115. storedReplaceableIdentifiers.push(node);
  5116. }
  5117. }
  5118. }
  5119. });
  5120. this.replaceableIdentifiers.set(scopeNode, storedReplaceableIdentifiers);
  5121. }
  5122. }]);
  5123. return ClassDeclarationTransformer;
  5124. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5125. ClassDeclarationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], ClassDeclarationTransformer);
  5126. exports.ClassDeclarationTransformer = ClassDeclarationTransformer;
  5127. /***/ }),
  5128. /* 115 */
  5129. /***/ (function(module, exports, __webpack_require__) {
  5130. "use strict";
  5131. 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; }; })();
  5132. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5133. 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; }
  5134. 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; }
  5135. Object.defineProperty(exports, "__esModule", { value: true });
  5136. var tslib_1 = __webpack_require__(2);
  5137. var inversify_1 = __webpack_require__(0);
  5138. var ServiceIdentifiers_1 = __webpack_require__(1);
  5139. var estraverse = __webpack_require__(8);
  5140. var IdentifierObfuscatingReplacer_1 = __webpack_require__(17);
  5141. var NodeType_1 = __webpack_require__(10);
  5142. var AbstractNodeTransformer_1 = __webpack_require__(7);
  5143. var NodeGuards_1 = __webpack_require__(5);
  5144. var NodeUtils_1 = __webpack_require__(4);
  5145. var FunctionDeclarationTransformer = function (_AbstractNodeTransfor) {
  5146. _inherits(FunctionDeclarationTransformer, _AbstractNodeTransfor);
  5147. function FunctionDeclarationTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  5148. _classCallCheck(this, FunctionDeclarationTransformer);
  5149. var _this = _possibleConstructorReturn(this, (FunctionDeclarationTransformer.__proto__ || Object.getPrototypeOf(FunctionDeclarationTransformer)).call(this, randomGenerator, options));
  5150. _this.replaceableIdentifiers = new Map();
  5151. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5152. return _this;
  5153. }
  5154. _createClass(FunctionDeclarationTransformer, [{
  5155. key: "getVisitor",
  5156. value: function getVisitor() {
  5157. var _this2 = this;
  5158. return {
  5159. enter: function enter(node, parentNode) {
  5160. if (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node)) {
  5161. return _this2.transformNode(node, parentNode);
  5162. }
  5163. }
  5164. };
  5165. }
  5166. }, {
  5167. key: "transformNode",
  5168. value: function transformNode(functionDeclarationNode, parentNode) {
  5169. var nodeIdentifier = this.nodeIdentifier++;
  5170. var blockScopeOfFunctionDeclarationNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(functionDeclarationNode)[0];
  5171. if (!this.options.renameGlobals && blockScopeOfFunctionDeclarationNode.type === NodeType_1.NodeType.Program) {
  5172. return functionDeclarationNode;
  5173. }
  5174. this.storeFunctionName(functionDeclarationNode, nodeIdentifier);
  5175. if (this.replaceableIdentifiers.has(blockScopeOfFunctionDeclarationNode)) {
  5176. this.replaceScopeCachedIdentifiers(blockScopeOfFunctionDeclarationNode, nodeIdentifier);
  5177. } else {
  5178. this.replaceScopeIdentifiers(blockScopeOfFunctionDeclarationNode, nodeIdentifier);
  5179. }
  5180. return functionDeclarationNode;
  5181. }
  5182. }, {
  5183. key: "storeFunctionName",
  5184. value: function storeFunctionName(functionDeclarationNode, nodeIdentifier) {
  5185. this.identifierObfuscatingReplacer.storeNames(functionDeclarationNode.id.name, nodeIdentifier);
  5186. }
  5187. }, {
  5188. key: "replaceScopeCachedIdentifiers",
  5189. value: function replaceScopeCachedIdentifiers(scopeNode, nodeIdentifier) {
  5190. var _this3 = this;
  5191. var cachedReplaceableIdentifiers = this.replaceableIdentifiers.get(scopeNode);
  5192. cachedReplaceableIdentifiers.forEach(function (replaceableIdentifier) {
  5193. var newReplaceableIdentifier = _this3.identifierObfuscatingReplacer.replace(replaceableIdentifier.name, nodeIdentifier);
  5194. replaceableIdentifier.name = newReplaceableIdentifier.name;
  5195. });
  5196. }
  5197. }, {
  5198. key: "replaceScopeIdentifiers",
  5199. value: function replaceScopeIdentifiers(scopeNode, nodeIdentifier) {
  5200. var _this4 = this;
  5201. var storedReplaceableIdentifiers = [];
  5202. estraverse.replace(scopeNode, {
  5203. enter: function enter(node, parentNode) {
  5204. if (NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  5205. var newIdentifier = _this4.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5206. var newIdentifierName = newIdentifier.name;
  5207. if (node.name !== newIdentifierName) {
  5208. node.name = newIdentifierName;
  5209. } else {
  5210. storedReplaceableIdentifiers.push(node);
  5211. }
  5212. }
  5213. }
  5214. });
  5215. this.replaceableIdentifiers.set(scopeNode, storedReplaceableIdentifiers);
  5216. }
  5217. }]);
  5218. return FunctionDeclarationTransformer;
  5219. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5220. FunctionDeclarationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], FunctionDeclarationTransformer);
  5221. exports.FunctionDeclarationTransformer = FunctionDeclarationTransformer;
  5222. /***/ }),
  5223. /* 116 */
  5224. /***/ (function(module, exports, __webpack_require__) {
  5225. "use strict";
  5226. 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; }; })();
  5227. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5228. 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; }
  5229. 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; }
  5230. Object.defineProperty(exports, "__esModule", { value: true });
  5231. var tslib_1 = __webpack_require__(2);
  5232. var inversify_1 = __webpack_require__(0);
  5233. var ServiceIdentifiers_1 = __webpack_require__(1);
  5234. var estraverse = __webpack_require__(8);
  5235. var IdentifierObfuscatingReplacer_1 = __webpack_require__(17);
  5236. var AbstractNodeTransformer_1 = __webpack_require__(7);
  5237. var NodeGuards_1 = __webpack_require__(5);
  5238. var FunctionTransformer = function (_AbstractNodeTransfor) {
  5239. _inherits(FunctionTransformer, _AbstractNodeTransfor);
  5240. function FunctionTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  5241. _classCallCheck(this, FunctionTransformer);
  5242. var _this = _possibleConstructorReturn(this, (FunctionTransformer.__proto__ || Object.getPrototypeOf(FunctionTransformer)).call(this, randomGenerator, options));
  5243. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5244. return _this;
  5245. }
  5246. _createClass(FunctionTransformer, [{
  5247. key: "getVisitor",
  5248. value: function getVisitor() {
  5249. var _this2 = this;
  5250. return {
  5251. enter: function enter(node, parentNode) {
  5252. if (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) || NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) || NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node)) {
  5253. return _this2.transformNode(node, parentNode);
  5254. }
  5255. }
  5256. };
  5257. }
  5258. }, {
  5259. key: "transformNode",
  5260. value: function transformNode(functionNode, parentNode) {
  5261. var nodeIdentifier = this.nodeIdentifier++;
  5262. this.storeFunctionParams(functionNode, nodeIdentifier);
  5263. this.replaceFunctionParams(functionNode, nodeIdentifier);
  5264. return functionNode;
  5265. }
  5266. }, {
  5267. key: "storeFunctionParams",
  5268. value: function storeFunctionParams(functionNode, nodeIdentifier) {
  5269. var _this3 = this;
  5270. functionNode.params.forEach(function (paramsNode) {
  5271. if (NodeGuards_1.NodeGuards.isObjectPatternNode(paramsNode)) {
  5272. return estraverse.VisitorOption.Skip;
  5273. }
  5274. estraverse.traverse(paramsNode, {
  5275. enter: function enter(node) {
  5276. if (NodeGuards_1.NodeGuards.isAssignmentPatternNode(node) && NodeGuards_1.NodeGuards.isIdentifierNode(node.left)) {
  5277. _this3.identifierObfuscatingReplacer.storeNames(node.left.name, nodeIdentifier);
  5278. return estraverse.VisitorOption.Skip;
  5279. }
  5280. if (NodeGuards_1.NodeGuards.isIdentifierNode(node)) {
  5281. _this3.identifierObfuscatingReplacer.storeNames(node.name, nodeIdentifier);
  5282. }
  5283. }
  5284. });
  5285. });
  5286. }
  5287. }, {
  5288. key: "replaceFunctionParams",
  5289. value: function replaceFunctionParams(functionNode, nodeIdentifier) {
  5290. var _this4 = this;
  5291. var replaceVisitor = {
  5292. enter: function enter(node, parentNode) {
  5293. if (NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  5294. var newIdentifier = _this4.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5295. var newIdentifierName = newIdentifier.name;
  5296. if (node.name !== newIdentifierName) {
  5297. node.name = newIdentifierName;
  5298. node.obfuscatedNode = true;
  5299. }
  5300. }
  5301. }
  5302. };
  5303. functionNode.params.forEach(function (paramsNode) {
  5304. return estraverse.replace(paramsNode, replaceVisitor);
  5305. });
  5306. estraverse.replace(functionNode.body, replaceVisitor);
  5307. }
  5308. }]);
  5309. return FunctionTransformer;
  5310. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5311. FunctionTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], FunctionTransformer);
  5312. exports.FunctionTransformer = FunctionTransformer;
  5313. /***/ }),
  5314. /* 117 */
  5315. /***/ (function(module, exports, __webpack_require__) {
  5316. "use strict";
  5317. 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; }; })();
  5318. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5319. 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; }
  5320. 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; }
  5321. Object.defineProperty(exports, "__esModule", { value: true });
  5322. var tslib_1 = __webpack_require__(2);
  5323. var inversify_1 = __webpack_require__(0);
  5324. var ServiceIdentifiers_1 = __webpack_require__(1);
  5325. var estraverse = __webpack_require__(8);
  5326. var IdentifierObfuscatingReplacer_1 = __webpack_require__(17);
  5327. var AbstractNodeTransformer_1 = __webpack_require__(7);
  5328. var NodeGuards_1 = __webpack_require__(5);
  5329. var LabeledStatementTransformer = function (_AbstractNodeTransfor) {
  5330. _inherits(LabeledStatementTransformer, _AbstractNodeTransfor);
  5331. function LabeledStatementTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  5332. _classCallCheck(this, LabeledStatementTransformer);
  5333. var _this = _possibleConstructorReturn(this, (LabeledStatementTransformer.__proto__ || Object.getPrototypeOf(LabeledStatementTransformer)).call(this, randomGenerator, options));
  5334. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5335. return _this;
  5336. }
  5337. _createClass(LabeledStatementTransformer, [{
  5338. key: "getVisitor",
  5339. value: function getVisitor() {
  5340. var _this2 = this;
  5341. return {
  5342. enter: function enter(node, parentNode) {
  5343. if (NodeGuards_1.NodeGuards.isLabeledStatementNode(node)) {
  5344. return _this2.transformNode(node, parentNode);
  5345. }
  5346. }
  5347. };
  5348. }
  5349. }, {
  5350. key: "transformNode",
  5351. value: function transformNode(labeledStatementNode, parentNode) {
  5352. var nodeIdentifier = this.nodeIdentifier++;
  5353. this.storeLabeledStatementName(labeledStatementNode, nodeIdentifier);
  5354. this.replaceLabeledStatementName(labeledStatementNode, nodeIdentifier);
  5355. return labeledStatementNode;
  5356. }
  5357. }, {
  5358. key: "storeLabeledStatementName",
  5359. value: function storeLabeledStatementName(labeledStatementNode, nodeIdentifier) {
  5360. this.identifierObfuscatingReplacer.storeNames(labeledStatementNode.label.name, nodeIdentifier);
  5361. }
  5362. }, {
  5363. key: "replaceLabeledStatementName",
  5364. value: function replaceLabeledStatementName(labeledStatementNode, nodeIdentifier) {
  5365. var _this3 = this;
  5366. estraverse.replace(labeledStatementNode, {
  5367. enter: function enter(node, parentNode) {
  5368. if (NodeGuards_1.NodeGuards.isLabelIdentifierNode(node, parentNode)) {
  5369. var newIdentifier = _this3.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5370. node.name = newIdentifier.name;
  5371. }
  5372. }
  5373. });
  5374. }
  5375. }]);
  5376. return LabeledStatementTransformer;
  5377. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5378. LabeledStatementTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], LabeledStatementTransformer);
  5379. exports.LabeledStatementTransformer = LabeledStatementTransformer;
  5380. /***/ }),
  5381. /* 118 */
  5382. /***/ (function(module, exports, __webpack_require__) {
  5383. "use strict";
  5384. 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; };
  5385. 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; }; })();
  5386. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5387. 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; }
  5388. 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; }
  5389. Object.defineProperty(exports, "__esModule", { value: true });
  5390. var tslib_1 = __webpack_require__(2);
  5391. var inversify_1 = __webpack_require__(0);
  5392. var ServiceIdentifiers_1 = __webpack_require__(1);
  5393. var LiteralObfuscatingReplacer_1 = __webpack_require__(40);
  5394. var AbstractNodeTransformer_1 = __webpack_require__(7);
  5395. var NodeGuards_1 = __webpack_require__(5);
  5396. var LiteralTransformer = function (_AbstractNodeTransfor) {
  5397. _inherits(LiteralTransformer, _AbstractNodeTransfor);
  5398. function LiteralTransformer(literalObfuscatingReplacerFactory, randomGenerator, options) {
  5399. _classCallCheck(this, LiteralTransformer);
  5400. var _this = _possibleConstructorReturn(this, (LiteralTransformer.__proto__ || Object.getPrototypeOf(LiteralTransformer)).call(this, randomGenerator, options));
  5401. _this.literalObfuscatingReplacerFactory = literalObfuscatingReplacerFactory;
  5402. return _this;
  5403. }
  5404. _createClass(LiteralTransformer, [{
  5405. key: "getVisitor",
  5406. value: function getVisitor() {
  5407. var _this2 = this;
  5408. return {
  5409. enter: function enter(node, parentNode) {
  5410. if (NodeGuards_1.NodeGuards.isLiteralNode(node) && !node.obfuscatedNode) {
  5411. return _this2.transformNode(node, parentNode);
  5412. }
  5413. }
  5414. };
  5415. }
  5416. }, {
  5417. key: "transformNode",
  5418. value: function transformNode(literalNode, parentNode) {
  5419. if (NodeGuards_1.NodeGuards.isPropertyNode(parentNode) && parentNode.key === literalNode) {
  5420. return literalNode;
  5421. }
  5422. switch (_typeof(literalNode.value)) {
  5423. case 'boolean':
  5424. return this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer).replace(literalNode.value);
  5425. case 'number':
  5426. return this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer).replace(literalNode.value);
  5427. case 'string':
  5428. return this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer).replace(literalNode.value);
  5429. default:
  5430. return literalNode;
  5431. }
  5432. }
  5433. }]);
  5434. return LiteralTransformer;
  5435. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5436. LiteralTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], LiteralTransformer);
  5437. exports.LiteralTransformer = LiteralTransformer;
  5438. /***/ }),
  5439. /* 119 */
  5440. /***/ (function(module, exports, __webpack_require__) {
  5441. "use strict";
  5442. 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; }; })();
  5443. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5444. 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; }
  5445. 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; }
  5446. Object.defineProperty(exports, "__esModule", { value: true });
  5447. var tslib_1 = __webpack_require__(2);
  5448. var inversify_1 = __webpack_require__(0);
  5449. var ServiceIdentifiers_1 = __webpack_require__(1);
  5450. var AbstractObfuscatingReplacer_1 = __webpack_require__(26);
  5451. var Nodes_1 = __webpack_require__(9);
  5452. var Utils_1 = __webpack_require__(16);
  5453. var NumberLiteralObfuscatingReplacer = function (_AbstractObfuscatingR) {
  5454. _inherits(NumberLiteralObfuscatingReplacer, _AbstractObfuscatingR);
  5455. function NumberLiteralObfuscatingReplacer(options) {
  5456. _classCallCheck(this, NumberLiteralObfuscatingReplacer);
  5457. var _this = _possibleConstructorReturn(this, (NumberLiteralObfuscatingReplacer.__proto__ || Object.getPrototypeOf(NumberLiteralObfuscatingReplacer)).call(this, options));
  5458. _this.numberLiteralCache = new Map();
  5459. return _this;
  5460. }
  5461. _createClass(NumberLiteralObfuscatingReplacer, [{
  5462. key: "replace",
  5463. value: function replace(nodeValue) {
  5464. var rawValue = void 0;
  5465. if (this.numberLiteralCache.has(nodeValue)) {
  5466. rawValue = this.numberLiteralCache.get(nodeValue);
  5467. } else {
  5468. if (!Utils_1.Utils.isCeilNumber(nodeValue)) {
  5469. rawValue = String(nodeValue);
  5470. } else {
  5471. rawValue = "" + Utils_1.Utils.hexadecimalPrefix + Utils_1.Utils.decToHex(nodeValue);
  5472. }
  5473. this.numberLiteralCache.set(nodeValue, rawValue);
  5474. }
  5475. return Nodes_1.Nodes.getLiteralNode(nodeValue, rawValue);
  5476. }
  5477. }]);
  5478. return NumberLiteralObfuscatingReplacer;
  5479. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  5480. NumberLiteralObfuscatingReplacer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object])], NumberLiteralObfuscatingReplacer);
  5481. exports.NumberLiteralObfuscatingReplacer = NumberLiteralObfuscatingReplacer;
  5482. /***/ }),
  5483. /* 120 */
  5484. /***/ (function(module, exports, __webpack_require__) {
  5485. "use strict";
  5486. 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; }; })();
  5487. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5488. 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; }
  5489. 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; }
  5490. Object.defineProperty(exports, "__esModule", { value: true });
  5491. var tslib_1 = __webpack_require__(2);
  5492. var inversify_1 = __webpack_require__(0);
  5493. var ServiceIdentifiers_1 = __webpack_require__(1);
  5494. var NodeType_1 = __webpack_require__(10);
  5495. var AbstractNodeTransformer_1 = __webpack_require__(7);
  5496. var NodeGuards_1 = __webpack_require__(5);
  5497. var ObjectExpressionTransformer = ObjectExpressionTransformer_1 = function (_AbstractNodeTransfor) {
  5498. _inherits(ObjectExpressionTransformer, _AbstractNodeTransfor);
  5499. function ObjectExpressionTransformer(randomGenerator, options) {
  5500. _classCallCheck(this, ObjectExpressionTransformer);
  5501. return _possibleConstructorReturn(this, (ObjectExpressionTransformer.__proto__ || Object.getPrototypeOf(ObjectExpressionTransformer)).call(this, randomGenerator, options));
  5502. }
  5503. _createClass(ObjectExpressionTransformer, [{
  5504. key: "getVisitor",
  5505. value: function getVisitor() {
  5506. var _this2 = this;
  5507. return {
  5508. enter: function enter(node, parentNode) {
  5509. if (NodeGuards_1.NodeGuards.isObjectExpressionNode(node)) {
  5510. return _this2.transformNode(node, parentNode);
  5511. }
  5512. }
  5513. };
  5514. }
  5515. }, {
  5516. key: "transformNode",
  5517. value: function transformNode(objectExpressionNode, parentNode) {
  5518. objectExpressionNode.properties.forEach(function (property) {
  5519. if (property.computed) {
  5520. return;
  5521. }
  5522. if (property.shorthand) {
  5523. property.shorthand = false;
  5524. }
  5525. if (NodeGuards_1.NodeGuards.isIdentifierNode(property.key)) {
  5526. property.key = ObjectExpressionTransformer_1.transformIdentifierPropertyKey(property.key);
  5527. }
  5528. });
  5529. return objectExpressionNode;
  5530. }
  5531. }], [{
  5532. key: "transformIdentifierPropertyKey",
  5533. value: function transformIdentifierPropertyKey(node) {
  5534. return {
  5535. type: NodeType_1.NodeType.Literal,
  5536. value: node.name,
  5537. raw: "'" + node.name + "'"
  5538. };
  5539. }
  5540. }]);
  5541. return ObjectExpressionTransformer;
  5542. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5543. ObjectExpressionTransformer = ObjectExpressionTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], ObjectExpressionTransformer);
  5544. exports.ObjectExpressionTransformer = ObjectExpressionTransformer;
  5545. var ObjectExpressionTransformer_1;
  5546. /***/ }),
  5547. /* 121 */
  5548. /***/ (function(module, exports, __webpack_require__) {
  5549. "use strict";
  5550. 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; }; })();
  5551. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5552. 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; }
  5553. 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; }
  5554. Object.defineProperty(exports, "__esModule", { value: true });
  5555. var tslib_1 = __webpack_require__(2);
  5556. var inversify_1 = __webpack_require__(0);
  5557. var ServiceIdentifiers_1 = __webpack_require__(1);
  5558. var StringArrayEncoding_1 = __webpack_require__(24);
  5559. var AbstractObfuscatingReplacer_1 = __webpack_require__(26);
  5560. var Nodes_1 = __webpack_require__(9);
  5561. var Utils_1 = __webpack_require__(16);
  5562. var StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer_1 = function (_AbstractObfuscatingR) {
  5563. _inherits(StringLiteralObfuscatingReplacer, _AbstractObfuscatingR);
  5564. function StringLiteralObfuscatingReplacer(customNodeGroupStorage, stringArrayStorage, escapeSequenceEncoder, randomGenerator, cryptUtils, options) {
  5565. _classCallCheck(this, StringLiteralObfuscatingReplacer);
  5566. var _this = _possibleConstructorReturn(this, (StringLiteralObfuscatingReplacer.__proto__ || Object.getPrototypeOf(StringLiteralObfuscatingReplacer)).call(this, options));
  5567. _this.nodesCache = new Map();
  5568. _this.stringLiteralHexadecimalIndexCache = new Map();
  5569. _this.customNodeGroupStorage = customNodeGroupStorage;
  5570. _this.stringArrayStorage = stringArrayStorage;
  5571. _this.escapeSequenceEncoder = escapeSequenceEncoder;
  5572. _this.randomGenerator = randomGenerator;
  5573. _this.cryptUtils = cryptUtils;
  5574. _this.rc4Keys = _this.randomGenerator.getRandomGenerator().n(function () {
  5575. return _this.randomGenerator.getRandomGenerator().string({
  5576. length: StringLiteralObfuscatingReplacer_1.rc4KeyLength
  5577. });
  5578. }, StringLiteralObfuscatingReplacer_1.rc4KeysCount);
  5579. return _this;
  5580. }
  5581. _createClass(StringLiteralObfuscatingReplacer, [{
  5582. key: "replace",
  5583. value: function replace(nodeValue) {
  5584. var useStringArray = this.canUseStringArray(nodeValue);
  5585. var cacheKey = nodeValue + "-" + String(useStringArray);
  5586. var useCacheValue = this.nodesCache.has(cacheKey) && this.options.stringArrayEncoding !== StringArrayEncoding_1.StringArrayEncoding.Rc4;
  5587. if (useCacheValue) {
  5588. return this.nodesCache.get(cacheKey);
  5589. }
  5590. var resultNode = useStringArray ? this.replaceWithStringArrayCallNode(nodeValue) : this.replaceWithLiteralNode(nodeValue);
  5591. this.nodesCache.set(cacheKey, resultNode);
  5592. return resultNode;
  5593. }
  5594. }, {
  5595. key: "canUseStringArray",
  5596. value: function canUseStringArray(nodeValue) {
  5597. return this.options.stringArray && nodeValue.length >= StringLiteralObfuscatingReplacer_1.minimumLengthForStringArray && this.randomGenerator.getMathRandom() <= this.options.stringArrayThreshold;
  5598. }
  5599. }, {
  5600. key: "getStringArrayHexadecimalIndex",
  5601. value: function getStringArrayHexadecimalIndex(value, stringArrayStorageLength) {
  5602. if (this.stringLiteralHexadecimalIndexCache.has(value)) {
  5603. return {
  5604. fromCache: true,
  5605. index: this.stringLiteralHexadecimalIndexCache.get(value)
  5606. };
  5607. }
  5608. var hexadecimalRawIndex = Utils_1.Utils.decToHex(stringArrayStorageLength);
  5609. var hexadecimalIndex = "" + Utils_1.Utils.hexadecimalPrefix + hexadecimalRawIndex;
  5610. this.stringLiteralHexadecimalIndexCache.set(value, hexadecimalIndex);
  5611. return {
  5612. fromCache: false,
  5613. index: hexadecimalIndex
  5614. };
  5615. }
  5616. }, {
  5617. key: "getEncodedValue",
  5618. value: function getEncodedValue(value) {
  5619. var encodedValue = void 0,
  5620. key = null;
  5621. switch (this.options.stringArrayEncoding) {
  5622. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  5623. key = this.randomGenerator.getRandomGenerator().pickone(this.rc4Keys);
  5624. encodedValue = this.cryptUtils.btoa(this.cryptUtils.rc4(value, key));
  5625. break;
  5626. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  5627. encodedValue = this.cryptUtils.btoa(value);
  5628. break;
  5629. default:
  5630. encodedValue = value;
  5631. }
  5632. return { encodedValue: encodedValue, key: key };
  5633. }
  5634. }, {
  5635. key: "replaceWithLiteralNode",
  5636. value: function replaceWithLiteralNode(value) {
  5637. return Nodes_1.Nodes.getLiteralNode(this.escapeSequenceEncoder.encode(value, this.options.unicodeEscapeSequence));
  5638. }
  5639. }, {
  5640. key: "replaceWithStringArrayCallNode",
  5641. value: function replaceWithStringArrayCallNode(value) {
  5642. var _getEncodedValue = this.getEncodedValue(value),
  5643. encodedValue = _getEncodedValue.encodedValue,
  5644. key = _getEncodedValue.key;
  5645. var escapedValue = this.escapeSequenceEncoder.encode(encodedValue, this.options.unicodeEscapeSequence);
  5646. var stringArrayStorageLength = this.stringArrayStorage.getLength();
  5647. var rotatedStringArrayStorageId = Utils_1.Utils.stringRotate(this.stringArrayStorage.getStorageId(), 1);
  5648. var stringArrayStorageCallsWrapperName = "_" + Utils_1.Utils.hexadecimalPrefix + rotatedStringArrayStorageId;
  5649. var _getStringArrayHexade = this.getStringArrayHexadecimalIndex(escapedValue, stringArrayStorageLength),
  5650. fromCache = _getStringArrayHexade.fromCache,
  5651. index = _getStringArrayHexade.index;
  5652. if (!fromCache) {
  5653. this.stringArrayStorage.set(stringArrayStorageLength, escapedValue);
  5654. }
  5655. var callExpressionArgs = [StringLiteralObfuscatingReplacer_1.getHexadecimalLiteralNode(index)];
  5656. if (key) {
  5657. callExpressionArgs.push(StringLiteralObfuscatingReplacer_1.getRc4KeyLiteralNode(this.escapeSequenceEncoder.encode(key, this.options.unicodeEscapeSequence)));
  5658. }
  5659. return Nodes_1.Nodes.getCallExpressionNode(Nodes_1.Nodes.getIdentifierNode(stringArrayStorageCallsWrapperName), callExpressionArgs);
  5660. }
  5661. }], [{
  5662. key: "getHexadecimalLiteralNode",
  5663. value: function getHexadecimalLiteralNode(hexadecimalIndex) {
  5664. var hexadecimalLiteralNode = Nodes_1.Nodes.getLiteralNode(hexadecimalIndex);
  5665. hexadecimalLiteralNode.obfuscatedNode = true;
  5666. return hexadecimalLiteralNode;
  5667. }
  5668. }, {
  5669. key: "getRc4KeyLiteralNode",
  5670. value: function getRc4KeyLiteralNode(literalValue) {
  5671. var rc4KeyLiteralNode = Nodes_1.Nodes.getLiteralNode(literalValue);
  5672. rc4KeyLiteralNode.obfuscatedNode = true;
  5673. return rc4KeyLiteralNode;
  5674. }
  5675. }]);
  5676. return StringLiteralObfuscatingReplacer;
  5677. }(AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer);
  5678. StringLiteralObfuscatingReplacer.minimumLengthForStringArray = 3;
  5679. StringLiteralObfuscatingReplacer.rc4KeyLength = 4;
  5680. StringLiteralObfuscatingReplacer.rc4KeysCount = 50;
  5681. StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.TCustomNodeGroupStorage)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.TStringArrayStorage)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils)), tslib_1.__param(5, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object, Object, Object, Object, Object])], StringLiteralObfuscatingReplacer);
  5682. exports.StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer;
  5683. var StringLiteralObfuscatingReplacer_1;
  5684. /***/ }),
  5685. /* 122 */
  5686. /***/ (function(module, exports, __webpack_require__) {
  5687. "use strict";
  5688. 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; }; })();
  5689. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5690. 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; }
  5691. 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; }
  5692. Object.defineProperty(exports, "__esModule", { value: true });
  5693. var tslib_1 = __webpack_require__(2);
  5694. var inversify_1 = __webpack_require__(0);
  5695. var ServiceIdentifiers_1 = __webpack_require__(1);
  5696. var estraverse = __webpack_require__(8);
  5697. var IdentifierObfuscatingReplacer_1 = __webpack_require__(17);
  5698. var NodeType_1 = __webpack_require__(10);
  5699. var AbstractNodeTransformer_1 = __webpack_require__(7);
  5700. var NodeGuards_1 = __webpack_require__(5);
  5701. var NodeUtils_1 = __webpack_require__(4);
  5702. var VariableDeclarationTransformer = function (_AbstractNodeTransfor) {
  5703. _inherits(VariableDeclarationTransformer, _AbstractNodeTransfor);
  5704. function VariableDeclarationTransformer(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  5705. _classCallCheck(this, VariableDeclarationTransformer);
  5706. var _this = _possibleConstructorReturn(this, (VariableDeclarationTransformer.__proto__ || Object.getPrototypeOf(VariableDeclarationTransformer)).call(this, randomGenerator, options));
  5707. _this.replaceableIdentifiers = new Map();
  5708. _this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  5709. return _this;
  5710. }
  5711. _createClass(VariableDeclarationTransformer, [{
  5712. key: "getVisitor",
  5713. value: function getVisitor() {
  5714. var _this2 = this;
  5715. return {
  5716. enter: function enter(node, parentNode) {
  5717. if (NodeGuards_1.NodeGuards.isVariableDeclarationNode(node)) {
  5718. return _this2.transformNode(node, parentNode);
  5719. }
  5720. }
  5721. };
  5722. }
  5723. }, {
  5724. key: "transformNode",
  5725. value: function transformNode(variableDeclarationNode, parentNode) {
  5726. var blockScopeOfVariableDeclarationNode = NodeUtils_1.NodeUtils.getBlockScopesOfNode(variableDeclarationNode)[0];
  5727. if (!this.options.renameGlobals && blockScopeOfVariableDeclarationNode.type === NodeType_1.NodeType.Program) {
  5728. return variableDeclarationNode;
  5729. }
  5730. var nodeIdentifier = this.nodeIdentifier++;
  5731. var scopeNode = variableDeclarationNode.kind === 'var' ? blockScopeOfVariableDeclarationNode : parentNode;
  5732. this.storeVariableNames(variableDeclarationNode, nodeIdentifier);
  5733. if (this.replaceableIdentifiers.has(scopeNode)) {
  5734. this.replaceScopeCachedIdentifiers(scopeNode, nodeIdentifier);
  5735. } else {
  5736. this.replaceScopeIdentifiers(scopeNode, nodeIdentifier);
  5737. }
  5738. return variableDeclarationNode;
  5739. }
  5740. }, {
  5741. key: "storeVariableNames",
  5742. value: function storeVariableNames(variableDeclarationNode, nodeIdentifier) {
  5743. var _this3 = this;
  5744. variableDeclarationNode.declarations.forEach(function (declarationNode) {
  5745. if (NodeGuards_1.NodeGuards.isObjectPatternNode(declarationNode.id)) {
  5746. return estraverse.VisitorOption.Skip;
  5747. }
  5748. NodeUtils_1.NodeUtils.typedTraverse(declarationNode.id, NodeType_1.NodeType.Identifier, {
  5749. enter: function enter(node) {
  5750. return _this3.identifierObfuscatingReplacer.storeNames(node.name, nodeIdentifier);
  5751. }
  5752. });
  5753. });
  5754. }
  5755. }, {
  5756. key: "replaceScopeCachedIdentifiers",
  5757. value: function replaceScopeCachedIdentifiers(scopeNode, nodeIdentifier) {
  5758. var _this4 = this;
  5759. var cachedReplaceableIdentifiers = this.replaceableIdentifiers.get(scopeNode);
  5760. cachedReplaceableIdentifiers.forEach(function (replaceableIdentifier) {
  5761. var newReplaceableIdentifier = _this4.identifierObfuscatingReplacer.replace(replaceableIdentifier.name, nodeIdentifier);
  5762. replaceableIdentifier.name = newReplaceableIdentifier.name;
  5763. });
  5764. }
  5765. }, {
  5766. key: "replaceScopeIdentifiers",
  5767. value: function replaceScopeIdentifiers(scopeNode, nodeIdentifier) {
  5768. var _this5 = this;
  5769. var storedReplaceableIdentifiers = [];
  5770. estraverse.replace(scopeNode, {
  5771. enter: function enter(node, parentNode) {
  5772. if (!node.obfuscatedNode && NodeGuards_1.NodeGuards.isReplaceableIdentifierNode(node, parentNode)) {
  5773. var newIdentifier = _this5.identifierObfuscatingReplacer.replace(node.name, nodeIdentifier);
  5774. var newIdentifierName = newIdentifier.name;
  5775. if (node.name !== newIdentifierName) {
  5776. node.name = newIdentifierName;
  5777. } else {
  5778. storedReplaceableIdentifiers.push(node);
  5779. }
  5780. }
  5781. }
  5782. });
  5783. this.replaceableIdentifiers.set(scopeNode, storedReplaceableIdentifiers);
  5784. }
  5785. }]);
  5786. return VariableDeclarationTransformer;
  5787. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5788. VariableDeclarationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], VariableDeclarationTransformer);
  5789. exports.VariableDeclarationTransformer = VariableDeclarationTransformer;
  5790. /***/ }),
  5791. /* 123 */
  5792. /***/ (function(module, exports, __webpack_require__) {
  5793. "use strict";
  5794. Object.defineProperty(exports, "__esModule", { value: true });
  5795. var InversifyContainerFacade_1 = __webpack_require__(14);
  5796. var inversify_1 = __webpack_require__(0);
  5797. var ServiceIdentifiers_1 = __webpack_require__(1);
  5798. var NodeTransformer_1 = __webpack_require__(21);
  5799. var ObfuscatingGuard_1 = __webpack_require__(41);
  5800. var BlackListObfuscatingGuard_1 = __webpack_require__(124);
  5801. var ConditionalCommentObfuscatingGuard_1 = __webpack_require__(125);
  5802. var ObfuscatingGuardsTransformer_1 = __webpack_require__(126);
  5803. var ParentificationTransformer_1 = __webpack_require__(127);
  5804. exports.preparingTransformersModule = new inversify_1.ContainerModule(function (bind) {
  5805. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ObfuscatingGuardsTransformer_1.ObfuscatingGuardsTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ObfuscatingGuardsTransformer);
  5806. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer).to(ParentificationTransformer_1.ParentificationTransformer).whenTargetNamed(NodeTransformer_1.NodeTransformer.ParentificationTransformer);
  5807. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard).to(BlackListObfuscatingGuard_1.BlackListObfuscatingGuard).inSingletonScope().whenTargetNamed(ObfuscatingGuard_1.ObfuscatingGuard.BlackListNodeGuard);
  5808. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard).to(ConditionalCommentObfuscatingGuard_1.ConditionalCommentObfuscatingGuard).inSingletonScope().whenTargetNamed(ObfuscatingGuard_1.ObfuscatingGuard.ConditionalCommentNodeGuard);
  5809. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeGuard).toFactory(InversifyContainerFacade_1.InversifyContainerFacade.getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard));
  5810. });
  5811. /***/ }),
  5812. /* 124 */
  5813. /***/ (function(module, exports, __webpack_require__) {
  5814. "use strict";
  5815. 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; }; })();
  5816. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5817. Object.defineProperty(exports, "__esModule", { value: true });
  5818. var tslib_1 = __webpack_require__(2);
  5819. var inversify_1 = __webpack_require__(0);
  5820. var NodeGuards_1 = __webpack_require__(5);
  5821. var BlackListObfuscatingGuard = BlackListObfuscatingGuard_1 = function () {
  5822. function BlackListObfuscatingGuard() {
  5823. _classCallCheck(this, BlackListObfuscatingGuard);
  5824. this.blackListGuardsLength = BlackListObfuscatingGuard_1.blackListGuards.length;
  5825. }
  5826. _createClass(BlackListObfuscatingGuard, [{
  5827. key: "check",
  5828. value: function check(node) {
  5829. for (var i = 0; i < this.blackListGuardsLength; i++) {
  5830. if (BlackListObfuscatingGuard_1.blackListGuards[i](node)) {
  5831. return false;
  5832. }
  5833. }
  5834. return true;
  5835. }
  5836. }]);
  5837. return BlackListObfuscatingGuard;
  5838. }();
  5839. BlackListObfuscatingGuard.blackListGuards = [NodeGuards_1.NodeGuards.isUseStrictOperator];
  5840. BlackListObfuscatingGuard = BlackListObfuscatingGuard_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__metadata("design:paramtypes", [])], BlackListObfuscatingGuard);
  5841. exports.BlackListObfuscatingGuard = BlackListObfuscatingGuard;
  5842. var BlackListObfuscatingGuard_1;
  5843. /***/ }),
  5844. /* 125 */
  5845. /***/ (function(module, exports, __webpack_require__) {
  5846. "use strict";
  5847. 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; }; })();
  5848. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5849. Object.defineProperty(exports, "__esModule", { value: true });
  5850. var tslib_1 = __webpack_require__(2);
  5851. var inversify_1 = __webpack_require__(0);
  5852. var ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard_1 = function () {
  5853. function ConditionalCommentObfuscatingGuard() {
  5854. _classCallCheck(this, ConditionalCommentObfuscatingGuard);
  5855. this.obfuscationAllowedForCurrentNode = true;
  5856. this.obfuscationAllowedForNextNode = null;
  5857. }
  5858. _createClass(ConditionalCommentObfuscatingGuard, [{
  5859. key: "check",
  5860. value: function check(node) {
  5861. if (this.obfuscationAllowedForNextNode) {
  5862. this.obfuscationAllowedForCurrentNode = this.obfuscationAllowedForNextNode;
  5863. this.obfuscationAllowedForNextNode = null;
  5864. }
  5865. if (!node.leadingComments && !node.trailingComments) {
  5866. return this.obfuscationAllowedForCurrentNode;
  5867. }
  5868. var leadingComments = node.leadingComments;
  5869. var trailingComments = node.trailingComments;
  5870. if (leadingComments) {
  5871. this.obfuscationAllowedForCurrentNode = this.checkComments(leadingComments);
  5872. }
  5873. if (trailingComments) {
  5874. this.obfuscationAllowedForNextNode = this.checkComments(trailingComments);
  5875. }
  5876. return this.obfuscationAllowedForCurrentNode;
  5877. }
  5878. }, {
  5879. key: "checkComments",
  5880. value: function checkComments(comments) {
  5881. var commentsLength = comments.length;
  5882. var obfuscationAllowed = this.obfuscationAllowedForCurrentNode;
  5883. for (var i = 0; i < commentsLength; i++) {
  5884. var comment = comments[i];
  5885. if (ConditionalCommentObfuscatingGuard_1.obfuscationEnableCommentRegExp.test(comment.value)) {
  5886. obfuscationAllowed = true;
  5887. continue;
  5888. }
  5889. if (ConditionalCommentObfuscatingGuard_1.obfuscationDisableCommentRegExp.test(comment.value)) {
  5890. obfuscationAllowed = false;
  5891. }
  5892. }
  5893. return obfuscationAllowed;
  5894. }
  5895. }]);
  5896. return ConditionalCommentObfuscatingGuard;
  5897. }();
  5898. ConditionalCommentObfuscatingGuard.obfuscationEnableCommentRegExp = new RegExp('javascript-obfuscator *: *enable');
  5899. ConditionalCommentObfuscatingGuard.obfuscationDisableCommentRegExp = new RegExp('javascript-obfuscator *: *disable');
  5900. ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard_1 = tslib_1.__decorate([inversify_1.injectable()], ConditionalCommentObfuscatingGuard);
  5901. exports.ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard;
  5902. var ConditionalCommentObfuscatingGuard_1;
  5903. /***/ }),
  5904. /* 126 */
  5905. /***/ (function(module, exports, __webpack_require__) {
  5906. "use strict";
  5907. 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; }; })();
  5908. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5909. 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; }
  5910. 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; }
  5911. Object.defineProperty(exports, "__esModule", { value: true });
  5912. var tslib_1 = __webpack_require__(2);
  5913. var inversify_1 = __webpack_require__(0);
  5914. var ServiceIdentifiers_1 = __webpack_require__(1);
  5915. var ObfuscatingGuard_1 = __webpack_require__(41);
  5916. var AbstractNodeTransformer_1 = __webpack_require__(7);
  5917. var ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer_1 = function (_AbstractNodeTransfor) {
  5918. _inherits(ObfuscatingGuardsTransformer, _AbstractNodeTransfor);
  5919. function ObfuscatingGuardsTransformer(obfuscatingGuardFactory, randomGenerator, options) {
  5920. _classCallCheck(this, ObfuscatingGuardsTransformer);
  5921. var _this = _possibleConstructorReturn(this, (ObfuscatingGuardsTransformer.__proto__ || Object.getPrototypeOf(ObfuscatingGuardsTransformer)).call(this, randomGenerator, options));
  5922. _this.obfuscatingGuards = ObfuscatingGuardsTransformer_1.obfuscatingGuardsList.map(obfuscatingGuardFactory);
  5923. return _this;
  5924. }
  5925. _createClass(ObfuscatingGuardsTransformer, [{
  5926. key: "getVisitor",
  5927. value: function getVisitor() {
  5928. var _this2 = this;
  5929. return {
  5930. enter: function enter(node, parentNode) {
  5931. return _this2.transformNode(node, parentNode);
  5932. }
  5933. };
  5934. }
  5935. }, {
  5936. key: "transformNode",
  5937. value: function transformNode(node, parentNode) {
  5938. var obfuscationAllowed = this.obfuscatingGuards.every(function (nodeGuard) {
  5939. return nodeGuard.check(node);
  5940. });
  5941. node.ignoredNode = !obfuscationAllowed;
  5942. return node;
  5943. }
  5944. }]);
  5945. return ObfuscatingGuardsTransformer;
  5946. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5947. ObfuscatingGuardsTransformer.obfuscatingGuardsList = [ObfuscatingGuard_1.ObfuscatingGuard.BlackListNodeGuard, ObfuscatingGuard_1.ObfuscatingGuard.ConditionalCommentNodeGuard];
  5948. ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeGuard)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], ObfuscatingGuardsTransformer);
  5949. exports.ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer;
  5950. var ObfuscatingGuardsTransformer_1;
  5951. /***/ }),
  5952. /* 127 */
  5953. /***/ (function(module, exports, __webpack_require__) {
  5954. "use strict";
  5955. 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; }; })();
  5956. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5957. 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; }
  5958. 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; }
  5959. Object.defineProperty(exports, "__esModule", { value: true });
  5960. var tslib_1 = __webpack_require__(2);
  5961. var inversify_1 = __webpack_require__(0);
  5962. var ServiceIdentifiers_1 = __webpack_require__(1);
  5963. var AbstractNodeTransformer_1 = __webpack_require__(7);
  5964. var NodeUtils_1 = __webpack_require__(4);
  5965. var ParentificationTransformer = function (_AbstractNodeTransfor) {
  5966. _inherits(ParentificationTransformer, _AbstractNodeTransfor);
  5967. function ParentificationTransformer(randomGenerator, options) {
  5968. _classCallCheck(this, ParentificationTransformer);
  5969. return _possibleConstructorReturn(this, (ParentificationTransformer.__proto__ || Object.getPrototypeOf(ParentificationTransformer)).call(this, randomGenerator, options));
  5970. }
  5971. _createClass(ParentificationTransformer, [{
  5972. key: "getVisitor",
  5973. value: function getVisitor() {
  5974. var _this2 = this;
  5975. return {
  5976. enter: function enter(node, parentNode) {
  5977. return _this2.transformNode(node, parentNode);
  5978. }
  5979. };
  5980. }
  5981. }, {
  5982. key: "transformNode",
  5983. value: function transformNode(node, parentNode) {
  5984. return NodeUtils_1.NodeUtils.parentizeNode(node, parentNode);
  5985. }
  5986. }]);
  5987. return ParentificationTransformer;
  5988. }(AbstractNodeTransformer_1.AbstractNodeTransformer);
  5989. ParentificationTransformer = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object])], ParentificationTransformer);
  5990. exports.ParentificationTransformer = ParentificationTransformer;
  5991. /***/ }),
  5992. /* 128 */
  5993. /***/ (function(module, exports, __webpack_require__) {
  5994. "use strict";
  5995. Object.defineProperty(exports, "__esModule", { value: true });
  5996. var inversify_1 = __webpack_require__(0);
  5997. var ServiceIdentifiers_1 = __webpack_require__(1);
  5998. var ControlFlowStorage_1 = __webpack_require__(129);
  5999. var CustomNodeGroupStorage_1 = __webpack_require__(130);
  6000. var StringArrayStorage_1 = __webpack_require__(131);
  6001. exports.storagesModule = new inversify_1.ContainerModule(function (bind) {
  6002. bind(ServiceIdentifiers_1.ServiceIdentifiers.TCustomNodeGroupStorage).to(CustomNodeGroupStorage_1.CustomNodeGroupStorage).inSingletonScope();
  6003. bind(ServiceIdentifiers_1.ServiceIdentifiers.TStringArrayStorage).to(StringArrayStorage_1.StringArrayStorage).inSingletonScope();
  6004. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__TControlFlowStorage).toConstructor(ControlFlowStorage_1.ControlFlowStorage);
  6005. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__TControlFlowStorage).toFactory(function (context) {
  6006. return function () {
  6007. var constructor = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.Newable__TControlFlowStorage);
  6008. var randomGenerator = context.container.get(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator);
  6009. var storage = new constructor(randomGenerator);
  6010. storage.initialize();
  6011. return storage;
  6012. };
  6013. });
  6014. });
  6015. /***/ }),
  6016. /* 129 */
  6017. /***/ (function(module, exports, __webpack_require__) {
  6018. "use strict";
  6019. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6020. 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; }
  6021. 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; }
  6022. Object.defineProperty(exports, "__esModule", { value: true });
  6023. var tslib_1 = __webpack_require__(2);
  6024. var inversify_1 = __webpack_require__(0);
  6025. var ServiceIdentifiers_1 = __webpack_require__(1);
  6026. var MapStorage_1 = __webpack_require__(42);
  6027. var ControlFlowStorage = function (_MapStorage_1$MapStor) {
  6028. _inherits(ControlFlowStorage, _MapStorage_1$MapStor);
  6029. function ControlFlowStorage(randomGenerator) {
  6030. _classCallCheck(this, ControlFlowStorage);
  6031. return _possibleConstructorReturn(this, (ControlFlowStorage.__proto__ || Object.getPrototypeOf(ControlFlowStorage)).call(this, randomGenerator));
  6032. }
  6033. return ControlFlowStorage;
  6034. }(MapStorage_1.MapStorage);
  6035. ControlFlowStorage = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__metadata("design:paramtypes", [Object])], ControlFlowStorage);
  6036. exports.ControlFlowStorage = ControlFlowStorage;
  6037. /***/ }),
  6038. /* 130 */
  6039. /***/ (function(module, exports, __webpack_require__) {
  6040. "use strict";
  6041. 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; }; })();
  6042. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6043. 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; }
  6044. 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; }
  6045. Object.defineProperty(exports, "__esModule", { value: true });
  6046. var tslib_1 = __webpack_require__(2);
  6047. var inversify_1 = __webpack_require__(0);
  6048. var ServiceIdentifiers_1 = __webpack_require__(1);
  6049. var CustomNodeGroup_1 = __webpack_require__(39);
  6050. var MapStorage_1 = __webpack_require__(42);
  6051. var CustomNodeGroupStorage = CustomNodeGroupStorage_1 = function (_MapStorage_1$MapStor) {
  6052. _inherits(CustomNodeGroupStorage, _MapStorage_1$MapStor);
  6053. function CustomNodeGroupStorage(customNodeGroupFactory, randomGenerator, options) {
  6054. _classCallCheck(this, CustomNodeGroupStorage);
  6055. var _this = _possibleConstructorReturn(this, (CustomNodeGroupStorage.__proto__ || Object.getPrototypeOf(CustomNodeGroupStorage)).call(this, randomGenerator));
  6056. _this.customNodeGroupFactory = customNodeGroupFactory;
  6057. _this.options = options;
  6058. return _this;
  6059. }
  6060. _createClass(CustomNodeGroupStorage, [{
  6061. key: "initialize",
  6062. value: function initialize() {
  6063. var _this2 = this;
  6064. this.storage = new Map();
  6065. this.storageId = this.randomGenerator.getRandomString(6);
  6066. CustomNodeGroupStorage_1.customNodeGroupsList.forEach(function (customNodeGroupName) {
  6067. var customNodeGroup = _this2.customNodeGroupFactory(customNodeGroupName);
  6068. if (!customNodeGroup) {
  6069. return;
  6070. }
  6071. _this2.storage.set(customNodeGroupName, customNodeGroup);
  6072. });
  6073. }
  6074. }]);
  6075. return CustomNodeGroupStorage;
  6076. }(MapStorage_1.MapStorage);
  6077. CustomNodeGroupStorage.customNodeGroupsList = [CustomNodeGroup_1.CustomNodeGroup.ConsoleOutputCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.DebugProtectionCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.DomainLockCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.SelfDefendingCustomNodeGroup, CustomNodeGroup_1.CustomNodeGroup.StringArrayCustomNodeGroup];
  6078. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], CustomNodeGroupStorage.prototype, "initialize", null);
  6079. CustomNodeGroupStorage = CustomNodeGroupStorage_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNodeGroup)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], CustomNodeGroupStorage);
  6080. exports.CustomNodeGroupStorage = CustomNodeGroupStorage;
  6081. var CustomNodeGroupStorage_1;
  6082. /***/ }),
  6083. /* 131 */
  6084. /***/ (function(module, exports, __webpack_require__) {
  6085. "use strict";
  6086. 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; }; })();
  6087. 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); } });
  6088. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6089. 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; }
  6090. 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; }
  6091. Object.defineProperty(exports, "__esModule", { value: true });
  6092. var tslib_1 = __webpack_require__(2);
  6093. var inversify_1 = __webpack_require__(0);
  6094. var ServiceIdentifiers_1 = __webpack_require__(1);
  6095. var ArrayStorage_1 = __webpack_require__(132);
  6096. var RandomGenerator_1 = __webpack_require__(31);
  6097. var StringArrayStorage = function (_ArrayStorage_1$Array) {
  6098. _inherits(StringArrayStorage, _ArrayStorage_1$Array);
  6099. function StringArrayStorage(arrayUtils, randomGenerator) {
  6100. _classCallCheck(this, StringArrayStorage);
  6101. var _this = _possibleConstructorReturn(this, (StringArrayStorage.__proto__ || Object.getPrototypeOf(StringArrayStorage)).call(this, randomGenerator));
  6102. _this.arrayUtils = arrayUtils;
  6103. return _this;
  6104. }
  6105. _createClass(StringArrayStorage, [{
  6106. key: "initialize",
  6107. value: function initialize() {
  6108. _get(StringArrayStorage.prototype.__proto__ || Object.getPrototypeOf(StringArrayStorage.prototype), "initialize", this).call(this);
  6109. this.storageId = this.randomGenerator.getRandomString(4, RandomGenerator_1.RandomGenerator.randomGeneratorPoolHexadecimal);
  6110. }
  6111. }, {
  6112. key: "rotateArray",
  6113. value: function rotateArray(rotationValue) {
  6114. this.storage = this.arrayUtils.arrayRotate(this.storage, rotationValue);
  6115. }
  6116. }, {
  6117. key: "toString",
  6118. value: function toString() {
  6119. return this.storage.map(function (value) {
  6120. return "'" + value + "'";
  6121. }).toString();
  6122. }
  6123. }]);
  6124. return StringArrayStorage;
  6125. }(ArrayStorage_1.ArrayStorage);
  6126. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], StringArrayStorage.prototype, "initialize", null);
  6127. StringArrayStorage = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__metadata("design:paramtypes", [Object, Object])], StringArrayStorage);
  6128. exports.StringArrayStorage = StringArrayStorage;
  6129. /***/ }),
  6130. /* 132 */
  6131. /***/ (function(module, exports, __webpack_require__) {
  6132. "use strict";
  6133. 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; }; })();
  6134. 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); } }
  6135. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6136. Object.defineProperty(exports, "__esModule", { value: true });
  6137. var tslib_1 = __webpack_require__(2);
  6138. var inversify_1 = __webpack_require__(0);
  6139. var ServiceIdentifiers_1 = __webpack_require__(1);
  6140. var Initializable_1 = __webpack_require__(3);
  6141. var ArrayStorage = function () {
  6142. function ArrayStorage(randomGenerator) {
  6143. _classCallCheck(this, ArrayStorage);
  6144. this.storageLength = 0;
  6145. this.randomGenerator = randomGenerator;
  6146. }
  6147. _createClass(ArrayStorage, [{
  6148. key: "initialize",
  6149. value: function initialize() {
  6150. this.storage = [];
  6151. this.storageId = this.randomGenerator.getRandomString(6);
  6152. }
  6153. }, {
  6154. key: "get",
  6155. value: function get(key) {
  6156. var value = this.storage[key];
  6157. if (!value) {
  6158. throw new Error("No value found in array storage with key `" + key + "`");
  6159. }
  6160. return value;
  6161. }
  6162. }, {
  6163. key: "getKeyOf",
  6164. value: function getKeyOf(value) {
  6165. var key = this.storage.indexOf(value);
  6166. return key >= 0 ? key : null;
  6167. }
  6168. }, {
  6169. key: "getLength",
  6170. value: function getLength() {
  6171. return this.storageLength;
  6172. }
  6173. }, {
  6174. key: "getStorage",
  6175. value: function getStorage() {
  6176. return this.storage;
  6177. }
  6178. }, {
  6179. key: "getStorageId",
  6180. value: function getStorageId() {
  6181. return this.storageId;
  6182. }
  6183. }, {
  6184. key: "mergeWith",
  6185. value: function mergeWith(storage) {
  6186. var mergeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6187. this.storage = [].concat(_toConsumableArray(this.storage), _toConsumableArray(storage.getStorage()));
  6188. if (mergeId) {
  6189. this.storageId = storage.getStorageId();
  6190. }
  6191. }
  6192. }, {
  6193. key: "set",
  6194. value: function set(key, value) {
  6195. if (key === this.storageLength) {
  6196. this.storage.push(value);
  6197. } else {
  6198. this.storage.splice(key, 0, value);
  6199. }
  6200. this.storageLength++;
  6201. }
  6202. }]);
  6203. return ArrayStorage;
  6204. }();
  6205. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Array)], ArrayStorage.prototype, "storage", void 0);
  6206. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ArrayStorage.prototype, "storageId", void 0);
  6207. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], ArrayStorage.prototype, "initialize", null);
  6208. ArrayStorage = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__metadata("design:paramtypes", [Object])], ArrayStorage);
  6209. exports.ArrayStorage = ArrayStorage;
  6210. /***/ }),
  6211. /* 133 */
  6212. /***/ (function(module, exports) {
  6213. module.exports = require("md5");
  6214. /***/ }),
  6215. /* 134 */
  6216. /***/ (function(module, exports) {
  6217. module.exports = require("chance");
  6218. /***/ }),
  6219. /* 135 */
  6220. /***/ (function(module, exports, __webpack_require__) {
  6221. "use strict";
  6222. Object.defineProperty(exports, "__esModule", { value: true });
  6223. var inversify_1 = __webpack_require__(0);
  6224. var ServiceIdentifiers_1 = __webpack_require__(1);
  6225. var ArrayUtils_1 = __webpack_require__(136);
  6226. var CryptUtils_1 = __webpack_require__(137);
  6227. var EscapeSequenceEncoder_1 = __webpack_require__(138);
  6228. var RandomGenerator_1 = __webpack_require__(31);
  6229. exports.utilsModule = new inversify_1.ContainerModule(function (bind) {
  6230. bind(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils).to(ArrayUtils_1.ArrayUtils).inSingletonScope();
  6231. bind(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator).to(RandomGenerator_1.RandomGenerator).inSingletonScope();
  6232. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils).to(CryptUtils_1.CryptUtils).inSingletonScope();
  6233. bind(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder).to(EscapeSequenceEncoder_1.EscapeSequenceEncoder).inSingletonScope();
  6234. });
  6235. /***/ }),
  6236. /* 136 */
  6237. /***/ (function(module, exports, __webpack_require__) {
  6238. "use strict";
  6239. 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; }; })();
  6240. 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); } }
  6241. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6242. Object.defineProperty(exports, "__esModule", { value: true });
  6243. var tslib_1 = __webpack_require__(2);
  6244. var inversify_1 = __webpack_require__(0);
  6245. var ServiceIdentifiers_1 = __webpack_require__(1);
  6246. var ArrayUtils = function () {
  6247. function ArrayUtils(randomGenerator) {
  6248. _classCallCheck(this, ArrayUtils);
  6249. this.randomGenerator = randomGenerator;
  6250. }
  6251. _createClass(ArrayUtils, [{
  6252. key: "arrayRange",
  6253. value: function arrayRange(length) {
  6254. var range = [];
  6255. for (var i = 0; i < length; i++) {
  6256. range.push(i);
  6257. }
  6258. return range;
  6259. }
  6260. }, {
  6261. key: "arrayRotate",
  6262. value: function arrayRotate(array, times) {
  6263. if (!array.length) {
  6264. throw new ReferenceError("Cannot rotate empty array.");
  6265. }
  6266. if (times <= 0) {
  6267. return array;
  6268. }
  6269. var newArray = array;
  6270. var temp = void 0;
  6271. while (times--) {
  6272. temp = newArray.pop();
  6273. newArray.unshift(temp);
  6274. }
  6275. return newArray;
  6276. }
  6277. }, {
  6278. key: "arrayShuffle",
  6279. value: function arrayShuffle(array) {
  6280. var shuffledArray = [].concat(_toConsumableArray(array));
  6281. for (var i = shuffledArray.length; i; i--) {
  6282. var j = Math.floor(this.randomGenerator.getMathRandom() * i);
  6283. var _ref = [shuffledArray[j], shuffledArray[i - 1]];
  6284. shuffledArray[i - 1] = _ref[0];
  6285. shuffledArray[j] = _ref[1];
  6286. }
  6287. return shuffledArray;
  6288. }
  6289. }]);
  6290. return ArrayUtils;
  6291. }();
  6292. ArrayUtils = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__metadata("design:paramtypes", [Object])], ArrayUtils);
  6293. exports.ArrayUtils = ArrayUtils;
  6294. /***/ }),
  6295. /* 137 */
  6296. /***/ (function(module, exports, __webpack_require__) {
  6297. "use strict";
  6298. 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; }; })();
  6299. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6300. Object.defineProperty(exports, "__esModule", { value: true });
  6301. var tslib_1 = __webpack_require__(2);
  6302. var inversify_1 = __webpack_require__(0);
  6303. var ServiceIdentifiers_1 = __webpack_require__(1);
  6304. var RandomGenerator_1 = __webpack_require__(31);
  6305. var Utils_1 = __webpack_require__(16);
  6306. var CryptUtils = function () {
  6307. function CryptUtils(randomGenerator) {
  6308. _classCallCheck(this, CryptUtils);
  6309. this.randomGenerator = randomGenerator;
  6310. }
  6311. _createClass(CryptUtils, [{
  6312. key: "btoa",
  6313. value: function btoa(string) {
  6314. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  6315. var output = '';
  6316. string = encodeURIComponent(string).replace(/%([0-9A-F]{2})/g, function (match, p1) {
  6317. return String.fromCharCode(parseInt("" + Utils_1.Utils.hexadecimalPrefix + p1));
  6318. });
  6319. for (var block, charCode, idx = 0, map = chars; string.charAt(idx | 0) || (map = '=', idx % 1); output += map.charAt(63 & block >> 8 - idx % 1 * 8)) {
  6320. charCode = string.charCodeAt(idx += 3 / 4);
  6321. if (charCode > 0xFF) {
  6322. throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
  6323. }
  6324. block = block << 8 | charCode;
  6325. }
  6326. return output;
  6327. }
  6328. }, {
  6329. key: "hideString",
  6330. value: function hideString(str, length) {
  6331. var _this = this;
  6332. var escapeRegExp = function escapeRegExp(s) {
  6333. return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  6334. };
  6335. var randomMerge = function randomMerge(s1, s2) {
  6336. var i1 = -1,
  6337. i2 = -1,
  6338. result = '';
  6339. while (i1 < s1.length || i2 < s2.length) {
  6340. if (_this.randomGenerator.getMathRandom() < 0.5 && i2 < s2.length) {
  6341. result += s2.charAt(++i2);
  6342. } else {
  6343. result += s1.charAt(++i1);
  6344. }
  6345. }
  6346. return result;
  6347. };
  6348. var randomString = this.randomGenerator.getRandomGenerator().string({
  6349. length: length,
  6350. pool: RandomGenerator_1.RandomGenerator.randomGeneratorPool
  6351. });
  6352. var randomStringDiff = randomString.replace(new RegExp("[" + escapeRegExp(str) + "]", 'g'), '');
  6353. var randomStringDiffArray = randomStringDiff.split('');
  6354. this.randomGenerator.getRandomGenerator().shuffle(randomStringDiffArray);
  6355. randomStringDiff = randomStringDiffArray.join('');
  6356. return [randomMerge(str, randomStringDiff), randomStringDiff];
  6357. }
  6358. }, {
  6359. key: "rc4",
  6360. value: function rc4(string, key) {
  6361. var s = [],
  6362. j = 0,
  6363. x = void 0,
  6364. result = '';
  6365. for (var i = 0; i < 256; i++) {
  6366. s[i] = i;
  6367. }
  6368. for (i = 0; i < 256; i++) {
  6369. j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
  6370. x = s[i];
  6371. s[i] = s[j];
  6372. s[j] = x;
  6373. }
  6374. i = 0;
  6375. j = 0;
  6376. for (var y = 0; y < string.length; y++) {
  6377. i = (i + 1) % 256;
  6378. j = (j + s[i]) % 256;
  6379. x = s[i];
  6380. s[i] = s[j];
  6381. s[j] = x;
  6382. result += String.fromCharCode(string.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);
  6383. }
  6384. return result;
  6385. }
  6386. }]);
  6387. return CryptUtils;
  6388. }();
  6389. CryptUtils = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__metadata("design:paramtypes", [Object])], CryptUtils);
  6390. exports.CryptUtils = CryptUtils;
  6391. /***/ }),
  6392. /* 138 */
  6393. /***/ (function(module, exports, __webpack_require__) {
  6394. "use strict";
  6395. 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; }; })();
  6396. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6397. Object.defineProperty(exports, "__esModule", { value: true });
  6398. var tslib_1 = __webpack_require__(2);
  6399. var inversify_1 = __webpack_require__(0);
  6400. var EscapeSequenceEncoder = function () {
  6401. function EscapeSequenceEncoder() {
  6402. _classCallCheck(this, EscapeSequenceEncoder);
  6403. this.stringsCache = new Map();
  6404. }
  6405. _createClass(EscapeSequenceEncoder, [{
  6406. key: "encode",
  6407. value: function encode(string, encodeAllSymbols) {
  6408. var cacheKey = string + "-" + String(encodeAllSymbols);
  6409. if (this.stringsCache.has(cacheKey)) {
  6410. return this.stringsCache.get(cacheKey);
  6411. }
  6412. var radix = 16;
  6413. var replaceRegExp = new RegExp('[\\s\\S]', 'g');
  6414. var escapeSequenceRegExp = new RegExp('[\'\"\\\\\\s]');
  6415. var regExp = new RegExp('[\\x00-\\x7F]');
  6416. var prefix = void 0,
  6417. template = void 0;
  6418. var result = string.replace(replaceRegExp, function (character) {
  6419. if (!encodeAllSymbols && !escapeSequenceRegExp.exec(character)) {
  6420. return character;
  6421. }
  6422. if (regExp.exec(character)) {
  6423. prefix = '\\x';
  6424. template = '00';
  6425. } else {
  6426. prefix = "\\u";
  6427. template = '0000';
  6428. }
  6429. return "" + prefix + (template + character.charCodeAt(0).toString(radix)).slice(-template.length);
  6430. });
  6431. this.stringsCache.set(cacheKey, result);
  6432. return result;
  6433. }
  6434. }]);
  6435. return EscapeSequenceEncoder;
  6436. }();
  6437. EscapeSequenceEncoder = tslib_1.__decorate([inversify_1.injectable()], EscapeSequenceEncoder);
  6438. exports.EscapeSequenceEncoder = EscapeSequenceEncoder;
  6439. /***/ }),
  6440. /* 139 */
  6441. /***/ (function(module, exports, __webpack_require__) {
  6442. "use strict";
  6443. 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; }; })();
  6444. 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); } }
  6445. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6446. Object.defineProperty(exports, "__esModule", { value: true });
  6447. var tslib_1 = __webpack_require__(2);
  6448. var inversify_1 = __webpack_require__(0);
  6449. var ServiceIdentifiers_1 = __webpack_require__(1);
  6450. var esprima = __webpack_require__(36);
  6451. var escodegen = __webpack_require__(28);
  6452. var esmangle = __webpack_require__(140);
  6453. var LoggingMessage_1 = __webpack_require__(141);
  6454. var NodeTransformer_1 = __webpack_require__(21);
  6455. var ObfuscationEvent_1 = __webpack_require__(15);
  6456. var NodeGuards_1 = __webpack_require__(5);
  6457. var JavaScriptObfuscator = JavaScriptObfuscator_1 = function () {
  6458. function JavaScriptObfuscator(stackTraceAnalyzer, obfuscationEventEmitter, customNodeGroupStorage, transformersRunner, sourceMapCorrector, randomGenerator, logger, options) {
  6459. _classCallCheck(this, JavaScriptObfuscator);
  6460. this.stackTraceAnalyzer = stackTraceAnalyzer;
  6461. this.obfuscationEventEmitter = obfuscationEventEmitter;
  6462. this.customNodeGroupStorage = customNodeGroupStorage;
  6463. this.transformersRunner = transformersRunner;
  6464. this.sourceMapCorrector = sourceMapCorrector;
  6465. this.randomGenerator = randomGenerator;
  6466. this.logger = logger;
  6467. this.options = options;
  6468. }
  6469. _createClass(JavaScriptObfuscator, [{
  6470. key: "obfuscate",
  6471. value: function obfuscate(sourceCode) {
  6472. var timeStart = Date.now();
  6473. this.logger.info(LoggingMessage_1.LoggingMessage.ObfuscationStarted);
  6474. this.logger.info(LoggingMessage_1.LoggingMessage.RandomGeneratorSeed, this.randomGenerator.getSeed());
  6475. var astTree = this.parseCode(sourceCode);
  6476. var obfuscatedAstTree = this.transformAstTree(astTree);
  6477. var generatorOutput = this.generateCode(sourceCode, obfuscatedAstTree);
  6478. var obfuscationTime = (Date.now() - timeStart) / 1000;
  6479. this.logger.success(LoggingMessage_1.LoggingMessage.ObfuscationCompleted, obfuscationTime);
  6480. return this.getObfuscationResult(generatorOutput);
  6481. }
  6482. }, {
  6483. key: "parseCode",
  6484. value: function parseCode(sourceCode) {
  6485. return esprima.parseScript(sourceCode, {
  6486. attachComment: true,
  6487. loc: this.options.sourceMap
  6488. });
  6489. }
  6490. }, {
  6491. key: "transformAstTree",
  6492. value: function transformAstTree(astTree) {
  6493. var _this = this;
  6494. if (NodeGuards_1.NodeGuards.isProgramNode(astTree) && !astTree.body.length) {
  6495. this.logger.warn(LoggingMessage_1.LoggingMessage.EmptySourceCode);
  6496. return astTree;
  6497. }
  6498. this.logger.info(LoggingMessage_1.LoggingMessage.StagePreparingASTTree);
  6499. astTree = this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.preparingTransformersList);
  6500. this.logger.info(LoggingMessage_1.LoggingMessage.StageAnalyzingASTTree);
  6501. var stackTraceData = this.stackTraceAnalyzer.analyze(astTree);
  6502. this.customNodeGroupStorage.getStorage().forEach(function (customNodeGroup) {
  6503. customNodeGroup.initialize();
  6504. _this.obfuscationEventEmitter.once(customNodeGroup.getAppendEvent(), customNodeGroup.appendCustomNodes.bind(customNodeGroup));
  6505. });
  6506. this.obfuscationEventEmitter.emit(ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation, astTree, stackTraceData);
  6507. if (this.options.deadCodeInjection) {
  6508. this.logger.info(LoggingMessage_1.LoggingMessage.StageDeadCodeInjection);
  6509. astTree = this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.deadCodeInjectionTransformersList);
  6510. }
  6511. if (this.options.controlFlowFlattening) {
  6512. this.logger.info(LoggingMessage_1.LoggingMessage.StageControlFlowFlattening);
  6513. astTree = this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.controlFlowTransformersList);
  6514. }
  6515. this.logger.info(LoggingMessage_1.LoggingMessage.StageObfuscation);
  6516. astTree = this.transformersRunner.transform(astTree, [].concat(_toConsumableArray(JavaScriptObfuscator_1.convertingTransformersList), _toConsumableArray(JavaScriptObfuscator_1.obfuscatingTransformersList)));
  6517. this.obfuscationEventEmitter.emit(ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation, astTree, stackTraceData);
  6518. return astTree;
  6519. }
  6520. }, {
  6521. key: "generateCode",
  6522. value: function generateCode(sourceCode, astTree) {
  6523. var escodegenParams = Object.assign({}, JavaScriptObfuscator_1.escodegenParams);
  6524. if (this.options.sourceMap) {
  6525. escodegenParams.sourceMap = 'sourceMap';
  6526. escodegenParams.sourceContent = sourceCode;
  6527. }
  6528. if (this.options.mangle) {
  6529. astTree = esmangle.mangle(astTree);
  6530. }
  6531. var generatorOutput = escodegen.generate(astTree, Object.assign({}, escodegenParams, { format: {
  6532. compact: this.options.compact
  6533. } }));
  6534. generatorOutput.map = generatorOutput.map ? generatorOutput.map.toString() : '';
  6535. return generatorOutput;
  6536. }
  6537. }, {
  6538. key: "getObfuscationResult",
  6539. value: function getObfuscationResult(generatorOutput) {
  6540. return this.sourceMapCorrector.correct(generatorOutput.code, generatorOutput.map);
  6541. }
  6542. }]);
  6543. return JavaScriptObfuscator;
  6544. }();
  6545. JavaScriptObfuscator.escodegenParams = {
  6546. verbatim: 'x-verbatim-property',
  6547. sourceMapWithCode: true
  6548. };
  6549. JavaScriptObfuscator.controlFlowTransformersList = [NodeTransformer_1.NodeTransformer.BlockStatementControlFlowTransformer, NodeTransformer_1.NodeTransformer.FunctionControlFlowTransformer];
  6550. JavaScriptObfuscator.convertingTransformersList = [NodeTransformer_1.NodeTransformer.MemberExpressionTransformer, NodeTransformer_1.NodeTransformer.MethodDefinitionTransformer, NodeTransformer_1.NodeTransformer.TemplateLiteralTransformer];
  6551. JavaScriptObfuscator.deadCodeInjectionTransformersList = [NodeTransformer_1.NodeTransformer.DeadCodeInjectionTransformer];
  6552. JavaScriptObfuscator.obfuscatingTransformersList = [NodeTransformer_1.NodeTransformer.CatchClauseTransformer, NodeTransformer_1.NodeTransformer.ClassDeclarationTransformer, NodeTransformer_1.NodeTransformer.FunctionDeclarationTransformer, NodeTransformer_1.NodeTransformer.FunctionTransformer, NodeTransformer_1.NodeTransformer.LabeledStatementTransformer, NodeTransformer_1.NodeTransformer.LiteralTransformer, NodeTransformer_1.NodeTransformer.ObjectExpressionTransformer, NodeTransformer_1.NodeTransformer.VariableDeclarationTransformer];
  6553. JavaScriptObfuscator.preparingTransformersList = [NodeTransformer_1.NodeTransformer.ObfuscatingGuardsTransformer, NodeTransformer_1.NodeTransformer.ParentificationTransformer];
  6554. JavaScriptObfuscator = JavaScriptObfuscator_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IStackTraceAnalyzer)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.TCustomNodeGroupStorage)), tslib_1.__param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ITransformersRunner)), tslib_1.__param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ISourceMapCorrector)), tslib_1.__param(5, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)), tslib_1.__param(6, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ILogger)), tslib_1.__param(7, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object, Object, Object, Object, Object, Object, Object, Object])], JavaScriptObfuscator);
  6555. exports.JavaScriptObfuscator = JavaScriptObfuscator;
  6556. var JavaScriptObfuscator_1;
  6557. /***/ }),
  6558. /* 140 */
  6559. /***/ (function(module, exports) {
  6560. module.exports = require("esmangle");
  6561. /***/ }),
  6562. /* 141 */
  6563. /***/ (function(module, exports, __webpack_require__) {
  6564. "use strict";
  6565. Object.defineProperty(exports, "__esModule", { value: true });
  6566. var LoggingMessage;
  6567. (function (LoggingMessage) {
  6568. LoggingMessage["EmptySourceCode"] = "Empty source code. Obfuscation canceled...";
  6569. LoggingMessage["ObfuscationCompleted"] = "Obfuscation completed. Total time: %s sec.";
  6570. LoggingMessage["ObfuscationStarted"] = "Obfuscation started...";
  6571. LoggingMessage["RandomGeneratorSeed"] = "Random generator seed: %s...";
  6572. LoggingMessage["StagePreparingASTTree"] = "Stage: preparing AST-tree...";
  6573. LoggingMessage["StageAnalyzingASTTree"] = "Stage: analyzing AST-tree...";
  6574. LoggingMessage["StageControlFlowFlattening"] = "Stage: control flow flattening...";
  6575. LoggingMessage["StageDeadCodeInjection"] = "Stage: dead code injection...";
  6576. LoggingMessage["StageObfuscation"] = "Stage: obfuscation...";
  6577. })(LoggingMessage = exports.LoggingMessage || (exports.LoggingMessage = {}));
  6578. /***/ }),
  6579. /* 142 */
  6580. /***/ (function(module, exports, __webpack_require__) {
  6581. "use strict";
  6582. 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; }; })();
  6583. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6584. Object.defineProperty(exports, "__esModule", { value: true });
  6585. var tslib_1 = __webpack_require__(2);
  6586. var inversify_1 = __webpack_require__(0);
  6587. var ServiceIdentifiers_1 = __webpack_require__(1);
  6588. var chalk = __webpack_require__(143);
  6589. var Initializable_1 = __webpack_require__(3);
  6590. var Logger = Logger_1 = function () {
  6591. function Logger(options) {
  6592. _classCallCheck(this, Logger);
  6593. this.options = options;
  6594. }
  6595. _createClass(Logger, [{
  6596. key: "initialize",
  6597. value: function initialize() {
  6598. this.colorInfo = chalk.cyan;
  6599. this.colorSuccess = chalk.green;
  6600. this.colorWarn = chalk.yellow;
  6601. }
  6602. }, {
  6603. key: "info",
  6604. value: function info(loggingMessage, value) {
  6605. this.log(this.colorInfo, loggingMessage, value);
  6606. }
  6607. }, {
  6608. key: "success",
  6609. value: function success(loggingMessage, value) {
  6610. this.log(this.colorSuccess, loggingMessage, value);
  6611. }
  6612. }, {
  6613. key: "warn",
  6614. value: function warn(loggingMessage, value) {
  6615. this.log(this.colorWarn, loggingMessage, value);
  6616. }
  6617. }, {
  6618. key: "log",
  6619. value: function log(loggingLevelColor, loggingMessage, value) {
  6620. if (!this.options.log) {
  6621. return;
  6622. }
  6623. var processedMessage = loggingLevelColor("\n" + Logger_1.loggingPrefix + " " + loggingMessage);
  6624. !value ? console.log(processedMessage) : console.log(processedMessage, value);
  6625. }
  6626. }]);
  6627. return Logger;
  6628. }();
  6629. Logger.loggingPrefix = '[javascript-obfuscator]';
  6630. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Function)], Logger.prototype, "colorInfo", void 0);
  6631. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Function)], Logger.prototype, "colorSuccess", void 0);
  6632. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", Function)], Logger.prototype, "colorWarn", void 0);
  6633. tslib_1.__decorate([inversify_1.postConstruct(), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", void 0)], Logger.prototype, "initialize", null);
  6634. Logger = Logger_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Object])], Logger);
  6635. exports.Logger = Logger;
  6636. var Logger_1;
  6637. /***/ }),
  6638. /* 143 */
  6639. /***/ (function(module, exports) {
  6640. module.exports = require("chalk");
  6641. /***/ }),
  6642. /* 144 */
  6643. /***/ (function(module, exports, __webpack_require__) {
  6644. "use strict";
  6645. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6646. 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; }
  6647. 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; }
  6648. Object.defineProperty(exports, "__esModule", { value: true });
  6649. var tslib_1 = __webpack_require__(2);
  6650. var inversify_1 = __webpack_require__(0);
  6651. var events_1 = __webpack_require__(145);
  6652. inversify_1.decorate(inversify_1.injectable(), events_1.EventEmitter);
  6653. var ObfuscationEventEmitter = function (_events_1$EventEmitte) {
  6654. _inherits(ObfuscationEventEmitter, _events_1$EventEmitte);
  6655. function ObfuscationEventEmitter() {
  6656. _classCallCheck(this, ObfuscationEventEmitter);
  6657. return _possibleConstructorReturn(this, (ObfuscationEventEmitter.__proto__ || Object.getPrototypeOf(ObfuscationEventEmitter)).apply(this, arguments));
  6658. }
  6659. return ObfuscationEventEmitter;
  6660. }(events_1.EventEmitter);
  6661. ObfuscationEventEmitter = tslib_1.__decorate([inversify_1.injectable()], ObfuscationEventEmitter);
  6662. exports.ObfuscationEventEmitter = ObfuscationEventEmitter;
  6663. /***/ }),
  6664. /* 145 */
  6665. /***/ (function(module, exports) {
  6666. module.exports = require("events");
  6667. /***/ }),
  6668. /* 146 */
  6669. /***/ (function(module, exports, __webpack_require__) {
  6670. "use strict";
  6671. 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; }; })();
  6672. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6673. Object.defineProperty(exports, "__esModule", { value: true });
  6674. var tslib_1 = __webpack_require__(2);
  6675. var inversify_1 = __webpack_require__(0);
  6676. var Initializable_1 = __webpack_require__(3);
  6677. var ObfuscationResult = function () {
  6678. function ObfuscationResult() {
  6679. _classCallCheck(this, ObfuscationResult);
  6680. }
  6681. _createClass(ObfuscationResult, [{
  6682. key: "initialize",
  6683. value: function initialize(obfuscatedCode, sourceMap) {
  6684. this.obfuscatedCode = obfuscatedCode;
  6685. this.sourceMap = sourceMap;
  6686. }
  6687. }, {
  6688. key: "getObfuscatedCode",
  6689. value: function getObfuscatedCode() {
  6690. return this.obfuscatedCode;
  6691. }
  6692. }, {
  6693. key: "getSourceMap",
  6694. value: function getSourceMap() {
  6695. return this.sourceMap;
  6696. }
  6697. }, {
  6698. key: "toString",
  6699. value: function toString() {
  6700. return this.obfuscatedCode;
  6701. }
  6702. }]);
  6703. return ObfuscationResult;
  6704. }();
  6705. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ObfuscationResult.prototype, "obfuscatedCode", void 0);
  6706. tslib_1.__decorate([Initializable_1.initializable(), tslib_1.__metadata("design:type", String)], ObfuscationResult.prototype, "sourceMap", void 0);
  6707. ObfuscationResult = tslib_1.__decorate([inversify_1.injectable()], ObfuscationResult);
  6708. exports.ObfuscationResult = ObfuscationResult;
  6709. /***/ }),
  6710. /* 147 */
  6711. /***/ (function(module, exports, __webpack_require__) {
  6712. "use strict";
  6713. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6714. Object.defineProperty(exports, "__esModule", { value: true });
  6715. var tslib_1 = __webpack_require__(2);
  6716. var inversify_1 = __webpack_require__(0);
  6717. var class_validator_1 = __webpack_require__(148);
  6718. var ObfuscationTarget_1 = __webpack_require__(13);
  6719. var SourceMapMode_1 = __webpack_require__(23);
  6720. var StringArrayEncoding_1 = __webpack_require__(24);
  6721. var Default_1 = __webpack_require__(32);
  6722. var OptionsNormalizer_1 = __webpack_require__(149);
  6723. var ValidationErrorsFormatter_1 = __webpack_require__(160);
  6724. var Options = Options_1 = function Options(inputOptions) {
  6725. _classCallCheck(this, Options);
  6726. Object.assign(this, Default_1.DEFAULT_PRESET, inputOptions);
  6727. var errors = class_validator_1.validateSync(this, Options_1.validatorOptions);
  6728. if (errors.length) {
  6729. throw new ReferenceError("Validation failed. errors:\n" + ValidationErrorsFormatter_1.ValidationErrorsFormatter.format(errors));
  6730. }
  6731. Object.assign(this, OptionsNormalizer_1.OptionsNormalizer.normalizeOptions(this));
  6732. };
  6733. Options.validatorOptions = {
  6734. validationError: {
  6735. target: false
  6736. }
  6737. };
  6738. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "compact", void 0);
  6739. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "controlFlowFlattening", void 0);
  6740. tslib_1.__decorate([class_validator_1.IsNumber(), class_validator_1.Min(0), class_validator_1.Max(1), tslib_1.__metadata("design:type", Number)], Options.prototype, "controlFlowFlatteningThreshold", void 0);
  6741. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "deadCodeInjection", void 0);
  6742. tslib_1.__decorate([class_validator_1.IsNumber(), tslib_1.__metadata("design:type", Number)], Options.prototype, "deadCodeInjectionThreshold", void 0);
  6743. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "debugProtection", void 0);
  6744. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "debugProtectionInterval", void 0);
  6745. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "disableConsoleOutput", void 0);
  6746. tslib_1.__decorate([class_validator_1.IsArray(), class_validator_1.ArrayUnique(), class_validator_1.IsString({
  6747. each: true
  6748. }), tslib_1.__metadata("design:type", Array)], Options.prototype, "domainLock", void 0);
  6749. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "log", void 0);
  6750. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "mangle", void 0);
  6751. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "renameGlobals", void 0);
  6752. tslib_1.__decorate([class_validator_1.IsArray(), class_validator_1.ArrayUnique(), class_validator_1.IsString({
  6753. each: true
  6754. }), tslib_1.__metadata("design:type", Array)], Options.prototype, "reservedNames", void 0);
  6755. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "rotateStringArray", void 0);
  6756. tslib_1.__decorate([class_validator_1.IsNumber(), tslib_1.__metadata("design:type", Number)], Options.prototype, "seed", void 0);
  6757. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "selfDefending", void 0);
  6758. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "sourceMap", void 0);
  6759. tslib_1.__decorate([class_validator_1.IsString(), class_validator_1.ValidateIf(function (options) {
  6760. return Boolean(options.sourceMapBaseUrl);
  6761. }), class_validator_1.IsUrl({
  6762. require_protocol: true,
  6763. require_valid_protocol: true
  6764. }), tslib_1.__metadata("design:type", String)], Options.prototype, "sourceMapBaseUrl", void 0);
  6765. tslib_1.__decorate([class_validator_1.IsString(), tslib_1.__metadata("design:type", String)], Options.prototype, "sourceMapFileName", void 0);
  6766. tslib_1.__decorate([class_validator_1.IsIn([SourceMapMode_1.SourceMapMode.Inline, SourceMapMode_1.SourceMapMode.Separate]), tslib_1.__metadata("design:type", String)], Options.prototype, "sourceMapMode", void 0);
  6767. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "stringArray", void 0);
  6768. tslib_1.__decorate([class_validator_1.IsIn([true, false, StringArrayEncoding_1.StringArrayEncoding.Base64, StringArrayEncoding_1.StringArrayEncoding.Rc4]), tslib_1.__metadata("design:type", Object)], Options.prototype, "stringArrayEncoding", void 0);
  6769. tslib_1.__decorate([class_validator_1.IsNumber(), class_validator_1.Min(0), class_validator_1.Max(1), tslib_1.__metadata("design:type", Number)], Options.prototype, "stringArrayThreshold", void 0);
  6770. tslib_1.__decorate([class_validator_1.IsIn([ObfuscationTarget_1.ObfuscationTarget.Browser, ObfuscationTarget_1.ObfuscationTarget.Extension, ObfuscationTarget_1.ObfuscationTarget.Node]), tslib_1.__metadata("design:type", String)], Options.prototype, "target", void 0);
  6771. tslib_1.__decorate([class_validator_1.IsBoolean(), tslib_1.__metadata("design:type", Boolean)], Options.prototype, "unicodeEscapeSequence", void 0);
  6772. Options = Options_1 = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__metadata("design:paramtypes", [Object])], Options);
  6773. exports.Options = Options;
  6774. var Options_1;
  6775. /***/ }),
  6776. /* 148 */
  6777. /***/ (function(module, exports) {
  6778. module.exports = require("class-validator");
  6779. /***/ }),
  6780. /* 149 */
  6781. /***/ (function(module, exports, __webpack_require__) {
  6782. "use strict";
  6783. 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; }; })();
  6784. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6785. Object.defineProperty(exports, "__esModule", { value: true });
  6786. var ControlFlowFlatteningThresholdRule_1 = __webpack_require__(150);
  6787. var DeadCodeInjectionRule_1 = __webpack_require__(151);
  6788. var DeadCodeInjectionThresholdRule_1 = __webpack_require__(152);
  6789. var DomainLockRule_1 = __webpack_require__(153);
  6790. var SelfDefendingRule_1 = __webpack_require__(154);
  6791. var SourceMapBaseUrlRule_1 = __webpack_require__(155);
  6792. var SourceMapFileNameRule_1 = __webpack_require__(156);
  6793. var StringArrayRule_1 = __webpack_require__(157);
  6794. var StringArrayEncodingRule_1 = __webpack_require__(158);
  6795. var StringArrayThresholdRule_1 = __webpack_require__(159);
  6796. var OptionsNormalizer = function () {
  6797. function OptionsNormalizer() {
  6798. _classCallCheck(this, OptionsNormalizer);
  6799. }
  6800. _createClass(OptionsNormalizer, null, [{
  6801. key: "normalizeOptions",
  6802. value: function normalizeOptions(options) {
  6803. var normalizedOptions = Object.assign({}, options);
  6804. var _iteratorNormalCompletion = true;
  6805. var _didIteratorError = false;
  6806. var _iteratorError = undefined;
  6807. try {
  6808. for (var _iterator = OptionsNormalizer.normalizerRules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  6809. var normalizerRule = _step.value;
  6810. normalizedOptions = normalizerRule(normalizedOptions);
  6811. }
  6812. } catch (err) {
  6813. _didIteratorError = true;
  6814. _iteratorError = err;
  6815. } finally {
  6816. try {
  6817. if (!_iteratorNormalCompletion && _iterator.return) {
  6818. _iterator.return();
  6819. }
  6820. } finally {
  6821. if (_didIteratorError) {
  6822. throw _iteratorError;
  6823. }
  6824. }
  6825. }
  6826. return normalizedOptions;
  6827. }
  6828. }]);
  6829. return OptionsNormalizer;
  6830. }();
  6831. OptionsNormalizer.normalizerRules = [ControlFlowFlatteningThresholdRule_1.ControlFlowFlatteningThresholdRule, DeadCodeInjectionRule_1.DeadCodeInjectionRule, DeadCodeInjectionThresholdRule_1.DeadCodeInjectionThresholdRule, DomainLockRule_1.DomainLockRule, SelfDefendingRule_1.SelfDefendingRule, SourceMapBaseUrlRule_1.SourceMapBaseUrlRule, SourceMapFileNameRule_1.SourceMapFileNameRule, StringArrayRule_1.StringArrayRule, StringArrayEncodingRule_1.StringArrayEncodingRule, StringArrayThresholdRule_1.StringArrayThresholdRule];
  6832. exports.OptionsNormalizer = OptionsNormalizer;
  6833. /***/ }),
  6834. /* 150 */
  6835. /***/ (function(module, exports, __webpack_require__) {
  6836. "use strict";
  6837. Object.defineProperty(exports, "__esModule", { value: true });
  6838. exports.ControlFlowFlatteningThresholdRule = function (options) {
  6839. if (options.controlFlowFlatteningThreshold === 0) {
  6840. options = Object.assign({}, options, { controlFlowFlattening: false, controlFlowFlatteningThreshold: 0 });
  6841. }
  6842. return options;
  6843. };
  6844. /***/ }),
  6845. /* 151 */
  6846. /***/ (function(module, exports, __webpack_require__) {
  6847. "use strict";
  6848. Object.defineProperty(exports, "__esModule", { value: true });
  6849. var Default_1 = __webpack_require__(32);
  6850. exports.DeadCodeInjectionRule = function (options) {
  6851. if (options.deadCodeInjection) {
  6852. options = Object.assign({}, options, { deadCodeInjection: true, stringArray: true });
  6853. if (!options.stringArrayThreshold) {
  6854. options = Object.assign({}, options, { stringArray: true, stringArrayThreshold: Default_1.DEFAULT_PRESET.stringArrayThreshold });
  6855. }
  6856. }
  6857. return options;
  6858. };
  6859. /***/ }),
  6860. /* 152 */
  6861. /***/ (function(module, exports, __webpack_require__) {
  6862. "use strict";
  6863. Object.defineProperty(exports, "__esModule", { value: true });
  6864. exports.DeadCodeInjectionThresholdRule = function (options) {
  6865. if (options.deadCodeInjectionThreshold === 0) {
  6866. options = Object.assign({}, options, { deadCodeInjection: false, deadCodeInjectionThreshold: 0 });
  6867. }
  6868. return options;
  6869. };
  6870. /***/ }),
  6871. /* 153 */
  6872. /***/ (function(module, exports, __webpack_require__) {
  6873. "use strict";
  6874. Object.defineProperty(exports, "__esModule", { value: true });
  6875. var Utils_1 = __webpack_require__(16);
  6876. exports.DomainLockRule = function (options) {
  6877. if (options.domainLock.length) {
  6878. var normalizedDomains = [];
  6879. var _iteratorNormalCompletion = true;
  6880. var _didIteratorError = false;
  6881. var _iteratorError = undefined;
  6882. try {
  6883. for (var _iterator = options.domainLock[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  6884. var domain = _step.value;
  6885. normalizedDomains.push(Utils_1.Utils.extractDomainFromUrl(domain));
  6886. }
  6887. } catch (err) {
  6888. _didIteratorError = true;
  6889. _iteratorError = err;
  6890. } finally {
  6891. try {
  6892. if (!_iteratorNormalCompletion && _iterator.return) {
  6893. _iterator.return();
  6894. }
  6895. } finally {
  6896. if (_didIteratorError) {
  6897. throw _iteratorError;
  6898. }
  6899. }
  6900. }
  6901. options = Object.assign({}, options, { domainLock: normalizedDomains });
  6902. }
  6903. return options;
  6904. };
  6905. /***/ }),
  6906. /* 154 */
  6907. /***/ (function(module, exports, __webpack_require__) {
  6908. "use strict";
  6909. Object.defineProperty(exports, "__esModule", { value: true });
  6910. exports.SelfDefendingRule = function (options) {
  6911. if (options.selfDefending) {
  6912. options = Object.assign({}, options, { compact: true, selfDefending: true });
  6913. }
  6914. return options;
  6915. };
  6916. /***/ }),
  6917. /* 155 */
  6918. /***/ (function(module, exports, __webpack_require__) {
  6919. "use strict";
  6920. Object.defineProperty(exports, "__esModule", { value: true });
  6921. exports.SourceMapBaseUrlRule = function (options) {
  6922. var _options = options,
  6923. sourceMapBaseUrl = _options.sourceMapBaseUrl;
  6924. if (!options.sourceMapFileName) {
  6925. options = Object.assign({}, options, { sourceMapBaseUrl: '' });
  6926. return options;
  6927. }
  6928. if (sourceMapBaseUrl && !sourceMapBaseUrl.endsWith('/')) {
  6929. options = Object.assign({}, options, { sourceMapBaseUrl: sourceMapBaseUrl + "/" });
  6930. }
  6931. return options;
  6932. };
  6933. /***/ }),
  6934. /* 156 */
  6935. /***/ (function(module, exports, __webpack_require__) {
  6936. "use strict";
  6937. Object.defineProperty(exports, "__esModule", { value: true });
  6938. exports.SourceMapFileNameRule = function (options) {
  6939. var _options = options,
  6940. sourceMapFileName = _options.sourceMapFileName;
  6941. if (sourceMapFileName) {
  6942. sourceMapFileName = sourceMapFileName.replace(/^\/+/, '').split('.')[0];
  6943. options = Object.assign({}, options, { sourceMapFileName: sourceMapFileName + ".js.map" });
  6944. }
  6945. return options;
  6946. };
  6947. /***/ }),
  6948. /* 157 */
  6949. /***/ (function(module, exports, __webpack_require__) {
  6950. "use strict";
  6951. Object.defineProperty(exports, "__esModule", { value: true });
  6952. exports.StringArrayRule = function (options) {
  6953. if (!options.stringArray) {
  6954. options = Object.assign({}, options, { rotateStringArray: false, stringArray: false, stringArrayEncoding: false, stringArrayThreshold: 0 });
  6955. }
  6956. return options;
  6957. };
  6958. /***/ }),
  6959. /* 158 */
  6960. /***/ (function(module, exports, __webpack_require__) {
  6961. "use strict";
  6962. Object.defineProperty(exports, "__esModule", { value: true });
  6963. var StringArrayEncoding_1 = __webpack_require__(24);
  6964. exports.StringArrayEncodingRule = function (options) {
  6965. if (options.stringArrayEncoding === true) {
  6966. options = Object.assign({}, options, { stringArrayEncoding: StringArrayEncoding_1.StringArrayEncoding.Base64 });
  6967. }
  6968. return options;
  6969. };
  6970. /***/ }),
  6971. /* 159 */
  6972. /***/ (function(module, exports, __webpack_require__) {
  6973. "use strict";
  6974. Object.defineProperty(exports, "__esModule", { value: true });
  6975. exports.StringArrayThresholdRule = function (options) {
  6976. if (options.stringArrayThreshold === 0) {
  6977. options = Object.assign({}, options, { rotateStringArray: false, stringArray: false, stringArrayEncoding: false, stringArrayThreshold: 0 });
  6978. }
  6979. return options;
  6980. };
  6981. /***/ }),
  6982. /* 160 */
  6983. /***/ (function(module, exports, __webpack_require__) {
  6984. "use strict";
  6985. 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; }; })();
  6986. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6987. Object.defineProperty(exports, "__esModule", { value: true });
  6988. var ValidationErrorsFormatter = function () {
  6989. function ValidationErrorsFormatter() {
  6990. _classCallCheck(this, ValidationErrorsFormatter);
  6991. }
  6992. _createClass(ValidationErrorsFormatter, null, [{
  6993. key: "format",
  6994. value: function format(validationErrors) {
  6995. var errorsArray = [];
  6996. var _iteratorNormalCompletion = true;
  6997. var _didIteratorError = false;
  6998. var _iteratorError = undefined;
  6999. try {
  7000. for (var _iterator = validationErrors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  7001. var error = _step.value;
  7002. errorsArray.push(ValidationErrorsFormatter.formatError(error));
  7003. }
  7004. } catch (err) {
  7005. _didIteratorError = true;
  7006. _iteratorError = err;
  7007. } finally {
  7008. try {
  7009. if (!_iteratorNormalCompletion && _iterator.return) {
  7010. _iterator.return();
  7011. }
  7012. } finally {
  7013. if (_didIteratorError) {
  7014. throw _iteratorError;
  7015. }
  7016. }
  7017. }
  7018. return errorsArray.join('\n');
  7019. }
  7020. }, {
  7021. key: "formatError",
  7022. value: function formatError(validationError) {
  7023. var constraints = validationError.constraints;
  7024. var errorString = "`" + validationError.property + "` errors:\n";
  7025. for (var constraint in constraints) {
  7026. if (!constraints.hasOwnProperty(constraint)) {
  7027. continue;
  7028. }
  7029. errorString += " - " + constraints[constraint] + "\n";
  7030. }
  7031. return errorString;
  7032. }
  7033. }]);
  7034. return ValidationErrorsFormatter;
  7035. }();
  7036. exports.ValidationErrorsFormatter = ValidationErrorsFormatter;
  7037. /***/ }),
  7038. /* 161 */
  7039. /***/ (function(module, exports, __webpack_require__) {
  7040. "use strict";
  7041. 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; }; })();
  7042. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7043. Object.defineProperty(exports, "__esModule", { value: true });
  7044. var SourceCode = function () {
  7045. function SourceCode(sourceCode) {
  7046. _classCallCheck(this, SourceCode);
  7047. this.sourceCode = sourceCode;
  7048. }
  7049. _createClass(SourceCode, [{
  7050. key: "getSourceCode",
  7051. value: function getSourceCode() {
  7052. return this.sourceCode;
  7053. }
  7054. }]);
  7055. return SourceCode;
  7056. }();
  7057. exports.SourceCode = SourceCode;
  7058. /***/ }),
  7059. /* 162 */
  7060. /***/ (function(module, exports, __webpack_require__) {
  7061. "use strict";
  7062. 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; }; })();
  7063. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7064. Object.defineProperty(exports, "__esModule", { value: true });
  7065. var tslib_1 = __webpack_require__(2);
  7066. var inversify_1 = __webpack_require__(0);
  7067. var ServiceIdentifiers_1 = __webpack_require__(1);
  7068. var SourceMapMode_1 = __webpack_require__(23);
  7069. var SourceMapCorrector = function () {
  7070. function SourceMapCorrector(obfuscationResultFactory, cryptUtils, options) {
  7071. _classCallCheck(this, SourceMapCorrector);
  7072. this.obfuscationResultFactory = obfuscationResultFactory;
  7073. this.cryptUtils = cryptUtils;
  7074. this.options = options;
  7075. }
  7076. _createClass(SourceMapCorrector, [{
  7077. key: "correct",
  7078. value: function correct(obfuscatedCode, sourceMap) {
  7079. return this.obfuscationResultFactory(this.correctObfuscatedCode(obfuscatedCode, sourceMap), sourceMap);
  7080. }
  7081. }, {
  7082. key: "correctObfuscatedCode",
  7083. value: function correctObfuscatedCode(obfuscatedCode, sourceMap) {
  7084. if (!sourceMap) {
  7085. return obfuscatedCode;
  7086. }
  7087. var sourceMapUrl = this.options.sourceMapBaseUrl + this.options.sourceMapFileName;
  7088. var sourceMappingUrl = '//# sourceMappingURL=';
  7089. switch (this.options.sourceMapMode) {
  7090. case SourceMapMode_1.SourceMapMode.Inline:
  7091. sourceMappingUrl += "data:application/json;base64," + this.cryptUtils.btoa(sourceMap);
  7092. break;
  7093. case SourceMapMode_1.SourceMapMode.Separate:
  7094. default:
  7095. if (!sourceMapUrl) {
  7096. return obfuscatedCode;
  7097. }
  7098. sourceMappingUrl += sourceMapUrl;
  7099. break;
  7100. }
  7101. return obfuscatedCode + "\n" + sourceMappingUrl;
  7102. }
  7103. }]);
  7104. return SourceMapCorrector;
  7105. }();
  7106. SourceMapCorrector = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscationResult)), tslib_1.__param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils)), tslib_1.__param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)), tslib_1.__metadata("design:paramtypes", [Function, Object, Object])], SourceMapCorrector);
  7107. exports.SourceMapCorrector = SourceMapCorrector;
  7108. /***/ }),
  7109. /* 163 */
  7110. /***/ (function(module, exports, __webpack_require__) {
  7111. "use strict";
  7112. 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; }; })();
  7113. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7114. Object.defineProperty(exports, "__esModule", { value: true });
  7115. var tslib_1 = __webpack_require__(2);
  7116. var inversify_1 = __webpack_require__(0);
  7117. var ServiceIdentifiers_1 = __webpack_require__(1);
  7118. var estraverse = __webpack_require__(8);
  7119. var VisitorDirection_1 = __webpack_require__(164);
  7120. var NodeGuards_1 = __webpack_require__(5);
  7121. var TransformersRunner = function () {
  7122. function TransformersRunner(nodeTransformerFactory) {
  7123. _classCallCheck(this, TransformersRunner);
  7124. this.nodeTransformerFactory = nodeTransformerFactory;
  7125. }
  7126. _createClass(TransformersRunner, [{
  7127. key: "transform",
  7128. value: function transform(astTree, nodeTransformers) {
  7129. if (!nodeTransformers.length) {
  7130. return astTree;
  7131. }
  7132. var enterVisitors = [];
  7133. var leaveVisitors = [];
  7134. var nodeTransformersLength = nodeTransformers.length;
  7135. var visitor = void 0;
  7136. for (var i = 0; i < nodeTransformersLength; i++) {
  7137. visitor = this.nodeTransformerFactory(nodeTransformers[i]).getVisitor();
  7138. if (visitor.enter) {
  7139. enterVisitors.push(visitor);
  7140. }
  7141. if (visitor.leave) {
  7142. leaveVisitors.push(visitor);
  7143. }
  7144. }
  7145. estraverse.replace(astTree, {
  7146. enter: this.mergeVisitorsForDirection(enterVisitors, VisitorDirection_1.VisitorDirection.Enter),
  7147. leave: this.mergeVisitorsForDirection(leaveVisitors, VisitorDirection_1.VisitorDirection.Leave)
  7148. });
  7149. return astTree;
  7150. }
  7151. }, {
  7152. key: "mergeVisitorsForDirection",
  7153. value: function mergeVisitorsForDirection(visitors, direction) {
  7154. var visitorsLength = visitors.length;
  7155. if (!visitorsLength) {
  7156. return function (node, parentNode) {
  7157. return node;
  7158. };
  7159. }
  7160. return function (node, parentNode) {
  7161. if (node.ignoredNode) {
  7162. return estraverse.VisitorOption.Skip;
  7163. }
  7164. for (var i = 0; i < visitorsLength; i++) {
  7165. var visitorFunction = visitors[i][direction];
  7166. if (!visitorFunction) {
  7167. continue;
  7168. }
  7169. var visitorResult = visitorFunction(node, parentNode);
  7170. if (!visitorResult || !NodeGuards_1.NodeGuards.isNode(visitorResult)) {
  7171. continue;
  7172. }
  7173. node = visitorResult;
  7174. }
  7175. return node;
  7176. };
  7177. }
  7178. }]);
  7179. return TransformersRunner;
  7180. }();
  7181. TransformersRunner = tslib_1.__decorate([inversify_1.injectable(), tslib_1.__param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeTransformer)), tslib_1.__metadata("design:paramtypes", [Function])], TransformersRunner);
  7182. exports.TransformersRunner = TransformersRunner;
  7183. /***/ }),
  7184. /* 164 */
  7185. /***/ (function(module, exports, __webpack_require__) {
  7186. "use strict";
  7187. Object.defineProperty(exports, "__esModule", { value: true });
  7188. var VisitorDirection;
  7189. (function (VisitorDirection) {
  7190. VisitorDirection["Enter"] = "enter";
  7191. VisitorDirection["Leave"] = "leave";
  7192. })(VisitorDirection = exports.VisitorDirection || (exports.VisitorDirection = {}));
  7193. /***/ }),
  7194. /* 165 */
  7195. /***/ (function(module, exports) {
  7196. module.exports = require("commander");
  7197. /***/ }),
  7198. /* 166 */
  7199. /***/ (function(module, exports, __webpack_require__) {
  7200. "use strict";
  7201. Object.defineProperty(exports, "__esModule", { value: true });
  7202. exports.ArraySanitizer = function (value) {
  7203. return value.split(',').map(function (string) {
  7204. return string.trim();
  7205. });
  7206. };
  7207. /***/ }),
  7208. /* 167 */
  7209. /***/ (function(module, exports, __webpack_require__) {
  7210. "use strict";
  7211. Object.defineProperty(exports, "__esModule", { value: true });
  7212. exports.BooleanSanitizer = function (value) {
  7213. return value === 'true' || value === '1';
  7214. };
  7215. /***/ }),
  7216. /* 168 */
  7217. /***/ (function(module, exports, __webpack_require__) {
  7218. "use strict";
  7219. Object.defineProperty(exports, "__esModule", { value: true });
  7220. var ObfuscationTarget_1 = __webpack_require__(13);
  7221. exports.ObfuscationTargetSanitizer = function (value) {
  7222. var isCorrectTarget = Object.keys(ObfuscationTarget_1.ObfuscationTarget).some(function (key) {
  7223. return ObfuscationTarget_1.ObfuscationTarget[key] === value;
  7224. });
  7225. if (!isCorrectTarget) {
  7226. throw new ReferenceError('Invalid value of `--target` option');
  7227. }
  7228. return value;
  7229. };
  7230. /***/ }),
  7231. /* 169 */
  7232. /***/ (function(module, exports, __webpack_require__) {
  7233. "use strict";
  7234. Object.defineProperty(exports, "__esModule", { value: true });
  7235. var SourceMapMode_1 = __webpack_require__(23);
  7236. exports.SourceMapModeSanitizer = function (value) {
  7237. var isCorrectSourceMapMode = Object.keys(SourceMapMode_1.SourceMapMode).some(function (key) {
  7238. return SourceMapMode_1.SourceMapMode[key] === value;
  7239. });
  7240. if (!isCorrectSourceMapMode) {
  7241. throw new ReferenceError('Invalid value of `--sourceMapMode` option');
  7242. }
  7243. return value;
  7244. };
  7245. /***/ }),
  7246. /* 170 */
  7247. /***/ (function(module, exports, __webpack_require__) {
  7248. "use strict";
  7249. Object.defineProperty(exports, "__esModule", { value: true });
  7250. var StringArrayEncoding_1 = __webpack_require__(24);
  7251. exports.StringArrayEncodingSanitizer = function (value) {
  7252. switch (value) {
  7253. case 'true':
  7254. case '1':
  7255. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  7256. return true;
  7257. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  7258. return StringArrayEncoding_1.StringArrayEncoding.Rc4;
  7259. default:
  7260. return false;
  7261. }
  7262. };
  7263. /***/ }),
  7264. /* 171 */
  7265. /***/ (function(module, exports, __webpack_require__) {
  7266. "use strict";
  7267. 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; }; })();
  7268. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7269. Object.defineProperty(exports, "__esModule", { value: true });
  7270. var fs = __webpack_require__(43);
  7271. var mkdirp = __webpack_require__(172);
  7272. var path = __webpack_require__(34);
  7273. var JavaScriptObfuscatorCLI_1 = __webpack_require__(33);
  7274. var CLIUtils = function () {
  7275. function CLIUtils() {
  7276. _classCallCheck(this, CLIUtils);
  7277. }
  7278. _createClass(CLIUtils, null, [{
  7279. key: "getOutputCodePath",
  7280. value: function getOutputCodePath(inputPath) {
  7281. return inputPath.split('.').map(function (value, index) {
  7282. return index === 0 ? "" + value + JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.obfuscatedFilePrefix : value;
  7283. }).join('.');
  7284. }
  7285. }, {
  7286. key: "getOutputSourceMapPath",
  7287. value: function getOutputSourceMapPath(outputCodePath) {
  7288. var sourceMapFileName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  7289. if (sourceMapFileName) {
  7290. outputCodePath = outputCodePath.substring(0, outputCodePath.lastIndexOf('/')) + "/" + sourceMapFileName;
  7291. }
  7292. if (!/\.js\.map$/.test(outputCodePath)) {
  7293. outputCodePath = outputCodePath.split('.')[0] + ".js.map";
  7294. } else if (/\.js$/.test(outputCodePath)) {
  7295. outputCodePath += '.map';
  7296. }
  7297. return outputCodePath;
  7298. }
  7299. }, {
  7300. key: "getPackageConfig",
  7301. value: function getPackageConfig() {
  7302. return JSON.parse(fs.readFileSync(path.join(path.dirname(fs.realpathSync(process.argv[1])), '../package.json'), JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding));
  7303. }
  7304. }, {
  7305. key: "getUserConfig",
  7306. value: function getUserConfig(configPath) {
  7307. var config = void 0;
  7308. try {
  7309. config = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }());
  7310. } catch (e) {
  7311. try {
  7312. config = require(configPath);
  7313. } catch (e) {
  7314. throw new ReferenceError('Given config path must be a valid file path');
  7315. }
  7316. }
  7317. return config;
  7318. }
  7319. }, {
  7320. key: "writeFile",
  7321. value: function writeFile(outputPath, data) {
  7322. mkdirp.sync(path.dirname(outputPath));
  7323. fs.writeFileSync(outputPath, data, {
  7324. encoding: JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding
  7325. });
  7326. }
  7327. }]);
  7328. return CLIUtils;
  7329. }();
  7330. exports.CLIUtils = CLIUtils;
  7331. /***/ }),
  7332. /* 172 */
  7333. /***/ (function(module, exports) {
  7334. module.exports = require("mkdirp");
  7335. /***/ }),
  7336. /* 173 */
  7337. /***/ (function(module, exports) {
  7338. function webpackEmptyContext(req) {
  7339. throw new Error("Cannot find module '" + req + "'.");
  7340. }
  7341. webpackEmptyContext.keys = function() { return []; };
  7342. webpackEmptyContext.resolve = webpackEmptyContext;
  7343. module.exports = webpackEmptyContext;
  7344. webpackEmptyContext.id = 173;
  7345. /***/ }),
  7346. /* 174 */
  7347. /***/ (function(module, exports, __webpack_require__) {
  7348. "use strict";
  7349. 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; }; })();
  7350. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7351. Object.defineProperty(exports, "__esModule", { value: true });
  7352. var fs = __webpack_require__(43);
  7353. var path = __webpack_require__(34);
  7354. var JavaScriptObfuscatorCLI_1 = __webpack_require__(33);
  7355. var SourceCodeReader = function () {
  7356. function SourceCodeReader() {
  7357. _classCallCheck(this, SourceCodeReader);
  7358. }
  7359. _createClass(SourceCodeReader, null, [{
  7360. key: "readSourceCode",
  7361. value: function readSourceCode(inputPath) {
  7362. if (SourceCodeReader.isFilePath(inputPath)) {
  7363. return SourceCodeReader.readFile(inputPath);
  7364. }
  7365. if (SourceCodeReader.isDirectoryPath(inputPath)) {
  7366. return SourceCodeReader.readDirectory(inputPath);
  7367. }
  7368. throw new ReferenceError("Given input path must be a valid source code file or directory path");
  7369. }
  7370. }, {
  7371. key: "isDirectoryPath",
  7372. value: function isDirectoryPath(filePath) {
  7373. try {
  7374. return fs.statSync(filePath).isDirectory();
  7375. } catch (e) {
  7376. return false;
  7377. }
  7378. }
  7379. }, {
  7380. key: "isFilePath",
  7381. value: function isFilePath(filePath) {
  7382. try {
  7383. return fs.statSync(filePath).isFile();
  7384. } catch (e) {
  7385. return false;
  7386. }
  7387. }
  7388. }, {
  7389. key: "readDirectory",
  7390. value: function readDirectory(directoryPath) {
  7391. return fs.readdirSync(directoryPath, JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding).filter(SourceCodeReader.isValidFile).map(function (fileName) {
  7392. var filePath = directoryPath + "/" + fileName;
  7393. var content = fs.readFileSync(filePath, JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding);
  7394. return { filePath: filePath, content: content };
  7395. });
  7396. }
  7397. }, {
  7398. key: "readFile",
  7399. value: function readFile(filePath) {
  7400. if (!SourceCodeReader.isValidFile(filePath)) {
  7401. throw new ReferenceError("Input file must have .js extension");
  7402. }
  7403. return fs.readFileSync(filePath, JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding);
  7404. }
  7405. }, {
  7406. key: "isValidFile",
  7407. value: function isValidFile(filePath) {
  7408. return JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.availableInputExtensions.indexOf(path.extname(filePath)) !== -1 && !(filePath.indexOf(JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.obfuscatedFilePrefix) !== -1);
  7409. }
  7410. }]);
  7411. return SourceCodeReader;
  7412. }();
  7413. exports.SourceCodeReader = SourceCodeReader;
  7414. /***/ })
  7415. /******/ ]);
  7416. //# sourceMappingURL=index.js.map