index.cli.js 762 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787
  1. /*!
  2. Copyright (C) 2016-2020 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, { enumerable: true, get: getter });
  62. /******/ }
  63. /******/ };
  64. /******/
  65. /******/ // define __esModule on exports
  66. /******/ __webpack_require__.r = function(exports) {
  67. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  68. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  69. /******/ }
  70. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  71. /******/ };
  72. /******/
  73. /******/ // create a fake namespace object
  74. /******/ // mode & 1: value is a module id, require it
  75. /******/ // mode & 2: merge all properties of value into the ns
  76. /******/ // mode & 4: return value when already ns object
  77. /******/ // mode & 8|1: behave like require
  78. /******/ __webpack_require__.t = function(value, mode) {
  79. /******/ if(mode & 1) value = __webpack_require__(value);
  80. /******/ if(mode & 8) return value;
  81. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  82. /******/ var ns = Object.create(null);
  83. /******/ __webpack_require__.r(ns);
  84. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  85. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  86. /******/ return ns;
  87. /******/ };
  88. /******/
  89. /******/ // getDefaultExport function for compatibility with non-harmony modules
  90. /******/ __webpack_require__.n = function(module) {
  91. /******/ var getter = module && module.__esModule ?
  92. /******/ function getDefault() { return module['default']; } :
  93. /******/ function getModuleExports() { return module; };
  94. /******/ __webpack_require__.d(getter, 'a', getter);
  95. /******/ return getter;
  96. /******/ };
  97. /******/
  98. /******/ // Object.prototype.hasOwnProperty.call
  99. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  100. /******/
  101. /******/ // __webpack_public_path__
  102. /******/ __webpack_require__.p = "";
  103. /******/
  104. /******/
  105. /******/ // Load entry module and return exports
  106. /******/ return __webpack_require__(__webpack_require__.s = "./index.cli.ts");
  107. /******/ })
  108. /************************************************************************/
  109. /******/ ({
  110. /***/ "./index.cli.ts":
  111. /*!**********************!*\
  112. !*** ./index.cli.ts ***!
  113. \**********************/
  114. /*! no static exports found */
  115. /***/ (function(module, exports, __webpack_require__) {
  116. "use strict";
  117. Object.defineProperty(exports, "__esModule", { value: true });
  118. const JavaScriptObfuscatorCLIFacade_1 = __webpack_require__(/*! ./src/JavaScriptObfuscatorCLIFacade */ "./src/JavaScriptObfuscatorCLIFacade.ts");
  119. module.exports = JavaScriptObfuscatorCLIFacade_1.JavaScriptObfuscatorCLI;
  120. /***/ }),
  121. /***/ "./src/ASTParserFacade.ts":
  122. /*!********************************!*\
  123. !*** ./src/ASTParserFacade.ts ***!
  124. \********************************/
  125. /*! no static exports found */
  126. /***/ (function(module, exports, __webpack_require__) {
  127. "use strict";
  128. var __importStar = (this && this.__importStar) || function (mod) {
  129. if (mod && mod.__esModule) return mod;
  130. var result = {};
  131. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  132. result["default"] = mod;
  133. return result;
  134. };
  135. var __importDefault = (this && this.__importDefault) || function (mod) {
  136. return (mod && mod.__esModule) ? mod : { "default": mod };
  137. };
  138. Object.defineProperty(exports, "__esModule", { value: true });
  139. const acorn = __importStar(__webpack_require__(/*! acorn */ "acorn"));
  140. const acorn_import_meta_1 = __importDefault(__webpack_require__(/*! acorn-import-meta */ "acorn-import-meta"));
  141. const chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
  142. class ASTParserFacade {
  143. static parse(inputData, config) {
  144. const sourceTypeLength = ASTParserFacade.sourceTypes.length;
  145. for (let i = 0; i < sourceTypeLength; i++) {
  146. try {
  147. return ASTParserFacade.parseType(inputData, config, ASTParserFacade.sourceTypes[i]);
  148. }
  149. catch (error) {
  150. if (i < sourceTypeLength - 1) {
  151. continue;
  152. }
  153. throw new Error(ASTParserFacade.processParsingError(inputData, error.message, error.loc));
  154. }
  155. }
  156. throw new Error('Acorn parsing error');
  157. }
  158. static parseType(inputData, inputConfig, sourceType) {
  159. const { sourceCode } = inputData;
  160. const comments = [];
  161. const config = Object.assign(Object.assign({}, inputConfig), { onComment: comments, sourceType });
  162. const program = acorn
  163. .Parser.extend(acorn_import_meta_1.default)
  164. .parse(sourceCode, config);
  165. if (comments.length) {
  166. program.comments = comments;
  167. }
  168. return program;
  169. }
  170. static processParsingError(inputData, errorMessage, position) {
  171. if (!position || !position.line || !position.column) {
  172. throw new Error(errorMessage);
  173. }
  174. const { sourceCode, inputFilePath } = inputData;
  175. const sourceCodeLines = sourceCode.split(/\r?\n/);
  176. const errorLine = sourceCodeLines[position.line - 1];
  177. if (!errorLine) {
  178. throw new Error(errorMessage);
  179. }
  180. const formattedInputFilePath = inputFilePath
  181. ? `${inputFilePath}, `
  182. : '';
  183. const startErrorIndex = Math.max(0, position.column - ASTParserFacade.nearestSymbolsCount);
  184. const endErrorIndex = Math.min(errorLine.length, position.column + ASTParserFacade.nearestSymbolsCount);
  185. const formattedPointer = ASTParserFacade.colorError('>');
  186. const formattedCodeSlice = `...${errorLine.substring(startErrorIndex, endErrorIndex).replace(/^\s+/, '')}...`;
  187. throw new Error(`ERROR in ${formattedInputFilePath}line ${position.line}: ${errorMessage}\n${formattedPointer} ${formattedCodeSlice}`);
  188. }
  189. }
  190. exports.ASTParserFacade = ASTParserFacade;
  191. ASTParserFacade.colorError = chalk_1.default.red;
  192. ASTParserFacade.nearestSymbolsCount = 15;
  193. ASTParserFacade.sourceTypes = [
  194. 'script',
  195. 'module'
  196. ];
  197. /***/ }),
  198. /***/ "./src/JavaScriptObfuscator.ts":
  199. /*!*************************************!*\
  200. !*** ./src/JavaScriptObfuscator.ts ***!
  201. \*************************************/
  202. /*! no static exports found */
  203. /***/ (function(module, exports, __webpack_require__) {
  204. "use strict";
  205. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  206. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  207. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  208. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  209. return c > 3 && r && Object.defineProperty(target, key, r), r;
  210. };
  211. var __metadata = (this && this.__metadata) || function (k, v) {
  212. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  213. };
  214. var __param = (this && this.__param) || function (paramIndex, decorator) {
  215. return function (target, key) { decorator(target, key, paramIndex); }
  216. };
  217. var __importStar = (this && this.__importStar) || function (mod) {
  218. if (mod && mod.__esModule) return mod;
  219. var result = {};
  220. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  221. result["default"] = mod;
  222. return result;
  223. };
  224. var JavaScriptObfuscator_1, _a, _b, _c, _d, _e;
  225. Object.defineProperty(exports, "__esModule", { value: true });
  226. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  227. const ServiceIdentifiers_1 = __webpack_require__(/*! ./container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  228. const escodegen = __importStar(__webpack_require__(/*! escodegen */ "escodegen"));
  229. const TObfuscatedCodeFactory_1 = __webpack_require__(/*! ./types/container/source-code/TObfuscatedCodeFactory */ "./src/types/container/source-code/TObfuscatedCodeFactory.ts");
  230. const ILogger_1 = __webpack_require__(/*! ./interfaces/logger/ILogger */ "./src/interfaces/logger/ILogger.ts");
  231. const IOptions_1 = __webpack_require__(/*! ./interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  232. const IRandomGenerator_1 = __webpack_require__(/*! ./interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  233. const ITransformersRunner_1 = __webpack_require__(/*! ./interfaces/node-transformers/ITransformersRunner */ "./src/interfaces/node-transformers/ITransformersRunner.ts");
  234. const LoggingMessage_1 = __webpack_require__(/*! ./enums/logger/LoggingMessage */ "./src/enums/logger/LoggingMessage.ts");
  235. const NodeTransformer_1 = __webpack_require__(/*! ./enums/node-transformers/NodeTransformer */ "./src/enums/node-transformers/NodeTransformer.ts");
  236. const TransformationStage_1 = __webpack_require__(/*! ./enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  237. const EcmaVersion_1 = __webpack_require__(/*! ./constants/EcmaVersion */ "./src/constants/EcmaVersion.ts");
  238. const ASTParserFacade_1 = __webpack_require__(/*! ./ASTParserFacade */ "./src/ASTParserFacade.ts");
  239. const NodeGuards_1 = __webpack_require__(/*! ./node/NodeGuards */ "./src/node/NodeGuards.ts");
  240. let JavaScriptObfuscator = JavaScriptObfuscator_1 = class JavaScriptObfuscator {
  241. constructor(transformersRunner, randomGenerator, obfuscatedCodeFactory, logger, options) {
  242. this.transformersRunner = transformersRunner;
  243. this.randomGenerator = randomGenerator;
  244. this.obfuscatedCodeFactory = obfuscatedCodeFactory;
  245. this.logger = logger;
  246. this.options = options;
  247. }
  248. obfuscate(sourceCode) {
  249. const timeStart = Date.now();
  250. this.logger.info(LoggingMessage_1.LoggingMessage.Version, "0.24.4");
  251. this.logger.info(LoggingMessage_1.LoggingMessage.ObfuscationStarted);
  252. this.logger.info(LoggingMessage_1.LoggingMessage.RandomGeneratorSeed, this.randomGenerator.getInputSeed());
  253. const astTree = this.parseCode(sourceCode);
  254. const obfuscatedAstTree = this.transformAstTree(astTree);
  255. const generatorOutput = this.generateCode(sourceCode, obfuscatedAstTree);
  256. const obfuscationTime = (Date.now() - timeStart) / 1000;
  257. this.logger.success(LoggingMessage_1.LoggingMessage.ObfuscationCompleted, obfuscationTime);
  258. return this.getObfuscatedCode(generatorOutput);
  259. }
  260. parseCode(sourceCode) {
  261. const inputData = {
  262. sourceCode,
  263. inputFilePath: this.options.inputFilePath
  264. };
  265. return ASTParserFacade_1.ASTParserFacade.parse(inputData, JavaScriptObfuscator_1.parseOptions);
  266. }
  267. transformAstTree(astTree) {
  268. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.Initializing);
  269. const isEmptyAstTree = NodeGuards_1.NodeGuards.isProgramNode(astTree)
  270. && !astTree.body.length
  271. && !astTree.leadingComments
  272. && !astTree.trailingComments;
  273. if (isEmptyAstTree) {
  274. this.logger.warn(LoggingMessage_1.LoggingMessage.EmptySourceCode);
  275. return astTree;
  276. }
  277. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.Preparing);
  278. if (this.options.deadCodeInjection) {
  279. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.DeadCodeInjection);
  280. }
  281. if (this.options.controlFlowFlattening) {
  282. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.ControlFlowFlattening);
  283. }
  284. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.Converting);
  285. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.Obfuscating);
  286. astTree = this.runTransformationStage(astTree, TransformationStage_1.TransformationStage.Finalizing);
  287. return astTree;
  288. }
  289. generateCode(sourceCode, astTree) {
  290. const escodegenParams = Object.assign({}, JavaScriptObfuscator_1.escodegenParams);
  291. if (this.options.sourceMap) {
  292. escodegenParams.sourceMap = this.options.inputFileName || 'sourceMap';
  293. escodegenParams.sourceContent = sourceCode;
  294. }
  295. const generatorOutput = escodegen.generate(astTree, Object.assign(Object.assign({}, escodegenParams), { format: {
  296. compact: this.options.compact
  297. } }));
  298. generatorOutput.map = generatorOutput.map ? generatorOutput.map.toString() : '';
  299. return generatorOutput;
  300. }
  301. getObfuscatedCode(generatorOutput) {
  302. return this.obfuscatedCodeFactory(generatorOutput.code, generatorOutput.map);
  303. }
  304. runTransformationStage(astTree, transformationStage) {
  305. this.logger.info(LoggingMessage_1.LoggingMessage.TransformationStage, transformationStage);
  306. return this.transformersRunner.transform(astTree, JavaScriptObfuscator_1.transformersList, transformationStage);
  307. }
  308. };
  309. JavaScriptObfuscator.parseOptions = {
  310. ecmaVersion: EcmaVersion_1.ecmaVersion,
  311. allowHashBang: true,
  312. allowImportExportEverywhere: true,
  313. allowReturnOutsideFunction: true,
  314. locations: true,
  315. ranges: true
  316. };
  317. JavaScriptObfuscator.escodegenParams = {
  318. comment: true,
  319. verbatim: 'x-verbatim-property',
  320. sourceMapWithCode: true
  321. };
  322. JavaScriptObfuscator.transformersList = [
  323. NodeTransformer_1.NodeTransformer.BlockStatementControlFlowTransformer,
  324. NodeTransformer_1.NodeTransformer.CommentsTransformer,
  325. NodeTransformer_1.NodeTransformer.CustomNodesTransformer,
  326. NodeTransformer_1.NodeTransformer.DeadCodeInjectionTransformer,
  327. NodeTransformer_1.NodeTransformer.EvalCallExpressionTransformer,
  328. NodeTransformer_1.NodeTransformer.FunctionControlFlowTransformer,
  329. NodeTransformer_1.NodeTransformer.LabeledStatementTransformer,
  330. NodeTransformer_1.NodeTransformer.LiteralTransformer,
  331. NodeTransformer_1.NodeTransformer.MemberExpressionTransformer,
  332. NodeTransformer_1.NodeTransformer.MetadataTransformer,
  333. NodeTransformer_1.NodeTransformer.MethodDefinitionTransformer,
  334. NodeTransformer_1.NodeTransformer.ObfuscatingGuardsTransformer,
  335. NodeTransformer_1.NodeTransformer.ObjectExpressionKeysTransformer,
  336. NodeTransformer_1.NodeTransformer.ObjectExpressionTransformer,
  337. NodeTransformer_1.NodeTransformer.ParentificationTransformer,
  338. NodeTransformer_1.NodeTransformer.ScopeIdentifiersTransformer,
  339. NodeTransformer_1.NodeTransformer.SplitStringTransformer,
  340. NodeTransformer_1.NodeTransformer.TemplateLiteralTransformer,
  341. NodeTransformer_1.NodeTransformer.VariablePreserveTransformer
  342. ];
  343. JavaScriptObfuscator = JavaScriptObfuscator_1 = __decorate([
  344. inversify_1.injectable(),
  345. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ITransformersRunner)),
  346. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  347. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatedCode)),
  348. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ILogger)),
  349. __param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  350. __metadata("design:paramtypes", [typeof (_a = typeof ITransformersRunner_1.ITransformersRunner !== "undefined" && ITransformersRunner_1.ITransformersRunner) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof TObfuscatedCodeFactory_1.TObfuscatedCodeFactory !== "undefined" && TObfuscatedCodeFactory_1.TObfuscatedCodeFactory) === "function" ? _c : Object, typeof (_d = typeof ILogger_1.ILogger !== "undefined" && ILogger_1.ILogger) === "function" ? _d : Object, typeof (_e = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _e : Object])
  351. ], JavaScriptObfuscator);
  352. exports.JavaScriptObfuscator = JavaScriptObfuscator;
  353. /***/ }),
  354. /***/ "./src/JavaScriptObfuscatorCLIFacade.ts":
  355. /*!**********************************************!*\
  356. !*** ./src/JavaScriptObfuscatorCLIFacade.ts ***!
  357. \**********************************************/
  358. /*! no static exports found */
  359. /***/ (function(module, exports, __webpack_require__) {
  360. "use strict";
  361. Object.defineProperty(exports, "__esModule", { value: true });
  362. __webpack_require__(/*! reflect-metadata */ "reflect-metadata");
  363. const JavaScriptObfuscatorCLI_1 = __webpack_require__(/*! ./cli/JavaScriptObfuscatorCLI */ "./src/cli/JavaScriptObfuscatorCLI.ts");
  364. class JavaScriptObfuscatorCLIFacade {
  365. static obfuscate(argv) {
  366. const javaScriptObfuscatorCLI = new JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI(argv);
  367. javaScriptObfuscatorCLI.initialize();
  368. javaScriptObfuscatorCLI.run();
  369. }
  370. }
  371. exports.JavaScriptObfuscatorCLI = JavaScriptObfuscatorCLIFacade;
  372. /***/ }),
  373. /***/ "./src/JavaScriptObfuscatorFacade.ts":
  374. /*!*******************************************!*\
  375. !*** ./src/JavaScriptObfuscatorFacade.ts ***!
  376. \*******************************************/
  377. /*! no static exports found */
  378. /***/ (function(module, exports, __webpack_require__) {
  379. "use strict";
  380. var _a;
  381. Object.defineProperty(exports, "__esModule", { value: true });
  382. __webpack_require__(/*! reflect-metadata */ "reflect-metadata");
  383. const ServiceIdentifiers_1 = __webpack_require__(/*! ./container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  384. const InversifyContainerFacade_1 = __webpack_require__(/*! ./container/InversifyContainerFacade */ "./src/container/InversifyContainerFacade.ts");
  385. class JavaScriptObfuscatorFacade {
  386. static obfuscate(sourceCode, inputOptions = {}) {
  387. const inversifyContainerFacade = new InversifyContainerFacade_1.InversifyContainerFacade();
  388. inversifyContainerFacade.load(sourceCode, '', inputOptions);
  389. const javaScriptObfuscator = inversifyContainerFacade
  390. .get(ServiceIdentifiers_1.ServiceIdentifiers.IJavaScriptObfuscator);
  391. const obfuscatedCode = javaScriptObfuscator.obfuscate(sourceCode);
  392. inversifyContainerFacade.unload();
  393. return obfuscatedCode;
  394. }
  395. }
  396. exports.JavaScriptObfuscator = JavaScriptObfuscatorFacade;
  397. JavaScriptObfuscatorFacade.version = (_a = "0.24.4") !== null && _a !== void 0 ? _a : 'unknown';
  398. /***/ }),
  399. /***/ "./src/analyzers/calls-graph-analyzer/CallsGraphAnalyzer.ts":
  400. /*!******************************************************************!*\
  401. !*** ./src/analyzers/calls-graph-analyzer/CallsGraphAnalyzer.ts ***!
  402. \******************************************************************/
  403. /*! no static exports found */
  404. /***/ (function(module, exports, __webpack_require__) {
  405. "use strict";
  406. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  407. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  408. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  409. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  410. return c > 3 && r && Object.defineProperty(target, key, r), r;
  411. };
  412. var __metadata = (this && this.__metadata) || function (k, v) {
  413. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  414. };
  415. var __param = (this && this.__param) || function (paramIndex, decorator) {
  416. return function (target, key) { decorator(target, key, paramIndex); }
  417. };
  418. var __importStar = (this && this.__importStar) || function (mod) {
  419. if (mod && mod.__esModule) return mod;
  420. var result = {};
  421. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  422. result["default"] = mod;
  423. return result;
  424. };
  425. var CallsGraphAnalyzer_1, _a;
  426. Object.defineProperty(exports, "__esModule", { value: true });
  427. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  428. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  429. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  430. const TCalleeDataExtractorFactory_1 = __webpack_require__(/*! ../../types/container/calls-graph-analyzer/TCalleeDataExtractorFactory */ "./src/types/container/calls-graph-analyzer/TCalleeDataExtractorFactory.ts");
  431. const CalleeDataExtractor_1 = __webpack_require__(/*! ../../enums/analyzers/calls-graph-analyzer/CalleeDataExtractor */ "./src/enums/analyzers/calls-graph-analyzer/CalleeDataExtractor.ts");
  432. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  433. const NodeStatementUtils_1 = __webpack_require__(/*! ../../node/NodeStatementUtils */ "./src/node/NodeStatementUtils.ts");
  434. let CallsGraphAnalyzer = CallsGraphAnalyzer_1 = class CallsGraphAnalyzer {
  435. constructor(calleeDataExtractorFactory) {
  436. this.calleeDataExtractorFactory = calleeDataExtractorFactory;
  437. }
  438. static getLimitIndex(blockScopeBodyLength) {
  439. const lastIndex = blockScopeBodyLength - 1;
  440. const limitThresholdActivationIndex = CallsGraphAnalyzer_1.limitThresholdActivationLength - 1;
  441. let limitIndex = lastIndex;
  442. if (lastIndex > limitThresholdActivationIndex) {
  443. limitIndex = Math.round(limitThresholdActivationIndex + (lastIndex * CallsGraphAnalyzer_1.limitThreshold));
  444. if (limitIndex > lastIndex) {
  445. limitIndex = lastIndex;
  446. }
  447. }
  448. return limitIndex;
  449. }
  450. analyze(astTree) {
  451. return this.analyzeRecursive(astTree.body);
  452. }
  453. analyzeRecursive(blockScopeBody) {
  454. const limitIndex = CallsGraphAnalyzer_1.getLimitIndex(blockScopeBody.length);
  455. const callsGraphData = [];
  456. const blockScopeBodyLength = blockScopeBody.length;
  457. for (let index = 0; index < blockScopeBodyLength; index++) {
  458. if (index > limitIndex) {
  459. break;
  460. }
  461. const blockScopeBodyNode = blockScopeBody[index];
  462. estraverse.traverse(blockScopeBodyNode, {
  463. enter: (node) => {
  464. if (!NodeGuards_1.NodeGuards.isCallExpressionNode(node)) {
  465. return;
  466. }
  467. if (blockScopeBodyNode.parentNode !== NodeStatementUtils_1.NodeStatementUtils.getParentNodeWithStatements(node)) {
  468. return estraverse.VisitorOption.Skip;
  469. }
  470. this.analyzeCallExpressionNode(callsGraphData, blockScopeBody, node);
  471. }
  472. });
  473. }
  474. return callsGraphData;
  475. }
  476. analyzeCallExpressionNode(callsGraphData, blockScopeBody, callExpressionNode) {
  477. CallsGraphAnalyzer_1.calleeDataExtractorsList.forEach((calleeDataExtractorName) => {
  478. const calleeData = this.calleeDataExtractorFactory(calleeDataExtractorName)
  479. .extract(blockScopeBody, callExpressionNode.callee);
  480. if (!calleeData) {
  481. return;
  482. }
  483. callsGraphData.push(Object.assign(Object.assign({}, calleeData), { callsGraph: this.analyzeRecursive(calleeData.callee.body) }));
  484. });
  485. }
  486. };
  487. CallsGraphAnalyzer.calleeDataExtractorsList = [
  488. CalleeDataExtractor_1.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor,
  489. CalleeDataExtractor_1.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor,
  490. CalleeDataExtractor_1.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor
  491. ];
  492. CallsGraphAnalyzer.limitThresholdActivationLength = 25;
  493. CallsGraphAnalyzer.limitThreshold = 0.002;
  494. CallsGraphAnalyzer = CallsGraphAnalyzer_1 = __decorate([
  495. inversify_1.injectable(),
  496. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICalleeDataExtractor)),
  497. __metadata("design:paramtypes", [typeof (_a = typeof TCalleeDataExtractorFactory_1.TCalleeDataExtractorFactory !== "undefined" && TCalleeDataExtractorFactory_1.TCalleeDataExtractorFactory) === "function" ? _a : Object])
  498. ], CallsGraphAnalyzer);
  499. exports.CallsGraphAnalyzer = CallsGraphAnalyzer;
  500. /***/ }),
  501. /***/ "./src/analyzers/calls-graph-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts":
  502. /*!**************************************************************************************************!*\
  503. !*** ./src/analyzers/calls-graph-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts ***!
  504. \**************************************************************************************************/
  505. /*! no static exports found */
  506. /***/ (function(module, exports, __webpack_require__) {
  507. "use strict";
  508. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  509. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  510. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  511. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  512. return c > 3 && r && Object.defineProperty(target, key, r), r;
  513. };
  514. Object.defineProperty(exports, "__esModule", { value: true });
  515. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  516. let AbstractCalleeDataExtractor = class AbstractCalleeDataExtractor {
  517. };
  518. AbstractCalleeDataExtractor = __decorate([
  519. inversify_1.injectable()
  520. ], AbstractCalleeDataExtractor);
  521. exports.AbstractCalleeDataExtractor = AbstractCalleeDataExtractor;
  522. /***/ }),
  523. /***/ "./src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts":
  524. /*!*************************************************************************************************************!*\
  525. !*** ./src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts ***!
  526. \*************************************************************************************************************/
  527. /*! no static exports found */
  528. /***/ (function(module, exports, __webpack_require__) {
  529. "use strict";
  530. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  531. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  532. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  533. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  534. return c > 3 && r && Object.defineProperty(target, key, r), r;
  535. };
  536. var __importStar = (this && this.__importStar) || function (mod) {
  537. if (mod && mod.__esModule) return mod;
  538. var result = {};
  539. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  540. result["default"] = mod;
  541. return result;
  542. };
  543. Object.defineProperty(exports, "__esModule", { value: true });
  544. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  545. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  546. const AbstractCalleeDataExtractor_1 = __webpack_require__(/*! ./AbstractCalleeDataExtractor */ "./src/analyzers/calls-graph-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts");
  547. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  548. const NodeStatementUtils_1 = __webpack_require__(/*! ../../../node/NodeStatementUtils */ "./src/node/NodeStatementUtils.ts");
  549. let FunctionDeclarationCalleeDataExtractor = class FunctionDeclarationCalleeDataExtractor extends AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor {
  550. extract(blockScopeBody, callee) {
  551. if (!NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  552. return null;
  553. }
  554. const calleeBlockStatement = this.getCalleeBlockStatement(NodeStatementUtils_1.NodeStatementUtils.getParentNodeWithStatements(blockScopeBody[0]), callee.name);
  555. if (!calleeBlockStatement) {
  556. return null;
  557. }
  558. return {
  559. callee: calleeBlockStatement,
  560. name: callee.name
  561. };
  562. }
  563. getCalleeBlockStatement(targetNode, name) {
  564. let calleeBlockStatement = null;
  565. estraverse.traverse(targetNode, {
  566. enter: (node) => {
  567. if (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) && node.id.name === name) {
  568. calleeBlockStatement = node.body;
  569. return estraverse.VisitorOption.Break;
  570. }
  571. }
  572. });
  573. return calleeBlockStatement;
  574. }
  575. };
  576. FunctionDeclarationCalleeDataExtractor = __decorate([
  577. inversify_1.injectable()
  578. ], FunctionDeclarationCalleeDataExtractor);
  579. exports.FunctionDeclarationCalleeDataExtractor = FunctionDeclarationCalleeDataExtractor;
  580. /***/ }),
  581. /***/ "./src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts":
  582. /*!************************************************************************************************************!*\
  583. !*** ./src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts ***!
  584. \************************************************************************************************************/
  585. /*! no static exports found */
  586. /***/ (function(module, exports, __webpack_require__) {
  587. "use strict";
  588. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  589. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  590. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  591. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  592. return c > 3 && r && Object.defineProperty(target, key, r), r;
  593. };
  594. var __importStar = (this && this.__importStar) || function (mod) {
  595. if (mod && mod.__esModule) return mod;
  596. var result = {};
  597. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  598. result["default"] = mod;
  599. return result;
  600. };
  601. Object.defineProperty(exports, "__esModule", { value: true });
  602. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  603. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  604. const AbstractCalleeDataExtractor_1 = __webpack_require__(/*! ./AbstractCalleeDataExtractor */ "./src/analyzers/calls-graph-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts");
  605. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  606. const NodeStatementUtils_1 = __webpack_require__(/*! ../../../node/NodeStatementUtils */ "./src/node/NodeStatementUtils.ts");
  607. let FunctionExpressionCalleeDataExtractor = class FunctionExpressionCalleeDataExtractor extends AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor {
  608. extract(blockScopeBody, callee) {
  609. var _a;
  610. let calleeBlockStatement = null;
  611. if (NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  612. calleeBlockStatement = this.getCalleeBlockStatement(NodeStatementUtils_1.NodeStatementUtils.getParentNodeWithStatements(blockScopeBody[0]), callee.name);
  613. }
  614. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(callee)) {
  615. calleeBlockStatement = callee.body;
  616. }
  617. if (!calleeBlockStatement) {
  618. return null;
  619. }
  620. return {
  621. callee: calleeBlockStatement,
  622. name: (_a = callee.name) !== null && _a !== void 0 ? _a : null
  623. };
  624. }
  625. getCalleeBlockStatement(targetNode, name) {
  626. let calleeBlockStatement = null;
  627. estraverse.traverse(targetNode, {
  628. enter: (node, parentNode) => {
  629. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) &&
  630. parentNode &&
  631. NodeGuards_1.NodeGuards.isVariableDeclaratorNode(parentNode) &&
  632. NodeGuards_1.NodeGuards.isIdentifierNode(parentNode.id) &&
  633. parentNode.id.name === name) {
  634. calleeBlockStatement = node.body;
  635. return estraverse.VisitorOption.Break;
  636. }
  637. }
  638. });
  639. return calleeBlockStatement;
  640. }
  641. };
  642. FunctionExpressionCalleeDataExtractor = __decorate([
  643. inversify_1.injectable()
  644. ], FunctionExpressionCalleeDataExtractor);
  645. exports.FunctionExpressionCalleeDataExtractor = FunctionExpressionCalleeDataExtractor;
  646. /***/ }),
  647. /***/ "./src/analyzers/calls-graph-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts":
  648. /*!**********************************************************************************************************!*\
  649. !*** ./src/analyzers/calls-graph-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts ***!
  650. \**********************************************************************************************************/
  651. /*! no static exports found */
  652. /***/ (function(module, exports, __webpack_require__) {
  653. "use strict";
  654. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  655. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  656. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  657. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  658. return c > 3 && r && Object.defineProperty(target, key, r), r;
  659. };
  660. var __importStar = (this && this.__importStar) || function (mod) {
  661. if (mod && mod.__esModule) return mod;
  662. var result = {};
  663. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  664. result["default"] = mod;
  665. return result;
  666. };
  667. var ObjectExpressionCalleeDataExtractor_1;
  668. Object.defineProperty(exports, "__esModule", { value: true });
  669. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  670. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  671. const AbstractCalleeDataExtractor_1 = __webpack_require__(/*! ./AbstractCalleeDataExtractor */ "./src/analyzers/calls-graph-analyzer/callee-data-extractors/AbstractCalleeDataExtractor.ts");
  672. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  673. const NodeStatementUtils_1 = __webpack_require__(/*! ../../../node/NodeStatementUtils */ "./src/node/NodeStatementUtils.ts");
  674. let ObjectExpressionCalleeDataExtractor = ObjectExpressionCalleeDataExtractor_1 = class ObjectExpressionCalleeDataExtractor extends AbstractCalleeDataExtractor_1.AbstractCalleeDataExtractor {
  675. static isValidTargetPropertyNode(propertyNode, nextItemInCallsChain) {
  676. if (!propertyNode.key) {
  677. return false;
  678. }
  679. const isTargetPropertyNodeWithIdentifierKey = NodeGuards_1.NodeGuards.isIdentifierNode(propertyNode.key) && propertyNode.key.name === nextItemInCallsChain;
  680. const isTargetPropertyNodeWithLiteralKey = NodeGuards_1.NodeGuards.isLiteralNode(propertyNode.key) &&
  681. Boolean(propertyNode.key.value) &&
  682. propertyNode.key.value === nextItemInCallsChain;
  683. return isTargetPropertyNodeWithIdentifierKey || isTargetPropertyNodeWithLiteralKey;
  684. }
  685. extract(blockScopeBody, callee) {
  686. if (!NodeGuards_1.NodeGuards.isMemberExpressionNode(callee)) {
  687. return null;
  688. }
  689. const objectMembersCallsChain = this.createObjectMembersCallsChain([], callee);
  690. if (!objectMembersCallsChain.length) {
  691. return null;
  692. }
  693. const functionExpressionName = objectMembersCallsChain[objectMembersCallsChain.length - 1];
  694. const calleeBlockStatement = this.getCalleeBlockStatement(NodeStatementUtils_1.NodeStatementUtils.getParentNodeWithStatements(blockScopeBody[0]), objectMembersCallsChain);
  695. if (!calleeBlockStatement) {
  696. return null;
  697. }
  698. return {
  699. callee: calleeBlockStatement,
  700. name: functionExpressionName
  701. };
  702. }
  703. createObjectMembersCallsChain(currentChain, memberExpression) {
  704. if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpression.property) && memberExpression.computed === false) {
  705. currentChain.unshift(memberExpression.property.name);
  706. }
  707. else if (NodeGuards_1.NodeGuards.isLiteralNode(memberExpression.property) &&
  708. (typeof memberExpression.property.value === 'string' ||
  709. typeof memberExpression.property.value === 'number')) {
  710. currentChain.unshift(memberExpression.property.value);
  711. }
  712. else {
  713. return currentChain;
  714. }
  715. if (NodeGuards_1.NodeGuards.isMemberExpressionNode(memberExpression.object)) {
  716. return this.createObjectMembersCallsChain(currentChain, memberExpression.object);
  717. }
  718. else if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpression.object)) {
  719. currentChain.unshift(memberExpression.object.name);
  720. }
  721. return currentChain;
  722. }
  723. getCalleeBlockStatement(targetNode, objectMembersCallsChain) {
  724. const objectName = objectMembersCallsChain.shift();
  725. if (!objectName) {
  726. return null;
  727. }
  728. let calleeBlockStatement = null;
  729. estraverse.traverse(targetNode, {
  730. enter: (node) => {
  731. if (NodeGuards_1.NodeGuards.isVariableDeclaratorNode(node) &&
  732. NodeGuards_1.NodeGuards.isIdentifierNode(node.id) &&
  733. node.init &&
  734. NodeGuards_1.NodeGuards.isObjectExpressionNode(node.init) &&
  735. node.id.name === objectName) {
  736. calleeBlockStatement = this.findCalleeBlockStatement(node.init.properties, objectMembersCallsChain);
  737. return estraverse.VisitorOption.Break;
  738. }
  739. }
  740. });
  741. return calleeBlockStatement;
  742. }
  743. findCalleeBlockStatement(objectExpressionProperties, objectMembersCallsChain) {
  744. const nextItemInCallsChain = objectMembersCallsChain.shift();
  745. if (!nextItemInCallsChain) {
  746. return null;
  747. }
  748. for (const propertyNode of objectExpressionProperties) {
  749. if (!ObjectExpressionCalleeDataExtractor_1.isValidTargetPropertyNode(propertyNode, nextItemInCallsChain)) {
  750. continue;
  751. }
  752. if (NodeGuards_1.NodeGuards.isObjectExpressionNode(propertyNode.value)) {
  753. return this.findCalleeBlockStatement(propertyNode.value.properties, objectMembersCallsChain);
  754. }
  755. if (NodeGuards_1.NodeGuards.isFunctionExpressionNode(propertyNode.value)) {
  756. return propertyNode.value.body;
  757. }
  758. }
  759. return null;
  760. }
  761. };
  762. ObjectExpressionCalleeDataExtractor = ObjectExpressionCalleeDataExtractor_1 = __decorate([
  763. inversify_1.injectable()
  764. ], ObjectExpressionCalleeDataExtractor);
  765. exports.ObjectExpressionCalleeDataExtractor = ObjectExpressionCalleeDataExtractor;
  766. /***/ }),
  767. /***/ "./src/analyzers/prevailing-kind-of-variables-analyzer/PrevailingKindOfVariablesAnalyzer.ts":
  768. /*!**************************************************************************************************!*\
  769. !*** ./src/analyzers/prevailing-kind-of-variables-analyzer/PrevailingKindOfVariablesAnalyzer.ts ***!
  770. \**************************************************************************************************/
  771. /*! no static exports found */
  772. /***/ (function(module, exports, __webpack_require__) {
  773. "use strict";
  774. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  775. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  776. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  777. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  778. return c > 3 && r && Object.defineProperty(target, key, r), r;
  779. };
  780. var __metadata = (this && this.__metadata) || function (k, v) {
  781. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  782. };
  783. var __param = (this && this.__param) || function (paramIndex, decorator) {
  784. return function (target, key) { decorator(target, key, paramIndex); }
  785. };
  786. var __importStar = (this && this.__importStar) || function (mod) {
  787. if (mod && mod.__esModule) return mod;
  788. var result = {};
  789. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  790. result["default"] = mod;
  791. return result;
  792. };
  793. var PrevailingKindOfVariablesAnalyzer_1, _a;
  794. Object.defineProperty(exports, "__esModule", { value: true });
  795. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  796. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  797. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  798. const IArrayUtils_1 = __webpack_require__(/*! ../../interfaces/utils/IArrayUtils */ "./src/interfaces/utils/IArrayUtils.ts");
  799. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  800. let PrevailingKindOfVariablesAnalyzer = PrevailingKindOfVariablesAnalyzer_1 = class PrevailingKindOfVariablesAnalyzer {
  801. constructor(arrayUtils) {
  802. this.prevailingKindOfVariables = PrevailingKindOfVariablesAnalyzer_1.defaultKindOfVariables;
  803. this.arrayUtils = arrayUtils;
  804. }
  805. analyze(astTree) {
  806. var _a;
  807. const variableKinds = [];
  808. estraverse.traverse(astTree, {
  809. enter: (node) => {
  810. if (!NodeGuards_1.NodeGuards.isVariableDeclarationNode(node)) {
  811. return;
  812. }
  813. variableKinds.push(node.kind);
  814. }
  815. });
  816. this.prevailingKindOfVariables = (_a = this.arrayUtils.findMostOccurringElement(variableKinds)) !== null && _a !== void 0 ? _a : PrevailingKindOfVariablesAnalyzer_1.defaultKindOfVariables;
  817. }
  818. getPrevailingKind() {
  819. return this.prevailingKindOfVariables;
  820. }
  821. };
  822. PrevailingKindOfVariablesAnalyzer.defaultKindOfVariables = 'var';
  823. PrevailingKindOfVariablesAnalyzer = PrevailingKindOfVariablesAnalyzer_1 = __decorate([
  824. inversify_1.injectable(),
  825. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils)),
  826. __metadata("design:paramtypes", [typeof (_a = typeof IArrayUtils_1.IArrayUtils !== "undefined" && IArrayUtils_1.IArrayUtils) === "function" ? _a : Object])
  827. ], PrevailingKindOfVariablesAnalyzer);
  828. exports.PrevailingKindOfVariablesAnalyzer = PrevailingKindOfVariablesAnalyzer;
  829. /***/ }),
  830. /***/ "./src/analyzers/scope-analyzer/ScopeAnalyzer.ts":
  831. /*!*******************************************************!*\
  832. !*** ./src/analyzers/scope-analyzer/ScopeAnalyzer.ts ***!
  833. \*******************************************************/
  834. /*! no static exports found */
  835. /***/ (function(module, exports, __webpack_require__) {
  836. "use strict";
  837. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  838. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  839. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  840. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  841. return c > 3 && r && Object.defineProperty(target, key, r), r;
  842. };
  843. var __importStar = (this && this.__importStar) || function (mod) {
  844. if (mod && mod.__esModule) return mod;
  845. var result = {};
  846. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  847. result["default"] = mod;
  848. return result;
  849. };
  850. var ScopeAnalyzer_1;
  851. Object.defineProperty(exports, "__esModule", { value: true });
  852. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  853. const eslintScope = __importStar(__webpack_require__(/*! eslint-scope */ "eslint-scope"));
  854. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  855. const EcmaVersion_1 = __webpack_require__(/*! ../../constants/EcmaVersion */ "./src/constants/EcmaVersion.ts");
  856. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  857. let ScopeAnalyzer = ScopeAnalyzer_1 = class ScopeAnalyzer {
  858. constructor() {
  859. this.scopeManager = null;
  860. }
  861. static attachMissingRanges(astTree) {
  862. estraverse.replace(astTree, {
  863. enter: (node) => {
  864. if (!node.range) {
  865. node.range = [
  866. ScopeAnalyzer_1.emptyRangeValue,
  867. ScopeAnalyzer_1.emptyRangeValue
  868. ];
  869. }
  870. return node;
  871. }
  872. });
  873. }
  874. static isRootNode(node) {
  875. return NodeGuards_1.NodeGuards.isProgramNode(node) || node.parentNode === node;
  876. }
  877. analyze(astTree) {
  878. const sourceTypeLength = ScopeAnalyzer_1.sourceTypes.length;
  879. ScopeAnalyzer_1.attachMissingRanges(astTree);
  880. for (let i = 0; i < sourceTypeLength; i++) {
  881. try {
  882. this.scopeManager = eslintScope.analyze(astTree, Object.assign(Object.assign({}, ScopeAnalyzer_1.eslintScopeOptions), { sourceType: ScopeAnalyzer_1.sourceTypes[i] }));
  883. return;
  884. }
  885. catch (error) {
  886. if (i < sourceTypeLength - 1) {
  887. continue;
  888. }
  889. throw new Error(error);
  890. }
  891. }
  892. throw new Error('Scope analyzing error');
  893. }
  894. acquireScope(node) {
  895. if (!this.scopeManager) {
  896. throw new Error('Scope manager is not defined');
  897. }
  898. const scope = this.scopeManager.acquire(node, ScopeAnalyzer_1.isRootNode(node));
  899. if (!scope) {
  900. throw new Error('Cannot acquire scope for node');
  901. }
  902. this.sanitizeScopes(scope);
  903. return scope;
  904. }
  905. sanitizeScopes(scope) {
  906. scope.childScopes.forEach((childScope) => {
  907. if (childScope.type === 'class' && childScope.upper) {
  908. if (!childScope.variables.length) {
  909. return;
  910. }
  911. const classNameVariable = childScope.variables[0];
  912. const upperVariable = childScope.upper.variables
  913. .find((variable) => {
  914. const isValidClassNameVariable = classNameVariable.defs
  915. .some((definition) => definition.type === 'ClassName');
  916. return isValidClassNameVariable && variable.name === classNameVariable.name;
  917. });
  918. upperVariable === null || upperVariable === void 0 ? void 0 : upperVariable.references.push(...childScope.variables[0].references);
  919. }
  920. });
  921. for (const childScope of scope.childScopes) {
  922. this.sanitizeScopes(childScope);
  923. }
  924. }
  925. };
  926. ScopeAnalyzer.eslintScopeOptions = {
  927. ecmaVersion: EcmaVersion_1.ecmaVersion,
  928. optimistic: true
  929. };
  930. ScopeAnalyzer.sourceTypes = [
  931. 'script',
  932. 'module'
  933. ];
  934. ScopeAnalyzer.emptyRangeValue = 0;
  935. ScopeAnalyzer = ScopeAnalyzer_1 = __decorate([
  936. inversify_1.injectable()
  937. ], ScopeAnalyzer);
  938. exports.ScopeAnalyzer = ScopeAnalyzer;
  939. /***/ }),
  940. /***/ "./src/analyzers/string-array-storage-analyzer/StringArrayStorageAnalyzer.ts":
  941. /*!***********************************************************************************!*\
  942. !*** ./src/analyzers/string-array-storage-analyzer/StringArrayStorageAnalyzer.ts ***!
  943. \***********************************************************************************/
  944. /*! no static exports found */
  945. /***/ (function(module, exports, __webpack_require__) {
  946. "use strict";
  947. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  948. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  949. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  950. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  951. return c > 3 && r && Object.defineProperty(target, key, r), r;
  952. };
  953. var __metadata = (this && this.__metadata) || function (k, v) {
  954. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  955. };
  956. var __param = (this && this.__param) || function (paramIndex, decorator) {
  957. return function (target, key) { decorator(target, key, paramIndex); }
  958. };
  959. var __importStar = (this && this.__importStar) || function (mod) {
  960. if (mod && mod.__esModule) return mod;
  961. var result = {};
  962. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  963. result["default"] = mod;
  964. return result;
  965. };
  966. var StringArrayStorageAnalyzer_1, _a, _b, _c;
  967. Object.defineProperty(exports, "__esModule", { value: true });
  968. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  969. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  970. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  971. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  972. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  973. const IStringArrayStorage_1 = __webpack_require__(/*! ../../interfaces/storages/string-array-storage/IStringArrayStorage */ "./src/interfaces/storages/string-array-storage/IStringArrayStorage.ts");
  974. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  975. const NodeMetadata_1 = __webpack_require__(/*! ../../node/NodeMetadata */ "./src/node/NodeMetadata.ts");
  976. const NodeLiteralUtils_1 = __webpack_require__(/*! ../../node/NodeLiteralUtils */ "./src/node/NodeLiteralUtils.ts");
  977. let StringArrayStorageAnalyzer = StringArrayStorageAnalyzer_1 = class StringArrayStorageAnalyzer {
  978. constructor(stringArrayStorage, randomGenerator, options) {
  979. this.stringArrayStorageData = new Map();
  980. this.stringArrayStorage = stringArrayStorage;
  981. this.randomGenerator = randomGenerator;
  982. this.options = options;
  983. }
  984. analyze(astTree) {
  985. if (!this.options.stringArray) {
  986. return;
  987. }
  988. estraverse.traverse(astTree, {
  989. enter: (node, parentNode) => {
  990. if (!parentNode) {
  991. return;
  992. }
  993. if (NodeMetadata_1.NodeMetadata.isIgnoredNode(node)) {
  994. return estraverse.VisitorOption.Skip;
  995. }
  996. if (!NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  997. return;
  998. }
  999. this.analyzeLiteralNode(node, parentNode);
  1000. }
  1001. });
  1002. }
  1003. getItemDataForLiteralNode(literalNode) {
  1004. return this.stringArrayStorageData.get(literalNode);
  1005. }
  1006. analyzeLiteralNode(literalNode, parentNode) {
  1007. if (typeof literalNode.value !== 'string') {
  1008. return;
  1009. }
  1010. if (NodeLiteralUtils_1.NodeLiteralUtils.isProhibitedLiteralNode(literalNode, parentNode)) {
  1011. return;
  1012. }
  1013. if (!this.shouldAddValueToStringArray(literalNode.value)) {
  1014. return;
  1015. }
  1016. this.stringArrayStorageData.set(literalNode, this.stringArrayStorage.getOrThrow(literalNode.value));
  1017. }
  1018. shouldAddValueToStringArray(value) {
  1019. return value.length >= StringArrayStorageAnalyzer_1.minimumLengthForStringArray
  1020. && this.randomGenerator.getMathRandom() <= this.options.stringArrayThreshold;
  1021. }
  1022. };
  1023. StringArrayStorageAnalyzer.minimumLengthForStringArray = 3;
  1024. StringArrayStorageAnalyzer = StringArrayStorageAnalyzer_1 = __decorate([
  1025. inversify_1.injectable(),
  1026. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IStringArrayStorage)),
  1027. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  1028. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  1029. __metadata("design:paramtypes", [typeof (_a = typeof IStringArrayStorage_1.IStringArrayStorage !== "undefined" && IStringArrayStorage_1.IStringArrayStorage) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  1030. ], StringArrayStorageAnalyzer);
  1031. exports.StringArrayStorageAnalyzer = StringArrayStorageAnalyzer;
  1032. /***/ }),
  1033. /***/ "./src/cli/JavaScriptObfuscatorCLI.ts":
  1034. /*!********************************************!*\
  1035. !*** ./src/cli/JavaScriptObfuscatorCLI.ts ***!
  1036. \********************************************/
  1037. /*! no static exports found */
  1038. /***/ (function(module, exports, __webpack_require__) {
  1039. "use strict";
  1040. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  1041. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1042. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1043. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  1044. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1045. };
  1046. var __metadata = (this && this.__metadata) || function (k, v) {
  1047. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  1048. };
  1049. var __importStar = (this && this.__importStar) || function (mod) {
  1050. if (mod && mod.__esModule) return mod;
  1051. var result = {};
  1052. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  1053. result["default"] = mod;
  1054. return result;
  1055. };
  1056. var _a, _b;
  1057. Object.defineProperty(exports, "__esModule", { value: true });
  1058. const commander = __importStar(__webpack_require__(/*! commander */ "commander"));
  1059. const path = __importStar(__webpack_require__(/*! path */ "path"));
  1060. const TInputCLIOptions_1 = __webpack_require__(/*! ../types/options/TInputCLIOptions */ "./src/types/options/TInputCLIOptions.ts");
  1061. const Initializable_1 = __webpack_require__(/*! ../decorators/Initializable */ "./src/decorators/Initializable.ts");
  1062. const Default_1 = __webpack_require__(/*! ../options/presets/Default */ "./src/options/presets/Default.ts");
  1063. const ArraySanitizer_1 = __webpack_require__(/*! ./sanitizers/ArraySanitizer */ "./src/cli/sanitizers/ArraySanitizer.ts");
  1064. const BooleanSanitizer_1 = __webpack_require__(/*! ./sanitizers/BooleanSanitizer */ "./src/cli/sanitizers/BooleanSanitizer.ts");
  1065. const IdentifierNamesGeneratorSanitizer_1 = __webpack_require__(/*! ./sanitizers/IdentifierNamesGeneratorSanitizer */ "./src/cli/sanitizers/IdentifierNamesGeneratorSanitizer.ts");
  1066. const ObfuscatingTargetSanitizer_1 = __webpack_require__(/*! ./sanitizers/ObfuscatingTargetSanitizer */ "./src/cli/sanitizers/ObfuscatingTargetSanitizer.ts");
  1067. const SourceMapModeSanitizer_1 = __webpack_require__(/*! ./sanitizers/SourceMapModeSanitizer */ "./src/cli/sanitizers/SourceMapModeSanitizer.ts");
  1068. const StringArrayEncodingSanitizer_1 = __webpack_require__(/*! ./sanitizers/StringArrayEncodingSanitizer */ "./src/cli/sanitizers/StringArrayEncodingSanitizer.ts");
  1069. const CLIUtils_1 = __webpack_require__(/*! ./utils/CLIUtils */ "./src/cli/utils/CLIUtils.ts");
  1070. const JavaScriptObfuscatorFacade_1 = __webpack_require__(/*! ../JavaScriptObfuscatorFacade */ "./src/JavaScriptObfuscatorFacade.ts");
  1071. const SourceCodeReader_1 = __webpack_require__(/*! ./utils/SourceCodeReader */ "./src/cli/utils/SourceCodeReader.ts");
  1072. class JavaScriptObfuscatorCLI {
  1073. constructor(argv) {
  1074. this.rawArguments = argv;
  1075. this.arguments = argv.slice(2);
  1076. }
  1077. static buildOptions(inputOptions, inputCodePath) {
  1078. const inputCLIOptions = JavaScriptObfuscatorCLI.filterOptions(inputOptions);
  1079. const configFilePath = inputOptions.config;
  1080. const configFileLocation = configFilePath ? path.resolve(configFilePath, '.') : '';
  1081. const configFileOptions = configFileLocation ? CLIUtils_1.CLIUtils.getUserConfig(configFileLocation) : {};
  1082. const inputFileName = path.basename(inputCodePath);
  1083. const inputFilePath = inputCodePath;
  1084. console.log(inputFilePath, inputFileName);
  1085. return Object.assign(Object.assign(Object.assign(Object.assign({}, Default_1.DEFAULT_PRESET), configFileOptions), inputCLIOptions), { inputFileName,
  1086. inputFilePath });
  1087. }
  1088. static filterOptions(options) {
  1089. const filteredOptions = {};
  1090. Object
  1091. .keys(options)
  1092. .forEach((option) => {
  1093. if (options[option] === undefined) {
  1094. return;
  1095. }
  1096. filteredOptions[option] = options[option];
  1097. });
  1098. return filteredOptions;
  1099. }
  1100. static processSourceCodeWithoutSourceMap(sourceCode, outputCodePath, options) {
  1101. const obfuscatedCode = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(sourceCode, options).getObfuscatedCode();
  1102. CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscatedCode);
  1103. }
  1104. static processSourceCodeWithSourceMap(sourceCode, outputCodePath, options) {
  1105. var _a;
  1106. const outputSourceMapPath = CLIUtils_1.CLIUtils.getOutputSourceMapPath(outputCodePath, (_a = options.sourceMapFileName) !== null && _a !== void 0 ? _a : '');
  1107. options = Object.assign(Object.assign({}, options), { sourceMapFileName: path.basename(outputSourceMapPath) });
  1108. const obfuscatedCode = JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(sourceCode, options);
  1109. CLIUtils_1.CLIUtils.writeFile(outputCodePath, obfuscatedCode.getObfuscatedCode());
  1110. if (options.sourceMapMode === 'separate' && obfuscatedCode.getSourceMap()) {
  1111. CLIUtils_1.CLIUtils.writeFile(outputSourceMapPath, obfuscatedCode.getSourceMap());
  1112. }
  1113. }
  1114. initialize() {
  1115. this.inputPath = path.normalize(this.arguments[0] || '');
  1116. this.commands = (new commander.Command());
  1117. this.configureCommands();
  1118. this.configureHelp();
  1119. this.inputCLIOptions = this.commands.opts();
  1120. }
  1121. run() {
  1122. const canShowHelp = !this.arguments.length || this.arguments.includes('--help');
  1123. if (canShowHelp) {
  1124. this.commands.outputHelp();
  1125. return;
  1126. }
  1127. const sourceCodeData = new SourceCodeReader_1.SourceCodeReader(this.inputCLIOptions)
  1128. .readSourceCode(this.inputPath);
  1129. this.processSourceCodeData(sourceCodeData);
  1130. }
  1131. configureCommands() {
  1132. var _a;
  1133. this.commands
  1134. .usage('<inputPath> [options]')
  1135. .version((_a = "0.24.4") !== null && _a !== void 0 ? _a : 'unknown', '-v, --version')
  1136. .option('-o, --output <path>', 'Output path for obfuscated code')
  1137. .option('--compact <boolean>', 'Disable one line output code compacting', BooleanSanitizer_1.BooleanSanitizer)
  1138. .option('--config <boolean>', 'Name of js / json config file')
  1139. .option('--control-flow-flattening <boolean>', 'Enables control flow flattening', BooleanSanitizer_1.BooleanSanitizer)
  1140. .option('--control-flow-flattening-threshold <number>', 'The probability that the control flow flattening transformation will be applied to the node', parseFloat)
  1141. .option('--dead-code-injection <boolean>', 'Enables dead code injection', BooleanSanitizer_1.BooleanSanitizer)
  1142. .option('--dead-code-injection-threshold <number>', 'The probability that the dead code injection transformation will be applied to the node', parseFloat)
  1143. .option('--debug-protection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', BooleanSanitizer_1.BooleanSanitizer)
  1144. .option('--debug-protection-interval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', BooleanSanitizer_1.BooleanSanitizer)
  1145. .option('--disable-console-output <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', BooleanSanitizer_1.BooleanSanitizer)
  1146. .option('--domain-lock <list> (comma separated, without whitespaces)', 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)', ArraySanitizer_1.ArraySanitizer)
  1147. .option('--exclude <list> (comma separated, without whitespaces)', 'A filename or glob which indicates files to exclude from obfuscation', ArraySanitizer_1.ArraySanitizer)
  1148. .option('--identifier-names-generator <string>', 'Sets identifier names generator. ' +
  1149. 'Values: hexadecimal, mangled, dictionary. ' +
  1150. 'Default: hexadecimal', IdentifierNamesGeneratorSanitizer_1.IdentifierNamesGeneratorSanitizer)
  1151. .option('--identifiers-prefix <string>', 'Sets prefix for all global identifiers.')
  1152. .option('--identifiers-dictionary <list> (comma separated, without whitespaces)', 'Identifiers dictionary (comma separated) for `--identifier-names-generator dictionary` option', ArraySanitizer_1.ArraySanitizer)
  1153. .option('--log <boolean>', 'Enables logging of the information to the console', BooleanSanitizer_1.BooleanSanitizer)
  1154. .option('--reserved-names <list> (comma separated, without whitespaces)', 'Disables obfuscation and generation of identifiers, which being matched by passed RegExp patterns (comma separated)', ArraySanitizer_1.ArraySanitizer)
  1155. .option('--reserved-strings <list> (comma separated, without whitespaces)', 'Disables transformation of string literals, which being matched by passed RegExp patterns (comma separated)', ArraySanitizer_1.ArraySanitizer)
  1156. .option('--rename-globals <boolean>', 'Allows to enable obfuscation of global variable and function names with declaration.', BooleanSanitizer_1.BooleanSanitizer)
  1157. .option('--rotate-string-array <boolean>', 'Enable rotation of string array values during obfuscation', BooleanSanitizer_1.BooleanSanitizer)
  1158. .option('--seed <string|number>', 'Sets seed for random generator. This is useful for creating repeatable results.', parseFloat)
  1159. .option('--self-defending <boolean>', 'Disables self-defending for obfuscated code', BooleanSanitizer_1.BooleanSanitizer)
  1160. .option('--shuffle-string-array <boolean>', 'Randomly shuffles string array items', BooleanSanitizer_1.BooleanSanitizer)
  1161. .option('--source-map <boolean>', 'Enables source map generation', BooleanSanitizer_1.BooleanSanitizer)
  1162. .option('--source-map-base-url <string>', 'Sets base url to the source map import url when `--source-map-mode=separate`')
  1163. .option('--source-map-file-name <string>', 'Sets file name for output source map when `--source-map-mode=separate`')
  1164. .option('--source-map-mode <string>', 'Specify source map output mode. ' +
  1165. 'Values: inline, separate. ' +
  1166. 'Default: separate', SourceMapModeSanitizer_1.SourceMapModeSanitizer)
  1167. .option('--split-strings <boolean>', 'Splits literal strings into chunks with length of `splitStringsChunkLength` option value', BooleanSanitizer_1.BooleanSanitizer)
  1168. .option('--split-strings-chunk-length <number>', 'Sets chunk length of `splitStrings` option', parseFloat)
  1169. .option('--string-array <boolean>', 'Disables gathering of all literal strings into an array and replacing every literal string with an array call', BooleanSanitizer_1.BooleanSanitizer)
  1170. .option('--string-array-encoding <string|boolean>', 'Encodes all strings in strings array using base64 or rc4 (this option can slow down your code speed. ' +
  1171. 'Values: true, false, base64, rc4. ' +
  1172. 'Default: false', StringArrayEncodingSanitizer_1.StringArrayEncodingSanitizer)
  1173. .option('--string-array-threshold <number>', 'The probability that the literal string will be inserted into stringArray (Default: 0.8, Min: 0, Max: 1)', parseFloat)
  1174. .option('--target <string>', 'Allows to set target environment for obfuscated code. ' +
  1175. 'Values: browser, browser-no-eval, node. ' +
  1176. 'Default: browser', ObfuscatingTargetSanitizer_1.ObfuscationTargetSanitizer)
  1177. .option('--transform-object-keys <boolean>', 'Enables transformation of object keys', BooleanSanitizer_1.BooleanSanitizer)
  1178. .option('--unicode-escape-sequence <boolean>', 'Allows to enable/disable string conversion to unicode escape sequence', BooleanSanitizer_1.BooleanSanitizer)
  1179. .parse(this.rawArguments);
  1180. }
  1181. configureHelp() {
  1182. this.commands.on('--help', () => {
  1183. console.log(' Examples:\n');
  1184. console.log(' %> javascript-obfuscator input_file_name.js --compact true --self-defending false');
  1185. console.log(' %> javascript-obfuscator input_file_name.js --output output_file_name.js --compact true --self-defending false');
  1186. console.log(' %> javascript-obfuscator input_directory_name --compact true --self-defending false');
  1187. console.log('');
  1188. });
  1189. }
  1190. processSourceCodeData(sourceCodeData) {
  1191. sourceCodeData.forEach(({ filePath, content }, index) => {
  1192. const outputCodePath = CLIUtils_1.CLIUtils.getOutputCodePath(filePath, this.inputCLIOptions.output);
  1193. this.processSourceCode(content, filePath, outputCodePath, index);
  1194. });
  1195. }
  1196. processSourceCode(sourceCode, inputCodePath, outputCodePath, sourceCodeIndex) {
  1197. var _a;
  1198. let options = JavaScriptObfuscatorCLI.buildOptions(this.inputCLIOptions, inputCodePath);
  1199. if (sourceCodeIndex !== null) {
  1200. const baseIdentifiersPrefix = (_a = this.inputCLIOptions.identifiersPrefix) !== null && _a !== void 0 ? _a : JavaScriptObfuscatorCLI.baseIdentifiersPrefix;
  1201. const identifiersPrefix = `${baseIdentifiersPrefix}${sourceCodeIndex}`;
  1202. options = Object.assign(Object.assign({}, options), { identifiersPrefix });
  1203. }
  1204. if (options.sourceMap) {
  1205. JavaScriptObfuscatorCLI.processSourceCodeWithSourceMap(sourceCode, outputCodePath, options);
  1206. }
  1207. else {
  1208. JavaScriptObfuscatorCLI.processSourceCodeWithoutSourceMap(sourceCode, outputCodePath, options);
  1209. }
  1210. }
  1211. }
  1212. JavaScriptObfuscatorCLI.encoding = 'utf8';
  1213. JavaScriptObfuscatorCLI.obfuscatedFilePrefix = '-obfuscated';
  1214. JavaScriptObfuscatorCLI.baseIdentifiersPrefix = 'a';
  1215. __decorate([
  1216. Initializable_1.initializable(),
  1217. __metadata("design:type", typeof (_a = typeof commander !== "undefined" && commander.CommanderStatic) === "function" ? _a : Object)
  1218. ], JavaScriptObfuscatorCLI.prototype, "commands", void 0);
  1219. __decorate([
  1220. Initializable_1.initializable(),
  1221. __metadata("design:type", typeof (_b = typeof TInputCLIOptions_1.TInputCLIOptions !== "undefined" && TInputCLIOptions_1.TInputCLIOptions) === "function" ? _b : Object)
  1222. ], JavaScriptObfuscatorCLI.prototype, "inputCLIOptions", void 0);
  1223. __decorate([
  1224. Initializable_1.initializable(),
  1225. __metadata("design:type", String)
  1226. ], JavaScriptObfuscatorCLI.prototype, "inputPath", void 0);
  1227. exports.JavaScriptObfuscatorCLI = JavaScriptObfuscatorCLI;
  1228. /***/ }),
  1229. /***/ "./src/cli/sanitizers/ArraySanitizer.ts":
  1230. /*!**********************************************!*\
  1231. !*** ./src/cli/sanitizers/ArraySanitizer.ts ***!
  1232. \**********************************************/
  1233. /*! no static exports found */
  1234. /***/ (function(module, exports, __webpack_require__) {
  1235. "use strict";
  1236. Object.defineProperty(exports, "__esModule", { value: true });
  1237. exports.ArraySanitizer = (value) => {
  1238. if (value.endsWith(',')) {
  1239. throw new SyntaxError('Multiple <list> values should be wrapped inside quotes: --option-name \'value1\',\'value2\'');
  1240. }
  1241. return value.split(',').map((string) => string.trim());
  1242. };
  1243. /***/ }),
  1244. /***/ "./src/cli/sanitizers/BooleanSanitizer.ts":
  1245. /*!************************************************!*\
  1246. !*** ./src/cli/sanitizers/BooleanSanitizer.ts ***!
  1247. \************************************************/
  1248. /*! no static exports found */
  1249. /***/ (function(module, exports, __webpack_require__) {
  1250. "use strict";
  1251. Object.defineProperty(exports, "__esModule", { value: true });
  1252. exports.BooleanSanitizer = (value) => {
  1253. return value === 'true' || value === '1';
  1254. };
  1255. /***/ }),
  1256. /***/ "./src/cli/sanitizers/IdentifierNamesGeneratorSanitizer.ts":
  1257. /*!*****************************************************************!*\
  1258. !*** ./src/cli/sanitizers/IdentifierNamesGeneratorSanitizer.ts ***!
  1259. \*****************************************************************/
  1260. /*! no static exports found */
  1261. /***/ (function(module, exports, __webpack_require__) {
  1262. "use strict";
  1263. Object.defineProperty(exports, "__esModule", { value: true });
  1264. const IdentifierNamesGenerator_1 = __webpack_require__(/*! ../../enums/generators/identifier-names-generators/IdentifierNamesGenerator */ "./src/enums/generators/identifier-names-generators/IdentifierNamesGenerator.ts");
  1265. exports.IdentifierNamesGeneratorSanitizer = (value) => {
  1266. const isCorrectIdentifierNamesGenerator = Object
  1267. .keys(IdentifierNamesGenerator_1.IdentifierNamesGenerator)
  1268. .some((key) => {
  1269. return IdentifierNamesGenerator_1.IdentifierNamesGenerator[key] === value;
  1270. });
  1271. if (!isCorrectIdentifierNamesGenerator) {
  1272. throw new ReferenceError('Invalid value of `--identifier-names-generator` option');
  1273. }
  1274. return value;
  1275. };
  1276. /***/ }),
  1277. /***/ "./src/cli/sanitizers/ObfuscatingTargetSanitizer.ts":
  1278. /*!**********************************************************!*\
  1279. !*** ./src/cli/sanitizers/ObfuscatingTargetSanitizer.ts ***!
  1280. \**********************************************************/
  1281. /*! no static exports found */
  1282. /***/ (function(module, exports, __webpack_require__) {
  1283. "use strict";
  1284. Object.defineProperty(exports, "__esModule", { value: true });
  1285. const ObfuscationTarget_1 = __webpack_require__(/*! ../../enums/ObfuscationTarget */ "./src/enums/ObfuscationTarget.ts");
  1286. exports.ObfuscationTargetSanitizer = (value) => {
  1287. const isCorrectTarget = Object
  1288. .keys(ObfuscationTarget_1.ObfuscationTarget)
  1289. .some((key) => {
  1290. return ObfuscationTarget_1.ObfuscationTarget[key] === value;
  1291. });
  1292. if (!isCorrectTarget) {
  1293. throw new ReferenceError('Invalid value of `--target` option');
  1294. }
  1295. return value;
  1296. };
  1297. /***/ }),
  1298. /***/ "./src/cli/sanitizers/SourceMapModeSanitizer.ts":
  1299. /*!******************************************************!*\
  1300. !*** ./src/cli/sanitizers/SourceMapModeSanitizer.ts ***!
  1301. \******************************************************/
  1302. /*! no static exports found */
  1303. /***/ (function(module, exports, __webpack_require__) {
  1304. "use strict";
  1305. Object.defineProperty(exports, "__esModule", { value: true });
  1306. const SourceMapMode_1 = __webpack_require__(/*! ../../enums/source-map/SourceMapMode */ "./src/enums/source-map/SourceMapMode.ts");
  1307. exports.SourceMapModeSanitizer = (value) => {
  1308. const isCorrectSourceMapMode = Object
  1309. .keys(SourceMapMode_1.SourceMapMode)
  1310. .some((key) => {
  1311. return SourceMapMode_1.SourceMapMode[key] === value;
  1312. });
  1313. if (!isCorrectSourceMapMode) {
  1314. throw new ReferenceError('Invalid value of `--source-map-mode` option');
  1315. }
  1316. return value;
  1317. };
  1318. /***/ }),
  1319. /***/ "./src/cli/sanitizers/StringArrayEncodingSanitizer.ts":
  1320. /*!************************************************************!*\
  1321. !*** ./src/cli/sanitizers/StringArrayEncodingSanitizer.ts ***!
  1322. \************************************************************/
  1323. /*! no static exports found */
  1324. /***/ (function(module, exports, __webpack_require__) {
  1325. "use strict";
  1326. Object.defineProperty(exports, "__esModule", { value: true });
  1327. const StringArrayEncoding_1 = __webpack_require__(/*! ../../enums/StringArrayEncoding */ "./src/enums/StringArrayEncoding.ts");
  1328. exports.StringArrayEncodingSanitizer = (value) => {
  1329. switch (value) {
  1330. case 'true':
  1331. case '1':
  1332. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  1333. return true;
  1334. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  1335. return StringArrayEncoding_1.StringArrayEncoding.Rc4;
  1336. default:
  1337. return false;
  1338. }
  1339. };
  1340. /***/ }),
  1341. /***/ "./src/cli/utils sync recursive":
  1342. /*!****************************!*\
  1343. !*** ./src/cli/utils sync ***!
  1344. \****************************/
  1345. /*! no static exports found */
  1346. /***/ (function(module, exports) {
  1347. function webpackEmptyContext(req) {
  1348. var e = new Error("Cannot find module '" + req + "'");
  1349. e.code = 'MODULE_NOT_FOUND';
  1350. throw e;
  1351. }
  1352. webpackEmptyContext.keys = function() { return []; };
  1353. webpackEmptyContext.resolve = webpackEmptyContext;
  1354. module.exports = webpackEmptyContext;
  1355. webpackEmptyContext.id = "./src/cli/utils sync recursive";
  1356. /***/ }),
  1357. /***/ "./src/cli/utils/CLIUtils.ts":
  1358. /*!***********************************!*\
  1359. !*** ./src/cli/utils/CLIUtils.ts ***!
  1360. \***********************************/
  1361. /*! no static exports found */
  1362. /***/ (function(module, exports, __webpack_require__) {
  1363. "use strict";
  1364. var __importStar = (this && this.__importStar) || function (mod) {
  1365. if (mod && mod.__esModule) return mod;
  1366. var result = {};
  1367. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  1368. result["default"] = mod;
  1369. return result;
  1370. };
  1371. Object.defineProperty(exports, "__esModule", { value: true });
  1372. const fs = __importStar(__webpack_require__(/*! fs */ "fs"));
  1373. const mkdirp = __importStar(__webpack_require__(/*! mkdirp */ "mkdirp"));
  1374. const path = __importStar(__webpack_require__(/*! path */ "path"));
  1375. const StringSeparator_1 = __webpack_require__(/*! ../../enums/StringSeparator */ "./src/enums/StringSeparator.ts");
  1376. const JavaScriptObfuscatorCLI_1 = __webpack_require__(/*! ../JavaScriptObfuscatorCLI */ "./src/cli/JavaScriptObfuscatorCLI.ts");
  1377. class CLIUtils {
  1378. static getOutputCodePath(inputPath, baseOutputPath) {
  1379. const normalizedBaseOutputPath = baseOutputPath
  1380. ? path.normalize(baseOutputPath)
  1381. : null;
  1382. if (!normalizedBaseOutputPath) {
  1383. return path
  1384. .normalize(inputPath)
  1385. .split(StringSeparator_1.StringSeparator.Dot)
  1386. .map((value, index) => {
  1387. return index === 0 ? `${value}${JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.obfuscatedFilePrefix}` : value;
  1388. })
  1389. .join(StringSeparator_1.StringSeparator.Dot);
  1390. }
  1391. const isDirectoryPath = path.extname(normalizedBaseOutputPath) === '';
  1392. return isDirectoryPath
  1393. ? path.join(normalizedBaseOutputPath, inputPath)
  1394. : normalizedBaseOutputPath;
  1395. }
  1396. static getOutputSourceMapPath(outputCodePath, sourceMapFileName = '') {
  1397. if (sourceMapFileName) {
  1398. outputCodePath = `${outputCodePath.substring(0, outputCodePath.lastIndexOf('/'))}/${sourceMapFileName}`;
  1399. }
  1400. if (!/\.js\.map$/.test(outputCodePath)) {
  1401. outputCodePath = `${outputCodePath.split(StringSeparator_1.StringSeparator.Dot)[0]}.js.map`;
  1402. }
  1403. else if (/\.js$/.test(outputCodePath)) {
  1404. outputCodePath += '.map';
  1405. }
  1406. return outputCodePath;
  1407. }
  1408. static getUserConfig(configPath) {
  1409. let config;
  1410. try {
  1411. config = __webpack_require__("./src/cli/utils sync recursive")(configPath);
  1412. }
  1413. catch (_a) {
  1414. try {
  1415. config = require(configPath);
  1416. }
  1417. catch (_b) {
  1418. throw new ReferenceError('Given config path must be a valid `.js` or `.json` file path');
  1419. }
  1420. }
  1421. return config;
  1422. }
  1423. static writeFile(outputPath, data) {
  1424. mkdirp.sync(path.dirname(outputPath));
  1425. fs.writeFileSync(outputPath, data, {
  1426. encoding: JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding
  1427. });
  1428. }
  1429. }
  1430. exports.CLIUtils = CLIUtils;
  1431. /***/ }),
  1432. /***/ "./src/cli/utils/SourceCodeReader.ts":
  1433. /*!*******************************************!*\
  1434. !*** ./src/cli/utils/SourceCodeReader.ts ***!
  1435. \*******************************************/
  1436. /*! no static exports found */
  1437. /***/ (function(module, exports, __webpack_require__) {
  1438. "use strict";
  1439. var __importStar = (this && this.__importStar) || function (mod) {
  1440. if (mod && mod.__esModule) return mod;
  1441. var result = {};
  1442. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  1443. result["default"] = mod;
  1444. return result;
  1445. };
  1446. var __importDefault = (this && this.__importDefault) || function (mod) {
  1447. return (mod && mod.__esModule) ? mod : { "default": mod };
  1448. };
  1449. Object.defineProperty(exports, "__esModule", { value: true });
  1450. const fs = __importStar(__webpack_require__(/*! fs */ "fs"));
  1451. const path = __importStar(__webpack_require__(/*! path */ "path"));
  1452. const multimatch_1 = __importDefault(__webpack_require__(/*! multimatch */ "multimatch"));
  1453. const LoggingPrefix_1 = __webpack_require__(/*! ../../enums/logger/LoggingPrefix */ "./src/enums/logger/LoggingPrefix.ts");
  1454. const JavaScriptObfuscatorCLI_1 = __webpack_require__(/*! ../JavaScriptObfuscatorCLI */ "./src/cli/JavaScriptObfuscatorCLI.ts");
  1455. const Logger_1 = __webpack_require__(/*! ../../logger/Logger */ "./src/logger/Logger.ts");
  1456. class SourceCodeReader {
  1457. constructor(options) {
  1458. this.options = options;
  1459. }
  1460. static isExcludedPath(filePath, excludePatterns = []) {
  1461. if (!excludePatterns.length) {
  1462. return false;
  1463. }
  1464. const fileName = path.basename(filePath);
  1465. const isExcludedFilePathByGlobPattern = !!multimatch_1.default([filePath], excludePatterns).length;
  1466. const isExcludedFilePathByInclusion = excludePatterns.some((excludePattern) => filePath.includes(excludePattern) || fileName.includes(excludePattern));
  1467. return isExcludedFilePathByInclusion || isExcludedFilePathByGlobPattern;
  1468. }
  1469. static isDirectoryPath(filePath) {
  1470. try {
  1471. return fs.statSync(filePath).isDirectory();
  1472. }
  1473. catch (_a) {
  1474. return false;
  1475. }
  1476. }
  1477. static isFilePath(filePath) {
  1478. try {
  1479. return fs.statSync(filePath).isFile();
  1480. }
  1481. catch (_a) {
  1482. return false;
  1483. }
  1484. }
  1485. static logFilePath(filePath) {
  1486. const normalizedFilePath = path.normalize(filePath);
  1487. Logger_1.Logger.log(Logger_1.Logger.colorInfo, LoggingPrefix_1.LoggingPrefix.CLI, `Obfuscating file: ${normalizedFilePath}...`);
  1488. }
  1489. readSourceCode(inputPath) {
  1490. if (SourceCodeReader.isFilePath(inputPath) && this.isValidFile(inputPath)) {
  1491. return [this.readFile(inputPath)];
  1492. }
  1493. if (SourceCodeReader.isDirectoryPath(inputPath) && this.isValidDirectory(inputPath)) {
  1494. return this.readDirectoryRecursive(inputPath);
  1495. }
  1496. const availableFilePaths = SourceCodeReader
  1497. .availableInputExtensions
  1498. .map((extension) => `\`${extension}\``)
  1499. .join(', ');
  1500. throw new ReferenceError(`Given input path must be a valid ${availableFilePaths} file or directory path`);
  1501. }
  1502. readDirectoryRecursive(directoryPath, filesData = []) {
  1503. fs.readdirSync(directoryPath, JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding)
  1504. .forEach((fileName) => {
  1505. const filePath = `${directoryPath}/${fileName}`;
  1506. if (SourceCodeReader.isDirectoryPath(filePath) && this.isValidDirectory(filePath)) {
  1507. filesData.push(...this.readDirectoryRecursive(filePath));
  1508. }
  1509. else if (SourceCodeReader.isFilePath(filePath) && this.isValidFile(filePath)) {
  1510. const fileData = this.readFile(filePath);
  1511. filesData.push(fileData);
  1512. }
  1513. });
  1514. return filesData;
  1515. }
  1516. readFile(filePath) {
  1517. SourceCodeReader.logFilePath(filePath);
  1518. return {
  1519. filePath,
  1520. content: fs.readFileSync(filePath, JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.encoding)
  1521. };
  1522. }
  1523. isValidDirectory(directoryPath) {
  1524. return !SourceCodeReader.isExcludedPath(directoryPath, this.options.exclude);
  1525. }
  1526. isValidFile(filePath) {
  1527. return SourceCodeReader.availableInputExtensions.includes(path.extname(filePath))
  1528. && !filePath.includes(JavaScriptObfuscatorCLI_1.JavaScriptObfuscatorCLI.obfuscatedFilePrefix)
  1529. && !SourceCodeReader.isExcludedPath(filePath, this.options.exclude);
  1530. }
  1531. }
  1532. exports.SourceCodeReader = SourceCodeReader;
  1533. SourceCodeReader.availableInputExtensions = [
  1534. '.js'
  1535. ];
  1536. /***/ }),
  1537. /***/ "./src/constants/EcmaVersion.ts":
  1538. /*!**************************************!*\
  1539. !*** ./src/constants/EcmaVersion.ts ***!
  1540. \**************************************/
  1541. /*! no static exports found */
  1542. /***/ (function(module, exports, __webpack_require__) {
  1543. "use strict";
  1544. Object.defineProperty(exports, "__esModule", { value: true });
  1545. exports.ecmaVersion = 11;
  1546. /***/ }),
  1547. /***/ "./src/container/InversifyContainerFacade.ts":
  1548. /*!***************************************************!*\
  1549. !*** ./src/container/InversifyContainerFacade.ts ***!
  1550. \***************************************************/
  1551. /*! no static exports found */
  1552. /***/ (function(module, exports, __webpack_require__) {
  1553. "use strict";
  1554. Object.defineProperty(exports, "__esModule", { value: true });
  1555. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  1556. const ServiceIdentifiers_1 = __webpack_require__(/*! ./ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  1557. const AnalyzersModule_1 = __webpack_require__(/*! ./modules/analyzers/AnalyzersModule */ "./src/container/modules/analyzers/AnalyzersModule.ts");
  1558. const ControlFlowTransformersModule_1 = __webpack_require__(/*! ./modules/node-transformers/ControlFlowTransformersModule */ "./src/container/modules/node-transformers/ControlFlowTransformersModule.ts");
  1559. const ConvertingTransformersModule_1 = __webpack_require__(/*! ./modules/node-transformers/ConvertingTransformersModule */ "./src/container/modules/node-transformers/ConvertingTransformersModule.ts");
  1560. const CustomNodesModule_1 = __webpack_require__(/*! ./modules/custom-nodes/CustomNodesModule */ "./src/container/modules/custom-nodes/CustomNodesModule.ts");
  1561. const FinalizingTransformersModule_1 = __webpack_require__(/*! ./modules/node-transformers/FinalizingTransformersModule */ "./src/container/modules/node-transformers/FinalizingTransformersModule.ts");
  1562. const GeneratorsModule_1 = __webpack_require__(/*! ./modules/generators/GeneratorsModule */ "./src/container/modules/generators/GeneratorsModule.ts");
  1563. const NodeTransformersModule_1 = __webpack_require__(/*! ./modules/node-transformers/NodeTransformersModule */ "./src/container/modules/node-transformers/NodeTransformersModule.ts");
  1564. const ObfuscatingTransformersModule_1 = __webpack_require__(/*! ./modules/node-transformers/ObfuscatingTransformersModule */ "./src/container/modules/node-transformers/ObfuscatingTransformersModule.ts");
  1565. const OptionsModule_1 = __webpack_require__(/*! ./modules/options/OptionsModule */ "./src/container/modules/options/OptionsModule.ts");
  1566. const PreparingTransformersModule_1 = __webpack_require__(/*! ./modules/node-transformers/PreparingTransformersModule */ "./src/container/modules/node-transformers/PreparingTransformersModule.ts");
  1567. const StoragesModule_1 = __webpack_require__(/*! ./modules/storages/StoragesModule */ "./src/container/modules/storages/StoragesModule.ts");
  1568. const UtilsModule_1 = __webpack_require__(/*! ./modules/utils/UtilsModule */ "./src/container/modules/utils/UtilsModule.ts");
  1569. const JavaScriptObfuscator_1 = __webpack_require__(/*! ../JavaScriptObfuscator */ "./src/JavaScriptObfuscator.ts");
  1570. const Logger_1 = __webpack_require__(/*! ../logger/Logger */ "./src/logger/Logger.ts");
  1571. const ObfuscationEventEmitter_1 = __webpack_require__(/*! ../event-emitters/ObfuscationEventEmitter */ "./src/event-emitters/ObfuscationEventEmitter.ts");
  1572. const ObfuscatedCode_1 = __webpack_require__(/*! ../source-code/ObfuscatedCode */ "./src/source-code/ObfuscatedCode.ts");
  1573. const SourceCode_1 = __webpack_require__(/*! ../source-code/SourceCode */ "./src/source-code/SourceCode.ts");
  1574. const TransformersRunner_1 = __webpack_require__(/*! ../node-transformers/TransformersRunner */ "./src/node-transformers/TransformersRunner.ts");
  1575. class InversifyContainerFacade {
  1576. constructor() {
  1577. this.container = new inversify_1.Container();
  1578. }
  1579. static getFactory(serviceIdentifier) {
  1580. return (context) => {
  1581. return (bindingName) => {
  1582. return context.container.getNamed(serviceIdentifier, bindingName);
  1583. };
  1584. };
  1585. }
  1586. static getCacheFactory(serviceIdentifier) {
  1587. return (context) => {
  1588. const cache = new Map();
  1589. return (bindingName) => {
  1590. if (cache.has(bindingName)) {
  1591. return cache.get(bindingName);
  1592. }
  1593. const object = context.container.getNamed(serviceIdentifier, bindingName);
  1594. cache.set(bindingName, object);
  1595. return object;
  1596. };
  1597. };
  1598. }
  1599. static getConstructorFactory(serviceIdentifier, ...dependencies) {
  1600. return (context) => {
  1601. const cache = new Map();
  1602. const cachedDependencies = [];
  1603. return (bindingName) => {
  1604. dependencies.forEach((dependency, index) => {
  1605. if (!cachedDependencies[index]) {
  1606. cachedDependencies[index] = context.container.get(dependency);
  1607. }
  1608. });
  1609. if (cache.has(bindingName)) {
  1610. return new (cache.get(bindingName))(...cachedDependencies);
  1611. }
  1612. const constructor = context.container
  1613. .getNamed(serviceIdentifier, bindingName);
  1614. cache.set(bindingName, constructor);
  1615. return new constructor(...cachedDependencies);
  1616. };
  1617. };
  1618. }
  1619. get(serviceIdentifier) {
  1620. return this.container.get(serviceIdentifier);
  1621. }
  1622. getNamed(serviceIdentifier, named) {
  1623. return this.container.getNamed(serviceIdentifier, named);
  1624. }
  1625. load(sourceCode, sourceMap, options) {
  1626. this.container
  1627. .bind(ServiceIdentifiers_1.ServiceIdentifiers.ISourceCode)
  1628. .toDynamicValue(() => new SourceCode_1.SourceCode(sourceCode, sourceMap))
  1629. .inSingletonScope();
  1630. this.container
  1631. .bind(ServiceIdentifiers_1.ServiceIdentifiers.TInputOptions)
  1632. .toDynamicValue(() => options)
  1633. .inSingletonScope();
  1634. this.container
  1635. .bind(ServiceIdentifiers_1.ServiceIdentifiers.ILogger)
  1636. .to(Logger_1.Logger)
  1637. .inSingletonScope();
  1638. this.container
  1639. .bind(ServiceIdentifiers_1.ServiceIdentifiers.IJavaScriptObfuscator)
  1640. .to(JavaScriptObfuscator_1.JavaScriptObfuscator)
  1641. .inSingletonScope();
  1642. this.container
  1643. .bind(ServiceIdentifiers_1.ServiceIdentifiers.ITransformersRunner)
  1644. .to(TransformersRunner_1.TransformersRunner)
  1645. .inSingletonScope();
  1646. this.container
  1647. .bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatedCode)
  1648. .to(ObfuscatedCode_1.ObfuscatedCode);
  1649. this.container
  1650. .bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatedCode)
  1651. .toFactory((context) => {
  1652. return (obfuscatedCodeAsString, sourceMapAsString) => {
  1653. const obfuscatedCode = context.container
  1654. .get(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatedCode);
  1655. obfuscatedCode.initialize(obfuscatedCodeAsString, sourceMapAsString);
  1656. return obfuscatedCode;
  1657. };
  1658. });
  1659. this.container
  1660. .bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)
  1661. .to(ObfuscationEventEmitter_1.ObfuscationEventEmitter)
  1662. .inSingletonScope();
  1663. this.container.load(AnalyzersModule_1.analyzersModule);
  1664. this.container.load(ControlFlowTransformersModule_1.controlFlowTransformersModule);
  1665. this.container.load(ConvertingTransformersModule_1.convertingTransformersModule);
  1666. this.container.load(CustomNodesModule_1.customNodesModule);
  1667. this.container.load(FinalizingTransformersModule_1.finalizingTransformersModule);
  1668. this.container.load(GeneratorsModule_1.generatorsModule);
  1669. this.container.load(NodeTransformersModule_1.nodeTransformersModule);
  1670. this.container.load(ObfuscatingTransformersModule_1.obfuscatingTransformersModule);
  1671. this.container.load(OptionsModule_1.optionsModule);
  1672. this.container.load(PreparingTransformersModule_1.preparingTransformersModule);
  1673. this.container.load(StoragesModule_1.storagesModule);
  1674. this.container.load(UtilsModule_1.utilsModule);
  1675. }
  1676. unload() {
  1677. this.container.unbindAll();
  1678. }
  1679. }
  1680. exports.InversifyContainerFacade = InversifyContainerFacade;
  1681. /***/ }),
  1682. /***/ "./src/container/ServiceIdentifiers.ts":
  1683. /*!*********************************************!*\
  1684. !*** ./src/container/ServiceIdentifiers.ts ***!
  1685. \*********************************************/
  1686. /*! no static exports found */
  1687. /***/ (function(module, exports, __webpack_require__) {
  1688. "use strict";
  1689. Object.defineProperty(exports, "__esModule", { value: true });
  1690. var ServiceIdentifiers;
  1691. (function (ServiceIdentifiers) {
  1692. ServiceIdentifiers["Factory__ICalleeDataExtractor"] = "Factory<ICalleeDataExtractor>";
  1693. ServiceIdentifiers["Factory__IControlFlowCustomNode"] = "Factory<IControlFlowCustomNode>";
  1694. ServiceIdentifiers["Factory__IControlFlowReplacer"] = "Factory<IControlFlowReplacer>";
  1695. ServiceIdentifiers["Factory__ICustomNode"] = "Factory<ICustomNode>";
  1696. ServiceIdentifiers["Factory__ICustomNodeGroup"] = "Factory<ICustomNodeGroup>";
  1697. ServiceIdentifiers["Factory__IDeadCodeInjectionCustomNode"] = "Factory<IDeadCodeInjectionCustomNode>";
  1698. ServiceIdentifiers["Factory__IIdentifierNamesGenerator"] = "Factory<IIdentifierNamesGenerator>";
  1699. ServiceIdentifiers["Factory__IIdentifierObfuscatingReplacer"] = "Factory<IIdentifierObfuscatingReplacer>";
  1700. ServiceIdentifiers["Factory__INodeGuard"] = "Factory<INodeGuard>";
  1701. ServiceIdentifiers["Factory__INodeTransformer"] = "Factory<INodeTransformer[]>";
  1702. ServiceIdentifiers["Factory__IObfuscatedCode"] = "Factory<IObfuscatedCode>";
  1703. ServiceIdentifiers["Factory__IObfuscatingReplacer"] = "Factory<IObfuscatingReplacer>";
  1704. ServiceIdentifiers["Factory__IObjectExpressionKeysTransformerCustomNode"] = "Factory<IObjectExpressionKeysTransformerCustomNode>";
  1705. ServiceIdentifiers["Factory__IObjectExpressionExtractor"] = "Factory<IObjectExpressionExtractor>";
  1706. ServiceIdentifiers["Factory__TControlFlowStorage"] = "Factory<TControlFlowStorage>";
  1707. ServiceIdentifiers["IArrayUtils"] = "IArrayUtils";
  1708. ServiceIdentifiers["ICalleeDataExtractor"] = "ICalleeDataExtractor";
  1709. ServiceIdentifiers["ICallsGraphAnalyzer"] = "ICallsGraphAnalyzer";
  1710. ServiceIdentifiers["ICryptUtils"] = "ICryptUtils";
  1711. ServiceIdentifiers["ICustomNode"] = "ICustomNode";
  1712. ServiceIdentifiers["ICustomNodeGroup"] = "ICustomNodeGroup";
  1713. ServiceIdentifiers["IControlFlowReplacer"] = "IControlFlowReplacer";
  1714. ServiceIdentifiers["ICustomNodeFormatter"] = "ICustomNodeFormatter";
  1715. ServiceIdentifiers["IEscapeSequenceEncoder"] = "IEscapeSequenceEncoder";
  1716. ServiceIdentifiers["IIdentifierNamesGenerator"] = "IIdentifierNamesGenerator";
  1717. ServiceIdentifiers["IIdentifierObfuscatingReplacer"] = "IIdentifierObfuscatingReplacer";
  1718. ServiceIdentifiers["IJavaScriptObfuscator"] = "IJavaScriptObfuscator";
  1719. ServiceIdentifiers["ILevelledTopologicalSorter"] = "ILevelledTopologicalSorter";
  1720. ServiceIdentifiers["ILogger"] = "ILogger";
  1721. ServiceIdentifiers["INodeGuard"] = "INodeGuard";
  1722. ServiceIdentifiers["INodeTransformer"] = "INodeTransformer";
  1723. ServiceIdentifiers["INodeTransformerNamesGroupsBuilder"] = "INodeTransformerNamesGroupsBuilder";
  1724. ServiceIdentifiers["IObfuscationEventEmitter"] = "IObfuscationEventEmitter";
  1725. ServiceIdentifiers["IObfuscatedCode"] = "IObfuscatedCode";
  1726. ServiceIdentifiers["IOptions"] = "IOptions";
  1727. ServiceIdentifiers["IOptionsNormalizer"] = "IOptionsNormalizer";
  1728. ServiceIdentifiers["IObfuscatingReplacer"] = "IObfuscatingReplacer";
  1729. ServiceIdentifiers["IPrevailingKindOfVariablesAnalyzer"] = "IPrevailingKindOfVariablesAnalyzer";
  1730. ServiceIdentifiers["IObjectExpressionExtractor"] = "IObjectExpressionExtractor";
  1731. ServiceIdentifiers["IRandomGenerator"] = "IRandomGenerator";
  1732. ServiceIdentifiers["ISourceCode"] = "ISourceCode";
  1733. ServiceIdentifiers["ISourceMapCorrector"] = "ISourceMapCorrector";
  1734. ServiceIdentifiers["IScopeAnalyzer"] = "IScopeAnalyzer";
  1735. ServiceIdentifiers["IStringArrayStorage"] = "IStringArrayStorage";
  1736. ServiceIdentifiers["IStringArrayStorageAnalyzer"] = "IStringArrayStorageAnalyzer";
  1737. ServiceIdentifiers["ITransformersRunner"] = "ITransformersRunner";
  1738. ServiceIdentifiers["Newable__ICustomNode"] = "Newable<ICustomNode>";
  1739. ServiceIdentifiers["Newable__TControlFlowStorage"] = "Newable<TControlFlowStorage>";
  1740. ServiceIdentifiers["TCustomNodeGroupStorage"] = "TCustomNodeGroupStorage";
  1741. ServiceIdentifiers["TInputOptions"] = "TInputOptions";
  1742. })(ServiceIdentifiers = exports.ServiceIdentifiers || (exports.ServiceIdentifiers = {}));
  1743. /***/ }),
  1744. /***/ "./src/container/modules/analyzers/AnalyzersModule.ts":
  1745. /*!************************************************************!*\
  1746. !*** ./src/container/modules/analyzers/AnalyzersModule.ts ***!
  1747. \************************************************************/
  1748. /*! no static exports found */
  1749. /***/ (function(module, exports, __webpack_require__) {
  1750. "use strict";
  1751. Object.defineProperty(exports, "__esModule", { value: true });
  1752. const InversifyContainerFacade_1 = __webpack_require__(/*! ../../InversifyContainerFacade */ "./src/container/InversifyContainerFacade.ts");
  1753. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  1754. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  1755. const CalleeDataExtractor_1 = __webpack_require__(/*! ../../../enums/analyzers/calls-graph-analyzer/CalleeDataExtractor */ "./src/enums/analyzers/calls-graph-analyzer/CalleeDataExtractor.ts");
  1756. const CallsGraphAnalyzer_1 = __webpack_require__(/*! ../../../analyzers/calls-graph-analyzer/CallsGraphAnalyzer */ "./src/analyzers/calls-graph-analyzer/CallsGraphAnalyzer.ts");
  1757. const FunctionDeclarationCalleeDataExtractor_1 = __webpack_require__(/*! ../../../analyzers/calls-graph-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor */ "./src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionDeclarationCalleeDataExtractor.ts");
  1758. const FunctionExpressionCalleeDataExtractor_1 = __webpack_require__(/*! ../../../analyzers/calls-graph-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor */ "./src/analyzers/calls-graph-analyzer/callee-data-extractors/FunctionExpressionCalleeDataExtractor.ts");
  1759. const ObjectExpressionCalleeDataExtractor_1 = __webpack_require__(/*! ../../../analyzers/calls-graph-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor */ "./src/analyzers/calls-graph-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts");
  1760. const PrevailingKindOfVariablesAnalyzer_1 = __webpack_require__(/*! ../../../analyzers/prevailing-kind-of-variables-analyzer/PrevailingKindOfVariablesAnalyzer */ "./src/analyzers/prevailing-kind-of-variables-analyzer/PrevailingKindOfVariablesAnalyzer.ts");
  1761. const ScopeAnalyzer_1 = __webpack_require__(/*! ../../../analyzers/scope-analyzer/ScopeAnalyzer */ "./src/analyzers/scope-analyzer/ScopeAnalyzer.ts");
  1762. const StringArrayStorageAnalyzer_1 = __webpack_require__(/*! ../../../analyzers/string-array-storage-analyzer/StringArrayStorageAnalyzer */ "./src/analyzers/string-array-storage-analyzer/StringArrayStorageAnalyzer.ts");
  1763. exports.analyzersModule = new inversify_1.ContainerModule((bind) => {
  1764. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICallsGraphAnalyzer)
  1765. .to(CallsGraphAnalyzer_1.CallsGraphAnalyzer)
  1766. .inSingletonScope();
  1767. bind(ServiceIdentifiers_1.ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer)
  1768. .to(PrevailingKindOfVariablesAnalyzer_1.PrevailingKindOfVariablesAnalyzer)
  1769. .inSingletonScope();
  1770. bind(ServiceIdentifiers_1.ServiceIdentifiers.IScopeAnalyzer)
  1771. .to(ScopeAnalyzer_1.ScopeAnalyzer)
  1772. .inSingletonScope();
  1773. bind(ServiceIdentifiers_1.ServiceIdentifiers.IStringArrayStorageAnalyzer)
  1774. .to(StringArrayStorageAnalyzer_1.StringArrayStorageAnalyzer)
  1775. .inSingletonScope();
  1776. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor)
  1777. .to(FunctionDeclarationCalleeDataExtractor_1.FunctionDeclarationCalleeDataExtractor)
  1778. .whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.FunctionDeclarationCalleeDataExtractor);
  1779. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor)
  1780. .to(FunctionExpressionCalleeDataExtractor_1.FunctionExpressionCalleeDataExtractor)
  1781. .whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.FunctionExpressionCalleeDataExtractor);
  1782. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor)
  1783. .to(ObjectExpressionCalleeDataExtractor_1.ObjectExpressionCalleeDataExtractor)
  1784. .whenTargetNamed(CalleeDataExtractor_1.CalleeDataExtractor.ObjectExpressionCalleeDataExtractor);
  1785. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICalleeDataExtractor)
  1786. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  1787. .getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICalleeDataExtractor));
  1788. });
  1789. /***/ }),
  1790. /***/ "./src/container/modules/custom-nodes/CustomNodesModule.ts":
  1791. /*!*****************************************************************!*\
  1792. !*** ./src/container/modules/custom-nodes/CustomNodesModule.ts ***!
  1793. \*****************************************************************/
  1794. /*! no static exports found */
  1795. /***/ (function(module, exports, __webpack_require__) {
  1796. "use strict";
  1797. Object.defineProperty(exports, "__esModule", { value: true });
  1798. const InversifyContainerFacade_1 = __webpack_require__(/*! ../../InversifyContainerFacade */ "./src/container/InversifyContainerFacade.ts");
  1799. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  1800. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  1801. const ControlFlowCustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/ControlFlowCustomNode */ "./src/enums/custom-nodes/ControlFlowCustomNode.ts");
  1802. const CustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/CustomNode */ "./src/enums/custom-nodes/CustomNode.ts");
  1803. const CustomNodeGroup_1 = __webpack_require__(/*! ../../../enums/custom-nodes/CustomNodeGroup */ "./src/enums/custom-nodes/CustomNodeGroup.ts");
  1804. const DeadCodeInjectionCustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/DeadCodeInjectionCustomNode */ "./src/enums/custom-nodes/DeadCodeInjectionCustomNode.ts");
  1805. const ObjectExpressionKeysTransformerCustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/ObjectExpressionKeysTransformerCustomNode */ "./src/enums/custom-nodes/ObjectExpressionKeysTransformerCustomNode.ts");
  1806. const ConsoleOutputCustomNodeGroup_1 = __webpack_require__(/*! ../../../custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup */ "./src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts");
  1807. const DebugProtectionCustomNodeGroup_1 = __webpack_require__(/*! ../../../custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup */ "./src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts");
  1808. const DomainLockCustomNodeGroup_1 = __webpack_require__(/*! ../../../custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup */ "./src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts");
  1809. const SelfDefendingCustomNodeGroup_1 = __webpack_require__(/*! ../../../custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup */ "./src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts");
  1810. const StringArrayCustomNodeGroup_1 = __webpack_require__(/*! ../../../custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup */ "./src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts");
  1811. const ObjectExpressionVariableDeclarationHostNode_1 = __webpack_require__(/*! ../../../custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode */ "./src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts");
  1812. const BinaryExpressionFunctionNode_1 = __webpack_require__(/*! ../../../custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode */ "./src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts");
  1813. const BlockStatementControlFlowFlatteningNode_1 = __webpack_require__(/*! ../../../custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode */ "./src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts");
  1814. const BlockStatementDeadCodeInjectionNode_1 = __webpack_require__(/*! ../../../custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode */ "./src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts");
  1815. const CallExpressionControlFlowStorageCallNode_1 = __webpack_require__(/*! ../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode */ "./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts");
  1816. const CallExpressionFunctionNode_1 = __webpack_require__(/*! ../../../custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode */ "./src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts");
  1817. const ControlFlowStorageNode_1 = __webpack_require__(/*! ../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode */ "./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts");
  1818. const ConsoleOutputDisableExpressionNode_1 = __webpack_require__(/*! ../../../custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode */ "./src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts");
  1819. const CustomNodeFormatter_1 = __webpack_require__(/*! ../../../custom-nodes/CustomNodeFormatter */ "./src/custom-nodes/CustomNodeFormatter.ts");
  1820. const DebugProtectionFunctionCallNode_1 = __webpack_require__(/*! ../../../custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode */ "./src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts");
  1821. const DebugProtectionFunctionIntervalNode_1 = __webpack_require__(/*! ../../../custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode */ "./src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts");
  1822. const DebugProtectionFunctionNode_1 = __webpack_require__(/*! ../../../custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode */ "./src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts");
  1823. const DomainLockNode_1 = __webpack_require__(/*! ../../../custom-nodes/domain-lock-nodes/DomainLockNode */ "./src/custom-nodes/domain-lock-nodes/DomainLockNode.ts");
  1824. const ExpressionWithOperatorControlFlowStorageCallNode_1 = __webpack_require__(/*! ../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode */ "./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts");
  1825. const LogicalExpressionFunctionNode_1 = __webpack_require__(/*! ../../../custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode */ "./src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts");
  1826. const NodeCallsControllerFunctionNode_1 = __webpack_require__(/*! ../../../custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode */ "./src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts");
  1827. const SelfDefendingUnicodeNode_1 = __webpack_require__(/*! ../../../custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode */ "./src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts");
  1828. const StringArrayCallsWrapper_1 = __webpack_require__(/*! ../../../custom-nodes/string-array-nodes/StringArrayCallsWrapper */ "./src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts");
  1829. const StringArrayNode_1 = __webpack_require__(/*! ../../../custom-nodes/string-array-nodes/StringArrayNode */ "./src/custom-nodes/string-array-nodes/StringArrayNode.ts");
  1830. const StringArrayRotateFunctionNode_1 = __webpack_require__(/*! ../../../custom-nodes/string-array-nodes/StringArrayRotateFunctionNode */ "./src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts");
  1831. const StringLiteralControlFlowStorageCallNode_1 = __webpack_require__(/*! ../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode */ "./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts");
  1832. const StringLiteralNode_1 = __webpack_require__(/*! ../../../custom-nodes/control-flow-flattening-nodes/StringLiteralNode */ "./src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts");
  1833. exports.customNodesModule = new inversify_1.ContainerModule((bind) => {
  1834. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode)
  1835. .to(ConsoleOutputDisableExpressionNode_1.ConsoleOutputDisableExpressionNode)
  1836. .whenTargetNamed(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode);
  1837. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode)
  1838. .to(DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode)
  1839. .whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode);
  1840. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode)
  1841. .to(DebugProtectionFunctionIntervalNode_1.DebugProtectionFunctionIntervalNode)
  1842. .whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode);
  1843. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode)
  1844. .to(DebugProtectionFunctionNode_1.DebugProtectionFunctionNode)
  1845. .whenTargetNamed(CustomNode_1.CustomNode.DebugProtectionFunctionNode);
  1846. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode)
  1847. .to(DomainLockNode_1.DomainLockNode)
  1848. .whenTargetNamed(CustomNode_1.CustomNode.DomainLockNode);
  1849. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode)
  1850. .to(NodeCallsControllerFunctionNode_1.NodeCallsControllerFunctionNode)
  1851. .whenTargetNamed(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  1852. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode)
  1853. .to(SelfDefendingUnicodeNode_1.SelfDefendingUnicodeNode)
  1854. .whenTargetNamed(CustomNode_1.CustomNode.SelfDefendingUnicodeNode);
  1855. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode)
  1856. .to(StringArrayCallsWrapper_1.StringArrayCallsWrapper)
  1857. .whenTargetNamed(CustomNode_1.CustomNode.StringArrayCallsWrapper);
  1858. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode)
  1859. .to(StringArrayNode_1.StringArrayNode)
  1860. .whenTargetNamed(CustomNode_1.CustomNode.StringArrayNode);
  1861. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode)
  1862. .to(StringArrayRotateFunctionNode_1.StringArrayRotateFunctionNode)
  1863. .whenTargetNamed(CustomNode_1.CustomNode.StringArrayRotateFunctionNode);
  1864. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1865. .toConstructor(BinaryExpressionFunctionNode_1.BinaryExpressionFunctionNode)
  1866. .whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.BinaryExpressionFunctionNode);
  1867. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1868. .toConstructor(BlockStatementControlFlowFlatteningNode_1.BlockStatementControlFlowFlatteningNode)
  1869. .whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);
  1870. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1871. .toConstructor(CallExpressionControlFlowStorageCallNode_1.CallExpressionControlFlowStorageCallNode)
  1872. .whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode);
  1873. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1874. .toConstructor(CallExpressionFunctionNode_1.CallExpressionFunctionNode)
  1875. .whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionFunctionNode);
  1876. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1877. .toConstructor(ControlFlowStorageNode_1.ControlFlowStorageNode)
  1878. .whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.ControlFlowStorageNode);
  1879. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1880. .toConstructor(ExpressionWithOperatorControlFlowStorageCallNode_1.ExpressionWithOperatorControlFlowStorageCallNode)
  1881. .whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode);
  1882. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1883. .toConstructor(LogicalExpressionFunctionNode_1.LogicalExpressionFunctionNode)
  1884. .whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.LogicalExpressionFunctionNode);
  1885. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1886. .toConstructor(StringLiteralNode_1.StringLiteralNode)
  1887. .whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralNode);
  1888. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1889. .toConstructor(StringLiteralControlFlowStorageCallNode_1.StringLiteralControlFlowStorageCallNode)
  1890. .whenTargetNamed(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);
  1891. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1892. .toConstructor(BlockStatementDeadCodeInjectionNode_1.BlockStatementDeadCodeInjectionNode)
  1893. .whenTargetNamed(DeadCodeInjectionCustomNode_1.DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode);
  1894. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode)
  1895. .toConstructor(ObjectExpressionVariableDeclarationHostNode_1.ObjectExpressionVariableDeclarationHostNode)
  1896. .whenTargetNamed(ObjectExpressionKeysTransformerCustomNode_1.ObjectExpressionKeysTransformerCustomNode.ObjectExpressionVariableDeclarationHostNode);
  1897. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup)
  1898. .to(ConsoleOutputCustomNodeGroup_1.ConsoleOutputCustomNodeGroup)
  1899. .whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.ConsoleOutputCustomNodeGroup);
  1900. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup)
  1901. .to(DebugProtectionCustomNodeGroup_1.DebugProtectionCustomNodeGroup)
  1902. .whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.DebugProtectionCustomNodeGroup);
  1903. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup)
  1904. .to(DomainLockCustomNodeGroup_1.DomainLockCustomNodeGroup)
  1905. .whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.DomainLockCustomNodeGroup);
  1906. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup)
  1907. .to(SelfDefendingCustomNodeGroup_1.SelfDefendingCustomNodeGroup)
  1908. .whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.SelfDefendingCustomNodeGroup);
  1909. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup)
  1910. .to(StringArrayCustomNodeGroup_1.StringArrayCustomNodeGroup)
  1911. .whenTargetNamed(CustomNodeGroup_1.CustomNodeGroup.StringArrayCustomNodeGroup);
  1912. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)
  1913. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  1914. .getFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNode));
  1915. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)
  1916. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  1917. .getConstructorFactory(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode, ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator, ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter, ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator, ServiceIdentifiers_1.ServiceIdentifiers.IOptions, ServiceIdentifiers_1.ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer));
  1918. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode)
  1919. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  1920. .getConstructorFactory(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode, ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator, ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter, ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator, ServiceIdentifiers_1.ServiceIdentifiers.IOptions));
  1921. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObjectExpressionKeysTransformerCustomNode)
  1922. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  1923. .getConstructorFactory(ServiceIdentifiers_1.ServiceIdentifiers.Newable__ICustomNode, ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator, ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter, ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator, ServiceIdentifiers_1.ServiceIdentifiers.IOptions, ServiceIdentifiers_1.ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer));
  1924. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNodeGroup)
  1925. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  1926. .getFactory(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeGroup));
  1927. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)
  1928. .to(CustomNodeFormatter_1.CustomNodeFormatter)
  1929. .inSingletonScope();
  1930. });
  1931. /***/ }),
  1932. /***/ "./src/container/modules/generators/GeneratorsModule.ts":
  1933. /*!**************************************************************!*\
  1934. !*** ./src/container/modules/generators/GeneratorsModule.ts ***!
  1935. \**************************************************************/
  1936. /*! no static exports found */
  1937. /***/ (function(module, exports, __webpack_require__) {
  1938. "use strict";
  1939. Object.defineProperty(exports, "__esModule", { value: true });
  1940. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  1941. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  1942. const IdentifierNamesGenerator_1 = __webpack_require__(/*! ../../../enums/generators/identifier-names-generators/IdentifierNamesGenerator */ "./src/enums/generators/identifier-names-generators/IdentifierNamesGenerator.ts");
  1943. const DictionaryIdentifierNamesGenerator_1 = __webpack_require__(/*! ../../../generators/identifier-names-generators/DictionaryIdentifierNamesGenerator */ "./src/generators/identifier-names-generators/DictionaryIdentifierNamesGenerator.ts");
  1944. const HexadecimalIdentifierNamesGenerator_1 = __webpack_require__(/*! ../../../generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator */ "./src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts");
  1945. const MangledIdentifierNamesGenerator_1 = __webpack_require__(/*! ../../../generators/identifier-names-generators/MangledIdentifierNamesGenerator */ "./src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts");
  1946. exports.generatorsModule = new inversify_1.ContainerModule((bind) => {
  1947. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator)
  1948. .to(DictionaryIdentifierNamesGenerator_1.DictionaryIdentifierNamesGenerator)
  1949. .inSingletonScope()
  1950. .whenTargetNamed(IdentifierNamesGenerator_1.IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator);
  1951. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator)
  1952. .to(HexadecimalIdentifierNamesGenerator_1.HexadecimalIdentifierNamesGenerator)
  1953. .inSingletonScope()
  1954. .whenTargetNamed(IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator);
  1955. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator)
  1956. .to(MangledIdentifierNamesGenerator_1.MangledIdentifierNamesGenerator)
  1957. .inSingletonScope()
  1958. .whenTargetNamed(IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator);
  1959. function identifierNameGeneratorFactory() {
  1960. let cachedIdentifierNamesGenerator = null;
  1961. return (context) => (options) => {
  1962. if (cachedIdentifierNamesGenerator) {
  1963. return cachedIdentifierNamesGenerator;
  1964. }
  1965. let identifierNamesGenerator;
  1966. switch (options.identifierNamesGenerator) {
  1967. case IdentifierNamesGenerator_1.IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator:
  1968. identifierNamesGenerator = context.container.getNamed(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator, IdentifierNamesGenerator_1.IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator);
  1969. break;
  1970. case IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator:
  1971. identifierNamesGenerator = context.container.getNamed(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator, IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator);
  1972. break;
  1973. case IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator:
  1974. default:
  1975. identifierNamesGenerator = context.container.getNamed(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierNamesGenerator, IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator);
  1976. }
  1977. cachedIdentifierNamesGenerator = identifierNamesGenerator;
  1978. return identifierNamesGenerator;
  1979. };
  1980. }
  1981. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
  1982. .toFactory(identifierNameGeneratorFactory());
  1983. });
  1984. /***/ }),
  1985. /***/ "./src/container/modules/node-transformers/ControlFlowTransformersModule.ts":
  1986. /*!**********************************************************************************!*\
  1987. !*** ./src/container/modules/node-transformers/ControlFlowTransformersModule.ts ***!
  1988. \**********************************************************************************/
  1989. /*! no static exports found */
  1990. /***/ (function(module, exports, __webpack_require__) {
  1991. "use strict";
  1992. Object.defineProperty(exports, "__esModule", { value: true });
  1993. const InversifyContainerFacade_1 = __webpack_require__(/*! ../../InversifyContainerFacade */ "./src/container/InversifyContainerFacade.ts");
  1994. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  1995. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  1996. const ControlFlowReplacer_1 = __webpack_require__(/*! ../../../enums/node-transformers/obfuscating-transformers/obfuscating-replacers/ControlFlowReplacer */ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/ControlFlowReplacer.ts");
  1997. const NodeTransformer_1 = __webpack_require__(/*! ../../../enums/node-transformers/NodeTransformer */ "./src/enums/node-transformers/NodeTransformer.ts");
  1998. const BinaryExpressionControlFlowReplacer_1 = __webpack_require__(/*! ../../../node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer */ "./src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts");
  1999. const BlockStatementControlFlowTransformer_1 = __webpack_require__(/*! ../../../node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer */ "./src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts");
  2000. const CallExpressionControlFlowReplacer_1 = __webpack_require__(/*! ../../../node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer */ "./src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts");
  2001. const DeadCodeInjectionTransformer_1 = __webpack_require__(/*! ../../../node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer */ "./src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts");
  2002. const FunctionControlFlowTransformer_1 = __webpack_require__(/*! ../../../node-transformers/control-flow-transformers/FunctionControlFlowTransformer */ "./src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts");
  2003. const LogicalExpressionControlFlowReplacer_1 = __webpack_require__(/*! ../../../node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer */ "./src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts");
  2004. const StringLiteralControlFlowReplacer_1 = __webpack_require__(/*! ../../../node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer */ "./src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts");
  2005. exports.controlFlowTransformersModule = new inversify_1.ContainerModule((bind) => {
  2006. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2007. .to(BlockStatementControlFlowTransformer_1.BlockStatementControlFlowTransformer)
  2008. .whenTargetNamed(NodeTransformer_1.NodeTransformer.BlockStatementControlFlowTransformer);
  2009. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2010. .to(DeadCodeInjectionTransformer_1.DeadCodeInjectionTransformer)
  2011. .whenTargetNamed(NodeTransformer_1.NodeTransformer.DeadCodeInjectionTransformer);
  2012. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2013. .to(FunctionControlFlowTransformer_1.FunctionControlFlowTransformer)
  2014. .whenTargetNamed(NodeTransformer_1.NodeTransformer.FunctionControlFlowTransformer);
  2015. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer)
  2016. .to(BinaryExpressionControlFlowReplacer_1.BinaryExpressionControlFlowReplacer)
  2017. .whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.BinaryExpressionControlFlowReplacer);
  2018. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer)
  2019. .to(CallExpressionControlFlowReplacer_1.CallExpressionControlFlowReplacer)
  2020. .whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.CallExpressionControlFlowReplacer);
  2021. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer)
  2022. .to(LogicalExpressionControlFlowReplacer_1.LogicalExpressionControlFlowReplacer)
  2023. .whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.LogicalExpressionControlFlowReplacer);
  2024. bind(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer)
  2025. .to(StringLiteralControlFlowReplacer_1.StringLiteralControlFlowReplacer)
  2026. .whenTargetNamed(ControlFlowReplacer_1.ControlFlowReplacer.StringLiteralControlFlowReplacer);
  2027. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowReplacer)
  2028. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  2029. .getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IControlFlowReplacer));
  2030. });
  2031. /***/ }),
  2032. /***/ "./src/container/modules/node-transformers/ConvertingTransformersModule.ts":
  2033. /*!*********************************************************************************!*\
  2034. !*** ./src/container/modules/node-transformers/ConvertingTransformersModule.ts ***!
  2035. \*********************************************************************************/
  2036. /*! no static exports found */
  2037. /***/ (function(module, exports, __webpack_require__) {
  2038. "use strict";
  2039. Object.defineProperty(exports, "__esModule", { value: true });
  2040. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2041. const InversifyContainerFacade_1 = __webpack_require__(/*! ../../InversifyContainerFacade */ "./src/container/InversifyContainerFacade.ts");
  2042. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2043. const NodeTransformer_1 = __webpack_require__(/*! ../../../enums/node-transformers/NodeTransformer */ "./src/enums/node-transformers/NodeTransformer.ts");
  2044. const ObjectExpressionExtractor_1 = __webpack_require__(/*! ../../../enums/node-transformers/converting-transformers/properties-extractors/ObjectExpressionExtractor */ "./src/enums/node-transformers/converting-transformers/properties-extractors/ObjectExpressionExtractor.ts");
  2045. const ObjectExpressionToVariableDeclarationExtractor_1 = __webpack_require__(/*! ../../../node-transformers/converting-transformers/object-expression-extractors/ObjectExpressionToVariableDeclarationExtractor */ "./src/node-transformers/converting-transformers/object-expression-extractors/ObjectExpressionToVariableDeclarationExtractor.ts");
  2046. const MemberExpressionTransformer_1 = __webpack_require__(/*! ../../../node-transformers/converting-transformers/MemberExpressionTransformer */ "./src/node-transformers/converting-transformers/MemberExpressionTransformer.ts");
  2047. const MethodDefinitionTransformer_1 = __webpack_require__(/*! ../../../node-transformers/converting-transformers/MethodDefinitionTransformer */ "./src/node-transformers/converting-transformers/MethodDefinitionTransformer.ts");
  2048. const ObjectExpressionKeysTransformer_1 = __webpack_require__(/*! ../../../node-transformers/converting-transformers/ObjectExpressionKeysTransformer */ "./src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts");
  2049. const ObjectExpressionTransformer_1 = __webpack_require__(/*! ../../../node-transformers/converting-transformers/ObjectExpressionTransformer */ "./src/node-transformers/converting-transformers/ObjectExpressionTransformer.ts");
  2050. const SplitStringTransformer_1 = __webpack_require__(/*! ../../../node-transformers/converting-transformers/SplitStringTransformer */ "./src/node-transformers/converting-transformers/SplitStringTransformer.ts");
  2051. const TemplateLiteralTransformer_1 = __webpack_require__(/*! ../../../node-transformers/converting-transformers/TemplateLiteralTransformer */ "./src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts");
  2052. const BasePropertiesExtractor_1 = __webpack_require__(/*! ../../../node-transformers/converting-transformers/object-expression-extractors/BasePropertiesExtractor */ "./src/node-transformers/converting-transformers/object-expression-extractors/BasePropertiesExtractor.ts");
  2053. exports.convertingTransformersModule = new inversify_1.ContainerModule((bind) => {
  2054. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2055. .to(MemberExpressionTransformer_1.MemberExpressionTransformer)
  2056. .whenTargetNamed(NodeTransformer_1.NodeTransformer.MemberExpressionTransformer);
  2057. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2058. .to(MethodDefinitionTransformer_1.MethodDefinitionTransformer)
  2059. .whenTargetNamed(NodeTransformer_1.NodeTransformer.MethodDefinitionTransformer);
  2060. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2061. .to(ObjectExpressionKeysTransformer_1.ObjectExpressionKeysTransformer)
  2062. .whenTargetNamed(NodeTransformer_1.NodeTransformer.ObjectExpressionKeysTransformer);
  2063. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2064. .to(ObjectExpressionTransformer_1.ObjectExpressionTransformer)
  2065. .whenTargetNamed(NodeTransformer_1.NodeTransformer.ObjectExpressionTransformer);
  2066. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2067. .to(SplitStringTransformer_1.SplitStringTransformer)
  2068. .whenTargetNamed(NodeTransformer_1.NodeTransformer.SplitStringTransformer);
  2069. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2070. .to(TemplateLiteralTransformer_1.TemplateLiteralTransformer)
  2071. .whenTargetNamed(NodeTransformer_1.NodeTransformer.TemplateLiteralTransformer);
  2072. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObjectExpressionExtractor)
  2073. .to(ObjectExpressionToVariableDeclarationExtractor_1.ObjectExpressionToVariableDeclarationExtractor)
  2074. .whenTargetNamed(ObjectExpressionExtractor_1.ObjectExpressionExtractor.ObjectExpressionToVariableDeclarationExtractor);
  2075. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObjectExpressionExtractor)
  2076. .to(BasePropertiesExtractor_1.BasePropertiesExtractor)
  2077. .whenTargetNamed(ObjectExpressionExtractor_1.ObjectExpressionExtractor.BasePropertiesExtractor);
  2078. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObjectExpressionExtractor)
  2079. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  2080. .getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IObjectExpressionExtractor));
  2081. });
  2082. /***/ }),
  2083. /***/ "./src/container/modules/node-transformers/FinalizingTransformersModule.ts":
  2084. /*!*********************************************************************************!*\
  2085. !*** ./src/container/modules/node-transformers/FinalizingTransformersModule.ts ***!
  2086. \*********************************************************************************/
  2087. /*! no static exports found */
  2088. /***/ (function(module, exports, __webpack_require__) {
  2089. "use strict";
  2090. Object.defineProperty(exports, "__esModule", { value: true });
  2091. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2092. exports.finalizingTransformersModule = new inversify_1.ContainerModule((bind) => {
  2093. });
  2094. /***/ }),
  2095. /***/ "./src/container/modules/node-transformers/NodeTransformersModule.ts":
  2096. /*!***************************************************************************!*\
  2097. !*** ./src/container/modules/node-transformers/NodeTransformersModule.ts ***!
  2098. \***************************************************************************/
  2099. /*! no static exports found */
  2100. /***/ (function(module, exports, __webpack_require__) {
  2101. "use strict";
  2102. Object.defineProperty(exports, "__esModule", { value: true });
  2103. const InversifyContainerFacade_1 = __webpack_require__(/*! ../../InversifyContainerFacade */ "./src/container/InversifyContainerFacade.ts");
  2104. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2105. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2106. exports.nodeTransformersModule = new inversify_1.ContainerModule((bind) => {
  2107. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeTransformer)
  2108. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  2109. .getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer));
  2110. });
  2111. /***/ }),
  2112. /***/ "./src/container/modules/node-transformers/ObfuscatingTransformersModule.ts":
  2113. /*!**********************************************************************************!*\
  2114. !*** ./src/container/modules/node-transformers/ObfuscatingTransformersModule.ts ***!
  2115. \**********************************************************************************/
  2116. /*! no static exports found */
  2117. /***/ (function(module, exports, __webpack_require__) {
  2118. "use strict";
  2119. Object.defineProperty(exports, "__esModule", { value: true });
  2120. const InversifyContainerFacade_1 = __webpack_require__(/*! ../../InversifyContainerFacade */ "./src/container/InversifyContainerFacade.ts");
  2121. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2122. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2123. const IdentifierObfuscatingReplacer_1 = __webpack_require__(/*! ../../../enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer */ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer.ts");
  2124. const LiteralObfuscatingReplacer_1 = __webpack_require__(/*! ../../../enums/node-transformers/obfuscating-transformers/obfuscating-replacers/LiteralObfuscatingReplacer */ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/LiteralObfuscatingReplacer.ts");
  2125. const NodeTransformer_1 = __webpack_require__(/*! ../../../enums/node-transformers/NodeTransformer */ "./src/enums/node-transformers/NodeTransformer.ts");
  2126. const BaseIdentifierObfuscatingReplacer_1 = __webpack_require__(/*! ../../../node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer */ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts");
  2127. const BooleanLiteralObfuscatingReplacer_1 = __webpack_require__(/*! ../../../node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/BooleanLiteralObfuscatingReplacer */ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/BooleanLiteralObfuscatingReplacer.ts");
  2128. const LabeledStatementTransformer_1 = __webpack_require__(/*! ../../../node-transformers/obfuscating-transformers/LabeledStatementTransformer */ "./src/node-transformers/obfuscating-transformers/LabeledStatementTransformer.ts");
  2129. const LiteralTransformer_1 = __webpack_require__(/*! ../../../node-transformers/obfuscating-transformers/LiteralTransformer */ "./src/node-transformers/obfuscating-transformers/LiteralTransformer.ts");
  2130. const NumberLiteralObfuscatingReplacer_1 = __webpack_require__(/*! ../../../node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/NumberLiteralObfuscatingReplacer */ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/NumberLiteralObfuscatingReplacer.ts");
  2131. const StringLiteralObfuscatingReplacer_1 = __webpack_require__(/*! ../../../node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer */ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer.ts");
  2132. const ScopeIdentifiersTransformer_1 = __webpack_require__(/*! ../../../node-transformers/obfuscating-transformers/ScopeIdentifiersTransformer */ "./src/node-transformers/obfuscating-transformers/ScopeIdentifiersTransformer.ts");
  2133. exports.obfuscatingTransformersModule = new inversify_1.ContainerModule((bind) => {
  2134. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2135. .to(LabeledStatementTransformer_1.LabeledStatementTransformer)
  2136. .whenTargetNamed(NodeTransformer_1.NodeTransformer.LabeledStatementTransformer);
  2137. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2138. .to(LiteralTransformer_1.LiteralTransformer)
  2139. .whenTargetNamed(NodeTransformer_1.NodeTransformer.LiteralTransformer);
  2140. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2141. .to(ScopeIdentifiersTransformer_1.ScopeIdentifiersTransformer)
  2142. .whenTargetNamed(NodeTransformer_1.NodeTransformer.ScopeIdentifiersTransformer);
  2143. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer)
  2144. .to(BooleanLiteralObfuscatingReplacer_1.BooleanLiteralObfuscatingReplacer)
  2145. .whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer);
  2146. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer)
  2147. .to(NumberLiteralObfuscatingReplacer_1.NumberLiteralObfuscatingReplacer)
  2148. .whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer);
  2149. bind(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer)
  2150. .to(StringLiteralObfuscatingReplacer_1.StringLiteralObfuscatingReplacer)
  2151. .whenTargetNamed(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer);
  2152. bind(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierObfuscatingReplacer)
  2153. .to(BaseIdentifierObfuscatingReplacer_1.BaseIdentifierObfuscatingReplacer)
  2154. .whenTargetNamed(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  2155. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer)
  2156. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  2157. .getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscatingReplacer));
  2158. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)
  2159. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  2160. .getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.IIdentifierObfuscatingReplacer));
  2161. });
  2162. /***/ }),
  2163. /***/ "./src/container/modules/node-transformers/PreparingTransformersModule.ts":
  2164. /*!********************************************************************************!*\
  2165. !*** ./src/container/modules/node-transformers/PreparingTransformersModule.ts ***!
  2166. \********************************************************************************/
  2167. /*! no static exports found */
  2168. /***/ (function(module, exports, __webpack_require__) {
  2169. "use strict";
  2170. Object.defineProperty(exports, "__esModule", { value: true });
  2171. const InversifyContainerFacade_1 = __webpack_require__(/*! ../../InversifyContainerFacade */ "./src/container/InversifyContainerFacade.ts");
  2172. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2173. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2174. const NodeTransformer_1 = __webpack_require__(/*! ../../../enums/node-transformers/NodeTransformer */ "./src/enums/node-transformers/NodeTransformer.ts");
  2175. const ObfuscatingGuard_1 = __webpack_require__(/*! ../../../enums/node-transformers/preparing-transformers/obfuscating-guards/ObfuscatingGuard */ "./src/enums/node-transformers/preparing-transformers/obfuscating-guards/ObfuscatingGuard.ts");
  2176. const BlackListObfuscatingGuard_1 = __webpack_require__(/*! ../../../node-transformers/preparing-transformers/obfuscating-guards/BlackListObfuscatingGuard */ "./src/node-transformers/preparing-transformers/obfuscating-guards/BlackListObfuscatingGuard.ts");
  2177. const CommentsTransformer_1 = __webpack_require__(/*! ../../../node-transformers/preparing-transformers/CommentsTransformer */ "./src/node-transformers/preparing-transformers/CommentsTransformer.ts");
  2178. const ConditionalCommentObfuscatingGuard_1 = __webpack_require__(/*! ../../../node-transformers/preparing-transformers/obfuscating-guards/ConditionalCommentObfuscatingGuard */ "./src/node-transformers/preparing-transformers/obfuscating-guards/ConditionalCommentObfuscatingGuard.ts");
  2179. const CustomNodesTransformer_1 = __webpack_require__(/*! ../../../node-transformers/preparing-transformers/CustomNodesTransformer */ "./src/node-transformers/preparing-transformers/CustomNodesTransformer.ts");
  2180. const EvalCallExpressionTransformer_1 = __webpack_require__(/*! ../../../node-transformers/preparing-transformers/EvalCallExpressionTransformer */ "./src/node-transformers/preparing-transformers/EvalCallExpressionTransformer.ts");
  2181. const MetadataTransformer_1 = __webpack_require__(/*! ../../../node-transformers/preparing-transformers/MetadataTransformer */ "./src/node-transformers/preparing-transformers/MetadataTransformer.ts");
  2182. const ObfuscatingGuardsTransformer_1 = __webpack_require__(/*! ../../../node-transformers/preparing-transformers/ObfuscatingGuardsTransformer */ "./src/node-transformers/preparing-transformers/ObfuscatingGuardsTransformer.ts");
  2183. const ParentificationTransformer_1 = __webpack_require__(/*! ../../../node-transformers/preparing-transformers/ParentificationTransformer */ "./src/node-transformers/preparing-transformers/ParentificationTransformer.ts");
  2184. const ReservedStringObfuscatingGuard_1 = __webpack_require__(/*! ../../../node-transformers/preparing-transformers/obfuscating-guards/ReservedStringObfuscatingGuard */ "./src/node-transformers/preparing-transformers/obfuscating-guards/ReservedStringObfuscatingGuard.ts");
  2185. const VariablePreserveTransformer_1 = __webpack_require__(/*! ../../../node-transformers/preparing-transformers/VariablePreserveTransformer */ "./src/node-transformers/preparing-transformers/VariablePreserveTransformer.ts");
  2186. exports.preparingTransformersModule = new inversify_1.ContainerModule((bind) => {
  2187. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2188. .to(CommentsTransformer_1.CommentsTransformer)
  2189. .whenTargetNamed(NodeTransformer_1.NodeTransformer.CommentsTransformer);
  2190. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2191. .to(CustomNodesTransformer_1.CustomNodesTransformer)
  2192. .whenTargetNamed(NodeTransformer_1.NodeTransformer.CustomNodesTransformer);
  2193. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2194. .to(EvalCallExpressionTransformer_1.EvalCallExpressionTransformer)
  2195. .whenTargetNamed(NodeTransformer_1.NodeTransformer.EvalCallExpressionTransformer);
  2196. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2197. .to(MetadataTransformer_1.MetadataTransformer)
  2198. .whenTargetNamed(NodeTransformer_1.NodeTransformer.MetadataTransformer);
  2199. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2200. .to(ObfuscatingGuardsTransformer_1.ObfuscatingGuardsTransformer)
  2201. .whenTargetNamed(NodeTransformer_1.NodeTransformer.ObfuscatingGuardsTransformer);
  2202. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2203. .to(ParentificationTransformer_1.ParentificationTransformer)
  2204. .whenTargetNamed(NodeTransformer_1.NodeTransformer.ParentificationTransformer);
  2205. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard)
  2206. .to(BlackListObfuscatingGuard_1.BlackListObfuscatingGuard)
  2207. .inSingletonScope()
  2208. .whenTargetNamed(ObfuscatingGuard_1.ObfuscatingGuard.BlackListObfuscatingGuard);
  2209. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard)
  2210. .to(ConditionalCommentObfuscatingGuard_1.ConditionalCommentObfuscatingGuard)
  2211. .inSingletonScope()
  2212. .whenTargetNamed(ObfuscatingGuard_1.ObfuscatingGuard.ConditionalCommentObfuscatingGuard);
  2213. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard)
  2214. .to(ReservedStringObfuscatingGuard_1.ReservedStringObfuscatingGuard)
  2215. .inSingletonScope()
  2216. .whenTargetNamed(ObfuscatingGuard_1.ObfuscatingGuard.ReservedStringObfuscatingGuard);
  2217. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeGuard)
  2218. .toFactory(InversifyContainerFacade_1.InversifyContainerFacade
  2219. .getCacheFactory(ServiceIdentifiers_1.ServiceIdentifiers.INodeGuard));
  2220. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformer)
  2221. .to(VariablePreserveTransformer_1.VariablePreserveTransformer)
  2222. .whenTargetNamed(NodeTransformer_1.NodeTransformer.VariablePreserveTransformer);
  2223. });
  2224. /***/ }),
  2225. /***/ "./src/container/modules/options/OptionsModule.ts":
  2226. /*!********************************************************!*\
  2227. !*** ./src/container/modules/options/OptionsModule.ts ***!
  2228. \********************************************************/
  2229. /*! no static exports found */
  2230. /***/ (function(module, exports, __webpack_require__) {
  2231. "use strict";
  2232. Object.defineProperty(exports, "__esModule", { value: true });
  2233. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2234. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2235. const Options_1 = __webpack_require__(/*! ../../../options/Options */ "./src/options/Options.ts");
  2236. const OptionsNormalizer_1 = __webpack_require__(/*! ../../../options/OptionsNormalizer */ "./src/options/OptionsNormalizer.ts");
  2237. exports.optionsModule = new inversify_1.ContainerModule((bind) => {
  2238. bind(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)
  2239. .to(Options_1.Options)
  2240. .inSingletonScope();
  2241. bind(ServiceIdentifiers_1.ServiceIdentifiers.IOptionsNormalizer)
  2242. .to(OptionsNormalizer_1.OptionsNormalizer)
  2243. .inSingletonScope();
  2244. });
  2245. /***/ }),
  2246. /***/ "./src/container/modules/storages/StoragesModule.ts":
  2247. /*!**********************************************************!*\
  2248. !*** ./src/container/modules/storages/StoragesModule.ts ***!
  2249. \**********************************************************/
  2250. /*! no static exports found */
  2251. /***/ (function(module, exports, __webpack_require__) {
  2252. "use strict";
  2253. Object.defineProperty(exports, "__esModule", { value: true });
  2254. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2255. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2256. const ControlFlowStorage_1 = __webpack_require__(/*! ../../../storages/control-flow/ControlFlowStorage */ "./src/storages/control-flow/ControlFlowStorage.ts");
  2257. const CustomNodeGroupStorage_1 = __webpack_require__(/*! ../../../storages/custom-node-group/CustomNodeGroupStorage */ "./src/storages/custom-node-group/CustomNodeGroupStorage.ts");
  2258. const StringArrayStorage_1 = __webpack_require__(/*! ../../../storages/string-array/StringArrayStorage */ "./src/storages/string-array/StringArrayStorage.ts");
  2259. exports.storagesModule = new inversify_1.ContainerModule((bind) => {
  2260. bind(ServiceIdentifiers_1.ServiceIdentifiers.TCustomNodeGroupStorage)
  2261. .to(CustomNodeGroupStorage_1.CustomNodeGroupStorage)
  2262. .inSingletonScope();
  2263. bind(ServiceIdentifiers_1.ServiceIdentifiers.IStringArrayStorage)
  2264. .to(StringArrayStorage_1.StringArrayStorage)
  2265. .inSingletonScope();
  2266. bind(ServiceIdentifiers_1.ServiceIdentifiers.Newable__TControlFlowStorage)
  2267. .toConstructor(ControlFlowStorage_1.ControlFlowStorage);
  2268. bind(ServiceIdentifiers_1.ServiceIdentifiers.Factory__TControlFlowStorage)
  2269. .toFactory((context) => {
  2270. return () => {
  2271. const constructor = context.container
  2272. .get(ServiceIdentifiers_1.ServiceIdentifiers.Newable__TControlFlowStorage);
  2273. const randomGenerator = context.container
  2274. .get(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator);
  2275. const options = context.container
  2276. .get(ServiceIdentifiers_1.ServiceIdentifiers.IOptions);
  2277. const storage = new constructor(randomGenerator, options);
  2278. storage.initialize();
  2279. return storage;
  2280. };
  2281. });
  2282. });
  2283. /***/ }),
  2284. /***/ "./src/container/modules/utils/UtilsModule.ts":
  2285. /*!****************************************************!*\
  2286. !*** ./src/container/modules/utils/UtilsModule.ts ***!
  2287. \****************************************************/
  2288. /*! no static exports found */
  2289. /***/ (function(module, exports, __webpack_require__) {
  2290. "use strict";
  2291. Object.defineProperty(exports, "__esModule", { value: true });
  2292. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2293. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2294. const ArrayUtils_1 = __webpack_require__(/*! ../../../utils/ArrayUtils */ "./src/utils/ArrayUtils.ts");
  2295. const CryptUtils_1 = __webpack_require__(/*! ../../../utils/CryptUtils */ "./src/utils/CryptUtils.ts");
  2296. const EscapeSequenceEncoder_1 = __webpack_require__(/*! ../../../utils/EscapeSequenceEncoder */ "./src/utils/EscapeSequenceEncoder.ts");
  2297. const LevelledTopologicalSorter_1 = __webpack_require__(/*! ../../../utils/LevelledTopologicalSorter */ "./src/utils/LevelledTopologicalSorter.ts");
  2298. const NodeTransformerNamesGroupsBuilder_1 = __webpack_require__(/*! ../../../utils/NodeTransformerNamesGroupsBuilder */ "./src/utils/NodeTransformerNamesGroupsBuilder.ts");
  2299. const RandomGenerator_1 = __webpack_require__(/*! ../../../utils/RandomGenerator */ "./src/utils/RandomGenerator.ts");
  2300. exports.utilsModule = new inversify_1.ContainerModule((bind) => {
  2301. bind(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils)
  2302. .to(ArrayUtils_1.ArrayUtils)
  2303. .inSingletonScope();
  2304. bind(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)
  2305. .to(RandomGenerator_1.RandomGenerator)
  2306. .inSingletonScope();
  2307. bind(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils)
  2308. .to(CryptUtils_1.CryptUtils)
  2309. .inSingletonScope();
  2310. bind(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)
  2311. .to(EscapeSequenceEncoder_1.EscapeSequenceEncoder)
  2312. .inSingletonScope();
  2313. bind(ServiceIdentifiers_1.ServiceIdentifiers.ILevelledTopologicalSorter)
  2314. .to(LevelledTopologicalSorter_1.LevelledTopologicalSorter);
  2315. bind(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformerNamesGroupsBuilder)
  2316. .to(NodeTransformerNamesGroupsBuilder_1.NodeTransformerNamesGroupsBuilder)
  2317. .inSingletonScope();
  2318. });
  2319. /***/ }),
  2320. /***/ "./src/custom-nodes/AbstractCustomNode.ts":
  2321. /*!************************************************!*\
  2322. !*** ./src/custom-nodes/AbstractCustomNode.ts ***!
  2323. \************************************************/
  2324. /*! no static exports found */
  2325. /***/ (function(module, exports, __webpack_require__) {
  2326. "use strict";
  2327. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2328. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2329. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2330. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2331. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2332. };
  2333. var __metadata = (this && this.__metadata) || function (k, v) {
  2334. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2335. };
  2336. var __param = (this && this.__param) || function (paramIndex, decorator) {
  2337. return function (target, key) { decorator(target, key, paramIndex); }
  2338. };
  2339. var AbstractCustomNode_1, _a, _b, _c, _d;
  2340. Object.defineProperty(exports, "__esModule", { value: true });
  2341. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2342. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2343. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  2344. const IOptions_1 = __webpack_require__(/*! ../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  2345. const IRandomGenerator_1 = __webpack_require__(/*! ../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  2346. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  2347. const GlobalVariableTemplate1_1 = __webpack_require__(/*! ../templates/GlobalVariableTemplate1 */ "./src/templates/GlobalVariableTemplate1.ts");
  2348. const GlobalVariableTemplate2_1 = __webpack_require__(/*! ../templates/GlobalVariableTemplate2 */ "./src/templates/GlobalVariableTemplate2.ts");
  2349. let AbstractCustomNode = AbstractCustomNode_1 = class AbstractCustomNode {
  2350. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  2351. this.cachedNode = null;
  2352. this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  2353. this.customNodeFormatter = customNodeFormatter;
  2354. this.randomGenerator = randomGenerator;
  2355. this.options = options;
  2356. }
  2357. getNode() {
  2358. if (!this.cachedNode) {
  2359. const nodeTemplate = this.getNodeTemplate();
  2360. this.cachedNode = this.customNodeFormatter.formatStructure(this.getNodeStructure(nodeTemplate));
  2361. }
  2362. return this.cachedNode;
  2363. }
  2364. getGlobalVariableTemplate() {
  2365. return this.randomGenerator
  2366. .getRandomGenerator()
  2367. .pickone(AbstractCustomNode_1.globalVariableTemplateFunctions);
  2368. }
  2369. getNodeTemplate() {
  2370. return '';
  2371. }
  2372. };
  2373. AbstractCustomNode.globalVariableTemplateFunctions = [
  2374. GlobalVariableTemplate1_1.GlobalVariableTemplate1(),
  2375. GlobalVariableTemplate2_1.GlobalVariableTemplate2()
  2376. ];
  2377. AbstractCustomNode = AbstractCustomNode_1 = __decorate([
  2378. inversify_1.injectable(),
  2379. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  2380. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  2381. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  2382. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  2383. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  2384. ], AbstractCustomNode);
  2385. exports.AbstractCustomNode = AbstractCustomNode;
  2386. /***/ }),
  2387. /***/ "./src/custom-nodes/AbstractCustomNodeGroup.ts":
  2388. /*!*****************************************************!*\
  2389. !*** ./src/custom-nodes/AbstractCustomNodeGroup.ts ***!
  2390. \*****************************************************/
  2391. /*! no static exports found */
  2392. /***/ (function(module, exports, __webpack_require__) {
  2393. "use strict";
  2394. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2395. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2396. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2397. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2398. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2399. };
  2400. var __metadata = (this && this.__metadata) || function (k, v) {
  2401. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2402. };
  2403. var __param = (this && this.__param) || function (paramIndex, decorator) {
  2404. return function (target, key) { decorator(target, key, paramIndex); }
  2405. };
  2406. var _a, _b, _c;
  2407. Object.defineProperty(exports, "__esModule", { value: true });
  2408. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2409. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2410. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  2411. const IOptions_1 = __webpack_require__(/*! ../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  2412. const IRandomGenerator_1 = __webpack_require__(/*! ../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  2413. let AbstractCustomNodeGroup = class AbstractCustomNodeGroup {
  2414. constructor(identifierNamesGeneratorFactory, randomGenerator, options) {
  2415. this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  2416. this.randomGenerator = randomGenerator;
  2417. this.options = options;
  2418. }
  2419. getAppendEvent() {
  2420. return this.appendEvent;
  2421. }
  2422. getCustomNodes() {
  2423. return this.customNodes;
  2424. }
  2425. appendCustomNodeIfExist(customNodeName, callback) {
  2426. const customNode = this.customNodes.get(customNodeName);
  2427. if (!customNode) {
  2428. return;
  2429. }
  2430. callback(customNode);
  2431. }
  2432. getRandomCallsGraphIndex(callsGraphLength) {
  2433. return this.randomGenerator.getRandomInteger(0, Math.max(0, Math.round(callsGraphLength - 1)));
  2434. }
  2435. };
  2436. AbstractCustomNodeGroup = __decorate([
  2437. inversify_1.injectable(),
  2438. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  2439. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  2440. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  2441. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  2442. ], AbstractCustomNodeGroup);
  2443. exports.AbstractCustomNodeGroup = AbstractCustomNodeGroup;
  2444. /***/ }),
  2445. /***/ "./src/custom-nodes/CustomNodeFormatter.ts":
  2446. /*!*************************************************!*\
  2447. !*** ./src/custom-nodes/CustomNodeFormatter.ts ***!
  2448. \*************************************************/
  2449. /*! no static exports found */
  2450. /***/ (function(module, exports, __webpack_require__) {
  2451. "use strict";
  2452. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2453. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2454. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2455. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2456. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2457. };
  2458. var __metadata = (this && this.__metadata) || function (k, v) {
  2459. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2460. };
  2461. var __param = (this && this.__param) || function (paramIndex, decorator) {
  2462. return function (target, key) { decorator(target, key, paramIndex); }
  2463. };
  2464. var __importStar = (this && this.__importStar) || function (mod) {
  2465. if (mod && mod.__esModule) return mod;
  2466. var result = {};
  2467. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  2468. result["default"] = mod;
  2469. return result;
  2470. };
  2471. var __importDefault = (this && this.__importDefault) || function (mod) {
  2472. return (mod && mod.__esModule) ? mod : { "default": mod };
  2473. };
  2474. var _a;
  2475. Object.defineProperty(exports, "__esModule", { value: true });
  2476. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2477. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2478. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  2479. const string_template_1 = __importDefault(__webpack_require__(/*! string-template */ "string-template"));
  2480. const IPrevailingKindOfVariablesAnalyzer_1 = __webpack_require__(/*! ../interfaces/analyzers/calls-graph-analyzer/IPrevailingKindOfVariablesAnalyzer */ "./src/interfaces/analyzers/calls-graph-analyzer/IPrevailingKindOfVariablesAnalyzer.ts");
  2481. const NodeGuards_1 = __webpack_require__(/*! ../node/NodeGuards */ "./src/node/NodeGuards.ts");
  2482. let CustomNodeFormatter = class CustomNodeFormatter {
  2483. constructor(prevailingKindOfVariablesAnalyzer) {
  2484. this.prevailingKindOfVariables = prevailingKindOfVariablesAnalyzer.getPrevailingKind();
  2485. }
  2486. formatTemplate(template, mapping) {
  2487. return string_template_1.default(template, mapping);
  2488. }
  2489. formatStructure(statements) {
  2490. for (const statement of statements) {
  2491. estraverse.replace(statement, {
  2492. enter: (node) => {
  2493. if (!NodeGuards_1.NodeGuards.isVariableDeclarationNode(node)) {
  2494. return;
  2495. }
  2496. if (this.prevailingKindOfVariables === 'var') {
  2497. node.kind = 'var';
  2498. }
  2499. return node;
  2500. }
  2501. });
  2502. }
  2503. return statements;
  2504. }
  2505. };
  2506. CustomNodeFormatter = __decorate([
  2507. inversify_1.injectable(),
  2508. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer)),
  2509. __metadata("design:paramtypes", [typeof (_a = typeof IPrevailingKindOfVariablesAnalyzer_1.IPrevailingKindOfVariablesAnalyzer !== "undefined" && IPrevailingKindOfVariablesAnalyzer_1.IPrevailingKindOfVariablesAnalyzer) === "function" ? _a : Object])
  2510. ], CustomNodeFormatter);
  2511. exports.CustomNodeFormatter = CustomNodeFormatter;
  2512. /***/ }),
  2513. /***/ "./src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts":
  2514. /*!*************************************************************************************!*\
  2515. !*** ./src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts ***!
  2516. \*************************************************************************************/
  2517. /*! no static exports found */
  2518. /***/ (function(module, exports, __webpack_require__) {
  2519. "use strict";
  2520. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2521. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2522. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2523. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2524. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2525. };
  2526. var __metadata = (this && this.__metadata) || function (k, v) {
  2527. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2528. };
  2529. var __param = (this && this.__param) || function (paramIndex, decorator) {
  2530. return function (target, key) { decorator(target, key, paramIndex); }
  2531. };
  2532. var _a, _b, _c, _d;
  2533. Object.defineProperty(exports, "__esModule", { value: true });
  2534. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2535. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2536. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  2537. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  2538. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  2539. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  2540. const ObfuscationTarget_1 = __webpack_require__(/*! ../../enums/ObfuscationTarget */ "./src/enums/ObfuscationTarget.ts");
  2541. const ConsoleOutputDisableExpressionTemplate_1 = __webpack_require__(/*! ../../templates/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate */ "./src/templates/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts");
  2542. const GlobalVariableNoEvalTemplate_1 = __webpack_require__(/*! ../../templates/GlobalVariableNoEvalTemplate */ "./src/templates/GlobalVariableNoEvalTemplate.ts");
  2543. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  2544. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  2545. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  2546. let ConsoleOutputDisableExpressionNode = class ConsoleOutputDisableExpressionNode extends AbstractCustomNode_1.AbstractCustomNode {
  2547. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  2548. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  2549. }
  2550. initialize(callsControllerFunctionName) {
  2551. this.callsControllerFunctionName = callsControllerFunctionName;
  2552. }
  2553. getNodeStructure(nodeTemplate) {
  2554. return NodeUtils_1.NodeUtils.convertCodeToStructure(nodeTemplate);
  2555. }
  2556. getNodeTemplate() {
  2557. const globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.BrowserNoEval
  2558. ? this.getGlobalVariableTemplate()
  2559. : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  2560. return this.customNodeFormatter.formatTemplate(ConsoleOutputDisableExpressionTemplate_1.ConsoleOutputDisableExpressionTemplate(), {
  2561. consoleLogDisableFunctionName: this.identifierNamesGenerator.generate(),
  2562. globalVariableTemplate,
  2563. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  2564. });
  2565. }
  2566. };
  2567. __decorate([
  2568. Initializable_1.initializable(),
  2569. __metadata("design:type", String)
  2570. ], ConsoleOutputDisableExpressionNode.prototype, "callsControllerFunctionName", void 0);
  2571. ConsoleOutputDisableExpressionNode = __decorate([
  2572. inversify_1.injectable(),
  2573. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  2574. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  2575. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  2576. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  2577. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  2578. ], ConsoleOutputDisableExpressionNode);
  2579. exports.ConsoleOutputDisableExpressionNode = ConsoleOutputDisableExpressionNode;
  2580. /***/ }),
  2581. /***/ "./src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts":
  2582. /*!*************************************************************************************!*\
  2583. !*** ./src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts ***!
  2584. \*************************************************************************************/
  2585. /*! no static exports found */
  2586. /***/ (function(module, exports, __webpack_require__) {
  2587. "use strict";
  2588. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2589. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2590. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2591. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2592. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2593. };
  2594. var __metadata = (this && this.__metadata) || function (k, v) {
  2595. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2596. };
  2597. var __param = (this && this.__param) || function (paramIndex, decorator) {
  2598. return function (target, key) { decorator(target, key, paramIndex); }
  2599. };
  2600. var _a, _b, _c, _d, _e;
  2601. Object.defineProperty(exports, "__esModule", { value: true });
  2602. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2603. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2604. const TCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TCustomNodeFactory */ "./src/types/container/custom-nodes/TCustomNodeFactory.ts");
  2605. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  2606. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  2607. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  2608. const Initializable_1 = __webpack_require__(/*! ../../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  2609. const CustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/CustomNode */ "./src/enums/custom-nodes/CustomNode.ts");
  2610. const ObfuscationEvent_1 = __webpack_require__(/*! ../../../enums/event-emitters/ObfuscationEvent */ "./src/enums/event-emitters/ObfuscationEvent.ts");
  2611. const AbstractCustomNodeGroup_1 = __webpack_require__(/*! ../../AbstractCustomNodeGroup */ "./src/custom-nodes/AbstractCustomNodeGroup.ts");
  2612. const NodeAppender_1 = __webpack_require__(/*! ../../../node/NodeAppender */ "./src/node/NodeAppender.ts");
  2613. let ConsoleOutputCustomNodeGroup = class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup_1.AbstractCustomNodeGroup {
  2614. constructor(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  2615. super(identifierNamesGeneratorFactory, randomGenerator, options);
  2616. this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  2617. this.customNodeFactory = customNodeFactory;
  2618. }
  2619. appendCustomNodes(nodeWithStatements, callsGraphData) {
  2620. const randomCallsGraphIndex = this.getRandomCallsGraphIndex(callsGraphData.length);
  2621. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode, (customNode) => {
  2622. NodeAppender_1.NodeAppender.appendToOptimalBlockScope(callsGraphData, nodeWithStatements, customNode.getNode(), randomCallsGraphIndex);
  2623. });
  2624. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, (customNode) => {
  2625. const targetNodeWithStatements = callsGraphData.length
  2626. ? NodeAppender_1.NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
  2627. : nodeWithStatements;
  2628. NodeAppender_1.NodeAppender.prepend(targetNodeWithStatements, customNode.getNode());
  2629. });
  2630. }
  2631. initialize() {
  2632. this.customNodes = new Map();
  2633. if (!this.options.disableConsoleOutput) {
  2634. return;
  2635. }
  2636. const callsControllerFunctionName = this.identifierNamesGenerator.generate();
  2637. const consoleOutputDisableExpressionNode = this.customNodeFactory(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode);
  2638. const nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  2639. consoleOutputDisableExpressionNode.initialize(callsControllerFunctionName);
  2640. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  2641. this.customNodes.set(CustomNode_1.CustomNode.ConsoleOutputDisableExpressionNode, consoleOutputDisableExpressionNode);
  2642. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  2643. }
  2644. };
  2645. __decorate([
  2646. Initializable_1.initializable(),
  2647. __metadata("design:type", typeof (_a = typeof Map !== "undefined" && Map) === "function" ? _a : Object)
  2648. ], ConsoleOutputCustomNodeGroup.prototype, "customNodes", void 0);
  2649. ConsoleOutputCustomNodeGroup = __decorate([
  2650. inversify_1.injectable(),
  2651. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)),
  2652. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  2653. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  2654. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  2655. __metadata("design:paramtypes", [typeof (_b = typeof TCustomNodeFactory_1.TCustomNodeFactory !== "undefined" && TCustomNodeFactory_1.TCustomNodeFactory) === "function" ? _b : Object, typeof (_c = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _c : Object, typeof (_d = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _d : Object, typeof (_e = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _e : Object])
  2656. ], ConsoleOutputCustomNodeGroup);
  2657. exports.ConsoleOutputCustomNodeGroup = ConsoleOutputCustomNodeGroup;
  2658. /***/ }),
  2659. /***/ "./src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts":
  2660. /*!****************************************************************************************!*\
  2661. !*** ./src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts ***!
  2662. \****************************************************************************************/
  2663. /*! no static exports found */
  2664. /***/ (function(module, exports, __webpack_require__) {
  2665. "use strict";
  2666. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2667. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2668. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2669. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2670. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2671. };
  2672. var __metadata = (this && this.__metadata) || function (k, v) {
  2673. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2674. };
  2675. var __param = (this && this.__param) || function (paramIndex, decorator) {
  2676. return function (target, key) { decorator(target, key, paramIndex); }
  2677. };
  2678. var _a, _b, _c, _d;
  2679. Object.defineProperty(exports, "__esModule", { value: true });
  2680. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2681. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2682. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  2683. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  2684. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  2685. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  2686. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  2687. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  2688. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  2689. let BinaryExpressionFunctionNode = class BinaryExpressionFunctionNode extends AbstractCustomNode_1.AbstractCustomNode {
  2690. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  2691. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  2692. }
  2693. initialize(operator) {
  2694. this.operator = operator;
  2695. }
  2696. getNodeStructure(nodeTemplate) {
  2697. const structure = NodeFactory_1.NodeFactory.expressionStatementNode(NodeFactory_1.NodeFactory.functionExpressionNode([
  2698. NodeFactory_1.NodeFactory.identifierNode('x'),
  2699. NodeFactory_1.NodeFactory.identifierNode('y')
  2700. ], NodeFactory_1.NodeFactory.blockStatementNode([
  2701. NodeFactory_1.NodeFactory.returnStatementNode(NodeFactory_1.NodeFactory.binaryExpressionNode(this.operator, NodeFactory_1.NodeFactory.identifierNode('x'), NodeFactory_1.NodeFactory.identifierNode('y')))
  2702. ])));
  2703. NodeUtils_1.NodeUtils.parentizeAst(structure);
  2704. return [structure];
  2705. }
  2706. };
  2707. BinaryExpressionFunctionNode = __decorate([
  2708. inversify_1.injectable(),
  2709. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  2710. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  2711. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  2712. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  2713. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  2714. ], BinaryExpressionFunctionNode);
  2715. exports.BinaryExpressionFunctionNode = BinaryExpressionFunctionNode;
  2716. /***/ }),
  2717. /***/ "./src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts":
  2718. /*!***************************************************************************************************!*\
  2719. !*** ./src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts ***!
  2720. \***************************************************************************************************/
  2721. /*! no static exports found */
  2722. /***/ (function(module, exports, __webpack_require__) {
  2723. "use strict";
  2724. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2725. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2726. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2727. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2728. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2729. };
  2730. var __metadata = (this && this.__metadata) || function (k, v) {
  2731. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2732. };
  2733. var __param = (this && this.__param) || function (paramIndex, decorator) {
  2734. return function (target, key) { decorator(target, key, paramIndex); }
  2735. };
  2736. var _a, _b, _c, _d;
  2737. Object.defineProperty(exports, "__esModule", { value: true });
  2738. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2739. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2740. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  2741. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  2742. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  2743. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  2744. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  2745. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  2746. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  2747. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  2748. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  2749. let BlockStatementControlFlowFlatteningNode = class BlockStatementControlFlowFlatteningNode extends AbstractCustomNode_1.AbstractCustomNode {
  2750. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  2751. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  2752. }
  2753. initialize(blockStatementBody, shuffledKeys, originalKeysIndexesInShuffledArray) {
  2754. this.blockStatementBody = blockStatementBody;
  2755. this.shuffledKeys = shuffledKeys;
  2756. this.originalKeysIndexesInShuffledArray = originalKeysIndexesInShuffledArray;
  2757. }
  2758. getNodeStructure(nodeTemplate) {
  2759. const controllerIdentifierName = this.randomGenerator.getRandomString(6);
  2760. const indexIdentifierName = this.randomGenerator.getRandomString(6);
  2761. const structure = NodeFactory_1.NodeFactory.blockStatementNode([
  2762. NodeFactory_1.NodeFactory.variableDeclarationNode([
  2763. NodeFactory_1.NodeFactory.variableDeclaratorNode(NodeFactory_1.NodeFactory.identifierNode(controllerIdentifierName), NodeFactory_1.NodeFactory.callExpressionNode(NodeFactory_1.NodeFactory.memberExpressionNode(NodeFactory_1.NodeFactory.literalNode(this.originalKeysIndexesInShuffledArray.join('|')), NodeFactory_1.NodeFactory.identifierNode('split')), [
  2764. NodeFactory_1.NodeFactory.literalNode('|')
  2765. ]))
  2766. ], 'const'),
  2767. NodeFactory_1.NodeFactory.variableDeclarationNode([
  2768. NodeFactory_1.NodeFactory.variableDeclaratorNode(NodeFactory_1.NodeFactory.identifierNode(indexIdentifierName), NodeFactory_1.NodeFactory.literalNode(0))
  2769. ], 'let'),
  2770. NodeFactory_1.NodeFactory.whileStatementNode(NodeFactory_1.NodeFactory.literalNode(true), NodeFactory_1.NodeFactory.blockStatementNode([
  2771. NodeFactory_1.NodeFactory.switchStatementNode(NodeFactory_1.NodeFactory.memberExpressionNode(NodeFactory_1.NodeFactory.identifierNode(controllerIdentifierName), NodeFactory_1.NodeFactory.updateExpressionNode('++', NodeFactory_1.NodeFactory.identifierNode(indexIdentifierName)), true), this.shuffledKeys.map((key, index) => {
  2772. const statement = this.blockStatementBody[key];
  2773. const consequent = [statement];
  2774. if (!NodeGuards_1.NodeGuards.isReturnStatementNode(statement)) {
  2775. consequent.push(NodeFactory_1.NodeFactory.continueStatement());
  2776. }
  2777. return NodeFactory_1.NodeFactory.switchCaseNode(NodeFactory_1.NodeFactory.literalNode(String(index)), consequent);
  2778. })),
  2779. NodeFactory_1.NodeFactory.breakStatement()
  2780. ]))
  2781. ]);
  2782. NodeUtils_1.NodeUtils.parentizeAst(structure);
  2783. return [structure];
  2784. }
  2785. };
  2786. __decorate([
  2787. Initializable_1.initializable(),
  2788. __metadata("design:type", Array)
  2789. ], BlockStatementControlFlowFlatteningNode.prototype, "blockStatementBody", void 0);
  2790. __decorate([
  2791. Initializable_1.initializable(),
  2792. __metadata("design:type", Array)
  2793. ], BlockStatementControlFlowFlatteningNode.prototype, "originalKeysIndexesInShuffledArray", void 0);
  2794. __decorate([
  2795. Initializable_1.initializable(),
  2796. __metadata("design:type", Array)
  2797. ], BlockStatementControlFlowFlatteningNode.prototype, "shuffledKeys", void 0);
  2798. BlockStatementControlFlowFlatteningNode = __decorate([
  2799. inversify_1.injectable(),
  2800. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  2801. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  2802. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  2803. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  2804. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  2805. ], BlockStatementControlFlowFlatteningNode);
  2806. exports.BlockStatementControlFlowFlatteningNode = BlockStatementControlFlowFlatteningNode;
  2807. /***/ }),
  2808. /***/ "./src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts":
  2809. /*!**************************************************************************************!*\
  2810. !*** ./src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts ***!
  2811. \**************************************************************************************/
  2812. /*! no static exports found */
  2813. /***/ (function(module, exports, __webpack_require__) {
  2814. "use strict";
  2815. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2816. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2817. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2818. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2819. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2820. };
  2821. var __metadata = (this && this.__metadata) || function (k, v) {
  2822. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2823. };
  2824. var __param = (this && this.__param) || function (paramIndex, decorator) {
  2825. return function (target, key) { decorator(target, key, paramIndex); }
  2826. };
  2827. var _a, _b, _c, _d;
  2828. Object.defineProperty(exports, "__esModule", { value: true });
  2829. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2830. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2831. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  2832. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  2833. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  2834. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  2835. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  2836. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  2837. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  2838. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  2839. let CallExpressionFunctionNode = class CallExpressionFunctionNode extends AbstractCustomNode_1.AbstractCustomNode {
  2840. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  2841. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  2842. }
  2843. initialize(expressionArguments) {
  2844. this.expressionArguments = expressionArguments;
  2845. }
  2846. getNodeStructure(nodeTemplate) {
  2847. const calleeIdentifier = NodeFactory_1.NodeFactory.identifierNode('callee');
  2848. const params = [];
  2849. const argumentsLength = this.expressionArguments.length;
  2850. for (let i = 0; i < argumentsLength; i++) {
  2851. params.push(NodeFactory_1.NodeFactory.identifierNode(`param${i + 1}`));
  2852. }
  2853. const structure = NodeFactory_1.NodeFactory.expressionStatementNode(NodeFactory_1.NodeFactory.functionExpressionNode([
  2854. calleeIdentifier,
  2855. ...params
  2856. ], NodeFactory_1.NodeFactory.blockStatementNode([
  2857. NodeFactory_1.NodeFactory.returnStatementNode(NodeFactory_1.NodeFactory.callExpressionNode(calleeIdentifier, params))
  2858. ])));
  2859. NodeUtils_1.NodeUtils.parentizeAst(structure);
  2860. return [structure];
  2861. }
  2862. };
  2863. __decorate([
  2864. Initializable_1.initializable(),
  2865. __metadata("design:type", Array)
  2866. ], CallExpressionFunctionNode.prototype, "expressionArguments", void 0);
  2867. CallExpressionFunctionNode = __decorate([
  2868. inversify_1.injectable(),
  2869. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  2870. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  2871. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  2872. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  2873. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  2874. ], CallExpressionFunctionNode);
  2875. exports.CallExpressionFunctionNode = CallExpressionFunctionNode;
  2876. /***/ }),
  2877. /***/ "./src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts":
  2878. /*!*****************************************************************************************!*\
  2879. !*** ./src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts ***!
  2880. \*****************************************************************************************/
  2881. /*! no static exports found */
  2882. /***/ (function(module, exports, __webpack_require__) {
  2883. "use strict";
  2884. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2885. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2886. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2887. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2888. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2889. };
  2890. var __metadata = (this && this.__metadata) || function (k, v) {
  2891. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2892. };
  2893. var __param = (this && this.__param) || function (paramIndex, decorator) {
  2894. return function (target, key) { decorator(target, key, paramIndex); }
  2895. };
  2896. var _a, _b, _c, _d;
  2897. Object.defineProperty(exports, "__esModule", { value: true });
  2898. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2899. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2900. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  2901. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  2902. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  2903. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  2904. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  2905. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  2906. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  2907. let LogicalExpressionFunctionNode = class LogicalExpressionFunctionNode extends AbstractCustomNode_1.AbstractCustomNode {
  2908. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  2909. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  2910. }
  2911. initialize(operator) {
  2912. this.operator = operator;
  2913. }
  2914. getNodeStructure(nodeTemplate) {
  2915. const structure = NodeFactory_1.NodeFactory.expressionStatementNode(NodeFactory_1.NodeFactory.functionExpressionNode([
  2916. NodeFactory_1.NodeFactory.identifierNode('x'),
  2917. NodeFactory_1.NodeFactory.identifierNode('y')
  2918. ], NodeFactory_1.NodeFactory.blockStatementNode([
  2919. NodeFactory_1.NodeFactory.returnStatementNode(NodeFactory_1.NodeFactory.logicalExpressionNode(this.operator, NodeFactory_1.NodeFactory.identifierNode('x'), NodeFactory_1.NodeFactory.identifierNode('y')))
  2920. ])));
  2921. NodeUtils_1.NodeUtils.parentizeAst(structure);
  2922. return [structure];
  2923. }
  2924. };
  2925. LogicalExpressionFunctionNode = __decorate([
  2926. inversify_1.injectable(),
  2927. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  2928. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  2929. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  2930. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  2931. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  2932. ], LogicalExpressionFunctionNode);
  2933. exports.LogicalExpressionFunctionNode = LogicalExpressionFunctionNode;
  2934. /***/ }),
  2935. /***/ "./src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts":
  2936. /*!*****************************************************************************!*\
  2937. !*** ./src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts ***!
  2938. \*****************************************************************************/
  2939. /*! no static exports found */
  2940. /***/ (function(module, exports, __webpack_require__) {
  2941. "use strict";
  2942. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2943. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  2944. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  2945. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  2946. return c > 3 && r && Object.defineProperty(target, key, r), r;
  2947. };
  2948. var __metadata = (this && this.__metadata) || function (k, v) {
  2949. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  2950. };
  2951. var __param = (this && this.__param) || function (paramIndex, decorator) {
  2952. return function (target, key) { decorator(target, key, paramIndex); }
  2953. };
  2954. var _a, _b, _c, _d;
  2955. Object.defineProperty(exports, "__esModule", { value: true });
  2956. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  2957. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  2958. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  2959. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  2960. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  2961. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  2962. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  2963. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  2964. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  2965. let StringLiteralNode = class StringLiteralNode extends AbstractCustomNode_1.AbstractCustomNode {
  2966. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  2967. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  2968. }
  2969. initialize(literalValue) {
  2970. this.literalValue = literalValue;
  2971. }
  2972. getNodeStructure(nodeTemplate) {
  2973. const structure = NodeFactory_1.NodeFactory.expressionStatementNode(NodeFactory_1.NodeFactory.literalNode(this.literalValue));
  2974. return [structure];
  2975. }
  2976. };
  2977. __decorate([
  2978. Initializable_1.initializable(),
  2979. __metadata("design:type", String)
  2980. ], StringLiteralNode.prototype, "literalValue", void 0);
  2981. StringLiteralNode = __decorate([
  2982. inversify_1.injectable(),
  2983. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  2984. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  2985. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  2986. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  2987. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  2988. ], StringLiteralNode);
  2989. exports.StringLiteralNode = StringLiteralNode;
  2990. /***/ }),
  2991. /***/ "./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts":
  2992. /*!*******************************************************************************************************************************!*\
  2993. !*** ./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts ***!
  2994. \*******************************************************************************************************************************/
  2995. /*! no static exports found */
  2996. /***/ (function(module, exports, __webpack_require__) {
  2997. "use strict";
  2998. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2999. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3000. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3001. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3002. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3003. };
  3004. var __metadata = (this && this.__metadata) || function (k, v) {
  3005. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3006. };
  3007. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3008. return function (target, key) { decorator(target, key, paramIndex); }
  3009. };
  3010. var _a, _b, _c, _d, _e;
  3011. Object.defineProperty(exports, "__esModule", { value: true });
  3012. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3013. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3014. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3015. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3016. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3017. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3018. const Initializable_1 = __webpack_require__(/*! ../../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3019. const AbstractCustomNode_1 = __webpack_require__(/*! ../../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3020. const NodeFactory_1 = __webpack_require__(/*! ../../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  3021. const NodeUtils_1 = __webpack_require__(/*! ../../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3022. let CallExpressionControlFlowStorageCallNode = class CallExpressionControlFlowStorageCallNode extends AbstractCustomNode_1.AbstractCustomNode {
  3023. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  3024. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3025. }
  3026. initialize(controlFlowStorageName, controlFlowStorageKey, callee, expressionArguments) {
  3027. this.controlFlowStorageName = controlFlowStorageName;
  3028. this.controlFlowStorageKey = controlFlowStorageKey;
  3029. this.callee = callee;
  3030. this.expressionArguments = expressionArguments;
  3031. }
  3032. getNodeStructure() {
  3033. const structure = NodeFactory_1.NodeFactory.expressionStatementNode(NodeFactory_1.NodeFactory.callExpressionNode(NodeFactory_1.NodeFactory.memberExpressionNode(NodeFactory_1.NodeFactory.identifierNode(this.controlFlowStorageName), NodeFactory_1.NodeFactory.identifierNode(this.controlFlowStorageKey)), [
  3034. this.callee,
  3035. ...this.expressionArguments
  3036. ]));
  3037. NodeUtils_1.NodeUtils.parentizeAst(structure);
  3038. return [structure];
  3039. }
  3040. };
  3041. __decorate([
  3042. Initializable_1.initializable(),
  3043. __metadata("design:type", typeof (_a = typeof ESTree !== "undefined" && ESTree.Expression) === "function" ? _a : Object)
  3044. ], CallExpressionControlFlowStorageCallNode.prototype, "callee", void 0);
  3045. __decorate([
  3046. Initializable_1.initializable(),
  3047. __metadata("design:type", String)
  3048. ], CallExpressionControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  3049. __decorate([
  3050. Initializable_1.initializable(),
  3051. __metadata("design:type", String)
  3052. ], CallExpressionControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  3053. __decorate([
  3054. Initializable_1.initializable(),
  3055. __metadata("design:type", Array)
  3056. ], CallExpressionControlFlowStorageCallNode.prototype, "expressionArguments", void 0);
  3057. CallExpressionControlFlowStorageCallNode = __decorate([
  3058. inversify_1.injectable(),
  3059. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3060. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3061. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3062. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3063. __metadata("design:paramtypes", [typeof (_b = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _b : Object, typeof (_c = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _c : Object, typeof (_d = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _d : Object, typeof (_e = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _e : Object])
  3064. ], CallExpressionControlFlowStorageCallNode);
  3065. exports.CallExpressionControlFlowStorageCallNode = CallExpressionControlFlowStorageCallNode;
  3066. /***/ }),
  3067. /***/ "./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts":
  3068. /*!*************************************************************************************************************!*\
  3069. !*** ./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts ***!
  3070. \*************************************************************************************************************/
  3071. /*! no static exports found */
  3072. /***/ (function(module, exports, __webpack_require__) {
  3073. "use strict";
  3074. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3075. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3076. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3077. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3078. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3079. };
  3080. var __metadata = (this && this.__metadata) || function (k, v) {
  3081. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3082. };
  3083. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3084. return function (target, key) { decorator(target, key, paramIndex); }
  3085. };
  3086. var _a, _b, _c, _d, _e;
  3087. Object.defineProperty(exports, "__esModule", { value: true });
  3088. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3089. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3090. const TControlFlowStorage_1 = __webpack_require__(/*! ../../../types/storages/TControlFlowStorage */ "./src/types/storages/TControlFlowStorage.ts");
  3091. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3092. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3093. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3094. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3095. const Initializable_1 = __webpack_require__(/*! ../../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3096. const AbstractCustomNode_1 = __webpack_require__(/*! ../../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3097. const NodeFactory_1 = __webpack_require__(/*! ../../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  3098. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  3099. const NodeUtils_1 = __webpack_require__(/*! ../../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3100. let ControlFlowStorageNode = class ControlFlowStorageNode extends AbstractCustomNode_1.AbstractCustomNode {
  3101. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  3102. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3103. }
  3104. initialize(controlFlowStorage) {
  3105. this.controlFlowStorage = controlFlowStorage;
  3106. }
  3107. getNodeStructure(nodeTemplate) {
  3108. const propertyNodes = Array
  3109. .from(this.controlFlowStorage.getStorage())
  3110. .map(([key, value]) => {
  3111. const node = value.getNode()[0];
  3112. if (!NodeGuards_1.NodeGuards.isExpressionStatementNode(node)) {
  3113. throw new Error('Function node for control flow storage object should be passed inside the `ExpressionStatement` node!');
  3114. }
  3115. return NodeFactory_1.NodeFactory.propertyNode(NodeFactory_1.NodeFactory.identifierNode(key), node.expression);
  3116. });
  3117. let structure = NodeFactory_1.NodeFactory.variableDeclarationNode([
  3118. NodeFactory_1.NodeFactory.variableDeclaratorNode(NodeFactory_1.NodeFactory.identifierNode(this.controlFlowStorage.getStorageId()), NodeFactory_1.NodeFactory.objectExpressionNode(propertyNodes))
  3119. ], 'const');
  3120. structure = NodeUtils_1.NodeUtils.parentizeAst(structure);
  3121. return [structure];
  3122. }
  3123. };
  3124. __decorate([
  3125. Initializable_1.initializable(),
  3126. __metadata("design:type", typeof (_a = typeof TControlFlowStorage_1.TControlFlowStorage !== "undefined" && TControlFlowStorage_1.TControlFlowStorage) === "function" ? _a : Object)
  3127. ], ControlFlowStorageNode.prototype, "controlFlowStorage", void 0);
  3128. ControlFlowStorageNode = __decorate([
  3129. inversify_1.injectable(),
  3130. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3131. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3132. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3133. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3134. __metadata("design:paramtypes", [typeof (_b = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _b : Object, typeof (_c = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _c : Object, typeof (_d = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _d : Object, typeof (_e = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _e : Object])
  3135. ], ControlFlowStorageNode);
  3136. exports.ControlFlowStorageNode = ControlFlowStorageNode;
  3137. /***/ }),
  3138. /***/ "./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts":
  3139. /*!***************************************************************************************************************************************!*\
  3140. !*** ./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts ***!
  3141. \***************************************************************************************************************************************/
  3142. /*! no static exports found */
  3143. /***/ (function(module, exports, __webpack_require__) {
  3144. "use strict";
  3145. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3146. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3147. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3148. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3149. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3150. };
  3151. var __metadata = (this && this.__metadata) || function (k, v) {
  3152. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3153. };
  3154. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3155. return function (target, key) { decorator(target, key, paramIndex); }
  3156. };
  3157. var _a, _b, _c, _d;
  3158. Object.defineProperty(exports, "__esModule", { value: true });
  3159. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3160. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3161. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3162. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3163. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3164. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3165. const Initializable_1 = __webpack_require__(/*! ../../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3166. const AbstractCustomNode_1 = __webpack_require__(/*! ../../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3167. const NodeFactory_1 = __webpack_require__(/*! ../../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  3168. const NodeUtils_1 = __webpack_require__(/*! ../../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3169. let ExpressionWithOperatorControlFlowStorageCallNode = class ExpressionWithOperatorControlFlowStorageCallNode extends AbstractCustomNode_1.AbstractCustomNode {
  3170. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  3171. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3172. }
  3173. initialize(controlFlowStorageName, controlFlowStorageKey, leftValue, rightValue) {
  3174. this.controlFlowStorageName = controlFlowStorageName;
  3175. this.controlFlowStorageKey = controlFlowStorageKey;
  3176. this.leftValue = leftValue;
  3177. this.rightValue = rightValue;
  3178. }
  3179. getNodeStructure() {
  3180. const structure = NodeFactory_1.NodeFactory.expressionStatementNode(NodeFactory_1.NodeFactory.callExpressionNode(NodeFactory_1.NodeFactory.memberExpressionNode(NodeFactory_1.NodeFactory.identifierNode(this.controlFlowStorageName), NodeFactory_1.NodeFactory.identifierNode(this.controlFlowStorageKey)), [
  3181. this.leftValue,
  3182. this.rightValue
  3183. ]));
  3184. NodeUtils_1.NodeUtils.parentizeAst(structure);
  3185. return [structure];
  3186. }
  3187. };
  3188. __decorate([
  3189. Initializable_1.initializable(),
  3190. __metadata("design:type", String)
  3191. ], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  3192. __decorate([
  3193. Initializable_1.initializable(),
  3194. __metadata("design:type", String)
  3195. ], ExpressionWithOperatorControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  3196. ExpressionWithOperatorControlFlowStorageCallNode = __decorate([
  3197. inversify_1.injectable(),
  3198. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3199. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3200. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3201. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3202. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  3203. ], ExpressionWithOperatorControlFlowStorageCallNode);
  3204. exports.ExpressionWithOperatorControlFlowStorageCallNode = ExpressionWithOperatorControlFlowStorageCallNode;
  3205. /***/ }),
  3206. /***/ "./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts":
  3207. /*!******************************************************************************************************************************!*\
  3208. !*** ./src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts ***!
  3209. \******************************************************************************************************************************/
  3210. /*! no static exports found */
  3211. /***/ (function(module, exports, __webpack_require__) {
  3212. "use strict";
  3213. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3214. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3215. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3216. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3217. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3218. };
  3219. var __metadata = (this && this.__metadata) || function (k, v) {
  3220. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3221. };
  3222. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3223. return function (target, key) { decorator(target, key, paramIndex); }
  3224. };
  3225. var _a, _b, _c, _d;
  3226. Object.defineProperty(exports, "__esModule", { value: true });
  3227. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3228. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3229. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3230. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3231. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3232. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3233. const Initializable_1 = __webpack_require__(/*! ../../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3234. const AbstractCustomNode_1 = __webpack_require__(/*! ../../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3235. const NodeFactory_1 = __webpack_require__(/*! ../../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  3236. const NodeUtils_1 = __webpack_require__(/*! ../../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3237. let StringLiteralControlFlowStorageCallNode = class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode_1.AbstractCustomNode {
  3238. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  3239. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3240. }
  3241. initialize(controlFlowStorageName, controlFlowStorageKey) {
  3242. this.controlFlowStorageName = controlFlowStorageName;
  3243. this.controlFlowStorageKey = controlFlowStorageKey;
  3244. }
  3245. getNodeStructure() {
  3246. const structure = NodeFactory_1.NodeFactory.expressionStatementNode(NodeFactory_1.NodeFactory.memberExpressionNode(NodeFactory_1.NodeFactory.identifierNode(this.controlFlowStorageName), NodeFactory_1.NodeFactory.identifierNode(this.controlFlowStorageKey)));
  3247. NodeUtils_1.NodeUtils.parentizeAst(structure);
  3248. return [structure];
  3249. }
  3250. };
  3251. __decorate([
  3252. Initializable_1.initializable(),
  3253. __metadata("design:type", String)
  3254. ], StringLiteralControlFlowStorageCallNode.prototype, "controlFlowStorageKey", void 0);
  3255. __decorate([
  3256. Initializable_1.initializable(),
  3257. __metadata("design:type", String)
  3258. ], StringLiteralControlFlowStorageCallNode.prototype, "controlFlowStorageName", void 0);
  3259. StringLiteralControlFlowStorageCallNode = __decorate([
  3260. inversify_1.injectable(),
  3261. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3262. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3263. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3264. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3265. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  3266. ], StringLiteralControlFlowStorageCallNode);
  3267. exports.StringLiteralControlFlowStorageCallNode = StringLiteralControlFlowStorageCallNode;
  3268. /***/ }),
  3269. /***/ "./src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts":
  3270. /*!*******************************************************************************************!*\
  3271. !*** ./src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts ***!
  3272. \*******************************************************************************************/
  3273. /*! no static exports found */
  3274. /***/ (function(module, exports, __webpack_require__) {
  3275. "use strict";
  3276. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3277. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3278. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3279. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3280. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3281. };
  3282. var __metadata = (this && this.__metadata) || function (k, v) {
  3283. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3284. };
  3285. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3286. return function (target, key) { decorator(target, key, paramIndex); }
  3287. };
  3288. var _a, _b, _c, _d;
  3289. Object.defineProperty(exports, "__esModule", { value: true });
  3290. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3291. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3292. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3293. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3294. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3295. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3296. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3297. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  3298. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3299. let BlockStatementDeadCodeInjectionNode = class BlockStatementDeadCodeInjectionNode extends AbstractCustomNode_1.AbstractCustomNode {
  3300. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  3301. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3302. }
  3303. initialize(blockStatementNode, deadCodeInjectionRootAstHostNode) {
  3304. this.blockStatementNode = blockStatementNode;
  3305. this.deadCodeInjectionRootAstHostNode = deadCodeInjectionRootAstHostNode;
  3306. }
  3307. getNodeStructure(nodeTemplate) {
  3308. const random1 = this.randomGenerator.getMathRandom() > 0.5;
  3309. const random2 = this.randomGenerator.getMathRandom() > 0.5;
  3310. const operator = random1 ? '===' : '!==';
  3311. const leftString = this.randomGenerator.getRandomString(5);
  3312. const rightString = random2 ? leftString : this.randomGenerator.getRandomString(5);
  3313. const [consequent, alternate] = random1 === random2
  3314. ? [this.blockStatementNode, this.deadCodeInjectionRootAstHostNode]
  3315. : [this.deadCodeInjectionRootAstHostNode, this.blockStatementNode];
  3316. const structure = NodeFactory_1.NodeFactory.blockStatementNode([
  3317. NodeFactory_1.NodeFactory.ifStatementNode(NodeFactory_1.NodeFactory.binaryExpressionNode(operator, NodeFactory_1.NodeFactory.literalNode(leftString), NodeFactory_1.NodeFactory.literalNode(rightString)), consequent, alternate)
  3318. ]);
  3319. NodeUtils_1.NodeUtils.parentizeAst(structure);
  3320. return [structure];
  3321. }
  3322. };
  3323. BlockStatementDeadCodeInjectionNode = __decorate([
  3324. inversify_1.injectable(),
  3325. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3326. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3327. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3328. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3329. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  3330. ], BlockStatementDeadCodeInjectionNode);
  3331. exports.BlockStatementDeadCodeInjectionNode = BlockStatementDeadCodeInjectionNode;
  3332. /***/ }),
  3333. /***/ "./src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts":
  3334. /*!************************************************************************************!*\
  3335. !*** ./src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts ***!
  3336. \************************************************************************************/
  3337. /*! no static exports found */
  3338. /***/ (function(module, exports, __webpack_require__) {
  3339. "use strict";
  3340. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3341. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3342. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3343. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3344. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3345. };
  3346. var __metadata = (this && this.__metadata) || function (k, v) {
  3347. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3348. };
  3349. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3350. return function (target, key) { decorator(target, key, paramIndex); }
  3351. };
  3352. var _a, _b, _c, _d;
  3353. Object.defineProperty(exports, "__esModule", { value: true });
  3354. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3355. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3356. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3357. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3358. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3359. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3360. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3361. const DebugProtectionFunctionCallTemplate_1 = __webpack_require__(/*! ../../templates/debug-protection-nodes/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate */ "./src/templates/debug-protection-nodes/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate.ts");
  3362. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3363. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3364. let DebugProtectionFunctionCallNode = class DebugProtectionFunctionCallNode extends AbstractCustomNode_1.AbstractCustomNode {
  3365. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  3366. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3367. }
  3368. initialize(debugProtectionFunctionName, callsControllerFunctionName) {
  3369. this.debugProtectionFunctionName = debugProtectionFunctionName;
  3370. this.callsControllerFunctionName = callsControllerFunctionName;
  3371. }
  3372. getNodeStructure(nodeTemplate) {
  3373. return NodeUtils_1.NodeUtils.convertCodeToStructure(nodeTemplate);
  3374. }
  3375. getNodeTemplate() {
  3376. return this.customNodeFormatter.formatTemplate(DebugProtectionFunctionCallTemplate_1.DebugProtectionFunctionCallTemplate(), {
  3377. debugProtectionFunctionName: this.debugProtectionFunctionName,
  3378. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  3379. });
  3380. }
  3381. };
  3382. __decorate([
  3383. Initializable_1.initializable(),
  3384. __metadata("design:type", String)
  3385. ], DebugProtectionFunctionCallNode.prototype, "callsControllerFunctionName", void 0);
  3386. __decorate([
  3387. Initializable_1.initializable(),
  3388. __metadata("design:type", String)
  3389. ], DebugProtectionFunctionCallNode.prototype, "debugProtectionFunctionName", void 0);
  3390. DebugProtectionFunctionCallNode = __decorate([
  3391. inversify_1.injectable(),
  3392. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3393. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3394. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3395. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3396. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  3397. ], DebugProtectionFunctionCallNode);
  3398. exports.DebugProtectionFunctionCallNode = DebugProtectionFunctionCallNode;
  3399. /***/ }),
  3400. /***/ "./src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts":
  3401. /*!****************************************************************************************!*\
  3402. !*** ./src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts ***!
  3403. \****************************************************************************************/
  3404. /*! no static exports found */
  3405. /***/ (function(module, exports, __webpack_require__) {
  3406. "use strict";
  3407. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3408. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3409. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3410. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3411. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3412. };
  3413. var __metadata = (this && this.__metadata) || function (k, v) {
  3414. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3415. };
  3416. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3417. return function (target, key) { decorator(target, key, paramIndex); }
  3418. };
  3419. var _a, _b, _c, _d;
  3420. Object.defineProperty(exports, "__esModule", { value: true });
  3421. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3422. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3423. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3424. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3425. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3426. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3427. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3428. const DebugProtectionFunctionIntervalTemplate_1 = __webpack_require__(/*! ../../templates/debug-protection-nodes/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate */ "./src/templates/debug-protection-nodes/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate.ts");
  3429. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3430. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3431. let DebugProtectionFunctionIntervalNode = class DebugProtectionFunctionIntervalNode extends AbstractCustomNode_1.AbstractCustomNode {
  3432. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  3433. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3434. }
  3435. initialize(debugProtectionFunctionName) {
  3436. this.debugProtectionFunctionName = debugProtectionFunctionName;
  3437. }
  3438. getNodeStructure(nodeTemplate) {
  3439. return NodeUtils_1.NodeUtils.convertCodeToStructure(nodeTemplate);
  3440. }
  3441. getNodeTemplate() {
  3442. return this.customNodeFormatter.formatTemplate(DebugProtectionFunctionIntervalTemplate_1.DebugProtectionFunctionIntervalTemplate(), {
  3443. debugProtectionFunctionName: this.debugProtectionFunctionName
  3444. });
  3445. }
  3446. };
  3447. __decorate([
  3448. Initializable_1.initializable(),
  3449. __metadata("design:type", String)
  3450. ], DebugProtectionFunctionIntervalNode.prototype, "debugProtectionFunctionName", void 0);
  3451. DebugProtectionFunctionIntervalNode = __decorate([
  3452. inversify_1.injectable(),
  3453. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3454. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3455. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3456. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3457. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  3458. ], DebugProtectionFunctionIntervalNode);
  3459. exports.DebugProtectionFunctionIntervalNode = DebugProtectionFunctionIntervalNode;
  3460. /***/ }),
  3461. /***/ "./src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts":
  3462. /*!********************************************************************************!*\
  3463. !*** ./src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts ***!
  3464. \********************************************************************************/
  3465. /*! no static exports found */
  3466. /***/ (function(module, exports, __webpack_require__) {
  3467. "use strict";
  3468. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3469. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3470. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3471. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3472. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3473. };
  3474. var __metadata = (this && this.__metadata) || function (k, v) {
  3475. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3476. };
  3477. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3478. return function (target, key) { decorator(target, key, paramIndex); }
  3479. };
  3480. var _a, _b, _c, _d;
  3481. Object.defineProperty(exports, "__esModule", { value: true });
  3482. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3483. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3484. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3485. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3486. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3487. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3488. const ObfuscationTarget_1 = __webpack_require__(/*! ../../enums/ObfuscationTarget */ "./src/enums/ObfuscationTarget.ts");
  3489. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3490. const DebuggerTemplate_1 = __webpack_require__(/*! ../../templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplate */ "./src/templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplate.ts");
  3491. const DebuggerTemplateNoEval_1 = __webpack_require__(/*! ../../templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplateNoEval */ "./src/templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplateNoEval.ts");
  3492. const DebugProtectionFunctionTemplate_1 = __webpack_require__(/*! ../../templates/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate */ "./src/templates/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate.ts");
  3493. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3494. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3495. let DebugProtectionFunctionNode = class DebugProtectionFunctionNode extends AbstractCustomNode_1.AbstractCustomNode {
  3496. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  3497. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3498. }
  3499. initialize(debugProtectionFunctionName) {
  3500. this.debugProtectionFunctionName = debugProtectionFunctionName;
  3501. }
  3502. getNodeStructure(nodeTemplate) {
  3503. return NodeUtils_1.NodeUtils.convertCodeToStructure(nodeTemplate);
  3504. }
  3505. getNodeTemplate() {
  3506. const debuggerTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.BrowserNoEval
  3507. ? DebuggerTemplate_1.DebuggerTemplate()
  3508. : DebuggerTemplateNoEval_1.DebuggerTemplateNoEval();
  3509. return this.customNodeFormatter.formatTemplate(DebugProtectionFunctionTemplate_1.DebugProtectionFunctionTemplate(), {
  3510. debuggerTemplate,
  3511. debugProtectionFunctionName: this.debugProtectionFunctionName
  3512. });
  3513. }
  3514. };
  3515. __decorate([
  3516. Initializable_1.initializable(),
  3517. __metadata("design:type", String)
  3518. ], DebugProtectionFunctionNode.prototype, "debugProtectionFunctionName", void 0);
  3519. DebugProtectionFunctionNode = __decorate([
  3520. inversify_1.injectable(),
  3521. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3522. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3523. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3524. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3525. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  3526. ], DebugProtectionFunctionNode);
  3527. exports.DebugProtectionFunctionNode = DebugProtectionFunctionNode;
  3528. /***/ }),
  3529. /***/ "./src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts":
  3530. /*!*****************************************************************************************!*\
  3531. !*** ./src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts ***!
  3532. \*****************************************************************************************/
  3533. /*! no static exports found */
  3534. /***/ (function(module, exports, __webpack_require__) {
  3535. "use strict";
  3536. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3537. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3538. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3539. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3540. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3541. };
  3542. var __metadata = (this && this.__metadata) || function (k, v) {
  3543. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3544. };
  3545. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3546. return function (target, key) { decorator(target, key, paramIndex); }
  3547. };
  3548. var _a, _b, _c, _d, _e;
  3549. Object.defineProperty(exports, "__esModule", { value: true });
  3550. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3551. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3552. const TCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TCustomNodeFactory */ "./src/types/container/custom-nodes/TCustomNodeFactory.ts");
  3553. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3554. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3555. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3556. const Initializable_1 = __webpack_require__(/*! ../../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3557. const CustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/CustomNode */ "./src/enums/custom-nodes/CustomNode.ts");
  3558. const ObfuscationEvent_1 = __webpack_require__(/*! ../../../enums/event-emitters/ObfuscationEvent */ "./src/enums/event-emitters/ObfuscationEvent.ts");
  3559. const AbstractCustomNodeGroup_1 = __webpack_require__(/*! ../../AbstractCustomNodeGroup */ "./src/custom-nodes/AbstractCustomNodeGroup.ts");
  3560. const NodeAppender_1 = __webpack_require__(/*! ../../../node/NodeAppender */ "./src/node/NodeAppender.ts");
  3561. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  3562. let DebugProtectionCustomNodeGroup = class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup_1.AbstractCustomNodeGroup {
  3563. constructor(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  3564. super(identifierNamesGeneratorFactory, randomGenerator, options);
  3565. this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  3566. this.customNodeFactory = customNodeFactory;
  3567. }
  3568. appendCustomNodes(nodeWithStatements, callsGraphData) {
  3569. const randomCallsGraphIndex = this.getRandomCallsGraphIndex(callsGraphData.length);
  3570. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode, (customNode) => {
  3571. NodeAppender_1.NodeAppender.appendToOptimalBlockScope(callsGraphData, nodeWithStatements, customNode.getNode(), randomCallsGraphIndex);
  3572. });
  3573. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionNode, (customNode) => {
  3574. NodeAppender_1.NodeAppender.append(nodeWithStatements, customNode.getNode());
  3575. });
  3576. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode, (customNode) => {
  3577. const programBodyLength = NodeGuards_1.NodeGuards.isSwitchCaseNode(nodeWithStatements)
  3578. ? nodeWithStatements.consequent.length
  3579. : nodeWithStatements.body.length;
  3580. const randomIndex = this.randomGenerator.getRandomInteger(0, programBodyLength);
  3581. NodeAppender_1.NodeAppender.insertAtIndex(nodeWithStatements, customNode.getNode(), randomIndex);
  3582. });
  3583. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, (customNode) => {
  3584. const targetNodeWithStatements = callsGraphData.length
  3585. ? NodeAppender_1.NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
  3586. : nodeWithStatements;
  3587. NodeAppender_1.NodeAppender.prepend(targetNodeWithStatements, customNode.getNode());
  3588. });
  3589. }
  3590. initialize() {
  3591. this.customNodes = new Map();
  3592. if (!this.options.debugProtection) {
  3593. return;
  3594. }
  3595. const debugProtectionFunctionName = this.identifierNamesGenerator.generate();
  3596. const callsControllerFunctionName = this.identifierNamesGenerator.generate();
  3597. const debugProtectionFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionNode);
  3598. const debugProtectionFunctionCallNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode);
  3599. const debugProtectionFunctionIntervalNode = this.customNodeFactory(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode);
  3600. const nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3601. debugProtectionFunctionNode.initialize(debugProtectionFunctionName);
  3602. debugProtectionFunctionCallNode.initialize(debugProtectionFunctionName, callsControllerFunctionName);
  3603. debugProtectionFunctionIntervalNode.initialize(debugProtectionFunctionName);
  3604. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  3605. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionNode, debugProtectionFunctionNode);
  3606. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionCallNode, debugProtectionFunctionCallNode);
  3607. if (this.options.debugProtectionInterval) {
  3608. this.customNodes.set(CustomNode_1.CustomNode.DebugProtectionFunctionIntervalNode, debugProtectionFunctionIntervalNode);
  3609. }
  3610. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  3611. }
  3612. };
  3613. __decorate([
  3614. Initializable_1.initializable(),
  3615. __metadata("design:type", typeof (_a = typeof Map !== "undefined" && Map) === "function" ? _a : Object)
  3616. ], DebugProtectionCustomNodeGroup.prototype, "customNodes", void 0);
  3617. DebugProtectionCustomNodeGroup = __decorate([
  3618. inversify_1.injectable(),
  3619. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)),
  3620. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3621. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3622. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3623. __metadata("design:paramtypes", [typeof (_b = typeof TCustomNodeFactory_1.TCustomNodeFactory !== "undefined" && TCustomNodeFactory_1.TCustomNodeFactory) === "function" ? _b : Object, typeof (_c = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _c : Object, typeof (_d = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _d : Object, typeof (_e = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _e : Object])
  3624. ], DebugProtectionCustomNodeGroup);
  3625. exports.DebugProtectionCustomNodeGroup = DebugProtectionCustomNodeGroup;
  3626. /***/ }),
  3627. /***/ "./src/custom-nodes/domain-lock-nodes/DomainLockNode.ts":
  3628. /*!**************************************************************!*\
  3629. !*** ./src/custom-nodes/domain-lock-nodes/DomainLockNode.ts ***!
  3630. \**************************************************************/
  3631. /*! no static exports found */
  3632. /***/ (function(module, exports, __webpack_require__) {
  3633. "use strict";
  3634. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3635. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3636. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3637. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3638. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3639. };
  3640. var __metadata = (this && this.__metadata) || function (k, v) {
  3641. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3642. };
  3643. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3644. return function (target, key) { decorator(target, key, paramIndex); }
  3645. };
  3646. var _a, _b, _c, _d, _e;
  3647. Object.defineProperty(exports, "__esModule", { value: true });
  3648. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3649. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3650. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3651. const ICryptUtils_1 = __webpack_require__(/*! ../../interfaces/utils/ICryptUtils */ "./src/interfaces/utils/ICryptUtils.ts");
  3652. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3653. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3654. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3655. const ObfuscationTarget_1 = __webpack_require__(/*! ../../enums/ObfuscationTarget */ "./src/enums/ObfuscationTarget.ts");
  3656. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3657. const DomainLockNodeTemplate_1 = __webpack_require__(/*! ../../templates/domain-lock-nodes/domain-lock-node/DomainLockNodeTemplate */ "./src/templates/domain-lock-nodes/domain-lock-node/DomainLockNodeTemplate.ts");
  3658. const GlobalVariableNoEvalTemplate_1 = __webpack_require__(/*! ../../templates/GlobalVariableNoEvalTemplate */ "./src/templates/GlobalVariableNoEvalTemplate.ts");
  3659. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3660. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3661. let DomainLockNode = class DomainLockNode extends AbstractCustomNode_1.AbstractCustomNode {
  3662. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options, cryptUtils) {
  3663. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3664. this.cryptUtils = cryptUtils;
  3665. }
  3666. initialize(callsControllerFunctionName) {
  3667. this.callsControllerFunctionName = callsControllerFunctionName;
  3668. }
  3669. getNodeStructure(nodeTemplate) {
  3670. return NodeUtils_1.NodeUtils.convertCodeToStructure(nodeTemplate);
  3671. }
  3672. getNodeTemplate() {
  3673. const domainsString = this.options.domainLock.join(';');
  3674. const [hiddenDomainsString, diff] = this.cryptUtils.hideString(domainsString, domainsString.length * 3);
  3675. const globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.BrowserNoEval
  3676. ? this.getGlobalVariableTemplate()
  3677. : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  3678. return this.customNodeFormatter.formatTemplate(DomainLockNodeTemplate_1.DomainLockNodeTemplate(), {
  3679. domainLockFunctionName: this.identifierNamesGenerator.generate(),
  3680. diff,
  3681. domains: hiddenDomainsString,
  3682. globalVariableTemplate,
  3683. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  3684. });
  3685. }
  3686. };
  3687. __decorate([
  3688. Initializable_1.initializable(),
  3689. __metadata("design:type", String)
  3690. ], DomainLockNode.prototype, "callsControllerFunctionName", void 0);
  3691. DomainLockNode = __decorate([
  3692. inversify_1.injectable(),
  3693. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3694. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3695. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3696. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3697. __param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils)),
  3698. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object, typeof (_e = typeof ICryptUtils_1.ICryptUtils !== "undefined" && ICryptUtils_1.ICryptUtils) === "function" ? _e : Object])
  3699. ], DomainLockNode);
  3700. exports.DomainLockNode = DomainLockNode;
  3701. /***/ }),
  3702. /***/ "./src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts":
  3703. /*!*******************************************************************************!*\
  3704. !*** ./src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts ***!
  3705. \*******************************************************************************/
  3706. /*! no static exports found */
  3707. /***/ (function(module, exports, __webpack_require__) {
  3708. "use strict";
  3709. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3710. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3711. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3712. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3713. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3714. };
  3715. var __metadata = (this && this.__metadata) || function (k, v) {
  3716. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3717. };
  3718. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3719. return function (target, key) { decorator(target, key, paramIndex); }
  3720. };
  3721. var _a, _b, _c, _d, _e;
  3722. Object.defineProperty(exports, "__esModule", { value: true });
  3723. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3724. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3725. const TCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TCustomNodeFactory */ "./src/types/container/custom-nodes/TCustomNodeFactory.ts");
  3726. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3727. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3728. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3729. const Initializable_1 = __webpack_require__(/*! ../../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3730. const CustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/CustomNode */ "./src/enums/custom-nodes/CustomNode.ts");
  3731. const ObfuscationEvent_1 = __webpack_require__(/*! ../../../enums/event-emitters/ObfuscationEvent */ "./src/enums/event-emitters/ObfuscationEvent.ts");
  3732. const AbstractCustomNodeGroup_1 = __webpack_require__(/*! ../../AbstractCustomNodeGroup */ "./src/custom-nodes/AbstractCustomNodeGroup.ts");
  3733. const NodeAppender_1 = __webpack_require__(/*! ../../../node/NodeAppender */ "./src/node/NodeAppender.ts");
  3734. let DomainLockCustomNodeGroup = class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup_1.AbstractCustomNodeGroup {
  3735. constructor(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  3736. super(identifierNamesGeneratorFactory, randomGenerator, options);
  3737. this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation;
  3738. this.customNodeFactory = customNodeFactory;
  3739. }
  3740. appendCustomNodes(nodeWithStatements, callsGraphData) {
  3741. const randomCallsGraphIndex = this.getRandomCallsGraphIndex(callsGraphData.length);
  3742. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.DomainLockNode, (customNode) => {
  3743. NodeAppender_1.NodeAppender.appendToOptimalBlockScope(callsGraphData, nodeWithStatements, customNode.getNode(), randomCallsGraphIndex);
  3744. });
  3745. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, (customNode) => {
  3746. const targetNodeWithStatements = callsGraphData.length
  3747. ? NodeAppender_1.NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
  3748. : nodeWithStatements;
  3749. NodeAppender_1.NodeAppender.prepend(targetNodeWithStatements, customNode.getNode());
  3750. });
  3751. }
  3752. initialize() {
  3753. this.customNodes = new Map();
  3754. if (!this.options.domainLock.length) {
  3755. return;
  3756. }
  3757. const callsControllerFunctionName = this.identifierNamesGenerator.generate();
  3758. const domainLockNode = this.customNodeFactory(CustomNode_1.CustomNode.DomainLockNode);
  3759. const nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  3760. domainLockNode.initialize(callsControllerFunctionName);
  3761. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  3762. this.customNodes.set(CustomNode_1.CustomNode.DomainLockNode, domainLockNode);
  3763. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  3764. }
  3765. };
  3766. __decorate([
  3767. Initializable_1.initializable(),
  3768. __metadata("design:type", typeof (_a = typeof Map !== "undefined" && Map) === "function" ? _a : Object)
  3769. ], DomainLockCustomNodeGroup.prototype, "customNodes", void 0);
  3770. DomainLockCustomNodeGroup = __decorate([
  3771. inversify_1.injectable(),
  3772. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)),
  3773. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3774. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3775. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3776. __metadata("design:paramtypes", [typeof (_b = typeof TCustomNodeFactory_1.TCustomNodeFactory !== "undefined" && TCustomNodeFactory_1.TCustomNodeFactory) === "function" ? _b : Object, typeof (_c = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _c : Object, typeof (_d = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _d : Object, typeof (_e = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _e : Object])
  3777. ], DomainLockCustomNodeGroup);
  3778. exports.DomainLockCustomNodeGroup = DomainLockCustomNodeGroup;
  3779. /***/ }),
  3780. /***/ "./src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts":
  3781. /*!*****************************************************************************************!*\
  3782. !*** ./src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts ***!
  3783. \*****************************************************************************************/
  3784. /*! no static exports found */
  3785. /***/ (function(module, exports, __webpack_require__) {
  3786. "use strict";
  3787. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3788. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3789. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3790. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3791. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3792. };
  3793. var __metadata = (this && this.__metadata) || function (k, v) {
  3794. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3795. };
  3796. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3797. return function (target, key) { decorator(target, key, paramIndex); }
  3798. };
  3799. var _a, _b, _c, _d, _e;
  3800. Object.defineProperty(exports, "__esModule", { value: true });
  3801. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3802. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3803. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3804. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3805. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3806. const ObfuscationEvent_1 = __webpack_require__(/*! ../../enums/event-emitters/ObfuscationEvent */ "./src/enums/event-emitters/ObfuscationEvent.ts");
  3807. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3808. const SingleNodeCallControllerTemplate_1 = __webpack_require__(/*! ../../templates/SingleNodeCallControllerTemplate */ "./src/templates/SingleNodeCallControllerTemplate.ts");
  3809. const NoCustomNodes_1 = __webpack_require__(/*! ../../options/presets/NoCustomNodes */ "./src/options/presets/NoCustomNodes.ts");
  3810. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3811. const JavaScriptObfuscatorFacade_1 = __webpack_require__(/*! ../../JavaScriptObfuscatorFacade */ "./src/JavaScriptObfuscatorFacade.ts");
  3812. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3813. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3814. let NodeCallsControllerFunctionNode = class NodeCallsControllerFunctionNode extends AbstractCustomNode_1.AbstractCustomNode {
  3815. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  3816. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3817. }
  3818. initialize(appendEvent, callsControllerFunctionName) {
  3819. this.appendEvent = appendEvent;
  3820. this.callsControllerFunctionName = callsControllerFunctionName;
  3821. }
  3822. getNodeStructure(nodeTemplate) {
  3823. return NodeUtils_1.NodeUtils.convertCodeToStructure(nodeTemplate);
  3824. }
  3825. getNodeTemplate() {
  3826. if (this.appendEvent === ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation) {
  3827. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(this.customNodeFormatter.formatTemplate(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
  3828. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  3829. }), Object.assign(Object.assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET), { identifierNamesGenerator: this.options.identifierNamesGenerator, identifiersDictionary: this.options.identifiersDictionary, seed: this.options.seed })).getObfuscatedCode();
  3830. }
  3831. return this.customNodeFormatter.formatTemplate(SingleNodeCallControllerTemplate_1.SingleNodeCallControllerTemplate(), {
  3832. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  3833. });
  3834. }
  3835. };
  3836. __decorate([
  3837. Initializable_1.initializable(),
  3838. __metadata("design:type", String)
  3839. ], NodeCallsControllerFunctionNode.prototype, "callsControllerFunctionName", void 0);
  3840. __decorate([
  3841. Initializable_1.initializable(),
  3842. __metadata("design:type", typeof (_a = typeof ObfuscationEvent_1.ObfuscationEvent !== "undefined" && ObfuscationEvent_1.ObfuscationEvent) === "function" ? _a : Object)
  3843. ], NodeCallsControllerFunctionNode.prototype, "appendEvent", void 0);
  3844. NodeCallsControllerFunctionNode = __decorate([
  3845. inversify_1.injectable(),
  3846. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3847. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3848. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3849. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3850. __metadata("design:paramtypes", [typeof (_b = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _b : Object, typeof (_c = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _c : Object, typeof (_d = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _d : Object, typeof (_e = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _e : Object])
  3851. ], NodeCallsControllerFunctionNode);
  3852. exports.NodeCallsControllerFunctionNode = NodeCallsControllerFunctionNode;
  3853. /***/ }),
  3854. /***/ "./src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts":
  3855. /*!******************************************************************************************************************!*\
  3856. !*** ./src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts ***!
  3857. \******************************************************************************************************************/
  3858. /*! no static exports found */
  3859. /***/ (function(module, exports, __webpack_require__) {
  3860. "use strict";
  3861. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3862. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3863. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3864. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3865. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3866. };
  3867. var __metadata = (this && this.__metadata) || function (k, v) {
  3868. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3869. };
  3870. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3871. return function (target, key) { decorator(target, key, paramIndex); }
  3872. };
  3873. var _a, _b, _c, _d;
  3874. Object.defineProperty(exports, "__esModule", { value: true });
  3875. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3876. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3877. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3878. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3879. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3880. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3881. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3882. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  3883. let ObjectExpressionVariableDeclarationHostNode = class ObjectExpressionVariableDeclarationHostNode extends AbstractCustomNode_1.AbstractCustomNode {
  3884. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  3885. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3886. }
  3887. initialize(properties) {
  3888. this.properties = properties;
  3889. }
  3890. getNodeStructure(nodeTemplate) {
  3891. const structure = NodeFactory_1.NodeFactory.variableDeclarationNode([
  3892. NodeFactory_1.NodeFactory.variableDeclaratorNode(NodeFactory_1.NodeFactory.identifierNode(this.identifierNamesGenerator.generate()), NodeFactory_1.NodeFactory.objectExpressionNode(this.properties))
  3893. ], 'const');
  3894. return [structure];
  3895. }
  3896. };
  3897. ObjectExpressionVariableDeclarationHostNode = __decorate([
  3898. inversify_1.injectable(),
  3899. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3900. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3901. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3902. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3903. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  3904. ], ObjectExpressionVariableDeclarationHostNode);
  3905. exports.ObjectExpressionVariableDeclarationHostNode = ObjectExpressionVariableDeclarationHostNode;
  3906. /***/ }),
  3907. /***/ "./src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts":
  3908. /*!***************************************************************************!*\
  3909. !*** ./src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts ***!
  3910. \***************************************************************************/
  3911. /*! no static exports found */
  3912. /***/ (function(module, exports, __webpack_require__) {
  3913. "use strict";
  3914. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3915. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3916. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3917. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3918. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3919. };
  3920. var __metadata = (this && this.__metadata) || function (k, v) {
  3921. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3922. };
  3923. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3924. return function (target, key) { decorator(target, key, paramIndex); }
  3925. };
  3926. var _a, _b, _c, _d, _e;
  3927. Object.defineProperty(exports, "__esModule", { value: true });
  3928. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3929. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3930. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3931. const IEscapeSequenceEncoder_1 = __webpack_require__(/*! ../../interfaces/utils/IEscapeSequenceEncoder */ "./src/interfaces/utils/IEscapeSequenceEncoder.ts");
  3932. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  3933. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  3934. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  3935. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  3936. const NoCustomNodes_1 = __webpack_require__(/*! ../../options/presets/NoCustomNodes */ "./src/options/presets/NoCustomNodes.ts");
  3937. const SelfDefendingTemplate_1 = __webpack_require__(/*! ../../templates/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate */ "./src/templates/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts");
  3938. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  3939. const JavaScriptObfuscatorFacade_1 = __webpack_require__(/*! ../../JavaScriptObfuscatorFacade */ "./src/JavaScriptObfuscatorFacade.ts");
  3940. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  3941. let SelfDefendingUnicodeNode = class SelfDefendingUnicodeNode extends AbstractCustomNode_1.AbstractCustomNode {
  3942. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options, escapeSequenceEncoder) {
  3943. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  3944. this.escapeSequenceEncoder = escapeSequenceEncoder;
  3945. }
  3946. initialize(callsControllerFunctionName) {
  3947. this.callsControllerFunctionName = callsControllerFunctionName;
  3948. }
  3949. getNodeStructure(nodeTemplate) {
  3950. return NodeUtils_1.NodeUtils.convertCodeToStructure(nodeTemplate);
  3951. }
  3952. getNodeTemplate() {
  3953. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(this.customNodeFormatter.formatTemplate(SelfDefendingTemplate_1.SelfDefendingTemplate(this.escapeSequenceEncoder), {
  3954. selfDefendingFunctionName: this.identifierNamesGenerator.generate(),
  3955. singleNodeCallControllerFunctionName: this.callsControllerFunctionName
  3956. }), Object.assign(Object.assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET), { identifierNamesGenerator: this.options.identifierNamesGenerator, identifiersDictionary: this.options.identifiersDictionary, seed: this.options.seed, unicodeEscapeSequence: true })).getObfuscatedCode();
  3957. }
  3958. };
  3959. __decorate([
  3960. Initializable_1.initializable(),
  3961. __metadata("design:type", String)
  3962. ], SelfDefendingUnicodeNode.prototype, "callsControllerFunctionName", void 0);
  3963. SelfDefendingUnicodeNode = __decorate([
  3964. inversify_1.injectable(),
  3965. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  3966. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  3967. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  3968. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  3969. __param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)),
  3970. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object, typeof (_e = typeof IEscapeSequenceEncoder_1.IEscapeSequenceEncoder !== "undefined" && IEscapeSequenceEncoder_1.IEscapeSequenceEncoder) === "function" ? _e : Object])
  3971. ], SelfDefendingUnicodeNode);
  3972. exports.SelfDefendingUnicodeNode = SelfDefendingUnicodeNode;
  3973. /***/ }),
  3974. /***/ "./src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts":
  3975. /*!*************************************************************************************!*\
  3976. !*** ./src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts ***!
  3977. \*************************************************************************************/
  3978. /*! no static exports found */
  3979. /***/ (function(module, exports, __webpack_require__) {
  3980. "use strict";
  3981. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3982. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3983. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  3984. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3985. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3986. };
  3987. var __metadata = (this && this.__metadata) || function (k, v) {
  3988. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  3989. };
  3990. var __param = (this && this.__param) || function (paramIndex, decorator) {
  3991. return function (target, key) { decorator(target, key, paramIndex); }
  3992. };
  3993. var _a, _b, _c, _d, _e;
  3994. Object.defineProperty(exports, "__esModule", { value: true });
  3995. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  3996. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  3997. const TCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TCustomNodeFactory */ "./src/types/container/custom-nodes/TCustomNodeFactory.ts");
  3998. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  3999. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  4000. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  4001. const Initializable_1 = __webpack_require__(/*! ../../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  4002. const CustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/CustomNode */ "./src/enums/custom-nodes/CustomNode.ts");
  4003. const ObfuscationEvent_1 = __webpack_require__(/*! ../../../enums/event-emitters/ObfuscationEvent */ "./src/enums/event-emitters/ObfuscationEvent.ts");
  4004. const AbstractCustomNodeGroup_1 = __webpack_require__(/*! ../../AbstractCustomNodeGroup */ "./src/custom-nodes/AbstractCustomNodeGroup.ts");
  4005. const NodeAppender_1 = __webpack_require__(/*! ../../../node/NodeAppender */ "./src/node/NodeAppender.ts");
  4006. let SelfDefendingCustomNodeGroup = class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup_1.AbstractCustomNodeGroup {
  4007. constructor(customNodeFactory, identifierNamesGeneratorFactory, randomGenerator, options) {
  4008. super(identifierNamesGeneratorFactory, randomGenerator, options);
  4009. this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation;
  4010. this.customNodeFactory = customNodeFactory;
  4011. }
  4012. appendCustomNodes(nodeWithStatements, callsGraphData) {
  4013. const randomCallsGraphIndex = this.getRandomCallsGraphIndex(callsGraphData.length);
  4014. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.SelfDefendingUnicodeNode, (customNode) => {
  4015. NodeAppender_1.NodeAppender.appendToOptimalBlockScope(callsGraphData, nodeWithStatements, customNode.getNode(), randomCallsGraphIndex);
  4016. });
  4017. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, (customNode) => {
  4018. const targetNodeWithStatements = callsGraphData.length
  4019. ? NodeAppender_1.NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
  4020. : nodeWithStatements;
  4021. NodeAppender_1.NodeAppender.prepend(targetNodeWithStatements, customNode.getNode());
  4022. });
  4023. }
  4024. initialize() {
  4025. this.customNodes = new Map();
  4026. if (!this.options.selfDefending) {
  4027. return;
  4028. }
  4029. const callsControllerFunctionName = this.identifierNamesGenerator.generate();
  4030. const selfDefendingUnicodeNode = this.customNodeFactory(CustomNode_1.CustomNode.SelfDefendingUnicodeNode);
  4031. const nodeCallsControllerFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode);
  4032. selfDefendingUnicodeNode.initialize(callsControllerFunctionName);
  4033. nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
  4034. this.customNodes.set(CustomNode_1.CustomNode.SelfDefendingUnicodeNode, selfDefendingUnicodeNode);
  4035. this.customNodes.set(CustomNode_1.CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
  4036. }
  4037. };
  4038. __decorate([
  4039. Initializable_1.initializable(),
  4040. __metadata("design:type", typeof (_a = typeof Map !== "undefined" && Map) === "function" ? _a : Object)
  4041. ], SelfDefendingCustomNodeGroup.prototype, "customNodes", void 0);
  4042. SelfDefendingCustomNodeGroup = __decorate([
  4043. inversify_1.injectable(),
  4044. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)),
  4045. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  4046. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  4047. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  4048. __metadata("design:paramtypes", [typeof (_b = typeof TCustomNodeFactory_1.TCustomNodeFactory !== "undefined" && TCustomNodeFactory_1.TCustomNodeFactory) === "function" ? _b : Object, typeof (_c = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _c : Object, typeof (_d = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _d : Object, typeof (_e = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _e : Object])
  4049. ], SelfDefendingCustomNodeGroup);
  4050. exports.SelfDefendingCustomNodeGroup = SelfDefendingCustomNodeGroup;
  4051. /***/ }),
  4052. /***/ "./src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts":
  4053. /*!************************************************************************!*\
  4054. !*** ./src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts ***!
  4055. \************************************************************************/
  4056. /*! no static exports found */
  4057. /***/ (function(module, exports, __webpack_require__) {
  4058. "use strict";
  4059. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  4060. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4061. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4062. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  4063. return c > 3 && r && Object.defineProperty(target, key, r), r;
  4064. };
  4065. var __metadata = (this && this.__metadata) || function (k, v) {
  4066. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  4067. };
  4068. var __param = (this && this.__param) || function (paramIndex, decorator) {
  4069. return function (target, key) { decorator(target, key, paramIndex); }
  4070. };
  4071. var _a, _b, _c, _d, _e;
  4072. Object.defineProperty(exports, "__esModule", { value: true });
  4073. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  4074. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  4075. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  4076. const IEscapeSequenceEncoder_1 = __webpack_require__(/*! ../../interfaces/utils/IEscapeSequenceEncoder */ "./src/interfaces/utils/IEscapeSequenceEncoder.ts");
  4077. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  4078. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  4079. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  4080. const ObfuscationTarget_1 = __webpack_require__(/*! ../../enums/ObfuscationTarget */ "./src/enums/ObfuscationTarget.ts");
  4081. const StringArrayEncoding_1 = __webpack_require__(/*! ../../enums/StringArrayEncoding */ "./src/enums/StringArrayEncoding.ts");
  4082. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  4083. const NoCustomNodes_1 = __webpack_require__(/*! ../../options/presets/NoCustomNodes */ "./src/options/presets/NoCustomNodes.ts");
  4084. const AtobTemplate_1 = __webpack_require__(/*! ../../templates/AtobTemplate */ "./src/templates/AtobTemplate.ts");
  4085. const GlobalVariableNoEvalTemplate_1 = __webpack_require__(/*! ../../templates/GlobalVariableNoEvalTemplate */ "./src/templates/GlobalVariableNoEvalTemplate.ts");
  4086. const Rc4Template_1 = __webpack_require__(/*! ../../templates/Rc4Template */ "./src/templates/Rc4Template.ts");
  4087. const SelfDefendingTemplate_1 = __webpack_require__(/*! ../../templates/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate */ "./src/templates/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate.ts");
  4088. const StringArrayBase64DecodeNodeTemplate_1 = __webpack_require__(/*! ../../templates/string-array-nodes/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate */ "./src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate.ts");
  4089. const StringArrayCallsWrapperTemplate_1 = __webpack_require__(/*! ../../templates/string-array-nodes/string-array-calls-wrapper/StringArrayCallsWrapperTemplate */ "./src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayCallsWrapperTemplate.ts");
  4090. const StringArrayRC4DecodeNodeTemplate_1 = __webpack_require__(/*! ../../templates/string-array-nodes/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate */ "./src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate.ts");
  4091. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  4092. const JavaScriptObfuscatorFacade_1 = __webpack_require__(/*! ../../JavaScriptObfuscatorFacade */ "./src/JavaScriptObfuscatorFacade.ts");
  4093. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  4094. let StringArrayCallsWrapper = class StringArrayCallsWrapper extends AbstractCustomNode_1.AbstractCustomNode {
  4095. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options, escapeSequenceEncoder) {
  4096. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  4097. this.escapeSequenceEncoder = escapeSequenceEncoder;
  4098. }
  4099. initialize(stringArrayName, stringArrayCallsWrapperName) {
  4100. this.stringArrayName = stringArrayName;
  4101. this.stringArrayCallsWrapperName = stringArrayCallsWrapperName;
  4102. }
  4103. getNodeStructure(nodeTemplate) {
  4104. return NodeUtils_1.NodeUtils.convertCodeToStructure(nodeTemplate);
  4105. }
  4106. getNodeTemplate() {
  4107. const decodeNodeTemplate = this.getDecodeStringArrayTemplate();
  4108. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(this.customNodeFormatter.formatTemplate(StringArrayCallsWrapperTemplate_1.StringArrayCallsWrapperTemplate(), {
  4109. decodeNodeTemplate,
  4110. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
  4111. stringArrayName: this.stringArrayName
  4112. }), Object.assign(Object.assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET), { identifierNamesGenerator: this.options.identifierNamesGenerator, identifiersDictionary: this.options.identifiersDictionary, seed: this.randomGenerator.getRawSeed() })).getObfuscatedCode();
  4113. }
  4114. getDecodeStringArrayTemplate() {
  4115. const globalVariableTemplate = this.options.target !== ObfuscationTarget_1.ObfuscationTarget.BrowserNoEval
  4116. ? this.getGlobalVariableTemplate()
  4117. : GlobalVariableNoEvalTemplate_1.GlobalVariableNoEvalTemplate();
  4118. const atobPolyfill = this.customNodeFormatter.formatTemplate(AtobTemplate_1.AtobTemplate(), { globalVariableTemplate });
  4119. let decodeStringArrayTemplate = '';
  4120. let selfDefendingCode = '';
  4121. if (this.options.selfDefending) {
  4122. selfDefendingCode = this.customNodeFormatter.formatTemplate(SelfDefendingTemplate_1.SelfDefendingTemplate(this.randomGenerator, this.escapeSequenceEncoder), {
  4123. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
  4124. stringArrayName: this.stringArrayName
  4125. });
  4126. }
  4127. switch (this.options.stringArrayEncoding) {
  4128. case StringArrayEncoding_1.StringArrayEncoding.Rc4:
  4129. decodeStringArrayTemplate = this.customNodeFormatter.formatTemplate(StringArrayRC4DecodeNodeTemplate_1.StringArrayRc4DecodeNodeTemplate(this.randomGenerator), {
  4130. atobPolyfill,
  4131. rc4Polyfill: Rc4Template_1.Rc4Template(),
  4132. selfDefendingCode,
  4133. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
  4134. });
  4135. break;
  4136. case StringArrayEncoding_1.StringArrayEncoding.Base64:
  4137. decodeStringArrayTemplate = this.customNodeFormatter.formatTemplate(StringArrayBase64DecodeNodeTemplate_1.StringArrayBase64DecodeNodeTemplate(this.randomGenerator), {
  4138. atobPolyfill,
  4139. selfDefendingCode,
  4140. stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
  4141. });
  4142. }
  4143. return decodeStringArrayTemplate;
  4144. }
  4145. };
  4146. __decorate([
  4147. Initializable_1.initializable(),
  4148. __metadata("design:type", String)
  4149. ], StringArrayCallsWrapper.prototype, "stringArrayName", void 0);
  4150. __decorate([
  4151. Initializable_1.initializable(),
  4152. __metadata("design:type", String)
  4153. ], StringArrayCallsWrapper.prototype, "stringArrayCallsWrapperName", void 0);
  4154. StringArrayCallsWrapper = __decorate([
  4155. inversify_1.injectable(),
  4156. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  4157. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  4158. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  4159. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  4160. __param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)),
  4161. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object, typeof (_e = typeof IEscapeSequenceEncoder_1.IEscapeSequenceEncoder !== "undefined" && IEscapeSequenceEncoder_1.IEscapeSequenceEncoder) === "function" ? _e : Object])
  4162. ], StringArrayCallsWrapper);
  4163. exports.StringArrayCallsWrapper = StringArrayCallsWrapper;
  4164. /***/ }),
  4165. /***/ "./src/custom-nodes/string-array-nodes/StringArrayNode.ts":
  4166. /*!****************************************************************!*\
  4167. !*** ./src/custom-nodes/string-array-nodes/StringArrayNode.ts ***!
  4168. \****************************************************************/
  4169. /*! no static exports found */
  4170. /***/ (function(module, exports, __webpack_require__) {
  4171. "use strict";
  4172. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  4173. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4174. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4175. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  4176. return c > 3 && r && Object.defineProperty(target, key, r), r;
  4177. };
  4178. var __metadata = (this && this.__metadata) || function (k, v) {
  4179. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  4180. };
  4181. var __param = (this && this.__param) || function (paramIndex, decorator) {
  4182. return function (target, key) { decorator(target, key, paramIndex); }
  4183. };
  4184. var _a, _b, _c, _d, _e;
  4185. Object.defineProperty(exports, "__esModule", { value: true });
  4186. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  4187. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  4188. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  4189. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  4190. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  4191. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  4192. const IStringArrayStorage_1 = __webpack_require__(/*! ../../interfaces/storages/string-array-storage/IStringArrayStorage */ "./src/interfaces/storages/string-array-storage/IStringArrayStorage.ts");
  4193. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  4194. const StringArrayTemplate_1 = __webpack_require__(/*! ../../templates/string-array-nodes/string-array-node/StringArrayTemplate */ "./src/templates/string-array-nodes/string-array-node/StringArrayTemplate.ts");
  4195. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  4196. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  4197. let StringArrayNode = class StringArrayNode extends AbstractCustomNode_1.AbstractCustomNode {
  4198. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options) {
  4199. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  4200. }
  4201. initialize(stringArrayStorage, stringArrayName) {
  4202. this.stringArrayStorage = stringArrayStorage;
  4203. this.stringArrayName = stringArrayName;
  4204. }
  4205. getNodeStructure(nodeTemplate) {
  4206. return NodeUtils_1.NodeUtils.convertCodeToStructure(nodeTemplate);
  4207. }
  4208. getNodeTemplate() {
  4209. return this.customNodeFormatter.formatTemplate(StringArrayTemplate_1.StringArrayTemplate(), {
  4210. stringArrayName: this.stringArrayName,
  4211. stringArray: this.stringArrayStorage.toString()
  4212. });
  4213. }
  4214. };
  4215. __decorate([
  4216. Initializable_1.initializable(),
  4217. __metadata("design:type", typeof (_a = typeof IStringArrayStorage_1.IStringArrayStorage !== "undefined" && IStringArrayStorage_1.IStringArrayStorage) === "function" ? _a : Object)
  4218. ], StringArrayNode.prototype, "stringArrayStorage", void 0);
  4219. __decorate([
  4220. Initializable_1.initializable(),
  4221. __metadata("design:type", String)
  4222. ], StringArrayNode.prototype, "stringArrayName", void 0);
  4223. StringArrayNode = __decorate([
  4224. inversify_1.injectable(),
  4225. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  4226. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  4227. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  4228. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  4229. __metadata("design:paramtypes", [typeof (_b = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _b : Object, typeof (_c = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _c : Object, typeof (_d = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _d : Object, typeof (_e = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _e : Object])
  4230. ], StringArrayNode);
  4231. exports.StringArrayNode = StringArrayNode;
  4232. /***/ }),
  4233. /***/ "./src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts":
  4234. /*!******************************************************************************!*\
  4235. !*** ./src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts ***!
  4236. \******************************************************************************/
  4237. /*! no static exports found */
  4238. /***/ (function(module, exports, __webpack_require__) {
  4239. "use strict";
  4240. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  4241. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4242. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4243. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  4244. return c > 3 && r && Object.defineProperty(target, key, r), r;
  4245. };
  4246. var __metadata = (this && this.__metadata) || function (k, v) {
  4247. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  4248. };
  4249. var __param = (this && this.__param) || function (paramIndex, decorator) {
  4250. return function (target, key) { decorator(target, key, paramIndex); }
  4251. };
  4252. var _a, _b, _c, _d, _e;
  4253. Object.defineProperty(exports, "__esModule", { value: true });
  4254. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  4255. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  4256. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  4257. const IEscapeSequenceEncoder_1 = __webpack_require__(/*! ../../interfaces/utils/IEscapeSequenceEncoder */ "./src/interfaces/utils/IEscapeSequenceEncoder.ts");
  4258. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  4259. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  4260. const ICustomNodeFormatter_1 = __webpack_require__(/*! ../../interfaces/custom-nodes/ICustomNodeFormatter */ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts");
  4261. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  4262. const NoCustomNodes_1 = __webpack_require__(/*! ../../options/presets/NoCustomNodes */ "./src/options/presets/NoCustomNodes.ts");
  4263. const SelfDefendingTemplate_1 = __webpack_require__(/*! ../../templates/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate */ "./src/templates/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate.ts");
  4264. const StringArrayRotateFunctionTemplate_1 = __webpack_require__(/*! ../../templates/string-array-nodes/string-array-rotate-function-node/StringArrayRotateFunctionTemplate */ "./src/templates/string-array-nodes/string-array-rotate-function-node/StringArrayRotateFunctionTemplate.ts");
  4265. const AbstractCustomNode_1 = __webpack_require__(/*! ../AbstractCustomNode */ "./src/custom-nodes/AbstractCustomNode.ts");
  4266. const JavaScriptObfuscatorFacade_1 = __webpack_require__(/*! ../../JavaScriptObfuscatorFacade */ "./src/JavaScriptObfuscatorFacade.ts");
  4267. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  4268. const NumberUtils_1 = __webpack_require__(/*! ../../utils/NumberUtils */ "./src/utils/NumberUtils.ts");
  4269. let StringArrayRotateFunctionNode = class StringArrayRotateFunctionNode extends AbstractCustomNode_1.AbstractCustomNode {
  4270. constructor(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options, escapeSequenceEncoder) {
  4271. super(identifierNamesGeneratorFactory, customNodeFormatter, randomGenerator, options);
  4272. this.escapeSequenceEncoder = escapeSequenceEncoder;
  4273. }
  4274. initialize(stringArrayName, stringArrayRotationAmount) {
  4275. this.stringArrayName = stringArrayName;
  4276. this.stringArrayRotationAmount = stringArrayRotationAmount;
  4277. }
  4278. getNodeStructure(nodeTemplate) {
  4279. return NodeUtils_1.NodeUtils.convertCodeToStructure(nodeTemplate);
  4280. }
  4281. getNodeTemplate() {
  4282. const timesName = this.identifierNamesGenerator.generate();
  4283. const whileFunctionName = this.identifierNamesGenerator.generate();
  4284. let code = '';
  4285. if (this.options.selfDefending) {
  4286. code = this.customNodeFormatter.formatTemplate(SelfDefendingTemplate_1.SelfDefendingTemplate(this.escapeSequenceEncoder), {
  4287. timesName,
  4288. whileFunctionName
  4289. });
  4290. }
  4291. else {
  4292. code = `${whileFunctionName}(++${timesName})`;
  4293. }
  4294. return JavaScriptObfuscatorFacade_1.JavaScriptObfuscator.obfuscate(this.customNodeFormatter.formatTemplate(StringArrayRotateFunctionTemplate_1.StringArrayRotateFunctionTemplate(), {
  4295. code,
  4296. timesName,
  4297. stringArrayName: this.stringArrayName,
  4298. stringArrayRotationAmount: NumberUtils_1.NumberUtils.toHex(this.stringArrayRotationAmount),
  4299. whileFunctionName
  4300. }), Object.assign(Object.assign({}, NoCustomNodes_1.NO_ADDITIONAL_NODES_PRESET), { identifierNamesGenerator: this.options.identifierNamesGenerator, identifiersDictionary: this.options.identifiersDictionary, seed: this.randomGenerator.getRawSeed() })).getObfuscatedCode();
  4301. }
  4302. };
  4303. __decorate([
  4304. Initializable_1.initializable(),
  4305. __metadata("design:type", String)
  4306. ], StringArrayRotateFunctionNode.prototype, "stringArrayName", void 0);
  4307. __decorate([
  4308. Initializable_1.initializable(),
  4309. __metadata("design:type", Number)
  4310. ], StringArrayRotateFunctionNode.prototype, "stringArrayRotationAmount", void 0);
  4311. StringArrayRotateFunctionNode = __decorate([
  4312. inversify_1.injectable(),
  4313. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  4314. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICustomNodeFormatter)),
  4315. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  4316. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  4317. __param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)),
  4318. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof ICustomNodeFormatter_1.ICustomNodeFormatter !== "undefined" && ICustomNodeFormatter_1.ICustomNodeFormatter) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object, typeof (_e = typeof IEscapeSequenceEncoder_1.IEscapeSequenceEncoder !== "undefined" && IEscapeSequenceEncoder_1.IEscapeSequenceEncoder) === "function" ? _e : Object])
  4319. ], StringArrayRotateFunctionNode);
  4320. exports.StringArrayRotateFunctionNode = StringArrayRotateFunctionNode;
  4321. /***/ }),
  4322. /***/ "./src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts":
  4323. /*!*********************************************************************************!*\
  4324. !*** ./src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts ***!
  4325. \*********************************************************************************/
  4326. /*! no static exports found */
  4327. /***/ (function(module, exports, __webpack_require__) {
  4328. "use strict";
  4329. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  4330. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4331. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4332. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  4333. return c > 3 && r && Object.defineProperty(target, key, r), r;
  4334. };
  4335. var __metadata = (this && this.__metadata) || function (k, v) {
  4336. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  4337. };
  4338. var __param = (this && this.__param) || function (paramIndex, decorator) {
  4339. return function (target, key) { decorator(target, key, paramIndex); }
  4340. };
  4341. var _a, _b, _c, _d, _e, _f;
  4342. Object.defineProperty(exports, "__esModule", { value: true });
  4343. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  4344. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  4345. const TCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TCustomNodeFactory */ "./src/types/container/custom-nodes/TCustomNodeFactory.ts");
  4346. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  4347. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  4348. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  4349. const IStringArrayStorage_1 = __webpack_require__(/*! ../../../interfaces/storages/string-array-storage/IStringArrayStorage */ "./src/interfaces/storages/string-array-storage/IStringArrayStorage.ts");
  4350. const Initializable_1 = __webpack_require__(/*! ../../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  4351. const CustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/CustomNode */ "./src/enums/custom-nodes/CustomNode.ts");
  4352. const ObfuscationEvent_1 = __webpack_require__(/*! ../../../enums/event-emitters/ObfuscationEvent */ "./src/enums/event-emitters/ObfuscationEvent.ts");
  4353. const AbstractCustomNodeGroup_1 = __webpack_require__(/*! ../../AbstractCustomNodeGroup */ "./src/custom-nodes/AbstractCustomNodeGroup.ts");
  4354. const NodeAppender_1 = __webpack_require__(/*! ../../../node/NodeAppender */ "./src/node/NodeAppender.ts");
  4355. let StringArrayCustomNodeGroup = class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup_1.AbstractCustomNodeGroup {
  4356. constructor(customNodeFactory, stringArrayStorage, identifierNamesGeneratorFactory, randomGenerator, options) {
  4357. super(identifierNamesGeneratorFactory, randomGenerator, options);
  4358. this.appendEvent = ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation;
  4359. this.customNodeFactory = customNodeFactory;
  4360. this.stringArrayStorage = stringArrayStorage;
  4361. }
  4362. appendCustomNodes(nodeWithStatements, callsGraphData) {
  4363. if (!this.stringArrayStorage.getLength()) {
  4364. return;
  4365. }
  4366. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayNode, (customNode) => {
  4367. NodeAppender_1.NodeAppender.prepend(nodeWithStatements, customNode.getNode());
  4368. });
  4369. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayCallsWrapper, (customNode) => {
  4370. NodeAppender_1.NodeAppender.insertAtIndex(nodeWithStatements, customNode.getNode(), 1);
  4371. });
  4372. this.appendCustomNodeIfExist(CustomNode_1.CustomNode.StringArrayRotateFunctionNode, (customNode) => {
  4373. NodeAppender_1.NodeAppender.insertAtIndex(nodeWithStatements, customNode.getNode(), 1);
  4374. });
  4375. }
  4376. initialize() {
  4377. this.customNodes = new Map();
  4378. if (!this.options.stringArray) {
  4379. return;
  4380. }
  4381. const stringArrayNode = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayNode);
  4382. const stringArrayCallsWrapper = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayCallsWrapper);
  4383. const stringArrayRotateFunctionNode = this.customNodeFactory(CustomNode_1.CustomNode.StringArrayRotateFunctionNode);
  4384. const stringArrayName = this.stringArrayStorage.getStorageName();
  4385. const stringArrayCallsWrapperName = this.stringArrayStorage.getStorageCallsWrapperName();
  4386. const stringArrayRotationAmount = this.stringArrayStorage.getRotationAmount();
  4387. stringArrayNode.initialize(this.stringArrayStorage, stringArrayName);
  4388. stringArrayCallsWrapper.initialize(stringArrayName, stringArrayCallsWrapperName);
  4389. stringArrayRotateFunctionNode.initialize(stringArrayName, stringArrayRotationAmount);
  4390. this.customNodes.set(CustomNode_1.CustomNode.StringArrayNode, stringArrayNode);
  4391. this.customNodes.set(CustomNode_1.CustomNode.StringArrayCallsWrapper, stringArrayCallsWrapper);
  4392. if (this.options.rotateStringArray) {
  4393. this.customNodes.set(CustomNode_1.CustomNode.StringArrayRotateFunctionNode, stringArrayRotateFunctionNode);
  4394. }
  4395. }
  4396. };
  4397. __decorate([
  4398. Initializable_1.initializable(),
  4399. __metadata("design:type", typeof (_a = typeof Map !== "undefined" && Map) === "function" ? _a : Object)
  4400. ], StringArrayCustomNodeGroup.prototype, "customNodes", void 0);
  4401. StringArrayCustomNodeGroup = __decorate([
  4402. inversify_1.injectable(),
  4403. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNode)),
  4404. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IStringArrayStorage)),
  4405. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  4406. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  4407. __param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  4408. __metadata("design:paramtypes", [typeof (_b = typeof TCustomNodeFactory_1.TCustomNodeFactory !== "undefined" && TCustomNodeFactory_1.TCustomNodeFactory) === "function" ? _b : Object, typeof (_c = typeof IStringArrayStorage_1.IStringArrayStorage !== "undefined" && IStringArrayStorage_1.IStringArrayStorage) === "function" ? _c : Object, typeof (_d = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _d : Object, typeof (_e = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _e : Object, typeof (_f = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _f : Object])
  4409. ], StringArrayCustomNodeGroup);
  4410. exports.StringArrayCustomNodeGroup = StringArrayCustomNodeGroup;
  4411. /***/ }),
  4412. /***/ "./src/decorators/Initializable.ts":
  4413. /*!*****************************************!*\
  4414. !*** ./src/decorators/Initializable.ts ***!
  4415. \*****************************************/
  4416. /*! no static exports found */
  4417. /***/ (function(module, exports, __webpack_require__) {
  4418. "use strict";
  4419. Object.defineProperty(exports, "__esModule", { value: true });
  4420. const defaultDescriptor = {
  4421. configurable: true,
  4422. enumerable: true
  4423. };
  4424. const initializedTargetMetadataKey = '_initialized';
  4425. const initializablePropertiesSetMetadataKey = '_initializablePropertiesSet';
  4426. const wrappedMethodsSetMetadataKey = '_wrappedMethodsSet';
  4427. const constructorMethodName = 'constructor';
  4428. function initializable(initializeMethodName = 'initialize') {
  4429. const decoratorName = Object.keys(this)[0];
  4430. return (target, propertyKey) => {
  4431. const initializeMethod = target[initializeMethodName];
  4432. if (!initializeMethod || typeof initializeMethod !== 'function') {
  4433. throw new Error(`\`${initializeMethodName}\` method with initialization logic not ` +
  4434. `found. \`@${decoratorName}\` decorator requires \`${initializeMethodName}\` method`);
  4435. }
  4436. initializeTargetMetadata(initializedTargetMetadataKey, false, target);
  4437. initializeTargetMetadata(initializablePropertiesSetMetadataKey, new Set(), target);
  4438. initializeTargetMetadata(wrappedMethodsSetMetadataKey, new Set(), target);
  4439. wrapTargetMethodsInInitializedCheck(target, initializeMethodName);
  4440. wrapInitializeMethodInInitializeCheck(target, initializeMethodName, propertyKey);
  4441. return wrapInitializableProperty(target, propertyKey);
  4442. };
  4443. }
  4444. exports.initializable = initializable;
  4445. function initializeTargetMetadata(metadataKey, metadataValue, target) {
  4446. const hasInitializedMetadata = Reflect.hasMetadata(metadataKey, target);
  4447. if (!hasInitializedMetadata) {
  4448. Reflect.defineMetadata(metadataKey, metadataValue, target);
  4449. }
  4450. }
  4451. function wrapTargetMethodsInInitializedCheck(target, initializeMethodName) {
  4452. const ownPropertyNames = Object.getOwnPropertyNames(target);
  4453. const prohibitedPropertyNames = [initializeMethodName, constructorMethodName];
  4454. ownPropertyNames.forEach((propertyName) => {
  4455. var _a;
  4456. const initializablePropertiesSet = Reflect
  4457. .getMetadata(initializablePropertiesSetMetadataKey, target);
  4458. const wrappedMethodsSet = Reflect
  4459. .getMetadata(wrappedMethodsSetMetadataKey, target);
  4460. const isProhibitedPropertyName = prohibitedPropertyNames.includes(propertyName)
  4461. || initializablePropertiesSet.has(propertyName)
  4462. || wrappedMethodsSet.has(propertyName);
  4463. if (isProhibitedPropertyName) {
  4464. return;
  4465. }
  4466. const targetProperty = target[propertyName];
  4467. if (typeof targetProperty !== 'function') {
  4468. return;
  4469. }
  4470. const methodDescriptor = (_a = Object
  4471. .getOwnPropertyDescriptor(target, propertyName)) !== null && _a !== void 0 ? _a : defaultDescriptor;
  4472. const originalMethod = methodDescriptor.value;
  4473. Object.defineProperty(target, propertyName, Object.assign(Object.assign({}, methodDescriptor), { value() {
  4474. if (!Reflect.getMetadata(initializedTargetMetadataKey, this)) {
  4475. throw new Error(`Class should be initialized with \`${initializeMethodName}()\` method`);
  4476. }
  4477. return originalMethod.apply(this, arguments);
  4478. } }));
  4479. wrappedMethodsSet.add(propertyName);
  4480. });
  4481. }
  4482. function wrapInitializeMethodInInitializeCheck(target, initializeMethodName, propertyKey) {
  4483. var _a;
  4484. const methodDescriptor = (_a = Object
  4485. .getOwnPropertyDescriptor(target, initializeMethodName)) !== null && _a !== void 0 ? _a : defaultDescriptor;
  4486. const originalMethod = methodDescriptor.value;
  4487. Object.defineProperty(target, initializeMethodName, Object.assign(Object.assign({}, methodDescriptor), { value: function () {
  4488. Reflect.defineMetadata(initializedTargetMetadataKey, true, this);
  4489. const result = originalMethod.apply(this, arguments);
  4490. if (this[propertyKey]) { }
  4491. return result;
  4492. } }));
  4493. }
  4494. function wrapInitializableProperty(target, propertyKey) {
  4495. var _a;
  4496. const initializablePropertiesSet = Reflect
  4497. .getMetadata(initializablePropertiesSetMetadataKey, target);
  4498. initializablePropertiesSet.add(propertyKey);
  4499. const initializablePropertyMetadataKey = `_${propertyKey.toString()}`;
  4500. const propertyDescriptor = (_a = Object
  4501. .getOwnPropertyDescriptor(target, initializablePropertyMetadataKey)) !== null && _a !== void 0 ? _a : defaultDescriptor;
  4502. Object.defineProperty(target, propertyKey, Object.assign(Object.assign({}, propertyDescriptor), { get: function () {
  4503. if (this[initializablePropertyMetadataKey] === undefined) {
  4504. throw new Error(`Property \`${propertyKey.toString()}\` is not initialized! Initialize it first!`);
  4505. }
  4506. return this[initializablePropertyMetadataKey];
  4507. }, set: function (newVal) {
  4508. this[initializablePropertyMetadataKey] = newVal;
  4509. } }));
  4510. return propertyDescriptor;
  4511. }
  4512. /***/ }),
  4513. /***/ "./src/enums/ObfuscationTarget.ts":
  4514. /*!****************************************!*\
  4515. !*** ./src/enums/ObfuscationTarget.ts ***!
  4516. \****************************************/
  4517. /*! no static exports found */
  4518. /***/ (function(module, exports, __webpack_require__) {
  4519. "use strict";
  4520. Object.defineProperty(exports, "__esModule", { value: true });
  4521. const tsenum_1 = __webpack_require__(/*! @gradecam/tsenum */ "@gradecam/tsenum");
  4522. exports.ObfuscationTarget = tsenum_1.MakeEnum({
  4523. Browser: 'browser',
  4524. BrowserNoEval: 'browser-no-eval',
  4525. Node: 'node'
  4526. });
  4527. /***/ }),
  4528. /***/ "./src/enums/StringArrayEncoding.ts":
  4529. /*!******************************************!*\
  4530. !*** ./src/enums/StringArrayEncoding.ts ***!
  4531. \******************************************/
  4532. /*! no static exports found */
  4533. /***/ (function(module, exports, __webpack_require__) {
  4534. "use strict";
  4535. Object.defineProperty(exports, "__esModule", { value: true });
  4536. const tsenum_1 = __webpack_require__(/*! @gradecam/tsenum */ "@gradecam/tsenum");
  4537. exports.StringArrayEncoding = tsenum_1.MakeEnum({
  4538. Base64: 'base64',
  4539. Rc4: 'rc4'
  4540. });
  4541. /***/ }),
  4542. /***/ "./src/enums/StringSeparator.ts":
  4543. /*!**************************************!*\
  4544. !*** ./src/enums/StringSeparator.ts ***!
  4545. \**************************************/
  4546. /*! no static exports found */
  4547. /***/ (function(module, exports, __webpack_require__) {
  4548. "use strict";
  4549. Object.defineProperty(exports, "__esModule", { value: true });
  4550. var StringSeparator;
  4551. (function (StringSeparator) {
  4552. StringSeparator["Dot"] = ".";
  4553. StringSeparator["Comma"] = ",";
  4554. })(StringSeparator = exports.StringSeparator || (exports.StringSeparator = {}));
  4555. /***/ }),
  4556. /***/ "./src/enums/analyzers/calls-graph-analyzer/CalleeDataExtractor.ts":
  4557. /*!*************************************************************************!*\
  4558. !*** ./src/enums/analyzers/calls-graph-analyzer/CalleeDataExtractor.ts ***!
  4559. \*************************************************************************/
  4560. /*! no static exports found */
  4561. /***/ (function(module, exports, __webpack_require__) {
  4562. "use strict";
  4563. Object.defineProperty(exports, "__esModule", { value: true });
  4564. var CalleeDataExtractor;
  4565. (function (CalleeDataExtractor) {
  4566. CalleeDataExtractor["FunctionDeclarationCalleeDataExtractor"] = "FunctionDeclarationCalleeDataExtractor";
  4567. CalleeDataExtractor["FunctionExpressionCalleeDataExtractor"] = "FunctionExpressionCalleeDataExtractor";
  4568. CalleeDataExtractor["ObjectExpressionCalleeDataExtractor"] = "ObjectExpressionCalleeDataExtractor";
  4569. })(CalleeDataExtractor = exports.CalleeDataExtractor || (exports.CalleeDataExtractor = {}));
  4570. /***/ }),
  4571. /***/ "./src/enums/custom-nodes/ControlFlowCustomNode.ts":
  4572. /*!*********************************************************!*\
  4573. !*** ./src/enums/custom-nodes/ControlFlowCustomNode.ts ***!
  4574. \*********************************************************/
  4575. /*! no static exports found */
  4576. /***/ (function(module, exports, __webpack_require__) {
  4577. "use strict";
  4578. Object.defineProperty(exports, "__esModule", { value: true });
  4579. var ControlFlowCustomNode;
  4580. (function (ControlFlowCustomNode) {
  4581. ControlFlowCustomNode["BinaryExpressionFunctionNode"] = "BinaryExpressionFunctionNode";
  4582. ControlFlowCustomNode["BlockStatementControlFlowFlatteningNode"] = "BlockStatementControlFlowFlatteningNode";
  4583. ControlFlowCustomNode["CallExpressionControlFlowStorageCallNode"] = "CallExpressionControlFlowStorageCallNode";
  4584. ControlFlowCustomNode["CallExpressionFunctionNode"] = "CallExpressionFunctionNode";
  4585. ControlFlowCustomNode["ControlFlowStorageNode"] = "ControlFlowStorageNode";
  4586. ControlFlowCustomNode["ExpressionWithOperatorControlFlowStorageCallNode"] = "ExpressionWithOperatorControlFlowStorageCallNode";
  4587. ControlFlowCustomNode["LogicalExpressionFunctionNode"] = "LogicalExpressionFunctionNode";
  4588. ControlFlowCustomNode["StringLiteralControlFlowStorageCallNode"] = "StringLiteralControlFlowStorageCallNode";
  4589. ControlFlowCustomNode["StringLiteralNode"] = "StringLiteralNode";
  4590. })(ControlFlowCustomNode = exports.ControlFlowCustomNode || (exports.ControlFlowCustomNode = {}));
  4591. /***/ }),
  4592. /***/ "./src/enums/custom-nodes/CustomNode.ts":
  4593. /*!**********************************************!*\
  4594. !*** ./src/enums/custom-nodes/CustomNode.ts ***!
  4595. \**********************************************/
  4596. /*! no static exports found */
  4597. /***/ (function(module, exports, __webpack_require__) {
  4598. "use strict";
  4599. Object.defineProperty(exports, "__esModule", { value: true });
  4600. var CustomNode;
  4601. (function (CustomNode) {
  4602. CustomNode["ConsoleOutputDisableExpressionNode"] = "ConsoleOutputDisableExpressionNode";
  4603. CustomNode["DebugProtectionFunctionCallNode"] = "DebugProtectionFunctionCallNode";
  4604. CustomNode["DebugProtectionFunctionIntervalNode"] = "DebugProtectionFunctionIntervalNode";
  4605. CustomNode["DebugProtectionFunctionNode"] = "DebugProtectionFunctionNode";
  4606. CustomNode["DomainLockNode"] = "DomainLockNode";
  4607. CustomNode["NodeCallsControllerFunctionNode"] = "NodeCallsControllerFunctionNode";
  4608. CustomNode["SelfDefendingUnicodeNode"] = "SelfDefendingUnicodeNode";
  4609. CustomNode["StringArrayCallsWrapper"] = "StringArrayCallsWrapper";
  4610. CustomNode["StringArrayNode"] = "StringArrayNode";
  4611. CustomNode["StringArrayRotateFunctionNode"] = "StringArrayRotateFunctionNode";
  4612. })(CustomNode = exports.CustomNode || (exports.CustomNode = {}));
  4613. /***/ }),
  4614. /***/ "./src/enums/custom-nodes/CustomNodeGroup.ts":
  4615. /*!***************************************************!*\
  4616. !*** ./src/enums/custom-nodes/CustomNodeGroup.ts ***!
  4617. \***************************************************/
  4618. /*! no static exports found */
  4619. /***/ (function(module, exports, __webpack_require__) {
  4620. "use strict";
  4621. Object.defineProperty(exports, "__esModule", { value: true });
  4622. var CustomNodeGroup;
  4623. (function (CustomNodeGroup) {
  4624. CustomNodeGroup["ConsoleOutputCustomNodeGroup"] = "ConsoleOutputCustomNodeGroup";
  4625. CustomNodeGroup["DebugProtectionCustomNodeGroup"] = "DebugProtectionCustomNodeGroup";
  4626. CustomNodeGroup["DomainLockCustomNodeGroup"] = "DomainLockCustomNodeGroup";
  4627. CustomNodeGroup["SelfDefendingCustomNodeGroup"] = "SelfDefendingCustomNodeGroup";
  4628. CustomNodeGroup["StringArrayCustomNodeGroup"] = "StringArrayCustomNodeGroup";
  4629. })(CustomNodeGroup = exports.CustomNodeGroup || (exports.CustomNodeGroup = {}));
  4630. /***/ }),
  4631. /***/ "./src/enums/custom-nodes/DeadCodeInjectionCustomNode.ts":
  4632. /*!***************************************************************!*\
  4633. !*** ./src/enums/custom-nodes/DeadCodeInjectionCustomNode.ts ***!
  4634. \***************************************************************/
  4635. /*! no static exports found */
  4636. /***/ (function(module, exports, __webpack_require__) {
  4637. "use strict";
  4638. Object.defineProperty(exports, "__esModule", { value: true });
  4639. var DeadCodeInjectionCustomNode;
  4640. (function (DeadCodeInjectionCustomNode) {
  4641. DeadCodeInjectionCustomNode["BlockStatementDeadCodeInjectionNode"] = "BlockStatementDeadCodeInjectionNode";
  4642. })(DeadCodeInjectionCustomNode = exports.DeadCodeInjectionCustomNode || (exports.DeadCodeInjectionCustomNode = {}));
  4643. /***/ }),
  4644. /***/ "./src/enums/custom-nodes/ObjectExpressionKeysTransformerCustomNode.ts":
  4645. /*!*****************************************************************************!*\
  4646. !*** ./src/enums/custom-nodes/ObjectExpressionKeysTransformerCustomNode.ts ***!
  4647. \*****************************************************************************/
  4648. /*! no static exports found */
  4649. /***/ (function(module, exports, __webpack_require__) {
  4650. "use strict";
  4651. Object.defineProperty(exports, "__esModule", { value: true });
  4652. var ObjectExpressionKeysTransformerCustomNode;
  4653. (function (ObjectExpressionKeysTransformerCustomNode) {
  4654. ObjectExpressionKeysTransformerCustomNode["ObjectExpressionVariableDeclarationHostNode"] = "ObjectExpressionVariableDeclarationHostNode";
  4655. })(ObjectExpressionKeysTransformerCustomNode = exports.ObjectExpressionKeysTransformerCustomNode || (exports.ObjectExpressionKeysTransformerCustomNode = {}));
  4656. /***/ }),
  4657. /***/ "./src/enums/event-emitters/ObfuscationEvent.ts":
  4658. /*!******************************************************!*\
  4659. !*** ./src/enums/event-emitters/ObfuscationEvent.ts ***!
  4660. \******************************************************/
  4661. /*! no static exports found */
  4662. /***/ (function(module, exports, __webpack_require__) {
  4663. "use strict";
  4664. Object.defineProperty(exports, "__esModule", { value: true });
  4665. var ObfuscationEvent;
  4666. (function (ObfuscationEvent) {
  4667. ObfuscationEvent["AfterObfuscation"] = "afterObfuscation";
  4668. ObfuscationEvent["BeforeObfuscation"] = "beforeObfuscation";
  4669. })(ObfuscationEvent = exports.ObfuscationEvent || (exports.ObfuscationEvent = {}));
  4670. /***/ }),
  4671. /***/ "./src/enums/generators/identifier-names-generators/IdentifierNamesGenerator.ts":
  4672. /*!**************************************************************************************!*\
  4673. !*** ./src/enums/generators/identifier-names-generators/IdentifierNamesGenerator.ts ***!
  4674. \**************************************************************************************/
  4675. /*! no static exports found */
  4676. /***/ (function(module, exports, __webpack_require__) {
  4677. "use strict";
  4678. Object.defineProperty(exports, "__esModule", { value: true });
  4679. const tsenum_1 = __webpack_require__(/*! @gradecam/tsenum */ "@gradecam/tsenum");
  4680. exports.IdentifierNamesGenerator = tsenum_1.MakeEnum({
  4681. DictionaryIdentifierNamesGenerator: 'dictionary',
  4682. HexadecimalIdentifierNamesGenerator: 'hexadecimal',
  4683. MangledIdentifierNamesGenerator: 'mangled'
  4684. });
  4685. /***/ }),
  4686. /***/ "./src/enums/logger/LoggingMessage.ts":
  4687. /*!********************************************!*\
  4688. !*** ./src/enums/logger/LoggingMessage.ts ***!
  4689. \********************************************/
  4690. /*! no static exports found */
  4691. /***/ (function(module, exports, __webpack_require__) {
  4692. "use strict";
  4693. Object.defineProperty(exports, "__esModule", { value: true });
  4694. var LoggingMessage;
  4695. (function (LoggingMessage) {
  4696. LoggingMessage["EmptySourceCode"] = "Empty source code. Obfuscation canceled...";
  4697. LoggingMessage["ObfuscationCompleted"] = "Obfuscation completed. Total time: %s sec.";
  4698. LoggingMessage["ObfuscationStarted"] = "Obfuscation started...";
  4699. LoggingMessage["RandomGeneratorSeed"] = "Random generator seed: %s...";
  4700. LoggingMessage["TransformationStage"] = "Transformation stage: %s...";
  4701. LoggingMessage["Version"] = "Version: %s";
  4702. })(LoggingMessage = exports.LoggingMessage || (exports.LoggingMessage = {}));
  4703. /***/ }),
  4704. /***/ "./src/enums/logger/LoggingPrefix.ts":
  4705. /*!*******************************************!*\
  4706. !*** ./src/enums/logger/LoggingPrefix.ts ***!
  4707. \*******************************************/
  4708. /*! no static exports found */
  4709. /***/ (function(module, exports, __webpack_require__) {
  4710. "use strict";
  4711. Object.defineProperty(exports, "__esModule", { value: true });
  4712. var LoggingPrefix;
  4713. (function (LoggingPrefix) {
  4714. LoggingPrefix["Base"] = "[javascript-obfuscator]";
  4715. LoggingPrefix["CLI"] = "[javascript-obfuscator-cli]";
  4716. })(LoggingPrefix = exports.LoggingPrefix || (exports.LoggingPrefix = {}));
  4717. /***/ }),
  4718. /***/ "./src/enums/node-transformers/NodeTransformer.ts":
  4719. /*!********************************************************!*\
  4720. !*** ./src/enums/node-transformers/NodeTransformer.ts ***!
  4721. \********************************************************/
  4722. /*! no static exports found */
  4723. /***/ (function(module, exports, __webpack_require__) {
  4724. "use strict";
  4725. Object.defineProperty(exports, "__esModule", { value: true });
  4726. var NodeTransformer;
  4727. (function (NodeTransformer) {
  4728. NodeTransformer["BlockStatementControlFlowTransformer"] = "BlockStatementControlFlowTransformer";
  4729. NodeTransformer["CommentsTransformer"] = "CommentsTransformer";
  4730. NodeTransformer["CustomNodesTransformer"] = "CustomNodesTransformer";
  4731. NodeTransformer["DeadCodeInjectionTransformer"] = "DeadCodeInjectionTransformer";
  4732. NodeTransformer["EvalCallExpressionTransformer"] = "EvalCallExpressionTransformer";
  4733. NodeTransformer["FunctionControlFlowTransformer"] = "FunctionControlFlowTransformer";
  4734. NodeTransformer["LabeledStatementTransformer"] = "LabeledStatementTransformer";
  4735. NodeTransformer["LiteralTransformer"] = "LiteralTransformer";
  4736. NodeTransformer["MemberExpressionTransformer"] = "MemberExpressionTransformer";
  4737. NodeTransformer["MetadataTransformer"] = "MetadataTransformer";
  4738. NodeTransformer["MethodDefinitionTransformer"] = "MethodDefinitionTransformer";
  4739. NodeTransformer["ObfuscatingGuardsTransformer"] = "ObfuscatingGuardsTransformer";
  4740. NodeTransformer["ObjectExpressionKeysTransformer"] = "ObjectExpressionKeysTransformer";
  4741. NodeTransformer["ObjectExpressionTransformer"] = "ObjectExpressionTransformer";
  4742. NodeTransformer["ParentificationTransformer"] = "ParentificationTransformer";
  4743. NodeTransformer["ScopeIdentifiersTransformer"] = "ScopeIdentifiersTransformer";
  4744. NodeTransformer["SplitStringTransformer"] = "SplitStringTransformer";
  4745. NodeTransformer["TemplateLiteralTransformer"] = "TemplateLiteralTransformer";
  4746. NodeTransformer["VariablePreserveTransformer"] = "VariablePreserveTransformer";
  4747. })(NodeTransformer = exports.NodeTransformer || (exports.NodeTransformer = {}));
  4748. /***/ }),
  4749. /***/ "./src/enums/node-transformers/TransformationStage.ts":
  4750. /*!************************************************************!*\
  4751. !*** ./src/enums/node-transformers/TransformationStage.ts ***!
  4752. \************************************************************/
  4753. /*! no static exports found */
  4754. /***/ (function(module, exports, __webpack_require__) {
  4755. "use strict";
  4756. Object.defineProperty(exports, "__esModule", { value: true });
  4757. var TransformationStage;
  4758. (function (TransformationStage) {
  4759. TransformationStage["Initializing"] = "Initializing";
  4760. TransformationStage["Preparing"] = "Preparing";
  4761. TransformationStage["DeadCodeInjection"] = "DeadCodeInjection";
  4762. TransformationStage["ControlFlowFlattening"] = "ControlFlowFlattening";
  4763. TransformationStage["Converting"] = "Converting";
  4764. TransformationStage["Obfuscating"] = "Obfuscating";
  4765. TransformationStage["Finalizing"] = "Finalizing";
  4766. })(TransformationStage = exports.TransformationStage || (exports.TransformationStage = {}));
  4767. /***/ }),
  4768. /***/ "./src/enums/node-transformers/VisitorDirection.ts":
  4769. /*!*********************************************************!*\
  4770. !*** ./src/enums/node-transformers/VisitorDirection.ts ***!
  4771. \*********************************************************/
  4772. /*! no static exports found */
  4773. /***/ (function(module, exports, __webpack_require__) {
  4774. "use strict";
  4775. Object.defineProperty(exports, "__esModule", { value: true });
  4776. var VisitorDirection;
  4777. (function (VisitorDirection) {
  4778. VisitorDirection["Enter"] = "enter";
  4779. VisitorDirection["Leave"] = "leave";
  4780. })(VisitorDirection = exports.VisitorDirection || (exports.VisitorDirection = {}));
  4781. /***/ }),
  4782. /***/ "./src/enums/node-transformers/converting-transformers/properties-extractors/ObjectExpressionExtractor.ts":
  4783. /*!****************************************************************************************************************!*\
  4784. !*** ./src/enums/node-transformers/converting-transformers/properties-extractors/ObjectExpressionExtractor.ts ***!
  4785. \****************************************************************************************************************/
  4786. /*! no static exports found */
  4787. /***/ (function(module, exports, __webpack_require__) {
  4788. "use strict";
  4789. Object.defineProperty(exports, "__esModule", { value: true });
  4790. var ObjectExpressionExtractor;
  4791. (function (ObjectExpressionExtractor) {
  4792. ObjectExpressionExtractor["BasePropertiesExtractor"] = "BasePropertiesExtractor";
  4793. ObjectExpressionExtractor["ObjectExpressionToVariableDeclarationExtractor"] = "ObjectExpressionToVariableDeclarationExtractor";
  4794. })(ObjectExpressionExtractor = exports.ObjectExpressionExtractor || (exports.ObjectExpressionExtractor = {}));
  4795. /***/ }),
  4796. /***/ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/ControlFlowReplacer.ts":
  4797. /*!***********************************************************************************************************!*\
  4798. !*** ./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/ControlFlowReplacer.ts ***!
  4799. \***********************************************************************************************************/
  4800. /*! no static exports found */
  4801. /***/ (function(module, exports, __webpack_require__) {
  4802. "use strict";
  4803. Object.defineProperty(exports, "__esModule", { value: true });
  4804. var ControlFlowReplacer;
  4805. (function (ControlFlowReplacer) {
  4806. ControlFlowReplacer["BinaryExpressionControlFlowReplacer"] = "BinaryExpressionControlFlowReplacer";
  4807. ControlFlowReplacer["CallExpressionControlFlowReplacer"] = "CallExpressionControlFlowReplacer";
  4808. ControlFlowReplacer["LogicalExpressionControlFlowReplacer"] = "LogicalExpressionControlFlowReplacer";
  4809. ControlFlowReplacer["StringLiteralControlFlowReplacer"] = "StringLiteralControlFlowReplacer";
  4810. })(ControlFlowReplacer = exports.ControlFlowReplacer || (exports.ControlFlowReplacer = {}));
  4811. /***/ }),
  4812. /***/ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer.ts":
  4813. /*!*********************************************************************************************************************!*\
  4814. !*** ./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer.ts ***!
  4815. \*********************************************************************************************************************/
  4816. /*! no static exports found */
  4817. /***/ (function(module, exports, __webpack_require__) {
  4818. "use strict";
  4819. Object.defineProperty(exports, "__esModule", { value: true });
  4820. var IdentifierObfuscatingReplacer;
  4821. (function (IdentifierObfuscatingReplacer) {
  4822. IdentifierObfuscatingReplacer["BaseIdentifierObfuscatingReplacer"] = "BaseIdentifierObfuscatingReplacer";
  4823. })(IdentifierObfuscatingReplacer = exports.IdentifierObfuscatingReplacer || (exports.IdentifierObfuscatingReplacer = {}));
  4824. /***/ }),
  4825. /***/ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/LiteralObfuscatingReplacer.ts":
  4826. /*!******************************************************************************************************************!*\
  4827. !*** ./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/LiteralObfuscatingReplacer.ts ***!
  4828. \******************************************************************************************************************/
  4829. /*! no static exports found */
  4830. /***/ (function(module, exports, __webpack_require__) {
  4831. "use strict";
  4832. Object.defineProperty(exports, "__esModule", { value: true });
  4833. var LiteralObfuscatingReplacer;
  4834. (function (LiteralObfuscatingReplacer) {
  4835. LiteralObfuscatingReplacer["BooleanLiteralObfuscatingReplacer"] = "BooleanLiteralObfuscatingReplacer";
  4836. LiteralObfuscatingReplacer["NumberLiteralObfuscatingReplacer"] = "NumberLiteralObfuscatingReplacer";
  4837. LiteralObfuscatingReplacer["StringLiteralObfuscatingReplacer"] = "StringLiteralObfuscatingReplacer";
  4838. })(LiteralObfuscatingReplacer = exports.LiteralObfuscatingReplacer || (exports.LiteralObfuscatingReplacer = {}));
  4839. /***/ }),
  4840. /***/ "./src/enums/node-transformers/preparing-transformers/obfuscating-guards/ObfuscatingGuard.ts":
  4841. /*!***************************************************************************************************!*\
  4842. !*** ./src/enums/node-transformers/preparing-transformers/obfuscating-guards/ObfuscatingGuard.ts ***!
  4843. \***************************************************************************************************/
  4844. /*! no static exports found */
  4845. /***/ (function(module, exports, __webpack_require__) {
  4846. "use strict";
  4847. Object.defineProperty(exports, "__esModule", { value: true });
  4848. var ObfuscatingGuard;
  4849. (function (ObfuscatingGuard) {
  4850. ObfuscatingGuard["BlackListObfuscatingGuard"] = "BlackListObfuscatingGuard";
  4851. ObfuscatingGuard["ConditionalCommentObfuscatingGuard"] = "ConditionalCommentObfuscatingGuard";
  4852. ObfuscatingGuard["ReservedStringObfuscatingGuard"] = "ReservedStringObfuscatingGuard";
  4853. })(ObfuscatingGuard = exports.ObfuscatingGuard || (exports.ObfuscatingGuard = {}));
  4854. /***/ }),
  4855. /***/ "./src/enums/node/NodeType.ts":
  4856. /*!************************************!*\
  4857. !*** ./src/enums/node/NodeType.ts ***!
  4858. \************************************/
  4859. /*! no static exports found */
  4860. /***/ (function(module, exports, __webpack_require__) {
  4861. "use strict";
  4862. Object.defineProperty(exports, "__esModule", { value: true });
  4863. var NodeType;
  4864. (function (NodeType) {
  4865. NodeType["ArrayExpression"] = "ArrayExpression";
  4866. NodeType["ArrayPattern"] = "ArrayPattern";
  4867. NodeType["ArrowFunctionExpression"] = "ArrowFunctionExpression";
  4868. NodeType["AssignmentExpression"] = "AssignmentExpression";
  4869. NodeType["AssignmentPattern"] = "AssignmentPattern";
  4870. NodeType["AwaitExpression"] = "AwaitExpression";
  4871. NodeType["BinaryExpression"] = "BinaryExpression";
  4872. NodeType["BlockStatement"] = "BlockStatement";
  4873. NodeType["BreakStatement"] = "BreakStatement";
  4874. NodeType["CallExpression"] = "CallExpression";
  4875. NodeType["CatchClause"] = "CatchClause";
  4876. NodeType["ClassDeclaration"] = "ClassDeclaration";
  4877. NodeType["ConditionalExpression"] = "ConditionalExpression";
  4878. NodeType["ContinueStatement"] = "ContinueStatement";
  4879. NodeType["ExportNamedDeclaration"] = "ExportNamedDeclaration";
  4880. NodeType["ExpressionStatement"] = "ExpressionStatement";
  4881. NodeType["ForStatement"] = "ForStatement";
  4882. NodeType["ForInStatement"] = "ForInStatement";
  4883. NodeType["ForOfStatement"] = "ForOfStatement";
  4884. NodeType["FunctionDeclaration"] = "FunctionDeclaration";
  4885. NodeType["FunctionExpression"] = "FunctionExpression";
  4886. NodeType["Identifier"] = "Identifier";
  4887. NodeType["IfStatement"] = "IfStatement";
  4888. NodeType["ImportDeclaration"] = "ImportDeclaration";
  4889. NodeType["ImportDefaultSpecifier"] = "ImportDefaultSpecifier";
  4890. NodeType["ImportNamespaceSpecifier"] = "ImportNamespaceSpecifier";
  4891. NodeType["ImportSpecifier"] = "ImportSpecifier";
  4892. NodeType["LabeledStatement"] = "LabeledStatement";
  4893. NodeType["Literal"] = "Literal";
  4894. NodeType["LogicalExpression"] = "LogicalExpression";
  4895. NodeType["MemberExpression"] = "MemberExpression";
  4896. NodeType["MethodDefinition"] = "MethodDefinition";
  4897. NodeType["ObjectExpression"] = "ObjectExpression";
  4898. NodeType["ObjectPattern"] = "ObjectPattern";
  4899. NodeType["Program"] = "Program";
  4900. NodeType["Property"] = "Property";
  4901. NodeType["RestElement"] = "RestElement";
  4902. NodeType["ReturnStatement"] = "ReturnStatement";
  4903. NodeType["SequenceExpression"] = "SequenceExpression";
  4904. NodeType["Super"] = "Super";
  4905. NodeType["SwitchCase"] = "SwitchCase";
  4906. NodeType["SwitchStatement"] = "SwitchStatement";
  4907. NodeType["TaggedTemplateExpression"] = "TaggedTemplateExpression";
  4908. NodeType["TemplateLiteral"] = "TemplateLiteral";
  4909. NodeType["TryStatement"] = "TryStatement";
  4910. NodeType["UnaryExpression"] = "UnaryExpression";
  4911. NodeType["UpdateExpression"] = "UpdateExpression";
  4912. NodeType["VariableDeclaration"] = "VariableDeclaration";
  4913. NodeType["VariableDeclarator"] = "VariableDeclarator";
  4914. NodeType["WhileStatement"] = "WhileStatement";
  4915. })(NodeType = exports.NodeType || (exports.NodeType = {}));
  4916. /***/ }),
  4917. /***/ "./src/enums/source-map/SourceMapMode.ts":
  4918. /*!***********************************************!*\
  4919. !*** ./src/enums/source-map/SourceMapMode.ts ***!
  4920. \***********************************************/
  4921. /*! no static exports found */
  4922. /***/ (function(module, exports, __webpack_require__) {
  4923. "use strict";
  4924. Object.defineProperty(exports, "__esModule", { value: true });
  4925. const tsenum_1 = __webpack_require__(/*! @gradecam/tsenum */ "@gradecam/tsenum");
  4926. exports.SourceMapMode = tsenum_1.MakeEnum({
  4927. Inline: 'inline',
  4928. Separate: 'separate'
  4929. });
  4930. /***/ }),
  4931. /***/ "./src/event-emitters/ObfuscationEventEmitter.ts":
  4932. /*!*******************************************************!*\
  4933. !*** ./src/event-emitters/ObfuscationEventEmitter.ts ***!
  4934. \*******************************************************/
  4935. /*! no static exports found */
  4936. /***/ (function(module, exports, __webpack_require__) {
  4937. "use strict";
  4938. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  4939. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4940. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4941. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  4942. return c > 3 && r && Object.defineProperty(target, key, r), r;
  4943. };
  4944. var __importDefault = (this && this.__importDefault) || function (mod) {
  4945. return (mod && mod.__esModule) ? mod : { "default": mod };
  4946. };
  4947. Object.defineProperty(exports, "__esModule", { value: true });
  4948. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  4949. const eventemitter3_1 = __importDefault(__webpack_require__(/*! eventemitter3 */ "eventemitter3"));
  4950. inversify_1.decorate(inversify_1.injectable(), eventemitter3_1.default);
  4951. let ObfuscationEventEmitter = class ObfuscationEventEmitter extends eventemitter3_1.default {
  4952. };
  4953. ObfuscationEventEmitter = __decorate([
  4954. inversify_1.injectable()
  4955. ], ObfuscationEventEmitter);
  4956. exports.ObfuscationEventEmitter = ObfuscationEventEmitter;
  4957. /***/ }),
  4958. /***/ "./src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts":
  4959. /*!****************************************************************************************!*\
  4960. !*** ./src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts ***!
  4961. \****************************************************************************************/
  4962. /*! no static exports found */
  4963. /***/ (function(module, exports, __webpack_require__) {
  4964. "use strict";
  4965. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  4966. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4967. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4968. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  4969. return c > 3 && r && Object.defineProperty(target, key, r), r;
  4970. };
  4971. var __metadata = (this && this.__metadata) || function (k, v) {
  4972. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  4973. };
  4974. var __param = (this && this.__param) || function (paramIndex, decorator) {
  4975. return function (target, key) { decorator(target, key, paramIndex); }
  4976. };
  4977. var _a, _b;
  4978. Object.defineProperty(exports, "__esModule", { value: true });
  4979. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  4980. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  4981. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  4982. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  4983. let AbstractIdentifierNamesGenerator = class AbstractIdentifierNamesGenerator {
  4984. constructor(randomGenerator, options) {
  4985. this.preservedNamesSet = new Set();
  4986. this.randomGenerator = randomGenerator;
  4987. this.options = options;
  4988. }
  4989. preserveName(name) {
  4990. this.preservedNamesSet.add(name);
  4991. }
  4992. isValidIdentifierName(name) {
  4993. return this.notReservedName(name) && !this.preservedNamesSet.has(name);
  4994. }
  4995. notReservedName(name) {
  4996. return this.options.reservedNames.length
  4997. ? !this.options.reservedNames.some((reservedName) => new RegExp(reservedName, 'g').exec(name) !== null)
  4998. : true;
  4999. }
  5000. };
  5001. AbstractIdentifierNamesGenerator = __decorate([
  5002. inversify_1.injectable(),
  5003. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  5004. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  5005. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  5006. ], AbstractIdentifierNamesGenerator);
  5007. exports.AbstractIdentifierNamesGenerator = AbstractIdentifierNamesGenerator;
  5008. /***/ }),
  5009. /***/ "./src/generators/identifier-names-generators/DictionaryIdentifierNamesGenerator.ts":
  5010. /*!******************************************************************************************!*\
  5011. !*** ./src/generators/identifier-names-generators/DictionaryIdentifierNamesGenerator.ts ***!
  5012. \******************************************************************************************/
  5013. /*! no static exports found */
  5014. /***/ (function(module, exports, __webpack_require__) {
  5015. "use strict";
  5016. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  5017. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  5018. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5019. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5020. return c > 3 && r && Object.defineProperty(target, key, r), r;
  5021. };
  5022. var __metadata = (this && this.__metadata) || function (k, v) {
  5023. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  5024. };
  5025. var __param = (this && this.__param) || function (paramIndex, decorator) {
  5026. return function (target, key) { decorator(target, key, paramIndex); }
  5027. };
  5028. var DictionaryIdentifierNamesGenerator_1, _a, _b, _c;
  5029. Object.defineProperty(exports, "__esModule", { value: true });
  5030. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  5031. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  5032. const IArrayUtils_1 = __webpack_require__(/*! ../../interfaces/utils/IArrayUtils */ "./src/interfaces/utils/IArrayUtils.ts");
  5033. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  5034. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  5035. const AbstractIdentifierNamesGenerator_1 = __webpack_require__(/*! ./AbstractIdentifierNamesGenerator */ "./src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts");
  5036. let DictionaryIdentifierNamesGenerator = DictionaryIdentifierNamesGenerator_1 = class DictionaryIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator_1.AbstractIdentifierNamesGenerator {
  5037. constructor(randomGenerator, options, arrayUtils) {
  5038. super(randomGenerator, options);
  5039. this.arrayUtils = arrayUtils;
  5040. this.identifierNamesSet = new Set(this.getInitialIdentifierNames(this.options.identifiersDictionary));
  5041. this.identifiersIterator = this.identifierNamesSet.values();
  5042. }
  5043. static incrementIdentifierName(identifierName) {
  5044. let newIdentifierName = '';
  5045. let isSuccess = false;
  5046. for (const character of identifierName) {
  5047. if (!isSuccess && character === character.toUpperCase()) {
  5048. newIdentifierName += character.toLowerCase();
  5049. }
  5050. else if (!isSuccess && character === character.toLowerCase()) {
  5051. newIdentifierName += character.toUpperCase();
  5052. isSuccess = true;
  5053. }
  5054. else {
  5055. newIdentifierName += character;
  5056. }
  5057. }
  5058. if (isSuccess) {
  5059. return newIdentifierName;
  5060. }
  5061. return null;
  5062. }
  5063. generate() {
  5064. if (!this.identifierNamesSet.size) {
  5065. throw new Error('Too many identifiers in the code, add more words to identifiers dictionary');
  5066. }
  5067. const iteratorResult = this.identifiersIterator.next();
  5068. if (!iteratorResult.done) {
  5069. return iteratorResult.value;
  5070. }
  5071. this.identifierNamesSet = new Set(this.getIncrementedIdentifierNames([...this.identifierNamesSet]));
  5072. this.identifiersIterator = this.identifierNamesSet.values();
  5073. return this.generate();
  5074. }
  5075. generateWithPrefix() {
  5076. const prefix = this.options.identifiersPrefix ?
  5077. `${this.options.identifiersPrefix}_`
  5078. : '';
  5079. const identifierName = this.generate();
  5080. return `${prefix}${identifierName}`.replace('__', '_');
  5081. }
  5082. getInitialIdentifierNames(identifierNames) {
  5083. const formattedIdentifierNames = identifierNames
  5084. .filter(Boolean)
  5085. .map((identifierName) => identifierName.toLowerCase());
  5086. return this.arrayUtils.shuffle(formattedIdentifierNames);
  5087. }
  5088. getIncrementedIdentifierNames(identifierNames) {
  5089. const formattedIdentifierNames = [];
  5090. for (const identifierName of identifierNames) {
  5091. const newIdentifierName = DictionaryIdentifierNamesGenerator_1
  5092. .incrementIdentifierName(identifierName);
  5093. if (newIdentifierName) {
  5094. formattedIdentifierNames.push(newIdentifierName);
  5095. }
  5096. }
  5097. return this.arrayUtils.shuffle(formattedIdentifierNames);
  5098. }
  5099. };
  5100. DictionaryIdentifierNamesGenerator = DictionaryIdentifierNamesGenerator_1 = __decorate([
  5101. inversify_1.injectable(),
  5102. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  5103. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  5104. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils)),
  5105. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object, typeof (_c = typeof IArrayUtils_1.IArrayUtils !== "undefined" && IArrayUtils_1.IArrayUtils) === "function" ? _c : Object])
  5106. ], DictionaryIdentifierNamesGenerator);
  5107. exports.DictionaryIdentifierNamesGenerator = DictionaryIdentifierNamesGenerator;
  5108. /***/ }),
  5109. /***/ "./src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts":
  5110. /*!*******************************************************************************************!*\
  5111. !*** ./src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.ts ***!
  5112. \*******************************************************************************************/
  5113. /*! no static exports found */
  5114. /***/ (function(module, exports, __webpack_require__) {
  5115. "use strict";
  5116. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  5117. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  5118. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5119. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5120. return c > 3 && r && Object.defineProperty(target, key, r), r;
  5121. };
  5122. var __metadata = (this && this.__metadata) || function (k, v) {
  5123. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  5124. };
  5125. var __param = (this && this.__param) || function (paramIndex, decorator) {
  5126. return function (target, key) { decorator(target, key, paramIndex); }
  5127. };
  5128. var HexadecimalIdentifierNamesGenerator_1, _a, _b;
  5129. Object.defineProperty(exports, "__esModule", { value: true });
  5130. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  5131. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  5132. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  5133. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  5134. const AbstractIdentifierNamesGenerator_1 = __webpack_require__(/*! ./AbstractIdentifierNamesGenerator */ "./src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts");
  5135. const NumberUtils_1 = __webpack_require__(/*! ../../utils/NumberUtils */ "./src/utils/NumberUtils.ts");
  5136. const Utils_1 = __webpack_require__(/*! ../../utils/Utils */ "./src/utils/Utils.ts");
  5137. let HexadecimalIdentifierNamesGenerator = HexadecimalIdentifierNamesGenerator_1 = class HexadecimalIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator_1.AbstractIdentifierNamesGenerator {
  5138. constructor(randomGenerator, options) {
  5139. super(randomGenerator, options);
  5140. this.randomVariableNameSet = new Set();
  5141. }
  5142. generate(nameLength) {
  5143. const rangeMinInteger = 10000;
  5144. const rangeMaxInteger = 99999999;
  5145. const randomInteger = this.randomGenerator.getRandomInteger(rangeMinInteger, rangeMaxInteger);
  5146. const hexadecimalNumber = NumberUtils_1.NumberUtils.toHex(randomInteger);
  5147. const prefixLength = Utils_1.Utils.hexadecimalPrefix.length + 1;
  5148. const baseNameLength = nameLength
  5149. ? nameLength - prefixLength
  5150. : HexadecimalIdentifierNamesGenerator_1.baseIdentifierNameLength;
  5151. const baseIdentifierName = hexadecimalNumber.substr(0, baseNameLength);
  5152. const identifierName = `_${Utils_1.Utils.hexadecimalPrefix}${baseIdentifierName}`;
  5153. if (this.randomVariableNameSet.has(identifierName)) {
  5154. return this.generate(nameLength);
  5155. }
  5156. this.randomVariableNameSet.add(identifierName);
  5157. return identifierName;
  5158. }
  5159. generateWithPrefix(nameLength) {
  5160. const identifierName = this.generate(nameLength);
  5161. return `${this.options.identifiersPrefix}${identifierName}`.replace('__', '_');
  5162. }
  5163. };
  5164. HexadecimalIdentifierNamesGenerator.baseIdentifierNameLength = 6;
  5165. HexadecimalIdentifierNamesGenerator = HexadecimalIdentifierNamesGenerator_1 = __decorate([
  5166. inversify_1.injectable(),
  5167. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  5168. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  5169. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  5170. ], HexadecimalIdentifierNamesGenerator);
  5171. exports.HexadecimalIdentifierNamesGenerator = HexadecimalIdentifierNamesGenerator;
  5172. /***/ }),
  5173. /***/ "./src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts":
  5174. /*!***************************************************************************************!*\
  5175. !*** ./src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.ts ***!
  5176. \***************************************************************************************/
  5177. /*! no static exports found */
  5178. /***/ (function(module, exports, __webpack_require__) {
  5179. "use strict";
  5180. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  5181. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  5182. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5183. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5184. return c > 3 && r && Object.defineProperty(target, key, r), r;
  5185. };
  5186. var __metadata = (this && this.__metadata) || function (k, v) {
  5187. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  5188. };
  5189. var __param = (this && this.__param) || function (paramIndex, decorator) {
  5190. return function (target, key) { decorator(target, key, paramIndex); }
  5191. };
  5192. var MangledIdentifierNamesGenerator_1, _a, _b;
  5193. Object.defineProperty(exports, "__esModule", { value: true });
  5194. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  5195. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  5196. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  5197. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  5198. const AbstractIdentifierNamesGenerator_1 = __webpack_require__(/*! ./AbstractIdentifierNamesGenerator */ "./src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.ts");
  5199. let MangledIdentifierNamesGenerator = MangledIdentifierNamesGenerator_1 = class MangledIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator_1.AbstractIdentifierNamesGenerator {
  5200. constructor(randomGenerator, options) {
  5201. super(randomGenerator, options);
  5202. this.previousMangledName = MangledIdentifierNamesGenerator_1.initMangledNameCharacter;
  5203. }
  5204. generate(nameLength) {
  5205. const identifierName = this.generateNewMangledName(this.previousMangledName);
  5206. this.previousMangledName = identifierName;
  5207. return identifierName;
  5208. }
  5209. generateWithPrefix(nameLength) {
  5210. const prefix = this.options.identifiersPrefix ?
  5211. `${this.options.identifiersPrefix}_`
  5212. : '';
  5213. const identifierName = this.generate(nameLength);
  5214. return `${prefix}${identifierName}`;
  5215. }
  5216. isValidIdentifierName(mangledName) {
  5217. return super.isValidIdentifierName(mangledName)
  5218. && !MangledIdentifierNamesGenerator_1.reservedNamesSet.has(mangledName);
  5219. }
  5220. generateNewMangledName(previousMangledName) {
  5221. const generateNewMangledName = (name) => {
  5222. const nameSequence = MangledIdentifierNamesGenerator_1.nameSequence;
  5223. const nameSequenceLength = nameSequence.length;
  5224. const nameLength = name.length;
  5225. const zeroSequence = (num) => {
  5226. return '0'.repeat(num);
  5227. };
  5228. let index = nameLength - 1;
  5229. do {
  5230. const character = name[index];
  5231. const indexInSequence = nameSequence.indexOf(character);
  5232. const lastNameSequenceIndex = nameSequenceLength - 1;
  5233. if (indexInSequence !== lastNameSequenceIndex) {
  5234. const previousNamePart = name.substring(0, index);
  5235. const nextCharacter = nameSequence[indexInSequence + 1];
  5236. const zeroSequenceLength = nameLength - (index + 1);
  5237. const zeroSequenceCharacters = zeroSequence(zeroSequenceLength);
  5238. return previousNamePart + nextCharacter + zeroSequenceCharacters;
  5239. }
  5240. --index;
  5241. } while (index >= 0);
  5242. return `a${zeroSequence(nameLength)}`;
  5243. };
  5244. let newMangledName = generateNewMangledName(previousMangledName);
  5245. if (!this.isValidIdentifierName(newMangledName)) {
  5246. newMangledName = this.generateNewMangledName(newMangledName);
  5247. }
  5248. return newMangledName;
  5249. }
  5250. };
  5251. MangledIdentifierNamesGenerator.initMangledNameCharacter = '9';
  5252. MangledIdentifierNamesGenerator.nameSequence = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
  5253. MangledIdentifierNamesGenerator.reservedNamesSet = new Set([
  5254. 'byte', 'case', 'char', 'do', 'else', 'enum', 'eval', 'for', 'goto',
  5255. 'if', 'in', 'int', 'let', 'long', 'new', 'null', 'this', 'true', 'try',
  5256. 'var', 'void', 'with'
  5257. ]);
  5258. MangledIdentifierNamesGenerator = MangledIdentifierNamesGenerator_1 = __decorate([
  5259. inversify_1.injectable(),
  5260. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  5261. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  5262. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  5263. ], MangledIdentifierNamesGenerator);
  5264. exports.MangledIdentifierNamesGenerator = MangledIdentifierNamesGenerator;
  5265. /***/ }),
  5266. /***/ "./src/interfaces/analyzers/calls-graph-analyzer/ICallsGraphAnalyzer.ts":
  5267. /*!******************************************************************************!*\
  5268. !*** ./src/interfaces/analyzers/calls-graph-analyzer/ICallsGraphAnalyzer.ts ***!
  5269. \******************************************************************************/
  5270. /*! no static exports found */
  5271. /***/ (function(module, exports, __webpack_require__) {
  5272. "use strict";
  5273. Object.defineProperty(exports, "__esModule", { value: true });
  5274. /***/ }),
  5275. /***/ "./src/interfaces/analyzers/calls-graph-analyzer/IPrevailingKindOfVariablesAnalyzer.ts":
  5276. /*!*********************************************************************************************!*\
  5277. !*** ./src/interfaces/analyzers/calls-graph-analyzer/IPrevailingKindOfVariablesAnalyzer.ts ***!
  5278. \*********************************************************************************************/
  5279. /*! no static exports found */
  5280. /***/ (function(module, exports, __webpack_require__) {
  5281. "use strict";
  5282. Object.defineProperty(exports, "__esModule", { value: true });
  5283. /***/ }),
  5284. /***/ "./src/interfaces/analyzers/scope-analyzer/IScopeAnalyzer.ts":
  5285. /*!*******************************************************************!*\
  5286. !*** ./src/interfaces/analyzers/scope-analyzer/IScopeAnalyzer.ts ***!
  5287. \*******************************************************************/
  5288. /*! no static exports found */
  5289. /***/ (function(module, exports, __webpack_require__) {
  5290. "use strict";
  5291. Object.defineProperty(exports, "__esModule", { value: true });
  5292. /***/ }),
  5293. /***/ "./src/interfaces/analyzers/string-array-storage-analyzer/IStringArrayStorageAnalyzer.ts":
  5294. /*!***********************************************************************************************!*\
  5295. !*** ./src/interfaces/analyzers/string-array-storage-analyzer/IStringArrayStorageAnalyzer.ts ***!
  5296. \***********************************************************************************************/
  5297. /*! no static exports found */
  5298. /***/ (function(module, exports, __webpack_require__) {
  5299. "use strict";
  5300. Object.defineProperty(exports, "__esModule", { value: true });
  5301. /***/ }),
  5302. /***/ "./src/interfaces/custom-nodes/ICustomNodeFormatter.ts":
  5303. /*!*************************************************************!*\
  5304. !*** ./src/interfaces/custom-nodes/ICustomNodeFormatter.ts ***!
  5305. \*************************************************************/
  5306. /*! no static exports found */
  5307. /***/ (function(module, exports, __webpack_require__) {
  5308. "use strict";
  5309. Object.defineProperty(exports, "__esModule", { value: true });
  5310. /***/ }),
  5311. /***/ "./src/interfaces/event-emitters/IObfuscationEventEmitter.ts":
  5312. /*!*******************************************************************!*\
  5313. !*** ./src/interfaces/event-emitters/IObfuscationEventEmitter.ts ***!
  5314. \*******************************************************************/
  5315. /*! no static exports found */
  5316. /***/ (function(module, exports, __webpack_require__) {
  5317. "use strict";
  5318. Object.defineProperty(exports, "__esModule", { value: true });
  5319. /***/ }),
  5320. /***/ "./src/interfaces/logger/ILogger.ts":
  5321. /*!******************************************!*\
  5322. !*** ./src/interfaces/logger/ILogger.ts ***!
  5323. \******************************************/
  5324. /*! no static exports found */
  5325. /***/ (function(module, exports, __webpack_require__) {
  5326. "use strict";
  5327. Object.defineProperty(exports, "__esModule", { value: true });
  5328. /***/ }),
  5329. /***/ "./src/interfaces/node-transformers/ITransformersRunner.ts":
  5330. /*!*****************************************************************!*\
  5331. !*** ./src/interfaces/node-transformers/ITransformersRunner.ts ***!
  5332. \*****************************************************************/
  5333. /*! no static exports found */
  5334. /***/ (function(module, exports, __webpack_require__) {
  5335. "use strict";
  5336. Object.defineProperty(exports, "__esModule", { value: true });
  5337. /***/ }),
  5338. /***/ "./src/interfaces/options/IOptions.ts":
  5339. /*!********************************************!*\
  5340. !*** ./src/interfaces/options/IOptions.ts ***!
  5341. \********************************************/
  5342. /*! no static exports found */
  5343. /***/ (function(module, exports, __webpack_require__) {
  5344. "use strict";
  5345. Object.defineProperty(exports, "__esModule", { value: true });
  5346. /***/ }),
  5347. /***/ "./src/interfaces/options/IOptionsNormalizer.ts":
  5348. /*!******************************************************!*\
  5349. !*** ./src/interfaces/options/IOptionsNormalizer.ts ***!
  5350. \******************************************************/
  5351. /*! no static exports found */
  5352. /***/ (function(module, exports, __webpack_require__) {
  5353. "use strict";
  5354. Object.defineProperty(exports, "__esModule", { value: true });
  5355. /***/ }),
  5356. /***/ "./src/interfaces/source-code/ISourceCode.ts":
  5357. /*!***************************************************!*\
  5358. !*** ./src/interfaces/source-code/ISourceCode.ts ***!
  5359. \***************************************************/
  5360. /*! no static exports found */
  5361. /***/ (function(module, exports, __webpack_require__) {
  5362. "use strict";
  5363. Object.defineProperty(exports, "__esModule", { value: true });
  5364. /***/ }),
  5365. /***/ "./src/interfaces/storages/string-array-storage/IStringArrayStorage.ts":
  5366. /*!*****************************************************************************!*\
  5367. !*** ./src/interfaces/storages/string-array-storage/IStringArrayStorage.ts ***!
  5368. \*****************************************************************************/
  5369. /*! no static exports found */
  5370. /***/ (function(module, exports, __webpack_require__) {
  5371. "use strict";
  5372. Object.defineProperty(exports, "__esModule", { value: true });
  5373. /***/ }),
  5374. /***/ "./src/interfaces/utils/IArrayUtils.ts":
  5375. /*!*********************************************!*\
  5376. !*** ./src/interfaces/utils/IArrayUtils.ts ***!
  5377. \*********************************************/
  5378. /*! no static exports found */
  5379. /***/ (function(module, exports, __webpack_require__) {
  5380. "use strict";
  5381. Object.defineProperty(exports, "__esModule", { value: true });
  5382. /***/ }),
  5383. /***/ "./src/interfaces/utils/ICryptUtils.ts":
  5384. /*!*********************************************!*\
  5385. !*** ./src/interfaces/utils/ICryptUtils.ts ***!
  5386. \*********************************************/
  5387. /*! no static exports found */
  5388. /***/ (function(module, exports, __webpack_require__) {
  5389. "use strict";
  5390. Object.defineProperty(exports, "__esModule", { value: true });
  5391. /***/ }),
  5392. /***/ "./src/interfaces/utils/IEscapeSequenceEncoder.ts":
  5393. /*!********************************************************!*\
  5394. !*** ./src/interfaces/utils/IEscapeSequenceEncoder.ts ***!
  5395. \********************************************************/
  5396. /*! no static exports found */
  5397. /***/ (function(module, exports, __webpack_require__) {
  5398. "use strict";
  5399. Object.defineProperty(exports, "__esModule", { value: true });
  5400. /***/ }),
  5401. /***/ "./src/interfaces/utils/ILevelledTopologicalSorter.ts":
  5402. /*!************************************************************!*\
  5403. !*** ./src/interfaces/utils/ILevelledTopologicalSorter.ts ***!
  5404. \************************************************************/
  5405. /*! no static exports found */
  5406. /***/ (function(module, exports, __webpack_require__) {
  5407. "use strict";
  5408. Object.defineProperty(exports, "__esModule", { value: true });
  5409. /***/ }),
  5410. /***/ "./src/interfaces/utils/INodeTransformerNamesGroupsBuilder.ts":
  5411. /*!********************************************************************!*\
  5412. !*** ./src/interfaces/utils/INodeTransformerNamesGroupsBuilder.ts ***!
  5413. \********************************************************************/
  5414. /*! no static exports found */
  5415. /***/ (function(module, exports, __webpack_require__) {
  5416. "use strict";
  5417. Object.defineProperty(exports, "__esModule", { value: true });
  5418. /***/ }),
  5419. /***/ "./src/interfaces/utils/IRandomGenerator.ts":
  5420. /*!**************************************************!*\
  5421. !*** ./src/interfaces/utils/IRandomGenerator.ts ***!
  5422. \**************************************************/
  5423. /*! no static exports found */
  5424. /***/ (function(module, exports, __webpack_require__) {
  5425. "use strict";
  5426. Object.defineProperty(exports, "__esModule", { value: true });
  5427. /***/ }),
  5428. /***/ "./src/logger/Logger.ts":
  5429. /*!******************************!*\
  5430. !*** ./src/logger/Logger.ts ***!
  5431. \******************************/
  5432. /*! no static exports found */
  5433. /***/ (function(module, exports, __webpack_require__) {
  5434. "use strict";
  5435. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  5436. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  5437. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5438. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5439. return c > 3 && r && Object.defineProperty(target, key, r), r;
  5440. };
  5441. var __metadata = (this && this.__metadata) || function (k, v) {
  5442. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  5443. };
  5444. var __param = (this && this.__param) || function (paramIndex, decorator) {
  5445. return function (target, key) { decorator(target, key, paramIndex); }
  5446. };
  5447. var __importDefault = (this && this.__importDefault) || function (mod) {
  5448. return (mod && mod.__esModule) ? mod : { "default": mod };
  5449. };
  5450. var Logger_1, _a;
  5451. Object.defineProperty(exports, "__esModule", { value: true });
  5452. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  5453. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  5454. const chalk_1 = __importDefault(__webpack_require__(/*! chalk */ "chalk"));
  5455. const IOptions_1 = __webpack_require__(/*! ../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  5456. const LoggingPrefix_1 = __webpack_require__(/*! ../enums/logger/LoggingPrefix */ "./src/enums/logger/LoggingPrefix.ts");
  5457. let Logger = Logger_1 = class Logger {
  5458. constructor(options) {
  5459. this.options = options;
  5460. }
  5461. static log(loggingLevelColor, loggingPrefix, loggingMessage, value) {
  5462. const processedMessage = loggingLevelColor(`\n${loggingPrefix} ${loggingMessage}`);
  5463. console.log(processedMessage, value !== null && value !== void 0 ? value : '');
  5464. }
  5465. info(loggingMessage, value) {
  5466. if (!this.options.log) {
  5467. return;
  5468. }
  5469. Logger_1.log(Logger_1.colorInfo, LoggingPrefix_1.LoggingPrefix.Base, loggingMessage, value);
  5470. }
  5471. success(loggingMessage, value) {
  5472. if (!this.options.log) {
  5473. return;
  5474. }
  5475. Logger_1.log(Logger_1.colorSuccess, LoggingPrefix_1.LoggingPrefix.Base, loggingMessage, value);
  5476. }
  5477. warn(loggingMessage, value) {
  5478. if (!this.options.log) {
  5479. return;
  5480. }
  5481. Logger_1.log(Logger_1.colorWarn, LoggingPrefix_1.LoggingPrefix.Base, loggingMessage, value);
  5482. }
  5483. };
  5484. Logger.colorInfo = chalk_1.default.cyan;
  5485. Logger.colorSuccess = chalk_1.default.green;
  5486. Logger.colorWarn = chalk_1.default.yellow;
  5487. Logger = Logger_1 = __decorate([
  5488. inversify_1.injectable(),
  5489. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  5490. __metadata("design:paramtypes", [typeof (_a = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _a : Object])
  5491. ], Logger);
  5492. exports.Logger = Logger;
  5493. /***/ }),
  5494. /***/ "./src/node-transformers/AbstractNodeTransformer.ts":
  5495. /*!**********************************************************!*\
  5496. !*** ./src/node-transformers/AbstractNodeTransformer.ts ***!
  5497. \**********************************************************/
  5498. /*! no static exports found */
  5499. /***/ (function(module, exports, __webpack_require__) {
  5500. "use strict";
  5501. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  5502. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  5503. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5504. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5505. return c > 3 && r && Object.defineProperty(target, key, r), r;
  5506. };
  5507. var __metadata = (this && this.__metadata) || function (k, v) {
  5508. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  5509. };
  5510. var __param = (this && this.__param) || function (paramIndex, decorator) {
  5511. return function (target, key) { decorator(target, key, paramIndex); }
  5512. };
  5513. var _a, _b;
  5514. Object.defineProperty(exports, "__esModule", { value: true });
  5515. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  5516. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  5517. const IOptions_1 = __webpack_require__(/*! ../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  5518. const IRandomGenerator_1 = __webpack_require__(/*! ../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  5519. let AbstractNodeTransformer = class AbstractNodeTransformer {
  5520. constructor(randomGenerator, options) {
  5521. this.randomGenerator = randomGenerator;
  5522. this.options = options;
  5523. }
  5524. };
  5525. AbstractNodeTransformer = __decorate([
  5526. inversify_1.injectable(),
  5527. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  5528. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  5529. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  5530. ], AbstractNodeTransformer);
  5531. exports.AbstractNodeTransformer = AbstractNodeTransformer;
  5532. /***/ }),
  5533. /***/ "./src/node-transformers/TransformersRunner.ts":
  5534. /*!*****************************************************!*\
  5535. !*** ./src/node-transformers/TransformersRunner.ts ***!
  5536. \*****************************************************/
  5537. /*! no static exports found */
  5538. /***/ (function(module, exports, __webpack_require__) {
  5539. "use strict";
  5540. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  5541. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  5542. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5543. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5544. return c > 3 && r && Object.defineProperty(target, key, r), r;
  5545. };
  5546. var __metadata = (this && this.__metadata) || function (k, v) {
  5547. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  5548. };
  5549. var __param = (this && this.__param) || function (paramIndex, decorator) {
  5550. return function (target, key) { decorator(target, key, paramIndex); }
  5551. };
  5552. var __importStar = (this && this.__importStar) || function (mod) {
  5553. if (mod && mod.__esModule) return mod;
  5554. var result = {};
  5555. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  5556. result["default"] = mod;
  5557. return result;
  5558. };
  5559. var _a, _b;
  5560. Object.defineProperty(exports, "__esModule", { value: true });
  5561. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  5562. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  5563. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  5564. const TNodeTransformerFactory_1 = __webpack_require__(/*! ../types/container/node-transformers/TNodeTransformerFactory */ "./src/types/container/node-transformers/TNodeTransformerFactory.ts");
  5565. const INodeTransformerNamesGroupsBuilder_1 = __webpack_require__(/*! ../interfaces/utils/INodeTransformerNamesGroupsBuilder */ "./src/interfaces/utils/INodeTransformerNamesGroupsBuilder.ts");
  5566. const VisitorDirection_1 = __webpack_require__(/*! ../enums/node-transformers/VisitorDirection */ "./src/enums/node-transformers/VisitorDirection.ts");
  5567. const NodeGuards_1 = __webpack_require__(/*! ../node/NodeGuards */ "./src/node/NodeGuards.ts");
  5568. const NodeMetadata_1 = __webpack_require__(/*! ../node/NodeMetadata */ "./src/node/NodeMetadata.ts");
  5569. let TransformersRunner = class TransformersRunner {
  5570. constructor(nodeTransformerFactory, nodeTransformerNamesGroupsBuilder) {
  5571. this.cachedNodeTransformersData = new Map();
  5572. this.nodeTransformerFactory = nodeTransformerFactory;
  5573. this.nodeTransformerNamesGroupsBuilder = nodeTransformerNamesGroupsBuilder;
  5574. }
  5575. transform(astTree, nodeTransformerNames, transformationStage) {
  5576. if (!nodeTransformerNames.length) {
  5577. return astTree;
  5578. }
  5579. let normalizedNodeTransformers;
  5580. let nodeTransformerNamesGroups;
  5581. if (!this.cachedNodeTransformersData.has(nodeTransformerNames)) {
  5582. normalizedNodeTransformers = this.buildNormalizedNodeTransformers(nodeTransformerNames);
  5583. nodeTransformerNamesGroups = this.nodeTransformerNamesGroupsBuilder.build(normalizedNodeTransformers);
  5584. this.cachedNodeTransformersData.set(nodeTransformerNames, [normalizedNodeTransformers, nodeTransformerNamesGroups]);
  5585. }
  5586. else {
  5587. [
  5588. normalizedNodeTransformers,
  5589. nodeTransformerNamesGroups
  5590. ] = this.cachedNodeTransformersData.get(nodeTransformerNames);
  5591. }
  5592. for (const nodeTransformerNamesGroup of nodeTransformerNamesGroups) {
  5593. const enterVisitors = [];
  5594. const leaveVisitors = [];
  5595. for (const nodeTransformerName of nodeTransformerNamesGroup) {
  5596. const nodeTransformer = normalizedNodeTransformers[nodeTransformerName];
  5597. const visitor = nodeTransformer.getVisitor(transformationStage);
  5598. if (!visitor) {
  5599. continue;
  5600. }
  5601. if (visitor.enter) {
  5602. enterVisitors.push({ enter: visitor.enter });
  5603. }
  5604. if (visitor.leave) {
  5605. leaveVisitors.push({ leave: visitor.leave });
  5606. }
  5607. }
  5608. if (!enterVisitors.length && !leaveVisitors.length) {
  5609. continue;
  5610. }
  5611. estraverse.replace(astTree, {
  5612. enter: this.mergeVisitorsForDirection(enterVisitors, VisitorDirection_1.VisitorDirection.Enter),
  5613. leave: this.mergeVisitorsForDirection(leaveVisitors, VisitorDirection_1.VisitorDirection.Leave)
  5614. });
  5615. }
  5616. return astTree;
  5617. }
  5618. buildNormalizedNodeTransformers(nodeTransformerNames) {
  5619. return nodeTransformerNames
  5620. .reduce((acc, nodeTransformerName) => (Object.assign(Object.assign({}, acc), { [nodeTransformerName]: this.nodeTransformerFactory(nodeTransformerName) })), {});
  5621. }
  5622. mergeVisitorsForDirection(visitors, direction) {
  5623. const visitorsLength = visitors.length;
  5624. if (!visitorsLength) {
  5625. return (node, parentNode) => node;
  5626. }
  5627. return (node, parentNode) => {
  5628. if (NodeMetadata_1.NodeMetadata.isIgnoredNode(node)) {
  5629. return estraverse.VisitorOption.Skip;
  5630. }
  5631. for (let i = 0; i < visitorsLength; i++) {
  5632. const visitorFunction = visitors[i][direction];
  5633. if (!visitorFunction) {
  5634. continue;
  5635. }
  5636. const visitorResult = visitorFunction(node, parentNode);
  5637. if (!visitorResult || !NodeGuards_1.NodeGuards.isNode(visitorResult)) {
  5638. continue;
  5639. }
  5640. node = visitorResult;
  5641. }
  5642. return node;
  5643. };
  5644. }
  5645. };
  5646. TransformersRunner = __decorate([
  5647. inversify_1.injectable(),
  5648. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeTransformer)),
  5649. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.INodeTransformerNamesGroupsBuilder)),
  5650. __metadata("design:paramtypes", [typeof (_a = typeof TNodeTransformerFactory_1.TNodeTransformerFactory !== "undefined" && TNodeTransformerFactory_1.TNodeTransformerFactory) === "function" ? _a : Object, typeof (_b = typeof INodeTransformerNamesGroupsBuilder_1.INodeTransformerNamesGroupsBuilder !== "undefined" && INodeTransformerNamesGroupsBuilder_1.INodeTransformerNamesGroupsBuilder) === "function" ? _b : Object])
  5651. ], TransformersRunner);
  5652. exports.TransformersRunner = TransformersRunner;
  5653. /***/ }),
  5654. /***/ "./src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts":
  5655. /*!*************************************************************************************************!*\
  5656. !*** ./src/node-transformers/control-flow-transformers/BlockStatementControlFlowTransformer.ts ***!
  5657. \*************************************************************************************************/
  5658. /*! no static exports found */
  5659. /***/ (function(module, exports, __webpack_require__) {
  5660. "use strict";
  5661. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  5662. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  5663. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5664. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5665. return c > 3 && r && Object.defineProperty(target, key, r), r;
  5666. };
  5667. var __metadata = (this && this.__metadata) || function (k, v) {
  5668. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  5669. };
  5670. var __param = (this && this.__param) || function (paramIndex, decorator) {
  5671. return function (target, key) { decorator(target, key, paramIndex); }
  5672. };
  5673. var __importStar = (this && this.__importStar) || function (mod) {
  5674. if (mod && mod.__esModule) return mod;
  5675. var result = {};
  5676. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  5677. result["default"] = mod;
  5678. return result;
  5679. };
  5680. var BlockStatementControlFlowTransformer_1, _a, _b, _c, _d;
  5681. Object.defineProperty(exports, "__esModule", { value: true });
  5682. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  5683. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  5684. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  5685. const TControlFlowCustomNodeFactory_1 = __webpack_require__(/*! ../../types/container/custom-nodes/TControlFlowCustomNodeFactory */ "./src/types/container/custom-nodes/TControlFlowCustomNodeFactory.ts");
  5686. const IArrayUtils_1 = __webpack_require__(/*! ../../interfaces/utils/IArrayUtils */ "./src/interfaces/utils/IArrayUtils.ts");
  5687. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  5688. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  5689. const ControlFlowCustomNode_1 = __webpack_require__(/*! ../../enums/custom-nodes/ControlFlowCustomNode */ "./src/enums/custom-nodes/ControlFlowCustomNode.ts");
  5690. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  5691. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  5692. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  5693. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  5694. let BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer_1 = class BlockStatementControlFlowTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  5695. constructor(controlFlowCustomNodeFactory, arrayUtils, randomGenerator, options) {
  5696. super(randomGenerator, options);
  5697. this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  5698. this.arrayUtils = arrayUtils;
  5699. }
  5700. static isProhibitedStatementNode(node) {
  5701. const isBreakOrContinueStatement = NodeGuards_1.NodeGuards.isBreakStatementNode(node)
  5702. || NodeGuards_1.NodeGuards.isContinueStatementNode(node);
  5703. const isVariableDeclarationWithLetOrConstKind = NodeGuards_1.NodeGuards.isVariableDeclarationNode(node)
  5704. && (node.kind === 'const' || node.kind === 'let');
  5705. const isClassDeclaration = NodeGuards_1.NodeGuards.isClassDeclarationNode(node);
  5706. return NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node)
  5707. || isBreakOrContinueStatement
  5708. || isVariableDeclarationWithLetOrConstKind
  5709. || isClassDeclaration;
  5710. }
  5711. static canTransformBlockStatementNode(blockStatementNode) {
  5712. let canTransform = true;
  5713. estraverse.traverse(blockStatementNode, {
  5714. enter: (node) => {
  5715. if (NodeGuards_1.NodeGuards.isWhileStatementNode(node)) {
  5716. return estraverse.VisitorOption.Skip;
  5717. }
  5718. if (BlockStatementControlFlowTransformer_1.isProhibitedStatementNode(node)) {
  5719. canTransform = false;
  5720. }
  5721. }
  5722. });
  5723. if (blockStatementNode.body.length <= 4) {
  5724. canTransform = false;
  5725. }
  5726. return canTransform;
  5727. }
  5728. getVisitor(transformationStage) {
  5729. switch (transformationStage) {
  5730. case TransformationStage_1.TransformationStage.ControlFlowFlattening:
  5731. return {
  5732. leave: (node, parentNode) => {
  5733. if (parentNode && NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  5734. return this.transformNode(node, parentNode);
  5735. }
  5736. }
  5737. };
  5738. default:
  5739. return null;
  5740. }
  5741. }
  5742. transformNode(blockStatementNode, parentNode) {
  5743. if (this.randomGenerator.getMathRandom() > this.options.controlFlowFlatteningThreshold ||
  5744. !BlockStatementControlFlowTransformer_1.canTransformBlockStatementNode(blockStatementNode)) {
  5745. return blockStatementNode;
  5746. }
  5747. const blockStatementBody = blockStatementNode.body;
  5748. const originalKeys = this.arrayUtils.createWithRange(blockStatementBody.length);
  5749. const shuffledKeys = this.arrayUtils.shuffle(originalKeys);
  5750. const originalKeysIndexesInShuffledArray = originalKeys.map((key) => shuffledKeys.indexOf(key));
  5751. const blockStatementControlFlowFlatteningCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.BlockStatementControlFlowFlatteningNode);
  5752. blockStatementControlFlowFlatteningCustomNode.initialize(blockStatementBody, shuffledKeys, originalKeysIndexesInShuffledArray);
  5753. const newBlockStatementNode = blockStatementControlFlowFlatteningCustomNode.getNode()[0];
  5754. NodeUtils_1.NodeUtils.parentizeNode(newBlockStatementNode, parentNode);
  5755. return newBlockStatementNode;
  5756. }
  5757. };
  5758. BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer_1 = __decorate([
  5759. inversify_1.injectable(),
  5760. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)),
  5761. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils)),
  5762. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  5763. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  5764. __metadata("design:paramtypes", [typeof (_a = typeof TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory !== "undefined" && TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory) === "function" ? _a : Object, typeof (_b = typeof IArrayUtils_1.IArrayUtils !== "undefined" && IArrayUtils_1.IArrayUtils) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  5765. ], BlockStatementControlFlowTransformer);
  5766. exports.BlockStatementControlFlowTransformer = BlockStatementControlFlowTransformer;
  5767. /***/ }),
  5768. /***/ "./src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts":
  5769. /*!*******************************************************************************************!*\
  5770. !*** ./src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.ts ***!
  5771. \*******************************************************************************************/
  5772. /*! no static exports found */
  5773. /***/ (function(module, exports, __webpack_require__) {
  5774. "use strict";
  5775. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  5776. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  5777. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5778. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5779. return c > 3 && r && Object.defineProperty(target, key, r), r;
  5780. };
  5781. var __metadata = (this && this.__metadata) || function (k, v) {
  5782. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  5783. };
  5784. var __param = (this && this.__param) || function (paramIndex, decorator) {
  5785. return function (target, key) { decorator(target, key, paramIndex); }
  5786. };
  5787. var __importStar = (this && this.__importStar) || function (mod) {
  5788. if (mod && mod.__esModule) return mod;
  5789. var result = {};
  5790. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  5791. result["default"] = mod;
  5792. return result;
  5793. };
  5794. var FunctionControlFlowTransformer_1, _a, _b, _c, _d, _e;
  5795. Object.defineProperty(exports, "__esModule", { value: true });
  5796. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  5797. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  5798. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  5799. const TControlFlowCustomNodeFactory_1 = __webpack_require__(/*! ../../types/container/custom-nodes/TControlFlowCustomNodeFactory */ "./src/types/container/custom-nodes/TControlFlowCustomNodeFactory.ts");
  5800. const TControlFlowReplacerFactory_1 = __webpack_require__(/*! ../../types/container/node-transformers/TControlFlowReplacerFactory */ "./src/types/container/node-transformers/TControlFlowReplacerFactory.ts");
  5801. const TControlFlowStorageFactory_1 = __webpack_require__(/*! ../../types/container/node-transformers/TControlFlowStorageFactory */ "./src/types/container/node-transformers/TControlFlowStorageFactory.ts");
  5802. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  5803. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  5804. const ControlFlowCustomNode_1 = __webpack_require__(/*! ../../enums/custom-nodes/ControlFlowCustomNode */ "./src/enums/custom-nodes/ControlFlowCustomNode.ts");
  5805. const ControlFlowReplacer_1 = __webpack_require__(/*! ../../enums/node-transformers/obfuscating-transformers/obfuscating-replacers/ControlFlowReplacer */ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/ControlFlowReplacer.ts");
  5806. const NodeType_1 = __webpack_require__(/*! ../../enums/node/NodeType */ "./src/enums/node/NodeType.ts");
  5807. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  5808. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  5809. const NodeAppender_1 = __webpack_require__(/*! ../../node/NodeAppender */ "./src/node/NodeAppender.ts");
  5810. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  5811. const NodeMetadata_1 = __webpack_require__(/*! ../../node/NodeMetadata */ "./src/node/NodeMetadata.ts");
  5812. const NodeStatementUtils_1 = __webpack_require__(/*! ../../node/NodeStatementUtils */ "./src/node/NodeStatementUtils.ts");
  5813. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  5814. let FunctionControlFlowTransformer = FunctionControlFlowTransformer_1 = class FunctionControlFlowTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  5815. constructor(controlFlowStorageFactory, controlFlowReplacerFactory, controlFlowCustomNodeFactory, randomGenerator, options) {
  5816. super(randomGenerator, options);
  5817. this.controlFlowData = new Map();
  5818. this.visitedFunctionNodes = new Set();
  5819. this.hostNodesWithControlFlowNode = new Set();
  5820. this.controlFlowStorageFactory = controlFlowStorageFactory;
  5821. this.controlFlowReplacerFactory = controlFlowReplacerFactory;
  5822. this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  5823. }
  5824. getVisitor(transformationStage) {
  5825. switch (transformationStage) {
  5826. case TransformationStage_1.TransformationStage.ControlFlowFlattening:
  5827. return {
  5828. leave: (node, parentNode) => {
  5829. if (parentNode && (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) ||
  5830. NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) ||
  5831. NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node))) {
  5832. return this.transformNode(node, parentNode);
  5833. }
  5834. }
  5835. };
  5836. default:
  5837. return null;
  5838. }
  5839. }
  5840. transformNode(functionNode, parentNode) {
  5841. this.visitedFunctionNodes.add(functionNode);
  5842. if (!NodeGuards_1.NodeGuards.isBlockStatementNode(functionNode.body)) {
  5843. return functionNode;
  5844. }
  5845. const hostNode = this.getHostNode(functionNode.body);
  5846. const controlFlowStorage = this.getControlFlowStorage(hostNode);
  5847. this.controlFlowData.set(hostNode, controlFlowStorage);
  5848. this.transformFunctionBody(functionNode.body, controlFlowStorage);
  5849. if (!controlFlowStorage.getLength()) {
  5850. return functionNode;
  5851. }
  5852. const controlFlowStorageCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.ControlFlowStorageNode);
  5853. controlFlowStorageCustomNode.initialize(controlFlowStorage);
  5854. NodeAppender_1.NodeAppender.prepend(hostNode, controlFlowStorageCustomNode.getNode());
  5855. this.hostNodesWithControlFlowNode.add(hostNode);
  5856. NodeUtils_1.NodeUtils.parentizeAst(functionNode);
  5857. return functionNode;
  5858. }
  5859. getControlFlowStorage(hostNode) {
  5860. const controlFlowStorage = this.controlFlowStorageFactory();
  5861. if (this.controlFlowData.has(hostNode)) {
  5862. if (this.hostNodesWithControlFlowNode.has(hostNode)) {
  5863. if (NodeGuards_1.NodeGuards.isSwitchCaseNode(hostNode)) {
  5864. hostNode.consequent.shift();
  5865. }
  5866. else {
  5867. hostNode.body.shift();
  5868. }
  5869. }
  5870. const hostControlFlowStorage = this.controlFlowData.get(hostNode);
  5871. controlFlowStorage.mergeWith(hostControlFlowStorage, true);
  5872. }
  5873. return controlFlowStorage;
  5874. }
  5875. getHostNode(functionNodeBody) {
  5876. const blockScopesOfNode = NodeStatementUtils_1.NodeStatementUtils.getParentNodesWithStatements(functionNodeBody);
  5877. if (blockScopesOfNode.length === 1) {
  5878. return functionNodeBody;
  5879. }
  5880. else {
  5881. blockScopesOfNode.pop();
  5882. }
  5883. if (blockScopesOfNode.length > FunctionControlFlowTransformer_1.hostNodeSearchMinDepth) {
  5884. blockScopesOfNode.splice(0, FunctionControlFlowTransformer_1.hostNodeSearchMinDepth);
  5885. }
  5886. if (blockScopesOfNode.length > FunctionControlFlowTransformer_1.hostNodeSearchMaxDepth) {
  5887. blockScopesOfNode.length = FunctionControlFlowTransformer_1.hostNodeSearchMaxDepth;
  5888. }
  5889. return this.randomGenerator.getRandomGenerator().pickone(blockScopesOfNode);
  5890. }
  5891. isVisitedFunctionNode(node) {
  5892. return (NodeGuards_1.NodeGuards.isFunctionDeclarationNode(node) ||
  5893. NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) ||
  5894. NodeGuards_1.NodeGuards.isArrowFunctionExpressionNode(node)) && this.visitedFunctionNodes.has(node);
  5895. }
  5896. transformFunctionBody(functionNodeBody, controlFlowStorage) {
  5897. estraverse.replace(functionNodeBody, {
  5898. enter: (node, parentNode) => {
  5899. if (NodeMetadata_1.NodeMetadata.isIgnoredNode(node)) {
  5900. return estraverse.VisitorOption.Skip;
  5901. }
  5902. if (this.isVisitedFunctionNode(node) || !parentNode) {
  5903. return estraverse.VisitorOption.Skip;
  5904. }
  5905. if (!FunctionControlFlowTransformer_1.controlFlowReplacersMap.has(node.type)) {
  5906. return node;
  5907. }
  5908. if (this.randomGenerator.getMathRandom() > this.options.controlFlowFlatteningThreshold) {
  5909. return node;
  5910. }
  5911. const controlFlowReplacerName = FunctionControlFlowTransformer_1
  5912. .controlFlowReplacersMap.get(node.type);
  5913. if (controlFlowReplacerName === undefined) {
  5914. return node;
  5915. }
  5916. return Object.assign(Object.assign({}, this.controlFlowReplacerFactory(controlFlowReplacerName).replace(node, parentNode, controlFlowStorage)), { parentNode });
  5917. }
  5918. });
  5919. }
  5920. };
  5921. FunctionControlFlowTransformer.controlFlowReplacersMap = new Map([
  5922. [NodeType_1.NodeType.BinaryExpression, ControlFlowReplacer_1.ControlFlowReplacer.BinaryExpressionControlFlowReplacer],
  5923. [NodeType_1.NodeType.CallExpression, ControlFlowReplacer_1.ControlFlowReplacer.CallExpressionControlFlowReplacer],
  5924. [NodeType_1.NodeType.LogicalExpression, ControlFlowReplacer_1.ControlFlowReplacer.LogicalExpressionControlFlowReplacer],
  5925. [NodeType_1.NodeType.Literal, ControlFlowReplacer_1.ControlFlowReplacer.StringLiteralControlFlowReplacer]
  5926. ]);
  5927. FunctionControlFlowTransformer.hostNodeSearchMinDepth = 0;
  5928. FunctionControlFlowTransformer.hostNodeSearchMaxDepth = 2;
  5929. FunctionControlFlowTransformer = FunctionControlFlowTransformer_1 = __decorate([
  5930. inversify_1.injectable(),
  5931. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__TControlFlowStorage)),
  5932. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowReplacer)),
  5933. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)),
  5934. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  5935. __param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  5936. __metadata("design:paramtypes", [typeof (_a = typeof TControlFlowStorageFactory_1.TControlFlowStorageFactory !== "undefined" && TControlFlowStorageFactory_1.TControlFlowStorageFactory) === "function" ? _a : Object, typeof (_b = typeof TControlFlowReplacerFactory_1.TControlFlowReplacerFactory !== "undefined" && TControlFlowReplacerFactory_1.TControlFlowReplacerFactory) === "function" ? _b : Object, typeof (_c = typeof TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory !== "undefined" && TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory) === "function" ? _c : Object, typeof (_d = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _d : Object, typeof (_e = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _e : Object])
  5937. ], FunctionControlFlowTransformer);
  5938. exports.FunctionControlFlowTransformer = FunctionControlFlowTransformer;
  5939. /***/ }),
  5940. /***/ "./src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts":
  5941. /*!***************************************************************************************************************!*\
  5942. !*** ./src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts ***!
  5943. \***************************************************************************************************************/
  5944. /*! no static exports found */
  5945. /***/ (function(module, exports, __webpack_require__) {
  5946. "use strict";
  5947. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  5948. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  5949. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5950. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5951. return c > 3 && r && Object.defineProperty(target, key, r), r;
  5952. };
  5953. var __metadata = (this && this.__metadata) || function (k, v) {
  5954. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  5955. };
  5956. var __param = (this && this.__param) || function (paramIndex, decorator) {
  5957. return function (target, key) { decorator(target, key, paramIndex); }
  5958. };
  5959. var AbstractControlFlowReplacer_1, _a, _b, _c;
  5960. Object.defineProperty(exports, "__esModule", { value: true });
  5961. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  5962. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  5963. const TControlFlowCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TControlFlowCustomNodeFactory */ "./src/types/container/custom-nodes/TControlFlowCustomNodeFactory.ts");
  5964. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  5965. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  5966. let AbstractControlFlowReplacer = AbstractControlFlowReplacer_1 = class AbstractControlFlowReplacer {
  5967. constructor(controlFlowCustomNodeFactory, randomGenerator, options) {
  5968. this.replacerDataByControlFlowStorageId = new Map();
  5969. this.controlFlowCustomNodeFactory = controlFlowCustomNodeFactory;
  5970. this.randomGenerator = randomGenerator;
  5971. this.options = options;
  5972. }
  5973. static getStorageKeysByIdForCurrentStorage(identifierDataByControlFlowStorageId, controlFlowStorageId) {
  5974. let storageKeysById;
  5975. if (identifierDataByControlFlowStorageId.has(controlFlowStorageId)) {
  5976. storageKeysById = identifierDataByControlFlowStorageId.get(controlFlowStorageId);
  5977. }
  5978. else {
  5979. storageKeysById = new Map();
  5980. }
  5981. return storageKeysById;
  5982. }
  5983. insertCustomNodeToControlFlowStorage(customNode, controlFlowStorage, replacerId, usingExistingIdentifierChance) {
  5984. const controlFlowStorageId = controlFlowStorage.getStorageId();
  5985. const storageKeysById = AbstractControlFlowReplacer_1
  5986. .getStorageKeysByIdForCurrentStorage(this.replacerDataByControlFlowStorageId, controlFlowStorageId);
  5987. const storageKeysForCurrentId = storageKeysById.get(replacerId);
  5988. if (this.randomGenerator.getMathRandom() < usingExistingIdentifierChance &&
  5989. storageKeysForCurrentId &&
  5990. storageKeysForCurrentId.length) {
  5991. return this.randomGenerator.getRandomGenerator().pickone(storageKeysForCurrentId);
  5992. }
  5993. const generateStorageKey = (length) => {
  5994. const key = this.randomGenerator.getRandomString(length);
  5995. if (controlFlowStorage.getStorage().has(key)) {
  5996. return generateStorageKey(length);
  5997. }
  5998. return key;
  5999. };
  6000. const storageKey = generateStorageKey(5);
  6001. storageKeysById.set(replacerId, [storageKey]);
  6002. this.replacerDataByControlFlowStorageId.set(controlFlowStorageId, storageKeysById);
  6003. controlFlowStorage.set(storageKey, customNode);
  6004. return storageKey;
  6005. }
  6006. };
  6007. AbstractControlFlowReplacer = AbstractControlFlowReplacer_1 = __decorate([
  6008. inversify_1.injectable(),
  6009. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)),
  6010. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6011. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6012. __metadata("design:paramtypes", [typeof (_a = typeof TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory !== "undefined" && TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  6013. ], AbstractControlFlowReplacer);
  6014. exports.AbstractControlFlowReplacer = AbstractControlFlowReplacer;
  6015. /***/ }),
  6016. /***/ "./src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts":
  6017. /*!***********************************************************************************************************************!*\
  6018. !*** ./src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.ts ***!
  6019. \***********************************************************************************************************************/
  6020. /*! no static exports found */
  6021. /***/ (function(module, exports, __webpack_require__) {
  6022. "use strict";
  6023. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6024. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6025. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6026. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6027. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6028. };
  6029. var __metadata = (this && this.__metadata) || function (k, v) {
  6030. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6031. };
  6032. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6033. return function (target, key) { decorator(target, key, paramIndex); }
  6034. };
  6035. var BinaryExpressionControlFlowReplacer_1, _a, _b, _c;
  6036. Object.defineProperty(exports, "__esModule", { value: true });
  6037. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6038. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6039. const TControlFlowCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TControlFlowCustomNodeFactory */ "./src/types/container/custom-nodes/TControlFlowCustomNodeFactory.ts");
  6040. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6041. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6042. const ControlFlowCustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/ControlFlowCustomNode */ "./src/enums/custom-nodes/ControlFlowCustomNode.ts");
  6043. const ExpressionWithOperatorControlFlowReplacer_1 = __webpack_require__(/*! ./ExpressionWithOperatorControlFlowReplacer */ "./src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts");
  6044. let BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer_1 = class BinaryExpressionControlFlowReplacer extends ExpressionWithOperatorControlFlowReplacer_1.ExpressionWithOperatorControlFlowReplacer {
  6045. constructor(controlFlowCustomNodeFactory, randomGenerator, options) {
  6046. super(controlFlowCustomNodeFactory, randomGenerator, options);
  6047. }
  6048. replace(binaryExpressionNode, parentNode, controlFlowStorage) {
  6049. const operator = binaryExpressionNode.operator;
  6050. const binaryExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.BinaryExpressionFunctionNode);
  6051. binaryExpressionFunctionCustomNode.initialize(operator);
  6052. const storageKey = this.insertCustomNodeToControlFlowStorage(binaryExpressionFunctionCustomNode, controlFlowStorage, operator, BinaryExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  6053. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, binaryExpressionNode.left, binaryExpressionNode.right);
  6054. }
  6055. };
  6056. BinaryExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  6057. BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer_1 = __decorate([
  6058. inversify_1.injectable(),
  6059. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)),
  6060. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6061. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6062. __metadata("design:paramtypes", [typeof (_a = typeof TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory !== "undefined" && TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  6063. ], BinaryExpressionControlFlowReplacer);
  6064. exports.BinaryExpressionControlFlowReplacer = BinaryExpressionControlFlowReplacer;
  6065. /***/ }),
  6066. /***/ "./src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts":
  6067. /*!*********************************************************************************************************************!*\
  6068. !*** ./src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.ts ***!
  6069. \*********************************************************************************************************************/
  6070. /*! no static exports found */
  6071. /***/ (function(module, exports, __webpack_require__) {
  6072. "use strict";
  6073. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6074. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6075. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6076. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6077. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6078. };
  6079. var __metadata = (this && this.__metadata) || function (k, v) {
  6080. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6081. };
  6082. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6083. return function (target, key) { decorator(target, key, paramIndex); }
  6084. };
  6085. var CallExpressionControlFlowReplacer_1, _a, _b, _c;
  6086. Object.defineProperty(exports, "__esModule", { value: true });
  6087. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6088. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6089. const TControlFlowCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TControlFlowCustomNodeFactory */ "./src/types/container/custom-nodes/TControlFlowCustomNodeFactory.ts");
  6090. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6091. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6092. const ControlFlowCustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/ControlFlowCustomNode */ "./src/enums/custom-nodes/ControlFlowCustomNode.ts");
  6093. const AbstractControlFlowReplacer_1 = __webpack_require__(/*! ./AbstractControlFlowReplacer */ "./src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts");
  6094. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6095. let CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer_1 = class CallExpressionControlFlowReplacer extends AbstractControlFlowReplacer_1.AbstractControlFlowReplacer {
  6096. constructor(controlFlowCustomNodeFactory, randomGenerator, options) {
  6097. super(controlFlowCustomNodeFactory, randomGenerator, options);
  6098. }
  6099. replace(callExpressionNode, parentNode, controlFlowStorage) {
  6100. const callee = callExpressionNode.callee;
  6101. if (!NodeGuards_1.NodeGuards.isIdentifierNode(callee)) {
  6102. return callExpressionNode;
  6103. }
  6104. const replacerId = String(callExpressionNode.arguments.length);
  6105. const callExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionFunctionNode);
  6106. const expressionArguments = callExpressionNode.arguments;
  6107. callExpressionFunctionCustomNode.initialize(expressionArguments);
  6108. const storageKey = this.insertCustomNodeToControlFlowStorage(callExpressionFunctionCustomNode, controlFlowStorage, replacerId, CallExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  6109. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, callee, expressionArguments);
  6110. }
  6111. getControlFlowStorageCallNode(controlFlowStorageId, storageKey, callee, expressionArguments) {
  6112. const controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.CallExpressionControlFlowStorageCallNode);
  6113. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey, callee, expressionArguments);
  6114. const statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  6115. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  6116. throw new Error('`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node');
  6117. }
  6118. return statementNode.expression;
  6119. }
  6120. };
  6121. CallExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  6122. CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer_1 = __decorate([
  6123. inversify_1.injectable(),
  6124. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)),
  6125. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6126. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6127. __metadata("design:paramtypes", [typeof (_a = typeof TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory !== "undefined" && TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  6128. ], CallExpressionControlFlowReplacer);
  6129. exports.CallExpressionControlFlowReplacer = CallExpressionControlFlowReplacer;
  6130. /***/ }),
  6131. /***/ "./src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts":
  6132. /*!*****************************************************************************************************************************!*\
  6133. !*** ./src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts ***!
  6134. \*****************************************************************************************************************************/
  6135. /*! no static exports found */
  6136. /***/ (function(module, exports, __webpack_require__) {
  6137. "use strict";
  6138. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6139. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6140. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6141. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6142. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6143. };
  6144. var __metadata = (this && this.__metadata) || function (k, v) {
  6145. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6146. };
  6147. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6148. return function (target, key) { decorator(target, key, paramIndex); }
  6149. };
  6150. var _a, _b, _c;
  6151. Object.defineProperty(exports, "__esModule", { value: true });
  6152. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6153. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6154. const TControlFlowCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TControlFlowCustomNodeFactory */ "./src/types/container/custom-nodes/TControlFlowCustomNodeFactory.ts");
  6155. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6156. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6157. const ControlFlowCustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/ControlFlowCustomNode */ "./src/enums/custom-nodes/ControlFlowCustomNode.ts");
  6158. const AbstractControlFlowReplacer_1 = __webpack_require__(/*! ./AbstractControlFlowReplacer */ "./src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts");
  6159. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6160. let ExpressionWithOperatorControlFlowReplacer = class ExpressionWithOperatorControlFlowReplacer extends AbstractControlFlowReplacer_1.AbstractControlFlowReplacer {
  6161. constructor(controlFlowCustomNodeFactory, randomGenerator, options) {
  6162. super(controlFlowCustomNodeFactory, randomGenerator, options);
  6163. }
  6164. getControlFlowStorageCallNode(controlFlowStorageId, storageKey, leftExpression, rightExpression) {
  6165. const controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.ExpressionWithOperatorControlFlowStorageCallNode);
  6166. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey, leftExpression, rightExpression);
  6167. const statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  6168. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  6169. throw new Error('`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node');
  6170. }
  6171. return statementNode.expression;
  6172. }
  6173. };
  6174. ExpressionWithOperatorControlFlowReplacer = __decorate([
  6175. inversify_1.injectable(),
  6176. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)),
  6177. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6178. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6179. __metadata("design:paramtypes", [typeof (_a = typeof TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory !== "undefined" && TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  6180. ], ExpressionWithOperatorControlFlowReplacer);
  6181. exports.ExpressionWithOperatorControlFlowReplacer = ExpressionWithOperatorControlFlowReplacer;
  6182. /***/ }),
  6183. /***/ "./src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts":
  6184. /*!************************************************************************************************************************!*\
  6185. !*** ./src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.ts ***!
  6186. \************************************************************************************************************************/
  6187. /*! no static exports found */
  6188. /***/ (function(module, exports, __webpack_require__) {
  6189. "use strict";
  6190. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6191. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6192. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6193. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6194. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6195. };
  6196. var __metadata = (this && this.__metadata) || function (k, v) {
  6197. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6198. };
  6199. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6200. return function (target, key) { decorator(target, key, paramIndex); }
  6201. };
  6202. var LogicalExpressionControlFlowReplacer_1, _a, _b, _c;
  6203. Object.defineProperty(exports, "__esModule", { value: true });
  6204. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6205. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6206. const TControlFlowCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TControlFlowCustomNodeFactory */ "./src/types/container/custom-nodes/TControlFlowCustomNodeFactory.ts");
  6207. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6208. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6209. const ControlFlowCustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/ControlFlowCustomNode */ "./src/enums/custom-nodes/ControlFlowCustomNode.ts");
  6210. const ExpressionWithOperatorControlFlowReplacer_1 = __webpack_require__(/*! ./ExpressionWithOperatorControlFlowReplacer */ "./src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.ts");
  6211. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6212. const NodeUtils_1 = __webpack_require__(/*! ../../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  6213. let LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer_1 = class LogicalExpressionControlFlowReplacer extends ExpressionWithOperatorControlFlowReplacer_1.ExpressionWithOperatorControlFlowReplacer {
  6214. constructor(controlFlowCustomNodeFactory, randomGenerator, options) {
  6215. super(controlFlowCustomNodeFactory, randomGenerator, options);
  6216. }
  6217. replace(logicalExpressionNode, parentNode, controlFlowStorage) {
  6218. if (this.checkForProhibitedExpressions(logicalExpressionNode.left, logicalExpressionNode.right)) {
  6219. return logicalExpressionNode;
  6220. }
  6221. const operator = logicalExpressionNode.operator;
  6222. const logicalExpressionFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.LogicalExpressionFunctionNode);
  6223. logicalExpressionFunctionCustomNode.initialize(operator);
  6224. const storageKey = this.insertCustomNodeToControlFlowStorage(logicalExpressionFunctionCustomNode, controlFlowStorage, operator, LogicalExpressionControlFlowReplacer_1.usingExistingIdentifierChance);
  6225. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey, logicalExpressionNode.left, logicalExpressionNode.right);
  6226. }
  6227. checkForProhibitedExpressions(leftExpression, rightExpression) {
  6228. return [leftExpression, rightExpression].some((expressionNode) => {
  6229. let nodeForCheck;
  6230. if (!NodeGuards_1.NodeGuards.isUnaryExpressionNode(expressionNode)) {
  6231. nodeForCheck = expressionNode;
  6232. }
  6233. else {
  6234. nodeForCheck = NodeUtils_1.NodeUtils.getUnaryExpressionArgumentNode(expressionNode);
  6235. }
  6236. return !NodeGuards_1.NodeGuards.isLiteralNode(nodeForCheck) &&
  6237. !NodeGuards_1.NodeGuards.isIdentifierNode(nodeForCheck) &&
  6238. !NodeGuards_1.NodeGuards.isObjectExpressionNode(nodeForCheck) &&
  6239. !NodeGuards_1.NodeGuards.isExpressionStatementNode(nodeForCheck);
  6240. });
  6241. }
  6242. };
  6243. LogicalExpressionControlFlowReplacer.usingExistingIdentifierChance = 0.5;
  6244. LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer_1 = __decorate([
  6245. inversify_1.injectable(),
  6246. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)),
  6247. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6248. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6249. __metadata("design:paramtypes", [typeof (_a = typeof TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory !== "undefined" && TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  6250. ], LogicalExpressionControlFlowReplacer);
  6251. exports.LogicalExpressionControlFlowReplacer = LogicalExpressionControlFlowReplacer;
  6252. /***/ }),
  6253. /***/ "./src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts":
  6254. /*!********************************************************************************************************************!*\
  6255. !*** ./src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.ts ***!
  6256. \********************************************************************************************************************/
  6257. /*! no static exports found */
  6258. /***/ (function(module, exports, __webpack_require__) {
  6259. "use strict";
  6260. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6261. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6262. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6263. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6264. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6265. };
  6266. var __metadata = (this && this.__metadata) || function (k, v) {
  6267. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6268. };
  6269. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6270. return function (target, key) { decorator(target, key, paramIndex); }
  6271. };
  6272. var StringLiteralControlFlowReplacer_1, _a, _b, _c;
  6273. Object.defineProperty(exports, "__esModule", { value: true });
  6274. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6275. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6276. const TControlFlowCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TControlFlowCustomNodeFactory */ "./src/types/container/custom-nodes/TControlFlowCustomNodeFactory.ts");
  6277. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6278. const IRandomGenerator_1 = __webpack_require__(/*! ../../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6279. const ControlFlowCustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/ControlFlowCustomNode */ "./src/enums/custom-nodes/ControlFlowCustomNode.ts");
  6280. const AbstractControlFlowReplacer_1 = __webpack_require__(/*! ./AbstractControlFlowReplacer */ "./src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.ts");
  6281. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6282. let StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer_1 = class StringLiteralControlFlowReplacer extends AbstractControlFlowReplacer_1.AbstractControlFlowReplacer {
  6283. constructor(controlFlowCustomNodeFactory, randomGenerator, options) {
  6284. super(controlFlowCustomNodeFactory, randomGenerator, options);
  6285. }
  6286. replace(literalNode, parentNode, controlFlowStorage) {
  6287. if (NodeGuards_1.NodeGuards.isPropertyNode(parentNode) && parentNode.key === literalNode) {
  6288. return literalNode;
  6289. }
  6290. if (typeof literalNode.value !== 'string' || literalNode.value.length < 3) {
  6291. return literalNode;
  6292. }
  6293. const replacerId = String(literalNode.value);
  6294. const literalFunctionCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralNode);
  6295. literalFunctionCustomNode.initialize(literalNode.value);
  6296. const storageKey = this.insertCustomNodeToControlFlowStorage(literalFunctionCustomNode, controlFlowStorage, replacerId, StringLiteralControlFlowReplacer_1.usingExistingIdentifierChance);
  6297. return this.getControlFlowStorageCallNode(controlFlowStorage.getStorageId(), storageKey);
  6298. }
  6299. getControlFlowStorageCallNode(controlFlowStorageId, storageKey) {
  6300. const controlFlowStorageCallCustomNode = this.controlFlowCustomNodeFactory(ControlFlowCustomNode_1.ControlFlowCustomNode.StringLiteralControlFlowStorageCallNode);
  6301. controlFlowStorageCallCustomNode.initialize(controlFlowStorageId, storageKey);
  6302. const statementNode = controlFlowStorageCallCustomNode.getNode()[0];
  6303. if (!statementNode || !NodeGuards_1.NodeGuards.isExpressionStatementNode(statementNode)) {
  6304. throw new Error('`controlFlowStorageCallCustomNode.getNode()[0]` should returns array with `ExpressionStatement` node');
  6305. }
  6306. return statementNode.expression;
  6307. }
  6308. };
  6309. StringLiteralControlFlowReplacer.usingExistingIdentifierChance = 1;
  6310. StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer_1 = __decorate([
  6311. inversify_1.injectable(),
  6312. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IControlFlowCustomNode)),
  6313. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6314. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6315. __metadata("design:paramtypes", [typeof (_a = typeof TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory !== "undefined" && TControlFlowCustomNodeFactory_1.TControlFlowCustomNodeFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  6316. ], StringLiteralControlFlowReplacer);
  6317. exports.StringLiteralControlFlowReplacer = StringLiteralControlFlowReplacer;
  6318. /***/ }),
  6319. /***/ "./src/node-transformers/converting-transformers/MemberExpressionTransformer.ts":
  6320. /*!**************************************************************************************!*\
  6321. !*** ./src/node-transformers/converting-transformers/MemberExpressionTransformer.ts ***!
  6322. \**************************************************************************************/
  6323. /*! no static exports found */
  6324. /***/ (function(module, exports, __webpack_require__) {
  6325. "use strict";
  6326. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6327. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6328. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6329. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6330. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6331. };
  6332. var __metadata = (this && this.__metadata) || function (k, v) {
  6333. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6334. };
  6335. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6336. return function (target, key) { decorator(target, key, paramIndex); }
  6337. };
  6338. var _a, _b;
  6339. Object.defineProperty(exports, "__esModule", { value: true });
  6340. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6341. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6342. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6343. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6344. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  6345. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  6346. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  6347. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6348. let MemberExpressionTransformer = class MemberExpressionTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  6349. constructor(randomGenerator, options) {
  6350. super(randomGenerator, options);
  6351. }
  6352. getVisitor(transformationStage) {
  6353. switch (transformationStage) {
  6354. case TransformationStage_1.TransformationStage.Converting:
  6355. return {
  6356. enter: (node, parentNode) => {
  6357. if (parentNode && NodeGuards_1.NodeGuards.isMemberExpressionNode(node)) {
  6358. return this.transformNode(node, parentNode);
  6359. }
  6360. }
  6361. };
  6362. default:
  6363. return null;
  6364. }
  6365. }
  6366. transformNode(memberExpressionNode, parentNode) {
  6367. if (NodeGuards_1.NodeGuards.isIdentifierNode(memberExpressionNode.property)) {
  6368. if (memberExpressionNode.computed) {
  6369. return memberExpressionNode;
  6370. }
  6371. memberExpressionNode.computed = true;
  6372. memberExpressionNode.property = NodeFactory_1.NodeFactory.literalNode(memberExpressionNode.property.name);
  6373. }
  6374. return memberExpressionNode;
  6375. }
  6376. };
  6377. MemberExpressionTransformer = __decorate([
  6378. inversify_1.injectable(),
  6379. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6380. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6381. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  6382. ], MemberExpressionTransformer);
  6383. exports.MemberExpressionTransformer = MemberExpressionTransformer;
  6384. /***/ }),
  6385. /***/ "./src/node-transformers/converting-transformers/MethodDefinitionTransformer.ts":
  6386. /*!**************************************************************************************!*\
  6387. !*** ./src/node-transformers/converting-transformers/MethodDefinitionTransformer.ts ***!
  6388. \**************************************************************************************/
  6389. /*! no static exports found */
  6390. /***/ (function(module, exports, __webpack_require__) {
  6391. "use strict";
  6392. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6393. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6394. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6395. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6396. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6397. };
  6398. var __metadata = (this && this.__metadata) || function (k, v) {
  6399. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6400. };
  6401. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6402. return function (target, key) { decorator(target, key, paramIndex); }
  6403. };
  6404. var MethodDefinitionTransformer_1, _a, _b;
  6405. Object.defineProperty(exports, "__esModule", { value: true });
  6406. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6407. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6408. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6409. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6410. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  6411. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  6412. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  6413. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6414. let MethodDefinitionTransformer = MethodDefinitionTransformer_1 = class MethodDefinitionTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  6415. constructor(randomGenerator, options) {
  6416. super(randomGenerator, options);
  6417. }
  6418. getVisitor(transformationStage) {
  6419. switch (transformationStage) {
  6420. case TransformationStage_1.TransformationStage.Converting:
  6421. return {
  6422. enter: (node, parentNode) => {
  6423. if (parentNode && NodeGuards_1.NodeGuards.isMethodDefinitionNode(node)) {
  6424. return this.transformNode(node, parentNode);
  6425. }
  6426. }
  6427. };
  6428. default:
  6429. return null;
  6430. }
  6431. }
  6432. transformNode(methodDefinitionNode, parentNode) {
  6433. if (NodeGuards_1.NodeGuards.isIdentifierNode(methodDefinitionNode.key)) {
  6434. return this.replaceIdentifierKey(methodDefinitionNode, methodDefinitionNode.key);
  6435. }
  6436. if (NodeGuards_1.NodeGuards.isLiteralNode(methodDefinitionNode.key)) {
  6437. return this.replaceLiteralKey(methodDefinitionNode, methodDefinitionNode.key);
  6438. }
  6439. return methodDefinitionNode;
  6440. }
  6441. replaceIdentifierKey(methodDefinitionNode, keyNode) {
  6442. if (!MethodDefinitionTransformer_1.ignoredNames.includes(keyNode.name)
  6443. && !methodDefinitionNode.computed) {
  6444. methodDefinitionNode.computed = true;
  6445. methodDefinitionNode.key = NodeFactory_1.NodeFactory.literalNode(keyNode.name);
  6446. }
  6447. return methodDefinitionNode;
  6448. }
  6449. replaceLiteralKey(methodDefinitionNode, keyNode) {
  6450. if (typeof keyNode.value === 'string'
  6451. && !MethodDefinitionTransformer_1.ignoredNames.includes(keyNode.value)
  6452. && !methodDefinitionNode.computed) {
  6453. methodDefinitionNode.computed = true;
  6454. }
  6455. return methodDefinitionNode;
  6456. }
  6457. };
  6458. MethodDefinitionTransformer.ignoredNames = ['constructor'];
  6459. MethodDefinitionTransformer = MethodDefinitionTransformer_1 = __decorate([
  6460. inversify_1.injectable(),
  6461. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6462. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6463. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  6464. ], MethodDefinitionTransformer);
  6465. exports.MethodDefinitionTransformer = MethodDefinitionTransformer;
  6466. /***/ }),
  6467. /***/ "./src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts":
  6468. /*!******************************************************************************************!*\
  6469. !*** ./src/node-transformers/converting-transformers/ObjectExpressionKeysTransformer.ts ***!
  6470. \******************************************************************************************/
  6471. /*! no static exports found */
  6472. /***/ (function(module, exports, __webpack_require__) {
  6473. "use strict";
  6474. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6475. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6476. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6477. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6478. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6479. };
  6480. var __metadata = (this && this.__metadata) || function (k, v) {
  6481. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6482. };
  6483. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6484. return function (target, key) { decorator(target, key, paramIndex); }
  6485. };
  6486. var __importStar = (this && this.__importStar) || function (mod) {
  6487. if (mod && mod.__esModule) return mod;
  6488. var result = {};
  6489. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  6490. result["default"] = mod;
  6491. return result;
  6492. };
  6493. var ObjectExpressionKeysTransformer_1, _a, _b, _c;
  6494. Object.defineProperty(exports, "__esModule", { value: true });
  6495. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6496. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6497. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  6498. const TObjectExpressionExtractorFactory_1 = __webpack_require__(/*! ../../types/container/node-transformers/TObjectExpressionExtractorFactory */ "./src/types/container/node-transformers/TObjectExpressionExtractorFactory.ts");
  6499. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6500. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6501. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  6502. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  6503. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6504. const NodeStatementUtils_1 = __webpack_require__(/*! ../../node/NodeStatementUtils */ "./src/node/NodeStatementUtils.ts");
  6505. const ObjectExpressionExtractor_1 = __webpack_require__(/*! ../../enums/node-transformers/converting-transformers/properties-extractors/ObjectExpressionExtractor */ "./src/enums/node-transformers/converting-transformers/properties-extractors/ObjectExpressionExtractor.ts");
  6506. let ObjectExpressionKeysTransformer = ObjectExpressionKeysTransformer_1 = class ObjectExpressionKeysTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  6507. constructor(objectExpressionExtractorFactory, randomGenerator, options) {
  6508. super(randomGenerator, options);
  6509. this.objectExpressionExtractorFactory = objectExpressionExtractorFactory;
  6510. }
  6511. static isProhibitedHostStatement(objectExpressionNode, hostStatement) {
  6512. return ObjectExpressionKeysTransformer_1.isReferencedIdentifierName(objectExpressionNode, hostStatement);
  6513. }
  6514. static isReferencedIdentifierName(objectExpressionNode, hostNode) {
  6515. const identifierNamesSet = [];
  6516. let isReferencedIdentifierName = false;
  6517. let isCurrentNode = false;
  6518. estraverse.traverse(hostNode, {
  6519. enter: (node) => {
  6520. if (node === objectExpressionNode) {
  6521. isCurrentNode = true;
  6522. }
  6523. if (!NodeGuards_1.NodeGuards.isIdentifierNode(node)) {
  6524. return;
  6525. }
  6526. if (!isCurrentNode) {
  6527. identifierNamesSet.push(node.name);
  6528. return;
  6529. }
  6530. if (identifierNamesSet.includes(node.name)) {
  6531. isReferencedIdentifierName = true;
  6532. }
  6533. },
  6534. leave: (node) => {
  6535. if (node === objectExpressionNode) {
  6536. isCurrentNode = false;
  6537. return estraverse.VisitorOption.Break;
  6538. }
  6539. }
  6540. });
  6541. return isReferencedIdentifierName;
  6542. }
  6543. getVisitor(transformationStage) {
  6544. if (!this.options.transformObjectKeys) {
  6545. return null;
  6546. }
  6547. switch (transformationStage) {
  6548. case TransformationStage_1.TransformationStage.Converting:
  6549. return {
  6550. leave: (node, parentNode) => {
  6551. if (parentNode
  6552. && NodeGuards_1.NodeGuards.isObjectExpressionNode(node)) {
  6553. return this.transformNode(node, parentNode);
  6554. }
  6555. }
  6556. };
  6557. default:
  6558. return null;
  6559. }
  6560. }
  6561. transformNode(objectExpressionNode, parentNode) {
  6562. if (!objectExpressionNode.properties.length) {
  6563. return objectExpressionNode;
  6564. }
  6565. const hostStatement = NodeStatementUtils_1.NodeStatementUtils.getRootStatementOfNode(objectExpressionNode);
  6566. if (ObjectExpressionKeysTransformer_1.isProhibitedHostStatement(objectExpressionNode, hostStatement)) {
  6567. return objectExpressionNode;
  6568. }
  6569. return this.applyObjectExpressionKeysExtractorsRecursive(ObjectExpressionKeysTransformer_1.objectExpressionExtractorNames, objectExpressionNode, hostStatement);
  6570. }
  6571. applyObjectExpressionKeysExtractorsRecursive(objectExpressionExtractorNames, objectExpressionNode, hostStatement) {
  6572. const newObjectExpressionExtractorNames = [...objectExpressionExtractorNames];
  6573. const objectExpressionExtractor = newObjectExpressionExtractorNames.shift();
  6574. if (!objectExpressionExtractor) {
  6575. return objectExpressionNode;
  6576. }
  6577. const { nodeToReplace, objectExpressionHostStatement: newObjectExpressionHostStatement, objectExpressionNode: newObjectExpressionNode } = this.objectExpressionExtractorFactory(objectExpressionExtractor)
  6578. .extract(objectExpressionNode, hostStatement);
  6579. this.applyObjectExpressionKeysExtractorsRecursive(newObjectExpressionExtractorNames, newObjectExpressionNode, newObjectExpressionHostStatement);
  6580. return nodeToReplace;
  6581. }
  6582. };
  6583. ObjectExpressionKeysTransformer.objectExpressionExtractorNames = [
  6584. ObjectExpressionExtractor_1.ObjectExpressionExtractor.ObjectExpressionToVariableDeclarationExtractor,
  6585. ObjectExpressionExtractor_1.ObjectExpressionExtractor.BasePropertiesExtractor
  6586. ];
  6587. ObjectExpressionKeysTransformer = ObjectExpressionKeysTransformer_1 = __decorate([
  6588. inversify_1.injectable(),
  6589. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObjectExpressionExtractor)),
  6590. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6591. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6592. __metadata("design:paramtypes", [typeof (_a = typeof TObjectExpressionExtractorFactory_1.TObjectExpressionExtractorFactory !== "undefined" && TObjectExpressionExtractorFactory_1.TObjectExpressionExtractorFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  6593. ], ObjectExpressionKeysTransformer);
  6594. exports.ObjectExpressionKeysTransformer = ObjectExpressionKeysTransformer;
  6595. /***/ }),
  6596. /***/ "./src/node-transformers/converting-transformers/ObjectExpressionTransformer.ts":
  6597. /*!**************************************************************************************!*\
  6598. !*** ./src/node-transformers/converting-transformers/ObjectExpressionTransformer.ts ***!
  6599. \**************************************************************************************/
  6600. /*! no static exports found */
  6601. /***/ (function(module, exports, __webpack_require__) {
  6602. "use strict";
  6603. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6604. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6605. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6606. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6607. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6608. };
  6609. var __metadata = (this && this.__metadata) || function (k, v) {
  6610. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6611. };
  6612. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6613. return function (target, key) { decorator(target, key, paramIndex); }
  6614. };
  6615. var _a, _b;
  6616. Object.defineProperty(exports, "__esModule", { value: true });
  6617. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6618. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6619. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6620. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6621. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  6622. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  6623. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  6624. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6625. let ObjectExpressionTransformer = class ObjectExpressionTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  6626. constructor(randomGenerator, options) {
  6627. super(randomGenerator, options);
  6628. }
  6629. getVisitor(transformationStage) {
  6630. switch (transformationStage) {
  6631. case TransformationStage_1.TransformationStage.Converting:
  6632. return {
  6633. enter: (node, parentNode) => {
  6634. if (parentNode && NodeGuards_1.NodeGuards.isObjectExpressionNode(node)) {
  6635. return this.transformNode(node, parentNode);
  6636. }
  6637. }
  6638. };
  6639. default:
  6640. return null;
  6641. }
  6642. }
  6643. transformNode(objectExpressionNode, parentNode) {
  6644. objectExpressionNode.properties
  6645. .forEach((property) => {
  6646. if (!property.key) {
  6647. return;
  6648. }
  6649. if (property.computed) {
  6650. this.transformComputedProperty(property);
  6651. }
  6652. else {
  6653. this.transformBaseProperty(property);
  6654. }
  6655. });
  6656. return objectExpressionNode;
  6657. }
  6658. transformComputedProperty(property) {
  6659. if (!NodeGuards_1.NodeGuards.isLiteralNode(property.key) || !(typeof property.key.value === 'string')) {
  6660. return;
  6661. }
  6662. property.key = NodeFactory_1.NodeFactory.literalNode(property.key.value);
  6663. }
  6664. transformBaseProperty(property) {
  6665. if (property.shorthand) {
  6666. property.shorthand = false;
  6667. }
  6668. if (!NodeGuards_1.NodeGuards.isIdentifierNode(property.key)) {
  6669. return;
  6670. }
  6671. property.key = NodeFactory_1.NodeFactory.literalNode(property.key.name);
  6672. }
  6673. };
  6674. ObjectExpressionTransformer = __decorate([
  6675. inversify_1.injectable(),
  6676. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6677. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6678. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  6679. ], ObjectExpressionTransformer);
  6680. exports.ObjectExpressionTransformer = ObjectExpressionTransformer;
  6681. /***/ }),
  6682. /***/ "./src/node-transformers/converting-transformers/SplitStringTransformer.ts":
  6683. /*!*********************************************************************************!*\
  6684. !*** ./src/node-transformers/converting-transformers/SplitStringTransformer.ts ***!
  6685. \*********************************************************************************/
  6686. /*! no static exports found */
  6687. /***/ (function(module, exports, __webpack_require__) {
  6688. "use strict";
  6689. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6690. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6691. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6692. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6693. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6694. };
  6695. var __metadata = (this && this.__metadata) || function (k, v) {
  6696. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6697. };
  6698. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6699. return function (target, key) { decorator(target, key, paramIndex); }
  6700. };
  6701. var __importStar = (this && this.__importStar) || function (mod) {
  6702. if (mod && mod.__esModule) return mod;
  6703. var result = {};
  6704. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  6705. result["default"] = mod;
  6706. return result;
  6707. };
  6708. var SplitStringTransformer_1, _a, _b;
  6709. Object.defineProperty(exports, "__esModule", { value: true });
  6710. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6711. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6712. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  6713. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6714. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6715. const NodeTransformer_1 = __webpack_require__(/*! ../../enums/node-transformers/NodeTransformer */ "./src/enums/node-transformers/NodeTransformer.ts");
  6716. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  6717. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  6718. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  6719. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6720. const NodeLiteralUtils_1 = __webpack_require__(/*! ../../node/NodeLiteralUtils */ "./src/node/NodeLiteralUtils.ts");
  6721. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  6722. let SplitStringTransformer = SplitStringTransformer_1 = class SplitStringTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  6723. constructor(randomGenerator, options) {
  6724. super(randomGenerator, options);
  6725. this.runAfter = [
  6726. NodeTransformer_1.NodeTransformer.ObjectExpressionKeysTransformer,
  6727. NodeTransformer_1.NodeTransformer.TemplateLiteralTransformer
  6728. ];
  6729. }
  6730. static chunkString(string, chunkSize) {
  6731. const chunksCount = Math.ceil(string.length / chunkSize);
  6732. const chunks = [];
  6733. let nextChunkStartIndex = 0;
  6734. for (let chunkIndex = 0; chunkIndex < chunksCount; ++chunkIndex, nextChunkStartIndex += chunkSize) {
  6735. chunks[chunkIndex] = string.substr(nextChunkStartIndex, chunkSize);
  6736. }
  6737. return chunks;
  6738. }
  6739. getVisitor(transformationStage) {
  6740. switch (transformationStage) {
  6741. case TransformationStage_1.TransformationStage.Converting:
  6742. return {
  6743. enter: (node, parentNode) => {
  6744. if (!this.options.splitStrings) {
  6745. return;
  6746. }
  6747. if (parentNode && NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  6748. return this.transformNode(node, parentNode);
  6749. }
  6750. }
  6751. };
  6752. default:
  6753. return null;
  6754. }
  6755. }
  6756. transformNode(literalNode, parentNode) {
  6757. if (NodeLiteralUtils_1.NodeLiteralUtils.isProhibitedLiteralNode(literalNode, parentNode)) {
  6758. return literalNode;
  6759. }
  6760. const firstPassChunksNode = this.transformLiteralNodeByChunkLength(literalNode, parentNode, SplitStringTransformer_1.firstPassChunkLength);
  6761. const secondPassChunksNode = estraverse.replace(firstPassChunksNode, {
  6762. enter: (node, parentNode) => {
  6763. if (parentNode && NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  6764. return this.transformLiteralNodeByChunkLength(node, parentNode, this.options.splitStringsChunkLength);
  6765. }
  6766. }
  6767. });
  6768. return secondPassChunksNode;
  6769. }
  6770. transformLiteralNodeByChunkLength(literalNode, parentNode, chunkLength) {
  6771. if (typeof literalNode.value !== 'string') {
  6772. return literalNode;
  6773. }
  6774. if (chunkLength >= literalNode.value.length) {
  6775. return literalNode;
  6776. }
  6777. const stringChunks = SplitStringTransformer_1.chunkString(literalNode.value, chunkLength);
  6778. const binaryExpressionNode = this.transformStringChunksToBinaryExpressionNode(stringChunks);
  6779. NodeUtils_1.NodeUtils.parentizeAst(binaryExpressionNode);
  6780. NodeUtils_1.NodeUtils.parentizeNode(binaryExpressionNode, parentNode);
  6781. return binaryExpressionNode;
  6782. }
  6783. transformStringChunksToBinaryExpressionNode(chunks) {
  6784. const firstChunk = chunks.shift();
  6785. const secondChunk = chunks.shift();
  6786. if (!firstChunk || !secondChunk) {
  6787. throw new Error('First and second chunks values should not be empty');
  6788. }
  6789. const initialBinaryExpressionNode = NodeFactory_1.NodeFactory.binaryExpressionNode('+', NodeFactory_1.NodeFactory.literalNode(firstChunk), NodeFactory_1.NodeFactory.literalNode(secondChunk));
  6790. return chunks.reduce((binaryExpressionNode, chunk) => {
  6791. const chunkLiteralNode = NodeFactory_1.NodeFactory.literalNode(chunk);
  6792. return NodeFactory_1.NodeFactory.binaryExpressionNode('+', binaryExpressionNode, chunkLiteralNode);
  6793. }, initialBinaryExpressionNode);
  6794. }
  6795. };
  6796. SplitStringTransformer.firstPassChunkLength = 1000;
  6797. SplitStringTransformer = SplitStringTransformer_1 = __decorate([
  6798. inversify_1.injectable(),
  6799. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6800. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6801. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  6802. ], SplitStringTransformer);
  6803. exports.SplitStringTransformer = SplitStringTransformer;
  6804. /***/ }),
  6805. /***/ "./src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts":
  6806. /*!*************************************************************************************!*\
  6807. !*** ./src/node-transformers/converting-transformers/TemplateLiteralTransformer.ts ***!
  6808. \*************************************************************************************/
  6809. /*! no static exports found */
  6810. /***/ (function(module, exports, __webpack_require__) {
  6811. "use strict";
  6812. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6813. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6814. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6815. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6816. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6817. };
  6818. var __metadata = (this && this.__metadata) || function (k, v) {
  6819. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  6820. };
  6821. var __param = (this && this.__param) || function (paramIndex, decorator) {
  6822. return function (target, key) { decorator(target, key, paramIndex); }
  6823. };
  6824. var TemplateLiteralTransformer_1, _a, _b;
  6825. Object.defineProperty(exports, "__esModule", { value: true });
  6826. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6827. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  6828. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  6829. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  6830. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  6831. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  6832. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  6833. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6834. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  6835. let TemplateLiteralTransformer = TemplateLiteralTransformer_1 = class TemplateLiteralTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  6836. constructor(randomGenerator, options) {
  6837. super(randomGenerator, options);
  6838. }
  6839. static isLiteralNodeWithStringValue(node) {
  6840. return !!node && NodeGuards_1.NodeGuards.isLiteralNode(node) && typeof node.value === 'string';
  6841. }
  6842. static isValidTemplateLiteralNode(node, parentNode) {
  6843. return NodeGuards_1.NodeGuards.isTemplateLiteralNode(node) && !NodeGuards_1.NodeGuards.isTaggedTemplateExpressionNode(parentNode);
  6844. }
  6845. getVisitor(transformationStage) {
  6846. switch (transformationStage) {
  6847. case TransformationStage_1.TransformationStage.Converting:
  6848. return {
  6849. enter: (node, parentNode) => {
  6850. if (parentNode && TemplateLiteralTransformer_1.isValidTemplateLiteralNode(node, parentNode)) {
  6851. return this.transformNode(node, parentNode);
  6852. }
  6853. }
  6854. };
  6855. default:
  6856. return null;
  6857. }
  6858. }
  6859. transformNode(templateLiteralNode, parentNode) {
  6860. const templateLiteralExpressions = templateLiteralNode.expressions;
  6861. let nodes = [];
  6862. templateLiteralNode.quasis.forEach((templateElement) => {
  6863. nodes.push(NodeFactory_1.NodeFactory.literalNode(templateElement.value.cooked));
  6864. const expression = templateLiteralExpressions.shift();
  6865. if (!expression) {
  6866. return;
  6867. }
  6868. nodes.push(expression);
  6869. });
  6870. nodes = nodes.filter((node) => {
  6871. return !(NodeGuards_1.NodeGuards.isLiteralNode(node) && node.value === '');
  6872. });
  6873. if (!TemplateLiteralTransformer_1.isLiteralNodeWithStringValue(nodes[0]) &&
  6874. !TemplateLiteralTransformer_1.isLiteralNodeWithStringValue(nodes[1])) {
  6875. nodes.unshift(NodeFactory_1.NodeFactory.literalNode(''));
  6876. }
  6877. let transformedNode;
  6878. if (nodes.length > 1) {
  6879. let root = NodeFactory_1.NodeFactory.binaryExpressionNode('+', nodes.shift(), nodes.shift());
  6880. nodes.forEach((node) => {
  6881. root = NodeFactory_1.NodeFactory.binaryExpressionNode('+', root, node);
  6882. });
  6883. transformedNode = root;
  6884. }
  6885. else {
  6886. transformedNode = nodes[0];
  6887. }
  6888. NodeUtils_1.NodeUtils.parentizeAst(transformedNode);
  6889. NodeUtils_1.NodeUtils.parentizeNode(transformedNode, parentNode);
  6890. return transformedNode;
  6891. }
  6892. };
  6893. TemplateLiteralTransformer = TemplateLiteralTransformer_1 = __decorate([
  6894. inversify_1.injectable(),
  6895. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  6896. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  6897. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  6898. ], TemplateLiteralTransformer);
  6899. exports.TemplateLiteralTransformer = TemplateLiteralTransformer;
  6900. /***/ }),
  6901. /***/ "./src/node-transformers/converting-transformers/object-expression-extractors/BasePropertiesExtractor.ts":
  6902. /*!***************************************************************************************************************!*\
  6903. !*** ./src/node-transformers/converting-transformers/object-expression-extractors/BasePropertiesExtractor.ts ***!
  6904. \***************************************************************************************************************/
  6905. /*! no static exports found */
  6906. /***/ (function(module, exports, __webpack_require__) {
  6907. "use strict";
  6908. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6909. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  6910. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  6911. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6912. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6913. };
  6914. var BasePropertiesExtractor_1;
  6915. Object.defineProperty(exports, "__esModule", { value: true });
  6916. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  6917. const NodeAppender_1 = __webpack_require__(/*! ../../../node/NodeAppender */ "./src/node/NodeAppender.ts");
  6918. const NodeFactory_1 = __webpack_require__(/*! ../../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  6919. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  6920. const NodeStatementUtils_1 = __webpack_require__(/*! ../../../node/NodeStatementUtils */ "./src/node/NodeStatementUtils.ts");
  6921. let BasePropertiesExtractor = BasePropertiesExtractor_1 = class BasePropertiesExtractor {
  6922. static getPropertyNodeKeyName(propertyNode) {
  6923. const propertyKeyNode = propertyNode.key;
  6924. if (NodeGuards_1.NodeGuards.isLiteralNode(propertyKeyNode)
  6925. && (typeof propertyKeyNode.value === 'string'
  6926. || typeof propertyKeyNode.value === 'number')) {
  6927. return propertyKeyNode.value.toString();
  6928. }
  6929. if (NodeGuards_1.NodeGuards.isIdentifierNode(propertyKeyNode)) {
  6930. return propertyKeyNode.name;
  6931. }
  6932. return null;
  6933. }
  6934. static isProhibitedPattern(node) {
  6935. return !node
  6936. || NodeGuards_1.NodeGuards.isObjectPatternNode(node)
  6937. || NodeGuards_1.NodeGuards.isArrayPatternNode(node)
  6938. || NodeGuards_1.NodeGuards.isAssignmentPatternNode(node)
  6939. || NodeGuards_1.NodeGuards.isRestElementNode(node);
  6940. }
  6941. extract(objectExpressionNode, hostStatement) {
  6942. const hostNode = objectExpressionNode.parentNode;
  6943. if (hostNode
  6944. && NodeGuards_1.NodeGuards.isVariableDeclaratorNode(hostNode)
  6945. && NodeGuards_1.NodeGuards.isIdentifierNode(hostNode.id)) {
  6946. return this.transformObjectExpressionNode(objectExpressionNode, hostStatement, hostNode.id);
  6947. }
  6948. return {
  6949. nodeToReplace: objectExpressionNode,
  6950. objectExpressionHostStatement: hostStatement,
  6951. objectExpressionNode: objectExpressionNode
  6952. };
  6953. }
  6954. transformObjectExpressionNode(objectExpressionNode, hostStatement, memberExpressionHostNode) {
  6955. const properties = objectExpressionNode.properties;
  6956. const [expressionStatements, removablePropertyIds] = this
  6957. .extractPropertiesToExpressionStatements(properties, hostStatement, memberExpressionHostNode);
  6958. const hostNodeWithStatements = NodeStatementUtils_1.NodeStatementUtils.getScopeOfNode(hostStatement);
  6959. this.filterExtractedObjectExpressionProperties(objectExpressionNode, removablePropertyIds);
  6960. NodeAppender_1.NodeAppender.insertAfter(hostNodeWithStatements, expressionStatements, hostStatement);
  6961. return {
  6962. nodeToReplace: objectExpressionNode,
  6963. objectExpressionHostStatement: hostStatement,
  6964. objectExpressionNode: objectExpressionNode
  6965. };
  6966. }
  6967. extractPropertiesToExpressionStatements(properties, hostStatement, memberExpressionHostNode) {
  6968. const propertiesLength = properties.length;
  6969. const expressionStatements = [];
  6970. const removablePropertyIds = [];
  6971. for (let i = 0; i < propertiesLength; i++) {
  6972. const property = properties[i];
  6973. const propertyValue = property.value;
  6974. if (BasePropertiesExtractor_1.isProhibitedPattern(propertyValue)) {
  6975. continue;
  6976. }
  6977. const propertyKeyName = BasePropertiesExtractor_1.getPropertyNodeKeyName(property);
  6978. if (!propertyKeyName) {
  6979. continue;
  6980. }
  6981. const shouldCreateLiteralNode = !property.computed
  6982. || (property.computed && !!property.key && NodeGuards_1.NodeGuards.isLiteralNode(property.key));
  6983. const memberExpressionProperty = shouldCreateLiteralNode
  6984. ? NodeFactory_1.NodeFactory.literalNode(propertyKeyName)
  6985. : NodeFactory_1.NodeFactory.identifierNode(propertyKeyName);
  6986. const memberExpressionNode = NodeFactory_1.NodeFactory
  6987. .memberExpressionNode(memberExpressionHostNode, memberExpressionProperty, true);
  6988. const expressionStatementNode = NodeFactory_1.NodeFactory.expressionStatementNode(NodeFactory_1.NodeFactory.assignmentExpressionNode('=', memberExpressionNode, propertyValue));
  6989. if (NodeGuards_1.NodeGuards.isObjectExpressionNode(property.value)) {
  6990. this.transformObjectExpressionNode(property.value, hostStatement, memberExpressionNode);
  6991. }
  6992. expressionStatements.push(expressionStatementNode);
  6993. removablePropertyIds.push(i);
  6994. }
  6995. return [expressionStatements, removablePropertyIds];
  6996. }
  6997. filterExtractedObjectExpressionProperties(objectExpressionNode, removablePropertyIds) {
  6998. objectExpressionNode.properties = objectExpressionNode.properties
  6999. .filter((property, index) => !removablePropertyIds.includes(index));
  7000. }
  7001. };
  7002. BasePropertiesExtractor = BasePropertiesExtractor_1 = __decorate([
  7003. inversify_1.injectable()
  7004. ], BasePropertiesExtractor);
  7005. exports.BasePropertiesExtractor = BasePropertiesExtractor;
  7006. /***/ }),
  7007. /***/ "./src/node-transformers/converting-transformers/object-expression-extractors/ObjectExpressionToVariableDeclarationExtractor.ts":
  7008. /*!**************************************************************************************************************************************!*\
  7009. !*** ./src/node-transformers/converting-transformers/object-expression-extractors/ObjectExpressionToVariableDeclarationExtractor.ts ***!
  7010. \**************************************************************************************************************************************/
  7011. /*! no static exports found */
  7012. /***/ (function(module, exports, __webpack_require__) {
  7013. "use strict";
  7014. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7015. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7016. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  7017. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  7018. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7019. };
  7020. var __metadata = (this && this.__metadata) || function (k, v) {
  7021. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  7022. };
  7023. var __param = (this && this.__param) || function (paramIndex, decorator) {
  7024. return function (target, key) { decorator(target, key, paramIndex); }
  7025. };
  7026. var _a;
  7027. Object.defineProperty(exports, "__esModule", { value: true });
  7028. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  7029. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  7030. const TObjectExpressionKeysTransformerCustomNodeFactory_1 = __webpack_require__(/*! ../../../types/container/custom-nodes/TObjectExpressionKeysTransformerCustomNodeFactory */ "./src/types/container/custom-nodes/TObjectExpressionKeysTransformerCustomNodeFactory.ts");
  7031. const ObjectExpressionKeysTransformerCustomNode_1 = __webpack_require__(/*! ../../../enums/custom-nodes/ObjectExpressionKeysTransformerCustomNode */ "./src/enums/custom-nodes/ObjectExpressionKeysTransformerCustomNode.ts");
  7032. const NodeAppender_1 = __webpack_require__(/*! ../../../node/NodeAppender */ "./src/node/NodeAppender.ts");
  7033. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  7034. const NodeStatementUtils_1 = __webpack_require__(/*! ../../../node/NodeStatementUtils */ "./src/node/NodeStatementUtils.ts");
  7035. const NodeUtils_1 = __webpack_require__(/*! ../../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  7036. let ObjectExpressionToVariableDeclarationExtractor = class ObjectExpressionToVariableDeclarationExtractor {
  7037. constructor(objectExpressionKeysTransformerCustomNodeFactory) {
  7038. this.objectExpressionKeysTransformerCustomNodeFactory = objectExpressionKeysTransformerCustomNodeFactory;
  7039. }
  7040. extract(objectExpressionNode, hostStatement) {
  7041. return this.transformObjectExpressionToVariableDeclaration(objectExpressionNode, hostStatement);
  7042. }
  7043. transformObjectExpressionToVariableDeclaration(objectExpressionNode, hostStatement) {
  7044. const properties = objectExpressionNode.properties;
  7045. const newObjectExpressionHostStatement = this.getObjectExpressionHostNode(properties);
  7046. const newObjectExpressionIdentifier = this.getObjectExpressionIdentifierNode(newObjectExpressionHostStatement);
  7047. const newObjectExpressionNode = this.getObjectExpressionNode(newObjectExpressionHostStatement);
  7048. const statementsToInsert = [newObjectExpressionHostStatement];
  7049. const hostNodeWithStatements = NodeStatementUtils_1.NodeStatementUtils.getScopeOfNode(hostStatement);
  7050. NodeAppender_1.NodeAppender.insertBefore(hostNodeWithStatements, statementsToInsert, hostStatement);
  7051. NodeUtils_1.NodeUtils.parentizeAst(newObjectExpressionHostStatement);
  7052. NodeUtils_1.NodeUtils.parentizeNode(newObjectExpressionHostStatement, hostNodeWithStatements);
  7053. return {
  7054. nodeToReplace: newObjectExpressionIdentifier,
  7055. objectExpressionHostStatement: newObjectExpressionHostStatement,
  7056. objectExpressionNode: newObjectExpressionNode
  7057. };
  7058. }
  7059. getObjectExpressionHostNode(properties) {
  7060. const variableDeclarationHostNodeCustomNode = this.objectExpressionKeysTransformerCustomNodeFactory(ObjectExpressionKeysTransformerCustomNode_1.ObjectExpressionKeysTransformerCustomNode.ObjectExpressionVariableDeclarationHostNode);
  7061. variableDeclarationHostNodeCustomNode.initialize(properties);
  7062. const statementNode = variableDeclarationHostNodeCustomNode.getNode()[0];
  7063. if (!statementNode
  7064. || !NodeGuards_1.NodeGuards.isVariableDeclarationNode(statementNode)) {
  7065. throw new Error('`objectExpressionHostCustomNode.getNode()[0]` should returns array with `VariableDeclaration` node');
  7066. }
  7067. return statementNode;
  7068. }
  7069. getObjectExpressionIdentifierNode(objectExpressionHostNode) {
  7070. const newObjectExpressionIdentifierNode = objectExpressionHostNode.declarations[0].id;
  7071. if (!NodeGuards_1.NodeGuards.isIdentifierNode(newObjectExpressionIdentifierNode)) {
  7072. throw new Error('`objectExpressionHostNode` should contain `VariableDeclarator` node with `Identifier` id property');
  7073. }
  7074. return newObjectExpressionIdentifierNode;
  7075. }
  7076. getObjectExpressionNode(objectExpressionHostNode) {
  7077. var _a;
  7078. const newObjectExpressionNode = (_a = objectExpressionHostNode.declarations[0].init) !== null && _a !== void 0 ? _a : null;
  7079. if (!newObjectExpressionNode || !NodeGuards_1.NodeGuards.isObjectExpressionNode(newObjectExpressionNode)) {
  7080. throw new Error('`objectExpressionHostNode` should contain `VariableDeclarator` node with `ObjectExpression` init property');
  7081. }
  7082. return newObjectExpressionNode;
  7083. }
  7084. };
  7085. ObjectExpressionToVariableDeclarationExtractor = __decorate([
  7086. inversify_1.injectable(),
  7087. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObjectExpressionKeysTransformerCustomNode)),
  7088. __metadata("design:paramtypes", [typeof (_a = typeof TObjectExpressionKeysTransformerCustomNodeFactory_1.TObjectExpressionKeysTransformerCustomNodeFactory !== "undefined" && TObjectExpressionKeysTransformerCustomNodeFactory_1.TObjectExpressionKeysTransformerCustomNodeFactory) === "function" ? _a : Object])
  7089. ], ObjectExpressionToVariableDeclarationExtractor);
  7090. exports.ObjectExpressionToVariableDeclarationExtractor = ObjectExpressionToVariableDeclarationExtractor;
  7091. /***/ }),
  7092. /***/ "./src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts":
  7093. /*!************************************************************************************************!*\
  7094. !*** ./src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.ts ***!
  7095. \************************************************************************************************/
  7096. /*! no static exports found */
  7097. /***/ (function(module, exports, __webpack_require__) {
  7098. "use strict";
  7099. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7100. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7101. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  7102. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  7103. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7104. };
  7105. var __metadata = (this && this.__metadata) || function (k, v) {
  7106. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  7107. };
  7108. var __param = (this && this.__param) || function (paramIndex, decorator) {
  7109. return function (target, key) { decorator(target, key, paramIndex); }
  7110. };
  7111. var __importStar = (this && this.__importStar) || function (mod) {
  7112. if (mod && mod.__esModule) return mod;
  7113. var result = {};
  7114. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  7115. result["default"] = mod;
  7116. return result;
  7117. };
  7118. var DeadCodeInjectionTransformer_1, _a, _b, _c, _d;
  7119. Object.defineProperty(exports, "__esModule", { value: true });
  7120. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  7121. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  7122. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  7123. const TDeadNodeInjectionCustomNodeFactory_1 = __webpack_require__(/*! ../../types/container/custom-nodes/TDeadNodeInjectionCustomNodeFactory */ "./src/types/container/custom-nodes/TDeadNodeInjectionCustomNodeFactory.ts");
  7124. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  7125. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  7126. const ITransformersRunner_1 = __webpack_require__(/*! ../../interfaces/node-transformers/ITransformersRunner */ "./src/interfaces/node-transformers/ITransformersRunner.ts");
  7127. const DeadCodeInjectionCustomNode_1 = __webpack_require__(/*! ../../enums/custom-nodes/DeadCodeInjectionCustomNode */ "./src/enums/custom-nodes/DeadCodeInjectionCustomNode.ts");
  7128. const NodeTransformer_1 = __webpack_require__(/*! ../../enums/node-transformers/NodeTransformer */ "./src/enums/node-transformers/NodeTransformer.ts");
  7129. const NodeType_1 = __webpack_require__(/*! ../../enums/node/NodeType */ "./src/enums/node/NodeType.ts");
  7130. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  7131. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  7132. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  7133. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  7134. const NodeStatementUtils_1 = __webpack_require__(/*! ../../node/NodeStatementUtils */ "./src/node/NodeStatementUtils.ts");
  7135. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  7136. let DeadCodeInjectionTransformer = DeadCodeInjectionTransformer_1 = class DeadCodeInjectionTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  7137. constructor(deadCodeInjectionCustomNodeFactory, transformersRunner, randomGenerator, options) {
  7138. super(randomGenerator, options);
  7139. this.deadCodeInjectionRootAstHostNodeSet = new Set();
  7140. this.collectedBlockStatements = [];
  7141. this.collectedBlockStatementsTotalLength = 0;
  7142. this.deadCodeInjectionCustomNodeFactory = deadCodeInjectionCustomNodeFactory;
  7143. this.transformersRunner = transformersRunner;
  7144. }
  7145. static isProhibitedNodeInsideCollectedBlockStatement(targetNode) {
  7146. return NodeGuards_1.NodeGuards.isBreakStatementNode(targetNode)
  7147. || NodeGuards_1.NodeGuards.isContinueStatementNode(targetNode)
  7148. || NodeGuards_1.NodeGuards.isAwaitExpressionNode(targetNode)
  7149. || NodeGuards_1.NodeGuards.isSuperNode(targetNode);
  7150. }
  7151. static isScopeHoistingFunctionDeclaration(targetNode) {
  7152. if (!NodeGuards_1.NodeGuards.isFunctionDeclarationNode(targetNode)) {
  7153. return false;
  7154. }
  7155. const scopeNode = NodeStatementUtils_1.NodeStatementUtils.getScopeOfNode(targetNode);
  7156. const scopeBody = !NodeGuards_1.NodeGuards.isSwitchCaseNode(scopeNode)
  7157. ? scopeNode.body
  7158. : scopeNode.consequent;
  7159. const indexInScope = scopeBody.indexOf(targetNode);
  7160. if (indexInScope === 0) {
  7161. return false;
  7162. }
  7163. const slicedBody = scopeBody.slice(0, indexInScope);
  7164. const hostBlockStatementNode = NodeFactory_1.NodeFactory.blockStatementNode(slicedBody);
  7165. const functionDeclarationName = targetNode.id.name;
  7166. let isScopeHoistedFunctionDeclaration = false;
  7167. estraverse.traverse(hostBlockStatementNode, {
  7168. enter: (node) => {
  7169. if (NodeGuards_1.NodeGuards.isIdentifierNode(node) && node.name === functionDeclarationName) {
  7170. isScopeHoistedFunctionDeclaration = true;
  7171. return estraverse.VisitorOption.Break;
  7172. }
  7173. }
  7174. });
  7175. return isScopeHoistedFunctionDeclaration;
  7176. }
  7177. static isValidCollectedBlockStatementNode(blockStatementNode) {
  7178. if (!blockStatementNode.body.length) {
  7179. return false;
  7180. }
  7181. let nestedBlockStatementsCount = 0;
  7182. let isValidBlockStatementNode = true;
  7183. estraverse.traverse(blockStatementNode, {
  7184. enter: (node) => {
  7185. if (NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  7186. nestedBlockStatementsCount++;
  7187. }
  7188. if (nestedBlockStatementsCount > DeadCodeInjectionTransformer_1.maxNestedBlockStatementsCount
  7189. || DeadCodeInjectionTransformer_1.isProhibitedNodeInsideCollectedBlockStatement(node)
  7190. || DeadCodeInjectionTransformer_1.isScopeHoistingFunctionDeclaration(node)) {
  7191. isValidBlockStatementNode = false;
  7192. return estraverse.VisitorOption.Break;
  7193. }
  7194. }
  7195. });
  7196. return isValidBlockStatementNode;
  7197. }
  7198. static isValidWrappedBlockStatementNode(blockStatementNode) {
  7199. if (!blockStatementNode.body.length) {
  7200. return false;
  7201. }
  7202. let isValidBlockStatementNode = true;
  7203. estraverse.traverse(blockStatementNode, {
  7204. enter: (node) => {
  7205. if (DeadCodeInjectionTransformer_1.isScopeHoistingFunctionDeclaration(node)) {
  7206. isValidBlockStatementNode = false;
  7207. return estraverse.VisitorOption.Break;
  7208. }
  7209. }
  7210. });
  7211. if (!isValidBlockStatementNode) {
  7212. return false;
  7213. }
  7214. const parentNodeWithStatements = NodeStatementUtils_1.NodeStatementUtils
  7215. .getParentNodeWithStatements(blockStatementNode);
  7216. return parentNodeWithStatements.type !== NodeType_1.NodeType.Program;
  7217. }
  7218. getVisitor(transformationStage) {
  7219. switch (transformationStage) {
  7220. case TransformationStage_1.TransformationStage.DeadCodeInjection:
  7221. return {
  7222. enter: (node, parentNode) => {
  7223. if (parentNode && NodeGuards_1.NodeGuards.isProgramNode(node)) {
  7224. this.analyzeNode(node, parentNode);
  7225. return node;
  7226. }
  7227. },
  7228. leave: (node, parentNode) => {
  7229. if (parentNode && NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  7230. return this.transformNode(node, parentNode);
  7231. }
  7232. }
  7233. };
  7234. case TransformationStage_1.TransformationStage.Finalizing:
  7235. if (!this.deadCodeInjectionRootAstHostNodeSet.size) {
  7236. return null;
  7237. }
  7238. return {
  7239. enter: (node, parentNode) => {
  7240. if (parentNode && this.isDeadCodeInjectionRootAstHostNode(node)) {
  7241. return this.restoreNode(node, parentNode);
  7242. }
  7243. }
  7244. };
  7245. default:
  7246. return null;
  7247. }
  7248. }
  7249. analyzeNode(programNode, parentNode) {
  7250. estraverse.traverse(programNode, {
  7251. enter: (node) => {
  7252. if (!NodeGuards_1.NodeGuards.isBlockStatementNode(node)) {
  7253. return;
  7254. }
  7255. const clonedBlockStatementNode = NodeUtils_1.NodeUtils.clone(node);
  7256. if (!DeadCodeInjectionTransformer_1.isValidCollectedBlockStatementNode(clonedBlockStatementNode)) {
  7257. return;
  7258. }
  7259. const transformedBlockStatementNode = this.makeClonedBlockStatementNodeUnique(clonedBlockStatementNode);
  7260. this.collectedBlockStatements.push(transformedBlockStatementNode);
  7261. }
  7262. });
  7263. this.collectedBlockStatementsTotalLength = this.collectedBlockStatements.length;
  7264. }
  7265. transformNode(blockStatementNode, parentNode) {
  7266. const canBreakTraverse = !this.collectedBlockStatements.length
  7267. || this.collectedBlockStatementsTotalLength < DeadCodeInjectionTransformer_1.minCollectedBlockStatementsCount;
  7268. if (canBreakTraverse) {
  7269. return estraverse.VisitorOption.Break;
  7270. }
  7271. if (this.randomGenerator.getMathRandom() > this.options.deadCodeInjectionThreshold
  7272. || !DeadCodeInjectionTransformer_1.isValidWrappedBlockStatementNode(blockStatementNode)) {
  7273. return blockStatementNode;
  7274. }
  7275. const minInteger = 0;
  7276. const maxInteger = this.collectedBlockStatements.length - 1;
  7277. const randomIndex = this.randomGenerator.getRandomInteger(minInteger, maxInteger);
  7278. const randomBlockStatementNode = this.collectedBlockStatements.splice(randomIndex, 1)[0];
  7279. const isDuplicateBlockStatementNodes = randomBlockStatementNode === blockStatementNode;
  7280. if (isDuplicateBlockStatementNodes) {
  7281. return blockStatementNode;
  7282. }
  7283. return this.replaceBlockStatementNode(blockStatementNode, randomBlockStatementNode, parentNode);
  7284. }
  7285. restoreNode(deadCodeInjectionRootAstHostNode, parentNode) {
  7286. const hostNodeFirstStatement = deadCodeInjectionRootAstHostNode.body[0];
  7287. if (!NodeGuards_1.NodeGuards.isFunctionDeclarationNode(hostNodeFirstStatement)) {
  7288. throw new Error('Wrong dead code injection root AST host node. Host node should contain `FunctionDeclaration` node');
  7289. }
  7290. return hostNodeFirstStatement.body;
  7291. }
  7292. isDeadCodeInjectionRootAstHostNode(node) {
  7293. return NodeGuards_1.NodeGuards.isBlockStatementNode(node) && this.deadCodeInjectionRootAstHostNodeSet.has(node);
  7294. }
  7295. makeClonedBlockStatementNodeUnique(clonedBlockStatementNode) {
  7296. const hostNode = NodeFactory_1.NodeFactory
  7297. .functionExpressionNode([], clonedBlockStatementNode);
  7298. NodeUtils_1.NodeUtils.parentizeNode(hostNode, hostNode);
  7299. NodeUtils_1.NodeUtils.parentizeNode(clonedBlockStatementNode, hostNode);
  7300. return this.transformersRunner.transform(hostNode, DeadCodeInjectionTransformer_1.transformersToRenameBlockScopeIdentifiers, TransformationStage_1.TransformationStage.Obfuscating).body;
  7301. }
  7302. replaceBlockStatementNode(blockStatementNode, randomBlockStatementNode, parentNode) {
  7303. const deadCodeInjectionRootAstHostNode = NodeFactory_1.NodeFactory.blockStatementNode([
  7304. NodeFactory_1.NodeFactory.functionDeclarationNode(DeadCodeInjectionTransformer_1.deadCodeInjectionRootAstHostNodeName, [], randomBlockStatementNode)
  7305. ]);
  7306. this.deadCodeInjectionRootAstHostNodeSet.add(deadCodeInjectionRootAstHostNode);
  7307. const blockStatementDeadCodeInjectionCustomNode = this.deadCodeInjectionCustomNodeFactory(DeadCodeInjectionCustomNode_1.DeadCodeInjectionCustomNode.BlockStatementDeadCodeInjectionNode);
  7308. blockStatementDeadCodeInjectionCustomNode.initialize(blockStatementNode, deadCodeInjectionRootAstHostNode);
  7309. const newBlockStatementNode = blockStatementDeadCodeInjectionCustomNode.getNode()[0];
  7310. NodeUtils_1.NodeUtils.parentizeNode(newBlockStatementNode, parentNode);
  7311. return newBlockStatementNode;
  7312. }
  7313. };
  7314. DeadCodeInjectionTransformer.deadCodeInjectionRootAstHostNodeName = 'deadCodeInjectionRootAstHostNode';
  7315. DeadCodeInjectionTransformer.maxNestedBlockStatementsCount = 4;
  7316. DeadCodeInjectionTransformer.minCollectedBlockStatementsCount = 5;
  7317. DeadCodeInjectionTransformer.transformersToRenameBlockScopeIdentifiers = [
  7318. NodeTransformer_1.NodeTransformer.LabeledStatementTransformer,
  7319. NodeTransformer_1.NodeTransformer.ScopeIdentifiersTransformer
  7320. ];
  7321. DeadCodeInjectionTransformer = DeadCodeInjectionTransformer_1 = __decorate([
  7322. inversify_1.injectable(),
  7323. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IDeadCodeInjectionCustomNode)),
  7324. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ITransformersRunner)),
  7325. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  7326. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  7327. __metadata("design:paramtypes", [typeof (_a = typeof TDeadNodeInjectionCustomNodeFactory_1.TDeadNodeInjectionCustomNodeFactory !== "undefined" && TDeadNodeInjectionCustomNodeFactory_1.TDeadNodeInjectionCustomNodeFactory) === "function" ? _a : Object, typeof (_b = typeof ITransformersRunner_1.ITransformersRunner !== "undefined" && ITransformersRunner_1.ITransformersRunner) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object])
  7328. ], DeadCodeInjectionTransformer);
  7329. exports.DeadCodeInjectionTransformer = DeadCodeInjectionTransformer;
  7330. /***/ }),
  7331. /***/ "./src/node-transformers/obfuscating-transformers/LabeledStatementTransformer.ts":
  7332. /*!***************************************************************************************!*\
  7333. !*** ./src/node-transformers/obfuscating-transformers/LabeledStatementTransformer.ts ***!
  7334. \***************************************************************************************/
  7335. /*! no static exports found */
  7336. /***/ (function(module, exports, __webpack_require__) {
  7337. "use strict";
  7338. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7339. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7340. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  7341. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  7342. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7343. };
  7344. var __metadata = (this && this.__metadata) || function (k, v) {
  7345. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  7346. };
  7347. var __param = (this && this.__param) || function (paramIndex, decorator) {
  7348. return function (target, key) { decorator(target, key, paramIndex); }
  7349. };
  7350. var __importStar = (this && this.__importStar) || function (mod) {
  7351. if (mod && mod.__esModule) return mod;
  7352. var result = {};
  7353. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  7354. result["default"] = mod;
  7355. return result;
  7356. };
  7357. var _a, _b, _c;
  7358. Object.defineProperty(exports, "__esModule", { value: true });
  7359. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  7360. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  7361. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  7362. const TIdentifierObfuscatingReplacerFactory_1 = __webpack_require__(/*! ../../types/container/node-transformers/TIdentifierObfuscatingReplacerFactory */ "./src/types/container/node-transformers/TIdentifierObfuscatingReplacerFactory.ts");
  7363. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  7364. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  7365. const IdentifierObfuscatingReplacer_1 = __webpack_require__(/*! ../../enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer */ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer.ts");
  7366. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  7367. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  7368. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  7369. const NodeLexicalScopeUtils_1 = __webpack_require__(/*! ../../node/NodeLexicalScopeUtils */ "./src/node/NodeLexicalScopeUtils.ts");
  7370. let LabeledStatementTransformer = class LabeledStatementTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  7371. constructor(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  7372. super(randomGenerator, options);
  7373. this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  7374. }
  7375. getVisitor(transformationStage) {
  7376. switch (transformationStage) {
  7377. case TransformationStage_1.TransformationStage.Obfuscating:
  7378. return {
  7379. enter: (node, parentNode) => {
  7380. if (parentNode && NodeGuards_1.NodeGuards.isLabeledStatementNode(node)) {
  7381. return this.transformNode(node, parentNode);
  7382. }
  7383. }
  7384. };
  7385. default:
  7386. return null;
  7387. }
  7388. }
  7389. transformNode(labeledStatementNode, parentNode) {
  7390. const lexicalScopeNode = NodeLexicalScopeUtils_1.NodeLexicalScopeUtils.getLexicalScope(labeledStatementNode);
  7391. if (!lexicalScopeNode) {
  7392. return labeledStatementNode;
  7393. }
  7394. this.storeLabeledStatementName(labeledStatementNode, lexicalScopeNode);
  7395. this.replaceLabeledStatementName(labeledStatementNode, lexicalScopeNode);
  7396. return labeledStatementNode;
  7397. }
  7398. storeLabeledStatementName(labeledStatementNode, lexicalScopeNode) {
  7399. this.identifierObfuscatingReplacer.storeLocalName(labeledStatementNode.label, lexicalScopeNode);
  7400. }
  7401. replaceLabeledStatementName(labeledStatementNode, lexicalScopeNode) {
  7402. estraverse.replace(labeledStatementNode, {
  7403. enter: (node, parentNode) => {
  7404. if (parentNode && NodeGuards_1.NodeGuards.isLabelIdentifierNode(node, parentNode)) {
  7405. const newIdentifier = this.identifierObfuscatingReplacer
  7406. .replace(node, lexicalScopeNode);
  7407. node.name = newIdentifier.name;
  7408. }
  7409. }
  7410. });
  7411. }
  7412. };
  7413. LabeledStatementTransformer = __decorate([
  7414. inversify_1.injectable(),
  7415. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)),
  7416. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  7417. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  7418. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierObfuscatingReplacerFactory_1.TIdentifierObfuscatingReplacerFactory !== "undefined" && TIdentifierObfuscatingReplacerFactory_1.TIdentifierObfuscatingReplacerFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  7419. ], LabeledStatementTransformer);
  7420. exports.LabeledStatementTransformer = LabeledStatementTransformer;
  7421. /***/ }),
  7422. /***/ "./src/node-transformers/obfuscating-transformers/LiteralTransformer.ts":
  7423. /*!******************************************************************************!*\
  7424. !*** ./src/node-transformers/obfuscating-transformers/LiteralTransformer.ts ***!
  7425. \******************************************************************************/
  7426. /*! no static exports found */
  7427. /***/ (function(module, exports, __webpack_require__) {
  7428. "use strict";
  7429. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7430. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7431. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  7432. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  7433. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7434. };
  7435. var __metadata = (this && this.__metadata) || function (k, v) {
  7436. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  7437. };
  7438. var __param = (this && this.__param) || function (paramIndex, decorator) {
  7439. return function (target, key) { decorator(target, key, paramIndex); }
  7440. };
  7441. var _a, _b, _c, _d, _e;
  7442. Object.defineProperty(exports, "__esModule", { value: true });
  7443. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  7444. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  7445. const TLiteralObfuscatingReplacerFactory_1 = __webpack_require__(/*! ../../types/container/node-transformers/TLiteralObfuscatingReplacerFactory */ "./src/types/container/node-transformers/TLiteralObfuscatingReplacerFactory.ts");
  7446. const IEscapeSequenceEncoder_1 = __webpack_require__(/*! ../../interfaces/utils/IEscapeSequenceEncoder */ "./src/interfaces/utils/IEscapeSequenceEncoder.ts");
  7447. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  7448. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  7449. const IStringArrayStorageAnalyzer_1 = __webpack_require__(/*! ../../interfaces/analyzers/string-array-storage-analyzer/IStringArrayStorageAnalyzer */ "./src/interfaces/analyzers/string-array-storage-analyzer/IStringArrayStorageAnalyzer.ts");
  7450. const LiteralObfuscatingReplacer_1 = __webpack_require__(/*! ../../enums/node-transformers/obfuscating-transformers/obfuscating-replacers/LiteralObfuscatingReplacer */ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/LiteralObfuscatingReplacer.ts");
  7451. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  7452. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  7453. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  7454. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  7455. const NodeLiteralUtils_1 = __webpack_require__(/*! ../../node/NodeLiteralUtils */ "./src/node/NodeLiteralUtils.ts");
  7456. const NodeMetadata_1 = __webpack_require__(/*! ../../node/NodeMetadata */ "./src/node/NodeMetadata.ts");
  7457. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  7458. let LiteralTransformer = class LiteralTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  7459. constructor(literalObfuscatingReplacerFactory, randomGenerator, options, stringArrayStorageAnalyzer, escapeSequenceEncoder) {
  7460. super(randomGenerator, options);
  7461. this.literalObfuscatingReplacerFactory = literalObfuscatingReplacerFactory;
  7462. this.stringArrayStorageAnalyzer = stringArrayStorageAnalyzer;
  7463. this.escapeSequenceEncoder = escapeSequenceEncoder;
  7464. }
  7465. getVisitor(transformationStage) {
  7466. switch (transformationStage) {
  7467. case TransformationStage_1.TransformationStage.Obfuscating:
  7468. return {
  7469. enter: (node, parentNode) => {
  7470. if (NodeGuards_1.NodeGuards.isProgramNode(node)) {
  7471. this.analyzeNode(node);
  7472. }
  7473. if (parentNode && NodeGuards_1.NodeGuards.isLiteralNode(node) && !NodeMetadata_1.NodeMetadata.isReplacedLiteral(node)) {
  7474. return this.transformNode(node, parentNode);
  7475. }
  7476. }
  7477. };
  7478. case TransformationStage_1.TransformationStage.Finalizing:
  7479. return {
  7480. enter: (node, parentNode) => {
  7481. if (parentNode && NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  7482. return this.encodeLiteralNodeToEscapeSequence(node, parentNode);
  7483. }
  7484. }
  7485. };
  7486. default:
  7487. return null;
  7488. }
  7489. }
  7490. analyzeNode(programNode) {
  7491. this.stringArrayStorageAnalyzer.analyze(programNode);
  7492. }
  7493. transformNode(literalNode, parentNode) {
  7494. if (NodeLiteralUtils_1.NodeLiteralUtils.isProhibitedLiteralNode(literalNode, parentNode)) {
  7495. return literalNode;
  7496. }
  7497. let newLiteralNode;
  7498. switch (typeof literalNode.value) {
  7499. case 'boolean':
  7500. newLiteralNode = this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.BooleanLiteralObfuscatingReplacer).replace(literalNode);
  7501. break;
  7502. case 'number':
  7503. newLiteralNode = this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.NumberLiteralObfuscatingReplacer).replace(literalNode);
  7504. break;
  7505. case 'string':
  7506. newLiteralNode = this.literalObfuscatingReplacerFactory(LiteralObfuscatingReplacer_1.LiteralObfuscatingReplacer.StringLiteralObfuscatingReplacer).replace(literalNode);
  7507. break;
  7508. default:
  7509. newLiteralNode = literalNode;
  7510. }
  7511. NodeUtils_1.NodeUtils.parentizeNode(newLiteralNode, parentNode);
  7512. return newLiteralNode;
  7513. }
  7514. encodeLiteralNodeToEscapeSequence(literalNode, parentNode) {
  7515. if (typeof literalNode.value !== 'string') {
  7516. return literalNode;
  7517. }
  7518. return NodeFactory_1.NodeFactory.literalNode(this.escapeSequenceEncoder.encode(literalNode.value, this.options.unicodeEscapeSequence));
  7519. }
  7520. };
  7521. LiteralTransformer = __decorate([
  7522. inversify_1.injectable(),
  7523. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IObfuscatingReplacer)),
  7524. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  7525. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  7526. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IStringArrayStorageAnalyzer)),
  7527. __param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)),
  7528. __metadata("design:paramtypes", [typeof (_a = typeof TLiteralObfuscatingReplacerFactory_1.TLiteralObfuscatingReplacerFactory !== "undefined" && TLiteralObfuscatingReplacerFactory_1.TLiteralObfuscatingReplacerFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object, typeof (_d = typeof IStringArrayStorageAnalyzer_1.IStringArrayStorageAnalyzer !== "undefined" && IStringArrayStorageAnalyzer_1.IStringArrayStorageAnalyzer) === "function" ? _d : Object, typeof (_e = typeof IEscapeSequenceEncoder_1.IEscapeSequenceEncoder !== "undefined" && IEscapeSequenceEncoder_1.IEscapeSequenceEncoder) === "function" ? _e : Object])
  7529. ], LiteralTransformer);
  7530. exports.LiteralTransformer = LiteralTransformer;
  7531. /***/ }),
  7532. /***/ "./src/node-transformers/obfuscating-transformers/ScopeIdentifiersTransformer.ts":
  7533. /*!***************************************************************************************!*\
  7534. !*** ./src/node-transformers/obfuscating-transformers/ScopeIdentifiersTransformer.ts ***!
  7535. \***************************************************************************************/
  7536. /*! no static exports found */
  7537. /***/ (function(module, exports, __webpack_require__) {
  7538. "use strict";
  7539. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7540. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7541. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  7542. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  7543. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7544. };
  7545. var __metadata = (this && this.__metadata) || function (k, v) {
  7546. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  7547. };
  7548. var __param = (this && this.__param) || function (paramIndex, decorator) {
  7549. return function (target, key) { decorator(target, key, paramIndex); }
  7550. };
  7551. var __importStar = (this && this.__importStar) || function (mod) {
  7552. if (mod && mod.__esModule) return mod;
  7553. var result = {};
  7554. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  7555. result["default"] = mod;
  7556. return result;
  7557. };
  7558. var ScopeIdentifiersTransformer_1, _a, _b, _c, _d;
  7559. Object.defineProperty(exports, "__esModule", { value: true });
  7560. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  7561. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  7562. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  7563. const TIdentifierObfuscatingReplacerFactory_1 = __webpack_require__(/*! ../../types/container/node-transformers/TIdentifierObfuscatingReplacerFactory */ "./src/types/container/node-transformers/TIdentifierObfuscatingReplacerFactory.ts");
  7564. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  7565. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  7566. const IScopeAnalyzer_1 = __webpack_require__(/*! ../../interfaces/analyzers/scope-analyzer/IScopeAnalyzer */ "./src/interfaces/analyzers/scope-analyzer/IScopeAnalyzer.ts");
  7567. const IdentifierObfuscatingReplacer_1 = __webpack_require__(/*! ../../enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer */ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer.ts");
  7568. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  7569. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  7570. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  7571. const NodeMetadata_1 = __webpack_require__(/*! ../../node/NodeMetadata */ "./src/node/NodeMetadata.ts");
  7572. let ScopeIdentifiersTransformer = ScopeIdentifiersTransformer_1 = class ScopeIdentifiersTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  7573. constructor(identifierObfuscatingReplacerFactory, randomGenerator, options, scopeAnalyzer) {
  7574. super(randomGenerator, options);
  7575. this.lexicalScopesWithObjectPatternWithoutDeclarationMap = new Map();
  7576. this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  7577. this.scopeAnalyzer = scopeAnalyzer;
  7578. }
  7579. getVisitor(transformationStage) {
  7580. switch (transformationStage) {
  7581. case TransformationStage_1.TransformationStage.Obfuscating:
  7582. return {
  7583. enter: (node, parentNode) => {
  7584. if (parentNode && NodeGuards_1.NodeGuards.isProgramNode(node)) {
  7585. this.analyzeNode(node, parentNode);
  7586. return this.transformNode(node, parentNode);
  7587. }
  7588. }
  7589. };
  7590. default:
  7591. return null;
  7592. }
  7593. }
  7594. analyzeNode(programNode, parentNode) {
  7595. this.scopeAnalyzer.analyze(programNode);
  7596. }
  7597. transformNode(programNode, parentNode) {
  7598. const globalScope = this.scopeAnalyzer.acquireScope(programNode);
  7599. this.traverseScopeVariables(globalScope);
  7600. return programNode;
  7601. }
  7602. traverseScopeVariables(scope) {
  7603. const lexicalScope = scope.variableScope;
  7604. const nodeWithLexicalScope = NodeGuards_1.NodeGuards.isNodeWithBlockLexicalScope(lexicalScope.block)
  7605. ? lexicalScope.block
  7606. : null;
  7607. const isGlobalDeclaration = ScopeIdentifiersTransformer_1.globalScopeNames.includes(lexicalScope.type);
  7608. if (!nodeWithLexicalScope) {
  7609. return;
  7610. }
  7611. for (const variable of scope.variables) {
  7612. if (variable.name === ScopeIdentifiersTransformer_1.argumentsVariableName) {
  7613. continue;
  7614. }
  7615. if (!this.options.renameGlobals && isGlobalDeclaration) {
  7616. const isImportBindingOrCatchClauseIdentifier = variable.defs
  7617. .every((definition) => definition.type === 'ImportBinding'
  7618. || definition.type === 'CatchClause');
  7619. if (!isImportBindingOrCatchClauseIdentifier) {
  7620. continue;
  7621. }
  7622. }
  7623. this.transformScopeVariableIdentifiers(variable, nodeWithLexicalScope, isGlobalDeclaration);
  7624. }
  7625. for (const childScope of scope.childScopes) {
  7626. this.traverseScopeVariables(childScope);
  7627. }
  7628. }
  7629. transformScopeVariableIdentifiers(variable, lexicalScopeNode, isGlobalDeclaration) {
  7630. for (const identifier of variable.identifiers) {
  7631. if (!this.isReplaceableIdentifierNode(identifier, lexicalScopeNode, variable)) {
  7632. continue;
  7633. }
  7634. this.storeIdentifierName(identifier, lexicalScopeNode, isGlobalDeclaration);
  7635. this.replaceIdentifierName(identifier, lexicalScopeNode, variable);
  7636. }
  7637. }
  7638. storeIdentifierName(identifierNode, lexicalScopeNode, isGlobalDeclaration) {
  7639. if (isGlobalDeclaration) {
  7640. this.identifierObfuscatingReplacer.storeGlobalName(identifierNode, lexicalScopeNode);
  7641. }
  7642. else {
  7643. this.identifierObfuscatingReplacer.storeLocalName(identifierNode, lexicalScopeNode);
  7644. }
  7645. }
  7646. replaceIdentifierName(identifierNode, lexicalScopeNode, variable) {
  7647. const newIdentifier = this.identifierObfuscatingReplacer
  7648. .replace(identifierNode, lexicalScopeNode);
  7649. identifierNode.name = newIdentifier.name;
  7650. variable.references.forEach((reference) => {
  7651. reference.identifier.name = identifierNode.name;
  7652. });
  7653. }
  7654. isReplaceableIdentifierNode(identifierNode, lexicalScopeNode, variable) {
  7655. const parentNode = identifierNode.parentNode;
  7656. return !!parentNode
  7657. && !NodeMetadata_1.NodeMetadata.isIgnoredNode(identifierNode)
  7658. && !this.isProhibitedPropertyNode(identifierNode, parentNode)
  7659. && !this.isProhibitedClassDeclarationNameIdentifierNode(variable, identifierNode, parentNode)
  7660. && !this.isProhibitedExportNamedClassDeclarationIdentifierNode(identifierNode, parentNode)
  7661. && !this.isProhibitedExportNamedFunctionDeclarationIdentifierNode(identifierNode, parentNode)
  7662. && !this.isProhibitedExportNamedVariableDeclarationIdentifierNode(identifierNode, parentNode)
  7663. && !this.isProhibitedImportSpecifierNode(identifierNode, parentNode)
  7664. && !this.isProhibitedVariableNameUsedInObjectPatternNode(variable, identifierNode, lexicalScopeNode)
  7665. && !NodeGuards_1.NodeGuards.isLabelIdentifierNode(identifierNode, parentNode);
  7666. }
  7667. isProhibitedClassDeclarationNameIdentifierNode(variable, identifierNode, parentNode) {
  7668. return NodeGuards_1.NodeGuards.isClassDeclarationNode(variable.scope.block)
  7669. && NodeGuards_1.NodeGuards.isClassDeclarationNode(parentNode)
  7670. && parentNode.id === identifierNode;
  7671. }
  7672. isProhibitedExportNamedClassDeclarationIdentifierNode(identifierNode, parentNode) {
  7673. return NodeGuards_1.NodeGuards.isClassDeclarationNode(parentNode)
  7674. && parentNode.id === identifierNode
  7675. && !!parentNode.parentNode
  7676. && NodeGuards_1.NodeGuards.isExportNamedDeclarationNode(parentNode.parentNode);
  7677. }
  7678. isProhibitedExportNamedFunctionDeclarationIdentifierNode(identifierNode, parentNode) {
  7679. return NodeGuards_1.NodeGuards.isFunctionDeclarationNode(parentNode)
  7680. && parentNode.id === identifierNode
  7681. && !!parentNode.parentNode
  7682. && NodeGuards_1.NodeGuards.isExportNamedDeclarationNode(parentNode.parentNode);
  7683. }
  7684. isProhibitedExportNamedVariableDeclarationIdentifierNode(identifierNode, parentNode) {
  7685. return NodeGuards_1.NodeGuards.isVariableDeclaratorNode(parentNode)
  7686. && parentNode.id === identifierNode
  7687. && !!parentNode.parentNode
  7688. && NodeGuards_1.NodeGuards.isVariableDeclarationNode(parentNode.parentNode)
  7689. && !!parentNode.parentNode.parentNode
  7690. && NodeGuards_1.NodeGuards.isExportNamedDeclarationNode(parentNode.parentNode.parentNode);
  7691. }
  7692. isProhibitedImportSpecifierNode(identifierNode, parentNode) {
  7693. return NodeGuards_1.NodeGuards.isImportSpecifierNode(parentNode)
  7694. && parentNode.imported.name === parentNode.local.name;
  7695. }
  7696. isProhibitedPropertyNode(node, parentNode) {
  7697. return NodeGuards_1.NodeGuards.isPropertyNode(parentNode)
  7698. && !parentNode.computed
  7699. && parentNode.key === node;
  7700. }
  7701. isProhibitedVariableNameUsedInObjectPatternNode(variable, identifierNode, lexicalScopeNode) {
  7702. let isLexicalScopeHasObjectPatternWithoutDeclaration = this.lexicalScopesWithObjectPatternWithoutDeclarationMap.get(lexicalScopeNode);
  7703. if (isLexicalScopeHasObjectPatternWithoutDeclaration === false) {
  7704. return false;
  7705. }
  7706. const hasVarDefinitions = variable.defs.some((definition) => definition.kind === 'var');
  7707. if (!hasVarDefinitions) {
  7708. return false;
  7709. }
  7710. let isProhibitedVariableDeclaration = false;
  7711. estraverse.traverse(lexicalScopeNode, {
  7712. enter: (node, parentNode) => {
  7713. if (NodeGuards_1.NodeGuards.isObjectPatternNode(node)
  7714. && parentNode
  7715. && NodeGuards_1.NodeGuards.isAssignmentExpressionNode(parentNode)) {
  7716. isLexicalScopeHasObjectPatternWithoutDeclaration = true;
  7717. const properties = node.properties;
  7718. for (const property of properties) {
  7719. if (property.computed || !property.shorthand) {
  7720. continue;
  7721. }
  7722. if (!NodeGuards_1.NodeGuards.isIdentifierNode(property.key)) {
  7723. continue;
  7724. }
  7725. if (identifierNode.name !== property.key.name) {
  7726. continue;
  7727. }
  7728. isProhibitedVariableDeclaration = true;
  7729. return estraverse.VisitorOption.Break;
  7730. }
  7731. }
  7732. }
  7733. });
  7734. this.lexicalScopesWithObjectPatternWithoutDeclarationMap.set(lexicalScopeNode, isLexicalScopeHasObjectPatternWithoutDeclaration !== null && isLexicalScopeHasObjectPatternWithoutDeclaration !== void 0 ? isLexicalScopeHasObjectPatternWithoutDeclaration : false);
  7735. return isProhibitedVariableDeclaration;
  7736. }
  7737. };
  7738. ScopeIdentifiersTransformer.argumentsVariableName = 'arguments';
  7739. ScopeIdentifiersTransformer.globalScopeNames = [
  7740. 'global',
  7741. 'module'
  7742. ];
  7743. ScopeIdentifiersTransformer = ScopeIdentifiersTransformer_1 = __decorate([
  7744. inversify_1.injectable(),
  7745. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)),
  7746. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  7747. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  7748. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IScopeAnalyzer)),
  7749. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierObfuscatingReplacerFactory_1.TIdentifierObfuscatingReplacerFactory !== "undefined" && TIdentifierObfuscatingReplacerFactory_1.TIdentifierObfuscatingReplacerFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object, typeof (_d = typeof IScopeAnalyzer_1.IScopeAnalyzer !== "undefined" && IScopeAnalyzer_1.IScopeAnalyzer) === "function" ? _d : Object])
  7750. ], ScopeIdentifiersTransformer);
  7751. exports.ScopeIdentifiersTransformer = ScopeIdentifiersTransformer;
  7752. /***/ }),
  7753. /***/ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts":
  7754. /*!*************************************************************************************************************!*\
  7755. !*** ./src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts ***!
  7756. \*************************************************************************************************************/
  7757. /*! no static exports found */
  7758. /***/ (function(module, exports, __webpack_require__) {
  7759. "use strict";
  7760. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7761. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7762. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  7763. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  7764. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7765. };
  7766. var __metadata = (this && this.__metadata) || function (k, v) {
  7767. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  7768. };
  7769. var __param = (this && this.__param) || function (paramIndex, decorator) {
  7770. return function (target, key) { decorator(target, key, paramIndex); }
  7771. };
  7772. var _a;
  7773. Object.defineProperty(exports, "__esModule", { value: true });
  7774. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  7775. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  7776. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  7777. let AbstractObfuscatingReplacer = class AbstractObfuscatingReplacer {
  7778. constructor(options) {
  7779. this.options = options;
  7780. }
  7781. };
  7782. AbstractObfuscatingReplacer = __decorate([
  7783. inversify_1.injectable(),
  7784. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  7785. __metadata("design:paramtypes", [typeof (_a = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _a : Object])
  7786. ], AbstractObfuscatingReplacer);
  7787. exports.AbstractObfuscatingReplacer = AbstractObfuscatingReplacer;
  7788. /***/ }),
  7789. /***/ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts":
  7790. /*!****************************************************************************************************************************************************!*\
  7791. !*** ./src/node-transformers/obfuscating-transformers/obfuscating-replacers/identifier-obfuscating-replacers/BaseIdentifierObfuscatingReplacer.ts ***!
  7792. \****************************************************************************************************************************************************/
  7793. /*! no static exports found */
  7794. /***/ (function(module, exports, __webpack_require__) {
  7795. "use strict";
  7796. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7797. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7798. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  7799. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  7800. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7801. };
  7802. var __metadata = (this && this.__metadata) || function (k, v) {
  7803. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  7804. };
  7805. var __param = (this && this.__param) || function (paramIndex, decorator) {
  7806. return function (target, key) { decorator(target, key, paramIndex); }
  7807. };
  7808. var _a, _b;
  7809. Object.defineProperty(exports, "__esModule", { value: true });
  7810. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  7811. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  7812. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  7813. const IOptions_1 = __webpack_require__(/*! ../../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  7814. const AbstractObfuscatingReplacer_1 = __webpack_require__(/*! ../AbstractObfuscatingReplacer */ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts");
  7815. const NodeFactory_1 = __webpack_require__(/*! ../../../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  7816. let BaseIdentifierObfuscatingReplacer = class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer {
  7817. constructor(identifierNamesGeneratorFactory, options) {
  7818. super(options);
  7819. this.blockScopesMap = new Map();
  7820. this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  7821. }
  7822. replace(identifierNode, lexicalScopeNode) {
  7823. let identifierName = identifierNode.name;
  7824. if (this.blockScopesMap.has(lexicalScopeNode)) {
  7825. const namesMap = this.blockScopesMap.get(lexicalScopeNode);
  7826. if (namesMap.has(identifierName)) {
  7827. identifierName = namesMap.get(identifierName);
  7828. }
  7829. }
  7830. return NodeFactory_1.NodeFactory.identifierNode(identifierName);
  7831. }
  7832. storeGlobalName(identifierNode, lexicalScopeNode) {
  7833. const identifierName = identifierNode.name;
  7834. if (this.isReservedName(identifierName)) {
  7835. return;
  7836. }
  7837. const newIdentifierName = this.identifierNamesGenerator.generateWithPrefix();
  7838. if (!this.blockScopesMap.has(lexicalScopeNode)) {
  7839. this.blockScopesMap.set(lexicalScopeNode, new Map());
  7840. }
  7841. const namesMap = this.blockScopesMap.get(lexicalScopeNode);
  7842. namesMap.set(identifierName, newIdentifierName);
  7843. }
  7844. storeLocalName(identifierNode, lexicalScopeNode) {
  7845. const identifierName = identifierNode.name;
  7846. if (this.isReservedName(identifierName)) {
  7847. return;
  7848. }
  7849. const newIdentifierName = this.identifierNamesGenerator.generate();
  7850. if (!this.blockScopesMap.has(lexicalScopeNode)) {
  7851. this.blockScopesMap.set(lexicalScopeNode, new Map());
  7852. }
  7853. const namesMap = this.blockScopesMap.get(lexicalScopeNode);
  7854. namesMap.set(identifierName, newIdentifierName);
  7855. }
  7856. preserveName(name) {
  7857. this.identifierNamesGenerator.preserveName(name);
  7858. }
  7859. isReservedName(name) {
  7860. if (!this.options.reservedNames.length) {
  7861. return false;
  7862. }
  7863. return this.options.reservedNames
  7864. .some((reservedName) => {
  7865. return new RegExp(reservedName, 'g').exec(name) !== null;
  7866. });
  7867. }
  7868. };
  7869. BaseIdentifierObfuscatingReplacer = __decorate([
  7870. inversify_1.injectable(),
  7871. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  7872. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  7873. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  7874. ], BaseIdentifierObfuscatingReplacer);
  7875. exports.BaseIdentifierObfuscatingReplacer = BaseIdentifierObfuscatingReplacer;
  7876. /***/ }),
  7877. /***/ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/BooleanLiteralObfuscatingReplacer.ts":
  7878. /*!*************************************************************************************************************************************************!*\
  7879. !*** ./src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/BooleanLiteralObfuscatingReplacer.ts ***!
  7880. \*************************************************************************************************************************************************/
  7881. /*! no static exports found */
  7882. /***/ (function(module, exports, __webpack_require__) {
  7883. "use strict";
  7884. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7885. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7886. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  7887. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  7888. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7889. };
  7890. var __metadata = (this && this.__metadata) || function (k, v) {
  7891. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  7892. };
  7893. var __param = (this && this.__param) || function (paramIndex, decorator) {
  7894. return function (target, key) { decorator(target, key, paramIndex); }
  7895. };
  7896. var BooleanLiteralObfuscatingReplacer_1, _a;
  7897. Object.defineProperty(exports, "__esModule", { value: true });
  7898. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  7899. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  7900. const IOptions_1 = __webpack_require__(/*! ../../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  7901. const AbstractObfuscatingReplacer_1 = __webpack_require__(/*! ../AbstractObfuscatingReplacer */ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts");
  7902. const NodeFactory_1 = __webpack_require__(/*! ../../../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  7903. let BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer_1 = class BooleanLiteralObfuscatingReplacer extends AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer {
  7904. constructor(options) {
  7905. super(options);
  7906. }
  7907. static getTrueUnaryExpressionNode() {
  7908. return NodeFactory_1.NodeFactory.unaryExpressionNode('!', BooleanLiteralObfuscatingReplacer_1.getFalseUnaryExpressionNode());
  7909. }
  7910. static getFalseUnaryExpressionNode() {
  7911. return NodeFactory_1.NodeFactory.unaryExpressionNode('!', NodeFactory_1.NodeFactory.arrayExpressionNode());
  7912. }
  7913. replace(literalNode) {
  7914. const literalValue = literalNode.value;
  7915. if (typeof literalValue !== 'boolean') {
  7916. throw new Error('`BooleanLiteralObfuscatingReplacer` should accept only literals with `boolean` value');
  7917. }
  7918. return literalValue
  7919. ? BooleanLiteralObfuscatingReplacer_1.getTrueUnaryExpressionNode()
  7920. : BooleanLiteralObfuscatingReplacer_1.getFalseUnaryExpressionNode();
  7921. }
  7922. };
  7923. BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer_1 = __decorate([
  7924. inversify_1.injectable(),
  7925. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  7926. __metadata("design:paramtypes", [typeof (_a = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _a : Object])
  7927. ], BooleanLiteralObfuscatingReplacer);
  7928. exports.BooleanLiteralObfuscatingReplacer = BooleanLiteralObfuscatingReplacer;
  7929. /***/ }),
  7930. /***/ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/NumberLiteralObfuscatingReplacer.ts":
  7931. /*!************************************************************************************************************************************************!*\
  7932. !*** ./src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/NumberLiteralObfuscatingReplacer.ts ***!
  7933. \************************************************************************************************************************************************/
  7934. /*! no static exports found */
  7935. /***/ (function(module, exports, __webpack_require__) {
  7936. "use strict";
  7937. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7938. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7939. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  7940. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  7941. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7942. };
  7943. var __metadata = (this && this.__metadata) || function (k, v) {
  7944. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  7945. };
  7946. var __param = (this && this.__param) || function (paramIndex, decorator) {
  7947. return function (target, key) { decorator(target, key, paramIndex); }
  7948. };
  7949. var _a;
  7950. Object.defineProperty(exports, "__esModule", { value: true });
  7951. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  7952. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  7953. const IOptions_1 = __webpack_require__(/*! ../../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  7954. const AbstractObfuscatingReplacer_1 = __webpack_require__(/*! ../AbstractObfuscatingReplacer */ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts");
  7955. const NodeFactory_1 = __webpack_require__(/*! ../../../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  7956. const NumberUtils_1 = __webpack_require__(/*! ../../../../utils/NumberUtils */ "./src/utils/NumberUtils.ts");
  7957. const Utils_1 = __webpack_require__(/*! ../../../../utils/Utils */ "./src/utils/Utils.ts");
  7958. let NumberLiteralObfuscatingReplacer = class NumberLiteralObfuscatingReplacer extends AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer {
  7959. constructor(options) {
  7960. super(options);
  7961. this.numberLiteralCache = new Map();
  7962. }
  7963. replace(literalNode) {
  7964. const literalValue = literalNode.value;
  7965. if (typeof literalValue !== 'number') {
  7966. throw new Error('`NumberLiteralObfuscatingReplacer` should accept only literals with `number` value');
  7967. }
  7968. let rawValue;
  7969. if (this.numberLiteralCache.has(literalValue)) {
  7970. rawValue = this.numberLiteralCache.get(literalValue);
  7971. }
  7972. else {
  7973. if (!NumberUtils_1.NumberUtils.isCeil(literalValue)) {
  7974. rawValue = String(literalValue);
  7975. }
  7976. else {
  7977. rawValue = `${Utils_1.Utils.hexadecimalPrefix}${NumberUtils_1.NumberUtils.toHex(literalValue)}`;
  7978. }
  7979. this.numberLiteralCache.set(literalValue, rawValue);
  7980. }
  7981. return NodeFactory_1.NodeFactory.literalNode(literalValue, rawValue);
  7982. }
  7983. };
  7984. NumberLiteralObfuscatingReplacer = __decorate([
  7985. inversify_1.injectable(),
  7986. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  7987. __metadata("design:paramtypes", [typeof (_a = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _a : Object])
  7988. ], NumberLiteralObfuscatingReplacer);
  7989. exports.NumberLiteralObfuscatingReplacer = NumberLiteralObfuscatingReplacer;
  7990. /***/ }),
  7991. /***/ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer.ts":
  7992. /*!************************************************************************************************************************************************!*\
  7993. !*** ./src/node-transformers/obfuscating-transformers/obfuscating-replacers/literal-obfuscating-replacers/StringLiteralObfuscatingReplacer.ts ***!
  7994. \************************************************************************************************************************************************/
  7995. /*! no static exports found */
  7996. /***/ (function(module, exports, __webpack_require__) {
  7997. "use strict";
  7998. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  7999. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8000. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8001. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8002. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8003. };
  8004. var __metadata = (this && this.__metadata) || function (k, v) {
  8005. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  8006. };
  8007. var __param = (this && this.__param) || function (paramIndex, decorator) {
  8008. return function (target, key) { decorator(target, key, paramIndex); }
  8009. };
  8010. var StringLiteralObfuscatingReplacer_1, _a, _b, _c;
  8011. Object.defineProperty(exports, "__esModule", { value: true });
  8012. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8013. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  8014. const IOptions_1 = __webpack_require__(/*! ../../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  8015. const IStringArrayStorage_1 = __webpack_require__(/*! ../../../../interfaces/storages/string-array-storage/IStringArrayStorage */ "./src/interfaces/storages/string-array-storage/IStringArrayStorage.ts");
  8016. const IStringArrayStorageAnalyzer_1 = __webpack_require__(/*! ../../../../interfaces/analyzers/string-array-storage-analyzer/IStringArrayStorageAnalyzer */ "./src/interfaces/analyzers/string-array-storage-analyzer/IStringArrayStorageAnalyzer.ts");
  8017. const Initializable_1 = __webpack_require__(/*! ../../../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  8018. const StringArrayEncoding_1 = __webpack_require__(/*! ../../../../enums/StringArrayEncoding */ "./src/enums/StringArrayEncoding.ts");
  8019. const AbstractObfuscatingReplacer_1 = __webpack_require__(/*! ../AbstractObfuscatingReplacer */ "./src/node-transformers/obfuscating-transformers/obfuscating-replacers/AbstractObfuscatingReplacer.ts");
  8020. const NodeMetadata_1 = __webpack_require__(/*! ../../../../node/NodeMetadata */ "./src/node/NodeMetadata.ts");
  8021. const NodeFactory_1 = __webpack_require__(/*! ../../../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  8022. const NumberUtils_1 = __webpack_require__(/*! ../../../../utils/NumberUtils */ "./src/utils/NumberUtils.ts");
  8023. const Utils_1 = __webpack_require__(/*! ../../../../utils/Utils */ "./src/utils/Utils.ts");
  8024. let StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer_1 = class StringLiteralObfuscatingReplacer extends AbstractObfuscatingReplacer_1.AbstractObfuscatingReplacer {
  8025. constructor(stringArrayStorage, stringArrayStorageAnalyzer, options) {
  8026. super(options);
  8027. this.nodesCache = new Map();
  8028. this.stringArrayStorage = stringArrayStorage;
  8029. this.stringArrayStorageAnalyzer = stringArrayStorageAnalyzer;
  8030. }
  8031. static getHexadecimalLiteralNode(hexadecimalIndex) {
  8032. const hexadecimalLiteralNode = NodeFactory_1.NodeFactory.literalNode(hexadecimalIndex);
  8033. NodeMetadata_1.NodeMetadata.set(hexadecimalLiteralNode, { replacedLiteral: true });
  8034. return hexadecimalLiteralNode;
  8035. }
  8036. static getRc4KeyLiteralNode(literalValue) {
  8037. const rc4KeyLiteralNode = NodeFactory_1.NodeFactory.literalNode(literalValue);
  8038. NodeMetadata_1.NodeMetadata.set(rc4KeyLiteralNode, { replacedLiteral: true });
  8039. return rc4KeyLiteralNode;
  8040. }
  8041. initialize() {
  8042. this.stringArrayStorageCallsWrapperName = this.stringArrayStorage.getStorageCallsWrapperName();
  8043. if (this.options.shuffleStringArray) {
  8044. this.stringArrayStorage.shuffleStorage();
  8045. }
  8046. if (this.options.rotateStringArray) {
  8047. this.stringArrayStorage.rotateStorage();
  8048. }
  8049. }
  8050. replace(literalNode) {
  8051. const literalValue = literalNode.value;
  8052. if (typeof literalValue !== 'string') {
  8053. throw new Error('`StringLiteralObfuscatingReplacer` should accept only literals with `string` value');
  8054. }
  8055. const stringArrayStorageItemData = this.stringArrayStorageAnalyzer
  8056. .getItemDataForLiteralNode(literalNode);
  8057. const cacheKey = `${literalValue}-${Boolean(stringArrayStorageItemData)}`;
  8058. const useCachedValue = this.nodesCache.has(cacheKey) && this.options.stringArrayEncoding !== StringArrayEncoding_1.StringArrayEncoding.Rc4;
  8059. if (useCachedValue) {
  8060. return this.nodesCache.get(cacheKey);
  8061. }
  8062. const resultNode = stringArrayStorageItemData
  8063. ? this.replaceWithStringArrayCallNode(stringArrayStorageItemData)
  8064. : this.replaceWithLiteralNode(literalValue);
  8065. this.nodesCache.set(cacheKey, resultNode);
  8066. return resultNode;
  8067. }
  8068. replaceWithLiteralNode(value) {
  8069. return NodeFactory_1.NodeFactory.literalNode(value);
  8070. }
  8071. replaceWithStringArrayCallNode(stringArrayStorageItemData) {
  8072. const { index, decodeKey } = stringArrayStorageItemData;
  8073. const hexadecimalIndex = `${Utils_1.Utils.hexadecimalPrefix}${NumberUtils_1.NumberUtils.toHex(index)}`;
  8074. const callExpressionArgs = [
  8075. StringLiteralObfuscatingReplacer_1.getHexadecimalLiteralNode(hexadecimalIndex)
  8076. ];
  8077. if (decodeKey) {
  8078. callExpressionArgs.push(StringLiteralObfuscatingReplacer_1.getRc4KeyLiteralNode(decodeKey));
  8079. }
  8080. const stringArrayIdentifierNode = NodeFactory_1.NodeFactory.identifierNode(this.stringArrayStorageCallsWrapperName);
  8081. return NodeFactory_1.NodeFactory.callExpressionNode(stringArrayIdentifierNode, callExpressionArgs);
  8082. }
  8083. };
  8084. __decorate([
  8085. Initializable_1.initializable(),
  8086. __metadata("design:type", String)
  8087. ], StringLiteralObfuscatingReplacer.prototype, "stringArrayStorageCallsWrapperName", void 0);
  8088. __decorate([
  8089. inversify_1.postConstruct(),
  8090. __metadata("design:type", Function),
  8091. __metadata("design:paramtypes", []),
  8092. __metadata("design:returntype", void 0)
  8093. ], StringLiteralObfuscatingReplacer.prototype, "initialize", null);
  8094. StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer_1 = __decorate([
  8095. inversify_1.injectable(),
  8096. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IStringArrayStorage)),
  8097. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IStringArrayStorageAnalyzer)),
  8098. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  8099. __metadata("design:paramtypes", [typeof (_a = typeof IStringArrayStorage_1.IStringArrayStorage !== "undefined" && IStringArrayStorage_1.IStringArrayStorage) === "function" ? _a : Object, typeof (_b = typeof IStringArrayStorageAnalyzer_1.IStringArrayStorageAnalyzer !== "undefined" && IStringArrayStorageAnalyzer_1.IStringArrayStorageAnalyzer) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  8100. ], StringLiteralObfuscatingReplacer);
  8101. exports.StringLiteralObfuscatingReplacer = StringLiteralObfuscatingReplacer;
  8102. /***/ }),
  8103. /***/ "./src/node-transformers/preparing-transformers/CommentsTransformer.ts":
  8104. /*!*****************************************************************************!*\
  8105. !*** ./src/node-transformers/preparing-transformers/CommentsTransformer.ts ***!
  8106. \*****************************************************************************/
  8107. /*! no static exports found */
  8108. /***/ (function(module, exports, __webpack_require__) {
  8109. "use strict";
  8110. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  8111. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8112. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8113. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8114. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8115. };
  8116. var __metadata = (this && this.__metadata) || function (k, v) {
  8117. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  8118. };
  8119. var __param = (this && this.__param) || function (paramIndex, decorator) {
  8120. return function (target, key) { decorator(target, key, paramIndex); }
  8121. };
  8122. var __importStar = (this && this.__importStar) || function (mod) {
  8123. if (mod && mod.__esModule) return mod;
  8124. var result = {};
  8125. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  8126. result["default"] = mod;
  8127. return result;
  8128. };
  8129. var CommentsTransformer_1, _a, _b;
  8130. Object.defineProperty(exports, "__esModule", { value: true });
  8131. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8132. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  8133. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  8134. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  8135. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  8136. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  8137. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  8138. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  8139. const ConditionalCommentObfuscatingGuard_1 = __webpack_require__(/*! ./obfuscating-guards/ConditionalCommentObfuscatingGuard */ "./src/node-transformers/preparing-transformers/obfuscating-guards/ConditionalCommentObfuscatingGuard.ts");
  8140. let CommentsTransformer = CommentsTransformer_1 = class CommentsTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  8141. constructor(randomGenerator, options) {
  8142. super(randomGenerator, options);
  8143. }
  8144. getVisitor(transformationStage) {
  8145. switch (transformationStage) {
  8146. case TransformationStage_1.TransformationStage.Initializing:
  8147. return {
  8148. leave: (node) => {
  8149. if (NodeGuards_1.NodeGuards.isProgramNode(node)) {
  8150. return this.transformNode(node);
  8151. }
  8152. }
  8153. };
  8154. default:
  8155. return null;
  8156. }
  8157. }
  8158. transformNode(rootNode) {
  8159. if (!rootNode.comments || !rootNode.comments.length) {
  8160. return rootNode;
  8161. }
  8162. const comments = this.transformComments(rootNode.comments);
  8163. if (comments.length === 0) {
  8164. return rootNode;
  8165. }
  8166. if (!rootNode.body.length) {
  8167. rootNode.leadingComments = comments;
  8168. return rootNode;
  8169. }
  8170. estraverse.traverse(rootNode, {
  8171. enter: (node) => {
  8172. if (node === rootNode) {
  8173. return;
  8174. }
  8175. const commentIdx = comments.findIndex((comment) => comment.range && node.range && comment.range[0] < node.range[0]);
  8176. if (commentIdx === -1) {
  8177. return;
  8178. }
  8179. node.leadingComments = comments.splice(commentIdx, comments.length - commentIdx).reverse();
  8180. }
  8181. });
  8182. if (comments.length > 0) {
  8183. rootNode.trailingComments = comments.reverse();
  8184. }
  8185. return rootNode;
  8186. }
  8187. transformComments(comments) {
  8188. return comments.filter((comment) => CommentsTransformer_1.preservedWords
  8189. .some((preservedWord) => comment.value.includes(preservedWord)) ||
  8190. ConditionalCommentObfuscatingGuard_1.ConditionalCommentObfuscatingGuard.isConditionalComment(comment)).reverse();
  8191. }
  8192. };
  8193. CommentsTransformer.preservedWords = [
  8194. '@license',
  8195. '@preserve'
  8196. ];
  8197. CommentsTransformer = CommentsTransformer_1 = __decorate([
  8198. inversify_1.injectable(),
  8199. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  8200. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  8201. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  8202. ], CommentsTransformer);
  8203. exports.CommentsTransformer = CommentsTransformer;
  8204. /***/ }),
  8205. /***/ "./src/node-transformers/preparing-transformers/CustomNodesTransformer.ts":
  8206. /*!********************************************************************************!*\
  8207. !*** ./src/node-transformers/preparing-transformers/CustomNodesTransformer.ts ***!
  8208. \********************************************************************************/
  8209. /*! no static exports found */
  8210. /***/ (function(module, exports, __webpack_require__) {
  8211. "use strict";
  8212. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  8213. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8214. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8215. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8216. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8217. };
  8218. var __metadata = (this && this.__metadata) || function (k, v) {
  8219. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  8220. };
  8221. var __param = (this && this.__param) || function (paramIndex, decorator) {
  8222. return function (target, key) { decorator(target, key, paramIndex); }
  8223. };
  8224. var _a, _b, _c, _d, _e, _f;
  8225. Object.defineProperty(exports, "__esModule", { value: true });
  8226. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8227. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  8228. const TCustomNodeGroupStorage_1 = __webpack_require__(/*! ../../types/storages/TCustomNodeGroupStorage */ "./src/types/storages/TCustomNodeGroupStorage.ts");
  8229. const IObfuscationEventEmitter_1 = __webpack_require__(/*! ../../interfaces/event-emitters/IObfuscationEventEmitter */ "./src/interfaces/event-emitters/IObfuscationEventEmitter.ts");
  8230. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  8231. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  8232. const ICallsGraphAnalyzer_1 = __webpack_require__(/*! ../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphAnalyzer */ "./src/interfaces/analyzers/calls-graph-analyzer/ICallsGraphAnalyzer.ts");
  8233. const IPrevailingKindOfVariablesAnalyzer_1 = __webpack_require__(/*! ../../interfaces/analyzers/calls-graph-analyzer/IPrevailingKindOfVariablesAnalyzer */ "./src/interfaces/analyzers/calls-graph-analyzer/IPrevailingKindOfVariablesAnalyzer.ts");
  8234. const ObfuscationEvent_1 = __webpack_require__(/*! ../../enums/event-emitters/ObfuscationEvent */ "./src/enums/event-emitters/ObfuscationEvent.ts");
  8235. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  8236. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  8237. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  8238. let CustomNodesTransformer = class CustomNodesTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  8239. constructor(callsGraphAnalyzer, prevailingKindOfVariablesAnalyzer, obfuscationEventEmitter, customNodeGroupStorage, randomGenerator, options) {
  8240. super(randomGenerator, options);
  8241. this.callsGraphData = [];
  8242. this.callsGraphAnalyzer = callsGraphAnalyzer;
  8243. this.prevailingKindOfVariablesAnalyzer = prevailingKindOfVariablesAnalyzer;
  8244. this.obfuscationEventEmitter = obfuscationEventEmitter;
  8245. this.customNodeGroupStorage = customNodeGroupStorage;
  8246. }
  8247. getVisitor(transformationStage) {
  8248. switch (transformationStage) {
  8249. case TransformationStage_1.TransformationStage.Preparing:
  8250. return {
  8251. leave: (node, parentNode) => {
  8252. if (NodeGuards_1.NodeGuards.isProgramNode(node)) {
  8253. this.analyzeNode(node, parentNode);
  8254. this.appendCustomNodesBeforeObfuscation(node, parentNode);
  8255. return this.transformNode(node, parentNode);
  8256. }
  8257. }
  8258. };
  8259. case TransformationStage_1.TransformationStage.Finalizing:
  8260. return {
  8261. leave: (node, parentNode) => {
  8262. if (NodeGuards_1.NodeGuards.isProgramNode(node)) {
  8263. this.appendCustomNodesAfterObfuscation(node, parentNode);
  8264. }
  8265. }
  8266. };
  8267. default:
  8268. return null;
  8269. }
  8270. }
  8271. analyzeNode(node, parentNode) {
  8272. this.callsGraphData = this.callsGraphAnalyzer.analyze(node);
  8273. this.prevailingKindOfVariablesAnalyzer.analyze(node);
  8274. }
  8275. transformNode(node, parentNode) {
  8276. return node;
  8277. }
  8278. appendCustomNodesBeforeObfuscation(node, parentNode) {
  8279. this.customNodeGroupStorage
  8280. .getStorage()
  8281. .forEach((customNodeGroup) => {
  8282. customNodeGroup.initialize();
  8283. this.obfuscationEventEmitter.once(customNodeGroup.getAppendEvent(), customNodeGroup.appendCustomNodes.bind(customNodeGroup));
  8284. });
  8285. this.obfuscationEventEmitter.emit(ObfuscationEvent_1.ObfuscationEvent.BeforeObfuscation, node, this.callsGraphData);
  8286. }
  8287. appendCustomNodesAfterObfuscation(node, parentNode) {
  8288. this.obfuscationEventEmitter.emit(ObfuscationEvent_1.ObfuscationEvent.AfterObfuscation, node, this.callsGraphData);
  8289. }
  8290. };
  8291. CustomNodesTransformer = __decorate([
  8292. inversify_1.injectable(),
  8293. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICallsGraphAnalyzer)),
  8294. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer)),
  8295. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IObfuscationEventEmitter)),
  8296. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.TCustomNodeGroupStorage)),
  8297. __param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  8298. __param(5, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  8299. __metadata("design:paramtypes", [typeof (_a = typeof ICallsGraphAnalyzer_1.ICallsGraphAnalyzer !== "undefined" && ICallsGraphAnalyzer_1.ICallsGraphAnalyzer) === "function" ? _a : Object, typeof (_b = typeof IPrevailingKindOfVariablesAnalyzer_1.IPrevailingKindOfVariablesAnalyzer !== "undefined" && IPrevailingKindOfVariablesAnalyzer_1.IPrevailingKindOfVariablesAnalyzer) === "function" ? _b : Object, typeof (_c = typeof IObfuscationEventEmitter_1.IObfuscationEventEmitter !== "undefined" && IObfuscationEventEmitter_1.IObfuscationEventEmitter) === "function" ? _c : Object, typeof (_d = typeof TCustomNodeGroupStorage_1.TCustomNodeGroupStorage !== "undefined" && TCustomNodeGroupStorage_1.TCustomNodeGroupStorage) === "function" ? _d : Object, typeof (_e = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _e : Object, typeof (_f = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _f : Object])
  8300. ], CustomNodesTransformer);
  8301. exports.CustomNodesTransformer = CustomNodesTransformer;
  8302. /***/ }),
  8303. /***/ "./src/node-transformers/preparing-transformers/EvalCallExpressionTransformer.ts":
  8304. /*!***************************************************************************************!*\
  8305. !*** ./src/node-transformers/preparing-transformers/EvalCallExpressionTransformer.ts ***!
  8306. \***************************************************************************************/
  8307. /*! no static exports found */
  8308. /***/ (function(module, exports, __webpack_require__) {
  8309. "use strict";
  8310. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  8311. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8312. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8313. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8314. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8315. };
  8316. var __metadata = (this && this.__metadata) || function (k, v) {
  8317. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  8318. };
  8319. var __param = (this && this.__param) || function (paramIndex, decorator) {
  8320. return function (target, key) { decorator(target, key, paramIndex); }
  8321. };
  8322. var __importDefault = (this && this.__importDefault) || function (mod) {
  8323. return (mod && mod.__esModule) ? mod : { "default": mod };
  8324. };
  8325. var EvalCallExpressionTransformer_1, _a, _b;
  8326. Object.defineProperty(exports, "__esModule", { value: true });
  8327. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8328. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  8329. const js_string_escape_1 = __importDefault(__webpack_require__(/*! js-string-escape */ "js-string-escape"));
  8330. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  8331. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  8332. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  8333. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  8334. const NodeFactory_1 = __webpack_require__(/*! ../../node/NodeFactory */ "./src/node/NodeFactory.ts");
  8335. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  8336. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  8337. let EvalCallExpressionTransformer = EvalCallExpressionTransformer_1 = class EvalCallExpressionTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  8338. constructor(randomGenerator, options) {
  8339. super(randomGenerator, options);
  8340. this.evalRootAstHostNodeSet = new Set();
  8341. }
  8342. static extractEvalStringFromCallExpressionArgument(node) {
  8343. if (NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  8344. return EvalCallExpressionTransformer_1
  8345. .extractEvalStringFromLiteralNode(node);
  8346. }
  8347. if (NodeGuards_1.NodeGuards.isTemplateLiteralNode(node)) {
  8348. return EvalCallExpressionTransformer_1
  8349. .extractEvalStringFromTemplateLiteralNode(node);
  8350. }
  8351. return null;
  8352. }
  8353. static extractEvalStringFromLiteralNode(node) {
  8354. return typeof node.value === 'string' ? node.value : null;
  8355. }
  8356. static extractEvalStringFromTemplateLiteralNode(node) {
  8357. const quasis = node.quasis;
  8358. const allowedQuasisLength = 1;
  8359. if (quasis.length !== allowedQuasisLength || node.expressions.length) {
  8360. return null;
  8361. }
  8362. return quasis[0].value.cooked;
  8363. }
  8364. getVisitor(transformationStage) {
  8365. switch (transformationStage) {
  8366. case TransformationStage_1.TransformationStage.Preparing:
  8367. return {
  8368. enter: (node, parentNode) => {
  8369. if (parentNode
  8370. && NodeGuards_1.NodeGuards.isCallExpressionNode(node)
  8371. && NodeGuards_1.NodeGuards.isIdentifierNode(node.callee)
  8372. && node.callee.name === 'eval') {
  8373. return this.transformNode(node, parentNode);
  8374. }
  8375. }
  8376. };
  8377. case TransformationStage_1.TransformationStage.Finalizing:
  8378. if (!this.evalRootAstHostNodeSet.size) {
  8379. return null;
  8380. }
  8381. return {
  8382. leave: (node, parentNode) => {
  8383. if (parentNode && this.isEvalRootAstHostNode(node)) {
  8384. return this.restoreNode(node, parentNode);
  8385. }
  8386. }
  8387. };
  8388. default:
  8389. return null;
  8390. }
  8391. }
  8392. transformNode(callExpressionNode, parentNode) {
  8393. const callExpressionFirstArgument = callExpressionNode.arguments[0];
  8394. if (!callExpressionFirstArgument) {
  8395. return callExpressionNode;
  8396. }
  8397. const evalString = EvalCallExpressionTransformer_1
  8398. .extractEvalStringFromCallExpressionArgument(callExpressionFirstArgument);
  8399. if (!evalString) {
  8400. return callExpressionNode;
  8401. }
  8402. let ast;
  8403. try {
  8404. ast = NodeUtils_1.NodeUtils.convertCodeToStructure(evalString);
  8405. }
  8406. catch (_a) {
  8407. return callExpressionNode;
  8408. }
  8409. const evalRootAstHostNode = NodeFactory_1.NodeFactory
  8410. .functionExpressionNode([], NodeFactory_1.NodeFactory.blockStatementNode(ast));
  8411. this.evalRootAstHostNodeSet.add(evalRootAstHostNode);
  8412. return evalRootAstHostNode;
  8413. }
  8414. restoreNode(evalRootAstHostNode, parentNode) {
  8415. const targetAst = evalRootAstHostNode.body.body;
  8416. const obfuscatedCode = NodeUtils_1.NodeUtils.convertStructureToCode(targetAst);
  8417. return NodeFactory_1.NodeFactory.callExpressionNode(NodeFactory_1.NodeFactory.identifierNode('eval'), [
  8418. NodeFactory_1.NodeFactory.literalNode(js_string_escape_1.default(obfuscatedCode))
  8419. ]);
  8420. }
  8421. isEvalRootAstHostNode(node) {
  8422. return NodeGuards_1.NodeGuards.isFunctionExpressionNode(node) && this.evalRootAstHostNodeSet.has(node);
  8423. }
  8424. };
  8425. EvalCallExpressionTransformer = EvalCallExpressionTransformer_1 = __decorate([
  8426. inversify_1.injectable(),
  8427. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  8428. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  8429. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  8430. ], EvalCallExpressionTransformer);
  8431. exports.EvalCallExpressionTransformer = EvalCallExpressionTransformer;
  8432. /***/ }),
  8433. /***/ "./src/node-transformers/preparing-transformers/MetadataTransformer.ts":
  8434. /*!*****************************************************************************!*\
  8435. !*** ./src/node-transformers/preparing-transformers/MetadataTransformer.ts ***!
  8436. \*****************************************************************************/
  8437. /*! no static exports found */
  8438. /***/ (function(module, exports, __webpack_require__) {
  8439. "use strict";
  8440. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  8441. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8442. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8443. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8444. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8445. };
  8446. var __metadata = (this && this.__metadata) || function (k, v) {
  8447. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  8448. };
  8449. var __param = (this && this.__param) || function (paramIndex, decorator) {
  8450. return function (target, key) { decorator(target, key, paramIndex); }
  8451. };
  8452. var _a, _b;
  8453. Object.defineProperty(exports, "__esModule", { value: true });
  8454. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8455. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  8456. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  8457. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  8458. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  8459. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  8460. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  8461. const NodeMetadata_1 = __webpack_require__(/*! ../../node/NodeMetadata */ "./src/node/NodeMetadata.ts");
  8462. let MetadataTransformer = class MetadataTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  8463. constructor(randomGenerator, options) {
  8464. super(randomGenerator, options);
  8465. }
  8466. getVisitor(transformationStage) {
  8467. switch (transformationStage) {
  8468. case TransformationStage_1.TransformationStage.Preparing:
  8469. return {
  8470. enter: (node, parentNode) => {
  8471. return this.transformNode(node, parentNode);
  8472. }
  8473. };
  8474. default:
  8475. return null;
  8476. }
  8477. }
  8478. transformNode(node, parentNode) {
  8479. NodeMetadata_1.NodeMetadata.set(node, { ignoredNode: false });
  8480. if (NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  8481. NodeMetadata_1.NodeMetadata.set(node, { replacedLiteral: false });
  8482. }
  8483. return node;
  8484. }
  8485. };
  8486. MetadataTransformer = __decorate([
  8487. inversify_1.injectable(),
  8488. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  8489. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  8490. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  8491. ], MetadataTransformer);
  8492. exports.MetadataTransformer = MetadataTransformer;
  8493. /***/ }),
  8494. /***/ "./src/node-transformers/preparing-transformers/ObfuscatingGuardsTransformer.ts":
  8495. /*!**************************************************************************************!*\
  8496. !*** ./src/node-transformers/preparing-transformers/ObfuscatingGuardsTransformer.ts ***!
  8497. \**************************************************************************************/
  8498. /*! no static exports found */
  8499. /***/ (function(module, exports, __webpack_require__) {
  8500. "use strict";
  8501. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  8502. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8503. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8504. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8505. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8506. };
  8507. var __metadata = (this && this.__metadata) || function (k, v) {
  8508. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  8509. };
  8510. var __param = (this && this.__param) || function (paramIndex, decorator) {
  8511. return function (target, key) { decorator(target, key, paramIndex); }
  8512. };
  8513. var ObfuscatingGuardsTransformer_1, _a, _b, _c;
  8514. Object.defineProperty(exports, "__esModule", { value: true });
  8515. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8516. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  8517. const TObfuscatingGuardFactory_1 = __webpack_require__(/*! ../../types/container/node-transformers/TObfuscatingGuardFactory */ "./src/types/container/node-transformers/TObfuscatingGuardFactory.ts");
  8518. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  8519. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  8520. const ObfuscatingGuard_1 = __webpack_require__(/*! ../../enums/node-transformers/preparing-transformers/obfuscating-guards/ObfuscatingGuard */ "./src/enums/node-transformers/preparing-transformers/obfuscating-guards/ObfuscatingGuard.ts");
  8521. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  8522. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  8523. const NodeMetadata_1 = __webpack_require__(/*! ../../node/NodeMetadata */ "./src/node/NodeMetadata.ts");
  8524. let ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer_1 = class ObfuscatingGuardsTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  8525. constructor(obfuscatingGuardFactory, randomGenerator, options) {
  8526. super(randomGenerator, options);
  8527. this.obfuscatingGuards = ObfuscatingGuardsTransformer_1.obfuscatingGuardsList.map(obfuscatingGuardFactory);
  8528. }
  8529. getVisitor(transformationStage) {
  8530. switch (transformationStage) {
  8531. case TransformationStage_1.TransformationStage.Preparing:
  8532. return {
  8533. enter: (node, parentNode) => {
  8534. return this.transformNode(node, parentNode);
  8535. }
  8536. };
  8537. default:
  8538. return null;
  8539. }
  8540. }
  8541. transformNode(node, parentNode) {
  8542. const obfuscationAllowed = this.obfuscatingGuards
  8543. .every((nodeGuard) => nodeGuard.check(node));
  8544. NodeMetadata_1.NodeMetadata.set(node, {
  8545. ignoredNode: !obfuscationAllowed
  8546. });
  8547. return node;
  8548. }
  8549. };
  8550. ObfuscatingGuardsTransformer.obfuscatingGuardsList = [
  8551. ObfuscatingGuard_1.ObfuscatingGuard.BlackListObfuscatingGuard,
  8552. ObfuscatingGuard_1.ObfuscatingGuard.ConditionalCommentObfuscatingGuard,
  8553. ObfuscatingGuard_1.ObfuscatingGuard.ReservedStringObfuscatingGuard
  8554. ];
  8555. ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer_1 = __decorate([
  8556. inversify_1.injectable(),
  8557. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__INodeGuard)),
  8558. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  8559. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  8560. __metadata("design:paramtypes", [typeof (_a = typeof TObfuscatingGuardFactory_1.TObfuscatingGuardFactory !== "undefined" && TObfuscatingGuardFactory_1.TObfuscatingGuardFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  8561. ], ObfuscatingGuardsTransformer);
  8562. exports.ObfuscatingGuardsTransformer = ObfuscatingGuardsTransformer;
  8563. /***/ }),
  8564. /***/ "./src/node-transformers/preparing-transformers/ParentificationTransformer.ts":
  8565. /*!************************************************************************************!*\
  8566. !*** ./src/node-transformers/preparing-transformers/ParentificationTransformer.ts ***!
  8567. \************************************************************************************/
  8568. /*! no static exports found */
  8569. /***/ (function(module, exports, __webpack_require__) {
  8570. "use strict";
  8571. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  8572. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8573. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8574. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8575. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8576. };
  8577. var __metadata = (this && this.__metadata) || function (k, v) {
  8578. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  8579. };
  8580. var __param = (this && this.__param) || function (paramIndex, decorator) {
  8581. return function (target, key) { decorator(target, key, paramIndex); }
  8582. };
  8583. var _a, _b;
  8584. Object.defineProperty(exports, "__esModule", { value: true });
  8585. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8586. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  8587. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  8588. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  8589. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  8590. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  8591. const NodeUtils_1 = __webpack_require__(/*! ../../node/NodeUtils */ "./src/node/NodeUtils.ts");
  8592. let ParentificationTransformer = class ParentificationTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  8593. constructor(randomGenerator, options) {
  8594. super(randomGenerator, options);
  8595. }
  8596. getVisitor(transformationStage) {
  8597. switch (transformationStage) {
  8598. case TransformationStage_1.TransformationStage.Preparing:
  8599. return {
  8600. enter: (node, parentNode) => {
  8601. return this.transformNode(node, parentNode);
  8602. }
  8603. };
  8604. default:
  8605. return null;
  8606. }
  8607. }
  8608. transformNode(node, parentNode) {
  8609. return NodeUtils_1.NodeUtils.parentizeNode(node, parentNode);
  8610. }
  8611. };
  8612. ParentificationTransformer = __decorate([
  8613. inversify_1.injectable(),
  8614. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  8615. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  8616. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  8617. ], ParentificationTransformer);
  8618. exports.ParentificationTransformer = ParentificationTransformer;
  8619. /***/ }),
  8620. /***/ "./src/node-transformers/preparing-transformers/VariablePreserveTransformer.ts":
  8621. /*!*************************************************************************************!*\
  8622. !*** ./src/node-transformers/preparing-transformers/VariablePreserveTransformer.ts ***!
  8623. \*************************************************************************************/
  8624. /*! no static exports found */
  8625. /***/ (function(module, exports, __webpack_require__) {
  8626. "use strict";
  8627. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  8628. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8629. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8630. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8631. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8632. };
  8633. var __metadata = (this && this.__metadata) || function (k, v) {
  8634. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  8635. };
  8636. var __param = (this && this.__param) || function (paramIndex, decorator) {
  8637. return function (target, key) { decorator(target, key, paramIndex); }
  8638. };
  8639. var _a, _b, _c;
  8640. Object.defineProperty(exports, "__esModule", { value: true });
  8641. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8642. const TIdentifierObfuscatingReplacerFactory_1 = __webpack_require__(/*! ../../types/container/node-transformers/TIdentifierObfuscatingReplacerFactory */ "./src/types/container/node-transformers/TIdentifierObfuscatingReplacerFactory.ts");
  8643. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  8644. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  8645. const IdentifierObfuscatingReplacer_1 = __webpack_require__(/*! ../../enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer */ "./src/enums/node-transformers/obfuscating-transformers/obfuscating-replacers/IdentifierObfuscatingReplacer.ts");
  8646. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  8647. const TransformationStage_1 = __webpack_require__(/*! ../../enums/node-transformers/TransformationStage */ "./src/enums/node-transformers/TransformationStage.ts");
  8648. const AbstractNodeTransformer_1 = __webpack_require__(/*! ../AbstractNodeTransformer */ "./src/node-transformers/AbstractNodeTransformer.ts");
  8649. const NodeGuards_1 = __webpack_require__(/*! ../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  8650. let VariablePreserveTransformer = class VariablePreserveTransformer extends AbstractNodeTransformer_1.AbstractNodeTransformer {
  8651. constructor(identifierObfuscatingReplacerFactory, randomGenerator, options) {
  8652. super(randomGenerator, options);
  8653. this.identifierObfuscatingReplacer = identifierObfuscatingReplacerFactory(IdentifierObfuscatingReplacer_1.IdentifierObfuscatingReplacer.BaseIdentifierObfuscatingReplacer);
  8654. }
  8655. getVisitor(transformationStage) {
  8656. switch (transformationStage) {
  8657. case TransformationStage_1.TransformationStage.Preparing:
  8658. return {
  8659. enter: (node, parentNode) => {
  8660. if (NodeGuards_1.NodeGuards.isIdentifierNode(node)
  8661. && parentNode
  8662. && (NodeGuards_1.NodeGuards.parentNodeIsPropertyNode(node, parentNode)
  8663. || NodeGuards_1.NodeGuards.parentNodeIsMemberExpressionNode(node, parentNode)
  8664. || NodeGuards_1.NodeGuards.parentNodeIsMethodDefinitionNode(node, parentNode)
  8665. || NodeGuards_1.NodeGuards.isLabelIdentifierNode(node, parentNode))) {
  8666. return this.transformNode(node, parentNode);
  8667. }
  8668. }
  8669. };
  8670. default:
  8671. return null;
  8672. }
  8673. }
  8674. transformNode(node, parentNode) {
  8675. this.identifierObfuscatingReplacer.preserveName(node.name);
  8676. return node;
  8677. }
  8678. };
  8679. VariablePreserveTransformer = __decorate([
  8680. inversify_1.injectable(),
  8681. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierObfuscatingReplacer)),
  8682. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  8683. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  8684. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierObfuscatingReplacerFactory_1.TIdentifierObfuscatingReplacerFactory !== "undefined" && TIdentifierObfuscatingReplacerFactory_1.TIdentifierObfuscatingReplacerFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  8685. ], VariablePreserveTransformer);
  8686. exports.VariablePreserveTransformer = VariablePreserveTransformer;
  8687. /***/ }),
  8688. /***/ "./src/node-transformers/preparing-transformers/obfuscating-guards/BlackListObfuscatingGuard.ts":
  8689. /*!******************************************************************************************************!*\
  8690. !*** ./src/node-transformers/preparing-transformers/obfuscating-guards/BlackListObfuscatingGuard.ts ***!
  8691. \******************************************************************************************************/
  8692. /*! no static exports found */
  8693. /***/ (function(module, exports, __webpack_require__) {
  8694. "use strict";
  8695. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  8696. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8697. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8698. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8699. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8700. };
  8701. var __metadata = (this && this.__metadata) || function (k, v) {
  8702. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  8703. };
  8704. var BlackListObfuscatingGuard_1;
  8705. Object.defineProperty(exports, "__esModule", { value: true });
  8706. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8707. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  8708. let BlackListObfuscatingGuard = BlackListObfuscatingGuard_1 = class BlackListObfuscatingGuard {
  8709. constructor() {
  8710. this.blackListGuardsLength = BlackListObfuscatingGuard_1.blackListGuards.length;
  8711. }
  8712. check(node) {
  8713. for (let i = 0; i < this.blackListGuardsLength; i++) {
  8714. if (BlackListObfuscatingGuard_1.blackListGuards[i](node)) {
  8715. return false;
  8716. }
  8717. }
  8718. return true;
  8719. }
  8720. };
  8721. BlackListObfuscatingGuard.blackListGuards = [
  8722. NodeGuards_1.NodeGuards.isUseStrictOperator
  8723. ];
  8724. BlackListObfuscatingGuard = BlackListObfuscatingGuard_1 = __decorate([
  8725. inversify_1.injectable(),
  8726. __metadata("design:paramtypes", [])
  8727. ], BlackListObfuscatingGuard);
  8728. exports.BlackListObfuscatingGuard = BlackListObfuscatingGuard;
  8729. /***/ }),
  8730. /***/ "./src/node-transformers/preparing-transformers/obfuscating-guards/ConditionalCommentObfuscatingGuard.ts":
  8731. /*!***************************************************************************************************************!*\
  8732. !*** ./src/node-transformers/preparing-transformers/obfuscating-guards/ConditionalCommentObfuscatingGuard.ts ***!
  8733. \***************************************************************************************************************/
  8734. /*! no static exports found */
  8735. /***/ (function(module, exports, __webpack_require__) {
  8736. "use strict";
  8737. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  8738. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8739. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8740. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8741. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8742. };
  8743. var ConditionalCommentObfuscatingGuard_1;
  8744. Object.defineProperty(exports, "__esModule", { value: true });
  8745. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8746. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  8747. let ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard_1 = class ConditionalCommentObfuscatingGuard {
  8748. constructor() {
  8749. this.obfuscationAllowedForCurrentNode = true;
  8750. this.obfuscationAllowedForNextNode = null;
  8751. }
  8752. static isConditionalComment(comment) {
  8753. return ConditionalCommentObfuscatingGuard_1.obfuscationEnableCommentRegExp.test(comment.value) ||
  8754. ConditionalCommentObfuscatingGuard_1.obfuscationDisableCommentRegExp.test(comment.value);
  8755. }
  8756. check(node) {
  8757. if (this.obfuscationAllowedForNextNode) {
  8758. this.obfuscationAllowedForCurrentNode = this.obfuscationAllowedForNextNode;
  8759. this.obfuscationAllowedForNextNode = null;
  8760. }
  8761. if (!NodeGuards_1.NodeGuards.isNodeWithComments(node)) {
  8762. return this.obfuscationAllowedForCurrentNode;
  8763. }
  8764. const leadingComments = node.leadingComments;
  8765. const trailingComments = node.trailingComments;
  8766. if (leadingComments) {
  8767. this.obfuscationAllowedForCurrentNode = this.checkComments(leadingComments);
  8768. }
  8769. if (trailingComments) {
  8770. this.obfuscationAllowedForNextNode = this.checkComments(trailingComments);
  8771. }
  8772. return this.obfuscationAllowedForCurrentNode;
  8773. }
  8774. checkComments(comments) {
  8775. const commentsLength = comments.length;
  8776. let obfuscationAllowed = this.obfuscationAllowedForCurrentNode;
  8777. for (let i = 0; i < commentsLength; i++) {
  8778. const comment = comments[i];
  8779. if (ConditionalCommentObfuscatingGuard_1.obfuscationEnableCommentRegExp.test(comment.value)) {
  8780. obfuscationAllowed = true;
  8781. continue;
  8782. }
  8783. if (ConditionalCommentObfuscatingGuard_1.obfuscationDisableCommentRegExp.test(comment.value)) {
  8784. obfuscationAllowed = false;
  8785. }
  8786. }
  8787. return obfuscationAllowed;
  8788. }
  8789. };
  8790. ConditionalCommentObfuscatingGuard.obfuscationEnableCommentRegExp = new RegExp('javascript-obfuscator *: *enable');
  8791. ConditionalCommentObfuscatingGuard.obfuscationDisableCommentRegExp = new RegExp('javascript-obfuscator *: *disable');
  8792. ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard_1 = __decorate([
  8793. inversify_1.injectable()
  8794. ], ConditionalCommentObfuscatingGuard);
  8795. exports.ConditionalCommentObfuscatingGuard = ConditionalCommentObfuscatingGuard;
  8796. /***/ }),
  8797. /***/ "./src/node-transformers/preparing-transformers/obfuscating-guards/ReservedStringObfuscatingGuard.ts":
  8798. /*!***********************************************************************************************************!*\
  8799. !*** ./src/node-transformers/preparing-transformers/obfuscating-guards/ReservedStringObfuscatingGuard.ts ***!
  8800. \***********************************************************************************************************/
  8801. /*! no static exports found */
  8802. /***/ (function(module, exports, __webpack_require__) {
  8803. "use strict";
  8804. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  8805. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  8806. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8807. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  8808. return c > 3 && r && Object.defineProperty(target, key, r), r;
  8809. };
  8810. var __metadata = (this && this.__metadata) || function (k, v) {
  8811. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  8812. };
  8813. var __param = (this && this.__param) || function (paramIndex, decorator) {
  8814. return function (target, key) { decorator(target, key, paramIndex); }
  8815. };
  8816. var _a;
  8817. Object.defineProperty(exports, "__esModule", { value: true });
  8818. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  8819. const IOptions_1 = __webpack_require__(/*! ../../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  8820. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  8821. const NodeGuards_1 = __webpack_require__(/*! ../../../node/NodeGuards */ "./src/node/NodeGuards.ts");
  8822. let ReservedStringObfuscatingGuard = class ReservedStringObfuscatingGuard {
  8823. constructor(options) {
  8824. this.options = options;
  8825. }
  8826. check(node) {
  8827. if (this.options.reservedStrings.length
  8828. && NodeGuards_1.NodeGuards.isLiteralNode(node)
  8829. && typeof node.value === 'string') {
  8830. return !this.isReservedString(node.value);
  8831. }
  8832. return true;
  8833. }
  8834. isReservedString(value) {
  8835. return this.options.reservedStrings
  8836. .some((reservedString) => {
  8837. return new RegExp(reservedString, 'g').exec(value) !== null;
  8838. });
  8839. }
  8840. };
  8841. ReservedStringObfuscatingGuard = __decorate([
  8842. inversify_1.injectable(),
  8843. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  8844. __metadata("design:paramtypes", [typeof (_a = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _a : Object])
  8845. ], ReservedStringObfuscatingGuard);
  8846. exports.ReservedStringObfuscatingGuard = ReservedStringObfuscatingGuard;
  8847. /***/ }),
  8848. /***/ "./src/node/NodeAppender.ts":
  8849. /*!**********************************!*\
  8850. !*** ./src/node/NodeAppender.ts ***!
  8851. \**********************************/
  8852. /*! no static exports found */
  8853. /***/ (function(module, exports, __webpack_require__) {
  8854. "use strict";
  8855. Object.defineProperty(exports, "__esModule", { value: true });
  8856. const NodeGuards_1 = __webpack_require__(/*! ./NodeGuards */ "./src/node/NodeGuards.ts");
  8857. class NodeAppender {
  8858. static append(nodeWithStatements, statements) {
  8859. statements = NodeAppender.parentizeScopeStatementsBeforeAppend(nodeWithStatements, statements);
  8860. NodeAppender.setScopeStatements(nodeWithStatements, [
  8861. ...NodeAppender.getScopeStatements(nodeWithStatements),
  8862. ...statements
  8863. ]);
  8864. }
  8865. static appendToOptimalBlockScope(callsGraphData, nodeWithStatements, bodyStatements, index = 0) {
  8866. const targetBlockScope = callsGraphData.length
  8867. ? NodeAppender.getOptimalBlockScope(callsGraphData, index)
  8868. : nodeWithStatements;
  8869. NodeAppender.prepend(targetBlockScope, bodyStatements);
  8870. }
  8871. static getOptimalBlockScope(callsGraphData, index, deep = Infinity) {
  8872. const firstCall = callsGraphData[index];
  8873. if (deep <= 0) {
  8874. throw new Error('Invalid `deep` argument value. Value should be bigger then 0.');
  8875. }
  8876. if (deep > 1 && firstCall.callsGraph.length) {
  8877. return NodeAppender.getOptimalBlockScope(firstCall.callsGraph, 0, --deep);
  8878. }
  8879. else {
  8880. return firstCall.callee;
  8881. }
  8882. }
  8883. static insertBefore(nodeWithStatements, statements, target) {
  8884. const indexInScopeStatement = NodeAppender
  8885. .getScopeStatements(nodeWithStatements)
  8886. .indexOf(target);
  8887. NodeAppender.insertAtIndex(nodeWithStatements, statements, indexInScopeStatement);
  8888. }
  8889. static insertAfter(nodeWithStatements, statements, target) {
  8890. const indexInScopeStatement = NodeAppender
  8891. .getScopeStatements(nodeWithStatements)
  8892. .indexOf(target);
  8893. NodeAppender.insertAtIndex(nodeWithStatements, statements, indexInScopeStatement + 1);
  8894. }
  8895. static insertAtIndex(nodeWithStatements, statements, index) {
  8896. statements = NodeAppender.parentizeScopeStatementsBeforeAppend(nodeWithStatements, statements);
  8897. NodeAppender.setScopeStatements(nodeWithStatements, [
  8898. ...NodeAppender.getScopeStatements(nodeWithStatements).slice(0, index),
  8899. ...statements,
  8900. ...NodeAppender.getScopeStatements(nodeWithStatements).slice(index)
  8901. ]);
  8902. }
  8903. static prepend(nodeWithStatements, statements) {
  8904. statements = NodeAppender.parentizeScopeStatementsBeforeAppend(nodeWithStatements, statements);
  8905. NodeAppender.setScopeStatements(nodeWithStatements, [
  8906. ...statements,
  8907. ...NodeAppender.getScopeStatements(nodeWithStatements),
  8908. ]);
  8909. }
  8910. static getScopeStatements(nodeWithStatements) {
  8911. if (NodeGuards_1.NodeGuards.isSwitchCaseNode(nodeWithStatements)) {
  8912. return nodeWithStatements.consequent;
  8913. }
  8914. return nodeWithStatements.body;
  8915. }
  8916. static parentizeScopeStatementsBeforeAppend(nodeWithStatements, statements) {
  8917. statements.forEach((statement) => {
  8918. statement.parentNode = nodeWithStatements;
  8919. });
  8920. return statements;
  8921. }
  8922. static setScopeStatements(nodeWithStatements, statements) {
  8923. if (NodeGuards_1.NodeGuards.isSwitchCaseNode(nodeWithStatements)) {
  8924. nodeWithStatements.consequent = statements;
  8925. return;
  8926. }
  8927. nodeWithStatements.body = statements;
  8928. }
  8929. }
  8930. exports.NodeAppender = NodeAppender;
  8931. /***/ }),
  8932. /***/ "./src/node/NodeFactory.ts":
  8933. /*!*********************************!*\
  8934. !*** ./src/node/NodeFactory.ts ***!
  8935. \*********************************/
  8936. /*! no static exports found */
  8937. /***/ (function(module, exports, __webpack_require__) {
  8938. "use strict";
  8939. var __importStar = (this && this.__importStar) || function (mod) {
  8940. if (mod && mod.__esModule) return mod;
  8941. var result = {};
  8942. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  8943. result["default"] = mod;
  8944. return result;
  8945. };
  8946. Object.defineProperty(exports, "__esModule", { value: true });
  8947. const escodegen = __importStar(__webpack_require__(/*! escodegen */ "escodegen"));
  8948. const NodeType_1 = __webpack_require__(/*! ../enums/node/NodeType */ "./src/enums/node/NodeType.ts");
  8949. class NodeFactory {
  8950. static programNode(body = []) {
  8951. return {
  8952. type: NodeType_1.NodeType.Program,
  8953. body,
  8954. sourceType: 'script',
  8955. metadata: { ignoredNode: false }
  8956. };
  8957. }
  8958. static arrayExpressionNode(elements = []) {
  8959. return {
  8960. type: NodeType_1.NodeType.ArrayExpression,
  8961. elements,
  8962. metadata: { ignoredNode: false }
  8963. };
  8964. }
  8965. static assignmentExpressionNode(operator, left, right) {
  8966. return {
  8967. type: NodeType_1.NodeType.AssignmentExpression,
  8968. operator,
  8969. left,
  8970. right,
  8971. metadata: { ignoredNode: false }
  8972. };
  8973. }
  8974. static binaryExpressionNode(operator, left, right) {
  8975. return {
  8976. type: NodeType_1.NodeType.BinaryExpression,
  8977. operator,
  8978. left,
  8979. right,
  8980. metadata: { ignoredNode: false }
  8981. };
  8982. }
  8983. static blockStatementNode(body = []) {
  8984. return {
  8985. type: NodeType_1.NodeType.BlockStatement,
  8986. body,
  8987. metadata: { ignoredNode: false }
  8988. };
  8989. }
  8990. static breakStatement(label) {
  8991. return {
  8992. type: NodeType_1.NodeType.BreakStatement,
  8993. label,
  8994. metadata: { ignoredNode: false }
  8995. };
  8996. }
  8997. static callExpressionNode(callee, args = []) {
  8998. return {
  8999. type: NodeType_1.NodeType.CallExpression,
  9000. callee,
  9001. arguments: args,
  9002. metadata: { ignoredNode: false }
  9003. };
  9004. }
  9005. static continueStatement(label) {
  9006. return {
  9007. type: NodeType_1.NodeType.ContinueStatement,
  9008. label,
  9009. metadata: { ignoredNode: false }
  9010. };
  9011. }
  9012. static directiveNode(expression, directive) {
  9013. return {
  9014. type: NodeType_1.NodeType.ExpressionStatement,
  9015. expression,
  9016. directive,
  9017. metadata: { ignoredNode: false }
  9018. };
  9019. }
  9020. static expressionStatementNode(expression) {
  9021. return {
  9022. type: NodeType_1.NodeType.ExpressionStatement,
  9023. expression,
  9024. metadata: { ignoredNode: false }
  9025. };
  9026. }
  9027. static functionDeclarationNode(functionName, params, body) {
  9028. return {
  9029. type: NodeType_1.NodeType.FunctionDeclaration,
  9030. id: NodeFactory.identifierNode(functionName),
  9031. params,
  9032. body,
  9033. generator: false,
  9034. metadata: { ignoredNode: false }
  9035. };
  9036. }
  9037. static functionExpressionNode(params, body) {
  9038. return {
  9039. type: NodeType_1.NodeType.FunctionExpression,
  9040. params,
  9041. body,
  9042. generator: false,
  9043. metadata: { ignoredNode: false }
  9044. };
  9045. }
  9046. static ifStatementNode(test, consequent, alternate) {
  9047. return Object.assign(Object.assign({ type: NodeType_1.NodeType.IfStatement, test,
  9048. consequent }, alternate && { alternate }), { metadata: { ignoredNode: false } });
  9049. }
  9050. static identifierNode(name) {
  9051. return {
  9052. type: NodeType_1.NodeType.Identifier,
  9053. name,
  9054. metadata: { ignoredNode: false }
  9055. };
  9056. }
  9057. static importDeclarationNode(specifiers, source) {
  9058. return {
  9059. type: NodeType_1.NodeType.ImportDeclaration,
  9060. specifiers,
  9061. source,
  9062. metadata: { ignoredNode: false }
  9063. };
  9064. }
  9065. static literalNode(value, raw) {
  9066. raw = raw !== undefined ? raw : `'${value}'`;
  9067. return {
  9068. type: NodeType_1.NodeType.Literal,
  9069. value,
  9070. raw,
  9071. 'x-verbatim-property': {
  9072. content: raw,
  9073. precedence: escodegen.Precedence.Primary
  9074. },
  9075. metadata: { ignoredNode: false }
  9076. };
  9077. }
  9078. static logicalExpressionNode(operator, left, right) {
  9079. return {
  9080. type: NodeType_1.NodeType.LogicalExpression,
  9081. operator,
  9082. left,
  9083. right,
  9084. metadata: { ignoredNode: false }
  9085. };
  9086. }
  9087. static memberExpressionNode(object, property, computed = false) {
  9088. return {
  9089. type: NodeType_1.NodeType.MemberExpression,
  9090. computed,
  9091. object,
  9092. property,
  9093. metadata: { ignoredNode: false }
  9094. };
  9095. }
  9096. static methodDefinitionNode(key, value, kind, computed) {
  9097. return {
  9098. type: NodeType_1.NodeType.MethodDefinition,
  9099. key,
  9100. value,
  9101. kind,
  9102. computed,
  9103. static: false,
  9104. metadata: { ignoredNode: false }
  9105. };
  9106. }
  9107. static objectExpressionNode(properties) {
  9108. return {
  9109. type: NodeType_1.NodeType.ObjectExpression,
  9110. properties,
  9111. metadata: { ignoredNode: false }
  9112. };
  9113. }
  9114. static propertyNode(key, value, computed = false) {
  9115. return {
  9116. type: NodeType_1.NodeType.Property,
  9117. key,
  9118. value,
  9119. kind: 'init',
  9120. method: false,
  9121. shorthand: false,
  9122. computed,
  9123. metadata: { ignoredNode: false }
  9124. };
  9125. }
  9126. static returnStatementNode(argument) {
  9127. return {
  9128. type: NodeType_1.NodeType.ReturnStatement,
  9129. argument,
  9130. metadata: { ignoredNode: false }
  9131. };
  9132. }
  9133. static switchStatementNode(discriminant, cases) {
  9134. return {
  9135. type: NodeType_1.NodeType.SwitchStatement,
  9136. discriminant,
  9137. cases,
  9138. metadata: { ignoredNode: false }
  9139. };
  9140. }
  9141. static switchCaseNode(test, consequent) {
  9142. return {
  9143. type: NodeType_1.NodeType.SwitchCase,
  9144. test,
  9145. consequent,
  9146. metadata: { ignoredNode: false }
  9147. };
  9148. }
  9149. static unaryExpressionNode(operator, argument, prefix = true) {
  9150. return {
  9151. type: NodeType_1.NodeType.UnaryExpression,
  9152. operator,
  9153. argument,
  9154. prefix,
  9155. metadata: { ignoredNode: false }
  9156. };
  9157. }
  9158. static updateExpressionNode(operator, argumentExpr) {
  9159. return {
  9160. type: NodeType_1.NodeType.UpdateExpression,
  9161. operator,
  9162. argument: argumentExpr,
  9163. prefix: false,
  9164. metadata: { ignoredNode: false }
  9165. };
  9166. }
  9167. static variableDeclarationNode(declarations = [], kind = 'var') {
  9168. return {
  9169. type: NodeType_1.NodeType.VariableDeclaration,
  9170. declarations,
  9171. kind,
  9172. metadata: { ignoredNode: false }
  9173. };
  9174. }
  9175. static variableDeclaratorNode(id, init) {
  9176. return {
  9177. type: NodeType_1.NodeType.VariableDeclarator,
  9178. id,
  9179. init,
  9180. metadata: { ignoredNode: false }
  9181. };
  9182. }
  9183. static whileStatementNode(test, body) {
  9184. return {
  9185. type: NodeType_1.NodeType.WhileStatement,
  9186. test,
  9187. body,
  9188. metadata: { ignoredNode: false }
  9189. };
  9190. }
  9191. }
  9192. exports.NodeFactory = NodeFactory;
  9193. /***/ }),
  9194. /***/ "./src/node/NodeGuards.ts":
  9195. /*!********************************!*\
  9196. !*** ./src/node/NodeGuards.ts ***!
  9197. \********************************/
  9198. /*! no static exports found */
  9199. /***/ (function(module, exports, __webpack_require__) {
  9200. "use strict";
  9201. Object.defineProperty(exports, "__esModule", { value: true });
  9202. const NodeType_1 = __webpack_require__(/*! ../enums/node/NodeType */ "./src/enums/node/NodeType.ts");
  9203. class NodeGuards {
  9204. static isArrayPatternNode(node) {
  9205. return node.type === NodeType_1.NodeType.ArrayPattern;
  9206. }
  9207. static isArrowFunctionExpressionNode(node) {
  9208. return node.type === NodeType_1.NodeType.ArrowFunctionExpression;
  9209. }
  9210. static isAssignmentExpressionNode(node) {
  9211. return node.type === NodeType_1.NodeType.AssignmentExpression;
  9212. }
  9213. static isAssignmentPatternNode(node) {
  9214. return node.type === NodeType_1.NodeType.AssignmentPattern;
  9215. }
  9216. static isAwaitExpressionNode(node) {
  9217. return node.type === NodeType_1.NodeType.AwaitExpression;
  9218. }
  9219. static isBlockStatementNode(node) {
  9220. return node.type === NodeType_1.NodeType.BlockStatement;
  9221. }
  9222. static isBreakStatementNode(node) {
  9223. return node.type === NodeType_1.NodeType.BreakStatement;
  9224. }
  9225. static isCallExpressionNode(node) {
  9226. return node.type === NodeType_1.NodeType.CallExpression;
  9227. }
  9228. static isClassDeclarationNode(node) {
  9229. return node.type === NodeType_1.NodeType.ClassDeclaration && node.id !== null;
  9230. }
  9231. static isContinueStatementNode(node) {
  9232. return node.type === NodeType_1.NodeType.ContinueStatement;
  9233. }
  9234. static isDirectiveNode(node) {
  9235. return node.type === NodeType_1.NodeType.ExpressionStatement
  9236. && 'directive' in node;
  9237. }
  9238. static isExportNamedDeclarationNode(node) {
  9239. return node.type === NodeType_1.NodeType.ExportNamedDeclaration;
  9240. }
  9241. static isExpressionStatementNode(node) {
  9242. return node.type === NodeType_1.NodeType.ExpressionStatement
  9243. && !('directive' in node);
  9244. }
  9245. static isFunctionNode(node) {
  9246. return NodeGuards.isFunctionDeclarationNode(node) ||
  9247. NodeGuards.isFunctionExpressionNode(node) ||
  9248. NodeGuards.isArrowFunctionExpressionNode(node);
  9249. }
  9250. static isFunctionDeclarationNode(node) {
  9251. return node.type === NodeType_1.NodeType.FunctionDeclaration && node.id !== null;
  9252. }
  9253. static isFunctionExpressionNode(node) {
  9254. return node.type === NodeType_1.NodeType.FunctionExpression;
  9255. }
  9256. static isIdentifierNode(node) {
  9257. return node.type === NodeType_1.NodeType.Identifier;
  9258. }
  9259. static isImportDeclarationNode(node) {
  9260. return node.type === NodeType_1.NodeType.ImportDeclaration;
  9261. }
  9262. static isImportSpecifierNode(node) {
  9263. return node.type === NodeType_1.NodeType.ImportSpecifier;
  9264. }
  9265. static isLabelIdentifierNode(node, parentNode) {
  9266. const parentNodeIsLabeledStatementNode = NodeGuards.isLabeledStatementNode(parentNode) && parentNode.label === node;
  9267. const parentNodeIsContinueStatementNode = NodeGuards.isContinueStatementNode(parentNode) && parentNode.label === node;
  9268. const parentNodeIsBreakStatementNode = NodeGuards.isBreakStatementNode(parentNode) && parentNode.label === node;
  9269. return parentNodeIsLabeledStatementNode || parentNodeIsContinueStatementNode || parentNodeIsBreakStatementNode;
  9270. }
  9271. static isLabeledStatementNode(node) {
  9272. return node.type === NodeType_1.NodeType.LabeledStatement;
  9273. }
  9274. static isLiteralNode(node) {
  9275. return node.type === NodeType_1.NodeType.Literal;
  9276. }
  9277. static isMemberExpressionNode(node) {
  9278. return node.type === NodeType_1.NodeType.MemberExpression;
  9279. }
  9280. static isMethodDefinitionNode(node) {
  9281. return node.type === NodeType_1.NodeType.MethodDefinition;
  9282. }
  9283. static isNode(object) {
  9284. return object && !object.type !== undefined;
  9285. }
  9286. static isNodeWithLexicalScope(node) {
  9287. return NodeGuards.isProgramNode(node) || NodeGuards.isFunctionNode(node);
  9288. }
  9289. static isNodeWithBlockLexicalScope(node) {
  9290. return NodeGuards.isNodeWithLexicalScope(node) || NodeGuards.isBlockStatementNode(node);
  9291. }
  9292. static isNodeWithLexicalScopeStatements(node, parentNode) {
  9293. return NodeGuards.isProgramNode(node)
  9294. || (NodeGuards.isBlockStatementNode(node) && NodeGuards.nodesWithLexicalStatements.includes(parentNode.type));
  9295. }
  9296. static isNodeWithStatements(node) {
  9297. return NodeGuards.isProgramNode(node)
  9298. || NodeGuards.isBlockStatementNode(node)
  9299. || NodeGuards.isSwitchCaseNode(node);
  9300. }
  9301. static isNodeWithComments(node) {
  9302. return Boolean(node.leadingComments) || Boolean(node.trailingComments);
  9303. }
  9304. static isObjectPatternNode(node) {
  9305. return node.type === NodeType_1.NodeType.ObjectPattern;
  9306. }
  9307. static isObjectExpressionNode(node) {
  9308. return node.type === NodeType_1.NodeType.ObjectExpression;
  9309. }
  9310. static isProgramNode(node) {
  9311. return node.type === NodeType_1.NodeType.Program;
  9312. }
  9313. static isPropertyNode(node) {
  9314. return node.type === NodeType_1.NodeType.Property;
  9315. }
  9316. static parentNodeIsPropertyNode(node, parentNode) {
  9317. return NodeGuards.isPropertyNode(parentNode)
  9318. && !parentNode.computed
  9319. && parentNode.key === node;
  9320. }
  9321. static parentNodeIsMemberExpressionNode(node, parentNode) {
  9322. return (NodeGuards.isMemberExpressionNode(parentNode)
  9323. && !parentNode.computed
  9324. && parentNode.property === node);
  9325. }
  9326. static parentNodeIsMethodDefinitionNode(node, parentNode) {
  9327. return NodeGuards.isMethodDefinitionNode(parentNode)
  9328. && !parentNode.computed;
  9329. }
  9330. static isRestElementNode(node) {
  9331. return node.type === NodeType_1.NodeType.RestElement;
  9332. }
  9333. static isReturnStatementNode(node) {
  9334. return node.type === NodeType_1.NodeType.ReturnStatement;
  9335. }
  9336. static isSuperNode(node) {
  9337. return node.type === NodeType_1.NodeType.Super;
  9338. }
  9339. static isSwitchCaseNode(node) {
  9340. return node.type === NodeType_1.NodeType.SwitchCase;
  9341. }
  9342. static isTaggedTemplateExpressionNode(node) {
  9343. return node.type === NodeType_1.NodeType.TaggedTemplateExpression;
  9344. }
  9345. static isTemplateLiteralNode(node) {
  9346. return node.type === NodeType_1.NodeType.TemplateLiteral;
  9347. }
  9348. static isUnaryExpressionNode(node) {
  9349. return node.type === NodeType_1.NodeType.UnaryExpression;
  9350. }
  9351. static isUseStrictOperator(node) {
  9352. return NodeGuards.isDirectiveNode(node)
  9353. && node.directive === 'use strict';
  9354. }
  9355. static isVariableDeclarationNode(node) {
  9356. return node.type === NodeType_1.NodeType.VariableDeclaration;
  9357. }
  9358. static isVariableDeclaratorNode(node) {
  9359. return node.type === NodeType_1.NodeType.VariableDeclarator;
  9360. }
  9361. static isWhileStatementNode(node) {
  9362. return node.type === NodeType_1.NodeType.WhileStatement;
  9363. }
  9364. }
  9365. exports.NodeGuards = NodeGuards;
  9366. NodeGuards.nodesWithLexicalStatements = [
  9367. NodeType_1.NodeType.ArrowFunctionExpression,
  9368. NodeType_1.NodeType.FunctionDeclaration,
  9369. NodeType_1.NodeType.FunctionExpression,
  9370. NodeType_1.NodeType.MethodDefinition,
  9371. ];
  9372. /***/ }),
  9373. /***/ "./src/node/NodeLexicalScopeUtils.ts":
  9374. /*!*******************************************!*\
  9375. !*** ./src/node/NodeLexicalScopeUtils.ts ***!
  9376. \*******************************************/
  9377. /*! no static exports found */
  9378. /***/ (function(module, exports, __webpack_require__) {
  9379. "use strict";
  9380. Object.defineProperty(exports, "__esModule", { value: true });
  9381. const NodeGuards_1 = __webpack_require__(/*! ./NodeGuards */ "./src/node/NodeGuards.ts");
  9382. class NodeLexicalScopeUtils {
  9383. static getLexicalScope(node) {
  9384. return NodeLexicalScopeUtils.getLexicalScopesRecursive(node, 1)[0];
  9385. }
  9386. static getLexicalScopes(node) {
  9387. return NodeLexicalScopeUtils.getLexicalScopesRecursive(node);
  9388. }
  9389. static getLexicalScopesRecursive(node, maxSize = Infinity, nodesWithLexicalScope = [], depth = 0) {
  9390. if (nodesWithLexicalScope.length >= maxSize) {
  9391. return nodesWithLexicalScope;
  9392. }
  9393. const parentNode = node.parentNode;
  9394. if (!parentNode) {
  9395. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  9396. }
  9397. if (NodeGuards_1.NodeGuards.isNodeWithLexicalScope(node)) {
  9398. nodesWithLexicalScope.push(node);
  9399. }
  9400. if (node !== parentNode) {
  9401. return NodeLexicalScopeUtils.getLexicalScopesRecursive(parentNode, maxSize, nodesWithLexicalScope, ++depth);
  9402. }
  9403. return nodesWithLexicalScope;
  9404. }
  9405. }
  9406. exports.NodeLexicalScopeUtils = NodeLexicalScopeUtils;
  9407. /***/ }),
  9408. /***/ "./src/node/NodeLiteralUtils.ts":
  9409. /*!**************************************!*\
  9410. !*** ./src/node/NodeLiteralUtils.ts ***!
  9411. \**************************************/
  9412. /*! no static exports found */
  9413. /***/ (function(module, exports, __webpack_require__) {
  9414. "use strict";
  9415. Object.defineProperty(exports, "__esModule", { value: true });
  9416. const NodeGuards_1 = __webpack_require__(/*! ./NodeGuards */ "./src/node/NodeGuards.ts");
  9417. class NodeLiteralUtils {
  9418. static isProhibitedLiteralNode(literalNode, parentNode) {
  9419. if (NodeGuards_1.NodeGuards.isPropertyNode(parentNode) && !parentNode.computed && parentNode.key === literalNode) {
  9420. return true;
  9421. }
  9422. if (NodeGuards_1.NodeGuards.isImportDeclarationNode(parentNode)) {
  9423. return true;
  9424. }
  9425. return false;
  9426. }
  9427. }
  9428. exports.NodeLiteralUtils = NodeLiteralUtils;
  9429. /***/ }),
  9430. /***/ "./src/node/NodeMetadata.ts":
  9431. /*!**********************************!*\
  9432. !*** ./src/node/NodeMetadata.ts ***!
  9433. \**********************************/
  9434. /*! no static exports found */
  9435. /***/ (function(module, exports, __webpack_require__) {
  9436. "use strict";
  9437. Object.defineProperty(exports, "__esModule", { value: true });
  9438. class NodeMetadata {
  9439. static set(node, metadata) {
  9440. var _a;
  9441. node.metadata = Object.assign((_a = node.metadata) !== null && _a !== void 0 ? _a : {}, metadata);
  9442. }
  9443. static get(node, metadataKey) {
  9444. return node.metadata !== undefined
  9445. ? node.metadata[metadataKey]
  9446. : undefined;
  9447. }
  9448. static isIgnoredNode(node) {
  9449. return NodeMetadata.get(node, 'ignoredNode') === true;
  9450. }
  9451. static isReplacedLiteral(literalNode) {
  9452. return NodeMetadata.get(literalNode, 'replacedLiteral') === true;
  9453. }
  9454. }
  9455. exports.NodeMetadata = NodeMetadata;
  9456. /***/ }),
  9457. /***/ "./src/node/NodeStatementUtils.ts":
  9458. /*!****************************************!*\
  9459. !*** ./src/node/NodeStatementUtils.ts ***!
  9460. \****************************************/
  9461. /*! no static exports found */
  9462. /***/ (function(module, exports, __webpack_require__) {
  9463. "use strict";
  9464. Object.defineProperty(exports, "__esModule", { value: true });
  9465. const NodeGuards_1 = __webpack_require__(/*! ./NodeGuards */ "./src/node/NodeGuards.ts");
  9466. class NodeStatementUtils {
  9467. static getParentNodeWithStatements(node) {
  9468. return NodeStatementUtils.getParentNodesWithStatementsRecursive(node, 1)[0];
  9469. }
  9470. static getParentNodesWithStatements(node) {
  9471. return NodeStatementUtils.getParentNodesWithStatementsRecursive(node);
  9472. }
  9473. static getNextSiblingStatement(statement) {
  9474. return NodeStatementUtils.getSiblingStatementByOffset(statement, 1);
  9475. }
  9476. static getPreviousSiblingStatement(statement) {
  9477. return NodeStatementUtils.getSiblingStatementByOffset(statement, -1);
  9478. }
  9479. static getRootStatementOfNode(node) {
  9480. if (NodeGuards_1.NodeGuards.isProgramNode(node)) {
  9481. throw new Error('Unable to find root statement for `Program` node');
  9482. }
  9483. const parentNode = node.parentNode;
  9484. if (!parentNode) {
  9485. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  9486. }
  9487. if (!NodeGuards_1.NodeGuards.isNodeWithStatements(parentNode)) {
  9488. return NodeStatementUtils.getRootStatementOfNode(parentNode);
  9489. }
  9490. return node;
  9491. }
  9492. static getScopeOfNode(node) {
  9493. const parentNode = node.parentNode;
  9494. if (!parentNode) {
  9495. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  9496. }
  9497. if (!NodeGuards_1.NodeGuards.isNodeWithStatements(parentNode)) {
  9498. return NodeStatementUtils.getScopeOfNode(parentNode);
  9499. }
  9500. return parentNode;
  9501. }
  9502. static getParentNodesWithStatementsRecursive(node, maxSize = Infinity, nodesWithStatements = [], depth = 0) {
  9503. if (nodesWithStatements.length >= maxSize) {
  9504. return nodesWithStatements;
  9505. }
  9506. const parentNode = node.parentNode;
  9507. if (!parentNode) {
  9508. throw new ReferenceError('`parentNode` property of given node is `undefined`');
  9509. }
  9510. if (NodeGuards_1.NodeGuards.isProgramNode(node) ||
  9511. (NodeGuards_1.NodeGuards.isNodeWithLexicalScopeStatements(node, parentNode) && depth > 0)) {
  9512. nodesWithStatements.push(node);
  9513. }
  9514. if (node !== parentNode) {
  9515. return NodeStatementUtils.getParentNodesWithStatementsRecursive(parentNode, maxSize, nodesWithStatements, ++depth);
  9516. }
  9517. return nodesWithStatements;
  9518. }
  9519. static getSiblingStatementByOffset(statement, offset) {
  9520. const scopeNode = NodeStatementUtils.getScopeOfNode(statement);
  9521. const scopeBody = !NodeGuards_1.NodeGuards.isSwitchCaseNode(scopeNode)
  9522. ? scopeNode.body
  9523. : scopeNode.consequent;
  9524. const indexInScope = scopeBody.indexOf(statement);
  9525. return scopeBody[indexInScope + offset] || null;
  9526. }
  9527. }
  9528. exports.NodeStatementUtils = NodeStatementUtils;
  9529. /***/ }),
  9530. /***/ "./src/node/NodeUtils.ts":
  9531. /*!*******************************!*\
  9532. !*** ./src/node/NodeUtils.ts ***!
  9533. \*******************************/
  9534. /*! no static exports found */
  9535. /***/ (function(module, exports, __webpack_require__) {
  9536. "use strict";
  9537. var __importStar = (this && this.__importStar) || function (mod) {
  9538. if (mod && mod.__esModule) return mod;
  9539. var result = {};
  9540. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  9541. result["default"] = mod;
  9542. return result;
  9543. };
  9544. Object.defineProperty(exports, "__esModule", { value: true });
  9545. const escodegen = __importStar(__webpack_require__(/*! escodegen */ "escodegen"));
  9546. const estraverse = __importStar(__webpack_require__(/*! estraverse */ "estraverse"));
  9547. const EcmaVersion_1 = __webpack_require__(/*! ../constants/EcmaVersion */ "./src/constants/EcmaVersion.ts");
  9548. const ASTParserFacade_1 = __webpack_require__(/*! ../ASTParserFacade */ "./src/ASTParserFacade.ts");
  9549. const NodeGuards_1 = __webpack_require__(/*! ./NodeGuards */ "./src/node/NodeGuards.ts");
  9550. const NodeMetadata_1 = __webpack_require__(/*! ./NodeMetadata */ "./src/node/NodeMetadata.ts");
  9551. class NodeUtils {
  9552. static addXVerbatimPropertyTo(literalNode) {
  9553. literalNode['x-verbatim-property'] = {
  9554. content: literalNode.raw,
  9555. precedence: escodegen.Precedence.Primary
  9556. };
  9557. return literalNode;
  9558. }
  9559. static clone(astTree) {
  9560. return NodeUtils.parentizeAst(NodeUtils.cloneRecursive(astTree));
  9561. }
  9562. static convertCodeToStructure(code) {
  9563. const structure = ASTParserFacade_1.ASTParserFacade.parse({ sourceCode: code }, {
  9564. ecmaVersion: EcmaVersion_1.ecmaVersion,
  9565. sourceType: 'script'
  9566. });
  9567. estraverse.replace(structure, {
  9568. enter: (node, parentNode) => {
  9569. NodeUtils.parentizeNode(node, parentNode);
  9570. if (NodeGuards_1.NodeGuards.isLiteralNode(node)) {
  9571. NodeUtils.addXVerbatimPropertyTo(node);
  9572. }
  9573. NodeMetadata_1.NodeMetadata.set(node, { ignoredNode: false });
  9574. return node;
  9575. }
  9576. });
  9577. return structure.body;
  9578. }
  9579. static convertStructureToCode(structure) {
  9580. return structure.reduce((code, node) => {
  9581. return code + escodegen.generate(node, {
  9582. sourceMapWithCode: true
  9583. }).code;
  9584. }, '');
  9585. }
  9586. static getUnaryExpressionArgumentNode(unaryExpressionNode) {
  9587. if (NodeGuards_1.NodeGuards.isUnaryExpressionNode(unaryExpressionNode.argument)) {
  9588. return NodeUtils.getUnaryExpressionArgumentNode(unaryExpressionNode.argument);
  9589. }
  9590. return unaryExpressionNode.argument;
  9591. }
  9592. static parentizeAst(astTree) {
  9593. estraverse.replace(astTree, {
  9594. enter: NodeUtils.parentizeNode
  9595. });
  9596. return astTree;
  9597. }
  9598. static parentizeNode(node, parentNode) {
  9599. node.parentNode = parentNode !== null && parentNode !== void 0 ? parentNode : node;
  9600. return node;
  9601. }
  9602. static cloneRecursive(node) {
  9603. if (node === null) {
  9604. return node;
  9605. }
  9606. const copy = {};
  9607. const nodeKeys = Object.keys(node);
  9608. nodeKeys
  9609. .forEach((property) => {
  9610. if (property === 'parentNode') {
  9611. return;
  9612. }
  9613. const value = node[property];
  9614. let clonedValue;
  9615. if (value === null || value instanceof RegExp) {
  9616. clonedValue = value;
  9617. }
  9618. else if (Array.isArray(value)) {
  9619. clonedValue = value.map(NodeUtils.cloneRecursive);
  9620. }
  9621. else if (typeof value === 'object') {
  9622. clonedValue = NodeUtils.cloneRecursive(value);
  9623. }
  9624. else {
  9625. clonedValue = value;
  9626. }
  9627. copy[property] = clonedValue;
  9628. });
  9629. return copy;
  9630. }
  9631. }
  9632. exports.NodeUtils = NodeUtils;
  9633. /***/ }),
  9634. /***/ "./src/options/Options.ts":
  9635. /*!********************************!*\
  9636. !*** ./src/options/Options.ts ***!
  9637. \********************************/
  9638. /*! no static exports found */
  9639. /***/ (function(module, exports, __webpack_require__) {
  9640. "use strict";
  9641. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  9642. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  9643. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  9644. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  9645. return c > 3 && r && Object.defineProperty(target, key, r), r;
  9646. };
  9647. var __metadata = (this && this.__metadata) || function (k, v) {
  9648. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  9649. };
  9650. var __param = (this && this.__param) || function (paramIndex, decorator) {
  9651. return function (target, key) { decorator(target, key, paramIndex); }
  9652. };
  9653. var Options_1, _a, _b, _c, _d, _e, _f;
  9654. Object.defineProperty(exports, "__esModule", { value: true });
  9655. const tsenum_1 = __webpack_require__(/*! @gradecam/tsenum */ "@gradecam/tsenum");
  9656. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  9657. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  9658. const class_validator_1 = __webpack_require__(/*! class-validator */ "class-validator");
  9659. const TInputOptions_1 = __webpack_require__(/*! ../types/options/TInputOptions */ "./src/types/options/TInputOptions.ts");
  9660. const TStringArrayEncoding_1 = __webpack_require__(/*! ../types/options/TStringArrayEncoding */ "./src/types/options/TStringArrayEncoding.ts");
  9661. const IOptionsNormalizer_1 = __webpack_require__(/*! ../interfaces/options/IOptionsNormalizer */ "./src/interfaces/options/IOptionsNormalizer.ts");
  9662. const IdentifierNamesGenerator_1 = __webpack_require__(/*! ../enums/generators/identifier-names-generators/IdentifierNamesGenerator */ "./src/enums/generators/identifier-names-generators/IdentifierNamesGenerator.ts");
  9663. const ObfuscationTarget_1 = __webpack_require__(/*! ../enums/ObfuscationTarget */ "./src/enums/ObfuscationTarget.ts");
  9664. const SourceMapMode_1 = __webpack_require__(/*! ../enums/source-map/SourceMapMode */ "./src/enums/source-map/SourceMapMode.ts");
  9665. const StringArrayEncoding_1 = __webpack_require__(/*! ../enums/StringArrayEncoding */ "./src/enums/StringArrayEncoding.ts");
  9666. const Default_1 = __webpack_require__(/*! ./presets/Default */ "./src/options/presets/Default.ts");
  9667. const ValidationErrorsFormatter_1 = __webpack_require__(/*! ./ValidationErrorsFormatter */ "./src/options/ValidationErrorsFormatter.ts");
  9668. const IsAllowedForObfuscationTargets_1 = __webpack_require__(/*! ./validators/IsAllowedForObfuscationTargets */ "./src/options/validators/IsAllowedForObfuscationTargets.ts");
  9669. let Options = Options_1 = class Options {
  9670. constructor(inputOptions, optionsNormalizer) {
  9671. Object.assign(this, Default_1.DEFAULT_PRESET, inputOptions);
  9672. const errors = class_validator_1.validateSync(this, Options_1.validatorOptions);
  9673. if (errors.length) {
  9674. throw new ReferenceError(`Validation failed. errors:\n${ValidationErrorsFormatter_1.ValidationErrorsFormatter.format(errors)}`);
  9675. }
  9676. Object.assign(this, optionsNormalizer.normalize(this));
  9677. }
  9678. };
  9679. Options.validatorOptions = {
  9680. validationError: {
  9681. target: false
  9682. }
  9683. };
  9684. __decorate([
  9685. class_validator_1.IsBoolean(),
  9686. __metadata("design:type", Boolean)
  9687. ], Options.prototype, "compact", void 0);
  9688. __decorate([
  9689. class_validator_1.IsBoolean(),
  9690. __metadata("design:type", Boolean)
  9691. ], Options.prototype, "controlFlowFlattening", void 0);
  9692. __decorate([
  9693. class_validator_1.IsNumber(),
  9694. class_validator_1.Min(0),
  9695. class_validator_1.Max(1),
  9696. __metadata("design:type", Number)
  9697. ], Options.prototype, "controlFlowFlatteningThreshold", void 0);
  9698. __decorate([
  9699. class_validator_1.IsBoolean(),
  9700. __metadata("design:type", Boolean)
  9701. ], Options.prototype, "deadCodeInjection", void 0);
  9702. __decorate([
  9703. class_validator_1.IsNumber(),
  9704. __metadata("design:type", Number)
  9705. ], Options.prototype, "deadCodeInjectionThreshold", void 0);
  9706. __decorate([
  9707. class_validator_1.IsBoolean(),
  9708. __metadata("design:type", Boolean)
  9709. ], Options.prototype, "debugProtection", void 0);
  9710. __decorate([
  9711. class_validator_1.IsBoolean(),
  9712. __metadata("design:type", Boolean)
  9713. ], Options.prototype, "debugProtectionInterval", void 0);
  9714. __decorate([
  9715. class_validator_1.IsBoolean(),
  9716. __metadata("design:type", Boolean)
  9717. ], Options.prototype, "disableConsoleOutput", void 0);
  9718. __decorate([
  9719. class_validator_1.IsArray(),
  9720. class_validator_1.ArrayUnique(),
  9721. class_validator_1.IsString({
  9722. each: true
  9723. }),
  9724. IsAllowedForObfuscationTargets_1.IsAllowedForObfuscationTargets([
  9725. ObfuscationTarget_1.ObfuscationTarget.Browser,
  9726. ObfuscationTarget_1.ObfuscationTarget.BrowserNoEval,
  9727. ]),
  9728. __metadata("design:type", Array)
  9729. ], Options.prototype, "domainLock", void 0);
  9730. __decorate([
  9731. class_validator_1.IsIn([
  9732. IdentifierNamesGenerator_1.IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator,
  9733. IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,
  9734. IdentifierNamesGenerator_1.IdentifierNamesGenerator.MangledIdentifierNamesGenerator
  9735. ]),
  9736. __metadata("design:type", typeof (_a = typeof tsenum_1.TypeFromEnum !== "undefined" && tsenum_1.TypeFromEnum) === "function" ? _a : Object)
  9737. ], Options.prototype, "identifierNamesGenerator", void 0);
  9738. __decorate([
  9739. class_validator_1.IsString(),
  9740. __metadata("design:type", String)
  9741. ], Options.prototype, "identifiersPrefix", void 0);
  9742. __decorate([
  9743. class_validator_1.IsArray(),
  9744. class_validator_1.ArrayUnique(),
  9745. class_validator_1.IsString({
  9746. each: true
  9747. }),
  9748. class_validator_1.ValidateIf((options) => options.identifierNamesGenerator === IdentifierNamesGenerator_1.IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator),
  9749. class_validator_1.ArrayNotEmpty(),
  9750. __metadata("design:type", Array)
  9751. ], Options.prototype, "identifiersDictionary", void 0);
  9752. __decorate([
  9753. class_validator_1.IsString(),
  9754. __metadata("design:type", String)
  9755. ], Options.prototype, "inputFileName", void 0);
  9756. __decorate([
  9757. class_validator_1.IsString(),
  9758. __metadata("design:type", String)
  9759. ], Options.prototype, "inputFilePath", void 0);
  9760. __decorate([
  9761. class_validator_1.IsBoolean(),
  9762. __metadata("design:type", Boolean)
  9763. ], Options.prototype, "log", void 0);
  9764. __decorate([
  9765. class_validator_1.IsBoolean(),
  9766. __metadata("design:type", Boolean)
  9767. ], Options.prototype, "renameGlobals", void 0);
  9768. __decorate([
  9769. class_validator_1.IsArray(),
  9770. class_validator_1.ArrayUnique(),
  9771. class_validator_1.IsString({
  9772. each: true
  9773. }),
  9774. __metadata("design:type", Array)
  9775. ], Options.prototype, "reservedNames", void 0);
  9776. __decorate([
  9777. class_validator_1.IsArray(),
  9778. class_validator_1.ArrayUnique(),
  9779. class_validator_1.IsString({
  9780. each: true
  9781. }),
  9782. __metadata("design:type", Array)
  9783. ], Options.prototype, "reservedStrings", void 0);
  9784. __decorate([
  9785. class_validator_1.IsBoolean(),
  9786. __metadata("design:type", Boolean)
  9787. ], Options.prototype, "rotateStringArray", void 0);
  9788. __decorate([
  9789. class_validator_1.IsBoolean(),
  9790. __metadata("design:type", Boolean)
  9791. ], Options.prototype, "selfDefending", void 0);
  9792. __decorate([
  9793. class_validator_1.IsBoolean(),
  9794. __metadata("design:type", Boolean)
  9795. ], Options.prototype, "shuffleStringArray", void 0);
  9796. __decorate([
  9797. class_validator_1.IsBoolean(),
  9798. __metadata("design:type", Boolean)
  9799. ], Options.prototype, "sourceMap", void 0);
  9800. __decorate([
  9801. class_validator_1.IsString(),
  9802. class_validator_1.ValidateIf((options) => Boolean(options.sourceMapBaseUrl)),
  9803. class_validator_1.IsUrl({
  9804. require_protocol: true,
  9805. require_tld: false,
  9806. require_valid_protocol: true
  9807. }),
  9808. __metadata("design:type", String)
  9809. ], Options.prototype, "sourceMapBaseUrl", void 0);
  9810. __decorate([
  9811. class_validator_1.IsString(),
  9812. __metadata("design:type", String)
  9813. ], Options.prototype, "sourceMapFileName", void 0);
  9814. __decorate([
  9815. class_validator_1.IsIn([SourceMapMode_1.SourceMapMode.Inline, SourceMapMode_1.SourceMapMode.Separate]),
  9816. __metadata("design:type", typeof (_b = typeof tsenum_1.TypeFromEnum !== "undefined" && tsenum_1.TypeFromEnum) === "function" ? _b : Object)
  9817. ], Options.prototype, "sourceMapMode", void 0);
  9818. __decorate([
  9819. class_validator_1.IsBoolean(),
  9820. __metadata("design:type", Boolean)
  9821. ], Options.prototype, "splitStrings", void 0);
  9822. __decorate([
  9823. class_validator_1.IsNumber(),
  9824. class_validator_1.ValidateIf((options) => Boolean(options.splitStrings)),
  9825. class_validator_1.Min(1),
  9826. __metadata("design:type", Number)
  9827. ], Options.prototype, "splitStringsChunkLength", void 0);
  9828. __decorate([
  9829. class_validator_1.IsBoolean(),
  9830. __metadata("design:type", Boolean)
  9831. ], Options.prototype, "stringArray", void 0);
  9832. __decorate([
  9833. class_validator_1.IsIn([true, false, StringArrayEncoding_1.StringArrayEncoding.Base64, StringArrayEncoding_1.StringArrayEncoding.Rc4]),
  9834. __metadata("design:type", typeof (_c = typeof TStringArrayEncoding_1.TStringArrayEncoding !== "undefined" && TStringArrayEncoding_1.TStringArrayEncoding) === "function" ? _c : Object)
  9835. ], Options.prototype, "stringArrayEncoding", void 0);
  9836. __decorate([
  9837. class_validator_1.IsNumber(),
  9838. class_validator_1.Min(0),
  9839. class_validator_1.Max(1),
  9840. __metadata("design:type", Number)
  9841. ], Options.prototype, "stringArrayThreshold", void 0);
  9842. __decorate([
  9843. class_validator_1.IsIn([ObfuscationTarget_1.ObfuscationTarget.Browser, ObfuscationTarget_1.ObfuscationTarget.BrowserNoEval, ObfuscationTarget_1.ObfuscationTarget.Node]),
  9844. __metadata("design:type", typeof (_d = typeof tsenum_1.TypeFromEnum !== "undefined" && tsenum_1.TypeFromEnum) === "function" ? _d : Object)
  9845. ], Options.prototype, "target", void 0);
  9846. __decorate([
  9847. class_validator_1.IsBoolean(),
  9848. __metadata("design:type", Boolean)
  9849. ], Options.prototype, "transformObjectKeys", void 0);
  9850. __decorate([
  9851. class_validator_1.IsBoolean(),
  9852. __metadata("design:type", Boolean)
  9853. ], Options.prototype, "unicodeEscapeSequence", void 0);
  9854. Options = Options_1 = __decorate([
  9855. inversify_1.injectable(),
  9856. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.TInputOptions)),
  9857. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptionsNormalizer)),
  9858. __metadata("design:paramtypes", [typeof (_e = typeof TInputOptions_1.TInputOptions !== "undefined" && TInputOptions_1.TInputOptions) === "function" ? _e : Object, typeof (_f = typeof IOptionsNormalizer_1.IOptionsNormalizer !== "undefined" && IOptionsNormalizer_1.IOptionsNormalizer) === "function" ? _f : Object])
  9859. ], Options);
  9860. exports.Options = Options;
  9861. /***/ }),
  9862. /***/ "./src/options/OptionsNormalizer.ts":
  9863. /*!******************************************!*\
  9864. !*** ./src/options/OptionsNormalizer.ts ***!
  9865. \******************************************/
  9866. /*! no static exports found */
  9867. /***/ (function(module, exports, __webpack_require__) {
  9868. "use strict";
  9869. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  9870. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  9871. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  9872. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  9873. return c > 3 && r && Object.defineProperty(target, key, r), r;
  9874. };
  9875. var OptionsNormalizer_1;
  9876. Object.defineProperty(exports, "__esModule", { value: true });
  9877. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  9878. const ControlFlowFlatteningThresholdRule_1 = __webpack_require__(/*! ./normalizer-rules/ControlFlowFlatteningThresholdRule */ "./src/options/normalizer-rules/ControlFlowFlatteningThresholdRule.ts");
  9879. const DeadCodeInjectionRule_1 = __webpack_require__(/*! ./normalizer-rules/DeadCodeInjectionRule */ "./src/options/normalizer-rules/DeadCodeInjectionRule.ts");
  9880. const DeadCodeInjectionThresholdRule_1 = __webpack_require__(/*! ./normalizer-rules/DeadCodeInjectionThresholdRule */ "./src/options/normalizer-rules/DeadCodeInjectionThresholdRule.ts");
  9881. const DomainLockRule_1 = __webpack_require__(/*! ./normalizer-rules/DomainLockRule */ "./src/options/normalizer-rules/DomainLockRule.ts");
  9882. const InputFileNameRule_1 = __webpack_require__(/*! ./normalizer-rules/InputFileNameRule */ "./src/options/normalizer-rules/InputFileNameRule.ts");
  9883. const SeedRule_1 = __webpack_require__(/*! ./normalizer-rules/SeedRule */ "./src/options/normalizer-rules/SeedRule.ts");
  9884. const SelfDefendingRule_1 = __webpack_require__(/*! ./normalizer-rules/SelfDefendingRule */ "./src/options/normalizer-rules/SelfDefendingRule.ts");
  9885. const SourceMapBaseUrlRule_1 = __webpack_require__(/*! ./normalizer-rules/SourceMapBaseUrlRule */ "./src/options/normalizer-rules/SourceMapBaseUrlRule.ts");
  9886. const SourceMapFileNameRule_1 = __webpack_require__(/*! ./normalizer-rules/SourceMapFileNameRule */ "./src/options/normalizer-rules/SourceMapFileNameRule.ts");
  9887. const SplitStringsChunkLengthRule_1 = __webpack_require__(/*! ./normalizer-rules/SplitStringsChunkLengthRule */ "./src/options/normalizer-rules/SplitStringsChunkLengthRule.ts");
  9888. const StringArrayRule_1 = __webpack_require__(/*! ./normalizer-rules/StringArrayRule */ "./src/options/normalizer-rules/StringArrayRule.ts");
  9889. const StringArrayEncodingRule_1 = __webpack_require__(/*! ./normalizer-rules/StringArrayEncodingRule */ "./src/options/normalizer-rules/StringArrayEncodingRule.ts");
  9890. const StringArrayThresholdRule_1 = __webpack_require__(/*! ./normalizer-rules/StringArrayThresholdRule */ "./src/options/normalizer-rules/StringArrayThresholdRule.ts");
  9891. let OptionsNormalizer = OptionsNormalizer_1 = class OptionsNormalizer {
  9892. normalize(options) {
  9893. let normalizedOptions = Object.assign({}, options);
  9894. for (const normalizerRule of OptionsNormalizer_1.normalizerRules) {
  9895. normalizedOptions = normalizerRule(normalizedOptions);
  9896. }
  9897. return normalizedOptions;
  9898. }
  9899. };
  9900. OptionsNormalizer.normalizerRules = [
  9901. ControlFlowFlatteningThresholdRule_1.ControlFlowFlatteningThresholdRule,
  9902. DeadCodeInjectionRule_1.DeadCodeInjectionRule,
  9903. DeadCodeInjectionThresholdRule_1.DeadCodeInjectionThresholdRule,
  9904. DomainLockRule_1.DomainLockRule,
  9905. InputFileNameRule_1.InputFileNameRule,
  9906. SeedRule_1.SeedRule,
  9907. SelfDefendingRule_1.SelfDefendingRule,
  9908. SourceMapBaseUrlRule_1.SourceMapBaseUrlRule,
  9909. SourceMapFileNameRule_1.SourceMapFileNameRule,
  9910. SplitStringsChunkLengthRule_1.SplitStringsChunkLengthRule,
  9911. StringArrayRule_1.StringArrayRule,
  9912. StringArrayEncodingRule_1.StringArrayEncodingRule,
  9913. StringArrayThresholdRule_1.StringArrayThresholdRule,
  9914. ];
  9915. OptionsNormalizer = OptionsNormalizer_1 = __decorate([
  9916. inversify_1.injectable()
  9917. ], OptionsNormalizer);
  9918. exports.OptionsNormalizer = OptionsNormalizer;
  9919. /***/ }),
  9920. /***/ "./src/options/ValidationErrorsFormatter.ts":
  9921. /*!**************************************************!*\
  9922. !*** ./src/options/ValidationErrorsFormatter.ts ***!
  9923. \**************************************************/
  9924. /*! no static exports found */
  9925. /***/ (function(module, exports, __webpack_require__) {
  9926. "use strict";
  9927. Object.defineProperty(exports, "__esModule", { value: true });
  9928. class ValidationErrorsFormatter {
  9929. static format(errors) {
  9930. return errors
  9931. .reduce((errorMessages, error) => [
  9932. ...errorMessages,
  9933. ValidationErrorsFormatter.formatWithNestedConstraints(error)
  9934. ], [])
  9935. .join('\n');
  9936. }
  9937. static formatWithNestedConstraints(error) {
  9938. const constraints = error.constraints;
  9939. const rootError = `\`${error.property}\` errors:\n`;
  9940. const nestedErrors = Object
  9941. .keys(constraints)
  9942. .map((constraint) => ` - ${constraints[constraint]}\n`)
  9943. .join();
  9944. return `${rootError}${nestedErrors}`;
  9945. }
  9946. }
  9947. exports.ValidationErrorsFormatter = ValidationErrorsFormatter;
  9948. /***/ }),
  9949. /***/ "./src/options/normalizer-rules/ControlFlowFlatteningThresholdRule.ts":
  9950. /*!****************************************************************************!*\
  9951. !*** ./src/options/normalizer-rules/ControlFlowFlatteningThresholdRule.ts ***!
  9952. \****************************************************************************/
  9953. /*! no static exports found */
  9954. /***/ (function(module, exports, __webpack_require__) {
  9955. "use strict";
  9956. Object.defineProperty(exports, "__esModule", { value: true });
  9957. exports.ControlFlowFlatteningThresholdRule = (options) => {
  9958. if (options.controlFlowFlatteningThreshold === 0) {
  9959. options = Object.assign(Object.assign({}, options), { controlFlowFlattening: false, controlFlowFlatteningThreshold: 0 });
  9960. }
  9961. return options;
  9962. };
  9963. /***/ }),
  9964. /***/ "./src/options/normalizer-rules/DeadCodeInjectionRule.ts":
  9965. /*!***************************************************************!*\
  9966. !*** ./src/options/normalizer-rules/DeadCodeInjectionRule.ts ***!
  9967. \***************************************************************/
  9968. /*! no static exports found */
  9969. /***/ (function(module, exports, __webpack_require__) {
  9970. "use strict";
  9971. Object.defineProperty(exports, "__esModule", { value: true });
  9972. const Default_1 = __webpack_require__(/*! ../presets/Default */ "./src/options/presets/Default.ts");
  9973. exports.DeadCodeInjectionRule = (options) => {
  9974. if (options.deadCodeInjection) {
  9975. options = Object.assign(Object.assign({}, options), { deadCodeInjection: true, stringArray: true });
  9976. if (!options.stringArrayThreshold) {
  9977. options = Object.assign(Object.assign({}, options), { stringArray: true, stringArrayThreshold: Default_1.DEFAULT_PRESET.stringArrayThreshold });
  9978. }
  9979. }
  9980. return options;
  9981. };
  9982. /***/ }),
  9983. /***/ "./src/options/normalizer-rules/DeadCodeInjectionThresholdRule.ts":
  9984. /*!************************************************************************!*\
  9985. !*** ./src/options/normalizer-rules/DeadCodeInjectionThresholdRule.ts ***!
  9986. \************************************************************************/
  9987. /*! no static exports found */
  9988. /***/ (function(module, exports, __webpack_require__) {
  9989. "use strict";
  9990. Object.defineProperty(exports, "__esModule", { value: true });
  9991. exports.DeadCodeInjectionThresholdRule = (options) => {
  9992. if (options.deadCodeInjectionThreshold === 0) {
  9993. options = Object.assign(Object.assign({}, options), { deadCodeInjection: false, deadCodeInjectionThreshold: 0 });
  9994. }
  9995. return options;
  9996. };
  9997. /***/ }),
  9998. /***/ "./src/options/normalizer-rules/DomainLockRule.ts":
  9999. /*!********************************************************!*\
  10000. !*** ./src/options/normalizer-rules/DomainLockRule.ts ***!
  10001. \********************************************************/
  10002. /*! no static exports found */
  10003. /***/ (function(module, exports, __webpack_require__) {
  10004. "use strict";
  10005. Object.defineProperty(exports, "__esModule", { value: true });
  10006. const Utils_1 = __webpack_require__(/*! ../../utils/Utils */ "./src/utils/Utils.ts");
  10007. exports.DomainLockRule = (options) => {
  10008. if (options.domainLock.length) {
  10009. const normalizedDomains = [];
  10010. for (const domain of options.domainLock) {
  10011. normalizedDomains.push(Utils_1.Utils.extractDomainFrom(domain));
  10012. }
  10013. options = Object.assign(Object.assign({}, options), { domainLock: normalizedDomains });
  10014. }
  10015. return options;
  10016. };
  10017. /***/ }),
  10018. /***/ "./src/options/normalizer-rules/InputFileNameRule.ts":
  10019. /*!***********************************************************!*\
  10020. !*** ./src/options/normalizer-rules/InputFileNameRule.ts ***!
  10021. \***********************************************************/
  10022. /*! no static exports found */
  10023. /***/ (function(module, exports, __webpack_require__) {
  10024. "use strict";
  10025. Object.defineProperty(exports, "__esModule", { value: true });
  10026. const StringSeparator_1 = __webpack_require__(/*! ../../enums/StringSeparator */ "./src/enums/StringSeparator.ts");
  10027. exports.InputFileNameRule = (options) => {
  10028. let { inputFileName } = options;
  10029. if (inputFileName) {
  10030. inputFileName = inputFileName
  10031. .replace(/^\/+/, '')
  10032. .split(StringSeparator_1.StringSeparator.Dot)
  10033. .slice(0, -1)
  10034. .join(StringSeparator_1.StringSeparator.Dot) || inputFileName;
  10035. options = Object.assign(Object.assign({}, options), { inputFileName: `${inputFileName}.js` });
  10036. }
  10037. return options;
  10038. };
  10039. /***/ }),
  10040. /***/ "./src/options/normalizer-rules/SeedRule.ts":
  10041. /*!**************************************************!*\
  10042. !*** ./src/options/normalizer-rules/SeedRule.ts ***!
  10043. \**************************************************/
  10044. /*! no static exports found */
  10045. /***/ (function(module, exports, __webpack_require__) {
  10046. "use strict";
  10047. Object.defineProperty(exports, "__esModule", { value: true });
  10048. exports.SeedRule = (options) => {
  10049. if (options.seed) {
  10050. return Object.assign(Object.assign({}, options), { seed: options.seed });
  10051. }
  10052. const getRandomInteger = (min, max) => {
  10053. return Math.floor(Math.random() * (max - min + 1) + min);
  10054. };
  10055. return Object.assign(Object.assign({}, options), { seed: getRandomInteger(0, 999999999) });
  10056. };
  10057. /***/ }),
  10058. /***/ "./src/options/normalizer-rules/SelfDefendingRule.ts":
  10059. /*!***********************************************************!*\
  10060. !*** ./src/options/normalizer-rules/SelfDefendingRule.ts ***!
  10061. \***********************************************************/
  10062. /*! no static exports found */
  10063. /***/ (function(module, exports, __webpack_require__) {
  10064. "use strict";
  10065. Object.defineProperty(exports, "__esModule", { value: true });
  10066. exports.SelfDefendingRule = (options) => {
  10067. if (options.selfDefending) {
  10068. options = Object.assign(Object.assign({}, options), { compact: true, selfDefending: true });
  10069. }
  10070. return options;
  10071. };
  10072. /***/ }),
  10073. /***/ "./src/options/normalizer-rules/SourceMapBaseUrlRule.ts":
  10074. /*!**************************************************************!*\
  10075. !*** ./src/options/normalizer-rules/SourceMapBaseUrlRule.ts ***!
  10076. \**************************************************************/
  10077. /*! no static exports found */
  10078. /***/ (function(module, exports, __webpack_require__) {
  10079. "use strict";
  10080. Object.defineProperty(exports, "__esModule", { value: true });
  10081. exports.SourceMapBaseUrlRule = (options) => {
  10082. const { sourceMapBaseUrl } = options;
  10083. if (!options.sourceMapFileName) {
  10084. options = Object.assign(Object.assign({}, options), { sourceMapBaseUrl: '' });
  10085. return options;
  10086. }
  10087. if (sourceMapBaseUrl && !sourceMapBaseUrl.endsWith('/')) {
  10088. options = Object.assign(Object.assign({}, options), { sourceMapBaseUrl: `${sourceMapBaseUrl}/` });
  10089. }
  10090. return options;
  10091. };
  10092. /***/ }),
  10093. /***/ "./src/options/normalizer-rules/SourceMapFileNameRule.ts":
  10094. /*!***************************************************************!*\
  10095. !*** ./src/options/normalizer-rules/SourceMapFileNameRule.ts ***!
  10096. \***************************************************************/
  10097. /*! no static exports found */
  10098. /***/ (function(module, exports, __webpack_require__) {
  10099. "use strict";
  10100. Object.defineProperty(exports, "__esModule", { value: true });
  10101. const StringSeparator_1 = __webpack_require__(/*! ../../enums/StringSeparator */ "./src/enums/StringSeparator.ts");
  10102. exports.SourceMapFileNameRule = (options) => {
  10103. let { sourceMapFileName } = options;
  10104. if (sourceMapFileName) {
  10105. sourceMapFileName = sourceMapFileName
  10106. .replace(/^\/+/, '')
  10107. .replace(/(?:\.js)?(?:\.map)?$/, '');
  10108. let sourceMapFileNameParts = sourceMapFileName.split(StringSeparator_1.StringSeparator.Dot);
  10109. const sourceMapFileNamePartsCount = sourceMapFileNameParts.length;
  10110. const lastPart = sourceMapFileNameParts[sourceMapFileNamePartsCount - 1];
  10111. if (sourceMapFileNamePartsCount > 1 && lastPart.length <= 3) {
  10112. sourceMapFileNameParts = sourceMapFileNameParts.slice(0, -1);
  10113. }
  10114. sourceMapFileName = sourceMapFileNameParts.join(StringSeparator_1.StringSeparator.Dot);
  10115. options = Object.assign(Object.assign({}, options), { sourceMapFileName: `${sourceMapFileName}.js.map` });
  10116. }
  10117. return options;
  10118. };
  10119. /***/ }),
  10120. /***/ "./src/options/normalizer-rules/SplitStringsChunkLengthRule.ts":
  10121. /*!*********************************************************************!*\
  10122. !*** ./src/options/normalizer-rules/SplitStringsChunkLengthRule.ts ***!
  10123. \*********************************************************************/
  10124. /*! no static exports found */
  10125. /***/ (function(module, exports, __webpack_require__) {
  10126. "use strict";
  10127. Object.defineProperty(exports, "__esModule", { value: true });
  10128. exports.SplitStringsChunkLengthRule = (options) => {
  10129. if (options.splitStringsChunkLength === 0) {
  10130. options = Object.assign(Object.assign({}, options), { splitStrings: false, splitStringsChunkLength: 0 });
  10131. }
  10132. else {
  10133. options = Object.assign(Object.assign({}, options), { splitStringsChunkLength: Math.floor(options.splitStringsChunkLength) });
  10134. }
  10135. return options;
  10136. };
  10137. /***/ }),
  10138. /***/ "./src/options/normalizer-rules/StringArrayEncodingRule.ts":
  10139. /*!*****************************************************************!*\
  10140. !*** ./src/options/normalizer-rules/StringArrayEncodingRule.ts ***!
  10141. \*****************************************************************/
  10142. /*! no static exports found */
  10143. /***/ (function(module, exports, __webpack_require__) {
  10144. "use strict";
  10145. Object.defineProperty(exports, "__esModule", { value: true });
  10146. const StringArrayEncoding_1 = __webpack_require__(/*! ../../enums/StringArrayEncoding */ "./src/enums/StringArrayEncoding.ts");
  10147. exports.StringArrayEncodingRule = (options) => {
  10148. if (options.stringArrayEncoding === true) {
  10149. options = Object.assign(Object.assign({}, options), { stringArrayEncoding: StringArrayEncoding_1.StringArrayEncoding.Base64 });
  10150. }
  10151. return options;
  10152. };
  10153. /***/ }),
  10154. /***/ "./src/options/normalizer-rules/StringArrayRule.ts":
  10155. /*!*********************************************************!*\
  10156. !*** ./src/options/normalizer-rules/StringArrayRule.ts ***!
  10157. \*********************************************************/
  10158. /*! no static exports found */
  10159. /***/ (function(module, exports, __webpack_require__) {
  10160. "use strict";
  10161. Object.defineProperty(exports, "__esModule", { value: true });
  10162. exports.StringArrayRule = (options) => {
  10163. if (!options.stringArray) {
  10164. options = Object.assign(Object.assign({}, options), { rotateStringArray: false, shuffleStringArray: false, stringArray: false, stringArrayEncoding: false, stringArrayThreshold: 0 });
  10165. }
  10166. return options;
  10167. };
  10168. /***/ }),
  10169. /***/ "./src/options/normalizer-rules/StringArrayThresholdRule.ts":
  10170. /*!******************************************************************!*\
  10171. !*** ./src/options/normalizer-rules/StringArrayThresholdRule.ts ***!
  10172. \******************************************************************/
  10173. /*! no static exports found */
  10174. /***/ (function(module, exports, __webpack_require__) {
  10175. "use strict";
  10176. Object.defineProperty(exports, "__esModule", { value: true });
  10177. exports.StringArrayThresholdRule = (options) => {
  10178. if (options.stringArrayThreshold === 0) {
  10179. options = Object.assign(Object.assign({}, options), { rotateStringArray: false, stringArray: false, stringArrayEncoding: false, stringArrayThreshold: 0 });
  10180. }
  10181. return options;
  10182. };
  10183. /***/ }),
  10184. /***/ "./src/options/presets/Default.ts":
  10185. /*!****************************************!*\
  10186. !*** ./src/options/presets/Default.ts ***!
  10187. \****************************************/
  10188. /*! no static exports found */
  10189. /***/ (function(module, exports, __webpack_require__) {
  10190. "use strict";
  10191. Object.defineProperty(exports, "__esModule", { value: true });
  10192. const IdentifierNamesGenerator_1 = __webpack_require__(/*! ../../enums/generators/identifier-names-generators/IdentifierNamesGenerator */ "./src/enums/generators/identifier-names-generators/IdentifierNamesGenerator.ts");
  10193. const ObfuscationTarget_1 = __webpack_require__(/*! ../../enums/ObfuscationTarget */ "./src/enums/ObfuscationTarget.ts");
  10194. const SourceMapMode_1 = __webpack_require__(/*! ../../enums/source-map/SourceMapMode */ "./src/enums/source-map/SourceMapMode.ts");
  10195. exports.DEFAULT_PRESET = Object.freeze({
  10196. compact: true,
  10197. config: '',
  10198. controlFlowFlattening: false,
  10199. controlFlowFlatteningThreshold: 0.75,
  10200. deadCodeInjection: false,
  10201. deadCodeInjectionThreshold: 0.4,
  10202. debugProtection: false,
  10203. debugProtectionInterval: false,
  10204. disableConsoleOutput: false,
  10205. domainLock: [],
  10206. exclude: [],
  10207. identifierNamesGenerator: IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,
  10208. identifiersPrefix: '',
  10209. identifiersDictionary: [],
  10210. inputFileName: '',
  10211. inputFilePath: '',
  10212. log: false,
  10213. renameGlobals: false,
  10214. reservedNames: [],
  10215. reservedStrings: [],
  10216. rotateStringArray: true,
  10217. seed: 0,
  10218. selfDefending: false,
  10219. shuffleStringArray: true,
  10220. sourceMap: false,
  10221. sourceMapBaseUrl: '',
  10222. sourceMapFileName: '',
  10223. sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
  10224. splitStrings: false,
  10225. splitStringsChunkLength: 10,
  10226. stringArray: true,
  10227. stringArrayEncoding: false,
  10228. stringArrayThreshold: 0.75,
  10229. target: ObfuscationTarget_1.ObfuscationTarget.Browser,
  10230. transformObjectKeys: false,
  10231. unicodeEscapeSequence: false
  10232. });
  10233. /***/ }),
  10234. /***/ "./src/options/presets/NoCustomNodes.ts":
  10235. /*!**********************************************!*\
  10236. !*** ./src/options/presets/NoCustomNodes.ts ***!
  10237. \**********************************************/
  10238. /*! no static exports found */
  10239. /***/ (function(module, exports, __webpack_require__) {
  10240. "use strict";
  10241. Object.defineProperty(exports, "__esModule", { value: true });
  10242. const IdentifierNamesGenerator_1 = __webpack_require__(/*! ../../enums/generators/identifier-names-generators/IdentifierNamesGenerator */ "./src/enums/generators/identifier-names-generators/IdentifierNamesGenerator.ts");
  10243. const ObfuscationTarget_1 = __webpack_require__(/*! ../../enums/ObfuscationTarget */ "./src/enums/ObfuscationTarget.ts");
  10244. const SourceMapMode_1 = __webpack_require__(/*! ../../enums/source-map/SourceMapMode */ "./src/enums/source-map/SourceMapMode.ts");
  10245. exports.NO_ADDITIONAL_NODES_PRESET = Object.freeze({
  10246. compact: true,
  10247. controlFlowFlattening: false,
  10248. controlFlowFlatteningThreshold: 0,
  10249. deadCodeInjection: false,
  10250. deadCodeInjectionThreshold: 0,
  10251. debugProtection: false,
  10252. debugProtectionInterval: false,
  10253. disableConsoleOutput: false,
  10254. domainLock: [],
  10255. exclude: [],
  10256. identifierNamesGenerator: IdentifierNamesGenerator_1.IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,
  10257. identifiersPrefix: '',
  10258. identifiersDictionary: [],
  10259. inputFileName: '',
  10260. inputFilePath: '',
  10261. log: false,
  10262. renameGlobals: false,
  10263. reservedNames: [],
  10264. reservedStrings: [],
  10265. rotateStringArray: false,
  10266. seed: 0,
  10267. selfDefending: false,
  10268. shuffleStringArray: false,
  10269. sourceMap: false,
  10270. sourceMapBaseUrl: '',
  10271. sourceMapFileName: '',
  10272. sourceMapMode: SourceMapMode_1.SourceMapMode.Separate,
  10273. splitStrings: false,
  10274. splitStringsChunkLength: 0,
  10275. stringArray: false,
  10276. stringArrayEncoding: false,
  10277. stringArrayThreshold: 0,
  10278. target: ObfuscationTarget_1.ObfuscationTarget.Browser,
  10279. transformObjectKeys: false,
  10280. unicodeEscapeSequence: false
  10281. });
  10282. /***/ }),
  10283. /***/ "./src/options/validators/IsAllowedForObfuscationTargets.ts":
  10284. /*!******************************************************************!*\
  10285. !*** ./src/options/validators/IsAllowedForObfuscationTargets.ts ***!
  10286. \******************************************************************/
  10287. /*! no static exports found */
  10288. /***/ (function(module, exports, __webpack_require__) {
  10289. "use strict";
  10290. var __importDefault = (this && this.__importDefault) || function (mod) {
  10291. return (mod && mod.__esModule) ? mod : { "default": mod };
  10292. };
  10293. Object.defineProperty(exports, "__esModule", { value: true });
  10294. const class_validator_1 = __webpack_require__(/*! class-validator */ "class-validator");
  10295. const fast_deep_equal_1 = __importDefault(__webpack_require__(/*! fast-deep-equal */ "fast-deep-equal"));
  10296. const StringSeparator_1 = __webpack_require__(/*! ../../enums/StringSeparator */ "./src/enums/StringSeparator.ts");
  10297. const Default_1 = __webpack_require__(/*! ../presets/Default */ "./src/options/presets/Default.ts");
  10298. function IsAllowedForObfuscationTargets(obfuscationTargets, validationOptions) {
  10299. return (optionsObject, propertyName) => {
  10300. class_validator_1.registerDecorator({
  10301. propertyName,
  10302. constraints: [obfuscationTargets],
  10303. name: 'IsAllowedForObfuscationTargets',
  10304. options: validationOptions,
  10305. target: optionsObject.constructor,
  10306. validator: {
  10307. validate(value, validationArguments) {
  10308. const options = validationArguments.object;
  10309. const defaultValue = Default_1.DEFAULT_PRESET[propertyName];
  10310. const isDefaultValue = fast_deep_equal_1.default(value, defaultValue);
  10311. return isDefaultValue || obfuscationTargets.includes(options.target);
  10312. },
  10313. defaultMessage(validationArguments) {
  10314. const requiredObfuscationTargetsString = obfuscationTargets.join(`${StringSeparator_1.StringSeparator.Comma} `);
  10315. return `This option allowed only for obfuscation targets: ${requiredObfuscationTargetsString}`;
  10316. }
  10317. }
  10318. });
  10319. };
  10320. }
  10321. exports.IsAllowedForObfuscationTargets = IsAllowedForObfuscationTargets;
  10322. /***/ }),
  10323. /***/ "./src/source-code/ObfuscatedCode.ts":
  10324. /*!*******************************************!*\
  10325. !*** ./src/source-code/ObfuscatedCode.ts ***!
  10326. \*******************************************/
  10327. /*! no static exports found */
  10328. /***/ (function(module, exports, __webpack_require__) {
  10329. "use strict";
  10330. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  10331. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  10332. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  10333. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  10334. return c > 3 && r && Object.defineProperty(target, key, r), r;
  10335. };
  10336. var __metadata = (this && this.__metadata) || function (k, v) {
  10337. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10338. };
  10339. var __param = (this && this.__param) || function (paramIndex, decorator) {
  10340. return function (target, key) { decorator(target, key, paramIndex); }
  10341. };
  10342. var _a, _b;
  10343. Object.defineProperty(exports, "__esModule", { value: true });
  10344. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  10345. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  10346. const ICryptUtils_1 = __webpack_require__(/*! ../interfaces/utils/ICryptUtils */ "./src/interfaces/utils/ICryptUtils.ts");
  10347. const Initializable_1 = __webpack_require__(/*! ../decorators/Initializable */ "./src/decorators/Initializable.ts");
  10348. const SourceMapMode_1 = __webpack_require__(/*! ../enums/source-map/SourceMapMode */ "./src/enums/source-map/SourceMapMode.ts");
  10349. const IOptions_1 = __webpack_require__(/*! ../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  10350. let ObfuscatedCode = class ObfuscatedCode {
  10351. constructor(cryptUtils, options) {
  10352. this.cryptUtils = cryptUtils;
  10353. this.options = options;
  10354. }
  10355. initialize(obfuscatedCode, sourceMap) {
  10356. this.obfuscatedCode = obfuscatedCode;
  10357. this.sourceMap = sourceMap;
  10358. }
  10359. getObfuscatedCode() {
  10360. return this.correctObfuscatedCode();
  10361. }
  10362. getSourceMap() {
  10363. return this.sourceMap;
  10364. }
  10365. toString() {
  10366. return this.obfuscatedCode;
  10367. }
  10368. correctObfuscatedCode() {
  10369. if (!this.sourceMap) {
  10370. return this.obfuscatedCode;
  10371. }
  10372. const sourceMapUrl = this.options.sourceMapBaseUrl + this.options.sourceMapFileName;
  10373. let sourceMappingUrl = '//# sourceMappingURL=';
  10374. switch (this.options.sourceMapMode) {
  10375. case SourceMapMode_1.SourceMapMode.Inline:
  10376. sourceMappingUrl += `data:application/json;base64,${this.cryptUtils.btoa(this.sourceMap)}`;
  10377. break;
  10378. case SourceMapMode_1.SourceMapMode.Separate:
  10379. default:
  10380. if (!sourceMapUrl) {
  10381. return this.obfuscatedCode;
  10382. }
  10383. sourceMappingUrl += sourceMapUrl;
  10384. }
  10385. return `${this.obfuscatedCode}\n${sourceMappingUrl}`;
  10386. }
  10387. };
  10388. __decorate([
  10389. Initializable_1.initializable(),
  10390. __metadata("design:type", String)
  10391. ], ObfuscatedCode.prototype, "obfuscatedCode", void 0);
  10392. __decorate([
  10393. Initializable_1.initializable(),
  10394. __metadata("design:type", String)
  10395. ], ObfuscatedCode.prototype, "sourceMap", void 0);
  10396. ObfuscatedCode = __decorate([
  10397. inversify_1.injectable(),
  10398. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils)),
  10399. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  10400. __metadata("design:paramtypes", [typeof (_a = typeof ICryptUtils_1.ICryptUtils !== "undefined" && ICryptUtils_1.ICryptUtils) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  10401. ], ObfuscatedCode);
  10402. exports.ObfuscatedCode = ObfuscatedCode;
  10403. /***/ }),
  10404. /***/ "./src/source-code/SourceCode.ts":
  10405. /*!***************************************!*\
  10406. !*** ./src/source-code/SourceCode.ts ***!
  10407. \***************************************/
  10408. /*! no static exports found */
  10409. /***/ (function(module, exports, __webpack_require__) {
  10410. "use strict";
  10411. Object.defineProperty(exports, "__esModule", { value: true });
  10412. class SourceCode {
  10413. constructor(sourceCode, sourceMap) {
  10414. this.sourceCode = sourceCode;
  10415. this.sourceMap = sourceMap;
  10416. }
  10417. getSourceCode() {
  10418. return this.sourceCode;
  10419. }
  10420. getSourceMap() {
  10421. return this.sourceMap;
  10422. }
  10423. toString() {
  10424. return this.sourceCode;
  10425. }
  10426. }
  10427. exports.SourceCode = SourceCode;
  10428. /***/ }),
  10429. /***/ "./src/storages/MapStorage.ts":
  10430. /*!************************************!*\
  10431. !*** ./src/storages/MapStorage.ts ***!
  10432. \************************************/
  10433. /*! no static exports found */
  10434. /***/ (function(module, exports, __webpack_require__) {
  10435. "use strict";
  10436. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  10437. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  10438. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  10439. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  10440. return c > 3 && r && Object.defineProperty(target, key, r), r;
  10441. };
  10442. var __metadata = (this && this.__metadata) || function (k, v) {
  10443. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10444. };
  10445. var __param = (this && this.__param) || function (paramIndex, decorator) {
  10446. return function (target, key) { decorator(target, key, paramIndex); }
  10447. };
  10448. var _a, _b, _c;
  10449. Object.defineProperty(exports, "__esModule", { value: true });
  10450. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  10451. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  10452. const IOptions_1 = __webpack_require__(/*! ../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  10453. const IRandomGenerator_1 = __webpack_require__(/*! ../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  10454. const Initializable_1 = __webpack_require__(/*! ../decorators/Initializable */ "./src/decorators/Initializable.ts");
  10455. let MapStorage = class MapStorage {
  10456. constructor(randomGenerator, options) {
  10457. this.randomGenerator = randomGenerator;
  10458. this.options = options;
  10459. }
  10460. initialize() {
  10461. this.storage = new Map();
  10462. this.storageId = this.randomGenerator.getRandomString(6);
  10463. }
  10464. get(key) {
  10465. return this.storage.get(key);
  10466. }
  10467. getOrThrow(key) {
  10468. const value = this.get(key);
  10469. if (!value) {
  10470. throw new Error(`No value found in map storage with key \`${key}\``);
  10471. }
  10472. return value;
  10473. }
  10474. getKeyOf(value) {
  10475. for (const [key, storageValue] of this.storage) {
  10476. if (value === storageValue) {
  10477. return key;
  10478. }
  10479. }
  10480. return null;
  10481. }
  10482. getLength() {
  10483. return this.storage.size;
  10484. }
  10485. getStorage() {
  10486. return this.storage;
  10487. }
  10488. getStorageId() {
  10489. return this.storageId;
  10490. }
  10491. has(key) {
  10492. return this.storage.has(key);
  10493. }
  10494. mergeWith(storage, mergeId = false) {
  10495. this.storage = new Map([...this.storage, ...storage.getStorage()]);
  10496. if (mergeId) {
  10497. this.storageId = storage.getStorageId();
  10498. }
  10499. }
  10500. set(key, value) {
  10501. this.storage.set(key, value);
  10502. }
  10503. };
  10504. __decorate([
  10505. Initializable_1.initializable(),
  10506. __metadata("design:type", String)
  10507. ], MapStorage.prototype, "storageId", void 0);
  10508. __decorate([
  10509. Initializable_1.initializable(),
  10510. __metadata("design:type", typeof (_a = typeof Map !== "undefined" && Map) === "function" ? _a : Object)
  10511. ], MapStorage.prototype, "storage", void 0);
  10512. __decorate([
  10513. inversify_1.postConstruct(),
  10514. __metadata("design:type", Function),
  10515. __metadata("design:paramtypes", []),
  10516. __metadata("design:returntype", void 0)
  10517. ], MapStorage.prototype, "initialize", null);
  10518. MapStorage = __decorate([
  10519. inversify_1.injectable(),
  10520. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  10521. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  10522. __metadata("design:paramtypes", [typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  10523. ], MapStorage);
  10524. exports.MapStorage = MapStorage;
  10525. /***/ }),
  10526. /***/ "./src/storages/control-flow/ControlFlowStorage.ts":
  10527. /*!*********************************************************!*\
  10528. !*** ./src/storages/control-flow/ControlFlowStorage.ts ***!
  10529. \*********************************************************/
  10530. /*! no static exports found */
  10531. /***/ (function(module, exports, __webpack_require__) {
  10532. "use strict";
  10533. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  10534. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  10535. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  10536. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  10537. return c > 3 && r && Object.defineProperty(target, key, r), r;
  10538. };
  10539. var __metadata = (this && this.__metadata) || function (k, v) {
  10540. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10541. };
  10542. var __param = (this && this.__param) || function (paramIndex, decorator) {
  10543. return function (target, key) { decorator(target, key, paramIndex); }
  10544. };
  10545. var _a, _b;
  10546. Object.defineProperty(exports, "__esModule", { value: true });
  10547. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  10548. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  10549. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  10550. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  10551. const MapStorage_1 = __webpack_require__(/*! ../MapStorage */ "./src/storages/MapStorage.ts");
  10552. let ControlFlowStorage = class ControlFlowStorage extends MapStorage_1.MapStorage {
  10553. constructor(randomGenerator, options) {
  10554. super(randomGenerator, options);
  10555. }
  10556. };
  10557. ControlFlowStorage = __decorate([
  10558. inversify_1.injectable(),
  10559. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  10560. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  10561. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object, typeof (_b = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _b : Object])
  10562. ], ControlFlowStorage);
  10563. exports.ControlFlowStorage = ControlFlowStorage;
  10564. /***/ }),
  10565. /***/ "./src/storages/custom-node-group/CustomNodeGroupStorage.ts":
  10566. /*!******************************************************************!*\
  10567. !*** ./src/storages/custom-node-group/CustomNodeGroupStorage.ts ***!
  10568. \******************************************************************/
  10569. /*! no static exports found */
  10570. /***/ (function(module, exports, __webpack_require__) {
  10571. "use strict";
  10572. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  10573. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  10574. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  10575. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  10576. return c > 3 && r && Object.defineProperty(target, key, r), r;
  10577. };
  10578. var __metadata = (this && this.__metadata) || function (k, v) {
  10579. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10580. };
  10581. var __param = (this && this.__param) || function (paramIndex, decorator) {
  10582. return function (target, key) { decorator(target, key, paramIndex); }
  10583. };
  10584. var CustomNodeGroupStorage_1, _a, _b, _c;
  10585. Object.defineProperty(exports, "__esModule", { value: true });
  10586. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  10587. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  10588. const TCustomNodeGroupFactory_1 = __webpack_require__(/*! ../../types/container/custom-nodes/TCustomNodeGroupFactory */ "./src/types/container/custom-nodes/TCustomNodeGroupFactory.ts");
  10589. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  10590. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  10591. const CustomNodeGroup_1 = __webpack_require__(/*! ../../enums/custom-nodes/CustomNodeGroup */ "./src/enums/custom-nodes/CustomNodeGroup.ts");
  10592. const MapStorage_1 = __webpack_require__(/*! ../MapStorage */ "./src/storages/MapStorage.ts");
  10593. let CustomNodeGroupStorage = CustomNodeGroupStorage_1 = class CustomNodeGroupStorage extends MapStorage_1.MapStorage {
  10594. constructor(customNodeGroupFactory, randomGenerator, options) {
  10595. super(randomGenerator, options);
  10596. this.customNodeGroupFactory = customNodeGroupFactory;
  10597. }
  10598. initialize() {
  10599. super.initialize();
  10600. CustomNodeGroupStorage_1.customNodeGroupsList.forEach((customNodeGroupName) => {
  10601. const customNodeGroup = this.customNodeGroupFactory(customNodeGroupName);
  10602. this.storage.set(customNodeGroupName, customNodeGroup);
  10603. });
  10604. }
  10605. };
  10606. CustomNodeGroupStorage.customNodeGroupsList = [
  10607. CustomNodeGroup_1.CustomNodeGroup.ConsoleOutputCustomNodeGroup,
  10608. CustomNodeGroup_1.CustomNodeGroup.DebugProtectionCustomNodeGroup,
  10609. CustomNodeGroup_1.CustomNodeGroup.DomainLockCustomNodeGroup,
  10610. CustomNodeGroup_1.CustomNodeGroup.SelfDefendingCustomNodeGroup,
  10611. CustomNodeGroup_1.CustomNodeGroup.StringArrayCustomNodeGroup
  10612. ];
  10613. __decorate([
  10614. inversify_1.postConstruct(),
  10615. __metadata("design:type", Function),
  10616. __metadata("design:paramtypes", []),
  10617. __metadata("design:returntype", void 0)
  10618. ], CustomNodeGroupStorage.prototype, "initialize", null);
  10619. CustomNodeGroupStorage = CustomNodeGroupStorage_1 = __decorate([
  10620. inversify_1.injectable(),
  10621. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__ICustomNodeGroup)),
  10622. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  10623. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  10624. __metadata("design:paramtypes", [typeof (_a = typeof TCustomNodeGroupFactory_1.TCustomNodeGroupFactory !== "undefined" && TCustomNodeGroupFactory_1.TCustomNodeGroupFactory) === "function" ? _a : Object, typeof (_b = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  10625. ], CustomNodeGroupStorage);
  10626. exports.CustomNodeGroupStorage = CustomNodeGroupStorage;
  10627. /***/ }),
  10628. /***/ "./src/storages/string-array/StringArrayStorage.ts":
  10629. /*!*********************************************************!*\
  10630. !*** ./src/storages/string-array/StringArrayStorage.ts ***!
  10631. \*********************************************************/
  10632. /*! no static exports found */
  10633. /***/ (function(module, exports, __webpack_require__) {
  10634. "use strict";
  10635. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  10636. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  10637. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  10638. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  10639. return c > 3 && r && Object.defineProperty(target, key, r), r;
  10640. };
  10641. var __metadata = (this && this.__metadata) || function (k, v) {
  10642. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10643. };
  10644. var __param = (this && this.__param) || function (paramIndex, decorator) {
  10645. return function (target, key) { decorator(target, key, paramIndex); }
  10646. };
  10647. var StringArrayStorage_1, _a, _b, _c, _d, _e, _f;
  10648. Object.defineProperty(exports, "__esModule", { value: true });
  10649. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  10650. const ServiceIdentifiers_1 = __webpack_require__(/*! ../../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  10651. const TIdentifierNamesGeneratorFactory_1 = __webpack_require__(/*! ../../types/container/generators/TIdentifierNamesGeneratorFactory */ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts");
  10652. const IArrayUtils_1 = __webpack_require__(/*! ../../interfaces/utils/IArrayUtils */ "./src/interfaces/utils/IArrayUtils.ts");
  10653. const ICryptUtils_1 = __webpack_require__(/*! ../../interfaces/utils/ICryptUtils */ "./src/interfaces/utils/ICryptUtils.ts");
  10654. const IEscapeSequenceEncoder_1 = __webpack_require__(/*! ../../interfaces/utils/IEscapeSequenceEncoder */ "./src/interfaces/utils/IEscapeSequenceEncoder.ts");
  10655. const IOptions_1 = __webpack_require__(/*! ../../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  10656. const IRandomGenerator_1 = __webpack_require__(/*! ../../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  10657. const Initializable_1 = __webpack_require__(/*! ../../decorators/Initializable */ "./src/decorators/Initializable.ts");
  10658. const StringArrayEncoding_1 = __webpack_require__(/*! ../../enums/StringArrayEncoding */ "./src/enums/StringArrayEncoding.ts");
  10659. const MapStorage_1 = __webpack_require__(/*! ../MapStorage */ "./src/storages/MapStorage.ts");
  10660. let StringArrayStorage = StringArrayStorage_1 = class StringArrayStorage extends MapStorage_1.MapStorage {
  10661. constructor(identifierNamesGeneratorFactory, arrayUtils, randomGenerator, options, cryptUtils, escapeSequenceEncoder) {
  10662. super(randomGenerator, options);
  10663. this.rc4EncodedValuesSourcesCache = new Map();
  10664. this.rotationAmount = 0;
  10665. this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
  10666. this.arrayUtils = arrayUtils;
  10667. this.cryptUtils = cryptUtils;
  10668. this.escapeSequenceEncoder = escapeSequenceEncoder;
  10669. this.rc4Keys = this.randomGenerator.getRandomGenerator()
  10670. .n(() => this.randomGenerator.getRandomGenerator().string({
  10671. length: StringArrayStorage_1.rc4KeyLength
  10672. }), StringArrayStorage_1.rc4KeysCount);
  10673. }
  10674. initialize() {
  10675. super.initialize();
  10676. const baseStringArrayName = this.identifierNamesGenerator
  10677. .generate(StringArrayStorage_1.stringArrayNameLength);
  10678. const baseStringArrayCallsWrapperName = this.identifierNamesGenerator
  10679. .generate(StringArrayStorage_1.stringArrayNameLength);
  10680. this.stringArrayStorageName = `${this.options.identifiersPrefix}${baseStringArrayName}`;
  10681. this.stringArrayStorageCallsWrapperName = `${this.options.identifiersPrefix}${baseStringArrayCallsWrapperName}`;
  10682. this.rotationAmount = this.options.rotateStringArray
  10683. ? this.randomGenerator.getRandomInteger(StringArrayStorage_1.minimumRotationAmount, StringArrayStorage_1.maximumRotationAmount)
  10684. : 0;
  10685. }
  10686. get(value) {
  10687. return this.getOrSetIfDoesNotExist(value);
  10688. }
  10689. getRotationAmount() {
  10690. return this.rotationAmount;
  10691. }
  10692. getStorageId() {
  10693. return this.stringArrayStorageName;
  10694. }
  10695. getStorageName() {
  10696. return this.getStorageId();
  10697. }
  10698. getStorageCallsWrapperName() {
  10699. return this.stringArrayStorageCallsWrapperName;
  10700. }
  10701. rotateStorage() {
  10702. if (!this.getLength()) {
  10703. return;
  10704. }
  10705. this.storage = new Map(this.arrayUtils.rotate(Array.from(this.storage.entries()), this.rotationAmount));
  10706. }
  10707. shuffleStorage() {
  10708. this.storage = new Map(this.arrayUtils
  10709. .shuffle(Array.from(this.storage.entries()))
  10710. .map(([value, stringArrayStorageItemData], index) => {
  10711. stringArrayStorageItemData.index = index;
  10712. return [value, stringArrayStorageItemData];
  10713. })
  10714. .sort(([, stringArrayStorageItemDataA], [, stringArrayStorageItemDataB]) => stringArrayStorageItemDataA.index - stringArrayStorageItemDataB.index));
  10715. }
  10716. toString() {
  10717. return Array
  10718. .from(this.storage.values())
  10719. .map((stringArrayStorageItemData) => {
  10720. return `'${this.escapeSequenceEncoder.encode(stringArrayStorageItemData.encodedValue, this.options.unicodeEscapeSequence)}'`;
  10721. }).toString();
  10722. }
  10723. getOrSetIfDoesNotExist(value) {
  10724. const { encodedValue, decodeKey } = this.getEncodedValue(value);
  10725. const storedStringArrayStorageItemData = this.storage.get(encodedValue);
  10726. if (storedStringArrayStorageItemData) {
  10727. return storedStringArrayStorageItemData;
  10728. }
  10729. const stringArrayStorageItemData = {
  10730. encodedValue,
  10731. decodeKey,
  10732. value,
  10733. index: this.getLength()
  10734. };
  10735. this.storage.set(encodedValue, stringArrayStorageItemData);
  10736. return stringArrayStorageItemData;
  10737. }
  10738. getEncodedValue(value) {
  10739. var _a;
  10740. switch (this.options.stringArrayEncoding) {
  10741. case StringArrayEncoding_1.StringArrayEncoding.Rc4: {
  10742. const decodeKey = this.randomGenerator.getRandomGenerator().pickone(this.rc4Keys);
  10743. const encodedValue = this.cryptUtils.btoa(this.cryptUtils.rc4(value, decodeKey));
  10744. const encodedValueSources = (_a = this.rc4EncodedValuesSourcesCache.get(encodedValue)) !== null && _a !== void 0 ? _a : [];
  10745. let encodedValueSourcesLength = encodedValueSources.length;
  10746. const shouldAddValueToSourcesCache = !encodedValueSourcesLength || !encodedValueSources.includes(value);
  10747. if (shouldAddValueToSourcesCache) {
  10748. encodedValueSources.push(value);
  10749. encodedValueSourcesLength++;
  10750. }
  10751. this.rc4EncodedValuesSourcesCache.set(encodedValue, encodedValueSources);
  10752. if (encodedValueSourcesLength > 1) {
  10753. return this.getEncodedValue(value);
  10754. }
  10755. return { encodedValue, decodeKey };
  10756. }
  10757. case StringArrayEncoding_1.StringArrayEncoding.Base64: {
  10758. const decodeKey = null;
  10759. const encodedValue = this.cryptUtils.btoa(value);
  10760. return { encodedValue, decodeKey };
  10761. }
  10762. default: {
  10763. const decodeKey = null;
  10764. const encodedValue = value;
  10765. return { encodedValue, decodeKey };
  10766. }
  10767. }
  10768. }
  10769. };
  10770. StringArrayStorage.minimumRotationAmount = 100;
  10771. StringArrayStorage.maximumRotationAmount = 500;
  10772. StringArrayStorage.rc4KeyLength = 4;
  10773. StringArrayStorage.rc4KeysCount = 50;
  10774. StringArrayStorage.stringArrayNameLength = 7;
  10775. __decorate([
  10776. Initializable_1.initializable(),
  10777. __metadata("design:type", String)
  10778. ], StringArrayStorage.prototype, "stringArrayStorageName", void 0);
  10779. __decorate([
  10780. Initializable_1.initializable(),
  10781. __metadata("design:type", String)
  10782. ], StringArrayStorage.prototype, "stringArrayStorageCallsWrapperName", void 0);
  10783. __decorate([
  10784. inversify_1.postConstruct(),
  10785. __metadata("design:type", Function),
  10786. __metadata("design:paramtypes", []),
  10787. __metadata("design:returntype", void 0)
  10788. ], StringArrayStorage.prototype, "initialize", null);
  10789. StringArrayStorage = StringArrayStorage_1 = __decorate([
  10790. inversify_1.injectable(),
  10791. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.Factory__IIdentifierNamesGenerator)),
  10792. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IArrayUtils)),
  10793. __param(2, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  10794. __param(3, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  10795. __param(4, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ICryptUtils)),
  10796. __param(5, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IEscapeSequenceEncoder)),
  10797. __metadata("design:paramtypes", [typeof (_a = typeof TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory !== "undefined" && TIdentifierNamesGeneratorFactory_1.TIdentifierNamesGeneratorFactory) === "function" ? _a : Object, typeof (_b = typeof IArrayUtils_1.IArrayUtils !== "undefined" && IArrayUtils_1.IArrayUtils) === "function" ? _b : Object, typeof (_c = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _c : Object, typeof (_d = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _d : Object, typeof (_e = typeof ICryptUtils_1.ICryptUtils !== "undefined" && ICryptUtils_1.ICryptUtils) === "function" ? _e : Object, typeof (_f = typeof IEscapeSequenceEncoder_1.IEscapeSequenceEncoder !== "undefined" && IEscapeSequenceEncoder_1.IEscapeSequenceEncoder) === "function" ? _f : Object])
  10798. ], StringArrayStorage);
  10799. exports.StringArrayStorage = StringArrayStorage;
  10800. /***/ }),
  10801. /***/ "./src/templates/AtobTemplate.ts":
  10802. /*!***************************************!*\
  10803. !*** ./src/templates/AtobTemplate.ts ***!
  10804. \***************************************/
  10805. /*! no static exports found */
  10806. /***/ (function(module, exports, __webpack_require__) {
  10807. "use strict";
  10808. Object.defineProperty(exports, "__esModule", { value: true });
  10809. function AtobTemplate() {
  10810. return `
  10811. (function () {
  10812. {globalVariableTemplate}
  10813. const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  10814. that.atob || (
  10815. that.atob = function(input) {
  10816. const str = String(input).replace(/=+$/, '');
  10817. let output = '';
  10818. for (
  10819. let bc = 0, bs, buffer, idx = 0;
  10820. buffer = str.charAt(idx++);
  10821. ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
  10822. bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
  10823. ) {
  10824. buffer = chars.indexOf(buffer);
  10825. }
  10826. return output;
  10827. }
  10828. );
  10829. })();
  10830. `;
  10831. }
  10832. exports.AtobTemplate = AtobTemplate;
  10833. /***/ }),
  10834. /***/ "./src/templates/GlobalVariableNoEvalTemplate.ts":
  10835. /*!*******************************************************!*\
  10836. !*** ./src/templates/GlobalVariableNoEvalTemplate.ts ***!
  10837. \*******************************************************/
  10838. /*! no static exports found */
  10839. /***/ (function(module, exports, __webpack_require__) {
  10840. "use strict";
  10841. Object.defineProperty(exports, "__esModule", { value: true });
  10842. function GlobalVariableNoEvalTemplate() {
  10843. return `
  10844. const that = (typeof window !== 'undefined'
  10845. ? window
  10846. : (typeof process === 'object' &&
  10847. typeof require === 'function' &&
  10848. typeof global === 'object')
  10849. ? global
  10850. : this);
  10851. `;
  10852. }
  10853. exports.GlobalVariableNoEvalTemplate = GlobalVariableNoEvalTemplate;
  10854. /***/ }),
  10855. /***/ "./src/templates/GlobalVariableTemplate1.ts":
  10856. /*!**************************************************!*\
  10857. !*** ./src/templates/GlobalVariableTemplate1.ts ***!
  10858. \**************************************************/
  10859. /*! no static exports found */
  10860. /***/ (function(module, exports, __webpack_require__) {
  10861. "use strict";
  10862. Object.defineProperty(exports, "__esModule", { value: true });
  10863. function GlobalVariableTemplate1() {
  10864. return `
  10865. let that;
  10866. try {
  10867. const getGlobal = Function('return (function() ' + '{}.constructor("return this")( )' + ');');
  10868. that = getGlobal();
  10869. } catch (e) {
  10870. that = window;
  10871. }
  10872. `;
  10873. }
  10874. exports.GlobalVariableTemplate1 = GlobalVariableTemplate1;
  10875. /***/ }),
  10876. /***/ "./src/templates/GlobalVariableTemplate2.ts":
  10877. /*!**************************************************!*\
  10878. !*** ./src/templates/GlobalVariableTemplate2.ts ***!
  10879. \**************************************************/
  10880. /*! no static exports found */
  10881. /***/ (function(module, exports, __webpack_require__) {
  10882. "use strict";
  10883. Object.defineProperty(exports, "__esModule", { value: true });
  10884. function GlobalVariableTemplate2() {
  10885. return `
  10886. const getGlobal = function () {
  10887. let globalObject;
  10888. try {
  10889. globalObject = Function('return (function() ' + '{}.constructor("return this")( )' + ');')();
  10890. } catch (e) {
  10891. globalObject = window;
  10892. }
  10893. return globalObject;
  10894. };
  10895. const that = getGlobal();
  10896. `;
  10897. }
  10898. exports.GlobalVariableTemplate2 = GlobalVariableTemplate2;
  10899. /***/ }),
  10900. /***/ "./src/templates/Rc4Template.ts":
  10901. /*!**************************************!*\
  10902. !*** ./src/templates/Rc4Template.ts ***!
  10903. \**************************************/
  10904. /*! no static exports found */
  10905. /***/ (function(module, exports, __webpack_require__) {
  10906. "use strict";
  10907. Object.defineProperty(exports, "__esModule", { value: true });
  10908. function Rc4Template() {
  10909. return `
  10910. const rc4 = function (str, key) {
  10911. let s = [], j = 0, x, res = '', newStr = '';
  10912. str = atob(str);
  10913. for (let k = 0, length = str.length; k < length; k++) {
  10914. newStr += '%' + ('00' + str.charCodeAt(k).toString(16)).slice(-2);
  10915. }
  10916. str = decodeURIComponent(newStr);
  10917. let i;
  10918. for (i = 0; i < 256; i++) {
  10919. s[i] = i;
  10920. }
  10921. for (i = 0; i < 256; i++) {
  10922. j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
  10923. x = s[i];
  10924. s[i] = s[j];
  10925. s[j] = x;
  10926. }
  10927. i = 0;
  10928. j = 0;
  10929. for (let y = 0; y < str.length; y++) {
  10930. i = (i + 1) % 256;
  10931. j = (j + s[i]) % 256;
  10932. x = s[i];
  10933. s[i] = s[j];
  10934. s[j] = x;
  10935. res += String.fromCharCode(str.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);
  10936. }
  10937. return res;
  10938. }
  10939. `;
  10940. }
  10941. exports.Rc4Template = Rc4Template;
  10942. /***/ }),
  10943. /***/ "./src/templates/SingleNodeCallControllerTemplate.ts":
  10944. /*!***********************************************************!*\
  10945. !*** ./src/templates/SingleNodeCallControllerTemplate.ts ***!
  10946. \***********************************************************/
  10947. /*! no static exports found */
  10948. /***/ (function(module, exports, __webpack_require__) {
  10949. "use strict";
  10950. Object.defineProperty(exports, "__esModule", { value: true });
  10951. function SingleNodeCallControllerTemplate() {
  10952. return `
  10953. const {singleNodeCallControllerFunctionName} = (function(){
  10954. let firstCall = true;
  10955. return function (context, fn){
  10956. const rfn = firstCall ? function(){
  10957. if(fn){
  10958. const res = fn.apply(context, arguments);
  10959. fn = null;
  10960. return res;
  10961. }
  10962. } : function(){}
  10963. firstCall = false;
  10964. return rfn;
  10965. }
  10966. })();
  10967. `;
  10968. }
  10969. exports.SingleNodeCallControllerTemplate = SingleNodeCallControllerTemplate;
  10970. /***/ }),
  10971. /***/ "./src/templates/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts":
  10972. /*!*****************************************************************************************************************************!*\
  10973. !*** ./src/templates/console-output-nodes/console-output-disable-expression-node/ConsoleOutputDisableExpressionTemplate.ts ***!
  10974. \*****************************************************************************************************************************/
  10975. /*! no static exports found */
  10976. /***/ (function(module, exports, __webpack_require__) {
  10977. "use strict";
  10978. Object.defineProperty(exports, "__esModule", { value: true });
  10979. function ConsoleOutputDisableExpressionTemplate() {
  10980. return `
  10981. const {consoleLogDisableFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {
  10982. const func = function () {};
  10983. {globalVariableTemplate}
  10984. if (!that.console) {
  10985. that.console = (function (func){
  10986. const c = {};
  10987. c.log = func;
  10988. c.warn = func;
  10989. c.debug = func;
  10990. c.info = func;
  10991. c.error = func;
  10992. c.exception = func;
  10993. c.table = func;
  10994. c.trace = func;
  10995. return c;
  10996. })(func);
  10997. } else {
  10998. that.console.log = func;
  10999. that.console.warn = func;
  11000. that.console.debug = func;
  11001. that.console.info = func;
  11002. that.console.error = func;
  11003. that.console.exception = func;
  11004. that.console.table = func;
  11005. that.console.trace = func;
  11006. }
  11007. });
  11008. {consoleLogDisableFunctionName}();
  11009. `;
  11010. }
  11011. exports.ConsoleOutputDisableExpressionTemplate = ConsoleOutputDisableExpressionTemplate;
  11012. /***/ }),
  11013. /***/ "./src/templates/debug-protection-nodes/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate.ts":
  11014. /*!*************************************************************************************************************************!*\
  11015. !*** ./src/templates/debug-protection-nodes/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate.ts ***!
  11016. \*************************************************************************************************************************/
  11017. /*! no static exports found */
  11018. /***/ (function(module, exports, __webpack_require__) {
  11019. "use strict";
  11020. Object.defineProperty(exports, "__esModule", { value: true });
  11021. function DebugProtectionFunctionCallTemplate() {
  11022. return `
  11023. (function () {
  11024. {singleNodeCallControllerFunctionName}(
  11025. this,
  11026. function () {
  11027. const regExp1 = new RegExp('function *\\\\( *\\\\)');
  11028. const regExp2 = new RegExp('\\\\+\\\\+ *\\(?:[a-zA-Z_$][0-9a-zA-Z_$]*\\)', 'i');
  11029. const result = {debugProtectionFunctionName}('init');
  11030. if (!regExp1.test(result + 'chain') || !regExp2.test(result + 'input')) {
  11031. result('0');
  11032. } else {
  11033. {debugProtectionFunctionName}();
  11034. }
  11035. }
  11036. )();
  11037. })();
  11038. `;
  11039. }
  11040. exports.DebugProtectionFunctionCallTemplate = DebugProtectionFunctionCallTemplate;
  11041. /***/ }),
  11042. /***/ "./src/templates/debug-protection-nodes/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate.ts":
  11043. /*!*********************************************************************************************************************************!*\
  11044. !*** ./src/templates/debug-protection-nodes/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate.ts ***!
  11045. \*********************************************************************************************************************************/
  11046. /*! no static exports found */
  11047. /***/ (function(module, exports, __webpack_require__) {
  11048. "use strict";
  11049. Object.defineProperty(exports, "__esModule", { value: true });
  11050. function DebugProtectionFunctionIntervalTemplate() {
  11051. return `
  11052. setInterval(function () {
  11053. {debugProtectionFunctionName}();
  11054. }, 4000);
  11055. `;
  11056. }
  11057. exports.DebugProtectionFunctionIntervalTemplate = DebugProtectionFunctionIntervalTemplate;
  11058. /***/ }),
  11059. /***/ "./src/templates/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate.ts":
  11060. /*!****************************************************************************************************************!*\
  11061. !*** ./src/templates/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate.ts ***!
  11062. \****************************************************************************************************************/
  11063. /*! no static exports found */
  11064. /***/ (function(module, exports, __webpack_require__) {
  11065. "use strict";
  11066. Object.defineProperty(exports, "__esModule", { value: true });
  11067. function DebugProtectionFunctionTemplate() {
  11068. return `
  11069. function {debugProtectionFunctionName} (ret) {
  11070. function debuggerProtection (counter) {
  11071. {debuggerTemplate}
  11072. debuggerProtection(++counter);
  11073. }
  11074. try {
  11075. if (ret) {
  11076. return debuggerProtection;
  11077. } else {
  11078. debuggerProtection(0);
  11079. }
  11080. } catch (y) {}
  11081. }
  11082. `;
  11083. }
  11084. exports.DebugProtectionFunctionTemplate = DebugProtectionFunctionTemplate;
  11085. /***/ }),
  11086. /***/ "./src/templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplate.ts":
  11087. /*!*************************************************************************************************!*\
  11088. !*** ./src/templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplate.ts ***!
  11089. \*************************************************************************************************/
  11090. /*! no static exports found */
  11091. /***/ (function(module, exports, __webpack_require__) {
  11092. "use strict";
  11093. Object.defineProperty(exports, "__esModule", { value: true });
  11094. function DebuggerTemplate() {
  11095. return `
  11096. if (typeof counter === 'string') {
  11097. return (function (arg) {}.constructor('while (true) {}').apply('counter'));
  11098. } else {
  11099. if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {
  11100. (function () {return true;}.constructor('debu' + 'gger').call('action'));
  11101. } else {
  11102. (function () {return false;}.constructor('debu' + 'gger').apply('stateObject'));
  11103. }
  11104. }
  11105. `;
  11106. }
  11107. exports.DebuggerTemplate = DebuggerTemplate;
  11108. /***/ }),
  11109. /***/ "./src/templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplateNoEval.ts":
  11110. /*!*******************************************************************************************************!*\
  11111. !*** ./src/templates/debug-protection-nodes/debug-protection-function-node/DebuggerTemplateNoEval.ts ***!
  11112. \*******************************************************************************************************/
  11113. /*! no static exports found */
  11114. /***/ (function(module, exports, __webpack_require__) {
  11115. "use strict";
  11116. Object.defineProperty(exports, "__esModule", { value: true });
  11117. function DebuggerTemplateNoEval() {
  11118. return `
  11119. if (typeof counter === 'string') {
  11120. const func = function () {
  11121. while (true) {}
  11122. };
  11123. return func();
  11124. } else {
  11125. if (('' + counter / counter)['length'] !== 1 || counter % 20 === 0) {
  11126. debugger;
  11127. } else {
  11128. debugger;
  11129. }
  11130. }
  11131. `;
  11132. }
  11133. exports.DebuggerTemplateNoEval = DebuggerTemplateNoEval;
  11134. /***/ }),
  11135. /***/ "./src/templates/domain-lock-nodes/domain-lock-node/DomainLockNodeTemplate.ts":
  11136. /*!************************************************************************************!*\
  11137. !*** ./src/templates/domain-lock-nodes/domain-lock-node/DomainLockNodeTemplate.ts ***!
  11138. \************************************************************************************/
  11139. /*! no static exports found */
  11140. /***/ (function(module, exports, __webpack_require__) {
  11141. "use strict";
  11142. Object.defineProperty(exports, "__esModule", { value: true });
  11143. function DomainLockNodeTemplate() {
  11144. return `
  11145. const {domainLockFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {
  11146. {globalVariableTemplate}
  11147. const func = function () {
  11148. return {
  11149. key: 'item',
  11150. value: 'attribute',
  11151. getAttribute: function () {
  11152. for (let i = 0; i < 1000; i--) {
  11153. const isPositive = i > 0;
  11154. switch (isPositive) {
  11155. case true:
  11156. return this.item + '_' + this.value + '_' + i;
  11157. default:
  11158. this.item + '_' + this.value;
  11159. }
  11160. }
  11161. }()
  11162. };
  11163. };
  11164. const regExp = new RegExp("[{diff}]", "g");
  11165. const domains = "{domains}".replace(regExp, "").split(";");
  11166. let document;
  11167. let domain;
  11168. let location;
  11169. let hostname;
  11170. for (let d in that) {
  11171. if (d.length == 8 && d.charCodeAt(7) == 116 && d.charCodeAt(5) == 101 && d.charCodeAt(3) == 117 && d.charCodeAt(0) == 100) {
  11172. document = d;
  11173. break;
  11174. }
  11175. }
  11176. for (let d1 in that[document]) {
  11177. if (d1.length == 6 && d1.charCodeAt(5) == 110 && d1.charCodeAt(0) == 100) {
  11178. domain = d1;
  11179. break;
  11180. }
  11181. }
  11182. if (!("~" > domain)) {
  11183. for (let d2 in that[document]) {
  11184. if (d2.length == 8 && d2.charCodeAt(7) == 110 && d2.charCodeAt(0) == 108) {
  11185. location = d2;
  11186. break;
  11187. }
  11188. }
  11189. for (let d3 in that[document][location]) {
  11190. if (d3.length == 8 && d3.charCodeAt(7) == 101 && d3.charCodeAt(0) == 104) {
  11191. hostname = d3;
  11192. break;
  11193. }
  11194. }
  11195. }
  11196. if (!document || !that[document]) {
  11197. return;
  11198. }
  11199. const documentDomain = that[document][domain];
  11200. const documentLocationHostName = !!that[document][location] && that[document][location][hostname];
  11201. const currentDomain = documentDomain || documentLocationHostName;
  11202. if (!currentDomain) {
  11203. return;
  11204. }
  11205. let ok = false;
  11206. for (let i = 0; i < domains.length; i++) {
  11207. const domain = domains[i];
  11208. const position = currentDomain.length - domain.length;
  11209. const lastIndex = currentDomain.indexOf(domain, position);
  11210. const endsWith = lastIndex !== -1 && lastIndex === position;
  11211. if (endsWith) {
  11212. if (currentDomain.length == domain.length || domain.indexOf(".") === 0) {
  11213. ok = true;
  11214. }
  11215. }
  11216. }
  11217. if (!ok) {
  11218. data;
  11219. } else {
  11220. return;
  11221. }
  11222. func();
  11223. });
  11224. {domainLockFunctionName}();
  11225. `;
  11226. }
  11227. exports.DomainLockNodeTemplate = DomainLockNodeTemplate;
  11228. /***/ }),
  11229. /***/ "./src/templates/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts":
  11230. /*!*************************************************************************************************!*\
  11231. !*** ./src/templates/self-defending-nodes/self-defending-unicode-node/SelfDefendingTemplate.ts ***!
  11232. \*************************************************************************************************/
  11233. /*! no static exports found */
  11234. /***/ (function(module, exports, __webpack_require__) {
  11235. "use strict";
  11236. Object.defineProperty(exports, "__esModule", { value: true });
  11237. function SelfDefendingTemplate(escapeSequenceEncoder) {
  11238. return `
  11239. const {selfDefendingFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {
  11240. const func1 = function(){return 'dev';},
  11241. func2 = function () {
  11242. return 'window';
  11243. };
  11244. const test1 = function () {
  11245. const regExp = new RegExp('${escapeSequenceEncoder.encode('\\w+ *\\(\\) *{\\w+ *[\'|"].+[\'|"];? *}', true)}');
  11246. return !regExp.test(func1.toString());
  11247. };
  11248. const test2 = function () {
  11249. const regExp = new RegExp('${escapeSequenceEncoder.encode('(\\\\[x|u](\\w){2,4})+', true)}');
  11250. return regExp.test(func2.toString());
  11251. };
  11252. const recursiveFunc1 = function (string) {
  11253. const i = ~-1 >> 1 + 255 % 0;
  11254. if (string.indexOf('i' === i)) {
  11255. recursiveFunc2(string)
  11256. }
  11257. };
  11258. const recursiveFunc2 = function (string) {
  11259. const i = ~-4 >> 1 + 255 % 0;
  11260. if (string.indexOf((true+"")[3]) !== i) {
  11261. recursiveFunc1(string)
  11262. }
  11263. };
  11264. if (!test1()) {
  11265. if (!test2()) {
  11266. recursiveFunc1('indеxOf');
  11267. } else {
  11268. recursiveFunc1('indexOf');
  11269. }
  11270. } else {
  11271. recursiveFunc1('indеxOf');
  11272. }
  11273. })
  11274. {selfDefendingFunctionName}();
  11275. `;
  11276. }
  11277. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  11278. /***/ }),
  11279. /***/ "./src/templates/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate.ts":
  11280. /*!**********************************************************************************************!*\
  11281. !*** ./src/templates/string-array-nodes/string-array-calls-wrapper/SelfDefendingTemplate.ts ***!
  11282. \**********************************************************************************************/
  11283. /*! no static exports found */
  11284. /***/ (function(module, exports, __webpack_require__) {
  11285. "use strict";
  11286. Object.defineProperty(exports, "__esModule", { value: true });
  11287. function SelfDefendingTemplate(randomGenerator, escapeSequenceEncoder) {
  11288. const identifierLength = 6;
  11289. const rc4BytesIdentifier = randomGenerator.getRandomString(identifierLength);
  11290. const statesIdentifier = randomGenerator.getRandomString(identifierLength);
  11291. const newStateIdentifier = randomGenerator.getRandomString(identifierLength);
  11292. const firstStateIdentifier = randomGenerator.getRandomString(identifierLength);
  11293. const secondStateIdentifier = randomGenerator.getRandomString(identifierLength);
  11294. const checkStateIdentifier = randomGenerator.getRandomString(identifierLength);
  11295. const runStateIdentifier = randomGenerator.getRandomString(identifierLength);
  11296. const getStateIdentifier = randomGenerator.getRandomString(identifierLength);
  11297. const stateResultIdentifier = randomGenerator.getRandomString(identifierLength);
  11298. return `
  11299. const StatesClass = function (${rc4BytesIdentifier}) {
  11300. this.${rc4BytesIdentifier} = ${rc4BytesIdentifier};
  11301. this.${statesIdentifier} = [1, 0, 0];
  11302. this.${newStateIdentifier} = function(){return 'newState';};
  11303. this.${firstStateIdentifier} = '${escapeSequenceEncoder.encode('\\w+ *\\(\\) *{\\w+ *', true)}';
  11304. this.${secondStateIdentifier} = '${escapeSequenceEncoder.encode('[\'|"].+[\'|"];? *}', true)}';
  11305. };
  11306. StatesClass.prototype.${checkStateIdentifier} = function () {
  11307. const regExp = new RegExp(this.${firstStateIdentifier} + this.${secondStateIdentifier});
  11308. const expression = regExp.test(this.${newStateIdentifier}.toString())
  11309. ? --this.${statesIdentifier}[1]
  11310. : --this.${statesIdentifier}[0];
  11311. return this.${runStateIdentifier}(expression);
  11312. };
  11313. StatesClass.prototype.${runStateIdentifier} = function (${stateResultIdentifier}) {
  11314. if (!Boolean(~${stateResultIdentifier})) {
  11315. return ${stateResultIdentifier};
  11316. }
  11317. return this.${getStateIdentifier}(this.${rc4BytesIdentifier});
  11318. };
  11319. StatesClass.prototype.${getStateIdentifier} = function (${rc4BytesIdentifier}) {
  11320. for (let i = 0, len = this.${statesIdentifier}.length; i < len; i++) {
  11321. this.${statesIdentifier}.push(Math.round(Math.random()));
  11322. len = this.${statesIdentifier}.length;
  11323. }
  11324. return ${rc4BytesIdentifier}(this.${statesIdentifier}[0]);
  11325. };
  11326. new StatesClass({stringArrayCallsWrapperName}).${checkStateIdentifier}();
  11327. `;
  11328. }
  11329. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  11330. /***/ }),
  11331. /***/ "./src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate.ts":
  11332. /*!************************************************************************************************************!*\
  11333. !*** ./src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate.ts ***!
  11334. \************************************************************************************************************/
  11335. /*! no static exports found */
  11336. /***/ (function(module, exports, __webpack_require__) {
  11337. "use strict";
  11338. Object.defineProperty(exports, "__esModule", { value: true });
  11339. function StringArrayBase64DecodeNodeTemplate(randomGenerator) {
  11340. const identifierLength = 6;
  11341. const initializedIdentifier = randomGenerator.getRandomString(identifierLength);
  11342. const base64DecodeFunctionIdentifier = randomGenerator.getRandomString(identifierLength);
  11343. const dataIdentifier = randomGenerator.getRandomString(identifierLength);
  11344. return `
  11345. if ({stringArrayCallsWrapperName}.${initializedIdentifier} === undefined) {
  11346. {atobPolyfill}
  11347. {stringArrayCallsWrapperName}.${base64DecodeFunctionIdentifier} = function (str) {
  11348. const string = atob(str);
  11349. let newStringChars = [];
  11350. for (let i = 0, length = string.length; i < length; i++) {
  11351. newStringChars += '%' + ('00' + string.charCodeAt(i).toString(16)).slice(-2);
  11352. }
  11353. return decodeURIComponent(newStringChars);
  11354. };
  11355. {stringArrayCallsWrapperName}.${dataIdentifier} = {};
  11356. {stringArrayCallsWrapperName}.${initializedIdentifier} = true;
  11357. }
  11358. const cachedValue = {stringArrayCallsWrapperName}.${dataIdentifier}[index];
  11359. if (cachedValue === undefined) {
  11360. {selfDefendingCode}
  11361. value = {stringArrayCallsWrapperName}.${base64DecodeFunctionIdentifier}(value);
  11362. {stringArrayCallsWrapperName}.${dataIdentifier}[index] = value;
  11363. } else {
  11364. value = cachedValue;
  11365. }
  11366. `;
  11367. }
  11368. exports.StringArrayBase64DecodeNodeTemplate = StringArrayBase64DecodeNodeTemplate;
  11369. /***/ }),
  11370. /***/ "./src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayCallsWrapperTemplate.ts":
  11371. /*!********************************************************************************************************!*\
  11372. !*** ./src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayCallsWrapperTemplate.ts ***!
  11373. \********************************************************************************************************/
  11374. /*! no static exports found */
  11375. /***/ (function(module, exports, __webpack_require__) {
  11376. "use strict";
  11377. Object.defineProperty(exports, "__esModule", { value: true });
  11378. function StringArrayCallsWrapperTemplate() {
  11379. return `
  11380. const {stringArrayCallsWrapperName} = function (index, key) {
  11381. index = index - 0;
  11382. let value = {stringArrayName}[index];
  11383. {decodeNodeTemplate}
  11384. return value;
  11385. };
  11386. `;
  11387. }
  11388. exports.StringArrayCallsWrapperTemplate = StringArrayCallsWrapperTemplate;
  11389. /***/ }),
  11390. /***/ "./src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate.ts":
  11391. /*!*********************************************************************************************************!*\
  11392. !*** ./src/templates/string-array-nodes/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate.ts ***!
  11393. \*********************************************************************************************************/
  11394. /*! no static exports found */
  11395. /***/ (function(module, exports, __webpack_require__) {
  11396. "use strict";
  11397. Object.defineProperty(exports, "__esModule", { value: true });
  11398. function StringArrayRc4DecodeNodeTemplate(randomGenerator) {
  11399. const identifierLength = 6;
  11400. const initializedIdentifier = randomGenerator.getRandomString(identifierLength);
  11401. const rc4Identifier = randomGenerator.getRandomString(identifierLength);
  11402. const dataIdentifier = randomGenerator.getRandomString(identifierLength);
  11403. const onceIdentifier = randomGenerator.getRandomString(identifierLength);
  11404. return `
  11405. if ({stringArrayCallsWrapperName}.${initializedIdentifier} === undefined) {
  11406. {atobPolyfill}
  11407. {rc4Polyfill}
  11408. {stringArrayCallsWrapperName}.${rc4Identifier} = rc4;
  11409. {stringArrayCallsWrapperName}.${dataIdentifier} = {};
  11410. {stringArrayCallsWrapperName}.${initializedIdentifier} = true;
  11411. }
  11412. const cachedValue = {stringArrayCallsWrapperName}.${dataIdentifier}[index];
  11413. if (cachedValue === undefined) {
  11414. if ({stringArrayCallsWrapperName}.${onceIdentifier} === undefined) {
  11415. {selfDefendingCode}
  11416. {stringArrayCallsWrapperName}.${onceIdentifier} = true;
  11417. }
  11418. value = {stringArrayCallsWrapperName}.${rc4Identifier}(value, key);
  11419. {stringArrayCallsWrapperName}.${dataIdentifier}[index] = value;
  11420. } else {
  11421. value = cachedValue;
  11422. }
  11423. `;
  11424. }
  11425. exports.StringArrayRc4DecodeNodeTemplate = StringArrayRc4DecodeNodeTemplate;
  11426. /***/ }),
  11427. /***/ "./src/templates/string-array-nodes/string-array-node/StringArrayTemplate.ts":
  11428. /*!***********************************************************************************!*\
  11429. !*** ./src/templates/string-array-nodes/string-array-node/StringArrayTemplate.ts ***!
  11430. \***********************************************************************************/
  11431. /*! no static exports found */
  11432. /***/ (function(module, exports, __webpack_require__) {
  11433. "use strict";
  11434. Object.defineProperty(exports, "__esModule", { value: true });
  11435. function StringArrayTemplate() {
  11436. return `
  11437. const {stringArrayName} = [{stringArray}];
  11438. `;
  11439. }
  11440. exports.StringArrayTemplate = StringArrayTemplate;
  11441. /***/ }),
  11442. /***/ "./src/templates/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate.ts":
  11443. /*!*****************************************************************************************************!*\
  11444. !*** ./src/templates/string-array-nodes/string-array-rotate-function-node/SelfDefendingTemplate.ts ***!
  11445. \*****************************************************************************************************/
  11446. /*! no static exports found */
  11447. /***/ (function(module, exports, __webpack_require__) {
  11448. "use strict";
  11449. Object.defineProperty(exports, "__esModule", { value: true });
  11450. function SelfDefendingTemplate(escapeSequenceEncoder) {
  11451. return `
  11452. const selfDefendingFunc = function () {
  11453. const object = {
  11454. data: {
  11455. key: 'cookie',
  11456. value: 'timeout'
  11457. },
  11458. setCookie: function (options, name, value, document) {
  11459. document = document || {};
  11460. let updatedCookie = name + "=" + value;
  11461. let i = 0;
  11462. for (let i = 0, len = options.length; i < len; i++) {
  11463. const propName = options[i];
  11464. updatedCookie += "; " + propName;
  11465. const propValue = options[propName];
  11466. options.push(propValue);
  11467. len = options.length;
  11468. if (propValue !== true) {
  11469. updatedCookie += "=" + propValue;
  11470. }
  11471. }
  11472. document['cookie'] = updatedCookie;
  11473. },
  11474. removeCookie: function(){return 'dev';},
  11475. getCookie: function (document, name) {
  11476. document = document || function (value) { return value };
  11477. const matches = document(new RegExp(
  11478. "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
  11479. ));
  11480. const func = function (param1, param2) {
  11481. param1(++param2);
  11482. };
  11483. func({whileFunctionName}, {timesName});
  11484. return matches ? decodeURIComponent(matches[1]) : undefined;
  11485. }
  11486. };
  11487. const test1 = function () {
  11488. const regExp = new RegExp('${escapeSequenceEncoder.encode('\\w+ *\\(\\) *{\\w+ *[\'|"].+[\'|"];? *}', true)}');
  11489. return regExp.test(object.removeCookie.toString());
  11490. };
  11491. object['updateCookie'] = test1;
  11492. let cookie = '';
  11493. const result = object['updateCookie']();
  11494. if (!result) {
  11495. object['setCookie'](['*'], 'counter', 1);
  11496. } else if (result) {
  11497. cookie = object['getCookie'](null, 'counter');
  11498. } else {
  11499. object['removeCookie']();
  11500. }
  11501. };
  11502. selfDefendingFunc();
  11503. `;
  11504. }
  11505. exports.SelfDefendingTemplate = SelfDefendingTemplate;
  11506. /***/ }),
  11507. /***/ "./src/templates/string-array-nodes/string-array-rotate-function-node/StringArrayRotateFunctionTemplate.ts":
  11508. /*!*****************************************************************************************************************!*\
  11509. !*** ./src/templates/string-array-nodes/string-array-rotate-function-node/StringArrayRotateFunctionTemplate.ts ***!
  11510. \*****************************************************************************************************************/
  11511. /*! no static exports found */
  11512. /***/ (function(module, exports, __webpack_require__) {
  11513. "use strict";
  11514. Object.defineProperty(exports, "__esModule", { value: true });
  11515. function StringArrayRotateFunctionTemplate() {
  11516. return `
  11517. (function (array, {timesName}) {
  11518. const {whileFunctionName} = function (times) {
  11519. while (--times) {
  11520. array['push'](array['shift']());
  11521. }
  11522. };
  11523. {code}
  11524. })({stringArrayName}, 0x{stringArrayRotationAmount});
  11525. `;
  11526. }
  11527. exports.StringArrayRotateFunctionTemplate = StringArrayRotateFunctionTemplate;
  11528. /***/ }),
  11529. /***/ "./src/types/container/calls-graph-analyzer/TCalleeDataExtractorFactory.ts":
  11530. /*!*********************************************************************************!*\
  11531. !*** ./src/types/container/calls-graph-analyzer/TCalleeDataExtractorFactory.ts ***!
  11532. \*********************************************************************************/
  11533. /*! no static exports found */
  11534. /***/ (function(module, exports, __webpack_require__) {
  11535. "use strict";
  11536. Object.defineProperty(exports, "__esModule", { value: true });
  11537. /***/ }),
  11538. /***/ "./src/types/container/custom-nodes/TControlFlowCustomNodeFactory.ts":
  11539. /*!***************************************************************************!*\
  11540. !*** ./src/types/container/custom-nodes/TControlFlowCustomNodeFactory.ts ***!
  11541. \***************************************************************************/
  11542. /*! no static exports found */
  11543. /***/ (function(module, exports, __webpack_require__) {
  11544. "use strict";
  11545. Object.defineProperty(exports, "__esModule", { value: true });
  11546. /***/ }),
  11547. /***/ "./src/types/container/custom-nodes/TCustomNodeFactory.ts":
  11548. /*!****************************************************************!*\
  11549. !*** ./src/types/container/custom-nodes/TCustomNodeFactory.ts ***!
  11550. \****************************************************************/
  11551. /*! no static exports found */
  11552. /***/ (function(module, exports, __webpack_require__) {
  11553. "use strict";
  11554. Object.defineProperty(exports, "__esModule", { value: true });
  11555. /***/ }),
  11556. /***/ "./src/types/container/custom-nodes/TCustomNodeGroupFactory.ts":
  11557. /*!*********************************************************************!*\
  11558. !*** ./src/types/container/custom-nodes/TCustomNodeGroupFactory.ts ***!
  11559. \*********************************************************************/
  11560. /*! no static exports found */
  11561. /***/ (function(module, exports, __webpack_require__) {
  11562. "use strict";
  11563. Object.defineProperty(exports, "__esModule", { value: true });
  11564. /***/ }),
  11565. /***/ "./src/types/container/custom-nodes/TDeadNodeInjectionCustomNodeFactory.ts":
  11566. /*!*********************************************************************************!*\
  11567. !*** ./src/types/container/custom-nodes/TDeadNodeInjectionCustomNodeFactory.ts ***!
  11568. \*********************************************************************************/
  11569. /*! no static exports found */
  11570. /***/ (function(module, exports, __webpack_require__) {
  11571. "use strict";
  11572. Object.defineProperty(exports, "__esModule", { value: true });
  11573. /***/ }),
  11574. /***/ "./src/types/container/custom-nodes/TObjectExpressionKeysTransformerCustomNodeFactory.ts":
  11575. /*!***********************************************************************************************!*\
  11576. !*** ./src/types/container/custom-nodes/TObjectExpressionKeysTransformerCustomNodeFactory.ts ***!
  11577. \***********************************************************************************************/
  11578. /*! no static exports found */
  11579. /***/ (function(module, exports, __webpack_require__) {
  11580. "use strict";
  11581. Object.defineProperty(exports, "__esModule", { value: true });
  11582. /***/ }),
  11583. /***/ "./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts":
  11584. /*!****************************************************************************!*\
  11585. !*** ./src/types/container/generators/TIdentifierNamesGeneratorFactory.ts ***!
  11586. \****************************************************************************/
  11587. /*! no static exports found */
  11588. /***/ (function(module, exports, __webpack_require__) {
  11589. "use strict";
  11590. Object.defineProperty(exports, "__esModule", { value: true });
  11591. /***/ }),
  11592. /***/ "./src/types/container/node-transformers/TControlFlowReplacerFactory.ts":
  11593. /*!******************************************************************************!*\
  11594. !*** ./src/types/container/node-transformers/TControlFlowReplacerFactory.ts ***!
  11595. \******************************************************************************/
  11596. /*! no static exports found */
  11597. /***/ (function(module, exports, __webpack_require__) {
  11598. "use strict";
  11599. Object.defineProperty(exports, "__esModule", { value: true });
  11600. /***/ }),
  11601. /***/ "./src/types/container/node-transformers/TControlFlowStorageFactory.ts":
  11602. /*!*****************************************************************************!*\
  11603. !*** ./src/types/container/node-transformers/TControlFlowStorageFactory.ts ***!
  11604. \*****************************************************************************/
  11605. /*! no static exports found */
  11606. /***/ (function(module, exports, __webpack_require__) {
  11607. "use strict";
  11608. Object.defineProperty(exports, "__esModule", { value: true });
  11609. /***/ }),
  11610. /***/ "./src/types/container/node-transformers/TIdentifierObfuscatingReplacerFactory.ts":
  11611. /*!****************************************************************************************!*\
  11612. !*** ./src/types/container/node-transformers/TIdentifierObfuscatingReplacerFactory.ts ***!
  11613. \****************************************************************************************/
  11614. /*! no static exports found */
  11615. /***/ (function(module, exports, __webpack_require__) {
  11616. "use strict";
  11617. Object.defineProperty(exports, "__esModule", { value: true });
  11618. /***/ }),
  11619. /***/ "./src/types/container/node-transformers/TLiteralObfuscatingReplacerFactory.ts":
  11620. /*!*************************************************************************************!*\
  11621. !*** ./src/types/container/node-transformers/TLiteralObfuscatingReplacerFactory.ts ***!
  11622. \*************************************************************************************/
  11623. /*! no static exports found */
  11624. /***/ (function(module, exports, __webpack_require__) {
  11625. "use strict";
  11626. Object.defineProperty(exports, "__esModule", { value: true });
  11627. /***/ }),
  11628. /***/ "./src/types/container/node-transformers/TNodeTransformerFactory.ts":
  11629. /*!**************************************************************************!*\
  11630. !*** ./src/types/container/node-transformers/TNodeTransformerFactory.ts ***!
  11631. \**************************************************************************/
  11632. /*! no static exports found */
  11633. /***/ (function(module, exports, __webpack_require__) {
  11634. "use strict";
  11635. Object.defineProperty(exports, "__esModule", { value: true });
  11636. /***/ }),
  11637. /***/ "./src/types/container/node-transformers/TObfuscatingGuardFactory.ts":
  11638. /*!***************************************************************************!*\
  11639. !*** ./src/types/container/node-transformers/TObfuscatingGuardFactory.ts ***!
  11640. \***************************************************************************/
  11641. /*! no static exports found */
  11642. /***/ (function(module, exports, __webpack_require__) {
  11643. "use strict";
  11644. Object.defineProperty(exports, "__esModule", { value: true });
  11645. /***/ }),
  11646. /***/ "./src/types/container/node-transformers/TObjectExpressionExtractorFactory.ts":
  11647. /*!************************************************************************************!*\
  11648. !*** ./src/types/container/node-transformers/TObjectExpressionExtractorFactory.ts ***!
  11649. \************************************************************************************/
  11650. /*! no static exports found */
  11651. /***/ (function(module, exports, __webpack_require__) {
  11652. "use strict";
  11653. Object.defineProperty(exports, "__esModule", { value: true });
  11654. /***/ }),
  11655. /***/ "./src/types/container/source-code/TObfuscatedCodeFactory.ts":
  11656. /*!*******************************************************************!*\
  11657. !*** ./src/types/container/source-code/TObfuscatedCodeFactory.ts ***!
  11658. \*******************************************************************/
  11659. /*! no static exports found */
  11660. /***/ (function(module, exports, __webpack_require__) {
  11661. "use strict";
  11662. Object.defineProperty(exports, "__esModule", { value: true });
  11663. /***/ }),
  11664. /***/ "./src/types/options/TInputCLIOptions.ts":
  11665. /*!***********************************************!*\
  11666. !*** ./src/types/options/TInputCLIOptions.ts ***!
  11667. \***********************************************/
  11668. /*! no static exports found */
  11669. /***/ (function(module, exports, __webpack_require__) {
  11670. "use strict";
  11671. Object.defineProperty(exports, "__esModule", { value: true });
  11672. /***/ }),
  11673. /***/ "./src/types/options/TInputOptions.ts":
  11674. /*!********************************************!*\
  11675. !*** ./src/types/options/TInputOptions.ts ***!
  11676. \********************************************/
  11677. /*! no static exports found */
  11678. /***/ (function(module, exports, __webpack_require__) {
  11679. "use strict";
  11680. Object.defineProperty(exports, "__esModule", { value: true });
  11681. /***/ }),
  11682. /***/ "./src/types/options/TStringArrayEncoding.ts":
  11683. /*!***************************************************!*\
  11684. !*** ./src/types/options/TStringArrayEncoding.ts ***!
  11685. \***************************************************/
  11686. /*! no static exports found */
  11687. /***/ (function(module, exports, __webpack_require__) {
  11688. "use strict";
  11689. Object.defineProperty(exports, "__esModule", { value: true });
  11690. /***/ }),
  11691. /***/ "./src/types/storages/TControlFlowStorage.ts":
  11692. /*!***************************************************!*\
  11693. !*** ./src/types/storages/TControlFlowStorage.ts ***!
  11694. \***************************************************/
  11695. /*! no static exports found */
  11696. /***/ (function(module, exports, __webpack_require__) {
  11697. "use strict";
  11698. Object.defineProperty(exports, "__esModule", { value: true });
  11699. /***/ }),
  11700. /***/ "./src/types/storages/TCustomNodeGroupStorage.ts":
  11701. /*!*******************************************************!*\
  11702. !*** ./src/types/storages/TCustomNodeGroupStorage.ts ***!
  11703. \*******************************************************/
  11704. /*! no static exports found */
  11705. /***/ (function(module, exports, __webpack_require__) {
  11706. "use strict";
  11707. Object.defineProperty(exports, "__esModule", { value: true });
  11708. /***/ }),
  11709. /***/ "./src/utils/ArrayUtils.ts":
  11710. /*!*********************************!*\
  11711. !*** ./src/utils/ArrayUtils.ts ***!
  11712. \*********************************/
  11713. /*! no static exports found */
  11714. /***/ (function(module, exports, __webpack_require__) {
  11715. "use strict";
  11716. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  11717. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  11718. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  11719. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  11720. return c > 3 && r && Object.defineProperty(target, key, r), r;
  11721. };
  11722. var __metadata = (this && this.__metadata) || function (k, v) {
  11723. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  11724. };
  11725. var __param = (this && this.__param) || function (paramIndex, decorator) {
  11726. return function (target, key) { decorator(target, key, paramIndex); }
  11727. };
  11728. var _a;
  11729. Object.defineProperty(exports, "__esModule", { value: true });
  11730. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  11731. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  11732. const IRandomGenerator_1 = __webpack_require__(/*! ../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  11733. let ArrayUtils = class ArrayUtils {
  11734. constructor(randomGenerator) {
  11735. this.randomGenerator = randomGenerator;
  11736. }
  11737. createWithRange(length) {
  11738. const range = [];
  11739. for (let i = 0; i < length; i++) {
  11740. range.push(i);
  11741. }
  11742. return range;
  11743. }
  11744. findMostOccurringElement(array) {
  11745. var _a;
  11746. const arrayLength = array.length;
  11747. if (!arrayLength) {
  11748. return null;
  11749. }
  11750. const elementsMap = {};
  11751. let mostOccurringElement = array[0];
  11752. let mostOccurringElementCount = 1;
  11753. for (const element of array) {
  11754. const currentElementCount = (_a = elementsMap[element]) !== null && _a !== void 0 ? _a : 0;
  11755. const updatedElementCount = currentElementCount + 1;
  11756. if (updatedElementCount > mostOccurringElementCount) {
  11757. mostOccurringElement = element;
  11758. mostOccurringElementCount = updatedElementCount;
  11759. }
  11760. elementsMap[element] = updatedElementCount;
  11761. }
  11762. return mostOccurringElement;
  11763. }
  11764. rotate(array, times) {
  11765. if (!array.length) {
  11766. throw new ReferenceError('Cannot rotate empty array.');
  11767. }
  11768. if (times <= 0) {
  11769. return array;
  11770. }
  11771. const newArray = array;
  11772. let temp;
  11773. while (times--) {
  11774. temp = newArray.pop();
  11775. if (temp) {
  11776. newArray.unshift(temp);
  11777. }
  11778. }
  11779. return newArray;
  11780. }
  11781. shuffle(array) {
  11782. const shuffledArray = [...array];
  11783. for (let i = shuffledArray.length; i; i--) {
  11784. const j = Math.floor(this.randomGenerator.getMathRandom() * i);
  11785. [shuffledArray[i - 1], shuffledArray[j]] = [shuffledArray[j], shuffledArray[i - 1]];
  11786. }
  11787. return shuffledArray;
  11788. }
  11789. };
  11790. ArrayUtils = __decorate([
  11791. inversify_1.injectable(),
  11792. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  11793. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object])
  11794. ], ArrayUtils);
  11795. exports.ArrayUtils = ArrayUtils;
  11796. /***/ }),
  11797. /***/ "./src/utils/CryptUtils.ts":
  11798. /*!*********************************!*\
  11799. !*** ./src/utils/CryptUtils.ts ***!
  11800. \*********************************/
  11801. /*! no static exports found */
  11802. /***/ (function(module, exports, __webpack_require__) {
  11803. "use strict";
  11804. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  11805. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  11806. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  11807. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  11808. return c > 3 && r && Object.defineProperty(target, key, r), r;
  11809. };
  11810. var __metadata = (this && this.__metadata) || function (k, v) {
  11811. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  11812. };
  11813. var __param = (this && this.__param) || function (paramIndex, decorator) {
  11814. return function (target, key) { decorator(target, key, paramIndex); }
  11815. };
  11816. var _a;
  11817. Object.defineProperty(exports, "__esModule", { value: true });
  11818. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  11819. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  11820. const IRandomGenerator_1 = __webpack_require__(/*! ../interfaces/utils/IRandomGenerator */ "./src/interfaces/utils/IRandomGenerator.ts");
  11821. const RandomGenerator_1 = __webpack_require__(/*! ./RandomGenerator */ "./src/utils/RandomGenerator.ts");
  11822. const Utils_1 = __webpack_require__(/*! ./Utils */ "./src/utils/Utils.ts");
  11823. let CryptUtils = class CryptUtils {
  11824. constructor(randomGenerator) {
  11825. this.randomGenerator = randomGenerator;
  11826. }
  11827. btoa(string) {
  11828. const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  11829. let output = '';
  11830. string = encodeURIComponent(string).replace(/%([0-9A-F]{2})/g, (match, p1) => {
  11831. return String.fromCharCode(parseInt(`${Utils_1.Utils.hexadecimalPrefix}${p1}`, 16));
  11832. });
  11833. for (let block, charCode, idx = 0, map = chars; string.charAt(idx | 0) || (map = '=', idx % 1); output += map.charAt(63 & block >> 8 - idx % 1 * 8)) {
  11834. charCode = string.charCodeAt(idx += 3 / 4);
  11835. if (charCode > 0xFF) {
  11836. throw new Error('\'btoa\' failed: The string to be encoded contains characters outside of the Latin1 range.');
  11837. }
  11838. block = block << 8 | charCode;
  11839. }
  11840. return output;
  11841. }
  11842. hideString(str, length) {
  11843. const escapeRegExp = (s) => s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  11844. const randomMerge = (s1, s2) => {
  11845. let i1 = -1;
  11846. let i2 = -1;
  11847. let result = '';
  11848. while (i1 < s1.length || i2 < s2.length) {
  11849. if (this.randomGenerator.getMathRandom() < 0.5 && i2 < s2.length) {
  11850. result += s2.charAt(++i2);
  11851. }
  11852. else {
  11853. result += s1.charAt(++i1);
  11854. }
  11855. }
  11856. return result;
  11857. };
  11858. const randomString = this.randomGenerator.getRandomGenerator().string({
  11859. length: length,
  11860. pool: RandomGenerator_1.RandomGenerator.randomGeneratorPool
  11861. });
  11862. let randomStringDiff = randomString.replace(new RegExp(`[${escapeRegExp(str)}]`, 'g'), '');
  11863. const randomStringDiffArray = randomStringDiff.split('');
  11864. this.randomGenerator.getRandomGenerator().shuffle(randomStringDiffArray);
  11865. randomStringDiff = randomStringDiffArray.join('');
  11866. return [randomMerge(str, randomStringDiff), randomStringDiff];
  11867. }
  11868. rc4(string, key) {
  11869. const s = [];
  11870. let j = 0;
  11871. let x;
  11872. let result = '';
  11873. for (var i = 0; i < 256; i++) {
  11874. s[i] = i;
  11875. }
  11876. for (i = 0; i < 256; i++) {
  11877. j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
  11878. x = s[i];
  11879. s[i] = s[j];
  11880. s[j] = x;
  11881. }
  11882. i = 0;
  11883. j = 0;
  11884. for (let y = 0; y < string.length; y++) {
  11885. i = (i + 1) % 256;
  11886. j = (j + s[i]) % 256;
  11887. x = s[i];
  11888. s[i] = s[j];
  11889. s[j] = x;
  11890. result += String.fromCharCode(string.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);
  11891. }
  11892. return result;
  11893. }
  11894. };
  11895. CryptUtils = __decorate([
  11896. inversify_1.injectable(),
  11897. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IRandomGenerator)),
  11898. __metadata("design:paramtypes", [typeof (_a = typeof IRandomGenerator_1.IRandomGenerator !== "undefined" && IRandomGenerator_1.IRandomGenerator) === "function" ? _a : Object])
  11899. ], CryptUtils);
  11900. exports.CryptUtils = CryptUtils;
  11901. /***/ }),
  11902. /***/ "./src/utils/EscapeSequenceEncoder.ts":
  11903. /*!********************************************!*\
  11904. !*** ./src/utils/EscapeSequenceEncoder.ts ***!
  11905. \********************************************/
  11906. /*! no static exports found */
  11907. /***/ (function(module, exports, __webpack_require__) {
  11908. "use strict";
  11909. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  11910. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  11911. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  11912. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  11913. return c > 3 && r && Object.defineProperty(target, key, r), r;
  11914. };
  11915. Object.defineProperty(exports, "__esModule", { value: true });
  11916. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  11917. let EscapeSequenceEncoder = class EscapeSequenceEncoder {
  11918. constructor() {
  11919. this.stringsCache = new Map();
  11920. }
  11921. encode(string, encodeAllSymbols) {
  11922. const cacheKey = `${string}-${String(encodeAllSymbols)}`;
  11923. if (this.stringsCache.has(cacheKey)) {
  11924. return this.stringsCache.get(cacheKey);
  11925. }
  11926. const radix = 16;
  11927. const replaceRegExp = new RegExp('[\\s\\S]', 'g');
  11928. const escapeSequenceRegExp = new RegExp('[\'\"\\\\\\s]');
  11929. const regExp = new RegExp('[\\x00-\\x7F]');
  11930. let prefix;
  11931. let template;
  11932. const result = string.replace(replaceRegExp, (character) => {
  11933. if (!encodeAllSymbols && !escapeSequenceRegExp.exec(character)) {
  11934. return character;
  11935. }
  11936. if (regExp.exec(character)) {
  11937. prefix = '\\x';
  11938. template = '00';
  11939. }
  11940. else {
  11941. prefix = '\\u';
  11942. template = '0000';
  11943. }
  11944. return `${prefix}${(template + character.charCodeAt(0).toString(radix)).slice(-template.length)}`;
  11945. });
  11946. this.stringsCache.set(cacheKey, result);
  11947. this.stringsCache.set(`${result}-${String(encodeAllSymbols)}`, result);
  11948. return result;
  11949. }
  11950. };
  11951. EscapeSequenceEncoder = __decorate([
  11952. inversify_1.injectable()
  11953. ], EscapeSequenceEncoder);
  11954. exports.EscapeSequenceEncoder = EscapeSequenceEncoder;
  11955. /***/ }),
  11956. /***/ "./src/utils/LevelledTopologicalSorter.ts":
  11957. /*!************************************************!*\
  11958. !*** ./src/utils/LevelledTopologicalSorter.ts ***!
  11959. \************************************************/
  11960. /*! no static exports found */
  11961. /***/ (function(module, exports, __webpack_require__) {
  11962. "use strict";
  11963. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  11964. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  11965. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  11966. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  11967. return c > 3 && r && Object.defineProperty(target, key, r), r;
  11968. };
  11969. Object.defineProperty(exports, "__esModule", { value: true });
  11970. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  11971. let LevelledTopologicalSorter = class LevelledTopologicalSorter {
  11972. constructor() {
  11973. this.graph = new Map();
  11974. }
  11975. add(precedent, consequent = null) {
  11976. if (consequent !== null) {
  11977. return this.link(precedent, consequent);
  11978. }
  11979. return this.register(precedent);
  11980. }
  11981. sort() {
  11982. const consequents = Array.from(this.graph.keys());
  11983. const results = [];
  11984. const marks = {};
  11985. for (const consequent of consequents) {
  11986. if (marks[consequent] !== undefined) {
  11987. continue;
  11988. }
  11989. this.visit(results, marks, consequent);
  11990. }
  11991. return results;
  11992. }
  11993. sortByGroups() {
  11994. this.sort();
  11995. const resultItemsGroups = [];
  11996. while (this.hasNodes()) {
  11997. const rootNodes = this.findRootNodes();
  11998. resultItemsGroups.push(rootNodes);
  11999. for (const rootNode of rootNodes) {
  12000. this.delete(rootNode);
  12001. }
  12002. }
  12003. return resultItemsGroups;
  12004. }
  12005. delete(consequent) {
  12006. const precedents = this.getPrecedents(consequent);
  12007. if (precedents.length) {
  12008. throw new Error(`Unable to remove non-root node: ${consequent}`);
  12009. }
  12010. this.graph.delete(consequent);
  12011. const precedentsGroups = Array.from(this.graph.values());
  12012. for (const precedentsGroup of precedentsGroups) {
  12013. const precedentsCount = precedentsGroup.length - 1;
  12014. for (let index = precedentsCount; index >= 0; index = index - 1) {
  12015. if (precedentsGroup[index] !== consequent) {
  12016. continue;
  12017. }
  12018. precedentsGroup.splice(index, 1);
  12019. }
  12020. }
  12021. }
  12022. findRootNodes() {
  12023. const consequents = Array.from(this.graph.keys());
  12024. const rootNodes = [];
  12025. for (const consequent of consequents) {
  12026. if (!this.hasPrecedents(consequent)) {
  12027. rootNodes.push(consequent);
  12028. }
  12029. }
  12030. return rootNodes;
  12031. }
  12032. getPrecedents(consequent) {
  12033. const precedents = this.graph.get(consequent);
  12034. if (!precedents) {
  12035. throw new Error(`Unknown node: ${consequent}`);
  12036. }
  12037. return precedents;
  12038. }
  12039. hasNodes() {
  12040. return this.graph.size > 0;
  12041. }
  12042. hasPrecedents(consequent) {
  12043. return this.getPrecedents(consequent).length > 0;
  12044. }
  12045. link(precedent, consequent) {
  12046. this.register(precedent);
  12047. this.register(consequent);
  12048. const target = this.graph.get(consequent);
  12049. if (target && !target.includes(precedent)) {
  12050. target.push(precedent);
  12051. }
  12052. return this;
  12053. }
  12054. register(name) {
  12055. if (!this.graph.has(name)) {
  12056. this.graph.set(name, []);
  12057. }
  12058. return this;
  12059. }
  12060. visit(results, marks, name) {
  12061. const mark = marks[name];
  12062. if (mark === 'visiting') {
  12063. throw new Error(`Detected cycle involving node: ${name}`);
  12064. }
  12065. if (mark) {
  12066. return;
  12067. }
  12068. marks[name] = 'visiting';
  12069. const precedents = this.getPrecedents(name);
  12070. for (const precedent of precedents) {
  12071. this.visit(results, marks, precedent);
  12072. }
  12073. marks[name] = 'ok';
  12074. results.push(name);
  12075. return;
  12076. }
  12077. };
  12078. LevelledTopologicalSorter = __decorate([
  12079. inversify_1.injectable()
  12080. ], LevelledTopologicalSorter);
  12081. exports.LevelledTopologicalSorter = LevelledTopologicalSorter;
  12082. /***/ }),
  12083. /***/ "./src/utils/NodeTransformerNamesGroupsBuilder.ts":
  12084. /*!********************************************************!*\
  12085. !*** ./src/utils/NodeTransformerNamesGroupsBuilder.ts ***!
  12086. \********************************************************/
  12087. /*! no static exports found */
  12088. /***/ (function(module, exports, __webpack_require__) {
  12089. "use strict";
  12090. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  12091. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  12092. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  12093. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  12094. return c > 3 && r && Object.defineProperty(target, key, r), r;
  12095. };
  12096. var __metadata = (this && this.__metadata) || function (k, v) {
  12097. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  12098. };
  12099. var __param = (this && this.__param) || function (paramIndex, decorator) {
  12100. return function (target, key) { decorator(target, key, paramIndex); }
  12101. };
  12102. var _a;
  12103. Object.defineProperty(exports, "__esModule", { value: true });
  12104. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  12105. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  12106. const ILevelledTopologicalSorter_1 = __webpack_require__(/*! ../interfaces/utils/ILevelledTopologicalSorter */ "./src/interfaces/utils/ILevelledTopologicalSorter.ts");
  12107. let NodeTransformerNamesGroupsBuilder = class NodeTransformerNamesGroupsBuilder {
  12108. constructor(levelledTopologicalSorter) {
  12109. this.levelledTopologicalSorter = levelledTopologicalSorter;
  12110. }
  12111. build(normalizedNodeTransformers) {
  12112. const nodeTransformerNames = Object.keys(normalizedNodeTransformers);
  12113. const relationEdges = this.buildNodeTransformersRelationEdges(nodeTransformerNames, normalizedNodeTransformers);
  12114. for (const [precedent, consequent] of relationEdges) {
  12115. this.levelledTopologicalSorter.add(precedent, consequent);
  12116. }
  12117. return this.levelledTopologicalSorter.sortByGroups();
  12118. }
  12119. buildNodeTransformersRelationEdges(nodeTransformerNames, normalizedNodeTransformers) {
  12120. const relationEdges = [];
  12121. for (const nodeTransformerName of nodeTransformerNames) {
  12122. const nodeTransformer = normalizedNodeTransformers[nodeTransformerName];
  12123. const runAfterRelations = nodeTransformer.runAfter;
  12124. if (!runAfterRelations || !runAfterRelations.length) {
  12125. relationEdges.push([nodeTransformerName, null]);
  12126. continue;
  12127. }
  12128. for (const runAfterRelation of runAfterRelations) {
  12129. const isUnknownRelation = normalizedNodeTransformers[runAfterRelation] === undefined;
  12130. if (isUnknownRelation) {
  12131. relationEdges.push([nodeTransformerName, null]);
  12132. continue;
  12133. }
  12134. relationEdges.push([runAfterRelation, nodeTransformerName]);
  12135. }
  12136. }
  12137. return relationEdges;
  12138. }
  12139. };
  12140. NodeTransformerNamesGroupsBuilder = __decorate([
  12141. inversify_1.injectable(),
  12142. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ILevelledTopologicalSorter)),
  12143. __metadata("design:paramtypes", [typeof (_a = typeof ILevelledTopologicalSorter_1.ILevelledTopologicalSorter !== "undefined" && ILevelledTopologicalSorter_1.ILevelledTopologicalSorter) === "function" ? _a : Object])
  12144. ], NodeTransformerNamesGroupsBuilder);
  12145. exports.NodeTransformerNamesGroupsBuilder = NodeTransformerNamesGroupsBuilder;
  12146. /***/ }),
  12147. /***/ "./src/utils/NumberUtils.ts":
  12148. /*!**********************************!*\
  12149. !*** ./src/utils/NumberUtils.ts ***!
  12150. \**********************************/
  12151. /*! no static exports found */
  12152. /***/ (function(module, exports, __webpack_require__) {
  12153. "use strict";
  12154. Object.defineProperty(exports, "__esModule", { value: true });
  12155. class NumberUtils {
  12156. static toHex(dec) {
  12157. const radix = 16;
  12158. return dec.toString(radix);
  12159. }
  12160. static isCeil(number) {
  12161. return number % 1 === 0;
  12162. }
  12163. }
  12164. exports.NumberUtils = NumberUtils;
  12165. /***/ }),
  12166. /***/ "./src/utils/RandomGenerator.ts":
  12167. /*!**************************************!*\
  12168. !*** ./src/utils/RandomGenerator.ts ***!
  12169. \**************************************/
  12170. /*! no static exports found */
  12171. /***/ (function(module, exports, __webpack_require__) {
  12172. "use strict";
  12173. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  12174. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  12175. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  12176. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  12177. return c > 3 && r && Object.defineProperty(target, key, r), r;
  12178. };
  12179. var __metadata = (this && this.__metadata) || function (k, v) {
  12180. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  12181. };
  12182. var __param = (this && this.__param) || function (paramIndex, decorator) {
  12183. return function (target, key) { decorator(target, key, paramIndex); }
  12184. };
  12185. var __importDefault = (this && this.__importDefault) || function (mod) {
  12186. return (mod && mod.__esModule) ? mod : { "default": mod };
  12187. };
  12188. var RandomGenerator_1, _a, _b, _c;
  12189. Object.defineProperty(exports, "__esModule", { value: true });
  12190. const inversify_1 = __webpack_require__(/*! inversify */ "inversify");
  12191. const ServiceIdentifiers_1 = __webpack_require__(/*! ../container/ServiceIdentifiers */ "./src/container/ServiceIdentifiers.ts");
  12192. const md5_1 = __importDefault(__webpack_require__(/*! md5 */ "md5"));
  12193. const chance_1 = __webpack_require__(/*! chance */ "chance");
  12194. const IOptions_1 = __webpack_require__(/*! ../interfaces/options/IOptions */ "./src/interfaces/options/IOptions.ts");
  12195. const ISourceCode_1 = __webpack_require__(/*! ../interfaces/source-code/ISourceCode */ "./src/interfaces/source-code/ISourceCode.ts");
  12196. const Initializable_1 = __webpack_require__(/*! ../decorators/Initializable */ "./src/decorators/Initializable.ts");
  12197. let RandomGenerator = RandomGenerator_1 = class RandomGenerator {
  12198. constructor(sourceCode, options) {
  12199. this.sourceCode = sourceCode;
  12200. this.options = options;
  12201. }
  12202. initialize() {
  12203. this.randomGenerator = new chance_1.Chance(this.getRawSeed());
  12204. }
  12205. getMathRandom() {
  12206. return this.getRandomInteger(0, 99999) / 100000;
  12207. }
  12208. getRandomGenerator() {
  12209. return this.randomGenerator;
  12210. }
  12211. getRandomInteger(min, max) {
  12212. return this.getRandomGenerator().integer({
  12213. min: min,
  12214. max: max
  12215. });
  12216. }
  12217. getRandomString(length, pool = RandomGenerator_1.randomGeneratorPool) {
  12218. return this.getRandomGenerator().string({ length, pool });
  12219. }
  12220. getInputSeed() {
  12221. return this.options.seed.toString();
  12222. }
  12223. getRawSeed() {
  12224. const inputSeed = this.getInputSeed();
  12225. const inputSeedParts = `${inputSeed}`.split('|');
  12226. if (inputSeedParts.length > 1) {
  12227. return inputSeed;
  12228. }
  12229. const sourceCodeMD5Hash = md5_1.default(this.sourceCode.getSourceCode());
  12230. return `${inputSeed}|${sourceCodeMD5Hash}`;
  12231. }
  12232. };
  12233. RandomGenerator.randomGeneratorPool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  12234. __decorate([
  12235. Initializable_1.initializable(),
  12236. __metadata("design:type", typeof (_a = typeof chance_1.Chance !== "undefined" && chance_1.Chance.Chance) === "function" ? _a : Object)
  12237. ], RandomGenerator.prototype, "randomGenerator", void 0);
  12238. __decorate([
  12239. inversify_1.postConstruct(),
  12240. __metadata("design:type", Function),
  12241. __metadata("design:paramtypes", []),
  12242. __metadata("design:returntype", void 0)
  12243. ], RandomGenerator.prototype, "initialize", null);
  12244. RandomGenerator = RandomGenerator_1 = __decorate([
  12245. inversify_1.injectable(),
  12246. __param(0, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.ISourceCode)),
  12247. __param(1, inversify_1.inject(ServiceIdentifiers_1.ServiceIdentifiers.IOptions)),
  12248. __metadata("design:paramtypes", [typeof (_b = typeof ISourceCode_1.ISourceCode !== "undefined" && ISourceCode_1.ISourceCode) === "function" ? _b : Object, typeof (_c = typeof IOptions_1.IOptions !== "undefined" && IOptions_1.IOptions) === "function" ? _c : Object])
  12249. ], RandomGenerator);
  12250. exports.RandomGenerator = RandomGenerator;
  12251. /***/ }),
  12252. /***/ "./src/utils/Utils.ts":
  12253. /*!****************************!*\
  12254. !*** ./src/utils/Utils.ts ***!
  12255. \****************************/
  12256. /*! no static exports found */
  12257. /***/ (function(module, exports, __webpack_require__) {
  12258. "use strict";
  12259. Object.defineProperty(exports, "__esModule", { value: true });
  12260. class Utils {
  12261. static extractDomainFrom(url) {
  12262. let domain;
  12263. if (url.includes('://') || url.indexOf('//') === 0) {
  12264. domain = url.split('/')[2];
  12265. }
  12266. else {
  12267. domain = url.split('/')[0];
  12268. }
  12269. domain = domain.split(':')[0];
  12270. return domain;
  12271. }
  12272. }
  12273. exports.Utils = Utils;
  12274. Utils.hexadecimalPrefix = '0x';
  12275. /***/ }),
  12276. /***/ "@gradecam/tsenum":
  12277. /*!***********************************!*\
  12278. !*** external "@gradecam/tsenum" ***!
  12279. \***********************************/
  12280. /*! no static exports found */
  12281. /***/ (function(module, exports) {
  12282. module.exports = require("@gradecam/tsenum");
  12283. /***/ }),
  12284. /***/ "acorn":
  12285. /*!************************!*\
  12286. !*** external "acorn" ***!
  12287. \************************/
  12288. /*! no static exports found */
  12289. /***/ (function(module, exports) {
  12290. module.exports = require("acorn");
  12291. /***/ }),
  12292. /***/ "acorn-import-meta":
  12293. /*!************************************!*\
  12294. !*** external "acorn-import-meta" ***!
  12295. \************************************/
  12296. /*! no static exports found */
  12297. /***/ (function(module, exports) {
  12298. module.exports = require("acorn-import-meta");
  12299. /***/ }),
  12300. /***/ "chalk":
  12301. /*!************************!*\
  12302. !*** external "chalk" ***!
  12303. \************************/
  12304. /*! no static exports found */
  12305. /***/ (function(module, exports) {
  12306. module.exports = require("chalk");
  12307. /***/ }),
  12308. /***/ "chance":
  12309. /*!*************************!*\
  12310. !*** external "chance" ***!
  12311. \*************************/
  12312. /*! no static exports found */
  12313. /***/ (function(module, exports) {
  12314. module.exports = require("chance");
  12315. /***/ }),
  12316. /***/ "class-validator":
  12317. /*!**********************************!*\
  12318. !*** external "class-validator" ***!
  12319. \**********************************/
  12320. /*! no static exports found */
  12321. /***/ (function(module, exports) {
  12322. module.exports = require("class-validator");
  12323. /***/ }),
  12324. /***/ "commander":
  12325. /*!****************************!*\
  12326. !*** external "commander" ***!
  12327. \****************************/
  12328. /*! no static exports found */
  12329. /***/ (function(module, exports) {
  12330. module.exports = require("commander");
  12331. /***/ }),
  12332. /***/ "escodegen":
  12333. /*!****************************!*\
  12334. !*** external "escodegen" ***!
  12335. \****************************/
  12336. /*! no static exports found */
  12337. /***/ (function(module, exports) {
  12338. module.exports = require("escodegen");
  12339. /***/ }),
  12340. /***/ "eslint-scope":
  12341. /*!*******************************!*\
  12342. !*** external "eslint-scope" ***!
  12343. \*******************************/
  12344. /*! no static exports found */
  12345. /***/ (function(module, exports) {
  12346. module.exports = require("eslint-scope");
  12347. /***/ }),
  12348. /***/ "estraverse":
  12349. /*!*****************************!*\
  12350. !*** external "estraverse" ***!
  12351. \*****************************/
  12352. /*! no static exports found */
  12353. /***/ (function(module, exports) {
  12354. module.exports = require("estraverse");
  12355. /***/ }),
  12356. /***/ "eventemitter3":
  12357. /*!********************************!*\
  12358. !*** external "eventemitter3" ***!
  12359. \********************************/
  12360. /*! no static exports found */
  12361. /***/ (function(module, exports) {
  12362. module.exports = require("eventemitter3");
  12363. /***/ }),
  12364. /***/ "fast-deep-equal":
  12365. /*!**********************************!*\
  12366. !*** external "fast-deep-equal" ***!
  12367. \**********************************/
  12368. /*! no static exports found */
  12369. /***/ (function(module, exports) {
  12370. module.exports = require("fast-deep-equal");
  12371. /***/ }),
  12372. /***/ "fs":
  12373. /*!*********************!*\
  12374. !*** external "fs" ***!
  12375. \*********************/
  12376. /*! no static exports found */
  12377. /***/ (function(module, exports) {
  12378. module.exports = require("fs");
  12379. /***/ }),
  12380. /***/ "inversify":
  12381. /*!****************************!*\
  12382. !*** external "inversify" ***!
  12383. \****************************/
  12384. /*! no static exports found */
  12385. /***/ (function(module, exports) {
  12386. module.exports = require("inversify");
  12387. /***/ }),
  12388. /***/ "js-string-escape":
  12389. /*!***********************************!*\
  12390. !*** external "js-string-escape" ***!
  12391. \***********************************/
  12392. /*! no static exports found */
  12393. /***/ (function(module, exports) {
  12394. module.exports = require("js-string-escape");
  12395. /***/ }),
  12396. /***/ "md5":
  12397. /*!**********************!*\
  12398. !*** external "md5" ***!
  12399. \**********************/
  12400. /*! no static exports found */
  12401. /***/ (function(module, exports) {
  12402. module.exports = require("md5");
  12403. /***/ }),
  12404. /***/ "mkdirp":
  12405. /*!*************************!*\
  12406. !*** external "mkdirp" ***!
  12407. \*************************/
  12408. /*! no static exports found */
  12409. /***/ (function(module, exports) {
  12410. module.exports = require("mkdirp");
  12411. /***/ }),
  12412. /***/ "multimatch":
  12413. /*!*****************************!*\
  12414. !*** external "multimatch" ***!
  12415. \*****************************/
  12416. /*! no static exports found */
  12417. /***/ (function(module, exports) {
  12418. module.exports = require("multimatch");
  12419. /***/ }),
  12420. /***/ "path":
  12421. /*!***********************!*\
  12422. !*** external "path" ***!
  12423. \***********************/
  12424. /*! no static exports found */
  12425. /***/ (function(module, exports) {
  12426. module.exports = require("path");
  12427. /***/ }),
  12428. /***/ "reflect-metadata":
  12429. /*!***********************************!*\
  12430. !*** external "reflect-metadata" ***!
  12431. \***********************************/
  12432. /*! no static exports found */
  12433. /***/ (function(module, exports) {
  12434. module.exports = require("reflect-metadata");
  12435. /***/ }),
  12436. /***/ "string-template":
  12437. /*!**********************************!*\
  12438. !*** external "string-template" ***!
  12439. \**********************************/
  12440. /*! no static exports found */
  12441. /***/ (function(module, exports) {
  12442. module.exports = require("string-template");
  12443. /***/ })
  12444. /******/ });
  12445. //# sourceMappingURL=index.cli.js.map