ivprog.bundle.js 2.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["ivprogCore"] = factory();
  8. else
  9. root["ivprogCore"] = factory();
  10. })(window, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./.ima_version.json":
  99. /*!***************************!*\
  100. !*** ./.ima_version.json ***!
  101. \***************************/
  102. /*! exports provided: version, default */
  103. /***/ (function(module) {
  104. module.exports = {"version":"2019_03_12 16_36"};
  105. /***/ }),
  106. /***/ "./grammar/en/ivprog.g4":
  107. /*!******************************!*\
  108. !*** ./grammar/en/ivprog.g4 ***!
  109. \******************************/
  110. /*! no static exports found */
  111. /***/ (function(module, exports, __webpack_require__) {
  112. module.exports =
  113. /******/ (function(modules) { // webpackBootstrap
  114. /******/ // The module cache
  115. /******/ var installedModules = {};
  116. /******/
  117. /******/ // The require function
  118. /******/ function __webpack_require__(moduleId) {
  119. /******/
  120. /******/ // Check if module is in cache
  121. /******/ if(installedModules[moduleId]) {
  122. /******/ return installedModules[moduleId].exports;
  123. /******/ }
  124. /******/ // Create a new module (and put it into the cache)
  125. /******/ var module = installedModules[moduleId] = {
  126. /******/ i: moduleId,
  127. /******/ l: false,
  128. /******/ exports: {}
  129. /******/ };
  130. /******/
  131. /******/ // Execute the module function
  132. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  133. /******/
  134. /******/ // Flag the module as loaded
  135. /******/ module.l = true;
  136. /******/
  137. /******/ // Return the exports of the module
  138. /******/ return module.exports;
  139. /******/ }
  140. /******/
  141. /******/
  142. /******/ // expose the modules object (__webpack_modules__)
  143. /******/ __webpack_require__.m = modules;
  144. /******/
  145. /******/ // expose the module cache
  146. /******/ __webpack_require__.c = installedModules;
  147. /******/
  148. /******/ // identity function for calling harmony imports with the correct context
  149. /******/ __webpack_require__.i = function(value) { return value; };
  150. /******/
  151. /******/ // define getter function for harmony exports
  152. /******/ __webpack_require__.d = function(exports, name, getter) {
  153. /******/ if(!__webpack_require__.o(exports, name)) {
  154. /******/ Object.defineProperty(exports, name, {
  155. /******/ configurable: false,
  156. /******/ enumerable: true,
  157. /******/ get: getter
  158. /******/ });
  159. /******/ }
  160. /******/ };
  161. /******/
  162. /******/ // getDefaultExport function for compatibility with non-harmony modules
  163. /******/ __webpack_require__.n = function(module) {
  164. /******/ var getter = module && module.__esModule ?
  165. /******/ function getDefault() { return module['default']; } :
  166. /******/ function getModuleExports() { return module; };
  167. /******/ __webpack_require__.d(getter, 'a', getter);
  168. /******/ return getter;
  169. /******/ };
  170. /******/
  171. /******/ // Object.prototype.hasOwnProperty.call
  172. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  173. /******/
  174. /******/ // __webpack_public_path__
  175. /******/ __webpack_require__.p = "";
  176. /******/
  177. /******/ // Load entry module and return exports
  178. /******/ return __webpack_require__(__webpack_require__.s = 1);
  179. /******/ })
  180. /************************************************************************/
  181. /******/ ([
  182. /* 0 */
  183. /***/ (function(module, exports, __webpack_require__) {
  184. // Generated from /tmp/tmp-10202T0qKg2cXqfRv/ivprog.g4 by ANTLR 4.7
  185. // jshint ignore: start
  186. var antlr4 = __webpack_require__(2);
  187. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  188. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  189. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  190. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  191. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  192. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  193. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  194. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  195. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  196. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  197. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  198. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  199. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  200. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  201. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  202. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  203. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  204. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  205. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  206. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  207. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  208. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  209. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  210. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  211. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  212. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  213. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  214. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  215. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  216. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  217. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  218. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  219. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  220. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  221. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  222. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  223. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  224. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  225. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  226. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  227. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  228. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  229. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  230. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  231. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  232. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  233. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  234. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  235. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  236. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  237. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  238. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  239. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  240. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  241. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  242. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  243. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  244. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  245. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  246. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  247. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  248. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  249. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  250. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  251. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  252. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  253. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  254. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  255. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  256. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  257. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  258. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  259. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  260. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  261. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  262. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  263. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  264. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  265. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  266. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  267. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  268. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  269. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  270. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  271. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  272. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  273. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  274. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  275. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  276. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  277. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  278. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  279. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  280. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  281. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  282. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  283. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  284. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  285. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  286. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  287. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  288. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  289. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  290. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  291. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  292. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  293. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  294. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  295. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  296. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  297. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  298. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  299. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  300. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  301. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  302. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  303. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  304. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  305. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  306. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  307. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  308. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  309. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  310. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  311. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  312. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  313. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  314. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  315. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  316. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  317. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  318. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  319. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  320. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  321. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  322. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  323. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  324. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  325. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  326. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  327. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  328. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  329. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  330. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  331. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  332. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  333. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  334. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  335. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  336. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  337. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  338. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  339. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  340. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  341. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  342. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  343. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  344. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  345. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  346. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  347. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  348. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  349. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  350. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  351. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  352. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  353. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  354. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  355. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  356. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  357. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  358. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  359. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  360. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  361. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  362. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  363. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  364. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  365. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  366. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  367. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  368. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  369. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  370. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  371. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  372. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  373. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  374. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  375. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  376. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  377. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  378. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  379. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  380. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  381. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  382. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  383. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  384. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  385. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  386. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  387. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  388. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  389. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  390. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  391. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  392. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  393. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  394. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  395. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  396. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  397. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  398. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  399. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  400. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  401. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  402. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  403. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  404. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  405. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  406. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  407. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  408. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  409. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  410. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  411. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  412. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  413. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  414. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  415. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  416. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  417. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  418. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  419. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  420. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  421. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  422. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  423. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  424. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  425. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  426. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  427. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  428. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  429. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  430. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  431. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  432. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  433. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  434. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  435. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  436. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  437. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  438. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  439. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  440. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  441. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  442. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  443. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  444. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  445. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  446. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  447. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  448. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  449. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  450. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  451. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  452. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  453. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  454. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  455. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  456. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  457. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  458. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  459. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  460. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  461. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  462. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  463. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  464. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  465. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  466. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  467. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  468. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  469. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  470. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  471. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  472. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  473. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  474. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  475. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  476. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  477. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  478. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  479. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  480. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  481. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  482. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  483. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  484. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  485. function ivprog(input) {
  486. antlr4.Lexer.call(this, input);
  487. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  488. return this;
  489. }
  490. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  491. ivprog.prototype.constructor = ivprog;
  492. ivprog.EOF = antlr4.Token.EOF;
  493. ivprog.RK_PROGRAM = 1;
  494. ivprog.RK_REAL = 2;
  495. ivprog.RK_VOID = 3;
  496. ivprog.RK_BOOLEAN = 4;
  497. ivprog.RK_STRING = 5;
  498. ivprog.RK_INTEGER = 6;
  499. ivprog.RK_CHARACTER = 7;
  500. ivprog.RK_SWITCH = 8;
  501. ivprog.RK_CASE = 9;
  502. ivprog.RK_DEFAULT = 10;
  503. ivprog.RK_CONST = 11;
  504. ivprog.RK_FUNCTION = 12;
  505. ivprog.RK_RETURN = 13;
  506. ivprog.RK_FOR = 14;
  507. ivprog.RK_BREAK = 15;
  508. ivprog.RK_DO = 16;
  509. ivprog.RK_WHILE = 17;
  510. ivprog.RK_IF = 18;
  511. ivprog.RK_ELSE = 19;
  512. ivprog.RK_FALSE = 20;
  513. ivprog.RK_TRUE = 21;
  514. ivprog.OPEN_PARENTHESIS = 22;
  515. ivprog.CLOSE_PARENTHESIS = 23;
  516. ivprog.OPEN_BRACE = 24;
  517. ivprog.CLOSE_BRACE = 25;
  518. ivprog.OPEN_CURLY = 26;
  519. ivprog.CLOSE_CURLY = 27;
  520. ivprog.COMMA = 28;
  521. ivprog.EQUAL = 29;
  522. ivprog.SUM_OP = 30;
  523. ivprog.MULTI_OP = 31;
  524. ivprog.AND_OPERATOR = 32;
  525. ivprog.OR_OPERATOR = 33;
  526. ivprog.RELATIONAL_OPERATOR = 34;
  527. ivprog.COLON = 35;
  528. ivprog.NOT_OPERATOR = 36;
  529. ivprog.ID = 37;
  530. ivprog.LIB_ID = 38;
  531. ivprog.INTEGER = 39;
  532. ivprog.REAL = 40;
  533. ivprog.STRING = 41;
  534. ivprog.CHARACTER = 42;
  535. ivprog.WHITESPACE = 43;
  536. ivprog.EOS = 44;
  537. ivprog.COMMENTS = 45;
  538. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  539. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  540. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  541. "'boolean'", "'string'", "'integer'",
  542. "'character'", "'switch'", "'case'", "'otherwise'",
  543. "'const'", "'function'", "'return'", "'for'",
  544. "'break'", "'do'", "'while'", "'if'",
  545. "'else'", "'false'", "'true'", "'('",
  546. "')'", "'['", "']'", "'{'", "'}'", "','",
  547. "'='", null, null, null, null, null, "':'" ];
  548. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  549. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  550. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  551. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  552. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  553. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  554. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  555. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  556. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  557. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  558. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  559. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  560. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  561. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  562. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  563. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  564. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  565. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  566. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  567. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  568. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  569. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  570. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  571. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  572. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  573. "STRING", "STRING_CHARACTER", "CHARACTER",
  574. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  575. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  576. "COMMENTS" ];
  577. ivprog.prototype.grammarFileName = "ivprog.g4";
  578. exports.ivprog = ivprog;
  579. /***/ }),
  580. /* 1 */
  581. /***/ (function(module, exports, __webpack_require__) {
  582. module.exports = {
  583. ivprog: __webpack_require__(0).ivprog
  584. };
  585. /***/ }),
  586. /* 2 */
  587. /***/ (function(module, exports) {
  588. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  589. /***/ })
  590. /******/ ]);
  591. /***/ }),
  592. /***/ "./grammar/en/langFunctions.js":
  593. /*!*************************************!*\
  594. !*** ./grammar/en/langFunctions.js ***!
  595. \*************************************/
  596. /*! exports provided: default */
  597. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  598. "use strict";
  599. __webpack_require__.r(__webpack_exports__);
  600. /* This is a dictionary of the language defined functions
  601. **/
  602. /* harmony default export */ __webpack_exports__["default"] = ({
  603. main_function: "start",
  604. $read: "read",
  605. $write: "write",
  606. $numElements: "total_of_elements",
  607. $matrixLines: "total_of_lines",
  608. $matrixColumns: "total_of_columns",
  609. $substring: "subcadeia",
  610. $length: "comprimento",
  611. $uppercase: "caixa_alta",
  612. $lowercase: "caixa_baixa",
  613. $charAt: "char_at",
  614. $isReal: "is_real",
  615. $isInt: "is_integer",
  616. $isBool: "is_logic",
  617. $castReal: "to_real",
  618. $castInt: "to_integer",
  619. $castBool: "to_logic",
  620. $castString: "to_string",
  621. $sin: "sin",
  622. $cos: "cos",
  623. $tan: "tan",
  624. $sqrt: "sqrt",
  625. $pow: "pow",
  626. $log: "log",
  627. $abs: "abs",
  628. $negate: "negate",
  629. $invert: "invert",
  630. $max: "maximum",
  631. $min: "minimum"
  632. });
  633. /***/ }),
  634. /***/ "./grammar/en/langLibs.js":
  635. /*!********************************!*\
  636. !*** ./grammar/en/langLibs.js ***!
  637. \********************************/
  638. /*! exports provided: default */
  639. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  640. "use strict";
  641. __webpack_require__.r(__webpack_exports__);
  642. /**
  643. * This is the dictionary of the language defined libraries
  644. */
  645. /* harmony default export */ __webpack_exports__["default"] = ({
  646. $mathLib: "Mathematic",
  647. $ioLib: "ES",
  648. $strLib: "Texto",
  649. $arrayLib: "Arranjo",
  650. $langLib: "Conversion"
  651. });
  652. /***/ }),
  653. /***/ "./grammar/es/ivprog.g4":
  654. /*!******************************!*\
  655. !*** ./grammar/es/ivprog.g4 ***!
  656. \******************************/
  657. /*! no static exports found */
  658. /***/ (function(module, exports, __webpack_require__) {
  659. module.exports =
  660. /******/ (function(modules) { // webpackBootstrap
  661. /******/ // The module cache
  662. /******/ var installedModules = {};
  663. /******/
  664. /******/ // The require function
  665. /******/ function __webpack_require__(moduleId) {
  666. /******/
  667. /******/ // Check if module is in cache
  668. /******/ if(installedModules[moduleId]) {
  669. /******/ return installedModules[moduleId].exports;
  670. /******/ }
  671. /******/ // Create a new module (and put it into the cache)
  672. /******/ var module = installedModules[moduleId] = {
  673. /******/ i: moduleId,
  674. /******/ l: false,
  675. /******/ exports: {}
  676. /******/ };
  677. /******/
  678. /******/ // Execute the module function
  679. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  680. /******/
  681. /******/ // Flag the module as loaded
  682. /******/ module.l = true;
  683. /******/
  684. /******/ // Return the exports of the module
  685. /******/ return module.exports;
  686. /******/ }
  687. /******/
  688. /******/
  689. /******/ // expose the modules object (__webpack_modules__)
  690. /******/ __webpack_require__.m = modules;
  691. /******/
  692. /******/ // expose the module cache
  693. /******/ __webpack_require__.c = installedModules;
  694. /******/
  695. /******/ // identity function for calling harmony imports with the correct context
  696. /******/ __webpack_require__.i = function(value) { return value; };
  697. /******/
  698. /******/ // define getter function for harmony exports
  699. /******/ __webpack_require__.d = function(exports, name, getter) {
  700. /******/ if(!__webpack_require__.o(exports, name)) {
  701. /******/ Object.defineProperty(exports, name, {
  702. /******/ configurable: false,
  703. /******/ enumerable: true,
  704. /******/ get: getter
  705. /******/ });
  706. /******/ }
  707. /******/ };
  708. /******/
  709. /******/ // getDefaultExport function for compatibility with non-harmony modules
  710. /******/ __webpack_require__.n = function(module) {
  711. /******/ var getter = module && module.__esModule ?
  712. /******/ function getDefault() { return module['default']; } :
  713. /******/ function getModuleExports() { return module; };
  714. /******/ __webpack_require__.d(getter, 'a', getter);
  715. /******/ return getter;
  716. /******/ };
  717. /******/
  718. /******/ // Object.prototype.hasOwnProperty.call
  719. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  720. /******/
  721. /******/ // __webpack_public_path__
  722. /******/ __webpack_require__.p = "";
  723. /******/
  724. /******/ // Load entry module and return exports
  725. /******/ return __webpack_require__(__webpack_require__.s = 1);
  726. /******/ })
  727. /************************************************************************/
  728. /******/ ([
  729. /* 0 */
  730. /***/ (function(module, exports, __webpack_require__) {
  731. // Generated from /tmp/tmp-10202G3RB1RJrVie3/ivprog.g4 by ANTLR 4.7
  732. // jshint ignore: start
  733. var antlr4 = __webpack_require__(2);
  734. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  735. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  736. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  737. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  738. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  739. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  740. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  741. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  742. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  743. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  744. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  745. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  746. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  747. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  748. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  749. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  750. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  751. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  752. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  753. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  754. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  755. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  756. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  757. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  758. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  759. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  760. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  761. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  762. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  763. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  764. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  765. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  766. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  767. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  768. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  769. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  770. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  771. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  772. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  773. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  774. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  775. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  776. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  777. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  778. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  779. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  780. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  781. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  782. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  783. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  784. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  785. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  786. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  787. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  788. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  789. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  790. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  791. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  792. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  793. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  794. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  795. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  796. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  797. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  798. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  799. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  800. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  801. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  802. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  803. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  804. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  805. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  806. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  807. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  808. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  809. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  810. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  811. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  812. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  813. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  814. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  815. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  816. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  817. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  818. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  819. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  820. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  821. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  822. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  823. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  824. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  825. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  826. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  827. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  828. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  829. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  830. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  831. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  832. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  833. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  834. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  835. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  836. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  837. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  838. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  839. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  840. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  841. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  842. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  843. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  844. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  845. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  846. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  847. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  848. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  849. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  850. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  851. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  852. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  853. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  854. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  855. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  856. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  857. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  858. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  859. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  860. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  861. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  862. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  863. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  864. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  865. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  866. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  867. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  868. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  869. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  870. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  871. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  872. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  873. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  874. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  875. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  876. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  877. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  878. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  879. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  880. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  881. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  882. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  883. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  884. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  885. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  886. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  887. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  888. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  889. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  890. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  891. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  892. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  893. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  894. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  895. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  896. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  897. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  898. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  899. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  900. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  901. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  902. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  903. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  904. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  905. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  906. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  907. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  908. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  909. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  910. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  911. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  912. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  913. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  914. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  915. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  916. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  917. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  918. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  919. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  920. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  921. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  922. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  923. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  924. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  925. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  926. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  927. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  928. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  929. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  930. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  931. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  932. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  933. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  934. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  935. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  936. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  937. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  938. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  939. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  940. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  941. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  942. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  943. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  944. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  945. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  946. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  947. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  948. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  949. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  950. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  951. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  952. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  953. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  954. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  955. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  956. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  957. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  958. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  959. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  960. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  961. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  962. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  963. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  964. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  965. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  966. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  967. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  968. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  969. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  970. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  971. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  972. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  973. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  974. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  975. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  976. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  977. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  978. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  979. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  980. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  981. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  982. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  983. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  984. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  985. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  986. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  987. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  988. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  989. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  990. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  991. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  992. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  993. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  994. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  995. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  996. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  997. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  998. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  999. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1000. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1001. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1002. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1003. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1004. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1005. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1006. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1007. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1008. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1009. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1010. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1011. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1012. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1013. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1014. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1015. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1016. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1017. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1018. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1019. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1020. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1021. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1022. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1023. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1024. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1025. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1026. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1027. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1028. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1029. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1030. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1031. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1032. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1033. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1034. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1035. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1036. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1037. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1038. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1039. function ivprog(input) {
  1040. antlr4.Lexer.call(this, input);
  1041. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1042. return this;
  1043. }
  1044. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1045. ivprog.prototype.constructor = ivprog;
  1046. ivprog.EOF = antlr4.Token.EOF;
  1047. ivprog.RK_PROGRAM = 1;
  1048. ivprog.RK_REAL = 2;
  1049. ivprog.RK_VOID = 3;
  1050. ivprog.RK_BOOLEAN = 4;
  1051. ivprog.RK_STRING = 5;
  1052. ivprog.RK_INTEGER = 6;
  1053. ivprog.RK_CHARACTER = 7;
  1054. ivprog.RK_SWITCH = 8;
  1055. ivprog.RK_CASE = 9;
  1056. ivprog.RK_DEFAULT = 10;
  1057. ivprog.RK_CONST = 11;
  1058. ivprog.RK_FUNCTION = 12;
  1059. ivprog.RK_RETURN = 13;
  1060. ivprog.RK_FOR = 14;
  1061. ivprog.RK_BREAK = 15;
  1062. ivprog.RK_DO = 16;
  1063. ivprog.RK_WHILE = 17;
  1064. ivprog.RK_IF = 18;
  1065. ivprog.RK_ELSE = 19;
  1066. ivprog.RK_FALSE = 20;
  1067. ivprog.RK_TRUE = 21;
  1068. ivprog.OPEN_PARENTHESIS = 22;
  1069. ivprog.CLOSE_PARENTHESIS = 23;
  1070. ivprog.OPEN_BRACE = 24;
  1071. ivprog.CLOSE_BRACE = 25;
  1072. ivprog.OPEN_CURLY = 26;
  1073. ivprog.CLOSE_CURLY = 27;
  1074. ivprog.COMMA = 28;
  1075. ivprog.EQUAL = 29;
  1076. ivprog.SUM_OP = 30;
  1077. ivprog.MULTI_OP = 31;
  1078. ivprog.AND_OPERATOR = 32;
  1079. ivprog.OR_OPERATOR = 33;
  1080. ivprog.RELATIONAL_OPERATOR = 34;
  1081. ivprog.COLON = 35;
  1082. ivprog.NOT_OPERATOR = 36;
  1083. ivprog.ID = 37;
  1084. ivprog.LIB_ID = 38;
  1085. ivprog.INTEGER = 39;
  1086. ivprog.REAL = 40;
  1087. ivprog.STRING = 41;
  1088. ivprog.CHARACTER = 42;
  1089. ivprog.WHITESPACE = 43;
  1090. ivprog.EOS = 44;
  1091. ivprog.COMMENTS = 45;
  1092. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1093. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1094. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1095. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1096. "'escolha'", "'caso'", "'contrario'",
  1097. "'const'", "'funcao'", "'retorne'", "'para'",
  1098. "'pare'", "'faca'", "'enquanto'", "'se'",
  1099. "'senao'", "'falso'", "'verdadeiro'",
  1100. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1101. "','", "'='", null, null, null, null,
  1102. null, "':'" ];
  1103. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1104. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1105. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1106. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1107. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1108. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1109. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1110. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1111. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1112. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1113. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1114. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1115. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1116. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1117. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1118. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1119. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1120. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1121. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1122. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1123. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1124. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1125. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1126. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1127. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1128. "STRING", "STRING_CHARACTER", "CHARACTER",
  1129. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1130. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1131. "COMMENTS" ];
  1132. ivprog.prototype.grammarFileName = "ivprog.g4";
  1133. exports.ivprog = ivprog;
  1134. /***/ }),
  1135. /* 1 */
  1136. /***/ (function(module, exports, __webpack_require__) {
  1137. module.exports = {
  1138. ivprog: __webpack_require__(0).ivprog
  1139. };
  1140. /***/ }),
  1141. /* 2 */
  1142. /***/ (function(module, exports) {
  1143. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1144. /***/ })
  1145. /******/ ]);
  1146. /***/ }),
  1147. /***/ "./grammar/es/langFunctions.js":
  1148. /*!*************************************!*\
  1149. !*** ./grammar/es/langFunctions.js ***!
  1150. \*************************************/
  1151. /*! exports provided: default */
  1152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1153. "use strict";
  1154. __webpack_require__.r(__webpack_exports__);
  1155. /* This is a dictionary of the language defined functions
  1156. **/
  1157. /* harmony default export */ __webpack_exports__["default"] = ({
  1158. main_function: "inicio",
  1159. $read: "leia",
  1160. $write: "escreva",
  1161. $numElements: "total_of_elements",
  1162. $matrixLines: "total_of_lines",
  1163. $matrixColumns: "total_of_columns",
  1164. $substring: "subcadeia",
  1165. $length: "comprimento",
  1166. $uppercase: "caixa_alta",
  1167. $lowercase: "caixa_baixa",
  1168. $charAt: "char_at",
  1169. $isReal: "is_real",
  1170. $isInt: "is_integer",
  1171. $isBool: "is_logic",
  1172. $castReal: "to_real",
  1173. $castInt: "to_integer",
  1174. $castBool: "to_logic",
  1175. $castString: "to_string",
  1176. $sin: "sin",
  1177. $cos: "cos",
  1178. $tan: "tan",
  1179. $sqrt: "sqrt",
  1180. $pow: "pow",
  1181. $log: "log",
  1182. $abs: "abs",
  1183. $negate: "negate",
  1184. $invert: "invert",
  1185. $max: "maximum",
  1186. $min: "minimum"
  1187. });
  1188. /***/ }),
  1189. /***/ "./grammar/es/langLibs.js":
  1190. /*!********************************!*\
  1191. !*** ./grammar/es/langLibs.js ***!
  1192. \********************************/
  1193. /*! exports provided: default */
  1194. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1195. "use strict";
  1196. __webpack_require__.r(__webpack_exports__);
  1197. /**
  1198. * This is the dictionary of the language defined libraries
  1199. */
  1200. /* harmony default export */ __webpack_exports__["default"] = ({
  1201. $mathLib: "Mathematic",
  1202. $ioLib: "ES",
  1203. $strLib: "Texto",
  1204. $arrayLib: "Arranjo",
  1205. $langLib: "Conversion"
  1206. });
  1207. /***/ }),
  1208. /***/ "./grammar/index.js":
  1209. /*!**************************!*\
  1210. !*** ./grammar/index.js ***!
  1211. \**************************/
  1212. /*! exports provided: default */
  1213. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1214. "use strict";
  1215. __webpack_require__.r(__webpack_exports__);
  1216. /* harmony import */ var _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1217. /* harmony import */ var _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__);
  1218. /* harmony import */ var _pt_langFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1219. /* harmony import */ var _pt_langLibs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1220. /* harmony import */ var _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1221. /* harmony import */ var _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__);
  1222. /* harmony import */ var _en_langFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1223. /* harmony import */ var _en_langLibs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1224. /* harmony import */ var _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1225. /* harmony import */ var _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__);
  1226. /* harmony import */ var _es_langFunctions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1227. /* harmony import */ var _es_langLibs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1228. /* harmony default export */ __webpack_exports__["default"] = ({
  1229. pt: {
  1230. lexer: _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__["ivprog"],
  1231. langFuncs: _pt_langFunctions__WEBPACK_IMPORTED_MODULE_1__["default"],
  1232. langLibs: _pt_langLibs__WEBPACK_IMPORTED_MODULE_2__["default"]
  1233. },
  1234. en: {
  1235. lexer: _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__["ivprog"],
  1236. langFuncs: _en_langFunctions__WEBPACK_IMPORTED_MODULE_4__["default"],
  1237. langLibs: _en_langLibs__WEBPACK_IMPORTED_MODULE_5__["default"]
  1238. },
  1239. es: {
  1240. lexer: _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__["ivprog"],
  1241. langFuncs: _es_langFunctions__WEBPACK_IMPORTED_MODULE_7__["default"],
  1242. langLibs: _es_langLibs__WEBPACK_IMPORTED_MODULE_8__["default"]
  1243. }
  1244. });
  1245. /***/ }),
  1246. /***/ "./grammar/pt/ivprog.g4":
  1247. /*!******************************!*\
  1248. !*** ./grammar/pt/ivprog.g4 ***!
  1249. \******************************/
  1250. /*! no static exports found */
  1251. /***/ (function(module, exports, __webpack_require__) {
  1252. module.exports =
  1253. /******/ (function(modules) { // webpackBootstrap
  1254. /******/ // The module cache
  1255. /******/ var installedModules = {};
  1256. /******/
  1257. /******/ // The require function
  1258. /******/ function __webpack_require__(moduleId) {
  1259. /******/
  1260. /******/ // Check if module is in cache
  1261. /******/ if(installedModules[moduleId]) {
  1262. /******/ return installedModules[moduleId].exports;
  1263. /******/ }
  1264. /******/ // Create a new module (and put it into the cache)
  1265. /******/ var module = installedModules[moduleId] = {
  1266. /******/ i: moduleId,
  1267. /******/ l: false,
  1268. /******/ exports: {}
  1269. /******/ };
  1270. /******/
  1271. /******/ // Execute the module function
  1272. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1273. /******/
  1274. /******/ // Flag the module as loaded
  1275. /******/ module.l = true;
  1276. /******/
  1277. /******/ // Return the exports of the module
  1278. /******/ return module.exports;
  1279. /******/ }
  1280. /******/
  1281. /******/
  1282. /******/ // expose the modules object (__webpack_modules__)
  1283. /******/ __webpack_require__.m = modules;
  1284. /******/
  1285. /******/ // expose the module cache
  1286. /******/ __webpack_require__.c = installedModules;
  1287. /******/
  1288. /******/ // identity function for calling harmony imports with the correct context
  1289. /******/ __webpack_require__.i = function(value) { return value; };
  1290. /******/
  1291. /******/ // define getter function for harmony exports
  1292. /******/ __webpack_require__.d = function(exports, name, getter) {
  1293. /******/ if(!__webpack_require__.o(exports, name)) {
  1294. /******/ Object.defineProperty(exports, name, {
  1295. /******/ configurable: false,
  1296. /******/ enumerable: true,
  1297. /******/ get: getter
  1298. /******/ });
  1299. /******/ }
  1300. /******/ };
  1301. /******/
  1302. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1303. /******/ __webpack_require__.n = function(module) {
  1304. /******/ var getter = module && module.__esModule ?
  1305. /******/ function getDefault() { return module['default']; } :
  1306. /******/ function getModuleExports() { return module; };
  1307. /******/ __webpack_require__.d(getter, 'a', getter);
  1308. /******/ return getter;
  1309. /******/ };
  1310. /******/
  1311. /******/ // Object.prototype.hasOwnProperty.call
  1312. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1313. /******/
  1314. /******/ // __webpack_public_path__
  1315. /******/ __webpack_require__.p = "";
  1316. /******/
  1317. /******/ // Load entry module and return exports
  1318. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1319. /******/ })
  1320. /************************************************************************/
  1321. /******/ ([
  1322. /* 0 */
  1323. /***/ (function(module, exports, __webpack_require__) {
  1324. // Generated from /tmp/tmp-10202IpGkGRDUSoaJ/ivprog.g4 by ANTLR 4.7
  1325. // jshint ignore: start
  1326. var antlr4 = __webpack_require__(2);
  1327. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1328. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1329. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1330. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1331. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1332. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1333. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1334. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1335. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1336. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1337. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1338. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1339. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1340. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1341. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1342. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1343. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1344. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1345. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1346. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1347. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1348. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1349. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1350. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1351. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1352. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1353. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1354. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1355. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1356. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1357. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1358. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1359. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1360. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1361. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1362. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1363. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1364. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1365. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1366. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1367. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1368. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1369. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1370. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1371. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1372. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1373. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1374. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1375. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1376. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1377. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1378. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1379. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1380. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1381. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1382. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1383. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1384. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1385. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1386. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1387. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1388. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1389. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1390. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1391. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1392. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1393. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1394. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1395. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1396. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1397. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1398. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1399. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1400. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1401. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1402. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1403. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1404. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1405. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1406. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1407. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1408. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1409. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1410. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1411. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1412. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1413. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1414. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1415. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1416. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1417. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1418. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1419. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1420. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1421. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1422. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1423. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1424. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1425. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1426. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1427. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1428. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1429. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1430. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1431. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1432. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1433. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1434. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1435. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1436. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1437. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1438. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1439. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1440. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1441. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1442. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1443. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1444. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1445. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1446. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1447. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1448. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1449. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1450. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1451. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1452. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1453. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1454. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1455. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1456. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1457. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1458. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1459. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1460. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1461. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1462. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1463. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1464. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1465. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1466. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1467. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1468. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1469. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1470. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1471. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1472. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1473. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1474. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1475. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1476. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1477. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1478. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1479. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1480. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1481. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1482. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1483. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1484. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1485. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1486. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1487. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1488. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1489. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1490. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1491. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1492. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1493. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1494. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1495. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1496. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1497. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1498. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1499. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1500. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1501. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1502. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1503. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1504. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1505. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1506. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1507. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1508. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1509. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1510. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1511. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1512. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1513. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1514. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1515. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1516. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1517. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1518. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1519. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1520. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1521. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1522. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1523. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1524. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1525. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1526. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1527. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1528. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1529. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1530. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1531. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1532. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1533. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1534. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1535. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1536. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1537. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1538. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1539. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1540. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1541. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1542. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1543. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1544. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1545. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1546. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1547. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1548. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1549. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1550. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1551. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1552. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1553. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1554. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1555. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1556. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1557. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1558. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1559. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1560. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1561. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1562. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1563. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1564. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1565. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1566. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1567. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1568. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1569. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1570. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1571. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1572. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1573. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1574. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1575. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1576. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1577. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1578. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1579. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1580. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1581. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1582. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1583. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1584. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1585. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1586. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1587. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1588. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1589. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1590. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1591. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1592. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1593. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1594. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1595. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1596. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1597. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1598. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1599. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1600. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1601. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1602. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1603. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1604. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1605. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1606. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1607. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1608. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1609. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1610. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1611. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1612. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1613. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1614. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1615. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1616. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1617. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1618. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1619. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1620. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1621. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1622. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1623. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1624. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1625. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1626. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1627. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1628. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1629. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1630. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1631. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1632. function ivprog(input) {
  1633. antlr4.Lexer.call(this, input);
  1634. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1635. return this;
  1636. }
  1637. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1638. ivprog.prototype.constructor = ivprog;
  1639. ivprog.EOF = antlr4.Token.EOF;
  1640. ivprog.RK_PROGRAM = 1;
  1641. ivprog.RK_REAL = 2;
  1642. ivprog.RK_VOID = 3;
  1643. ivprog.RK_BOOLEAN = 4;
  1644. ivprog.RK_STRING = 5;
  1645. ivprog.RK_INTEGER = 6;
  1646. ivprog.RK_CHARACTER = 7;
  1647. ivprog.RK_SWITCH = 8;
  1648. ivprog.RK_CASE = 9;
  1649. ivprog.RK_DEFAULT = 10;
  1650. ivprog.RK_CONST = 11;
  1651. ivprog.RK_FUNCTION = 12;
  1652. ivprog.RK_RETURN = 13;
  1653. ivprog.RK_FOR = 14;
  1654. ivprog.RK_BREAK = 15;
  1655. ivprog.RK_DO = 16;
  1656. ivprog.RK_WHILE = 17;
  1657. ivprog.RK_IF = 18;
  1658. ivprog.RK_ELSE = 19;
  1659. ivprog.RK_FALSE = 20;
  1660. ivprog.RK_TRUE = 21;
  1661. ivprog.OPEN_PARENTHESIS = 22;
  1662. ivprog.CLOSE_PARENTHESIS = 23;
  1663. ivprog.OPEN_BRACE = 24;
  1664. ivprog.CLOSE_BRACE = 25;
  1665. ivprog.OPEN_CURLY = 26;
  1666. ivprog.CLOSE_CURLY = 27;
  1667. ivprog.COMMA = 28;
  1668. ivprog.EQUAL = 29;
  1669. ivprog.SUM_OP = 30;
  1670. ivprog.MULTI_OP = 31;
  1671. ivprog.AND_OPERATOR = 32;
  1672. ivprog.OR_OPERATOR = 33;
  1673. ivprog.RELATIONAL_OPERATOR = 34;
  1674. ivprog.COLON = 35;
  1675. ivprog.NOT_OPERATOR = 36;
  1676. ivprog.ID = 37;
  1677. ivprog.LIB_ID = 38;
  1678. ivprog.INTEGER = 39;
  1679. ivprog.REAL = 40;
  1680. ivprog.STRING = 41;
  1681. ivprog.CHARACTER = 42;
  1682. ivprog.WHITESPACE = 43;
  1683. ivprog.EOS = 44;
  1684. ivprog.COMMENTS = 45;
  1685. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1686. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1687. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1688. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1689. "'escolha'", "'caso'", "'contrario'",
  1690. "'const'", "'funcao'", "'retorne'", "'para'",
  1691. "'pare'", "'faca'", "'enquanto'", "'se'",
  1692. "'senao'", "'falso'", "'verdadeiro'",
  1693. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1694. "','", "'='", null, null, null, null,
  1695. null, "':'" ];
  1696. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1697. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1698. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1699. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1700. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1701. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1702. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1703. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1704. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1705. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1706. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1707. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1708. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1709. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1710. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1711. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1712. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1713. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1714. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1715. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1716. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1717. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1718. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1719. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1720. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1721. "STRING", "STRING_CHARACTER", "CHARACTER",
  1722. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1723. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1724. "COMMENTS" ];
  1725. ivprog.prototype.grammarFileName = "ivprog.g4";
  1726. exports.ivprog = ivprog;
  1727. /***/ }),
  1728. /* 1 */
  1729. /***/ (function(module, exports, __webpack_require__) {
  1730. module.exports = {
  1731. ivprog: __webpack_require__(0).ivprog
  1732. };
  1733. /***/ }),
  1734. /* 2 */
  1735. /***/ (function(module, exports) {
  1736. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1737. /***/ })
  1738. /******/ ]);
  1739. /***/ }),
  1740. /***/ "./grammar/pt/langFunctions.js":
  1741. /*!*************************************!*\
  1742. !*** ./grammar/pt/langFunctions.js ***!
  1743. \*************************************/
  1744. /*! exports provided: default */
  1745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1746. "use strict";
  1747. __webpack_require__.r(__webpack_exports__);
  1748. /* This is a dictionary of the language defined functions
  1749. **/
  1750. /* harmony default export */ __webpack_exports__["default"] = ({
  1751. main_function: "inicio",
  1752. $read: "leia",
  1753. $write: "escreva",
  1754. $numElements: "total_de_elementos",
  1755. $matrixLines: "total_de_linhas",
  1756. $matrixColumns: "total_de_colunas",
  1757. $substring: "subcadeia",
  1758. $length: "comprimento",
  1759. $uppercase: "caixa_alta",
  1760. $lowercase: "caixa_baixa",
  1761. $charAt: "texto_na_posicao",
  1762. $isReal: "e_real",
  1763. $isInt: "e_inteiro",
  1764. $isBool: "e_logico",
  1765. $castReal: "como_real",
  1766. $castInt: "como_inteiro",
  1767. $castBool: "como_logico",
  1768. $castString: "como_cadeia",
  1769. $sin: "seno",
  1770. $cos: "cosseno",
  1771. $tan: "tangente",
  1772. $sqrt: "raiz_quadrada",
  1773. $pow: "potencia",
  1774. $log: "logaritmo",
  1775. $abs: "modulo",
  1776. $negate: "trocar_sinal",
  1777. $invert: "inverter_valor",
  1778. $max: "maximo",
  1779. $min: "minimo"
  1780. });
  1781. /***/ }),
  1782. /***/ "./grammar/pt/langLibs.js":
  1783. /*!********************************!*\
  1784. !*** ./grammar/pt/langLibs.js ***!
  1785. \********************************/
  1786. /*! exports provided: default */
  1787. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1788. "use strict";
  1789. __webpack_require__.r(__webpack_exports__);
  1790. /**
  1791. * This is the dictionary of the language defined libraries
  1792. */
  1793. /* harmony default export */ __webpack_exports__["default"] = ({
  1794. $mathLib: "Matematica",
  1795. $ioLib: "ES",
  1796. $strLib: "Texto",
  1797. $arrayLib: "Arranjo",
  1798. $langLib: "Conversao"
  1799. });
  1800. /***/ }),
  1801. /***/ "./i18n/en/error.json":
  1802. /*!****************************!*\
  1803. !*** ./i18n/en/error.json ***!
  1804. \****************************/
  1805. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, default */
  1806. /***/ (function(module) {
  1807. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1"};
  1808. /***/ }),
  1809. /***/ "./i18n/en/index.js":
  1810. /*!**************************!*\
  1811. !*** ./i18n/en/index.js ***!
  1812. \**************************/
  1813. /*! exports provided: default */
  1814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1815. "use strict";
  1816. __webpack_require__.r(__webpack_exports__);
  1817. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1818. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/en/error.json", 1);
  1819. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1820. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/en/message.json", 1);
  1821. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1822. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/en/ui.json", 1);
  1823. /* harmony default export */ __webpack_exports__["default"] = ({
  1824. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1825. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1826. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1827. });
  1828. /***/ }),
  1829. /***/ "./i18n/en/message.json":
  1830. /*!******************************!*\
  1831. !*** ./i18n/en/message.json ***!
  1832. \******************************/
  1833. /*! exports provided: test_case_success, test_case_duration, default */
  1834. /***/ (function(module) {
  1835. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  1836. /***/ }),
  1837. /***/ "./i18n/en/ui.json":
  1838. /*!*************************!*\
  1839. !*** ./i18n/en/ui.json ***!
  1840. \*************************/
  1841. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1842. /***/ (function(module) {
  1843. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"string","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Relational Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","math":"Mathematic","text_t":"Text","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1844. /***/ }),
  1845. /***/ "./i18n/es/error.json":
  1846. /*!****************************!*\
  1847. !*** ./i18n/es/error.json ***!
  1848. \****************************/
  1849. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, default */
  1850. /***/ (function(module) {
  1851. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1"};
  1852. /***/ }),
  1853. /***/ "./i18n/es/index.js":
  1854. /*!**************************!*\
  1855. !*** ./i18n/es/index.js ***!
  1856. \**************************/
  1857. /*! exports provided: default */
  1858. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1859. "use strict";
  1860. __webpack_require__.r(__webpack_exports__);
  1861. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1862. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/es/error.json", 1);
  1863. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1864. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/es/message.json", 1);
  1865. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1866. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/es/ui.json", 1);
  1867. /* harmony default export */ __webpack_exports__["default"] = ({
  1868. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1869. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1870. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1871. });
  1872. /***/ }),
  1873. /***/ "./i18n/es/message.json":
  1874. /*!******************************!*\
  1875. !*** ./i18n/es/message.json ***!
  1876. \******************************/
  1877. /*! exports provided: test_case_success, test_case_duration, default */
  1878. /***/ (function(module) {
  1879. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  1880. /***/ }),
  1881. /***/ "./i18n/es/ui.json":
  1882. /*!*************************!*\
  1883. !*** ./i18n/es/ui.json ***!
  1884. \*************************/
  1885. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1886. /***/ (function(module) {
  1887. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"string","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Relational Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","math":"Mathematic","text_t":"Text","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1888. /***/ }),
  1889. /***/ "./i18n/index.js":
  1890. /*!***********************!*\
  1891. !*** ./i18n/index.js ***!
  1892. \***********************/
  1893. /*! exports provided: default */
  1894. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1895. "use strict";
  1896. __webpack_require__.r(__webpack_exports__);
  1897. /* harmony import */ var _en__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1898. /* harmony import */ var _pt__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1899. /* harmony import */ var _es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1900. /* harmony default export */ __webpack_exports__["default"] = ({
  1901. 'en': _en__WEBPACK_IMPORTED_MODULE_0__["default"],
  1902. 'pt': _pt__WEBPACK_IMPORTED_MODULE_1__["default"],
  1903. 'es': _es__WEBPACK_IMPORTED_MODULE_2__["default"]
  1904. });
  1905. /***/ }),
  1906. /***/ "./i18n/pt/error.json":
  1907. /*!****************************!*\
  1908. !*** ./i18n/pt/error.json ***!
  1909. \****************************/
  1910. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, invalid_type_conversion, default */
  1911. /***/ (function(module) {
  1912. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: <ul> <li>entrada(s): $1</li> <li>saída(s) esperada(s): $2</li> <li>saída(s): $3</li></ul>","test_case_failed_exception":"Caso de teste $0 falhou: $1","invalid_type_conversion":"O valor $0 não pode ser convertido para o tipo $1"};
  1913. /***/ }),
  1914. /***/ "./i18n/pt/index.js":
  1915. /*!**************************!*\
  1916. !*** ./i18n/pt/index.js ***!
  1917. \**************************/
  1918. /*! exports provided: default */
  1919. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1920. "use strict";
  1921. __webpack_require__.r(__webpack_exports__);
  1922. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1923. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/pt/error.json", 1);
  1924. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1925. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/pt/message.json", 1);
  1926. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1927. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/pt/ui.json", 1);
  1928. /* harmony default export */ __webpack_exports__["default"] = ({
  1929. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1930. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1931. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1932. });
  1933. /***/ }),
  1934. /***/ "./i18n/pt/message.json":
  1935. /*!******************************!*\
  1936. !*** ./i18n/pt/message.json ***!
  1937. \******************************/
  1938. /*! exports provided: test_case_success, test_case_duration, test_suite_grade, default */
  1939. /***/ (function(module) {
  1940. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms","test_suite_grade":"A sua solução alcançou $0% da nota."};
  1941. /***/ }),
  1942. /***/ "./i18n/pt/ui.json":
  1943. /*!*************************!*\
  1944. !*** ./i18n/pt/ui.json ***!
  1945. \*************************/
  1946. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, and, or, not, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_return, text_btn_return, text_comment, join_or, matrix_string, vector_string, text_attribution, text_if, text_break, text_else, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1947. /***/ (function(module) {
  1948. module.exports = {"function":"funcao","btn_clear":"Limpar","btn_function":"Função","btn_arithmetic_plus":"Adição","btn_arithmetic_minus":"Subtração","btn_arithmetic_multiplication":"Multiplicação","btn_arithmetic_division":"Divisão","btn_arithmetic_module":"Módulo","btn_break":"Pare","btn_case":"Caso","start":"inicio","void":"vazio","integer":"inteiro","and":"E","or":"OU","not":"nao","real":"real","program":"programa","text":"cadeia","text_start":"texto","boolean":"logico","true":"verdadeiro","false":"falso","variable":"Variável","command":"Comando","new_parameter":"novo_parametro","new_variable":"nova_variavel","new_global":"nova_global","new_function":"nova_funcao","vector":"vetor","text_comment_start":"Comentário inicial da função...","text_comment_main":"Esta é a função principal...","text_read_var":"Leitura de dados","text_write_var":"Escrita de dados","text_command_read":"leia","text_command_write":"escreva","text_return":"retorne","text_btn_return":"Retorno","text_comment":"Comentário","join_or":"ou","matrix_string":"matriz de $0","vector_string":"vetor de $0","text_attribution":"Atribuição","text_if":"se","text_break":"pare","text_else":"senao","text_for":"para","text_code_while":"enquanto","text_code_do":"faca","text_command_do":"faça","text_code_switch":"escolha","text_code_case":"caso","text_logic_expression":"Expressão Lógica","text_arithmetic_expression":"Expressão Relacional","text_iftrue":"Se verdadeiro então","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Faça enquanto verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","text_header_ivprog_functions":"Funções do iVProg","text_menu_functions_math":"Matemática","text_menu_functions_text":"Texto","text_menu_functions_arrangement":"Arranjo","text_menu_functions_conversion":"Conversão","text_none_variable":"Nenhuma variável declarada","text_none_variable_instruction":"Antes de utilizar uma variável, é necessário criá-la","text_ivprog_description":"Programação Visual interativa na Internet","tooltip_visual":"Programação visual","tooltip_textual":"Programação textual","tooltip_upload":"Upload de código fonte","tooltip_download":"Download do código fonte","tooltip_undo":"Desfazer","tooltip_redo":"Refazer","tooltip_run":"Executar o programa","tooltip_evaluate":"Avaliar o programa","tooltip_help":"Ajuda","tooltip_add_global":"Adicionar variável global","tooltip_minimize":"Ocultar os elementos da função","tooltip_console":"Abrir/fechar o terminal","var_menu_select_var":"Selecione uma variável","var_menu_select_all":"Selecione","var_menu_select_function":"Selecione uma função","expression_menu_select":"Construir uma expressão lógica","math":"Matematica","text_t":"Texto","inform_valid_name":"Informe um nome válido!","inform_valid_content":"Informe o conteúdo!","inform_valid_expression":"Construa uma expressão lógica!","inform_valid_name_duplicated":"Este nome já está em uso por outra função!","inform_valid_global_duplicated":"Já existe uma variável global com o nome informado.","inform_valid_variable_duplicated":"Já existe uma variável local com o nome informado.","arrangement":"Arranjo","conversion":"Conversao","$sin":"seno","$cos":"cosseno","$tan":"tangente","$sqrt":"raiz_quadrada","$pow":"potencia","$log":"logaritmo","$abs":"modulo","$negate":"trocar_sinal","$invert":"inverter_valor","$max":"maximo","$min":"minimo","$substring":"subcadeia","$length":"comprimento","$uppercase":"caixa_alta","$lowercase":"caixa_baixa","$charAt":"texto_na_posicao","$numElements":"total_de_elementos","$matrixLines":"total_de_linhas","$matrixColumns":"total_de_colunas","$isReal":"e_real","$isInt":"e_inteiro","$isBool":"e_logico","$castReal":"como_real","$castInt":"como_inteiro","$castBool":"como_logico","$castString":"como_cadeia","text_ivprog_version":"Versão"};
  1949. /***/ }),
  1950. /***/ "./js/Sortable.js":
  1951. /*!************************!*\
  1952. !*** ./js/Sortable.js ***!
  1953. \************************/
  1954. /*! no static exports found */
  1955. /***/ (function(module, exports, __webpack_require__) {
  1956. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  1957. /**!
  1958. * Sortable
  1959. * @author RubaXa <trash@rubaxa.org>
  1960. * @license MIT
  1961. */
  1962. (function sortableModule(factory) {
  1963. "use strict";
  1964. if (true) {
  1965. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1966. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1967. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1968. __WEBPACK_AMD_DEFINE_FACTORY__),
  1969. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1970. } else {}
  1971. })(function sortableFactory() {
  1972. "use strict";
  1973. if (typeof window == "undefined" || !window.document) {
  1974. return function sortableError() {
  1975. throw new Error("Sortable.js requires a window with a document");
  1976. };
  1977. }
  1978. var dragEl,
  1979. parentEl,
  1980. ghostEl,
  1981. cloneEl,
  1982. rootEl,
  1983. nextEl,
  1984. lastDownEl,
  1985. scrollEl,
  1986. scrollParentEl,
  1987. scrollCustomFn,
  1988. lastEl,
  1989. lastCSS,
  1990. lastParentCSS,
  1991. oldIndex,
  1992. newIndex,
  1993. activeGroup,
  1994. putSortable,
  1995. autoScroll = {},
  1996. tapEvt,
  1997. touchEvt,
  1998. moved,
  1999. /** @const */
  2000. R_SPACE = /\s+/g,
  2001. R_FLOAT = /left|right|inline/,
  2002. expando = 'Sortable' + new Date().getTime(),
  2003. win = window,
  2004. document = win.document,
  2005. parseInt = win.parseInt,
  2006. $ = win.jQuery || win.Zepto,
  2007. Polymer = win.Polymer,
  2008. captureMode = false,
  2009. supportDraggable = !!('draggable' in document.createElement('div')),
  2010. supportCssPointerEvents = function (el) {
  2011. // false when IE11
  2012. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2013. return false;
  2014. }
  2015. el = document.createElement('x');
  2016. el.style.cssText = 'pointer-events:auto';
  2017. return el.style.pointerEvents === 'auto';
  2018. }(),
  2019. _silent = false,
  2020. abs = Math.abs,
  2021. min = Math.min,
  2022. savedInputChecked = [],
  2023. touchDragOverListeners = [],
  2024. _autoScroll = _throttle(function (
  2025. /**Event*/
  2026. evt,
  2027. /**Object*/
  2028. options,
  2029. /**HTMLElement*/
  2030. rootEl) {
  2031. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2032. if (rootEl && options.scroll) {
  2033. var _this = rootEl[expando],
  2034. el,
  2035. rect,
  2036. sens = options.scrollSensitivity,
  2037. speed = options.scrollSpeed,
  2038. x = evt.clientX,
  2039. y = evt.clientY,
  2040. winWidth = window.innerWidth,
  2041. winHeight = window.innerHeight,
  2042. vx,
  2043. vy,
  2044. scrollOffsetX,
  2045. scrollOffsetY; // Delect scrollEl
  2046. if (scrollParentEl !== rootEl) {
  2047. scrollEl = options.scroll;
  2048. scrollParentEl = rootEl;
  2049. scrollCustomFn = options.scrollFn;
  2050. if (scrollEl === true) {
  2051. scrollEl = rootEl;
  2052. do {
  2053. if (scrollEl.offsetWidth < scrollEl.scrollWidth || scrollEl.offsetHeight < scrollEl.scrollHeight) {
  2054. break;
  2055. }
  2056. /* jshint boss:true */
  2057. } while (scrollEl = scrollEl.parentNode);
  2058. }
  2059. }
  2060. if (scrollEl) {
  2061. el = scrollEl;
  2062. rect = scrollEl.getBoundingClientRect();
  2063. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  2064. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  2065. }
  2066. if (!(vx || vy)) {
  2067. vx = (winWidth - x <= sens) - (x <= sens);
  2068. vy = (winHeight - y <= sens) - (y <= sens);
  2069. /* jshint expr:true */
  2070. (vx || vy) && (el = win);
  2071. }
  2072. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  2073. autoScroll.el = el;
  2074. autoScroll.vx = vx;
  2075. autoScroll.vy = vy;
  2076. clearInterval(autoScroll.pid);
  2077. if (el) {
  2078. autoScroll.pid = setInterval(function () {
  2079. scrollOffsetY = vy ? vy * speed : 0;
  2080. scrollOffsetX = vx ? vx * speed : 0;
  2081. if ('function' === typeof scrollCustomFn) {
  2082. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  2083. }
  2084. if (el === win) {
  2085. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  2086. } else {
  2087. el.scrollTop += scrollOffsetY;
  2088. el.scrollLeft += scrollOffsetX;
  2089. }
  2090. }, 24);
  2091. }
  2092. }
  2093. }
  2094. }, 30),
  2095. _prepareGroup = function _prepareGroup(options) {
  2096. function toFn(value, pull) {
  2097. if (value === void 0 || value === true) {
  2098. value = group.name;
  2099. }
  2100. if (typeof value === 'function') {
  2101. return value;
  2102. } else {
  2103. return function (to, from) {
  2104. var fromGroup = from.options.group.name;
  2105. return pull ? value : value && (value.join ? value.indexOf(fromGroup) > -1 : fromGroup == value);
  2106. };
  2107. }
  2108. }
  2109. var group = {};
  2110. var originalGroup = options.group;
  2111. if (!originalGroup || _typeof(originalGroup) != 'object') {
  2112. originalGroup = {
  2113. name: originalGroup
  2114. };
  2115. }
  2116. group.name = originalGroup.name;
  2117. group.checkPull = toFn(originalGroup.pull, true);
  2118. group.checkPut = toFn(originalGroup.put);
  2119. group.revertClone = originalGroup.revertClone;
  2120. options.group = group;
  2121. };
  2122. /**
  2123. * @class Sortable
  2124. * @param {HTMLElement} el
  2125. * @param {Object} [options]
  2126. */
  2127. function Sortable(el, options) {
  2128. if (!(el && el.nodeType && el.nodeType === 1)) {
  2129. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2130. }
  2131. this.el = el; // root element
  2132. this.options = options = _extend({}, options); // Export instance
  2133. el[expando] = this; // Default options
  2134. var defaults = {
  2135. group: Math.random(),
  2136. sort: true,
  2137. disabled: false,
  2138. store: null,
  2139. handle: null,
  2140. scroll: true,
  2141. scrollSensitivity: 30,
  2142. scrollSpeed: 10,
  2143. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  2144. ghostClass: 'sortable-ghost',
  2145. chosenClass: 'sortable-chosen',
  2146. dragClass: 'sortable-drag',
  2147. ignore: 'a, img',
  2148. filter: null,
  2149. preventOnFilter: true,
  2150. animation: 0,
  2151. setData: function setData(dataTransfer, dragEl) {
  2152. dataTransfer.setData('Text', dragEl.textContent);
  2153. },
  2154. dropBubble: false,
  2155. dragoverBubble: false,
  2156. dataIdAttr: 'data-id',
  2157. delay: 0,
  2158. forceFallback: false,
  2159. fallbackClass: 'sortable-fallback',
  2160. fallbackOnBody: false,
  2161. fallbackTolerance: 0,
  2162. fallbackOffset: {
  2163. x: 0,
  2164. y: 0
  2165. }
  2166. }; // Set default options
  2167. for (var name in defaults) {
  2168. !(name in options) && (options[name] = defaults[name]);
  2169. }
  2170. _prepareGroup(options); // Bind all private methods
  2171. for (var fn in this) {
  2172. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2173. this[fn] = this[fn].bind(this);
  2174. }
  2175. } // Setup drag mode
  2176. this.nativeDraggable = options.forceFallback ? false : supportDraggable; // Bind events
  2177. _on(el, 'mousedown', this._onTapStart);
  2178. _on(el, 'touchstart', this._onTapStart);
  2179. _on(el, 'pointerdown', this._onTapStart);
  2180. if (this.nativeDraggable) {
  2181. _on(el, 'dragover', this);
  2182. _on(el, 'dragenter', this);
  2183. }
  2184. touchDragOverListeners.push(this._onDragOver); // Restore sorting
  2185. options.store && this.sort(options.store.get(this));
  2186. }
  2187. Sortable.prototype =
  2188. /** @lends Sortable.prototype */
  2189. {
  2190. constructor: Sortable,
  2191. _onTapStart: function _onTapStart(
  2192. /** Event|TouchEvent */
  2193. evt) {
  2194. var _this = this,
  2195. el = this.el,
  2196. options = this.options,
  2197. preventOnFilter = options.preventOnFilter,
  2198. type = evt.type,
  2199. touch = evt.touches && evt.touches[0],
  2200. target = (touch || evt).target,
  2201. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2202. filter = options.filter,
  2203. startIndex;
  2204. _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2205. if (dragEl) {
  2206. return;
  2207. }
  2208. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2209. return; // only left button or enabled
  2210. }
  2211. target = _closest(target, options.draggable, el);
  2212. if (!target) {
  2213. return;
  2214. }
  2215. if (lastDownEl === target) {
  2216. // Ignoring duplicate `down`
  2217. return;
  2218. } // Get the index of the dragged element within its parent
  2219. startIndex = _index(target, options.draggable); // Check filter
  2220. if (typeof filter === 'function') {
  2221. if (filter.call(this, evt, target, this)) {
  2222. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2223. preventOnFilter && evt.preventDefault();
  2224. return; // cancel dnd
  2225. }
  2226. } else if (filter) {
  2227. filter = filter.split(',').some(function (criteria) {
  2228. criteria = _closest(originalTarget, criteria.trim(), el);
  2229. if (criteria) {
  2230. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2231. return true;
  2232. }
  2233. });
  2234. if (filter) {
  2235. preventOnFilter && evt.preventDefault();
  2236. return; // cancel dnd
  2237. }
  2238. }
  2239. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2240. return;
  2241. } // Prepare `dragstart`
  2242. this._prepareDragStart(evt, touch, target, startIndex);
  2243. },
  2244. _prepareDragStart: function _prepareDragStart(
  2245. /** Event */
  2246. evt,
  2247. /** Touch */
  2248. touch,
  2249. /** HTMLElement */
  2250. target,
  2251. /** Number */
  2252. startIndex) {
  2253. var _this = this,
  2254. el = _this.el,
  2255. options = _this.options,
  2256. ownerDocument = el.ownerDocument,
  2257. dragStartFn;
  2258. if (target && !dragEl && target.parentNode === el) {
  2259. tapEvt = evt;
  2260. rootEl = el;
  2261. dragEl = target;
  2262. parentEl = dragEl.parentNode;
  2263. nextEl = dragEl.nextSibling;
  2264. lastDownEl = target;
  2265. activeGroup = options.group;
  2266. oldIndex = startIndex;
  2267. this._lastX = (touch || evt).clientX;
  2268. this._lastY = (touch || evt).clientY;
  2269. dragEl.style['will-change'] = 'transform';
  2270. dragStartFn = function dragStartFn() {
  2271. // Delayed drag has been triggered
  2272. // we can re-enable the events: touchmove/mousemove
  2273. _this._disableDelayedDrag(); // Make the element draggable
  2274. dragEl.draggable = _this.nativeDraggable; // Chosen item
  2275. _toggleClass(dragEl, options.chosenClass, true); // Bind the events: dragstart/dragend
  2276. _this._triggerDragStart(evt, touch); // Drag start event
  2277. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2278. }; // Disable "draggable"
  2279. options.ignore.split(',').forEach(function (criteria) {
  2280. _find(dragEl, criteria.trim(), _disableDraggable);
  2281. });
  2282. _on(ownerDocument, 'mouseup', _this._onDrop);
  2283. _on(ownerDocument, 'touchend', _this._onDrop);
  2284. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2285. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2286. _on(ownerDocument, 'selectstart', _this);
  2287. if (options.delay) {
  2288. // If the user moves the pointer or let go the click or touch
  2289. // before the delay has been reached:
  2290. // disable the delayed drag
  2291. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2292. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2293. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2294. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2295. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2296. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2297. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2298. } else {
  2299. dragStartFn();
  2300. }
  2301. }
  2302. },
  2303. _disableDelayedDrag: function _disableDelayedDrag() {
  2304. var ownerDocument = this.el.ownerDocument;
  2305. clearTimeout(this._dragStartTimer);
  2306. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2307. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2308. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2309. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2310. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2311. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2312. },
  2313. _triggerDragStart: function _triggerDragStart(
  2314. /** Event */
  2315. evt,
  2316. /** Touch */
  2317. touch) {
  2318. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2319. if (touch) {
  2320. // Touch device support
  2321. tapEvt = {
  2322. target: dragEl,
  2323. clientX: touch.clientX,
  2324. clientY: touch.clientY
  2325. };
  2326. this._onDragStart(tapEvt, 'touch');
  2327. } else if (!this.nativeDraggable) {
  2328. this._onDragStart(tapEvt, true);
  2329. } else {
  2330. _on(dragEl, 'dragend', this);
  2331. _on(rootEl, 'dragstart', this._onDragStart);
  2332. }
  2333. try {
  2334. if (document.selection) {
  2335. // Timeout neccessary for IE9
  2336. setTimeout(function () {
  2337. document.selection.empty();
  2338. });
  2339. } else {
  2340. window.getSelection().removeAllRanges();
  2341. }
  2342. } catch (err) {}
  2343. },
  2344. _dragStarted: function _dragStarted() {
  2345. if (rootEl && dragEl) {
  2346. var options = this.options; // Apply effect
  2347. _toggleClass(dragEl, options.ghostClass, true);
  2348. _toggleClass(dragEl, options.dragClass, false);
  2349. Sortable.active = this; // Drag start event
  2350. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2351. } else {
  2352. this._nulling();
  2353. }
  2354. },
  2355. _emulateDragOver: function _emulateDragOver() {
  2356. if (touchEvt) {
  2357. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2358. return;
  2359. }
  2360. this._lastX = touchEvt.clientX;
  2361. this._lastY = touchEvt.clientY;
  2362. if (!supportCssPointerEvents) {
  2363. _css(ghostEl, 'display', 'none');
  2364. }
  2365. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2366. parent = target,
  2367. i = touchDragOverListeners.length;
  2368. if (parent) {
  2369. do {
  2370. if (parent[expando]) {
  2371. while (i--) {
  2372. touchDragOverListeners[i]({
  2373. clientX: touchEvt.clientX,
  2374. clientY: touchEvt.clientY,
  2375. target: target,
  2376. rootEl: parent
  2377. });
  2378. }
  2379. break;
  2380. }
  2381. target = parent; // store last element
  2382. }
  2383. /* jshint boss:true */
  2384. while (parent = parent.parentNode);
  2385. }
  2386. if (!supportCssPointerEvents) {
  2387. _css(ghostEl, 'display', '');
  2388. }
  2389. }
  2390. },
  2391. _onTouchMove: function _onTouchMove(
  2392. /**TouchEvent*/
  2393. evt) {
  2394. if (tapEvt) {
  2395. var options = this.options,
  2396. fallbackTolerance = options.fallbackTolerance,
  2397. fallbackOffset = options.fallbackOffset,
  2398. touch = evt.touches ? evt.touches[0] : evt,
  2399. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2400. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2401. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)'; // only set the status to dragging, when we are actually dragging
  2402. if (!Sortable.active) {
  2403. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2404. return;
  2405. }
  2406. this._dragStarted();
  2407. } // as well as creating the ghost element on the document body
  2408. this._appendGhost();
  2409. moved = true;
  2410. touchEvt = touch;
  2411. _css(ghostEl, 'webkitTransform', translate3d);
  2412. _css(ghostEl, 'mozTransform', translate3d);
  2413. _css(ghostEl, 'msTransform', translate3d);
  2414. _css(ghostEl, 'transform', translate3d);
  2415. evt.preventDefault();
  2416. }
  2417. },
  2418. _appendGhost: function _appendGhost() {
  2419. if (!ghostEl) {
  2420. var rect = dragEl.getBoundingClientRect(),
  2421. css = _css(dragEl),
  2422. options = this.options,
  2423. ghostRect;
  2424. ghostEl = dragEl.cloneNode(true);
  2425. _toggleClass(ghostEl, options.ghostClass, false);
  2426. _toggleClass(ghostEl, options.fallbackClass, true);
  2427. _toggleClass(ghostEl, options.dragClass, true);
  2428. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2429. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2430. _css(ghostEl, 'width', rect.width);
  2431. _css(ghostEl, 'height', rect.height);
  2432. _css(ghostEl, 'opacity', '0.8');
  2433. _css(ghostEl, 'position', 'fixed');
  2434. _css(ghostEl, 'zIndex', '100000');
  2435. _css(ghostEl, 'pointerEvents', 'none');
  2436. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl); // Fixing dimensions.
  2437. ghostRect = ghostEl.getBoundingClientRect();
  2438. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2439. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2440. }
  2441. },
  2442. _onDragStart: function _onDragStart(
  2443. /**Event*/
  2444. evt,
  2445. /**boolean*/
  2446. useFallback) {
  2447. var dataTransfer = evt.dataTransfer,
  2448. options = this.options;
  2449. this._offUpEvents();
  2450. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2451. cloneEl = _clone(dragEl);
  2452. cloneEl.draggable = false;
  2453. cloneEl.style['will-change'] = '';
  2454. _css(cloneEl, 'display', 'none');
  2455. _toggleClass(cloneEl, this.options.chosenClass, false);
  2456. rootEl.insertBefore(cloneEl, dragEl);
  2457. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2458. }
  2459. _toggleClass(dragEl, options.dragClass, true);
  2460. if (useFallback) {
  2461. if (useFallback === 'touch') {
  2462. // Bind touch events
  2463. _on(document, 'touchmove', this._onTouchMove);
  2464. _on(document, 'touchend', this._onDrop);
  2465. _on(document, 'touchcancel', this._onDrop);
  2466. _on(document, 'pointermove', this._onTouchMove);
  2467. _on(document, 'pointerup', this._onDrop);
  2468. } else {
  2469. // Old brwoser
  2470. _on(document, 'mousemove', this._onTouchMove);
  2471. _on(document, 'mouseup', this._onDrop);
  2472. }
  2473. this._loopId = setInterval(this._emulateDragOver, 50);
  2474. } else {
  2475. if (dataTransfer) {
  2476. dataTransfer.effectAllowed = 'move';
  2477. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2478. }
  2479. _on(document, 'drop', this);
  2480. setTimeout(this._dragStarted, 0);
  2481. }
  2482. },
  2483. _onDragOver: function _onDragOver(
  2484. /**Event*/
  2485. evt) {
  2486. var el = this.el,
  2487. target,
  2488. dragRect,
  2489. targetRect,
  2490. revert,
  2491. options = this.options,
  2492. group = options.group,
  2493. activeSortable = Sortable.active,
  2494. isOwner = activeGroup === group,
  2495. isMovingBetweenSortable = false,
  2496. canSort = options.sort;
  2497. if (evt.preventDefault !== void 0) {
  2498. evt.preventDefault();
  2499. !options.dragoverBubble && evt.stopPropagation();
  2500. }
  2501. if (dragEl.animated) {
  2502. return;
  2503. }
  2504. moved = true;
  2505. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2506. : putSortable === this || (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt)) && (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  2507. ) {
  2508. // Smart auto-scrolling
  2509. _autoScroll(evt, options, this.el);
  2510. if (_silent) {
  2511. return;
  2512. }
  2513. target = _closest(evt.target, options.draggable, el);
  2514. dragRect = dragEl.getBoundingClientRect();
  2515. if (putSortable !== this) {
  2516. putSortable = this;
  2517. isMovingBetweenSortable = true;
  2518. }
  2519. if (revert) {
  2520. _cloneHide(activeSortable, true);
  2521. parentEl = rootEl; // actualization
  2522. if (cloneEl || nextEl) {
  2523. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2524. } else if (!canSort) {
  2525. rootEl.appendChild(dragEl);
  2526. }
  2527. return;
  2528. }
  2529. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2530. //assign target only if condition is true
  2531. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2532. target = el.lastElementChild;
  2533. }
  2534. if (target) {
  2535. if (target.animated) {
  2536. return;
  2537. }
  2538. targetRect = target.getBoundingClientRect();
  2539. }
  2540. _cloneHide(activeSortable, isOwner);
  2541. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2542. if (!dragEl.contains(el)) {
  2543. el.appendChild(dragEl);
  2544. parentEl = el; // actualization
  2545. }
  2546. this._animate(dragRect, dragEl);
  2547. target && this._animate(targetRect, target);
  2548. }
  2549. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2550. if (lastEl !== target) {
  2551. lastEl = target;
  2552. lastCSS = _css(target);
  2553. lastParentCSS = _css(target.parentNode);
  2554. }
  2555. targetRect = target.getBoundingClientRect();
  2556. var width = targetRect.right - targetRect.left,
  2557. height = targetRect.bottom - targetRect.top,
  2558. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2559. isWide = target.offsetWidth > dragEl.offsetWidth,
  2560. isLong = target.offsetHeight > dragEl.offsetHeight,
  2561. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2562. nextSibling = target.nextElementSibling,
  2563. after = false;
  2564. if (floating) {
  2565. var elTop = dragEl.offsetTop,
  2566. tgTop = target.offsetTop;
  2567. if (elTop === tgTop) {
  2568. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2569. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2570. after = (evt.clientY - targetRect.top) / height > 0.5;
  2571. } else {
  2572. after = tgTop > elTop;
  2573. }
  2574. } else if (!isMovingBetweenSortable) {
  2575. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2576. }
  2577. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2578. if (moveVector !== false) {
  2579. if (moveVector === 1 || moveVector === -1) {
  2580. after = moveVector === 1;
  2581. }
  2582. _silent = true;
  2583. setTimeout(_unsilent, 30);
  2584. _cloneHide(activeSortable, isOwner);
  2585. if (!dragEl.contains(el)) {
  2586. if (after && !nextSibling) {
  2587. el.appendChild(dragEl);
  2588. } else {
  2589. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2590. }
  2591. }
  2592. parentEl = dragEl.parentNode; // actualization
  2593. this._animate(dragRect, dragEl);
  2594. this._animate(targetRect, target);
  2595. }
  2596. }
  2597. }
  2598. },
  2599. _animate: function _animate(prevRect, target) {
  2600. var ms = this.options.animation;
  2601. if (ms) {
  2602. var currentRect = target.getBoundingClientRect();
  2603. if (prevRect.nodeType === 1) {
  2604. prevRect = prevRect.getBoundingClientRect();
  2605. }
  2606. _css(target, 'transition', 'none');
  2607. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2608. target.offsetWidth; // repaint
  2609. _css(target, 'transition', 'all ' + ms + 'ms');
  2610. _css(target, 'transform', 'translate3d(0,0,0)');
  2611. clearTimeout(target.animated);
  2612. target.animated = setTimeout(function () {
  2613. _css(target, 'transition', '');
  2614. _css(target, 'transform', '');
  2615. target.animated = false;
  2616. }, ms);
  2617. }
  2618. },
  2619. _offUpEvents: function _offUpEvents() {
  2620. var ownerDocument = this.el.ownerDocument;
  2621. _off(document, 'touchmove', this._onTouchMove);
  2622. _off(document, 'pointermove', this._onTouchMove);
  2623. _off(ownerDocument, 'mouseup', this._onDrop);
  2624. _off(ownerDocument, 'touchend', this._onDrop);
  2625. _off(ownerDocument, 'pointerup', this._onDrop);
  2626. _off(ownerDocument, 'touchcancel', this._onDrop);
  2627. _off(ownerDocument, 'pointercancel', this._onDrop);
  2628. _off(ownerDocument, 'selectstart', this);
  2629. },
  2630. _onDrop: function _onDrop(
  2631. /**Event*/
  2632. evt) {
  2633. var el = this.el,
  2634. options = this.options;
  2635. clearInterval(this._loopId);
  2636. clearInterval(autoScroll.pid);
  2637. clearTimeout(this._dragStartTimer); // Unbind events
  2638. _off(document, 'mousemove', this._onTouchMove);
  2639. if (this.nativeDraggable) {
  2640. _off(document, 'drop', this);
  2641. _off(el, 'dragstart', this._onDragStart);
  2642. }
  2643. this._offUpEvents();
  2644. if (evt) {
  2645. if (moved) {
  2646. evt.preventDefault();
  2647. !options.dropBubble && evt.stopPropagation();
  2648. }
  2649. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  2650. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  2651. // Remove clone
  2652. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  2653. }
  2654. if (dragEl) {
  2655. if (this.nativeDraggable) {
  2656. _off(dragEl, 'dragend', this);
  2657. }
  2658. _disableDraggable(dragEl);
  2659. dragEl.style['will-change'] = ''; // Remove class's
  2660. _toggleClass(dragEl, this.options.ghostClass, false);
  2661. _toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event
  2662. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2663. if (rootEl !== parentEl) {
  2664. newIndex = _index(dragEl, options.draggable);
  2665. if (newIndex >= 0) {
  2666. // Add event
  2667. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex); // Remove event
  2668. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); // drag from one list and drop into another
  2669. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2670. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2671. }
  2672. } else {
  2673. if (dragEl.nextSibling !== nextEl) {
  2674. // Get the index of the dragged element within its parent
  2675. newIndex = _index(dragEl, options.draggable);
  2676. if (newIndex >= 0) {
  2677. // drag & drop within the same list
  2678. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2679. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2680. }
  2681. }
  2682. }
  2683. if (Sortable.active) {
  2684. /* jshint eqnull:true */
  2685. if (newIndex == null || newIndex === -1) {
  2686. newIndex = oldIndex;
  2687. }
  2688. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); // Save sorting
  2689. this.save();
  2690. }
  2691. }
  2692. }
  2693. this._nulling();
  2694. },
  2695. _nulling: function _nulling() {
  2696. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2697. savedInputChecked.forEach(function (el) {
  2698. el.checked = true;
  2699. });
  2700. savedInputChecked.length = 0;
  2701. },
  2702. handleEvent: function handleEvent(
  2703. /**Event*/
  2704. evt) {
  2705. switch (evt.type) {
  2706. case 'drop':
  2707. case 'dragend':
  2708. this._onDrop(evt);
  2709. break;
  2710. case 'dragover':
  2711. case 'dragenter':
  2712. if (dragEl) {
  2713. this._onDragOver(evt);
  2714. _globalDragOver(evt);
  2715. }
  2716. break;
  2717. case 'selectstart':
  2718. evt.preventDefault();
  2719. break;
  2720. }
  2721. },
  2722. /**
  2723. * Serializes the item into an array of string.
  2724. * @returns {String[]}
  2725. */
  2726. toArray: function toArray() {
  2727. var order = [],
  2728. el,
  2729. children = this.el.children,
  2730. i = 0,
  2731. n = children.length,
  2732. options = this.options;
  2733. for (; i < n; i++) {
  2734. el = children[i];
  2735. if (_closest(el, options.draggable, this.el)) {
  2736. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2737. }
  2738. }
  2739. return order;
  2740. },
  2741. /**
  2742. * Sorts the elements according to the array.
  2743. * @param {String[]} order order of the items
  2744. */
  2745. sort: function sort(order) {
  2746. var items = {},
  2747. rootEl = this.el;
  2748. this.toArray().forEach(function (id, i) {
  2749. var el = rootEl.children[i];
  2750. if (_closest(el, this.options.draggable, rootEl)) {
  2751. items[id] = el;
  2752. }
  2753. }, this);
  2754. order.forEach(function (id) {
  2755. if (items[id]) {
  2756. rootEl.removeChild(items[id]);
  2757. rootEl.appendChild(items[id]);
  2758. }
  2759. });
  2760. },
  2761. /**
  2762. * Save the current sorting
  2763. */
  2764. save: function save() {
  2765. var store = this.options.store;
  2766. store && store.set(this);
  2767. },
  2768. /**
  2769. * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  2770. * @param {HTMLElement} el
  2771. * @param {String} [selector] default: `options.draggable`
  2772. * @returns {HTMLElement|null}
  2773. */
  2774. closest: function closest(el, selector) {
  2775. return _closest(el, selector || this.options.draggable, this.el);
  2776. },
  2777. /**
  2778. * Set/get option
  2779. * @param {string} name
  2780. * @param {*} [value]
  2781. * @returns {*}
  2782. */
  2783. option: function option(name, value) {
  2784. var options = this.options;
  2785. if (value === void 0) {
  2786. return options[name];
  2787. } else {
  2788. options[name] = value;
  2789. if (name === 'group') {
  2790. _prepareGroup(options);
  2791. }
  2792. }
  2793. },
  2794. /**
  2795. * Destroy
  2796. */
  2797. destroy: function destroy() {
  2798. var el = this.el;
  2799. el[expando] = null;
  2800. _off(el, 'mousedown', this._onTapStart);
  2801. _off(el, 'touchstart', this._onTapStart);
  2802. _off(el, 'pointerdown', this._onTapStart);
  2803. if (this.nativeDraggable) {
  2804. _off(el, 'dragover', this);
  2805. _off(el, 'dragenter', this);
  2806. } // Remove draggable attributes
  2807. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2808. el.removeAttribute('draggable');
  2809. });
  2810. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2811. this._onDrop();
  2812. this.el = el = null;
  2813. }
  2814. };
  2815. function _cloneHide(sortable, state) {
  2816. if (sortable.lastPullMode !== 'clone') {
  2817. state = true;
  2818. }
  2819. if (cloneEl && cloneEl.state !== state) {
  2820. _css(cloneEl, 'display', state ? 'none' : '');
  2821. if (!state) {
  2822. if (cloneEl.state) {
  2823. if (sortable.options.group.revertClone) {
  2824. rootEl.insertBefore(cloneEl, nextEl);
  2825. sortable._animate(dragEl, cloneEl);
  2826. } else {
  2827. rootEl.insertBefore(cloneEl, dragEl);
  2828. }
  2829. }
  2830. }
  2831. cloneEl.state = state;
  2832. }
  2833. }
  2834. function _closest(
  2835. /**HTMLElement*/
  2836. el,
  2837. /**String*/
  2838. selector,
  2839. /**HTMLElement*/
  2840. ctx) {
  2841. if (el) {
  2842. ctx = ctx || document;
  2843. do {
  2844. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2845. return el;
  2846. }
  2847. /* jshint boss:true */
  2848. } while (el = _getParentOrHost(el));
  2849. }
  2850. return null;
  2851. }
  2852. function _getParentOrHost(el) {
  2853. var parent = el.host;
  2854. return parent && parent.nodeType ? parent : el.parentNode;
  2855. }
  2856. function _globalDragOver(
  2857. /**Event*/
  2858. evt) {
  2859. if (evt.dataTransfer) {
  2860. evt.dataTransfer.dropEffect = 'move';
  2861. }
  2862. evt.preventDefault();
  2863. }
  2864. function _on(el, event, fn) {
  2865. el.addEventListener(event, fn, captureMode);
  2866. }
  2867. function _off(el, event, fn) {
  2868. el.removeEventListener(event, fn, captureMode);
  2869. }
  2870. function _toggleClass(el, name, state) {
  2871. if (el) {
  2872. if (el.classList) {
  2873. el.classList[state ? 'add' : 'remove'](name);
  2874. } else {
  2875. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2876. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2877. }
  2878. }
  2879. }
  2880. function _css(el, prop, val) {
  2881. var style = el && el.style;
  2882. if (style) {
  2883. if (val === void 0) {
  2884. if (document.defaultView && document.defaultView.getComputedStyle) {
  2885. val = document.defaultView.getComputedStyle(el, '');
  2886. } else if (el.currentStyle) {
  2887. val = el.currentStyle;
  2888. }
  2889. return prop === void 0 ? val : val[prop];
  2890. } else {
  2891. if (!(prop in style)) {
  2892. prop = '-webkit-' + prop;
  2893. }
  2894. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2895. }
  2896. }
  2897. }
  2898. function _find(ctx, tagName, iterator) {
  2899. if (ctx) {
  2900. var list = ctx.getElementsByTagName(tagName),
  2901. i = 0,
  2902. n = list.length;
  2903. if (iterator) {
  2904. for (; i < n; i++) {
  2905. iterator(list[i], i);
  2906. }
  2907. }
  2908. return list;
  2909. }
  2910. return [];
  2911. }
  2912. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2913. sortable = sortable || rootEl[expando];
  2914. var evt = document.createEvent('Event'),
  2915. options = sortable.options,
  2916. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2917. evt.initEvent(name, true, true);
  2918. evt.to = rootEl;
  2919. evt.from = fromEl || rootEl;
  2920. evt.item = targetEl || rootEl;
  2921. evt.clone = cloneEl;
  2922. evt.oldIndex = startIndex;
  2923. evt.newIndex = newIndex;
  2924. rootEl.dispatchEvent(evt);
  2925. if (options[onName]) {
  2926. options[onName].call(sortable, evt);
  2927. }
  2928. }
  2929. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2930. var evt,
  2931. sortable = fromEl[expando],
  2932. onMoveFn = sortable.options.onMove,
  2933. retVal;
  2934. evt = document.createEvent('Event');
  2935. evt.initEvent('move', true, true);
  2936. evt.to = toEl;
  2937. evt.from = fromEl;
  2938. evt.dragged = dragEl;
  2939. evt.draggedRect = dragRect;
  2940. evt.related = targetEl || toEl;
  2941. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2942. evt.willInsertAfter = willInsertAfter;
  2943. fromEl.dispatchEvent(evt);
  2944. if (onMoveFn) {
  2945. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2946. }
  2947. return retVal;
  2948. }
  2949. function _disableDraggable(el) {
  2950. el.draggable = false;
  2951. }
  2952. function _unsilent() {
  2953. _silent = false;
  2954. }
  2955. /** @returns {HTMLElement|false} */
  2956. function _ghostIsLast(el, evt) {
  2957. var lastEl = el.lastElementChild,
  2958. rect = lastEl.getBoundingClientRect(); // 5 — min delta
  2959. // abs — нельзя добавлять, а то глюки при наведении сверху
  2960. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2961. }
  2962. /**
  2963. * Generate id
  2964. * @param {HTMLElement} el
  2965. * @returns {String}
  2966. * @private
  2967. */
  2968. function _generateId(el) {
  2969. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2970. i = str.length,
  2971. sum = 0;
  2972. while (i--) {
  2973. sum += str.charCodeAt(i);
  2974. }
  2975. return sum.toString(36);
  2976. }
  2977. /**
  2978. * Returns the index of an element within its parent for a selected set of
  2979. * elements
  2980. * @param {HTMLElement} el
  2981. * @param {selector} selector
  2982. * @return {number}
  2983. */
  2984. function _index(el, selector) {
  2985. var index = 0;
  2986. if (!el || !el.parentNode) {
  2987. return -1;
  2988. }
  2989. while (el && (el = el.previousElementSibling)) {
  2990. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2991. index++;
  2992. }
  2993. }
  2994. return index;
  2995. }
  2996. function _matches(
  2997. /**HTMLElement*/
  2998. el,
  2999. /**String*/
  3000. selector) {
  3001. if (el) {
  3002. selector = selector.split('.');
  3003. var tag = selector.shift().toUpperCase(),
  3004. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  3005. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  3006. }
  3007. return false;
  3008. }
  3009. function _throttle(callback, ms) {
  3010. var args, _this;
  3011. return function () {
  3012. if (args === void 0) {
  3013. args = arguments;
  3014. _this = this;
  3015. setTimeout(function () {
  3016. if (args.length === 1) {
  3017. callback.call(_this, args[0]);
  3018. } else {
  3019. callback.apply(_this, args);
  3020. }
  3021. args = void 0;
  3022. }, ms);
  3023. }
  3024. };
  3025. }
  3026. function _extend(dst, src) {
  3027. if (dst && src) {
  3028. for (var key in src) {
  3029. if (src.hasOwnProperty(key)) {
  3030. dst[key] = src[key];
  3031. }
  3032. }
  3033. }
  3034. return dst;
  3035. }
  3036. function _clone(el) {
  3037. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3038. }
  3039. function _saveInputCheckedState(root) {
  3040. var inputs = root.getElementsByTagName('input');
  3041. var idx = inputs.length;
  3042. while (idx--) {
  3043. var el = inputs[idx];
  3044. el.checked && savedInputChecked.push(el);
  3045. }
  3046. } // Fixed #973:
  3047. _on(document, 'touchmove', function (evt) {
  3048. if (Sortable.active) {
  3049. evt.preventDefault();
  3050. }
  3051. });
  3052. try {
  3053. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3054. get: function get() {
  3055. captureMode = {
  3056. capture: false,
  3057. passive: false
  3058. };
  3059. }
  3060. }));
  3061. } catch (err) {} // Export utils
  3062. Sortable.utils = {
  3063. on: _on,
  3064. off: _off,
  3065. css: _css,
  3066. find: _find,
  3067. is: function is(el, selector) {
  3068. return !!_closest(el, selector, el);
  3069. },
  3070. extend: _extend,
  3071. throttle: _throttle,
  3072. closest: _closest,
  3073. toggleClass: _toggleClass,
  3074. clone: _clone,
  3075. index: _index
  3076. };
  3077. /**
  3078. * Create sortable instance
  3079. * @param {HTMLElement} el
  3080. * @param {Object} [options]
  3081. */
  3082. Sortable.create = function (el, options) {
  3083. return new Sortable(el, options);
  3084. }; // Export
  3085. Sortable.version = '1.6.1';
  3086. return Sortable;
  3087. });
  3088. /***/ }),
  3089. /***/ "./js/assessment/ivprogAssessment.js":
  3090. /*!*******************************************!*\
  3091. !*** ./js/assessment/ivprogAssessment.js ***!
  3092. \*******************************************/
  3093. /*! exports provided: IVProgAssessment */
  3094. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3095. "use strict";
  3096. __webpack_require__.r(__webpack_exports__);
  3097. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgAssessment", function() { return IVProgAssessment; });
  3098. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  3099. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_0__);
  3100. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  3101. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3102. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3103. /* harmony import */ var _util_inputTest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3104. /* harmony import */ var _util_outputTest__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3105. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  3106. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3107. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  3108. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3109. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3110. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3111. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_7__["getInstance"]();
  3112. var StringTypes = line_i18n__WEBPACK_IMPORTED_MODULE_1__["default"].StringTypes;
  3113. var IVProgAssessment =
  3114. /*#__PURE__*/
  3115. function () {
  3116. function IVProgAssessment(textCode, testCases, domConsole) {
  3117. _classCallCheck(this, IVProgAssessment);
  3118. this.textCode = textCode;
  3119. this.testCases = testCases;
  3120. this.domConsole = domConsole;
  3121. }
  3122. _createClass(IVProgAssessment, [{
  3123. key: "runTest",
  3124. value: function runTest() {
  3125. var _this = this;
  3126. try {
  3127. var validTree = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_2__["SemanticAnalyser"].analyseFromSource(this.textCode); // loop test cases and show messages through domconsole
  3128. var partialTests = this.testCases.map(function (t, name) {
  3129. return _this.partialEvaluateTestCase(new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_3__["IVProgProcessor"](validTree), t.input, t.output, name);
  3130. });
  3131. var testResult = partialTests.reduce(function (acc, curr) {
  3132. return acc.then(curr);
  3133. }, Promise.resolve(0));
  3134. return testResult.then(function (total) {
  3135. var grade = total / _this.testCases.length;
  3136. var channel = grade == 1 ? _io_domConsole__WEBPACK_IMPORTED_MODULE_6__["DOMConsole"].INFO : _io_domConsole__WEBPACK_IMPORTED_MODULE_6__["DOMConsole"].ERR;
  3137. _this.writeToConsole(channel, StringTypes.MESSAGE, "test_suite_grade", grade * 100);
  3138. return Promise.resolve(grade);
  3139. }).catch(function (err) {
  3140. _this.domConsole.err("Erro inesperado durante o cálculo da nota."); // try and show error messages through domconsole
  3141. _this.domConsole.err(err.message);
  3142. return Promise.resolve(0);
  3143. });
  3144. } catch (error) {
  3145. this.domConsole.err("Erro inesperado durante a execução do programa"); // try and show error messages through domconsole
  3146. this.domConsole.err(error.message);
  3147. return Promise.resolve(0);
  3148. }
  3149. }
  3150. }, {
  3151. key: "evaluateTestCase",
  3152. value: function evaluateTestCase(prog, inputList, expectedOutputs, name, accumulator) {
  3153. var outerThis = this;
  3154. var input = new _util_inputTest__WEBPACK_IMPORTED_MODULE_4__["InputTest"](inputList);
  3155. var output = new _util_outputTest__WEBPACK_IMPORTED_MODULE_5__["OutputTest"]();
  3156. prog.registerInput(input);
  3157. prog.registerOutput(output);
  3158. var startTime = Date.now();
  3159. return prog.interpretAST().then(function (_) {
  3160. var millis = Date.now() - startTime;
  3161. if (input.inputList.length !== input.index) {
  3162. outerThis.showErrorMessage('test_case_few_reads', name + 1);
  3163. outerThis.showInfoMessage('test_case_duration', millis);
  3164. return Promise.resolve(accumulator + input.index / inputList.length);
  3165. } else if (output.list.length != expectedOutputs.length) {
  3166. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), expectedOutputs.join(','), output.list.join(','));
  3167. outerThis.showInfoMessage('test_case_duration', millis); // must check for a partial match of the generated output
  3168. var numMatchedOutputs = output.list.reduce(function (acc, actualOutput, index) {
  3169. if (outerThis.checkOutputValues(actualOutput, expectedOutputs[index])) {
  3170. return acc + 1;
  3171. } else {
  3172. return acc;
  3173. }
  3174. }, 0);
  3175. var maxLength = Math.max(expectedOutputs.length, output.list.length);
  3176. return Promise.resolve(accumulator + numMatchedOutputs / maxLength);
  3177. } else {
  3178. var isOk = outerThis.checkOutputLists(output.list, expectedOutputs);
  3179. if (!isOk) {
  3180. console.log("not ok.");
  3181. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), expectedOutputs.join(','), output.list.join(','));
  3182. outerThis.showInfoMessage('test_case_duration', millis);
  3183. return Promise.resolve(accumulator);
  3184. } else {
  3185. outerThis.showInfoMessage('test_case_success', name + 1);
  3186. outerThis.showInfoMessage('test_case_duration', millis);
  3187. return Promise.resolve(accumulator + 1);
  3188. }
  3189. }
  3190. }).catch(function (error) {
  3191. outerThis.showErrorMessage('test_case_failed_exception', name + 1, error.message);
  3192. return Promise.resolve(accumulator);
  3193. });
  3194. }
  3195. }, {
  3196. key: "partialEvaluateTestCase",
  3197. value: function partialEvaluateTestCase(prog, inputList, expectedOutputs, name) {
  3198. return this.evaluateTestCase.bind(this, prog, inputList, expectedOutputs, name);
  3199. }
  3200. }, {
  3201. key: "checkOutputLists",
  3202. value: function checkOutputLists(actualOutputs, expectedOutputs) {
  3203. for (var i = 0; i < actualOutputs.length; i++) {
  3204. var outValue = actualOutputs[i];
  3205. var expectedValue = expectedOutputs[i];
  3206. if (!this.checkOutputValues(outValue, expectedValue)) {
  3207. return false;
  3208. }
  3209. }
  3210. return true;
  3211. }
  3212. }, {
  3213. key: "checkOutputValues",
  3214. value: function checkOutputValues(actualValue, expectedValue) {
  3215. var castNumberA = parseFloat(actualValue);
  3216. if (!Number.isNaN(castNumberA)) {
  3217. var castNumberB = parseFloat(expectedValue);
  3218. if (Number.isNaN(castNumberB)) {
  3219. return false;
  3220. }
  3221. castNumberA = new decimal_js__WEBPACK_IMPORTED_MODULE_0__["Decimal"](castNumberA);
  3222. castNumberB = new decimal_js__WEBPACK_IMPORTED_MODULE_0__["Decimal"](castNumberB);
  3223. var decimalPlaces = Math.min(castNumberB.dp(), _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces);
  3224. castNumberA = new decimal_js__WEBPACK_IMPORTED_MODULE_0__["Decimal"](castNumberA.toFixed(decimalPlaces, decimal_js__WEBPACK_IMPORTED_MODULE_0__["Decimal"].ROUND_FLOOR));
  3225. castNumberB = new decimal_js__WEBPACK_IMPORTED_MODULE_0__["Decimal"](castNumberB.toFixed(decimalPlaces, decimal_js__WEBPACK_IMPORTED_MODULE_0__["Decimal"].ROUND_FLOOR));
  3226. var aEqualsB = castNumberA.eq(castNumberB);
  3227. if (!aEqualsB) {
  3228. return false;
  3229. }
  3230. } else if (actualValue != expectedValue) {
  3231. return false;
  3232. }
  3233. return true;
  3234. }
  3235. }, {
  3236. key: "showErrorMessage",
  3237. value: function showErrorMessage(errorID) {
  3238. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3239. args[_key - 1] = arguments[_key];
  3240. }
  3241. this.domConsole.err(LocalizedStrings.getError(errorID, args));
  3242. }
  3243. }, {
  3244. key: "showInfoMessage",
  3245. value: function showInfoMessage(msgID) {
  3246. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  3247. args[_key2 - 1] = arguments[_key2];
  3248. }
  3249. this.domConsole.info(LocalizedStrings.getMessage(msgID, args));
  3250. }
  3251. }, {
  3252. key: "writeToConsole",
  3253. value: function writeToConsole(channel, msgType, msgID) {
  3254. var msg = LocalizedStrings.getString(msgID, msgType);
  3255. for (var _len3 = arguments.length, args = new Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {
  3256. args[_key3 - 3] = arguments[_key3];
  3257. }
  3258. msg = LocalizedStrings.processString(msg, args);
  3259. switch (channel) {
  3260. case _io_domConsole__WEBPACK_IMPORTED_MODULE_6__["DOMConsole"].ERR:
  3261. {
  3262. this.domConsole.err(msg);
  3263. break;
  3264. }
  3265. case _io_domConsole__WEBPACK_IMPORTED_MODULE_6__["DOMConsole"].INFO:
  3266. {
  3267. this.domConsole.info(msg);
  3268. break;
  3269. }
  3270. case _io_domConsole__WEBPACK_IMPORTED_MODULE_6__["DOMConsole"].USER:
  3271. {
  3272. this.domConsole.write(msg);
  3273. break;
  3274. }
  3275. }
  3276. }
  3277. }]);
  3278. return IVProgAssessment;
  3279. }();
  3280. /***/ }),
  3281. /***/ "./js/ast/commands/arrayAssign.js":
  3282. /*!****************************************!*\
  3283. !*** ./js/ast/commands/arrayAssign.js ***!
  3284. \****************************************/
  3285. /*! exports provided: ArrayIndexAssign */
  3286. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3287. "use strict";
  3288. __webpack_require__.r(__webpack_exports__);
  3289. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayIndexAssign", function() { return ArrayIndexAssign; });
  3290. /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3291. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3292. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3293. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3294. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3295. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3296. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3297. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3298. var ArrayIndexAssign =
  3299. /*#__PURE__*/
  3300. function (_Assign) {
  3301. _inherits(ArrayIndexAssign, _Assign);
  3302. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3303. var _this;
  3304. _classCallCheck(this, ArrayIndexAssign);
  3305. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayIndexAssign).call(this, id, expression));
  3306. _this.line = lineExpression;
  3307. _this.column = columnExpression;
  3308. return _this;
  3309. }
  3310. return ArrayIndexAssign;
  3311. }(_assign__WEBPACK_IMPORTED_MODULE_0__["Assign"]);
  3312. /***/ }),
  3313. /***/ "./js/ast/commands/arrayDeclaration.js":
  3314. /*!*********************************************!*\
  3315. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3316. \*********************************************/
  3317. /*! exports provided: ArrayDeclaration */
  3318. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3319. "use strict";
  3320. __webpack_require__.r(__webpack_exports__);
  3321. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayDeclaration", function() { return ArrayDeclaration; });
  3322. /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3323. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3324. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3325. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3326. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3327. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3328. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3329. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3330. var ArrayDeclaration =
  3331. /*#__PURE__*/
  3332. function (_Declaration) {
  3333. _inherits(ArrayDeclaration, _Declaration);
  3334. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3335. var _this;
  3336. _classCallCheck(this, ArrayDeclaration);
  3337. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayDeclaration).call(this, id, type, initial, isConst));
  3338. _this.lines = lines;
  3339. _this.columns = columns;
  3340. return _this;
  3341. }
  3342. return ArrayDeclaration;
  3343. }(_declaration__WEBPACK_IMPORTED_MODULE_0__["Declaration"]);
  3344. /***/ }),
  3345. /***/ "./js/ast/commands/assign.js":
  3346. /*!***********************************!*\
  3347. !*** ./js/ast/commands/assign.js ***!
  3348. \***********************************/
  3349. /*! exports provided: Assign */
  3350. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3351. "use strict";
  3352. __webpack_require__.r(__webpack_exports__);
  3353. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return Assign; });
  3354. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3355. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3356. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3357. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3358. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3359. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3360. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3361. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3362. var Assign =
  3363. /*#__PURE__*/
  3364. function (_Command) {
  3365. _inherits(Assign, _Command);
  3366. function Assign(id, expression) {
  3367. var _this;
  3368. _classCallCheck(this, Assign);
  3369. _this = _possibleConstructorReturn(this, _getPrototypeOf(Assign).call(this));
  3370. _this.id = id;
  3371. _this.expression = expression;
  3372. return _this;
  3373. }
  3374. return Assign;
  3375. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3376. /***/ }),
  3377. /***/ "./js/ast/commands/break.js":
  3378. /*!**********************************!*\
  3379. !*** ./js/ast/commands/break.js ***!
  3380. \**********************************/
  3381. /*! exports provided: Break */
  3382. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3383. "use strict";
  3384. __webpack_require__.r(__webpack_exports__);
  3385. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return Break; });
  3386. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3387. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3388. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3389. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3390. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3391. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3392. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3393. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3394. var Break =
  3395. /*#__PURE__*/
  3396. function (_Command) {
  3397. _inherits(Break, _Command);
  3398. function Break() {
  3399. _classCallCheck(this, Break);
  3400. return _possibleConstructorReturn(this, _getPrototypeOf(Break).call(this));
  3401. }
  3402. return Break;
  3403. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3404. /***/ }),
  3405. /***/ "./js/ast/commands/case.js":
  3406. /*!*********************************!*\
  3407. !*** ./js/ast/commands/case.js ***!
  3408. \*********************************/
  3409. /*! exports provided: Case */
  3410. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3411. "use strict";
  3412. __webpack_require__.r(__webpack_exports__);
  3413. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Case", function() { return Case; });
  3414. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3415. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3416. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3417. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3418. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3419. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3420. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3421. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3422. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3423. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3424. var Case =
  3425. /*#__PURE__*/
  3426. function (_Command) {
  3427. _inherits(Case, _Command);
  3428. function Case(expression) {
  3429. var _this;
  3430. _classCallCheck(this, Case);
  3431. _this = _possibleConstructorReturn(this, _getPrototypeOf(Case).call(this));
  3432. _this.expression = expression;
  3433. _this.commands = [];
  3434. return _this;
  3435. }
  3436. _createClass(Case, [{
  3437. key: "setCommands",
  3438. value: function setCommands(commands) {
  3439. this.commands = commands;
  3440. }
  3441. }, {
  3442. key: "isDefault",
  3443. get: function get() {
  3444. return this.expression === null;
  3445. }
  3446. }]);
  3447. return Case;
  3448. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3449. /***/ }),
  3450. /***/ "./js/ast/commands/command.js":
  3451. /*!************************************!*\
  3452. !*** ./js/ast/commands/command.js ***!
  3453. \************************************/
  3454. /*! exports provided: Command */
  3455. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3456. "use strict";
  3457. __webpack_require__.r(__webpack_exports__);
  3458. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; });
  3459. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3460. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3461. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3462. var Command =
  3463. /*#__PURE__*/
  3464. function () {
  3465. function Command() {
  3466. _classCallCheck(this, Command);
  3467. this._sourceInfo = null;
  3468. }
  3469. _createClass(Command, [{
  3470. key: "sourceInfo",
  3471. set: function set(sourceInfo) {
  3472. this._sourceInfo = sourceInfo;
  3473. },
  3474. get: function get() {
  3475. return this._sourceInfo;
  3476. }
  3477. }]);
  3478. return Command;
  3479. }();
  3480. /***/ }),
  3481. /***/ "./js/ast/commands/commandBlock.js":
  3482. /*!*****************************************!*\
  3483. !*** ./js/ast/commands/commandBlock.js ***!
  3484. \*****************************************/
  3485. /*! exports provided: CommandBlock */
  3486. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3487. "use strict";
  3488. __webpack_require__.r(__webpack_exports__);
  3489. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommandBlock", function() { return CommandBlock; });
  3490. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3491. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3492. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3493. var CommandBlock =
  3494. /*#__PURE__*/
  3495. function () {
  3496. function CommandBlock(variables, commands) {
  3497. _classCallCheck(this, CommandBlock);
  3498. this.variables = variables;
  3499. this.commands = commands;
  3500. this._sourceInfo = null;
  3501. }
  3502. _createClass(CommandBlock, [{
  3503. key: "sourceInfo",
  3504. set: function set(sourceInfo) {
  3505. this._sourceInfo = sourceInfo;
  3506. },
  3507. get: function get() {
  3508. return this._sourceInfo;
  3509. }
  3510. }]);
  3511. return CommandBlock;
  3512. }();
  3513. /***/ }),
  3514. /***/ "./js/ast/commands/declaration.js":
  3515. /*!****************************************!*\
  3516. !*** ./js/ast/commands/declaration.js ***!
  3517. \****************************************/
  3518. /*! exports provided: Declaration */
  3519. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3520. "use strict";
  3521. __webpack_require__.r(__webpack_exports__);
  3522. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Declaration", function() { return Declaration; });
  3523. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3524. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3525. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3526. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3527. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3528. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3529. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3530. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3531. var Declaration =
  3532. /*#__PURE__*/
  3533. function (_Command) {
  3534. _inherits(Declaration, _Command);
  3535. function Declaration(id, type, initial, isConst) {
  3536. var _this;
  3537. _classCallCheck(this, Declaration);
  3538. _this = _possibleConstructorReturn(this, _getPrototypeOf(Declaration).call(this));
  3539. _this.id = id;
  3540. _this.type = type;
  3541. _this.initial = initial;
  3542. _this.isConst = isConst;
  3543. return _this;
  3544. }
  3545. return Declaration;
  3546. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3547. /***/ }),
  3548. /***/ "./js/ast/commands/doWhile.js":
  3549. /*!************************************!*\
  3550. !*** ./js/ast/commands/doWhile.js ***!
  3551. \************************************/
  3552. /*! exports provided: DoWhile */
  3553. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3554. "use strict";
  3555. __webpack_require__.r(__webpack_exports__);
  3556. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DoWhile", function() { return DoWhile; });
  3557. /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3558. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3559. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3560. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3561. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3562. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3563. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3564. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3565. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3566. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3567. var DoWhile =
  3568. /*#__PURE__*/
  3569. function (_While) {
  3570. _inherits(DoWhile, _While);
  3571. function DoWhile(condition, commandBlock) {
  3572. _classCallCheck(this, DoWhile);
  3573. return _possibleConstructorReturn(this, _getPrototypeOf(DoWhile).call(this, condition, commandBlock));
  3574. }
  3575. _createClass(DoWhile, [{
  3576. key: "testFirst",
  3577. get: function get() {
  3578. return false;
  3579. }
  3580. }]);
  3581. return DoWhile;
  3582. }(_while__WEBPACK_IMPORTED_MODULE_0__["While"]);
  3583. /***/ }),
  3584. /***/ "./js/ast/commands/for.js":
  3585. /*!********************************!*\
  3586. !*** ./js/ast/commands/for.js ***!
  3587. \********************************/
  3588. /*! exports provided: For */
  3589. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3590. "use strict";
  3591. __webpack_require__.r(__webpack_exports__);
  3592. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "For", function() { return For; });
  3593. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3594. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3595. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3596. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3597. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3598. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3599. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3600. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3601. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3602. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3603. var For =
  3604. /*#__PURE__*/
  3605. function (_Command) {
  3606. _inherits(For, _Command);
  3607. function For(assignment, condition, increment, commandBlock) {
  3608. var _this;
  3609. _classCallCheck(this, For);
  3610. _this = _possibleConstructorReturn(this, _getPrototypeOf(For).call(this));
  3611. _this.assignment = assignment;
  3612. _this.condition = condition;
  3613. _this.increment = increment;
  3614. _this.commandBlock = commandBlock;
  3615. return _this;
  3616. }
  3617. _createClass(For, [{
  3618. key: "commands",
  3619. get: function get() {
  3620. return this.commandBlock.commands;
  3621. }
  3622. }]);
  3623. return For;
  3624. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3625. /***/ }),
  3626. /***/ "./js/ast/commands/formalParameter.js":
  3627. /*!********************************************!*\
  3628. !*** ./js/ast/commands/formalParameter.js ***!
  3629. \********************************************/
  3630. /*! exports provided: FormalParameter */
  3631. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3632. "use strict";
  3633. __webpack_require__.r(__webpack_exports__);
  3634. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormalParameter", function() { return FormalParameter; });
  3635. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3636. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3637. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3638. var FormalParameter =
  3639. /*#__PURE__*/
  3640. function () {
  3641. function FormalParameter(type, id) {
  3642. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3643. _classCallCheck(this, FormalParameter);
  3644. this.type = type;
  3645. this.id = id;
  3646. this.byRef = byRef;
  3647. this._sourceInfo = null;
  3648. }
  3649. _createClass(FormalParameter, [{
  3650. key: "sourceInfo",
  3651. set: function set(sourceInfo) {
  3652. this._sourceInfo = sourceInfo;
  3653. },
  3654. get: function get() {
  3655. return this._sourceInfo;
  3656. }
  3657. }]);
  3658. return FormalParameter;
  3659. }();
  3660. /***/ }),
  3661. /***/ "./js/ast/commands/function.js":
  3662. /*!*************************************!*\
  3663. !*** ./js/ast/commands/function.js ***!
  3664. \*************************************/
  3665. /*! exports provided: Function */
  3666. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3667. "use strict";
  3668. __webpack_require__.r(__webpack_exports__);
  3669. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return Function; });
  3670. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3671. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3672. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3673. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3674. var Function =
  3675. /*#__PURE__*/
  3676. function () {
  3677. function Function(name, returnType, formalParameters, commandBlock) {
  3678. _classCallCheck(this, Function);
  3679. this.name = name;
  3680. this.returnType = returnType;
  3681. this.formalParameters = formalParameters;
  3682. this.commandBlock = commandBlock;
  3683. this._sourceInfo = null;
  3684. }
  3685. _createClass(Function, [{
  3686. key: "isMain",
  3687. get: function get() {
  3688. return this.name === null && this.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].VOID);
  3689. }
  3690. }, {
  3691. key: "commands",
  3692. get: function get() {
  3693. return this.commandBlock.commands;
  3694. }
  3695. }, {
  3696. key: "variablesDeclarations",
  3697. get: function get() {
  3698. return this.commandBlock.variables;
  3699. }
  3700. }, {
  3701. key: "sourceInfo",
  3702. set: function set(sourceInfo) {
  3703. this._sourceInfo = sourceInfo;
  3704. },
  3705. get: function get() {
  3706. return this._sourceInfo;
  3707. }
  3708. }]);
  3709. return Function;
  3710. }();
  3711. /***/ }),
  3712. /***/ "./js/ast/commands/ifThenElse.js":
  3713. /*!***************************************!*\
  3714. !*** ./js/ast/commands/ifThenElse.js ***!
  3715. \***************************************/
  3716. /*! exports provided: IfThenElse */
  3717. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3718. "use strict";
  3719. __webpack_require__.r(__webpack_exports__);
  3720. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfThenElse", function() { return IfThenElse; });
  3721. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3722. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3723. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3724. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3725. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3726. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3727. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3728. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3729. var IfThenElse =
  3730. /*#__PURE__*/
  3731. function (_Command) {
  3732. _inherits(IfThenElse, _Command);
  3733. function IfThenElse(condition, ifTrue, ifFalse) {
  3734. var _this;
  3735. _classCallCheck(this, IfThenElse);
  3736. _this = _possibleConstructorReturn(this, _getPrototypeOf(IfThenElse).call(this));
  3737. _this.condition = condition;
  3738. _this.ifTrue = ifTrue;
  3739. _this.ifFalse = ifFalse;
  3740. return _this;
  3741. }
  3742. return IfThenElse;
  3743. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3744. /***/ }),
  3745. /***/ "./js/ast/commands/index.js":
  3746. /*!**********************************!*\
  3747. !*** ./js/ast/commands/index.js ***!
  3748. \**********************************/
  3749. /*! exports provided: Break, Return, Assign, ArrayIndexAssign, Declaration, ArrayDeclaration, While, For, Function, IfThenElse, CommandBlock, DoWhile, Switch, Case, SysCall, FormalParameter, FunctionCall */
  3750. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3751. "use strict";
  3752. __webpack_require__.r(__webpack_exports__);
  3753. /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3754. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return _break__WEBPACK_IMPORTED_MODULE_0__["Break"]; });
  3755. /* harmony import */ var _return__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3756. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return _return__WEBPACK_IMPORTED_MODULE_1__["Return"]; });
  3757. /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3758. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return _assign__WEBPACK_IMPORTED_MODULE_2__["Assign"]; });
  3759. /* harmony import */ var _arrayAssign__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3760. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayIndexAssign", function() { return _arrayAssign__WEBPACK_IMPORTED_MODULE_3__["ArrayIndexAssign"]; });
  3761. /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3762. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Declaration", function() { return _declaration__WEBPACK_IMPORTED_MODULE_4__["Declaration"]; });
  3763. /* harmony import */ var _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3764. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayDeclaration", function() { return _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__["ArrayDeclaration"]; });
  3765. /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3766. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "While", function() { return _while__WEBPACK_IMPORTED_MODULE_6__["While"]; });
  3767. /* harmony import */ var _for__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3768. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "For", function() { return _for__WEBPACK_IMPORTED_MODULE_7__["For"]; });
  3769. /* harmony import */ var _function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3770. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return _function__WEBPACK_IMPORTED_MODULE_8__["Function"]; });
  3771. /* harmony import */ var _ifThenElse__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3772. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IfThenElse", function() { return _ifThenElse__WEBPACK_IMPORTED_MODULE_9__["IfThenElse"]; });
  3773. /* harmony import */ var _commandBlock__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3774. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CommandBlock", function() { return _commandBlock__WEBPACK_IMPORTED_MODULE_10__["CommandBlock"]; });
  3775. /* harmony import */ var _doWhile__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3776. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DoWhile", function() { return _doWhile__WEBPACK_IMPORTED_MODULE_11__["DoWhile"]; });
  3777. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3778. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return _switch__WEBPACK_IMPORTED_MODULE_12__["Switch"]; });
  3779. /* harmony import */ var _case__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3780. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Case", function() { return _case__WEBPACK_IMPORTED_MODULE_13__["Case"]; });
  3781. /* harmony import */ var _sysCall__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3782. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SysCall", function() { return _sysCall__WEBPACK_IMPORTED_MODULE_14__["SysCall"]; });
  3783. /* harmony import */ var _formalParameter__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3784. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FormalParameter", function() { return _formalParameter__WEBPACK_IMPORTED_MODULE_15__["FormalParameter"]; });
  3785. /* harmony import */ var _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3786. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__["FunctionCall"]; });
  3787. //Proxy to expression since they do exatcly the same thing
  3788. /***/ }),
  3789. /***/ "./js/ast/commands/return.js":
  3790. /*!***********************************!*\
  3791. !*** ./js/ast/commands/return.js ***!
  3792. \***********************************/
  3793. /*! exports provided: Return */
  3794. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3795. "use strict";
  3796. __webpack_require__.r(__webpack_exports__);
  3797. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return Return; });
  3798. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3799. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3800. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3801. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3802. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3803. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3804. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3805. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3806. var Return =
  3807. /*#__PURE__*/
  3808. function (_Command) {
  3809. _inherits(Return, _Command);
  3810. function Return(expression) {
  3811. var _this;
  3812. _classCallCheck(this, Return);
  3813. _this = _possibleConstructorReturn(this, _getPrototypeOf(Return).call(this));
  3814. _this.expression = expression;
  3815. return _this;
  3816. }
  3817. return Return;
  3818. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3819. /***/ }),
  3820. /***/ "./js/ast/commands/switch.js":
  3821. /*!***********************************!*\
  3822. !*** ./js/ast/commands/switch.js ***!
  3823. \***********************************/
  3824. /*! exports provided: Switch */
  3825. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3826. "use strict";
  3827. __webpack_require__.r(__webpack_exports__);
  3828. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return Switch; });
  3829. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3830. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3831. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3832. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3833. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3834. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3835. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3836. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3837. var Switch =
  3838. /*#__PURE__*/
  3839. function (_Command) {
  3840. _inherits(Switch, _Command);
  3841. function Switch(expression, cases) {
  3842. var _this;
  3843. _classCallCheck(this, Switch);
  3844. _this = _possibleConstructorReturn(this, _getPrototypeOf(Switch).call(this));
  3845. _this.expression = expression;
  3846. _this.cases = cases;
  3847. return _this;
  3848. }
  3849. return Switch;
  3850. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3851. /***/ }),
  3852. /***/ "./js/ast/commands/sysCall.js":
  3853. /*!************************************!*\
  3854. !*** ./js/ast/commands/sysCall.js ***!
  3855. \************************************/
  3856. /*! exports provided: SysCall */
  3857. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3858. "use strict";
  3859. __webpack_require__.r(__webpack_exports__);
  3860. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SysCall", function() { return SysCall; });
  3861. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3862. /**
  3863. * This class represents all the language defined functions.
  3864. * The language processor uses the id provided here to properly execute the desired function.
  3865. * The function is actually implemented inside the language processor.
  3866. * All the functions can be found at: js/processor/definedFunctions.js
  3867. */
  3868. var SysCall = function SysCall(langFunc) {
  3869. _classCallCheck(this, SysCall);
  3870. this.langFunc = langFunc;
  3871. };
  3872. /***/ }),
  3873. /***/ "./js/ast/commands/while.js":
  3874. /*!**********************************!*\
  3875. !*** ./js/ast/commands/while.js ***!
  3876. \**********************************/
  3877. /*! exports provided: While */
  3878. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3879. "use strict";
  3880. __webpack_require__.r(__webpack_exports__);
  3881. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "While", function() { return While; });
  3882. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3883. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3884. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3885. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3886. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3887. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3888. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3889. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3890. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3891. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3892. var While =
  3893. /*#__PURE__*/
  3894. function (_Command) {
  3895. _inherits(While, _Command);
  3896. function While(expression, commandBlock) {
  3897. var _this;
  3898. _classCallCheck(this, While);
  3899. _this = _possibleConstructorReturn(this, _getPrototypeOf(While).call(this));
  3900. _this.expression = expression;
  3901. _this.commandBlock = commandBlock;
  3902. return _this;
  3903. }
  3904. _createClass(While, [{
  3905. key: "commands",
  3906. get: function get() {
  3907. return this.commandBlock.commands;
  3908. }
  3909. }, {
  3910. key: "testFirst",
  3911. get: function get() {
  3912. return true;
  3913. }
  3914. }]);
  3915. return While;
  3916. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3917. /***/ }),
  3918. /***/ "./js/ast/error/syntaxError.js":
  3919. /*!*************************************!*\
  3920. !*** ./js/ast/error/syntaxError.js ***!
  3921. \*************************************/
  3922. /*! exports provided: SyntaxError */
  3923. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3924. "use strict";
  3925. __webpack_require__.r(__webpack_exports__);
  3926. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyntaxError", function() { return SyntaxError; });
  3927. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3928. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3929. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3930. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3931. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3932. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  3933. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  3934. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  3935. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  3936. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3937. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3938. var SyntaxError =
  3939. /*#__PURE__*/
  3940. function (_Error) {
  3941. _inherits(SyntaxError, _Error);
  3942. function SyntaxError() {
  3943. var _getPrototypeOf2;
  3944. var _this;
  3945. _classCallCheck(this, SyntaxError);
  3946. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  3947. msg[_key] = arguments[_key];
  3948. }
  3949. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SyntaxError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  3950. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), SyntaxError);
  3951. return _this;
  3952. }
  3953. return SyntaxError;
  3954. }(_wrapNativeSuper(Error));
  3955. /***/ }),
  3956. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3957. /*!********************************************!*\
  3958. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3959. \********************************************/
  3960. /*! exports provided: SyntaxErrorFactory */
  3961. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3962. "use strict";
  3963. __webpack_require__.r(__webpack_exports__);
  3964. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyntaxErrorFactory", function() { return SyntaxErrorFactory; });
  3965. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3966. /* harmony import */ var _syntaxError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3967. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__["getInstance"]();
  3968. var SyntaxErrorFactory = Object.freeze({
  3969. extra_lines: function extra_lines() {
  3970. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("extra_lines"));
  3971. },
  3972. token_missing_one: function token_missing_one(expected, token) {
  3973. var context = [expected, token.text, token.line, token.column];
  3974. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("token_missing_one", context));
  3975. },
  3976. token_missing_list: function token_missing_list(expectedList, token) {
  3977. var line = expectedList.join(LocalizedStrings.getOR());
  3978. return SyntaxErrorFactory.token_missing_one(line, token);
  3979. },
  3980. id_missing: function id_missing(token) {
  3981. var context = [token.text, token.line, token.column];
  3982. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("id_missing", context));
  3983. },
  3984. eos_missing: function eos_missing(token) {
  3985. var context = [token.line, token.column];
  3986. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("eos_missing", context));
  3987. },
  3988. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3989. var context = [token.line, token.column, typeName];
  3990. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_array_dimension", context));
  3991. },
  3992. invalid_array_size: function invalid_array_size(token) {
  3993. var context = [token.line];
  3994. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_array_size", context));
  3995. },
  3996. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3997. var context = [name, typeName, token.line];
  3998. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_main_return", context));
  3999. },
  4000. invalid_var_declaration: function invalid_var_declaration(token) {
  4001. var context = [token.line];
  4002. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_var_declaration", context));
  4003. },
  4004. invalid_break_command: function invalid_break_command(cmdName, token) {
  4005. var context = [token.line, cmdName];
  4006. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_break_command", context));
  4007. },
  4008. invalid_terminal: function invalid_terminal(token) {
  4009. var context = [token.text, token.line, token.column];
  4010. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError('invalid_terminal', context));
  4011. },
  4012. invalid_type: function invalid_type(list, token) {
  4013. var line = list.join(LocalizedStrings.getOR());
  4014. var context = [token.text, token.line, token.column, line];
  4015. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_type", context));
  4016. },
  4017. const_not_init: function const_not_init(token) {
  4018. var context = [token.line, token.column];
  4019. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("const_not_init", context));
  4020. },
  4021. invalid_id_format: function invalid_id_format(token) {
  4022. var context = [token.text, token.line, token.column];
  4023. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_id_format", context));
  4024. },
  4025. duplicate_function: function duplicate_function(token) {
  4026. var context = [token.text, token.line, token.column];
  4027. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("duplicate_function", context));
  4028. },
  4029. main_parameters: function main_parameters() {
  4030. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("main_parameters"));
  4031. },
  4032. duplicate_variable: function duplicate_variable(token) {
  4033. var context = [token.text, token.line, token.column];
  4034. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("duplicate_variable", context));
  4035. }
  4036. });
  4037. /***/ }),
  4038. /***/ "./js/ast/expressions/arrayAccess.js":
  4039. /*!*******************************************!*\
  4040. !*** ./js/ast/expressions/arrayAccess.js ***!
  4041. \*******************************************/
  4042. /*! exports provided: ArrayAccess */
  4043. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4044. "use strict";
  4045. __webpack_require__.r(__webpack_exports__);
  4046. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayAccess", function() { return ArrayAccess; });
  4047. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4048. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4049. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4050. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4051. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4052. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4053. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4054. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4055. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4056. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4057. var ArrayAccess =
  4058. /*#__PURE__*/
  4059. function (_Expression) {
  4060. _inherits(ArrayAccess, _Expression);
  4061. function ArrayAccess(id, line, column) {
  4062. var _this;
  4063. _classCallCheck(this, ArrayAccess);
  4064. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayAccess).call(this));
  4065. _this.id = id;
  4066. _this.line = line;
  4067. _this.column = column;
  4068. return _this;
  4069. }
  4070. _createClass(ArrayAccess, [{
  4071. key: "toString",
  4072. value: function toString() {
  4073. var strLine = this.line.toString();
  4074. var strColumn = null;
  4075. if (this.column) {
  4076. strColumn = this.column.toString();
  4077. }
  4078. if (strColumn) {
  4079. return "".concat(this.id, "[").concat(strLine, "][").concat(strColumn, "]");
  4080. } else {
  4081. return "".concat(this.id, "[").concat(strLine, "]");
  4082. }
  4083. }
  4084. }]);
  4085. return ArrayAccess;
  4086. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4087. /***/ }),
  4088. /***/ "./js/ast/expressions/arrayLiteral.js":
  4089. /*!********************************************!*\
  4090. !*** ./js/ast/expressions/arrayLiteral.js ***!
  4091. \********************************************/
  4092. /*! exports provided: ArrayLiteral */
  4093. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4094. "use strict";
  4095. __webpack_require__.r(__webpack_exports__);
  4096. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayLiteral", function() { return ArrayLiteral; });
  4097. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4098. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4099. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4100. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4101. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4102. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4103. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4104. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4105. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4106. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4107. var ArrayLiteral =
  4108. /*#__PURE__*/
  4109. function (_Literal) {
  4110. _inherits(ArrayLiteral, _Literal);
  4111. function ArrayLiteral(type, value) {
  4112. var _this;
  4113. _classCallCheck(this, ArrayLiteral);
  4114. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayLiteral).call(this, type));
  4115. _this.value = value;
  4116. return _this;
  4117. }
  4118. _createClass(ArrayLiteral, [{
  4119. key: "validateType",
  4120. value: function validateType() {
  4121. // let valid = true;
  4122. // if(this.columns !== null) {
  4123. // const len = this.columns;
  4124. // const len2 = this.lines;
  4125. // for (let i = len - 1; i >= 0; i--) {
  4126. // for (let j = len2 - 1; j >= 0; j--) {
  4127. // if(this.value[i].value[j].type !== this.subtype) {
  4128. // valid = false;
  4129. // break;
  4130. // }
  4131. // }
  4132. // }
  4133. // } else {
  4134. // const len = this.lines;
  4135. // for (var i = len - 1; i >= 0; i--) {
  4136. // if(this.value[i].type !== this.subtype) {
  4137. // valid = false;
  4138. // break;
  4139. // }
  4140. // }
  4141. // }
  4142. return true; //valid;
  4143. }
  4144. }, {
  4145. key: "validateSize",
  4146. value: function validateSize() {
  4147. var valid = true;
  4148. if (this.columns !== null) {
  4149. var equalityTest = data.value.map(function (v) {
  4150. return v.length;
  4151. }).reduce(function (old, next) {
  4152. if (old === null) {
  4153. return next;
  4154. } else if (old === next) {
  4155. return old;
  4156. } else {
  4157. return -1;
  4158. }
  4159. }, null);
  4160. valid = equalityTest !== -1;
  4161. }
  4162. return valid;
  4163. }
  4164. }, {
  4165. key: "toString",
  4166. value: function toString() {
  4167. var strList = this.value.map(function (arrayLiteral) {
  4168. return arrayLiteral.toString();
  4169. });
  4170. return "{" + strList.join(',') + "}";
  4171. }
  4172. }, {
  4173. key: "subtype",
  4174. get: function get() {
  4175. var element = this.value[0];
  4176. if (element instanceof ArrayLiteral) {
  4177. return element.value[0].type;
  4178. } else {
  4179. return element.type;
  4180. }
  4181. }
  4182. }, {
  4183. key: "lines",
  4184. get: function get() {
  4185. return this.value.length;
  4186. }
  4187. }, {
  4188. key: "columns",
  4189. get: function get() {
  4190. var element = this.value[0];
  4191. if (!(element instanceof ArrayLiteral)) {
  4192. return null;
  4193. } else {
  4194. return element.value[0].length;
  4195. }
  4196. }
  4197. }, {
  4198. key: "isVector",
  4199. get: function get() {
  4200. return this.columns === null;
  4201. }
  4202. }, {
  4203. key: "isValid",
  4204. get: function get() {
  4205. return true; //this.validateType() && this.validateSize();
  4206. }
  4207. }]);
  4208. return ArrayLiteral;
  4209. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4210. /***/ }),
  4211. /***/ "./js/ast/expressions/boolLiteral.js":
  4212. /*!*******************************************!*\
  4213. !*** ./js/ast/expressions/boolLiteral.js ***!
  4214. \*******************************************/
  4215. /*! exports provided: BoolLiteral */
  4216. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4217. "use strict";
  4218. __webpack_require__.r(__webpack_exports__);
  4219. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoolLiteral", function() { return BoolLiteral; });
  4220. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4221. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4222. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4223. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4224. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4225. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4226. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4227. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4228. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4229. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4230. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4231. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4232. var BoolLiteral =
  4233. /*#__PURE__*/
  4234. function (_Literal) {
  4235. _inherits(BoolLiteral, _Literal);
  4236. function BoolLiteral(value) {
  4237. var _this;
  4238. _classCallCheck(this, BoolLiteral);
  4239. _this = _possibleConstructorReturn(this, _getPrototypeOf(BoolLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN));
  4240. _this.value = value;
  4241. return _this;
  4242. }
  4243. _createClass(BoolLiteral, [{
  4244. key: "toString",
  4245. value: function toString() {
  4246. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertBoolToString"])(this.value);
  4247. }
  4248. }]);
  4249. return BoolLiteral;
  4250. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4251. /***/ }),
  4252. /***/ "./js/ast/expressions/expression.js":
  4253. /*!******************************************!*\
  4254. !*** ./js/ast/expressions/expression.js ***!
  4255. \******************************************/
  4256. /*! exports provided: Expression */
  4257. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4258. "use strict";
  4259. __webpack_require__.r(__webpack_exports__);
  4260. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Expression", function() { return Expression; });
  4261. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4262. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4263. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4264. var Expression =
  4265. /*#__PURE__*/
  4266. function () {
  4267. function Expression() {
  4268. _classCallCheck(this, Expression);
  4269. this._sourceInfo = null;
  4270. }
  4271. _createClass(Expression, [{
  4272. key: "sourceInfo",
  4273. set: function set(sourceInfo) {
  4274. this._sourceInfo = sourceInfo;
  4275. },
  4276. get: function get() {
  4277. return this._sourceInfo;
  4278. }
  4279. }]);
  4280. return Expression;
  4281. }();
  4282. /***/ }),
  4283. /***/ "./js/ast/expressions/functionCall.js":
  4284. /*!********************************************!*\
  4285. !*** ./js/ast/expressions/functionCall.js ***!
  4286. \********************************************/
  4287. /*! exports provided: FunctionCall */
  4288. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4289. "use strict";
  4290. __webpack_require__.r(__webpack_exports__);
  4291. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return FunctionCall; });
  4292. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4293. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4294. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4295. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4296. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4297. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4298. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4299. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4300. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4301. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4302. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4303. var FunctionCall =
  4304. /*#__PURE__*/
  4305. function (_Expression) {
  4306. _inherits(FunctionCall, _Expression);
  4307. function FunctionCall(id, actualParameters) {
  4308. var _this;
  4309. _classCallCheck(this, FunctionCall);
  4310. _this = _possibleConstructorReturn(this, _getPrototypeOf(FunctionCall).call(this));
  4311. _this.id = id;
  4312. _this.actualParameters = actualParameters;
  4313. return _this;
  4314. }
  4315. _createClass(FunctionCall, [{
  4316. key: "toString",
  4317. value: function toString() {
  4318. var name = null;
  4319. if (this.isMainCall) {
  4320. name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName();
  4321. } else {
  4322. name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getLocalName(this.id);
  4323. }
  4324. var params = null;
  4325. if (this.actualParameters.length == 0) {
  4326. params = "()";
  4327. } else {
  4328. var strParams = this.actualParameters.map(function (v) {
  4329. return v.toString();
  4330. });
  4331. params = "(" + strParams.join(",") + ")";
  4332. }
  4333. return name + params;
  4334. }
  4335. }, {
  4336. key: "isMainCall",
  4337. get: function get() {
  4338. return this.id === null;
  4339. }
  4340. }, {
  4341. key: "parametersSize",
  4342. get: function get() {
  4343. return this.actualParameters.length;
  4344. }
  4345. }]);
  4346. return FunctionCall;
  4347. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4348. /***/ }),
  4349. /***/ "./js/ast/expressions/index.js":
  4350. /*!*************************************!*\
  4351. !*** ./js/ast/expressions/index.js ***!
  4352. \*************************************/
  4353. /*! exports provided: ArrayAccess, FunctionCall, IntLiteral, RealLiteral, BoolLiteral, StringLiteral, ArrayLiteral, VariableLiteral, InfixApp, UnaryApp */
  4354. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4355. "use strict";
  4356. __webpack_require__.r(__webpack_exports__);
  4357. /* harmony import */ var _arrayAccess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4358. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayAccess", function() { return _arrayAccess__WEBPACK_IMPORTED_MODULE_0__["ArrayAccess"]; });
  4359. /* harmony import */ var _functionCall__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4360. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return _functionCall__WEBPACK_IMPORTED_MODULE_1__["FunctionCall"]; });
  4361. /* harmony import */ var _intLiteral__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4362. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntLiteral", function() { return _intLiteral__WEBPACK_IMPORTED_MODULE_2__["IntLiteral"]; });
  4363. /* harmony import */ var _realLiteral__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4364. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RealLiteral", function() { return _realLiteral__WEBPACK_IMPORTED_MODULE_3__["RealLiteral"]; });
  4365. /* harmony import */ var _boolLiteral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4366. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoolLiteral", function() { return _boolLiteral__WEBPACK_IMPORTED_MODULE_4__["BoolLiteral"]; });
  4367. /* harmony import */ var _stringLiteral__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4368. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StringLiteral", function() { return _stringLiteral__WEBPACK_IMPORTED_MODULE_5__["StringLiteral"]; });
  4369. /* harmony import */ var _arrayLiteral__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4370. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayLiteral", function() { return _arrayLiteral__WEBPACK_IMPORTED_MODULE_6__["ArrayLiteral"]; });
  4371. /* harmony import */ var _variableLiteral__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4372. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VariableLiteral", function() { return _variableLiteral__WEBPACK_IMPORTED_MODULE_7__["VariableLiteral"]; });
  4373. /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4374. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InfixApp", function() { return _infixApp__WEBPACK_IMPORTED_MODULE_8__["InfixApp"]; });
  4375. /* harmony import */ var _unaryApp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4376. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UnaryApp", function() { return _unaryApp__WEBPACK_IMPORTED_MODULE_9__["UnaryApp"]; });
  4377. /***/ }),
  4378. /***/ "./js/ast/expressions/infixApp.js":
  4379. /*!****************************************!*\
  4380. !*** ./js/ast/expressions/infixApp.js ***!
  4381. \****************************************/
  4382. /*! exports provided: InfixApp */
  4383. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4384. "use strict";
  4385. __webpack_require__.r(__webpack_exports__);
  4386. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InfixApp", function() { return InfixApp; });
  4387. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4388. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4389. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4390. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4391. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4392. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4393. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4394. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4395. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4396. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4397. var InfixApp =
  4398. /*#__PURE__*/
  4399. function (_Expression) {
  4400. _inherits(InfixApp, _Expression);
  4401. function InfixApp(op, left, right) {
  4402. var _this;
  4403. _classCallCheck(this, InfixApp);
  4404. _this = _possibleConstructorReturn(this, _getPrototypeOf(InfixApp).call(this));
  4405. _this.op = op;
  4406. _this.left = left;
  4407. _this.right = right;
  4408. return _this;
  4409. }
  4410. _createClass(InfixApp, [{
  4411. key: "toString",
  4412. value: function toString() {
  4413. var l = this.left.toString();
  4414. var op = this.op.value;
  4415. var r = this.right.toString();
  4416. return l + op + r;
  4417. }
  4418. }]);
  4419. return InfixApp;
  4420. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4421. /***/ }),
  4422. /***/ "./js/ast/expressions/intLiteral.js":
  4423. /*!******************************************!*\
  4424. !*** ./js/ast/expressions/intLiteral.js ***!
  4425. \******************************************/
  4426. /*! exports provided: IntLiteral */
  4427. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4428. "use strict";
  4429. __webpack_require__.r(__webpack_exports__);
  4430. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntLiteral", function() { return IntLiteral; });
  4431. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4432. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4433. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4434. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4435. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4436. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4437. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4438. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4439. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4440. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4441. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4442. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4443. var IntLiteral =
  4444. /*#__PURE__*/
  4445. function (_Literal) {
  4446. _inherits(IntLiteral, _Literal);
  4447. function IntLiteral(value) {
  4448. var _this;
  4449. _classCallCheck(this, IntLiteral);
  4450. _this = _possibleConstructorReturn(this, _getPrototypeOf(IntLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER));
  4451. _this.value = value;
  4452. return _this;
  4453. }
  4454. _createClass(IntLiteral, [{
  4455. key: "toString",
  4456. value: function toString() {
  4457. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(this.value, this.type);
  4458. }
  4459. }]);
  4460. return IntLiteral;
  4461. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4462. /***/ }),
  4463. /***/ "./js/ast/expressions/literal.js":
  4464. /*!***************************************!*\
  4465. !*** ./js/ast/expressions/literal.js ***!
  4466. \***************************************/
  4467. /*! exports provided: Literal */
  4468. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4469. "use strict";
  4470. __webpack_require__.r(__webpack_exports__);
  4471. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Literal", function() { return Literal; });
  4472. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4473. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4474. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4475. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4476. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4477. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4478. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4479. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4480. var Literal =
  4481. /*#__PURE__*/
  4482. function (_Expression) {
  4483. _inherits(Literal, _Expression);
  4484. function Literal(type) {
  4485. var _this;
  4486. _classCallCheck(this, Literal);
  4487. _this = _possibleConstructorReturn(this, _getPrototypeOf(Literal).call(this));
  4488. _this.type = type;
  4489. return _this;
  4490. }
  4491. return Literal;
  4492. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4493. /***/ }),
  4494. /***/ "./js/ast/expressions/realLiteral.js":
  4495. /*!*******************************************!*\
  4496. !*** ./js/ast/expressions/realLiteral.js ***!
  4497. \*******************************************/
  4498. /*! exports provided: RealLiteral */
  4499. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4500. "use strict";
  4501. __webpack_require__.r(__webpack_exports__);
  4502. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RealLiteral", function() { return RealLiteral; });
  4503. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4504. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4505. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4506. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4507. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4508. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4509. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4510. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4511. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4512. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4513. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4514. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4515. var RealLiteral =
  4516. /*#__PURE__*/
  4517. function (_Literal) {
  4518. _inherits(RealLiteral, _Literal);
  4519. function RealLiteral(value) {
  4520. var _this;
  4521. _classCallCheck(this, RealLiteral);
  4522. _this = _possibleConstructorReturn(this, _getPrototypeOf(RealLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL));
  4523. _this.value = value;
  4524. return _this;
  4525. }
  4526. _createClass(RealLiteral, [{
  4527. key: "toString",
  4528. value: function toString() {
  4529. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(this.value, this.type);
  4530. }
  4531. }]);
  4532. return RealLiteral;
  4533. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4534. /***/ }),
  4535. /***/ "./js/ast/expressions/stringLiteral.js":
  4536. /*!*********************************************!*\
  4537. !*** ./js/ast/expressions/stringLiteral.js ***!
  4538. \*********************************************/
  4539. /*! exports provided: StringLiteral */
  4540. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4541. "use strict";
  4542. __webpack_require__.r(__webpack_exports__);
  4543. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringLiteral", function() { return StringLiteral; });
  4544. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4545. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4546. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4547. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4548. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4549. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4550. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4551. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4552. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4553. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4554. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4555. var StringLiteral =
  4556. /*#__PURE__*/
  4557. function (_Literal) {
  4558. _inherits(StringLiteral, _Literal);
  4559. function StringLiteral(value) {
  4560. var _this;
  4561. _classCallCheck(this, StringLiteral);
  4562. _this = _possibleConstructorReturn(this, _getPrototypeOf(StringLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].STRING));
  4563. _this.value = value;
  4564. return _this;
  4565. }
  4566. _createClass(StringLiteral, [{
  4567. key: "toString",
  4568. value: function toString() {
  4569. return '"' + this.value + '"';
  4570. }
  4571. }]);
  4572. return StringLiteral;
  4573. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4574. /***/ }),
  4575. /***/ "./js/ast/expressions/unaryApp.js":
  4576. /*!****************************************!*\
  4577. !*** ./js/ast/expressions/unaryApp.js ***!
  4578. \****************************************/
  4579. /*! exports provided: UnaryApp */
  4580. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4581. "use strict";
  4582. __webpack_require__.r(__webpack_exports__);
  4583. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnaryApp", function() { return UnaryApp; });
  4584. /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4585. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4586. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4587. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4588. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4589. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4590. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4591. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4592. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4593. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4594. var UnaryApp =
  4595. /*#__PURE__*/
  4596. function (_InfixApp) {
  4597. _inherits(UnaryApp, _InfixApp);
  4598. function UnaryApp(op, left) {
  4599. _classCallCheck(this, UnaryApp);
  4600. return _possibleConstructorReturn(this, _getPrototypeOf(UnaryApp).call(this, op, left, null));
  4601. }
  4602. _createClass(UnaryApp, [{
  4603. key: "toString",
  4604. value: function toString() {
  4605. var l = this.left.toString();
  4606. var op = this.op.value;
  4607. return op + l;
  4608. }
  4609. }]);
  4610. return UnaryApp;
  4611. }(_infixApp__WEBPACK_IMPORTED_MODULE_0__["InfixApp"]);
  4612. /***/ }),
  4613. /***/ "./js/ast/expressions/variableLiteral.js":
  4614. /*!***********************************************!*\
  4615. !*** ./js/ast/expressions/variableLiteral.js ***!
  4616. \***********************************************/
  4617. /*! exports provided: VariableLiteral */
  4618. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4619. "use strict";
  4620. __webpack_require__.r(__webpack_exports__);
  4621. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableLiteral", function() { return VariableLiteral; });
  4622. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4623. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4624. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4625. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4626. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4627. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4628. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4629. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4630. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4631. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4632. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4633. var VariableLiteral =
  4634. /*#__PURE__*/
  4635. function (_Literal) {
  4636. _inherits(VariableLiteral, _Literal);
  4637. function VariableLiteral(id) {
  4638. var _this;
  4639. _classCallCheck(this, VariableLiteral);
  4640. _this = _possibleConstructorReturn(this, _getPrototypeOf(VariableLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].UNDEFINED));
  4641. _this.id = id;
  4642. return _this;
  4643. }
  4644. _createClass(VariableLiteral, [{
  4645. key: "toString",
  4646. value: function toString() {
  4647. return this.id;
  4648. }
  4649. }]);
  4650. return VariableLiteral;
  4651. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4652. /***/ }),
  4653. /***/ "./js/ast/ivprogParser.js":
  4654. /*!********************************!*\
  4655. !*** ./js/ast/ivprogParser.js ***!
  4656. \********************************/
  4657. /*! exports provided: IVProgParser */
  4658. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4659. "use strict";
  4660. __webpack_require__.r(__webpack_exports__);
  4661. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgParser", function() { return IVProgParser; });
  4662. /* harmony import */ var antlr4_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4663. /* harmony import */ var antlr4_index__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(antlr4_index__WEBPACK_IMPORTED_MODULE_0__);
  4664. /* harmony import */ var _expressions___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4665. /* harmony import */ var _commands___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4666. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4667. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4668. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4669. /* harmony import */ var _sourceInfo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4670. /* harmony import */ var _operators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4671. /* harmony import */ var _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4672. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4673. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4674. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4675. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4676. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4677. var IVProgParser =
  4678. /*#__PURE__*/
  4679. function () {
  4680. _createClass(IVProgParser, null, [{
  4681. key: "createParser",
  4682. value: function createParser(input) {
  4683. var lexerClass = _services_languageService__WEBPACK_IMPORTED_MODULE_10__["LanguageService"].getCurrentLexer();
  4684. return new IVProgParser(input, lexerClass);
  4685. } // <BEGIN scope consts>
  4686. }, {
  4687. key: "BASE",
  4688. get: function get() {
  4689. return 0;
  4690. }
  4691. }, {
  4692. key: "FUNCTION",
  4693. get: function get() {
  4694. return 1;
  4695. }
  4696. }, {
  4697. key: "COMMAND",
  4698. get: function get() {
  4699. return 2;
  4700. }
  4701. }, {
  4702. key: "BREAKABLE",
  4703. get: function get() {
  4704. return 4;
  4705. } // </ END scope consts>
  4706. }]);
  4707. function IVProgParser(input, lexerClass) {
  4708. _classCallCheck(this, IVProgParser);
  4709. this.lexerClass = lexerClass;
  4710. this.lexer = new lexerClass(new antlr4_index__WEBPACK_IMPORTED_MODULE_0__["InputStream"](input));
  4711. this.tokenStream = new antlr4_index__WEBPACK_IMPORTED_MODULE_0__["CommonTokenStream"](this.lexer);
  4712. this.tokenStream.fill();
  4713. this.pos = 1;
  4714. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4715. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4716. this.parsingArrayDimension = 0;
  4717. this.scope = [];
  4718. this.langFuncs = _services_languageService__WEBPACK_IMPORTED_MODULE_10__["LanguageService"].getCurrentLangFuncs();
  4719. this.definedFuncsNameList = [];
  4720. this.definedVariablesStack = [];
  4721. }
  4722. _createClass(IVProgParser, [{
  4723. key: "parseTree",
  4724. value: function parseTree() {
  4725. return this.parseProgram();
  4726. }
  4727. }, {
  4728. key: "getToken",
  4729. value: function getToken() {
  4730. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4731. // if(index === null)
  4732. // index = this.pos;
  4733. return this.tokenStream.LT(index);
  4734. }
  4735. }, {
  4736. key: "insideScope",
  4737. value: function insideScope(scope) {
  4738. if (this.scope.length <= 0) {
  4739. return IVProgParser.BASE === scope;
  4740. } else {
  4741. return this.scope[this.scope.length - 1] === scope;
  4742. }
  4743. }
  4744. }, {
  4745. key: "pushScope",
  4746. value: function pushScope(scope) {
  4747. this.scope.push(scope);
  4748. }
  4749. }, {
  4750. key: "pushVariableStack",
  4751. value: function pushVariableStack() {
  4752. this.definedVariablesStack.push([]);
  4753. }
  4754. }, {
  4755. key: "popScope",
  4756. value: function popScope() {
  4757. return this.scope.pop();
  4758. }
  4759. }, {
  4760. key: "popVariableStack",
  4761. value: function popVariableStack() {
  4762. return this.definedVariablesStack.pop();
  4763. }
  4764. }, {
  4765. key: "getCurrentVariableStack",
  4766. value: function getCurrentVariableStack() {
  4767. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4768. }
  4769. }, {
  4770. key: "isEOF",
  4771. value: function isEOF() {
  4772. this.getToken(this.pos);
  4773. return this.tokenStream.fetchedEOF;
  4774. }
  4775. }, {
  4776. key: "parseProgram",
  4777. value: function parseProgram() {
  4778. var token = this.getToken();
  4779. var globalVars = [];
  4780. var functions = [];
  4781. if (this.lexerClass.RK_PROGRAM === token.type) {
  4782. this.pos++;
  4783. this.consumeNewLines();
  4784. this.checkOpenCurly();
  4785. this.pos++;
  4786. this.pushVariableStack();
  4787. while (true) {
  4788. this.consumeNewLines();
  4789. var _token = this.getToken();
  4790. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4791. globalVars = globalVars.concat(this.parseGlobalVariables());
  4792. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4793. this.pushVariableStack();
  4794. functions = functions.concat(this.parseFunction());
  4795. this.popVariableStack();
  4796. } else {
  4797. break;
  4798. }
  4799. }
  4800. this.consumeNewLines();
  4801. this.checkCloseCurly();
  4802. this.pos++;
  4803. this.consumeNewLines();
  4804. if (!this.isEOF()) {
  4805. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].extra_lines();
  4806. }
  4807. this.popVariableStack();
  4808. return {
  4809. global: globalVars,
  4810. functions: functions
  4811. };
  4812. } else {
  4813. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4814. }
  4815. }
  4816. }, {
  4817. key: "checkOpenCurly",
  4818. value: function checkOpenCurly() {
  4819. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4820. var token = this.getToken();
  4821. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4822. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('{', token);else return false;
  4823. }
  4824. return true;
  4825. }
  4826. }, {
  4827. key: "checkCloseCurly",
  4828. value: function checkCloseCurly() {
  4829. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4830. var token = this.getToken();
  4831. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4832. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('}', token);else return false;
  4833. }
  4834. return true;
  4835. }
  4836. /* It checks if the current token at position pos is a ']'.
  4837. * As a check function it doesn't increment pos.
  4838. *
  4839. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4840. *
  4841. * @returns true if the attempt is true and current token is '[',
  4842. * false is attempt is true and current token is not '['
  4843. **/
  4844. }, {
  4845. key: "checkOpenBrace",
  4846. value: function checkOpenBrace() {
  4847. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4848. var token = this.getToken();
  4849. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4850. if (!attempt) {
  4851. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('[', token);
  4852. } else {
  4853. return false;
  4854. }
  4855. }
  4856. return true;
  4857. }
  4858. }, {
  4859. key: "checkCloseBrace",
  4860. value: function checkCloseBrace() {
  4861. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4862. var token = this.getToken();
  4863. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4864. if (!attempt) {
  4865. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(']', token);
  4866. } else {
  4867. return false;
  4868. }
  4869. }
  4870. return true;
  4871. }
  4872. }, {
  4873. key: "checkOpenParenthesis",
  4874. value: function checkOpenParenthesis() {
  4875. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4876. var token = this.getToken();
  4877. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4878. if (!attempt) {
  4879. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('(', token);
  4880. } else {
  4881. return false;
  4882. }
  4883. }
  4884. return true;
  4885. }
  4886. }, {
  4887. key: "checkCloseParenthesis",
  4888. value: function checkCloseParenthesis() {
  4889. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4890. var token = this.getToken();
  4891. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4892. if (!attempt) {
  4893. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(')', token);
  4894. } else {
  4895. return false;
  4896. }
  4897. }
  4898. return true;
  4899. }
  4900. }, {
  4901. key: "checkEOS",
  4902. value: function checkEOS() {
  4903. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4904. var eosToken = this.getToken();
  4905. if (eosToken.type !== this.lexerClass.EOS) {
  4906. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].eos_missing(eosToken);else return false;
  4907. }
  4908. return true;
  4909. }
  4910. }, {
  4911. key: "checkFunctionDuplicate",
  4912. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4913. var id = functionID === null ? "$main" : functionID;
  4914. var index = this.definedFuncsNameList.indexOf(id);
  4915. if (index !== -1) {
  4916. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].duplicate_function(funcIDToken);
  4917. }
  4918. this.definedFuncsNameList.push(id);
  4919. }
  4920. }, {
  4921. key: "checkVariableDuplicate",
  4922. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4923. var index = this.getCurrentVariableStack().indexOf(variableID);
  4924. if (index !== -1) {
  4925. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].duplicate_variable(variableIDToken);
  4926. }
  4927. this.getCurrentVariableStack().push(variableID);
  4928. }
  4929. }, {
  4930. key: "consumeForSemiColon",
  4931. value: function consumeForSemiColon() {
  4932. var eosToken = this.getToken();
  4933. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4934. this.pos++;
  4935. return;
  4936. }
  4937. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(';', eosToken);
  4938. }
  4939. }, {
  4940. key: "parseGlobalVariables",
  4941. value: function parseGlobalVariables() {
  4942. var decl = this.parseMaybeConst();
  4943. this.checkEOS();
  4944. this.pos++;
  4945. return decl;
  4946. }
  4947. /*
  4948. * Checks if the next token is PR_CONST. It's only available
  4949. * at global variables declaration level
  4950. * @returns Declararion(const, type, id, initVal?)
  4951. **/
  4952. }, {
  4953. key: "parseMaybeConst",
  4954. value: function parseMaybeConst() {
  4955. var constToken = this.getToken();
  4956. if (constToken.type === this.lexerClass.RK_CONST) {
  4957. this.pos++;
  4958. var typeString = this.parseType();
  4959. return this.parseDeclaration(typeString, true);
  4960. } else if (this.isVariableType(constToken)) {
  4961. var _typeString = this.parseType();
  4962. return this.parseDeclaration(_typeString);
  4963. } else {
  4964. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4965. }
  4966. }
  4967. /*
  4968. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4969. * @returns a list of Declararion(const, type, id, initVal?)
  4970. **/
  4971. }, {
  4972. key: "parseDeclaration",
  4973. value: function parseDeclaration(typeString) {
  4974. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4975. var initial = null;
  4976. var dim1 = null;
  4977. var dim2 = null;
  4978. var idToken = this.getToken();
  4979. var idString = this.parseID();
  4980. this.checkVariableDuplicate(idString, idToken); // Check for array or vector
  4981. // ID[int/IDi][int/IDj]
  4982. if (this.checkOpenBrace(true)) {
  4983. this.pos++;
  4984. this.consumeNewLines();
  4985. dim1 = this.parseArrayDimension();
  4986. this.consumeNewLines();
  4987. this.checkCloseBrace();
  4988. this.pos++;
  4989. if (this.checkOpenBrace(true)) {
  4990. this.pos++;
  4991. this.consumeNewLines();
  4992. dim2 = this.parseArrayDimension();
  4993. this.consumeNewLines();
  4994. this.checkCloseBrace();
  4995. this.pos++;
  4996. }
  4997. }
  4998. var equalsToken = this.getToken();
  4999. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  5000. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].const_not_init(idToken);
  5001. }
  5002. if (equalsToken.type === this.lexerClass.EQUAL) {
  5003. this.pos++;
  5004. initial = this.parseExpressionOR();
  5005. }
  5006. var declaration = null;
  5007. var dimensions = 0;
  5008. if (dim1 !== null) {
  5009. dimensions++;
  5010. if (dim2 !== null) {
  5011. dimensions++;
  5012. }
  5013. declaration = new _commands___WEBPACK_IMPORTED_MODULE_2__["ArrayDeclaration"](idString, new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](typeString, dimensions), dim1, dim2, initial, isConst);
  5014. } else {
  5015. declaration = new _commands___WEBPACK_IMPORTED_MODULE_2__["Declaration"](idString, typeString, initial, isConst);
  5016. }
  5017. declaration.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(idToken);
  5018. var commaToken = this.getToken();
  5019. if (commaToken.type === this.lexerClass.COMMA) {
  5020. this.pos++;
  5021. this.consumeNewLines();
  5022. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  5023. } else {
  5024. return [declaration];
  5025. }
  5026. }
  5027. }, {
  5028. key: "consumeNewLines",
  5029. value: function consumeNewLines() {
  5030. var token = this.getToken();
  5031. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  5032. this.pos++;
  5033. token = this.getToken();
  5034. }
  5035. }
  5036. }, {
  5037. key: "isVariableType",
  5038. value: function isVariableType(token) {
  5039. return this.variableTypes.find(function (v) {
  5040. return v === token.type;
  5041. });
  5042. }
  5043. /*
  5044. * Reads the next token of the stream to check if it is a Integer or an ID.
  5045. * @returns Integer | ID
  5046. **/
  5047. }, {
  5048. key: "parseArrayDimension",
  5049. value: function parseArrayDimension() {
  5050. var dimToken = this.getToken();
  5051. if (dimToken.type === this.lexerClass.INTEGER) {
  5052. //parse as int literal
  5053. this.pos++;
  5054. return this.getIntLiteral(dimToken);
  5055. } else if (dimToken.type === this.lexerClass.ID) {
  5056. //parse as variable
  5057. this.pos++;
  5058. return this.parseVariable(dimToken);
  5059. } else {
  5060. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  5061. }
  5062. }
  5063. /*
  5064. * Returns an object {type: 'int', value: value}.
  5065. * It checks for binary and hexadecimal integers.
  5066. * @returns object with fields type and value
  5067. **/
  5068. }, {
  5069. key: "getIntLiteral",
  5070. value: function getIntLiteral(token) {
  5071. var text = token.text;
  5072. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5073. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["IntLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(text));
  5074. exp.sourceInfo = sourceInfo;
  5075. return exp;
  5076. }
  5077. }, {
  5078. key: "getRealLiteral",
  5079. value: function getRealLiteral(token) {
  5080. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5081. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["RealLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(token.text));
  5082. exp.sourceInfo = sourceInfo;
  5083. return exp;
  5084. }
  5085. }, {
  5086. key: "getStringLiteral",
  5087. value: function getStringLiteral(token) {
  5088. var text = token.text;
  5089. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5090. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["StringLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toString"])(text));
  5091. exp.sourceInfo = sourceInfo;
  5092. return exp;
  5093. }
  5094. }, {
  5095. key: "getBoolLiteral",
  5096. value: function getBoolLiteral(token) {
  5097. var val = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toBool"])(token.text);
  5098. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["BoolLiteral"](val);
  5099. exp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5100. ;
  5101. return exp;
  5102. }
  5103. }, {
  5104. key: "parseArrayLiteral",
  5105. value: function parseArrayLiteral() {
  5106. this.checkOpenCurly();
  5107. var beginArray = this.getToken();
  5108. if (this.parsingArrayDimension >= 2) {
  5109. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list("Array dimensions exceed maximum size of 2 at line ".concat(beginArray.line));
  5110. }
  5111. this.pos++;
  5112. this.parsingArrayDimension++;
  5113. this.consumeNewLines();
  5114. var data = this.parseExpressionList();
  5115. this.consumeNewLines();
  5116. this.checkCloseCurly();
  5117. var endArray = this.getToken();
  5118. this.pos++;
  5119. this.parsingArrayDimension--;
  5120. if (this.parsingArrayDimension === 0) {// if (!data.isValid) {
  5121. // // TODO: better error message
  5122. // console.log('invalid array');
  5123. // throw new Error(`Invalid array at line ${beginArray.line}`);
  5124. // }
  5125. }
  5126. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(beginArray, endArray);
  5127. var dataDim = 1;
  5128. if (data[0] instanceof _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayLiteral"]) {
  5129. dataDim++;
  5130. }
  5131. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].UNDEFINED, dataDim);
  5132. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayLiteral"](type, data);
  5133. exp.sourceInfo = sourceInfo;
  5134. return exp;
  5135. }
  5136. /*
  5137. * Returns an object {type: 'variable', value: value}.
  5138. * @returns object with fields type and value
  5139. **/
  5140. }, {
  5141. key: "parseVariable",
  5142. value: function parseVariable(token) {
  5143. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5144. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["VariableLiteral"](token.text);
  5145. exp.sourceInfo = sourceInfo;
  5146. return exp;
  5147. }
  5148. /*
  5149. * Returns an object representing a function. It has
  5150. * four attributes: returnType, id, formalParams and block.
  5151. * The block object has two attributes: declarations and commands
  5152. **/
  5153. }, {
  5154. key: "parseFunction",
  5155. value: function parseFunction() {
  5156. this.pushScope(IVProgParser.FUNCTION);
  5157. var formalParams = [];
  5158. var token = this.getToken();
  5159. if (token.type !== this.lexerClass.RK_FUNCTION) {
  5160. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  5161. return null;
  5162. }
  5163. this.pos++;
  5164. var funType = this.parseType();
  5165. var dimensions = 0;
  5166. if (this.checkOpenBrace(true)) {
  5167. this.pos++;
  5168. this.checkCloseBrace();
  5169. this.pos++;
  5170. dimensions++;
  5171. if (this.checkOpenBrace(true)) {
  5172. this.pos++;
  5173. this.checkCloseBrace();
  5174. this.pos++;
  5175. dimensions++;
  5176. }
  5177. }
  5178. var funcIDToken = this.getToken();
  5179. var functionID = this.parseID();
  5180. this.checkFunctionDuplicate(functionID, funcIDToken);
  5181. this.checkOpenParenthesis();
  5182. this.pos++;
  5183. this.consumeNewLines();
  5184. if (!this.checkCloseParenthesis(true)) {
  5185. formalParams = this.parseFormalParameters(); // formal parameters
  5186. this.consumeNewLines();
  5187. this.checkCloseParenthesis();
  5188. this.pos++;
  5189. } else {
  5190. this.pos++;
  5191. }
  5192. this.consumeNewLines();
  5193. var commandsBlock = this.parseCommandBlock();
  5194. var returnType = funType;
  5195. if (dimensions > 0) {
  5196. returnType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](funType, dimensions);
  5197. }
  5198. var func = new _commands___WEBPACK_IMPORTED_MODULE_2__["Function"](functionID, returnType, formalParams, commandsBlock);
  5199. if (functionID === null && !func.isMain) {
  5200. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_main_return(_processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  5201. } else if (func.isMain && formalParams.length !== 0) {
  5202. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].main_parameters();
  5203. }
  5204. this.popScope();
  5205. return func;
  5206. }
  5207. /*
  5208. * Parse the formal parameters of a function.
  5209. * @returns a list of objects with the following attributes: type, id and dimensions.
  5210. **/
  5211. }, {
  5212. key: "parseFormalParameters",
  5213. value: function parseFormalParameters() {
  5214. var list = [];
  5215. while (true) {
  5216. var dimensions = 0;
  5217. var typeString = this.parseType();
  5218. var idToken = this.getToken();
  5219. var idString = this.parseID();
  5220. this.checkVariableDuplicate(idString, idToken);
  5221. if (this.checkOpenBrace(true)) {
  5222. this.pos++;
  5223. dimensions++;
  5224. this.checkCloseBrace();
  5225. this.pos++;
  5226. if (this.checkOpenBrace(true)) {
  5227. this.pos++;
  5228. dimensions++;
  5229. this.checkCloseBrace();
  5230. this.pos++;
  5231. }
  5232. }
  5233. var type = null;
  5234. if (dimensions > 0) {
  5235. type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](typeString, dimensions);
  5236. } else {
  5237. type = typeString;
  5238. }
  5239. list.push(new _commands___WEBPACK_IMPORTED_MODULE_2__["FormalParameter"](type, idString));
  5240. var commaToken = this.getToken();
  5241. if (commaToken.type !== this.lexerClass.COMMA) break;
  5242. this.pos++;
  5243. this.consumeNewLines();
  5244. }
  5245. return list;
  5246. }
  5247. }, {
  5248. key: "parseID",
  5249. value: function parseID() {
  5250. var token = this.getToken();
  5251. if (token.type !== this.lexerClass.ID) {
  5252. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].id_missing(token);
  5253. }
  5254. this.pos++;
  5255. if (this.insideScope(IVProgParser.FUNCTION)) {
  5256. if (token.text === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName()) {
  5257. return null;
  5258. }
  5259. }
  5260. return token.text;
  5261. }
  5262. }, {
  5263. key: "parseMaybeLibID",
  5264. value: function parseMaybeLibID() {
  5265. var token = this.getToken();
  5266. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5267. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].id_missing(token);
  5268. }
  5269. this.pos++;
  5270. return token.text;
  5271. }
  5272. }, {
  5273. key: "parseType",
  5274. value: function parseType() {
  5275. var token = this.getToken();
  5276. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5277. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].VOID;
  5278. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5279. this.pos++;
  5280. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].VOID;
  5281. } else if (this.isVariableType(token)) {
  5282. this.pos++;
  5283. switch (token.type) {
  5284. case this.lexerClass.RK_INTEGER:
  5285. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].INTEGER;
  5286. case this.lexerClass.RK_BOOLEAN:
  5287. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].BOOLEAN;
  5288. case this.lexerClass.RK_REAL:
  5289. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].REAL;
  5290. case this.lexerClass.RK_STRING:
  5291. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].STRING;
  5292. default:
  5293. break;
  5294. }
  5295. }
  5296. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_type(this.getTypeArray(), token);
  5297. }
  5298. }, {
  5299. key: "parseCommandBlock",
  5300. value: function parseCommandBlock() {
  5301. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5302. var variablesDecl = [];
  5303. var commands = [];
  5304. var hasOpen = false;
  5305. if (this.checkOpenCurly(optionalCurly)) {
  5306. this.pos++;
  5307. hasOpen = true;
  5308. }
  5309. this.consumeNewLines();
  5310. while (true) {
  5311. var cmd = this.parseCommand();
  5312. if (cmd === null) break;
  5313. if (cmd !== -1) {
  5314. if (cmd instanceof Array) {
  5315. variablesDecl = variablesDecl.concat(cmd);
  5316. } else {
  5317. commands.push(cmd);
  5318. }
  5319. }
  5320. }
  5321. this.consumeNewLines();
  5322. if (hasOpen) {
  5323. this.checkCloseCurly();
  5324. this.pos++;
  5325. this.consumeNewLines();
  5326. }
  5327. return new _commands___WEBPACK_IMPORTED_MODULE_2__["CommandBlock"](variablesDecl, commands);
  5328. }
  5329. }, {
  5330. key: "parseCommand",
  5331. value: function parseCommand() {
  5332. var token = this.getToken();
  5333. if (this.isVariableType(token)) {
  5334. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5335. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_var_declaration(token.line);
  5336. }
  5337. this.pushScope(IVProgParser.BASE);
  5338. var varType = this.parseType();
  5339. this.popScope();
  5340. var cmd = this.parseDeclaration(varType);
  5341. this.checkEOS();
  5342. this.pos++;
  5343. return cmd;
  5344. } else if (token.type === this.lexerClass.ID) {
  5345. return this.parseIDCommand();
  5346. } else if (token.type === this.lexerClass.LIB_ID) {
  5347. return this.parseIDCommand();
  5348. } else if (token.type === this.lexerClass.RK_RETURN) {
  5349. return this.parseReturn();
  5350. } else if (token.type === this.lexerClass.RK_WHILE) {
  5351. return this.parseWhile();
  5352. } else if (token.type === this.lexerClass.RK_FOR) {
  5353. return this.parseFor();
  5354. } else if (token.type === this.lexerClass.RK_BREAK) {
  5355. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5356. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5357. }
  5358. return this.parseBreak();
  5359. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5360. return this.parseSwitchCase();
  5361. } else if (token.type === this.lexerClass.RK_DO) {
  5362. return this.parseDoWhile();
  5363. } else if (token.type === this.lexerClass.RK_IF) {
  5364. return this.parseIfThenElse();
  5365. } else if (this.checkEOS(true)) {
  5366. this.pos++;
  5367. return -1;
  5368. } else {
  5369. return null;
  5370. }
  5371. }
  5372. }, {
  5373. key: "parseSwitchCase",
  5374. value: function parseSwitchCase() {
  5375. this.pushScope(IVProgParser.BREAKABLE);
  5376. this.pos++;
  5377. this.checkOpenParenthesis();
  5378. this.pos++;
  5379. this.consumeNewLines();
  5380. var exp = this.parseExpressionOR();
  5381. this.consumeNewLines();
  5382. this.checkCloseParenthesis();
  5383. this.pos++;
  5384. this.consumeNewLines();
  5385. this.checkOpenCurly();
  5386. this.pos++;
  5387. this.consumeNewLines();
  5388. var casesList = this.parseCases();
  5389. this.consumeNewLines();
  5390. this.checkCloseCurly();
  5391. this.pos++;
  5392. this.consumeNewLines();
  5393. this.popScope();
  5394. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Switch"](exp, casesList);
  5395. }
  5396. }, {
  5397. key: "parseDoWhile",
  5398. value: function parseDoWhile() {
  5399. this.pos++;
  5400. this.consumeNewLines();
  5401. this.pushScope(IVProgParser.BREAKABLE);
  5402. var commandsBlock = this.parseCommandBlock();
  5403. this.consumeNewLines(); //Maybe not...
  5404. var whileToken = this.getToken();
  5405. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5406. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5407. }
  5408. this.pos++;
  5409. this.checkOpenParenthesis();
  5410. this.pos++;
  5411. this.consumeNewLines();
  5412. var condition = this.parseExpressionOR();
  5413. this.consumeNewLines();
  5414. this.checkCloseParenthesis();
  5415. this.pos++;
  5416. this.checkEOS();
  5417. this.popScope();
  5418. return new _commands___WEBPACK_IMPORTED_MODULE_2__["DoWhile"](condition, commandsBlock);
  5419. }
  5420. }, {
  5421. key: "parseIfThenElse",
  5422. value: function parseIfThenElse() {
  5423. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5424. this.pushScope(IVProgParser.BREAKABLE);
  5425. } else {
  5426. this.pushScope(IVProgParser.COMMAND);
  5427. }
  5428. var token = this.getToken();
  5429. this.pos++;
  5430. this.checkOpenParenthesis();
  5431. this.pos++;
  5432. this.consumeNewLines();
  5433. var logicalExpression = this.parseExpressionOR();
  5434. this.consumeNewLines();
  5435. this.checkCloseParenthesis();
  5436. this.pos++;
  5437. this.consumeNewLines();
  5438. var cmdBlocks = this.parseCommandBlock();
  5439. var maybeElse = this.getToken();
  5440. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5441. this.pos++;
  5442. this.consumeNewLines();
  5443. var maybeIf = this.getToken();
  5444. var elseBlock = null;
  5445. if (this.checkOpenCurly(true)) {
  5446. elseBlock = this.parseCommandBlock();
  5447. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5448. elseBlock = this.parseIfThenElse();
  5449. } else {
  5450. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5451. }
  5452. this.popScope();
  5453. var _cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["IfThenElse"](logicalExpression, cmdBlocks, elseBlock);
  5454. _cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5455. return _cmd;
  5456. }
  5457. this.popScope();
  5458. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["IfThenElse"](logicalExpression, cmdBlocks, null);
  5459. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5460. return cmd;
  5461. }
  5462. }, {
  5463. key: "parseFor",
  5464. value: function parseFor() {
  5465. this.pushScope(IVProgParser.BREAKABLE);
  5466. this.pos++;
  5467. this.checkOpenParenthesis();
  5468. this.pos++;
  5469. this.consumeNewLines();
  5470. var attribution = this.parseForAssign();
  5471. this.consumeNewLines();
  5472. var condition = this.parseExpressionOR();
  5473. this.consumeForSemiColon();
  5474. var increment = this.parseForAssign(true);
  5475. this.checkCloseParenthesis();
  5476. this.pos++;
  5477. this.consumeNewLines();
  5478. var commandsBlock = this.parseCommandBlock();
  5479. this.popScope();
  5480. return new _commands___WEBPACK_IMPORTED_MODULE_2__["For"](attribution, condition, increment, commandsBlock);
  5481. }
  5482. }, {
  5483. key: "parseWhile",
  5484. value: function parseWhile() {
  5485. this.pushScope(IVProgParser.BREAKABLE);
  5486. var token = this.getToken();
  5487. this.pos++;
  5488. this.checkOpenParenthesis();
  5489. this.pos++;
  5490. this.consumeNewLines();
  5491. var logicalExpression = this.parseExpressionOR();
  5492. this.consumeNewLines();
  5493. this.checkCloseParenthesis();
  5494. this.pos++;
  5495. this.consumeNewLines();
  5496. var cmdBlocks = this.parseCommandBlock();
  5497. this.popScope();
  5498. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["While"](logicalExpression, cmdBlocks);
  5499. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5500. return cmd;
  5501. }
  5502. }, {
  5503. key: "parseBreak",
  5504. value: function parseBreak() {
  5505. this.pos++;
  5506. this.checkEOS();
  5507. this.pos++;
  5508. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Break"]();
  5509. }
  5510. }, {
  5511. key: "parseReturn",
  5512. value: function parseReturn() {
  5513. this.pos++;
  5514. var exp = null;
  5515. if (!this.checkEOS(true)) {
  5516. exp = this.parseExpressionOR();
  5517. this.checkEOS();
  5518. }
  5519. this.pos++;
  5520. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Return"](exp);
  5521. }
  5522. }, {
  5523. key: "parseIDCommand",
  5524. value: function parseIDCommand() {
  5525. var refToken = this.getToken();
  5526. var isID = refToken.type === this.lexerClass.ID;
  5527. var id = this.parseMaybeLibID();
  5528. if (this.checkOpenBrace(true)) {
  5529. this.pos++;
  5530. var lineExpression = null;
  5531. var columnExpression = null;
  5532. this.consumeNewLines();
  5533. lineExpression = this.parseExpression();
  5534. this.consumeNewLines();
  5535. this.checkCloseBrace();
  5536. this.pos++;
  5537. if (this.checkOpenBrace(true)) {
  5538. this.pos++;
  5539. this.consumeNewLines();
  5540. columnExpression = this.parseExpression();
  5541. this.consumeNewLines();
  5542. this.checkCloseBrace();
  5543. this.pos++;
  5544. }
  5545. var equalToken = this.getToken();
  5546. if (equalToken.type !== this.lexerClass.EQUAL) {
  5547. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('=', equalToken);
  5548. }
  5549. this.pos++;
  5550. var exp = this.parseExpressionOR();
  5551. this.checkEOS();
  5552. this.pos++;
  5553. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["ArrayIndexAssign"](id, lineExpression, columnExpression, exp);
  5554. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equalToken);
  5555. return cmd;
  5556. }
  5557. var equalOrParenthesis = this.getToken();
  5558. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5559. this.pos++;
  5560. var _exp = this.parseExpressionOR();
  5561. this.checkEOS();
  5562. this.pos++;
  5563. var _cmd2 = new _commands___WEBPACK_IMPORTED_MODULE_2__["Assign"](id, _exp);
  5564. _cmd2.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equalOrParenthesis);
  5565. return _cmd2;
  5566. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5567. var funcCall = this.parseFunctionCallCommand(id);
  5568. this.checkEOS();
  5569. this.pos++;
  5570. return funcCall;
  5571. } else if (isID) {
  5572. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list(['=', '('], equalOrParenthesis);
  5573. } else {
  5574. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_id_format(refToken);
  5575. }
  5576. }
  5577. }, {
  5578. key: "parseForAssign",
  5579. value: function parseForAssign() {
  5580. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5581. if (!isLast) this.consumeNewLines();
  5582. if (this.checkEOS(true)) {
  5583. return null;
  5584. }
  5585. var id = this.parseID();
  5586. var equal = this.getToken();
  5587. if (equal.type !== this.lexerClass.EQUAL) {
  5588. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('=', equal);
  5589. }
  5590. this.pos++;
  5591. var exp = this.parseExpressionOR();
  5592. if (!isLast) {
  5593. this.consumeForSemiColon();
  5594. }
  5595. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equal);
  5596. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["Assign"](id, exp);
  5597. cmd.sourceInfo = sourceInfo;
  5598. return cmd;
  5599. }
  5600. }, {
  5601. key: "parseCases",
  5602. value: function parseCases() {
  5603. var token = this.getToken();
  5604. if (token.type !== this.lexerClass.RK_CASE) {
  5605. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5606. }
  5607. this.pos++;
  5608. var nextToken = this.getToken();
  5609. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5610. this.pos++;
  5611. var colonToken = this.getToken();
  5612. if (colonToken.type !== this.lexerClass.COLON) {
  5613. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(':', colonToken);
  5614. }
  5615. this.pos++;
  5616. this.consumeNewLines();
  5617. var block = this.parseCommandBlock(true);
  5618. var defaultCase = new _commands___WEBPACK_IMPORTED_MODULE_2__["Case"](null);
  5619. defaultCase.setCommands(block.commands);
  5620. return [defaultCase];
  5621. } else {
  5622. var exp = this.parseExpressionOR();
  5623. var _colonToken = this.getToken();
  5624. if (_colonToken.type !== this.lexerClass.COLON) {
  5625. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(':', _colonToken);
  5626. }
  5627. this.pos++;
  5628. this.consumeNewLines();
  5629. var _block = this.parseCommandBlock(true);
  5630. var aCase = new _commands___WEBPACK_IMPORTED_MODULE_2__["Case"](exp);
  5631. aCase.setCommands(_block.commands);
  5632. var caseToken = this.getToken();
  5633. if (caseToken.type === this.lexerClass.RK_CASE) {
  5634. return [aCase].concat(this.parseCases());
  5635. } else {
  5636. return [aCase];
  5637. }
  5638. }
  5639. }
  5640. /*
  5641. * Parses an Expression following the structure:
  5642. *
  5643. * EOR => EAnd ( 'or' EOR)? #expression and
  5644. *
  5645. * EOR => ENot ('and' EOR)? #expression or
  5646. *
  5647. * ENot => 'not'? ER #expression not
  5648. *
  5649. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5650. *
  5651. * E => factor ((+, -) E)? #expression
  5652. *
  5653. * factor=> term ((*, /, %) factor)?
  5654. *
  5655. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5656. **/
  5657. }, {
  5658. key: "parseExpressionOR",
  5659. value: function parseExpressionOR() {
  5660. var exp1 = this.parseExpressionAND();
  5661. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5662. var opToken = this.getToken();
  5663. this.pos++;
  5664. var or = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('or');
  5665. this.consumeNewLines();
  5666. var exp2 = this.parseExpressionAND();
  5667. var _finalExp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](or, exp1, exp2);
  5668. _finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5669. exp1 = _finalExp;
  5670. }
  5671. return exp1;
  5672. }
  5673. }, {
  5674. key: "parseExpressionAND",
  5675. value: function parseExpressionAND() {
  5676. var exp1 = this.parseExpressionNot();
  5677. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5678. var opToken = this.getToken();
  5679. this.pos++;
  5680. var and = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('and');
  5681. this.consumeNewLines();
  5682. var exp2 = this.parseExpressionNot();
  5683. var _finalExp2 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](and, exp1, exp2);
  5684. _finalExp2.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5685. exp1 = _finalExp2;
  5686. }
  5687. return exp1;
  5688. }
  5689. }, {
  5690. key: "parseExpressionNot",
  5691. value: function parseExpressionNot() {
  5692. var maybeNotToken = this.getToken();
  5693. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5694. var opToken = this.getToken();
  5695. this.pos++;
  5696. var not = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('not');
  5697. var exp1 = this.parseExpressionRel();
  5698. finalExp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["UnaryApp"](not, exp1);
  5699. finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5700. return finalExp;
  5701. } else {
  5702. return this.parseExpressionRel();
  5703. }
  5704. }
  5705. }, {
  5706. key: "parseExpressionRel",
  5707. value: function parseExpressionRel() {
  5708. var exp1 = this.parseExpression();
  5709. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5710. var relToken = this.getToken();
  5711. this.pos++;
  5712. var rel = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(relToken.text);
  5713. var exp2 = this.parseExpression();
  5714. var _finalExp3 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](rel, exp1, exp2);
  5715. _finalExp3.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(relToken);
  5716. exp1 = _finalExp3;
  5717. }
  5718. return exp1;
  5719. }
  5720. }, {
  5721. key: "parseExpression",
  5722. value: function parseExpression() {
  5723. var factor = this.parseFactor();
  5724. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5725. var sumOpToken = this.getToken();
  5726. this.pos++;
  5727. var op = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(sumOpToken.text);
  5728. var factor2 = this.parseFactor();
  5729. var _finalExp4 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](op, factor, factor2);
  5730. _finalExp4.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(sumOpToken);
  5731. factor = _finalExp4;
  5732. }
  5733. return factor;
  5734. }
  5735. }, {
  5736. key: "parseFactor",
  5737. value: function parseFactor() {
  5738. var term = this.parseTerm();
  5739. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5740. var multOpToken = this.getToken();
  5741. this.pos++;
  5742. var op = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(multOpToken.text);
  5743. var term2 = this.parseTerm();
  5744. var _finalExp5 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](op, term, term2);
  5745. _finalExp5.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(multOpToken);
  5746. term = _finalExp5;
  5747. }
  5748. return term;
  5749. }
  5750. }, {
  5751. key: "parseTerm",
  5752. value: function parseTerm() {
  5753. var token = this.getToken();
  5754. var sourceInfo = null;
  5755. switch (token.type) {
  5756. case this.lexerClass.SUM_OP:
  5757. this.pos++;
  5758. sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5759. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["UnaryApp"](Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(token.text), this.parseTerm());
  5760. exp.sourceInfo = sourceInfo;
  5761. return exp;
  5762. case this.lexerClass.INTEGER:
  5763. this.pos++;
  5764. return this.getIntLiteral(token);
  5765. case this.lexerClass.REAL:
  5766. this.pos++;
  5767. return this.getRealLiteral(token);
  5768. case this.lexerClass.STRING:
  5769. this.pos++;
  5770. return this.getStringLiteral(token);
  5771. case this.lexerClass.RK_TRUE:
  5772. case this.lexerClass.RK_FALSE:
  5773. this.pos++;
  5774. return this.getBoolLiteral(token);
  5775. case this.lexerClass.OPEN_CURLY:
  5776. return this.parseArrayLiteral();
  5777. case this.lexerClass.ID:
  5778. case this.lexerClass.LIB_ID:
  5779. return this.parseIDTerm();
  5780. case this.lexerClass.OPEN_PARENTHESIS:
  5781. return this.parseParenthesisExp();
  5782. default:
  5783. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_terminal(token);
  5784. }
  5785. }
  5786. }, {
  5787. key: "parseIDTerm",
  5788. value: function parseIDTerm() {
  5789. var tokenA = this.getToken();
  5790. var id = this.parseMaybeLibID();
  5791. var isID = tokenA.type === this.lexerClass.ID;
  5792. if (isID && this.checkOpenBrace(true)) {
  5793. var tokenB = null;
  5794. this.pos++;
  5795. var firstIndex = this.parseExpression();
  5796. var secondIndex = null;
  5797. this.consumeNewLines();
  5798. this.checkCloseBrace();
  5799. tokenB = this.getToken();
  5800. this.pos++;
  5801. if (this.checkOpenBrace(true)) {
  5802. this.pos++;
  5803. secondIndex = this.parseExpression();
  5804. this.consumeNewLines();
  5805. this.checkCloseBrace();
  5806. tokenB = this.getToken();
  5807. this.pos++;
  5808. }
  5809. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5810. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayAccess"](id, firstIndex, secondIndex);
  5811. exp.sourceInfo = sourceInfo;
  5812. return exp;
  5813. } else if (this.checkOpenParenthesis(true)) {
  5814. return this.parseFunctionCallExpression(id);
  5815. } else if (isID) {
  5816. var _sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(tokenA);
  5817. var _exp2 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["VariableLiteral"](id);
  5818. _exp2.sourceInfo = _sourceInfo;
  5819. return _exp2;
  5820. } else {
  5821. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_id_format(tokenA);
  5822. }
  5823. }
  5824. }, {
  5825. key: "getFunctionName",
  5826. value: function getFunctionName(id) {
  5827. var name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getInternalName(id);
  5828. if (name === null) {
  5829. if (id === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName()) {
  5830. return null;
  5831. }
  5832. return id;
  5833. } else {
  5834. return name;
  5835. }
  5836. }
  5837. }, {
  5838. key: "parseFunctionCallExpression",
  5839. value: function parseFunctionCallExpression(id) {
  5840. var tokenA = this.getToken(this.pos - 1);
  5841. var actualParameters = this.parseActualParameters();
  5842. var tokenB = this.getToken(this.pos - 1);
  5843. var funcName = this.getFunctionName(id);
  5844. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5845. var cmd = new _expressions___WEBPACK_IMPORTED_MODULE_1__["FunctionCall"](funcName, actualParameters);
  5846. cmd.sourceInfo = sourceInfo;
  5847. return cmd;
  5848. }
  5849. }, {
  5850. key: "parseFunctionCallCommand",
  5851. value: function parseFunctionCallCommand(id) {
  5852. return this.parseFunctionCallExpression(id);
  5853. }
  5854. }, {
  5855. key: "parseParenthesisExp",
  5856. value: function parseParenthesisExp() {
  5857. this.checkOpenParenthesis();
  5858. var tokenA = this.getToken();
  5859. this.pos++;
  5860. this.consumeNewLines();
  5861. var exp = this.parseExpressionOR();
  5862. this.consumeNewLines();
  5863. this.checkCloseParenthesis();
  5864. var tokenB = this.getToken();
  5865. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5866. this.pos++;
  5867. exp.sourceInfo = sourceInfo;
  5868. return exp;
  5869. }
  5870. }, {
  5871. key: "parseActualParameters",
  5872. value: function parseActualParameters() {
  5873. this.checkOpenParenthesis();
  5874. this.pos++;
  5875. if (this.checkCloseParenthesis(true)) {
  5876. this.pos++;
  5877. return [];
  5878. }
  5879. this.consumeNewLines();
  5880. var list = this.parseExpressionList();
  5881. this.consumeNewLines();
  5882. this.checkCloseParenthesis();
  5883. this.pos++;
  5884. return list;
  5885. }
  5886. }, {
  5887. key: "parseExpressionList",
  5888. value: function parseExpressionList() {
  5889. var list = [];
  5890. while (true) {
  5891. var exp = this.parseExpressionOR();
  5892. list.push(exp);
  5893. var maybeToken = this.getToken();
  5894. if (maybeToken.type !== this.lexerClass.COMMA) {
  5895. break;
  5896. } else {
  5897. this.pos++;
  5898. this.consumeNewLines();
  5899. }
  5900. }
  5901. return list;
  5902. }
  5903. }, {
  5904. key: "getTypeArray",
  5905. value: function getTypeArray() {
  5906. var _this = this;
  5907. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5908. return types.map(function (x) {
  5909. return _this.lexer.literalNames[x];
  5910. });
  5911. }
  5912. }]);
  5913. return IVProgParser;
  5914. }();
  5915. /***/ }),
  5916. /***/ "./js/ast/operators.js":
  5917. /*!*****************************!*\
  5918. !*** ./js/ast/operators.js ***!
  5919. \*****************************/
  5920. /*! exports provided: Operators, convertFromString */
  5921. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5922. "use strict";
  5923. __webpack_require__.r(__webpack_exports__);
  5924. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Operators", function() { return Operators; });
  5925. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertFromString", function() { return convertFromString; });
  5926. var Operators = Object.freeze({
  5927. ADD: {
  5928. ord: 0,
  5929. value: "+"
  5930. },
  5931. SUB: {
  5932. ord: 1,
  5933. value: "-"
  5934. },
  5935. MULT: {
  5936. ord: 2,
  5937. value: '*'
  5938. },
  5939. DIV: {
  5940. ord: 3,
  5941. value: '/'
  5942. },
  5943. MOD: {
  5944. ord: 4,
  5945. value: '%'
  5946. },
  5947. GT: {
  5948. ord: 5,
  5949. value: '>'
  5950. },
  5951. GE: {
  5952. ord: 6,
  5953. value: '>='
  5954. },
  5955. LT: {
  5956. ord: 7,
  5957. value: '<'
  5958. },
  5959. LE: {
  5960. ord: 8,
  5961. value: '<='
  5962. },
  5963. EQ: {
  5964. ord: 9,
  5965. value: '=='
  5966. },
  5967. NEQ: {
  5968. ord: 10,
  5969. value: '!='
  5970. },
  5971. AND: {
  5972. ord: 11,
  5973. value: 'and'
  5974. },
  5975. OR: {
  5976. ord: 12,
  5977. value: 'or'
  5978. },
  5979. NOT: {
  5980. ord: 13,
  5981. value: 'not'
  5982. }
  5983. });
  5984. function convertFromString(op) {
  5985. switch (op) {
  5986. case '+':
  5987. return Operators.ADD;
  5988. case '-':
  5989. return Operators.SUB;
  5990. case '*':
  5991. return Operators.MULT;
  5992. case '/':
  5993. return Operators.DIV;
  5994. case '%':
  5995. return Operators.MOD;
  5996. case '>':
  5997. return Operators.GT;
  5998. case '>=':
  5999. return Operators.GE;
  6000. case '<':
  6001. return Operators.LT;
  6002. case '<=':
  6003. return Operators.LE;
  6004. case '==':
  6005. return Operators.EQ;
  6006. case '!=':
  6007. return Operators.NEQ;
  6008. case 'and':
  6009. return Operators.AND;
  6010. case 'or':
  6011. return Operators.OR;
  6012. case 'not':
  6013. return Operators.NOT;
  6014. }
  6015. }
  6016. /***/ }),
  6017. /***/ "./js/ast/sourceInfo.js":
  6018. /*!******************************!*\
  6019. !*** ./js/ast/sourceInfo.js ***!
  6020. \******************************/
  6021. /*! exports provided: SourceInfo */
  6022. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6023. "use strict";
  6024. __webpack_require__.r(__webpack_exports__);
  6025. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SourceInfo", function() { return SourceInfo; });
  6026. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6027. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6028. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6029. var SourceInfo =
  6030. /*#__PURE__*/
  6031. function () {
  6032. _createClass(SourceInfo, null, [{
  6033. key: "createSourceInfo",
  6034. value: function createSourceInfo(token) {
  6035. return new SourceInfo(token.line, token.column, token.text.length);
  6036. }
  6037. }, {
  6038. key: "createSourceInfoFromList",
  6039. value: function createSourceInfoFromList(tokenA, tokenB) {
  6040. var line = tokenA.line;
  6041. var column = tokenA.column; // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  6042. // No idea why...
  6043. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  6044. return new SourceInfo(line, column, size);
  6045. }
  6046. }]);
  6047. function SourceInfo(line, column, size) {
  6048. _classCallCheck(this, SourceInfo);
  6049. this.line = line;
  6050. this.column = column;
  6051. this.size = size;
  6052. }
  6053. return SourceInfo;
  6054. }();
  6055. /***/ }),
  6056. /***/ "./js/io/domConsole.js":
  6057. /*!*****************************!*\
  6058. !*** ./js/io/domConsole.js ***!
  6059. \*****************************/
  6060. /*! exports provided: DOMConsole */
  6061. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6062. "use strict";
  6063. __webpack_require__.r(__webpack_exports__);
  6064. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMConsole", function() { return DOMConsole; });
  6065. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  6066. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  6067. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6068. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6069. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6070. var DOMConsole =
  6071. /*#__PURE__*/
  6072. function () {
  6073. _createClass(DOMConsole, null, [{
  6074. key: "USER",
  6075. get: function get() {
  6076. return 0;
  6077. }
  6078. }, {
  6079. key: "INFO",
  6080. get: function get() {
  6081. return 1;
  6082. }
  6083. }, {
  6084. key: "ERR",
  6085. get: function get() {
  6086. return 2;
  6087. }
  6088. }]);
  6089. function DOMConsole(elementID) {
  6090. _classCallCheck(this, DOMConsole);
  6091. this.input = null;
  6092. this.needInput = false;
  6093. this.termDiv = null;
  6094. this.anyKey = false;
  6095. this.parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(elementID);
  6096. this.setup();
  6097. this.inputListeners = [];
  6098. }
  6099. _createClass(DOMConsole, [{
  6100. key: "setup",
  6101. value: function setup() {
  6102. this._setupDom();
  6103. this._setupEvents();
  6104. }
  6105. }, {
  6106. key: "_setupEvents",
  6107. value: function _setupEvents() {
  6108. var _this = this;
  6109. this.input.on("keydown", function (event) {
  6110. if (!_this.needInput) {
  6111. event.preventDefault();
  6112. return;
  6113. }
  6114. var keyCode = event.which;
  6115. if (keyCode === 13 || _this.anyKey) {
  6116. var text = _this.input.val();
  6117. text = text.replace('[\n\r]+', '');
  6118. _this.notifyListeners(text);
  6119. _this.write(text);
  6120. _this.input.val("");
  6121. }
  6122. });
  6123. }
  6124. }, {
  6125. key: "_setupDom",
  6126. value: function _setupDom() {
  6127. this.termDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<div></div>");
  6128. this.termDiv.addClass("ivprog-term-div");
  6129. this.input = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<input text="type">');
  6130. this.input.addClass("ivprog-term-input");
  6131. this.termDiv.append(this.input);
  6132. this.parent.append(this.termDiv);
  6133. }
  6134. }, {
  6135. key: "notifyListeners",
  6136. value: function notifyListeners(text) {
  6137. this.inputListeners.forEach(function (resolve) {
  6138. return resolve(text);
  6139. });
  6140. this.inputListeners.splice(0, this.inputListeners.length);
  6141. this.hideInput();
  6142. this.anyKey = false;
  6143. }
  6144. }, {
  6145. key: "write",
  6146. value: function write(text) {
  6147. this._appendText(text, DOMConsole.USER);
  6148. }
  6149. }, {
  6150. key: "info",
  6151. value: function info(text) {
  6152. this._appendText(text, DOMConsole.INFO);
  6153. }
  6154. }, {
  6155. key: "err",
  6156. value: function err(text) {
  6157. this._appendText(text, DOMConsole.ERR);
  6158. }
  6159. }, {
  6160. key: "_appendText",
  6161. value: function _appendText(text, type) {
  6162. var divClass = this.getClassForType(type);
  6163. var textDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<div></div>");
  6164. textDiv.addClass(divClass);
  6165. textDiv.append(text);
  6166. textDiv.insertBefore(this.input);
  6167. this.scrollTerm();
  6168. }
  6169. }, {
  6170. key: "scrollTerm",
  6171. value: function scrollTerm() {
  6172. this.termDiv.animate({
  6173. scrollTop: this.termDiv.prop('scrollHeight')
  6174. }, 0);
  6175. }
  6176. }, {
  6177. key: "getClassForType",
  6178. value: function getClassForType(type) {
  6179. switch (type) {
  6180. case DOMConsole.USER:
  6181. return "ivprog-term-userText";
  6182. case DOMConsole.INFO:
  6183. return "ivprog-term-info";
  6184. case DOMConsole.ERR:
  6185. return "ivprog-term-error";
  6186. }
  6187. }
  6188. }, {
  6189. key: "dispose",
  6190. value: function dispose() {
  6191. this.parent.off();
  6192. this.input.off();
  6193. this.input = null;
  6194. this.parent.empty();
  6195. }
  6196. }, {
  6197. key: "showInput",
  6198. value: function showInput() {
  6199. this.needInput = true;
  6200. this.input.show();
  6201. this.input.focus();
  6202. }
  6203. }, {
  6204. key: "hideInput",
  6205. value: function hideInput() {
  6206. this.needInput = false;
  6207. this.input.hide();
  6208. }
  6209. }, {
  6210. key: "requestInput",
  6211. value: function requestInput(callback) {
  6212. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6213. this.inputListeners.push(callback);
  6214. this.anyKey = anyKey;
  6215. this.showInput();
  6216. }
  6217. }, {
  6218. key: "sendOutput",
  6219. value: function sendOutput(text) {
  6220. var _this2 = this;
  6221. var output = "" + text;
  6222. output.split("\n").forEach(function (t) {
  6223. t = t.replace(/\t/g, '&#9;');
  6224. _this2.write(t);
  6225. });
  6226. }
  6227. }, {
  6228. key: "clear",
  6229. value: function clear() {
  6230. this.input.parent().children().not(this.input).remove();
  6231. this.input.val("");
  6232. }
  6233. }]);
  6234. return DOMConsole;
  6235. }();
  6236. /***/ }),
  6237. /***/ "./js/io/input.js":
  6238. /*!************************!*\
  6239. !*** ./js/io/input.js ***!
  6240. \************************/
  6241. /*! exports provided: Input */
  6242. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6243. "use strict";
  6244. __webpack_require__.r(__webpack_exports__);
  6245. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Input", function() { return Input; });
  6246. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6247. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6248. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6249. var Input =
  6250. /*#__PURE__*/
  6251. function () {
  6252. function Input() {
  6253. _classCallCheck(this, Input);
  6254. }
  6255. _createClass(Input, [{
  6256. key: "requestInput",
  6257. value: function requestInput(callback) {
  6258. throw new Error("Must be implemented");
  6259. }
  6260. }]);
  6261. return Input;
  6262. }();
  6263. /***/ }),
  6264. /***/ "./js/io/output.js":
  6265. /*!*************************!*\
  6266. !*** ./js/io/output.js ***!
  6267. \*************************/
  6268. /*! exports provided: Output */
  6269. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6270. "use strict";
  6271. __webpack_require__.r(__webpack_exports__);
  6272. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Output", function() { return Output; });
  6273. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6274. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  6275. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6276. var Output =
  6277. /*#__PURE__*/
  6278. function () {
  6279. function Output() {
  6280. _classCallCheck(this, Output);
  6281. }
  6282. _createClass(Output, [{
  6283. key: "sendOutput",
  6284. value: function sendOutput(text) {
  6285. throw new Error("Must be implemented");
  6286. }
  6287. }]);
  6288. return Output;
  6289. }();
  6290. /***/ }),
  6291. /***/ "./js/main.js":
  6292. /*!********************!*\
  6293. !*** ./js/main.js ***!
  6294. \********************/
  6295. /*! exports provided: runner, initVisualUI, addFunctionChangeListener, addGlobalChangeListener, removeFunctionListener, removeGlobalListener, LocalizedStrings, i18n */
  6296. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6297. "use strict";
  6298. __webpack_require__.r(__webpack_exports__);
  6299. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  6300. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i18n", function() { return i18n; });
  6301. /* harmony import */ var _runner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6302. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "runner", function() { return _runner__WEBPACK_IMPORTED_MODULE_0__["runner"]; });
  6303. /* harmony import */ var _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6304. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "initVisualUI", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["initVisualUI"]; });
  6305. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addFunctionChangeListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["addFunctionChangeListener"]; });
  6306. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addGlobalChangeListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["addGlobalChangeListener"]; });
  6307. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeFunctionListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["removeFunctionListener"]; });
  6308. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeGlobalListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["removeGlobalListener"]; });
  6309. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6310. /* harmony import */ var _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6311. var i18n = _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__["i18nHelper"].i18n;
  6312. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__["getInstance"]();
  6313. /***/ }),
  6314. /***/ "./js/processor/compatibilityTable.js":
  6315. /*!********************************************!*\
  6316. !*** ./js/processor/compatibilityTable.js ***!
  6317. \********************************************/
  6318. /*! exports provided: resultTypeAfterInfixOp, resultTypeAfterUnaryOp */
  6319. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6320. "use strict";
  6321. __webpack_require__.r(__webpack_exports__);
  6322. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resultTypeAfterInfixOp", function() { return resultTypeAfterInfixOp; });
  6323. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resultTypeAfterUnaryOp", function() { return resultTypeAfterUnaryOp; });
  6324. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6325. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6326. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6327. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6328. function buildInfixAddTable() {
  6329. var table = [[], [], [], []];
  6330. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6331. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6332. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6333. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6334. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6335. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6336. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6337. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6338. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6339. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6340. return table;
  6341. }
  6342. function buildInfixMultiDivSubTable() {
  6343. var table = [[], [], [], []];
  6344. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6345. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6346. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6347. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6348. return table;
  6349. }
  6350. function buildInfixEqualityInequalityTable() {
  6351. var table = [[], [], [], []];
  6352. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6353. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6354. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6355. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6356. return table;
  6357. }
  6358. function buildInfixRelationalTable() {
  6359. var table = [[], [], [], []];
  6360. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6361. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6362. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6363. return table;
  6364. }
  6365. function buildInfixAndOrTable() {
  6366. var table = [[], [], [], []];
  6367. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6368. return table;
  6369. }
  6370. function buildInfixModTable() {
  6371. var table = [[], [], [], []];
  6372. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6373. return table;
  6374. }
  6375. function buildUnarySumSubList() {
  6376. var list = [];
  6377. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6378. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6379. return list;
  6380. }
  6381. function buildUnaryNegList() {
  6382. var list = [];
  6383. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6384. return list;
  6385. }
  6386. function buildInfixCompatibilityTable() {
  6387. var compatibilityMap = new WeakMap();
  6388. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].ADD, buildInfixAddTable());
  6389. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].SUB, buildInfixMultiDivSubTable());
  6390. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MULT, buildInfixMultiDivSubTable());
  6391. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].DIV, buildInfixMultiDivSubTable());
  6392. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].EQ, buildInfixEqualityInequalityTable());
  6393. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].NEQ, buildInfixEqualityInequalityTable());
  6394. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].GE, buildInfixRelationalTable());
  6395. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].GT, buildInfixRelationalTable());
  6396. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].LE, buildInfixRelationalTable());
  6397. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].LT, buildInfixRelationalTable());
  6398. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].OR, buildInfixAndOrTable());
  6399. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].AND, buildInfixAndOrTable());
  6400. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MOD, buildInfixModTable());
  6401. return compatibilityMap;
  6402. }
  6403. function buildUnaryCompatibilityTable() {
  6404. var compatibilityMap = new WeakMap();
  6405. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].ADD, buildUnarySumSubList());
  6406. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].SUB, buildUnarySumSubList());
  6407. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].NOT, buildUnaryNegList());
  6408. return compatibilityMap;
  6409. }
  6410. var infixMap = buildInfixCompatibilityTable();
  6411. var unaryMap = buildUnaryCompatibilityTable();
  6412. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6413. try {
  6414. if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"] && rightExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6415. var newMulti = [];
  6416. for (var i = 0; i < leftExpressionType.types.length; ++i) {
  6417. var typeA = leftExpressionType.types[i];
  6418. for (var j = 0; j < rightExpressionType.types.length; ++i) {
  6419. var typeB = rightExpressionType.types[j];
  6420. newMulti.push(resultTypeAfterInfixOp(operator, typeA, typeB));
  6421. }
  6422. }
  6423. newMulti = newMulti.filter(function (x) {
  6424. return !x.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED);
  6425. });
  6426. if (newMulti.length <= 0) {
  6427. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6428. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6429. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6430. return new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL]);
  6431. }
  6432. }
  6433. }
  6434. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6435. } else {
  6436. return new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"](newMulti);
  6437. }
  6438. } else if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6439. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6440. return resultTypeAfterInfixOp(operator, rightExpressionType, rightExpressionType);
  6441. } else {
  6442. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6443. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6444. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6445. return rightExpressionType;
  6446. }
  6447. }
  6448. }
  6449. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6450. }
  6451. } else if (rightExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6452. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6453. return resultTypeAfterInfixOp(operator, leftExpressionType, leftExpressionType);
  6454. } else {
  6455. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6456. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6457. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6458. return leftExpressionType;
  6459. }
  6460. }
  6461. }
  6462. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6463. }
  6464. }
  6465. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6466. if (resultType === null || resultType === undefined) {
  6467. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6468. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6469. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6470. if (operator === _ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MOD) {
  6471. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6472. } else if (operator.ord >= 5 && operator.ord <= 10) {
  6473. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6474. }
  6475. }
  6476. }
  6477. }
  6478. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6479. }
  6480. return resultType;
  6481. } catch (e) {
  6482. if (e instanceof TypeError) {
  6483. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6484. } else {
  6485. throw e;
  6486. }
  6487. }
  6488. }
  6489. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6490. try {
  6491. if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6492. return leftExpressionType;
  6493. }
  6494. return unaryMap.get(operator)[leftExpressionType.ord];
  6495. } catch (e) {
  6496. if (e instanceof TypeError) {
  6497. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6498. } else {
  6499. throw e;
  6500. }
  6501. }
  6502. }
  6503. /***/ }),
  6504. /***/ "./js/processor/context.js":
  6505. /*!*********************************!*\
  6506. !*** ./js/processor/context.js ***!
  6507. \*********************************/
  6508. /*! exports provided: Context */
  6509. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6510. "use strict";
  6511. __webpack_require__.r(__webpack_exports__);
  6512. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Context", function() { return Context; });
  6513. var Context = Object.freeze({
  6514. BASE: Symbol('context:base'),
  6515. BREAKABLE: Symbol('context:breakable'),
  6516. FUNCTION: Symbol('context:function')
  6517. });
  6518. /***/ }),
  6519. /***/ "./js/processor/definedFunctions.js":
  6520. /*!******************************************!*\
  6521. !*** ./js/processor/definedFunctions.js ***!
  6522. \******************************************/
  6523. /*! exports provided: LanguageDefinedFunction */
  6524. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6525. "use strict";
  6526. __webpack_require__.r(__webpack_exports__);
  6527. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageDefinedFunction", function() { return LanguageDefinedFunction; });
  6528. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6529. /* harmony import */ var _lib_io__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6530. /* harmony import */ var _lib_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6531. /* harmony import */ var _lib_arrays__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6532. /* harmony import */ var _lib_lang__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6533. /* harmony import */ var _lib_math__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6534. function valueToKey(value, object) {
  6535. for (var key in object) {
  6536. if (object.hasOwnProperty(key)) {
  6537. if (object[key] === value) {
  6538. return key;
  6539. }
  6540. }
  6541. }
  6542. return null;
  6543. }
  6544. function concatObjects() {
  6545. var result = {};
  6546. for (var i = 0; i < arguments.length; i++) {
  6547. var obj = i < 0 || arguments.length <= i ? undefined : arguments[i];
  6548. for (var key in obj) {
  6549. if (obj.hasOwnProperty(key)) {
  6550. result[key] = obj[key];
  6551. }
  6552. }
  6553. }
  6554. return result;
  6555. }
  6556. var libsObject = {
  6557. $mathLib: {
  6558. $sin: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createSinFun"])(),
  6559. $cos: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createCosFun"])(),
  6560. $tan: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createTanFun"])(),
  6561. $sqrt: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createSqrtFun"])(),
  6562. $pow: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createPowFun"])(),
  6563. $log: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createLogFun"])(),
  6564. $abs: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createAbsFun"])(),
  6565. $negate: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createNegateFun"])(),
  6566. $invert: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createInvertFun"])(),
  6567. $max: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createMaxFun"])(),
  6568. $min: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createMinFun"])()
  6569. },
  6570. $ioLib: {
  6571. $read: Object(_lib_io__WEBPACK_IMPORTED_MODULE_1__["createInputFun"])(),
  6572. $write: Object(_lib_io__WEBPACK_IMPORTED_MODULE_1__["createOutputFun"])()
  6573. },
  6574. $strLib: {
  6575. $substring: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createSubstringFun"])(),
  6576. $length: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createLengthFun"])(),
  6577. $uppercase: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createUppercaseFun"])(),
  6578. $lowercase: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createLowercaseFun"])(),
  6579. $charAt: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createrCharAtFun"])()
  6580. },
  6581. $arrayLib: {
  6582. $numElements: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createNumElementsFun"])(),
  6583. $matrixLines: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createMatrixLinesFun"])(),
  6584. $matrixColumns: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createMatrixColumnsFun"])()
  6585. },
  6586. $langLib: {
  6587. $isReal: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsRealFun"])(),
  6588. $isInt: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsIntFun"])(),
  6589. $isBool: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsBoolFun"])(),
  6590. $castReal: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastRealFun"])(),
  6591. $castInt: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastIntFun"])(),
  6592. $castBool: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastBoolFun"])(),
  6593. $castString: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastStringFun"])()
  6594. }
  6595. };
  6596. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6597. var LanguageDefinedFunction = Object.freeze({
  6598. getMainFunctionName: function getMainFunctionName() {
  6599. return _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs().main_function;
  6600. },
  6601. getInternalName: function getInternalName(localName) {
  6602. if (localName.indexOf(".") !== -1) {
  6603. var names = localName.split(".");
  6604. var lib = valueToKey(names[0], _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangLibs());
  6605. var internalName = valueToKey(names[1], _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs());
  6606. if (lib === null || internalName === null) {
  6607. return null;
  6608. }
  6609. return lib + "." + internalName;
  6610. }
  6611. var funcName = valueToKey(localName, _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs());
  6612. if (funcName !== null) {
  6613. if (funcsObject[funcName]) {
  6614. return funcName;
  6615. }
  6616. }
  6617. return null;
  6618. },
  6619. getFunction: function getFunction(internalName) {
  6620. if (internalName.indexOf(".") !== -1) {
  6621. var names = internalName.split(".");
  6622. var libName = names[0];
  6623. var funName = names[1];
  6624. return libsObject[libName][funName];
  6625. }
  6626. return funcsObject[internalName];
  6627. },
  6628. getLocalName: function getLocalName(internalName) {
  6629. if (internalName.indexOf(".") !== -1) {
  6630. var names = internalName.split(".");
  6631. var libName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangLibs()[names[0]];
  6632. var funName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[names[1]];
  6633. return "".concat(libName, ".").concat(funName);
  6634. } else if (_services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[internalName]) {
  6635. return _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[internalName];
  6636. } else {
  6637. return internalName;
  6638. }
  6639. }
  6640. });
  6641. /***/ }),
  6642. /***/ "./js/processor/error/processorErrorFactory.js":
  6643. /*!*****************************************************!*\
  6644. !*** ./js/processor/error/processorErrorFactory.js ***!
  6645. \*****************************************************/
  6646. /*! exports provided: ProcessorErrorFactory */
  6647. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6648. "use strict";
  6649. __webpack_require__.r(__webpack_exports__);
  6650. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProcessorErrorFactory", function() { return ProcessorErrorFactory; });
  6651. /* harmony import */ var _runtimeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6652. /* harmony import */ var _semanticError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6653. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6654. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__["getInstance"]();
  6655. var ProcessorErrorFactory = Object.freeze({
  6656. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6657. if (sourceInfo) {
  6658. var context = [id, sourceInfo.line, sourceInfo.column];
  6659. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("symbol_not_found_full", context));
  6660. } else {
  6661. return ProcessorErrorFactory.symbol_not_found(id);
  6662. }
  6663. },
  6664. symbol_not_found: function symbol_not_found(id) {
  6665. var context = [id];
  6666. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("symbol_not_found", context));
  6667. },
  6668. function_missing_full: function function_missing_full(id, sourceInfo) {
  6669. if (sourceInfo) {
  6670. var context = [id, sourceInfo.line, sourceInfo.column];
  6671. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_missing_full", context));
  6672. } else {
  6673. return ProcessorErrorFactory.function_missing(id);
  6674. }
  6675. },
  6676. function_missing: function function_missing(id) {
  6677. var context = [id];
  6678. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_missing", context));
  6679. },
  6680. main_missing: function main_missing() {
  6681. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("main_missing"));
  6682. },
  6683. // TODO: better urgent error message
  6684. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6685. if (sourceInfo) {
  6686. var context = [sourceInfo.line];
  6687. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_int_full", context));
  6688. } else {
  6689. return ProcessorErrorFactory.array_dimension_not_int();
  6690. }
  6691. },
  6692. array_dimension_not_int: function array_dimension_not_int() {
  6693. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_int"));
  6694. },
  6695. unknown_command_full: function unknown_command_full(sourceInfo) {
  6696. if (sourceInfo) {
  6697. var context = [sourceInfo.line];
  6698. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unknown_command_full", context));
  6699. } else {
  6700. return ProcessorErrorFactory.unknown_command();
  6701. }
  6702. },
  6703. unknown_command: function unknown_command() {
  6704. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unknown_command"));
  6705. },
  6706. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6707. if (sourceInfo) {
  6708. var context = [LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6709. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_full", context));
  6710. } else {
  6711. return ProcessorErrorFactory.incompatible_types(type, dim);
  6712. }
  6713. },
  6714. incompatible_types: function incompatible_types(type, dim) {
  6715. var context = [LocalizedStrings.translateType(type, dim)];
  6716. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types", context));
  6717. },
  6718. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6719. if (sourceInfo) {
  6720. var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6721. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_array_full", context));
  6722. } else {
  6723. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6724. }
  6725. },
  6726. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6727. var context = [exp, LocalizedStrings.translateType(type, dim)];
  6728. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_array", context));
  6729. },
  6730. loop_condition_type_full: function loop_condition_type_full(exp, sourceInfo) {
  6731. if (sourceInfo) {
  6732. var context = [sourceInfo.line, sourceInfo.column, exp];
  6733. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("loop_condition_type_full", context));
  6734. } else {
  6735. return ProcessorErrorFactory.loop_condition_type(exp);
  6736. }
  6737. },
  6738. loop_condition_type: function loop_condition_type(exp) {
  6739. var context = [exp];
  6740. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("loop_condition_type", context));
  6741. },
  6742. endless_loop_full: function endless_loop_full(sourceInfo) {
  6743. if (sourceInfo) {
  6744. var context = [sourceInfo.line];
  6745. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("endless_loop_full", context));
  6746. } else {
  6747. return ProcessorErrorFactory.endless_loop();
  6748. }
  6749. },
  6750. endless_loop: function endless_loop() {
  6751. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("endless_loop"));
  6752. },
  6753. for_condition_type_full: function for_condition_type_full(exp, sourceInfo) {
  6754. if (sourceInfo) {
  6755. var context = [sourceInfo.line, sourceInfo.column, exp];
  6756. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("for_condition_type_full", context));
  6757. } else {
  6758. return ProcessorErrorFactory.for_condition_type(exp);
  6759. }
  6760. },
  6761. for_condition_type: function for_condition_type(exp) {
  6762. var context = [exp];
  6763. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("for_condition_type", context));
  6764. },
  6765. if_condition_type_full: function if_condition_type_full(exp, sourceInfo) {
  6766. if (sourceInfo) {
  6767. var context = [sourceInfo.line, sourceInfo.column, exp];
  6768. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("if_condition_type_full", context));
  6769. } else {
  6770. return ProcessorErrorFactory.if_condition_type(exp);
  6771. }
  6772. },
  6773. if_condition_type: function if_condition_type(exp) {
  6774. var context = [exp];
  6775. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("if_condition_type", context));
  6776. },
  6777. invalid_global_var: function invalid_global_var() {
  6778. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_global_var"));
  6779. },
  6780. not_implemented: function not_implemented(id) {
  6781. var context = [id];
  6782. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("not_implemented", context));
  6783. },
  6784. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6785. if (sourceInfo) {
  6786. var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6787. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_case_type_full", context));
  6788. } else {
  6789. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6790. }
  6791. },
  6792. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6793. var context = [exp, LocalizedStrings.translateType(type, dim)];
  6794. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_case_type", context));
  6795. },
  6796. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6797. if (sourceInfo) {
  6798. var context = [sourceInfo.line, sourceInfo.column, id];
  6799. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("void_in_expression_full", context));
  6800. } else {
  6801. return ProcessorErrorFactory.void_in_expression(id);
  6802. }
  6803. },
  6804. void_in_expression: function void_in_expression(id) {
  6805. var context = [id];
  6806. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("void_in_expression", context));
  6807. },
  6808. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6809. if (sourceInfo) {
  6810. var context = [id, sourceInfo.line, sourceInfo.column];
  6811. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_array_access_full", context));
  6812. } else {
  6813. return ProcessorErrorFactory.invalid_array_access(id);
  6814. }
  6815. },
  6816. invalid_array_access: function invalid_array_access(id) {
  6817. var context = [id];
  6818. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_array_access", context));
  6819. },
  6820. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6821. if (sourceInfo) {
  6822. var context = [id, sourceInfo.line, sourceInfo.column];
  6823. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_matrix_access_full", context));
  6824. } else {
  6825. return ProcessorErrorFactory.invalid_matrix_access(id);
  6826. }
  6827. },
  6828. invalid_matrix_access: function invalid_matrix_access(id) {
  6829. var context = [id];
  6830. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_matrix_access", context));
  6831. },
  6832. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6833. if (sourceInfo) {
  6834. var context = [sourceInfo.line, value, id, columns];
  6835. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6836. } else {
  6837. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6838. }
  6839. },
  6840. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6841. var context = [value, id, columns];
  6842. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_column_outbounds", context));
  6843. },
  6844. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6845. if (sourceInfo) {
  6846. var context = [sourceInfo.line, value, id, lines];
  6847. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6848. } else {
  6849. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6850. }
  6851. },
  6852. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6853. var context = [value, id, lines];
  6854. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_line_outbounds", context));
  6855. },
  6856. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6857. if (sourceInfo) {
  6858. var context = [sourceInfo.line, value, id, lines];
  6859. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_line_outbounds_full", context));
  6860. } else {
  6861. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6862. }
  6863. },
  6864. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6865. var context = [value, id, lines];
  6866. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_line_outbounds", context));
  6867. },
  6868. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6869. if (sourceInfo) {
  6870. var context = [sourceInfo.line, id];
  6871. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_not_matrix_full", context));
  6872. } else {
  6873. return ProcessorErrorFactory.vector_not_matrix(id);
  6874. }
  6875. },
  6876. vector_not_matrix: function vector_not_matrix(id) {
  6877. var context = [id];
  6878. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_not_matrix", context));
  6879. },
  6880. function_no_return: function function_no_return(id) {
  6881. var context = [id];
  6882. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_no_return", context));
  6883. },
  6884. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6885. if (sourceInfo) {
  6886. var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
  6887. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_void_return_full", context));
  6888. } else {
  6889. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6890. }
  6891. },
  6892. invalid_void_return: function invalid_void_return(id, type, dim) {
  6893. var context = [id, LocalizedStrings.translateType(type, dim)];
  6894. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_void_return_full", context));
  6895. },
  6896. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6897. if (sourceInfo) {
  6898. var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
  6899. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_return_type_full", context));
  6900. } else {
  6901. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6902. }
  6903. },
  6904. invalid_return_type: function invalid_return_type(id, type, dim) {
  6905. var context = [id, LocalizedStrings.translateType(type, dim)];
  6906. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_return_type", context));
  6907. },
  6908. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6909. if (sourceInfo) {
  6910. var context = [sourceInfo.line, id, expected, actual];
  6911. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameters_size_full", context));
  6912. } else {
  6913. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6914. }
  6915. },
  6916. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6917. var context = [id, expected, actual];
  6918. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameters_size", context));
  6919. },
  6920. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6921. if (sourceInfo) {
  6922. var context = [exp, id, sourceInfo.line];
  6923. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameter_type_full", context));
  6924. } else {
  6925. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6926. }
  6927. },
  6928. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6929. var context = [exp, id];
  6930. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameter_type_full", context));
  6931. },
  6932. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6933. if (sourceInfo) {
  6934. var context = [exp, id, sourceInfo.line];
  6935. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_ref_full", context));
  6936. } else {
  6937. return ProcessorErrorFactory.invalid_ref(id, exp);
  6938. }
  6939. },
  6940. invalid_ref: function invalid_ref(id, exp) {
  6941. var context = [exp, id];
  6942. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_ref", context));
  6943. },
  6944. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6945. if (sourceInfo) {
  6946. var context = [sourceInfo.line];
  6947. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unexpected_break_command_full", context));
  6948. } else {
  6949. return ProcessorErrorFactory.unexpected_break_command();
  6950. }
  6951. },
  6952. unexpected_break_command: function unexpected_break_command() {
  6953. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unexpected_break_command"));
  6954. },
  6955. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6956. if (sourceInfo) {
  6957. var context = [sourceInfo.line, exp];
  6958. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6959. } else {
  6960. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6961. }
  6962. },
  6963. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6964. var context = [exp];
  6965. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_type", context));
  6966. },
  6967. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6968. if (sourceInfo) {
  6969. var context = [sourceInfo.line, expected, actual];
  6970. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6971. } else {
  6972. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6973. }
  6974. },
  6975. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6976. var context = [expected, actual];
  6977. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_line", context));
  6978. },
  6979. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6980. if (sourceInfo) {
  6981. var context = [sourceInfo.line, expected, actual];
  6982. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6983. } else {
  6984. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6985. }
  6986. },
  6987. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6988. var context = [expected, actual];
  6989. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_column", context));
  6990. },
  6991. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6992. if (sourceInfo) {
  6993. var context = [sourceInfo.line, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
  6994. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_unary_op_full", context));
  6995. } else {
  6996. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6997. }
  6998. },
  6999. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  7000. var context = [LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
  7001. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_unary_op", context));
  7002. },
  7003. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  7004. if (sourceInfo) {
  7005. var context = [sourceInfo.line, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
  7006. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_infix_op_full", context));
  7007. } else {
  7008. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  7009. }
  7010. },
  7011. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  7012. var context = [LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
  7013. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_infix_op", context));
  7014. },
  7015. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  7016. if (sourceInfo) {
  7017. var context = [sourceInfo.line];
  7018. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_positive_full", context));
  7019. } else {
  7020. return ProcessorErrorFactory.array_dimension_not_positive();
  7021. }
  7022. },
  7023. array_dimension_not_positive: function array_dimension_not_positive() {
  7024. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_positive"));
  7025. },
  7026. invalid_type_conversion: function invalid_type_conversion(value, type, dim) {
  7027. var context = [value, LocalizedStrings.translateType(type, dim)];
  7028. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_type_conversion", context));
  7029. }
  7030. });
  7031. /***/ }),
  7032. /***/ "./js/processor/error/runtimeError.js":
  7033. /*!********************************************!*\
  7034. !*** ./js/processor/error/runtimeError.js ***!
  7035. \********************************************/
  7036. /*! exports provided: RuntimeError */
  7037. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7038. "use strict";
  7039. __webpack_require__.r(__webpack_exports__);
  7040. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuntimeError", function() { return RuntimeError; });
  7041. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7042. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7043. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  7044. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  7045. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  7046. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  7047. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  7048. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  7049. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  7050. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  7051. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  7052. var RuntimeError =
  7053. /*#__PURE__*/
  7054. function (_Error) {
  7055. _inherits(RuntimeError, _Error);
  7056. function RuntimeError() {
  7057. var _getPrototypeOf2;
  7058. var _this;
  7059. _classCallCheck(this, RuntimeError);
  7060. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  7061. msg[_key] = arguments[_key];
  7062. }
  7063. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(RuntimeError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  7064. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), RuntimeError);
  7065. return _this;
  7066. }
  7067. return RuntimeError;
  7068. }(_wrapNativeSuper(Error));
  7069. /***/ }),
  7070. /***/ "./js/processor/error/semanticError.js":
  7071. /*!*********************************************!*\
  7072. !*** ./js/processor/error/semanticError.js ***!
  7073. \*********************************************/
  7074. /*! exports provided: SemanticError */
  7075. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7076. "use strict";
  7077. __webpack_require__.r(__webpack_exports__);
  7078. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SemanticError", function() { return SemanticError; });
  7079. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7080. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7081. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  7082. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  7083. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  7084. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  7085. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  7086. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  7087. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  7088. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  7089. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  7090. var SemanticError =
  7091. /*#__PURE__*/
  7092. function (_Error) {
  7093. _inherits(SemanticError, _Error);
  7094. function SemanticError() {
  7095. var _getPrototypeOf2;
  7096. var _this;
  7097. _classCallCheck(this, SemanticError);
  7098. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  7099. msg[_key] = arguments[_key];
  7100. }
  7101. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SemanticError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  7102. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), SemanticError);
  7103. return _this;
  7104. }
  7105. return SemanticError;
  7106. }(_wrapNativeSuper(Error));
  7107. /***/ }),
  7108. /***/ "./js/processor/ivprogProcessor.js":
  7109. /*!*****************************************!*\
  7110. !*** ./js/processor/ivprogProcessor.js ***!
  7111. \*****************************************/
  7112. /*! exports provided: IVProgProcessor */
  7113. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7114. "use strict";
  7115. __webpack_require__.r(__webpack_exports__);
  7116. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgProcessor", function() { return IVProgProcessor; });
  7117. /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  7118. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  7119. /* harmony import */ var _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  7120. /* harmony import */ var _store_storeObjectRef__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  7121. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  7122. /* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  7123. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  7124. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  7125. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  7126. /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  7127. /* harmony import */ var _ast_commands___WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  7128. /* harmony import */ var _ast_expressions___WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  7129. /* harmony import */ var _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  7130. /* harmony import */ var _store_storeObjectArrayAddressRef__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  7131. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7132. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7133. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  7134. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7135. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_17__);
  7136. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  7137. /* harmony import */ var _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  7138. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7139. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  7140. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  7141. var IVProgProcessor =
  7142. /*#__PURE__*/
  7143. function () {
  7144. _createClass(IVProgProcessor, null, [{
  7145. key: "LOOP_TIMEOUT",
  7146. get: function get() {
  7147. return _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].loopTimeout;
  7148. },
  7149. set: function set(ms) {
  7150. _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].setConfig({
  7151. loopTimeout: ms
  7152. });
  7153. }
  7154. }, {
  7155. key: "MAIN_INTERNAL_ID",
  7156. get: function get() {
  7157. return "$main";
  7158. }
  7159. }]);
  7160. function IVProgProcessor(ast) {
  7161. _classCallCheck(this, IVProgProcessor);
  7162. this.ast = ast;
  7163. this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"]("$global");
  7164. this.stores = [this.globalStore];
  7165. this.context = [_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE];
  7166. this.input = null;
  7167. this.forceKill = false;
  7168. this.loopTimers = [];
  7169. this.output = null;
  7170. }
  7171. _createClass(IVProgProcessor, [{
  7172. key: "registerInput",
  7173. value: function registerInput(input) {
  7174. if (this.input !== null) this.input = null;
  7175. this.input = input;
  7176. }
  7177. }, {
  7178. key: "registerOutput",
  7179. value: function registerOutput(output) {
  7180. if (this.output !== null) this.output = null;
  7181. this.output = output;
  7182. }
  7183. }, {
  7184. key: "checkContext",
  7185. value: function checkContext(context) {
  7186. return this.context[this.context.length - 1] === context;
  7187. }
  7188. }, {
  7189. key: "ignoreSwitchCases",
  7190. value: function ignoreSwitchCases(store) {
  7191. if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7192. return true;
  7193. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7194. return true;
  7195. } else {
  7196. return false;
  7197. }
  7198. }
  7199. }, {
  7200. key: "prepareState",
  7201. value: function prepareState() {
  7202. if (this.stores !== null) {
  7203. for (var i = 0; i < this.stores.length; i++) {
  7204. delete this.stores[i];
  7205. }
  7206. this.stores = null;
  7207. }
  7208. if (this.globalStore !== null) this.globalStore = null;
  7209. this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"]("$global");
  7210. this.stores = [this.globalStore];
  7211. this.context = [_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE];
  7212. }
  7213. }, {
  7214. key: "interpretAST",
  7215. value: function interpretAST() {
  7216. var _this = this;
  7217. this.prepareState();
  7218. return this.initGlobal().then(function (_) {
  7219. var mainFunc = _this.findMainFunction();
  7220. if (mainFunc === null) {
  7221. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].main_missing();
  7222. }
  7223. return _this.runFunction(mainFunc, [], _this.globalStore);
  7224. });
  7225. }
  7226. }, {
  7227. key: "initGlobal",
  7228. value: function initGlobal() {
  7229. if (!this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE)) {
  7230. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_global_var();
  7231. }
  7232. return this.executeCommands(this.globalStore, this.ast.global);
  7233. }
  7234. }, {
  7235. key: "findMainFunction",
  7236. value: function findMainFunction() {
  7237. return this.ast.functions.find(function (v) {
  7238. return v.isMain;
  7239. });
  7240. }
  7241. }, {
  7242. key: "findFunction",
  7243. value: function findFunction(name) {
  7244. if (name.match(/^\$.+$/)) {
  7245. var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getFunction(name);
  7246. if (!!!fun) {
  7247. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].not_implemented(name);
  7248. }
  7249. return fun;
  7250. } else {
  7251. var val = this.ast.functions.find(function (v) {
  7252. return v.name === name;
  7253. });
  7254. if (!!!val) {
  7255. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].function_missing(name);
  7256. }
  7257. return val;
  7258. }
  7259. }
  7260. }, {
  7261. key: "runFunction",
  7262. value: function runFunction(func, actualParameters, store) {
  7263. var _this2 = this;
  7264. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  7265. var funcStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"](funcName);
  7266. funcStore.extendStore(this.globalStore);
  7267. var returnStoreObject = null;
  7268. if (func.returnType instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7269. if (func.returnType.dimensions > 1) {
  7270. returnStoreObject = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](func.returnType, -1, -1, [[]]);
  7271. } else {
  7272. returnStoreObject = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](func.returnType, -1, null, []);
  7273. }
  7274. } else {
  7275. returnStoreObject = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](func.returnType, null);
  7276. }
  7277. funcStore.insertStore('$', returnStoreObject);
  7278. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  7279. var outerRef = this;
  7280. return newFuncStore$.then(function (sto) {
  7281. _this2.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].FUNCTION);
  7282. _this2.stores.push(sto);
  7283. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  7284. return outerRef.executeCommands(stoWithVars, func.commands);
  7285. }).then(function (finalSto) {
  7286. outerRef.stores.pop();
  7287. outerRef.context.pop();
  7288. return finalSto;
  7289. });
  7290. });
  7291. }
  7292. }, {
  7293. key: "associateParameters",
  7294. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  7295. var _this3 = this;
  7296. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : calleeStore.name;
  7297. if (formalList.length != actualList.length) {
  7298. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_parameters_size(funcName, formalList.length, actualList.length);
  7299. }
  7300. var promises$ = actualList.map(function (actualParameter) {
  7301. return _this3.evaluateExpression(callerStore, actualParameter);
  7302. });
  7303. return Promise.all(promises$).then(function (values) {
  7304. for (var i = 0; i < values.length; i++) {
  7305. var stoObj = values[i];
  7306. var exp = actualList[i];
  7307. var shouldTypeCast = false;
  7308. var formalParameter = formalList[i];
  7309. if (!formalParameter.type.isCompatible(stoObj.type)) {
  7310. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && !formalParameter.byRef && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(formalParameter.type, stoObj.type)) {
  7311. shouldTypeCast = true;
  7312. } else {
  7313. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_parameter_type(funcName, exp.toString());
  7314. }
  7315. }
  7316. if (formalParameter.byRef && !stoObj.inStore) {
  7317. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_ref(funcName, exp.toString());
  7318. }
  7319. if (formalParameter.byRef) {
  7320. var ref = null;
  7321. if (stoObj instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7322. ref = new _store_storeObjectArrayAddressRef__WEBPACK_IMPORTED_MODULE_13__["StoreObjectArrayAddressRef"](stoObj);
  7323. } else {
  7324. ref = new _store_storeObjectRef__WEBPACK_IMPORTED_MODULE_3__["StoreObjectRef"](stoObj.id, callerStore);
  7325. }
  7326. calleeStore.insertStore(formalParameter.id, ref);
  7327. } else {
  7328. var realValue = _this3.parseStoreObjectValue(stoObj);
  7329. if (shouldTypeCast) {
  7330. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(formalParameter.type, realValue);
  7331. }
  7332. calleeStore.insertStore(formalParameter.id, realValue);
  7333. }
  7334. }
  7335. return calleeStore;
  7336. });
  7337. }
  7338. }, {
  7339. key: "executeCommands",
  7340. value: function executeCommands(store, cmds) {
  7341. // helper to partially apply a function, in this case executeCommand
  7342. var outerRef = this;
  7343. var partial = function partial(fun, cmd) {
  7344. return function (sto) {
  7345. return fun(sto, cmd);
  7346. };
  7347. };
  7348. return cmds.reduce(function (lastCommand, next) {
  7349. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7350. return lastCommand.then(nextCommand);
  7351. }, Promise.resolve(store));
  7352. }
  7353. }, {
  7354. key: "executeCommand",
  7355. value: function executeCommand(store, cmd) {
  7356. if (this.forceKill) {
  7357. return Promise.reject("FORCED_KILL!");
  7358. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].PAUSE) {
  7359. return Promise.resolve(this.executeCommand(store, cmd));
  7360. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7361. return Promise.resolve(store);
  7362. } else if (this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE) && store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7363. return Promise.resolve(store);
  7364. }
  7365. if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Declaration"]) {
  7366. return this.executeDeclaration(store, cmd);
  7367. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["ArrayIndexAssign"]) {
  7368. return this.executeArrayIndexAssign(store, cmd);
  7369. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Assign"]) {
  7370. return this.executeAssign(store, cmd);
  7371. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Break"]) {
  7372. return this.executeBreak(store, cmd);
  7373. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Return"]) {
  7374. return this.executeReturn(store, cmd);
  7375. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["IfThenElse"]) {
  7376. return this.executeIfThenElse(store, cmd);
  7377. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["DoWhile"]) {
  7378. return this.executeDoWhile(store, cmd);
  7379. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["While"]) {
  7380. return this.executeWhile(store, cmd);
  7381. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["For"]) {
  7382. return this.executeFor(store, cmd);
  7383. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Switch"]) {
  7384. return this.executeSwitch(store, cmd);
  7385. } else if (cmd instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["FunctionCall"]) {
  7386. return this.executeFunctionCall(store, cmd);
  7387. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["SysCall"]) {
  7388. return this.executeSysCall(store, cmd);
  7389. } else {
  7390. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].unknown_command(cmd.sourceInfo);
  7391. }
  7392. }
  7393. }, {
  7394. key: "executeSysCall",
  7395. value: function executeSysCall(store, cmd) {
  7396. var func = cmd.langFunc.bind(this);
  7397. return func(store, cmd);
  7398. }
  7399. }, {
  7400. key: "executeFunctionCall",
  7401. value: function executeFunctionCall(store, cmd) {
  7402. var func = null;
  7403. if (cmd.isMainCall) {
  7404. func = this.findMainFunction();
  7405. } else {
  7406. func = this.findFunction(cmd.id);
  7407. }
  7408. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7409. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID.isCompatible(func.returnType) && sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7410. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : func.name;
  7411. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].function_no_return(funcName));
  7412. } else {
  7413. return store;
  7414. }
  7415. });
  7416. }
  7417. }, {
  7418. key: "executeSwitch",
  7419. value: function executeSwitch(store, cmd) {
  7420. var _this4 = this;
  7421. this.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7422. var outerRef = this;
  7423. var caseSequence = cmd.cases.reduce(function (prev, next) {
  7424. return prev.then(function (tuple) {
  7425. if (outerRef.ignoreSwitchCases(tuple[1])) {
  7426. return Promise.resolve(tuple);
  7427. } else if (tuple[0] || next.isDefault) {
  7428. return outerRef.executeCommands(tuple[1], next.commands).then(function (nSto) {
  7429. return Promise.resolve([true, nSto]);
  7430. });
  7431. } else {
  7432. return outerRef.evaluateExpression(tuple[1], new _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["InfixApp"](_ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].EQ, cmd.expression, next.expression)).then(function (equalityResult) {
  7433. if (equalityResult.value) {
  7434. return _this4.executeCommands(tuple[1], next.commands).then(function (nSto) {
  7435. return Promise.resolve([true, nSto]);
  7436. });
  7437. } else {
  7438. return Promise.resolve(tuple);
  7439. }
  7440. });
  7441. }
  7442. });
  7443. }, Promise.resolve([false, store]));
  7444. return caseSequence.then(function (tuple) {
  7445. return tuple[1];
  7446. });
  7447. }
  7448. }, {
  7449. key: "executeFor",
  7450. value: function executeFor(store, cmd) {
  7451. try {
  7452. //BEGIN for -> while rewrite
  7453. var initCmd = cmd.assignment;
  7454. var condition = cmd.condition;
  7455. var increment = cmd.increment;
  7456. var whileBlock = new _ast_commands___WEBPACK_IMPORTED_MODULE_10__["CommandBlock"]([], cmd.commands.concat(increment));
  7457. var forAsWhile = new _ast_commands___WEBPACK_IMPORTED_MODULE_10__["While"](condition, whileBlock);
  7458. forAsWhile.sourceInfo = cmd.sourceInfo; //END for -> while rewrite
  7459. var newCmdList = [initCmd, forAsWhile];
  7460. return this.executeCommands(store, newCmdList);
  7461. } catch (error) {
  7462. return Promise.reject(error);
  7463. }
  7464. }
  7465. }, {
  7466. key: "executeDoWhile",
  7467. value: function executeDoWhile(store, cmd) {
  7468. var outerRef = this;
  7469. try {
  7470. outerRef.loopTimers.push(Date.now());
  7471. outerRef.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7472. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7473. return $newStore.then(function (sto) {
  7474. if (sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7475. outerRef.context.pop();
  7476. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7477. outerRef.loopTimers.pop();
  7478. return sto;
  7479. }
  7480. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7481. return $value.then(function (vl) {
  7482. if (!vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7483. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].loop_condition_type_full(cmd.sourceInfo));
  7484. }
  7485. if (vl.value) {
  7486. outerRef.context.pop();
  7487. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7488. var time = outerRef.loopTimers[i];
  7489. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7490. outerRef.forceKill = true;
  7491. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].endless_loop_full(cmd.sourceInfo));
  7492. }
  7493. }
  7494. return outerRef.executeCommand(sto, cmd);
  7495. } else {
  7496. outerRef.context.pop();
  7497. outerRef.loopTimers.pop();
  7498. return sto;
  7499. }
  7500. });
  7501. });
  7502. } catch (error) {
  7503. return Promise.reject(error);
  7504. }
  7505. }
  7506. }, {
  7507. key: "executeWhile",
  7508. value: function executeWhile(store, cmd) {
  7509. var outerRef = this;
  7510. try {
  7511. outerRef.loopTimers.push(Date.now());
  7512. outerRef.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7513. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7514. return $value.then(function (vl) {
  7515. if (vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7516. if (vl.value) {
  7517. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7518. return $newStore.then(function (sto) {
  7519. outerRef.context.pop();
  7520. if (sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7521. outerRef.loopTimers.pop();
  7522. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7523. return sto;
  7524. }
  7525. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7526. var time = outerRef.loopTimers[i];
  7527. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7528. outerRef.forceKill = true;
  7529. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].endless_loop_full(cmd.sourceInfo));
  7530. }
  7531. }
  7532. return outerRef.executeCommand(sto, cmd);
  7533. });
  7534. } else {
  7535. outerRef.context.pop();
  7536. outerRef.loopTimers.pop();
  7537. return store;
  7538. }
  7539. } else {
  7540. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo));
  7541. }
  7542. });
  7543. } catch (error) {
  7544. return Promise.reject(error);
  7545. }
  7546. }
  7547. }, {
  7548. key: "executeIfThenElse",
  7549. value: function executeIfThenElse(store, cmd) {
  7550. var _this5 = this;
  7551. try {
  7552. var $value = this.evaluateExpression(store, cmd.condition);
  7553. return $value.then(function (vl) {
  7554. if (vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7555. if (vl.value) {
  7556. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7557. } else if (cmd.ifFalse !== null) {
  7558. if (cmd.ifFalse instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["IfThenElse"]) {
  7559. return _this5.executeCommand(store, cmd.ifFalse);
  7560. } else {
  7561. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7562. }
  7563. } else {
  7564. return Promise.resolve(store);
  7565. }
  7566. } else {
  7567. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo));
  7568. }
  7569. });
  7570. } catch (error) {
  7571. return Promise.reject(error);
  7572. }
  7573. }
  7574. }, {
  7575. key: "executeReturn",
  7576. value: function executeReturn(store, cmd) {
  7577. var _this6 = this;
  7578. try {
  7579. var funcType = store.applyStore('$').type;
  7580. var $value = this.evaluateExpression(store, cmd.expression);
  7581. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : store.name;
  7582. return $value.then(function (vl) {
  7583. if (vl === null && funcType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID)) {
  7584. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  7585. return Promise.resolve(store);
  7586. }
  7587. if (vl === null || !funcType.isCompatible(vl.type)) {
  7588. var stringInfo = funcType.stringInfo();
  7589. var info = stringInfo[0];
  7590. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7591. } else {
  7592. var realValue = _this6.parseStoreObjectValue(vl);
  7593. store.updateStore('$', realValue);
  7594. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  7595. return Promise.resolve(store);
  7596. }
  7597. });
  7598. } catch (error) {
  7599. return Promise.reject(error);
  7600. }
  7601. }
  7602. }, {
  7603. key: "executeBreak",
  7604. value: function executeBreak(store, cmd) {
  7605. if (this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE)) {
  7606. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK;
  7607. return Promise.resolve(store);
  7608. } else {
  7609. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].unexpected_break_command_full(cmd.sourceInfo));
  7610. }
  7611. }
  7612. }, {
  7613. key: "executeAssign",
  7614. value: function executeAssign(store, cmd) {
  7615. var _this7 = this;
  7616. try {
  7617. var inStore = store.applyStore(cmd.id);
  7618. var $value = this.evaluateExpression(store, cmd.expression);
  7619. return $value.then(function (vl) {
  7620. var realValue = _this7.parseStoreObjectValue(vl);
  7621. if (!inStore.type.isCompatible(realValue.type)) {
  7622. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(inStore.type, vl.type)) {
  7623. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(inStore.type, realValue);
  7624. } else {
  7625. var stringInfo = inStore.type.stringInfo();
  7626. var info = stringInfo[0];
  7627. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7628. }
  7629. }
  7630. store.updateStore(cmd.id, realValue);
  7631. return store;
  7632. });
  7633. } catch (error) {
  7634. return Promise.reject(error);
  7635. }
  7636. }
  7637. }, {
  7638. key: "executeArrayIndexAssign",
  7639. value: function executeArrayIndexAssign(store, cmd) {
  7640. var _this8 = this;
  7641. var mustBeArray = store.applyStore(cmd.id);
  7642. if (!(mustBeArray.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"])) {
  7643. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7644. }
  7645. var line$ = this.evaluateExpression(store, cmd.line);
  7646. var column$ = this.evaluateExpression(store, cmd.column);
  7647. var value$ = this.evaluateExpression(store, cmd.expression);
  7648. return Promise.all([line$, column$, value$]).then(function (results) {
  7649. var lineSO = results[0];
  7650. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7651. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7652. }
  7653. var line = lineSO.number;
  7654. var columnSO = results[1];
  7655. var column = null;
  7656. if (columnSO !== null) {
  7657. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7658. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7659. }
  7660. column = columnSO.number;
  7661. }
  7662. var value = _this8.parseStoreObjectValue(results[2]);
  7663. if (line >= mustBeArray.lines) {
  7664. if (mustBeArray.isVector) {
  7665. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7666. } else {
  7667. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7668. }
  7669. } else if (line < 0) {
  7670. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7671. }
  7672. if (column !== null && mustBeArray.columns === null) {
  7673. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7674. }
  7675. if (column !== null) {
  7676. if (column >= mustBeArray.columns) {
  7677. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7678. } else if (column < 0) {
  7679. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7680. }
  7681. }
  7682. var newArray = Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null), mustBeArray);
  7683. if (column !== null) {
  7684. if (value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"] || !newArray.type.canAccept(value.type)) {
  7685. var type = mustBeArray.type.innerType;
  7686. var stringInfo = type.stringInfo();
  7687. var info = stringInfo[0];
  7688. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7689. }
  7690. newArray.value[line].value[column] = value;
  7691. store.updateStore(cmd.id, newArray);
  7692. } else {
  7693. if (mustBeArray.columns !== null && value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"] || !newArray.type.canAccept(value.type)) {
  7694. var _type = mustBeArray.type;
  7695. var _stringInfo = _type.stringInfo();
  7696. var _info = _stringInfo[0];
  7697. var exp = cmd.expression.toString();
  7698. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7699. }
  7700. newArray.value[line] = value;
  7701. store.updateStore(cmd.id, newArray);
  7702. }
  7703. return store;
  7704. });
  7705. }
  7706. }, {
  7707. key: "executeDeclaration",
  7708. value: function executeDeclaration(store, cmd) {
  7709. try {
  7710. var $value = this.evaluateExpression(store, cmd.initial);
  7711. if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["ArrayDeclaration"]) {
  7712. var $lines = this.evaluateExpression(store, cmd.lines);
  7713. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7714. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7715. var lineSO = values[0];
  7716. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7717. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7718. }
  7719. var line = lineSO.number;
  7720. if (line < 0) {
  7721. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7722. }
  7723. var columnSO = values[1];
  7724. var column = null;
  7725. if (columnSO !== null) {
  7726. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7727. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7728. }
  7729. column = columnSO.number;
  7730. if (column < 0) {
  7731. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7732. }
  7733. }
  7734. var value = values[2];
  7735. var temp = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](cmd.type, line, column, null);
  7736. store.insertStore(cmd.id, temp);
  7737. var realValue = value;
  7738. if (value !== null) {
  7739. if (value instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7740. if (value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7741. realValue = Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null), value.refValue);
  7742. } else {
  7743. realValue = Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), value.refValue);
  7744. }
  7745. }
  7746. } else {
  7747. realValue = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](cmd.type, line, column, []);
  7748. if (column !== null) {
  7749. for (var i = 0; i < line; i++) {
  7750. realValue.value.push(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](cmd.type.innerType, 1), column, null, []));
  7751. }
  7752. }
  7753. }
  7754. realValue.readOnly = cmd.isConst;
  7755. store.updateStore(cmd.id, realValue);
  7756. return store;
  7757. });
  7758. } else {
  7759. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](cmd.type, null);
  7760. store.insertStore(cmd.id, temp);
  7761. return $value.then(function (vl) {
  7762. var realValue = vl;
  7763. if (vl !== null) {
  7764. if (!vl.type.isCompatible(cmd.type)) {
  7765. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(cmd.type, vl.type)) {
  7766. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(cmd.type, realValue);
  7767. } else {
  7768. var stringInfo = typeInfo.type.stringInfo();
  7769. var info = stringInfo[0];
  7770. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7771. }
  7772. }
  7773. if (vl instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7774. if (vl.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7775. return Promise.reject(new Error("!!!Critical Error: Compatibility check failed, a Type accepts a CompoundType"));
  7776. } else {
  7777. realValue = Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), vl.refValue);
  7778. }
  7779. }
  7780. } else {
  7781. realValue = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](cmd.type, 0);
  7782. }
  7783. realValue.readOnly = cmd.isConst;
  7784. store.updateStore(cmd.id, realValue);
  7785. return store;
  7786. });
  7787. }
  7788. } catch (e) {
  7789. return Promise.reject(e);
  7790. }
  7791. }
  7792. }, {
  7793. key: "evaluateExpression",
  7794. value: function evaluateExpression(store, exp) {
  7795. if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["UnaryApp"]) {
  7796. return this.evaluateUnaryApp(store, exp);
  7797. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["InfixApp"]) {
  7798. return this.evaluateInfixApp(store, exp);
  7799. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["ArrayAccess"]) {
  7800. return this.evaluateArrayAccess(store, exp);
  7801. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["VariableLiteral"]) {
  7802. return this.evaluateVariableLiteral(store, exp);
  7803. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["IntLiteral"]) {
  7804. return this.evaluateLiteral(store, exp);
  7805. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["RealLiteral"]) {
  7806. return this.evaluateLiteral(store, exp);
  7807. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["BoolLiteral"]) {
  7808. return this.evaluateLiteral(store, exp);
  7809. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["StringLiteral"]) {
  7810. return this.evaluateLiteral(store, exp);
  7811. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["ArrayLiteral"]) {
  7812. return this.evaluateArrayLiteral(store, exp);
  7813. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["FunctionCall"]) {
  7814. return this.evaluateFunctionCall(store, exp);
  7815. }
  7816. return Promise.resolve(null);
  7817. }
  7818. }, {
  7819. key: "evaluateFunctionCall",
  7820. value: function evaluateFunctionCall(store, exp) {
  7821. if (exp.isMainCall) {
  7822. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName(), exp.sourceInfo));
  7823. }
  7824. var func = this.findFunction(exp.id);
  7825. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID.isCompatible(func.returnType)) {
  7826. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].void_in_expression_full(exp.id, exp.sourceInfo));
  7827. }
  7828. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7829. return $newStore.then(function (sto) {
  7830. if (sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7831. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7832. }
  7833. var val = sto.applyStore('$');
  7834. if (val instanceof _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"]) {
  7835. return Promise.resolve(Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null, null, null), val));
  7836. } else {
  7837. return Promise.resolve(Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), val));
  7838. }
  7839. });
  7840. }
  7841. }, {
  7842. key: "evaluateArrayLiteral",
  7843. value: function evaluateArrayLiteral(store, exp) {
  7844. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7845. var errorCode = validationResult[0];
  7846. switch (errorCode) {
  7847. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_COLUMN_NUMBER:
  7848. {
  7849. var columnValue = validationResult[1];
  7850. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7851. }
  7852. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_LINE_NUMBER:
  7853. {
  7854. var lineValue = validationResult[1];
  7855. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7856. }
  7857. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_TYPE:
  7858. {
  7859. var line = null;
  7860. var strExp = null;
  7861. if (validationResult.length > 2) {
  7862. line = validationResult[1];
  7863. var column = validationResult[2];
  7864. strExp = exp.value[line].value[column].toString();
  7865. } else {
  7866. line = validationResult[1];
  7867. strExp = exp.value[line].toString();
  7868. }
  7869. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7870. }
  7871. }
  7872. };
  7873. if (!exp.isVector) {
  7874. var $matrix = this.evaluateMatrix(store, exp.value);
  7875. return $matrix.then(function (list) {
  7876. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type.innerType, 2);
  7877. var arr = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, list[0].lines, list);
  7878. var checkResult = arr.isValid;
  7879. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7880. return errorHelperFunction(checkResult, exp);
  7881. }
  7882. });
  7883. } else {
  7884. return this.evaluateVector(store, exp.value).then(function (list) {
  7885. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type, 1);
  7886. var stoArray = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, null, list);
  7887. var checkResult = stoArray.isValid;
  7888. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7889. return errorHelperFunction(checkResult, exp);
  7890. }
  7891. });
  7892. }
  7893. }
  7894. }, {
  7895. key: "evaluateVector",
  7896. value: function evaluateVector(store, exps) {
  7897. var _this9 = this;
  7898. return Promise.all(exps.map(function (exp) {
  7899. return _this9.evaluateExpression(store, exp);
  7900. }));
  7901. }
  7902. }, {
  7903. key: "evaluateMatrix",
  7904. value: function evaluateMatrix(store, exps) {
  7905. var _this10 = this;
  7906. return Promise.all(exps.map(function (vector) {
  7907. var $vector = _this10.evaluateVector(store, vector.value);
  7908. return $vector.then(function (list) {
  7909. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type, 1);
  7910. return new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, null, list);
  7911. });
  7912. }));
  7913. }
  7914. }, {
  7915. key: "evaluateLiteral",
  7916. value: function evaluateLiteral(_, exp) {
  7917. return Promise.resolve(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](exp.type, exp.value));
  7918. }
  7919. }, {
  7920. key: "evaluateVariableLiteral",
  7921. value: function evaluateVariableLiteral(store, exp) {
  7922. try {
  7923. var val = store.applyStore(exp.id);
  7924. if (val instanceof _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"]) {
  7925. return Promise.resolve(Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null, null), val));
  7926. } else {
  7927. return Promise.resolve(Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), val));
  7928. }
  7929. } catch (error) {
  7930. return Promise.reject(error);
  7931. }
  7932. }
  7933. }, {
  7934. key: "evaluateArrayAccess",
  7935. value: function evaluateArrayAccess(store, exp) {
  7936. var mustBeArray = store.applyStore(exp.id);
  7937. if (!(mustBeArray.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"])) {
  7938. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_access_full(exp.id, exp.sourceInfo));
  7939. }
  7940. var $line = this.evaluateExpression(store, exp.line);
  7941. var $column = this.evaluateExpression(store, exp.column);
  7942. return Promise.all([$line, $column]).then(function (values) {
  7943. var lineSO = values[0];
  7944. var columnSO = values[1];
  7945. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7946. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(exp.sourceInfo));
  7947. }
  7948. var line = lineSO.number;
  7949. var column = null;
  7950. if (columnSO !== null) {
  7951. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7952. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(exp.sourceInfo));
  7953. }
  7954. column = columnSO.number;
  7955. }
  7956. if (line >= mustBeArray.lines) {
  7957. if (mustBeArray.isVector) {
  7958. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7959. } else {
  7960. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7961. }
  7962. } else if (line < 0) {
  7963. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(exp.sourceInfo);
  7964. }
  7965. if (column !== null && mustBeArray.columns === null) {
  7966. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_not_matrix_full(exp.id, exp.sourceInfo));
  7967. }
  7968. if (column !== null) {
  7969. if (column >= mustBeArray.columns) {
  7970. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7971. } else if (column < 0) {
  7972. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(exp.sourceInfo);
  7973. }
  7974. }
  7975. return Promise.resolve(new _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"](mustBeArray.id, line, column, store));
  7976. });
  7977. }
  7978. }, {
  7979. key: "evaluateUnaryApp",
  7980. value: function evaluateUnaryApp(store, unaryApp) {
  7981. var $left = this.evaluateExpression(store, unaryApp.left);
  7982. return $left.then(function (left) {
  7983. var resultType = Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_9__["resultTypeAfterUnaryOp"])(unaryApp.op, left.type);
  7984. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].UNDEFINED.isCompatible(resultType)) {
  7985. var stringInfo = left.type.stringInfo();
  7986. var info = stringInfo[0];
  7987. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7988. }
  7989. switch (unaryApp.op.ord) {
  7990. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].ADD.ord:
  7991. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value);
  7992. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].SUB.ord:
  7993. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.negated());
  7994. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].NOT.ord:
  7995. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, !left.value);
  7996. default:
  7997. return Promise.reject(new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7998. }
  7999. });
  8000. }
  8001. }, {
  8002. key: "evaluateInfixApp",
  8003. value: function evaluateInfixApp(store, infixApp) {
  8004. var $left = this.evaluateExpression(store, infixApp.left);
  8005. var $right = this.evaluateExpression(store, infixApp.right);
  8006. return Promise.all([$left, $right]).then(function (values) {
  8007. var shouldImplicitCast = false;
  8008. var left = values[0];
  8009. var right = values[1];
  8010. var resultType = Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_9__["resultTypeAfterInfixOp"])(infixApp.op, left.type, right.type);
  8011. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].UNDEFINED.isCompatible(resultType)) {
  8012. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(left.type, right.type)) {
  8013. shouldImplicitCast = true;
  8014. } else {
  8015. var stringInfoLeft = left.type.stringInfo();
  8016. var infoLeft = stringInfoLeft[0];
  8017. var stringInfoRight = right.type.stringInfo();
  8018. var infoRight = stringInfoRight[0];
  8019. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  8020. }
  8021. }
  8022. var result = null;
  8023. switch (infixApp.op.ord) {
  8024. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].ADD.ord:
  8025. {
  8026. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8027. var rightStr = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__["convertToString"])(right.value, right.type);
  8028. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value + rightStr);
  8029. } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(right.type)) {
  8030. var leftStr = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__["convertToString"])(left.value, left.type);
  8031. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, leftStr + right.value);
  8032. } else {
  8033. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.plus(right.value));
  8034. }
  8035. }
  8036. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].SUB.ord:
  8037. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.minus(right.value));
  8038. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].MULT.ord:
  8039. {
  8040. result = left.value.times(right.value);
  8041. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8042. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8043. }
  8044. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8045. }
  8046. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].DIV.ord:
  8047. {
  8048. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  8049. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8050. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8051. }
  8052. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8053. }
  8054. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].MOD.ord:
  8055. {
  8056. var leftValue = left.value;
  8057. var rightValue = right.value;
  8058. if (shouldImplicitCast) {
  8059. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER;
  8060. leftValue = leftValue.trunc();
  8061. rightValue = rightValue.trunc();
  8062. }
  8063. result = leftValue.modulo(rightValue);
  8064. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8065. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8066. }
  8067. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8068. }
  8069. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].GT.ord:
  8070. {
  8071. var _leftValue = left.value;
  8072. var _rightValue = right.value;
  8073. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8074. result = left.value.length > right.value.length;
  8075. } else {
  8076. if (shouldImplicitCast) {
  8077. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8078. _leftValue = _leftValue.trunc();
  8079. _rightValue = _rightValue.trunc();
  8080. }
  8081. result = _leftValue.gt(_rightValue);
  8082. }
  8083. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8084. }
  8085. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].GE.ord:
  8086. {
  8087. var _leftValue2 = left.value;
  8088. var _rightValue2 = right.value;
  8089. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8090. result = left.value.length >= right.value.length;
  8091. } else {
  8092. if (shouldImplicitCast) {
  8093. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8094. _leftValue2 = _leftValue2.trunc();
  8095. _rightValue2 = _rightValue2.trunc();
  8096. }
  8097. result = _leftValue2.gte(_rightValue2);
  8098. }
  8099. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8100. }
  8101. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].LT.ord:
  8102. {
  8103. var _leftValue3 = left.value;
  8104. var _rightValue3 = right.value;
  8105. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8106. result = left.value.length < right.value.length;
  8107. } else {
  8108. if (shouldImplicitCast) {
  8109. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8110. _leftValue3 = _leftValue3.trunc();
  8111. _rightValue3 = _rightValue3.trunc();
  8112. }
  8113. result = _leftValue3.lt(_rightValue3);
  8114. }
  8115. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8116. }
  8117. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].LE.ord:
  8118. {
  8119. var _leftValue4 = left.value;
  8120. var _rightValue4 = right.value;
  8121. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8122. result = left.value.length <= right.value.length;
  8123. } else {
  8124. if (shouldImplicitCast) {
  8125. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8126. _leftValue4 = _leftValue4.trunc();
  8127. _rightValue4 = _rightValue4.trunc();
  8128. }
  8129. result = _leftValue4.lte(_rightValue4);
  8130. }
  8131. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8132. }
  8133. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].EQ.ord:
  8134. {
  8135. var _leftValue5 = left.value;
  8136. var _rightValue5 = right.value;
  8137. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].REAL.isCompatible(left.type)) {
  8138. if (shouldImplicitCast) {
  8139. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8140. _leftValue5 = _leftValue5.trunc();
  8141. _rightValue5 = _rightValue5.trunc();
  8142. }
  8143. result = _leftValue5.eq(_rightValue5);
  8144. } else {
  8145. result = left.value === right.value;
  8146. }
  8147. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8148. }
  8149. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].NEQ.ord:
  8150. {
  8151. var _leftValue6 = left.value;
  8152. var _rightValue6 = right.value;
  8153. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].REAL.isCompatible(left.type)) {
  8154. if (shouldImplicitCast) {
  8155. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8156. _leftValue6 = _leftValue6.trunc();
  8157. _rightValue6 = _rightValue6.trunc();
  8158. }
  8159. result = !_leftValue6.eq(_rightValue6);
  8160. } else {
  8161. result = left.value !== right.value;
  8162. }
  8163. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8164. }
  8165. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].AND.ord:
  8166. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value && right.value);
  8167. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].OR.ord:
  8168. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value || right.value);
  8169. default:
  8170. return Promise.reject(new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]('!!!Critical Invalid InfixApp ' + infixApp.op));
  8171. }
  8172. });
  8173. }
  8174. }, {
  8175. key: "parseStoreObjectValue",
  8176. value: function parseStoreObjectValue(vl) {
  8177. var realValue = vl;
  8178. if (vl instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  8179. if (vl.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  8180. switch (vl.type.dimensions) {
  8181. case 1:
  8182. {
  8183. realValue = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](vl.type, vl.value);
  8184. break;
  8185. }
  8186. default:
  8187. {
  8188. throw new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]("Three dimensional array address...");
  8189. }
  8190. }
  8191. } else {
  8192. realValue = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](vl.type, vl.value);
  8193. }
  8194. }
  8195. return realValue;
  8196. }
  8197. }]);
  8198. return IVProgProcessor;
  8199. }();
  8200. /***/ }),
  8201. /***/ "./js/processor/lib/arrays.js":
  8202. /*!************************************!*\
  8203. !*** ./js/processor/lib/arrays.js ***!
  8204. \************************************/
  8205. /*! exports provided: createNumElementsFun, createMatrixLinesFun, createMatrixColumnsFun */
  8206. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8207. "use strict";
  8208. __webpack_require__.r(__webpack_exports__);
  8209. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNumElementsFun", function() { return createNumElementsFun; });
  8210. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMatrixLinesFun", function() { return createMatrixLinesFun; });
  8211. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMatrixColumnsFun", function() { return createMatrixColumnsFun; });
  8212. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8213. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8214. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8215. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8216. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8217. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8218. /**
  8219. * num_elements
  8220. * matrix_lines
  8221. * matrix_columns
  8222. */
  8223. function createNumElementsFun() {
  8224. var numElementsFun = function numElementsFun(sto, _) {
  8225. var vector = sto.applyStore("vector");
  8226. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(vector.lines));
  8227. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8228. return Promise.resolve(sto.updateStore("$", temp));
  8229. };
  8230. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](numElementsFun)]);
  8231. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$numElements', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 1), 'vector', false)], block);
  8232. return func;
  8233. }
  8234. function createMatrixLinesFun() {
  8235. var matrixLinesFun = function matrixLinesFun(sto, _) {
  8236. var matrix = sto.applyStore("matrix");
  8237. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(matrix.lines));
  8238. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8239. return Promise.resolve(sto.updateStore("$", temp));
  8240. };
  8241. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](matrixLinesFun)]);
  8242. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$matrixLines', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 2), 'matrix', false)], block);
  8243. return func;
  8244. }
  8245. function createMatrixColumnsFun() {
  8246. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  8247. var matrix = sto.applyStore("matrix");
  8248. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(matrix.columns));
  8249. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8250. return Promise.resolve(sto.updateStore("$", temp));
  8251. };
  8252. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](matrixColumnsFun)]);
  8253. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$matrixColumns', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 2), 'matrix', false)], block);
  8254. return func;
  8255. }
  8256. /***/ }),
  8257. /***/ "./js/processor/lib/io.js":
  8258. /*!********************************!*\
  8259. !*** ./js/processor/lib/io.js ***!
  8260. \********************************/
  8261. /*! exports provided: createOutputFun, createInputFun */
  8262. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8263. "use strict";
  8264. __webpack_require__.r(__webpack_exports__);
  8265. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOutputFun", function() { return createOutputFun; });
  8266. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createInputFun", function() { return createInputFun; });
  8267. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  8268. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8269. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8270. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8271. function createOutputFun() {
  8272. var writeFunction = function writeFunction(store, _) {
  8273. var val = store.applyStore('p1');
  8274. this.output.sendOutput(Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(val.value, val.type));
  8275. return Promise.resolve(store);
  8276. };
  8277. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](writeFunction)]);
  8278. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$write', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].ALL, 'p1', false)], block);
  8279. return func;
  8280. }
  8281. function createInputFun() {
  8282. var readFunction = function readFunction(store, _) {
  8283. var _this = this;
  8284. var request = new Promise(function (resolve, _) {
  8285. _this.input.requestInput(resolve);
  8286. });
  8287. return request.then(function (text) {
  8288. var typeToConvert = store.applyStore('p1').type;
  8289. var stoObj = null;
  8290. if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].INTEGER)) {
  8291. var val = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toInt"])(text);
  8292. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].INTEGER, val.trunc());
  8293. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].REAL)) {
  8294. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].REAL, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toReal"])(text));
  8295. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].BOOLEAN)) {
  8296. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].BOOLEAN, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toBool"])(text));
  8297. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].STRING)) {
  8298. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].STRING, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toString"])(text));
  8299. }
  8300. _this.loopTimers.splice(0, _this.loopTimers.length);
  8301. store.updateStore('p1', stoObj);
  8302. return Promise.resolve(store);
  8303. });
  8304. };
  8305. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](readFunction)]);
  8306. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$read', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].ALL, 'p1', true)], block);
  8307. return func;
  8308. }
  8309. /***/ }),
  8310. /***/ "./js/processor/lib/lang.js":
  8311. /*!**********************************!*\
  8312. !*** ./js/processor/lib/lang.js ***!
  8313. \**********************************/
  8314. /*! exports provided: createIsRealFun, createIsIntFun, createIsBoolFun, createCastRealFun, createCastIntFun, createCastBoolFun, createCastStringFun */
  8315. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8316. "use strict";
  8317. __webpack_require__.r(__webpack_exports__);
  8318. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsRealFun", function() { return createIsRealFun; });
  8319. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsIntFun", function() { return createIsIntFun; });
  8320. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsBoolFun", function() { return createIsBoolFun; });
  8321. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastRealFun", function() { return createCastRealFun; });
  8322. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastIntFun", function() { return createCastIntFun; });
  8323. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastBoolFun", function() { return createCastBoolFun; });
  8324. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastStringFun", function() { return createCastStringFun; });
  8325. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8326. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8327. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8328. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8329. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  8330. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8331. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8332. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8333. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8334. /**
  8335. *
  8336. * is_real
  8337. * is_int
  8338. * is_bool
  8339. * cast_real
  8340. * cast_int
  8341. * cast_bool
  8342. * cast_string
  8343. */
  8344. function createIsRealFun() {
  8345. var isRealFun = function isRealFun(sto, _) {
  8346. var str = sto.applyStore("str");
  8347. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8348. var result = false;
  8349. try {
  8350. var val = parser.parseTerm();
  8351. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["RealLiteral"]) {
  8352. result = true;
  8353. }
  8354. } catch (error) {}
  8355. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8356. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8357. return Promise.resolve(sto.updateStore("$", temp));
  8358. };
  8359. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isRealFun)]);
  8360. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isReal', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8361. return func;
  8362. }
  8363. function createIsIntFun() {
  8364. var isIntFun = function isIntFun(sto, _) {
  8365. var str = sto.applyStore("str");
  8366. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8367. var result = false;
  8368. try {
  8369. var val = parser.parseTerm();
  8370. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["IntLiteral"]) {
  8371. result = true;
  8372. }
  8373. } catch (error) {}
  8374. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8375. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8376. return Promise.resolve(sto.updateStore("$", temp));
  8377. };
  8378. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isIntFun)]);
  8379. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isInt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8380. return func;
  8381. }
  8382. function createIsBoolFun() {
  8383. var isBoolFun = function isBoolFun(sto, _) {
  8384. var str = sto.applyStore("str");
  8385. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8386. var result = false;
  8387. try {
  8388. var val = parser.parseTerm();
  8389. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["BoolLiteral"]) {
  8390. result = true;
  8391. }
  8392. } catch (error) {}
  8393. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8394. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8395. return Promise.resolve(sto.updateStore("$", temp));
  8396. };
  8397. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isBoolFun)]);
  8398. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isBool', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8399. return func;
  8400. }
  8401. function createCastRealFun() {
  8402. var castRealFun = function castRealFun(sto, _) {
  8403. var val = sto.applyStore("val");
  8404. var value = val.value;
  8405. switch (val.type.ord) {
  8406. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER.ord:
  8407. {
  8408. value = value.toNumber();
  8409. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(value));
  8410. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8411. return Promise.resolve(sto.updateStore("$", temp));
  8412. }
  8413. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING.ord:
  8414. {
  8415. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8416. try {
  8417. var result = parser.parseTerm();
  8418. if (result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["RealLiteral"]) {
  8419. var _temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result.value);
  8420. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8421. return Promise.resolve(sto.updateStore("$", _temp));
  8422. }
  8423. } catch (error) {}
  8424. }
  8425. }
  8426. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL.stringInfo();
  8427. var typeInfo = typeStringInfoArray[0];
  8428. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8429. };
  8430. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castRealFun)]);
  8431. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castReal', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING]), 'val', false)], block);
  8432. return func;
  8433. }
  8434. function createCastIntFun() {
  8435. var castIntFun = function castIntFun(sto, _) {
  8436. var val = sto.applyStore("val");
  8437. var value = val.value;
  8438. switch (val.type.ord) {
  8439. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL.ord:
  8440. {
  8441. value = value.toNumber();
  8442. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Math.floor(value));
  8443. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8444. return Promise.resolve(sto.updateStore("$", temp));
  8445. }
  8446. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING.ord:
  8447. {
  8448. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8449. try {
  8450. var result = parser.parseTerm();
  8451. if (result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["IntLiteral"]) {
  8452. var _temp2 = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, result.value);
  8453. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8454. return Promise.resolve(sto.updateStore("$", _temp2));
  8455. }
  8456. } catch (error) {}
  8457. }
  8458. }
  8459. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER.stringInfo();
  8460. var typeInfo = typeStringInfoArray[0];
  8461. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8462. };
  8463. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castIntFun)]);
  8464. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castInt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING]), 'val', false)], block);
  8465. return func;
  8466. }
  8467. function createCastBoolFun() {
  8468. var castBoolFun = function castBoolFun(sto, _) {
  8469. var str = sto.applyStore("str");
  8470. var value = str.value;
  8471. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8472. try {
  8473. var val = parser.parseTerm();
  8474. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["BoolLiteral"]) {
  8475. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, val.value);
  8476. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8477. return Promise.resolve(sto.updateStore("$", temp));
  8478. }
  8479. } catch (error) {}
  8480. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN.stringInfo();
  8481. var typeInfo = typeStringInfoArray[0];
  8482. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8483. };
  8484. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castBoolFun)]);
  8485. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castBool', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8486. return func;
  8487. }
  8488. function createCastStringFun() {
  8489. var castStringFun = function castStringFun(store, _) {
  8490. var val = store.applyStore('str');
  8491. var result = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["convertToString"])(val);
  8492. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, result);
  8493. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8494. return Promise.resolve(sto.updateStore("$", temp));
  8495. };
  8496. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castStringFun)]);
  8497. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castString', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 'str', false)], block);
  8498. return func;
  8499. }
  8500. /***/ }),
  8501. /***/ "./js/processor/lib/math.js":
  8502. /*!**********************************!*\
  8503. !*** ./js/processor/lib/math.js ***!
  8504. \**********************************/
  8505. /*! exports provided: createSinFun, createCosFun, createTanFun, createSqrtFun, createPowFun, createLogFun, createAbsFun, createNegateFun, createInvertFun, createMaxFun, createMinFun */
  8506. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8507. "use strict";
  8508. __webpack_require__.r(__webpack_exports__);
  8509. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSinFun", function() { return createSinFun; });
  8510. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCosFun", function() { return createCosFun; });
  8511. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTanFun", function() { return createTanFun; });
  8512. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSqrtFun", function() { return createSqrtFun; });
  8513. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPowFun", function() { return createPowFun; });
  8514. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLogFun", function() { return createLogFun; });
  8515. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAbsFun", function() { return createAbsFun; });
  8516. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNegateFun", function() { return createNegateFun; });
  8517. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createInvertFun", function() { return createInvertFun; });
  8518. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMaxFun", function() { return createMaxFun; });
  8519. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMinFun", function() { return createMinFun; });
  8520. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8521. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8522. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8523. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8524. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8525. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_4__);
  8526. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8527. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8528. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8529. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8530. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
  8531. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
  8532. function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
  8533. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
  8534. /**
  8535. * sin
  8536. * cos
  8537. * tan
  8538. * sqrt
  8539. * pow
  8540. * log
  8541. * abs
  8542. * negate
  8543. * invert
  8544. * max
  8545. * min
  8546. */
  8547. function convertToRadians(degrees) {
  8548. return degrees.times(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].acos(-1)).div(180);
  8549. }
  8550. function createSinFun() {
  8551. var sinFun = function sinFun(sto, _) {
  8552. var x = sto.applyStore('x');
  8553. var angle = x.value.mod(360);
  8554. var result = null;
  8555. if (angle.eq(90)) {
  8556. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](1);
  8557. } else if (angle.eq(180)) {
  8558. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8559. } else if (angle.eq(270)) {
  8560. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](-1);
  8561. } else {
  8562. result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].sin(convertToRadians(angle));
  8563. }
  8564. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8565. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8566. }
  8567. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8568. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8569. return Promise.resolve(sto.updateStore('$', temp));
  8570. };
  8571. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](sinFun)]);
  8572. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$sin', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8573. return func;
  8574. }
  8575. function createCosFun() {
  8576. var cosFun = function cosFun(sto, _) {
  8577. var x = sto.applyStore('x');
  8578. var angle = x.value.mod(360);
  8579. var result = null;
  8580. if (angle.eq(90)) {
  8581. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8582. } else if (angle.eq(180)) {
  8583. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](-1);
  8584. } else if (angle.eq(270)) {
  8585. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8586. }
  8587. result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].cos(convertToRadians(angle));
  8588. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8589. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8590. }
  8591. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8592. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8593. return Promise.resolve(sto.updateStore('$', temp));
  8594. };
  8595. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](cosFun)]);
  8596. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$cos', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8597. return func;
  8598. }
  8599. function createTanFun() {
  8600. var tanFun = function tanFun(sto, _) {
  8601. var x = sto.applyStore('x');
  8602. var angle = x.value.mod(360);
  8603. if (angle.eq(90) || angle.eq(270)) {
  8604. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8605. }
  8606. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].tan(convertToRadians(angle));
  8607. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8608. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8609. }
  8610. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8611. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8612. return Promise.resolve(sto.updateStore('$', temp));
  8613. };
  8614. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](tanFun)]);
  8615. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$tan', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8616. return func;
  8617. }
  8618. function createSqrtFun() {
  8619. var sqrtFun = function sqrtFun(sto, _) {
  8620. var x = sto.applyStore('x');
  8621. var result = x.value.sqrt();
  8622. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8623. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8624. }
  8625. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8626. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8627. return Promise.resolve(sto.updateStore('$', temp));
  8628. };
  8629. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](sqrtFun)]);
  8630. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$sqrt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8631. return func;
  8632. }
  8633. function createPowFun() {
  8634. var powFun = function powFun(sto, _) {
  8635. var x = sto.applyStore('x');
  8636. var y = sto.applyStore('y');
  8637. var result = x.value.pow(y.value);
  8638. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8639. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8640. }
  8641. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8642. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8643. return Promise.resolve(sto.updateStore('$', temp));
  8644. };
  8645. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](powFun)]);
  8646. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$pow', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'y', false)], block);
  8647. return func;
  8648. }
  8649. function createLogFun() {
  8650. var logFun = function logFun(sto, _) {
  8651. var x = sto.applyStore('x');
  8652. if (x.value.isNegative()) {
  8653. return Promise.reject("the value passed to log function cannot be negative");
  8654. }
  8655. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].log10(x.value);
  8656. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8657. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8658. }
  8659. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8660. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8661. return Promise.resolve(sto.updateStore('$', temp));
  8662. };
  8663. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](logFun)]);
  8664. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$log', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8665. return func;
  8666. }
  8667. function createAbsFun() {
  8668. var absFun = function absFun(sto, _) {
  8669. var x = sto.applyStore('x');
  8670. var result = x.value.abs();
  8671. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type, result);
  8672. sto.updateStore('$', temp);
  8673. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8674. return Promise.resolve(sto);
  8675. };
  8676. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](absFun)]);
  8677. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$abs', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8678. return func;
  8679. }
  8680. function createNegateFun() {
  8681. var negateFun = function negateFun(sto, _) {
  8682. var x = sto.applyStore('x');
  8683. var result = x.value.negated();
  8684. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type, result);
  8685. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8686. return Promise.resolve(sto.updateStore('$', temp));
  8687. };
  8688. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](negateFun)]);
  8689. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$negate', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8690. return func;
  8691. }
  8692. function createInvertFun() {
  8693. var invertFun = function invertFun(sto, _) {
  8694. var x = sto.applyStore('x');
  8695. var result = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(1).dividedBy(x.value);
  8696. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8697. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8698. }
  8699. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8700. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8701. return Promise.resolve(sto.updateStore('$', temp));
  8702. };
  8703. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](invertFun)]);
  8704. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$invert', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8705. return func;
  8706. }
  8707. function createMaxFun() {
  8708. var maxFun = function maxFun(sto, _) {
  8709. var x = sto.applyStore('x');
  8710. var numbers = x.value.map(function (stoObj) {
  8711. return stoObj.value;
  8712. });
  8713. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].max.apply(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"], _toConsumableArray(numbers));
  8714. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type.innerType, result);
  8715. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8716. return Promise.resolve(sto.updateStore('$', temp));
  8717. };
  8718. var paramType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__["CompoundType"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 1);
  8719. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](maxFun)]);
  8720. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$max', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](paramType, 'x', false)], block);
  8721. return func;
  8722. }
  8723. function createMinFun() {
  8724. var minFun = function minFun(sto, _) {
  8725. var x = sto.applyStore('x');
  8726. var numbers = x.value.map(function (stoObj) {
  8727. return stoObj.value;
  8728. });
  8729. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].min.apply(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"], _toConsumableArray(numbers));
  8730. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type.innerType, result);
  8731. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8732. return Promise.resolve(sto.updateStore('$', temp));
  8733. };
  8734. var paramType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__["CompoundType"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 1);
  8735. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](minFun)]);
  8736. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$min', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](paramType, 'x', false)], block);
  8737. return func;
  8738. }
  8739. /***/ }),
  8740. /***/ "./js/processor/lib/strings.js":
  8741. /*!*************************************!*\
  8742. !*** ./js/processor/lib/strings.js ***!
  8743. \*************************************/
  8744. /*! exports provided: createSubstringFun, createLengthFun, createUppercaseFun, createLowercaseFun, createrCharAtFun */
  8745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8746. "use strict";
  8747. __webpack_require__.r(__webpack_exports__);
  8748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSubstringFun", function() { return createSubstringFun; });
  8749. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLengthFun", function() { return createLengthFun; });
  8750. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createUppercaseFun", function() { return createUppercaseFun; });
  8751. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLowercaseFun", function() { return createLowercaseFun; });
  8752. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createrCharAtFun", function() { return createrCharAtFun; });
  8753. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8754. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8755. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8756. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8757. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8758. /*
  8759. * substring
  8760. * length
  8761. * uppercase
  8762. * lowercase
  8763. * charAt
  8764. **/
  8765. function createSubstringFun() {
  8766. var substringFun = function substringFun(sto, _) {
  8767. var str = sto.applyStore("str");
  8768. var start = sto.applyStore("start");
  8769. var end = sto.applyStore("end");
  8770. var result = str.value.substring(start.value, end.value);
  8771. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, result);
  8772. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8773. return Promise.resolve(sto.updateStore("$", temp));
  8774. };
  8775. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](substringFun)]);
  8776. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$substring', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'start', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'end', false)], block);
  8777. return func;
  8778. }
  8779. function createLengthFun() {
  8780. var lengthFun = function lengthFun(sto, _) {
  8781. var str = sto.applyStore("str");
  8782. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(str.value.length));
  8783. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8784. return Promise.resolve(sto.updateStore("$", temp));
  8785. };
  8786. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](lengthFun)]);
  8787. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$length', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8788. return func;
  8789. }
  8790. function createUppercaseFun() {
  8791. var uppercaseFun = function uppercaseFun(sto, _) {
  8792. var str = sto.applyStore("str");
  8793. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.toUpperCase());
  8794. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8795. return Promise.resolve(sto.updateStore("$", temp));
  8796. };
  8797. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](uppercaseFun)]);
  8798. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$uppercase', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8799. return func;
  8800. }
  8801. function createLowercaseFun() {
  8802. var lowercaseFun = function lowercaseFun(sto, _) {
  8803. var str = sto.applyStore("str");
  8804. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.toLowerCase());
  8805. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8806. return Promise.resolve(sto.updateStore("$", temp));
  8807. };
  8808. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](lowercaseFun)]);
  8809. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$lowercase', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8810. return func;
  8811. }
  8812. function createrCharAtFun() {
  8813. var charAtFun = function charAtFun(sto, _) {
  8814. var str = sto.applyStore("str");
  8815. var idx = sto.applyStore("index");
  8816. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8817. return Promise.reject(new Error("invalid string position"));
  8818. }
  8819. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.charAt(idx.value.toNumber()));
  8820. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8821. return Promise.resolve(sto.updateStore("$", temp));
  8822. };
  8823. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](charAtFun)]);
  8824. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$charAt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'index', false)], block);
  8825. return func;
  8826. }
  8827. /***/ }),
  8828. /***/ "./js/processor/modes.js":
  8829. /*!*******************************!*\
  8830. !*** ./js/processor/modes.js ***!
  8831. \*******************************/
  8832. /*! exports provided: Modes */
  8833. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8834. "use strict";
  8835. __webpack_require__.r(__webpack_exports__);
  8836. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Modes", function() { return Modes; });
  8837. var Modes = Object.freeze({
  8838. RETURN: Symbol('mode:return'),
  8839. BREAK: Symbol('mode:break'),
  8840. PAUSE: Symbol('mode:pause'),
  8841. RUN: Symbol('mode:run')
  8842. });
  8843. /***/ }),
  8844. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8845. /*!***************************************************!*\
  8846. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8847. \***************************************************/
  8848. /*! exports provided: SemanticAnalyser */
  8849. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8850. "use strict";
  8851. __webpack_require__.r(__webpack_exports__);
  8852. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SemanticAnalyser", function() { return SemanticAnalyser; });
  8853. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8854. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8855. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8856. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8857. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8858. /* harmony import */ var _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8859. /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8860. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8861. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8862. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8863. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8864. /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../store/store */ "./js/processor/store/store.js");
  8865. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  8866. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8867. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  8868. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8869. var SemanticAnalyser =
  8870. /*#__PURE__*/
  8871. function () {
  8872. _createClass(SemanticAnalyser, null, [{
  8873. key: "analyseFromSource",
  8874. value: function analyseFromSource(stringCode) {
  8875. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_12__["IVProgParser"].createParser(stringCode);
  8876. var semantic = new SemanticAnalyser(parser.parseTree());
  8877. return semantic.analyseTree();
  8878. }
  8879. }]);
  8880. function SemanticAnalyser(ast) {
  8881. _classCallCheck(this, SemanticAnalyser);
  8882. this.ast = ast;
  8883. this.lexerClass = _services_languageService__WEBPACK_IMPORTED_MODULE_2__["LanguageService"].getCurrentLexer();
  8884. var lexer = new this.lexerClass(null);
  8885. this.literalNames = lexer.literalNames;
  8886. this.symbolMap = null;
  8887. this.currentFunction = null;
  8888. }
  8889. _createClass(SemanticAnalyser, [{
  8890. key: "pushMap",
  8891. value: function pushMap() {
  8892. if (this.symbolMap === null) {
  8893. this.symbolMap = {
  8894. map: {},
  8895. next: null
  8896. };
  8897. } else {
  8898. var n = {
  8899. map: {},
  8900. next: this.symbolMap
  8901. };
  8902. this.symbolMap = n;
  8903. }
  8904. }
  8905. }, {
  8906. key: "popMap",
  8907. value: function popMap() {
  8908. if (this.symbolMap !== null) {
  8909. this.symbolMap = this.symbolMap.next;
  8910. }
  8911. }
  8912. }, {
  8913. key: "insertSymbol",
  8914. value: function insertSymbol(id, typeInfo) {
  8915. this.symbolMap.map[id] = typeInfo;
  8916. }
  8917. }, {
  8918. key: "findSymbol",
  8919. value: function findSymbol(id, symMap) {
  8920. if (!symMap.map[id]) {
  8921. if (symMap.next) {
  8922. return this.findSymbol(id, symMap.next);
  8923. }
  8924. return null;
  8925. } else {
  8926. return symMap.map[id];
  8927. }
  8928. }
  8929. }, {
  8930. key: "getMainFunction",
  8931. value: function getMainFunction() {
  8932. return this.ast.functions.find(function (v) {
  8933. return v.isMain;
  8934. });
  8935. }
  8936. }, {
  8937. key: "findFunction",
  8938. value: function findFunction(name) {
  8939. if (name.match(/^\$.+$/)) {
  8940. var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getFunction(name);
  8941. if (!!!fun) {
  8942. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].not_implemented(name);
  8943. }
  8944. return fun;
  8945. } else {
  8946. var val = this.ast.functions.find(function (v) {
  8947. return v.name === name;
  8948. });
  8949. if (!!!val) {
  8950. return null;
  8951. }
  8952. return val;
  8953. }
  8954. }
  8955. }, {
  8956. key: "analyseTree",
  8957. value: function analyseTree() {
  8958. var globalVars = this.ast.global;
  8959. this.pushMap();
  8960. this.assertDeclarations(globalVars);
  8961. var functions = this.ast.functions;
  8962. var mainFunc = functions.filter(function (f) {
  8963. return f.name === null;
  8964. });
  8965. if (mainFunc.length <= 0) {
  8966. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].main_missing();
  8967. }
  8968. for (var i = 0; i < functions.length; i++) {
  8969. var fun = functions[i];
  8970. this.assertFunction(fun);
  8971. }
  8972. return this.ast;
  8973. }
  8974. }, {
  8975. key: "assertDeclarations",
  8976. value: function assertDeclarations(list) {
  8977. for (var i = 0; i < list.length; i++) {
  8978. this.assertDeclaration(list[i]);
  8979. }
  8980. }
  8981. }, {
  8982. key: "assertDeclaration",
  8983. value: function assertDeclaration(declaration) {
  8984. if (declaration instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["ArrayDeclaration"]) {
  8985. if (declaration.initial === null) {
  8986. var lineType = this.evaluateExpressionType(declaration.lines);
  8987. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  8988. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(declaration.sourceInfo);
  8989. }
  8990. if (declaration.columns !== null) {
  8991. var columnType = this.evaluateExpressionType(declaration.columns);
  8992. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  8993. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(declaration.sourceInfo);
  8994. }
  8995. }
  8996. this.insertSymbol(declaration.id, {
  8997. id: declaration.id,
  8998. lines: declaration.lines,
  8999. columns: declaration.columns,
  9000. type: declaration.type
  9001. });
  9002. return;
  9003. }
  9004. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  9005. this.insertSymbol(declaration.id, {
  9006. id: declaration.id,
  9007. lines: declaration.lines,
  9008. columns: declaration.columns,
  9009. type: declaration.type
  9010. });
  9011. } else {
  9012. if (declaration.initial === null) {
  9013. this.insertSymbol(declaration.id, {
  9014. id: declaration.id,
  9015. type: declaration.type
  9016. });
  9017. return;
  9018. }
  9019. var resultType = this.evaluateExpressionType(declaration.initial);
  9020. if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9021. if (!resultType.isCompatible(declaration.type)) {
  9022. var stringInfo = declaration.type.stringInfo();
  9023. var info = stringInfo[0];
  9024. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  9025. }
  9026. this.insertSymbol(declaration.id, {
  9027. id: declaration.id,
  9028. type: declaration.type
  9029. });
  9030. } else if (!declaration.type.isCompatible(resultType) && !_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting || !declaration.type.isCompatible(resultType) && _util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(declaration.type, resultType)) {
  9031. var _stringInfo = declaration.type.stringInfo();
  9032. var _info = _stringInfo[0];
  9033. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  9034. } else {
  9035. this.insertSymbol(declaration.id, {
  9036. id: declaration.id,
  9037. type: declaration.type
  9038. });
  9039. }
  9040. }
  9041. }
  9042. }, {
  9043. key: "evaluateExpressionType",
  9044. value: function evaluateExpressionType(expression) {
  9045. if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["UnaryApp"]) {
  9046. var op = expression.op;
  9047. var resultType = this.evaluateExpressionType(expression.left);
  9048. return Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_6__["resultTypeAfterUnaryOp"])(op, resultType);
  9049. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["InfixApp"]) {
  9050. var _op = expression.op;
  9051. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  9052. var resultTypeRight = this.evaluateExpressionType(expression.right);
  9053. return Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_6__["resultTypeAfterInfixOp"])(_op, resultTypeLeft, resultTypeRight);
  9054. } else if (expression instanceof _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_5__["Literal"]) {
  9055. return this.evaluateLiteralType(expression);
  9056. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["FunctionCall"]) {
  9057. if (expression.isMainCall) {
  9058. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName(), expression.sourceInfo);
  9059. }
  9060. var fun = this.findFunction(expression.id);
  9061. if (fun === null) {
  9062. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_missing_full(expression.id, expression.sourceInfo);
  9063. }
  9064. if (fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID)) {
  9065. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].void_in_expression_full(expression.id, expression.sourceInfo);
  9066. }
  9067. this.assertParameters(fun, expression.actualParameters);
  9068. return fun.returnType;
  9069. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayAccess"]) {
  9070. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  9071. if (arrayTypeInfo === null) {
  9072. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(expression.id, expression.sourceInfo);
  9073. }
  9074. if (!(arrayTypeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9075. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_array_access_full(expression.id, expression.sourceInfo);
  9076. }
  9077. var lineType = this.evaluateExpressionType(expression.line);
  9078. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9079. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(expression.sourceInfo);
  9080. }
  9081. if (expression.column !== null) {
  9082. if (arrayTypeInfo.columns === null) {
  9083. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_matrix_access_full(expression.id, expression.sourceInfo);
  9084. }
  9085. var columnType = this.evaluateExpressionType(expression.column);
  9086. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9087. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(expression.sourceInfo);
  9088. }
  9089. }
  9090. var arrType = arrayTypeInfo.type;
  9091. if (expression.column !== null) {
  9092. // indexing matrix
  9093. return arrType.innerType;
  9094. } else {
  9095. if (arrayTypeInfo.columns === null) {
  9096. return arrType.innerType;
  9097. }
  9098. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](arrType.innerType, 1);
  9099. }
  9100. }
  9101. }
  9102. }, {
  9103. key: "evaluateLiteralType",
  9104. value: function evaluateLiteralType(literal) {
  9105. if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["IntLiteral"]) {
  9106. return literal.type;
  9107. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["RealLiteral"]) {
  9108. return literal.type;
  9109. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["StringLiteral"]) {
  9110. return literal.type;
  9111. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["BoolLiteral"]) {
  9112. return literal.type;
  9113. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["VariableLiteral"]) {
  9114. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  9115. if (typeInfo === null) {
  9116. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(literal.id, literal.sourceInfo);
  9117. }
  9118. if (typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9119. return typeInfo.type;
  9120. }
  9121. return typeInfo.type;
  9122. } else {
  9123. console.warn("Evaluating type only for an array literal...");
  9124. var last = null;
  9125. if (literal.value.length === 1) {
  9126. last = this.evaluateExpressionType(literal.value[0]);
  9127. } else {
  9128. for (var i = 0; i < literal.value.length; i++) {
  9129. var e = this.evaluateExpressionType(literal.value[i]);
  9130. if (last === null) {
  9131. last = e;
  9132. } else if (!last.isCompatible(e)) {
  9133. var strInfo = last.stringInfo();
  9134. var info = strInfo[0];
  9135. var strExp = literal.toString();
  9136. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  9137. }
  9138. }
  9139. }
  9140. if (last instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9141. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](last.innerType, last.dimensions + 1);
  9142. }
  9143. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](last, 1);
  9144. }
  9145. }
  9146. }, {
  9147. key: "evaluateArrayLiteral",
  9148. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  9149. /* if (literal instanceof ArrayLiteral) {
  9150. const dimType = this.evaluateExpressionType(lines);
  9151. if (!dimType.isCompatible(Types.INTEGER)) {
  9152. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  9153. }
  9154. if ((lines instanceof IntLiteral)) {
  9155. if (!lines.value.eq(literal.value.length)) {
  9156. if(type.dimensions > 1) {
  9157. throw ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  9158. } else {
  9159. throw ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  9160. }
  9161. } else if (lines.value.isNeg()) {
  9162. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  9163. }
  9164. }
  9165. if (columns === null) {
  9166. // it's a vector...
  9167. literal.value.reduce((last, next) => {
  9168. const eType = this.evaluateExpressionType(next);
  9169. if (!last.canAccept(eType)) {
  9170. const strInfo = last.stringInfo();
  9171. const info = strInfo[0];
  9172. const strExp = literal.toString();
  9173. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9174. }
  9175. return last;
  9176. }, type);
  9177. return true;
  9178. } else {
  9179. const dimType = this.evaluateExpressionType(columns);
  9180. if (!dimType.isCompatible(Types.INTEGER)) {
  9181. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  9182. }
  9183. if ((columns instanceof IntLiteral)) {
  9184. const columnValue = literal.value[0].value.length;
  9185. if (!columns.value.eq(columnValue)) {
  9186. if(type.dimensions > 1) {
  9187. throw ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.value.toNumber(), literal.sourceInfo)
  9188. } else {
  9189. throw ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  9190. }
  9191. } else if (columns.value.isNeg()) {
  9192. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  9193. }
  9194. for (let i = 0; i < columns; i++) {
  9195. const anotherArray = literal.value[i];
  9196. this.evaluateArrayLiteral(id, columns, null, type, anotherArray)
  9197. }
  9198. }
  9199. }
  9200. } else {
  9201. const resultType = this.evaluateExpressionType(literal);
  9202. if (!(resultType instanceof CompoundType)) {
  9203. const strInfo = type.stringInfo();
  9204. const info = strInfo[0];
  9205. const strExp = literal.toString();
  9206. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9207. }
  9208. if (!type.isCompatible(resultType)) {
  9209. const strInfo = type.stringInfo();
  9210. const info = strInfo[0];
  9211. const strExp = literal.toString();
  9212. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9213. }
  9214. return true;
  9215. } */
  9216. return true;
  9217. }
  9218. }, {
  9219. key: "assertFunction",
  9220. value: function assertFunction(fun) {
  9221. var _this = this;
  9222. this.pushMap();
  9223. this.currentFunction = fun;
  9224. fun.formalParameters.forEach(function (formalParam) {
  9225. if (formalParam.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9226. if (formalParam.type.dimensions > 1) {
  9227. _this.insertSymbol(formalParam.id, {
  9228. id: formalParam.id,
  9229. lines: -1,
  9230. columns: -1,
  9231. type: formalParam.type
  9232. });
  9233. } else {
  9234. _this.insertSymbol(formalParam.id, {
  9235. id: formalParam.id,
  9236. lines: -1,
  9237. columns: null,
  9238. type: formalParam.type
  9239. });
  9240. }
  9241. } else {
  9242. _this.insertSymbol(formalParam.id, {
  9243. id: formalParam.id,
  9244. type: formalParam.type
  9245. });
  9246. }
  9247. });
  9248. this.assertDeclarations(fun.variablesDeclarations);
  9249. var optional = fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID);
  9250. var valid = this.assertReturn(fun, optional);
  9251. if (!valid) {
  9252. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_no_return(fun.name);
  9253. }
  9254. this.popMap();
  9255. }
  9256. }, {
  9257. key: "assertReturn",
  9258. value: function assertReturn(fun, optional) {
  9259. var _this2 = this;
  9260. return fun.commands.reduce(function (last, next) {
  9261. return _this2.checkCommand(fun.returnType, next, optional) || last;
  9262. }, optional);
  9263. }
  9264. }, {
  9265. key: "checkCommand",
  9266. value: function checkCommand(type, cmd, optional) {
  9267. if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["While"]) {
  9268. var resultType = this.evaluateExpressionType(cmd.expression);
  9269. if (!resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9270. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo);
  9271. }
  9272. this.checkCommands(type, cmd.commands, optional);
  9273. return false;
  9274. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["For"]) {
  9275. this.checkCommand(type, cmd.assignment, optional);
  9276. var _resultType = this.evaluateExpressionType(cmd.condition);
  9277. if (!_resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9278. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].for_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9279. }
  9280. this.checkCommand(type, cmd.increment, optional);
  9281. this.checkCommands(type, cmd.commands, optional);
  9282. return false;
  9283. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Switch"]) {
  9284. var sType = this.evaluateExpressionType(cmd.expression);
  9285. var result = optional;
  9286. var hasDefault = false;
  9287. for (var i = 0; i < cmd.cases.length; i++) {
  9288. var aCase = cmd.cases[i];
  9289. if (aCase.expression !== null) {
  9290. var caseType = this.evaluateExpressionType(aCase.expression);
  9291. if (!sType.isCompatible(caseType)) {
  9292. var strInfo = sType.stringInfo();
  9293. var info = strInfo[0];
  9294. var strExp = aCase.expression.toString();
  9295. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  9296. }
  9297. } else {
  9298. hasDefault = true;
  9299. }
  9300. result = result && this.checkCommands(type, aCase.commands, result);
  9301. }
  9302. return result && hasDefault;
  9303. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["ArrayIndexAssign"]) {
  9304. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9305. if (typeInfo === null) {
  9306. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9307. }
  9308. if (!(typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9309. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_array_access_full(cmd.id, cmd.sourceInfo);
  9310. }
  9311. var exp = cmd.expression;
  9312. var lineExp = cmd.line;
  9313. var lineType = this.evaluateExpressionType(lineExp);
  9314. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9315. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo);
  9316. }
  9317. var columnExp = cmd.column;
  9318. if (typeInfo.columns === null && columnExp !== null) {
  9319. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  9320. } else if (columnExp !== null) {
  9321. var columnType = this.evaluateExpressionType(columnExp);
  9322. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9323. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo);
  9324. }
  9325. } // exp can be a arrayLiteral, a single value exp or an array access
  9326. if (exp instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayLiteral"]) {
  9327. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  9328. } else {// cannot properly evaluate since type system is poorly constructed
  9329. }
  9330. return optional;
  9331. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Assign"]) {
  9332. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9333. if (_typeInfo === null) {
  9334. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9335. }
  9336. var _exp = cmd.expression;
  9337. if (_exp instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayLiteral"]) {
  9338. if (!(_typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9339. var stringInfo = _typeInfo.type.stringInfo();
  9340. var _info2 = stringInfo[0];
  9341. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info2.type, _info2.dim, cmd.sourceInfo);
  9342. }
  9343. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  9344. } else {
  9345. var _resultType2 = this.evaluateExpressionType(_exp);
  9346. if (!_resultType2.isCompatible(_typeInfo.type) && !_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting || !_resultType2.isCompatible(_typeInfo.type) && _util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(_typeInfo.type, _resultType2)) {
  9347. var _stringInfo2 = _typeInfo.type.stringInfo();
  9348. var _info3 = _stringInfo2[0];
  9349. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  9350. }
  9351. }
  9352. return optional;
  9353. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Break"]) {
  9354. return optional;
  9355. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["IfThenElse"]) {
  9356. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  9357. if (!_resultType3.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9358. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9359. }
  9360. if (cmd.ifFalse instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["IfThenElse"]) {
  9361. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  9362. } else {
  9363. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  9364. }
  9365. } else if (cmd instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["FunctionCall"]) {
  9366. var fun = null;
  9367. if (cmd.isMainCall) {
  9368. fun = this.getMainFunction();
  9369. } else {
  9370. fun = this.findFunction(cmd.id);
  9371. }
  9372. if (fun === null) {
  9373. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_missing_full(cmd.id, cmd.sourceInfo);
  9374. }
  9375. this.assertParameters(fun, cmd.actualParameters);
  9376. return optional;
  9377. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Return"]) {
  9378. var funcName = this.currentFunction.isMain ? _definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName() : this.currentFunction.name;
  9379. if (cmd.expression === null && !type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID)) {
  9380. var _stringInfo3 = type.stringInfo();
  9381. var _info4 = _stringInfo3[0];
  9382. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_void_return_full(funcName, _info4.type, _info4.dim, cmd.sourceInfo);
  9383. } else if (cmd.expression !== null) {
  9384. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  9385. if (!type.isCompatible(_resultType4)) {
  9386. var _stringInfo4 = type.stringInfo();
  9387. var _info5 = _stringInfo4[0];
  9388. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_return_type_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  9389. } else {
  9390. return true;
  9391. }
  9392. } else {
  9393. return true;
  9394. }
  9395. }
  9396. }
  9397. }, {
  9398. key: "checkCommands",
  9399. value: function checkCommands(type, cmds, optional) {
  9400. var _this3 = this;
  9401. return cmds.reduce(function (last, next) {
  9402. return _this3.checkCommand(type, next, optional) || last;
  9403. }, optional);
  9404. }
  9405. }, {
  9406. key: "assertParameters",
  9407. value: function assertParameters(fun, actualParametersList) {
  9408. if (fun.formalParameters.length !== actualParametersList.length) {
  9409. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9410. }
  9411. for (var i = 0; i < actualParametersList.length; i++) {
  9412. var param = actualParametersList[i];
  9413. var formalParam = fun.formalParameters[i];
  9414. var id = formalParam.id;
  9415. if (formalParam.byRef) {
  9416. if (!(param instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["VariableLiteral"] || param instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayAccess"])) {
  9417. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9418. }
  9419. }
  9420. var resultType = this.evaluateExpressionType(param);
  9421. if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"] && formalParam.type instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9422. var shared = 0;
  9423. for (var j = 0; j < resultType.types.length; j++) {
  9424. var element = resultType.types[j];
  9425. if (formalParam.type.types.indexOf(element) !== -1) {
  9426. shared++;
  9427. }
  9428. }
  9429. if (shared <= 0) {
  9430. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9431. if (resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9432. if (formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9433. continue;
  9434. }
  9435. }
  9436. }
  9437. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9438. }
  9439. } else if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9440. if (!resultType.isCompatible(formalParam.type)) {
  9441. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9442. if (resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9443. if (formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9444. continue;
  9445. }
  9446. }
  9447. }
  9448. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9449. }
  9450. } else if (!formalParam.type.isCompatible(resultType)) {
  9451. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9452. if (_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(formalParam.type, resultType)) {
  9453. continue;
  9454. }
  9455. }
  9456. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9457. }
  9458. }
  9459. }
  9460. }]);
  9461. return SemanticAnalyser;
  9462. }();
  9463. /***/ }),
  9464. /***/ "./js/processor/store/store.js":
  9465. /*!*************************************!*\
  9466. !*** ./js/processor/store/store.js ***!
  9467. \*************************************/
  9468. /*! exports provided: Store */
  9469. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9470. "use strict";
  9471. __webpack_require__.r(__webpack_exports__);
  9472. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Store", function() { return Store; });
  9473. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9474. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  9475. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9476. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9477. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9478. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9479. var Store =
  9480. /*#__PURE__*/
  9481. function () {
  9482. _createClass(Store, null, [{
  9483. key: "canImplicitTypeCast",
  9484. value: function canImplicitTypeCast(castType, sourceType) {
  9485. if (castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) || castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL)) {
  9486. if (sourceType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) || sourceType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL)) {
  9487. return true;
  9488. }
  9489. }
  9490. return false;
  9491. }
  9492. }, {
  9493. key: "doImplicitCasting",
  9494. value: function doImplicitCasting(castType, stoObj) {
  9495. if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
  9496. throw new Error("!!!Critical error: attempted to type cast invalid types");
  9497. }
  9498. if (castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER)) {
  9499. return new _storeObject__WEBPACK_IMPORTED_MODULE_2__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, stoObj.value.trunc());
  9500. } else {
  9501. return new _storeObject__WEBPACK_IMPORTED_MODULE_2__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, stoObj.value);
  9502. }
  9503. }
  9504. }]);
  9505. function Store(name) {
  9506. _classCallCheck(this, Store);
  9507. this.name = name;
  9508. this.store = {};
  9509. this.nextStore = null;
  9510. this.mode = _modes__WEBPACK_IMPORTED_MODULE_0__["Modes"].RUN;
  9511. }
  9512. _createClass(Store, [{
  9513. key: "extendStore",
  9514. value: function extendStore(nextStore) {
  9515. this.nextStore = nextStore;
  9516. }
  9517. }, {
  9518. key: "applyStore",
  9519. value: function applyStore(id) {
  9520. if (!this.store[id]) {
  9521. if (this.nextStore !== null) {
  9522. return this.nextStore.applyStore(id);
  9523. } else {
  9524. throw new Error("Variable ".concat(id, " not found."));
  9525. }
  9526. }
  9527. var val = this.store[id];
  9528. if (val.isRef) {
  9529. return val.getRefObj();
  9530. }
  9531. return this.store[id];
  9532. }
  9533. }, {
  9534. key: "updateStore",
  9535. value: function updateStore(id, stoObj) {
  9536. if (!this.store[id]) {
  9537. if (this.nextStore !== null) {
  9538. this.nextStore.updateStore(id, stoObj);
  9539. return this;
  9540. } else {
  9541. // TODO: better error message
  9542. throw new Error("Variable ".concat(id, " not found."));
  9543. }
  9544. } else {
  9545. var oldObj = this.store[id];
  9546. if (oldObj.readOnly) {
  9547. // TODO: better error message
  9548. throw new Error("Cannot change value of a read only variable: " + id);
  9549. }
  9550. if (oldObj.isRef) {
  9551. oldObj.updateRef(stoObj);
  9552. return this;
  9553. } else if (oldObj.isCompatible(stoObj)) {
  9554. stoObj.setID(id);
  9555. this.store[id] = Object.freeze(stoObj);
  9556. return this;
  9557. } else {
  9558. var oldType = oldObj.type;
  9559. var stoType = stoObj.type; // TODO: better error message
  9560. throw new Error("".concat(oldType, " is not compatible with type ").concat(stoType, " given"));
  9561. }
  9562. }
  9563. } //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9564. // and no the StoreObject refferenced by it
  9565. // updateStoreRef(id, stoObjAddress) {...}
  9566. }, {
  9567. key: "insertStore",
  9568. value: function insertStore(id, stoObj) {
  9569. if (this.store[id]) {
  9570. // TODO: better error message
  9571. throw new Error("".concat(id, " is already defined"));
  9572. }
  9573. stoObj.setID(id);
  9574. this.store[id] = Object.freeze(stoObj);
  9575. return this;
  9576. }
  9577. }]);
  9578. return Store;
  9579. }();
  9580. /***/ }),
  9581. /***/ "./js/processor/store/storeObject.js":
  9582. /*!*******************************************!*\
  9583. !*** ./js/processor/store/storeObject.js ***!
  9584. \*******************************************/
  9585. /*! exports provided: StoreObject */
  9586. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9587. "use strict";
  9588. __webpack_require__.r(__webpack_exports__);
  9589. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObject", function() { return StoreObject; });
  9590. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9591. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_0__);
  9592. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9593. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9594. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9595. var StoreObject =
  9596. /*#__PURE__*/
  9597. function () {
  9598. function StoreObject(type, value) {
  9599. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9600. _classCallCheck(this, StoreObject);
  9601. this._type = type;
  9602. this._value = value;
  9603. this._readOnly = readOnly;
  9604. this._id = null;
  9605. }
  9606. _createClass(StoreObject, [{
  9607. key: "setID",
  9608. value: function setID(id) {
  9609. this._id = id;
  9610. }
  9611. }, {
  9612. key: "isCompatible",
  9613. value: function isCompatible(another) {
  9614. if (another instanceof StoreObject) {
  9615. return this.type.isCompatible(another.type);
  9616. }
  9617. return false;
  9618. }
  9619. }, {
  9620. key: "id",
  9621. get: function get() {
  9622. return this._id;
  9623. }
  9624. }, {
  9625. key: "inStore",
  9626. get: function get() {
  9627. return this.id !== null;
  9628. }
  9629. }, {
  9630. key: "type",
  9631. get: function get() {
  9632. return this._type;
  9633. }
  9634. }, {
  9635. key: "value",
  9636. get: function get() {
  9637. return this._value;
  9638. }
  9639. }, {
  9640. key: "number",
  9641. get: function get() {
  9642. if (this._value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_0___default.a) {
  9643. return this._value.toNumber();
  9644. } else {
  9645. return null;
  9646. }
  9647. }
  9648. }, {
  9649. key: "readOnly",
  9650. get: function get() {
  9651. return this._readOnly;
  9652. },
  9653. set: function set(value) {
  9654. this._readOnly = value;
  9655. }
  9656. }]);
  9657. return StoreObject;
  9658. }();
  9659. /***/ }),
  9660. /***/ "./js/processor/store/storeObjectArray.js":
  9661. /*!************************************************!*\
  9662. !*** ./js/processor/store/storeObjectArray.js ***!
  9663. \************************************************/
  9664. /*! exports provided: StoreObjectArray */
  9665. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9666. "use strict";
  9667. __webpack_require__.r(__webpack_exports__);
  9668. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArray", function() { return StoreObjectArray; });
  9669. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9670. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9671. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9672. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9673. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9674. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  9675. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  9676. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9677. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9678. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9679. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9680. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9681. var StoreObjectArray =
  9682. /*#__PURE__*/
  9683. function (_StoreObject) {
  9684. _inherits(StoreObjectArray, _StoreObject);
  9685. _createClass(StoreObjectArray, null, [{
  9686. key: "WRONG_LINE_NUMBER",
  9687. get: function get() {
  9688. return 1;
  9689. }
  9690. }, {
  9691. key: "WRONG_TYPE",
  9692. get: function get() {
  9693. return 2;
  9694. }
  9695. }, {
  9696. key: "WRONG_COLUMN_NUMBER",
  9697. get: function get() {
  9698. return 3;
  9699. }
  9700. }]);
  9701. function StoreObjectArray(type, lines, columns) {
  9702. var _this;
  9703. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9704. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9705. _classCallCheck(this, StoreObjectArray);
  9706. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArray).call(this, type, value, readOnly));
  9707. _this._lines = lines;
  9708. _this._columns = columns;
  9709. return _this;
  9710. }
  9711. _createClass(StoreObjectArray, [{
  9712. key: "isCompatible",
  9713. value: function isCompatible(another) {
  9714. if (another instanceof _storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]) {
  9715. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9716. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9717. return _get(_getPrototypeOf(StoreObjectArray.prototype), "isCompatible", this).call(this, another);
  9718. }
  9719. }
  9720. }
  9721. return false;
  9722. }
  9723. }, {
  9724. key: "lines",
  9725. get: function get() {
  9726. return this._lines;
  9727. }
  9728. }, {
  9729. key: "columns",
  9730. get: function get() {
  9731. return this._columns;
  9732. }
  9733. }, {
  9734. key: "isVector",
  9735. get: function get() {
  9736. return this.type.dimensions === 1;
  9737. }
  9738. }, {
  9739. key: "isValid",
  9740. get: function get() {
  9741. var _this2 = this;
  9742. if (this.value !== null) {
  9743. if (this.isVector) {
  9744. if (this.value.length !== this.lines) {
  9745. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9746. ;
  9747. }
  9748. var mustBeNull = this.value.find(function (v) {
  9749. return !_this2.type.canAccept(v.type);
  9750. });
  9751. if (!!mustBeNull) {
  9752. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];
  9753. ;
  9754. }
  9755. }
  9756. return [];
  9757. } else {
  9758. if (this.lines !== this.value.length) {
  9759. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9760. }
  9761. for (var i = 0; i < this.lines; i++) {
  9762. for (var j = 0; j < this.columns; j++) {
  9763. var arr = this.value[i];
  9764. if (arr.length !== this.columns) {
  9765. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9766. }
  9767. var _mustBeNull = arr.find(function (v) {
  9768. return !_this2.type.canAccept(v.type);
  9769. });
  9770. if (!!_mustBeNull) {
  9771. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9772. }
  9773. }
  9774. }
  9775. return [];
  9776. }
  9777. }
  9778. }]);
  9779. return StoreObjectArray;
  9780. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9781. /***/ }),
  9782. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9783. /*!*******************************************************!*\
  9784. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9785. \*******************************************************/
  9786. /*! exports provided: StoreObjectArrayAddress */
  9787. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9788. "use strict";
  9789. __webpack_require__.r(__webpack_exports__);
  9790. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArrayAddress", function() { return StoreObjectArrayAddress; });
  9791. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9792. /* harmony import */ var _storeObjectArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9793. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9794. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9795. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9796. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9797. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9798. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9799. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9800. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9801. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9802. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9803. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9804. var StoreObjectArrayAddress =
  9805. /*#__PURE__*/
  9806. function (_StoreObject) {
  9807. _inherits(StoreObjectArrayAddress, _StoreObject);
  9808. function StoreObjectArrayAddress(refID, line, column, store) {
  9809. var _this;
  9810. _classCallCheck(this, StoreObjectArrayAddress);
  9811. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArrayAddress).call(this, null, null, false));
  9812. _this.refID = refID;
  9813. _this.store = store;
  9814. _this.line = line;
  9815. _this.column = column;
  9816. return _this;
  9817. }
  9818. _createClass(StoreObjectArrayAddress, [{
  9819. key: "getArrayObject",
  9820. value: function getArrayObject() {
  9821. return this.store.applyStore(this.refID);
  9822. }
  9823. }, {
  9824. key: "updateArrayObject",
  9825. value: function updateArrayObject(stoObj) {
  9826. var anArray = this.getArrayObject();
  9827. var newArray = Object.assign(new _storeObjectArray__WEBPACK_IMPORTED_MODULE_1__["StoreObjectArray"](null, null, null), anArray);
  9828. if (!stoObj.type.isCompatible(this.type)) {
  9829. throw new Error("Invalid operation: cannot assign the value given to ".concat(this.refID));
  9830. } else if (this.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"] && this.type.canAccept(stoObj.type)) {
  9831. throw new Error("Invalid operation: cannot assign the value given to ".concat(this.refID));
  9832. }
  9833. if (this.column !== null) {
  9834. newArray.value[this.line].value[this.column] = stoObj;
  9835. return newArray;
  9836. } else {
  9837. newArray.value[this.line] = stoObj;
  9838. return newArray;
  9839. }
  9840. }
  9841. }, {
  9842. key: "isCompatible",
  9843. value: function isCompatible(another) {
  9844. if (this.type.isCompatible(another.type)) {
  9845. if (another.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"]) {
  9846. return this.lines === another.lines && this.columns === another.columns;
  9847. } else {
  9848. this.refValue.isCompatible(another);
  9849. }
  9850. }
  9851. }
  9852. }, {
  9853. key: "isRef",
  9854. get: function get() {
  9855. return false;
  9856. }
  9857. }, {
  9858. key: "inStore",
  9859. get: function get() {
  9860. return true;
  9861. }
  9862. }, {
  9863. key: "refValue",
  9864. get: function get() {
  9865. var refLine = this.store.applyStore(this.refID).value[this.line];
  9866. if (!refLine) {
  9867. if (this.getArrayObject().isVector) {
  9868. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9869. } else {
  9870. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9871. }
  9872. }
  9873. if (this.column !== null) {
  9874. var refColumn = refLine.value[this.column];
  9875. if (!refColumn) {
  9876. if (this.getArrayObject().isVector) {
  9877. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].vector_not_matrix(this.refID);
  9878. } else {
  9879. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9880. }
  9881. }
  9882. return refColumn;
  9883. }
  9884. return refLine;
  9885. }
  9886. }, {
  9887. key: "value",
  9888. get: function get() {
  9889. return this.refValue.value;
  9890. }
  9891. }, {
  9892. key: "type",
  9893. get: function get() {
  9894. return this.refValue.type;
  9895. }
  9896. }, {
  9897. key: "lines",
  9898. get: function get() {
  9899. if (!(this.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"])) {
  9900. return null;
  9901. }
  9902. return this.refValue.value.length;
  9903. }
  9904. }, {
  9905. key: "columns",
  9906. get: function get() {
  9907. switch (this.type.dimensions) {
  9908. case 2:
  9909. return this.refValue.value[0].value.length;
  9910. default:
  9911. return null;
  9912. }
  9913. }
  9914. }]);
  9915. return StoreObjectArrayAddress;
  9916. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9917. /***/ }),
  9918. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9919. /*!**********************************************************!*\
  9920. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9921. \**********************************************************/
  9922. /*! exports provided: StoreObjectArrayAddressRef */
  9923. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9924. "use strict";
  9925. __webpack_require__.r(__webpack_exports__);
  9926. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArrayAddressRef", function() { return StoreObjectArrayAddressRef; });
  9927. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9928. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9929. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_1__);
  9930. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9931. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9932. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  9933. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9934. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9935. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9936. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9937. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9938. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9939. var StoreObjectArrayAddressRef =
  9940. /*#__PURE__*/
  9941. function (_StoreObject) {
  9942. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9943. function StoreObjectArrayAddressRef(address) {
  9944. var _this;
  9945. _classCallCheck(this, StoreObjectArrayAddressRef);
  9946. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArrayAddressRef).call(this, null, null, false));
  9947. _this.address = address;
  9948. return _this;
  9949. }
  9950. _createClass(StoreObjectArrayAddressRef, [{
  9951. key: "getRefObj",
  9952. value: function getRefObj() {
  9953. return this.address.refValue;
  9954. }
  9955. }, {
  9956. key: "updateRef",
  9957. value: function updateRef(stoObj) {
  9958. var newArray = this.address.updateArrayObject(stoObj);
  9959. this.address.store.updateStore(this.address.refID, newArray);
  9960. }
  9961. }, {
  9962. key: "isCompatible",
  9963. value: function isCompatible(another) {
  9964. return this.address.isCompatible(another);
  9965. }
  9966. }, {
  9967. key: "isRef",
  9968. get: function get() {
  9969. return true;
  9970. }
  9971. }, {
  9972. key: "type",
  9973. get: function get() {
  9974. return this.address.type;
  9975. }
  9976. }, {
  9977. key: "value",
  9978. get: function get() {
  9979. return this.address.value;
  9980. }
  9981. }, {
  9982. key: "number",
  9983. get: function get() {
  9984. if (this.value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_1___default.a) {
  9985. return this.value.toNumber();
  9986. } else {
  9987. return null;
  9988. }
  9989. }
  9990. }]);
  9991. return StoreObjectArrayAddressRef;
  9992. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9993. /***/ }),
  9994. /***/ "./js/processor/store/storeObjectRef.js":
  9995. /*!**********************************************!*\
  9996. !*** ./js/processor/store/storeObjectRef.js ***!
  9997. \**********************************************/
  9998. /*! exports provided: StoreObjectRef */
  9999. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10000. "use strict";
  10001. __webpack_require__.r(__webpack_exports__);
  10002. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectRef", function() { return StoreObjectRef; });
  10003. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  10004. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  10005. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_1__);
  10006. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  10007. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  10008. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  10009. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  10010. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  10011. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  10012. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  10013. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  10014. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  10015. var StoreObjectRef =
  10016. /*#__PURE__*/
  10017. function (_StoreObject) {
  10018. _inherits(StoreObjectRef, _StoreObject);
  10019. function StoreObjectRef(refID, store) {
  10020. var _this;
  10021. _classCallCheck(this, StoreObjectRef);
  10022. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectRef).call(this, null, null, false));
  10023. _this.refID = refID;
  10024. _this.store = store;
  10025. return _this;
  10026. }
  10027. _createClass(StoreObjectRef, [{
  10028. key: "getRefObj",
  10029. value: function getRefObj() {
  10030. return this.store.applyStore(this.refID);
  10031. }
  10032. }, {
  10033. key: "updateRef",
  10034. value: function updateRef(stoObj) {
  10035. this.store.updateStore(this.refID, stoObj);
  10036. }
  10037. }, {
  10038. key: "isCompatible",
  10039. value: function isCompatible(another) {
  10040. return this.store.applyStore(this.refID).isCompatible(another);
  10041. }
  10042. }, {
  10043. key: "isRef",
  10044. get: function get() {
  10045. return true;
  10046. }
  10047. }, {
  10048. key: "type",
  10049. get: function get() {
  10050. return this.store.applyStore(this.refID).type;
  10051. }
  10052. }, {
  10053. key: "value",
  10054. get: function get() {
  10055. return this.store.applyStore(this.refID).value;
  10056. }
  10057. }, {
  10058. key: "number",
  10059. get: function get() {
  10060. if (this.value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_1___default.a) {
  10061. return this.value.toNumber();
  10062. } else {
  10063. return null;
  10064. }
  10065. }
  10066. }]);
  10067. return StoreObjectRef;
  10068. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  10069. /***/ }),
  10070. /***/ "./js/runner.js":
  10071. /*!**********************!*\
  10072. !*** ./js/runner.js ***!
  10073. \**********************/
  10074. /*! exports provided: runner */
  10075. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10076. "use strict";
  10077. __webpack_require__.r(__webpack_exports__);
  10078. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runner", function() { return runner; });
  10079. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  10080. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  10081. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  10082. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  10083. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  10084. function runner() {
  10085. var ivprogLexer = _services_languageService__WEBPACK_IMPORTED_MODULE_3__["LanguageService"].getCurrentLexer(); // const lexer = new ivprogLexer(new InputStream(input));
  10086. // const stream = new CommonTokenStream(lexer);
  10087. // stream.fill();
  10088. // let i = 1;
  10089. // let token = null;
  10090. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  10091. // console.log(`${token.type}-${token.text}`);
  10092. // console.log('\n')
  10093. // i++;
  10094. // }
  10095. // const anaSin = new IVProgParser(input, ivprogLexer);
  10096. var editor = new JsonEditor('#json-renderer', {});
  10097. var domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_2__["DOMConsole"]("#console"); // proc.interpretAST().then( sto => {
  10098. // console.log(sto.applyStore('a'));
  10099. // }).catch(e => console.log(e));
  10100. try {
  10101. $('#btn').click(function () {
  10102. var input = $('#input').val();
  10103. var analiser = new _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__["IVProgParser"](input, ivprogLexer);
  10104. try {
  10105. var data = analiser.parseTree();
  10106. var semAna = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_4__["SemanticAnalyser"](data);
  10107. var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__["IVProgProcessor"](semAna.analyseTree());
  10108. proc.registerInput(domConsole);
  10109. domConsole.clear();
  10110. proc.registerOutput(domConsole);
  10111. proc.interpretAST().then(function (sto) {
  10112. return editor.load(sto.store);
  10113. }).catch(function (e) {
  10114. alert(e);
  10115. console.log(e);
  10116. });
  10117. } catch (error) {
  10118. alert(error);
  10119. console.log(error);
  10120. }
  10121. });
  10122. } catch (a) {
  10123. console.log(a);
  10124. }
  10125. }
  10126. /***/ }),
  10127. /***/ "./js/semantic/semantic.min.js":
  10128. /*!*************************************!*\
  10129. !*** ./js/semantic/semantic.min.js ***!
  10130. \*************************************/
  10131. /*! no static exports found */
  10132. /***/ (function(module, exports) {
  10133. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  10134. /*
  10135. * # Semantic UI - 2.3.3
  10136. * https://github.com/Semantic-Org/Semantic-UI
  10137. * http://www.semantic-ui.com/
  10138. *
  10139. * Copyright 2014 Contributors
  10140. * Released under the MIT license
  10141. * http://opensource.org/licenses/MIT
  10142. *
  10143. */
  10144. !function (e, t, n, i) {
  10145. e.site = e.fn.site = function (o) {
  10146. var a,
  10147. r,
  10148. s = new Date().getTime(),
  10149. l = [],
  10150. c = arguments[0],
  10151. u = "string" == typeof c,
  10152. d = [].slice.call(arguments, 1),
  10153. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  10154. m = f.namespace,
  10155. g = f.error,
  10156. p = "module-" + m,
  10157. h = e(n),
  10158. v = this,
  10159. b = h.data(p);
  10160. return a = {
  10161. initialize: function initialize() {
  10162. a.instantiate();
  10163. },
  10164. instantiate: function instantiate() {
  10165. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  10166. },
  10167. normalize: function normalize() {
  10168. a.fix.console(), a.fix.requestAnimationFrame();
  10169. },
  10170. fix: {
  10171. console: function (_console) {
  10172. function console() {
  10173. return _console.apply(this, arguments);
  10174. }
  10175. console.toString = function () {
  10176. return _console.toString();
  10177. };
  10178. return console;
  10179. }(function () {
  10180. a.debug("Normalizing window.console"), console !== i && console.log !== i || (a.verbose("Console not available, normalizing events"), a.disable.console()), void 0 !== console.group && void 0 !== console.groupEnd && void 0 !== console.groupCollapsed || (a.verbose("Console group not available, normalizing events"), t.console.group = function () {}, t.console.groupEnd = function () {}, t.console.groupCollapsed = function () {}), void 0 === console.markTimeline && (a.verbose("Mark timeline not available, normalizing events"), t.console.markTimeline = function () {});
  10181. }),
  10182. consoleClear: function consoleClear() {
  10183. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  10184. },
  10185. requestAnimationFrame: function requestAnimationFrame() {
  10186. a.debug("Normalizing requestAnimationFrame"), t.requestAnimationFrame === i && (a.debug("RequestAnimationFrame not available, normalizing event"), t.requestAnimationFrame = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  10187. setTimeout(e, 0);
  10188. });
  10189. }
  10190. },
  10191. moduleExists: function moduleExists(t) {
  10192. return e.fn[t] !== i && e.fn[t].settings !== i;
  10193. },
  10194. enabled: {
  10195. modules: function modules(t) {
  10196. var n = [];
  10197. return t = t || f.modules, e.each(t, function (e, t) {
  10198. a.moduleExists(t) && n.push(t);
  10199. }), n;
  10200. }
  10201. },
  10202. disabled: {
  10203. modules: function modules(t) {
  10204. var n = [];
  10205. return t = t || f.modules, e.each(t, function (e, t) {
  10206. a.moduleExists(t) || n.push(t);
  10207. }), n;
  10208. }
  10209. },
  10210. change: {
  10211. setting: function setting(t, n, o, r) {
  10212. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  10213. var s,
  10214. l = !a.moduleExists(o) || e.fn[o].settings.namespace || !1;
  10215. a.moduleExists(o) && (a.verbose("Changing default setting", t, n, o), e.fn[o].settings[t] = n, r && l && (s = e(":data(module-" + l + ")")).length > 0 && (a.verbose("Modifying existing settings", s), s[o]("setting", t, n)));
  10216. });
  10217. },
  10218. settings: function settings(t, n, o) {
  10219. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  10220. var r;
  10221. a.moduleExists(i) && (a.verbose("Changing default setting", t, i), e.extend(!0, e.fn[i].settings, t), o && m && (r = e(":data(module-" + m + ")")).length > 0 && (a.verbose("Modifying existing settings", r), r[i]("setting", t)));
  10222. });
  10223. }
  10224. },
  10225. enable: {
  10226. console: function console() {
  10227. a.console(!0);
  10228. },
  10229. debug: function debug(e, t) {
  10230. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  10231. },
  10232. verbose: function verbose(e, t) {
  10233. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  10234. }
  10235. },
  10236. disable: {
  10237. console: function console() {
  10238. a.console(!1);
  10239. },
  10240. debug: function debug(e, t) {
  10241. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  10242. },
  10243. verbose: function verbose(e, t) {
  10244. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  10245. }
  10246. },
  10247. console: function console(e) {
  10248. if (e) {
  10249. if (b.cache.console === i) return void a.error(g.console);
  10250. a.debug("Restoring console function"), t.console = b.cache.console;
  10251. } else a.debug("Disabling console function"), b.cache.console = t.console, t.console = {
  10252. clear: function clear() {},
  10253. error: function error() {},
  10254. group: function group() {},
  10255. groupCollapsed: function groupCollapsed() {},
  10256. groupEnd: function groupEnd() {},
  10257. info: function info() {},
  10258. log: function log() {},
  10259. markTimeline: function markTimeline() {},
  10260. warn: function warn() {}
  10261. };
  10262. },
  10263. destroy: function destroy() {
  10264. a.verbose("Destroying previous site for", h), h.removeData(p);
  10265. },
  10266. cache: {},
  10267. setting: function setting(t, n) {
  10268. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  10269. if (n === i) return f[t];
  10270. f[t] = n;
  10271. }
  10272. },
  10273. internal: function internal(t, n) {
  10274. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  10275. if (n === i) return a[t];
  10276. a[t] = n;
  10277. }
  10278. },
  10279. debug: function debug() {
  10280. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  10281. },
  10282. verbose: function verbose() {
  10283. f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  10284. },
  10285. error: function error() {
  10286. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  10287. },
  10288. performance: {
  10289. log: function log(e) {
  10290. var t, n;
  10291. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  10292. Element: v,
  10293. Name: e[0],
  10294. Arguments: [].slice.call(e, 1) || "",
  10295. "Execution Time": n
  10296. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  10297. },
  10298. display: function display() {
  10299. var t = f.name + ":",
  10300. n = 0;
  10301. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  10302. n += t["Execution Time"];
  10303. }), t += " " + n + "ms", (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  10304. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10305. }), console.groupEnd()), l = [];
  10306. }
  10307. },
  10308. invoke: function invoke(t, n, o) {
  10309. var s,
  10310. l,
  10311. c,
  10312. u = b;
  10313. return n = n || d, o = v || o, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  10314. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  10315. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  10316. if (u[r] !== i) return l = u[r], !1;
  10317. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);
  10318. u = u[o];
  10319. }
  10320. })), e.isFunction(l) ? c = l.apply(o, n) : l !== i && (c = l), e.isArray(r) ? r.push(c) : r !== i ? r = [r, c] : c !== i && (r = c), l;
  10321. }
  10322. }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  10323. }, e.site.settings = {
  10324. name: "Site",
  10325. namespace: "site",
  10326. error: {
  10327. console: "Console cannot be restored, most likely it was overwritten outside of module",
  10328. method: "The method you called is not defined."
  10329. },
  10330. debug: !1,
  10331. verbose: !1,
  10332. performance: !0,
  10333. modules: ["accordion", "api", "checkbox", "dimmer", "dropdown", "embed", "form", "modal", "nag", "popup", "rating", "shape", "sidebar", "state", "sticky", "tab", "transition", "visit", "visibility"],
  10334. siteNamespace: "site",
  10335. namespaceStub: {
  10336. cache: {},
  10337. config: {},
  10338. sections: {},
  10339. section: {},
  10340. utilities: {}
  10341. }
  10342. }, e.extend(e.expr[":"], {
  10343. data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {
  10344. return function (n) {
  10345. return !!e.data(n, t);
  10346. };
  10347. }) : function (t, n, i) {
  10348. return !!e.data(t, i[3]);
  10349. }
  10350. });
  10351. }(jQuery, window, document), function (e, t, n, i) {
  10352. "use strict";
  10353. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  10354. var o,
  10355. a = e(this),
  10356. r = a.selector || "",
  10357. s = new Date().getTime(),
  10358. l = [],
  10359. c = arguments[0],
  10360. u = arguments[1],
  10361. d = "string" == typeof c,
  10362. f = [].slice.call(arguments, 1);
  10363. return a.each(function () {
  10364. var m,
  10365. g,
  10366. p,
  10367. h,
  10368. v,
  10369. b,
  10370. y,
  10371. x,
  10372. C,
  10373. w,
  10374. S,
  10375. k,
  10376. T,
  10377. A,
  10378. R,
  10379. P,
  10380. E = e(this),
  10381. F = this,
  10382. O = [],
  10383. D = !1;
  10384. (P = {
  10385. initialize: function initialize() {
  10386. P.get.settings(), d ? (R === i && P.instantiate(), P.invoke(c)) : (R !== i && R.invoke("destroy"), P.verbose("Initializing form validation", E, v), P.bindEvents(), P.set.defaults(), P.instantiate());
  10387. },
  10388. instantiate: function instantiate() {
  10389. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  10390. },
  10391. destroy: function destroy() {
  10392. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  10393. },
  10394. refresh: function refresh() {
  10395. P.verbose("Refreshing selector cache"), m = E.find(x.field), g = E.find(x.group), p = E.find(x.message), E.find(x.prompt), h = E.find(x.submit), E.find(x.clear), E.find(x.reset);
  10396. },
  10397. submit: function submit() {
  10398. P.verbose("Submitting form", E), E.submit();
  10399. },
  10400. attachEvents: function attachEvents(t, n) {
  10401. n = n || "submit", e(t).on("click" + A, function (e) {
  10402. P[n](), e.preventDefault();
  10403. });
  10404. },
  10405. bindEvents: function bindEvents() {
  10406. P.verbose("Attaching form events"), E.on("submit" + A, P.validate.form).on("blur" + A, x.field, P.event.field.blur).on("click" + A, x.submit, P.submit).on("click" + A, x.reset, P.reset).on("click" + A, x.clear, P.clear), v.keyboardShortcuts && E.on("keydown" + A, x.field, P.event.field.keydown), m.each(function () {
  10407. var t = e(this),
  10408. n = t.prop("type"),
  10409. i = P.get.changeEvent(n, t);
  10410. e(this).on(i + A, P.event.field.change);
  10411. });
  10412. },
  10413. clear: function clear() {
  10414. m.each(function () {
  10415. var t = e(this),
  10416. n = t.parent(),
  10417. i = t.closest(g),
  10418. o = i.find(x.prompt),
  10419. a = t.data(y.defaultValue) || "",
  10420. r = n.is(x.uiCheckbox),
  10421. s = n.is(x.uiDropdown);
  10422. i.hasClass(C.error) && (P.verbose("Resetting error on field", i), i.removeClass(C.error), o.remove()), s ? (P.verbose("Resetting dropdown value", n, a), n.dropdown("clear")) : r ? t.prop("checked", !1) : (P.verbose("Resetting field value", t, a), t.val(""));
  10423. });
  10424. },
  10425. reset: function reset() {
  10426. m.each(function () {
  10427. var t = e(this),
  10428. n = t.parent(),
  10429. o = t.closest(g),
  10430. a = o.find(x.prompt),
  10431. r = t.data(y.defaultValue),
  10432. s = n.is(x.uiCheckbox),
  10433. l = n.is(x.uiDropdown),
  10434. c = o.hasClass(C.error);
  10435. r !== i && (c && (P.verbose("Resetting error on field", o), o.removeClass(C.error), a.remove()), l ? (P.verbose("Resetting dropdown value", n, r), n.dropdown("restore defaults")) : s ? (P.verbose("Resetting checkbox value", n, r), t.prop("checked", r)) : (P.verbose("Resetting field value", t, r), t.val(r)));
  10436. });
  10437. },
  10438. determine: {
  10439. isValid: function isValid() {
  10440. var t = !0;
  10441. return e.each(b, function (e, n) {
  10442. P.validate.field(n, e, !0) || (t = !1);
  10443. }), t;
  10444. }
  10445. },
  10446. is: {
  10447. bracketedRule: function bracketedRule(e) {
  10448. return e.type && e.type.match(v.regExp.bracket);
  10449. },
  10450. shorthandFields: function shorthandFields(e) {
  10451. var t = e[Object.keys(e)[0]];
  10452. return P.is.shorthandRules(t);
  10453. },
  10454. shorthandRules: function shorthandRules(t) {
  10455. return "string" == typeof t || e.isArray(t);
  10456. },
  10457. empty: function empty(e) {
  10458. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  10459. },
  10460. blank: function blank(t) {
  10461. return "" === e.trim(t.val());
  10462. },
  10463. valid: function valid(t) {
  10464. var n = !0;
  10465. return t ? (P.verbose("Checking if field is valid", t), P.validate.field(b[t], t, !1)) : (P.verbose("Checking if form is valid"), e.each(b, function (e, t) {
  10466. P.is.valid(e) || (n = !1);
  10467. }), n);
  10468. }
  10469. },
  10470. removeEvents: function removeEvents() {
  10471. E.off(A), m.off(A), h.off(A), m.off(A);
  10472. },
  10473. event: {
  10474. field: {
  10475. keydown: function keydown(t) {
  10476. var n = e(this),
  10477. i = t.which,
  10478. o = n.is(x.input),
  10479. a = n.is(x.checkbox),
  10480. r = n.closest(x.uiDropdown).length > 0,
  10481. s = 13;
  10482. i == 27 && (P.verbose("Escape key pressed blurring field"), n.blur()), t.ctrlKey || i != s || !o || r || a || (D || (n.one("keyup" + A, P.event.field.keyup), P.submit(), P.debug("Enter pressed on input submitting form")), D = !0);
  10483. },
  10484. keyup: function keyup() {
  10485. D = !1;
  10486. },
  10487. blur: function blur(t) {
  10488. var n = e(this),
  10489. i = n.closest(g),
  10490. o = P.get.validation(n);
  10491. i.hasClass(C.error) ? (P.debug("Revalidating field", n, o), o && P.validate.field(o)) : "blur" == v.on && o && P.validate.field(o);
  10492. },
  10493. change: function change(t) {
  10494. var n = e(this),
  10495. i = n.closest(g),
  10496. o = P.get.validation(n);
  10497. o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  10498. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  10499. }, v.delay));
  10500. }
  10501. }
  10502. },
  10503. get: {
  10504. ancillaryValue: function ancillaryValue(e) {
  10505. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  10506. },
  10507. ruleName: function ruleName(e) {
  10508. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  10509. },
  10510. changeEvent: function changeEvent(e, t) {
  10511. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  10512. },
  10513. inputEvent: function inputEvent() {
  10514. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  10515. },
  10516. fieldsFromShorthand: function fieldsFromShorthand(t) {
  10517. var n = {};
  10518. return e.each(t, function (t, i) {
  10519. "string" == typeof i && (i = [i]), n[t] = {
  10520. rules: []
  10521. }, e.each(i, function (e, i) {
  10522. n[t].rules.push({
  10523. type: i
  10524. });
  10525. });
  10526. }), n;
  10527. },
  10528. prompt: function prompt(t, n) {
  10529. var i,
  10530. o,
  10531. a = P.get.ruleName(t),
  10532. r = P.get.ancillaryValue(t),
  10533. s = P.get.field(n.identifier),
  10534. l = s.val(),
  10535. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  10536. u = -1 !== c.search("{value}"),
  10537. d = -1 !== c.search("{name}");
  10538. return u && (c = c.replace("{value}", s.val())), d && (o = 1 == (i = s.closest(x.group).find("label").eq(0)).length ? i.text() : s.prop("placeholder") || v.text.unspecifiedField, c = c.replace("{name}", o)), c = (c = c.replace("{identifier}", n.identifier)).replace("{ruleValue}", r), t.prompt || P.verbose("Using default validation prompt for type", c, a), c;
  10539. },
  10540. settings: function settings() {
  10541. if (e.isPlainObject(t)) {
  10542. var n = Object.keys(t);
  10543. n.length > 0 && t[n[0]].identifier !== i && t[n[0]].rules !== i ? (v = e.extend(!0, {}, e.fn.form.settings, u), b = e.extend({}, e.fn.form.settings.defaults, t), P.error(v.error.oldSyntax, F), P.verbose("Extending settings from legacy parameters", b, v)) : (t.fields && P.is.shorthandFields(t.fields) && (t.fields = P.get.fieldsFromShorthand(t.fields)), v = e.extend(!0, {}, e.fn.form.settings, t), b = e.extend({}, e.fn.form.settings.defaults, v.fields), P.verbose("Extending settings", b, v));
  10544. } else v = e.fn.form.settings, b = e.fn.form.settings.defaults, P.verbose("Using default form validation", b, v);
  10545. k = v.namespace, y = v.metadata, x = v.selector, C = v.className, w = v.regExp, S = v.error, T = "module-" + k, A = "." + k, R = E.data(T), P.refresh();
  10546. },
  10547. field: function field(t) {
  10548. return P.verbose("Finding field with identifier", t), t = P.escape.string(t), m.filter("#" + t).length > 0 ? m.filter("#" + t) : m.filter('[name="' + t + '"]').length > 0 ? m.filter('[name="' + t + '"]') : m.filter('[name="' + t + '[]"]').length > 0 ? m.filter('[name="' + t + '[]"]') : m.filter("[data-" + y.validate + '="' + t + '"]').length > 0 ? m.filter("[data-" + y.validate + '="' + t + '"]') : e("<input/>");
  10549. },
  10550. fields: function fields(t) {
  10551. var n = e();
  10552. return e.each(t, function (e, t) {
  10553. n = n.add(P.get.field(t));
  10554. }), n;
  10555. },
  10556. validation: function validation(t) {
  10557. var n, i;
  10558. return !!b && (e.each(b, function (e, o) {
  10559. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  10560. }), n || !1);
  10561. },
  10562. value: function value(e) {
  10563. var t = [];
  10564. return t.push(e), P.get.values.call(F, t)[e];
  10565. },
  10566. values: function values(t) {
  10567. var n = {};
  10568. return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  10569. var a = e(o),
  10570. r = (a.prop("type"), a.prop("name")),
  10571. s = a.val(),
  10572. l = a.is(x.checkbox),
  10573. c = a.is(x.radio),
  10574. u = -1 !== r.indexOf("[]"),
  10575. d = !!l && a.is(":checked");
  10576. r && (u ? (r = r.replace("[]", ""), n[r] || (n[r] = []), l ? d ? n[r].push(s || !0) : n[r].push(!1) : n[r].push(s)) : c ? n[r] !== i && 0 != n[r] || (n[r] = !!d && (s || !0)) : n[r] = l ? !!d && (s || !0) : s);
  10577. }), n;
  10578. }
  10579. },
  10580. has: {
  10581. field: function field(e) {
  10582. return P.verbose("Checking for existence of a field with identifier", e), "string" != typeof (e = P.escape.string(e)) && P.error(S.identifier, e), m.filter("#" + e).length > 0 || m.filter('[name="' + e + '"]').length > 0 || m.filter("[data-" + y.validate + '="' + e + '"]').length > 0;
  10583. }
  10584. },
  10585. escape: {
  10586. string: function string(e) {
  10587. return (e = String(e)).replace(w.escape, "\\$&");
  10588. }
  10589. },
  10590. add: {
  10591. rule: function rule(e, t) {
  10592. P.add.field(e, t);
  10593. },
  10594. field: function field(t, n) {
  10595. var i = {};
  10596. P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = {
  10597. rules: []
  10598. }, e.each(n, function (e, n) {
  10599. i[t].rules.push({
  10600. type: n
  10601. });
  10602. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  10603. },
  10604. fields: function fields(t) {
  10605. var n;
  10606. n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  10607. },
  10608. prompt: function prompt(t, n) {
  10609. var o = P.get.field(t).closest(g),
  10610. a = o.children(x.prompt),
  10611. r = 0 !== a.length;
  10612. n = "string" == typeof n ? [n] : n, P.verbose("Adding field error state", t), o.addClass(C.error), v.inline && (r || (a = v.templates.prompt(n)).appendTo(o), a.html(n[0]), r ? P.verbose("Inline errors are disabled, no inline error added", t) : v.transition && e.fn.transition !== i && E.transition("is supported") ? (P.verbose("Displaying error with css transition", v.transition), a.transition(v.transition + " in", v.duration)) : (P.verbose("Displaying error with fallback javascript animation"), a.fadeIn(v.duration)));
  10613. },
  10614. errors: function errors(e) {
  10615. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  10616. }
  10617. },
  10618. remove: {
  10619. rule: function rule(t, n) {
  10620. var o = e.isArray(n) ? n : [n];
  10621. if (n == i) return P.debug("Removed all rules"), void (b[t].rules = []);
  10622. b[t] != i && e.isArray(b[t].rules) && e.each(b[t].rules, function (e, n) {
  10623. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  10624. });
  10625. },
  10626. field: function field(t) {
  10627. var n = e.isArray(t) ? t : [t];
  10628. e.each(n, function (e, t) {
  10629. P.remove.rule(t);
  10630. });
  10631. },
  10632. rules: function rules(t, n) {
  10633. e.isArray(t) ? e.each(fields, function (e, t) {
  10634. P.remove.rule(t, n);
  10635. }) : P.remove.rule(t, n);
  10636. },
  10637. fields: function fields(e) {
  10638. P.remove.field(e);
  10639. },
  10640. prompt: function prompt(t) {
  10641. var n = P.get.field(t).closest(g),
  10642. o = n.children(x.prompt);
  10643. n.removeClass(C.error), v.inline && o.is(":visible") && (P.verbose("Removing prompt for field", t), v.transition && e.fn.transition !== i && E.transition("is supported") ? o.transition(v.transition + " out", v.duration, function () {
  10644. o.remove();
  10645. }) : o.fadeOut(v.duration, function () {
  10646. o.remove();
  10647. }));
  10648. }
  10649. },
  10650. set: {
  10651. success: function success() {
  10652. E.removeClass(C.error).addClass(C.success);
  10653. },
  10654. defaults: function defaults() {
  10655. m.each(function () {
  10656. var t = e(this),
  10657. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();
  10658. t.data(y.defaultValue, n);
  10659. });
  10660. },
  10661. error: function error() {
  10662. E.removeClass(C.success).addClass(C.error);
  10663. },
  10664. value: function value(e, t) {
  10665. var n = {};
  10666. return n[e] = t, P.set.values.call(F, n);
  10667. },
  10668. values: function values(t) {
  10669. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10670. var i,
  10671. o = P.get.field(t),
  10672. a = o.parent(),
  10673. r = e.isArray(n),
  10674. s = a.is(x.uiCheckbox),
  10675. l = a.is(x.uiDropdown),
  10676. c = o.is(x.radio) && s;
  10677. o.length > 0 && (r && s ? (P.verbose("Selecting multiple", n, o), a.checkbox("uncheck"), e.each(n, function (e, t) {
  10678. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10679. })) : c ? (P.verbose("Selecting radio value", n, o), o.filter('[value="' + n + '"]').parent(x.uiCheckbox).checkbox("check")) : s ? (P.verbose("Setting checkbox value", n, a), !0 === n ? a.checkbox("check") : a.checkbox("uncheck")) : l ? (P.verbose("Setting dropdown value", n, a), a.dropdown("set selected", n)) : (P.verbose("Setting field value", n, o), o.val(n)));
  10680. });
  10681. }
  10682. },
  10683. validate: {
  10684. form: function form(e, t) {
  10685. var n = P.get.values();
  10686. if (D) return !1;
  10687. if (O = [], P.determine.isValid()) {
  10688. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10689. } else if (P.debug("Form has errors"), P.set.error(), v.inline || P.add.errors(O), E.data("moduleApi") !== i && e.stopImmediatePropagation(), !0 !== t) return v.onFailure.call(F, O, n);
  10690. },
  10691. field: function field(t, n, o) {
  10692. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);
  10693. var a = t.identifier || n,
  10694. r = P.get.field(a),
  10695. s = !!t.depends && P.get.field(t.depends),
  10696. l = !0,
  10697. c = [];
  10698. return t.identifier || (P.debug("Using field name as identifier", a), t.identifier = a), r.prop("disabled") ? (P.debug("Field is disabled. Skipping", a), l = !0) : t.optional && P.is.blank(r) ? (P.debug("Field is optional and blank. Skipping", a), l = !0) : t.depends && P.is.empty(s) ? (P.debug("Field depends on another value that is not present or empty. Skipping", s), l = !0) : t.rules !== i && e.each(t.rules, function (e, n) {
  10699. P.has.field(a) && !P.validate.rule(t, n) && (P.debug("Field is invalid", a, n.type), c.push(P.get.prompt(n, t)), l = !1);
  10700. }), l ? (o && (P.remove.prompt(a, c), v.onValid.call(r)), !0) : (o && (O = O.concat(c), P.add.prompt(a, c), v.onInvalid.call(r, c)), !1);
  10701. },
  10702. rule: function rule(t, n) {
  10703. var o = P.get.field(t.identifier),
  10704. a = (n.type, o.val()),
  10705. r = P.get.ancillaryValue(n),
  10706. s = P.get.ruleName(n),
  10707. l = v.rules[s];
  10708. if (e.isFunction(l)) return a = a === i || "" === a || null === a ? "" : e.trim(a + ""), l.call(o, a, r);
  10709. P.error(S.noRule, s);
  10710. }
  10711. },
  10712. setting: function setting(t, n) {
  10713. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10714. if (n === i) return v[t];
  10715. v[t] = n;
  10716. }
  10717. },
  10718. internal: function internal(t, n) {
  10719. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10720. if (n === i) return P[t];
  10721. P[t] = n;
  10722. }
  10723. },
  10724. debug: function debug() {
  10725. !v.silent && v.debug && (v.performance ? P.performance.log(arguments) : (P.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), P.debug.apply(console, arguments)));
  10726. },
  10727. verbose: function verbose() {
  10728. !v.silent && v.verbose && v.debug && (v.performance ? P.performance.log(arguments) : (P.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), P.verbose.apply(console, arguments)));
  10729. },
  10730. error: function error() {
  10731. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10732. },
  10733. performance: {
  10734. log: function log(e) {
  10735. var t, n;
  10736. v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  10737. Name: e[0],
  10738. Arguments: [].slice.call(e, 1) || "",
  10739. Element: F,
  10740. "Execution Time": n
  10741. })), clearTimeout(P.performance.timer), P.performance.timer = setTimeout(P.performance.display, 500);
  10742. },
  10743. display: function display() {
  10744. var t = v.name + ":",
  10745. n = 0;
  10746. s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10747. n += t["Execution Time"];
  10748. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  10749. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10750. }), console.groupEnd()), l = [];
  10751. }
  10752. },
  10753. invoke: function invoke(t, n, a) {
  10754. var r,
  10755. s,
  10756. l,
  10757. c = R;
  10758. return n = n || f, a = F || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  10759. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  10760. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10761. if (c[a] !== i) return s = c[a], !1;
  10762. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  10763. c = c[o];
  10764. }
  10765. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  10766. }
  10767. }).initialize();
  10768. }), o !== i ? o : this;
  10769. }, e.fn.form.settings = {
  10770. name: "Form",
  10771. namespace: "form",
  10772. debug: !1,
  10773. verbose: !1,
  10774. performance: !0,
  10775. fields: !1,
  10776. keyboardShortcuts: !0,
  10777. on: "submit",
  10778. inline: !1,
  10779. delay: 200,
  10780. revalidate: !0,
  10781. transition: "scale",
  10782. duration: 200,
  10783. onValid: function onValid() {},
  10784. onInvalid: function onInvalid() {},
  10785. onSuccess: function onSuccess() {
  10786. return !0;
  10787. },
  10788. onFailure: function onFailure() {
  10789. return !1;
  10790. },
  10791. metadata: {
  10792. defaultValue: "default",
  10793. validate: "validate"
  10794. },
  10795. regExp: {
  10796. htmlID: /^[a-zA-Z][\w:.-]*$/g,
  10797. bracket: /\[(.*)\]/i,
  10798. decimal: /^\d+\.?\d*$/,
  10799. email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,
  10800. escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
  10801. flags: /^\/(.*)\/(.*)?/,
  10802. integer: /^\-?\d+$/,
  10803. number: /^\-?\d*(\.\d+)?$/,
  10804. url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i
  10805. },
  10806. text: {
  10807. unspecifiedRule: "Please enter a valid value",
  10808. unspecifiedField: "This field"
  10809. },
  10810. prompt: {
  10811. empty: "{name} must have a value",
  10812. checked: "{name} must be checked",
  10813. email: "{name} must be a valid e-mail",
  10814. url: "{name} must be a valid url",
  10815. regExp: "{name} is not formatted correctly",
  10816. integer: "{name} must be an integer",
  10817. decimal: "{name} must be a decimal number",
  10818. number: "{name} must be set to a number",
  10819. is: '{name} must be "{ruleValue}"',
  10820. isExactly: '{name} must be exactly "{ruleValue}"',
  10821. not: '{name} cannot be set to "{ruleValue}"',
  10822. notExactly: '{name} cannot be set to exactly "{ruleValue}"',
  10823. contain: '{name} must contain "{ruleValue}"',
  10824. containExactly: '{name} must contain exactly "{ruleValue}"',
  10825. doesntContain: '{name} cannot contain "{ruleValue}"',
  10826. doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"',
  10827. minLength: "{name} must be at least {ruleValue} characters",
  10828. length: "{name} must be at least {ruleValue} characters",
  10829. exactLength: "{name} must be exactly {ruleValue} characters",
  10830. maxLength: "{name} cannot be longer than {ruleValue} characters",
  10831. match: "{name} must match {ruleValue} field",
  10832. different: "{name} must have a different value than {ruleValue} field",
  10833. creditCard: "{name} must be a valid credit card number",
  10834. minCount: "{name} must have at least {ruleValue} choices",
  10835. exactCount: "{name} must have exactly {ruleValue} choices",
  10836. maxCount: "{name} must have {ruleValue} or less choices"
  10837. },
  10838. selector: {
  10839. checkbox: 'input[type="checkbox"], input[type="radio"]',
  10840. clear: ".clear",
  10841. field: "input, textarea, select",
  10842. group: ".field",
  10843. input: "input",
  10844. message: ".error.message",
  10845. prompt: ".prompt.label",
  10846. radio: 'input[type="radio"]',
  10847. reset: '.reset:not([type="reset"])',
  10848. submit: '.submit:not([type="submit"])',
  10849. uiCheckbox: ".ui.checkbox",
  10850. uiDropdown: ".ui.dropdown"
  10851. },
  10852. className: {
  10853. error: "error",
  10854. label: "ui prompt label",
  10855. pressed: "down",
  10856. success: "success"
  10857. },
  10858. error: {
  10859. identifier: "You must specify a string identifier for each field",
  10860. method: "The method you called is not defined.",
  10861. noRule: "There is no rule matching the one you specified",
  10862. oldSyntax: "Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically."
  10863. },
  10864. templates: {
  10865. error: function error(t) {
  10866. var n = '<ul class="list">';
  10867. return e.each(t, function (e, t) {
  10868. n += "<li>" + t + "</li>";
  10869. }), e(n += "</ul>");
  10870. },
  10871. prompt: function prompt(t) {
  10872. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10873. }
  10874. },
  10875. rules: {
  10876. empty: function empty(t) {
  10877. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10878. },
  10879. checked: function checked() {
  10880. return e(this).filter(":checked").length > 0;
  10881. },
  10882. email: function email(t) {
  10883. return e.fn.form.settings.regExp.email.test(t);
  10884. },
  10885. url: function url(t) {
  10886. return e.fn.form.settings.regExp.url.test(t);
  10887. },
  10888. regExp: function regExp(t, n) {
  10889. if (n instanceof RegExp) return t.match(n);
  10890. var i,
  10891. o = n.match(e.fn.form.settings.regExp.flags);
  10892. return o && (n = o.length >= 2 ? o[1] : n, i = o.length >= 3 ? o[2] : ""), t.match(new RegExp(n, i));
  10893. },
  10894. integer: function integer(t, n) {
  10895. var o,
  10896. a,
  10897. r,
  10898. s = e.fn.form.settings.regExp.integer;
  10899. return n && -1 === ["", ".."].indexOf(n) && (-1 == n.indexOf("..") ? s.test(n) && (o = a = n - 0) : (r = n.split("..", 2), s.test(r[0]) && (o = r[0] - 0), s.test(r[1]) && (a = r[1] - 0))), s.test(t) && (o === i || t >= o) && (a === i || t <= a);
  10900. },
  10901. decimal: function decimal(t) {
  10902. return e.fn.form.settings.regExp.decimal.test(t);
  10903. },
  10904. number: function number(t) {
  10905. return e.fn.form.settings.regExp.number.test(t);
  10906. },
  10907. is: function is(e, t) {
  10908. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10909. },
  10910. isExactly: function isExactly(e, t) {
  10911. return e == t;
  10912. },
  10913. not: function not(e, t) {
  10914. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10915. },
  10916. notExactly: function notExactly(e, t) {
  10917. return e != t;
  10918. },
  10919. contains: function contains(t, n) {
  10920. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10921. },
  10922. containsExactly: function containsExactly(t, n) {
  10923. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10924. },
  10925. doesntContain: function doesntContain(t, n) {
  10926. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10927. },
  10928. doesntContainExactly: function doesntContainExactly(t, n) {
  10929. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10930. },
  10931. minLength: function minLength(e, t) {
  10932. return e !== i && e.length >= t;
  10933. },
  10934. length: function length(e, t) {
  10935. return e !== i && e.length >= t;
  10936. },
  10937. exactLength: function exactLength(e, t) {
  10938. return e !== i && e.length == t;
  10939. },
  10940. maxLength: function maxLength(e, t) {
  10941. return e !== i && e.length <= t;
  10942. },
  10943. match: function match(t, n) {
  10944. var o;
  10945. e(this);
  10946. return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() == o.toString();
  10947. },
  10948. different: function different(t, n) {
  10949. var o;
  10950. e(this);
  10951. return e('[data-validate="' + n + '"]').length > 0 ? o = e('[data-validate="' + n + '"]').val() : e("#" + n).length > 0 ? o = e("#" + n).val() : e('[name="' + n + '"]').length > 0 ? o = e('[name="' + n + '"]').val() : e('[name="' + n + '[]"]').length > 0 && (o = e('[name="' + n + '[]"]')), o !== i && t.toString() !== o.toString();
  10952. },
  10953. creditCard: function creditCard(t, n) {
  10954. var i,
  10955. o,
  10956. a = {
  10957. visa: {
  10958. pattern: /^4/,
  10959. length: [16]
  10960. },
  10961. amex: {
  10962. pattern: /^3[47]/,
  10963. length: [15]
  10964. },
  10965. mastercard: {
  10966. pattern: /^5[1-5]/,
  10967. length: [16]
  10968. },
  10969. discover: {
  10970. pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,
  10971. length: [16]
  10972. },
  10973. unionPay: {
  10974. pattern: /^(62|88)/,
  10975. length: [16, 17, 18, 19]
  10976. },
  10977. jcb: {
  10978. pattern: /^35(2[89]|[3-8][0-9])/,
  10979. length: [16]
  10980. },
  10981. maestro: {
  10982. pattern: /^(5018|5020|5038|6304|6759|676[1-3])/,
  10983. length: [12, 13, 14, 15, 16, 17, 18, 19]
  10984. },
  10985. dinersClub: {
  10986. pattern: /^(30[0-5]|^36)/,
  10987. length: [14]
  10988. },
  10989. laser: {
  10990. pattern: /^(6304|670[69]|6771)/,
  10991. length: [16, 17, 18, 19]
  10992. },
  10993. visaElectron: {
  10994. pattern: /^(4026|417500|4508|4844|491(3|7))/,
  10995. length: [16]
  10996. }
  10997. },
  10998. r = {},
  10999. s = !1,
  11000. l = "string" == typeof n && n.split(",");
  11001. if ("string" == typeof t && 0 !== t.length) {
  11002. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  11003. (o = a[i]) && (r = {
  11004. length: -1 !== e.inArray(t.length, o.length),
  11005. pattern: -1 !== t.search(o.pattern)
  11006. }).length && r.pattern && (s = !0);
  11007. }), !s)) return !1;
  11008. if ((i = {
  11009. number: -1 !== e.inArray(t.length, a.unionPay.length),
  11010. pattern: -1 !== t.search(a.unionPay.pattern)
  11011. }).number && i.pattern) return !0;
  11012. for (var c = t.length, u = 0, d = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]], f = 0; c--;) {
  11013. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  11014. }
  11015. return f % 10 == 0 && f > 0;
  11016. }
  11017. },
  11018. minCount: function minCount(e, t) {
  11019. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  11020. },
  11021. exactCount: function exactCount(e, t) {
  11022. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  11023. },
  11024. maxCount: function maxCount(e, t) {
  11025. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  11026. }
  11027. }
  11028. };
  11029. }(jQuery, window, document), function (e, t, n, i) {
  11030. "use strict";
  11031. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  11032. var o,
  11033. a = e(this),
  11034. r = new Date().getTime(),
  11035. s = [],
  11036. l = arguments[0],
  11037. c = "string" == typeof l,
  11038. u = [].slice.call(arguments, 1);
  11039. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  11040. return a.each(function () {
  11041. var d,
  11042. f,
  11043. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  11044. g = m.className,
  11045. p = m.namespace,
  11046. h = m.selector,
  11047. v = m.error,
  11048. b = "." + p,
  11049. y = "module-" + p,
  11050. x = a.selector || "",
  11051. C = e(this),
  11052. w = C.find(h.title),
  11053. S = C.find(h.content),
  11054. k = this,
  11055. T = C.data(y);
  11056. f = {
  11057. initialize: function initialize() {
  11058. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  11059. },
  11060. instantiate: function instantiate() {
  11061. T = f, C.data(y, f);
  11062. },
  11063. destroy: function destroy() {
  11064. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  11065. },
  11066. refresh: function refresh() {
  11067. w = C.find(h.title), S = C.find(h.content);
  11068. },
  11069. observeChanges: function observeChanges() {
  11070. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  11071. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  11072. })).observe(k, {
  11073. childList: !0,
  11074. subtree: !0
  11075. }), f.debug("Setting up mutation observer", d));
  11076. },
  11077. bind: {
  11078. events: function events() {
  11079. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  11080. }
  11081. },
  11082. event: {
  11083. click: function click() {
  11084. f.toggle.call(this);
  11085. }
  11086. },
  11087. toggle: function toggle(t) {
  11088. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11089. o = n.next(S),
  11090. a = o.hasClass(g.animating),
  11091. r = o.hasClass(g.active),
  11092. s = r && !a,
  11093. l = !r && a;
  11094. f.debug("Toggling visibility of content", n), s || l ? m.collapsible ? f.close.call(n) : f.debug("Cannot close accordion content collapsing is disabled") : f.open.call(n);
  11095. },
  11096. open: function open(t) {
  11097. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11098. o = n.next(S),
  11099. a = o.hasClass(g.animating);
  11100. o.hasClass(g.active) || a ? f.debug("Accordion already open, skipping", o) : (f.debug("Opening accordion content", n), m.onOpening.call(o), m.onChanging.call(o), m.exclusive && f.closeOthers.call(n), n.addClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({
  11101. animation: "fade in",
  11102. queue: !1,
  11103. useFailSafe: !0,
  11104. debug: m.debug,
  11105. verbose: m.verbose,
  11106. duration: m.duration
  11107. }) : o.children().stop(!0, !0).animate({
  11108. opacity: 1
  11109. }, m.duration, f.resetOpacity)), o.slideDown(m.duration, m.easing, function () {
  11110. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  11111. }));
  11112. },
  11113. close: function close(t) {
  11114. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11115. o = n.next(S),
  11116. a = o.hasClass(g.animating),
  11117. r = o.hasClass(g.active);
  11118. !r && !(!r && a) || r && a || (f.debug("Closing accordion content", o), m.onClosing.call(o), m.onChanging.call(o), n.removeClass(g.active), o.stop(!0, !0).addClass(g.animating), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? o.children().transition({
  11119. animation: "fade out",
  11120. queue: !1,
  11121. useFailSafe: !0,
  11122. debug: m.debug,
  11123. verbose: m.verbose,
  11124. duration: m.duration
  11125. }) : o.children().stop(!0, !0).animate({
  11126. opacity: 0
  11127. }, m.duration, f.resetOpacity)), o.slideUp(m.duration, m.easing, function () {
  11128. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  11129. }));
  11130. },
  11131. closeOthers: function closeOthers(t) {
  11132. var n,
  11133. o,
  11134. a,
  11135. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  11136. s = r.parents(h.content).prev(h.title),
  11137. l = r.closest(h.accordion),
  11138. c = h.title + "." + g.active + ":visible",
  11139. u = h.content + "." + g.active + ":visible";
  11140. m.closeNested ? a = (n = l.find(c).not(s)).next(S) : (n = l.find(c).not(s), o = l.find(u).find(c).not(s), a = (n = n.not(o)).next(S)), n.length > 0 && (f.debug("Exclusive enabled, closing other content", n), n.removeClass(g.active), a.removeClass(g.animating).stop(!0, !0), m.animateChildren && (e.fn.transition !== i && C.transition("is supported") ? a.children().transition({
  11141. animation: "fade out",
  11142. useFailSafe: !0,
  11143. debug: m.debug,
  11144. verbose: m.verbose,
  11145. duration: m.duration
  11146. }) : a.children().stop(!0, !0).animate({
  11147. opacity: 0
  11148. }, m.duration, f.resetOpacity)), a.slideUp(m.duration, m.easing, function () {
  11149. e(this).removeClass(g.active), f.reset.display.call(this);
  11150. }));
  11151. },
  11152. reset: {
  11153. display: function display() {
  11154. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  11155. },
  11156. opacity: function opacity() {
  11157. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  11158. }
  11159. },
  11160. setting: function setting(t, n) {
  11161. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11162. if (n === i) return m[t];
  11163. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11164. }
  11165. },
  11166. internal: function internal(t, n) {
  11167. if (f.debug("Changing internal", t, n), n === i) return f[t];
  11168. e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  11169. },
  11170. debug: function debug() {
  11171. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  11172. },
  11173. verbose: function verbose() {
  11174. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  11175. },
  11176. error: function error() {
  11177. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11178. },
  11179. performance: {
  11180. log: function log(e) {
  11181. var t, n;
  11182. m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  11183. Name: e[0],
  11184. Arguments: [].slice.call(e, 1) || "",
  11185. Element: k,
  11186. "Execution Time": n
  11187. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  11188. },
  11189. display: function display() {
  11190. var t = m.name + ":",
  11191. n = 0;
  11192. r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  11193. n += t["Execution Time"];
  11194. }), t += " " + n + "ms", x && (t += " '" + x + "'"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  11195. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11196. }), console.groupEnd()), s = [];
  11197. }
  11198. },
  11199. invoke: function invoke(t, n, a) {
  11200. var r,
  11201. s,
  11202. l,
  11203. c = T;
  11204. return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11205. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11206. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11207. if (c[a] !== i) return s = c[a], !1;
  11208. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);
  11209. c = c[o];
  11210. }
  11211. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  11212. }
  11213. }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  11214. }), o !== i ? o : this;
  11215. }, e.fn.accordion.settings = {
  11216. name: "Accordion",
  11217. namespace: "accordion",
  11218. silent: !1,
  11219. debug: !1,
  11220. verbose: !1,
  11221. performance: !0,
  11222. on: "click",
  11223. observeChanges: !0,
  11224. exclusive: !0,
  11225. collapsible: !0,
  11226. closeNested: !1,
  11227. animateChildren: !0,
  11228. duration: 350,
  11229. easing: "easeOutQuad",
  11230. onOpening: function onOpening() {},
  11231. onClosing: function onClosing() {},
  11232. onChanging: function onChanging() {},
  11233. onOpen: function onOpen() {},
  11234. onClose: function onClose() {},
  11235. onChange: function onChange() {},
  11236. error: {
  11237. method: "The method you called is not defined"
  11238. },
  11239. className: {
  11240. active: "active",
  11241. animating: "animating"
  11242. },
  11243. selector: {
  11244. accordion: ".accordion",
  11245. title: ".title",
  11246. trigger: ".title",
  11247. content: ".content"
  11248. }
  11249. }, e.extend(e.easing, {
  11250. easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  11251. return -i * (t /= o) * (t - 2) + n;
  11252. }
  11253. });
  11254. }(jQuery, window, document), function (e, t, n, i) {
  11255. "use strict";
  11256. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  11257. var a,
  11258. r = e(this),
  11259. s = r.selector || "",
  11260. l = new Date().getTime(),
  11261. c = [],
  11262. u = arguments[0],
  11263. d = "string" == typeof u,
  11264. f = [].slice.call(arguments, 1);
  11265. return r.each(function () {
  11266. var r,
  11267. m,
  11268. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  11269. p = g.className,
  11270. h = g.namespace,
  11271. v = g.selector,
  11272. b = g.error,
  11273. y = "." + h,
  11274. x = "module-" + h,
  11275. C = e(this),
  11276. w = e(this).children(v.label),
  11277. S = e(this).children(v.input),
  11278. k = S[0],
  11279. T = !1,
  11280. A = !1,
  11281. R = C.data(x),
  11282. P = this;
  11283. m = {
  11284. initialize: function initialize() {
  11285. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  11286. },
  11287. instantiate: function instantiate() {
  11288. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  11289. },
  11290. destroy: function destroy() {
  11291. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  11292. },
  11293. fix: {
  11294. reference: function reference() {
  11295. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  11296. }
  11297. },
  11298. setup: function setup() {
  11299. m.set.initialLoad(), m.is.indeterminate() ? (m.debug("Initial value is indeterminate"), m.indeterminate()) : m.is.checked() ? (m.debug("Initial value is checked"), m.check()) : (m.debug("Initial value is unchecked"), m.uncheck()), m.remove.initialLoad();
  11300. },
  11301. refresh: function refresh() {
  11302. w = C.children(v.label), S = C.children(v.input), k = S[0];
  11303. },
  11304. hide: {
  11305. input: function input() {
  11306. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  11307. }
  11308. },
  11309. show: {
  11310. input: function input() {
  11311. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  11312. }
  11313. },
  11314. observeChanges: function observeChanges() {
  11315. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  11316. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  11317. })).observe(P, {
  11318. childList: !0,
  11319. subtree: !0
  11320. }), m.debug("Setting up mutation observer", r));
  11321. },
  11322. attachEvents: function attachEvents(t, n) {
  11323. var i = e(t);
  11324. n = e.isFunction(m[n]) ? m[n] : m.toggle, i.length > 0 ? (m.debug("Attaching checkbox events to element", t, n), i.on("click" + y, n)) : m.error(b.notFound);
  11325. },
  11326. event: {
  11327. click: function click(t) {
  11328. var n = e(t.target);
  11329. n.is(v.input) ? m.verbose("Using default check action on initialized checkbox") : n.is(v.link) ? m.debug("Clicking link inside checkbox, skipping toggle") : (m.toggle(), S.focus(), t.preventDefault());
  11330. },
  11331. keydown: function keydown(e) {
  11332. var t = e.which,
  11333. n = 13,
  11334. i = 32;
  11335. t == 27 ? (m.verbose("Escape key pressed blurring field"), S.blur(), A = !0) : e.ctrlKey || t != i && t != n ? A = !1 : (m.verbose("Enter/space key pressed, toggling checkbox"), m.toggle(), A = !0);
  11336. },
  11337. keyup: function keyup(e) {
  11338. A && e.preventDefault();
  11339. }
  11340. },
  11341. check: function check() {
  11342. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  11343. },
  11344. uncheck: function uncheck() {
  11345. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  11346. },
  11347. indeterminate: function indeterminate() {
  11348. m.should.allowIndeterminate() ? m.debug("Checkbox is already indeterminate") : (m.debug("Making checkbox indeterminate"), m.set.indeterminate(), m.should.ignoreCallbacks() || (g.onIndeterminate.call(k), g.onChange.call(k)));
  11349. },
  11350. determinate: function determinate() {
  11351. m.should.allowDeterminate() ? m.debug("Checkbox is already determinate") : (m.debug("Making checkbox determinate"), m.set.determinate(), m.should.ignoreCallbacks() || (g.onDeterminate.call(k), g.onChange.call(k)));
  11352. },
  11353. enable: function enable() {
  11354. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  11355. },
  11356. disable: function disable() {
  11357. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  11358. },
  11359. get: {
  11360. radios: function radios() {
  11361. var t = m.get.name();
  11362. return e('input[name="' + t + '"]').closest(v.checkbox);
  11363. },
  11364. otherRadios: function otherRadios() {
  11365. return m.get.radios().not(C);
  11366. },
  11367. name: function name() {
  11368. return S.attr("name");
  11369. }
  11370. },
  11371. is: {
  11372. initialLoad: function initialLoad() {
  11373. return T;
  11374. },
  11375. radio: function radio() {
  11376. return S.hasClass(p.radio) || "radio" == S.attr("type");
  11377. },
  11378. indeterminate: function indeterminate() {
  11379. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  11380. },
  11381. checked: function checked() {
  11382. return S.prop("checked") !== i && S.prop("checked");
  11383. },
  11384. disabled: function disabled() {
  11385. return S.prop("disabled") !== i && S.prop("disabled");
  11386. },
  11387. enabled: function enabled() {
  11388. return !m.is.disabled();
  11389. },
  11390. determinate: function determinate() {
  11391. return !m.is.indeterminate();
  11392. },
  11393. unchecked: function unchecked() {
  11394. return !m.is.checked();
  11395. }
  11396. },
  11397. should: {
  11398. allowCheck: function allowCheck() {
  11399. return m.is.determinate() && m.is.checked() && !m.should.forceCallbacks() ? (m.debug("Should not allow check, checkbox is already checked"), !1) : !1 !== g.beforeChecked.apply(k) || (m.debug("Should not allow check, beforeChecked cancelled"), !1);
  11400. },
  11401. allowUncheck: function allowUncheck() {
  11402. return m.is.determinate() && m.is.unchecked() && !m.should.forceCallbacks() ? (m.debug("Should not allow uncheck, checkbox is already unchecked"), !1) : !1 !== g.beforeUnchecked.apply(k) || (m.debug("Should not allow uncheck, beforeUnchecked cancelled"), !1);
  11403. },
  11404. allowIndeterminate: function allowIndeterminate() {
  11405. return m.is.indeterminate() && !m.should.forceCallbacks() ? (m.debug("Should not allow indeterminate, checkbox is already indeterminate"), !1) : !1 !== g.beforeIndeterminate.apply(k) || (m.debug("Should not allow indeterminate, beforeIndeterminate cancelled"), !1);
  11406. },
  11407. allowDeterminate: function allowDeterminate() {
  11408. return m.is.determinate() && !m.should.forceCallbacks() ? (m.debug("Should not allow determinate, checkbox is already determinate"), !1) : !1 !== g.beforeDeterminate.apply(k) || (m.debug("Should not allow determinate, beforeDeterminate cancelled"), !1);
  11409. },
  11410. forceCallbacks: function forceCallbacks() {
  11411. return m.is.initialLoad() && g.fireOnInit;
  11412. },
  11413. ignoreCallbacks: function ignoreCallbacks() {
  11414. return T && !g.fireOnInit;
  11415. }
  11416. },
  11417. can: {
  11418. change: function change() {
  11419. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  11420. },
  11421. uncheck: function uncheck() {
  11422. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  11423. }
  11424. },
  11425. set: {
  11426. initialLoad: function initialLoad() {
  11427. T = !0;
  11428. },
  11429. checked: function checked() {
  11430. m.verbose("Setting class to checked"), C.removeClass(p.indeterminate).addClass(p.checked), m.is.radio() && m.uncheckOthers(), m.is.indeterminate() || !m.is.checked() ? (m.verbose("Setting state to checked", k), S.prop("indeterminate", !1).prop("checked", !0), m.trigger.change()) : m.debug("Input is already checked, skipping input property change");
  11431. },
  11432. unchecked: function unchecked() {
  11433. m.verbose("Removing checked class"), C.removeClass(p.indeterminate).removeClass(p.checked), m.is.indeterminate() || !m.is.unchecked() ? (m.debug("Setting state to unchecked"), S.prop("indeterminate", !1).prop("checked", !1), m.trigger.change()) : m.debug("Input is already unchecked");
  11434. },
  11435. indeterminate: function indeterminate() {
  11436. m.verbose("Setting class to indeterminate"), C.addClass(p.indeterminate), m.is.indeterminate() ? m.debug("Input is already indeterminate, skipping input property change") : (m.debug("Setting state to indeterminate"), S.prop("indeterminate", !0), m.trigger.change());
  11437. },
  11438. determinate: function determinate() {
  11439. m.verbose("Removing indeterminate class"), C.removeClass(p.indeterminate), m.is.determinate() ? m.debug("Input is already determinate, skipping input property change") : (m.debug("Setting state to determinate"), S.prop("indeterminate", !1));
  11440. },
  11441. disabled: function disabled() {
  11442. m.verbose("Setting class to disabled"), C.addClass(p.disabled), m.is.disabled() ? m.debug("Input is already disabled, skipping input property change") : (m.debug("Setting state to disabled"), S.prop("disabled", "disabled"), m.trigger.change());
  11443. },
  11444. enabled: function enabled() {
  11445. m.verbose("Removing disabled class"), C.removeClass(p.disabled), m.is.enabled() ? m.debug("Input is already enabled, skipping input property change") : (m.debug("Setting state to enabled"), S.prop("disabled", !1), m.trigger.change());
  11446. },
  11447. tabbable: function tabbable() {
  11448. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  11449. }
  11450. },
  11451. remove: {
  11452. initialLoad: function initialLoad() {
  11453. T = !1;
  11454. }
  11455. },
  11456. trigger: {
  11457. change: function change() {
  11458. var e = n.createEvent("HTMLEvents"),
  11459. t = S[0];
  11460. t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  11461. }
  11462. },
  11463. create: {
  11464. label: function label() {
  11465. S.prevAll(v.label).length > 0 ? (S.prev(v.label).detach().insertAfter(S), m.debug("Moving existing label", w)) : m.has.label() || (w = e("<label>").insertAfter(S), m.debug("Creating label", w));
  11466. }
  11467. },
  11468. has: {
  11469. label: function label() {
  11470. return w.length > 0;
  11471. }
  11472. },
  11473. bind: {
  11474. events: function events() {
  11475. m.verbose("Attaching checkbox events"), C.on("click" + y, m.event.click).on("keydown" + y, v.input, m.event.keydown).on("keyup" + y, v.input, m.event.keyup);
  11476. }
  11477. },
  11478. unbind: {
  11479. events: function events() {
  11480. m.debug("Removing events"), C.off(y);
  11481. }
  11482. },
  11483. uncheckOthers: function uncheckOthers() {
  11484. var e = m.get.otherRadios();
  11485. m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  11486. },
  11487. toggle: function toggle() {
  11488. m.can.change() ? m.is.indeterminate() || m.is.unchecked() ? (m.debug("Currently unchecked"), m.check()) : m.is.checked() && m.can.uncheck() && (m.debug("Currently checked"), m.uncheck()) : m.is.radio() || m.debug("Checkbox is read-only or disabled, ignoring toggle");
  11489. },
  11490. setting: function setting(t, n) {
  11491. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  11492. if (n === i) return g[t];
  11493. e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  11494. }
  11495. },
  11496. internal: function internal(t, n) {
  11497. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  11498. if (n === i) return m[t];
  11499. m[t] = n;
  11500. }
  11501. },
  11502. debug: function debug() {
  11503. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  11504. },
  11505. verbose: function verbose() {
  11506. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  11507. },
  11508. error: function error() {
  11509. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  11510. },
  11511. performance: {
  11512. log: function log(e) {
  11513. var t, n;
  11514. g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  11515. Name: e[0],
  11516. Arguments: [].slice.call(e, 1) || "",
  11517. Element: P,
  11518. "Execution Time": n
  11519. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  11520. },
  11521. display: function display() {
  11522. var t = g.name + ":",
  11523. n = 0;
  11524. l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  11525. n += t["Execution Time"];
  11526. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  11527. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11528. }), console.groupEnd()), c = [];
  11529. }
  11530. },
  11531. invoke: function invoke(t, n, o) {
  11532. var r,
  11533. s,
  11534. l,
  11535. c = R;
  11536. return n = n || f, o = P || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11537. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11538. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11539. if (c[a] !== i) return s = c[a], !1;
  11540. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);
  11541. c = c[o];
  11542. }
  11543. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  11544. }
  11545. }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  11546. }), a !== i ? a : this;
  11547. }, e.fn.checkbox.settings = {
  11548. name: "Checkbox",
  11549. namespace: "checkbox",
  11550. silent: !1,
  11551. debug: !1,
  11552. verbose: !0,
  11553. performance: !0,
  11554. uncheckable: "auto",
  11555. fireOnInit: !1,
  11556. onChange: function onChange() {},
  11557. beforeChecked: function beforeChecked() {},
  11558. beforeUnchecked: function beforeUnchecked() {},
  11559. beforeDeterminate: function beforeDeterminate() {},
  11560. beforeIndeterminate: function beforeIndeterminate() {},
  11561. onChecked: function onChecked() {},
  11562. onUnchecked: function onUnchecked() {},
  11563. onDeterminate: function onDeterminate() {},
  11564. onIndeterminate: function onIndeterminate() {},
  11565. onEnable: function onEnable() {},
  11566. onDisable: function onDisable() {},
  11567. onEnabled: function onEnabled() {},
  11568. onDisabled: function onDisabled() {},
  11569. className: {
  11570. checked: "checked",
  11571. indeterminate: "indeterminate",
  11572. disabled: "disabled",
  11573. hidden: "hidden",
  11574. radio: "radio",
  11575. readOnly: "read-only"
  11576. },
  11577. error: {
  11578. method: "The method you called is not defined"
  11579. },
  11580. selector: {
  11581. checkbox: ".ui.checkbox",
  11582. label: "label, .box",
  11583. input: 'input[type="checkbox"], input[type="radio"]',
  11584. link: "a[href]"
  11585. }
  11586. };
  11587. }(jQuery, window, document), function (e, t, n, i) {
  11588. "use strict";
  11589. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  11590. var o,
  11591. a = e(this),
  11592. r = new Date().getTime(),
  11593. s = [],
  11594. l = arguments[0],
  11595. c = "string" == typeof l,
  11596. u = [].slice.call(arguments, 1);
  11597. return a.each(function () {
  11598. var d,
  11599. f,
  11600. m,
  11601. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  11602. p = g.selector,
  11603. h = g.namespace,
  11604. v = g.className,
  11605. b = g.error,
  11606. y = "." + h,
  11607. x = "module-" + h,
  11608. C = a.selector || "",
  11609. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  11610. S = e(this),
  11611. k = this,
  11612. T = S.data(x);
  11613. (m = {
  11614. preinitialize: function preinitialize() {
  11615. m.is.dimmer() ? (f = S.parent(), d = S) : (f = S, d = m.has.dimmer() ? g.dimmerName ? f.find(p.dimmer).filter("." + g.dimmerName) : f.find(p.dimmer) : m.create(), m.set.variation());
  11616. },
  11617. initialize: function initialize() {
  11618. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  11619. },
  11620. instantiate: function instantiate() {
  11621. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  11622. },
  11623. destroy: function destroy() {
  11624. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  11625. },
  11626. bind: {
  11627. events: function events() {
  11628. m.is.page() && f.get(0).addEventListener("touchmove", m.event.preventScroll, {
  11629. passive: !1
  11630. }), "hover" == g.on ? f.on("mouseenter" + y, m.show).on("mouseleave" + y, m.hide) : "click" == g.on && f.on(w + y, m.toggle), m.is.page() && (m.debug("Setting as a page dimmer", f), m.set.pageDimmer()), m.is.closable() && (m.verbose("Adding dimmer close event", d), f.on(w + y, p.dimmer, m.event.click));
  11631. }
  11632. },
  11633. unbind: {
  11634. events: function events() {
  11635. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, {
  11636. passive: !1
  11637. }), S.removeData(x), f.off(y);
  11638. }
  11639. },
  11640. event: {
  11641. click: function click(t) {
  11642. m.verbose("Determining if event occured on dimmer", t), (0 === d.find(t.target).length || e(t.target).is(p.content)) && (m.hide(), t.stopImmediatePropagation());
  11643. },
  11644. preventScroll: function preventScroll(e) {
  11645. e.preventDefault();
  11646. }
  11647. },
  11648. addContent: function addContent(t) {
  11649. var n = e(t);
  11650. m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  11651. },
  11652. create: function create() {
  11653. var t = e(g.template.dimmer());
  11654. return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  11655. },
  11656. show: function show(t) {
  11657. t = e.isFunction(t) ? t : function () {}, m.debug("Showing dimmer", d, g), m.is.dimmed() && !m.is.animating() || !m.is.enabled() ? m.debug("Dimmer is already shown or disabled") : (m.animate.show(t), g.onShow.call(k), g.onChange.call(k));
  11658. },
  11659. hide: function hide(t) {
  11660. t = e.isFunction(t) ? t : function () {}, m.is.dimmed() || m.is.animating() ? (m.debug("Hiding dimmer", d), m.animate.hide(t), g.onHide.call(k), g.onChange.call(k)) : m.debug("Dimmer is not visible");
  11661. },
  11662. toggle: function toggle() {
  11663. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  11664. },
  11665. animate: {
  11666. show: function show(t) {
  11667. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? ("auto" !== g.opacity && m.set.opacity(), d.transition({
  11668. displayType: "flex",
  11669. animation: g.transition + " in",
  11670. queue: !1,
  11671. duration: m.get.duration(),
  11672. useFailSafe: !0,
  11673. onStart: function onStart() {
  11674. m.set.dimmed();
  11675. },
  11676. onComplete: function onComplete() {
  11677. m.set.active(), t();
  11678. }
  11679. })) : (m.verbose("Showing dimmer animation with javascript"), m.set.dimmed(), "auto" == g.opacity && (g.opacity = .8), d.stop().css({
  11680. opacity: 0,
  11681. width: "100%",
  11682. height: "100%"
  11683. }).fadeTo(m.get.duration(), g.opacity, function () {
  11684. d.removeAttr("style"), m.set.active(), t();
  11685. }));
  11686. },
  11687. hide: function hide(t) {
  11688. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? (m.verbose("Hiding dimmer with css"), d.transition({
  11689. displayType: "flex",
  11690. animation: g.transition + " out",
  11691. queue: !1,
  11692. duration: m.get.duration(),
  11693. useFailSafe: !0,
  11694. onStart: function onStart() {
  11695. m.remove.dimmed();
  11696. },
  11697. onComplete: function onComplete() {
  11698. m.remove.active(), t();
  11699. }
  11700. })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  11701. m.remove.active(), d.removeAttr("style"), t();
  11702. }));
  11703. }
  11704. },
  11705. get: {
  11706. dimmer: function dimmer() {
  11707. return d;
  11708. },
  11709. duration: function duration() {
  11710. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  11711. }
  11712. },
  11713. has: {
  11714. dimmer: function dimmer() {
  11715. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  11716. }
  11717. },
  11718. is: {
  11719. active: function active() {
  11720. return d.hasClass(v.active);
  11721. },
  11722. animating: function animating() {
  11723. return d.is(":animated") || d.hasClass(v.animating);
  11724. },
  11725. closable: function closable() {
  11726. return "auto" == g.closable ? "hover" != g.on : g.closable;
  11727. },
  11728. dimmer: function dimmer() {
  11729. return S.hasClass(v.dimmer);
  11730. },
  11731. dimmable: function dimmable() {
  11732. return S.hasClass(v.dimmable);
  11733. },
  11734. dimmed: function dimmed() {
  11735. return f.hasClass(v.dimmed);
  11736. },
  11737. disabled: function disabled() {
  11738. return f.hasClass(v.disabled);
  11739. },
  11740. enabled: function enabled() {
  11741. return !m.is.disabled();
  11742. },
  11743. page: function page() {
  11744. return f.is("body");
  11745. },
  11746. pageDimmer: function pageDimmer() {
  11747. return d.hasClass(v.pageDimmer);
  11748. }
  11749. },
  11750. can: {
  11751. show: function show() {
  11752. return !d.hasClass(v.disabled);
  11753. }
  11754. },
  11755. set: {
  11756. opacity: function opacity(e) {
  11757. var t = d.css("background-color"),
  11758. n = t.split(","),
  11759. i = n && 3 == n.length,
  11760. o = n && 4 == n.length;
  11761. e = 0 === g.opacity ? 0 : g.opacity || e, i || o ? (n[3] = e + ")", t = n.join(",")) : t = "rgba(0, 0, 0, " + e + ")", m.debug("Setting opacity to", e), d.css("background-color", t);
  11762. },
  11763. active: function active() {
  11764. d.addClass(v.active);
  11765. },
  11766. dimmable: function dimmable() {
  11767. f.addClass(v.dimmable);
  11768. },
  11769. dimmed: function dimmed() {
  11770. f.addClass(v.dimmed);
  11771. },
  11772. pageDimmer: function pageDimmer() {
  11773. d.addClass(v.pageDimmer);
  11774. },
  11775. disabled: function disabled() {
  11776. d.addClass(v.disabled);
  11777. },
  11778. variation: function variation(e) {
  11779. (e = e || g.variation) && d.addClass(e);
  11780. }
  11781. },
  11782. remove: {
  11783. active: function active() {
  11784. d.removeClass(v.active);
  11785. },
  11786. dimmed: function dimmed() {
  11787. f.removeClass(v.dimmed);
  11788. },
  11789. disabled: function disabled() {
  11790. d.removeClass(v.disabled);
  11791. },
  11792. variation: function variation(e) {
  11793. (e = e || g.variation) && d.removeClass(e);
  11794. }
  11795. },
  11796. setting: function setting(t, n) {
  11797. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  11798. if (n === i) return g[t];
  11799. e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  11800. }
  11801. },
  11802. internal: function internal(t, n) {
  11803. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  11804. if (n === i) return m[t];
  11805. m[t] = n;
  11806. }
  11807. },
  11808. debug: function debug() {
  11809. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  11810. },
  11811. verbose: function verbose() {
  11812. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  11813. },
  11814. error: function error() {
  11815. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  11816. },
  11817. performance: {
  11818. log: function log(e) {
  11819. var t, n;
  11820. g.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  11821. Name: e[0],
  11822. Arguments: [].slice.call(e, 1) || "",
  11823. Element: k,
  11824. "Execution Time": n
  11825. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  11826. },
  11827. display: function display() {
  11828. var t = g.name + ":",
  11829. n = 0;
  11830. r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  11831. n += t["Execution Time"];
  11832. }), t += " " + n + "ms", C && (t += " '" + C + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  11833. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11834. }), console.groupEnd()), s = [];
  11835. }
  11836. },
  11837. invoke: function invoke(t, n, a) {
  11838. var r,
  11839. s,
  11840. l,
  11841. c = T;
  11842. return n = n || u, a = k || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  11843. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11844. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11845. if (c[a] !== i) return s = c[a], !1;
  11846. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);
  11847. c = c[o];
  11848. }
  11849. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  11850. }
  11851. }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  11852. }), o !== i ? o : this;
  11853. }, e.fn.dimmer.settings = {
  11854. name: "Dimmer",
  11855. namespace: "dimmer",
  11856. silent: !1,
  11857. debug: !1,
  11858. verbose: !1,
  11859. performance: !0,
  11860. dimmerName: !1,
  11861. variation: !1,
  11862. closable: "auto",
  11863. useCSS: !0,
  11864. transition: "fade",
  11865. on: !1,
  11866. opacity: "auto",
  11867. duration: {
  11868. show: 500,
  11869. hide: 500
  11870. },
  11871. onChange: function onChange() {},
  11872. onShow: function onShow() {},
  11873. onHide: function onHide() {},
  11874. error: {
  11875. method: "The method you called is not defined."
  11876. },
  11877. className: {
  11878. active: "active",
  11879. animating: "animating",
  11880. dimmable: "dimmable",
  11881. dimmed: "dimmed",
  11882. dimmer: "dimmer",
  11883. disabled: "disabled",
  11884. hide: "hide",
  11885. pageDimmer: "page",
  11886. show: "show"
  11887. },
  11888. selector: {
  11889. dimmer: "> .ui.dimmer",
  11890. content: ".ui.dimmer > .content, .ui.dimmer > .content > .center"
  11891. },
  11892. template: {
  11893. dimmer: function dimmer() {
  11894. return e("<div />").attr("class", "ui dimmer");
  11895. }
  11896. }
  11897. };
  11898. }(jQuery, window, document), function (e, t, n, i) {
  11899. "use strict";
  11900. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  11901. var a,
  11902. r = e(this),
  11903. s = e(n),
  11904. l = r.selector || "",
  11905. c = "ontouchstart" in n.documentElement,
  11906. u = new Date().getTime(),
  11907. d = [],
  11908. f = arguments[0],
  11909. m = "string" == typeof f,
  11910. g = [].slice.call(arguments, 1);
  11911. return r.each(function (p) {
  11912. var h,
  11913. v,
  11914. b,
  11915. y,
  11916. x,
  11917. C,
  11918. w,
  11919. S,
  11920. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  11921. T = k.className,
  11922. A = k.message,
  11923. R = k.fields,
  11924. P = k.keys,
  11925. E = k.metadata,
  11926. F = k.namespace,
  11927. O = k.regExp,
  11928. D = k.selector,
  11929. q = k.error,
  11930. j = k.templates,
  11931. z = "." + F,
  11932. I = "module-" + F,
  11933. M = e(this),
  11934. L = e(k.context),
  11935. V = M.find(D.text),
  11936. N = M.find(D.search),
  11937. H = M.find(D.sizer),
  11938. U = M.find(D.input),
  11939. W = M.find(D.icon),
  11940. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  11941. Q = M.children(D.menu),
  11942. X = Q.find(D.item),
  11943. $ = !1,
  11944. Y = !1,
  11945. Z = !1,
  11946. K = this,
  11947. J = M.data(I);
  11948. S = {
  11949. initialize: function initialize() {
  11950. S.debug("Initializing dropdown", k), S.is.alreadySetup() ? S.setup.reference() : (S.setup.layout(), k.values && S.change.values(k.values), S.refreshData(), S.save.defaults(), S.restore.selected(), S.create.id(), S.bind.events(), S.observeChanges(), S.instantiate());
  11951. },
  11952. instantiate: function instantiate() {
  11953. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  11954. },
  11955. destroy: function destroy() {
  11956. S.verbose("Destroying previous dropdown", M), S.remove.tabbable(), M.off(z).removeData(I), Q.off(z), s.off(y), S.disconnect.menuObserver(), S.disconnect.selectObserver();
  11957. },
  11958. observeChanges: function observeChanges() {
  11959. "MutationObserver" in t && (C = new MutationObserver(S.event.select.mutation), w = new MutationObserver(S.event.menu.mutation), S.debug("Setting up mutation observer", C, w), S.observe.select(), S.observe.menu());
  11960. },
  11961. disconnect: {
  11962. menuObserver: function menuObserver() {
  11963. w && w.disconnect();
  11964. },
  11965. selectObserver: function selectObserver() {
  11966. C && C.disconnect();
  11967. }
  11968. },
  11969. observe: {
  11970. select: function select() {
  11971. S.has.input() && C.observe(M[0], {
  11972. childList: !0,
  11973. subtree: !0
  11974. });
  11975. },
  11976. menu: function menu() {
  11977. S.has.menu() && w.observe(Q[0], {
  11978. childList: !0,
  11979. subtree: !0
  11980. });
  11981. }
  11982. },
  11983. create: {
  11984. id: function id() {
  11985. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  11986. },
  11987. userChoice: function userChoice(t) {
  11988. var n, o, a;
  11989. return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  11990. !1 === S.get.item(r) && (a = k.templates.addition(S.add.variables(A.addResult, r)), o = e("<div />").html(a).attr("data-" + E.value, r).attr("data-" + E.text, r).addClass(T.addition).addClass(T.item), k.hideAdditions && o.addClass(T.hidden), n = n === i ? o : n.add(o), S.verbose("Creating user choices for value", r, o));
  11991. }), n);
  11992. },
  11993. userLabels: function userLabels(t) {
  11994. var n = S.get.userValues();
  11995. n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  11996. S.verbose("Adding custom user value"), S.add.label(t, t);
  11997. }));
  11998. },
  11999. menu: function menu() {
  12000. Q = e("<div />").addClass(T.menu).appendTo(M);
  12001. },
  12002. sizer: function sizer() {
  12003. H = e("<span />").addClass(T.sizer).insertAfter(N);
  12004. }
  12005. },
  12006. search: function search(e) {
  12007. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  12008. },
  12009. select: {
  12010. firstUnfiltered: function firstUnfiltered() {
  12011. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  12012. },
  12013. nextAvailable: function nextAvailable(e) {
  12014. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  12015. n = e.prevAll(D.item).not(D.unselectable).eq(0);
  12016. t.length > 0 ? (S.verbose("Moving selection to", t), t.addClass(T.selected)) : (S.verbose("Moving selection to", n), n.addClass(T.selected));
  12017. }
  12018. },
  12019. setup: {
  12020. api: function api() {
  12021. var e = {
  12022. debug: k.debug,
  12023. urlData: {
  12024. value: S.get.value(),
  12025. query: S.get.query()
  12026. },
  12027. on: !1
  12028. };
  12029. S.verbose("First request, initializing API"), M.api(e);
  12030. },
  12031. layout: function layout() {
  12032. M.is("select") && (S.setup.select(), S.setup.returnedObject()), S.has.menu() || S.create.menu(), S.is.search() && !S.has.search() && (S.verbose("Adding search input"), N = e("<input />").addClass(T.search).prop("autocomplete", "off").insertBefore(V)), S.is.multiple() && S.is.searchSelection() && !S.has.sizer() && S.create.sizer(), k.allowTab && S.set.tabbable();
  12033. },
  12034. select: function select() {
  12035. var t = S.get.selectValues();
  12036. S.debug("Dropdown initialized on a select", t), M.is("select") && (U = M), U.parent(D.dropdown).length > 0 ? (S.debug("UI dropdown already exists. Creating dropdown menu only"), M = U.closest(D.dropdown), S.has.menu() || S.create.menu(), Q = M.children(D.menu), S.setup.menu(t)) : (S.debug("Creating entire dropdown from select"), M = e("<div />").attr("class", U.attr("class")).addClass(T.selection).addClass(T.dropdown).html(j.dropdown(t)).insertBefore(U), U.hasClass(T.multiple) && !1 === U.prop("multiple") && (S.error(q.missingMultiple), U.prop("multiple", !0)), U.is("[multiple]") && S.set.multiple(), U.prop("disabled") && (S.debug("Disabling dropdown"), M.addClass(T.disabled)), U.removeAttr("class").detach().prependTo(M)), S.refresh();
  12037. },
  12038. menu: function menu(e) {
  12039. Q.html(j.menu(e, R)), X = Q.find(D.item);
  12040. },
  12041. reference: function reference() {
  12042. S.debug("Dropdown behavior was called on select, replacing with closest dropdown"), M = M.parent(D.dropdown), J = M.data(I), K = M.get(0), S.refresh(), S.setup.returnedObject();
  12043. },
  12044. returnedObject: function returnedObject() {
  12045. var e = r.slice(0, p),
  12046. t = r.slice(p + 1);
  12047. r = e.add(M).add(t);
  12048. }
  12049. },
  12050. refresh: function refresh() {
  12051. S.refreshSelectors(), S.refreshData();
  12052. },
  12053. refreshItems: function refreshItems() {
  12054. X = Q.find(D.item);
  12055. },
  12056. refreshSelectors: function refreshSelectors() {
  12057. S.verbose("Refreshing selector cache"), V = M.find(D.text), N = M.find(D.search), U = M.find(D.input), W = M.find(D.icon), B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(), Q = M.children(D.menu), X = Q.find(D.item);
  12058. },
  12059. refreshData: function refreshData() {
  12060. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  12061. },
  12062. clearData: function clearData() {
  12063. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  12064. },
  12065. toggle: function toggle() {
  12066. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  12067. },
  12068. show: function show(t) {
  12069. if (t = e.isFunction(t) ? t : function () {}, !S.can.show() && S.is.remote() && (S.debug("No API results retrieved, searching before show"), S.queryRemote(S.get.query(), S.show)), S.can.show() && !S.is.active()) {
  12070. if (S.debug("Showing dropdown"), !S.has.message() || S.has.maxSelections() || S.has.allResultsFiltered() || S.remove.message(), S.is.allFiltered()) return !0;
  12071. !1 !== k.onShow.call(K) && S.animate.show(function () {
  12072. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  12073. });
  12074. }
  12075. },
  12076. hide: function hide(t) {
  12077. t = e.isFunction(t) ? t : function () {}, S.is.active() && !S.is.animatingOutward() && (S.debug("Hiding dropdown"), !1 !== k.onHide.call(K) && S.animate.hide(function () {
  12078. S.remove.visible(), t.call(K);
  12079. }));
  12080. },
  12081. hideOthers: function hideOthers() {
  12082. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  12083. },
  12084. hideMenu: function hideMenu() {
  12085. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  12086. },
  12087. hideSubMenus: function hideSubMenus() {
  12088. var e = Q.children(D.item).find(D.menu);
  12089. S.verbose("Hiding sub menus", e), e.transition("hide");
  12090. },
  12091. bind: {
  12092. events: function events() {
  12093. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  12094. },
  12095. touchEvents: function touchEvents() {
  12096. S.debug("Touch device detected binding additional touch events"), S.is.searchSelection() || S.is.single() && M.on("touchstart" + z, S.event.test.toggle), Q.on("touchstart" + z, D.item, S.event.item.mouseenter);
  12097. },
  12098. keyboardEvents: function keyboardEvents() {
  12099. S.verbose("Binding keyboard events"), M.on("keydown" + z, S.event.keydown), S.has.search() && M.on(S.get.inputEvent() + z, D.search, S.event.input), S.is.multiple() && s.on("keydown" + y, S.event.document.keydown);
  12100. },
  12101. inputEvents: function inputEvents() {
  12102. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  12103. },
  12104. mouseEvents: function mouseEvents() {
  12105. S.verbose("Binding mouse events"), S.is.multiple() && M.on("click" + z, D.label, S.event.label.click).on("click" + z, D.remove, S.event.remove.click), S.is.searchSelection() ? (M.on("mousedown" + z, S.event.mousedown).on("mouseup" + z, S.event.mouseup).on("mousedown" + z, D.menu, S.event.menu.mousedown).on("mouseup" + z, D.menu, S.event.menu.mouseup).on("click" + z, D.icon, S.event.icon.click).on("focus" + z, D.search, S.event.search.focus).on("click" + z, D.search, S.event.search.focus).on("blur" + z, D.search, S.event.search.blur).on("click" + z, D.text, S.event.text.focus), S.is.multiple() && M.on("click" + z, S.event.click)) : ("click" == k.on ? M.on("click" + z, D.icon, S.event.icon.click).on("click" + z, S.event.test.toggle) : "hover" == k.on ? M.on("mouseenter" + z, S.delay.show).on("mouseleave" + z, S.delay.hide) : M.on(k.on + z, S.toggle), M.on("mousedown" + z, S.event.mousedown).on("mouseup" + z, S.event.mouseup).on("focus" + z, S.event.focus), S.has.menuSearch() ? M.on("blur" + z, D.search, S.event.search.blur) : M.on("blur" + z, S.event.blur)), Q.on("mouseenter" + z, D.item, S.event.item.mouseenter).on("mouseleave" + z, D.item, S.event.item.mouseleave).on("click" + z, D.item, S.event.item.click);
  12106. },
  12107. intent: function intent() {
  12108. S.verbose("Binding hide intent event to document"), c && s.on("touchstart" + y, S.event.test.touch).on("touchmove" + y, S.event.test.touch), s.on("click" + y, S.event.test.hide);
  12109. }
  12110. },
  12111. unbind: {
  12112. intent: function intent() {
  12113. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  12114. }
  12115. },
  12116. filter: function filter(e) {
  12117. var t = e !== i ? e : S.get.query(),
  12118. n = function n() {
  12119. S.is.multiple() && S.filterActive(), (e || !e && 0 == S.get.activeItem().length) && S.select.firstUnfiltered(), S.has.allResultsFiltered() ? k.onNoResults.call(K, t) ? k.allowAdditions ? k.hideAdditions && (S.verbose("User addition with no menu, setting empty style"), S.set.empty(), S.hideMenu()) : (S.verbose("All items filtered, showing message", t), S.add.message(A.noResults)) : (S.verbose("All items filtered, hiding dropdown", t), S.hideMenu()) : (S.remove.empty(), S.remove.message()), k.allowAdditions && S.add.userSuggestion(e), S.is.searchSelection() && S.can.show() && S.is.focusedOnSearch() && S.show();
  12120. };
  12121. k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  12122. k.filterRemoteData && S.filterItems(t), n();
  12123. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  12124. },
  12125. queryRemote: function queryRemote(t, n) {
  12126. var i = {
  12127. errorDuration: !1,
  12128. cache: "local",
  12129. throttle: k.throttle,
  12130. urlData: {
  12131. query: t
  12132. },
  12133. onError: function onError() {
  12134. S.add.message(A.serverError), n();
  12135. },
  12136. onFailure: function onFailure() {
  12137. S.add.message(A.serverError), n();
  12138. },
  12139. onSuccess: function onSuccess(t) {
  12140. var i = t[R.remoteValues];
  12141. e.isArray(i) && i.length > 0 ? (S.remove.message(), S.setup.menu({
  12142. values: t[R.remoteValues]
  12143. })) : S.add.message(A.noResults), n();
  12144. }
  12145. };
  12146. M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  12147. },
  12148. filterItems: function filterItems(t) {
  12149. var n = t !== i ? t : S.get.query(),
  12150. o = null,
  12151. a = S.escape.string(n),
  12152. r = new RegExp("^" + a, "igm");
  12153. S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  12154. var t,
  12155. i,
  12156. a = e(this);
  12157. if ("both" == k.match || "text" == k.match) {
  12158. if (-1 !== (t = String(S.get.choiceText(a, !1))).search(r)) return o.push(this), !0;
  12159. if ("exact" === k.fullTextSearch && S.exactSearch(n, t)) return o.push(this), !0;
  12160. if (!0 === k.fullTextSearch && S.fuzzySearch(n, t)) return o.push(this), !0;
  12161. }
  12162. if ("both" == k.match || "value" == k.match) {
  12163. if (-1 !== (i = String(S.get.choiceValue(a, t))).search(r)) return o.push(this), !0;
  12164. if ("exact" === k.fullTextSearch && S.exactSearch(n, i)) return o.push(this), !0;
  12165. if (!0 === k.fullTextSearch && S.fuzzySearch(n, i)) return o.push(this), !0;
  12166. }
  12167. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  12168. },
  12169. fuzzySearch: function fuzzySearch(e, t) {
  12170. var n = t.length,
  12171. i = e.length;
  12172. if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;
  12173. if (i === n) return e === t;
  12174. e: for (var o = 0, a = 0; o < i; o++) {
  12175. for (var r = e.charCodeAt(o); a < n;) {
  12176. if (t.charCodeAt(a++) === r) continue e;
  12177. }
  12178. return !1;
  12179. }
  12180. return !0;
  12181. },
  12182. exactSearch: function exactSearch(e, t) {
  12183. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12184. },
  12185. filterActive: function filterActive() {
  12186. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  12187. },
  12188. focusSearch: function focusSearch(e) {
  12189. S.has.search() && !S.is.focusedOnSearch() && (e ? (M.off("focus" + z, D.search), N.focus(), M.on("focus" + z, D.search, S.event.search.focus)) : N.focus());
  12190. },
  12191. forceSelection: function forceSelection() {
  12192. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  12193. t = X.not(T.filtered).filter("." + T.active).eq(0),
  12194. n = e.length > 0 ? e : t;
  12195. if (n.length > 0 && !S.is.multiple()) return S.debug("Forcing partial selection to selected item", n), void S.event.item.click.call(n, {}, !0);
  12196. k.allowAdditions ? (S.set.selected(S.get.query()), S.remove.searchTerm()) : S.remove.searchTerm();
  12197. },
  12198. change: {
  12199. values: function values(t) {
  12200. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({
  12201. values: t
  12202. }), e.each(t, function (e, t) {
  12203. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  12204. });
  12205. }
  12206. },
  12207. event: {
  12208. change: function change() {
  12209. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  12210. },
  12211. focus: function focus() {
  12212. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  12213. },
  12214. blur: function blur(e) {
  12215. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  12216. },
  12217. mousedown: function mousedown() {
  12218. S.is.searchSelection() ? b = !0 : $ = !0;
  12219. },
  12220. mouseup: function mouseup() {
  12221. S.is.searchSelection() ? b = !1 : $ = !1;
  12222. },
  12223. click: function click(t) {
  12224. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  12225. },
  12226. search: {
  12227. focus: function focus() {
  12228. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  12229. },
  12230. blur: function blur(e) {
  12231. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  12232. }
  12233. },
  12234. icon: {
  12235. click: function click(e) {
  12236. S.toggle();
  12237. }
  12238. },
  12239. text: {
  12240. focus: function focus(e) {
  12241. $ = !0, S.focusSearch();
  12242. }
  12243. },
  12244. input: function input(e) {
  12245. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  12246. },
  12247. label: {
  12248. click: function click(t) {
  12249. var n = e(this),
  12250. i = M.find(D.label),
  12251. o = i.filter("." + T.active),
  12252. a = n.nextAll("." + T.active),
  12253. r = n.prevAll("." + T.active),
  12254. s = a.length > 0 ? n.nextUntil(a).add(o).add(n) : n.prevUntil(r).add(o).add(n);
  12255. t.shiftKey ? (o.removeClass(T.active), s.addClass(T.active)) : t.ctrlKey ? n.toggleClass(T.active) : (o.removeClass(T.active), n.addClass(T.active)), k.onLabelSelect.apply(this, i.filter("." + T.active));
  12256. }
  12257. },
  12258. remove: {
  12259. click: function click() {
  12260. var t = e(this).parent();
  12261. t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  12262. }
  12263. },
  12264. test: {
  12265. toggle: function toggle(e) {
  12266. var t = S.is.multiple() ? S.show : S.toggle;
  12267. S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  12268. },
  12269. touch: function touch(e) {
  12270. S.determine.eventOnElement(e, function () {
  12271. "touchstart" == e.type ? S.timer = setTimeout(function () {
  12272. S.hide();
  12273. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  12274. }), e.stopPropagation();
  12275. },
  12276. hide: function hide(e) {
  12277. S.determine.eventInModule(e, S.hide);
  12278. }
  12279. },
  12280. select: {
  12281. mutation: function mutation(t) {
  12282. S.debug("<select> modified, recreating menu");
  12283. var n = !1;
  12284. e.each(t, function (t, i) {
  12285. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  12286. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  12287. }
  12288. },
  12289. menu: {
  12290. mutation: function mutation(t) {
  12291. var n = t[0],
  12292. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  12293. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  12294. a = i.add(o),
  12295. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  12296. s = a.is(D.message) || a.closest(D.message).length > 0;
  12297. r || s ? (S.debug("Updating item selector cache"), S.refreshItems()) : (S.debug("Menu modified, updating selector cache"), S.refresh());
  12298. },
  12299. mousedown: function mousedown() {
  12300. Y = !0;
  12301. },
  12302. mouseup: function mouseup() {
  12303. Y = !1;
  12304. }
  12305. },
  12306. item: {
  12307. mouseenter: function mouseenter(t) {
  12308. var n = e(t.target),
  12309. i = e(this),
  12310. o = i.children(D.menu),
  12311. a = i.siblings(D.item).children(D.menu),
  12312. r = o.length > 0;
  12313. !(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  12314. S.verbose("Showing sub-menu", o), e.each(a, function () {
  12315. S.animate.hide(!1, e(this));
  12316. }), S.animate.show(!1, o);
  12317. }, k.delay.show), t.preventDefault());
  12318. },
  12319. mouseleave: function mouseleave(t) {
  12320. var n = e(this).children(D.menu);
  12321. n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  12322. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  12323. }, k.delay.hide));
  12324. },
  12325. click: function click(t, i) {
  12326. var o = e(this),
  12327. a = e(t ? t.target : ""),
  12328. r = o.find(D.menu),
  12329. s = S.get.choiceText(o),
  12330. l = S.get.choiceValue(o, s),
  12331. c = r.length > 0,
  12332. u = r.find(a).length > 0;
  12333. S.has.menuSearch() && e(n.activeElement).blur(), u || c && !k.allowCategorySelection || (S.is.searchSelection() && (k.allowAdditions && S.remove.userAddition(), S.remove.searchTerm(), S.is.focusedOnSearch() || 1 == i || S.focusSearch(!0)), k.useLabels || (S.remove.filteredItem(), S.set.scrollPosition(o)), S.determine.selectAction.call(this, s, l));
  12334. }
  12335. },
  12336. document: {
  12337. keydown: function keydown(e) {
  12338. var t = e.which;
  12339. if (S.is.inObject(t, P)) {
  12340. var n = M.find(D.label),
  12341. i = n.filter("." + T.active),
  12342. o = (i.data(E.value), n.index(i)),
  12343. a = n.length,
  12344. r = i.length > 0,
  12345. s = i.length > 1,
  12346. l = 0 === o,
  12347. c = o + 1 == a,
  12348. u = S.is.searchSelection(),
  12349. d = S.is.focusedOnSearch(),
  12350. f = S.is.focused(),
  12351. m = d && 0 === S.get.caretPosition();
  12352. if (u && !r && !d) return;
  12353. t == P.leftArrow ? !f && !m || r ? r && (e.shiftKey ? S.verbose("Adding previous label to selection") : (S.verbose("Selecting previous label"), n.removeClass(T.active)), l && !s ? i.addClass(T.active) : i.prev(D.siblingLabel).addClass(T.active).end(), e.preventDefault()) : (S.verbose("Selecting previous label"), n.last().addClass(T.active)) : t == P.rightArrow ? (f && !r && n.first().addClass(T.active), r && (e.shiftKey ? S.verbose("Adding next label to selection") : (S.verbose("Selecting next label"), n.removeClass(T.active)), c ? u ? d ? n.removeClass(T.active) : S.focusSearch() : s ? i.next(D.siblingLabel).addClass(T.active) : i.addClass(T.active) : i.next(D.siblingLabel).addClass(T.active), e.preventDefault())) : t == P.deleteKey || t == P.backspace ? r ? (S.verbose("Removing active labels"), c && u && !d && S.focusSearch(), i.last().next(D.siblingLabel).addClass(T.active), S.remove.activeLabels(i), e.preventDefault()) : m && !r && t == P.backspace && (S.verbose("Removing last label on input backspace"), i = n.last().addClass(T.active), S.remove.activeLabels(i)) : i.removeClass(T.active);
  12354. }
  12355. }
  12356. },
  12357. keydown: function keydown(e) {
  12358. var t = e.which;
  12359. if (S.is.inObject(t, P)) {
  12360. var n,
  12361. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  12362. o = Q.children("." + T.active).eq(0),
  12363. a = i.length > 0 ? i : o,
  12364. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  12365. s = a.children(D.menu),
  12366. l = a.closest(D.menu),
  12367. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  12368. u = s.length > 0,
  12369. d = a.length > 0,
  12370. f = a.not(D.unselectable).length > 0,
  12371. m = t == P.delimiter && k.allowAdditions && S.is.multiple();
  12372. if (k.allowAdditions && k.hideAdditions && (t == P.enter || m) && f && (S.verbose("Selecting item from keyboard shortcut", a), S.event.item.click.call(a, e), S.is.searchSelection() && S.remove.searchTerm()), S.is.visible()) {
  12373. if ((t == P.enter || m) && (t == P.enter && d && u && !k.allowCategorySelection ? (S.verbose("Pressed enter on unselectable category, opening sub menu"), t = P.rightArrow) : f && (S.verbose("Selecting item from keyboard shortcut", a), S.event.item.click.call(a, e), S.is.searchSelection() && S.remove.searchTerm()), e.preventDefault()), d && (t == P.leftArrow && l[0] !== Q[0] && (S.verbose("Left key pressed, closing sub-menu"), S.animate.hide(!1, l), a.removeClass(T.selected), l.closest(D.item).addClass(T.selected), e.preventDefault()), t == P.rightArrow && u && (S.verbose("Right key pressed, opening sub-menu"), S.animate.show(!1, s), a.removeClass(T.selected), s.find(D.item).eq(0).addClass(T.selected), e.preventDefault())), t == P.upArrow) {
  12374. if (n = d && c ? a.prevAll(D.item + ":not(" + D.unselectable + ")").eq(0) : X.eq(0), r.index(n) < 0) return S.verbose("Up key pressed but reached top of current menu"), void e.preventDefault();
  12375. S.verbose("Up key pressed, changing active item"), a.removeClass(T.selected), n.addClass(T.selected), S.set.scrollPosition(n), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), e.preventDefault();
  12376. }
  12377. if (t == P.downArrow) {
  12378. if (0 === (n = d && c ? n = a.nextAll(D.item + ":not(" + D.unselectable + ")").eq(0) : X.eq(0)).length) return S.verbose("Down key pressed but reached bottom of current menu"), void e.preventDefault();
  12379. S.verbose("Down key pressed, changing active item"), X.removeClass(T.selected), n.addClass(T.selected), S.set.scrollPosition(n), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), e.preventDefault();
  12380. }
  12381. t == P.pageUp && (S.scrollPage("up"), e.preventDefault()), t == P.pageDown && (S.scrollPage("down"), e.preventDefault()), t == P.escape && (S.verbose("Escape key pressed, closing dropdown"), S.hide());
  12382. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  12383. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  12384. }
  12385. },
  12386. trigger: {
  12387. change: function change() {
  12388. var e = n.createEvent("HTMLEvents"),
  12389. t = U[0];
  12390. t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  12391. }
  12392. },
  12393. determine: {
  12394. selectAction: function selectAction(t, n) {
  12395. S.verbose("Determining action", k.action), e.isFunction(S.action[k.action]) ? (S.verbose("Triggering preset action", k.action, t, n), S.action[k.action].call(K, t, n, this)) : e.isFunction(k.action) ? (S.verbose("Triggering user action", k.action, t, n), k.action.call(K, t, n, this)) : S.error(q.action, k.action);
  12396. },
  12397. eventInModule: function eventInModule(t, i) {
  12398. var o = e(t.target),
  12399. a = o.closest(n.documentElement).length > 0,
  12400. r = o.closest(M).length > 0;
  12401. return i = e.isFunction(i) ? i : function () {}, a && !r ? (S.verbose("Triggering event", i), i(), !0) : (S.verbose("Event occurred in dropdown, canceling callback"), !1);
  12402. },
  12403. eventOnElement: function eventOnElement(t, i) {
  12404. var o = e(t.target),
  12405. a = o.closest(D.siblingLabel),
  12406. r = n.body.contains(t.target),
  12407. s = 0 === M.find(a).length,
  12408. l = 0 === o.closest(Q).length;
  12409. return i = e.isFunction(i) ? i : function () {}, r && s && l ? (S.verbose("Triggering event", i), i(), !0) : (S.verbose("Event occurred in dropdown menu, canceling callback"), !1);
  12410. }
  12411. },
  12412. action: {
  12413. nothing: function nothing() {},
  12414. activate: function activate(t, n, o) {
  12415. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  12416. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;
  12417. S.hideAndClear();
  12418. }
  12419. },
  12420. select: function select(t, n, o) {
  12421. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  12422. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;
  12423. S.hideAndClear();
  12424. }
  12425. },
  12426. combo: function combo(t, n, o) {
  12427. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  12428. },
  12429. hide: function hide(e, t, n) {
  12430. S.set.value(t, e), S.hideAndClear();
  12431. }
  12432. },
  12433. get: {
  12434. id: function id() {
  12435. return x;
  12436. },
  12437. defaultText: function defaultText() {
  12438. return M.data(E.defaultText);
  12439. },
  12440. defaultValue: function defaultValue() {
  12441. return M.data(E.defaultValue);
  12442. },
  12443. placeholderText: function placeholderText() {
  12444. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  12445. },
  12446. text: function text() {
  12447. return V.text();
  12448. },
  12449. query: function query() {
  12450. return e.trim(N.val());
  12451. },
  12452. searchWidth: function searchWidth(e) {
  12453. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  12454. },
  12455. selectionCount: function selectionCount() {
  12456. var t = S.get.values();
  12457. return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  12458. },
  12459. transition: function transition(e) {
  12460. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  12461. },
  12462. userValues: function userValues() {
  12463. var t = S.get.values();
  12464. return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  12465. return !1 === S.get.item(e);
  12466. }));
  12467. },
  12468. uniqueArray: function uniqueArray(t) {
  12469. return e.grep(t, function (n, i) {
  12470. return e.inArray(n, t) === i;
  12471. });
  12472. },
  12473. caretPosition: function caretPosition() {
  12474. var e,
  12475. t,
  12476. i = N.get(0);
  12477. return "selectionStart" in i ? i.selectionStart : n.selection ? (i.focus(), t = (e = n.selection.createRange()).text.length, e.moveStart("character", -i.value.length), e.text.length - t) : void 0;
  12478. },
  12479. value: function value() {
  12480. var t = U.length > 0 ? U.val() : M.data(E.value),
  12481. n = e.isArray(t) && 1 === t.length && "" === t[0];
  12482. return t === i || n ? "" : t;
  12483. },
  12484. values: function values() {
  12485. var e = S.get.value();
  12486. return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  12487. },
  12488. remoteValues: function remoteValues() {
  12489. var t = S.get.values(),
  12490. n = !1;
  12491. return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  12492. var i = S.read.remoteData(t);
  12493. S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  12494. })), n;
  12495. },
  12496. choiceText: function choiceText(t, n) {
  12497. if (n = n !== i ? n : k.preserveHTML, t) return t.find(D.menu).length > 0 && (S.verbose("Retrieving text of element with sub-menu"), (t = t.clone()).find(D.menu).remove(), t.find(D.menuIcon).remove()), t.data(E.text) !== i ? t.data(E.text) : n ? e.trim(t.html()) : e.trim(t.text());
  12498. },
  12499. choiceValue: function choiceValue(t, n) {
  12500. return n = n || S.get.choiceText(t), !!t && (t.data(E.value) !== i ? String(t.data(E.value)) : "string" == typeof n ? e.trim(n.toLowerCase()) : String(n));
  12501. },
  12502. inputEvent: function inputEvent() {
  12503. var e = N[0];
  12504. return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  12505. },
  12506. selectValues: function selectValues() {
  12507. var t = {
  12508. values: []
  12509. };
  12510. return M.find("option").each(function () {
  12511. var n = e(this),
  12512. o = n.html(),
  12513. a = n.attr("disabled"),
  12514. r = n.attr("value") !== i ? n.attr("value") : o;
  12515. "auto" === k.placeholder && "" === r ? t.placeholder = o : t.values.push({
  12516. name: o,
  12517. value: r,
  12518. disabled: a
  12519. });
  12520. }), k.placeholder && "auto" !== k.placeholder && (S.debug("Setting placeholder value to", k.placeholder), t.placeholder = k.placeholder), k.sortSelect ? (t.values.sort(function (e, t) {
  12521. return e.name > t.name ? 1 : -1;
  12522. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  12523. },
  12524. activeItem: function activeItem() {
  12525. return X.filter("." + T.active);
  12526. },
  12527. selectedItem: function selectedItem() {
  12528. var e = X.not(D.unselectable).filter("." + T.selected);
  12529. return e.length > 0 ? e : X.eq(0);
  12530. },
  12531. itemWithAdditions: function itemWithAdditions(e) {
  12532. var t = S.get.item(e),
  12533. n = S.create.userChoice(e);
  12534. return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  12535. },
  12536. item: function item(t, n) {
  12537. var o,
  12538. a,
  12539. r = !1;
  12540. return t = t !== i ? t : S.get.values() !== i ? S.get.values() : S.get.text(), o = a ? t.length > 0 : t !== i && null !== t, a = S.is.multiple() && e.isArray(t), n = "" === t || 0 === t || n || !1, o && X.each(function () {
  12541. var o = e(this),
  12542. s = S.get.choiceText(o),
  12543. l = S.get.choiceValue(o, s);
  12544. if (null !== l && l !== i) if (a) -1 === e.inArray(String(l), t) && -1 === e.inArray(s, t) || (r = r ? r.add(o) : o);else if (n) {
  12545. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  12546. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  12547. }), r;
  12548. }
  12549. },
  12550. check: {
  12551. maxSelections: function maxSelections(e) {
  12552. return !k.maxSelections || ((e = e !== i ? e : S.get.selectionCount()) >= k.maxSelections ? (S.debug("Maximum selection count reached"), k.useLabels && (X.addClass(T.filtered), S.add.message(A.maxSelections)), !0) : (S.verbose("No longer at maximum selection count"), S.remove.message(), S.remove.filteredItem(), S.is.searchSelection() && S.filterItems(), !1));
  12553. }
  12554. },
  12555. restore: {
  12556. defaults: function defaults() {
  12557. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  12558. },
  12559. defaultText: function defaultText() {
  12560. var e = S.get.defaultText();
  12561. e === S.get.placeholderText ? (S.debug("Restoring default placeholder text", e), S.set.placeholderText(e)) : (S.debug("Restoring default text", e), S.set.text(e));
  12562. },
  12563. placeholderText: function placeholderText() {
  12564. S.set.placeholderText();
  12565. },
  12566. defaultValue: function defaultValue() {
  12567. var e = S.get.defaultValue();
  12568. e !== i && (S.debug("Restoring default value", e), "" !== e ? (S.set.value(e), S.set.selected()) : (S.remove.activeItem(), S.remove.selectedItem()));
  12569. },
  12570. labels: function labels() {
  12571. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  12572. },
  12573. selected: function selected() {
  12574. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  12575. },
  12576. values: function values() {
  12577. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  12578. },
  12579. remoteValues: function remoteValues() {
  12580. var t = S.get.remoteValues();
  12581. S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  12582. S.set.text(t);
  12583. }) : e.each(t, function (e, t) {
  12584. S.add.label(e, t);
  12585. }));
  12586. }
  12587. },
  12588. read: {
  12589. remoteData: function remoteData(e) {
  12590. var n;
  12591. if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;
  12592. S.error(q.noStorage);
  12593. }
  12594. },
  12595. save: {
  12596. defaults: function defaults() {
  12597. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  12598. },
  12599. defaultValue: function defaultValue() {
  12600. var e = S.get.value();
  12601. S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  12602. },
  12603. defaultText: function defaultText() {
  12604. var e = S.get.text();
  12605. S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  12606. },
  12607. placeholderText: function placeholderText() {
  12608. var e;
  12609. !1 !== k.placeholder && V.hasClass(T.placeholder) && (e = S.get.text(), S.verbose("Saving placeholder text as", e), M.data(E.placeholderText, e));
  12610. },
  12611. remoteData: function remoteData(e, n) {
  12612. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  12613. }
  12614. },
  12615. clear: function clear() {
  12616. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  12617. },
  12618. clearValue: function clearValue() {
  12619. S.set.value("");
  12620. },
  12621. scrollPage: function scrollPage(e, t) {
  12622. var n,
  12623. i,
  12624. o = t || S.get.selectedItem(),
  12625. a = o.closest(D.menu),
  12626. r = a.outerHeight(),
  12627. s = a.scrollTop(),
  12628. l = X.eq(0).outerHeight(),
  12629. c = Math.floor(r / l),
  12630. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  12631. d = X.not(D.unselectable);
  12632. i = "up" == e ? d.index(o) - c : d.index(o) + c, (n = ("up" == e ? i >= 0 : i < d.length) ? d.eq(i) : "up" == e ? d.first() : d.last()).length > 0 && (S.debug("Scrolling page", e, n), o.removeClass(T.selected), n.addClass(T.selected), k.selectOnKeydown && S.is.single() && S.set.selectedItem(n), a.scrollTop(u));
  12633. },
  12634. set: {
  12635. filtered: function filtered() {
  12636. var e = S.is.multiple(),
  12637. t = S.is.searchSelection(),
  12638. n = e && t,
  12639. i = t ? S.get.query() : "",
  12640. o = "string" == typeof i && i.length > 0,
  12641. a = S.get.searchWidth(),
  12642. r = "" !== i;
  12643. e && o && (S.verbose("Adjusting input width", a, k.glyphWidth), N.css("width", a)), o || n && r ? (S.verbose("Hiding placeholder text"), V.addClass(T.filtered)) : (!e || n && !r) && (S.verbose("Showing placeholder text"), V.removeClass(T.filtered));
  12644. },
  12645. empty: function empty() {
  12646. M.addClass(T.empty);
  12647. },
  12648. loading: function loading() {
  12649. M.addClass(T.loading);
  12650. },
  12651. placeholderText: function placeholderText(e) {
  12652. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  12653. },
  12654. tabbable: function tabbable() {
  12655. S.is.searchSelection() ? (S.debug("Added tabindex to searchable dropdown"), N.val("").attr("tabindex", 0), Q.attr("tabindex", -1)) : (S.debug("Added tabindex to dropdown"), M.attr("tabindex") === i && (M.attr("tabindex", 0), Q.attr("tabindex", -1)));
  12656. },
  12657. initialLoad: function initialLoad() {
  12658. S.verbose("Setting initial load"), h = !0;
  12659. },
  12660. activeItem: function activeItem(e) {
  12661. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  12662. },
  12663. partialSearch: function partialSearch(e) {
  12664. var t = S.get.query().length;
  12665. N.val(e.substr(0, t));
  12666. },
  12667. scrollPosition: function scrollPosition(e, t) {
  12668. var n, o, a, r, s, l;
  12669. n = (e = e || S.get.selectedItem()).closest(D.menu), o = e && e.length > 0, t = t !== i && t, e && n.length > 0 && o && (e.position().top, n.addClass(T.loading), a = (r = n.scrollTop()) - n.offset().top + e.offset().top, t || (l = r + n.height() < a + 5, s = a - 5 < r), S.debug("Scrolling to active item", a), (t || s || l) && n.scrollTop(a), n.removeClass(T.loading));
  12670. },
  12671. text: function text(e) {
  12672. "select" !== k.action && ("combo" == k.action ? (S.debug("Changing combo button text", e, B), k.preserveHTML ? B.html(e) : B.text(e)) : (e !== S.get.placeholderText() && V.removeClass(T.placeholder), S.debug("Changing text", e, V), V.removeClass(T.filtered), k.preserveHTML ? V.html(e) : V.text(e)));
  12673. },
  12674. selectedItem: function selectedItem(e) {
  12675. var t = S.get.choiceValue(e),
  12676. n = S.get.choiceText(e, !1),
  12677. i = S.get.choiceText(e, !0);
  12678. S.debug("Setting user selection to item", e), S.remove.activeItem(), S.set.partialSearch(n), S.set.activeItem(e), S.set.selected(t, e), S.set.text(i);
  12679. },
  12680. selectedLetter: function selectedLetter(t) {
  12681. var n,
  12682. i = X.filter("." + T.selected),
  12683. o = !1;
  12684. i.length > 0 && S.has.firstLetter(i, t) && (n = i.nextAll(X).eq(0), S.has.firstLetter(n, t) && (o = n)), o || X.each(function () {
  12685. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  12686. }), o && (S.verbose("Scrolling to next value with letter", t), S.set.scrollPosition(o), i.removeClass(T.selected), o.addClass(T.selected), k.selectOnKeydown && S.is.single() && S.set.selectedItem(o));
  12687. },
  12688. direction: function direction(e) {
  12689. "auto" == k.direction ? (S.remove.upward(), S.can.openDownward(e) ? S.remove.upward(e) : S.set.upward(e), S.is.leftward(e) || S.can.openRightward(e) || S.set.leftward(e)) : "upward" == k.direction && S.set.upward(e);
  12690. },
  12691. upward: function upward(e) {
  12692. (e || M).addClass(T.upward);
  12693. },
  12694. leftward: function leftward(e) {
  12695. (e || Q).addClass(T.leftward);
  12696. },
  12697. value: function value(e, t, n) {
  12698. var o = S.escape.value(e),
  12699. a = U.length > 0,
  12700. r = S.get.values(),
  12701. s = e !== i ? String(e) : e;
  12702. if (a) {
  12703. if (!k.allowReselection && s == r && (S.verbose("Skipping value update already same value", e, r), !S.is.initialLoad())) return;
  12704. S.is.single() && S.has.selectInput() && S.can.extendSelect() && (S.debug("Adding user option", e), S.add.optionValue(e)), S.debug("Updating input value", o, r), Z = !0, U.val(o), !1 === k.fireOnInit && S.is.initialLoad() ? S.debug("Input native change event ignored on initial load") : S.trigger.change(), Z = !1;
  12705. } else S.verbose("Storing value in metadata", o, U), o !== r && M.data(E.value, s);
  12706. !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onChange) : k.onChange.call(K, e, t, n);
  12707. },
  12708. active: function active() {
  12709. M.addClass(T.active);
  12710. },
  12711. multiple: function multiple() {
  12712. M.addClass(T.multiple);
  12713. },
  12714. visible: function visible() {
  12715. M.addClass(T.visible);
  12716. },
  12717. exactly: function exactly(e, t) {
  12718. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  12719. },
  12720. selected: function selected(t, n) {
  12721. var i = S.is.multiple();
  12722. (n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t)) && (S.debug("Setting selected menu item to", n), S.is.multiple() && S.remove.searchWidth(), S.is.single() ? (S.remove.activeItem(), S.remove.selectedItem()) : k.useLabels && S.remove.selectedItem(), n.each(function () {
  12723. var t = e(this),
  12724. o = S.get.choiceText(t),
  12725. a = S.get.choiceValue(t, o),
  12726. r = t.hasClass(T.filtered),
  12727. s = t.hasClass(T.active),
  12728. l = t.hasClass(T.addition),
  12729. c = i && 1 == n.length;
  12730. i ? !s || l ? (k.apiSettings && k.saveRemoteData && S.save.remoteData(o, a), k.useLabels ? (S.add.label(a, o, c), S.add.value(a, o, t), S.set.activeItem(t), S.filterActive(), S.select.nextAvailable(n)) : (S.add.value(a, o, t), S.set.text(S.add.variables(A.count)), S.set.activeItem(t))) : r || (S.debug("Selected active value, removing label"), S.remove.selected(a)) : (k.apiSettings && k.saveRemoteData && S.save.remoteData(o, a), S.set.text(o), S.set.value(a, o, t), t.addClass(T.active).addClass(T.selected));
  12731. }));
  12732. }
  12733. },
  12734. add: {
  12735. label: function label(t, n, i) {
  12736. var o,
  12737. a = S.is.searchSelection() ? N : V,
  12738. r = S.escape.value(t);
  12739. k.ignoreCase && (r = r.toLowerCase()), o = e("<a />").addClass(T.label).attr("data-" + E.value, r).html(j.label(r, n)), o = k.onLabelCreate.call(o, r, n), S.has.label(t) ? S.debug("User selection already exists, skipping", r) : (k.label.variation && o.addClass(k.label.variation), !0 === i ? (S.debug("Animating in label", o), o.addClass(T.hidden).insertBefore(a).transition(k.label.transition, k.label.duration)) : (S.debug("Adding selection label", o), o.insertBefore(a)));
  12740. },
  12741. message: function message(t) {
  12742. var n = Q.children(D.message),
  12743. i = k.templates.message(S.add.variables(t));
  12744. n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  12745. },
  12746. optionValue: function optionValue(t) {
  12747. var n = S.escape.value(t);
  12748. U.find('option[value="' + S.escape.string(n) + '"]').length > 0 || (S.disconnect.selectObserver(), S.is.single() && (S.verbose("Removing previous user addition"), U.find("option." + T.addition).remove()), e("<option/>").prop("value", n).addClass(T.addition).html(t).appendTo(U), S.verbose("Adding user addition as an <option>", t), S.observe.select());
  12749. },
  12750. userSuggestion: function userSuggestion(e) {
  12751. var t,
  12752. n = Q.children(D.addition),
  12753. i = S.get.item(e),
  12754. o = i && i.not(D.addition).length,
  12755. a = n.length > 0;
  12756. k.useLabels && S.has.maxSelections() || ("" === e || o ? n.remove() : (a ? (n.data(E.value, e).data(E.text, e).attr("data-" + E.value, e).attr("data-" + E.text, e).removeClass(T.filtered), k.hideAdditions || (t = k.templates.addition(S.add.variables(A.addResult, e)), n.html(t)), S.verbose("Replacing user suggestion with new value", n)) : ((n = S.create.userChoice(e)).prependTo(Q), S.verbose("Adding item choice to menu corresponding with user choice addition", n)), k.hideAdditions && !S.is.allFiltered() || n.addClass(T.selected).siblings().removeClass(T.selected), S.refreshItems()));
  12757. },
  12758. variables: function variables(e, t) {
  12759. var n,
  12760. i,
  12761. o = -1 !== e.search("{count}"),
  12762. a = -1 !== e.search("{maxCount}"),
  12763. r = -1 !== e.search("{term}");
  12764. return S.verbose("Adding templated variables to message", e), o && (n = S.get.selectionCount(), e = e.replace("{count}", n)), a && (n = S.get.selectionCount(), e = e.replace("{maxCount}", k.maxSelections)), r && (i = t || S.get.query(), e = e.replace("{term}", i)), e;
  12765. },
  12766. value: function value(t, n, i) {
  12767. var o,
  12768. a = S.get.values();
  12769. S.has.value(t) ? S.debug("Value already selected") : "" !== t ? (e.isArray(a) ? (o = a.concat([t]), o = S.get.uniqueArray(o)) : o = [t], S.has.selectInput() ? S.can.extendSelect() && (S.debug("Adding value to select", t, o, U), S.add.optionValue(t)) : (o = o.join(k.delimiter), S.debug("Setting hidden input to delimited value", o, U)), !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("Skipping onadd callback on initial load", k.onAdd) : k.onAdd.call(K, t, n, i), S.set.value(o, t, n, i), S.check.maxSelections()) : S.debug("Cannot select blank values from multiselect");
  12770. }
  12771. },
  12772. remove: {
  12773. active: function active() {
  12774. M.removeClass(T.active);
  12775. },
  12776. activeLabel: function activeLabel() {
  12777. M.find(D.label).removeClass(T.active);
  12778. },
  12779. empty: function empty() {
  12780. M.removeClass(T.empty);
  12781. },
  12782. loading: function loading() {
  12783. M.removeClass(T.loading);
  12784. },
  12785. initialLoad: function initialLoad() {
  12786. h = !1;
  12787. },
  12788. upward: function upward(e) {
  12789. (e || M).removeClass(T.upward);
  12790. },
  12791. leftward: function leftward(e) {
  12792. (e || Q).removeClass(T.leftward);
  12793. },
  12794. visible: function visible() {
  12795. M.removeClass(T.visible);
  12796. },
  12797. activeItem: function activeItem() {
  12798. X.removeClass(T.active);
  12799. },
  12800. filteredItem: function filteredItem() {
  12801. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  12802. },
  12803. optionValue: function optionValue(e) {
  12804. var t = S.escape.value(e),
  12805. n = U.find('option[value="' + S.escape.string(t) + '"]');
  12806. n.length > 0 && n.hasClass(T.addition) && (C && (C.disconnect(), S.verbose("Temporarily disconnecting mutation observer")), n.remove(), S.verbose("Removing user addition as an <option>", t), C && C.observe(U[0], {
  12807. childList: !0,
  12808. subtree: !0
  12809. }));
  12810. },
  12811. message: function message() {
  12812. Q.children(D.message).remove();
  12813. },
  12814. searchWidth: function searchWidth() {
  12815. N.css("width", "");
  12816. },
  12817. searchTerm: function searchTerm() {
  12818. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  12819. },
  12820. userAddition: function userAddition() {
  12821. X.filter(D.addition).remove();
  12822. },
  12823. selected: function selected(t, n) {
  12824. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;
  12825. n.each(function () {
  12826. var t = e(this),
  12827. n = S.get.choiceText(t),
  12828. i = S.get.choiceValue(t, n);
  12829. S.is.multiple() ? k.useLabels ? (S.remove.value(i, n, t), S.remove.label(i)) : (S.remove.value(i, n, t), 0 === S.get.selectionCount() ? S.set.placeholderText() : S.set.text(S.add.variables(A.count))) : S.remove.value(i, n, t), t.removeClass(T.filtered).removeClass(T.active), k.useLabels && t.removeClass(T.selected);
  12830. });
  12831. },
  12832. selectedItem: function selectedItem() {
  12833. X.removeClass(T.selected);
  12834. },
  12835. value: function value(e, t, n) {
  12836. var i,
  12837. o = S.get.values();
  12838. S.has.selectInput() ? (S.verbose("Input is <select> removing selected option", e), i = S.remove.arrayValue(e, o), S.remove.optionValue(e)) : (S.verbose("Removing from delimited values", e), i = (i = S.remove.arrayValue(e, o)).join(k.delimiter)), !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onRemove) : k.onRemove.call(K, e, t, n), S.set.value(i, t, n), S.check.maxSelections();
  12839. },
  12840. arrayValue: function arrayValue(t, n) {
  12841. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  12842. return t != e;
  12843. }), S.verbose("Removed value from delimited string", t, n), n;
  12844. },
  12845. label: function label(e, t) {
  12846. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');
  12847. S.verbose("Removing label", n), n.remove();
  12848. },
  12849. activeLabels: function activeLabels(e) {
  12850. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  12851. },
  12852. labels: function labels(t) {
  12853. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  12854. var t = e(this),
  12855. n = t.data(E.value),
  12856. o = n !== i ? String(n) : n,
  12857. a = S.is.userValue(o);
  12858. !1 !== k.onLabelRemove.call(t, n) ? (S.remove.message(), a ? (S.remove.value(o), S.remove.label(o)) : S.remove.selected(o)) : S.debug("Label remove callback cancelled removal");
  12859. });
  12860. },
  12861. tabbable: function tabbable() {
  12862. S.is.searchSelection() ? (S.debug("Searchable dropdown initialized"), N.removeAttr("tabindex"), Q.removeAttr("tabindex")) : (S.debug("Simple selection dropdown initialized"), M.removeAttr("tabindex"), Q.removeAttr("tabindex"));
  12863. }
  12864. },
  12865. has: {
  12866. menuSearch: function menuSearch() {
  12867. return S.has.search() && N.closest(Q).length > 0;
  12868. },
  12869. search: function search() {
  12870. return N.length > 0;
  12871. },
  12872. sizer: function sizer() {
  12873. return H.length > 0;
  12874. },
  12875. selectInput: function selectInput() {
  12876. return U.is("select");
  12877. },
  12878. minCharacters: function minCharacters(e) {
  12879. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  12880. },
  12881. firstLetter: function firstLetter(e, t) {
  12882. var n;
  12883. return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  12884. },
  12885. input: function input() {
  12886. return U.length > 0;
  12887. },
  12888. items: function items() {
  12889. return X.length > 0;
  12890. },
  12891. menu: function menu() {
  12892. return Q.length > 0;
  12893. },
  12894. message: function message() {
  12895. return 0 !== Q.children(D.message).length;
  12896. },
  12897. label: function label(e) {
  12898. var t = S.escape.value(e),
  12899. n = M.find(D.label);
  12900. return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  12901. },
  12902. maxSelections: function maxSelections() {
  12903. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  12904. },
  12905. allResultsFiltered: function allResultsFiltered() {
  12906. var e = X.not(D.addition);
  12907. return e.filter(D.unselectable).length === e.length;
  12908. },
  12909. userSuggestion: function userSuggestion() {
  12910. return Q.children(D.addition).length > 0;
  12911. },
  12912. query: function query() {
  12913. return "" !== S.get.query();
  12914. },
  12915. value: function value(e) {
  12916. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  12917. },
  12918. valueMatchingCase: function valueMatchingCase(t) {
  12919. var n = S.get.values();
  12920. return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  12921. },
  12922. valueIgnoringCase: function valueIgnoringCase(t) {
  12923. var n = S.get.values(),
  12924. i = !1;
  12925. return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  12926. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  12927. }), i;
  12928. }
  12929. },
  12930. is: {
  12931. active: function active() {
  12932. return M.hasClass(T.active);
  12933. },
  12934. animatingInward: function animatingInward() {
  12935. return Q.transition("is inward");
  12936. },
  12937. animatingOutward: function animatingOutward() {
  12938. return Q.transition("is outward");
  12939. },
  12940. bubbledLabelClick: function bubbledLabelClick(t) {
  12941. return e(t.target).is("select, input") && M.closest("label").length > 0;
  12942. },
  12943. bubbledIconClick: function bubbledIconClick(t) {
  12944. return e(t.target).closest(W).length > 0;
  12945. },
  12946. alreadySetup: function alreadySetup() {
  12947. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  12948. },
  12949. animating: function animating(e) {
  12950. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  12951. },
  12952. leftward: function leftward(e) {
  12953. return (e || Q).hasClass(T.leftward);
  12954. },
  12955. disabled: function disabled() {
  12956. return M.hasClass(T.disabled);
  12957. },
  12958. focused: function focused() {
  12959. return n.activeElement === M[0];
  12960. },
  12961. focusedOnSearch: function focusedOnSearch() {
  12962. return n.activeElement === N[0];
  12963. },
  12964. allFiltered: function allFiltered() {
  12965. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  12966. },
  12967. hidden: function hidden(e) {
  12968. return !S.is.visible(e);
  12969. },
  12970. initialLoad: function initialLoad() {
  12971. return h;
  12972. },
  12973. inObject: function inObject(t, n) {
  12974. var i = !1;
  12975. return e.each(n, function (e, n) {
  12976. if (n == t) return i = !0, !0;
  12977. }), i;
  12978. },
  12979. multiple: function multiple() {
  12980. return M.hasClass(T.multiple);
  12981. },
  12982. remote: function remote() {
  12983. return k.apiSettings && S.can.useAPI();
  12984. },
  12985. single: function single() {
  12986. return !S.is.multiple();
  12987. },
  12988. selectMutation: function selectMutation(t) {
  12989. var n = !1;
  12990. return e.each(t, function (t, i) {
  12991. if (i.target && e(i.target).is("select")) return n = !0, !0;
  12992. }), n;
  12993. },
  12994. search: function search() {
  12995. return M.hasClass(T.search);
  12996. },
  12997. searchSelection: function searchSelection() {
  12998. return S.has.search() && 1 === N.parent(D.dropdown).length;
  12999. },
  13000. selection: function selection() {
  13001. return M.hasClass(T.selection);
  13002. },
  13003. userValue: function userValue(t) {
  13004. return -1 !== e.inArray(t, S.get.userValues());
  13005. },
  13006. upward: function upward(e) {
  13007. return (e || M).hasClass(T.upward);
  13008. },
  13009. visible: function visible(e) {
  13010. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  13011. },
  13012. verticallyScrollableContext: function verticallyScrollableContext() {
  13013. var e = L.get(0) !== t && L.css("overflow-y");
  13014. return "auto" == e || "scroll" == e;
  13015. },
  13016. horizontallyScrollableContext: function horizontallyScrollableContext() {
  13017. var e = L.get(0) !== t && L.css("overflow-X");
  13018. return "auto" == e || "scroll" == e;
  13019. }
  13020. },
  13021. can: {
  13022. activate: function activate(e) {
  13023. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  13024. },
  13025. openDownward: function openDownward(e) {
  13026. var n,
  13027. i,
  13028. o = e || Q,
  13029. a = !0;
  13030. return o.addClass(T.loading), i = {
  13031. context: {
  13032. offset: L.get(0) === t ? {
  13033. top: 0,
  13034. left: 0
  13035. } : L.offset(),
  13036. scrollTop: L.scrollTop(),
  13037. height: L.outerHeight()
  13038. },
  13039. menu: {
  13040. offset: o.offset(),
  13041. height: o.outerHeight()
  13042. }
  13043. }, S.is.verticallyScrollableContext() && (i.menu.offset.top += i.context.scrollTop), (n = {
  13044. above: i.context.scrollTop <= i.menu.offset.top - i.context.offset.top - i.menu.height,
  13045. below: i.context.scrollTop + i.context.height >= i.menu.offset.top - i.context.offset.top + i.menu.height
  13046. }).below ? (S.verbose("Dropdown can fit in context downward", n), a = !0) : n.below || n.above ? (S.verbose("Dropdown cannot fit below, opening upward", n), a = !1) : (S.verbose("Dropdown cannot fit in either direction, favoring downward", n), a = !0), o.removeClass(T.loading), a;
  13047. },
  13048. openRightward: function openRightward(e) {
  13049. var n,
  13050. i,
  13051. o = e || Q,
  13052. a = !0;
  13053. return o.addClass(T.loading), i = {
  13054. context: {
  13055. offset: L.get(0) === t ? {
  13056. top: 0,
  13057. left: 0
  13058. } : L.offset(),
  13059. scrollLeft: L.scrollLeft(),
  13060. width: L.outerWidth()
  13061. },
  13062. menu: {
  13063. offset: o.offset(),
  13064. width: o.outerWidth()
  13065. }
  13066. }, S.is.horizontallyScrollableContext() && (i.menu.offset.left += i.context.scrollLeft), (n = i.menu.offset.left - i.context.offset.left + i.menu.width >= i.context.scrollLeft + i.context.width) && (S.verbose("Dropdown cannot fit in context rightward", n), a = !1), o.removeClass(T.loading), a;
  13067. },
  13068. click: function click() {
  13069. return c || "click" == k.on;
  13070. },
  13071. extendSelect: function extendSelect() {
  13072. return k.allowAdditions || k.apiSettings;
  13073. },
  13074. show: function show() {
  13075. return !S.is.disabled() && (S.has.items() || S.has.message());
  13076. },
  13077. useAPI: function useAPI() {
  13078. return e.fn.api !== i;
  13079. }
  13080. },
  13081. animate: {
  13082. show: function show(t, n) {
  13083. var o,
  13084. a = n || Q,
  13085. r = n ? function () {} : function () {
  13086. S.hideSubMenus(), S.hideOthers(), S.set.active();
  13087. };
  13088. t = e.isFunction(t) ? t : function () {}, S.verbose("Doing menu show animation", a), S.set.direction(n), o = S.get.transition(n), S.is.selection() && S.set.scrollPosition(S.get.selectedItem(), !0), (S.is.hidden(a) || S.is.animating(a)) && ("none" == o ? (r(), a.transition("show"), t.call(K)) : e.fn.transition !== i && M.transition("is supported") ? a.transition({
  13089. animation: o + " in",
  13090. debug: k.debug,
  13091. verbose: k.verbose,
  13092. duration: k.duration,
  13093. queue: !0,
  13094. onStart: r,
  13095. onComplete: function onComplete() {
  13096. t.call(K);
  13097. }
  13098. }) : S.error(q.noTransition, o));
  13099. },
  13100. hide: function hide(t, n) {
  13101. var o = n || Q,
  13102. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  13103. S.can.click() && S.unbind.intent(), S.remove.active();
  13104. }),
  13105. r = S.get.transition(n);
  13106. t = e.isFunction(t) ? t : function () {}, (S.is.visible(o) || S.is.animating(o)) && (S.verbose("Doing menu hide animation", o), "none" == r ? (a(), o.transition("hide"), t.call(K)) : e.fn.transition !== i && M.transition("is supported") ? o.transition({
  13107. animation: r + " out",
  13108. duration: k.duration,
  13109. debug: k.debug,
  13110. verbose: k.verbose,
  13111. queue: !1,
  13112. onStart: a,
  13113. onComplete: function onComplete() {
  13114. t.call(K);
  13115. }
  13116. }) : S.error(q.transition));
  13117. }
  13118. },
  13119. hideAndClear: function hideAndClear() {
  13120. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  13121. S.remove.filteredItem();
  13122. }) : S.hide());
  13123. },
  13124. delay: {
  13125. show: function show() {
  13126. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  13127. },
  13128. hide: function hide() {
  13129. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  13130. }
  13131. },
  13132. escape: {
  13133. value: function value(t) {
  13134. var n = e.isArray(t),
  13135. i = "string" == typeof t,
  13136. o = !i && !n,
  13137. a = i && -1 !== t.search(O.quote),
  13138. r = [];
  13139. return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  13140. r.push(t.replace(O.quote, "&quot;"));
  13141. }), r) : t.replace(O.quote, "&quot;"));
  13142. },
  13143. string: function string(e) {
  13144. return (e = String(e)).replace(O.escape, "\\$&");
  13145. }
  13146. },
  13147. setting: function setting(t, n) {
  13148. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  13149. if (n === i) return k[t];
  13150. e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  13151. }
  13152. },
  13153. internal: function internal(t, n) {
  13154. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  13155. if (n === i) return S[t];
  13156. S[t] = n;
  13157. }
  13158. },
  13159. debug: function debug() {
  13160. !k.silent && k.debug && (k.performance ? S.performance.log(arguments) : (S.debug = Function.prototype.bind.call(console.info, console, k.name + ":"), S.debug.apply(console, arguments)));
  13161. },
  13162. verbose: function verbose() {
  13163. !k.silent && k.verbose && k.debug && (k.performance ? S.performance.log(arguments) : (S.verbose = Function.prototype.bind.call(console.info, console, k.name + ":"), S.verbose.apply(console, arguments)));
  13164. },
  13165. error: function error() {
  13166. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  13167. },
  13168. performance: {
  13169. log: function log(e) {
  13170. var t, n;
  13171. k.performance && (n = (t = new Date().getTime()) - (u || t), u = t, d.push({
  13172. Name: e[0],
  13173. Arguments: [].slice.call(e, 1) || "",
  13174. Element: K,
  13175. "Execution Time": n
  13176. })), clearTimeout(S.performance.timer), S.performance.timer = setTimeout(S.performance.display, 500);
  13177. },
  13178. display: function display() {
  13179. var t = k.name + ":",
  13180. n = 0;
  13181. u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  13182. n += t["Execution Time"];
  13183. }), t += " " + n + "ms", l && (t += " '" + l + "'"), (console.group !== i || console.table !== i) && d.length > 0 && (console.groupCollapsed(t), console.table ? console.table(d) : e.each(d, function (e, t) {
  13184. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13185. }), console.groupEnd()), d = [];
  13186. }
  13187. },
  13188. invoke: function invoke(t, n, o) {
  13189. var r,
  13190. s,
  13191. l,
  13192. c = J;
  13193. return n = n || g, o = K || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13194. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  13195. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13196. if (c[a] !== i) return s = c[a], !1;
  13197. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (S.error(q.method, t), !1);
  13198. c = c[o];
  13199. }
  13200. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  13201. }
  13202. }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  13203. }), a !== i ? a : r;
  13204. }, e.fn.dropdown.settings = {
  13205. silent: !1,
  13206. debug: !1,
  13207. verbose: !1,
  13208. performance: !0,
  13209. on: "click",
  13210. action: "activate",
  13211. values: !1,
  13212. apiSettings: !1,
  13213. selectOnKeydown: !0,
  13214. minCharacters: 0,
  13215. filterRemoteData: !1,
  13216. saveRemoteData: !0,
  13217. throttle: 200,
  13218. context: t,
  13219. direction: "auto",
  13220. keepOnScreen: !0,
  13221. match: "both",
  13222. fullTextSearch: !1,
  13223. placeholder: "auto",
  13224. preserveHTML: !0,
  13225. sortSelect: !1,
  13226. forceSelection: !0,
  13227. allowAdditions: !1,
  13228. ignoreCase: !1,
  13229. hideAdditions: !0,
  13230. maxSelections: !1,
  13231. useLabels: !0,
  13232. delimiter: ",",
  13233. showOnFocus: !0,
  13234. allowReselection: !1,
  13235. allowTab: !0,
  13236. allowCategorySelection: !1,
  13237. fireOnInit: !1,
  13238. transition: "auto",
  13239. duration: 200,
  13240. glyphWidth: 1.037,
  13241. label: {
  13242. transition: "scale",
  13243. duration: 200,
  13244. variation: !1
  13245. },
  13246. delay: {
  13247. hide: 300,
  13248. show: 200,
  13249. search: 20,
  13250. touch: 50
  13251. },
  13252. onChange: function onChange(e, t, n) {},
  13253. onAdd: function onAdd(e, t, n) {},
  13254. onRemove: function onRemove(e, t, n) {},
  13255. onLabelSelect: function onLabelSelect(e) {},
  13256. onLabelCreate: function onLabelCreate(t, n) {
  13257. return e(this);
  13258. },
  13259. onLabelRemove: function onLabelRemove(e) {
  13260. return !0;
  13261. },
  13262. onNoResults: function onNoResults(e) {
  13263. return !0;
  13264. },
  13265. onShow: function onShow() {},
  13266. onHide: function onHide() {},
  13267. name: "Dropdown",
  13268. namespace: "dropdown",
  13269. message: {
  13270. addResult: "Add <b>{term}</b>",
  13271. count: "{count} selected",
  13272. maxSelections: "Max {maxCount} selections",
  13273. noResults: "No results found.",
  13274. serverError: "There was an error contacting the server"
  13275. },
  13276. error: {
  13277. action: "You called a dropdown action that was not defined",
  13278. alreadySetup: "Once a select has been initialized behaviors must be called on the created ui dropdown",
  13279. labels: "Allowing user additions currently requires the use of labels.",
  13280. missingMultiple: "<select> requires multiple property to be set to correctly preserve multiple values",
  13281. method: "The method you called is not defined.",
  13282. noAPI: "The API module is required to load resources remotely",
  13283. noStorage: "Saving remote data requires session storage",
  13284. noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>"
  13285. },
  13286. regExp: {
  13287. escape: /[-[\]{}()*+?.,\\^$|#\s]/g,
  13288. quote: /"/g
  13289. },
  13290. metadata: {
  13291. defaultText: "defaultText",
  13292. defaultValue: "defaultValue",
  13293. placeholderText: "placeholder",
  13294. text: "text",
  13295. value: "value"
  13296. },
  13297. fields: {
  13298. remoteValues: "results",
  13299. values: "values",
  13300. disabled: "disabled",
  13301. name: "name",
  13302. value: "value",
  13303. text: "text"
  13304. },
  13305. keys: {
  13306. backspace: 8,
  13307. delimiter: 188,
  13308. deleteKey: 46,
  13309. enter: 13,
  13310. escape: 27,
  13311. pageUp: 33,
  13312. pageDown: 34,
  13313. leftArrow: 37,
  13314. upArrow: 38,
  13315. rightArrow: 39,
  13316. downArrow: 40
  13317. },
  13318. selector: {
  13319. addition: ".addition",
  13320. dropdown: ".ui.dropdown",
  13321. hidden: ".hidden",
  13322. icon: "> .dropdown.icon",
  13323. input: '> input[type="hidden"], > select',
  13324. item: ".item",
  13325. label: "> .label",
  13326. remove: "> .label > .delete.icon",
  13327. siblingLabel: ".label",
  13328. menu: ".menu",
  13329. message: ".message",
  13330. menuIcon: ".dropdown.icon",
  13331. search: "input.search, .menu > .search > input, .menu input.search",
  13332. sizer: "> input.sizer",
  13333. text: "> .text:not(.icon)",
  13334. unselectable: ".disabled, .filtered"
  13335. },
  13336. className: {
  13337. active: "active",
  13338. addition: "addition",
  13339. animating: "animating",
  13340. disabled: "disabled",
  13341. empty: "empty",
  13342. dropdown: "ui dropdown",
  13343. filtered: "filtered",
  13344. hidden: "hidden transition",
  13345. item: "item",
  13346. label: "ui label",
  13347. loading: "loading",
  13348. menu: "menu",
  13349. message: "message",
  13350. multiple: "multiple",
  13351. placeholder: "default",
  13352. sizer: "sizer",
  13353. search: "search",
  13354. selected: "selected",
  13355. selection: "selection",
  13356. upward: "upward",
  13357. leftward: "left",
  13358. visible: "visible"
  13359. }
  13360. }, e.fn.dropdown.settings.templates = {
  13361. dropdown: function dropdown(t) {
  13362. var n = t.placeholder || !1,
  13363. i = (t.values, "");
  13364. return i += '<i class="dropdown icon"></i>', t.placeholder ? i += '<div class="default text">' + n + "</div>" : i += '<div class="text"></div>', i += '<div class="menu">', e.each(t.values, function (e, t) {
  13365. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  13366. }), i += "</div>";
  13367. },
  13368. menu: function menu(t, n) {
  13369. var i = t[n.values] || {},
  13370. o = "";
  13371. return e.each(i, function (e, t) {
  13372. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  13373. a = t[n.disabled] ? "disabled " : "";
  13374. o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  13375. }), o;
  13376. },
  13377. label: function label(e, t) {
  13378. return t + '<i class="delete icon"></i>';
  13379. },
  13380. message: function message(e) {
  13381. return e;
  13382. },
  13383. addition: function addition(e) {
  13384. return e;
  13385. }
  13386. };
  13387. }(jQuery, window, document), function (e, t, n, i) {
  13388. "use strict";
  13389. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  13390. var o,
  13391. a = e(this),
  13392. r = a.selector || "",
  13393. s = new Date().getTime(),
  13394. l = [],
  13395. c = arguments[0],
  13396. u = "string" == typeof c,
  13397. d = [].slice.call(arguments, 1);
  13398. return a.each(function () {
  13399. var f,
  13400. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  13401. g = m.selector,
  13402. p = m.className,
  13403. h = m.sources,
  13404. v = m.error,
  13405. b = m.metadata,
  13406. y = m.namespace,
  13407. x = m.templates,
  13408. C = "." + y,
  13409. w = "module-" + y,
  13410. S = (e(t), e(this)),
  13411. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  13412. T = this,
  13413. A = S.data(w);
  13414. f = {
  13415. initialize: function initialize() {
  13416. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  13417. },
  13418. instantiate: function instantiate() {
  13419. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  13420. },
  13421. destroy: function destroy() {
  13422. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  13423. },
  13424. refresh: function refresh() {
  13425. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  13426. },
  13427. bind: {
  13428. events: function events() {
  13429. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  13430. }
  13431. },
  13432. create: function create() {
  13433. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  13434. },
  13435. createPlaceholder: function createPlaceholder(e) {
  13436. var t = f.get.icon(),
  13437. n = f.get.url();
  13438. f.generate.embed(n);
  13439. e = e || f.get.placeholder(), S.html(x.placeholder(e, t)), f.debug("Creating placeholder for embed", e, t);
  13440. },
  13441. createEmbed: function createEmbed(t) {
  13442. f.refresh(), t = t || f.get.url(), k = e("<div/>").addClass(p.embed).html(f.generate.embed(t)).appendTo(S), m.onCreate.call(T, t), f.debug("Creating embed object", k);
  13443. },
  13444. changeEmbed: function changeEmbed(e) {
  13445. k.html(f.generate.embed(e));
  13446. },
  13447. createAndShow: function createAndShow() {
  13448. f.createEmbed(), f.show();
  13449. },
  13450. change: function change(e, t, n) {
  13451. f.debug("Changing video to ", e, t, n), S.data(b.source, e).data(b.id, t), n ? S.data(b.url, n) : S.removeData(b.url), f.has.embed() ? f.changeEmbed() : f.create();
  13452. },
  13453. reset: function reset() {
  13454. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  13455. },
  13456. show: function show() {
  13457. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  13458. },
  13459. hide: function hide() {
  13460. f.debug("Hiding embed"), f.showPlaceholder();
  13461. },
  13462. showPlaceholder: function showPlaceholder() {
  13463. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  13464. },
  13465. get: {
  13466. id: function id() {
  13467. return m.id || S.data(b.id);
  13468. },
  13469. placeholder: function placeholder() {
  13470. return m.placeholder || S.data(b.placeholder);
  13471. },
  13472. icon: function icon() {
  13473. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  13474. },
  13475. source: function source(e) {
  13476. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  13477. },
  13478. type: function type() {
  13479. var e = f.get.source();
  13480. return h[e] !== i && h[e].type;
  13481. },
  13482. url: function url() {
  13483. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  13484. }
  13485. },
  13486. determine: {
  13487. autoplay: function autoplay() {
  13488. f.should.autoplay() && (m.autoplay = !0);
  13489. },
  13490. source: function source(t) {
  13491. var n = !1;
  13492. return (t = t || f.get.url()) && e.each(h, function (e, i) {
  13493. if (-1 !== t.search(i.domain)) return n = e, !1;
  13494. }), n;
  13495. },
  13496. icon: function icon() {
  13497. var e = f.get.source();
  13498. return h[e] !== i && h[e].icon;
  13499. },
  13500. url: function url() {
  13501. var e,
  13502. t = m.id || S.data(b.id),
  13503. n = m.source || S.data(b.source);
  13504. return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  13505. }
  13506. },
  13507. set: {
  13508. active: function active() {
  13509. S.addClass(p.active);
  13510. }
  13511. },
  13512. remove: {
  13513. active: function active() {
  13514. S.removeClass(p.active);
  13515. },
  13516. embed: function embed() {
  13517. k.empty();
  13518. }
  13519. },
  13520. encode: {
  13521. parameters: function parameters(e) {
  13522. var t,
  13523. n = [];
  13524. for (t in e) {
  13525. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  13526. }
  13527. return n.join("&amp;");
  13528. }
  13529. },
  13530. generate: {
  13531. embed: function embed(e) {
  13532. f.debug("Generating embed html");
  13533. var t,
  13534. n,
  13535. i = f.get.source();
  13536. return (e = f.get.url(e)) ? (n = f.generate.parameters(i), t = x.iframe(e, n)) : f.error(v.noURL, S), t;
  13537. },
  13538. parameters: function parameters(t, n) {
  13539. var o = h[t] && h[t].parameters !== i ? h[t].parameters(m) : {};
  13540. return (n = n || m.parameters) && (o = e.extend({}, o, n)), o = m.onEmbed(o), f.encode.parameters(o);
  13541. }
  13542. },
  13543. has: {
  13544. embed: function embed() {
  13545. return k.length > 0;
  13546. },
  13547. placeholder: function placeholder() {
  13548. return m.placeholder || S.data(b.placeholder);
  13549. }
  13550. },
  13551. should: {
  13552. autoplay: function autoplay() {
  13553. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  13554. }
  13555. },
  13556. is: {
  13557. video: function video() {
  13558. return "video" == f.get.type();
  13559. }
  13560. },
  13561. setting: function setting(t, n) {
  13562. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13563. if (n === i) return m[t];
  13564. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13565. }
  13566. },
  13567. internal: function internal(t, n) {
  13568. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  13569. if (n === i) return f[t];
  13570. f[t] = n;
  13571. }
  13572. },
  13573. debug: function debug() {
  13574. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  13575. },
  13576. verbose: function verbose() {
  13577. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  13578. },
  13579. error: function error() {
  13580. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  13581. },
  13582. performance: {
  13583. log: function log(e) {
  13584. var t, n;
  13585. m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  13586. Name: e[0],
  13587. Arguments: [].slice.call(e, 1) || "",
  13588. Element: T,
  13589. "Execution Time": n
  13590. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  13591. },
  13592. display: function display() {
  13593. var t = m.name + ":",
  13594. n = 0;
  13595. s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  13596. n += t["Execution Time"];
  13597. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  13598. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13599. }), console.groupEnd()), l = [];
  13600. }
  13601. },
  13602. invoke: function invoke(t, n, a) {
  13603. var r,
  13604. s,
  13605. l,
  13606. c = A;
  13607. return n = n || d, a = T || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  13608. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  13609. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13610. if (c[a] !== i) return s = c[a], !1;
  13611. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);
  13612. c = c[o];
  13613. }
  13614. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  13615. }
  13616. }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  13617. }), o !== i ? o : this;
  13618. }, e.fn.embed.settings = {
  13619. name: "Embed",
  13620. namespace: "embed",
  13621. silent: !1,
  13622. debug: !1,
  13623. verbose: !1,
  13624. performance: !0,
  13625. icon: !1,
  13626. source: !1,
  13627. url: !1,
  13628. id: !1,
  13629. autoplay: "auto",
  13630. color: "#444444",
  13631. hd: !0,
  13632. brandedUI: !1,
  13633. parameters: !1,
  13634. onDisplay: function onDisplay() {},
  13635. onPlaceholderDisplay: function onPlaceholderDisplay() {},
  13636. onReset: function onReset() {},
  13637. onCreate: function onCreate(e) {},
  13638. onEmbed: function onEmbed(e) {
  13639. return e;
  13640. },
  13641. metadata: {
  13642. id: "id",
  13643. icon: "icon",
  13644. placeholder: "placeholder",
  13645. source: "source",
  13646. url: "url"
  13647. },
  13648. error: {
  13649. noURL: "No URL specified",
  13650. method: "The method you called is not defined"
  13651. },
  13652. className: {
  13653. active: "active",
  13654. embed: "embed"
  13655. },
  13656. selector: {
  13657. embed: ".embed",
  13658. placeholder: ".placeholder",
  13659. icon: ".icon"
  13660. },
  13661. sources: {
  13662. youtube: {
  13663. name: "youtube",
  13664. type: "video",
  13665. icon: "video play",
  13666. domain: "youtube.com",
  13667. url: "//www.youtube.com/embed/{id}",
  13668. parameters: function parameters(e) {
  13669. return {
  13670. autohide: !e.brandedUI,
  13671. autoplay: e.autoplay,
  13672. color: e.color || i,
  13673. hq: e.hd,
  13674. jsapi: e.api,
  13675. modestbranding: !e.brandedUI
  13676. };
  13677. }
  13678. },
  13679. vimeo: {
  13680. name: "vimeo",
  13681. type: "video",
  13682. icon: "video play",
  13683. domain: "vimeo.com",
  13684. url: "//player.vimeo.com/video/{id}",
  13685. parameters: function parameters(e) {
  13686. return {
  13687. api: e.api,
  13688. autoplay: e.autoplay,
  13689. byline: e.brandedUI,
  13690. color: e.color || i,
  13691. portrait: e.brandedUI,
  13692. title: e.brandedUI
  13693. };
  13694. }
  13695. }
  13696. },
  13697. templates: {
  13698. iframe: function iframe(e, t) {
  13699. var n = e;
  13700. return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  13701. },
  13702. placeholder: function placeholder(e, t) {
  13703. var n = "";
  13704. return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  13705. }
  13706. },
  13707. api: !1,
  13708. onPause: function onPause() {},
  13709. onPlay: function onPlay() {},
  13710. onStop: function onStop() {}
  13711. };
  13712. }(jQuery, window, document), function (e, t, n, i) {
  13713. "use strict";
  13714. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  13715. var a,
  13716. r = e(this),
  13717. s = e(t),
  13718. l = e(n),
  13719. c = e("body"),
  13720. u = r.selector || "",
  13721. d = new Date().getTime(),
  13722. f = [],
  13723. m = arguments[0],
  13724. g = "string" == typeof m,
  13725. p = [].slice.call(arguments, 1),
  13726. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13727. setTimeout(e, 0);
  13728. };
  13729. return r.each(function () {
  13730. var r,
  13731. v,
  13732. b,
  13733. y,
  13734. x,
  13735. C,
  13736. w,
  13737. S,
  13738. k,
  13739. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  13740. A = T.selector,
  13741. R = T.className,
  13742. P = T.namespace,
  13743. E = T.error,
  13744. F = "." + P,
  13745. O = "module-" + P,
  13746. D = e(this),
  13747. q = e(T.context),
  13748. j = D.find(A.close),
  13749. z = this,
  13750. I = D.data(O),
  13751. M = !1;
  13752. k = {
  13753. initialize: function initialize() {
  13754. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  13755. },
  13756. instantiate: function instantiate() {
  13757. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  13758. },
  13759. create: {
  13760. dimmer: function dimmer() {
  13761. var t = {
  13762. debug: T.debug,
  13763. variation: !T.centered && "top aligned",
  13764. dimmerName: "modals"
  13765. },
  13766. n = e.extend(!0, t, T.dimmerSettings);
  13767. e.fn.dimmer !== i ? (k.debug("Creating dimmer"), y = q.dimmer(n), T.detachable ? (k.verbose("Modal is detachable, moving content into dimmer"), y.dimmer("add content", D)) : k.set.undetached(), x = y.dimmer("get dimmer")) : k.error(E.dimmer);
  13768. },
  13769. id: function id() {
  13770. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  13771. }
  13772. },
  13773. destroy: function destroy() {
  13774. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  13775. },
  13776. observeChanges: function observeChanges() {
  13777. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  13778. k.debug("DOM tree modified, refreshing"), k.refresh();
  13779. })).observe(z, {
  13780. childList: !0,
  13781. subtree: !0
  13782. }), k.debug("Setting up mutation observer", S));
  13783. },
  13784. refresh: function refresh() {
  13785. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  13786. },
  13787. refreshModals: function refreshModals() {
  13788. v = D.siblings(A.modal), r = v.add(D);
  13789. },
  13790. attachEvents: function attachEvents(t, n) {
  13791. var i = e(t);
  13792. n = e.isFunction(k[n]) ? k[n] : k.toggle, i.length > 0 ? (k.debug("Attaching modal events to element", t, n), i.off(F).on("click" + F, n)) : k.error(E.notFound, t);
  13793. },
  13794. bind: {
  13795. events: function events() {
  13796. k.verbose("Attaching events"), D.on("click" + F, A.close, k.event.close).on("click" + F, A.approve, k.event.approve).on("click" + F, A.deny, k.event.deny), s.on("resize" + C, k.event.resize);
  13797. }
  13798. },
  13799. get: {
  13800. id: function id() {
  13801. return (Math.random().toString(16) + "000000000").substr(2, 8);
  13802. }
  13803. },
  13804. event: {
  13805. approve: function approve() {
  13806. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  13807. M = !1;
  13808. }));
  13809. },
  13810. deny: function deny() {
  13811. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  13812. M = !1;
  13813. }));
  13814. },
  13815. close: function close() {
  13816. k.hide();
  13817. },
  13818. click: function click(t) {
  13819. if (T.closable) {
  13820. var i = e(t.target).closest(A.modal).length > 0,
  13821. o = e.contains(n.documentElement, t.target);
  13822. !i && o && k.is.active() && (k.debug("Dimmer clicked, hiding all modals"), k.remove.clickaway(), T.allowMultiple ? k.hide() : k.hideAll());
  13823. } else k.verbose("Dimmer clicked but closable setting is disabled");
  13824. },
  13825. debounce: function debounce(e, t) {
  13826. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  13827. },
  13828. keyboard: function keyboard(e) {
  13829. 27 == e.which && (T.closable ? (k.debug("Escape key pressed hiding modal"), k.hide()) : k.debug("Escape key pressed, but closable is set to false"), e.preventDefault());
  13830. },
  13831. resize: function resize() {
  13832. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  13833. }
  13834. },
  13835. toggle: function toggle() {
  13836. k.is.active() || k.is.animating() ? k.hide() : k.show();
  13837. },
  13838. show: function show(t) {
  13839. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  13840. },
  13841. hide: function hide(t) {
  13842. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  13843. },
  13844. showModal: function showModal(t) {
  13845. t = e.isFunction(t) ? t : function () {}, k.is.animating() || !k.is.active() ? (k.showDimmer(), k.cacheSizes(), k.set.screenHeight(), k.set.type(), k.set.clickaway(), !T.allowMultiple && k.others.active() ? k.hideOthers(k.showModal) : (T.allowMultiple && T.detachable && D.detach().appendTo(x), T.onShow.call(z), T.transition && e.fn.transition !== i && D.transition("is supported") ? (k.debug("Showing modal with css animations"), D.transition({
  13846. debug: T.debug,
  13847. animation: T.transition + " in",
  13848. queue: T.queue,
  13849. duration: T.duration,
  13850. useFailSafe: !0,
  13851. onComplete: function onComplete() {
  13852. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  13853. }
  13854. })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  13855. },
  13856. hideModal: function hideModal(t, n) {
  13857. t = e.isFunction(t) ? t : function () {}, k.debug("Hiding modal"), !1 !== T.onHide.call(z, e(this)) ? (k.is.animating() || k.is.active()) && (T.transition && e.fn.transition !== i && D.transition("is supported") ? (k.remove.active(), D.transition({
  13858. debug: T.debug,
  13859. animation: T.transition + " out",
  13860. queue: T.queue,
  13861. duration: T.duration,
  13862. useFailSafe: !0,
  13863. onStart: function onStart() {
  13864. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  13865. },
  13866. onComplete: function onComplete() {
  13867. T.onHidden.call(z), k.restore.focus(), t();
  13868. }
  13869. })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  13870. },
  13871. showDimmer: function showDimmer() {
  13872. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  13873. },
  13874. hideDimmer: function hideDimmer() {
  13875. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  13876. k.remove.clickaway(), k.remove.screenHeight();
  13877. }) : k.debug("Dimmer is not visible cannot hide");
  13878. },
  13879. hideAll: function hideAll(t) {
  13880. var n = r.filter("." + R.active + ", ." + R.animating);
  13881. t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding all visible modals"), k.hideDimmer(), n.modal("hide modal", t));
  13882. },
  13883. hideOthers: function hideOthers(t) {
  13884. var n = v.filter("." + R.active + ", ." + R.animating);
  13885. t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding other modals", v), n.modal("hide modal", t, !0));
  13886. },
  13887. others: {
  13888. active: function active() {
  13889. return v.filter("." + R.active).length > 0;
  13890. },
  13891. animating: function animating() {
  13892. return v.filter("." + R.animating).length > 0;
  13893. }
  13894. },
  13895. add: {
  13896. keyboardShortcuts: function keyboardShortcuts() {
  13897. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  13898. }
  13899. },
  13900. save: {
  13901. focus: function focus() {
  13902. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  13903. }
  13904. },
  13905. restore: {
  13906. focus: function focus() {
  13907. b && b.length > 0 && b.focus();
  13908. }
  13909. },
  13910. remove: {
  13911. active: function active() {
  13912. D.removeClass(R.active);
  13913. },
  13914. clickaway: function clickaway() {
  13915. x.off("click" + C);
  13916. },
  13917. bodyStyle: function bodyStyle() {
  13918. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  13919. },
  13920. screenHeight: function screenHeight() {
  13921. k.debug("Removing page height"), c.css("height", "");
  13922. },
  13923. keyboardShortcuts: function keyboardShortcuts() {
  13924. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  13925. },
  13926. scrolling: function scrolling() {
  13927. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  13928. }
  13929. },
  13930. cacheSizes: function cacheSizes() {
  13931. D.addClass(R.loading);
  13932. var o = D.prop("scrollHeight"),
  13933. a = D.outerHeight();
  13934. k.cache !== i && 0 === a || (k.cache = {
  13935. pageHeight: e(n).outerHeight(),
  13936. height: a + T.offset,
  13937. scrollHeight: o + T.offset,
  13938. contextHeight: "body" == T.context ? e(t).height() : y.height()
  13939. }, k.cache.topOffset = -k.cache.height / 2), D.removeClass(R.loading), k.debug("Caching modal and container sizes", k.cache);
  13940. },
  13941. can: {
  13942. fit: function fit() {
  13943. var e = k.cache.contextHeight,
  13944. t = k.cache.contextHeight / 2,
  13945. n = k.cache.topOffset,
  13946. i = k.cache.scrollHeight,
  13947. o = k.cache.height,
  13948. a = T.padding;
  13949. return i > o ? t + n + i + a < e : o + 2 * a < e;
  13950. }
  13951. },
  13952. is: {
  13953. active: function active() {
  13954. return D.hasClass(R.active);
  13955. },
  13956. animating: function animating() {
  13957. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  13958. },
  13959. scrolling: function scrolling() {
  13960. return y.hasClass(R.scrolling);
  13961. },
  13962. modernBrowser: function modernBrowser() {
  13963. return !(t.ActiveXObject || "ActiveXObject" in t);
  13964. }
  13965. },
  13966. set: {
  13967. autofocus: function autofocus() {
  13968. var e = D.find("[tabindex], :input").filter(":visible"),
  13969. t = e.filter("[autofocus]"),
  13970. n = t.length > 0 ? t.first() : e.first();
  13971. n.length > 0 && n.focus();
  13972. },
  13973. clickaway: function clickaway() {
  13974. x.on("click" + C, k.event.click);
  13975. },
  13976. dimmerSettings: function dimmerSettings() {
  13977. if (e.fn.dimmer !== i) {
  13978. var t = {
  13979. debug: T.debug,
  13980. dimmerName: "modals",
  13981. closable: "auto",
  13982. variation: !T.centered && "top aligned",
  13983. duration: {
  13984. show: T.duration,
  13985. hide: T.duration
  13986. }
  13987. },
  13988. n = e.extend(!0, t, T.dimmerSettings);
  13989. T.inverted ? (n.variation = n.variation !== i ? n.variation + " inverted" : "inverted", x.addClass(R.inverted)) : x.removeClass(R.inverted), T.blurring ? y.addClass(R.blurring) : y.removeClass(R.blurring), q.dimmer("setting", n);
  13990. } else k.error(E.dimmer);
  13991. },
  13992. screenHeight: function screenHeight() {
  13993. k.can.fit() ? c.css("height", "") : (k.debug("Modal is taller than page content, resizing page height"), c.css("height", k.cache.height + 2 * T.padding));
  13994. },
  13995. active: function active() {
  13996. D.addClass(R.active);
  13997. },
  13998. scrolling: function scrolling() {
  13999. y.addClass(R.scrolling), D.addClass(R.scrolling);
  14000. },
  14001. type: function type() {
  14002. k.can.fit() ? (k.verbose("Modal fits on screen"), k.others.active() || k.others.animating() || k.remove.scrolling()) : (k.verbose("Modal cannot fit on screen setting to scrolling"), k.set.scrolling());
  14003. },
  14004. undetached: function undetached() {
  14005. y.addClass(R.undetached);
  14006. }
  14007. },
  14008. setting: function setting(t, n) {
  14009. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  14010. if (n === i) return T[t];
  14011. e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  14012. }
  14013. },
  14014. internal: function internal(t, n) {
  14015. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  14016. if (n === i) return k[t];
  14017. k[t] = n;
  14018. }
  14019. },
  14020. debug: function debug() {
  14021. !T.silent && T.debug && (T.performance ? k.performance.log(arguments) : (k.debug = Function.prototype.bind.call(console.info, console, T.name + ":"), k.debug.apply(console, arguments)));
  14022. },
  14023. verbose: function verbose() {
  14024. !T.silent && T.verbose && T.debug && (T.performance ? k.performance.log(arguments) : (k.verbose = Function.prototype.bind.call(console.info, console, T.name + ":"), k.verbose.apply(console, arguments)));
  14025. },
  14026. error: function error() {
  14027. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  14028. },
  14029. performance: {
  14030. log: function log(e) {
  14031. var t, n;
  14032. T.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({
  14033. Name: e[0],
  14034. Arguments: [].slice.call(e, 1) || "",
  14035. Element: z,
  14036. "Execution Time": n
  14037. })), clearTimeout(k.performance.timer), k.performance.timer = setTimeout(k.performance.display, 500);
  14038. },
  14039. display: function display() {
  14040. var t = T.name + ":",
  14041. n = 0;
  14042. d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  14043. n += t["Execution Time"];
  14044. }), t += " " + n + "ms", u && (t += " '" + u + "'"), (console.group !== i || console.table !== i) && f.length > 0 && (console.groupCollapsed(t), console.table ? console.table(f) : e.each(f, function (e, t) {
  14045. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14046. }), console.groupEnd()), f = [];
  14047. }
  14048. },
  14049. invoke: function invoke(t, n, o) {
  14050. var r,
  14051. s,
  14052. l,
  14053. c = I;
  14054. return n = n || p, o = z || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  14055. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14056. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14057. if (c[a] !== i) return s = c[a], !1;
  14058. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  14059. c = c[o];
  14060. }
  14061. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  14062. }
  14063. }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  14064. }), a !== i ? a : this;
  14065. }, e.fn.modal.settings = {
  14066. name: "Modal",
  14067. namespace: "modal",
  14068. silent: !1,
  14069. debug: !1,
  14070. verbose: !1,
  14071. performance: !0,
  14072. observeChanges: !1,
  14073. allowMultiple: !1,
  14074. detachable: !0,
  14075. closable: !0,
  14076. autofocus: !0,
  14077. inverted: !1,
  14078. blurring: !1,
  14079. centered: !0,
  14080. dimmerSettings: {
  14081. closable: !1,
  14082. useCSS: !0
  14083. },
  14084. keyboardShortcuts: !0,
  14085. context: "body",
  14086. queue: !1,
  14087. duration: 500,
  14088. offset: 0,
  14089. transition: "scale",
  14090. padding: 50,
  14091. onShow: function onShow() {},
  14092. onVisible: function onVisible() {},
  14093. onHide: function onHide() {
  14094. return !0;
  14095. },
  14096. onHidden: function onHidden() {},
  14097. onApprove: function onApprove() {
  14098. return !0;
  14099. },
  14100. onDeny: function onDeny() {
  14101. return !0;
  14102. },
  14103. selector: {
  14104. close: "> .close",
  14105. approve: ".actions .positive, .actions .approve, .actions .ok",
  14106. deny: ".actions .negative, .actions .deny, .actions .cancel",
  14107. modal: ".ui.modal"
  14108. },
  14109. error: {
  14110. dimmer: "UI Dimmer, a required component is not included in this page",
  14111. method: "The method you called is not defined.",
  14112. notFound: "The element you specified could not be found"
  14113. },
  14114. className: {
  14115. active: "active",
  14116. animating: "animating",
  14117. blurring: "blurring",
  14118. inverted: "inverted",
  14119. loading: "loading",
  14120. scrolling: "scrolling",
  14121. undetached: "undetached"
  14122. }
  14123. };
  14124. }(jQuery, window, document), function (e, t, n, i) {
  14125. "use strict";
  14126. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  14127. var o,
  14128. a = e(this),
  14129. r = a.selector || "",
  14130. s = new Date().getTime(),
  14131. l = [],
  14132. c = arguments[0],
  14133. u = "string" == typeof c,
  14134. d = [].slice.call(arguments, 1);
  14135. return a.each(function () {
  14136. var a,
  14137. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  14138. m = (f.className, f.selector),
  14139. g = f.error,
  14140. p = f.namespace,
  14141. h = "." + p,
  14142. v = p + "-module",
  14143. b = e(this),
  14144. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  14145. x = this,
  14146. C = b.data(v);
  14147. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  14148. a = {
  14149. initialize: function initialize() {
  14150. a.verbose("Initializing element"), b.on("click" + h, m.close, a.dismiss).data(v, a), f.detachable && b.parent()[0] !== y[0] && b.detach().prependTo(y), f.displayTime > 0 && setTimeout(a.hide, f.displayTime), a.show();
  14151. },
  14152. destroy: function destroy() {
  14153. a.verbose("Destroying instance"), b.removeData(v).off(h);
  14154. },
  14155. show: function show() {
  14156. a.should.show() && !b.is(":visible") && (a.debug("Showing nag", f.animation.show), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideDown(f.duration, f.easing));
  14157. },
  14158. hide: function hide() {
  14159. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  14160. },
  14161. onHide: function onHide() {
  14162. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  14163. },
  14164. dismiss: function dismiss(e) {
  14165. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  14166. },
  14167. should: {
  14168. show: function show() {
  14169. return f.persist ? (a.debug("Persistent nag is set, can show nag"), !0) : a.storage.get(f.key) != f.value.toString() ? (a.debug("Stored value is not set, can show nag", a.storage.get(f.key)), !0) : (a.debug("Stored value is set, cannot show nag", a.storage.get(f.key)), !1);
  14170. }
  14171. },
  14172. get: {
  14173. storageOptions: function storageOptions() {
  14174. var e = {};
  14175. return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  14176. }
  14177. },
  14178. clear: function clear() {
  14179. a.storage.remove(f.key);
  14180. },
  14181. storage: {
  14182. set: function set(n, o) {
  14183. var r = a.get.storageOptions();
  14184. if ("localstorage" == f.storageMethod && t.localStorage !== i) t.localStorage.setItem(n, o), a.debug("Value stored using local storage", n, o);else if ("sessionstorage" == f.storageMethod && t.sessionStorage !== i) t.sessionStorage.setItem(n, o), a.debug("Value stored using session storage", n, o);else {
  14185. if (e.cookie === i) return void a.error(g.noCookieStorage);
  14186. e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  14187. }
  14188. },
  14189. get: function get(n, o) {
  14190. var r;
  14191. return "localstorage" == f.storageMethod && t.localStorage !== i ? r = t.localStorage.getItem(n) : "sessionstorage" == f.storageMethod && t.sessionStorage !== i ? r = t.sessionStorage.getItem(n) : e.cookie !== i ? r = e.cookie(n) : a.error(g.noCookieStorage), "undefined" != r && "null" != r && r !== i && null !== r || (r = i), r;
  14192. },
  14193. remove: function remove(n) {
  14194. var o = a.get.storageOptions();
  14195. "localstorage" == f.storageMethod && t.localStorage !== i ? t.localStorage.removeItem(n) : "sessionstorage" == f.storageMethod && t.sessionStorage !== i ? t.sessionStorage.removeItem(n) : e.cookie !== i ? e.removeCookie(n, o) : a.error(g.noStorage);
  14196. }
  14197. },
  14198. setting: function setting(t, n) {
  14199. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  14200. if (n === i) return f[t];
  14201. e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  14202. }
  14203. },
  14204. internal: function internal(t, n) {
  14205. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  14206. if (n === i) return a[t];
  14207. a[t] = n;
  14208. }
  14209. },
  14210. debug: function debug() {
  14211. !f.silent && f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  14212. },
  14213. verbose: function verbose() {
  14214. !f.silent && f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  14215. },
  14216. error: function error() {
  14217. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  14218. },
  14219. performance: {
  14220. log: function log(e) {
  14221. var t, n;
  14222. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  14223. Name: e[0],
  14224. Arguments: [].slice.call(e, 1) || "",
  14225. Element: x,
  14226. "Execution Time": n
  14227. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  14228. },
  14229. display: function display() {
  14230. var t = f.name + ":",
  14231. n = 0;
  14232. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  14233. n += t["Execution Time"];
  14234. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  14235. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14236. }), console.groupEnd()), l = [];
  14237. }
  14238. },
  14239. invoke: function invoke(t, n, r) {
  14240. var s,
  14241. l,
  14242. c,
  14243. u = C;
  14244. return n = n || d, r = x || r, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  14245. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14246. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  14247. if (u[r] !== i) return l = u[r], !1;
  14248. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);
  14249. u = u[o];
  14250. }
  14251. })), e.isFunction(l) ? c = l.apply(r, n) : l !== i && (c = l), e.isArray(o) ? o.push(c) : o !== i ? o = [o, c] : c !== i && (o = c), l;
  14252. }
  14253. }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  14254. }), o !== i ? o : this;
  14255. }, e.fn.nag.settings = {
  14256. name: "Nag",
  14257. silent: !1,
  14258. debug: !1,
  14259. verbose: !1,
  14260. performance: !0,
  14261. namespace: "Nag",
  14262. persist: !1,
  14263. displayTime: 0,
  14264. animation: {
  14265. show: "slide",
  14266. hide: "slide"
  14267. },
  14268. context: !1,
  14269. detachable: !1,
  14270. expires: 30,
  14271. domain: !1,
  14272. path: "/",
  14273. storageMethod: "cookie",
  14274. key: "nag",
  14275. value: "dismiss",
  14276. error: {
  14277. noCookieStorage: "$.cookie is not included. A storage solution is required.",
  14278. noStorage: "Neither $.cookie or store is defined. A storage solution is required for storing state",
  14279. method: "The method you called is not defined."
  14280. },
  14281. className: {
  14282. bottom: "bottom",
  14283. fixed: "fixed"
  14284. },
  14285. selector: {
  14286. close: ".close.icon"
  14287. },
  14288. speed: 500,
  14289. easing: "easeOutQuad",
  14290. onHide: function onHide() {}
  14291. }, e.extend(e.easing, {
  14292. easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  14293. return -i * (t /= o) * (t - 2) + n;
  14294. }
  14295. });
  14296. }(jQuery, window, document), function (e, t, n, i) {
  14297. "use strict";
  14298. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  14299. var a,
  14300. r = e(this),
  14301. s = e(n),
  14302. l = e(t),
  14303. c = e("body"),
  14304. u = r.selector || "",
  14305. d = new Date().getTime(),
  14306. f = [],
  14307. m = arguments[0],
  14308. g = "string" == typeof m,
  14309. p = [].slice.call(arguments, 1);
  14310. return r.each(function () {
  14311. var r,
  14312. h,
  14313. v,
  14314. b,
  14315. y,
  14316. x,
  14317. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  14318. w = C.selector,
  14319. S = C.className,
  14320. k = C.error,
  14321. T = C.metadata,
  14322. A = C.namespace,
  14323. R = "." + C.namespace,
  14324. P = "module-" + A,
  14325. E = e(this),
  14326. F = e(C.context),
  14327. O = e(C.scrollContext),
  14328. D = e(C.boundary),
  14329. q = C.target ? e(C.target) : E,
  14330. j = 0,
  14331. z = !1,
  14332. I = !1,
  14333. M = this,
  14334. L = E.data(P);
  14335. x = {
  14336. initialize: function initialize() {
  14337. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  14338. },
  14339. instantiate: function instantiate() {
  14340. x.verbose("Storing instance", x), L = x, E.data(P, L);
  14341. },
  14342. observeChanges: function observeChanges() {
  14343. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, {
  14344. childList: !0,
  14345. subtree: !0
  14346. }), x.debug("Setting up mutation observer", v));
  14347. },
  14348. refresh: function refresh() {
  14349. C.popup ? r = e(C.popup).eq(0) : C.inline && (r = q.nextAll(w.popup).eq(0), C.popup = r), C.popup ? (r.addClass(S.loading), h = x.get.offsetParent(), r.removeClass(S.loading), C.movePopup && x.has.popup() && x.get.offsetParent(r)[0] !== h[0] && (x.debug("Moving popup to the same offset parent as target"), r.detach().appendTo(h))) : h = C.inline ? x.get.offsetParent(q) : x.has.popup() ? x.get.offsetParent(r) : c, h.is("html") && h[0] !== c[0] && (x.debug("Setting page as offset parent"), h = c), x.get.variation() && x.set.variation();
  14350. },
  14351. reposition: function reposition() {
  14352. x.refresh(), x.set.position();
  14353. },
  14354. destroy: function destroy() {
  14355. x.debug("Destroying previous module"), v && v.disconnect(), r && !C.preserve && x.removePopup(), clearTimeout(x.hideTimer), clearTimeout(x.showTimer), x.unbind.close(), x.unbind.events(), E.removeData(P);
  14356. },
  14357. event: {
  14358. start: function start(t) {
  14359. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;
  14360. clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  14361. },
  14362. end: function end() {
  14363. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;
  14364. clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  14365. },
  14366. touchstart: function touchstart(e) {
  14367. I = !0, x.show();
  14368. },
  14369. resize: function resize() {
  14370. x.is.visible() && x.set.position();
  14371. },
  14372. documentChanged: function documentChanged(t) {
  14373. [].forEach.call(t, function (t) {
  14374. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  14375. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  14376. });
  14377. });
  14378. },
  14379. hideGracefully: function hideGracefully(t) {
  14380. var i = e(t.target),
  14381. o = e.contains(n.documentElement, t.target),
  14382. a = i.closest(w.popup).length > 0;
  14383. t && !a && o ? (x.debug("Click occurred outside popup hiding popup"), x.hide()) : x.debug("Click was inside popup, keeping popup open");
  14384. }
  14385. },
  14386. create: function create() {
  14387. var t = x.get.html(),
  14388. n = x.get.title(),
  14389. i = x.get.content();
  14390. t || i || n ? (x.debug("Creating pop-up html"), t || (t = C.templates.popup({
  14391. title: n,
  14392. content: i
  14393. })), r = e("<div/>").addClass(S.popup).data(T.activator, E).html(t), C.inline ? (x.verbose("Inserting popup element inline", r), r.insertAfter(E)) : (x.verbose("Appending popup element to body", r), r.appendTo(F)), x.refresh(), x.set.variation(), C.hoverable && x.bind.popup(), C.onCreate.call(r, M)) : 0 !== q.next(w.popup).length ? (x.verbose("Pre-existing popup found"), C.inline = !0, C.popup = q.next(w.popup).data(T.activator, E), x.refresh(), C.hoverable && x.bind.popup()) : C.popup ? (e(C.popup).data(T.activator, E), x.verbose("Used popup specified in settings"), x.refresh(), C.hoverable && x.bind.popup()) : x.debug("No content specified skipping display", M);
  14394. },
  14395. createID: function createID() {
  14396. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  14397. },
  14398. toggle: function toggle() {
  14399. x.debug("Toggling pop-up"), x.is.hidden() ? (x.debug("Popup is hidden, showing pop-up"), x.unbind.close(), x.show()) : (x.debug("Popup is visible, hiding pop-up"), x.hide());
  14400. },
  14401. show: function show(e) {
  14402. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  14403. if (x.exists() || x.create(), !1 === C.onShow.call(r, M)) return void x.debug("onShow callback returned false, cancelling popup animation");
  14404. C.preserve || C.popup || x.refresh(), r && x.set.position() && (x.save.conditions(), C.exclusive && x.hideAll(), x.animate.show(e));
  14405. }
  14406. },
  14407. hide: function hide(e) {
  14408. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  14409. if (!1 === C.onHide.call(r, M)) return void x.debug("onHide callback returned false, cancelling popup animation");
  14410. x.remove.visible(), x.unbind.close(), x.restore.conditions(), x.animate.hide(e);
  14411. }
  14412. },
  14413. hideAll: function hideAll() {
  14414. e(w.popup).filter("." + S.popupVisible).each(function () {
  14415. e(this).data(T.activator).popup("hide");
  14416. });
  14417. },
  14418. exists: function exists() {
  14419. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  14420. },
  14421. removePopup: function removePopup() {
  14422. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  14423. },
  14424. save: {
  14425. conditions: function conditions() {
  14426. x.cache = {
  14427. title: E.attr("title")
  14428. }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  14429. }
  14430. },
  14431. restore: {
  14432. conditions: function conditions() {
  14433. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  14434. }
  14435. },
  14436. supports: {
  14437. svg: function svg() {
  14438. return "undefined" == typeof SVGGraphicsElement;
  14439. }
  14440. },
  14441. animate: {
  14442. show: function show(t) {
  14443. t = e.isFunction(t) ? t : function () {}, C.transition && e.fn.transition !== i && E.transition("is supported") ? (x.set.visible(), r.transition({
  14444. animation: C.transition + " in",
  14445. queue: !1,
  14446. debug: C.debug,
  14447. verbose: C.verbose,
  14448. duration: C.duration,
  14449. onComplete: function onComplete() {
  14450. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  14451. }
  14452. })) : x.error(k.noTransition);
  14453. },
  14454. hide: function hide(t) {
  14455. t = e.isFunction(t) ? t : function () {}, x.debug("Hiding pop-up"), !1 !== C.onHide.call(r, M) ? C.transition && e.fn.transition !== i && E.transition("is supported") ? r.transition({
  14456. animation: C.transition + " out",
  14457. queue: !1,
  14458. duration: C.duration,
  14459. debug: C.debug,
  14460. verbose: C.verbose,
  14461. onComplete: function onComplete() {
  14462. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  14463. }
  14464. }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  14465. }
  14466. },
  14467. change: {
  14468. content: function content(e) {
  14469. r.html(e);
  14470. }
  14471. },
  14472. get: {
  14473. html: function html() {
  14474. return E.removeData(T.html), E.data(T.html) || C.html;
  14475. },
  14476. title: function title() {
  14477. return E.removeData(T.title), E.data(T.title) || C.title;
  14478. },
  14479. content: function content() {
  14480. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  14481. },
  14482. variation: function variation() {
  14483. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  14484. },
  14485. popup: function popup() {
  14486. return r;
  14487. },
  14488. popupOffset: function popupOffset() {
  14489. return r.offset();
  14490. },
  14491. calculations: function calculations() {
  14492. var e,
  14493. n = x.get.offsetParent(r),
  14494. i = q[0],
  14495. o = D[0] == t,
  14496. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  14497. s = o ? {
  14498. top: 0,
  14499. left: 0
  14500. } : D.offset(),
  14501. c = {},
  14502. u = o ? {
  14503. top: l.scrollTop(),
  14504. left: l.scrollLeft()
  14505. } : {
  14506. top: 0,
  14507. left: 0
  14508. };
  14509. if (c = {
  14510. target: {
  14511. element: q[0],
  14512. width: q.outerWidth(),
  14513. height: q.outerHeight(),
  14514. top: a.top,
  14515. left: a.left,
  14516. margin: {}
  14517. },
  14518. popup: {
  14519. width: r.outerWidth(),
  14520. height: r.outerHeight()
  14521. },
  14522. parent: {
  14523. width: h.outerWidth(),
  14524. height: h.outerHeight()
  14525. },
  14526. screen: {
  14527. top: s.top,
  14528. left: s.left,
  14529. scroll: {
  14530. top: u.top,
  14531. left: u.left
  14532. },
  14533. width: D.width(),
  14534. height: D.height()
  14535. }
  14536. }, n.get(0) !== h.get(0)) {
  14537. var d = n.offset();
  14538. c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  14539. }
  14540. return C.setFluidWidth && x.is.fluid() && (c.container = {
  14541. width: r.parent().outerWidth()
  14542. }, c.popup.width = c.container.width), c.target.margin.top = C.inline ? parseInt(t.getComputedStyle(i).getPropertyValue("margin-top"), 10) : 0, c.target.margin.left = C.inline ? x.is.rtl() ? parseInt(t.getComputedStyle(i).getPropertyValue("margin-right"), 10) : parseInt(t.getComputedStyle(i).getPropertyValue("margin-left"), 10) : 0, e = c.screen, c.boundary = {
  14543. top: e.top + e.scroll.top,
  14544. bottom: e.top + e.scroll.top + e.height,
  14545. left: e.left + e.scroll.left,
  14546. right: e.left + e.scroll.left + e.width
  14547. }, c;
  14548. },
  14549. id: function id() {
  14550. return y;
  14551. },
  14552. startEvent: function startEvent() {
  14553. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  14554. },
  14555. scrollEvent: function scrollEvent() {
  14556. return "scroll";
  14557. },
  14558. endEvent: function endEvent() {
  14559. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  14560. },
  14561. distanceFromBoundary: function distanceFromBoundary(e, t) {
  14562. var n,
  14563. i,
  14564. o = {};
  14565. return n = (t = t || x.get.calculations()).popup, i = t.boundary, e && (o = {
  14566. top: e.top - i.top,
  14567. left: e.left - i.left,
  14568. right: i.right - (e.left + n.width),
  14569. bottom: i.bottom - (e.top + n.height)
  14570. }, x.verbose("Distance from boundaries determined", e, o)), o;
  14571. },
  14572. offsetParent: function offsetParent(t) {
  14573. var n = (t !== i ? t[0] : q[0]).parentNode,
  14574. o = e(n);
  14575. if (n) for (var a = "none" === o.css("transform"), r = "static" === o.css("position"), s = o.is("body"); n && !s && r && a;) {
  14576. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  14577. }
  14578. return o && o.length > 0 ? o : e();
  14579. },
  14580. positions: function positions() {
  14581. return {
  14582. "top left": !1,
  14583. "top center": !1,
  14584. "top right": !1,
  14585. "bottom left": !1,
  14586. "bottom center": !1,
  14587. "bottom right": !1,
  14588. "left center": !1,
  14589. "right center": !1
  14590. };
  14591. },
  14592. nextPosition: function nextPosition(e) {
  14593. var t = e.split(" "),
  14594. n = t[0],
  14595. i = t[1],
  14596. o = "top" == n || "bottom" == n,
  14597. a = !1,
  14598. r = !1,
  14599. s = !1;
  14600. return z || (x.verbose("All available positions available"), z = x.get.positions()), x.debug("Recording last position tried", e), z[e] = !0, "opposite" === C.prefer && (s = (s = [{
  14601. top: "bottom",
  14602. bottom: "top",
  14603. left: "right",
  14604. right: "left"
  14605. }[n], i]).join(" "), a = !0 === z[s], x.debug("Trying opposite strategy", s)), "adjacent" === C.prefer && o && (s = (s = [n, {
  14606. left: "center",
  14607. center: "right",
  14608. right: "left"
  14609. }[i]]).join(" "), r = !0 === z[s], x.debug("Trying adjacent strategy", s)), (r || a) && (x.debug("Using backup position", s), s = {
  14610. "top left": "top center",
  14611. "top center": "top right",
  14612. "top right": "right center",
  14613. "right center": "bottom right",
  14614. "bottom right": "bottom center",
  14615. "bottom center": "bottom left",
  14616. "bottom left": "left center",
  14617. "left center": "top left"
  14618. }[e]), s;
  14619. }
  14620. },
  14621. set: {
  14622. position: function position(e, t) {
  14623. if (0 !== q.length && 0 !== r.length) {
  14624. var n, o, a, s, l, c, u, d;
  14625. if (t = t || x.get.calculations(), e = e || E.data(T.position) || C.position, n = E.data(T.offset) || C.offset, o = C.distanceAway, a = t.target, s = t.popup, l = t.parent, x.should.centerArrow(t) && (x.verbose("Adjusting offset to center arrow on small target element"), "top left" != e && "bottom left" != e || (n += a.width / 2, n -= C.arrowPixelsFromEdge), "top right" != e && "bottom right" != e || (n -= a.width / 2, n += C.arrowPixelsFromEdge)), 0 === a.width && 0 === a.height && !x.is.svg(a.element)) return x.debug("Popup target is hidden, no action taken"), !1;
  14626. switch (C.inline && (x.debug("Adding margin to calculation", a.margin), "left center" == e || "right center" == e ? (n += a.margin.top, o += -a.margin.left) : "top left" == e || "top center" == e || "top right" == e ? (n += a.margin.left, o -= a.margin.top) : (n += a.margin.left, o += a.margin.top)), x.debug("Determining popup position from calculations", e, t), x.is.rtl() && (e = e.replace(/left|right/g, function (e) {
  14627. return "left" == e ? "right" : "left";
  14628. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {
  14629. case "top left":
  14630. c = {
  14631. top: "auto",
  14632. bottom: l.height - a.top + o,
  14633. left: a.left + n,
  14634. right: "auto"
  14635. };
  14636. break;
  14637. case "top center":
  14638. c = {
  14639. bottom: l.height - a.top + o,
  14640. left: a.left + a.width / 2 - s.width / 2 + n,
  14641. top: "auto",
  14642. right: "auto"
  14643. };
  14644. break;
  14645. case "top right":
  14646. c = {
  14647. bottom: l.height - a.top + o,
  14648. right: l.width - a.left - a.width - n,
  14649. top: "auto",
  14650. left: "auto"
  14651. };
  14652. break;
  14653. case "left center":
  14654. c = {
  14655. top: a.top + a.height / 2 - s.height / 2 + n,
  14656. right: l.width - a.left + o,
  14657. left: "auto",
  14658. bottom: "auto"
  14659. };
  14660. break;
  14661. case "right center":
  14662. c = {
  14663. top: a.top + a.height / 2 - s.height / 2 + n,
  14664. left: a.left + a.width + o,
  14665. bottom: "auto",
  14666. right: "auto"
  14667. };
  14668. break;
  14669. case "bottom left":
  14670. c = {
  14671. top: a.top + a.height + o,
  14672. left: a.left + n,
  14673. bottom: "auto",
  14674. right: "auto"
  14675. };
  14676. break;
  14677. case "bottom center":
  14678. c = {
  14679. top: a.top + a.height + o,
  14680. left: a.left + a.width / 2 - s.width / 2 + n,
  14681. bottom: "auto",
  14682. right: "auto"
  14683. };
  14684. break;
  14685. case "bottom right":
  14686. c = {
  14687. top: a.top + a.height + o,
  14688. right: l.width - a.left - a.width - n,
  14689. left: "auto",
  14690. bottom: "auto"
  14691. };
  14692. }
  14693. if (c === i && x.error(k.invalidPosition, e), x.debug("Calculated popup positioning values", c), r.css(c).removeClass(S.position).addClass(e).addClass(S.loading), u = x.get.popupOffset(), d = x.get.distanceFromBoundary(u, t), x.is.offstage(d, e)) {
  14694. if (x.debug("Position is outside viewport", e), j < C.maxSearchDepth) return j++, e = x.get.nextPosition(e), x.debug("Trying new position", e), !!r && x.set.position(e, t);
  14695. if (!C.lastResort) return x.debug("Popup could not find a position to display", r), x.error(k.cannotPlace, M), x.remove.attempts(), x.remove.loading(), x.reset(), C.onUnplaceable.call(r, M), !1;
  14696. x.debug("No position found, showing with last position");
  14697. }
  14698. return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  14699. }
  14700. x.error(k.notFound);
  14701. },
  14702. fluidWidth: function fluidWidth(e) {
  14703. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  14704. },
  14705. variation: function variation(e) {
  14706. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  14707. },
  14708. visible: function visible() {
  14709. E.addClass(S.visible);
  14710. }
  14711. },
  14712. remove: {
  14713. loading: function loading() {
  14714. r.removeClass(S.loading);
  14715. },
  14716. variation: function variation(e) {
  14717. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  14718. },
  14719. visible: function visible() {
  14720. E.removeClass(S.visible);
  14721. },
  14722. attempts: function attempts() {
  14723. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  14724. }
  14725. },
  14726. bind: {
  14727. events: function events() {
  14728. x.debug("Binding popup events to module"), "click" == C.on && E.on("click" + R, x.toggle), "hover" == C.on && E.on("touchstart" + R, x.event.touchstart), x.get.startEvent() && E.on(x.get.startEvent() + R, x.event.start).on(x.get.endEvent() + R, x.event.end), C.target && x.debug("Target set to element", q), l.on("resize" + b, x.event.resize);
  14729. },
  14730. popup: function popup() {
  14731. x.verbose("Allowing hover events on popup to prevent closing"), r && x.has.popup() && r.on("mouseenter" + R, x.event.start).on("mouseleave" + R, x.event.end);
  14732. },
  14733. close: function close() {
  14734. (!0 === C.hideOnScroll || "auto" == C.hideOnScroll && "click" != C.on) && x.bind.closeOnScroll(), "hover" == C.on && I && x.bind.touchClose(), "click" == C.on && C.closable && x.bind.clickaway();
  14735. },
  14736. closeOnScroll: function closeOnScroll() {
  14737. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  14738. },
  14739. touchClose: function touchClose() {
  14740. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  14741. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  14742. });
  14743. },
  14744. clickaway: function clickaway() {
  14745. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  14746. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  14747. });
  14748. }
  14749. },
  14750. unbind: {
  14751. events: function events() {
  14752. l.off(b), E.off(R);
  14753. },
  14754. close: function close() {
  14755. s.off(b), O.off(b);
  14756. }
  14757. },
  14758. has: {
  14759. popup: function popup() {
  14760. return r && r.length > 0;
  14761. }
  14762. },
  14763. should: {
  14764. centerArrow: function centerArrow(e) {
  14765. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  14766. }
  14767. },
  14768. is: {
  14769. offstage: function offstage(t, n) {
  14770. var i = [];
  14771. return e.each(t, function (e, t) {
  14772. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  14773. }), i.length > 0;
  14774. },
  14775. svg: function svg(e) {
  14776. return x.supports.svg() && e instanceof SVGGraphicsElement;
  14777. },
  14778. basic: function basic() {
  14779. return E.hasClass(S.basic);
  14780. },
  14781. active: function active() {
  14782. return E.hasClass(S.active);
  14783. },
  14784. animating: function animating() {
  14785. return r !== i && r.hasClass(S.animating);
  14786. },
  14787. fluid: function fluid() {
  14788. return r !== i && r.hasClass(S.fluid);
  14789. },
  14790. visible: function visible() {
  14791. return r !== i && r.hasClass(S.popupVisible);
  14792. },
  14793. dropdown: function dropdown() {
  14794. return E.hasClass(S.dropdown);
  14795. },
  14796. hidden: function hidden() {
  14797. return !x.is.visible();
  14798. },
  14799. rtl: function rtl() {
  14800. return "rtl" == E.css("direction");
  14801. }
  14802. },
  14803. reset: function reset() {
  14804. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  14805. },
  14806. setting: function setting(t, n) {
  14807. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  14808. if (n === i) return C[t];
  14809. C[t] = n;
  14810. }
  14811. },
  14812. internal: function internal(t, n) {
  14813. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  14814. if (n === i) return x[t];
  14815. x[t] = n;
  14816. }
  14817. },
  14818. debug: function debug() {
  14819. !C.silent && C.debug && (C.performance ? x.performance.log(arguments) : (x.debug = Function.prototype.bind.call(console.info, console, C.name + ":"), x.debug.apply(console, arguments)));
  14820. },
  14821. verbose: function verbose() {
  14822. !C.silent && C.verbose && C.debug && (C.performance ? x.performance.log(arguments) : (x.verbose = Function.prototype.bind.call(console.info, console, C.name + ":"), x.verbose.apply(console, arguments)));
  14823. },
  14824. error: function error() {
  14825. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  14826. },
  14827. performance: {
  14828. log: function log(e) {
  14829. var t, n;
  14830. C.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({
  14831. Name: e[0],
  14832. Arguments: [].slice.call(e, 1) || "",
  14833. Element: M,
  14834. "Execution Time": n
  14835. })), clearTimeout(x.performance.timer), x.performance.timer = setTimeout(x.performance.display, 500);
  14836. },
  14837. display: function display() {
  14838. var t = C.name + ":",
  14839. n = 0;
  14840. d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  14841. n += t["Execution Time"];
  14842. }), t += " " + n + "ms", u && (t += " '" + u + "'"), (console.group !== i || console.table !== i) && f.length > 0 && (console.groupCollapsed(t), console.table ? console.table(f) : e.each(f, function (e, t) {
  14843. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14844. }), console.groupEnd()), f = [];
  14845. }
  14846. },
  14847. invoke: function invoke(t, n, o) {
  14848. var r,
  14849. s,
  14850. l,
  14851. c = L;
  14852. return n = n || p, o = M || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  14853. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14854. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14855. if (c[a] !== i) return s = c[a], !1;
  14856. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  14857. c = c[o];
  14858. }
  14859. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  14860. }
  14861. }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  14862. }), a !== i ? a : this;
  14863. }, e.fn.popup.settings = {
  14864. name: "Popup",
  14865. silent: !1,
  14866. debug: !1,
  14867. verbose: !1,
  14868. performance: !0,
  14869. namespace: "popup",
  14870. observeChanges: !0,
  14871. onCreate: function onCreate() {},
  14872. onRemove: function onRemove() {},
  14873. onShow: function onShow() {},
  14874. onVisible: function onVisible() {},
  14875. onHide: function onHide() {},
  14876. onUnplaceable: function onUnplaceable() {},
  14877. onHidden: function onHidden() {},
  14878. on: "hover",
  14879. boundary: t,
  14880. addTouchEvents: !0,
  14881. position: "top left",
  14882. variation: "",
  14883. movePopup: !0,
  14884. target: !1,
  14885. popup: !1,
  14886. inline: !1,
  14887. preserve: !1,
  14888. hoverable: !1,
  14889. content: !1,
  14890. html: !1,
  14891. title: !1,
  14892. closable: !0,
  14893. hideOnScroll: "auto",
  14894. exclusive: !1,
  14895. context: "body",
  14896. scrollContext: t,
  14897. prefer: "opposite",
  14898. lastResort: !1,
  14899. arrowPixelsFromEdge: 20,
  14900. delay: {
  14901. show: 50,
  14902. hide: 70
  14903. },
  14904. setFluidWidth: !0,
  14905. duration: 200,
  14906. transition: "scale",
  14907. distanceAway: 0,
  14908. jitter: 2,
  14909. offset: 0,
  14910. maxSearchDepth: 15,
  14911. error: {
  14912. invalidPosition: "The position you specified is not a valid position",
  14913. cannotPlace: "Popup does not fit within the boundaries of the viewport",
  14914. method: "The method you called is not defined.",
  14915. noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>",
  14916. notFound: "The target or popup you specified does not exist on the page"
  14917. },
  14918. metadata: {
  14919. activator: "activator",
  14920. content: "content",
  14921. html: "html",
  14922. offset: "offset",
  14923. position: "position",
  14924. title: "title",
  14925. variation: "variation"
  14926. },
  14927. className: {
  14928. active: "active",
  14929. basic: "basic",
  14930. animating: "animating",
  14931. dropdown: "dropdown",
  14932. fluid: "fluid",
  14933. loading: "loading",
  14934. popup: "ui popup",
  14935. position: "top left center bottom right",
  14936. visible: "visible",
  14937. popupVisible: "visible"
  14938. },
  14939. selector: {
  14940. popup: ".ui.popup"
  14941. },
  14942. templates: {
  14943. escape: function escape(e) {
  14944. var t = {
  14945. "&": "&amp;",
  14946. "<": "&lt;",
  14947. ">": "&gt;",
  14948. '"': "&quot;",
  14949. "'": "&#x27;",
  14950. "`": "&#x60;"
  14951. };
  14952. return /[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  14953. return t[e];
  14954. }) : e;
  14955. },
  14956. popup: function popup(t) {
  14957. var n = "",
  14958. o = e.fn.popup.settings.templates.escape;
  14959. return _typeof(t) !== i && (_typeof(t.title) !== i && t.title && (t.title = o(t.title), n += '<div class="header">' + t.title + "</div>"), _typeof(t.content) !== i && t.content && (t.content = o(t.content), n += '<div class="content">' + t.content + "</div>")), n;
  14960. }
  14961. }
  14962. };
  14963. }(jQuery, window, document), function (e, t, n, i) {
  14964. "use strict";
  14965. void 0 !== (t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")()) && t.Math == Math || ("undefined" != typeof self && self.Math == Math ? self : Function("return this")());
  14966. e.fn.progress = function (t) {
  14967. var o,
  14968. a = e(this),
  14969. r = a.selector || "",
  14970. s = new Date().getTime(),
  14971. l = [],
  14972. c = arguments[0],
  14973. u = "string" == typeof c,
  14974. d = [].slice.call(arguments, 1);
  14975. return a.each(function () {
  14976. var a,
  14977. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  14978. m = f.className,
  14979. g = f.metadata,
  14980. p = f.namespace,
  14981. h = f.selector,
  14982. v = f.error,
  14983. b = "." + p,
  14984. y = "module-" + p,
  14985. x = e(this),
  14986. C = e(this).find(h.bar),
  14987. w = e(this).find(h.progress),
  14988. S = e(this).find(h.label),
  14989. k = this,
  14990. T = x.data(y),
  14991. A = !1;
  14992. a = {
  14993. initialize: function initialize() {
  14994. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  14995. },
  14996. instantiate: function instantiate() {
  14997. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  14998. },
  14999. destroy: function destroy() {
  15000. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  15001. },
  15002. reset: function reset() {
  15003. a.remove.nextValue(), a.update.progress(0);
  15004. },
  15005. complete: function complete() {
  15006. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  15007. },
  15008. read: {
  15009. metadata: function metadata() {
  15010. var e = {
  15011. percent: x.data(g.percent),
  15012. total: x.data(g.total),
  15013. value: x.data(g.value)
  15014. };
  15015. e.percent && (a.debug("Current percent value set from metadata", e.percent), a.set.percent(e.percent)), e.total && (a.debug("Total value set from metadata", e.total), a.set.total(e.total)), e.value && (a.debug("Current value set from metadata", e.value), a.set.value(e.value), a.set.progress(e.value));
  15016. },
  15017. settings: function settings() {
  15018. !1 !== f.total && (a.debug("Current total set in settings", f.total), a.set.total(f.total)), !1 !== f.value && (a.debug("Current value set in settings", f.value), a.set.value(f.value), a.set.progress(a.value)), !1 !== f.percent && (a.debug("Current percent set in settings", f.percent), a.set.percent(f.percent));
  15019. }
  15020. },
  15021. bind: {
  15022. transitionEnd: function transitionEnd(e) {
  15023. var t = a.get.transitionEnd();
  15024. C.one(t + b, function (t) {
  15025. clearTimeout(a.failSafeTimer), e.call(this, t);
  15026. }), a.failSafeTimer = setTimeout(function () {
  15027. C.triggerHandler(t);
  15028. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  15029. }
  15030. },
  15031. increment: function increment(e) {
  15032. var t, n;
  15033. a.has.total() ? n = (t = a.get.value()) + (e = e || 1) : (n = (t = a.get.percent()) + (e = e || a.get.randomValue()), 100, a.debug("Incrementing percentage by", t, n)), n = a.get.normalizedValue(n), a.set.progress(n);
  15034. },
  15035. decrement: function decrement(e) {
  15036. var t, n;
  15037. a.get.total() ? (n = (t = a.get.value()) - (e = e || 1), a.debug("Decrementing value by", e, t)) : (n = (t = a.get.percent()) - (e = e || a.get.randomValue()), a.debug("Decrementing percentage by", e, t)), n = a.get.normalizedValue(n), a.set.progress(n);
  15038. },
  15039. has: {
  15040. progressPoll: function progressPoll() {
  15041. return a.progressPoll;
  15042. },
  15043. total: function total() {
  15044. return !1 !== a.get.total();
  15045. }
  15046. },
  15047. get: {
  15048. text: function text(e) {
  15049. var t = a.value || 0,
  15050. n = a.total || 0,
  15051. i = A ? a.get.displayPercent() : a.percent || 0,
  15052. o = a.total > 0 ? n - t : 100 - i;
  15053. return e = (e = e || "").replace("{value}", t).replace("{total}", n).replace("{left}", o).replace("{percent}", i), a.verbose("Adding variables to progress bar text", e), e;
  15054. },
  15055. normalizedValue: function normalizedValue(e) {
  15056. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;
  15057. if (a.has.total()) {
  15058. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  15059. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;
  15060. return e;
  15061. },
  15062. updateInterval: function updateInterval() {
  15063. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  15064. },
  15065. randomValue: function randomValue() {
  15066. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  15067. },
  15068. numericValue: function numericValue(e) {
  15069. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  15070. },
  15071. transitionEnd: function transitionEnd() {
  15072. var e,
  15073. t = n.createElement("element"),
  15074. o = {
  15075. transition: "transitionend",
  15076. OTransition: "oTransitionEnd",
  15077. MozTransition: "transitionend",
  15078. WebkitTransition: "webkitTransitionEnd"
  15079. };
  15080. for (e in o) {
  15081. if (t.style[e] !== i) return o[e];
  15082. }
  15083. },
  15084. displayPercent: function displayPercent() {
  15085. var e = C.width(),
  15086. t = x.width(),
  15087. n = e > parseInt(C.css("min-width"), 10) ? e / t * 100 : a.percent;
  15088. return f.precision > 0 ? Math.round(n * (10 * f.precision)) / (10 * f.precision) : Math.round(n);
  15089. },
  15090. percent: function percent() {
  15091. return a.percent || 0;
  15092. },
  15093. value: function value() {
  15094. return a.nextValue || a.value || 0;
  15095. },
  15096. total: function total() {
  15097. return a.total || !1;
  15098. }
  15099. },
  15100. create: {
  15101. progressPoll: function progressPoll() {
  15102. a.progressPoll = setTimeout(function () {
  15103. a.update.toNextValue(), a.remove.progressPoll();
  15104. }, a.get.updateInterval());
  15105. }
  15106. },
  15107. is: {
  15108. complete: function complete() {
  15109. return a.is.success() || a.is.warning() || a.is.error();
  15110. },
  15111. success: function success() {
  15112. return x.hasClass(m.success);
  15113. },
  15114. warning: function warning() {
  15115. return x.hasClass(m.warning);
  15116. },
  15117. error: function error() {
  15118. return x.hasClass(m.error);
  15119. },
  15120. active: function active() {
  15121. return x.hasClass(m.active);
  15122. },
  15123. visible: function visible() {
  15124. return x.is(":visible");
  15125. }
  15126. },
  15127. remove: {
  15128. progressPoll: function progressPoll() {
  15129. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  15130. },
  15131. nextValue: function nextValue() {
  15132. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  15133. },
  15134. state: function state() {
  15135. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  15136. },
  15137. active: function active() {
  15138. a.verbose("Removing active state"), x.removeClass(m.active);
  15139. },
  15140. success: function success() {
  15141. a.verbose("Removing success state"), x.removeClass(m.success);
  15142. },
  15143. warning: function warning() {
  15144. a.verbose("Removing warning state"), x.removeClass(m.warning);
  15145. },
  15146. error: function error() {
  15147. a.verbose("Removing error state"), x.removeClass(m.error);
  15148. }
  15149. },
  15150. set: {
  15151. barWidth: function barWidth(e) {
  15152. e > 100 ? a.error(v.tooHigh, e) : e < 0 ? a.error(v.tooLow, e) : (C.css("width", e + "%"), x.attr("data-percent", parseInt(e, 10)));
  15153. },
  15154. duration: function duration(e) {
  15155. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({
  15156. "transition-duration": e
  15157. });
  15158. },
  15159. percent: function percent(e) {
  15160. e = "string" == typeof e ? +e.replace("%", "") : e, e = f.precision > 0 ? Math.round(e * (10 * f.precision)) / (10 * f.precision) : Math.round(e), a.percent = e, a.has.total() || (a.value = f.precision > 0 ? Math.round(e / 100 * a.total * (10 * f.precision)) / (10 * f.precision) : Math.round(e / 100 * a.total * 10) / 10, f.limitValues && (a.value = a.value > 100 ? 100 : a.value < 0 ? 0 : a.value)), a.set.barWidth(e), a.set.labelInterval(), a.set.labels(), f.onChange.call(k, e, a.value, a.total);
  15161. },
  15162. labelInterval: function labelInterval() {
  15163. clearInterval(a.interval), a.bind.transitionEnd(function () {
  15164. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  15165. }), A = !0, a.interval = setInterval(function () {
  15166. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  15167. }, f.framerate);
  15168. },
  15169. labels: function labels() {
  15170. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  15171. },
  15172. label: function label(e) {
  15173. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  15174. },
  15175. state: function state(e) {
  15176. 100 === (e = e !== i ? e : a.percent) ? f.autoSuccess && !(a.is.warning() || a.is.error() || a.is.success()) ? (a.set.success(), a.debug("Automatically triggering success at 100%")) : (a.verbose("Reached 100% removing active state"), a.remove.active(), a.remove.progressPoll()) : e > 0 ? (a.verbose("Adjusting active progress bar label", e), a.set.active()) : (a.remove.active(), a.set.label(f.text.active));
  15177. },
  15178. barLabel: function barLabel(e) {
  15179. e !== i ? w.text(a.get.text(e)) : "ratio" == f.label && a.total ? (a.verbose("Adding ratio to bar label"), w.text(a.get.text(f.text.ratio))) : "percent" == f.label && (a.verbose("Adding percentage to bar label"), w.text(a.get.text(f.text.percent)));
  15180. },
  15181. active: function active(e) {
  15182. e = e || f.text.active, a.debug("Setting active state"), f.showActivity && !a.is.active() && x.addClass(m.active), a.remove.warning(), a.remove.error(), a.remove.success(), (e = f.onLabelUpdate("active", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  15183. f.onActive.call(k, a.value, a.total);
  15184. });
  15185. },
  15186. success: function success(e) {
  15187. e = e || f.text.success || f.text.active, a.debug("Setting success state"), x.addClass(m.success), a.remove.active(), a.remove.warning(), a.remove.error(), a.complete(), f.text.success ? (e = f.onLabelUpdate("success", e, a.value, a.total), a.set.label(e)) : (e = f.onLabelUpdate("active", e, a.value, a.total), a.set.label(e)), a.bind.transitionEnd(function () {
  15188. f.onSuccess.call(k, a.total);
  15189. });
  15190. },
  15191. warning: function warning(e) {
  15192. e = e || f.text.warning, a.debug("Setting warning state"), x.addClass(m.warning), a.remove.active(), a.remove.success(), a.remove.error(), a.complete(), (e = f.onLabelUpdate("warning", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  15193. f.onWarning.call(k, a.value, a.total);
  15194. });
  15195. },
  15196. error: function error(e) {
  15197. e = e || f.text.error, a.debug("Setting error state"), x.addClass(m.error), a.remove.active(), a.remove.success(), a.remove.warning(), a.complete(), (e = f.onLabelUpdate("error", e, a.value, a.total)) && a.set.label(e), a.bind.transitionEnd(function () {
  15198. f.onError.call(k, a.value, a.total);
  15199. });
  15200. },
  15201. transitionEvent: function transitionEvent() {
  15202. a.get.transitionEnd();
  15203. },
  15204. total: function total(e) {
  15205. a.total = e;
  15206. },
  15207. value: function value(e) {
  15208. a.value = e;
  15209. },
  15210. progress: function progress(e) {
  15211. a.has.progressPoll() ? (a.debug("Updated within interval, setting next update to use new value", e), a.set.nextValue(e)) : (a.debug("First update in progress update interval, immediately updating", e), a.update.progress(e), a.create.progressPoll());
  15212. },
  15213. nextValue: function nextValue(e) {
  15214. a.nextValue = e;
  15215. }
  15216. },
  15217. update: {
  15218. toNextValue: function toNextValue() {
  15219. var e = a.nextValue;
  15220. e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  15221. },
  15222. progress: function progress(e) {
  15223. var t;
  15224. !1 === (e = a.get.numericValue(e)) && a.error(v.nonNumeric, e), e = a.get.normalizedValue(e), a.has.total() ? (a.set.value(e), t = e / a.total * 100, a.debug("Calculating percent complete from total", t), a.set.percent(t)) : (t = e, a.debug("Setting value to exact percentage value", t), a.set.percent(t));
  15225. }
  15226. },
  15227. setting: function setting(t, n) {
  15228. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  15229. if (n === i) return f[t];
  15230. e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  15231. }
  15232. },
  15233. internal: function internal(t, n) {
  15234. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  15235. if (n === i) return a[t];
  15236. a[t] = n;
  15237. }
  15238. },
  15239. debug: function debug() {
  15240. !f.silent && f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  15241. },
  15242. verbose: function verbose() {
  15243. !f.silent && f.verbose && f.debug && (f.performance ? a.performance.log(arguments) : (a.verbose = Function.prototype.bind.call(console.info, console, f.name + ":"), a.verbose.apply(console, arguments)));
  15244. },
  15245. error: function error() {
  15246. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  15247. },
  15248. performance: {
  15249. log: function log(e) {
  15250. var t, n;
  15251. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  15252. Name: e[0],
  15253. Arguments: [].slice.call(e, 1) || "",
  15254. Element: k,
  15255. "Execution Time": n
  15256. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  15257. },
  15258. display: function display() {
  15259. var t = f.name + ":",
  15260. n = 0;
  15261. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  15262. n += t["Execution Time"];
  15263. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  15264. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15265. }), console.groupEnd()), l = [];
  15266. }
  15267. },
  15268. invoke: function invoke(t, n, r) {
  15269. var s,
  15270. l,
  15271. c,
  15272. u = T;
  15273. return n = n || d, r = k || r, "string" == typeof t && u !== i && (t = t.split(/[\. ]/), s = t.length - 1, e.each(t, function (n, o) {
  15274. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15275. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  15276. if (u[r] !== i) return l = u[r], !1;
  15277. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(v.method, t), !1);
  15278. u = u[o];
  15279. }
  15280. })), e.isFunction(l) ? c = l.apply(r, n) : l !== i && (c = l), e.isArray(o) ? o.push(c) : o !== i ? o = [o, c] : c !== i && (o = c), l;
  15281. }
  15282. }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  15283. }), o !== i ? o : this;
  15284. }, e.fn.progress.settings = {
  15285. name: "Progress",
  15286. namespace: "progress",
  15287. silent: !1,
  15288. debug: !1,
  15289. verbose: !1,
  15290. performance: !0,
  15291. random: {
  15292. min: 2,
  15293. max: 5
  15294. },
  15295. duration: 300,
  15296. updateInterval: "auto",
  15297. autoSuccess: !0,
  15298. showActivity: !0,
  15299. limitValues: !0,
  15300. label: "percent",
  15301. precision: 0,
  15302. framerate: 1e3 / 30,
  15303. percent: !1,
  15304. total: !1,
  15305. value: !1,
  15306. failSafeDelay: 100,
  15307. onLabelUpdate: function onLabelUpdate(e, t, n, i) {
  15308. return t;
  15309. },
  15310. onChange: function onChange(e, t, n) {},
  15311. onSuccess: function onSuccess(e) {},
  15312. onActive: function onActive(e, t) {},
  15313. onError: function onError(e, t) {},
  15314. onWarning: function onWarning(e, t) {},
  15315. error: {
  15316. method: "The method you called is not defined.",
  15317. nonNumeric: "Progress value is non numeric",
  15318. tooHigh: "Value specified is above 100%",
  15319. tooLow: "Value specified is below 0%"
  15320. },
  15321. regExp: {
  15322. variable: /\{\$*[A-z0-9]+\}/g
  15323. },
  15324. metadata: {
  15325. percent: "percent",
  15326. total: "total",
  15327. value: "value"
  15328. },
  15329. selector: {
  15330. bar: "> .bar",
  15331. label: "> .label",
  15332. progress: ".bar > .progress"
  15333. },
  15334. text: {
  15335. active: !1,
  15336. error: !1,
  15337. success: !1,
  15338. warning: !1,
  15339. percent: "{percent}%",
  15340. ratio: "{value} of {total}"
  15341. },
  15342. className: {
  15343. active: "active",
  15344. error: "error",
  15345. success: "success",
  15346. warning: "warning"
  15347. }
  15348. };
  15349. }(jQuery, window, document), function (e, t, n, i) {
  15350. "use strict";
  15351. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  15352. var n,
  15353. o = e(this),
  15354. a = o.selector || "",
  15355. r = new Date().getTime(),
  15356. s = [],
  15357. l = arguments[0],
  15358. c = "string" == typeof l,
  15359. u = [].slice.call(arguments, 1);
  15360. return o.each(function () {
  15361. var d,
  15362. f,
  15363. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  15364. g = m.namespace,
  15365. p = m.className,
  15366. h = m.metadata,
  15367. v = m.selector,
  15368. b = (m.error, "." + g),
  15369. y = "module-" + g,
  15370. x = this,
  15371. C = e(this).data(y),
  15372. w = e(this),
  15373. S = w.find(v.icon);
  15374. f = {
  15375. initialize: function initialize() {
  15376. f.verbose("Initializing rating module", m), 0 === S.length && f.setup.layout(), m.interactive ? f.enable() : f.disable(), f.set.initialLoad(), f.set.rating(f.get.initialRating()), f.remove.initialLoad(), f.instantiate();
  15377. },
  15378. instantiate: function instantiate() {
  15379. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  15380. },
  15381. destroy: function destroy() {
  15382. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  15383. },
  15384. refresh: function refresh() {
  15385. S = w.find(v.icon);
  15386. },
  15387. setup: {
  15388. layout: function layout() {
  15389. var t = f.get.maxRating(),
  15390. n = e.fn.rating.settings.templates.icon(t);
  15391. f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  15392. }
  15393. },
  15394. event: {
  15395. mouseenter: function mouseenter() {
  15396. var t = e(this);
  15397. t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  15398. },
  15399. mouseleave: function mouseleave() {
  15400. w.removeClass(p.selected), S.removeClass(p.selected);
  15401. },
  15402. click: function click() {
  15403. var t = e(this),
  15404. n = f.get.rating(),
  15405. i = S.index(t) + 1;
  15406. ("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  15407. }
  15408. },
  15409. clearRating: function clearRating() {
  15410. f.debug("Clearing current rating"), f.set.rating(0);
  15411. },
  15412. bind: {
  15413. events: function events() {
  15414. f.verbose("Binding events"), w.on("mouseenter" + b, v.icon, f.event.mouseenter).on("mouseleave" + b, v.icon, f.event.mouseleave).on("click" + b, v.icon, f.event.click);
  15415. }
  15416. },
  15417. remove: {
  15418. events: function events() {
  15419. f.verbose("Removing events"), w.off(b);
  15420. },
  15421. initialLoad: function initialLoad() {
  15422. d = !1;
  15423. }
  15424. },
  15425. enable: function enable() {
  15426. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  15427. },
  15428. disable: function disable() {
  15429. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  15430. },
  15431. is: {
  15432. initialLoad: function initialLoad() {
  15433. return d;
  15434. }
  15435. },
  15436. get: {
  15437. initialRating: function initialRating() {
  15438. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  15439. },
  15440. maxRating: function maxRating() {
  15441. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  15442. },
  15443. rating: function rating() {
  15444. var e = S.filter("." + p.active).length;
  15445. return f.verbose("Current rating retrieved", e), e;
  15446. }
  15447. },
  15448. set: {
  15449. rating: function rating(e) {
  15450. var t = e - 1 >= 0 ? e - 1 : 0,
  15451. n = S.eq(t);
  15452. w.removeClass(p.selected), S.removeClass(p.selected).removeClass(p.active), e > 0 && (f.verbose("Setting current rating to", e), n.prevAll().addBack().addClass(p.active)), f.is.initialLoad() || m.onRate.call(x, e);
  15453. },
  15454. initialLoad: function initialLoad() {
  15455. d = !0;
  15456. }
  15457. },
  15458. setting: function setting(t, n) {
  15459. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  15460. if (n === i) return m[t];
  15461. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  15462. }
  15463. },
  15464. internal: function internal(t, n) {
  15465. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  15466. if (n === i) return f[t];
  15467. f[t] = n;
  15468. }
  15469. },
  15470. debug: function debug() {
  15471. !m.silent && m.debug && (m.performance ? f.performance.log(arguments) : (f.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), f.debug.apply(console, arguments)));
  15472. },
  15473. verbose: function verbose() {
  15474. !m.silent && m.verbose && m.debug && (m.performance ? f.performance.log(arguments) : (f.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), f.verbose.apply(console, arguments)));
  15475. },
  15476. error: function error() {
  15477. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  15478. },
  15479. performance: {
  15480. log: function log(e) {
  15481. var t, n;
  15482. m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  15483. Name: e[0],
  15484. Arguments: [].slice.call(e, 1) || "",
  15485. Element: x,
  15486. "Execution Time": n
  15487. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  15488. },
  15489. display: function display() {
  15490. var t = m.name + ":",
  15491. n = 0;
  15492. r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  15493. n += t["Execution Time"];
  15494. }), t += " " + n + "ms", a && (t += " '" + a + "'"), o.length > 1 && (t += " (" + o.length + ")"), (console.group !== i || console.table !== i) && s.length > 0 && (console.groupCollapsed(t), console.table ? console.table(s) : e.each(s, function (e, t) {
  15495. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15496. }), console.groupEnd()), s = [];
  15497. }
  15498. },
  15499. invoke: function invoke(t, o, a) {
  15500. var r,
  15501. s,
  15502. l,
  15503. c = C;
  15504. return o = o || u, a = x || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  15505. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15506. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  15507. if (c[a] !== i) return s = c[a], !1;
  15508. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  15509. c = c[o];
  15510. }
  15511. })), e.isFunction(s) ? l = s.apply(a, o) : s !== i && (l = s), e.isArray(n) ? n.push(l) : n !== i ? n = [n, l] : l !== i && (n = l), s;
  15512. }
  15513. }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  15514. }), n !== i ? n : this;
  15515. }, e.fn.rating.settings = {
  15516. name: "Rating",
  15517. namespace: "rating",
  15518. slent: !1,
  15519. debug: !1,
  15520. verbose: !1,
  15521. performance: !0,
  15522. initialRating: 0,
  15523. interactive: !0,
  15524. maxRating: 4,
  15525. clearable: "auto",
  15526. fireOnInit: !1,
  15527. onRate: function onRate(e) {},
  15528. error: {
  15529. method: "The method you called is not defined",
  15530. noMaximum: "No maximum rating specified. Cannot generate HTML automatically"
  15531. },
  15532. metadata: {
  15533. rating: "rating",
  15534. maxRating: "maxRating"
  15535. },
  15536. className: {
  15537. active: "active",
  15538. disabled: "disabled",
  15539. selected: "selected",
  15540. loading: "loading"
  15541. },
  15542. selector: {
  15543. icon: ".icon"
  15544. },
  15545. templates: {
  15546. icon: function icon(e) {
  15547. for (var t = 1, n = ""; t <= e;) {
  15548. n += '<i class="icon"></i>', t++;
  15549. }
  15550. return n;
  15551. }
  15552. }
  15553. };
  15554. }(jQuery, window, document), function (e, t, n, i) {
  15555. "use strict";
  15556. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  15557. var a,
  15558. r = e(this),
  15559. s = r.selector || "",
  15560. l = new Date().getTime(),
  15561. c = [],
  15562. u = arguments[0],
  15563. d = "string" == typeof u,
  15564. f = [].slice.call(arguments, 1);
  15565. return e(this).each(function () {
  15566. var m,
  15567. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  15568. p = g.className,
  15569. h = g.metadata,
  15570. v = g.regExp,
  15571. b = g.fields,
  15572. y = g.selector,
  15573. x = g.error,
  15574. C = g.namespace,
  15575. w = "." + C,
  15576. S = C + "-module",
  15577. k = e(this),
  15578. T = k.find(y.prompt),
  15579. A = k.find(y.searchButton),
  15580. R = k.find(y.results),
  15581. P = k.find(y.result),
  15582. E = (k.find(y.category), this),
  15583. F = k.data(S),
  15584. O = !1,
  15585. D = !1;
  15586. m = {
  15587. initialize: function initialize() {
  15588. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  15589. },
  15590. instantiate: function instantiate() {
  15591. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  15592. },
  15593. destroy: function destroy() {
  15594. m.verbose("Destroying instance"), k.off(w).removeData(S);
  15595. },
  15596. refresh: function refresh() {
  15597. m.debug("Refreshing selector cache"), T = k.find(y.prompt), A = k.find(y.searchButton), k.find(y.category), R = k.find(y.results), P = k.find(y.result);
  15598. },
  15599. refreshResults: function refreshResults() {
  15600. R = k.find(y.results), P = k.find(y.result);
  15601. },
  15602. bind: {
  15603. events: function events() {
  15604. m.verbose("Binding events to search"), g.automatic && (k.on(m.get.inputEvent() + w, y.prompt, m.event.input), T.attr("autocomplete", "off")), k.on("focus" + w, y.prompt, m.event.focus).on("blur" + w, y.prompt, m.event.blur).on("keydown" + w, y.prompt, m.handleKeyboard).on("click" + w, y.searchButton, m.query).on("mousedown" + w, y.results, m.event.result.mousedown).on("mouseup" + w, y.results, m.event.result.mouseup).on("click" + w, y.result, m.event.result.click);
  15605. }
  15606. },
  15607. determine: {
  15608. searchFields: function searchFields() {
  15609. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  15610. }
  15611. },
  15612. event: {
  15613. input: function input() {
  15614. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  15615. m.is.focused() && m.query();
  15616. }, g.searchDelay)) : m.query();
  15617. },
  15618. focus: function focus() {
  15619. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  15620. m.can.show() && m.showResults();
  15621. });
  15622. },
  15623. blur: function blur(e) {
  15624. var t = function t() {
  15625. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  15626. };
  15627. n.activeElement === this || (D = !1, m.resultsClicked ? (m.debug("Determining if user action caused search to close"), k.one("click.close" + w, y.results, function (e) {
  15628. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  15629. })) : (m.debug("Input blurred without user action, closing results"), t()));
  15630. },
  15631. result: {
  15632. mousedown: function mousedown() {
  15633. m.resultsClicked = !0;
  15634. },
  15635. mouseup: function mouseup() {
  15636. m.resultsClicked = !1;
  15637. },
  15638. click: function click(n) {
  15639. m.debug("Search result selected");
  15640. var i = e(this),
  15641. o = i.find(y.title).eq(0),
  15642. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  15643. r = a.attr("href") || !1,
  15644. s = a.attr("target") || !1,
  15645. l = (o.html(), o.length > 0 && o.text()),
  15646. c = m.get.results(),
  15647. u = i.data(h.result) || m.get.result(l, c);
  15648. if (e.isFunction(g.onSelect) && !1 === g.onSelect.call(E, u, c)) return m.debug("Custom onSelect callback cancelled default select action"), void (O = !0);
  15649. m.hideResults(), l && m.set.value(l), r && (m.verbose("Opening search link found in result", a), "_blank" == s || n.ctrlKey ? t.open(r) : t.location.href = r);
  15650. }
  15651. }
  15652. },
  15653. handleKeyboard: function handleKeyboard(e) {
  15654. var t,
  15655. n = k.find(y.result),
  15656. i = k.find(y.category),
  15657. o = n.filter("." + p.active),
  15658. a = n.index(o),
  15659. r = n.length,
  15660. s = o.length > 0,
  15661. l = e.which,
  15662. c = 13,
  15663. u = 38,
  15664. d = 40;
  15665. if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  15666. if (l == c) {
  15667. if (m.verbose("Enter key pressed, selecting active result"), n.filter("." + p.active).length > 0) return m.event.result.click.call(n.filter("." + p.active), e), e.preventDefault(), !1;
  15668. } else l == u && s ? (m.verbose("Up key pressed, changing active result"), t = a - 1 < 0 ? a : a - 1, i.removeClass(p.active), n.removeClass(p.active).eq(t).addClass(p.active).closest(i).addClass(p.active), e.preventDefault()) : l == d && (m.verbose("Down key pressed, changing active result"), t = a + 1 >= r ? a : a + 1, i.removeClass(p.active), n.removeClass(p.active).eq(t).addClass(p.active).closest(i).addClass(p.active), e.preventDefault());
  15669. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  15670. },
  15671. setup: {
  15672. api: function api(t, n) {
  15673. var i = {
  15674. debug: g.debug,
  15675. on: !1,
  15676. cache: g.cache,
  15677. action: "search",
  15678. urlData: {
  15679. query: t
  15680. },
  15681. onSuccess: function onSuccess(e) {
  15682. m.parse.response.call(E, e, t), n();
  15683. },
  15684. onFailure: function onFailure() {
  15685. m.displayMessage(x.serverError), n();
  15686. },
  15687. onAbort: function onAbort(e) {},
  15688. onError: m.error
  15689. };
  15690. e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  15691. }
  15692. },
  15693. can: {
  15694. useAPI: function useAPI() {
  15695. return e.fn.api !== i;
  15696. },
  15697. show: function show() {
  15698. return m.is.focused() && !m.is.visible() && !m.is.empty();
  15699. },
  15700. transition: function transition() {
  15701. return g.transition && e.fn.transition !== i && k.transition("is supported");
  15702. }
  15703. },
  15704. is: {
  15705. animating: function animating() {
  15706. return R.hasClass(p.animating);
  15707. },
  15708. hidden: function hidden() {
  15709. return R.hasClass(p.hidden);
  15710. },
  15711. inMessage: function inMessage(t) {
  15712. if (t.target) {
  15713. var i = e(t.target);
  15714. return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  15715. }
  15716. },
  15717. empty: function empty() {
  15718. return "" === R.html();
  15719. },
  15720. visible: function visible() {
  15721. return R.filter(":visible").length > 0;
  15722. },
  15723. focused: function focused() {
  15724. return T.filter(":focus").length > 0;
  15725. }
  15726. },
  15727. get: {
  15728. settings: function settings() {
  15729. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  15730. },
  15731. inputEvent: function inputEvent() {
  15732. var e = T[0];
  15733. return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  15734. },
  15735. value: function value() {
  15736. return T.val();
  15737. },
  15738. results: function results() {
  15739. return k.data(h.results);
  15740. },
  15741. result: function result(t, n) {
  15742. var o = ["title", "id"],
  15743. a = !1;
  15744. return t = t !== i ? t : m.get.value(), n = n !== i ? n : m.get.results(), "category" === g.type ? (m.debug("Finding result that matches", t), e.each(n, function (n, i) {
  15745. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  15746. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  15747. }
  15748. },
  15749. select: {
  15750. firstResult: function firstResult() {
  15751. m.verbose("Selecting first result"), P.first().addClass(p.active);
  15752. }
  15753. },
  15754. set: {
  15755. focus: function focus() {
  15756. k.addClass(p.focus);
  15757. },
  15758. loading: function loading() {
  15759. k.addClass(p.loading);
  15760. },
  15761. value: function value(e) {
  15762. m.verbose("Setting search input value", e), T.val(e);
  15763. },
  15764. type: function type(e) {
  15765. e = e || g.type, "category" == g.type && k.addClass(g.type);
  15766. },
  15767. buttonPressed: function buttonPressed() {
  15768. A.addClass(p.pressed);
  15769. }
  15770. },
  15771. remove: {
  15772. loading: function loading() {
  15773. k.removeClass(p.loading);
  15774. },
  15775. focus: function focus() {
  15776. k.removeClass(p.focus);
  15777. },
  15778. buttonPressed: function buttonPressed() {
  15779. A.removeClass(p.pressed);
  15780. }
  15781. },
  15782. query: function query(t) {
  15783. t = e.isFunction(t) ? t : function () {};
  15784. var n = m.get.value(),
  15785. i = m.read.cache(n);
  15786. t = t || function () {}, m.has.minimumCharacters() ? (i ? (m.debug("Reading result from cache", n), m.save.results(i.results), m.addResults(i.html), m.inject.id(i.results), t()) : (m.debug("Querying for", n), e.isPlainObject(g.source) || e.isArray(g.source) ? (m.search.local(n), t()) : m.can.useAPI() ? m.search.remote(n, t) : (m.error(x.source), t())), g.onSearchQuery.call(E, n)) : m.hideResults();
  15787. },
  15788. search: {
  15789. local: function local(e) {
  15790. var t,
  15791. n = m.search.object(e, g.content);
  15792. m.set.loading(), m.save.results(n), m.debug("Returned full local search results", n), g.maxResults > 0 && (m.debug("Using specified max results", n), n = n.slice(0, g.maxResults)), "category" == g.type && (n = m.create.categoryResults(n)), t = m.generateResults({
  15793. results: n
  15794. }), m.remove.loading(), m.addResults(t), m.inject.id(n), m.write.cache(e, {
  15795. html: t,
  15796. results: n
  15797. });
  15798. },
  15799. remote: function remote(t, n) {
  15800. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  15801. },
  15802. object: function object(t, n, o) {
  15803. var a = [],
  15804. r = [],
  15805. s = [],
  15806. l = t.toString().replace(v.escape, "\\$&"),
  15807. c = new RegExp(v.beginsWith + l, "i"),
  15808. u = function u(t, n) {
  15809. var i = -1 == e.inArray(n, a),
  15810. o = -1 == e.inArray(n, s),
  15811. l = -1 == e.inArray(n, r);
  15812. i && o && l && t.push(n);
  15813. };
  15814. return n = n || g.source, o = o !== i ? o : g.searchFields, e.isArray(o) || (o = [o]), n === i || !1 === n ? (m.error(x.source), []) : (e.each(o, function (i, o) {
  15815. e.each(n, function (e, n) {
  15816. "string" == typeof n[o] && (-1 !== n[o].search(c) ? u(a, n) : "exact" === g.fullTextSearch && m.exactSearch(t, n[o]) ? u(r, n) : 1 == g.fullTextSearch && m.fuzzySearch(t, n[o]) && u(s, n));
  15817. });
  15818. }), e.merge(r, s), e.merge(a, r), a);
  15819. }
  15820. },
  15821. exactSearch: function exactSearch(e, t) {
  15822. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  15823. },
  15824. fuzzySearch: function fuzzySearch(e, t) {
  15825. var n = t.length,
  15826. i = e.length;
  15827. if ("string" != typeof e) return !1;
  15828. if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;
  15829. if (i === n) return e === t;
  15830. e: for (var o = 0, a = 0; o < i; o++) {
  15831. for (var r = e.charCodeAt(o); a < n;) {
  15832. if (t.charCodeAt(a++) === r) continue e;
  15833. }
  15834. return !1;
  15835. }
  15836. return !0;
  15837. },
  15838. parse: {
  15839. response: function response(e, t) {
  15840. var n = m.generateResults(e);
  15841. m.verbose("Parsing server response", e), e !== i && t !== i && e[b.results] !== i && (m.addResults(n), m.inject.id(e[b.results]), m.write.cache(t, {
  15842. html: n,
  15843. results: e[b.results]
  15844. }), m.save.results(e[b.results]));
  15845. }
  15846. },
  15847. cancel: {
  15848. query: function query() {
  15849. m.can.useAPI() && k.api("abort");
  15850. }
  15851. },
  15852. has: {
  15853. minimumCharacters: function minimumCharacters() {
  15854. return m.get.value().length >= g.minCharacters;
  15855. },
  15856. results: function results() {
  15857. return 0 !== R.length && "" != R.html();
  15858. }
  15859. },
  15860. clear: {
  15861. cache: function cache(e) {
  15862. var t = k.data(h.cache);
  15863. e ? e && t && t[e] && (m.debug("Removing value from cache", e), delete t[e], k.data(h.cache, t)) : (m.debug("Clearing cache", e), k.removeData(h.cache));
  15864. }
  15865. },
  15866. read: {
  15867. cache: function cache(e) {
  15868. var t = k.data(h.cache);
  15869. return !!g.cache && (m.verbose("Checking cache for generated html for query", e), "object" == _typeof(t) && t[e] !== i && t[e]);
  15870. }
  15871. },
  15872. create: {
  15873. categoryResults: function categoryResults(t) {
  15874. var n = {};
  15875. return e.each(t, function (e, t) {
  15876. t.category && (n[t.category] === i ? (m.verbose("Creating new category of results", t.category), n[t.category] = {
  15877. name: t.category,
  15878. results: [t]
  15879. }) : n[t.category].results.push(t));
  15880. }), n;
  15881. },
  15882. id: function id(e, t) {
  15883. var n,
  15884. o = e + 1;
  15885. return t !== i ? (n = String.fromCharCode(97 + t) + o, m.verbose("Creating category result id", n)) : (n = o, m.verbose("Creating result id", n)), n;
  15886. },
  15887. results: function results() {
  15888. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  15889. }
  15890. },
  15891. inject: {
  15892. result: function result(e, t, n) {
  15893. m.verbose("Injecting result into results");
  15894. var o = n !== i ? R.children().eq(n).children(y.results).first().children(y.result).eq(t) : R.children(y.result).eq(t);
  15895. m.verbose("Injecting results metadata", o), o.data(h.result, e);
  15896. },
  15897. id: function id(t) {
  15898. m.debug("Injecting unique ids into results");
  15899. var n = 0,
  15900. o = 0;
  15901. return "category" === g.type ? e.each(t, function (t, a) {
  15902. o = 0, e.each(a.results, function (e, t) {
  15903. var r = a.results[e];
  15904. r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  15905. }), n++;
  15906. }) : e.each(t, function (e, n) {
  15907. var a = t[e];
  15908. a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  15909. }), t;
  15910. }
  15911. },
  15912. save: {
  15913. results: function results(e) {
  15914. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  15915. }
  15916. },
  15917. write: {
  15918. cache: function cache(e, t) {
  15919. var n = k.data(h.cache) !== i ? k.data(h.cache) : {};
  15920. g.cache && (m.verbose("Writing generated html to cache", e, t), n[e] = t, k.data(h.cache, n));
  15921. }
  15922. },
  15923. addResults: function addResults(t) {
  15924. if (e.isFunction(g.onResultsAdd) && !1 === g.onResultsAdd.call(R, t)) return m.debug("onResultsAdd callback cancelled default action"), !1;
  15925. t ? (R.html(t), m.refreshResults(), g.selectFirstResult && m.select.firstResult(), m.showResults()) : m.hideResults(function () {
  15926. R.empty();
  15927. });
  15928. },
  15929. showResults: function showResults(t) {
  15930. t = e.isFunction(t) ? t : function () {}, D || !m.is.visible() && m.has.results() && (m.can.transition() ? (m.debug("Showing results with css animations"), R.transition({
  15931. animation: g.transition + " in",
  15932. debug: g.debug,
  15933. verbose: g.verbose,
  15934. duration: g.duration,
  15935. onComplete: function onComplete() {
  15936. t();
  15937. },
  15938. queue: !0
  15939. })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  15940. },
  15941. hideResults: function hideResults(t) {
  15942. t = e.isFunction(t) ? t : function () {}, m.is.visible() && (m.can.transition() ? (m.debug("Hiding results with css animations"), R.transition({
  15943. animation: g.transition + " out",
  15944. debug: g.debug,
  15945. verbose: g.verbose,
  15946. duration: g.duration,
  15947. onComplete: function onComplete() {
  15948. t();
  15949. },
  15950. queue: !0
  15951. })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  15952. },
  15953. generateResults: function generateResults(t) {
  15954. m.debug("Generating html from response", t);
  15955. var n = g.templates[g.type],
  15956. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  15957. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  15958. a = "";
  15959. return i || o ? (g.maxResults > 0 && (i ? "standard" == g.type && m.error(x.maxResults) : t[b.results] = t[b.results].slice(0, g.maxResults)), e.isFunction(n) ? a = n(t, b) : m.error(x.noTemplate, !1)) : g.showNoResults && (a = m.displayMessage(x.noResults, "empty")), g.onResults.call(E, t), a;
  15960. },
  15961. displayMessage: function displayMessage(e, t) {
  15962. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  15963. },
  15964. setting: function setting(t, n) {
  15965. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  15966. if (n === i) return g[t];
  15967. g[t] = n;
  15968. }
  15969. },
  15970. internal: function internal(t, n) {
  15971. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  15972. if (n === i) return m[t];
  15973. m[t] = n;
  15974. }
  15975. },
  15976. debug: function debug() {
  15977. !g.silent && g.debug && (g.performance ? m.performance.log(arguments) : (m.debug = Function.prototype.bind.call(console.info, console, g.name + ":"), m.debug.apply(console, arguments)));
  15978. },
  15979. verbose: function verbose() {
  15980. !g.silent && g.verbose && g.debug && (g.performance ? m.performance.log(arguments) : (m.verbose = Function.prototype.bind.call(console.info, console, g.name + ":"), m.verbose.apply(console, arguments)));
  15981. },
  15982. error: function error() {
  15983. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  15984. },
  15985. performance: {
  15986. log: function log(e) {
  15987. var t, n;
  15988. g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  15989. Name: e[0],
  15990. Arguments: [].slice.call(e, 1) || "",
  15991. Element: E,
  15992. "Execution Time": n
  15993. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  15994. },
  15995. display: function display() {
  15996. var t = g.name + ":",
  15997. n = 0;
  15998. l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  15999. n += t["Execution Time"];
  16000. }), t += " " + n + "ms", s && (t += " '" + s + "'"), r.length > 1 && (t += " (" + r.length + ")"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  16001. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  16002. }), console.groupEnd()), c = [];
  16003. }
  16004. },
  16005. invoke: function invoke(t, n, o) {
  16006. var r,
  16007. s,
  16008. l,
  16009. c = F;
  16010. return n = n || f, o = E || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  16011. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  16012. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16013. if (c[a] !== i) return s = c[a], !1;
  16014. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  16015. c = c[o];
  16016. }
  16017. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  16018. }
  16019. }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  16020. }), a !== i ? a : this;
  16021. }, e.fn.search.settings = {
  16022. name: "Search",
  16023. namespace: "search",
  16024. silent: !1,
  16025. debug: !1,
  16026. verbose: !1,
  16027. performance: !0,
  16028. type: "standard",
  16029. minCharacters: 1,
  16030. selectFirstResult: !1,
  16031. apiSettings: !1,
  16032. source: !1,
  16033. searchOnFocus: !0,
  16034. searchFields: ["title", "description"],
  16035. displayField: "",
  16036. fullTextSearch: "exact",
  16037. automatic: !0,
  16038. hideDelay: 0,
  16039. searchDelay: 200,
  16040. maxResults: 7,
  16041. cache: !0,
  16042. showNoResults: !0,
  16043. transition: "scale",
  16044. duration: 200,
  16045. easing: "easeOutExpo",
  16046. onSelect: !1,
  16047. onResultsAdd: !1,
  16048. onSearchQuery: function onSearchQuery(e) {},
  16049. onResults: function onResults(e) {},
  16050. onResultsOpen: function onResultsOpen() {},
  16051. onResultsClose: function onResultsClose() {},
  16052. className: {
  16053. animating: "animating",
  16054. active: "active",
  16055. empty: "empty",
  16056. focus: "focus",
  16057. hidden: "hidden",
  16058. loading: "loading",
  16059. results: "results",
  16060. pressed: "down"
  16061. },
  16062. error: {
  16063. source: "Cannot search. No source used, and Semantic API module was not included",
  16064. noResults: "Your search returned no results",
  16065. logging: "Error in debug logging, exiting.",
  16066. noEndpoint: "No search endpoint was specified",
  16067. noTemplate: "A valid template name was not specified.",
  16068. oldSearchSyntax: "searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.",
  16069. serverError: "There was an issue querying the server.",
  16070. maxResults: "Results must be an array to use maxResults setting",
  16071. method: "The method you called is not defined."
  16072. },
  16073. metadata: {
  16074. cache: "cache",
  16075. results: "results",
  16076. result: "result"
  16077. },
  16078. regExp: {
  16079. escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
  16080. beginsWith: "(?:s|^)"
  16081. },
  16082. fields: {
  16083. categories: "results",
  16084. categoryName: "name",
  16085. categoryResults: "results",
  16086. description: "description",
  16087. image: "image",
  16088. price: "price",
  16089. results: "results",
  16090. title: "title",
  16091. url: "url",
  16092. action: "action",
  16093. actionText: "text",
  16094. actionURL: "url"
  16095. },
  16096. selector: {
  16097. prompt: ".prompt",
  16098. searchButton: ".search.button",
  16099. results: ".results",
  16100. message: ".results > .message",
  16101. category: ".category",
  16102. result: ".result",
  16103. title: ".title, .name"
  16104. },
  16105. templates: {
  16106. escape: function escape(e) {
  16107. var t = {
  16108. "&": "&amp;",
  16109. "<": "&lt;",
  16110. ">": "&gt;",
  16111. '"': "&quot;",
  16112. "'": "&#x27;",
  16113. "`": "&#x60;"
  16114. };
  16115. return /[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  16116. return t[e];
  16117. }) : e;
  16118. },
  16119. message: function message(e, t) {
  16120. var n = "";
  16121. return e !== i && t !== i && (n += '<div class="message ' + t + '">', n += "empty" == t ? '<div class="header">No Results</div class="header"><div class="description">' + e + '</div class="description">' : ' <div class="description">' + e + "</div>", n += "</div>"), n;
  16122. },
  16123. category: function category(t, n) {
  16124. var o = "";
  16125. e.fn.search.settings.templates.escape;
  16126. return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  16127. a[n.results] !== i && a.results.length > 0 && (o += '<div class="category">', a[n.categoryName] !== i && (o += '<div class="name">' + a[n.categoryName] + "</div>"), o += '<div class="results">', e.each(a.results, function (e, t) {
  16128. t[n.url] ? o += '<a class="result" href="' + t[n.url] + '">' : o += '<a class="result">', t[n.image] !== i && (o += '<div class="image"> <img src="' + t[n.image] + '"></div>'), o += '<div class="content">', t[n.price] !== i && (o += '<div class="price">' + t[n.price] + "</div>"), t[n.title] !== i && (o += '<div class="title">' + t[n.title] + "</div>"), t[n.description] !== i && (o += '<div class="description">' + t[n.description] + "</div>"), o += "</div>", o += "</a>";
  16129. }), o += "</div>", o += "</div>");
  16130. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  16131. },
  16132. standard: function standard(t, n) {
  16133. var o = "";
  16134. return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  16135. t[n.url] ? o += '<a class="result" href="' + t[n.url] + '">' : o += '<a class="result">', t[n.image] !== i && (o += '<div class="image"> <img src="' + t[n.image] + '"></div>'), o += '<div class="content">', t[n.price] !== i && (o += '<div class="price">' + t[n.price] + "</div>"), t[n.title] !== i && (o += '<div class="title">' + t[n.title] + "</div>"), t[n.description] !== i && (o += '<div class="description">' + t[n.description] + "</div>"), o += "</div>", o += "</a>";
  16136. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  16137. }
  16138. }
  16139. };
  16140. }(jQuery, window, document), function (e, t, n, i) {
  16141. "use strict";
  16142. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  16143. var a,
  16144. r = e(this),
  16145. s = (e("body"), new Date().getTime()),
  16146. l = [],
  16147. c = arguments[0],
  16148. u = "string" == typeof c,
  16149. d = [].slice.call(arguments, 1),
  16150. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16151. setTimeout(e, 0);
  16152. };
  16153. return r.each(function () {
  16154. var t,
  16155. m,
  16156. g,
  16157. p = r.selector || "",
  16158. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  16159. v = h.namespace,
  16160. b = h.selector,
  16161. y = h.error,
  16162. x = h.className,
  16163. C = "." + v,
  16164. w = "module-" + v,
  16165. S = e(this),
  16166. k = S.find(b.sides),
  16167. T = S.find(b.side),
  16168. A = !1,
  16169. R = this,
  16170. P = S.data(w);
  16171. g = {
  16172. initialize: function initialize() {
  16173. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  16174. },
  16175. instantiate: function instantiate() {
  16176. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  16177. },
  16178. destroy: function destroy() {
  16179. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  16180. },
  16181. refresh: function refresh() {
  16182. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  16183. },
  16184. repaint: function repaint() {
  16185. g.verbose("Forcing repaint event");
  16186. (k[0] || n.createElement("div")).offsetWidth;
  16187. },
  16188. animate: function animate(e, n) {
  16189. g.verbose("Animating box with properties", e), n = n || function (e) {
  16190. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  16191. }, h.beforeChange.call(m[0]), g.get.transitionEvent() ? (g.verbose("Starting CSS animation"), S.addClass(x.animating), k.css(e).one(g.get.transitionEvent(), n), g.set.duration(h.duration), f(function () {
  16192. S.addClass(x.animating), t.addClass(x.hidden);
  16193. })) : n();
  16194. },
  16195. queue: function queue(e) {
  16196. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  16197. g.debug("Executing queued animation"), setTimeout(function () {
  16198. S.shape(e);
  16199. }, 0);
  16200. });
  16201. },
  16202. reset: function reset() {
  16203. g.verbose("Animating states reset"), S.removeClass(x.animating).attr("style", "").removeAttr("style"), k.attr("style", "").removeAttr("style"), T.attr("style", "").removeAttr("style").removeClass(x.hidden), m.removeClass(x.animating).attr("style", "").removeAttr("style");
  16204. },
  16205. is: {
  16206. complete: function complete() {
  16207. return T.filter("." + x.active)[0] == m[0];
  16208. },
  16209. animating: function animating() {
  16210. return S.hasClass(x.animating);
  16211. }
  16212. },
  16213. set: {
  16214. defaultSide: function defaultSide() {
  16215. t = S.find("." + h.className.active), m = t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first(), A = !1, g.verbose("Active side set to", t), g.verbose("Next side set to", m);
  16216. },
  16217. duration: function duration(e) {
  16218. e = "number" == typeof (e = e || h.duration) ? e + "ms" : e, g.verbose("Setting animation duration", e), (h.duration || 0 === h.duration) && k.add(T).css({
  16219. "-webkit-transition-duration": e,
  16220. "-moz-transition-duration": e,
  16221. "-ms-transition-duration": e,
  16222. "-o-transition-duration": e,
  16223. "transition-duration": e
  16224. });
  16225. },
  16226. currentStageSize: function currentStageSize() {
  16227. var e = S.find("." + h.className.active),
  16228. t = e.outerWidth(!0),
  16229. n = e.outerHeight(!0);
  16230. S.css({
  16231. width: t,
  16232. height: n
  16233. });
  16234. },
  16235. stageSize: function stageSize() {
  16236. var e = S.clone().addClass(x.loading),
  16237. t = e.find("." + h.className.active),
  16238. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  16239. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  16240. o = "next" == h.height ? n.outerHeight(!0) : "initial" == h.height ? S.height() : h.height;
  16241. t.removeClass(x.active), n.addClass(x.active), e.insertAfter(S), e.remove(), "auto" != h.width && (S.css("width", i + h.jitter), g.verbose("Specifying width during animation", i)), "auto" != h.height && (S.css("height", o + h.jitter), g.verbose("Specifying height during animation", o));
  16242. },
  16243. nextSide: function nextSide(e) {
  16244. A = e, m = T.filter(e), A = T.index(m), 0 === m.length && (g.set.defaultSide(), g.error(y.side)), g.verbose("Next side manually set to", m);
  16245. },
  16246. active: function active() {
  16247. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  16248. }
  16249. },
  16250. flip: {
  16251. up: function up() {
  16252. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16253. if (g.is.animating()) g.queue("flip up");else {
  16254. g.debug("Flipping up", m);
  16255. var e = g.get.transform.up();
  16256. g.set.stageSize(), g.stage.above(), g.animate(e);
  16257. }
  16258. } else g.debug("Side already visible", m);
  16259. },
  16260. down: function down() {
  16261. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16262. if (g.is.animating()) g.queue("flip down");else {
  16263. g.debug("Flipping down", m);
  16264. var e = g.get.transform.down();
  16265. g.set.stageSize(), g.stage.below(), g.animate(e);
  16266. }
  16267. } else g.debug("Side already visible", m);
  16268. },
  16269. left: function left() {
  16270. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16271. if (g.is.animating()) g.queue("flip left");else {
  16272. g.debug("Flipping left", m);
  16273. var e = g.get.transform.left();
  16274. g.set.stageSize(), g.stage.left(), g.animate(e);
  16275. }
  16276. } else g.debug("Side already visible", m);
  16277. },
  16278. right: function right() {
  16279. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16280. if (g.is.animating()) g.queue("flip right");else {
  16281. g.debug("Flipping right", m);
  16282. var e = g.get.transform.right();
  16283. g.set.stageSize(), g.stage.right(), g.animate(e);
  16284. }
  16285. } else g.debug("Side already visible", m);
  16286. },
  16287. over: function over() {
  16288. !g.is.complete() || g.is.animating() || h.allowRepeats ? g.is.animating() ? g.queue("flip over") : (g.debug("Flipping over", m), g.set.stageSize(), g.stage.behind(), g.animate(g.get.transform.over())) : g.debug("Side already visible", m);
  16289. },
  16290. back: function back() {
  16291. !g.is.complete() || g.is.animating() || h.allowRepeats ? g.is.animating() ? g.queue("flip back") : (g.debug("Flipping back", m), g.set.stageSize(), g.stage.behind(), g.animate(g.get.transform.back())) : g.debug("Side already visible", m);
  16292. }
  16293. },
  16294. get: {
  16295. transform: {
  16296. up: function up() {
  16297. return {
  16298. transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)"
  16299. };
  16300. },
  16301. down: function down() {
  16302. return {
  16303. transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)"
  16304. };
  16305. },
  16306. left: function left() {
  16307. return {
  16308. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)"
  16309. };
  16310. },
  16311. right: function right() {
  16312. return {
  16313. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)"
  16314. };
  16315. },
  16316. over: function over() {
  16317. return {
  16318. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)"
  16319. };
  16320. },
  16321. back: function back() {
  16322. return {
  16323. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)"
  16324. };
  16325. }
  16326. },
  16327. transitionEvent: function transitionEvent() {
  16328. var e,
  16329. t = n.createElement("element"),
  16330. o = {
  16331. transition: "transitionend",
  16332. OTransition: "oTransitionEnd",
  16333. MozTransition: "transitionend",
  16334. WebkitTransition: "webkitTransitionEnd"
  16335. };
  16336. for (e in o) {
  16337. if (t.style[e] !== i) return o[e];
  16338. }
  16339. },
  16340. nextSide: function nextSide() {
  16341. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  16342. }
  16343. },
  16344. stage: {
  16345. above: function above() {
  16346. var e = {
  16347. origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2,
  16348. depth: {
  16349. active: m.outerHeight(!0) / 2,
  16350. next: t.outerHeight(!0) / 2
  16351. }
  16352. };
  16353. g.verbose("Setting the initial animation position as above", m, e), k.css({
  16354. transform: "translateZ(-" + e.depth.active + "px)"
  16355. }), t.css({
  16356. transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)"
  16357. }), m.addClass(x.animating).css({
  16358. top: e.origin + "px",
  16359. transform: "rotateX(90deg) translateZ(" + e.depth.next + "px)"
  16360. });
  16361. },
  16362. below: function below() {
  16363. var e = {
  16364. origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2,
  16365. depth: {
  16366. active: m.outerHeight(!0) / 2,
  16367. next: t.outerHeight(!0) / 2
  16368. }
  16369. };
  16370. g.verbose("Setting the initial animation position as below", m, e), k.css({
  16371. transform: "translateZ(-" + e.depth.active + "px)"
  16372. }), t.css({
  16373. transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)"
  16374. }), m.addClass(x.animating).css({
  16375. top: e.origin + "px",
  16376. transform: "rotateX(-90deg) translateZ(" + e.depth.next + "px)"
  16377. });
  16378. },
  16379. left: function left() {
  16380. var e = t.outerWidth(!0),
  16381. n = m.outerWidth(!0),
  16382. i = {
  16383. origin: (e - n) / 2,
  16384. depth: {
  16385. active: n / 2,
  16386. next: e / 2
  16387. }
  16388. };
  16389. g.verbose("Setting the initial animation position as left", m, i), k.css({
  16390. transform: "translateZ(-" + i.depth.active + "px)"
  16391. }), t.css({
  16392. transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)"
  16393. }), m.addClass(x.animating).css({
  16394. left: i.origin + "px",
  16395. transform: "rotateY(-90deg) translateZ(" + i.depth.next + "px)"
  16396. });
  16397. },
  16398. right: function right() {
  16399. var e = t.outerWidth(!0),
  16400. n = m.outerWidth(!0),
  16401. i = {
  16402. origin: (e - n) / 2,
  16403. depth: {
  16404. active: n / 2,
  16405. next: e / 2
  16406. }
  16407. };
  16408. g.verbose("Setting the initial animation position as left", m, i), k.css({
  16409. transform: "translateZ(-" + i.depth.active + "px)"
  16410. }), t.css({
  16411. transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)"
  16412. }), m.addClass(x.animating).css({
  16413. left: i.origin + "px",
  16414. transform: "rotateY(90deg) translateZ(" + i.depth.next + "px)"
  16415. });
  16416. },
  16417. behind: function behind() {
  16418. var e = t.outerWidth(!0),
  16419. n = m.outerWidth(!0),
  16420. i = {
  16421. origin: (e - n) / 2,
  16422. depth: {
  16423. active: n / 2,
  16424. next: e / 2
  16425. }
  16426. };
  16427. g.verbose("Setting the initial animation position as behind", m, i), t.css({
  16428. transform: "rotateY(0deg)"
  16429. }), m.addClass(x.animating).css({
  16430. left: i.origin + "px",
  16431. transform: "rotateY(-180deg)"
  16432. });
  16433. }
  16434. },
  16435. setting: function setting(t, n) {
  16436. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  16437. if (n === i) return h[t];
  16438. e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  16439. }
  16440. },
  16441. internal: function internal(t, n) {
  16442. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  16443. if (n === i) return g[t];
  16444. g[t] = n;
  16445. }
  16446. },
  16447. debug: function debug() {
  16448. !h.silent && h.debug && (h.performance ? g.performance.log(arguments) : (g.debug = Function.prototype.bind.call(console.info, console, h.name + ":"), g.debug.apply(console, arguments)));
  16449. },
  16450. verbose: function verbose() {
  16451. !h.silent && h.verbose && h.debug && (h.performance ? g.performance.log(arguments) : (g.verbose = Function.prototype.bind.call(console.info, console, h.name + ":"), g.verbose.apply(console, arguments)));
  16452. },
  16453. error: function error() {
  16454. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  16455. },
  16456. performance: {
  16457. log: function log(e) {
  16458. var t, n;
  16459. h.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  16460. Name: e[0],
  16461. Arguments: [].slice.call(e, 1) || "",
  16462. Element: R,
  16463. "Execution Time": n
  16464. })), clearTimeout(g.performance.timer), g.performance.timer = setTimeout(g.performance.display, 500);
  16465. },
  16466. display: function display() {
  16467. var t = h.name + ":",
  16468. n = 0;
  16469. s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  16470. n += t["Execution Time"];
  16471. }), t += " " + n + "ms", p && (t += " '" + p + "'"), r.length > 1 && (t += " (" + r.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  16472. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  16473. }), console.groupEnd()), l = [];
  16474. }
  16475. },
  16476. invoke: function invoke(t, n, o) {
  16477. var r,
  16478. s,
  16479. l,
  16480. c = P;
  16481. return n = n || d, o = R || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  16482. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  16483. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16484. if (c[a] !== i) return s = c[a], !1;
  16485. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  16486. c = c[o];
  16487. }
  16488. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  16489. }
  16490. }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  16491. }), a !== i ? a : this;
  16492. }, e.fn.shape.settings = {
  16493. name: "Shape",
  16494. silent: !1,
  16495. debug: !1,
  16496. verbose: !1,
  16497. jitter: 0,
  16498. performance: !0,
  16499. namespace: "shape",
  16500. width: "initial",
  16501. height: "initial",
  16502. beforeChange: function beforeChange() {},
  16503. onChange: function onChange() {},
  16504. allowRepeats: !1,
  16505. duration: !1,
  16506. error: {
  16507. side: "You tried to switch to a side that does not exist.",
  16508. method: "The method you called is not defined"
  16509. },
  16510. className: {
  16511. animating: "animating",
  16512. hidden: "hidden",
  16513. loading: "loading",
  16514. active: "active"
  16515. },
  16516. selector: {
  16517. sides: ".sides",
  16518. side: ".side"
  16519. }
  16520. };
  16521. }(jQuery, window, document), function (e, t, n, i) {
  16522. "use strict";
  16523. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  16524. var a,
  16525. r = e(this),
  16526. s = e(t),
  16527. l = e(n),
  16528. c = e("html"),
  16529. u = e("head"),
  16530. d = r.selector || "",
  16531. f = new Date().getTime(),
  16532. m = [],
  16533. g = arguments[0],
  16534. p = "string" == typeof g,
  16535. h = [].slice.call(arguments, 1),
  16536. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16537. setTimeout(e, 0);
  16538. };
  16539. return r.each(function () {
  16540. var r,
  16541. b,
  16542. y,
  16543. x,
  16544. C,
  16545. w,
  16546. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  16547. k = S.selector,
  16548. T = S.className,
  16549. A = S.namespace,
  16550. R = S.regExp,
  16551. P = S.error,
  16552. E = "." + A,
  16553. F = "module-" + A,
  16554. O = e(this),
  16555. D = e(S.context),
  16556. q = O.children(k.sidebar),
  16557. j = (D.children(k.fixed), D.children(k.pusher)),
  16558. z = this,
  16559. I = O.data(F);
  16560. w = {
  16561. initialize: function initialize() {
  16562. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  16563. w.setup.cache();
  16564. }), w.instantiate();
  16565. },
  16566. instantiate: function instantiate() {
  16567. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  16568. },
  16569. create: {
  16570. id: function id() {
  16571. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  16572. }
  16573. },
  16574. destroy: function destroy() {
  16575. w.verbose("Destroying previous module for", O), O.off(E).removeData(F), w.is.ios() && w.remove.ios(), D.off(b), s.off(b), l.off(b);
  16576. },
  16577. event: {
  16578. clickaway: function clickaway(e) {
  16579. var t = j.find(e.target).length > 0 || j.is(e.target),
  16580. n = D.is(e.target);
  16581. t && (w.verbose("User clicked on dimmed page"), w.hide()), n && (w.verbose("User clicked on dimmable context (scaled out page)"), w.hide());
  16582. },
  16583. touch: function touch(e) {},
  16584. containScroll: function containScroll(e) {
  16585. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  16586. },
  16587. scroll: function scroll(t) {
  16588. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  16589. }
  16590. },
  16591. bind: {
  16592. clickaway: function clickaway() {
  16593. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  16594. },
  16595. scrollLock: function scrollLock() {
  16596. S.scrollLock && (w.debug("Disabling page scroll"), s.on("DOMMouseScroll" + b, w.event.scroll)), w.verbose("Adding events to contain sidebar scroll"), l.on("touchmove" + b, w.event.touch), O.on("scroll" + E, w.event.containScroll);
  16597. }
  16598. },
  16599. unbind: {
  16600. clickaway: function clickaway() {
  16601. w.verbose("Removing clickaway events from context", D), D.off(b);
  16602. },
  16603. scrollLock: function scrollLock() {
  16604. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  16605. }
  16606. },
  16607. add: {
  16608. inlineCSS: function inlineCSS() {
  16609. var t,
  16610. n = w.cache.width || O.outerWidth(),
  16611. i = w.cache.height || O.outerHeight(),
  16612. o = w.is.rtl(),
  16613. a = w.get.direction(),
  16614. s = {
  16615. left: n,
  16616. right: -n,
  16617. top: i,
  16618. bottom: -i
  16619. };
  16620. o && (w.verbose("RTL detected, flipping widths"), s.left = -n, s.right = n), t = "<style>", "left" === a || "right" === a ? (w.debug("Adding CSS rules for animation distance", n), t += " .ui.visible." + a + ".sidebar ~ .fixed, .ui.visible." + a + ".sidebar ~ .pusher { -webkit-transform: translate3d(" + s[a] + "px, 0, 0); transform: translate3d(" + s[a] + "px, 0, 0); }") : "top" !== a && "bottom" != a || (t += " .ui.visible." + a + ".sidebar ~ .fixed, .ui.visible." + a + ".sidebar ~ .pusher { -webkit-transform: translate3d(0, " + s[a] + "px, 0); transform: translate3d(0, " + s[a] + "px, 0); }"), w.is.ie() && ("left" === a || "right" === a ? (w.debug("Adding CSS rules for animation distance", n), t += " body.pushable > .ui.visible." + a + ".sidebar ~ .pusher:after { -webkit-transform: translate3d(" + s[a] + "px, 0, 0); transform: translate3d(" + s[a] + "px, 0, 0); }") : "top" !== a && "bottom" != a || (t += " body.pushable > .ui.visible." + a + ".sidebar ~ .pusher:after { -webkit-transform: translate3d(0, " + s[a] + "px, 0); transform: translate3d(0, " + s[a] + "px, 0); }"), t += " body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after, body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after { -webkit-transform: translate3d(0px, 0, 0); transform: translate3d(0px, 0, 0); }"), r = e(t += "</style>").appendTo(u), w.debug("Adding sizing css to head", r);
  16621. }
  16622. },
  16623. refresh: function refresh() {
  16624. w.verbose("Refreshing selector cache"), D = e(S.context), q = D.children(k.sidebar), j = D.children(k.pusher), D.children(k.fixed), w.clear.cache();
  16625. },
  16626. refreshSidebars: function refreshSidebars() {
  16627. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  16628. },
  16629. repaint: function repaint() {
  16630. w.verbose("Forcing repaint event"), z.style.display = "none";
  16631. z.offsetHeight;
  16632. z.scrollTop = z.scrollTop, z.style.display = "";
  16633. },
  16634. setup: {
  16635. cache: function cache() {
  16636. w.cache = {
  16637. width: O.outerWidth(),
  16638. height: O.outerHeight(),
  16639. rtl: "rtl" == O.css("direction")
  16640. };
  16641. },
  16642. layout: function layout() {
  16643. 0 === D.children(k.pusher).length && (w.debug("Adding wrapper element for sidebar"), w.error(P.pusher), j = e('<div class="pusher" />'), D.children().not(k.omitted).not(q).wrapAll(j), w.refresh()), 0 !== O.nextAll(k.pusher).length && O.nextAll(k.pusher)[0] === j[0] || (w.debug("Moved sidebar to correct parent element"), w.error(P.movedSidebar, z), O.detach().prependTo(D), w.refresh()), w.clear.cache(), w.set.pushable(), w.set.direction();
  16644. }
  16645. },
  16646. attachEvents: function attachEvents(t, n) {
  16647. var i = e(t);
  16648. n = e.isFunction(w[n]) ? w[n] : w.toggle, i.length > 0 ? (w.debug("Attaching sidebar events to element", t, n), i.on("click" + E, n)) : w.error(P.notFound, t);
  16649. },
  16650. show: function show(t) {
  16651. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  16652. if (w.refreshSidebars(), S.overlay && (w.error(P.overlay), S.transition = "overlay"), w.refresh(), w.othersActive()) if (w.debug("Other sidebars currently visible"), S.exclusive) {
  16653. if ("overlay" != S.transition) return void w.hideOthers(w.show);
  16654. w.hideOthers();
  16655. } else S.transition = "overlay";
  16656. w.pushPage(function () {
  16657. t.call(z), S.onShow.call(z);
  16658. }), S.onChange.call(z), S.onVisible.call(z);
  16659. } else w.debug("Sidebar is already visible");
  16660. },
  16661. hide: function hide(t) {
  16662. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  16663. t.call(z), S.onHidden.call(z);
  16664. }), S.onChange.call(z), S.onHide.call(z));
  16665. },
  16666. othersAnimating: function othersAnimating() {
  16667. return q.not(O).filter("." + T.animating).length > 0;
  16668. },
  16669. othersVisible: function othersVisible() {
  16670. return q.not(O).filter("." + T.visible).length > 0;
  16671. },
  16672. othersActive: function othersActive() {
  16673. return w.othersVisible() || w.othersAnimating();
  16674. },
  16675. hideOthers: function hideOthers(e) {
  16676. var t = q.not(O).filter("." + T.visible),
  16677. n = t.length,
  16678. i = 0;
  16679. e = e || function () {}, t.sidebar("hide", function () {
  16680. ++i == n && e();
  16681. });
  16682. },
  16683. toggle: function toggle() {
  16684. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  16685. },
  16686. pushPage: function pushPage(t) {
  16687. var n,
  16688. i,
  16689. _o,
  16690. a = w.get.transition(),
  16691. r = "overlay" === a || w.othersActive() ? O : j;
  16692. t = e.isFunction(t) ? t : function () {}, "scale down" == S.transition && w.scrollToTop(), w.set.transition(a), w.repaint(), n = function n() {
  16693. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  16694. }, i = function i() {
  16695. w.set.dimmed();
  16696. }, _o = function o(e) {
  16697. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  16698. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  16699. },
  16700. pullPage: function pullPage(t) {
  16701. var n,
  16702. _i,
  16703. o = w.get.transition(),
  16704. a = "overlay" == o || w.othersActive() ? O : j;
  16705. t = e.isFunction(t) ? t : function () {}, w.verbose("Removing context push state", w.get.direction()), w.unbind.clickaway(), w.unbind.scrollLock(), n = function n() {
  16706. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  16707. }, _i = function i(e) {
  16708. e.target == a[0] && (a.off(C + b, _i), w.remove.animating(), w.remove.transition(), w.remove.inlineCSS(), ("scale down" == o || S.returnScroll && w.is.mobile()) && w.scrollBack(), t.call(z));
  16709. }, a.off(C + b), a.on(C + b, _i), v(n);
  16710. },
  16711. scrollToTop: function scrollToTop() {
  16712. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  16713. },
  16714. scrollBack: function scrollBack() {
  16715. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  16716. },
  16717. clear: {
  16718. cache: function cache() {
  16719. w.verbose("Clearing cached dimensions"), w.cache = {};
  16720. }
  16721. },
  16722. set: {
  16723. ios: function ios() {
  16724. c.addClass(T.ios);
  16725. },
  16726. pushed: function pushed() {
  16727. D.addClass(T.pushed);
  16728. },
  16729. pushable: function pushable() {
  16730. D.addClass(T.pushable);
  16731. },
  16732. dimmed: function dimmed() {
  16733. j.addClass(T.dimmed);
  16734. },
  16735. active: function active() {
  16736. O.addClass(T.active);
  16737. },
  16738. animating: function animating() {
  16739. O.addClass(T.animating);
  16740. },
  16741. transition: function transition(e) {
  16742. e = e || w.get.transition(), O.addClass(e);
  16743. },
  16744. direction: function direction(e) {
  16745. e = e || w.get.direction(), O.addClass(T[e]);
  16746. },
  16747. visible: function visible() {
  16748. O.addClass(T.visible);
  16749. },
  16750. overlay: function overlay() {
  16751. O.addClass(T.overlay);
  16752. }
  16753. },
  16754. remove: {
  16755. inlineCSS: function inlineCSS() {
  16756. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  16757. },
  16758. ios: function ios() {
  16759. c.removeClass(T.ios);
  16760. },
  16761. pushed: function pushed() {
  16762. D.removeClass(T.pushed);
  16763. },
  16764. pushable: function pushable() {
  16765. D.removeClass(T.pushable);
  16766. },
  16767. active: function active() {
  16768. O.removeClass(T.active);
  16769. },
  16770. animating: function animating() {
  16771. O.removeClass(T.animating);
  16772. },
  16773. transition: function transition(e) {
  16774. e = e || w.get.transition(), O.removeClass(e);
  16775. },
  16776. direction: function direction(e) {
  16777. e = e || w.get.direction(), O.removeClass(T[e]);
  16778. },
  16779. visible: function visible() {
  16780. O.removeClass(T.visible);
  16781. },
  16782. overlay: function overlay() {
  16783. O.removeClass(T.overlay);
  16784. }
  16785. },
  16786. get: {
  16787. direction: function direction() {
  16788. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  16789. },
  16790. transition: function transition() {
  16791. var e,
  16792. t = w.get.direction();
  16793. return e = w.is.mobile() ? "auto" == S.mobileTransition ? S.defaultTransition.mobile[t] : S.mobileTransition : "auto" == S.transition ? S.defaultTransition.computer[t] : S.transition, w.verbose("Determined transition", e), e;
  16794. },
  16795. transitionEvent: function transitionEvent() {
  16796. var e,
  16797. t = n.createElement("element"),
  16798. o = {
  16799. transition: "transitionend",
  16800. OTransition: "oTransitionEnd",
  16801. MozTransition: "transitionend",
  16802. WebkitTransition: "webkitTransitionEnd"
  16803. };
  16804. for (e in o) {
  16805. if (t.style[e] !== i) return o[e];
  16806. }
  16807. }
  16808. },
  16809. is: {
  16810. ie: function ie() {
  16811. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  16812. },
  16813. ios: function ios() {
  16814. var e = navigator.userAgent,
  16815. t = e.match(R.ios),
  16816. n = e.match(R.mobileChrome);
  16817. return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  16818. },
  16819. mobile: function mobile() {
  16820. var e = navigator.userAgent;
  16821. return e.match(R.mobile) ? (w.verbose("Browser was found to be mobile", e), !0) : (w.verbose("Browser is not mobile, using regular transition", e), !1);
  16822. },
  16823. hidden: function hidden() {
  16824. return !w.is.visible();
  16825. },
  16826. visible: function visible() {
  16827. return O.hasClass(T.visible);
  16828. },
  16829. open: function open() {
  16830. return w.is.visible();
  16831. },
  16832. closed: function closed() {
  16833. return w.is.hidden();
  16834. },
  16835. vertical: function vertical() {
  16836. return O.hasClass(T.top);
  16837. },
  16838. animating: function animating() {
  16839. return D.hasClass(T.animating);
  16840. },
  16841. rtl: function rtl() {
  16842. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  16843. }
  16844. },
  16845. setting: function setting(t, n) {
  16846. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  16847. if (n === i) return S[t];
  16848. e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  16849. }
  16850. },
  16851. internal: function internal(t, n) {
  16852. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  16853. if (n === i) return w[t];
  16854. w[t] = n;
  16855. }
  16856. },
  16857. debug: function debug() {
  16858. !S.silent && S.debug && (S.performance ? w.performance.log(arguments) : (w.debug = Function.prototype.bind.call(console.info, console, S.name + ":"), w.debug.apply(console, arguments)));
  16859. },
  16860. verbose: function verbose() {
  16861. !S.silent && S.verbose && S.debug && (S.performance ? w.performance.log(arguments) : (w.verbose = Function.prototype.bind.call(console.info, console, S.name + ":"), w.verbose.apply(console, arguments)));
  16862. },
  16863. error: function error() {
  16864. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  16865. },
  16866. performance: {
  16867. log: function log(e) {
  16868. var t, n;
  16869. S.performance && (n = (t = new Date().getTime()) - (f || t), f = t, m.push({
  16870. Name: e[0],
  16871. Arguments: [].slice.call(e, 1) || "",
  16872. Element: z,
  16873. "Execution Time": n
  16874. })), clearTimeout(w.performance.timer), w.performance.timer = setTimeout(w.performance.display, 500);
  16875. },
  16876. display: function display() {
  16877. var t = S.name + ":",
  16878. n = 0;
  16879. f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  16880. n += t["Execution Time"];
  16881. }), t += " " + n + "ms", d && (t += " '" + d + "'"), (console.group !== i || console.table !== i) && m.length > 0 && (console.groupCollapsed(t), console.table ? console.table(m) : e.each(m, function (e, t) {
  16882. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  16883. }), console.groupEnd()), m = [];
  16884. }
  16885. },
  16886. invoke: function invoke(t, n, o) {
  16887. var r,
  16888. s,
  16889. l,
  16890. c = I;
  16891. return n = n || h, o = z || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  16892. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  16893. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16894. if (c[a] !== i) return s = c[a], !1;
  16895. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (w.error(P.method, t), !1);
  16896. c = c[o];
  16897. }
  16898. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  16899. }
  16900. }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  16901. }), a !== i ? a : this;
  16902. }, e.fn.sidebar.settings = {
  16903. name: "Sidebar",
  16904. namespace: "sidebar",
  16905. silent: !1,
  16906. debug: !1,
  16907. verbose: !1,
  16908. performance: !0,
  16909. transition: "auto",
  16910. mobileTransition: "auto",
  16911. defaultTransition: {
  16912. computer: {
  16913. left: "uncover",
  16914. right: "uncover",
  16915. top: "overlay",
  16916. bottom: "overlay"
  16917. },
  16918. mobile: {
  16919. left: "uncover",
  16920. right: "uncover",
  16921. top: "overlay",
  16922. bottom: "overlay"
  16923. }
  16924. },
  16925. context: "body",
  16926. exclusive: !1,
  16927. closable: !0,
  16928. dimPage: !0,
  16929. scrollLock: !1,
  16930. returnScroll: !1,
  16931. delaySetup: !1,
  16932. duration: 500,
  16933. onChange: function onChange() {},
  16934. onShow: function onShow() {},
  16935. onHide: function onHide() {},
  16936. onHidden: function onHidden() {},
  16937. onVisible: function onVisible() {},
  16938. className: {
  16939. active: "active",
  16940. animating: "animating",
  16941. dimmed: "dimmed",
  16942. ios: "ios",
  16943. pushable: "pushable",
  16944. pushed: "pushed",
  16945. right: "right",
  16946. top: "top",
  16947. left: "left",
  16948. bottom: "bottom",
  16949. visible: "visible"
  16950. },
  16951. selector: {
  16952. fixed: ".fixed",
  16953. omitted: "script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed",
  16954. pusher: ".pusher",
  16955. sidebar: ".ui.sidebar"
  16956. },
  16957. regExp: {
  16958. ios: /(iPad|iPhone|iPod)/g,
  16959. mobileChrome: /(CriOS)/g,
  16960. mobile: /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g
  16961. },
  16962. error: {
  16963. method: "The method you called is not defined.",
  16964. pusher: "Had to add pusher element. For optimal performance make sure body content is inside a pusher element",
  16965. movedSidebar: "Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag",
  16966. overlay: "The overlay setting is no longer supported, use animation: overlay",
  16967. notFound: "There were no elements that matched the specified selector"
  16968. }
  16969. };
  16970. }(jQuery, window, document), function (e, t, n, i) {
  16971. "use strict";
  16972. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  16973. var a,
  16974. r = e(this),
  16975. s = r.selector || "",
  16976. l = new Date().getTime(),
  16977. c = [],
  16978. u = arguments[0],
  16979. d = "string" == typeof u,
  16980. f = [].slice.call(arguments, 1);
  16981. return r.each(function () {
  16982. var r,
  16983. m,
  16984. g,
  16985. p,
  16986. h,
  16987. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  16988. b = v.className,
  16989. y = v.namespace,
  16990. x = v.error,
  16991. C = "." + y,
  16992. w = "module-" + y,
  16993. S = e(this),
  16994. k = e(t),
  16995. T = e(v.scrollContext),
  16996. A = (S.selector, S.data(w)),
  16997. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16998. setTimeout(e, 0);
  16999. },
  17000. P = this;
  17001. h = {
  17002. initialize: function initialize() {
  17003. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  17004. },
  17005. instantiate: function instantiate() {
  17006. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  17007. },
  17008. destroy: function destroy() {
  17009. h.verbose("Destroying previous instance"), h.reset(), g && g.disconnect(), p && p.disconnect(), k.off("load" + C, h.event.load).off("resize" + C, h.event.resize), T.off("scrollchange" + C, h.event.scrollchange), S.removeData(w);
  17010. },
  17011. observeChanges: function observeChanges() {
  17012. "MutationObserver" in t && (g = new MutationObserver(h.event.documentChanged), p = new MutationObserver(h.event.changed), g.observe(n, {
  17013. childList: !0,
  17014. subtree: !0
  17015. }), p.observe(P, {
  17016. childList: !0,
  17017. subtree: !0
  17018. }), p.observe(m[0], {
  17019. childList: !0,
  17020. subtree: !0
  17021. }), h.debug("Setting up mutation observer", p));
  17022. },
  17023. determineContainer: function determineContainer() {
  17024. r = v.container ? e(v.container) : S.offsetParent();
  17025. },
  17026. determineContext: function determineContext() {
  17027. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  17028. },
  17029. checkErrors: function checkErrors() {
  17030. if (h.is.hidden() && h.error(x.visible, S), h.cache.element.height > h.cache.context.height) return h.reset(), void h.error(x.elementSize, S);
  17031. },
  17032. bind: {
  17033. events: function events() {
  17034. k.on("load" + C, h.event.load).on("resize" + C, h.event.resize), T.off("scroll" + C).on("scroll" + C, h.event.scroll).on("scrollchange" + C, h.event.scrollchange);
  17035. }
  17036. },
  17037. event: {
  17038. changed: function changed(e) {
  17039. clearTimeout(h.timer), h.timer = setTimeout(function () {
  17040. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  17041. }, 100);
  17042. },
  17043. documentChanged: function documentChanged(t) {
  17044. [].forEach.call(t, function (t) {
  17045. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  17046. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  17047. });
  17048. });
  17049. },
  17050. load: function load() {
  17051. h.verbose("Page contents finished loading"), R(h.refresh);
  17052. },
  17053. resize: function resize() {
  17054. h.verbose("Window resized"), R(h.refresh);
  17055. },
  17056. scroll: function scroll() {
  17057. R(function () {
  17058. T.triggerHandler("scrollchange" + C, T.scrollTop());
  17059. });
  17060. },
  17061. scrollchange: function scrollchange(e, t) {
  17062. h.stick(t), v.onScroll.call(P);
  17063. }
  17064. },
  17065. refresh: function refresh(e) {
  17066. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  17067. },
  17068. supports: {
  17069. sticky: function sticky() {
  17070. var t = e("<div/>");
  17071. t[0];
  17072. return t.addClass(b.supported), t.css("position").match("sticky");
  17073. }
  17074. },
  17075. save: {
  17076. lastScroll: function lastScroll(e) {
  17077. h.lastScroll = e;
  17078. },
  17079. elementScroll: function elementScroll(e) {
  17080. h.elementScroll = e;
  17081. },
  17082. positions: function positions() {
  17083. var e = {
  17084. height: T.height()
  17085. },
  17086. t = {
  17087. margin: {
  17088. top: parseInt(S.css("margin-top"), 10),
  17089. bottom: parseInt(S.css("margin-bottom"), 10)
  17090. },
  17091. offset: S.offset(),
  17092. width: S.outerWidth(),
  17093. height: S.outerHeight()
  17094. },
  17095. n = {
  17096. offset: m.offset(),
  17097. height: m.outerHeight()
  17098. };
  17099. r.outerHeight();
  17100. h.is.standardScroll() || (h.debug("Non-standard scroll. Removing scroll offset from element offset"), e.top = T.scrollTop(), e.left = T.scrollLeft(), t.offset.top += e.top, n.offset.top += e.top, t.offset.left += e.left, n.offset.left += e.left), h.cache = {
  17101. fits: t.height + v.offset <= e.height,
  17102. sameHeight: t.height == n.height,
  17103. scrollContext: {
  17104. height: e.height
  17105. },
  17106. element: {
  17107. margin: t.margin,
  17108. top: t.offset.top - t.margin.top,
  17109. left: t.offset.left,
  17110. width: t.width,
  17111. height: t.height,
  17112. bottom: t.offset.top + t.height
  17113. },
  17114. context: {
  17115. top: n.offset.top,
  17116. height: n.height,
  17117. bottom: n.offset.top + n.height
  17118. }
  17119. }, h.set.containerSize(), h.stick(), h.debug("Caching element positions", h.cache);
  17120. }
  17121. },
  17122. get: {
  17123. direction: function direction(e) {
  17124. var t = "down";
  17125. return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  17126. },
  17127. scrollChange: function scrollChange(e) {
  17128. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  17129. },
  17130. currentElementScroll: function currentElementScroll() {
  17131. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  17132. },
  17133. elementScroll: function elementScroll(e) {
  17134. e = e || T.scrollTop();
  17135. var t = h.cache.element,
  17136. n = h.cache.scrollContext,
  17137. i = h.get.scrollChange(e),
  17138. o = t.height - n.height + v.offset,
  17139. a = h.get.currentElementScroll(),
  17140. r = a + i;
  17141. return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  17142. }
  17143. },
  17144. remove: {
  17145. lastScroll: function lastScroll() {
  17146. delete h.lastScroll;
  17147. },
  17148. elementScroll: function elementScroll(e) {
  17149. delete h.elementScroll;
  17150. },
  17151. minimumSize: function minimumSize() {
  17152. r.css("min-height", "");
  17153. },
  17154. offset: function offset() {
  17155. S.css("margin-top", "");
  17156. }
  17157. },
  17158. set: {
  17159. offset: function offset() {
  17160. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  17161. },
  17162. containerSize: function containerSize() {
  17163. var e = r.get(0).tagName;
  17164. "HTML" === e || "body" == e ? h.determineContainer() : Math.abs(r.outerHeight() - h.cache.context.height) > v.jitter && (h.debug("Context has padding, specifying exact height for container", h.cache.context.height), r.css({
  17165. height: h.cache.context.height
  17166. }));
  17167. },
  17168. minimumSize: function minimumSize() {
  17169. var e = h.cache.element;
  17170. r.css("min-height", e.height);
  17171. },
  17172. scroll: function scroll(e) {
  17173. h.debug("Setting scroll on element", e), h.elementScroll != e && (h.is.top() && S.css("bottom", "").css("top", -e), h.is.bottom() && S.css("top", "").css("bottom", e));
  17174. },
  17175. size: function size() {
  17176. 0 !== h.cache.element.height && 0 !== h.cache.element.width && (P.style.setProperty("width", h.cache.element.width + "px", "important"), P.style.setProperty("height", h.cache.element.height + "px", "important"));
  17177. }
  17178. },
  17179. is: {
  17180. standardScroll: function standardScroll() {
  17181. return T[0] == t;
  17182. },
  17183. top: function top() {
  17184. return S.hasClass(b.top);
  17185. },
  17186. bottom: function bottom() {
  17187. return S.hasClass(b.bottom);
  17188. },
  17189. initialPosition: function initialPosition() {
  17190. return !h.is.fixed() && !h.is.bound();
  17191. },
  17192. hidden: function hidden() {
  17193. return !S.is(":visible");
  17194. },
  17195. bound: function bound() {
  17196. return S.hasClass(b.bound);
  17197. },
  17198. fixed: function fixed() {
  17199. return S.hasClass(b.fixed);
  17200. }
  17201. },
  17202. stick: function stick(e) {
  17203. var t = e || T.scrollTop(),
  17204. n = h.cache,
  17205. i = n.fits,
  17206. o = n.sameHeight,
  17207. a = n.element,
  17208. r = n.scrollContext,
  17209. s = n.context,
  17210. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  17211. c = (e = {
  17212. top: t + l,
  17213. bottom: t + l + r.height
  17214. }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  17215. u = !i;
  17216. 0 !== a.height && !o && (h.is.initialPosition() ? e.top >= s.bottom ? (h.debug("Initial element position is bottom of container"), h.bindBottom()) : e.top > a.top && (a.height + e.top - c >= s.bottom ? (h.debug("Initial element position is bottom of container"), h.bindBottom()) : (h.debug("Initial element position is fixed"), h.fixTop())) : h.is.fixed() ? h.is.top() ? e.top <= a.top ? (h.debug("Fixed element reached top of container"), h.setInitialPosition()) : a.height + e.top - c >= s.bottom ? (h.debug("Fixed element reached bottom of container"), h.bindBottom()) : u && (h.set.scroll(c), h.save.lastScroll(e.top), h.save.elementScroll(c)) : h.is.bottom() && (e.bottom - a.height <= a.top ? (h.debug("Bottom fixed rail has reached top of container"), h.setInitialPosition()) : e.bottom >= s.bottom ? (h.debug("Bottom fixed rail has reached bottom of container"), h.bindBottom()) : u && (h.set.scroll(c), h.save.lastScroll(e.top), h.save.elementScroll(c))) : h.is.bottom() && (e.top <= a.top ? (h.debug("Jumped from bottom fixed to top fixed, most likely used home/end button"), h.setInitialPosition()) : v.pushing ? h.is.bound() && e.bottom <= s.bottom && (h.debug("Fixing bottom attached element to bottom of browser."), h.fixBottom()) : h.is.bound() && e.top <= s.bottom - a.height && (h.debug("Fixing bottom attached element to top of browser."), h.fixTop())));
  17217. },
  17218. bindTop: function bindTop() {
  17219. h.debug("Binding element to top of parent container"), h.remove.offset(), S.css({
  17220. left: "",
  17221. top: "",
  17222. marginBottom: ""
  17223. }).removeClass(b.fixed).removeClass(b.bottom).addClass(b.bound).addClass(b.top), v.onTop.call(P), v.onUnstick.call(P);
  17224. },
  17225. bindBottom: function bindBottom() {
  17226. h.debug("Binding element to bottom of parent container"), h.remove.offset(), S.css({
  17227. left: "",
  17228. top: ""
  17229. }).removeClass(b.fixed).removeClass(b.top).addClass(b.bound).addClass(b.bottom), v.onBottom.call(P), v.onUnstick.call(P);
  17230. },
  17231. setInitialPosition: function setInitialPosition() {
  17232. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  17233. },
  17234. fixTop: function fixTop() {
  17235. h.debug("Fixing element to top of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({
  17236. left: h.cache.element.left,
  17237. bottom: "",
  17238. marginBottom: ""
  17239. }).removeClass(b.bound).removeClass(b.bottom).addClass(b.fixed).addClass(b.top), v.onStick.call(P);
  17240. },
  17241. fixBottom: function fixBottom() {
  17242. h.debug("Sticking element to bottom of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({
  17243. left: h.cache.element.left,
  17244. bottom: "",
  17245. marginBottom: ""
  17246. }).removeClass(b.bound).removeClass(b.top).addClass(b.fixed).addClass(b.bottom), v.onStick.call(P);
  17247. },
  17248. unbind: function unbind() {
  17249. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  17250. },
  17251. unfix: function unfix() {
  17252. h.is.fixed() && (h.debug("Removing fixed position on element"), h.remove.minimumSize(), h.remove.offset(), S.removeClass(b.fixed).removeClass(b.top).removeClass(b.bottom), v.onUnstick.call(P));
  17253. },
  17254. reset: function reset() {
  17255. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  17256. },
  17257. resetCSS: function resetCSS() {
  17258. S.css({
  17259. width: "",
  17260. height: ""
  17261. }), r.css({
  17262. height: ""
  17263. });
  17264. },
  17265. setting: function setting(t, n) {
  17266. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  17267. if (n === i) return v[t];
  17268. v[t] = n;
  17269. }
  17270. },
  17271. internal: function internal(t, n) {
  17272. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  17273. if (n === i) return h[t];
  17274. h[t] = n;
  17275. }
  17276. },
  17277. debug: function debug() {
  17278. !v.silent && v.debug && (v.performance ? h.performance.log(arguments) : (h.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), h.debug.apply(console, arguments)));
  17279. },
  17280. verbose: function verbose() {
  17281. !v.silent && v.verbose && v.debug && (v.performance ? h.performance.log(arguments) : (h.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), h.verbose.apply(console, arguments)));
  17282. },
  17283. error: function error() {
  17284. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  17285. },
  17286. performance: {
  17287. log: function log(e) {
  17288. var t, n;
  17289. v.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  17290. Name: e[0],
  17291. Arguments: [].slice.call(e, 1) || "",
  17292. Element: P,
  17293. "Execution Time": n
  17294. })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 0);
  17295. },
  17296. display: function display() {
  17297. var t = v.name + ":",
  17298. n = 0;
  17299. l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  17300. n += t["Execution Time"];
  17301. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  17302. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  17303. }), console.groupEnd()), c = [];
  17304. }
  17305. },
  17306. invoke: function invoke(t, n, o) {
  17307. var r,
  17308. s,
  17309. l,
  17310. c = A;
  17311. return n = n || f, o = P || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  17312. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  17313. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  17314. if (c[a] !== i) return s = c[a], !1;
  17315. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  17316. c = c[o];
  17317. }
  17318. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  17319. }
  17320. }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  17321. }), a !== i ? a : this;
  17322. }, e.fn.sticky.settings = {
  17323. name: "Sticky",
  17324. namespace: "sticky",
  17325. silent: !1,
  17326. debug: !1,
  17327. verbose: !0,
  17328. performance: !0,
  17329. pushing: !1,
  17330. context: !1,
  17331. container: !1,
  17332. scrollContext: t,
  17333. offset: 0,
  17334. bottomOffset: 0,
  17335. jitter: 5,
  17336. setSize: !0,
  17337. observeChanges: !1,
  17338. onReposition: function onReposition() {},
  17339. onScroll: function onScroll() {},
  17340. onStick: function onStick() {},
  17341. onUnstick: function onUnstick() {},
  17342. onTop: function onTop() {},
  17343. onBottom: function onBottom() {},
  17344. error: {
  17345. container: "Sticky element must be inside a relative container",
  17346. visible: "Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.",
  17347. method: "The method you called is not defined.",
  17348. invalidContext: "Context specified does not exist",
  17349. elementSize: "Sticky element is larger than its container, cannot create sticky."
  17350. },
  17351. className: {
  17352. bound: "bound",
  17353. fixed: "fixed",
  17354. supported: "native",
  17355. top: "top",
  17356. bottom: "bottom"
  17357. }
  17358. };
  17359. }(jQuery, window, document), function (e, t, n, i) {
  17360. "use strict";
  17361. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  17362. var a,
  17363. r = e.isFunction(this) ? e(t) : e(this),
  17364. s = r.selector || "",
  17365. l = new Date().getTime(),
  17366. c = [],
  17367. u = arguments[0],
  17368. d = "string" == typeof u,
  17369. f = [].slice.call(arguments, 1),
  17370. m = !1;
  17371. return r.each(function () {
  17372. var g,
  17373. p,
  17374. h,
  17375. v,
  17376. b,
  17377. y,
  17378. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  17379. C = x.className,
  17380. w = x.metadata,
  17381. S = x.selector,
  17382. k = x.error,
  17383. T = "." + x.namespace,
  17384. A = "module-" + x.namespace,
  17385. R = e(this),
  17386. P = {},
  17387. E = !0,
  17388. F = 0,
  17389. O = this,
  17390. D = R.data(A);
  17391. b = {
  17392. initialize: function initialize() {
  17393. b.debug("Initializing tab menu item", R), b.fix.callbacks(), b.determineTabs(), b.debug("Determining tabs", x.context, p), x.auto && b.set.auto(), b.bind.events(), x.history && !m && (b.initializeHistory(), m = !0), b.instantiate();
  17394. },
  17395. instantiate: function instantiate() {
  17396. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  17397. },
  17398. destroy: function destroy() {
  17399. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  17400. },
  17401. bind: {
  17402. events: function events() {
  17403. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  17404. }
  17405. },
  17406. determineTabs: function determineTabs() {
  17407. var t;
  17408. "parent" === x.context ? (R.closest(S.ui).length > 0 ? (t = R.closest(S.ui), b.verbose("Using closest UI element as parent", t)) : t = R, g = t.parent(), b.verbose("Determined parent element for creating context", g)) : x.context ? (g = e(x.context), b.verbose("Using selector for tab context", x.context, g)) : g = e("body"), x.childrenOnly ? (p = g.children(S.tabs), b.debug("Searching tab context children for tabs", g, p)) : (p = g.find(S.tabs), b.debug("Searching tab context for tabs", g, p));
  17409. },
  17410. fix: {
  17411. callbacks: function callbacks() {
  17412. e.isPlainObject(o) && (o.onTabLoad || o.onTabInit) && (o.onTabLoad && (o.onLoad = o.onTabLoad, delete o.onTabLoad, b.error(k.legacyLoad, o.onLoad)), o.onTabInit && (o.onFirstLoad = o.onTabInit, delete o.onTabInit, b.error(k.legacyInit, o.onFirstLoad)), x = e.extend(!0, {}, e.fn.tab.settings, o));
  17413. }
  17414. },
  17415. initializeHistory: function initializeHistory() {
  17416. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;
  17417. if ("state" == x.historyType) {
  17418. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;
  17419. e.address.history(!0).state(x.path);
  17420. }
  17421. e.address.bind("change", b.event.history.change);
  17422. },
  17423. event: {
  17424. click: function click(t) {
  17425. var n = e(this).data(w.tab);
  17426. n !== i ? (x.history ? (b.verbose("Updating page state", t), e.address.value(n)) : (b.verbose("Changing tab", t), b.changeTab(n)), t.preventDefault()) : b.debug("No tab specified");
  17427. },
  17428. history: {
  17429. change: function change(t) {
  17430. var n = t.pathNames.join("/") || b.get.initialPath(),
  17431. o = x.templates.determineTitle(n) || !1;
  17432. b.performance.display(), b.debug("History change event", n, t), y = t, n !== i && b.changeTab(n), o && e.address.title(o);
  17433. }
  17434. }
  17435. },
  17436. refresh: function refresh() {
  17437. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  17438. },
  17439. cache: {
  17440. read: function read(e) {
  17441. return e !== i && P[e];
  17442. },
  17443. add: function add(e, t) {
  17444. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  17445. },
  17446. remove: function remove(e) {
  17447. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  17448. }
  17449. },
  17450. set: {
  17451. auto: function auto() {
  17452. var t = "string" == typeof x.path ? x.path.replace(/\/$/, "") + "/{$tab}" : "/{$tab}";
  17453. b.verbose("Setting up automatic tab retrieval from server", t), e.isPlainObject(x.apiSettings) ? x.apiSettings.url = t : x.apiSettings = {
  17454. url: t
  17455. };
  17456. },
  17457. loading: function loading(e) {
  17458. var t = b.get.tabElement(e);
  17459. t.hasClass(C.loading) || (b.verbose("Setting loading state for", t), t.addClass(C.loading).siblings(p).removeClass(C.active + " " + C.loading), t.length > 0 && x.onRequest.call(t[0], e));
  17460. },
  17461. state: function state(t) {
  17462. e.address.value(t);
  17463. }
  17464. },
  17465. changeTab: function changeTab(n) {
  17466. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  17467. o = x.auto || e.isPlainObject(x.apiSettings),
  17468. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);
  17469. n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  17470. var s,
  17471. l,
  17472. c,
  17473. u,
  17474. d = a.slice(0, t + 1),
  17475. f = b.utilities.arrayToPath(d),
  17476. m = b.is.tab(f),
  17477. p = t + 1 == a.length,
  17478. S = b.get.tabElement(f);
  17479. if (b.verbose("Looking for tab", r), m) {
  17480. if (b.verbose("Tab was found", r), h = f, v = b.utilities.filterArray(a, d), p ? u = !0 : (l = a.slice(0, t + 2), c = b.utilities.arrayToPath(l), (u = !b.is.tab(c)) && b.verbose("Tab parameters found", l)), u && o) return i ? (b.debug("Ignoring remote content on first tab load", f), E = !1, b.cache.add(n, S.html()), b.activate.all(f), x.onFirstLoad.call(S[0], f, v, y), x.onLoad.call(S[0], f, v, y)) : (b.activate.navigation(f), b.fetch.content(f, n)), !1;
  17481. b.debug("Opened local tab", f), b.activate.all(f), b.cache.read(f) || (b.cache.add(f, !0), b.debug("First time tab loaded calling tab init"), x.onFirstLoad.call(S[0], f, v, y)), x.onLoad.call(S[0], f, v, y);
  17482. } else {
  17483. if (-1 != n.search("/") || "" === n) return b.error(k.missingTab, R, g, f), !1;
  17484. if (f = (s = e("#" + n + ', a[name="' + n + '"]')).closest("[data-tab]").data(w.tab), S = b.get.tabElement(f), s && s.length > 0 && f) return b.debug("Anchor link used, opening parent tab", S, s), S.hasClass(C.active) || setTimeout(function () {
  17485. b.scrollTo(s);
  17486. }, 0), b.activate.all(f), b.cache.read(f) || (b.cache.add(f, !0), b.debug("First time tab loaded calling tab init"), x.onFirstLoad.call(S[0], f, v, y)), x.onLoad.call(S[0], f, v, y), !1;
  17487. }
  17488. });
  17489. },
  17490. scrollTo: function scrollTo(t) {
  17491. var i = !!(t && t.length > 0) && t.offset().top;
  17492. !1 !== i && (b.debug("Forcing scroll to an in-page link in a hidden tab", i, t), e(n).scrollTop(i));
  17493. },
  17494. update: {
  17495. content: function content(t, n, o) {
  17496. var a = b.get.tabElement(t),
  17497. r = a[0];
  17498. o = o !== i ? o : x.evaluateScripts, "string" == typeof x.cacheType && "dom" == x.cacheType.toLowerCase() && "string" != typeof n ? a.empty().append(e(n).clone(!0)) : o ? (b.debug("Updating HTML and evaluating inline scripts", t, n), a.html(n)) : (b.debug("Updating HTML", t, n), r.innerHTML = n);
  17499. }
  17500. },
  17501. fetch: {
  17502. content: function content(t, n) {
  17503. var o,
  17504. a,
  17505. r = b.get.tabElement(t),
  17506. s = {
  17507. dataType: "html",
  17508. encodeParameters: !1,
  17509. on: "now",
  17510. cache: x.alwaysRefresh,
  17511. headers: {
  17512. "X-Remote": !0
  17513. },
  17514. onSuccess: function onSuccess(e) {
  17515. "response" == x.cacheType && b.cache.add(n, e), b.update.content(t, e), t == h ? (b.debug("Content loaded", t), b.activate.tab(t)) : b.debug("Content loaded in background", t), x.onFirstLoad.call(r[0], t, v, y), x.onLoad.call(r[0], t, v, y), x.loadOnce ? b.cache.add(n, !0) : "string" == typeof x.cacheType && "dom" == x.cacheType.toLowerCase() && r.children().length > 0 ? setTimeout(function () {
  17516. var e = r.children().clone(!0);
  17517. e = e.not("script"), b.cache.add(n, e);
  17518. }, 0) : b.cache.add(n, r.html());
  17519. },
  17520. urlData: {
  17521. tab: n
  17522. }
  17523. },
  17524. l = r.api("get request") || !1,
  17525. c = l && "pending" === l.state();
  17526. n = n || t, a = b.cache.read(n), x.cache && a ? (b.activate.tab(t), b.debug("Adding cached content", n), x.loadOnce || ("once" == x.evaluateScripts ? b.update.content(t, a, !1) : b.update.content(t, a)), x.onLoad.call(r[0], t, v, y)) : c ? (b.set.loading(t), b.debug("Content is already loading", n)) : e.api !== i ? (o = e.extend(!0, {}, x.apiSettings, s), b.debug("Retrieving remote content", n, o), b.set.loading(t), r.api(o)) : b.error(k.api);
  17527. }
  17528. },
  17529. activate: {
  17530. all: function all(e) {
  17531. b.activate.tab(e), b.activate.navigation(e);
  17532. },
  17533. tab: function tab(e) {
  17534. var t = b.get.tabElement(e),
  17535. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  17536. i = t.hasClass(C.active);
  17537. b.verbose("Showing tab content for", t), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading), t.length > 0 && x.onVisible.call(t[0], e));
  17538. },
  17539. navigation: function navigation(e) {
  17540. var t = b.get.navElement(e),
  17541. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  17542. i = t.hasClass(C.active);
  17543. b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  17544. }
  17545. },
  17546. deactivate: {
  17547. all: function all() {
  17548. b.deactivate.navigation(), b.deactivate.tabs();
  17549. },
  17550. navigation: function navigation() {
  17551. r.removeClass(C.active);
  17552. },
  17553. tabs: function tabs() {
  17554. p.removeClass(C.active + " " + C.loading);
  17555. }
  17556. },
  17557. is: {
  17558. tab: function tab(e) {
  17559. return e !== i && b.get.tabElement(e).length > 0;
  17560. }
  17561. },
  17562. get: {
  17563. initialPath: function initialPath() {
  17564. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  17565. },
  17566. path: function path() {
  17567. return e.address.value();
  17568. },
  17569. defaultPathArray: function defaultPathArray(e) {
  17570. return b.utilities.pathToArray(b.get.defaultPath(e));
  17571. },
  17572. defaultPath: function defaultPath(e) {
  17573. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;
  17574. if (t) {
  17575. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);
  17576. b.error(k.recursion);
  17577. } else b.debug("No default tabs found for", e, p);
  17578. return F = 0, e;
  17579. },
  17580. navElement: function navElement(e) {
  17581. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  17582. },
  17583. tabElement: function tabElement(e) {
  17584. var t, n, i, o;
  17585. return e = e || h, i = b.utilities.pathToArray(e), o = b.utilities.last(i), t = p.filter("[data-" + w.tab + '="' + e + '"]'), n = p.filter("[data-" + w.tab + '="' + o + '"]'), t.length > 0 ? t : n;
  17586. },
  17587. tab: function tab() {
  17588. return h;
  17589. }
  17590. },
  17591. utilities: {
  17592. filterArray: function filterArray(t, n) {
  17593. return e.grep(t, function (t) {
  17594. return -1 == e.inArray(t, n);
  17595. });
  17596. },
  17597. last: function last(t) {
  17598. return !!e.isArray(t) && t[t.length - 1];
  17599. },
  17600. pathToArray: function pathToArray(e) {
  17601. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  17602. },
  17603. arrayToPath: function arrayToPath(t) {
  17604. return !!e.isArray(t) && t.join("/");
  17605. }
  17606. },
  17607. setting: function setting(t, n) {
  17608. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  17609. if (n === i) return x[t];
  17610. e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  17611. }
  17612. },
  17613. internal: function internal(t, n) {
  17614. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  17615. if (n === i) return b[t];
  17616. b[t] = n;
  17617. }
  17618. },
  17619. debug: function debug() {
  17620. !x.silent && x.debug && (x.performance ? b.performance.log(arguments) : (b.debug = Function.prototype.bind.call(console.info, console, x.name + ":"), b.debug.apply(console, arguments)));
  17621. },
  17622. verbose: function verbose() {
  17623. !x.silent && x.verbose && x.debug && (x.performance ? b.performance.log(arguments) : (b.verbose = Function.prototype.bind.call(console.info, console, x.name + ":"), b.verbose.apply(console, arguments)));
  17624. },
  17625. error: function error() {
  17626. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  17627. },
  17628. performance: {
  17629. log: function log(e) {
  17630. var t, n;
  17631. x.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  17632. Name: e[0],
  17633. Arguments: [].slice.call(e, 1) || "",
  17634. Element: O,
  17635. "Execution Time": n
  17636. })), clearTimeout(b.performance.timer), b.performance.timer = setTimeout(b.performance.display, 500);
  17637. },
  17638. display: function display() {
  17639. var t = x.name + ":",
  17640. n = 0;
  17641. l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  17642. n += t["Execution Time"];
  17643. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  17644. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  17645. }), console.groupEnd()), c = [];
  17646. }
  17647. },
  17648. invoke: function invoke(t, n, o) {
  17649. var r,
  17650. s,
  17651. l,
  17652. c = D;
  17653. return n = n || f, o = O || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  17654. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  17655. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  17656. if (c[a] !== i) return s = c[a], !1;
  17657. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (b.error(k.method, t), !1);
  17658. c = c[o];
  17659. }
  17660. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  17661. }
  17662. }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  17663. }), a !== i ? a : this;
  17664. }, e.tab = function () {
  17665. e(t).tab.apply(this, arguments);
  17666. }, e.fn.tab.settings = {
  17667. name: "Tab",
  17668. namespace: "tab",
  17669. silent: !1,
  17670. debug: !1,
  17671. verbose: !1,
  17672. performance: !0,
  17673. auto: !1,
  17674. history: !1,
  17675. historyType: "hash",
  17676. path: !1,
  17677. context: !1,
  17678. childrenOnly: !1,
  17679. maxDepth: 25,
  17680. deactivate: "siblings",
  17681. alwaysRefresh: !1,
  17682. cache: !0,
  17683. loadOnce: !1,
  17684. cacheType: "response",
  17685. ignoreFirstLoad: !1,
  17686. apiSettings: !1,
  17687. evaluateScripts: "once",
  17688. onFirstLoad: function onFirstLoad(e, t, n) {},
  17689. onLoad: function onLoad(e, t, n) {},
  17690. onVisible: function onVisible(e, t, n) {},
  17691. onRequest: function onRequest(e, t, n) {},
  17692. templates: {
  17693. determineTitle: function determineTitle(e) {}
  17694. },
  17695. error: {
  17696. api: "You attempted to load content without API module",
  17697. method: "The method you called is not defined",
  17698. missingTab: "Activated tab cannot be found. Tabs are case-sensitive.",
  17699. noContent: "The tab you specified is missing a content url.",
  17700. path: "History enabled, but no path was specified",
  17701. recursion: "Max recursive depth reached",
  17702. legacyInit: "onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.",
  17703. legacyLoad: "onTabLoad has been renamed to onLoad in 2.0. Please adjust your code",
  17704. state: "History requires Asual's Address library <https://github.com/asual/jquery-address>"
  17705. },
  17706. metadata: {
  17707. tab: "tab",
  17708. loaded: "loaded",
  17709. promise: "promise"
  17710. },
  17711. className: {
  17712. loading: "loading",
  17713. active: "active"
  17714. },
  17715. selector: {
  17716. tabs: ".ui.tab",
  17717. ui: ".ui"
  17718. }
  17719. };
  17720. }(jQuery, window, document), function (e, t, n, i) {
  17721. "use strict";
  17722. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  17723. var o,
  17724. a = e(this),
  17725. r = a.selector || "",
  17726. s = new Date().getTime(),
  17727. l = [],
  17728. c = arguments,
  17729. u = c[0],
  17730. d = [].slice.call(arguments, 1),
  17731. f = "string" == typeof u;
  17732. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  17733. return a.each(function (t) {
  17734. var m,
  17735. g,
  17736. p,
  17737. h,
  17738. v,
  17739. b,
  17740. y,
  17741. x,
  17742. C,
  17743. w = e(this),
  17744. S = this;
  17745. (C = {
  17746. initialize: function initialize() {
  17747. m = C.get.settings.apply(S, c), h = m.className, p = m.error, v = m.metadata, x = "." + m.namespace, y = "module-" + m.namespace, g = w.data(y) || C, b = C.get.animationEndEvent(), f && (f = C.invoke(u)), !1 === f && (C.verbose("Converted arguments into settings object", m), m.interval ? C.delay(m.animate) : C.animate(), C.instantiate());
  17748. },
  17749. instantiate: function instantiate() {
  17750. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  17751. },
  17752. destroy: function destroy() {
  17753. C.verbose("Destroying previous module for", S), w.removeData(y);
  17754. },
  17755. refresh: function refresh() {
  17756. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  17757. },
  17758. forceRepaint: function forceRepaint() {
  17759. C.verbose("Forcing element repaint");
  17760. var e = w.parent(),
  17761. t = w.next();
  17762. 0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  17763. },
  17764. repaint: function repaint() {
  17765. C.verbose("Repainting element");
  17766. S.offsetWidth;
  17767. },
  17768. delay: function delay(e) {
  17769. var n,
  17770. o = C.get.animationDirection();
  17771. o || (o = C.can.transition() ? C.get.direction() : "static"), e = e !== i ? e : m.interval, n = "auto" == m.reverse && o == h.outward || 1 == m.reverse ? (a.length - t) * m.interval : t * m.interval, C.debug("Delaying animation by", n), setTimeout(C.animate, n);
  17772. },
  17773. animate: function animate(e) {
  17774. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;
  17775. if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  17776. if (m.queue) return !m.allowRepeats && C.has.direction() && C.is.occurring() && !0 !== C.queuing ? C.debug("Animation is currently occurring, preventing queueing same animation", m.animation) : C.queue(m.animation), !1;
  17777. if (!m.allowRepeats && C.is.occurring()) return C.debug("Animation is already occurring, will not execute repeated animation", m.animation), !1;
  17778. C.debug("New animation started, completing previous early", m.animation), g.complete();
  17779. }
  17780. C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  17781. },
  17782. reset: function reset() {
  17783. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  17784. },
  17785. queue: function queue(e) {
  17786. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  17787. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  17788. });
  17789. },
  17790. complete: function complete(e) {
  17791. C.debug("Animation complete", m.animation), C.remove.completeCallback(), C.remove.failSafe(), C.is.looping() || (C.is.outward() ? (C.verbose("Animation is outward, hiding element"), C.restore.conditions(), C.hide()) : C.is.inward() ? (C.verbose("Animation is outward, showing element"), C.restore.conditions(), C.show()) : (C.verbose("Static animation completed"), C.restore.conditions(), m.onComplete.call(S)));
  17792. },
  17793. force: {
  17794. visible: function visible() {
  17795. var e = w.attr("style"),
  17796. t = C.get.userStyle(),
  17797. n = C.get.displayType(),
  17798. o = t + "display: " + n + " !important;",
  17799. a = w.css("display"),
  17800. r = e === i || "" === e;
  17801. a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  17802. },
  17803. hidden: function hidden() {
  17804. var e = w.attr("style"),
  17805. t = w.css("display"),
  17806. n = e === i || "" === e;
  17807. "none" === t || C.is.hidden() ? n && w.removeAttr("style") : (C.verbose("Overriding default display to hide element"), w.css("display", "none"));
  17808. }
  17809. },
  17810. has: {
  17811. direction: function direction(t) {
  17812. var n = !1;
  17813. return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  17814. t !== h.inward && t !== h.outward || (n = !0);
  17815. })), n;
  17816. },
  17817. inlineDisplay: function inlineDisplay() {
  17818. var t = w.attr("style") || "";
  17819. return e.isArray(t.match(/display.*?;/, ""));
  17820. }
  17821. },
  17822. set: {
  17823. animating: function animating(e) {
  17824. var t;
  17825. C.remove.completeCallback(), e = e || m.animation, t = C.get.animationClass(e), C.save.animation(t), C.force.visible(), C.remove.hidden(), C.remove.direction(), C.start.animation(t);
  17826. },
  17827. duration: function duration(e, t) {
  17828. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({
  17829. "animation-duration": t
  17830. }));
  17831. },
  17832. direction: function direction(e) {
  17833. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  17834. },
  17835. looping: function looping() {
  17836. C.debug("Transition set to loop"), w.addClass(h.looping);
  17837. },
  17838. hidden: function hidden() {
  17839. w.addClass(h.transition).addClass(h.hidden);
  17840. },
  17841. inward: function inward() {
  17842. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  17843. },
  17844. outward: function outward() {
  17845. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  17846. },
  17847. visible: function visible() {
  17848. w.addClass(h.transition).addClass(h.visible);
  17849. }
  17850. },
  17851. start: {
  17852. animation: function animation(e) {
  17853. e = e || C.get.animationClass(), C.debug("Starting tween", e), w.addClass(e).one(b + ".complete" + x, C.complete), m.useFailSafe && C.add.failSafe(), C.set.duration(m.duration), m.onStart.call(S);
  17854. }
  17855. },
  17856. save: {
  17857. animation: function animation(e) {
  17858. C.cache || (C.cache = {}), C.cache.animation = e;
  17859. },
  17860. displayType: function displayType(e) {
  17861. "none" !== e && w.data(v.displayType, e);
  17862. },
  17863. transitionExists: function transitionExists(t, n) {
  17864. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  17865. }
  17866. },
  17867. restore: {
  17868. conditions: function conditions() {
  17869. var e = C.get.currentAnimation();
  17870. e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  17871. }
  17872. },
  17873. add: {
  17874. failSafe: function failSafe() {
  17875. var e = C.get.duration();
  17876. C.timer = setTimeout(function () {
  17877. w.triggerHandler(b);
  17878. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  17879. }
  17880. },
  17881. remove: {
  17882. animating: function animating() {
  17883. w.removeClass(h.animating);
  17884. },
  17885. animationCallbacks: function animationCallbacks() {
  17886. C.remove.queueCallback(), C.remove.completeCallback();
  17887. },
  17888. queueCallback: function queueCallback() {
  17889. w.off(".queue" + x);
  17890. },
  17891. completeCallback: function completeCallback() {
  17892. w.off(".complete" + x);
  17893. },
  17894. display: function display() {
  17895. w.css("display", "");
  17896. },
  17897. direction: function direction() {
  17898. w.removeClass(h.inward).removeClass(h.outward);
  17899. },
  17900. duration: function duration() {
  17901. w.css("animation-duration", "");
  17902. },
  17903. failSafe: function failSafe() {
  17904. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  17905. },
  17906. hidden: function hidden() {
  17907. w.removeClass(h.hidden);
  17908. },
  17909. visible: function visible() {
  17910. w.removeClass(h.visible);
  17911. },
  17912. looping: function looping() {
  17913. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  17914. },
  17915. transition: function transition() {
  17916. w.removeClass(h.visible).removeClass(h.hidden);
  17917. }
  17918. },
  17919. get: {
  17920. settings: function settings(t, n, i) {
  17921. return "object" == _typeof(t) ? e.extend(!0, {}, e.fn.transition.settings, t) : "function" == typeof i ? e.extend({}, e.fn.transition.settings, {
  17922. animation: t,
  17923. onComplete: i,
  17924. duration: n
  17925. }) : "string" == typeof n || "number" == typeof n ? e.extend({}, e.fn.transition.settings, {
  17926. animation: t,
  17927. duration: n
  17928. }) : "object" == _typeof(n) ? e.extend({}, e.fn.transition.settings, n, {
  17929. animation: t
  17930. }) : "function" == typeof n ? e.extend({}, e.fn.transition.settings, {
  17931. animation: t,
  17932. onComplete: n
  17933. }) : e.extend({}, e.fn.transition.settings, {
  17934. animation: t
  17935. });
  17936. },
  17937. animationClass: function animationClass(e) {
  17938. var t = e || m.animation,
  17939. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";
  17940. return h.animating + " " + h.transition + " " + n + t;
  17941. },
  17942. currentAnimation: function currentAnimation() {
  17943. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  17944. },
  17945. currentDirection: function currentDirection() {
  17946. return C.is.inward() ? h.inward : h.outward;
  17947. },
  17948. direction: function direction() {
  17949. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  17950. },
  17951. animationDirection: function animationDirection(t) {
  17952. var n;
  17953. return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  17954. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  17955. })), n || !1;
  17956. },
  17957. duration: function duration(e) {
  17958. return !1 === (e = e || m.duration) && (e = w.css("animation-duration") || 0), "string" == typeof e ? e.indexOf("ms") > -1 ? parseFloat(e) : 1e3 * parseFloat(e) : e;
  17959. },
  17960. displayType: function displayType(e) {
  17961. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  17962. },
  17963. userStyle: function userStyle(e) {
  17964. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  17965. },
  17966. transitionExists: function transitionExists(t) {
  17967. return e.fn.transition.exists[t];
  17968. },
  17969. animationStartEvent: function animationStartEvent() {
  17970. var e,
  17971. t = n.createElement("div"),
  17972. o = {
  17973. animation: "animationstart",
  17974. OAnimation: "oAnimationStart",
  17975. MozAnimation: "mozAnimationStart",
  17976. WebkitAnimation: "webkitAnimationStart"
  17977. };
  17978. for (e in o) {
  17979. if (t.style[e] !== i) return o[e];
  17980. }
  17981. return !1;
  17982. },
  17983. animationEndEvent: function animationEndEvent() {
  17984. var e,
  17985. t = n.createElement("div"),
  17986. o = {
  17987. animation: "animationend",
  17988. OAnimation: "oAnimationEnd",
  17989. MozAnimation: "mozAnimationEnd",
  17990. WebkitAnimation: "webkitAnimationEnd"
  17991. };
  17992. for (e in o) {
  17993. if (t.style[e] !== i) return o[e];
  17994. }
  17995. return !1;
  17996. }
  17997. },
  17998. can: {
  17999. transition: function transition(t) {
  18000. var n,
  18001. o,
  18002. a,
  18003. r,
  18004. s,
  18005. l,
  18006. c = m.animation,
  18007. u = C.get.transitionExists(c),
  18008. d = C.get.displayType(!1);
  18009. if (u === i || t) {
  18010. if (C.verbose("Determining whether animation exists"), n = w.attr("class"), o = w.prop("tagName"), r = (a = e("<" + o + " />").addClass(n).insertAfter(w)).addClass(c).removeClass(h.inward).removeClass(h.outward).addClass(h.animating).addClass(h.transition).css("animationName"), s = a.addClass(h.inward).css("animationName"), d || (d = a.attr("class", n).removeAttr("style").removeClass(h.hidden).removeClass(h.visible).show().css("display"), C.verbose("Determining final display state", d), C.save.displayType(d)), a.remove(), r != s) C.debug("Direction exists for animation", c), l = !0;else {
  18011. if ("none" == r || !r) return void C.debug("No animation defined in css", c);
  18012. C.debug("Static animation found", c, d), l = !1;
  18013. }
  18014. C.save.transitionExists(c, l);
  18015. }
  18016. return u !== i ? u : l;
  18017. },
  18018. animate: function animate() {
  18019. return C.can.transition() !== i;
  18020. }
  18021. },
  18022. is: {
  18023. animating: function animating() {
  18024. return w.hasClass(h.animating);
  18025. },
  18026. inward: function inward() {
  18027. return w.hasClass(h.inward);
  18028. },
  18029. outward: function outward() {
  18030. return w.hasClass(h.outward);
  18031. },
  18032. looping: function looping() {
  18033. return w.hasClass(h.looping);
  18034. },
  18035. occurring: function occurring(e) {
  18036. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  18037. },
  18038. visible: function visible() {
  18039. return w.is(":visible");
  18040. },
  18041. hidden: function hidden() {
  18042. return "hidden" === w.css("visibility");
  18043. },
  18044. supported: function supported() {
  18045. return !1 !== b;
  18046. }
  18047. },
  18048. hide: function hide() {
  18049. C.verbose("Hiding element"), C.is.animating() && C.reset(), S.blur(), C.remove.display(), C.remove.visible(), C.set.hidden(), C.force.hidden(), m.onHide.call(S), m.onComplete.call(S);
  18050. },
  18051. show: function show(e) {
  18052. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  18053. },
  18054. toggle: function toggle() {
  18055. C.is.visible() ? C.hide() : C.show();
  18056. },
  18057. stop: function stop() {
  18058. C.debug("Stopping current animation"), w.triggerHandler(b);
  18059. },
  18060. stopAll: function stopAll() {
  18061. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  18062. },
  18063. clear: {
  18064. queue: function queue() {
  18065. C.debug("Clearing animation queue"), C.remove.queueCallback();
  18066. }
  18067. },
  18068. enable: function enable() {
  18069. C.verbose("Starting animation"), w.removeClass(h.disabled);
  18070. },
  18071. disable: function disable() {
  18072. C.debug("Stopping animation"), w.addClass(h.disabled);
  18073. },
  18074. setting: function setting(t, n) {
  18075. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  18076. if (n === i) return m[t];
  18077. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  18078. }
  18079. },
  18080. internal: function internal(t, n) {
  18081. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  18082. if (n === i) return C[t];
  18083. C[t] = n;
  18084. }
  18085. },
  18086. debug: function debug() {
  18087. !m.silent && m.debug && (m.performance ? C.performance.log(arguments) : (C.debug = Function.prototype.bind.call(console.info, console, m.name + ":"), C.debug.apply(console, arguments)));
  18088. },
  18089. verbose: function verbose() {
  18090. !m.silent && m.verbose && m.debug && (m.performance ? C.performance.log(arguments) : (C.verbose = Function.prototype.bind.call(console.info, console, m.name + ":"), C.verbose.apply(console, arguments)));
  18091. },
  18092. error: function error() {
  18093. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  18094. },
  18095. performance: {
  18096. log: function log(e) {
  18097. var t, n;
  18098. m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  18099. Name: e[0],
  18100. Arguments: [].slice.call(e, 1) || "",
  18101. Element: S,
  18102. "Execution Time": n
  18103. })), clearTimeout(C.performance.timer), C.performance.timer = setTimeout(C.performance.display, 500);
  18104. },
  18105. display: function display() {
  18106. var t = m.name + ":",
  18107. n = 0;
  18108. s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  18109. n += t["Execution Time"];
  18110. }), t += " " + n + "ms", r && (t += " '" + r + "'"), a.length > 1 && (t += " (" + a.length + ")"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  18111. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18112. }), console.groupEnd()), l = [];
  18113. }
  18114. },
  18115. invoke: function invoke(t, n, a) {
  18116. var r,
  18117. s,
  18118. l,
  18119. c = g;
  18120. return n = n || d, a = S || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  18121. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  18122. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  18123. if (c[a] !== i) return s = c[a], !1;
  18124. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  18125. c = c[o];
  18126. }
  18127. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s !== i && s;
  18128. }
  18129. }).initialize();
  18130. }), o !== i ? o : this;
  18131. }, e.fn.transition.exists = {}, e.fn.transition.settings = {
  18132. name: "Transition",
  18133. silent: !1,
  18134. debug: !1,
  18135. verbose: !1,
  18136. performance: !0,
  18137. namespace: "transition",
  18138. interval: 0,
  18139. reverse: "auto",
  18140. onStart: function onStart() {},
  18141. onComplete: function onComplete() {},
  18142. onShow: function onShow() {},
  18143. onHide: function onHide() {},
  18144. useFailSafe: !0,
  18145. failSafeDelay: 100,
  18146. allowRepeats: !1,
  18147. displayType: !1,
  18148. animation: "fade",
  18149. duration: !1,
  18150. queue: !0,
  18151. metadata: {
  18152. displayType: "display"
  18153. },
  18154. className: {
  18155. animating: "animating",
  18156. disabled: "disabled",
  18157. hidden: "hidden",
  18158. inward: "in",
  18159. loading: "loading",
  18160. looping: "looping",
  18161. outward: "out",
  18162. transition: "transition",
  18163. visible: "visible"
  18164. },
  18165. error: {
  18166. noAnimation: "Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.",
  18167. repeated: "That animation is already occurring, cancelling repeated animation",
  18168. method: "The method you called is not defined",
  18169. support: "This browser does not support CSS animations"
  18170. }
  18171. };
  18172. }(jQuery, window, document), function (e, t, n, i) {
  18173. "use strict";
  18174. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();
  18175. e.api = e.fn.api = function (n) {
  18176. var o,
  18177. a = e.isFunction(this) ? e(t) : e(this),
  18178. r = a.selector || "",
  18179. s = new Date().getTime(),
  18180. l = [],
  18181. c = arguments[0],
  18182. u = "string" == typeof c,
  18183. d = [].slice.call(arguments, 1);
  18184. return a.each(function () {
  18185. var a,
  18186. f,
  18187. m,
  18188. g,
  18189. p,
  18190. h,
  18191. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  18192. b = v.namespace,
  18193. y = v.metadata,
  18194. x = v.selector,
  18195. C = v.error,
  18196. w = v.className,
  18197. S = "." + b,
  18198. k = "module-" + b,
  18199. T = e(this),
  18200. A = T.closest(x.form),
  18201. R = v.stateContext ? e(v.stateContext) : T,
  18202. P = this,
  18203. E = R[0],
  18204. F = T.data(k);
  18205. h = {
  18206. initialize: function initialize() {
  18207. u || h.bind.events(), h.instantiate();
  18208. },
  18209. instantiate: function instantiate() {
  18210. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  18211. },
  18212. destroy: function destroy() {
  18213. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  18214. },
  18215. bind: {
  18216. events: function events() {
  18217. var e = h.get.event();
  18218. e ? (h.verbose("Attaching API events to element", e), T.on(e + S, h.event.trigger)) : "now" == v.on && (h.debug("Querying API endpoint immediately"), h.query());
  18219. }
  18220. },
  18221. decode: {
  18222. json: function json(e) {
  18223. if (e !== i && "string" == typeof e) try {
  18224. e = JSON.parse(e);
  18225. } catch (e) {}
  18226. return e;
  18227. }
  18228. },
  18229. read: {
  18230. cachedResponse: function cachedResponse(e) {
  18231. var n;
  18232. if (t.Storage !== i) return n = sessionStorage.getItem(e), h.debug("Using cached response", e, n), n = h.decode.json(n);
  18233. h.error(C.noStorage);
  18234. }
  18235. },
  18236. write: {
  18237. cachedResponse: function cachedResponse(n, o) {
  18238. o && "" === o ? h.debug("Response empty, not caching", o) : t.Storage !== i ? (e.isPlainObject(o) && (o = JSON.stringify(o)), sessionStorage.setItem(n, o), h.verbose("Storing cached response for url", n, o)) : h.error(C.noStorage);
  18239. }
  18240. },
  18241. query: function query() {
  18242. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  18243. if (h.is.loading()) {
  18244. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");
  18245. h.debug("Interrupting previous request"), h.abort();
  18246. }
  18247. if (v.defaultData && e.extend(!0, v.urlData, h.get.defaultData()), v.serializeForm && (v.data = h.add.formData(v.data)), !1 === (f = h.get.settings())) return h.cancelled = !0, void h.error(C.beforeSend);
  18248. if (h.cancelled = !1, (m = h.get.templatedURL()) || h.is.mocked()) {
  18249. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  18250. if (f.url = v.base + m, a = e.extend(!0, {}, v, {
  18251. type: v.method || v.type,
  18252. data: g,
  18253. url: v.base + m,
  18254. beforeSend: v.beforeXHR,
  18255. success: function success() {},
  18256. failure: function failure() {},
  18257. complete: function complete() {}
  18258. }), h.debug("Querying URL", a.url), h.verbose("Using AJAX settings", a), "local" === v.cache && h.read.cachedResponse(m)) return h.debug("Response returned from local cache"), h.request = h.create.request(), void h.request.resolveWith(E, [h.read.cachedResponse(m)]);
  18259. v.throttle ? v.throttleFirstRequest || h.timer ? (h.debug("Throttling request", v.throttle), clearTimeout(h.timer), h.timer = setTimeout(function () {
  18260. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  18261. }, v.throttle)) : (h.debug("Sending request", g, a.method), h.send.request(), h.timer = setTimeout(function () {}, v.throttle)) : (h.debug("Sending request", g, a.method), h.send.request());
  18262. }
  18263. } else h.error(C.missingURL);
  18264. }
  18265. },
  18266. should: {
  18267. removeError: function removeError() {
  18268. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  18269. }
  18270. },
  18271. is: {
  18272. disabled: function disabled() {
  18273. return T.filter(x.disabled).length > 0;
  18274. },
  18275. expectingJSON: function expectingJSON() {
  18276. return "json" === v.dataType || "jsonp" === v.dataType;
  18277. },
  18278. form: function form() {
  18279. return T.is("form") || R.is("form");
  18280. },
  18281. mocked: function mocked() {
  18282. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  18283. },
  18284. input: function input() {
  18285. return T.is("input");
  18286. },
  18287. loading: function loading() {
  18288. return !!h.request && "pending" == h.request.state();
  18289. },
  18290. abortedRequest: function abortedRequest(e) {
  18291. return e && e.readyState !== i && 0 === e.readyState ? (h.verbose("XHR request determined to be aborted"), !0) : (h.verbose("XHR request was not aborted"), !1);
  18292. },
  18293. validResponse: function validResponse(t) {
  18294. return h.is.expectingJSON() && e.isFunction(v.successTest) ? (h.debug("Checking JSON returned success", v.successTest, t), v.successTest(t) ? (h.debug("Response passed success test", t), !0) : (h.debug("Response failed success test", t), !1)) : (h.verbose("Response is not JSON, skipping validation", v.successTest, t), !0);
  18295. }
  18296. },
  18297. was: {
  18298. cancelled: function cancelled() {
  18299. return h.cancelled || !1;
  18300. },
  18301. succesful: function succesful() {
  18302. return h.request && "resolved" == h.request.state();
  18303. },
  18304. failure: function failure() {
  18305. return h.request && "rejected" == h.request.state();
  18306. },
  18307. complete: function complete() {
  18308. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  18309. }
  18310. },
  18311. add: {
  18312. urlData: function urlData(t, n) {
  18313. var o, a;
  18314. return t && (o = t.match(v.regExp.required), a = t.match(v.regExp.optional), n = n || v.urlData, o && (h.debug("Looking for required URL variables", o), e.each(o, function (o, a) {
  18315. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  18316. s = e.isPlainObject(n) && n[r] !== i ? n[r] : T.data(r) !== i ? T.data(r) : R.data(r) !== i ? R.data(r) : n[r];
  18317. if (s === i) return h.error(C.requiredParameter, r, t), t = !1, !1;
  18318. h.verbose("Found required variable", r, s), s = v.encodeParameters ? h.get.urlEncodedValue(s) : s, t = t.replace(a, s);
  18319. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  18320. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  18321. s = e.isPlainObject(n) && n[r] !== i ? n[r] : T.data(r) !== i ? T.data(r) : R.data(r) !== i ? R.data(r) : n[r];
  18322. s !== i ? (h.verbose("Optional variable Found", r, s), t = t.replace(a, s)) : (h.verbose("Optional variable not found", r), t = -1 !== t.indexOf("/" + a) ? t.replace("/" + a, "") : t.replace(a, ""));
  18323. }))), t;
  18324. },
  18325. formData: function formData(t) {
  18326. var n = e.fn.serializeObject !== i,
  18327. o = n ? A.serializeObject() : A.serialize();
  18328. return t = t || v.data, e.isPlainObject(t) ? n ? (h.debug("Extending existing data with form data", t, o), t = e.extend(!0, {}, t, o)) : (h.error(C.missingSerialize), h.debug("Cant extend data. Replacing data with form data", t, o), t = o) : (h.debug("Adding form data", o), t = o), t;
  18329. }
  18330. },
  18331. send: {
  18332. request: function request() {
  18333. h.set.loading(), h.request = h.create.request(), h.is.mocked() ? h.mockedXHR = h.create.mockedXHR() : h.xhr = h.create.xhr(), v.onRequest.call(E, h.request, h.xhr);
  18334. }
  18335. },
  18336. event: {
  18337. trigger: function trigger(e) {
  18338. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  18339. },
  18340. xhr: {
  18341. always: function always() {},
  18342. done: function done(t, n, i) {
  18343. var o = this,
  18344. a = new Date().getTime() - p,
  18345. r = v.loadingDuration - a,
  18346. s = !!e.isFunction(v.onResponse) && (h.is.expectingJSON() ? v.onResponse.call(o, e.extend(!0, {}, t)) : v.onResponse.call(o, t));
  18347. r = r > 0 ? r : 0, s && (h.debug("Modified API response in onResponse callback", v.onResponse, s, t), t = s), r > 0 && h.debug("Response completed early delaying state change by", r), setTimeout(function () {
  18348. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  18349. }, r);
  18350. },
  18351. fail: function fail(e, t, n) {
  18352. var i = this,
  18353. o = new Date().getTime() - p,
  18354. a = v.loadingDuration - o;
  18355. (a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  18356. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  18357. }, a);
  18358. }
  18359. },
  18360. request: {
  18361. done: function done(e, t) {
  18362. h.debug("Successful API Response", e), "local" === v.cache && m && (h.write.cachedResponse(m, e), h.debug("Saving server response locally", h.cache)), v.onSuccess.call(E, e, T, t);
  18363. },
  18364. complete: function complete(e, t) {
  18365. var n, i;
  18366. h.was.succesful() ? (i = e, n = t) : (n = e, i = h.get.responseFromXHR(n)), h.remove.loading(), v.onComplete.call(E, i, T, n);
  18367. },
  18368. fail: function fail(e, t, n) {
  18369. var o = h.get.responseFromXHR(e),
  18370. r = h.get.errorFromRequest(o, t, n);
  18371. if ("aborted" == t) return h.debug("XHR Aborted (Most likely caused by page navigation or CORS Policy)", t, n), v.onAbort.call(E, t, T, e), !0;
  18372. "invalid" == t ? h.debug("JSON did not pass success test. A server-side error has most likely occurred", o) : "error" == t && e !== i && (h.debug("XHR produced a server error", t, n), 200 != e.status && n !== i && "" !== n && h.error(C.statusMessage + n, a.url), v.onError.call(E, r, T, e)), v.errorDuration && "aborted" !== t && (h.debug("Adding error state"), h.set.error(), h.should.removeError() && setTimeout(h.remove.error, v.errorDuration)), h.debug("API Request failed", r, e), v.onFailure.call(E, o, T, e);
  18373. }
  18374. }
  18375. },
  18376. create: {
  18377. request: function request() {
  18378. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  18379. },
  18380. mockedXHR: function mockedXHR() {
  18381. var t,
  18382. n,
  18383. i,
  18384. o = v.mockResponse || v.response,
  18385. a = v.mockResponseAsync || v.responseAsync;
  18386. return i = e.Deferred().always(h.event.xhr.complete).done(h.event.xhr.done).fail(h.event.xhr.fail), o ? (e.isFunction(o) ? (h.debug("Using specified synchronous callback", o), n = o.call(E, f)) : (h.debug("Using settings specified response", o), n = o), i.resolveWith(E, [n, !1, {
  18387. responseText: n
  18388. }])) : e.isFunction(a) && (t = function t(e) {
  18389. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, {
  18390. responseText: e
  18391. }]) : i.rejectWith(E, [{
  18392. responseText: e
  18393. }, !1, !1]);
  18394. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  18395. },
  18396. xhr: function xhr() {
  18397. var t;
  18398. return t = e.ajax(a).always(h.event.xhr.always).done(h.event.xhr.done).fail(h.event.xhr.fail), h.verbose("Created server request", t, a), t;
  18399. }
  18400. },
  18401. set: {
  18402. error: function error() {
  18403. h.verbose("Adding error state to element", R), R.addClass(w.error);
  18404. },
  18405. loading: function loading() {
  18406. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  18407. }
  18408. },
  18409. remove: {
  18410. error: function error() {
  18411. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  18412. },
  18413. loading: function loading() {
  18414. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  18415. }
  18416. },
  18417. get: {
  18418. responseFromXHR: function responseFromXHR(t) {
  18419. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  18420. },
  18421. errorFromRequest: function errorFromRequest(t, n, o) {
  18422. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  18423. },
  18424. request: function request() {
  18425. return h.request || !1;
  18426. },
  18427. xhr: function xhr() {
  18428. return h.xhr || !1;
  18429. },
  18430. settings: function settings() {
  18431. var t;
  18432. return (t = v.beforeSend.call(E, v)) && (t.success !== i && (h.debug("Legacy success callback detected", t), h.error(C.legacyParameters, t.success), t.onSuccess = t.success), t.failure !== i && (h.debug("Legacy failure callback detected", t), h.error(C.legacyParameters, t.failure), t.onFailure = t.failure), t.complete !== i && (h.debug("Legacy complete callback detected", t), h.error(C.legacyParameters, t.complete), t.onComplete = t.complete)), t === i && h.error(C.noReturnedValue), !1 === t ? t : t !== i ? e.extend(!0, {}, t) : e.extend(!0, {}, v);
  18433. },
  18434. urlEncodedValue: function urlEncodedValue(e) {
  18435. var n = t.decodeURIComponent(e),
  18436. i = t.encodeURIComponent(e);
  18437. return n !== e ? (h.debug("URL value is already encoded, avoiding double encoding", e), e) : (h.verbose("Encoding value using encodeURIComponent", e, i), i);
  18438. },
  18439. defaultData: function defaultData() {
  18440. var t = {};
  18441. return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  18442. },
  18443. event: function event() {
  18444. return e.isWindow(P) || "now" == v.on ? (h.debug("API called without element, no events attached"), !1) : "auto" == v.on ? T.is("input") ? P.oninput !== i ? "input" : P.onpropertychange !== i ? "propertychange" : "keyup" : T.is("form") ? "submit" : "click" : v.on;
  18445. },
  18446. templatedURL: function templatedURL(e) {
  18447. if (e = e || T.data(y.action) || v.action || !1, m = T.data(y.url) || v.url || !1) return h.debug("Using specified url", m), m;
  18448. if (e) {
  18449. if (h.debug("Looking up url for action", e, v.api), v.api[e] === i && !h.is.mocked()) return void h.error(C.missingAction, v.action, v.api);
  18450. m = v.api[e];
  18451. } else h.is.form() && (m = T.attr("action") || R.attr("action") || !1, h.debug("No url or action specified, defaulting to form action", m));
  18452. return m;
  18453. }
  18454. },
  18455. abort: function abort() {
  18456. var e = h.get.xhr();
  18457. e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  18458. },
  18459. reset: function reset() {
  18460. h.remove.error(), h.remove.loading();
  18461. },
  18462. setting: function setting(t, n) {
  18463. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  18464. if (n === i) return v[t];
  18465. e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  18466. }
  18467. },
  18468. internal: function internal(t, n) {
  18469. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  18470. if (n === i) return h[t];
  18471. h[t] = n;
  18472. }
  18473. },
  18474. debug: function debug() {
  18475. !v.silent && v.debug && (v.performance ? h.performance.log(arguments) : (h.debug = Function.prototype.bind.call(console.info, console, v.name + ":"), h.debug.apply(console, arguments)));
  18476. },
  18477. verbose: function verbose() {
  18478. !v.silent && v.verbose && v.debug && (v.performance ? h.performance.log(arguments) : (h.verbose = Function.prototype.bind.call(console.info, console, v.name + ":"), h.verbose.apply(console, arguments)));
  18479. },
  18480. error: function error() {
  18481. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  18482. },
  18483. performance: {
  18484. log: function log(e) {
  18485. var t, n;
  18486. v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  18487. Name: e[0],
  18488. Arguments: [].slice.call(e, 1) || "",
  18489. "Execution Time": n
  18490. })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 500);
  18491. },
  18492. display: function display() {
  18493. var t = v.name + ":",
  18494. n = 0;
  18495. s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  18496. n += t["Execution Time"];
  18497. }), t += " " + n + "ms", r && (t += " '" + r + "'"), (console.group !== i || console.table !== i) && l.length > 0 && (console.groupCollapsed(t), console.table ? console.table(l) : e.each(l, function (e, t) {
  18498. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18499. }), console.groupEnd()), l = [];
  18500. }
  18501. },
  18502. invoke: function invoke(t, n, a) {
  18503. var r,
  18504. s,
  18505. l,
  18506. c = F;
  18507. return n = n || d, a = P || a, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  18508. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  18509. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  18510. if (c[a] !== i) return s = c[a], !1;
  18511. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (h.error(C.method, t), !1);
  18512. c = c[o];
  18513. }
  18514. })), e.isFunction(s) ? l = s.apply(a, n) : s !== i && (l = s), e.isArray(o) ? o.push(l) : o !== i ? o = [o, l] : l !== i && (o = l), s;
  18515. }
  18516. }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  18517. }), o !== i ? o : this;
  18518. }, e.api.settings = {
  18519. name: "API",
  18520. namespace: "api",
  18521. debug: !1,
  18522. verbose: !1,
  18523. performance: !0,
  18524. api: {},
  18525. cache: !0,
  18526. interruptRequests: !0,
  18527. on: "auto",
  18528. stateContext: !1,
  18529. loadingDuration: 0,
  18530. hideError: "auto",
  18531. errorDuration: 2e3,
  18532. encodeParameters: !0,
  18533. action: !1,
  18534. url: !1,
  18535. base: "",
  18536. urlData: {},
  18537. defaultData: !0,
  18538. serializeForm: !1,
  18539. throttle: 0,
  18540. throttleFirstRequest: !0,
  18541. method: "get",
  18542. data: {},
  18543. dataType: "json",
  18544. mockResponse: !1,
  18545. mockResponseAsync: !1,
  18546. response: !1,
  18547. responseAsync: !1,
  18548. beforeSend: function beforeSend(e) {
  18549. return e;
  18550. },
  18551. beforeXHR: function beforeXHR(e) {},
  18552. onRequest: function onRequest(e, t) {},
  18553. onResponse: !1,
  18554. onSuccess: function onSuccess(e, t) {},
  18555. onComplete: function onComplete(e, t) {},
  18556. onFailure: function onFailure(e, t) {},
  18557. onError: function onError(e, t) {},
  18558. onAbort: function onAbort(e, t) {},
  18559. successTest: !1,
  18560. error: {
  18561. beforeSend: "The before send function has aborted the request",
  18562. error: "There was an error with your request",
  18563. exitConditions: "API Request Aborted. Exit conditions met",
  18564. JSONParse: "JSON could not be parsed during error handling",
  18565. legacyParameters: "You are using legacy API success callback names",
  18566. method: "The method you called is not defined",
  18567. missingAction: "API action used but no url was defined",
  18568. missingSerialize: "jquery-serialize-object is required to add form data to an existing data object",
  18569. missingURL: "No URL specified for api event",
  18570. noReturnedValue: "The beforeSend callback must return a settings object, beforeSend ignored.",
  18571. noStorage: "Caching responses locally requires session storage",
  18572. parseError: "There was an error parsing your request",
  18573. requiredParameter: "Missing a required URL parameter: ",
  18574. statusMessage: "Server gave an error: ",
  18575. timeout: "Your request timed out"
  18576. },
  18577. regExp: {
  18578. required: /\{\$*[A-z0-9]+\}/g,
  18579. optional: /\{\/\$*[A-z0-9]+\}/g
  18580. },
  18581. className: {
  18582. loading: "loading",
  18583. error: "error"
  18584. },
  18585. selector: {
  18586. disabled: ".disabled",
  18587. form: "form"
  18588. },
  18589. metadata: {
  18590. action: "action",
  18591. url: "url"
  18592. }
  18593. };
  18594. }(jQuery, window, document), function (e, t, n, i) {
  18595. "use strict";
  18596. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  18597. var a,
  18598. r = e(this),
  18599. s = r.selector || "",
  18600. l = new Date().getTime(),
  18601. c = [],
  18602. u = arguments[0],
  18603. d = "string" == typeof u,
  18604. f = [].slice.call(arguments, 1),
  18605. m = r.length,
  18606. g = 0;
  18607. return r.each(function () {
  18608. var r,
  18609. p,
  18610. h,
  18611. v,
  18612. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  18613. y = b.className,
  18614. x = b.namespace,
  18615. C = b.error,
  18616. w = b.metadata,
  18617. S = "." + x,
  18618. k = "module-" + x,
  18619. T = e(t),
  18620. A = e(this),
  18621. R = e(b.context),
  18622. P = (A.selector, A.data(k)),
  18623. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  18624. setTimeout(e, 0);
  18625. },
  18626. F = this,
  18627. O = !1;
  18628. v = {
  18629. initialize: function initialize() {
  18630. v.debug("Initializing", b), v.setup.cache(), v.should.trackChanges() && ("image" == b.type && v.setup.image(), "fixed" == b.type && v.setup.fixed(), b.observeChanges && v.observeChanges(), v.bind.events()), v.save.position(), v.is.visible() || v.error(C.visible, A), b.initialCheck && v.checkVisibility(), v.instantiate();
  18631. },
  18632. instantiate: function instantiate() {
  18633. v.debug("Storing instance", v), A.data(k, v), P = v;
  18634. },
  18635. destroy: function destroy() {
  18636. v.verbose("Destroying previous module"), h && h.disconnect(), p && p.disconnect(), T.off("load" + S, v.event.load).off("resize" + S, v.event.resize), R.off("scroll" + S, v.event.scroll).off("scrollchange" + S, v.event.scrollchange), "fixed" == b.type && (v.resetFixed(), v.remove.placeholder()), A.off(S).removeData(k);
  18637. },
  18638. observeChanges: function observeChanges() {
  18639. "MutationObserver" in t && (p = new MutationObserver(v.event.contextChanged), h = new MutationObserver(v.event.changed), p.observe(n, {
  18640. childList: !0,
  18641. subtree: !0
  18642. }), h.observe(F, {
  18643. childList: !0,
  18644. subtree: !0
  18645. }), v.debug("Setting up mutation observer", h));
  18646. },
  18647. bind: {
  18648. events: function events() {
  18649. v.verbose("Binding visibility events to scroll and resize"), b.refreshOnLoad && T.on("load" + S, v.event.load), T.on("resize" + S, v.event.resize), R.off("scroll" + S).on("scroll" + S, v.event.scroll).on("scrollchange" + S, v.event.scrollchange);
  18650. }
  18651. },
  18652. event: {
  18653. changed: function changed(e) {
  18654. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  18655. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  18656. }, 100);
  18657. },
  18658. contextChanged: function contextChanged(t) {
  18659. [].forEach.call(t, function (t) {
  18660. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  18661. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  18662. });
  18663. });
  18664. },
  18665. resize: function resize() {
  18666. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  18667. },
  18668. load: function load() {
  18669. v.debug("Page finished loading"), E(v.refresh);
  18670. },
  18671. scroll: function scroll() {
  18672. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  18673. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  18674. }, b.throttle)) : E(function () {
  18675. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  18676. });
  18677. },
  18678. scrollchange: function scrollchange(e, t) {
  18679. v.checkVisibility(t);
  18680. }
  18681. },
  18682. precache: function precache(t, i) {
  18683. t instanceof Array || (t = [t]);
  18684. for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  18685. ++a >= t.length && e.isFunction(i) && i();
  18686. }; o--;) {
  18687. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  18688. }
  18689. },
  18690. enableCallbacks: function enableCallbacks() {
  18691. v.debug("Allowing callbacks to occur"), O = !1;
  18692. },
  18693. disableCallbacks: function disableCallbacks() {
  18694. v.debug("Disabling all callbacks temporarily"), O = !0;
  18695. },
  18696. should: {
  18697. trackChanges: function trackChanges() {
  18698. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  18699. }
  18700. },
  18701. setup: {
  18702. cache: function cache() {
  18703. v.cache = {
  18704. occurred: {},
  18705. screen: {},
  18706. element: {}
  18707. };
  18708. },
  18709. image: function image() {
  18710. var e = A.data(w.src);
  18711. e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  18712. v.debug("Image on screen", F), v.precache(e, function () {
  18713. v.set.image(e, function () {
  18714. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  18715. });
  18716. });
  18717. });
  18718. },
  18719. fixed: function fixed() {
  18720. v.debug("Setting up fixed"), b.once = !1, b.observeChanges = !1, b.initialCheck = !0, b.refreshOnLoad = !0, o.transition || (b.transition = !1), v.create.placeholder(), v.debug("Added placeholder", r), b.onTopPassed = function () {
  18721. v.debug("Element passed, adding fixed position", A), v.show.placeholder(), v.set.fixed(), b.transition && e.fn.transition !== i && A.transition(b.transition, b.duration);
  18722. }, b.onTopPassedReverse = function () {
  18723. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  18724. };
  18725. }
  18726. },
  18727. create: {
  18728. placeholder: function placeholder() {
  18729. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  18730. }
  18731. },
  18732. show: {
  18733. placeholder: function placeholder() {
  18734. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  18735. }
  18736. },
  18737. hide: {
  18738. placeholder: function placeholder() {
  18739. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  18740. }
  18741. },
  18742. set: {
  18743. fixed: function fixed() {
  18744. v.verbose("Setting element to fixed position"), A.addClass(y.fixed).css({
  18745. position: "fixed",
  18746. top: b.offset + "px",
  18747. left: "auto",
  18748. zIndex: b.zIndex
  18749. }), b.onFixed.call(F);
  18750. },
  18751. image: function image(t, n) {
  18752. if (A.attr("src", t), b.transition) {
  18753. if (e.fn.transition !== i) {
  18754. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");
  18755. A.transition(b.transition, b.duration, n);
  18756. } else A.fadeIn(b.duration, n);
  18757. } else A.show();
  18758. }
  18759. },
  18760. is: {
  18761. onScreen: function onScreen() {
  18762. return v.get.elementCalculations().onScreen;
  18763. },
  18764. offScreen: function offScreen() {
  18765. return v.get.elementCalculations().offScreen;
  18766. },
  18767. visible: function visible() {
  18768. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  18769. },
  18770. verticallyScrollableContext: function verticallyScrollableContext() {
  18771. var e = R.get(0) !== t && R.css("overflow-y");
  18772. return "auto" == e || "scroll" == e;
  18773. },
  18774. horizontallyScrollableContext: function horizontallyScrollableContext() {
  18775. var e = R.get(0) !== t && R.css("overflow-x");
  18776. return "auto" == e || "scroll" == e;
  18777. }
  18778. },
  18779. refresh: function refresh() {
  18780. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  18781. },
  18782. resetFixed: function resetFixed() {
  18783. v.remove.fixed(), v.remove.occurred();
  18784. },
  18785. reset: function reset() {
  18786. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  18787. },
  18788. checkVisibility: function checkVisibility(e) {
  18789. v.verbose("Checking visibility of element", v.cache.element), !O && v.is.visible() && (v.save.scroll(e), v.save.calculations(), v.passed(), v.passingReverse(), v.topVisibleReverse(), v.bottomVisibleReverse(), v.topPassedReverse(), v.bottomPassedReverse(), v.onScreen(), v.offScreen(), v.passing(), v.topVisible(), v.bottomVisible(), v.topPassed(), v.bottomPassed(), b.onUpdate && b.onUpdate.call(F, v.get.elementCalculations()));
  18790. },
  18791. passed: function passed(t, n) {
  18792. var o = v.get.elementCalculations();
  18793. if (t && n) b.onPassed[t] = n;else {
  18794. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;
  18795. o.passing && e.each(b.onPassed, function (e, t) {
  18796. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  18797. });
  18798. }
  18799. },
  18800. onScreen: function onScreen(e) {
  18801. var t = v.get.elementCalculations(),
  18802. n = e || b.onOnScreen,
  18803. o = "onScreen";
  18804. if (e && (v.debug("Adding callback for onScreen", e), b.onOnScreen = e), t.onScreen ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.onOnScreen;
  18805. },
  18806. offScreen: function offScreen(e) {
  18807. var t = v.get.elementCalculations(),
  18808. n = e || b.onOffScreen,
  18809. o = "offScreen";
  18810. if (e && (v.debug("Adding callback for offScreen", e), b.onOffScreen = e), t.offScreen ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.onOffScreen;
  18811. },
  18812. passing: function passing(e) {
  18813. var t = v.get.elementCalculations(),
  18814. n = e || b.onPassing,
  18815. o = "passing";
  18816. if (e && (v.debug("Adding callback for passing", e), b.onPassing = e), t.passing ? v.execute(n, o) : b.once || v.remove.occurred(o), e !== i) return t.passing;
  18817. },
  18818. topVisible: function topVisible(e) {
  18819. var t = v.get.elementCalculations(),
  18820. n = e || b.onTopVisible,
  18821. o = "topVisible";
  18822. if (e && (v.debug("Adding callback for top visible", e), b.onTopVisible = e), t.topVisible ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.topVisible;
  18823. },
  18824. bottomVisible: function bottomVisible(e) {
  18825. var t = v.get.elementCalculations(),
  18826. n = e || b.onBottomVisible,
  18827. o = "bottomVisible";
  18828. if (e && (v.debug("Adding callback for bottom visible", e), b.onBottomVisible = e), t.bottomVisible ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.bottomVisible;
  18829. },
  18830. topPassed: function topPassed(e) {
  18831. var t = v.get.elementCalculations(),
  18832. n = e || b.onTopPassed,
  18833. o = "topPassed";
  18834. if (e && (v.debug("Adding callback for top passed", e), b.onTopPassed = e), t.topPassed ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.topPassed;
  18835. },
  18836. bottomPassed: function bottomPassed(e) {
  18837. var t = v.get.elementCalculations(),
  18838. n = e || b.onBottomPassed,
  18839. o = "bottomPassed";
  18840. if (e && (v.debug("Adding callback for bottom passed", e), b.onBottomPassed = e), t.bottomPassed ? v.execute(n, o) : b.once || v.remove.occurred(o), e === i) return t.bottomPassed;
  18841. },
  18842. passingReverse: function passingReverse(e) {
  18843. var t = v.get.elementCalculations(),
  18844. n = e || b.onPassingReverse,
  18845. o = "passingReverse";
  18846. if (e && (v.debug("Adding callback for passing reverse", e), b.onPassingReverse = e), t.passing ? b.once || v.remove.occurred(o) : v.get.occurred("passing") && v.execute(n, o), e !== i) return !t.passing;
  18847. },
  18848. topVisibleReverse: function topVisibleReverse(e) {
  18849. var t = v.get.elementCalculations(),
  18850. n = e || b.onTopVisibleReverse,
  18851. o = "topVisibleReverse";
  18852. if (e && (v.debug("Adding callback for top visible reverse", e), b.onTopVisibleReverse = e), t.topVisible ? b.once || v.remove.occurred(o) : v.get.occurred("topVisible") && v.execute(n, o), e === i) return !t.topVisible;
  18853. },
  18854. bottomVisibleReverse: function bottomVisibleReverse(e) {
  18855. var t = v.get.elementCalculations(),
  18856. n = e || b.onBottomVisibleReverse,
  18857. o = "bottomVisibleReverse";
  18858. if (e && (v.debug("Adding callback for bottom visible reverse", e), b.onBottomVisibleReverse = e), t.bottomVisible ? b.once || v.remove.occurred(o) : v.get.occurred("bottomVisible") && v.execute(n, o), e === i) return !t.bottomVisible;
  18859. },
  18860. topPassedReverse: function topPassedReverse(e) {
  18861. var t = v.get.elementCalculations(),
  18862. n = e || b.onTopPassedReverse,
  18863. o = "topPassedReverse";
  18864. if (e && (v.debug("Adding callback for top passed reverse", e), b.onTopPassedReverse = e), t.topPassed ? b.once || v.remove.occurred(o) : v.get.occurred("topPassed") && v.execute(n, o), e === i) return !t.onTopPassed;
  18865. },
  18866. bottomPassedReverse: function bottomPassedReverse(e) {
  18867. var t = v.get.elementCalculations(),
  18868. n = e || b.onBottomPassedReverse,
  18869. o = "bottomPassedReverse";
  18870. if (e && (v.debug("Adding callback for bottom passed reverse", e), b.onBottomPassedReverse = e), t.bottomPassed ? b.once || v.remove.occurred(o) : v.get.occurred("bottomPassed") && v.execute(n, o), e === i) return !t.bottomPassed;
  18871. },
  18872. execute: function execute(e, t) {
  18873. var n = v.get.elementCalculations(),
  18874. i = v.get.screenCalculations();
  18875. (e = e || !1) && (b.continuous ? (v.debug("Callback being called continuously", t, n), e.call(F, n, i)) : v.get.occurred(t) || (v.debug("Conditions met", t, n), e.call(F, n, i))), v.save.occurred(t);
  18876. },
  18877. remove: {
  18878. fixed: function fixed() {
  18879. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({
  18880. position: "",
  18881. top: "",
  18882. left: "",
  18883. zIndex: ""
  18884. }), b.onUnfixed.call(F);
  18885. },
  18886. placeholder: function placeholder() {
  18887. v.debug("Removing placeholder content"), r && r.remove();
  18888. },
  18889. occurred: function occurred(e) {
  18890. if (e) {
  18891. var t = v.cache.occurred;
  18892. t[e] !== i && !0 === t[e] && (v.debug("Callback can now be called again", e), v.cache.occurred[e] = !1);
  18893. } else v.cache.occurred = {};
  18894. }
  18895. },
  18896. save: {
  18897. calculations: function calculations() {
  18898. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  18899. },
  18900. occurred: function occurred(e) {
  18901. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  18902. },
  18903. scroll: function scroll(e) {
  18904. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  18905. },
  18906. direction: function direction() {
  18907. var e,
  18908. t = v.get.scroll(),
  18909. n = v.get.lastScroll();
  18910. return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  18911. },
  18912. elementPosition: function elementPosition() {
  18913. var e = v.cache.element,
  18914. t = v.get.screenSize();
  18915. return v.verbose("Saving element position"), e.fits = e.height < t.height, e.offset = A.offset(), e.width = A.outerWidth(), e.height = A.outerHeight(), v.is.verticallyScrollableContext() && (e.offset.top += R.scrollTop() - R.offset().top), v.is.horizontallyScrollableContext() && (e.offset.left += R.scrollLeft - R.offset().left), v.cache.element = e, e;
  18916. },
  18917. elementCalculations: function elementCalculations() {
  18918. var e = v.get.screenCalculations(),
  18919. t = v.get.elementPosition();
  18920. return b.includeMargin ? (t.margin = {}, t.margin.top = parseInt(A.css("margin-top"), 10), t.margin.bottom = parseInt(A.css("margin-bottom"), 10), t.top = t.offset.top - t.margin.top, t.bottom = t.offset.top + t.height + t.margin.bottom) : (t.top = t.offset.top, t.bottom = t.offset.top + t.height), t.topPassed = e.top >= t.top, t.bottomPassed = e.top >= t.bottom, t.topVisible = e.bottom >= t.top && !t.topPassed, t.bottomVisible = e.bottom >= t.bottom && !t.bottomPassed, t.pixelsPassed = 0, t.percentagePassed = 0, t.onScreen = (t.topVisible || t.passing) && !t.bottomPassed, t.passing = t.topPassed && !t.bottomPassed, t.offScreen = !t.onScreen, t.passing && (t.pixelsPassed = e.top - t.top, t.percentagePassed = (e.top - t.top) / t.height), v.cache.element = t, v.verbose("Updated element calculations", t), t;
  18921. },
  18922. screenCalculations: function screenCalculations() {
  18923. var e = v.get.scroll();
  18924. return v.save.direction(), v.cache.screen.top = e, v.cache.screen.bottom = e + v.cache.screen.height, v.cache.screen;
  18925. },
  18926. screenSize: function screenSize() {
  18927. v.verbose("Saving window position"), v.cache.screen = {
  18928. height: R.height()
  18929. };
  18930. },
  18931. position: function position() {
  18932. v.save.screenSize(), v.save.elementPosition();
  18933. }
  18934. },
  18935. get: {
  18936. pixelsPassed: function pixelsPassed(e) {
  18937. var t = v.get.elementCalculations();
  18938. return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  18939. },
  18940. occurred: function occurred(e) {
  18941. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  18942. },
  18943. direction: function direction() {
  18944. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  18945. },
  18946. elementPosition: function elementPosition() {
  18947. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  18948. },
  18949. elementCalculations: function elementCalculations() {
  18950. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  18951. },
  18952. screenCalculations: function screenCalculations() {
  18953. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  18954. },
  18955. screenSize: function screenSize() {
  18956. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  18957. },
  18958. scroll: function scroll() {
  18959. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  18960. },
  18961. lastScroll: function lastScroll() {
  18962. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  18963. }
  18964. },
  18965. setting: function setting(t, n) {
  18966. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  18967. if (n === i) return b[t];
  18968. b[t] = n;
  18969. }
  18970. },
  18971. internal: function internal(t, n) {
  18972. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  18973. if (n === i) return v[t];
  18974. v[t] = n;
  18975. }
  18976. },
  18977. debug: function debug() {
  18978. !b.silent && b.debug && (b.performance ? v.performance.log(arguments) : (v.debug = Function.prototype.bind.call(console.info, console, b.name + ":"), v.debug.apply(console, arguments)));
  18979. },
  18980. verbose: function verbose() {
  18981. !b.silent && b.verbose && b.debug && (b.performance ? v.performance.log(arguments) : (v.verbose = Function.prototype.bind.call(console.info, console, b.name + ":"), v.verbose.apply(console, arguments)));
  18982. },
  18983. error: function error() {
  18984. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  18985. },
  18986. performance: {
  18987. log: function log(e) {
  18988. var t, n;
  18989. b.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  18990. Name: e[0],
  18991. Arguments: [].slice.call(e, 1) || "",
  18992. Element: F,
  18993. "Execution Time": n
  18994. })), clearTimeout(v.performance.timer), v.performance.timer = setTimeout(v.performance.display, 500);
  18995. },
  18996. display: function display() {
  18997. var t = b.name + ":",
  18998. n = 0;
  18999. l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  19000. n += t["Execution Time"];
  19001. }), t += " " + n + "ms", s && (t += " '" + s + "'"), (console.group !== i || console.table !== i) && c.length > 0 && (console.groupCollapsed(t), console.table ? console.table(c) : e.each(c, function (e, t) {
  19002. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  19003. }), console.groupEnd()), c = [];
  19004. }
  19005. },
  19006. invoke: function invoke(t, n, o) {
  19007. var r,
  19008. s,
  19009. l,
  19010. c = P;
  19011. return n = n || f, o = F || o, "string" == typeof t && c !== i && (t = t.split(/[\. ]/), r = t.length - 1, e.each(t, function (n, o) {
  19012. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  19013. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  19014. if (c[a] !== i) return s = c[a], !1;
  19015. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (v.error(C.method, t), !1);
  19016. c = c[o];
  19017. }
  19018. })), e.isFunction(s) ? l = s.apply(o, n) : s !== i && (l = s), e.isArray(a) ? a.push(l) : a !== i ? a = [a, l] : l !== i && (a = l), s;
  19019. }
  19020. }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  19021. }), a !== i ? a : this;
  19022. }, e.fn.visibility.settings = {
  19023. name: "Visibility",
  19024. namespace: "visibility",
  19025. debug: !1,
  19026. verbose: !1,
  19027. performance: !0,
  19028. observeChanges: !0,
  19029. initialCheck: !0,
  19030. refreshOnLoad: !0,
  19031. refreshOnResize: !0,
  19032. checkOnRefresh: !0,
  19033. once: !0,
  19034. continuous: !1,
  19035. offset: 0,
  19036. includeMargin: !1,
  19037. context: t,
  19038. throttle: !1,
  19039. type: !1,
  19040. zIndex: "10",
  19041. transition: "fade in",
  19042. duration: 1e3,
  19043. onPassed: {},
  19044. onOnScreen: !1,
  19045. onOffScreen: !1,
  19046. onPassing: !1,
  19047. onTopVisible: !1,
  19048. onBottomVisible: !1,
  19049. onTopPassed: !1,
  19050. onBottomPassed: !1,
  19051. onPassingReverse: !1,
  19052. onTopVisibleReverse: !1,
  19053. onBottomVisibleReverse: !1,
  19054. onTopPassedReverse: !1,
  19055. onBottomPassedReverse: !1,
  19056. onLoad: function onLoad() {},
  19057. onAllLoaded: function onAllLoaded() {},
  19058. onFixed: function onFixed() {},
  19059. onUnfixed: function onUnfixed() {},
  19060. onUpdate: !1,
  19061. onRefresh: function onRefresh() {},
  19062. metadata: {
  19063. src: "src"
  19064. },
  19065. className: {
  19066. fixed: "fixed",
  19067. placeholder: "placeholder",
  19068. visible: "visible"
  19069. },
  19070. error: {
  19071. method: "The method you called is not defined.",
  19072. visible: "Element is hidden, you must call refresh after element becomes visible"
  19073. }
  19074. };
  19075. }(jQuery, window, document);
  19076. /***/ }),
  19077. /***/ "./js/services/i18nHelper.js":
  19078. /*!***********************************!*\
  19079. !*** ./js/services/i18nHelper.js ***!
  19080. \***********************************/
  19081. /*! exports provided: i18nHelper */
  19082. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19083. "use strict";
  19084. __webpack_require__.r(__webpack_exports__);
  19085. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i18nHelper", function() { return i18nHelper; });
  19086. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19087. /* harmony import */ var _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  19088. var StringTypes = line_i18n__WEBPACK_IMPORTED_MODULE_0__["default"].StringTypes;
  19089. var i18nHelper = Object.freeze({
  19090. i18n: function i18n(identifier) {
  19091. var opts = identifier.split(':');
  19092. var type = opts[0].toLowerCase();
  19093. var id = opts[1];
  19094. if (StringTypes.ERROR === type) {
  19095. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getError(id);
  19096. } else if (StringTypes.MESSAGE === type) {
  19097. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getMessage(id);
  19098. } else if (StringTypes.UI === type) {
  19099. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getUI(id);
  19100. } else {
  19101. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  19102. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getString(identifier, type);
  19103. }
  19104. }
  19105. });
  19106. /***/ }),
  19107. /***/ "./js/services/languageService.js":
  19108. /*!****************************************!*\
  19109. !*** ./js/services/languageService.js ***!
  19110. \****************************************/
  19111. /*! exports provided: LanguageService */
  19112. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19113. "use strict";
  19114. __webpack_require__.r(__webpack_exports__);
  19115. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageService", function() { return LanguageService; });
  19116. /* harmony import */ var _grammar___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  19117. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19118. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../util/config */ "./js/util/config.js");
  19119. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19120. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19121. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19122. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19123. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19124. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19125. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19126. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19127. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19128. var LanguageServiceExtended =
  19129. /*#__PURE__*/
  19130. function (_line_i18n$LanguageSe) {
  19131. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  19132. function LanguageServiceExtended() {
  19133. _classCallCheck(this, LanguageServiceExtended);
  19134. return _possibleConstructorReturn(this, _getPrototypeOf(LanguageServiceExtended).call(this, typeof iLMparameters === 'undefined' ? _util_config__WEBPACK_IMPORTED_MODULE_2__["Config"].default_lang : iLMparameters.lang));
  19135. }
  19136. _createClass(LanguageServiceExtended, [{
  19137. key: "getCurrentLexer",
  19138. value: function getCurrentLexer() {
  19139. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19140. if (langInfo === null || langInfo === undefined) {
  19141. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].lexer;
  19142. } else {
  19143. return langInfo.lexer;
  19144. }
  19145. }
  19146. }, {
  19147. key: "getCurrentLangFuncs",
  19148. value: function getCurrentLangFuncs() {
  19149. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19150. if (langInfo === null || langInfo === undefined) {
  19151. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].langFuncs;
  19152. } else {
  19153. return langInfo.langFuncs;
  19154. }
  19155. }
  19156. }, {
  19157. key: "getCurrentLangLibs",
  19158. value: function getCurrentLangLibs() {
  19159. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19160. if (langInfo === null || langInfo === undefined) {
  19161. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].langLibs;
  19162. }
  19163. return langInfo.langLibs;
  19164. }
  19165. }]);
  19166. return LanguageServiceExtended;
  19167. }(line_i18n__WEBPACK_IMPORTED_MODULE_1__["default"].LanguageServiceNoLS);
  19168. var LanguageService = new LanguageServiceExtended();
  19169. /***/ }),
  19170. /***/ "./js/services/localizedStringsService.js":
  19171. /*!************************************************!*\
  19172. !*** ./js/services/localizedStringsService.js ***!
  19173. \************************************************/
  19174. /*! exports provided: LocalizedStrings, getInstance */
  19175. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19176. "use strict";
  19177. __webpack_require__.r(__webpack_exports__);
  19178. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  19179. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getInstance", function() { return getInstance; });
  19180. /* harmony import */ var _languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  19181. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19182. /* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  19183. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19184. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19185. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19186. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19187. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19188. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19189. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19190. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19191. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19192. var IVProgLocalizedStrings =
  19193. /*#__PURE__*/
  19194. function (_line_i18n$LocalizedS) {
  19195. _inherits(IVProgLocalizedStrings, _line_i18n$LocalizedS);
  19196. function IVProgLocalizedStrings(langService, langsJsons) {
  19197. var shouldListenToChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  19198. _classCallCheck(this, IVProgLocalizedStrings);
  19199. return _possibleConstructorReturn(this, _getPrototypeOf(IVProgLocalizedStrings).call(this, langService, langsJsons, shouldListenToChange));
  19200. }
  19201. _createClass(IVProgLocalizedStrings, [{
  19202. key: "translateType",
  19203. value: function translateType(type, dim) {
  19204. switch (dim) {
  19205. case 0:
  19206. return this.getUI(type);
  19207. default:
  19208. var transType = this.getUI(type);
  19209. if (dim === 1) return this.getUI("vector_string", [transType]);else return this.getUI("matrix_string", [transType]);
  19210. }
  19211. }
  19212. }, {
  19213. key: "translateOp",
  19214. value: function translateOp(op) {
  19215. switch (op.ord) {
  19216. case Operators.AND.ord:
  19217. case Operators.OR.ord:
  19218. case Operators.NOT.ord:
  19219. return this.getUI(op.value);
  19220. default:
  19221. return op.value;
  19222. }
  19223. }
  19224. }]);
  19225. return IVProgLocalizedStrings;
  19226. }(line_i18n__WEBPACK_IMPORTED_MODULE_1__["default"].LocalizedStrings);
  19227. var LocalizedStrings = Object.freeze(new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"], _i18n__WEBPACK_IMPORTED_MODULE_2__["default"], true));
  19228. var _instance = null;
  19229. function getInstance() {
  19230. if (_instance == null) {
  19231. _instance = new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"], _i18n__WEBPACK_IMPORTED_MODULE_2__["default"]);
  19232. }
  19233. return _instance;
  19234. }
  19235. /***/ }),
  19236. /***/ "./js/typeSystem/baseTypes.js":
  19237. /*!************************************!*\
  19238. !*** ./js/typeSystem/baseTypes.js ***!
  19239. \************************************/
  19240. /*! exports provided: BaseTypes */
  19241. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19242. "use strict";
  19243. __webpack_require__.r(__webpack_exports__);
  19244. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseTypes", function() { return BaseTypes; });
  19245. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19246. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19247. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19248. var BaseType =
  19249. /*#__PURE__*/
  19250. function () {
  19251. function BaseType(name, ord) {
  19252. _classCallCheck(this, BaseType);
  19253. this.name = name;
  19254. this.ord = ord;
  19255. }
  19256. _createClass(BaseType, [{
  19257. key: "isCompatible",
  19258. value: function isCompatible(another) {
  19259. if (another instanceof BaseType) {
  19260. return this.name === another.name && this.ord === another.ord;
  19261. }
  19262. return false;
  19263. }
  19264. }, {
  19265. key: "value",
  19266. get: function get() {
  19267. return this.name;
  19268. }
  19269. }]);
  19270. return BaseType;
  19271. }(); // Base types names are the same as i18n ui type keys
  19272. var BaseTypes = Object.freeze({
  19273. INTEGER: new BaseType("integer", 0),
  19274. REAL: new BaseType("real", 1),
  19275. STRING: new BaseType("text", 2),
  19276. BOOLEAN: new BaseType("boolean", 3),
  19277. VOID: new BaseType("void", 4),
  19278. UNDEFINED: new BaseType("undefined", 5)
  19279. });
  19280. /***/ }),
  19281. /***/ "./js/typeSystem/compoundType.js":
  19282. /*!***************************************!*\
  19283. !*** ./js/typeSystem/compoundType.js ***!
  19284. \***************************************/
  19285. /*! exports provided: CompoundType */
  19286. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19287. "use strict";
  19288. __webpack_require__.r(__webpack_exports__);
  19289. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompoundType", function() { return CompoundType; });
  19290. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19291. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19292. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19293. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19294. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19295. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19296. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19297. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19298. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19299. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19300. var CompoundType =
  19301. /*#__PURE__*/
  19302. function (_Type) {
  19303. _inherits(CompoundType, _Type);
  19304. function CompoundType(type, dimensions) {
  19305. var _this;
  19306. _classCallCheck(this, CompoundType);
  19307. _this = _possibleConstructorReturn(this, _getPrototypeOf(CompoundType).call(this, null));
  19308. _this.innerType = type;
  19309. _this.dimensions = dimensions;
  19310. return _this;
  19311. }
  19312. _createClass(CompoundType, [{
  19313. key: "isCompatible",
  19314. value: function isCompatible(another) {
  19315. if (another instanceof CompoundType) {
  19316. if (this.dimensions !== another.dimensions) {
  19317. return false;
  19318. }
  19319. return this.innerType.isCompatible(another.innerType);
  19320. }
  19321. return false;
  19322. }
  19323. }, {
  19324. key: "stringInfo",
  19325. value: function stringInfo() {
  19326. var _this2 = this;
  19327. var list = this.innerType.stringInfo();
  19328. list.forEach(function (v) {
  19329. v.dim = _this2.dimensions;
  19330. });
  19331. return list;
  19332. }
  19333. }, {
  19334. key: "canAccept",
  19335. value: function canAccept(another) {
  19336. if (another instanceof CompoundType) {
  19337. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  19338. } else {
  19339. return this.innerType.isCompatible(another);
  19340. }
  19341. }
  19342. }]);
  19343. return CompoundType;
  19344. }(_type__WEBPACK_IMPORTED_MODULE_0__["Type"]);
  19345. /***/ }),
  19346. /***/ "./js/typeSystem/multiType.js":
  19347. /*!************************************!*\
  19348. !*** ./js/typeSystem/multiType.js ***!
  19349. \************************************/
  19350. /*! exports provided: MultiType */
  19351. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19352. "use strict";
  19353. __webpack_require__.r(__webpack_exports__);
  19354. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MultiType", function() { return MultiType; });
  19355. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19356. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19357. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19358. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19359. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19360. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19361. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19362. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19363. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19364. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19365. var MultiType =
  19366. /*#__PURE__*/
  19367. function (_Type) {
  19368. _inherits(MultiType, _Type);
  19369. function MultiType(types) {
  19370. var _this;
  19371. _classCallCheck(this, MultiType);
  19372. _this = _possibleConstructorReturn(this, _getPrototypeOf(MultiType).call(this, null));
  19373. _this.types = types;
  19374. return _this;
  19375. }
  19376. _createClass(MultiType, [{
  19377. key: "stringInfo",
  19378. value: function stringInfo() {
  19379. var list = [];
  19380. for (var i = 0; i < this.types.length; i++) {
  19381. var t = this.types[i];
  19382. list = list.concat(t.stringInfo());
  19383. }
  19384. return list;
  19385. }
  19386. }, {
  19387. key: "isCompatible",
  19388. value: function isCompatible(another) {
  19389. if (another instanceof _type__WEBPACK_IMPORTED_MODULE_0__["Type"]) {
  19390. for (var i = 0; i < this.types.length; i++) {
  19391. var t = this.types[i];
  19392. if (another.isCompatible(t)) {
  19393. return true;
  19394. }
  19395. }
  19396. }
  19397. return false;
  19398. }
  19399. }, {
  19400. key: "value",
  19401. get: function get() {
  19402. return null;
  19403. }
  19404. }, {
  19405. key: "ord",
  19406. get: function get() {
  19407. return null;
  19408. }
  19409. }]);
  19410. return MultiType;
  19411. }(_type__WEBPACK_IMPORTED_MODULE_0__["Type"]);
  19412. /***/ }),
  19413. /***/ "./js/typeSystem/parsers.js":
  19414. /*!**********************************!*\
  19415. !*** ./js/typeSystem/parsers.js ***!
  19416. \**********************************/
  19417. /*! exports provided: toInt, toString, toReal, toBool, convertBoolToString, convertToString */
  19418. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19419. "use strict";
  19420. __webpack_require__.r(__webpack_exports__);
  19421. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toInt", function() { return toInt; });
  19422. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toString", function() { return toString; });
  19423. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toReal", function() { return toReal; });
  19424. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toBool", function() { return toBool; });
  19425. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertBoolToString", function() { return convertBoolToString; });
  19426. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertToString", function() { return convertToString; });
  19427. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  19428. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  19429. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  19430. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_2__);
  19431. function toInt(str) {
  19432. return new decimal_js__WEBPACK_IMPORTED_MODULE_2___default.a(str);
  19433. }
  19434. function toString(str) {
  19435. var value = str.replace(/^"/, '');
  19436. value = value.replace(/"$/, '');
  19437. value = value.replace(/\\b/g, "\b");
  19438. value = value.replace(/\\t/g, "\t");
  19439. value = value.replace(/\\n/g, "\n");
  19440. value = value.replace(/\\r/g, "\r");
  19441. value = value.replace(/\\\"/g, "\"");
  19442. value = value.replace(/\\\'/g, "\'");
  19443. value = value.replace(/\\\\/g, "\\");
  19444. return value;
  19445. }
  19446. function toReal(value) {
  19447. return new decimal_js__WEBPACK_IMPORTED_MODULE_2___default.a(value);
  19448. }
  19449. function toBool(str) {
  19450. var val = "'" + str + "'";
  19451. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLexer();
  19452. var instance = new lexer(null);
  19453. if (instance.literalNames[lexer.RK_TRUE] === val) {
  19454. return true;
  19455. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  19456. return false;
  19457. } else {
  19458. // TODO: better error message
  19459. throw new Error(str + "not a valid boolean");
  19460. }
  19461. }
  19462. function convertBoolToString(bool) {
  19463. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLexer();
  19464. var instance = new lexer(null);
  19465. if (bool) {
  19466. return instance.literalNames[lexer.RK_TRUE];
  19467. } else {
  19468. return instance.literalNames[lexer.RK_FALSE];
  19469. }
  19470. }
  19471. function convertToString(value, type) {
  19472. switch (type.ord) {
  19473. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER.ord:
  19474. return value.toString();
  19475. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL.ord:
  19476. {
  19477. if (value.dp() <= 0) {
  19478. return value.toFixed(1);
  19479. } else {
  19480. return value.toNumber();
  19481. }
  19482. }
  19483. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN.ord:
  19484. return convertBoolToString(value);
  19485. default:
  19486. return value;
  19487. }
  19488. }
  19489. /***/ }),
  19490. /***/ "./js/typeSystem/type.js":
  19491. /*!*******************************!*\
  19492. !*** ./js/typeSystem/type.js ***!
  19493. \*******************************/
  19494. /*! exports provided: Type */
  19495. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19496. "use strict";
  19497. __webpack_require__.r(__webpack_exports__);
  19498. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function() { return Type; });
  19499. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  19500. /* harmony import */ var _baseTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  19501. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19502. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19503. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19504. var Type =
  19505. /*#__PURE__*/
  19506. function () {
  19507. function Type(baseType) {
  19508. _classCallCheck(this, Type);
  19509. this.baseType = baseType;
  19510. }
  19511. _createClass(Type, [{
  19512. key: "stringInfo",
  19513. value: function stringInfo() {
  19514. return [{
  19515. type: this.baseType.name,
  19516. dim: 0
  19517. }];
  19518. }
  19519. }, {
  19520. key: "isCompatible",
  19521. value: function isCompatible(another) {
  19522. if (another instanceof Type) {
  19523. return this.baseType.isCompatible(another.baseType);
  19524. }
  19525. return false;
  19526. }
  19527. }, {
  19528. key: "value",
  19529. get: function get() {
  19530. return this.baseType.value;
  19531. }
  19532. }, {
  19533. key: "ord",
  19534. get: function get() {
  19535. return this.baseType.ord;
  19536. }
  19537. }]);
  19538. return Type;
  19539. }();
  19540. /***/ }),
  19541. /***/ "./js/typeSystem/types.js":
  19542. /*!********************************!*\
  19543. !*** ./js/typeSystem/types.js ***!
  19544. \********************************/
  19545. /*! exports provided: Types */
  19546. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19547. "use strict";
  19548. __webpack_require__.r(__webpack_exports__);
  19549. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Types", function() { return Types; });
  19550. /* harmony import */ var _baseTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  19551. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19552. /* harmony import */ var _multiType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  19553. var INTEGER = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].INTEGER);
  19554. var REAL = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].REAL);
  19555. var STRING = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].STRING);
  19556. var BOOLEAN = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].BOOLEAN);
  19557. var VOID = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].VOID);
  19558. var UNDEFINED = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].UNDEFINED);
  19559. var ALL = new _multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]([INTEGER, REAL, STRING, BOOLEAN]);
  19560. var Types = Object.freeze({
  19561. INTEGER: INTEGER,
  19562. REAL: REAL,
  19563. STRING: STRING,
  19564. BOOLEAN: BOOLEAN,
  19565. VOID: VOID,
  19566. UNDEFINED: UNDEFINED,
  19567. ALL: ALL
  19568. });
  19569. /***/ }),
  19570. /***/ "./js/util/config.js":
  19571. /*!***************************!*\
  19572. !*** ./js/util/config.js ***!
  19573. \***************************/
  19574. /*! exports provided: Config */
  19575. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19576. "use strict";
  19577. __webpack_require__.r(__webpack_exports__);
  19578. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Config", function() { return Config; });
  19579. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19580. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19581. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19582. var ConfigObject =
  19583. /*#__PURE__*/
  19584. function () {
  19585. function ConfigObject() {
  19586. _classCallCheck(this, ConfigObject);
  19587. this.loopTimeout = 5000;
  19588. this.decimalPlaces = 8;
  19589. this.intConvertRoundMode = 2;
  19590. this.default_lang = 'pt';
  19591. this.enable_type_casting = true;
  19592. }
  19593. _createClass(ConfigObject, [{
  19594. key: "setConfig",
  19595. value: function setConfig(opts) {
  19596. for (var key in opts) {
  19597. if (this.hasOwnProperty(key)) {
  19598. this[key] = opts[key];
  19599. }
  19600. }
  19601. }
  19602. }]);
  19603. return ConfigObject;
  19604. }();
  19605. var config = new ConfigObject();
  19606. var Config = config;
  19607. /***/ }),
  19608. /***/ "./js/util/inputTest.js":
  19609. /*!******************************!*\
  19610. !*** ./js/util/inputTest.js ***!
  19611. \******************************/
  19612. /*! exports provided: InputTest */
  19613. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19614. "use strict";
  19615. __webpack_require__.r(__webpack_exports__);
  19616. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InputTest", function() { return InputTest; });
  19617. /* harmony import */ var _io_input__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  19618. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19619. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19620. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19621. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19622. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19623. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19624. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19625. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19626. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19627. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19628. var InputTest =
  19629. /*#__PURE__*/
  19630. function (_Input) {
  19631. _inherits(InputTest, _Input);
  19632. function InputTest(inputList) {
  19633. var _this;
  19634. _classCallCheck(this, InputTest);
  19635. _this = _possibleConstructorReturn(this, _getPrototypeOf(InputTest).call(this));
  19636. _this.index = 0;
  19637. _this.inputList = inputList;
  19638. return _this;
  19639. }
  19640. _createClass(InputTest, [{
  19641. key: "requestInput",
  19642. value: function requestInput(callback) {
  19643. if (this.index < this.inputList.length) {
  19644. callback(this.inputList[this.index]);
  19645. this.index++;
  19646. } else {
  19647. throw new Error(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getError("exceeded_input_request"));
  19648. }
  19649. }
  19650. }]);
  19651. return InputTest;
  19652. }(_io_input__WEBPACK_IMPORTED_MODULE_0__["Input"]);
  19653. /***/ }),
  19654. /***/ "./js/util/outputTest.js":
  19655. /*!*******************************!*\
  19656. !*** ./js/util/outputTest.js ***!
  19657. \*******************************/
  19658. /*! exports provided: OutputTest */
  19659. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19660. "use strict";
  19661. __webpack_require__.r(__webpack_exports__);
  19662. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutputTest", function() { return OutputTest; });
  19663. /* harmony import */ var _io_output__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  19664. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19665. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19666. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  19667. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19668. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19669. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19670. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19671. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19672. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19673. var OutputTest =
  19674. /*#__PURE__*/
  19675. function (_Output) {
  19676. _inherits(OutputTest, _Output);
  19677. function OutputTest() {
  19678. var _this;
  19679. _classCallCheck(this, OutputTest);
  19680. _this = _possibleConstructorReturn(this, _getPrototypeOf(OutputTest).call(this));
  19681. _this.list = [];
  19682. return _this;
  19683. }
  19684. _createClass(OutputTest, [{
  19685. key: "sendOutput",
  19686. value: function sendOutput(text) {
  19687. this.list.push(text);
  19688. }
  19689. }]);
  19690. return OutputTest;
  19691. }(_io_output__WEBPACK_IMPORTED_MODULE_0__["Output"]);
  19692. /***/ }),
  19693. /***/ "./js/visualUI/algorithm.js":
  19694. /*!**********************************!*\
  19695. !*** ./js/visualUI/algorithm.js ***!
  19696. \**********************************/
  19697. /*! exports provided: renderAlgorithm */
  19698. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19699. "use strict";
  19700. __webpack_require__.r(__webpack_exports__);
  19701. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderAlgorithm", function() { return renderAlgorithm; });
  19702. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19703. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  19704. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19705. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19706. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19707. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19708. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19709. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19710. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  19711. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19712. /* harmony import */ var _functions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  19713. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  19714. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  19715. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  19716. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  19717. window.block_render = false;
  19718. function renderAlgorithm() {
  19719. if (window.block_render) {
  19720. return;
  19721. }
  19722. if (window.draging) {
  19723. return;
  19724. }
  19725. window.block_render = true;
  19726. console.log('rendering algorithm');
  19727. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children().off();
  19728. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').empty();
  19729. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').children().off();
  19730. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').empty();
  19731. for (var i = 0; i < window.program_obj.functions.length; i++) {
  19732. _functions__WEBPACK_IMPORTED_MODULE_9__["renderFunction"](window.program_obj.functions[i]);
  19733. }
  19734. for (var i = 0; i < window.program_obj.globals.length; i++) {
  19735. _globals__WEBPACK_IMPORTED_MODULE_4__["renderGlobal"](window.program_obj.globals[i]);
  19736. }
  19737. setTimeout(function () {
  19738. window.block_render = false;
  19739. }, 100);
  19740. console.log('fim do render');
  19741. }
  19742. /***/ }),
  19743. /***/ "./js/visualUI/code_generator.js":
  19744. /*!***************************************!*\
  19745. !*** ./js/visualUI/code_generator.js ***!
  19746. \***************************************/
  19747. /*! exports provided: generate */
  19748. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19749. "use strict";
  19750. __webpack_require__.r(__webpack_exports__);
  19751. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generate", function() { return generate; });
  19752. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19753. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  19754. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19755. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19756. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19757. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19758. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19759. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19760. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  19761. function generate() {
  19762. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').find('.error_icon').remove();
  19763. var code = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('program') + ' { ';
  19764. code += globalsCode();
  19765. code += '\n';
  19766. var has_error = false;
  19767. for (var i = 0; i < window.program_obj.functions.length; i++) {
  19768. var n_code = functionsCode(window.program_obj.functions[i]);
  19769. if (n_code == null) {
  19770. has_error = true;
  19771. }
  19772. code += n_code;
  19773. code += '\n';
  19774. }
  19775. code += '\n}';
  19776. if (has_error) {
  19777. return null;
  19778. } else {
  19779. return code;
  19780. }
  19781. }
  19782. function functionsCode(function_obj) {
  19783. var ret = '\n\t' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('function') + ' ';
  19784. var has_error = false;
  19785. switch (function_obj.return_type) {
  19786. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  19787. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer');
  19788. break;
  19789. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  19790. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real');
  19791. break;
  19792. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  19793. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text');
  19794. break;
  19795. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  19796. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean');
  19797. break;
  19798. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID:
  19799. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('void');
  19800. break;
  19801. }
  19802. ret += ' ';
  19803. if (function_obj.return_dimensions == 1) {
  19804. ret += '[] ';
  19805. } else if (function_obj.return_dimensions == 2) {
  19806. ret += '[][] ';
  19807. }
  19808. ret += function_obj.name + ' ( ';
  19809. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19810. ret += parametersCode(function_obj.parameters_list[j]);
  19811. if (j + 1 < function_obj.parameters_list.length) {
  19812. ret += ',';
  19813. }
  19814. }
  19815. ret += ' ) {';
  19816. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19817. ret += variablesCode(function_obj.variables_list[j]);
  19818. }
  19819. for (var j = 0; j < function_obj.commands.length; j++) {
  19820. try {
  19821. ret += commandsCode(function_obj.commands[j]);
  19822. } catch (err) {
  19823. has_error = true;
  19824. console.error(err.message);
  19825. var todos = jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').find('.command_container');
  19826. for (var i = 0; i < todos.length; i++) {
  19827. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(todos[i]).data('command') == function_obj.commands[j]) {
  19828. jquery__WEBPACK_IMPORTED_MODULE_0___default()(todos[i]).prepend(' <i class="ui icon red exclamation triangle error_icon"></i> ');
  19829. break;
  19830. }
  19831. }
  19832. }
  19833. }
  19834. ret += '\n\t}';
  19835. if (has_error) {
  19836. return null;
  19837. } else {
  19838. return ret;
  19839. }
  19840. }
  19841. function commandsCode(command_obj) {
  19842. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  19843. switch (command_obj.type) {
  19844. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  19845. return breaksCode(command_obj, indentation);
  19846. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  19847. return commentsCode(command_obj, indentation);
  19848. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  19849. return readersCode(command_obj, indentation);
  19850. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  19851. return writersCode(command_obj, indentation);
  19852. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  19853. return functioncallsCode(command_obj, indentation);
  19854. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  19855. return attributionsCode(command_obj, indentation);
  19856. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  19857. return whiletruesCode(command_obj, indentation);
  19858. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  19859. return doWhilesCode(command_obj, indentation);
  19860. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  19861. return iftruesCode(command_obj, indentation);
  19862. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  19863. return repeatNtimesCode(command_obj, indentation);
  19864. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  19865. return switchsCode(command_obj, indentation);
  19866. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  19867. return returnsCode(command_obj, indentation);
  19868. }
  19869. }
  19870. function returnsCode(command_obj, indentation) {
  19871. var ret = '\n';
  19872. for (var i = 0; i < indentation; i++) {
  19873. ret += '\t';
  19874. }
  19875. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return');
  19876. if (command_obj.variable_value_menu) {
  19877. try {
  19878. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
  19879. } catch (err) {}
  19880. }
  19881. return ret;
  19882. }
  19883. function breaksCode(command_obj, indentation) {
  19884. var ret = '\n';
  19885. for (var i = 0; i < indentation; i++) {
  19886. ret += '\t';
  19887. }
  19888. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break');
  19889. return ret;
  19890. }
  19891. function switchsCode(command_obj, indentation) {
  19892. var ret = '\n';
  19893. for (var i = 0; i < indentation; i++) {
  19894. ret += '\t';
  19895. }
  19896. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( ';
  19897. ret += variableValueMenuCode(command_obj.variable);
  19898. ret += ' ) { ';
  19899. if (command_obj.cases) {
  19900. for (var i = 0; i < command_obj.cases.length; i++) {
  19901. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  19902. }
  19903. }
  19904. ret += '\n';
  19905. for (var i = 0; i < indentation; i++) {
  19906. ret += '\t';
  19907. }
  19908. ret += '} ';
  19909. return ret;
  19910. }
  19911. function switchcasesCode(switchcase, indentation) {
  19912. var ret = '\n';
  19913. for (var i = 0; i < indentation; i++) {
  19914. ret += '\t';
  19915. }
  19916. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' ';
  19917. ret += variableValueMenuCode(switchcase.variable_value_menu);
  19918. ret += ' :';
  19919. if (switchcase.commands_block) {
  19920. for (var i = 0; i < switchcase.commands_block.length; i++) {
  19921. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  19922. }
  19923. }
  19924. return ret;
  19925. }
  19926. function repeatNtimesCode(command_obj, indentation) {
  19927. var ret = '\n';
  19928. for (var i = 0; i < indentation; i++) {
  19929. ret += '\t';
  19930. }
  19931. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_for') + ' ( ';
  19932. if (command_obj.var_attribution) {
  19933. ret += variableValueMenuCode(command_obj.var_attribution);
  19934. ret += ' = ';
  19935. ret += variableValueMenuCode(command_obj.expression1);
  19936. }
  19937. ret += ' ; ';
  19938. if (command_obj.expression2) {
  19939. switch (command_obj.expression2.expression.type) {
  19940. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  19941. ret += logicExpressionCode(command_obj.expression2.expression);
  19942. break;
  19943. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  19944. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  19945. break;
  19946. }
  19947. }
  19948. ret += ' ; ';
  19949. if (command_obj.var_incrementation) {
  19950. ret += variableValueMenuCode(command_obj.var_incrementation);
  19951. ret += ' = ';
  19952. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  19953. switch (command_obj.expression3.itens[1]) {
  19954. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  19955. ret += ' + ';
  19956. break;
  19957. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  19958. ret += ' - ';
  19959. break;
  19960. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  19961. ret += ' * ';
  19962. break;
  19963. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  19964. ret += ' / ';
  19965. break;
  19966. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  19967. ret += ' % ';
  19968. break;
  19969. }
  19970. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  19971. }
  19972. ret += ' ) { ';
  19973. if (command_obj.commands_block) {
  19974. for (var i = 0; i < command_obj.commands_block.length; i++) {
  19975. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  19976. }
  19977. }
  19978. ret += '\n';
  19979. for (var i = 0; i < indentation; i++) {
  19980. ret += '\t';
  19981. }
  19982. ret += '}';
  19983. return ret;
  19984. }
  19985. function iftruesCode(command_obj, indentation) {
  19986. var ret = '\n';
  19987. for (var i = 0; i < indentation; i++) {
  19988. ret += '\t';
  19989. }
  19990. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_if');
  19991. if (!command_obj.expression.expression) {
  19992. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  19993. }
  19994. switch (command_obj.expression.expression.type) {
  19995. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  19996. ret += logicExpressionCode(command_obj.expression.expression);
  19997. break;
  19998. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  19999. ret += arithmeticExpressionCode(command_obj.expression.expression);
  20000. break;
  20001. }
  20002. ret += ' { ';
  20003. if (command_obj.commands_block) {
  20004. for (var i = 0; i < command_obj.commands_block.length; i++) {
  20005. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  20006. }
  20007. }
  20008. ret += '\n';
  20009. for (var i = 0; i < indentation; i++) {
  20010. ret += '\t';
  20011. }
  20012. ret += '} ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_else') + ' {';
  20013. if (command_obj.commands_else) {
  20014. for (var i = 0; i < command_obj.commands_else.length; i++) {
  20015. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  20016. }
  20017. }
  20018. ret += '\n';
  20019. for (var i = 0; i < indentation; i++) {
  20020. ret += '\t';
  20021. }
  20022. ret += '}';
  20023. return ret;
  20024. }
  20025. function doWhilesCode(command_obj, indentation) {
  20026. var ret = '\n';
  20027. for (var i = 0; i < indentation; i++) {
  20028. ret += '\t';
  20029. }
  20030. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_do') + ' { ';
  20031. if (command_obj.commands_block) {
  20032. for (var i = 0; i < command_obj.commands_block.length; i++) {
  20033. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  20034. }
  20035. }
  20036. ret += '\n';
  20037. for (var i = 0; i < indentation; i++) {
  20038. ret += '\t';
  20039. }
  20040. ret += '} ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while');
  20041. if (!command_obj.expression.expression) {
  20042. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  20043. }
  20044. switch (command_obj.expression.expression.type) {
  20045. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  20046. ret += logicExpressionCode(command_obj.expression.expression);
  20047. break;
  20048. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  20049. ret += arithmeticExpressionCode(command_obj.expression.expression);
  20050. break;
  20051. }
  20052. return ret;
  20053. }
  20054. function whiletruesCode(command_obj, indentation) {
  20055. var ret = '\n';
  20056. for (var i = 0; i < indentation; i++) {
  20057. ret += '\t';
  20058. }
  20059. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while');
  20060. if (!command_obj.expression.expression) {
  20061. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  20062. }
  20063. switch (command_obj.expression.expression.type) {
  20064. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  20065. ret += logicExpressionCode(command_obj.expression.expression);
  20066. break;
  20067. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  20068. ret += arithmeticExpressionCode(command_obj.expression.expression);
  20069. break;
  20070. }
  20071. ret += ' { ';
  20072. if (command_obj.commands_block) {
  20073. for (var i = 0; i < command_obj.commands_block.length; i++) {
  20074. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  20075. }
  20076. }
  20077. ret += '\n';
  20078. for (var i = 0; i < indentation; i++) {
  20079. ret += '\t';
  20080. }
  20081. ret += '}';
  20082. return ret;
  20083. }
  20084. function logicExpressionCode(expression) {
  20085. var ret = ' ( ';
  20086. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20087. ret += logicExpressionCode(expression.first_operand);
  20088. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20089. ret += arithmeticExpressionCode(expression.first_operand);
  20090. } else {
  20091. ret += variableValueMenuCode(expression.first_operand);
  20092. }
  20093. if (expression.operator) {
  20094. switch (expression.operator) {
  20095. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to:
  20096. ret += ' == ';
  20097. break;
  20098. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to:
  20099. ret += ' != ';
  20100. break;
  20101. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and:
  20102. ret += ' && ';
  20103. break;
  20104. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or:
  20105. ret += ' || ';
  20106. break;
  20107. }
  20108. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20109. ret += logicExpressionCode(expression.second_operand);
  20110. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20111. ret += arithmeticExpressionCode(expression.second_operand);
  20112. } else {
  20113. ret += variableValueMenuCode(expression.second_operand);
  20114. }
  20115. }
  20116. ret += ' ) ';
  20117. return ret;
  20118. }
  20119. function arithmeticExpressionCode(expression) {
  20120. var ret = ' ( ';
  20121. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20122. ret += logicExpressionCode(expression.first_operand);
  20123. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20124. ret += arithmeticExpressionCode(expression.first_operand);
  20125. } else {
  20126. ret += variableValueMenuCode(expression.first_operand);
  20127. }
  20128. switch (expression.operator) {
  20129. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than:
  20130. ret += ' > ';
  20131. break;
  20132. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than:
  20133. ret += ' < ';
  20134. break;
  20135. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to:
  20136. ret += ' == ';
  20137. break;
  20138. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to:
  20139. ret += ' != ';
  20140. break;
  20141. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to:
  20142. ret += ' >= ';
  20143. break;
  20144. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to:
  20145. ret += ' <= ';
  20146. break;
  20147. }
  20148. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20149. ret += logicExpressionCode(expression.second_operand);
  20150. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20151. ret += arithmeticExpressionCode(expression.second_operand);
  20152. } else {
  20153. ret += variableValueMenuCode(expression.second_operand);
  20154. }
  20155. ret += ' ) ';
  20156. return ret;
  20157. }
  20158. function attributionsCode(command_obj, indentation) {
  20159. var ret = '\n';
  20160. for (var i = 0; i < indentation; i++) {
  20161. ret += '\t';
  20162. }
  20163. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  20164. for (var i = 0; i < command_obj.expression.length; i++) {
  20165. ret += elementExpressionCode(command_obj.expression[i]);
  20166. }
  20167. return ret;
  20168. }
  20169. function elementExpressionCode(expression_obj) {
  20170. var ret = '';
  20171. for (var i = 0; i < expression_obj.itens.length; i++) {
  20172. if (expression_obj.itens[i].type) {
  20173. ret += variableValueMenuCode(expression_obj.itens[i]);
  20174. } else if (expression_obj.itens[i].type_exp) {
  20175. if (expression_obj.itens[i].type_exp == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par) {
  20176. ret += ' ( ';
  20177. }
  20178. ret += elementExpressionCode(expression_obj.itens[i]);
  20179. if (expression_obj.itens[i].type_exp == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par) {
  20180. ret += ' ) ';
  20181. }
  20182. } else {
  20183. switch (expression_obj.itens[i]) {
  20184. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  20185. ret += ' + ';
  20186. break;
  20187. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  20188. ret += ' - ';
  20189. break;
  20190. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  20191. ret += ' * ';
  20192. break;
  20193. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  20194. ret += ' / ';
  20195. break;
  20196. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  20197. ret += ' % ';
  20198. break;
  20199. }
  20200. }
  20201. }
  20202. return ret;
  20203. }
  20204. function functioncallsCode(command_obj, indentation) {
  20205. var ret = '\n';
  20206. for (var i = 0; i < indentation; i++) {
  20207. ret += '\t';
  20208. }
  20209. ret += variableValueMenuCode(command_obj.function_called);
  20210. return ret;
  20211. }
  20212. function readersCode(command_obj, indentation) {
  20213. var ret = '\n';
  20214. for (var i = 0; i < indentation; i++) {
  20215. ret += '\t';
  20216. }
  20217. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' ( ';
  20218. ret += variableValueMenuCode(command_obj.variable_value_menu);
  20219. ret += ' ) ';
  20220. return ret;
  20221. }
  20222. function variableValueMenuCode(variable_obj) {
  20223. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  20224. var ret = '';
  20225. try {
  20226. if (variable_obj.function_called) {
  20227. if (variable_obj.function_called.name) {
  20228. ret += variable_obj.function_called.name + ' ( ';
  20229. } else {
  20230. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + ' ( ';
  20231. }
  20232. if (variable_obj.parameters_list) {
  20233. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  20234. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  20235. if (i + 1 < variable_obj.parameters_list.length) {
  20236. ret += ', ';
  20237. }
  20238. }
  20239. }
  20240. ret += ' )';
  20241. } else if (variable_obj.content.type) {
  20242. ret += variable_obj.content.name;
  20243. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  20244. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  20245. }
  20246. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  20247. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  20248. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  20249. }
  20250. } else {
  20251. if (isNaN(variable_obj.content)) {
  20252. ret += '"' + variable_obj.content + '"';
  20253. } else {
  20254. ret += variable_obj.content;
  20255. }
  20256. }
  20257. } catch (err) {
  20258. if (!is_return) {
  20259. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](variable_obj.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_content'));
  20260. throw err;
  20261. }
  20262. }
  20263. return ret;
  20264. }
  20265. function writersCode(command_obj, indentation) {
  20266. var ret = '\n';
  20267. for (var i = 0; i < indentation; i++) {
  20268. ret += '\t';
  20269. }
  20270. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' ( ';
  20271. for (var i = 0; i < command_obj.content.length; i++) {
  20272. ret += variableValueMenuCode(command_obj.content[i]);
  20273. if (i + 1 < command_obj.content.length) {
  20274. ret += ' + ';
  20275. }
  20276. }
  20277. ret += ' ) ';
  20278. return ret;
  20279. }
  20280. function commentsCode(command_obj, indentation) {
  20281. var ret = '\n';
  20282. for (var i = 0; i < indentation; i++) {
  20283. ret += '\t';
  20284. }
  20285. ret += '// ';
  20286. ret += command_obj.comment_text.content;
  20287. return ret;
  20288. }
  20289. function parametersCode(parameter_obj) {
  20290. var ret = '';
  20291. switch (parameter_obj.type) {
  20292. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20293. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer') + ' ';
  20294. break;
  20295. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20296. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real') + ' ';
  20297. break;
  20298. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20299. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text') + ' ';
  20300. break;
  20301. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20302. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean') + ' ';
  20303. break;
  20304. }
  20305. ret += parameter_obj.name + '';
  20306. if (parameter_obj.dimensions == 1) {
  20307. ret += ' []';
  20308. } else if (parameter_obj.dimensions == 2) {
  20309. ret += ' [][]';
  20310. }
  20311. return ret;
  20312. }
  20313. function variablesCode(variable_obj) {
  20314. var ret = '';
  20315. var temp = variable_obj;
  20316. ret += '\n\t\t';
  20317. if (temp.is_constant) {
  20318. ret += 'const ';
  20319. }
  20320. switch (temp.type) {
  20321. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20322. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer') + ' ';
  20323. break;
  20324. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20325. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real') + ' ';
  20326. break;
  20327. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20328. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text') + ' ';
  20329. break;
  20330. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20331. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean') + ' ';
  20332. break;
  20333. }
  20334. ret += temp.name + ' ';
  20335. if (temp.dimensions == 1) {
  20336. ret += '[' + temp.columns + '] ';
  20337. switch (temp.type) {
  20338. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20339. ret += '= {' + temp.value + '}';
  20340. break;
  20341. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20342. ret += '= {' + temp.value.toFixed(2) + '}';
  20343. break;
  20344. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20345. ret += '= {';
  20346. for (var j = 0; j < temp.value.length; j++) {
  20347. ret += '"' + temp.value[j] + '"';
  20348. if (j + 1 < temp.value.length) {
  20349. ret += ',';
  20350. }
  20351. }
  20352. ret += '}';
  20353. break;
  20354. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20355. ret += '= {';
  20356. for (var j = 0; j < temp.value.length; j++) {
  20357. if (temp.value[j]) {
  20358. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20359. } else {
  20360. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20361. }
  20362. if (j + 1 < temp.value.length) {
  20363. ret += ',';
  20364. }
  20365. }
  20366. ret += '}';
  20367. break;
  20368. }
  20369. } else if (temp.dimensions == 2) {
  20370. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  20371. switch (temp.type) {
  20372. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20373. ret += '= {';
  20374. for (var j = 0; j < temp.rows; j++) {
  20375. ret += '{' + temp.value[j] + '}';
  20376. if (j + 1 < temp.rows) {
  20377. ret += ',';
  20378. }
  20379. }
  20380. ret += '}';
  20381. break;
  20382. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20383. ret += '= {';
  20384. for (var j = 0; j < temp.rows; j++) {
  20385. ret += '{' + temp.value[j].toFixed(2) + '}';
  20386. if (j + 1 < temp.rows) {
  20387. ret += ',';
  20388. }
  20389. }
  20390. ret += '}';
  20391. break;
  20392. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20393. ret += '= {';
  20394. for (var j = 0; j < temp.rows; j++) {
  20395. ret += '{';
  20396. for (var k = 0; k < temp.columns; k++) {
  20397. ret += '"' + temp.value[j][k] + '"';
  20398. if (k + 1 < temp.columns) {
  20399. ret += ',';
  20400. }
  20401. }
  20402. ret += '}';
  20403. if (j + 1 < temp.rows) {
  20404. ret += ',';
  20405. }
  20406. }
  20407. ret += '}';
  20408. break;
  20409. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20410. ret += '= {';
  20411. for (var j = 0; j < temp.rows; j++) {
  20412. ret += '{';
  20413. for (var k = 0; k < temp.columns; k++) {
  20414. if (temp.value[j][k]) {
  20415. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20416. } else {
  20417. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20418. }
  20419. if (k + 1 < temp.columns) {
  20420. ret += ',';
  20421. }
  20422. }
  20423. ret += '}';
  20424. if (j + 1 < temp.rows) {
  20425. ret += ',';
  20426. }
  20427. }
  20428. ret += '}';
  20429. break;
  20430. }
  20431. } else {
  20432. switch (temp.type) {
  20433. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20434. ret += '= ' + temp.value;
  20435. break;
  20436. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20437. ret += '= ' + temp.value.toFixed(2);
  20438. break;
  20439. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20440. ret += '= "' + temp.value + '"';
  20441. break;
  20442. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20443. ret += '= ';
  20444. if (temp.value) {
  20445. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20446. } else {
  20447. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20448. }
  20449. break;
  20450. }
  20451. }
  20452. return ret;
  20453. }
  20454. function globalsCode() {
  20455. var ret = '';
  20456. if (window.program_obj.globals) {
  20457. for (var i = 0; i < window.program_obj.globals.length; i++) {
  20458. var temp = window.program_obj.globals[i];
  20459. ret += '\n\t';
  20460. if (temp.is_constant) {
  20461. ret += 'const ';
  20462. }
  20463. switch (temp.type) {
  20464. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20465. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer');
  20466. break;
  20467. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20468. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real');
  20469. break;
  20470. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20471. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text');
  20472. break;
  20473. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20474. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean');
  20475. break;
  20476. }
  20477. ret += ' ' + temp.name + ' ';
  20478. if (temp.dimensions == 1) {
  20479. ret += '[' + temp.columns + '] ';
  20480. switch (temp.type) {
  20481. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20482. ret += '= {' + temp.value + '}';
  20483. break;
  20484. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20485. ret += '= {';
  20486. for (var j = 0; j < temp.value.length; j++) {
  20487. ret += temp.value[j].toFixed(2);
  20488. if (j + 1 < temp.value.length) {
  20489. ret += ',';
  20490. }
  20491. }
  20492. ret += '}';
  20493. break;
  20494. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20495. ret += '= {';
  20496. for (var j = 0; j < temp.value.length; j++) {
  20497. ret += '"' + temp.value[j] + '"';
  20498. if (j + 1 < temp.value.length) {
  20499. ret += ',';
  20500. }
  20501. }
  20502. ret += '}';
  20503. break;
  20504. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20505. ret += '= {';
  20506. for (var j = 0; j < temp.value.length; j++) {
  20507. if (temp.value[j]) {
  20508. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20509. } else {
  20510. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20511. }
  20512. if (j + 1 < temp.value.length) {
  20513. ret += ',';
  20514. }
  20515. }
  20516. ret += '}';
  20517. break;
  20518. }
  20519. } else if (temp.dimensions == 2) {
  20520. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  20521. switch (temp.type) {
  20522. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20523. ret += '= {';
  20524. for (var j = 0; j < temp.rows; j++) {
  20525. ret += '{' + temp.value[j] + '}';
  20526. if (j + 1 < temp.rows) {
  20527. ret += ',';
  20528. }
  20529. }
  20530. ret += '}';
  20531. break;
  20532. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20533. ret += '= {';
  20534. for (var j = 0; j < temp.rows; j++) {
  20535. ret += '{';
  20536. for (var k = 0; k < temp.columns; k++) {
  20537. ret += temp.value[j][k].toFixed(2);
  20538. if (k + 1 < temp.columns) {
  20539. ret += ',';
  20540. }
  20541. }
  20542. ret += '}';
  20543. if (j + 1 < temp.rows) {
  20544. ret += ',';
  20545. }
  20546. }
  20547. ret += '}';
  20548. break;
  20549. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20550. ret += '= {';
  20551. for (var j = 0; j < temp.rows; j++) {
  20552. ret += '{';
  20553. for (var k = 0; k < temp.columns; k++) {
  20554. ret += '"' + temp.value[j][k] + '"';
  20555. if (k + 1 < temp.columns) {
  20556. ret += ',';
  20557. }
  20558. }
  20559. ret += '}';
  20560. if (j + 1 < temp.rows) {
  20561. ret += ',';
  20562. }
  20563. }
  20564. ret += '}';
  20565. break;
  20566. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20567. ret += '= {';
  20568. for (var j = 0; j < temp.rows; j++) {
  20569. ret += '{';
  20570. for (var k = 0; k < temp.columns; k++) {
  20571. if (temp.value[j][k]) {
  20572. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20573. } else {
  20574. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20575. }
  20576. if (k + 1 < temp.columns) {
  20577. ret += ',';
  20578. }
  20579. }
  20580. ret += '}';
  20581. if (j + 1 < temp.rows) {
  20582. ret += ',';
  20583. }
  20584. }
  20585. ret += '}';
  20586. break;
  20587. }
  20588. } else {
  20589. switch (temp.type) {
  20590. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20591. ret += '= ' + temp.value;
  20592. break;
  20593. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20594. ret += '= ' + temp.value.toFixed(2);
  20595. break;
  20596. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20597. ret += '= "' + temp.value + '"';
  20598. break;
  20599. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20600. ret += '= ';
  20601. if (temp.value) {
  20602. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20603. ;
  20604. } else {
  20605. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20606. ;
  20607. }
  20608. break;
  20609. }
  20610. }
  20611. }
  20612. }
  20613. return ret;
  20614. }
  20615. /***/ }),
  20616. /***/ "./js/visualUI/commands.js":
  20617. /*!*********************************!*\
  20618. !*** ./js/visualUI/commands.js ***!
  20619. \*********************************/
  20620. /*! exports provided: removeCommand, createFloatingCommand, renderCommand, genericCreateCommand */
  20621. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  20622. "use strict";
  20623. __webpack_require__.r(__webpack_exports__);
  20624. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeCommand", function() { return removeCommand; });
  20625. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  20626. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  20627. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "genericCreateCommand", function() { return genericCreateCommand; });
  20628. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20629. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  20630. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20631. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20632. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20633. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  20634. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  20635. /* harmony import */ var _commands_comment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  20636. /* harmony import */ var _commands_reader__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  20637. /* harmony import */ var _commands_writer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  20638. /* harmony import */ var _commands_attribution__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  20639. /* harmony import */ var _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  20640. /* harmony import */ var _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  20641. /* harmony import */ var _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  20642. /* harmony import */ var _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  20643. /* harmony import */ var _commands_switch__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  20644. /* harmony import */ var _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  20645. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20646. /* harmony import */ var _commands_break__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  20647. /* harmony import */ var _commands_return__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  20648. var has_element_created_draged = false;
  20649. var which_element_is_draged = null;
  20650. function removeCommand(command, function_obj, dom_obj) {
  20651. if (function_obj.commands.indexOf(command) > -1) {
  20652. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  20653. return true;
  20654. } // Utilize dois parantNode, pois o primeiro é o div de comandos
  20655. try {
  20656. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  20657. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  20658. return true;
  20659. }
  20660. } catch (err) {}
  20661. try {
  20662. if (dom_obj.parent().parent().data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue) {
  20663. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  20664. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  20665. return true;
  20666. }
  20667. }
  20668. } catch (err) {}
  20669. if (dom_obj.parent().data('switchcase')) {
  20670. console.log("o que encontrei: ");
  20671. console.log(dom_obj.parent().data('switchcase'));
  20672. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  20673. return true;
  20674. }
  20675. return false;
  20676. }
  20677. window.function_container_active = null;
  20678. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  20679. var floatingObject;
  20680. switch (command_type) {
  20681. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20682. floatingObject = _commands_break__WEBPACK_IMPORTED_MODULE_17__["createFloatingCommand"]();
  20683. break;
  20684. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20685. floatingObject = _commands_comment__WEBPACK_IMPORTED_MODULE_6__["createFloatingCommand"]();
  20686. break;
  20687. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20688. floatingObject = _commands_reader__WEBPACK_IMPORTED_MODULE_7__["createFloatingCommand"]();
  20689. break;
  20690. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20691. floatingObject = _commands_writer__WEBPACK_IMPORTED_MODULE_8__["createFloatingCommand"]();
  20692. break;
  20693. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20694. floatingObject = _commands_attribution__WEBPACK_IMPORTED_MODULE_9__["createFloatingCommand"]();
  20695. break;
  20696. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20697. floatingObject = _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__["createFloatingCommand"]();
  20698. break;
  20699. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20700. floatingObject = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__["createFloatingCommand"]();
  20701. break;
  20702. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20703. floatingObject = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__["createFloatingCommand"]();
  20704. break;
  20705. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20706. floatingObject = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__["createFloatingCommand"]();
  20707. break;
  20708. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20709. floatingObject = _commands_switch__WEBPACK_IMPORTED_MODULE_14__["createFloatingCommand"]();
  20710. break;
  20711. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20712. floatingObject = _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__["createFloatingCommand"]();
  20713. break;
  20714. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  20715. floatingObject = _commands_return__WEBPACK_IMPORTED_MODULE_18__["createFloatingCommand"]();
  20716. break;
  20717. }
  20718. floatingObject.draggable().appendTo("body");
  20719. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').mouseup(function (evt) {
  20720. manageCommand(function_obj, function_container, evt, command_type);
  20721. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseup');
  20722. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseover');
  20723. });
  20724. if (!function_container.hasClass('function_div') || function_container.length < 1) {
  20725. window.mouse_event = mouse_event;
  20726. function_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(mouse_event.originalEvent.srcElement.closest('.function_div'));
  20727. }
  20728. console.log('function_container', function_container);
  20729. function_container_active = function_container;
  20730. function_container.find('.commands_list_div').on('mousemove', function (evt) {
  20731. addGhostDiv(evt);
  20732. });
  20733. function_container.find('.commands_list_div').find("*").on('mousemove', function (evt) {
  20734. addGhostDiv(evt);
  20735. });
  20736. function_container.on('mouseout', function (event) {
  20737. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  20738. if (el.closest('.commands_list_div').length < 1) {
  20739. window.ghostDiv.remove();
  20740. }
  20741. });
  20742. floatingObject.css("position", "absolute");
  20743. mouse_event.type = "mousedown.draggable";
  20744. mouse_event.target = floatingObject[0];
  20745. floatingObject.css("left", mouse_event.pageX - window.divx);
  20746. floatingObject.css("top", mouse_event.pageY);
  20747. floatingObject.trigger(mouse_event);
  20748. }
  20749. window.divx = 100;
  20750. window.ghostDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ghost_div">');
  20751. window.active_container = null;
  20752. function addGhostToEmptyBlock(element, evt) {
  20753. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20754. var container = element.closest('.command_container');
  20755. if (container.hasClass('switch')) {
  20756. container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.case_div');
  20757. }
  20758. if (!container.hasClass('dowhiletrue') && !container.hasClass('iftrue') && !container.hasClass('repeatNtimes') && !container.hasClass('case_div') && !container.hasClass('whiletrue')) {
  20759. addGhostToNotEmptyBlock(element, evt);
  20760. return;
  20761. }
  20762. if (window.active_container != null) {
  20763. if (window.active_container.is(container)) {
  20764. console.log('é o mesmo, não mudou!');
  20765. } else {
  20766. if (container.length < 1) {
  20767. container = element.closest('.commands_list_div');
  20768. if (window.active_container.is(container)) {
  20769. console.log('é o mesmo command list');
  20770. } else {
  20771. console.log('mudou para um command list');
  20772. window.active_container = container;
  20773. }
  20774. } else {
  20775. console.log('mudou para um outro container?');
  20776. }
  20777. }
  20778. }
  20779. window.active_container = container;
  20780. if (container.hasClass('iftrue')) {
  20781. var containerIf = container.find('.commands_if').get(0);
  20782. var containerElse = container.find('.commands_else').get(0);
  20783. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  20784. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  20785. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  20786. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  20787. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  20788. jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerIf).append(window.ghostDiv);
  20789. } else {
  20790. jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerElse).append(window.ghostDiv);
  20791. }
  20792. } else if (container.hasClass('case_div')) {
  20793. container.find('.case_commands_block').append(window.ghostDiv);
  20794. } else {
  20795. container.find('.block_commands').append(window.ghostDiv);
  20796. }
  20797. }
  20798. function addGhostToNotEmptyBlock(element, evt) {
  20799. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20800. var container = element.closest('.dowhiletrue, .iftrue, .repeatNtimes, .case_div, .whiletrue'); //console.log("\n\nNOT EMPTY: ", container);
  20801. //if (window.active_container != null) {
  20802. //}
  20803. if (container.length < 1) {
  20804. container = element.closest('.commands_list_div');
  20805. window.active_container = container;
  20806. addGhostToFunctionArea(element, evt);
  20807. } else {//console.log('mudou para um outro container?');
  20808. }
  20809. window.active_container = container; // quem está mais próximo? // Essa regra se aplica somente quando o over está sobre um comando
  20810. var allfilhos;
  20811. console.log('olha o container: ', container);
  20812. if (container.hasClass('iftrue')) {
  20813. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.data_block_if').length > 0) {
  20814. allfilhos = container.find('.commands_if').children('.command_container');
  20815. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.data_block_else').length > 0) {
  20816. allfilhos = container.find('.commands_else').children('.command_container');
  20817. } else {
  20818. var containerIf = container.find('.commands_if').get(0);
  20819. var containerElse = container.find('.commands_else').get(0);
  20820. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  20821. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  20822. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  20823. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  20824. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  20825. allfilhos = jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerIf).children('.command_container');
  20826. } else {
  20827. allfilhos = jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerElse).children('.command_container');
  20828. }
  20829. }
  20830. } else if (container.hasClass('case_div')) {
  20831. allfilhos = container.children('.case_commands_block').children('.command_container');
  20832. } else if (container.hasClass('commands_list_div')) {
  20833. allfilhos = container.children('.command_container');
  20834. } else {
  20835. allfilhos = container.children('.block_commands').children('.command_container');
  20836. }
  20837. var topDistances = [];
  20838. var bottomDistances = [];
  20839. for (var i = 0; i < allfilhos.length; i++) {
  20840. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  20841. topDistances.push(topD);
  20842. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  20843. bottomDistances.push(botD);
  20844. }
  20845. console.log('topDistances\n', topDistances, '\nbottomDistances\n', bottomDistances);
  20846. var menorTop = Math.min.apply(null, topDistances);
  20847. var indiceTop = topDistances.indexOf(menorTop);
  20848. var menorBot = Math.min.apply(null, bottomDistances);
  20849. var indiceBot = bottomDistances.indexOf(menorBot);
  20850. if (menorTop < menorBot) {
  20851. window.ghostDiv.insertBefore(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceTop)));
  20852. } else {
  20853. window.ghostDiv.insertAfter(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceBot)));
  20854. }
  20855. console.log('distancias: menorTop ', menorTop, ' menorBot ', menorBot);
  20856. }
  20857. function addGhostToFunctionArea(undermouse, evt) {
  20858. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20859. var allfilhos = undermouse.closest('.commands_list_div').children('.command_container');
  20860. var topDistances = [];
  20861. var bottomDistances = [];
  20862. for (var i = 0; i < allfilhos.length; i++) {
  20863. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  20864. topDistances.push(topD);
  20865. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  20866. bottomDistances.push(botD);
  20867. }
  20868. var menorTop = Math.min.apply(null, topDistances);
  20869. var indiceTop = topDistances.indexOf(menorTop);
  20870. var menorBot = Math.min.apply(null, bottomDistances);
  20871. var indiceBot = bottomDistances.indexOf(menorBot);
  20872. if (menorTop < menorBot) {
  20873. window.ghostDiv.insertBefore(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceTop)));
  20874. } else {
  20875. window.ghostDiv.insertAfter(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceBot)));
  20876. }
  20877. }
  20878. function addGhostDiv(evt) {
  20879. console.log('a');
  20880. var undermouse = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target);
  20881. console.log('undermouse', undermouse);
  20882. if (undermouse.hasClass('ghost_div')) {
  20883. return;
  20884. } else if (undermouse.hasClass('commands_list_div')) {
  20885. addGhostToFunctionArea(undermouse, evt);
  20886. return;
  20887. } else if (undermouse.hasClass('block_commands')) {
  20888. if (undermouse.find('.command_container').length > 0) {
  20889. addGhostToNotEmptyBlock(undermouse, evt);
  20890. } else {
  20891. addGhostToEmptyBlock(undermouse, evt);
  20892. }
  20893. } else if (undermouse.hasClass('case_div')) {
  20894. if (undermouse.find('.case_commands_block').find('.command_container').length > 0) {
  20895. addGhostToNotEmptyBlock(undermouse, evt);
  20896. } else {
  20897. addGhostToEmptyBlock(undermouse, evt);
  20898. }
  20899. } else {
  20900. addGhostToNotEmptyBlock(undermouse, evt);
  20901. }
  20902. }
  20903. function borderMouseDragCommand(function_obj, function_container, evt) {
  20904. function_container.find('.over_command_drag').each(function (index) {
  20905. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).removeClass('over_command_drag');
  20906. });
  20907. var prev = null;
  20908. function_container.find('.commands_list_div').each(function (index) {
  20909. prev = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  20910. if (prev) {
  20911. var objLeft = prev.offset().left;
  20912. var objTop = prev.offset().top;
  20913. var objRight = objLeft + prev.width();
  20914. var objBottom = objTop + prev.height();
  20915. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  20916. prev.addClass("over_command_drag");
  20917. }
  20918. }
  20919. });
  20920. function_container.find('.command_container').each(function (index) {
  20921. var obj = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  20922. var objLeft = obj.offset().left;
  20923. var objTop = obj.offset().top;
  20924. var objRight = objLeft + obj.width();
  20925. var objBottom = objTop + obj.height();
  20926. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  20927. if (prev) {
  20928. prev.removeClass('over_command_drag');
  20929. }
  20930. obj.addClass("over_command_drag");
  20931. return;
  20932. }
  20933. });
  20934. } // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  20935. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  20936. var createdElement;
  20937. switch (command.type) {
  20938. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20939. createdElement = _commands_comment__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command, function_obj);
  20940. break;
  20941. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20942. createdElement = _commands_break__WEBPACK_IMPORTED_MODULE_17__["renderCommand"](command, function_obj);
  20943. break;
  20944. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20945. createdElement = _commands_reader__WEBPACK_IMPORTED_MODULE_7__["renderCommand"](command, function_obj);
  20946. break;
  20947. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20948. createdElement = _commands_writer__WEBPACK_IMPORTED_MODULE_8__["renderCommand"](command, function_obj);
  20949. break;
  20950. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20951. createdElement = _commands_attribution__WEBPACK_IMPORTED_MODULE_9__["renderCommand"](command, function_obj);
  20952. break;
  20953. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20954. createdElement = _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__["renderCommand"](command, function_obj);
  20955. break;
  20956. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20957. createdElement = _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__["renderCommand"](command, function_obj);
  20958. break;
  20959. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20960. createdElement = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__["renderCommand"](command, function_obj);
  20961. break;
  20962. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20963. createdElement = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__["renderCommand"](command, function_obj);
  20964. break;
  20965. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20966. createdElement = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__["renderCommand"](command, function_obj);
  20967. break;
  20968. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20969. createdElement = _commands_switch__WEBPACK_IMPORTED_MODULE_14__["renderCommand"](command, function_obj);
  20970. break;
  20971. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  20972. createdElement = _commands_return__WEBPACK_IMPORTED_MODULE_18__["renderCommand"](command, function_obj);
  20973. break;
  20974. }
  20975. switch (before_after_inside) {
  20976. case 1:
  20977. createdElement.insertBefore(element_reference);
  20978. break;
  20979. case 2:
  20980. createdElement.insertAfter(element_reference);
  20981. break;
  20982. case 3:
  20983. element_reference.append(createdElement);
  20984. break;
  20985. }
  20986. }
  20987. function genericCreateCommand(command_type) {
  20988. switch (command_type) {
  20989. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20990. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Break"]();
  20991. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20992. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_value, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment'), null, null, false));
  20993. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20994. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Reader"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false));
  20995. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20996. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Writer"]([new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  20997. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20998. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Attribution"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), []);
  20999. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  21000. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["FunctionCall"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_function, null, null, null, false), null);
  21001. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  21002. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["IfTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null, null);
  21003. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  21004. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["RepeatNTimes"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), null, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null, null);
  21005. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  21006. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["WhileTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null);
  21007. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  21008. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["DoWhileTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null);
  21009. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  21010. var sc = [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SwitchCase"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true))];
  21011. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Switch"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true), sc);
  21012. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  21013. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Return"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21014. }
  21015. }
  21016. function dragTrash(event) {
  21017. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  21018. var trash = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon trash alternate outline"></i>');
  21019. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').append(trash);
  21020. trash.css('position', 'absolute');
  21021. trash.css('top', event.clientY);
  21022. trash.css('left', event.clientX - 20);
  21023. trash.css('font-size', '3em');
  21024. trash.css('display', 'none');
  21025. function_container_active.find('.commands_list_div').off('mousemove');
  21026. function_container_active.find('.commands_list_div').find("*").off('mousemove');
  21027. trash.fadeIn(200, function () {
  21028. trash.fadeOut(200, function () {
  21029. trash.remove();
  21030. });
  21031. });
  21032. }
  21033. function manageCommand(function_obj, function_container, event, command_type) {
  21034. jquery__WEBPACK_IMPORTED_MODULE_0___default()(".created_element").each(function (index) {
  21035. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  21036. });
  21037. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  21038. if (el.hasClass('ghost_div')) {
  21039. if (el.closest('.command_container').length < 1) {
  21040. console.log('\n\nvou tentar!!!!');
  21041. console.log(el.closest('.commands_list_div'), '\n\n');
  21042. el.closest('.commands_list_div').css('height', el.closest('.commands_list_div').css('height') + 30); //$('.ghost_div').remove();
  21043. el = el.closest('.commands_list_div');
  21044. }
  21045. }
  21046. console.log('soltou no: ');
  21047. console.log(el);
  21048. console.log(el.data('fun')); // Primeiro verificar se ele soltou no espaço da função correta:
  21049. var hier = el.parentsUntil(".all_functions");
  21050. var esta_correto = false;
  21051. var esta_na_div_correta = false;
  21052. if (el.hasClass("commands_list_div")) {
  21053. esta_na_div_correta = true;
  21054. }
  21055. for (var i = 0; i < hier.length; i++) {
  21056. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21057. if (temp.hasClass("commands_list_div")) {
  21058. esta_na_div_correta = true;
  21059. }
  21060. if (temp.data('fun') == function_obj) {
  21061. esta_correto = true;
  21062. break;
  21063. }
  21064. }
  21065. if (!esta_correto) {
  21066. has_element_created_draged = false;
  21067. which_element_is_draged = null;
  21068. dragTrash(event);
  21069. return;
  21070. } else {
  21071. if (!esta_na_div_correta) {
  21072. has_element_created_draged = false;
  21073. which_element_is_draged = null;
  21074. dragTrash(event);
  21075. return;
  21076. }
  21077. } // Agora é descobrir qual o escopo para adicionar o comando:
  21078. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  21079. if (typeof el.data('fun') !== 'undefined') {
  21080. // Se a lista de comandos estiver vazia, então é o primeiro.
  21081. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  21082. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  21083. // pode adicionar
  21084. el.data('fun').commands = [];
  21085. var new_cmd = genericCreateCommand(command_type);
  21086. el.data('fun').commands.push(new_cmd);
  21087. renderCommand(new_cmd, jquery__WEBPACK_IMPORTED_MODULE_0___default()(function_container).find('.commands_list_div'), 3, function_obj);
  21088. } else {
  21089. // Entra nesse else, caso já existam outros comandos no bloco:
  21090. findNearbyCommandToAddInFunctionScope(el, event, jquery__WEBPACK_IMPORTED_MODULE_0___default()(function_container).find('.commands_list_div'), function_obj, command_type);
  21091. }
  21092. } else {
  21093. console.log("soltou em um comando"); // descobrir em qual comando ele soltou:
  21094. var hier_find = el.parentsUntil(".commands_list_div");
  21095. var hierarquia_bottom_up = [];
  21096. if (typeof el.data('command') !== 'undefined') {
  21097. hierarquia_bottom_up.push(el.data('command'));
  21098. }
  21099. for (var i = 0; i < hier_find.length; i++) {
  21100. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21101. hierarquia_bottom_up.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command'));
  21102. }
  21103. }
  21104. console.log("comando em que soltou: ");
  21105. console.log(hierarquia_bottom_up[0]);
  21106. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  21107. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  21108. console.log(hierarquia_bottom_up[i]);
  21109. } // Se for do tipo break, verificar se está no contexto correto:
  21110. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  21111. var is_correct_context = false;
  21112. if (command_type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break) {
  21113. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  21114. if (hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21115. is_correct_context = true;
  21116. break;
  21117. }
  21118. }
  21119. if (!is_correct_context) {
  21120. console.error("Context not allowed to insert BREAK COMMAND!");
  21121. return;
  21122. }
  21123. } // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  21124. if (hierarquia_bottom_up.length == 1) {
  21125. console.log('QQ1');
  21126. var sub_elemento = false;
  21127. for (var i = 0; i < hier_find.length; i++) {
  21128. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21129. console.log('QQ2');
  21130. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  21131. sub_elemento = true;
  21132. break;
  21133. }
  21134. }
  21135. if (!sub_elemento) {
  21136. console.log('QQ3');
  21137. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  21138. }
  21139. } else {
  21140. console.log('QQ4'); // caso exista mais de um elemento na hierarquia:
  21141. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command') !== 'undefined') {
  21142. console.log('QQ5');
  21143. console.log("PPP1");
  21144. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  21145. } else {
  21146. console.log('QQ6');
  21147. var sub_elemento = false;
  21148. for (var i = 0; i < hier_find.length; i++) {
  21149. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21150. console.log('QQ7');
  21151. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  21152. sub_elemento = true;
  21153. break;
  21154. }
  21155. }
  21156. }
  21157. }
  21158. }
  21159. has_element_created_draged = false;
  21160. which_element_is_draged = null;
  21161. renderAlgorithm();
  21162. }
  21163. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  21164. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21165. var command_parent = el_jq.data('command');
  21166. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21167. console.log('QQ17');
  21168. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  21169. console.log('QQ18'); // Se não tiver outro comando ainda no bloco, só adiciona:
  21170. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21171. command_parent.commands_block = [];
  21172. var recentComand = genericCreateCommand(command_type);
  21173. command_parent.commands_block.push(recentComand);
  21174. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  21175. } else {
  21176. // Se já tem algum comando no bloco:
  21177. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  21178. }
  21179. } else {
  21180. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  21181. addCommandToSwitchCase(event, function_obj, command_type);
  21182. }
  21183. } else {
  21184. console.log('QQ19'); // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  21185. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  21186. }
  21187. }
  21188. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  21189. var all_sub = jquery__WEBPACK_IMPORTED_MODULE_0___default()(node_list_commands).find('div.command_container');
  21190. var menor_distancia = 999999999;
  21191. var elemento_menor_distancia = null;
  21192. var antes = true;
  21193. var t_bot;
  21194. var t_top; // Descobrindo o elemento mais próximo:
  21195. for (var i = 0; i < all_sub.length; i++) {
  21196. t_top = all_sub[i].getBoundingClientRect().top;
  21197. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21198. if (t_top - event.clientY < menor_distancia) {
  21199. menor_distancia = event.clientY - t_top;
  21200. elemento_menor_distancia = all_sub[i];
  21201. }
  21202. }
  21203. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21204. if (borda_inferior - event.clientY < menor_distancia) {
  21205. var recentComand = genericCreateCommand(command_type);
  21206. command_parent.commands_block.push(recentComand); //
  21207. renderCommand(recentComand, node_list_commands, 3, function_obj);
  21208. } else {
  21209. var recentComand = genericCreateCommand(command_type);
  21210. var index = command_parent.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21211. if (index > -1) {
  21212. command_parent.commands_block.splice(index, 0, recentComand);
  21213. }
  21214. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21215. }
  21216. }
  21217. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  21218. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21219. var command_parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.parentNode.parentNode).data('command');
  21220. var command_target = el_jq.data('command');
  21221. var temp_parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.parentNode.parentNode);
  21222. var is_in_else = false;
  21223. if (!command_parent) {
  21224. command_parent = el_jq.data('command');
  21225. temp_parent = el_jq;
  21226. var hier = el_jq.parentsUntil(".command_container");
  21227. for (var i = 0; i < hier.length; i++) {
  21228. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21229. if (typeof temp.data('else') != 'undefined') {
  21230. is_in_else = true;
  21231. }
  21232. if (typeof temp.data('command') != 'undefined') {
  21233. command_parent = temp.data('command');
  21234. temp_parent = temp;
  21235. }
  21236. }
  21237. }
  21238. var hier = el_jq.parentsUntil(".command_container");
  21239. for (var i = 0; i < hier.length; i++) {
  21240. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21241. if (typeof temp.data('else') != 'undefined') {
  21242. is_in_else = true;
  21243. }
  21244. }
  21245. if (command_parent == command_target) {
  21246. var hier = el_jq.parentsUntil(".command_container");
  21247. for (var i = 0; i < hier.length; i++) {
  21248. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21249. if (typeof temp.data('else') !== 'undefined') {
  21250. is_in_else = true;
  21251. break;
  21252. }
  21253. }
  21254. }
  21255. if (command_parent.type != _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue && command_parent.type != _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21256. var hier = temp_parent.parentsUntil(".all_cases_div");
  21257. console.log("vou procurar!!");
  21258. for (var i = 0; i < hier.length; i++) {
  21259. console.log("estou vasculhando...");
  21260. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21261. if (typeof temp.data('switchcase') !== 'undefined') {
  21262. console.log("encontrei");
  21263. command_parent = temp.data('switchcase');
  21264. is_in_else = false;
  21265. break;
  21266. }
  21267. }
  21268. }
  21269. console.log('debugging:');
  21270. console.log('el_jq');
  21271. console.log(el_jq);
  21272. console.log('command_parent');
  21273. console.log(command_parent);
  21274. console.log('command_target');
  21275. console.log(command_target);
  21276. var menor_distancia = 999999999;
  21277. var antes = true;
  21278. var t_bot;
  21279. var t_top;
  21280. t_top = el.getBoundingClientRect().top;
  21281. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  21282. var d_top = event.clientY - t_top; // distancia topo
  21283. var d_bot = t_bot - event.clientY; // distancia baixo
  21284. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21285. if (d_top < d_bot) {
  21286. var recentComand = genericCreateCommand(command_type);
  21287. console.log('MMM1');
  21288. if (is_in_else) {
  21289. console.log('MMM2');
  21290. if (command_parent == command_target) {
  21291. console.log('MMM3');
  21292. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21293. command_parent.commands_else = [];
  21294. var recentComand = genericCreateCommand(command_type);
  21295. command_parent.commands_else.push(recentComand);
  21296. renderCommand(recentComand, el_jq, 3, function_obj);
  21297. } else {
  21298. // Se já tem algum comando no bloco:
  21299. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  21300. }
  21301. return;
  21302. }
  21303. console.log('MMM7');
  21304. var index = command_parent.commands_else.indexOf(command_target);
  21305. if (index > -1) {
  21306. command_parent.commands_else.splice(index, 0, recentComand);
  21307. }
  21308. renderCommand(recentComand, el, 1, function_obj);
  21309. } else {
  21310. console.log('MMM4');
  21311. if (command_parent == command_target) {
  21312. console.log('Nxxxx5');
  21313. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21314. command_parent.commands_block = [];
  21315. console.log('SSS4');
  21316. var recentComand = genericCreateCommand(command_type);
  21317. command_parent.commands_block.push(recentComand);
  21318. renderCommand(recentComand, el_jq, 3, function_obj);
  21319. } else {
  21320. console.log('SSS5');
  21321. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  21322. }
  21323. return;
  21324. }
  21325. console.log('MMM6');
  21326. var index = command_parent.commands_block.indexOf(command_target);
  21327. if (index > -1) {
  21328. command_parent.commands_block.splice(index, 0, recentComand);
  21329. }
  21330. renderCommand(recentComand, el, 1, function_obj);
  21331. }
  21332. } else {
  21333. console.log('XXX1');
  21334. var recentComand = genericCreateCommand(command_type);
  21335. if (is_in_else) {
  21336. if (command_parent == command_target) {
  21337. console.log('MMM3');
  21338. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21339. command_parent.commands_else = [];
  21340. console.log('SSS1');
  21341. var recentComand = genericCreateCommand(command_type);
  21342. command_parent.commands_else.push(recentComand);
  21343. renderCommand(recentComand, el_jq, 3, function_obj);
  21344. } else {
  21345. // Se já tem algum comando no bloco:
  21346. console.log('SSS2');
  21347. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  21348. }
  21349. return;
  21350. }
  21351. console.log('XXX2');
  21352. var index = command_parent.commands_else.indexOf(command_target);
  21353. if (index > -1) {
  21354. command_parent.commands_else.splice(index + 1, 0, recentComand);
  21355. }
  21356. renderCommand(recentComand, el, 2, function_obj);
  21357. } else {
  21358. if (command_parent == command_target) {
  21359. console.log('Nxxxx78');
  21360. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21361. command_parent.commands_block = [];
  21362. var recentComand = genericCreateCommand(command_type);
  21363. command_parent.commands_block.push(recentComand);
  21364. console.log('SSS6');
  21365. renderCommand(recentComand, el_jq, 3, function_obj);
  21366. } else {
  21367. console.log('SSS7');
  21368. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  21369. }
  21370. return;
  21371. }
  21372. console.log('XXX3');
  21373. var index = command_parent.commands_block.indexOf(command_target);
  21374. if (index > -1) {
  21375. command_parent.commands_block.splice(index + 1, 0, recentComand);
  21376. }
  21377. renderCommand(recentComand, el, 2, function_obj);
  21378. }
  21379. }
  21380. }
  21381. function insertCommandInBlock(el, event, function_obj, command_type) {
  21382. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21383. var command_parent = el_jq.data('command');
  21384. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  21385. // Se não tiver outro comando ainda no bloco, só adiciona:
  21386. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21387. command_parent.commands_block = [];
  21388. var recentComand = genericCreateCommand(command_type);
  21389. command_parent.commands_block.push(recentComand);
  21390. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  21391. } else {
  21392. // Se já tem algum comando no bloco:
  21393. findInBlockCorrectPlace(el, event, function_obj, command_type);
  21394. }
  21395. } else if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue) {
  21396. console.log('QQ9'); // no if ou no else?
  21397. var correct_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.pageX, event.pageY));
  21398. var is_in_if = true;
  21399. if (correct_div.data('if')) {
  21400. is_in_if = true;
  21401. } else if (correct_div.data('else')) {
  21402. is_in_if = false;
  21403. } else {
  21404. var hier = correct_div.parentsUntil(".command_container");
  21405. for (var i = 0; i < hier.length; i++) {
  21406. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21407. if (typeof temp.data('if') !== 'undefined') {
  21408. is_in_if = true;
  21409. break;
  21410. }
  21411. if (typeof temp.data('else') !== 'undefined') {
  21412. is_in_if = false;
  21413. break;
  21414. }
  21415. }
  21416. }
  21417. if (is_in_if) {
  21418. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21419. command_parent.commands_block = [];
  21420. var recentComand = genericCreateCommand(command_type);
  21421. command_parent.commands_block.push(recentComand);
  21422. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  21423. } else {
  21424. // Se já tem algum comando no bloco:
  21425. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  21426. }
  21427. } else {
  21428. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21429. command_parent.commands_else = [];
  21430. var recentComand = genericCreateCommand(command_type);
  21431. command_parent.commands_else.push(recentComand);
  21432. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  21433. } else {
  21434. // Se já tem algum comando no bloco:
  21435. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  21436. }
  21437. }
  21438. } else {
  21439. // é do tipo switch
  21440. console.log("está tentando inserir em um switch que está na raiz!");
  21441. addCommandToSwitchCase(event, function_obj, command_type);
  21442. }
  21443. }
  21444. function addCommandToSwitchCase(event, function_obj, command_type) {
  21445. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  21446. var which_case = el.data('switchcase');
  21447. var case_div = el;
  21448. if (!which_case) {
  21449. var hier_find = el.parentsUntil(".all_cases_div");
  21450. for (var i = 0; i < hier_find.length; i++) {
  21451. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('switchcase') !== 'undefined') {
  21452. which_case = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('switchcase');
  21453. case_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]);
  21454. break;
  21455. }
  21456. }
  21457. }
  21458. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  21459. which_case.commands_block = [];
  21460. var recentComand = genericCreateCommand(command_type);
  21461. which_case.commands_block.push(recentComand);
  21462. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  21463. } else {
  21464. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  21465. }
  21466. }
  21467. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  21468. var all_sub = case_div.find('div.command_container');
  21469. var menor_distancia = 999999999;
  21470. var elemento_menor_distancia = null;
  21471. var antes = true;
  21472. var t_bot;
  21473. var t_top; // Descobrindo o elemento mais próximo:
  21474. for (var i = 0; i < all_sub.length; i++) {
  21475. t_top = all_sub[i].getBoundingClientRect().top;
  21476. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21477. if (t_top - event.clientY < menor_distancia) {
  21478. menor_distancia = event.clientY - t_top;
  21479. elemento_menor_distancia = all_sub[i];
  21480. }
  21481. }
  21482. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21483. if (borda_inferior - event.clientY < menor_distancia) {
  21484. var recentComand = genericCreateCommand(command_type);
  21485. which_case.commands_block.push(recentComand);
  21486. renderCommand(recentComand, jquery__WEBPACK_IMPORTED_MODULE_0___default()(case_div.find('.case_commands_block')[0]), 3, function_obj);
  21487. } else {
  21488. var recentComand = genericCreateCommand(command_type);
  21489. var index = which_case.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21490. if (index > -1) {
  21491. which_case.commands_block.splice(index, 0, recentComand);
  21492. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21493. }
  21494. }
  21495. }
  21496. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  21497. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21498. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21499. var all_sub = el_jq.find('div.command_container');
  21500. var menor_distancia = 999999999;
  21501. var elemento_menor_distancia = null;
  21502. var antes = true;
  21503. var t_bot;
  21504. var t_top; // Descobrindo o elemento mais próximo:
  21505. for (var i = 0; i < all_sub.length; i++) {
  21506. t_top = all_sub[i].getBoundingClientRect().top;
  21507. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21508. if (t_top - event.clientY < menor_distancia) {
  21509. menor_distancia = event.clientY - t_top;
  21510. elemento_menor_distancia = all_sub[i];
  21511. }
  21512. }
  21513. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  21514. console.log("menor_distancia: ");
  21515. console.log(elemento_menor_distancia); // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21516. if (borda_inferior - event.clientY < menor_distancia) {
  21517. console.log('QQ11');
  21518. var recentComand = genericCreateCommand(command_type);
  21519. var command_parent = el_jq.data('command');
  21520. if (is_in_else) {
  21521. console.log('QQ15');
  21522. command_parent.commands_else.push(recentComand);
  21523. console.log('el_jq');
  21524. console.log(el_jq);
  21525. console.log("$(el_jq.find('.commands_else')[0]):: ");
  21526. console.log(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el_jq.find('.commands_else')[0]));
  21527. renderCommand(recentComand, el_jq, 3, function_obj);
  21528. } else {
  21529. console.log('QQ16');
  21530. command_parent.commands_block.push(recentComand);
  21531. renderCommand(recentComand, jquery__WEBPACK_IMPORTED_MODULE_0___default()(el_jq.find('.block_commands')[0]), 3, function_obj);
  21532. }
  21533. } else {
  21534. console.log('QQ12');
  21535. var recentComand = genericCreateCommand(command_type);
  21536. var command_parent = el_jq.data('command');
  21537. if (is_in_else) {
  21538. var index = command_parent.commands_else.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21539. if (index > -1) {
  21540. command_parent.commands_else.splice(index, 0, recentComand);
  21541. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21542. }
  21543. } else {
  21544. var index = command_parent.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21545. if (index > -1) {
  21546. command_parent.commands_block.splice(index, 0, recentComand);
  21547. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21548. }
  21549. }
  21550. }
  21551. }
  21552. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  21553. switch (jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command').type) {
  21554. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  21555. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  21556. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  21557. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  21558. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  21559. insertCommandInBlock(el, event, function_obj, command_type);
  21560. return;
  21561. }
  21562. var menor_distancia = 999999999;
  21563. var antes = true;
  21564. var t_bot;
  21565. var t_top;
  21566. t_top = el.getBoundingClientRect().top;
  21567. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  21568. var d_top = event.clientY - t_top; // distancia topo
  21569. var d_bot = t_bot - event.clientY; // distancia baixo
  21570. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21571. if (d_top < d_bot) {
  21572. var recentComand = genericCreateCommand(command_type);
  21573. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command'));
  21574. if (index > -1) {
  21575. function_obj.commands.splice(index, 0, recentComand);
  21576. }
  21577. renderCommand(recentComand, el, 1, function_obj);
  21578. } else {
  21579. var recentComand = genericCreateCommand(command_type);
  21580. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command'));
  21581. if (index > -1) {
  21582. function_obj.commands.splice(index + 1, 0, recentComand);
  21583. }
  21584. renderCommand(recentComand, el, 2, function_obj);
  21585. }
  21586. }
  21587. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  21588. var all_sub = jquery__WEBPACK_IMPORTED_MODULE_0___default()(node_list_commands).find('div.command_container');
  21589. var menor_distancia = 999999999;
  21590. var elemento_menor_distancia = null;
  21591. var antes = true;
  21592. var t_bot;
  21593. var t_top; // Descobrindo o elemento mais próximo:
  21594. for (var i = 0; i < all_sub.length; i++) {
  21595. t_top = all_sub[i].getBoundingClientRect().top;
  21596. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21597. if (t_top - event.clientY < menor_distancia) {
  21598. menor_distancia = event.clientY - t_top;
  21599. elemento_menor_distancia = all_sub[i];
  21600. }
  21601. }
  21602. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21603. if (borda_inferior - event.clientY < menor_distancia) {
  21604. var recentComand = genericCreateCommand(command_type);
  21605. function_obj.commands.push(recentComand); //
  21606. renderCommand(recentComand, node_list_commands, 3, function_obj);
  21607. } else {
  21608. var recentComand = genericCreateCommand(command_type);
  21609. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21610. if (index > -1) {
  21611. function_obj.commands.splice(index, 0, recentComand);
  21612. }
  21613. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21614. }
  21615. }
  21616. /***/ }),
  21617. /***/ "./js/visualUI/commands/attribution.js":
  21618. /*!*********************************************!*\
  21619. !*** ./js/visualUI/commands/attribution.js ***!
  21620. \*********************************************/
  21621. /*! exports provided: createFloatingCommand, renderCommand, manageExpressionElements, renderMenuOperations */
  21622. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21623. "use strict";
  21624. __webpack_require__.r(__webpack_exports__);
  21625. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  21626. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  21627. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageExpressionElements", function() { return manageExpressionElements; });
  21628. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenuOperations", function() { return renderMenuOperations; });
  21629. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21630. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  21631. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  21632. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21633. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21634. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  21635. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  21636. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  21637. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  21638. function createFloatingCommand() {
  21639. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  21640. }
  21641. function renderCommand(command, function_obj) {
  21642. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui attribution command_container"><i class="ui icon small arrow left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_attributed"></div> <span class="text_attr_receives span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> </div>');
  21643. el.data('command', command);
  21644. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable, el.find('.var_attributed'), function_obj);
  21645. if (!command.expression || command.expression.length < 1) {
  21646. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21647. command.expression.push(exp);
  21648. }
  21649. addHandlers(command, function_obj, el);
  21650. renderExpressionElements(command, function_obj, el);
  21651. return el;
  21652. }
  21653. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  21654. var index_to_move = expression_element.itens.indexOf(ref_object);
  21655. switch (selectedItem.data('exp')) {
  21656. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21657. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [expression_element.itens[index_to_move], _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21658. expression_element.itens[index_to_move] = exp;
  21659. break;
  21660. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21661. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, expression_element.itens[index_to_move]]);
  21662. expression_element.itens[index_to_move] = exp;
  21663. break;
  21664. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21665. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par, [expression_element.itens[index_to_move]]);
  21666. expression_element.itens[index_to_move] = exp;
  21667. break;
  21668. }
  21669. renderExpressionElements(command, function_obj, dom_object);
  21670. }
  21671. function renderExpressionElements(command, function_obj, el) {
  21672. var expression_div = el.find('.expression_elements');
  21673. var command_container;
  21674. if (el.hasClass("command_container") == false) {
  21675. var hier = el.parentsUntil(".command_container");
  21676. for (var i = 0; i < hier.length; i++) {
  21677. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("command_container")) {
  21678. command_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21679. break;
  21680. }
  21681. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("expression_elements")) {
  21682. expression_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21683. break;
  21684. }
  21685. }
  21686. }
  21687. if (command_container) {
  21688. expression_div = command_container.find('.expression_elements');
  21689. }
  21690. expression_div.text('');
  21691. for (var i = 0; i < command.expression.length; i++) {
  21692. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  21693. temp.data('ref_element', command.expression[i]);
  21694. temp.data('ref_index', i);
  21695. expression_div.append(temp);
  21696. renderElement(command, function_obj, temp, command.expression[i]);
  21697. }
  21698. }
  21699. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  21700. var context_menu = '<div class="ui dropdown"><div class="text">';
  21701. switch (expression_element.itens[index_op]) {
  21702. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  21703. context_menu += '+';
  21704. break;
  21705. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  21706. context_menu += '-';
  21707. break;
  21708. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  21709. context_menu += '*';
  21710. break;
  21711. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  21712. context_menu += '/';
  21713. break;
  21714. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  21715. context_menu += '%';
  21716. break;
  21717. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none:
  21718. context_menu += '...';
  21719. break;
  21720. }
  21721. context_menu += '</div><div class="menu">';
  21722. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus + '">+</div>';
  21723. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus + '">-</div>';
  21724. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication + '">*</div>';
  21725. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division + '">/</div>';
  21726. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module + '">%</div>';
  21727. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none + '" data-text="...">Nenhum</div>';
  21728. context_menu += '</div></div>';
  21729. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21730. temp_op.append(context_menu);
  21731. context_menu.dropdown({
  21732. onChange: function onChange(value, text, $selectedItem) {
  21733. expression_element.itens[index_op] = value;
  21734. }
  21735. });
  21736. }
  21737. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  21738. if (el.hasClass("command_container") == false) {
  21739. var hier = el.parentsUntil(".commands_list_div");
  21740. for (var i = 0; i < hier.length; i++) {
  21741. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("command_container")) {
  21742. el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21743. break;
  21744. }
  21745. }
  21746. }
  21747. if (dom_append_menu.hasClass("expression_elements") == false) {
  21748. var hier = el.parentsUntil(".commands_list_div");
  21749. for (var i = 0; i < hier.length; i++) {
  21750. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("expression_elements")) {
  21751. dom_append_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21752. break;
  21753. }
  21754. }
  21755. }
  21756. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  21757. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  21758. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  21759. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  21760. context_menu += '</div></div>';
  21761. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21762. dom_append_menu.append(context_menu);
  21763. context_menu.dropdown({
  21764. onChange: function onChange(value, text, $selectedItem) {
  21765. switch (value) {
  21766. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21767. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21768. expression_append_new_expression.push(exp);
  21769. break;
  21770. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21771. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21772. expression_append_new_expression.push(exp);
  21773. break;
  21774. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21775. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21776. expression_append_new_expression.push(exp);
  21777. break;
  21778. }
  21779. renderExpressionElements(command, function_obj, el);
  21780. }
  21781. });
  21782. }
  21783. function renderElement(command, function_obj, el, expression_element) {
  21784. switch (expression_element.type_exp) {
  21785. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21786. var temp_op = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21787. var temp_exp_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21788. var temp_exp_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21789. el.append(temp_exp_1);
  21790. el.append(temp_op);
  21791. el.append(temp_exp_2);
  21792. if (expression_element.itens[0].type) {
  21793. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  21794. } else {
  21795. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  21796. }
  21797. renderOperator(command, function_obj, temp_op, expression_element, 1);
  21798. if (expression_element.itens[2].type) {
  21799. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  21800. } else {
  21801. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  21802. }
  21803. break;
  21804. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21805. var temp_op = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21806. var temp_exp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21807. el.append(temp_op);
  21808. el.append(temp_exp);
  21809. renderOperator(command, function_obj, temp_op, expression_element, 0);
  21810. if (expression_element.itens[1].type) {
  21811. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  21812. } else {
  21813. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  21814. }
  21815. break;
  21816. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21817. var temp_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"> ( </div>');
  21818. var temp_exp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21819. var temp_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"> ) </div>');
  21820. el.append(temp_par_1);
  21821. el.append(temp_exp);
  21822. for (var j = 0; j < expression_element.itens.length; j++) {
  21823. if (expression_element.itens[j].type) {
  21824. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  21825. } else {
  21826. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  21827. }
  21828. } //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  21829. el.append(temp_par_2);
  21830. break;
  21831. }
  21832. }
  21833. function renderExpression(command, function_obj, el) {
  21834. var expression_div = el.find('.expression_elements');
  21835. expression_div.text('');
  21836. var menu_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="menu_add_item"></div>');
  21837. menu_add_item.data('index_add', 0);
  21838. expression_div.append(menu_add_item);
  21839. for (var i = 0; i < command.expression.length; i++) {
  21840. if (command.expression[i].type) {
  21841. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  21842. temp.data('ref_element', command.expression[i]);
  21843. temp.data('ref_index', i);
  21844. expression_div.append(temp);
  21845. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.expression[i], temp, function_obj);
  21846. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  21847. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element">' + command.expression[i] + '</div>');
  21848. temp.data('ref_element', command.expression[i]);
  21849. temp.data('ref_index', i);
  21850. expression_div.append(temp);
  21851. } else {
  21852. var temp = '<div class="expression_element">';
  21853. switch (command.expression[i]) {
  21854. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  21855. temp += '+';
  21856. break;
  21857. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  21858. temp += '-';
  21859. break;
  21860. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  21861. temp += '*';
  21862. break;
  21863. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  21864. temp += '/';
  21865. break;
  21866. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  21867. temp += '%';
  21868. break;
  21869. }
  21870. temp += '</div>';
  21871. temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(temp);
  21872. temp.data('ref_element', command.expression[i]);
  21873. temp.data('ref_index', i);
  21874. expression_div.append(temp);
  21875. }
  21876. var menu_add_item_seq = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="menu_add_item"></div>');
  21877. var index_temp = i + 1;
  21878. menu_add_item_seq.data('index_add', index_temp);
  21879. expression_div.append(menu_add_item_seq);
  21880. }
  21881. addMenuItens(command, function_obj, el);
  21882. }
  21883. function addMenuItens(command, function_obj, expression_div) {
  21884. var divs_expression = expression_div.find('.menu_add_item');
  21885. for (var i = 0; i < divs_expression.length; i++) {
  21886. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(divs_expression[i]).data('index_add');
  21887. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  21888. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_value') + '</div>';
  21889. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_operator') + '</div>';
  21890. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_parentheses') + '</div>';
  21891. context_menu += '</div></div>';
  21892. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21893. jquery__WEBPACK_IMPORTED_MODULE_0___default()(divs_expression[i]).append(context_menu);
  21894. context_menu.dropdown({
  21895. on: 'hover',
  21896. onChange: function onChange(value, text, $selectedItem) {
  21897. switch ($selectedItem.data('option')) {
  21898. case "value":
  21899. command.expression.splice($selectedItem.data('index'), 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21900. renderExpression(command, function_obj, expression_div);
  21901. break;
  21902. case "operator":
  21903. command.expression.splice($selectedItem.data('index'), 0, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus);
  21904. renderExpression(command, function_obj, expression_div);
  21905. break;
  21906. case "parentheses":
  21907. command.expression.splice($selectedItem.data('index'), 0, "(");
  21908. command.expression.splice($selectedItem.data('index') + 1, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21909. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  21910. renderExpression(command, function_obj, expression_div);
  21911. break;
  21912. }
  21913. }
  21914. });
  21915. }
  21916. }
  21917. function addHandlers(command, function_obj, attribution_dom) {
  21918. attribution_dom.find('.button_remove_command').on('click', function () {
  21919. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, attribution_dom)) {
  21920. attribution_dom.fadeOut(400, function () {
  21921. attribution_dom.remove();
  21922. });
  21923. }
  21924. });
  21925. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  21926. renderExpressionElements(command, function_obj, attribution_dom);
  21927. });
  21928. }
  21929. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  21930. /*console.log("recebido o seguinte DOM: ");
  21931. console.log(dom_object);
  21932. if (dom_object.hasClass('var_attributed')) {
  21933. return;
  21934. } else {
  21935. var hier = dom_object.parentsUntil(".command_container");
  21936. for (var i = 0; i < hier.length; i++) {
  21937. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  21938. return;
  21939. }
  21940. }
  21941. }
  21942. dom_object.find('.context_menu_clear').remove();
  21943. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  21944. for (var tm in Models.ARITHMETIC_TYPES) {
  21945. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  21946. }
  21947. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  21948. menu_operations += '</div></div>';
  21949. menu_operations = $(menu_operations);
  21950. dom_object.append(menu_operations);
  21951. menu_operations.dropdown({
  21952. onChange: function(value, text, $selectedItem) {
  21953. switch ($($selectedItem).data('option')) {
  21954. case "clear":
  21955. $(dom_object).text('');
  21956. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  21957. break;
  21958. default:
  21959. createExpressionAround(command, ref_object, dom_object, function_obj);
  21960. menu_operations.find('.text').text('');
  21961. }
  21962. }
  21963. });*/
  21964. }
  21965. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  21966. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span> ( </span>').insertBefore(dom_object);
  21967. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span> ) </span>').insertAfter(dom_object);
  21968. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), dom_object, function_obj);
  21969. }
  21970. /***/ }),
  21971. /***/ "./js/visualUI/commands/break.js":
  21972. /*!***************************************!*\
  21973. !*** ./js/visualUI/commands/break.js ***!
  21974. \***************************************/
  21975. /*! exports provided: createFloatingCommand, renderCommand */
  21976. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21977. "use strict";
  21978. __webpack_require__.r(__webpack_exports__);
  21979. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  21980. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  21981. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21982. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  21983. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  21984. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21985. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21986. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  21987. function createFloatingCommand() {
  21988. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break') + ' </span></div>');
  21989. }
  21990. function renderCommand(command, function_obj) {
  21991. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <span>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break') + '</span> </div>');
  21992. el.data('command', command);
  21993. addHandlers(command, function_obj, el);
  21994. return el;
  21995. }
  21996. function addHandlers(command, function_obj, break_dom) {
  21997. break_dom.find('.button_remove_command').on('click', function () {
  21998. if (_commands__WEBPACK_IMPORTED_MODULE_4__["removeCommand"](command, function_obj, break_dom)) {
  21999. break_dom.fadeOut(400, function () {
  22000. break_dom.remove();
  22001. });
  22002. }
  22003. });
  22004. }
  22005. /***/ }),
  22006. /***/ "./js/visualUI/commands/comment.js":
  22007. /*!*****************************************!*\
  22008. !*** ./js/visualUI/commands/comment.js ***!
  22009. \*****************************************/
  22010. /*! exports provided: createFloatingCommand, renderCommand */
  22011. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22012. "use strict";
  22013. __webpack_require__.r(__webpack_exports__);
  22014. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22015. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22016. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22017. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22018. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22019. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22020. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22021. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22022. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22023. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22024. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22025. function createFloatingCommand() {
  22026. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment') + ' </span></div>');
  22027. }
  22028. function renderCommand(command, function_obj) {
  22029. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment command_container"> <i class="ui icon small quote left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text">' + '</div> </div>');
  22030. el.data('command', command);
  22031. addHandlers(command, function_obj, el);
  22032. renderTextComment(command, function_obj, el);
  22033. return el;
  22034. }
  22035. function renderTextComment(command, function_obj, el) {
  22036. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  22037. }
  22038. function addHandlers(command, function_obj, comment_dom) {
  22039. comment_dom.find('.button_remove_command').on('click', function () {
  22040. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, comment_dom)) {
  22041. comment_dom.fadeOut(400, function () {
  22042. comment_dom.remove();
  22043. });
  22044. }
  22045. });
  22046. }
  22047. /***/ }),
  22048. /***/ "./js/visualUI/commands/conditional_expression.js":
  22049. /*!********************************************************!*\
  22050. !*** ./js/visualUI/commands/conditional_expression.js ***!
  22051. \********************************************************/
  22052. /*! exports provided: renderExpression */
  22053. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22054. "use strict";
  22055. __webpack_require__.r(__webpack_exports__);
  22056. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderExpression", function() { return renderExpression; });
  22057. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22058. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22059. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22060. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22061. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22062. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22063. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22064. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22065. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  22066. expression.dom_object = initial_el_to_render;
  22067. if (expression.expression == null || expression.expression.length < 1) {
  22068. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  22069. } else {
  22070. var main_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_elements"></div>');
  22071. switch (expression.expression.type) {
  22072. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  22073. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  22074. break;
  22075. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  22076. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  22077. break;
  22078. }
  22079. initial_el_to_render.append(main_div);
  22080. var restartMenu = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  22081. initial_el_to_render.append(restartMenu);
  22082. restartMenu.on('click', function (e) {
  22083. expression.expression = null;
  22084. initial_el_to_render.empty();
  22085. renderExpression(command, expression, function_obj, initial_el_to_render);
  22086. });
  22087. }
  22088. }
  22089. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  22090. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  22091. menu_operator.dropdown({
  22092. values: [{
  22093. name: '>',
  22094. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than,
  22095. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than
  22096. }, {
  22097. name: '<',
  22098. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than,
  22099. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than
  22100. }, {
  22101. name: '==',
  22102. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to,
  22103. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to
  22104. }, {
  22105. name: '!=',
  22106. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to,
  22107. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to
  22108. }, {
  22109. name: '>=',
  22110. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to,
  22111. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to
  22112. }, {
  22113. name: '<=',
  22114. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to,
  22115. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to
  22116. }],
  22117. onChange: function onChange(value, text, $selectedItem) {
  22118. expression_arithmetic.operator = value;
  22119. }
  22120. });
  22121. element_to_append.append(menu_operator);
  22122. }
  22123. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  22124. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  22125. menu_operator.dropdown({
  22126. values: [{
  22127. name: '==',
  22128. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to,
  22129. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to
  22130. }, {
  22131. name: '!=',
  22132. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to,
  22133. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to
  22134. }, {
  22135. name: '&&',
  22136. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and,
  22137. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and
  22138. }, {
  22139. name: '||',
  22140. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or,
  22141. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or
  22142. }],
  22143. onChange: function onChange(value, text, $selectedItem) {
  22144. if ($selectedItem) {
  22145. expression_logic.operator = value;
  22146. if (expression_logic.second_operand == null) {
  22147. expression_logic.second_operand = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  22148. initial_el_to_render.empty();
  22149. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  22150. }
  22151. }
  22152. }
  22153. });
  22154. element_to_append.append(menu_operator);
  22155. }
  22156. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  22157. var exp_el_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22158. var exp_el_expr_el_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22159. var exp_el_expr_operand = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22160. var exp_el_expr_el_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22161. var exp_el_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22162. if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22163. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  22164. } else if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22165. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  22166. } else {
  22167. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  22168. }
  22169. element_to_append.append(exp_el_par_1);
  22170. element_to_append.append(exp_el_expr_el_1);
  22171. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  22172. element_to_append.append(exp_el_expr_operand);
  22173. if (expression_logic.second_operand) {
  22174. if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22175. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  22176. } else if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22177. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  22178. } else {
  22179. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  22180. }
  22181. element_to_append.append(exp_el_expr_el_2);
  22182. }
  22183. element_to_append.append(exp_el_par_2);
  22184. }
  22185. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  22186. var exp_el_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22187. var exp_el_expr_el_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22188. var exp_el_expr_operand = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22189. var exp_el_expr_el_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22190. var exp_el_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22191. if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22192. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  22193. } else if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22194. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  22195. } else {
  22196. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  22197. }
  22198. if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22199. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  22200. } else if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22201. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  22202. } else {
  22203. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  22204. }
  22205. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  22206. element_to_append.append(exp_el_par_1);
  22207. element_to_append.append(exp_el_expr_el_1);
  22208. element_to_append.append(exp_el_expr_operand);
  22209. element_to_append.append(exp_el_expr_el_2);
  22210. element_to_append.append(exp_el_par_2);
  22211. }
  22212. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  22213. var start_menu = '';
  22214. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('expression_menu_select') + '</i></div><i class="dropdown icon"></i><div class="menu">';
  22215. start_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_logic_expression') + ' (EL == EL and EL)</div>';
  22216. start_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_arithmetic_expression') + ' (EA < EA)</div>';
  22217. start_menu += '</div></div>';
  22218. start_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(start_menu);
  22219. start_menu.dropdown({
  22220. onChange: function onChange(value, text, $selectedItem) {
  22221. switch ($selectedItem.data('exp')) {
  22222. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  22223. expression.expression = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LogicExpression"](false, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  22224. break;
  22225. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  22226. expression.expression = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ArithmeticExpression"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than);
  22227. break;
  22228. }
  22229. initial_el_to_render.html('');
  22230. renderExpression(command, expression, function_obj, initial_el_to_render);
  22231. },
  22232. selectOnKeydown: false
  22233. });
  22234. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  22235. initial_el_to_render.append(start_menu);
  22236. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  22237. }
  22238. /***/ }),
  22239. /***/ "./js/visualUI/commands/contextualized_menu.js":
  22240. /*!*****************************************************!*\
  22241. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  22242. \*****************************************************/
  22243. /*! exports provided: renderMenu */
  22244. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22245. "use strict";
  22246. __webpack_require__.r(__webpack_exports__);
  22247. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenu", function() { return renderMenu; });
  22248. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22249. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22250. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22251. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22252. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22253. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22254. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22255. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  22256. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  22257. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  22258. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  22259. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  22260. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_break') + ' </a>';
  22261. } else {
  22262. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_break') + ' </a>';
  22263. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switchcase + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_case') + ' </a>';
  22264. }
  22265. menu_div += '</div></div>';
  22266. menu_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_div);
  22267. dom_where_render.append(menu_div);
  22268. addHandlers(command, dom_where_render, function_obj, dom_command);
  22269. }
  22270. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  22271. dom_where_render.find('.menu_commands').dropdown({
  22272. on: 'hover'
  22273. });
  22274. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  22275. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  22276. if (command.commands_block == null || command.commands_block.length == 0) {
  22277. command.commands_block = [];
  22278. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_4__["genericCreateCommand"](jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'));
  22279. command.commands_block.push(new_cmd);
  22280. _commands__WEBPACK_IMPORTED_MODULE_4__["renderCommand"](new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  22281. } else {
  22282. _commands__WEBPACK_IMPORTED_MODULE_4__["createFloatingCommand"](function_obj, dom_command.find('.block_commands'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  22283. }
  22284. } else {
  22285. switch (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command')) {
  22286. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  22287. _commands__WEBPACK_IMPORTED_MODULE_4__["createFloatingCommand"](function_obj, dom_command.find('.block_commands'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  22288. break;
  22289. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switchcase:
  22290. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  22291. break;
  22292. }
  22293. }
  22294. });
  22295. }
  22296. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  22297. if (command.cases == null) {
  22298. command.cases = [];
  22299. }
  22300. var sc = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SwitchCase"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_5__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  22301. command.cases.push(sc);
  22302. _switch__WEBPACK_IMPORTED_MODULE_6__["renderCase"](sc, command, function_obj, dom_command.find('.all_cases_div'));
  22303. }
  22304. /***/ }),
  22305. /***/ "./js/visualUI/commands/dowhiletrue.js":
  22306. /*!*********************************************!*\
  22307. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  22308. \*********************************************/
  22309. /*! exports provided: createFloatingCommand, renderCommand */
  22310. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22311. "use strict";
  22312. __webpack_require__.r(__webpack_exports__);
  22313. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22314. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22315. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22316. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22317. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22318. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22319. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22320. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22321. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22322. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22323. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22324. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22325. function createFloatingCommand() {
  22326. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_do') + ' <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + '(x < 10) </span></div>');
  22327. }
  22328. function renderCommand(command, function_obj) {
  22329. var ret = '';
  22330. ret += '<div class="ui dowhiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_do') + ' </span>';
  22331. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  22332. ret += '</div>';
  22333. ret += ' <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  22334. ret += '</div>';
  22335. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22336. el.data('command', command);
  22337. el.find('.block_commands').data('command', command);
  22338. addHandlers(command, function_obj, el);
  22339. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22340. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  22341. if (command.commands_block) {
  22342. for (var j = 0; j < command.commands_block.length; j++) {
  22343. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  22344. }
  22345. }
  22346. return el;
  22347. }
  22348. function addHandlers(command, function_obj, dowhiletrue_dom) {
  22349. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  22350. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, dowhiletrue_dom)) {
  22351. dowhiletrue_dom.fadeOut(400, function () {
  22352. dowhiletrue_dom.remove();
  22353. });
  22354. }
  22355. });
  22356. }
  22357. /***/ }),
  22358. /***/ "./js/visualUI/commands/functioncall.js":
  22359. /*!**********************************************!*\
  22360. !*** ./js/visualUI/commands/functioncall.js ***!
  22361. \**********************************************/
  22362. /*! exports provided: createFloatingCommand, renderCommand */
  22363. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22364. "use strict";
  22365. __webpack_require__.r(__webpack_exports__);
  22366. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22367. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22368. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22369. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22370. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22371. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22372. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22373. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22374. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22375. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22376. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22377. function createFloatingCommand() {
  22378. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  22379. }
  22380. function renderCommand(command, function_obj) {
  22381. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui functioncall command_container"> <i class="hand point right icon command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> </div>');
  22382. el.data('command', command);
  22383. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  22384. addHandlers(command, function_obj, el);
  22385. return el;
  22386. }
  22387. function addHandlers(command, function_obj, functioncall_dom) {
  22388. functioncall_dom.find('.button_remove_command').on('click', function () {
  22389. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, functioncall_dom)) {
  22390. functioncall_dom.fadeOut(400, function () {
  22391. functioncall_dom.remove();
  22392. });
  22393. }
  22394. });
  22395. }
  22396. /***/ }),
  22397. /***/ "./js/visualUI/commands/iftrue.js":
  22398. /*!****************************************!*\
  22399. !*** ./js/visualUI/commands/iftrue.js ***!
  22400. \****************************************/
  22401. /*! exports provided: createFloatingCommand, renderCommand */
  22402. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22403. "use strict";
  22404. __webpack_require__.r(__webpack_exports__);
  22405. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22406. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22407. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22408. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22409. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22410. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22411. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22412. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22413. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22414. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22415. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22416. function createFloatingCommand() {
  22417. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  22418. }
  22419. function renderCommand(command, function_obj) {
  22420. var ret = '';
  22421. ret += '<div class="ui iftrue command_container"><div class="ui data_block_if" data-if="true"> <i class="ui icon small random command_drag"></i> <i class="ui icon times red button_remove_command"></i>';
  22422. ret += '<span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_if') + '</span>';
  22423. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  22424. ret += '<span> </span> ';
  22425. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  22426. ret += '</div></div>';
  22427. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_else') + ' </span>';
  22428. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  22429. ret += '</div>';
  22430. ret += '<span></span></div>';
  22431. ret += '</div>';
  22432. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22433. el.data('command', command);
  22434. el.find('.block_commands').data('command', command);
  22435. el.find('.data_block_if').data('command', command);
  22436. el.find('.data_block_else').data('command', command);
  22437. el.find('.commands_if').data('command', command);
  22438. addHandlers(command, function_obj, el);
  22439. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  22440. if (command.commands_block) {
  22441. for (var j = 0; j < command.commands_block.length; j++) {
  22442. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.commands_if')[0]), 3, function_obj);
  22443. }
  22444. }
  22445. if (command.commands_else) {
  22446. for (var j = 0; j < command.commands_else.length; j++) {
  22447. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_else[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.commands_else')[0]), 3, function_obj);
  22448. }
  22449. }
  22450. return el;
  22451. }
  22452. function addHandlers(command, function_obj, iftrue_dom) {
  22453. iftrue_dom.find('.button_remove_command').on('click', function () {
  22454. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, iftrue_dom)) {
  22455. iftrue_dom.fadeOut(400, function () {
  22456. iftrue_dom.remove();
  22457. });
  22458. }
  22459. });
  22460. }
  22461. /***/ }),
  22462. /***/ "./js/visualUI/commands/reader.js":
  22463. /*!****************************************!*\
  22464. !*** ./js/visualUI/commands/reader.js ***!
  22465. \****************************************/
  22466. /*! exports provided: createFloatingCommand, renderCommand */
  22467. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22468. "use strict";
  22469. __webpack_require__.r(__webpack_exports__);
  22470. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22471. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22472. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22473. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22474. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22475. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22476. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22477. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22478. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22479. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22480. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22481. function createFloatingCommand() {
  22482. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' var </span></div>');
  22483. }
  22484. function renderCommand(command, function_obj) {
  22485. var el = '<div class="ui reader command_container"> <i class="ui icon small download command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  22486. el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  22487. el.data('command', command);
  22488. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  22489. addHandlers(command, function_obj, el);
  22490. return el;
  22491. }
  22492. function addHandlers(command, function_obj, reader_dom) {
  22493. reader_dom.find('.button_remove_command').on('click', function () {
  22494. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, reader_dom)) {
  22495. reader_dom.fadeOut(400, function () {
  22496. reader_dom.remove();
  22497. });
  22498. }
  22499. });
  22500. }
  22501. /***/ }),
  22502. /***/ "./js/visualUI/commands/repeatNtimes.js":
  22503. /*!**********************************************!*\
  22504. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  22505. \**********************************************/
  22506. /*! exports provided: createFloatingCommand, renderCommand, manageExpressionElements, manageClearExpressionElements */
  22507. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22508. "use strict";
  22509. __webpack_require__.r(__webpack_exports__);
  22510. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22511. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22512. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageExpressionElements", function() { return manageExpressionElements; });
  22513. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageClearExpressionElements", function() { return manageClearExpressionElements; });
  22514. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22515. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22516. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22517. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22518. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22519. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22520. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22521. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22522. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22523. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22524. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22525. function createFloatingCommand() {
  22526. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> para (x = 0; x < 10; x ++) <br> </span></div>');
  22527. }
  22528. function renderCommand(command, function_obj) {
  22529. var ret = '<div class="ui repeatNtimes command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_for') + ' ( </span> <div class="ui attribution_expression"><div class="ui variable_attribution"></div> <span class="text_receives span_command_spec"></span> <div class="ui var_value_expression div_expression_st"></div> </div> <span class="span_command_spec separator_character">;</span> <div class="conditional_expression"></div> <span class="span_command_spec separator_character">;</span> <div class="ui incrementation_field"><div class="ui incrementation_variable"></div> <span class="text_inc_receives span_command_spec"></span> <div class="ui first_operand"></div><div class="ui operator"></div><div class="ui second_operand"></div></div> <span class="span_command_spec"> ) </span>';
  22530. ret += '<div class="ui block_commands">';
  22531. ret += '</div>';
  22532. ret += '<span> </span>';
  22533. ret += '</div>';
  22534. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22535. el.data('command', command);
  22536. el.find('.block_commands').data('command', command);
  22537. addHandlers(command, function_obj, el);
  22538. _contextualized_menu__WEBPACK_IMPORTED_MODULE_9__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22539. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  22540. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression2, function_obj, el.find('.conditional_expression'));
  22541. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  22542. if (command.expression1) {
  22543. el.find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22544. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression1, el.find('.var_value_expression'), function_obj);
  22545. }
  22546. if (command.expression3) {
  22547. el.find('.text_inc_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22548. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  22549. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  22550. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  22551. }
  22552. if (command.commands_block) {
  22553. for (var j = 0; j < command.commands_block.length; j++) {
  22554. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  22555. }
  22556. }
  22557. return el;
  22558. }
  22559. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  22560. if (dom_object.hasClass('variable_attribution')) {
  22561. if (!command.expression3) {
  22562. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [command.var_attribution, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, "1", null, null, true)]);
  22563. command.expression3 = exp;
  22564. command.var_incrementation = command.var_attribution;
  22565. var cond_exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ArithmeticExpression"](command.var_attribution, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than);
  22566. command.expression2.expression = cond_exp;
  22567. }
  22568. dom_object.parent().find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22569. command.expression1 = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, "0", null, null, true);
  22570. dom_object.parent().find('.var_value_expression').empty();
  22571. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  22572. renderAlgorithm();
  22573. }
  22574. if (dom_object.hasClass('incrementation_variable')) {
  22575. dom_object.parent().find('.text_inc_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  22576. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  22577. command.expression3 = exp;
  22578. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  22579. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  22580. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  22581. }
  22582. }
  22583. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  22584. if (dom_object.hasClass('variable_attribution')) {
  22585. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.text_receives').text('');
  22586. command.expression1 = null;
  22587. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.var_value_expression').empty();
  22588. }
  22589. if (dom_object.hasClass('incrementation_variable')) {
  22590. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.text_inc_receives').text('');
  22591. command.expression3 = null;
  22592. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.first_operand').empty();
  22593. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.operator').empty();
  22594. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.second_operand').empty();
  22595. }
  22596. }
  22597. function addHandlers(command, function_obj, repeatNtimes_dom) {
  22598. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  22599. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, repeatNtimes_dom)) {
  22600. repeatNtimes_dom.fadeOut(400, function () {
  22601. repeatNtimes_dom.remove();
  22602. });
  22603. }
  22604. });
  22605. }
  22606. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  22607. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div></div>');
  22608. menu_operator.dropdown({
  22609. values: [{
  22610. name: '+',
  22611. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus,
  22612. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus
  22613. }, {
  22614. name: '-',
  22615. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus,
  22616. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus
  22617. }, {
  22618. name: '*',
  22619. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication,
  22620. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication
  22621. }, {
  22622. name: '/',
  22623. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division,
  22624. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division
  22625. }, {
  22626. name: '%',
  22627. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module,
  22628. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module
  22629. }],
  22630. onChange: function onChange(value, text, $selectedItem) {
  22631. expression_element.itens[index_op] = value;
  22632. }
  22633. });
  22634. temp_op.append(menu_operator);
  22635. }
  22636. /***/ }),
  22637. /***/ "./js/visualUI/commands/return.js":
  22638. /*!****************************************!*\
  22639. !*** ./js/visualUI/commands/return.js ***!
  22640. \****************************************/
  22641. /*! exports provided: createFloatingCommand, renderCommand */
  22642. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22643. "use strict";
  22644. __webpack_require__.r(__webpack_exports__);
  22645. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22646. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22647. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22648. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22649. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22650. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22651. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22652. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22653. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22654. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22655. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22656. function createFloatingCommand() {
  22657. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return') + ' </span></div>');
  22658. }
  22659. function renderCommand(command, function_obj) {
  22660. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return') + ' </span> <div class="var_value_menu_div"></div></div>');
  22661. el.data('command', command);
  22662. addHandlers(command, function_obj, el);
  22663. if (function_obj.return_type != _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID) {
  22664. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  22665. } else {
  22666. el.find('.var_value_menu_div').remove();
  22667. command.variable_value_menu = null;
  22668. }
  22669. return el;
  22670. }
  22671. function addHandlers(command, function_obj, return_dom) {
  22672. return_dom.find('.button_remove_command').on('click', function () {
  22673. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, return_dom)) {
  22674. return_dom.fadeOut(400, function () {
  22675. return_dom.remove();
  22676. });
  22677. }
  22678. });
  22679. }
  22680. /***/ }),
  22681. /***/ "./js/visualUI/commands/switch.js":
  22682. /*!****************************************!*\
  22683. !*** ./js/visualUI/commands/switch.js ***!
  22684. \****************************************/
  22685. /*! exports provided: createFloatingCommand, renderCommand, renderCase */
  22686. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22687. "use strict";
  22688. __webpack_require__.r(__webpack_exports__);
  22689. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22690. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22691. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCase", function() { return renderCase; });
  22692. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22693. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22694. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22695. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22696. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22697. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22698. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22699. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22700. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22701. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22702. function createFloatingCommand() {
  22703. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( x ) { <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' 1: <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' 2: <br> } </span></div>');
  22704. }
  22705. function renderCommand(command, function_obj) {
  22706. var ret = '';
  22707. ret += '<div class="ui switch command_container"> <i class="ui icon small random command_drag" ></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( <div class="ui variable_to_switch"></div> ) <div class="ui all_cases_div"></div></span>';
  22708. ret += '</div>';
  22709. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22710. el.data('command', command);
  22711. addHandlers(command, function_obj, el);
  22712. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22713. _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__["renderMenu"](command, command.variable, el.find('.variable_to_switch'), function_obj);
  22714. if (command.cases) {
  22715. for (var i = 0; i < command.cases.length; i++) {
  22716. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  22717. }
  22718. }
  22719. return el;
  22720. }
  22721. function renderCase(switchcase, command, function_obj, el) {
  22722. var casediv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + '</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');
  22723. _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__["renderMenu"](command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  22724. casediv.data('switchcase', switchcase);
  22725. casediv.find('.case_commands_block').data('switchcase', switchcase);
  22726. el.append(casediv);
  22727. if (switchcase.commands_block) {
  22728. for (var j = 0; j < switchcase.commands_block.length; j++) {
  22729. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](switchcase.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(casediv.find('.case_commands_block')[0]), 3, function_obj);
  22730. }
  22731. }
  22732. casediv.find('.button_remove_command').on('click', function () {
  22733. for (var i = 0; i < command.cases.length; i++) {
  22734. if (switchcase == command.cases[i]) {
  22735. delete command.cases[i];
  22736. command.cases.splice(i, 1);
  22737. casediv.remove();
  22738. break;
  22739. }
  22740. }
  22741. });
  22742. }
  22743. function addHandlers(command, function_obj, switch_dom) {
  22744. switch_dom.find('.button_remove_command').on('click', function () {
  22745. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, switch_dom)) {
  22746. switch_dom.fadeOut(400, function () {
  22747. switch_dom.remove();
  22748. });
  22749. }
  22750. });
  22751. }
  22752. /***/ }),
  22753. /***/ "./js/visualUI/commands/variable_value_menu.js":
  22754. /*!*****************************************************!*\
  22755. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  22756. \*****************************************************/
  22757. /*! exports provided: VAR_OR_VALUE_TYPES, renderMenu */
  22758. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22759. "use strict";
  22760. __webpack_require__.r(__webpack_exports__);
  22761. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VAR_OR_VALUE_TYPES", function() { return VAR_OR_VALUE_TYPES; });
  22762. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenu", function() { return renderMenu; });
  22763. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22764. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22765. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22766. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22767. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22768. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22769. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22770. /* harmony import */ var _attribution__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  22771. /* harmony import */ var _writer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  22772. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  22773. var VAR_OR_VALUE_TYPES = Object.freeze({
  22774. only_variable: 1,
  22775. only_value: 2,
  22776. only_function: 3,
  22777. variable_and_function: 4,
  22778. variable_and_value_opt: 5,
  22779. value_and_function: 6,
  22780. all: 7
  22781. });
  22782. function renderMenu(command, ref_object, dom_object, function_obj) {
  22783. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  22784. var expression_element = arguments.length > 5 ? arguments[5] : undefined;
  22785. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  22786. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  22787. if (ref_object.function_called) {
  22788. if (ref_object.function_called.parameters_list) {
  22789. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  22790. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  22791. ref_object.parameters_list.pop();
  22792. } else {
  22793. ref_object.parameters_list.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true));
  22794. }
  22795. }
  22796. }
  22797. }
  22798. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  22799. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  22800. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  22801. menu_var_or_value += '</div>';
  22802. }
  22803. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  22804. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('variable');
  22805. menu_var_or_value += '<div class="menu menu_only_vars">';
  22806. menu_var_or_value += '</div></div>';
  22807. }
  22808. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  22809. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  22810. }
  22811. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_value_opt || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  22812. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_value') + '</div>';
  22813. }
  22814. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  22815. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  22816. menu_var_or_value += '</div>';
  22817. }
  22818. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.variable_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.value_and_function || ref_object.variable_and_value == VAR_OR_VALUE_TYPES.all) {
  22819. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_function');
  22820. menu_var_or_value += '<div class="menu menu_only_functions">';
  22821. menu_var_or_value += '</div></div>';
  22822. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  22823. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  22824. menu_var_or_value += '<div class="menu">';
  22825. menu_var_or_value += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  22826. menu_var_or_value += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  22827. menu_var_or_value += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  22828. menu_var_or_value += '</div></div>';
  22829. }
  22830. }
  22831. menu_var_or_value += '</div></div>';
  22832. menu_var_or_value = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_var_or_value);
  22833. dom_object.append(menu_var_or_value);
  22834. ref_object.dom_object = menu_var_or_value;
  22835. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  22836. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  22837. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  22838. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  22839. if (ref_object.content || ref_object.function_called) {
  22840. if (ref_object.content) {
  22841. // Verificar se a variável ainda existe:
  22842. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  22843. if (variable_fun) {
  22844. ref_object.content = variable_fun;
  22845. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  22846. } else {
  22847. if (ref_object.content && ref_object.content.type) {
  22848. ref_object.content = null;
  22849. appendSelectText(ref_object, menu_var_or_value);
  22850. } else {
  22851. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  22852. }
  22853. }
  22854. } else if (ref_object.function_called) {
  22855. // Verificar se a função ainda existe:
  22856. var ret_function = isFunctionInProgram(ref_object.function_called);
  22857. if (ret_function) {
  22858. ref_object.function_called = ret_function;
  22859. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  22860. } else {
  22861. ref_object.content = null;
  22862. ref_object.row = null;
  22863. ref_object.column = null;
  22864. delete ref_object.function_called;
  22865. delete ref_object.parameters_list;
  22866. appendSelectText(ref_object, menu_var_or_value);
  22867. }
  22868. }
  22869. } else {
  22870. appendSelectText(ref_object, menu_var_or_value);
  22871. }
  22872. }
  22873. function appendSelectText(ref_object, menu_var_or_value) {
  22874. switch (ref_object.variable_and_value) {
  22875. case VAR_OR_VALUE_TYPES.only_variable:
  22876. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_var') + '</i>');
  22877. break;
  22878. case VAR_OR_VALUE_TYPES.all:
  22879. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_all') + '</i>');
  22880. break;
  22881. case VAR_OR_VALUE_TYPES.variable_and_function:
  22882. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_all') + '</i>');
  22883. break;
  22884. case VAR_OR_VALUE_TYPES.only_function:
  22885. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_function') + '</i>');
  22886. break;
  22887. }
  22888. }
  22889. function isFunctionInProgram(function_called_obj) {
  22890. if (function_called_obj.name) {
  22891. if (window.program_obj.functions) {
  22892. for (var i = 0; i < window.program_obj.functions.length; i++) {
  22893. if (window.program_obj.functions[i] == function_called_obj) {
  22894. return window.program_obj.functions[i];
  22895. }
  22896. }
  22897. for (var i = 0; i < window.program_obj.functions.length; i++) {
  22898. if (window.program_obj.functions[i].name == function_called_obj.name) {
  22899. return window.program_obj.functions[i];
  22900. }
  22901. }
  22902. }
  22903. } else if (function_called_obj.identifier) {
  22904. for (var i = 0; i < window.system_functions.length; i++) {
  22905. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  22906. return window.system_functions[i];
  22907. }
  22908. }
  22909. }
  22910. return null;
  22911. }
  22912. function isVarInProgram(var_obj, function_obj) {
  22913. // Verify in locals:
  22914. if (function_obj.variables_list) {
  22915. for (var i = 0; i < function_obj.variables_list.length; i++) {
  22916. if (function_obj.variables_list[i] == var_obj) {
  22917. return function_obj.variables_list[i];
  22918. }
  22919. }
  22920. } // Verify in parameters:
  22921. if (function_obj.parameters_list) {
  22922. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  22923. if (function_obj.parameters_list[i] == var_obj) {
  22924. return function_obj.parameters_list[i];
  22925. }
  22926. }
  22927. } // Verify in globals:
  22928. if (window.program_obj.globals) {
  22929. for (var i = 0; i < window.program_obj.globals.length; i++) {
  22930. if (window.program_obj.globals[i] == var_obj) {
  22931. return window.program_obj.globals[i];
  22932. }
  22933. }
  22934. } // If not found, verify if the reference was lost
  22935. if (var_obj) {
  22936. if (function_obj.variables_list) {
  22937. for (var i = 0; i < function_obj.variables_list.length; i++) {
  22938. if (function_obj.variables_list[i].name == var_obj.name) {
  22939. return function_obj.variables_list[i];
  22940. }
  22941. }
  22942. }
  22943. if (function_obj.parameters_list) {
  22944. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  22945. if (function_obj.parameters_list[i].name == var_obj.name) {
  22946. return function_obj.parameters_list[i];
  22947. }
  22948. }
  22949. }
  22950. if (window.program_obj.globals) {
  22951. for (var i = 0; i < window.program_obj.globals.length; i++) {
  22952. if (window.program_obj.globals[i].name == var_obj.name) {
  22953. return window.program_obj.globals[i];
  22954. }
  22955. }
  22956. }
  22957. }
  22958. return null;
  22959. }
  22960. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  22961. if (ref_object.function_called) {
  22962. menu_var_or_value.remove();
  22963. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  22964. } else if (ref_object.content.type) {
  22965. menu_var_or_value.remove();
  22966. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  22967. } else {
  22968. menu_var_or_value.remove();
  22969. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  22970. }
  22971. }
  22972. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  22973. if (variable_obj.content || variable_obj.function_called) {
  22974. // Verificar se a variável ainda existe:
  22975. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  22976. if (var_fun) {
  22977. variable_obj.content = var_fun;
  22978. } else {
  22979. if (variable_obj.content && variable_obj.content.type) {
  22980. variable_obj.content = null;
  22981. appendSelectText(variable_obj, menu_var_or_value);
  22982. }
  22983. }
  22984. } else {
  22985. appendSelectText(variable_obj, menu_var_or_value);
  22986. }
  22987. if (variable_obj.content == null && variable_obj.function_called == null) {
  22988. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  22989. return;
  22990. }
  22991. var ret = '';
  22992. if (variable_obj.function_called) {
  22993. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  22994. menu_var_or_value.find('.text').text(' ');
  22995. dom_object.find('.menu_var_or_value_dom').remove();
  22996. var parameters_menu;
  22997. if (variable_obj.function_called.name) {
  22998. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  22999. } else {
  23000. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  23001. }
  23002. parameters_menu += '<span> ) </span></div>';
  23003. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23004. dom_object.append(parameters_menu);
  23005. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23006. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23007. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23008. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23009. context_menu += '<div class="menu">';
  23010. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23011. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23012. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23013. context_menu += '</div></div>';
  23014. }
  23015. context_menu += '</div></div>';
  23016. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23017. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23018. context_menu.dropdown({
  23019. onChange: function onChange(value, text, $selectedItem) {
  23020. console.log('S1');
  23021. if ($selectedItem.data('clear')) {
  23022. console.log('PP1');
  23023. dom_object.text('');
  23024. variable_obj.content = null;
  23025. variable_obj.row = null;
  23026. variable_obj.column = null;
  23027. delete variable_obj.function_called;
  23028. delete variable_obj.parameters_list;
  23029. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23030. }
  23031. if ($selectedItem.data('exp')) {
  23032. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23033. }
  23034. },
  23035. selectOnKeydown: false
  23036. });
  23037. } else {
  23038. menu_var_or_value.find('.text').text(' ');
  23039. dom_object.find('.menu_var_or_value_dom').remove();
  23040. var parameters_menu;
  23041. if (variable_obj.function_called.name) {
  23042. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  23043. } else {
  23044. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  23045. }
  23046. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  23047. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  23048. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  23049. parameters_menu += ' , ';
  23050. }
  23051. }
  23052. parameters_menu += '<span> ) </span></div>';
  23053. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23054. dom_object.append(parameters_menu);
  23055. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  23056. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  23057. }
  23058. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23059. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23060. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23061. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23062. context_menu += '<div class="menu">';
  23063. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23064. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23065. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23066. context_menu += '</div></div>';
  23067. }
  23068. context_menu += '</div></div>';
  23069. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23070. context_menu.insertAfter(parameters_menu);
  23071. context_menu.dropdown({
  23072. onChange: function onChange(value, text, $selectedItem) {
  23073. console.log('S2');
  23074. if ($selectedItem.data('clear')) {
  23075. console.log('PP2');
  23076. dom_object.text('');
  23077. variable_obj.content = null;
  23078. variable_obj.row = null;
  23079. variable_obj.column = null;
  23080. delete variable_obj.function_called;
  23081. delete variable_obj.parameters_list;
  23082. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23083. }
  23084. if ($selectedItem.data('exp')) {
  23085. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23086. }
  23087. },
  23088. selectOnKeydown: false
  23089. });
  23090. }
  23091. } else if (variable_obj.content.type) {
  23092. var variable_render = "";
  23093. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  23094. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23095. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23096. variable_render += '</div>';
  23097. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23098. dom_object.append(variable_render);
  23099. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23100. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23101. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23102. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23103. context_menu += '<div class="menu">';
  23104. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23105. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23106. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23107. context_menu += '</div></div>';
  23108. }
  23109. context_menu += '</div></div>';
  23110. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23111. variable_render.append(context_menu);
  23112. context_menu.dropdown({
  23113. onChange: function onChange(value, text, $selectedItem) {
  23114. console.log('S3');
  23115. if ($selectedItem.data('clear')) {
  23116. console.log('PP3');
  23117. dom_object.text('');
  23118. variable_obj.content = null;
  23119. variable_obj.row = null;
  23120. variable_obj.column = null;
  23121. delete variable_obj.function_called;
  23122. delete variable_obj.parameters_list;
  23123. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23124. }
  23125. if ($selectedItem.data('exp')) {
  23126. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23127. }
  23128. },
  23129. selectOnKeydown: false
  23130. });
  23131. if (!variable_obj.column) {
  23132. variable_obj.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23133. }
  23134. variableValueMenuCode(command, variable_obj.column, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  23135. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  23136. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23137. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  23138. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  23139. variable_render += '</div>';
  23140. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23141. dom_object.append(variable_render);
  23142. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23143. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23144. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23145. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23146. context_menu += '<div class="menu">';
  23147. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23148. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23149. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23150. context_menu += '</div></div>';
  23151. }
  23152. context_menu += '</div></div>';
  23153. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23154. variable_render.append(context_menu);
  23155. context_menu.dropdown({
  23156. onChange: function onChange(value, text, $selectedItem) {
  23157. console.log('S4');
  23158. if ($selectedItem.data('clear')) {
  23159. console.log('PP4');
  23160. dom_object.text('');
  23161. variable_obj.content = null;
  23162. variable_obj.row = null;
  23163. variable_obj.column = null;
  23164. delete variable_obj.function_called;
  23165. delete variable_obj.parameters_list;
  23166. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23167. }
  23168. if ($selectedItem.data('exp')) {
  23169. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23170. }
  23171. },
  23172. selectOnKeydown: false
  23173. });
  23174. if (!variable_obj.column) {
  23175. variable_obj.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23176. }
  23177. if (!variable_obj.row) {
  23178. variable_obj.row = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23179. }
  23180. variableValueMenuCode(command, variable_obj.row, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  23181. variableValueMenuCode(command, variable_obj.column, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  23182. } else {
  23183. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23184. variable_render += '</div>';
  23185. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23186. dom_object.append(variable_render);
  23187. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23188. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23189. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution && !dom_object.hasClass('var_attributed')) {
  23190. console.log('dom_object6');
  23191. console.log(dom_object);
  23192. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23193. context_menu += '<div class="menu">';
  23194. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23195. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23196. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23197. context_menu += '</div></div>';
  23198. }
  23199. context_menu += '</div></div>';
  23200. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23201. variable_render.append(context_menu);
  23202. context_menu.dropdown({
  23203. onChange: function onChange(value, text, $selectedItem) {
  23204. console.log('S5');
  23205. if ($selectedItem.data('clear')) {
  23206. console.log('PP5');
  23207. dom_object.text('');
  23208. variable_obj.content = null;
  23209. variable_obj.row = null;
  23210. variable_obj.column = null;
  23211. delete variable_obj.function_called;
  23212. delete variable_obj.parameters_list;
  23213. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23214. }
  23215. if ($selectedItem.data('exp')) {
  23216. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23217. }
  23218. },
  23219. selectOnKeydown: false
  23220. });
  23221. }
  23222. } else {
  23223. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  23224. variable_render += '</div>';
  23225. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23226. dom_object.append(variable_render);
  23227. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23228. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23229. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23230. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23231. context_menu += '<div class="menu">';
  23232. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23233. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23234. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23235. context_menu += '</div></div>';
  23236. }
  23237. context_menu += '</div></div>';
  23238. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23239. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23240. context_menu.insertAfter(variable_render);
  23241. }
  23242. context_menu.dropdown({
  23243. onChange: function onChange(value, text, $selectedItem) {
  23244. console.log('S6');
  23245. if ($selectedItem.data('clear')) {
  23246. console.log('PP6');
  23247. dom_object.text('');
  23248. variable_obj.content = null;
  23249. variable_obj.row = null;
  23250. variable_obj.column = null;
  23251. delete variable_obj.function_called;
  23252. delete variable_obj.parameters_list;
  23253. dom_object.find('.value_rendered').remove();
  23254. dom_object.find('.context_menu_clear').remove();
  23255. dom_object.find('.width-dynamic-minus').remove();
  23256. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23257. }
  23258. if ($selectedItem.data('exp')) {
  23259. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23260. }
  23261. },
  23262. selectOnKeydown: false
  23263. });
  23264. variable_render.on('click', function (e) {
  23265. variable_render.remove();
  23266. variable_render.empty();
  23267. variable_render.remove();
  23268. dom_object.empty();
  23269. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23270. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  23271. });
  23272. }
  23273. }
  23274. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23275. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  23276. sub_menu.append('<div class="divider"></div><div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_header_ivprog_functions') + '</div>');
  23277. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_math') + '<div class="menu menu_math_functions"></div></div>');
  23278. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_text') + '<div class="menu menu_text_functions"></div></div>');
  23279. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_arrangement') + '<div class="menu menu_arrangement_functions"></div></div>');
  23280. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_conversion') + '<div class="menu menu_conversion_functions"></div></div>'); // Insert Math functions:
  23281. for (var i = 0; i < window.system_functions.length; i++) {
  23282. var t = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item"></div>');
  23283. t.data('function_reference', window.system_functions[i]);
  23284. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  23285. t.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(window.system_functions[i].identifier));
  23286. switch (window.system_functions[i].category) {
  23287. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math:
  23288. sub_menu.find('.menu_math_functions').append(t);
  23289. break;
  23290. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text:
  23291. sub_menu.find('.menu_text_functions').append(t);
  23292. break;
  23293. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement:
  23294. sub_menu.find('.menu_arrangement_functions').append(t);
  23295. break;
  23296. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion:
  23297. sub_menu.find('.menu_conversion_functions').append(t);
  23298. break;
  23299. }
  23300. }
  23301. }
  23302. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23303. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  23304. sub_menu.text('');
  23305. for (var i = 0; i < window.program_obj.functions.length; i++) {
  23306. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  23307. temp.data('function_reference', window.program_obj.functions[i]);
  23308. sub_menu.append(temp);
  23309. }
  23310. }
  23311. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23312. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  23313. sub_menu.text('');
  23314. var is_there = false;
  23315. if (window.program_obj.globals) {
  23316. if (ref_object.include_constant) {
  23317. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23318. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  23319. temp.data('variable_reference', window.program_obj.globals[i]);
  23320. sub_menu.append(temp);
  23321. is_there = true;
  23322. }
  23323. } else {
  23324. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23325. if (!window.program_obj.globals[i].is_constant) {
  23326. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  23327. temp.data('variable_reference', window.program_obj.globals[i]);
  23328. sub_menu.append(temp);
  23329. is_there = true;
  23330. }
  23331. }
  23332. }
  23333. }
  23334. if (function_obj.parameters_list) {
  23335. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  23336. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  23337. temp.data('variable_reference', function_obj.parameters_list[i]);
  23338. sub_menu.append(temp);
  23339. is_there = true;
  23340. }
  23341. }
  23342. if (function_obj.variables_list) {
  23343. for (var i = 0; i < function_obj.variables_list.length; i++) {
  23344. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  23345. temp.data('variable_reference', function_obj.variables_list[i]);
  23346. sub_menu.append(temp);
  23347. is_there = true;
  23348. }
  23349. }
  23350. if (!is_there) {
  23351. sub_menu.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_none_variable') + '</div>'));
  23352. sub_menu.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item disabled">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_none_variable_instruction') + '</div>'));
  23353. }
  23354. }
  23355. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  23356. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23357. menu_var_or_value.dropdown({
  23358. onChange: function onChange(value, text, $selectedItem) {
  23359. console.log('S7');
  23360. dom_object.find('.var_name').remove();
  23361. switch ($selectedItem.data('option')) {
  23362. case VAR_OR_VALUE_TYPES.only_function:
  23363. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, jquery__WEBPACK_IMPORTED_MODULE_0___default()($selectedItem).data('function_reference'), expression_element);
  23364. break;
  23365. case VAR_OR_VALUE_TYPES.only_value:
  23366. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23367. break;
  23368. case VAR_OR_VALUE_TYPES.only_variable:
  23369. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, jquery__WEBPACK_IMPORTED_MODULE_0___default()($selectedItem).data('variable_reference'), expression_element);
  23370. break;
  23371. }
  23372. if ($selectedItem.data('exp')) {
  23373. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23374. }
  23375. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes) {
  23376. _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23377. }
  23378. },
  23379. selectOnKeydown: false
  23380. });
  23381. }
  23382. dom_object.find('.width-dynamic').on('input', function () {
  23383. var inputWidth = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).textWidth() + 10;
  23384. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).focus();
  23385. var tmpStr = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val();
  23386. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val('');
  23387. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val(tmpStr);
  23388. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).css({
  23389. width: inputWidth
  23390. });
  23391. }).trigger('input');
  23392. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment) {
  23393. dom_object.parent().on('click', function (e) {
  23394. dom_object.find('.value_rendered').remove();
  23395. dom_object.find('.value_rendered').empty();
  23396. dom_object.find('.value_rendered').remove();
  23397. dom_object.empty();
  23398. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23399. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23400. });
  23401. }
  23402. }
  23403. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  23404. ref_object.function_called = function_selected;
  23405. ref_object.parameters_list = [];
  23406. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  23407. menu_var_or_value.find('.text').text(' ');
  23408. dom_object.find('.menu_var_or_value_dom').remove();
  23409. var parameters_menu;
  23410. if (function_selected.name) {
  23411. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  23412. } else {
  23413. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.identifier) + '</i> <span> ( </span>';
  23414. }
  23415. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  23416. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  23417. if (j + 1 != function_selected.parameters_list.length) {
  23418. parameters_menu += ' , ';
  23419. }
  23420. }
  23421. parameters_menu += '<span> ) </span></div>';
  23422. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23423. dom_object.append(parameters_menu);
  23424. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  23425. var temp;
  23426. if (function_selected.parameters_list[j].dimensions > 0) {
  23427. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, function_selected.parameters_list[j].dimensions);
  23428. } else {
  23429. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23430. }
  23431. ref_object.parameters_list.push(temp);
  23432. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  23433. }
  23434. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23435. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23436. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23437. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23438. context_menu += '<div class="menu">';
  23439. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23440. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23441. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23442. context_menu += '</div></div>';
  23443. }
  23444. context_menu += '</div></div>';
  23445. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23446. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23447. context_menu.dropdown({
  23448. onChange: function onChange(value, text, $selectedItem) {
  23449. console.log('S8');
  23450. if ($selectedItem.data('clear')) {
  23451. console.log('PP7');
  23452. dom_object.text('');
  23453. ref_object.content = null;
  23454. ref_object.row = null;
  23455. ref_object.column = null;
  23456. delete ref_object.function_called;
  23457. delete ref_object.parameters_list;
  23458. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23459. }
  23460. if ($selectedItem.data('exp')) {
  23461. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23462. }
  23463. },
  23464. selectOnKeydown: false
  23465. });
  23466. } else {
  23467. menu_var_or_value.find('.text').text(' ');
  23468. dom_object.find('.menu_var_or_value_dom').remove();
  23469. var parameters_menu;
  23470. if (function_selected.name) {
  23471. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  23472. } else {
  23473. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.identifier) + '</i> <span> ( </span>';
  23474. }
  23475. parameters_menu += '<span> ) </span></div>';
  23476. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23477. dom_object.append(parameters_menu);
  23478. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23479. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23480. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23481. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23482. context_menu += '<div class="menu">';
  23483. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23484. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23485. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23486. context_menu += '</div></div>';
  23487. }
  23488. context_menu += '</div></div>';
  23489. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23490. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23491. context_menu.dropdown({
  23492. onChange: function onChange(value, text, $selectedItem) {
  23493. console.log('S9');
  23494. if ($selectedItem.data('clear')) {
  23495. console.log('PP8');
  23496. dom_object.text('');
  23497. ref_object.content = null;
  23498. ref_object.row = null;
  23499. ref_object.column = null;
  23500. delete ref_object.function_called;
  23501. delete ref_object.parameters_list;
  23502. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23503. }
  23504. if ($selectedItem.data('exp')) {
  23505. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23506. }
  23507. },
  23508. selectOnKeydown: false
  23509. });
  23510. }
  23511. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23512. _attribution__WEBPACK_IMPORTED_MODULE_6__["renderMenuOperations"](command, ref_object, dom_object, menu_var_or_value, function_obj);
  23513. }
  23514. }
  23515. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  23516. ref_object.content = variable_selected;
  23517. menu_var_or_value.find('.text').text(' ');
  23518. dom_object.find('.menu_var_or_value_dom').remove();
  23519. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  23520. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  23521. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23522. }
  23523. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  23524. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  23525. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23526. }
  23527. variable_render += '</div>';
  23528. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23529. dom_object.append(variable_render);
  23530. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  23531. ref_object.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23532. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  23533. }
  23534. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  23535. ref_object.row = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23536. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  23537. ref_object.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23538. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  23539. }
  23540. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23541. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23542. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution && !dom_object.hasClass('var_attributed')) {
  23543. console.log("dom_object 10: ");
  23544. console.log(dom_object);
  23545. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23546. context_menu += '<div class="menu">';
  23547. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23548. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23549. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23550. context_menu += '</div></div>';
  23551. }
  23552. context_menu += '</div></div>';
  23553. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23554. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  23555. context_menu.dropdown({
  23556. onChange: function onChange(value, text, $selectedItem) {
  23557. console.log('S10');
  23558. if ($selectedItem.data('clear')) {
  23559. console.log('PP9');
  23560. dom_object.text('');
  23561. ref_object.content = null;
  23562. ref_object.row = null;
  23563. ref_object.column = null;
  23564. delete ref_object.function_called;
  23565. delete ref_object.parameters_list;
  23566. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23567. }
  23568. if ($selectedItem.data('exp')) {
  23569. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23570. }
  23571. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes) {
  23572. _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__["manageClearExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23573. }
  23574. },
  23575. selectOnKeydown: false
  23576. });
  23577. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23578. _attribution__WEBPACK_IMPORTED_MODULE_6__["renderMenuOperations"](command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  23579. }
  23580. }
  23581. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  23582. if (ref_object.content == null) {
  23583. ref_object.content = "";
  23584. }
  23585. menu_var_or_value.find('.text').text(' ');
  23586. var field = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  23587. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  23588. var rendered = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="value_rendered"></div>');
  23589. rendered.insertBefore(field);
  23590. field.focus();
  23591. field.val(ref_object.content);
  23592. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23593. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23594. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23595. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_change');
  23596. context_menu += '<div class="menu">';
  23597. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  23598. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  23599. context_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  23600. context_menu += '</div></div>';
  23601. }
  23602. context_menu += '</div></div>';
  23603. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23604. dom_object.find('.menu_var_or_value_dom').remove();
  23605. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23606. context_menu.insertAfter(field);
  23607. }
  23608. context_menu.dropdown({
  23609. onChange: function onChange(value, text, $selectedItem) {
  23610. console.log('S11');
  23611. if ($selectedItem.data('clear')) {
  23612. console.log('PP10');
  23613. dom_object.text('');
  23614. dom_object.find('.value_rendered').remove();
  23615. dom_object.find('.context_menu_clear').remove();
  23616. dom_object.find('.width-dynamic-minus').remove();
  23617. ref_object.content = null;
  23618. ref_object.row = null;
  23619. ref_object.column = null;
  23620. delete ref_object.function_called;
  23621. delete ref_object.parameters_list;
  23622. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23623. }
  23624. if ($selectedItem.data('exp')) {
  23625. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23626. }
  23627. },
  23628. selectOnKeydown: false
  23629. });
  23630. dom_object.find('.width-dynamic-minus').focusout(function () {
  23631. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim()) {
  23632. ref_object.content = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim();
  23633. }
  23634. rendered.text(ref_object.content);
  23635. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  23636. });
  23637. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  23638. var code = e.keyCode || e.which;
  23639. if (code == 13) {
  23640. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim()) {
  23641. ref_object.content = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim();
  23642. }
  23643. rendered.text(ref_object.content);
  23644. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  23645. }
  23646. if (code == 27) {
  23647. rendered.text(ref_object.content);
  23648. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  23649. }
  23650. });
  23651. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment) {
  23652. /*rendered.parent().on('click', function(e) {
  23653. rendered.parent().off();
  23654. console.log("TTT14");
  23655. rendered.remove();
  23656. rendered.empty();
  23657. rendered.remove();
  23658. dom_object.empty();
  23659. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23660. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  23661. });*/
  23662. }
  23663. rendered.on('click', function (e) {
  23664. console.log("TTT2");
  23665. rendered.remove();
  23666. rendered.empty();
  23667. rendered.remove();
  23668. dom_object.empty();
  23669. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23670. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23671. });
  23672. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  23673. _attribution__WEBPACK_IMPORTED_MODULE_6__["renderMenuOperations"](command, ref_object, dom_object, menu_var_or_value, function_obj);
  23674. }
  23675. }
  23676. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth = function (text, font) {
  23677. if (!jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl) jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span>').hide().appendTo(document.body);
  23678. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  23679. return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.width();
  23680. };
  23681. /***/ }),
  23682. /***/ "./js/visualUI/commands/whiletrue.js":
  23683. /*!*******************************************!*\
  23684. !*** ./js/visualUI/commands/whiletrue.js ***!
  23685. \*******************************************/
  23686. /*! exports provided: createFloatingCommand, renderCommand */
  23687. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23688. "use strict";
  23689. __webpack_require__.r(__webpack_exports__);
  23690. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23691. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23692. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23693. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23694. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23695. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23696. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23697. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23698. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23699. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23700. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  23701. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  23702. function createFloatingCommand() {
  23703. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' ( x < 10 ) <br> </span></div>');
  23704. }
  23705. function renderCommand(command, function_obj) {
  23706. var ret = '';
  23707. ret += '<div class="ui whiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' </span>';
  23708. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  23709. ret += ' </span>';
  23710. ret += '<div class="ui block_commands">';
  23711. ret += '</div>';
  23712. ret += '<span> </span>';
  23713. ret += '</div>';
  23714. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23715. el.data('command', command);
  23716. el.find('.block_commands').data('command', command);
  23717. addHandlers(command, function_obj, el);
  23718. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  23719. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  23720. if (command.commands_block) {
  23721. for (var j = 0; j < command.commands_block.length; j++) {
  23722. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  23723. }
  23724. }
  23725. return el;
  23726. }
  23727. function addHandlers(command, function_obj, whiletrue_dom) {
  23728. whiletrue_dom.find('.button_remove_command').on('click', function () {
  23729. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, whiletrue_dom)) {
  23730. whiletrue_dom.fadeOut(400, function () {
  23731. whiletrue_dom.remove();
  23732. });
  23733. }
  23734. });
  23735. }
  23736. /***/ }),
  23737. /***/ "./js/visualUI/commands/writer.js":
  23738. /*!****************************************!*\
  23739. !*** ./js/visualUI/commands/writer.js ***!
  23740. \****************************************/
  23741. /*! exports provided: createFloatingCommand, renderCommand, addContent */
  23742. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23743. "use strict";
  23744. __webpack_require__.r(__webpack_exports__);
  23745. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23746. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addContent", function() { return addContent; });
  23748. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23749. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23750. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23751. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23752. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23753. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23754. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23755. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23756. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23757. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Sortable.js */ "./js/Sortable.js");
  23758. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Sortable_js__WEBPACK_IMPORTED_MODULE_8__);
  23759. function createFloatingCommand() {
  23760. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' var </span></div>');
  23761. }
  23762. function renderCommand(command, function_obj) {
  23763. var ret = '';
  23764. ret += '<div class="ui writer command_container"> <i class="ui icon small upload command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' ( </span><div class="all_elements_write"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  23765. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23766. el.data('command', command);
  23767. for (var i = 0; i < command.content.length; i++) {
  23768. var new_div_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="var_value_menu_div"></div>');
  23769. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler"></div>');
  23770. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  23771. div_parent_with_handler.append(new_div_item);
  23772. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  23773. el.find('.all_elements_write').append(div_parent_with_handler);
  23774. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.content[i], new_div_item, function_obj);
  23775. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  23776. addHandlersManager(command, function_obj, el, div_parent_with_handler, command.content[i]);
  23777. }
  23778. if (command.content.length == 0) {
  23779. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  23780. }
  23781. addHandlers(command, function_obj, el);
  23782. return el;
  23783. }
  23784. function addHandlersManager(command, function_obj, writer_dom, item_div, content_element) {
  23785. item_div.find('.times').on('click', function () {
  23786. for (var i = 0; i < command.content.length; i++) {
  23787. if (command.content[i] == content_element) {
  23788. delete command.content[i];
  23789. command.content.splice(i, 1);
  23790. item_div.children().off();
  23791. item_div.off();
  23792. item_div.fadeOut();
  23793. if (command.content.length > 0) {
  23794. item_div.next('.icon_add_item_to_writer').fadeOut();
  23795. }
  23796. break;
  23797. }
  23798. }
  23799. });
  23800. }
  23801. function addHandlers(command, function_obj, writer_dom) {
  23802. writer_dom.find('.button_remove_command').on('click', function () {
  23803. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, writer_dom)) {
  23804. writer_dom.fadeOut(400, function () {
  23805. writer_dom.remove();
  23806. });
  23807. }
  23808. });
  23809. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  23810. handle: '.ellipsis',
  23811. animation: 100,
  23812. ghostClass: 'ghost',
  23813. group: 'writer_' + Math.floor(Math.random() * 10000000),
  23814. draggable: '.div_parent_handler',
  23815. onEnd: function onEnd(evt) {
  23816. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  23817. writer_dom.empty();
  23818. writer_dom.replaceWith(renderCommand(command, function_obj));
  23819. }
  23820. });
  23821. }
  23822. function addHandlerIconAdd(dom_object, command, function_obj) {
  23823. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  23824. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  23825. var icon_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  23826. if (!insert_after) {
  23827. dom_object.append(icon_add_item);
  23828. } else {
  23829. icon_add_item.insertAfter(after_which);
  23830. }
  23831. icon_add_item.on('click', function (e) {
  23832. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler" style="display:none;"></div>');
  23833. var new_div_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="var_value_menu_div"></div>');
  23834. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  23835. div_parent_with_handler.append(new_div_item);
  23836. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  23837. div_parent_with_handler.insertAfter(icon_add_item);
  23838. var new_related_menu = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  23839. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new_related_menu, new_div_item, function_obj);
  23840. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  23841. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  23842. var pos = 1;
  23843. dom_object.find('.icon_add_item_to_writer').each(function () {
  23844. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).get(0) === icon_add_item.get(0)) {
  23845. command.content.splice(pos, 0, new_related_menu);
  23846. } else {
  23847. pos++;
  23848. }
  23849. });
  23850. if (command.content.length == 1) {
  23851. icon_add_item.remove();
  23852. }
  23853. div_parent_with_handler.fadeIn();
  23854. });
  23855. }
  23856. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  23857. if (dom_object.hasClass('var_value_menu_div')) {
  23858. var icon_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  23859. icon_add_item.insertAfter(dom_object);
  23860. icon_add_item.on('click', function (e) {
  23861. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler"></div>');
  23862. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  23863. div_parent_with_handler.append(new_div_item);
  23864. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  23865. div_parent_with_handler.insertAfter(icon_add_item);
  23866. var new_related_menu = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  23867. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new_related_menu, new_div_item, function_obj);
  23868. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  23869. command.content.push(new_related_menu);
  23870. if (command.content.length == 1) {
  23871. icon_add_item.remove();
  23872. }
  23873. });
  23874. }
  23875. }
  23876. /***/ }),
  23877. /***/ "./js/visualUI/functions.js":
  23878. /*!**********************************!*\
  23879. !*** ./js/visualUI/functions.js ***!
  23880. \**********************************/
  23881. /*! exports provided: renderFunction, initVisualUI, addFunctionChangeListener, addGlobalChangeListener, removeGlobalListener, removeFunctionListener */
  23882. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23883. "use strict";
  23884. __webpack_require__.r(__webpack_exports__);
  23885. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderFunction", function() { return renderFunction; });
  23886. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initVisualUI", function() { return initVisualUI; });
  23887. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addFunctionChangeListener", function() { return addFunctionChangeListener; });
  23888. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGlobalChangeListener", function() { return addGlobalChangeListener; });
  23889. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeGlobalListener", function() { return removeGlobalListener; });
  23890. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFunctionListener", function() { return removeFunctionListener; });
  23891. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23892. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23893. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  23894. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23895. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23896. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  23897. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  23898. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  23899. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  23900. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23901. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  23902. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  23903. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  23904. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_11__);
  23905. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  23906. /* harmony import */ var _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  23907. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  23908. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  23909. /* harmony import */ var _ima_version_json__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../../.ima_version.json */ "./.ima_version.json");
  23910. var _ima_version_json__WEBPACK_IMPORTED_MODULE_16___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./../../.ima_version.json */ "./.ima_version.json", 1);
  23911. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  23912. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_Sortable_js__WEBPACK_IMPORTED_MODULE_17__);
  23913. var counter_new_functions = 0;
  23914. var counter_new_parameters = 0;
  23915. var ivprog_version = _ima_version_json__WEBPACK_IMPORTED_MODULE_16__.version;
  23916. var globalChangeListeners = [];
  23917. var functionsChangeListeners = [];
  23918. var domConsole = null;
  23919. window.studentGrade = null;
  23920. window.LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"];
  23921. var program = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Program"]();
  23922. window.system_functions = []; // Adding math functions:
  23923. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$sin', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23924. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$cos', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23925. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$tan', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23926. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$sqrt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23927. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$pow', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23928. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$log', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23929. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$abs', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23930. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$negate', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23931. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$invert', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23932. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$max', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  23933. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$min', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math)); // Adding text functions:
  23934. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$substring', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23935. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$length', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23936. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$uppercase', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23937. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$lowercase', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  23938. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$charAt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text)); // Adding arrangement functions:
  23939. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$numElements', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 1)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement));
  23940. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$matrixLines', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 2)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement));
  23941. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$matrixColumns', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 2)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement)); // Adding conversion functions:
  23942. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isReal', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23943. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isInt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23944. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isBool', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23945. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castReal', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23946. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castInt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23947. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castBool', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23948. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castString', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  23949. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ \n\n Laboratório de Informática na Educação\n http://line.ime.usp.br');
  23950. var mainFunction = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Function"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("start"), _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID, 0, [], true, false);
  23951. mainFunction.function_comment = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment_main'));
  23952. program.addFunction(mainFunction);
  23953. window.program_obj = program;
  23954. window.generator = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"];
  23955. window.runCodeAssessment = runCodeAssessment;
  23956. window.renderAlgorithm = _algorithm__WEBPACK_IMPORTED_MODULE_14__["renderAlgorithm"];
  23957. window.insertContext = false;
  23958. window.watchW = melanke_watchjs__WEBPACK_IMPORTED_MODULE_11___default.a;
  23959. melanke_watchjs__WEBPACK_IMPORTED_MODULE_11___default.a.watch(window.program_obj.globals, function () {
  23960. if (window.insertContext) {
  23961. setTimeout(function () {
  23962. _algorithm__WEBPACK_IMPORTED_MODULE_14__["renderAlgorithm"]();
  23963. globalChangeListeners.forEach(function (x) {
  23964. return x();
  23965. });
  23966. }, 300);
  23967. window.insertContext = false;
  23968. } else {
  23969. _algorithm__WEBPACK_IMPORTED_MODULE_14__["renderAlgorithm"]();
  23970. globalChangeListeners.forEach(function (x) {
  23971. return x();
  23972. });
  23973. }
  23974. }, 1);
  23975. melanke_watchjs__WEBPACK_IMPORTED_MODULE_11___default.a.watch(window.program_obj.functions, function () {
  23976. if (window.insertContext) {
  23977. setTimeout(function () {
  23978. _algorithm__WEBPACK_IMPORTED_MODULE_14__["renderAlgorithm"]();
  23979. functionsChangeListeners.forEach(function (x) {
  23980. return x();
  23981. });
  23982. }, 300);
  23983. window.insertContext = false;
  23984. } else {
  23985. _algorithm__WEBPACK_IMPORTED_MODULE_14__["renderAlgorithm"]();
  23986. functionsChangeListeners.forEach(function (x) {
  23987. return x();
  23988. });
  23989. }
  23990. }, 1);
  23991. function addFunctionHandler() {
  23992. var new_function = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Function"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("new_function") + "_" + counter_new_functions, _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID, 0, [], false, false, [], new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment_start')));
  23993. program.addFunction(new_function);
  23994. counter_new_functions++;
  23995. window.insertContext = true;
  23996. var newe = renderFunction(new_function);
  23997. /*newe.css('display', 'none');
  23998. newe.fadeIn();*/
  23999. }
  24000. function addParameter(function_obj, function_container) {
  24001. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  24002. if (function_obj.parameters_list == null) {
  24003. function_obj.parameters_list = [];
  24004. }
  24005. var new_parameter = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("new_parameter") + "_" + counter_new_parameters);
  24006. function_obj.parameters_list.push(new_parameter);
  24007. counter_new_parameters++;
  24008. var newe = renderParameter(function_obj, new_parameter, function_container);
  24009. if (is_from_click) {
  24010. /*newe.css('display', 'none');
  24011. newe.fadeIn();*/
  24012. }
  24013. }
  24014. function updateReturnType(function_obj, new_type) {
  24015. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24016. function_obj.return_type = new_type;
  24017. function_obj.return_dimensions = new_dimensions;
  24018. }
  24019. function removeFunction(function_obj) {
  24020. var index = program.functions.indexOf(function_obj);
  24021. if (index > -1) {
  24022. program.functions.splice(index, 1);
  24023. }
  24024. }
  24025. function minimizeFunction(function_obj) {
  24026. function_obj.is_hidden = !function_obj.is_hidden;
  24027. }
  24028. function addHandlers(function_obj, function_container) {
  24029. function_container.find('.ui.dropdown.function_return').dropdown({
  24030. onChange: function onChange(value, text, $selectedItem) {
  24031. if ($selectedItem.data('dimensions')) {
  24032. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  24033. } else {
  24034. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  24035. }
  24036. },
  24037. selectOnKeydown: false
  24038. });
  24039. function_container.find(".name_function_updated").on('click', function (e) {
  24040. enableNameFunctionUpdate(function_obj, function_container);
  24041. });
  24042. function_container.find(".add_parameter_button").on('click', function (e) {
  24043. window.insertContext = true;
  24044. addParameter(function_obj, function_container, true);
  24045. });
  24046. function_container.find('.menu_commands').dropdown({
  24047. on: 'hover'
  24048. });
  24049. function_container.find('.menu_commands a').on('click', function (evt) {
  24050. if (function_obj.commands == null || function_obj.commands.length == 0) {
  24051. function_obj.commands = [];
  24052. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_6__["genericCreateCommand"](jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'));
  24053. function_obj.commands.push(new_cmd);
  24054. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  24055. } else {
  24056. _commands__WEBPACK_IMPORTED_MODULE_6__["createFloatingCommand"](function_obj, function_container, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  24057. }
  24058. });
  24059. function_container.find('.add_var_button_function').on('click', function (e) {
  24060. window.insertContext = true;
  24061. _variables__WEBPACK_IMPORTED_MODULE_5__["addVariable"](function_obj, function_container, true);
  24062. });
  24063. function_container.find('.remove_function_button').on('click', function (e) {
  24064. removeFunction(function_obj);
  24065. function_container.fadeOut();
  24066. });
  24067. function_container.find('.minimize_function_button').on('click', function (e) {
  24068. minimizeFunction(function_obj);
  24069. if (function_obj.is_hidden) {
  24070. function_container.find(".add_var_button_function").toggle();
  24071. function_container.find(".inline_add_command").toggle();
  24072. function_container.find(".function_area").slideToggle();
  24073. } else {
  24074. function_container.find(".function_area").slideToggle(function () {
  24075. function_container.find(".add_var_button_function").toggle();
  24076. function_container.find(".inline_add_command").toggle();
  24077. });
  24078. }
  24079. });
  24080. } // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  24081. function renderFunctionReturn(function_obj, function_element) {
  24082. var ret = '<div class="ui dropdown function_return">';
  24083. if (function_obj.return_dimensions > 0) {
  24084. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("vector") + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_obj.return_type);
  24085. if (function_obj.return_dimensions == 1) {
  24086. ret += ' [ ] ';
  24087. } else {
  24088. ret += ' [ ] [ ] ';
  24089. }
  24090. ret += '</div>';
  24091. } else {
  24092. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_obj.return_type) + '</div>';
  24093. }
  24094. ret += '<div class="menu">';
  24095. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24096. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions < 1 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  24097. }
  24098. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24099. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  24100. continue;
  24101. }
  24102. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  24103. }
  24104. ret += '</div></div>';
  24105. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24106. function_element.find('.function_return').append(ret);
  24107. }
  24108. var cont = 0;
  24109. function renderFunction(function_obj) {
  24110. var appender = '<div class="ui secondary segment function_div list-group-item function_cont_' + cont + '">';
  24111. if (function_obj.function_comment) {//appender += renderComment(function_obj.function_comment, sequence, true, -1);
  24112. }
  24113. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  24114. appender += (function_obj.is_main ? '<div class="div_start_minimize_v"> </div>' : '<button class="ui icon button large remove_function_button"><i class="red icon times"></i></button>') + '<button class="ui icon button tiny minimize_function_button"><i class="icon window minimize"></i></button>';
  24115. appender += '<div class="function_signature_div">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("function") + ' ';
  24116. if (function_obj.is_main) {
  24117. appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('void') + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="span_name_function" >' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function">( </span> <div class="ui large labels parameters_list">';
  24118. } else {
  24119. appender += '<div class="ui function_return"></div>';
  24120. appender += '<div class="function_name_div function_name_div_updated"><span class="span_name_function name_function_updated">' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function"> ( </span> <i class="ui icon plus square outline add_parameter_button"></i> <div class="ui large labels parameters_list container_parameters_list">';
  24121. }
  24122. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  24123. appender += '<div class="ui add_var_context add_var_button_function" style="float: left;"><i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button purple"><i class="icon superscript"></i></div></div>';
  24124. appender += '<div class="ui top attached segment variables_list_div"></div>';
  24125. appender += '<div class="ui bottom attached segment commands_list_div commands_cont_' + cont + '">' + '<div class="ui rail" style="width: 35px; margin-left: -36px;"><div class="ui sticky sticky_cont_' + cont + '" style="top: 50px !important;">';
  24126. appender += '<i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" ><i class="icon code"></i> <div class="menu"> ';
  24127. appender += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer + '"><i class="upload icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment + '"><i class="quote left icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution + '"><i class="arrow left icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall + '"><i class="hand point right icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue + '" ><i class="random icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch + '"><i class="list icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_switch') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return + '"><i class="reply icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_btn_return') + '</a>' + '</div></div>';
  24128. appender += '</div></div>' + '</div>';
  24129. appender += '</div></div>';
  24130. appender = jquery__WEBPACK_IMPORTED_MODULE_0___default()(appender);
  24131. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').append(appender);
  24132. appender.data('fun', function_obj);
  24133. appender.find('.commands_list_div').data('fun', function_obj);
  24134. renderFunctionReturn(function_obj, appender);
  24135. addHandlers(function_obj, appender); // Rendering parameters:
  24136. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  24137. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  24138. } // Rendering variables:
  24139. for (var j = 0; j < function_obj.variables_list.length; j++) {
  24140. _variables__WEBPACK_IMPORTED_MODULE_5__["renderVariable"](appender, function_obj.variables_list[j], function_obj);
  24141. } // Rendering commands:
  24142. for (var j = 0; j < function_obj.commands.length; j++) {
  24143. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](function_obj.commands[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(appender.find('.commands_list_div')[0]), 3, function_obj);
  24144. }
  24145. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.minimize_function_button').popup({
  24146. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_minimize"),
  24147. delay: {
  24148. show: 750,
  24149. hide: 0
  24150. }
  24151. });
  24152. var function_index = program.functions.indexOf(function_obj);
  24153. Sortable.create(appender.find(".variables_list_div")[0], {
  24154. handle: '.ellipsis',
  24155. animation: 100,
  24156. ghostClass: 'ghost',
  24157. group: 'local_vars_drag_' + function_index,
  24158. onEnd: function onEnd(evt) {
  24159. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  24160. }
  24161. });
  24162. addSortableHandler(appender.find(".commands_list_div")[0], function_index);
  24163. if (!function_obj.is_main) {
  24164. Sortable.create(appender.find(".container_parameters_list")[0], {
  24165. handle: '.ellipsis',
  24166. animation: 100,
  24167. ghostClass: 'ghost',
  24168. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  24169. onEnd: function onEnd(evt) {
  24170. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  24171. }
  24172. });
  24173. }
  24174. var teste = '.ui.sticky.sticky_cont_' + cont;
  24175. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).sticky({
  24176. context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_' + cont,
  24177. scrollContext: '.ivprog_visual_panel',
  24178. observeChanges: true,
  24179. offset: 40,
  24180. onStick: function onStick(evt) {
  24181. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24182. },
  24183. onBottom: function onBottom(evt) {
  24184. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24185. },
  24186. onUnstick: function onUnstick(evt) {
  24187. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24188. },
  24189. onReposition: function onReposition(evt) {
  24190. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24191. },
  24192. onScroll: function onScroll(evt) {
  24193. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24194. if (!isVisible(jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste), jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).parent())) {
  24195. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).removeClass('fixed');
  24196. }
  24197. },
  24198. onTop: function onTop(evt) {
  24199. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24200. }
  24201. });
  24202. cont++;
  24203. return appender;
  24204. }
  24205. function isVisible(element, container) {
  24206. var elementTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).offset().top,
  24207. elementHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).height(),
  24208. containerTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).offset().top,
  24209. containerHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).height() - 30;
  24210. return elementTop - containerTop + elementHeight > 0 && elementTop - containerTop < containerHeight;
  24211. }
  24212. window.evento_drag;
  24213. function updateProgramObjDrag() {
  24214. var nodes = Array.prototype.slice.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children());
  24215. var function_index;
  24216. var start_index;
  24217. var function_obj;
  24218. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  24219. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('function_div')) {
  24220. function_index = nodes.indexOf(this);
  24221. start_index = index;
  24222. function_obj = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  24223. }
  24224. });
  24225. console.log(function_index);
  24226. var path_target = [];
  24227. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  24228. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('command_container')) {
  24229. path_target.push(this);
  24230. }
  24231. });
  24232. if (path_target.length == 0) {//console.log('soltou na raiz, na posição: ' + evento_drag.newIndex + ' mas ainda não sei de onde saiu ');
  24233. } else {//console.log('soltou dentro de algum bloco, sequência vem logo abaixo (de baixo pra cima): ');
  24234. //console.log(path_target);
  24235. }
  24236. var index_each = [];
  24237. var path_relative = [];
  24238. for (var i = path_target.length - 1; i >= 0; i--) {
  24239. console.log('da vez', jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]));
  24240. if (i == path_target.length - 1) {
  24241. // está na raiz
  24242. var indice_na_raiz = function_obj.find('.command_container').index(path_target[i]);
  24243. console.log('índice na raiz: ', indice_na_raiz);
  24244. } else {
  24245. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('iftrue')) {
  24246. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().hasClass('commands_if')) {
  24247. path_relative.push('if');
  24248. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().find('.command_container').index(path_target[i]));
  24249. } else {
  24250. path_relative.push('else');
  24251. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().find('.command_container').index(path_target[i]));
  24252. }
  24253. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('dowhiletrue')) {
  24254. path_relative.push('dowhiletrue');
  24255. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24256. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('repeatNtimes')) {
  24257. path_relative.push('repeatNtimes');
  24258. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24259. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('whiletrue')) {
  24260. path_relative.push('whiletrue');
  24261. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24262. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('switch')) {
  24263. path_relative.push('switch'); //index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24264. }
  24265. }
  24266. }
  24267. var index_in_block = -1;
  24268. var is_in_else = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().hasClass('commands_else');
  24269. index_in_block = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().find('.command_container').index(evento_drag.item);
  24270. var is_in_case_switch = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().hasClass('case_commands_block');
  24271. var index_case_of_switch = -1;
  24272. if (is_in_case_switch) {
  24273. index_case_of_switch = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().parent().parent().find('.case_div').index(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().parent());
  24274. }
  24275. /*console.log('path_relative:');
  24276. console.log(path_relative);
  24277. console.log('index_each:');
  24278. console.log(index_each);
  24279. console.log('index_in_block:');
  24280. console.log(index_in_block);
  24281. console.log('ele está em algum bloco de senão? ');
  24282. console.log(is_in_else);
  24283. console.log('ele está dentro de um case de switch?');
  24284. console.log(is_in_case_switch);
  24285. console.log('qual é o índice do case: ');
  24286. console.log(index_case_of_switch);*/
  24287. // encontrar o elemento na árvore:
  24288. var command_start_point = window.program_obj.functions[function_index].commands[indice_na_raiz];
  24289. var block_to_insert = command_start_point;
  24290. for (var i = 0; i < index_each.length; i++) {
  24291. if (path_relative[i] == "else") {
  24292. block_to_insert = block_to_insert.commands_else[index_each[i]];
  24293. } else if (path_relative[i] == "switch") {} else {
  24294. block_to_insert = block_to_insert.commands_block[index_each[i]];
  24295. }
  24296. } //console.log('command_start_point', command_start_point);
  24297. //console.log('block_to_insert', block_to_insert);
  24298. // agora tem que alocar o comando na árvore, mas considerar as quatro situações:
  24299. // (1) se está em um else ou (2) se está em switch ou (3) será um caso padrão ou (4) se será na raiz.
  24300. if (path_target.length == 0) {
  24301. // soltou na raiz:
  24302. window.program_obj.functions[function_index].commands.splice(evento_drag.newIndex, 0, command_in_drag);
  24303. } else if (is_in_else) {
  24304. if (block_to_insert.commands_else) {
  24305. block_to_insert.commands_else.splice(evento_drag.newIndex, 0, command_in_drag);
  24306. } else {
  24307. block_to_insert.commands_else = [];
  24308. block_to_insert.commands_else.push(command_in_drag);
  24309. }
  24310. } else if (is_in_case_switch) {} else {
  24311. // verificar se tem alguma coisa no bloco:
  24312. if (block_to_insert.commands_block) {
  24313. block_to_insert.commands_block.splice(evento_drag.newIndex, 0, command_in_drag);
  24314. } else {
  24315. block_to_insert.commands_block = [];
  24316. block_to_insert.commands_block.push(command_in_drag);
  24317. }
  24318. }
  24319. window.draging = false;
  24320. renderAlgorithm();
  24321. }
  24322. function prepareDragHandler(evt) {
  24323. window.draging = true;
  24324. var nodes = Array.prototype.slice.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children());
  24325. var function_index;
  24326. var function_obj;
  24327. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parentsUntil(".all_functions").each(function (index) {
  24328. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('function_div')) {
  24329. function_index = nodes.indexOf(this);
  24330. function_obj = window.program_obj.functions[function_index];
  24331. }
  24332. });
  24333. command_in_drag = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).data("command"); //console.log('$(evt.item).parent(): ');
  24334. //console.log($(evt.item).parent());
  24335. // descobrir qual das quatro situações:
  24336. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('commands_list_div')) {
  24337. // está na raiz:
  24338. if (function_obj.commands.indexOf(command_in_drag) > -1) {
  24339. function_obj.commands.splice(function_obj.commands.indexOf(command_in_drag), 1);
  24340. }
  24341. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('commands_else')) {
  24342. // está no else:
  24343. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.indexOf(command_in_drag) > -1) {
  24344. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.splice(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.indexOf(command_in_drag), 1);
  24345. }
  24346. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('case_commands_block')) {// está em um switch:
  24347. } else {
  24348. // caso padrão:
  24349. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.indexOf(command_in_drag) > -1) {
  24350. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.splice(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.indexOf(command_in_drag), 1);
  24351. }
  24352. }
  24353. }
  24354. var command_in_drag;
  24355. function addSortableHandler(element, id_function) {
  24356. var n_group = 'commands_drag_' + id_function;
  24357. Sortable.create(element, {
  24358. handle: '.command_drag',
  24359. ghostClass: 'ghost',
  24360. animation: 300,
  24361. group: {
  24362. name: n_group
  24363. },
  24364. onEnd: function onEnd(evt) {
  24365. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  24366. var itemEl = evt.item; // dragged HTMLElement
  24367. evt.to; // target list
  24368. evt.from; // previous list
  24369. evt.oldIndex; // element's old index within old parent
  24370. evt.newIndex; // element's new index within new parent
  24371. //console.log('::EVT::');
  24372. //console.log(evt);
  24373. window.evento_drag = evt;
  24374. try {
  24375. updateProgramObjDrag();
  24376. } catch (e) {
  24377. window.draging = false;
  24378. }
  24379. },
  24380. onStart: function onStart(evt) {
  24381. //console.log("START::EVT::");
  24382. //console.log(evt);
  24383. //console.log("\n\ncommand_in_drag");
  24384. try {
  24385. prepareDragHandler(evt);
  24386. } catch (e) {
  24387. window.draging = false;
  24388. }
  24389. }
  24390. });
  24391. element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  24392. element.find(".iftrue").each(function (index) {
  24393. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24394. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[1], id_function);
  24395. });
  24396. element.find(".repeatNtimes").each(function (index) {
  24397. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24398. });
  24399. element.find(".dowhiletrue").each(function (index) {
  24400. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24401. });
  24402. element.find(".whiletrue").each(function (index) {
  24403. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24404. });
  24405. element.find(".switch").each(function (index) {
  24406. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".case_div").each(function (index) {
  24407. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".case_commands_block")[0], id_function);
  24408. });
  24409. });
  24410. }
  24411. function initVisualUI() {
  24412. // MUST USE CONST, LET, OR VAR !!!!!!
  24413. var mainDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#visual-main-div'); // fill mainDiv with functions and globals...
  24414. // renderAlgorithm()...
  24415. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_function_button').on('click', function () {
  24416. addFunctionHandler();
  24417. });
  24418. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_global_button').on('click', function () {
  24419. window.insertContext = true;
  24420. _globals__WEBPACK_IMPORTED_MODULE_4__["addGlobal"](program, true);
  24421. });
  24422. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.run_button').on('click', function () {
  24423. runCode();
  24424. });
  24425. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').on('click', function () {
  24426. toggleVisualCoding();
  24427. });
  24428. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').on('click', function () {
  24429. toggleTextualCoding();
  24430. });
  24431. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.assessment').on('click', function () {
  24432. runCodeAssessment();
  24433. is_iassign = true;
  24434. });
  24435. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.div_toggle_console').on('click', function () {
  24436. toggleConsole();
  24437. });
  24438. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.expand_button').on('click', function () {
  24439. full_screen();
  24440. });
  24441. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.help_button').on('click', function () {
  24442. window.open('https://www.usp.br/line/ivprog/', '_blank');
  24443. });
  24444. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.main_title h2').prop('title', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_ivprog_description'));
  24445. }
  24446. var is_iassign = false;
  24447. jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).ready(function () {
  24448. var time_show = 750;
  24449. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').popup({
  24450. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_visual"),
  24451. delay: {
  24452. show: time_show,
  24453. hide: 0
  24454. }
  24455. });
  24456. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').popup({
  24457. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_textual"),
  24458. delay: {
  24459. show: time_show,
  24460. hide: 0
  24461. }
  24462. });
  24463. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.upload_file_button').popup({
  24464. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_upload"),
  24465. delay: {
  24466. show: time_show,
  24467. hide: 0
  24468. }
  24469. });
  24470. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.download_file_button').popup({
  24471. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_download"),
  24472. delay: {
  24473. show: time_show,
  24474. hide: 0
  24475. }
  24476. });
  24477. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.undo_button').popup({
  24478. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_undo"),
  24479. delay: {
  24480. show: time_show,
  24481. hide: 0
  24482. }
  24483. });
  24484. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.redo_button').popup({
  24485. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_redo"),
  24486. delay: {
  24487. show: time_show,
  24488. hide: 0
  24489. }
  24490. });
  24491. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.run_button').popup({
  24492. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_run"),
  24493. delay: {
  24494. show: time_show,
  24495. hide: 0
  24496. }
  24497. });
  24498. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.assessment_button').popup({
  24499. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_evaluate"),
  24500. delay: {
  24501. show: time_show,
  24502. hide: 0
  24503. }
  24504. });
  24505. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.help_button').popup({
  24506. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_help") + ' - ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("text_ivprog_version") + ' ' + ivprog_version,
  24507. delay: {
  24508. show: time_show,
  24509. hide: 0
  24510. }
  24511. });
  24512. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_global_button').popup({
  24513. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_add_global"),
  24514. delay: {
  24515. show: time_show,
  24516. hide: 0
  24517. }
  24518. });
  24519. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.div_toggle_console').popup({
  24520. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_console"),
  24521. delay: {
  24522. show: time_show,
  24523. hide: 0
  24524. }
  24525. });
  24526. Sortable.create(listWithHandle, {
  24527. handle: '.glyphicon-move',
  24528. animation: 100,
  24529. ghostClass: 'ghost',
  24530. group: 'functions_divs_drag',
  24531. onEnd: function onEnd(evt) {
  24532. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  24533. }
  24534. });
  24535. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  24536. Sortable.create(listGlobalsHandle, {
  24537. handle: '.ellipsis',
  24538. animation: 100,
  24539. ghostClass: 'ghost',
  24540. group: 'globals_divs_drag',
  24541. onEnd: function onEnd(evt) {
  24542. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  24543. }
  24544. });
  24545. });
  24546. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  24547. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  24548. }
  24549. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  24550. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  24551. }
  24552. function updateSequenceGlobals(oldIndex, newIndex) {
  24553. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  24554. }
  24555. function updateSequenceFunction(oldIndex, newIndex) {
  24556. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  24557. }
  24558. function runCodeAssessment() {
  24559. window.studentGrade = null;
  24560. var strCode = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  24561. if (strCode == null) {
  24562. return;
  24563. }
  24564. toggleConsole(true);
  24565. if (domConsole == null) domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_9__["DOMConsole"]("#ivprog-term");
  24566. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").slideDown(500);
  24567. var runner = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_13__["IVProgAssessment"](strCode, testCases, domConsole);
  24568. runner.runTest().then(function (grade) {
  24569. if (!is_iassign) {
  24570. parent.getEvaluationCallback(grade);
  24571. } else {
  24572. is_iassign = false;
  24573. }
  24574. }).catch(function (err) {
  24575. return console.log(err);
  24576. });
  24577. }
  24578. function runCode() {
  24579. var strCode = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  24580. if (strCode == null) {
  24581. return;
  24582. }
  24583. toggleConsole(true);
  24584. if (domConsole == null) domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_9__["DOMConsole"]("#ivprog-term");
  24585. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").slideDown(500);
  24586. try {
  24587. var data = _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_12__["SemanticAnalyser"].analyseFromSource(strCode);
  24588. var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_10__["IVProgProcessor"](data);
  24589. proc.registerInput(domConsole);
  24590. proc.registerOutput(domConsole);
  24591. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").addClass('ivprog-term-active');
  24592. proc.interpretAST().then(function (_) {
  24593. domConsole.info("Programa executado com sucesso!");
  24594. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").removeClass('ivprog-term-active');
  24595. }).catch(function (err) {
  24596. domConsole.err(err.message);
  24597. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").removeClass('ivprog-term-active');
  24598. });
  24599. } catch (error) {
  24600. domConsole.err(error.message);
  24601. console.log(error);
  24602. }
  24603. }
  24604. function toggleConsole(is_running) {
  24605. if (is_running) {
  24606. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'block');
  24607. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '160px');
  24608. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-170px');
  24609. return;
  24610. }
  24611. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height') == '160px') {
  24612. // esconder
  24613. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'none');
  24614. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '0');
  24615. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-30px');
  24616. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('padding', '5px');
  24617. } else {
  24618. // mostrar
  24619. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'block');
  24620. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '160px');
  24621. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-170px');
  24622. }
  24623. }
  24624. function waitToCloseConsole() {
  24625. domConsole.info("Aperte qualquer tecla para fechar...");
  24626. var p = new Promise(function (resolve, _) {
  24627. domConsole.requestInput(resolve, true);
  24628. });
  24629. p.then(function (_) {
  24630. domConsole.dispose();
  24631. domConsole = null;
  24632. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").hide();
  24633. });
  24634. }
  24635. function toggleTextualCoding() {
  24636. var code = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  24637. if (code == null) {
  24638. return;
  24639. }
  24640. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').css('display', 'none');
  24641. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').css('display', 'block');
  24642. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').removeClass('loading');
  24643. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_code').text(code);
  24644. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').removeClass('active');
  24645. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').addClass('active');
  24646. }
  24647. function toggleVisualCoding() {
  24648. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').addClass('loading');
  24649. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').css('display', 'none');
  24650. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').css('display', 'block');
  24651. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').removeClass('active');
  24652. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').addClass('active');
  24653. }
  24654. function removeParameter(function_obj, parameter_obj, parameter_container) {
  24655. var index = function_obj.parameters_list.indexOf(parameter_obj);
  24656. if (index > -1) {
  24657. window.insertContext = true;
  24658. function_obj.parameters_list.splice(index, 1);
  24659. }
  24660. jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameter_container).fadeOut();
  24661. }
  24662. function updateParameterType(parameter_obj, new_type) {
  24663. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24664. parameter_obj.type = new_type;
  24665. parameter_obj.dimensions = new_dimensions;
  24666. if (new_dimensions > 0) {
  24667. parameter_obj.rows = new_dimensions;
  24668. parameter_obj.columns = 2;
  24669. }
  24670. }
  24671. function renderParameter(function_obj, parameter_obj, function_container) {
  24672. var ret = "";
  24673. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  24674. ret += '<div class="ui dropdown parameter_type">';
  24675. if (parameter_obj.dimensions > 0) {
  24676. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(parameter_obj.type);
  24677. if (parameter_obj.dimensions == 1) {
  24678. ret += ' [ ] ';
  24679. } else {
  24680. ret += ' [ ] [ ] ';
  24681. }
  24682. ret += '</div>';
  24683. } else {
  24684. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(parameter_obj.type) + '</div>';
  24685. }
  24686. ret += '<div class="menu">';
  24687. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24688. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  24689. continue;
  24690. }
  24691. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  24692. }
  24693. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24694. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  24695. continue;
  24696. }
  24697. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  24698. }
  24699. ret += '</div></div>';
  24700. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  24701. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  24702. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24703. function_container.find('.container_parameters_list').append(ret);
  24704. ret.find('.remove_parameter').on('click', function (e) {
  24705. removeParameter(function_obj, parameter_obj, ret);
  24706. });
  24707. ret.find('.ui.dropdown.parameter_type').dropdown({
  24708. onChange: function onChange(value, text, $selectedItem) {
  24709. if ($selectedItem.data('dimensions')) {
  24710. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  24711. } else {
  24712. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  24713. }
  24714. },
  24715. selectOnKeydown: false
  24716. });
  24717. ret.find('.label_enable_name_parameter').on('click', function (e) {
  24718. enableNameParameterUpdate(parameter_obj, ret, function_obj);
  24719. });
  24720. return ret;
  24721. }
  24722. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  24723. if (parameter_var.name == new_name) {
  24724. return;
  24725. }
  24726. if (isValidIdentifier(new_name)) {
  24727. if (variableNameAlreadyExists(new_name, function_obj)) {
  24728. _utils__WEBPACK_IMPORTED_MODULE_15__["renderErrorMessage"](parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_variable_duplicated'));
  24729. } else {
  24730. parameter_var.name = new_name;
  24731. }
  24732. } else {
  24733. _utils__WEBPACK_IMPORTED_MODULE_15__["renderErrorMessage"](parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  24734. }
  24735. }
  24736. function variableNameAlreadyExists(name_var, function_obj) {
  24737. if (function_obj.parameters_list) {
  24738. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  24739. if (function_obj.parameters_list[i].name == name_var) {
  24740. return true;
  24741. }
  24742. }
  24743. }
  24744. if (function_obj.variables_list) {
  24745. for (var i = 0; i < function_obj.variables_list.length; i++) {
  24746. if (function_obj.variables_list[i].name == name_var) {
  24747. return true;
  24748. }
  24749. }
  24750. }
  24751. return false;
  24752. }
  24753. function updateFunctionName(function_var, new_name, function_obj_dom) {
  24754. if (function_var.name == new_name) {
  24755. return;
  24756. }
  24757. if (isValidIdentifier(new_name)) {
  24758. if (functionNameAlreadyExists(new_name)) {
  24759. _utils__WEBPACK_IMPORTED_MODULE_15__["renderErrorMessage"](function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name_duplicated'));
  24760. } else {
  24761. function_var.name = new_name;
  24762. }
  24763. } else {
  24764. _utils__WEBPACK_IMPORTED_MODULE_15__["renderErrorMessage"](function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  24765. }
  24766. }
  24767. function functionNameAlreadyExists(function_name) {
  24768. for (var i = 0; i < window.program_obj.functions.length; i++) {
  24769. if (window.program_obj.functions[i].name == function_name) {
  24770. return true;
  24771. }
  24772. }
  24773. return false;
  24774. }
  24775. function isValidIdentifier(identifier_str) {
  24776. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  24777. }
  24778. var opened_name_parameter = false;
  24779. var opened_input_parameter = null;
  24780. function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
  24781. if (opened_name_parameter) {
  24782. opened_input_parameter.focus();
  24783. return;
  24784. }
  24785. opened_name_parameter = true;
  24786. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  24787. var input_field;
  24788. parent_node.find('.span_name_parameter').text('');
  24789. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  24790. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  24791. input_field.on('input', function () {
  24792. var inputWidth = input_field.textWidth() + 10;
  24793. opened_input_parameter = input_field;
  24794. input_field.focus();
  24795. var tmpStr = input_field.val();
  24796. input_field.val('');
  24797. input_field.val(tmpStr);
  24798. input_field.css({
  24799. width: inputWidth
  24800. });
  24801. }).trigger('input');
  24802. input_field.focusout(function () {
  24803. /// update array:
  24804. if (input_field.val().trim()) {
  24805. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  24806. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  24807. }
  24808. input_field.off();
  24809. input_field.remove(); /// update elements:
  24810. opened_name_parameter = false;
  24811. opened_input_parameter = false;
  24812. });
  24813. input_field.on('keydown', function (e) {
  24814. var code = e.keyCode || e.which;
  24815. if (code == 13) {
  24816. if (input_field.val().trim()) {
  24817. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  24818. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  24819. }
  24820. input_field.off();
  24821. input_field.remove(); /// update elements:
  24822. opened_name_parameter = false;
  24823. opened_input_parameter = false;
  24824. }
  24825. if (code == 27) {
  24826. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  24827. input_field.off();
  24828. input_field.remove(); /// update elements:
  24829. opened_name_parameter = false;
  24830. opened_input_parameter = false;
  24831. }
  24832. });
  24833. input_field.select();
  24834. }
  24835. var opened_name_function = false;
  24836. var opened_input = null;
  24837. var previousPadding = null;
  24838. function enableNameFunctionUpdate(function_obj, parent_node) {
  24839. if (opened_name_function) {
  24840. opened_input.focus();
  24841. return;
  24842. }
  24843. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  24844. parent_node.find('.span_name_function').text('');
  24845. var input_field;
  24846. if (!previousPadding) {
  24847. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  24848. }
  24849. parent_node.find('.span_name_function').css('padding-left', '0');
  24850. parent_node.find('.span_name_function').css('padding-right', '0');
  24851. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  24852. input_field.insertBefore(parent_node.find('.span_name_function'));
  24853. input_field.on('input', function () {
  24854. var inputWidth = input_field.textWidth() + 10;
  24855. opened_input = input_field;
  24856. input_field.focus();
  24857. var tmpStr = input_field.val();
  24858. input_field.val('');
  24859. input_field.val(tmpStr);
  24860. input_field.css({
  24861. width: inputWidth
  24862. });
  24863. }).trigger('input');
  24864. input_field.focusout(function () {
  24865. /// update array:
  24866. if (input_field.val().trim()) {
  24867. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  24868. }
  24869. input_field.off();
  24870. input_field.remove();
  24871. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  24872. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  24873. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  24874. opened_name_function = false;
  24875. opened_input = false;
  24876. });
  24877. input_field.on('keydown', function (e) {
  24878. var code = e.keyCode || e.which;
  24879. if (code == 13) {
  24880. if (input_field.val().trim()) {
  24881. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  24882. }
  24883. input_field.off();
  24884. input_field.remove();
  24885. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  24886. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  24887. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  24888. opened_name_function = false;
  24889. opened_input = false;
  24890. }
  24891. if (code == 27) {
  24892. input_field.off();
  24893. input_field.remove();
  24894. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  24895. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  24896. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  24897. opened_name_function = false;
  24898. opened_input = false;
  24899. }
  24900. });
  24901. input_field.select();
  24902. }
  24903. function addFunctionChangeListener(callback) {
  24904. functionsChangeListeners.push(callback);
  24905. return functionsChangeListeners.length - 1;
  24906. }
  24907. function addGlobalChangeListener(callback) {
  24908. globalChangeListeners.push(callback);
  24909. return globalChangeListeners.length - 1;
  24910. }
  24911. function removeGlobalListener(index) {
  24912. globalChangeListeners.splice(index, 1);
  24913. }
  24914. function removeFunctionListener(index) {
  24915. functionsChangeListeners.splice(index);
  24916. }
  24917. /***/ }),
  24918. /***/ "./js/visualUI/globals.js":
  24919. /*!********************************!*\
  24920. !*** ./js/visualUI/globals.js ***!
  24921. \********************************/
  24922. /*! exports provided: addGlobal, renderGlobal */
  24923. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  24924. "use strict";
  24925. __webpack_require__.r(__webpack_exports__);
  24926. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGlobal", function() { return addGlobal; });
  24927. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderGlobal", function() { return renderGlobal; });
  24928. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  24929. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  24930. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  24931. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  24932. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  24933. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  24934. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  24935. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__);
  24936. window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  24937. var counter_new_globals = 0;
  24938. function addGlobal(program) {
  24939. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  24940. var new_global = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('new_global') + '_' + counter_new_globals, 1);
  24941. counter_new_globals++;
  24942. program.addGlobal(new_global);
  24943. var newe = renderGlobal(new_global);
  24944. if (is_from_click) {
  24945. newe.css('display', 'none');
  24946. newe.fadeIn();
  24947. }
  24948. }
  24949. function toggleConstant(global_var) {
  24950. global_var.is_constant = !global_var.is_constant;
  24951. }
  24952. function updateName(global_var, new_name, global_obj_dom) {
  24953. if (global_var.name == new_name) {
  24954. return;
  24955. }
  24956. if (isValidIdentifier(new_name)) {
  24957. if (globalNameAlreadyExists(new_name)) {
  24958. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_global_duplicated'));
  24959. } else {
  24960. global_var.name = new_name;
  24961. }
  24962. } else {
  24963. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  24964. }
  24965. }
  24966. function globalNameAlreadyExists(global_name) {
  24967. for (var i = 0; i < window.program_obj.globals.length; i++) {
  24968. if (window.program_obj.globals[i].name == global_name) {
  24969. return true;
  24970. }
  24971. }
  24972. return false;
  24973. }
  24974. function isValidIdentifier(identifier_str) {
  24975. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  24976. }
  24977. function updateType(global_var, new_type) {
  24978. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24979. global_var.type = new_type;
  24980. global_var.dimensions = new_dimensions;
  24981. if (new_dimensions > 0) {
  24982. global_var.rows = new_dimensions;
  24983. global_var.columns = 2;
  24984. }
  24985. updateInitialValues(global_var);
  24986. }
  24987. function removeGlobal(global_var, global_container) {
  24988. var index = window.program_obj.globals.indexOf(global_var);
  24989. if (index > -1) {
  24990. window.insertContext = true;
  24991. window.program_obj.globals.splice(index, 1);
  24992. }
  24993. global_container.children().off();
  24994. global_container.off();
  24995. global_container.fadeOut();
  24996. }
  24997. function updateInitialValues(global_var) {
  24998. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  24999. if (global_var.dimensions == 0) {
  25000. global_var.value = 1;
  25001. }
  25002. if (global_var.dimensions == 1) {
  25003. global_var.value = [1, 1];
  25004. }
  25005. if (global_var.dimensions == 2) {
  25006. global_var.value = [[1, 1], [1, 1]];
  25007. }
  25008. }
  25009. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25010. if (global_var.dimensions == 0) {
  25011. global_var.value = 1.0;
  25012. }
  25013. if (global_var.dimensions == 1) {
  25014. global_var.value = [1.0, 1.0];
  25015. }
  25016. if (global_var.dimensions == 2) {
  25017. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  25018. }
  25019. }
  25020. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25021. if (global_var.dimensions == 0) {
  25022. global_var.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start');
  25023. }
  25024. if (global_var.dimensions == 1) {
  25025. global_var.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')];
  25026. }
  25027. if (global_var.dimensions == 2) {
  25028. global_var.value = [[_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')], [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')]];
  25029. }
  25030. }
  25031. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25032. if (global_var.dimensions == 0) {
  25033. global_var.value = true;
  25034. }
  25035. if (global_var.dimensions == 1) {
  25036. global_var.value = [true, true];
  25037. }
  25038. if (global_var.dimensions == 2) {
  25039. global_var.value = [[true, true], [true, true]];
  25040. }
  25041. }
  25042. }
  25043. function alternateBooleanGlobalValue(global_var, value_container) {
  25044. global_var.value = !global_var.value;
  25045. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value));
  25046. }
  25047. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  25048. global_var.value[index] = !global_var.value[index];
  25049. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[index]));
  25050. }
  25051. function removeGlobalColumnVector(global_var) {
  25052. if (global_var.columns == 0) {
  25053. return;
  25054. }
  25055. global_var.columns--;
  25056. global_var.value.splice(global_var.value.length - 1, 1);
  25057. }
  25058. function addGlobalColumnVector(global_var) {
  25059. global_var.columns++;
  25060. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25061. global_var.value.push(1);
  25062. }
  25063. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25064. global_var.value.push(1.0);
  25065. }
  25066. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25067. global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25068. }
  25069. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25070. global_var.value.push(true);
  25071. }
  25072. }
  25073. function removeColumnGlobalMatrix(global_var) {
  25074. if (global_var.columns == 0) {
  25075. return;
  25076. }
  25077. global_var.columns--;
  25078. for (var i = 0; i < global_var.rows; i++) {
  25079. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  25080. }
  25081. }
  25082. function addColumnGlobalMatrix(global_var) {
  25083. global_var.columns++;
  25084. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25085. for (var i = 0; i < global_var.rows; i++) {
  25086. global_var.value[i].push(1);
  25087. }
  25088. }
  25089. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25090. for (var i = 0; i < global_var.rows; i++) {
  25091. global_var.value[i].push(1.0);
  25092. }
  25093. }
  25094. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25095. for (var i = 0; i < global_var.rows; i++) {
  25096. global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25097. }
  25098. }
  25099. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25100. for (var i = 0; i < global_var.rows; i++) {
  25101. global_var.value[i].push(true);
  25102. }
  25103. }
  25104. }
  25105. function removeLineGlobalMatrix(global_var) {
  25106. if (global_var.rows == 0) {
  25107. return;
  25108. }
  25109. global_var.rows--;
  25110. global_var.value.splice(global_var.value.length - 1, 1);
  25111. }
  25112. function addLineGlobalMatrix(global_var) {
  25113. global_var.rows++;
  25114. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25115. var n_l = [];
  25116. for (var i = 0; i < global_var.columns; i++) {
  25117. n_l.push(1);
  25118. }
  25119. global_var.value.push(n_l);
  25120. }
  25121. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25122. var n_l = [];
  25123. for (i = 0; i < global_var.columns; i++) {
  25124. n_l.push(1.0);
  25125. }
  25126. global_var.value.push(n_l);
  25127. }
  25128. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25129. var n_l = [];
  25130. for (i = 0; i < global_var.columns; i++) {
  25131. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25132. }
  25133. global_var.value.push(n_l);
  25134. }
  25135. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25136. var n_l = [];
  25137. for (i = 0; i < global_var.columns; i++) {
  25138. n_l.push(true);
  25139. }
  25140. global_var.value.push(n_l);
  25141. }
  25142. }
  25143. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  25144. global_var.value[row][index] = !global_var.value[row][index];
  25145. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[row][index]));
  25146. }
  25147. function renderValues(global_var, global_container) {
  25148. var ret = "";
  25149. var j = 0;
  25150. if (global_var.dimensions == 0) {
  25151. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25152. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  25153. } else {
  25154. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25155. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value) + '</span> </div> ';
  25156. } else {
  25157. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  25158. }
  25159. }
  25160. } else {
  25161. ret += '<table class="tabela_var">';
  25162. if (global_var.dimensions == 1) {
  25163. ret += '<tr>';
  25164. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25165. for (var k = 0; k < global_var.columns; k++) {
  25166. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  25167. }
  25168. } else {
  25169. for (var k = 0; k < global_var.columns; k++) {
  25170. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25171. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[k]) + '</span></td>';
  25172. } else {
  25173. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  25174. }
  25175. }
  25176. }
  25177. ret += '</tr>';
  25178. ret += '</table>';
  25179. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_vector_column"></i>' + ' <i class="ui icon plus square outline add_global_vector_column"></i></div>';
  25180. }
  25181. if (global_var.dimensions == 2) {
  25182. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25183. for (var l = 0; l < global_var.rows; l++) {
  25184. ret += '<tr>';
  25185. for (var k = 0; k < global_var.columns; k++) {
  25186. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  25187. }
  25188. ret += '</tr>';
  25189. }
  25190. } else {
  25191. for (var l = 0; l < global_var.rows; l++) {
  25192. ret += '<tr>';
  25193. for (var k = 0; k < global_var.columns; k++) {
  25194. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25195. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[l][k]) + '</span></td>';
  25196. } else {
  25197. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  25198. }
  25199. }
  25200. ret += '</tr>';
  25201. }
  25202. }
  25203. if (global_var.rows == 0) {
  25204. ret += '<tr><td></td></tr>';
  25205. }
  25206. ret += '<tr><td colspan="' + global_var.columns + '" class="tr_manage_lines"><i class="ui icon minus square outline remove_global_matrix_line"></i>' + ' <i class="ui icon plus square outline add_global_matrix_line"></i></td></tr>';
  25207. ret += '</table>';
  25208. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_matrix_column"></i>' + ' <i class="ui icon plus square outline add_global_matrix_column"></i></div>';
  25209. }
  25210. }
  25211. global_container.find(".div_valor_var").html('');
  25212. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  25213. ret.find('.span_value_variable').data('associatedOject', global_var);
  25214. ret.find(".boolean_simple_type").on('click', function (e) {
  25215. alternateBooleanGlobalValue(global_var, this.parentNode);
  25216. });
  25217. ret.find(".simple_var").on('click', function (e) {
  25218. enableGlobalValueUpdate(global_var, this.parentNode);
  25219. });
  25220. ret.find(".boolean_vector_var").on('click', function (e) {
  25221. alternateBooleanGlobalVectorValue(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25222. });
  25223. ret.find(".vector_var").on('click', function (e) {
  25224. enableGlobalVectorValueUpdate(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25225. });
  25226. ret.find(".remove_global_vector_column").on('click', function (e) {
  25227. removeGlobalColumnVector(global_var);
  25228. global_container.find(".div_valor_var").html('');
  25229. renderValues(global_var, global_container);
  25230. });
  25231. ret.find(".add_global_vector_column").on('click', function (e) {
  25232. addGlobalColumnVector(global_var);
  25233. global_container.find(".div_valor_var").html('');
  25234. renderValues(global_var, global_container);
  25235. });
  25236. ret.find(".remove_global_matrix_column").on('click', function (e) {
  25237. removeColumnGlobalMatrix(global_var);
  25238. global_container.find(".div_valor_var").html('');
  25239. renderValues(global_var, global_container);
  25240. });
  25241. ret.find(".add_global_matrix_column").on('click', function (e) {
  25242. addColumnGlobalMatrix(global_var);
  25243. global_container.find(".div_valor_var").html('');
  25244. renderValues(global_var, global_container);
  25245. });
  25246. ret.find(".remove_global_matrix_line").on('click', function (e) {
  25247. removeLineGlobalMatrix(global_var);
  25248. global_container.find(".div_valor_var").html('');
  25249. renderValues(global_var, global_container);
  25250. });
  25251. ret.find(".add_global_matrix_line").on('click', function (e) {
  25252. addLineGlobalMatrix(global_var);
  25253. global_container.find(".div_valor_var").html('');
  25254. renderValues(global_var, global_container);
  25255. });
  25256. ret.find(".boolean_matrix_var").on('click', function (e) {
  25257. alternateBooleanGlobalMatrixValue(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25258. });
  25259. ret.find(".matrix_var").on('click', function (e) {
  25260. enableGlobalMatrixValueUpdate(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25261. });
  25262. global_container.find(".div_valor_var").append(ret);
  25263. updateColumnsAndRowsText(global_container, global_var);
  25264. }
  25265. function addHandlers(global_container) {
  25266. var global_var = global_container.data('associatedOject'); // Manage constant option:
  25267. global_container.find(".alternate_constant").on('click', function (e) {
  25268. toggleConstant(global_var);
  25269. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).removeClass("on off");
  25270. if (global_var.is_constant) {
  25271. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).addClass("on");
  25272. } else {
  25273. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).addClass("off");
  25274. }
  25275. }); // Manage global name:
  25276. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  25277. enableNameUpdate(global_container);
  25278. }); // Menu to change type:
  25279. global_container.find('.ui.dropdown.global_type').dropdown({
  25280. onChange: function onChange(value, text, $selectedItem) {
  25281. if ($selectedItem.data('dimensions')) {
  25282. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  25283. } else {
  25284. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  25285. }
  25286. renderValues(global_var, global_container);
  25287. },
  25288. selectOnKeydown: false
  25289. }); // Remove global:
  25290. global_container.find(".remove_global").on('click', function (e) {
  25291. removeGlobal(global_var, global_container);
  25292. });
  25293. }
  25294. function updateColumnsAndRowsText(global_container, global_var) {
  25295. var prev = global_container.find('.text').text().split('[');
  25296. if (prev.length == 2) {
  25297. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  25298. global_container.find('.text').empty();
  25299. global_container.find('.text').text(ff);
  25300. }
  25301. if (prev.length == 3) {
  25302. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  25303. global_container.find('.text').empty();
  25304. global_container.find('.text').text(ff);
  25305. }
  25306. }
  25307. function renderGlobal(global_var) {
  25308. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  25309. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  25310. element += '<div class="ui dropdown global_type">';
  25311. if (global_var.dimensions > 0) {
  25312. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.type);
  25313. for (var i = 0; i < global_var.dimensions; i++) {
  25314. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  25315. }
  25316. element += '</div>';
  25317. } else {
  25318. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.type.toLowerCase()) + '</div>';
  25319. }
  25320. element += '<div class="menu">';
  25321. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25322. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25323. continue;
  25324. }
  25325. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  25326. }
  25327. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25328. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25329. continue;
  25330. }
  25331. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  25332. }
  25333. element += '</div></div> <div class="editing_name_var"> <span class="span_name_variable enable_edit_name_parameter">' + global_var.name + '</span> </div> <span class="character_equals"> = </span> ';
  25334. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  25335. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  25336. var complete_element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  25337. complete_element.data('associatedOject', global_var);
  25338. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').append(complete_element);
  25339. addHandlers(complete_element);
  25340. renderValues(global_var, complete_element);
  25341. if (global_var.dimensions == 1) {
  25342. complete_element.find('.dimensions_0').text(global_var.columns);
  25343. }
  25344. if (global_var.dimensions == 2) {
  25345. complete_element.find('.dimensions_0').text(global_var.columns);
  25346. complete_element.find('.dimensions_1').text(global_var.rows);
  25347. }
  25348. return complete_element;
  25349. }
  25350. var opened_name_value_matrix_global_v = false;
  25351. var opened_input_value_matrix_global_v = null;
  25352. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  25353. if (opened_name_value_matrix_global_v) {
  25354. opened_input_value_matrix_global_v.focus();
  25355. return;
  25356. }
  25357. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25358. opened_name_value_matrix_global_v = true;
  25359. parent_node.find('.span_value_variable').text('');
  25360. var input_field;
  25361. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25362. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index].toFixed(1) + "' />");
  25363. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25364. } else {
  25365. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />");
  25366. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25367. }
  25368. input_field.on('input', function () {
  25369. var inputWidth = input_field.textWidth() + 10;
  25370. opened_input_value_matrix_global_v = input_field;
  25371. input_field.focus();
  25372. var tmpStr = input_field.val();
  25373. input_field.val('');
  25374. input_field.val(tmpStr);
  25375. input_field.css({
  25376. width: inputWidth
  25377. });
  25378. }).trigger('input');
  25379. input_field.focusout(function () {
  25380. /// update array:
  25381. if (input_field.val().trim()) {
  25382. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25383. global_var.value[row][index] = parseFloat(input_field.val().trim());
  25384. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25385. } else {
  25386. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25387. global_var.value[row][index] = parseInt(input_field.val().trim());
  25388. } else {
  25389. global_var.value[row][index] = input_field.val().trim();
  25390. }
  25391. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25392. }
  25393. } else {
  25394. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25395. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25396. } else {
  25397. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25398. }
  25399. }
  25400. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25401. global_var.value[row][index] = input_field.val();
  25402. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25403. }
  25404. input_field.off();
  25405. input_field.remove(); /// update elements:
  25406. opened_name_value_matrix_global_v = false;
  25407. opened_input_value_matrix_global_v = false;
  25408. });
  25409. input_field.on('keydown', function (e) {
  25410. var code = e.keyCode || e.which;
  25411. if (code == 13) {
  25412. if (input_field.val().trim()) {
  25413. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25414. global_var.value[row][index] = parseFloat(input_field.val().trim());
  25415. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25416. } else {
  25417. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25418. global_var.value[row][index] = parseInt(input_field.val().trim());
  25419. } else {
  25420. global_var.value[row][index] = input_field.val().trim();
  25421. }
  25422. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25423. }
  25424. } else {
  25425. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25426. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25427. } else {
  25428. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25429. }
  25430. }
  25431. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25432. global_var.value[row][index] = input_field.val();
  25433. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25434. }
  25435. input_field.off();
  25436. input_field.remove(); /// update elements:
  25437. opened_name_value_matrix_global_v = false;
  25438. opened_input_value_matrix_global_v = false;
  25439. }
  25440. if (code == 27) {
  25441. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25442. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25443. } else {
  25444. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25445. }
  25446. input_field.off();
  25447. input_field.remove(); /// update elements:
  25448. opened_name_value_matrix_global_v = false;
  25449. opened_input_value_matrix_global_v = false;
  25450. }
  25451. });
  25452. input_field.select();
  25453. }
  25454. var opened_name_value_global_var = false;
  25455. var opened_input_value_global_ar = null;
  25456. function enableGlobalValueUpdate(global_var, parent_node) {
  25457. if (opened_name_value_global_var) {
  25458. opened_input_value_global_ar.focus();
  25459. return;
  25460. }
  25461. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25462. opened_name_value_global_var = true;
  25463. parent_node.find('.span_value_variable').text('');
  25464. var input_field;
  25465. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25466. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value.toFixed(1) + "' />");
  25467. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25468. } else {
  25469. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  25470. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25471. }
  25472. input_field.on('input', function () {
  25473. var inputWidth = input_field.textWidth() + 10;
  25474. opened_input_value_global_ar = input_field;
  25475. input_field.focus();
  25476. var tmpStr = input_field.val();
  25477. input_field.val('');
  25478. input_field.val(tmpStr);
  25479. input_field.css({
  25480. width: inputWidth
  25481. });
  25482. }).trigger('input');
  25483. input_field.focusout(function () {
  25484. /// update array:
  25485. if (input_field.val().trim()) {
  25486. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25487. global_var.value = parseFloat(input_field.val().trim());
  25488. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25489. } else {
  25490. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25491. global_var.value = parseInt(input_field.val().trim());
  25492. } else {
  25493. global_var.value = input_field.val().trim();
  25494. }
  25495. parent_node.find('.span_value_variable').text(global_var.value);
  25496. }
  25497. } else {
  25498. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25499. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25500. } else {
  25501. parent_node.find('.span_value_variable').text(global_var.value);
  25502. }
  25503. }
  25504. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25505. global_var.value = input_field.val();
  25506. parent_node.find('.span_value_variable').text(global_var.value);
  25507. }
  25508. input_field.off();
  25509. input_field.remove(); /// update elements:
  25510. opened_name_value_global_var = false;
  25511. opened_input_value_global_ar = false;
  25512. });
  25513. input_field.on('keydown', function (e) {
  25514. var code = e.keyCode || e.which;
  25515. if (code == 13) {
  25516. if (input_field.val().trim()) {
  25517. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25518. global_var.value = parseFloat(input_field.val().trim());
  25519. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25520. } else {
  25521. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25522. global_var.value = parseInt(input_field.val().trim());
  25523. } else {
  25524. global_var.value = input_field.val().trim();
  25525. }
  25526. parent_node.find('.span_value_variable').text(global_var.value);
  25527. }
  25528. } else {
  25529. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25530. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25531. } else {
  25532. parent_node.find('.span_value_variable').text(global_var.value);
  25533. }
  25534. }
  25535. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25536. global_var.value = input_field.val();
  25537. parent_node.find('.span_value_variable').text(global_var.value);
  25538. }
  25539. input_field.off();
  25540. input_field.remove(); /// update elements:
  25541. opened_name_value_global_var = false;
  25542. opened_input_value_global_ar = false;
  25543. }
  25544. if (code == 27) {
  25545. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25546. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  25547. } else {
  25548. parent_node.find('.span_value_variable').text(global_var.value);
  25549. }
  25550. input_field.off();
  25551. input_field.remove(); /// update elements:
  25552. opened_name_value_global_var = false;
  25553. opened_input_value_global_ar = false;
  25554. }
  25555. });
  25556. input_field.select();
  25557. }
  25558. var opened_name_global = false;
  25559. var opened_input_global = null;
  25560. function enableNameUpdate(global_container) {
  25561. var global_var = global_container.data('associatedOject');
  25562. if (opened_name_global) {
  25563. opened_input_global.focus();
  25564. return;
  25565. }
  25566. opened_name_global = true;
  25567. global_container.find('.span_name_variable').text('');
  25568. var input_name = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  25569. input_name.insertBefore(global_container.find('.span_name_variable'));
  25570. input_name.on('input', function () {
  25571. var inputWidth = input_name.textWidth() + 10;
  25572. opened_input_global = input_name;
  25573. opened_input_global.focus();
  25574. opened_input_global.css({
  25575. width: inputWidth
  25576. });
  25577. }).trigger('input');
  25578. input_name.focusout(function () {
  25579. /// update array:
  25580. if (input_name.val().trim().length > 0) {
  25581. updateName(global_var, input_name.val().trim(), global_container);
  25582. global_container.find('.span_name_variable').text(global_var.name);
  25583. } else {
  25584. global_container.find('.span_name_variable').text(global_var.name);
  25585. }
  25586. input_name.off();
  25587. input_name.remove(); /// update elements:
  25588. opened_name_global = false;
  25589. opened_input_global = false;
  25590. });
  25591. input_name.on('keydown', function (e) {
  25592. var code = e.keyCode || e.which;
  25593. if (code == 13) {
  25594. if (input_name.val().trim()) {
  25595. updateName(global_var, input_name.val().trim(), global_container);
  25596. global_container.find('.span_name_variable').text(global_var.name);
  25597. } else {
  25598. global_container.find('.span_name_variable').text(global_var.name);
  25599. }
  25600. input_name.off();
  25601. input_name.remove(); /// update elements:
  25602. opened_name_global = false;
  25603. opened_input_global = false;
  25604. }
  25605. if (code == 27) {
  25606. global_container.find('.span_name_variable').text(global_var.name);
  25607. input_name.off();
  25608. input_name.remove(); /// update elements:
  25609. opened_name_global = false;
  25610. opened_input_global = false;
  25611. }
  25612. });
  25613. input_name.select();
  25614. }
  25615. var opened_name_value_vector_global_ = false;
  25616. var opened_input_value_vector_global_ = null;
  25617. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  25618. if (opened_name_value_vector_global_) {
  25619. opened_input_value_vector_global_.focus();
  25620. return;
  25621. }
  25622. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25623. opened_name_value_vector_global_ = true;
  25624. parent_node.find('.span_value_variable').text('');
  25625. var input_field;
  25626. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25627. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index].toFixed(1) + "' />");
  25628. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25629. } else {
  25630. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
  25631. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25632. }
  25633. input_field.on('input', function () {
  25634. var inputWidth = input_field.textWidth() + 10;
  25635. opened_input_value_vector_global_ = input_field;
  25636. input_field.focus();
  25637. var tmpStr = input_field.val();
  25638. input_field.val('');
  25639. input_field.val(tmpStr);
  25640. input_field.css({
  25641. width: inputWidth
  25642. });
  25643. }).trigger('input');
  25644. input_field.focusout(function () {
  25645. /// update array:
  25646. if (input_field.val().trim()) {
  25647. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25648. global_var.value[index] = parseFloat(input_field.val().trim());
  25649. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25650. } else {
  25651. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25652. global_var.value[index] = parseInt(input_field.val().trim());
  25653. } else {
  25654. global_var.value[index] = input_field.val().trim();
  25655. }
  25656. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25657. }
  25658. } else {
  25659. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25660. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25661. } else {
  25662. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25663. }
  25664. }
  25665. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25666. global_var.value[index] = input_field.val();
  25667. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25668. }
  25669. input_field.off();
  25670. input_field.remove(); /// update elements:
  25671. opened_name_value_vector_global_ = false;
  25672. opened_input_value_vector_global_ = false;
  25673. });
  25674. input_field.on('keydown', function (e) {
  25675. var code = e.keyCode || e.which;
  25676. if (code == 13) {
  25677. if (input_field.val().trim()) {
  25678. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25679. global_var.value[index] = parseFloat(input_field.val().trim());
  25680. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25681. } else {
  25682. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25683. global_var.value[index] = parseInt(input_field.val().trim());
  25684. } else {
  25685. global_var.value[index] = input_field.val().trim();
  25686. }
  25687. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25688. }
  25689. } else {
  25690. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25691. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25692. } else {
  25693. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25694. }
  25695. }
  25696. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25697. global_var.value[index] = input_field.val();
  25698. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25699. }
  25700. input_field.off();
  25701. input_field.remove(); /// update elements:
  25702. opened_name_value_vector_global_ = false;
  25703. opened_input_value_vector_global_ = false;
  25704. }
  25705. if (code == 27) {
  25706. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25707. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  25708. } else {
  25709. parent_node.find('.span_value_variable').text(global_var.value[index]);
  25710. }
  25711. input_field.off();
  25712. input_field.remove(); /// update elements:
  25713. opened_name_value_vector_global_ = false;
  25714. opened_input_value_vector_global_ = false;
  25715. }
  25716. });
  25717. input_field.select();
  25718. }
  25719. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth = function (text, font) {
  25720. if (!jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl) jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span>').hide().appendTo(document.body);
  25721. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  25722. return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.width();
  25723. };
  25724. /***/ }),
  25725. /***/ "./js/visualUI/ivprog_elements.js":
  25726. /*!****************************************!*\
  25727. !*** ./js/visualUI/ivprog_elements.js ***!
  25728. \****************************************/
  25729. /*! exports provided: COMMAND_TYPES, ARITHMETIC_TYPES, EXPRESSION_ELEMENTS, EXPRESSION_TYPES, ARITHMETIC_COMPARISON, LOGIC_COMPARISON, SYSTEM_FUNCTIONS_CATEGORIES, Variable, Function, SystemFunction, Comment, Break, Reader, Writer, Attribution, ExpressionElement, ConditionalExpression, LogicExpression, ArithmeticExpression, IfTrue, RepeatNTimes, WhileTrue, DoWhileTrue, Switch, Return, SwitchCase, FunctionCall, VariableValueMenu, FunctionCallMenu, Program */
  25730. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  25731. "use strict";
  25732. __webpack_require__.r(__webpack_exports__);
  25733. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMMAND_TYPES", function() { return COMMAND_TYPES; });
  25734. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARITHMETIC_TYPES", function() { return ARITHMETIC_TYPES; });
  25735. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXPRESSION_ELEMENTS", function() { return EXPRESSION_ELEMENTS; });
  25736. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXPRESSION_TYPES", function() { return EXPRESSION_TYPES; });
  25737. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARITHMETIC_COMPARISON", function() { return ARITHMETIC_COMPARISON; });
  25738. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOGIC_COMPARISON", function() { return LOGIC_COMPARISON; });
  25739. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SYSTEM_FUNCTIONS_CATEGORIES", function() { return SYSTEM_FUNCTIONS_CATEGORIES; });
  25740. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Variable", function() { return Variable; });
  25741. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return Function; });
  25742. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemFunction", function() { return SystemFunction; });
  25743. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Comment", function() { return Comment; });
  25744. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return Break; });
  25745. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reader", function() { return Reader; });
  25746. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Writer", function() { return Writer; });
  25747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribution", function() { return Attribution; });
  25748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionElement", function() { return ExpressionElement; });
  25749. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConditionalExpression", function() { return ConditionalExpression; });
  25750. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogicExpression", function() { return LogicExpression; });
  25751. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArithmeticExpression", function() { return ArithmeticExpression; });
  25752. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfTrue", function() { return IfTrue; });
  25753. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RepeatNTimes", function() { return RepeatNTimes; });
  25754. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WhileTrue", function() { return WhileTrue; });
  25755. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DoWhileTrue", function() { return DoWhileTrue; });
  25756. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return Switch; });
  25757. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return Return; });
  25758. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SwitchCase", function() { return SwitchCase; });
  25759. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return FunctionCall; });
  25760. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableValueMenu", function() { return VariableValueMenu; });
  25761. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCallMenu", function() { return FunctionCallMenu; });
  25762. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Program", function() { return Program; });
  25763. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  25764. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  25765. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  25766. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_2__);
  25767. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  25768. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  25769. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  25770. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  25771. var COMMAND_TYPES = Object.freeze({
  25772. function: "function",
  25773. comment: "comment",
  25774. reader: "reader",
  25775. writer: "writer",
  25776. attribution: "attribution",
  25777. iftrue: "iftrue",
  25778. repeatNtimes: "repeatNtimes",
  25779. whiletrue: "whiletrue",
  25780. dowhiletrue: "dowhiletrue",
  25781. switch: "switch",
  25782. switchcase: "switchcase",
  25783. functioncall: "functioncall",
  25784. break: "break",
  25785. return: "return"
  25786. });
  25787. var ARITHMETIC_TYPES = Object.freeze({
  25788. plus: "plus",
  25789. minus: "minus",
  25790. multiplication: "multiplication",
  25791. division: "division",
  25792. module: "module",
  25793. none: "none"
  25794. });
  25795. var EXPRESSION_ELEMENTS = Object.freeze({
  25796. exp_op_exp: "exp_op_exp",
  25797. op_exp: "op_exp",
  25798. par_exp_par: "par_exp_par",
  25799. start_point: "start_point"
  25800. });
  25801. var EXPRESSION_TYPES = Object.freeze({
  25802. exp_conditional: "exp_conditional",
  25803. exp_logic: "exp_logic",
  25804. exp_arithmetic: "exp_arithmetic"
  25805. });
  25806. var ARITHMETIC_COMPARISON = Object.freeze({
  25807. greater_than: "greater_than",
  25808. less_than: "less_than",
  25809. equals_to: "equals_to",
  25810. not_equals_to: "not_equals_to",
  25811. greater_than_or_equals_to: "greater_than_or_equals_to",
  25812. less_than_or_equals_to: "less_than_or_equals_to"
  25813. });
  25814. var LOGIC_COMPARISON = Object.freeze({
  25815. equals_to: "equals_to",
  25816. not_equals_to: "not_equals_to",
  25817. and: "and",
  25818. or: "or"
  25819. });
  25820. var SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({
  25821. math: "math",
  25822. text: "text_t",
  25823. arrangement: "arrangement",
  25824. conversion: "conversion"
  25825. });
  25826. var Variable = function Variable(type, name, value) {
  25827. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  25828. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  25829. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  25830. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  25831. _classCallCheck(this, Variable);
  25832. this.type = type;
  25833. this.name = name;
  25834. this.value = value;
  25835. this.dimensions = dimensions;
  25836. this.is_constant = is_constant;
  25837. this.rows = rows;
  25838. this.columns = columns;
  25839. };
  25840. var Function = function Function(name) {
  25841. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID;
  25842. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  25843. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  25844. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  25845. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  25846. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  25847. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  25848. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  25849. _classCallCheck(this, Function);
  25850. this.type = COMMAND_TYPES.function;
  25851. this.name = name;
  25852. this.return_type = return_type;
  25853. this.return_dimensions = return_dimensions;
  25854. this.parameters_list = parameters_list;
  25855. this.is_main = is_main;
  25856. this.is_hidden = is_hidden;
  25857. this.variables_list = variables_list;
  25858. this.function_comment = function_comment;
  25859. this.commands = commands;
  25860. };
  25861. var SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  25862. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  25863. var category = arguments.length > 5 ? arguments[5] : undefined;
  25864. _classCallCheck(this, SystemFunction);
  25865. this.type = COMMAND_TYPES.function;
  25866. this.identifier = identifier;
  25867. this.return_type = return_type;
  25868. this.return_dimensions = return_dimensions;
  25869. this.parameters_list = parameters_list;
  25870. this.function_comment = function_comment;
  25871. this.category = category;
  25872. };
  25873. var Comment = function Comment(comment_text) {
  25874. _classCallCheck(this, Comment);
  25875. this.type = COMMAND_TYPES.comment;
  25876. this.comment_text = comment_text;
  25877. };
  25878. var Break = function Break() {
  25879. _classCallCheck(this, Break);
  25880. this.type = COMMAND_TYPES.break;
  25881. };
  25882. var Reader = function Reader() {
  25883. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  25884. _classCallCheck(this, Reader);
  25885. this.type = COMMAND_TYPES.reader;
  25886. this.variable_value_menu = variable_value_menu;
  25887. };
  25888. var Writer = function Writer(content) {
  25889. _classCallCheck(this, Writer);
  25890. this.type = COMMAND_TYPES.writer;
  25891. this.content = content;
  25892. };
  25893. var Attribution = function Attribution(variable) {
  25894. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25895. _classCallCheck(this, Attribution);
  25896. this.type = COMMAND_TYPES.attribution;
  25897. this.variable = variable;
  25898. this.expression = expression;
  25899. };
  25900. var ExpressionElement = function ExpressionElement(type_exp) {
  25901. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25902. _classCallCheck(this, ExpressionElement);
  25903. this.type_exp = type_exp;
  25904. this.itens = itens;
  25905. };
  25906. var ConditionalExpression = function ConditionalExpression(expression) {
  25907. _classCallCheck(this, ConditionalExpression);
  25908. this.type = EXPRESSION_TYPES.exp_conditional;
  25909. this.expression = expression;
  25910. };
  25911. var LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  25912. _classCallCheck(this, LogicExpression);
  25913. this.type = EXPRESSION_TYPES.exp_logic;
  25914. this.has_neg = has_neg;
  25915. this.first_operand = first_operand;
  25916. this.second_operand = second_operand;
  25917. this.operator = operator;
  25918. };
  25919. var ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  25920. _classCallCheck(this, ArithmeticExpression);
  25921. this.type = EXPRESSION_TYPES.exp_arithmetic;
  25922. this.first_operand = first_operand;
  25923. this.second_operand = second_operand;
  25924. this.operator = operator;
  25925. };
  25926. var IfTrue = function IfTrue(expression, commands_block, commands_else) {
  25927. _classCallCheck(this, IfTrue);
  25928. this.type = COMMAND_TYPES.iftrue;
  25929. this.expression = expression;
  25930. this.commands_block = commands_block;
  25931. this.commands_else = commands_else;
  25932. };
  25933. var RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  25934. _classCallCheck(this, RepeatNTimes);
  25935. this.type = COMMAND_TYPES.repeatNtimes;
  25936. this.var_attribution = var_attribution;
  25937. this.var_incrementation = var_incrementation;
  25938. this.expression1 = expression1;
  25939. this.expression2 = expression2;
  25940. this.expression3 = expression3;
  25941. this.commands_block = commands_block;
  25942. };
  25943. var WhileTrue = function WhileTrue(expression, commands_block) {
  25944. _classCallCheck(this, WhileTrue);
  25945. this.type = COMMAND_TYPES.whiletrue;
  25946. this.expression = expression;
  25947. this.commands_block = commands_block;
  25948. };
  25949. var DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  25950. _classCallCheck(this, DoWhileTrue);
  25951. this.type = COMMAND_TYPES.dowhiletrue;
  25952. this.expression = expression;
  25953. this.commands_block = commands_block;
  25954. };
  25955. var Switch = function Switch(variable) {
  25956. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25957. _classCallCheck(this, Switch);
  25958. this.type = COMMAND_TYPES.switch;
  25959. this.variable = variable;
  25960. this.cases = cases;
  25961. };
  25962. var Return = function Return(variable_value_menu) {
  25963. _classCallCheck(this, Return);
  25964. this.type = COMMAND_TYPES.return;
  25965. this.variable_value_menu = variable_value_menu;
  25966. };
  25967. var SwitchCase = function SwitchCase(variable_value_menu) {
  25968. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25969. _classCallCheck(this, SwitchCase);
  25970. this.type = COMMAND_TYPES.switchcase;
  25971. this.variable_value_menu = variable_value_menu;
  25972. this.commands_block = commands_block;
  25973. };
  25974. var FunctionCall = function FunctionCall(function_called, parameters_list) {
  25975. _classCallCheck(this, FunctionCall);
  25976. this.type = COMMAND_TYPES.functioncall;
  25977. this.function_called = function_called;
  25978. this.parameters_list = parameters_list;
  25979. };
  25980. var VariableValueMenu = function VariableValueMenu() {
  25981. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  25982. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  25983. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  25984. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  25985. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  25986. var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  25987. _classCallCheck(this, VariableValueMenu);
  25988. this.type = "var_value";
  25989. this.variable_and_value = variable_and_value;
  25990. this.content = content;
  25991. this.row = row;
  25992. this.column = column;
  25993. this.include_constant = include_constant;
  25994. this.dimensions = dimensions;
  25995. };
  25996. var FunctionCallMenu = function FunctionCallMenu() {
  25997. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  25998. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  25999. _classCallCheck(this, FunctionCallMenu);
  26000. this.type = "function_call";
  26001. this.function_called = function_called;
  26002. this.parameters_list = parameters_list;
  26003. };
  26004. var Program =
  26005. /*#__PURE__*/
  26006. function () {
  26007. function Program() {
  26008. _classCallCheck(this, Program);
  26009. this.functions = [];
  26010. this.globals = [];
  26011. }
  26012. _createClass(Program, [{
  26013. key: "addFunction",
  26014. value: function addFunction(function_to_add) {
  26015. melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default.a.watch(function_to_add.parameters_list, function () {
  26016. if (window.insertContext) {
  26017. setTimeout(function () {
  26018. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26019. }, 300);
  26020. window.insertContext = false;
  26021. } else {
  26022. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26023. }
  26024. }, 1);
  26025. melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default.a.watch(function_to_add.variables_list, function () {
  26026. if (window.insertContext) {
  26027. setTimeout(function () {
  26028. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26029. }, 300);
  26030. window.insertContext = false;
  26031. } else {
  26032. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26033. }
  26034. }, 1);
  26035. this.functions.push(function_to_add);
  26036. }
  26037. }, {
  26038. key: "addVariable",
  26039. value: function addVariable(function_to_receive, variable) {
  26040. if (this.functions[function_to_receive].variable === null) {
  26041. this.functions[function_to_receive].variables_list = [];
  26042. }
  26043. this.functions[function_to_receive].variables_list.push(variable);
  26044. }
  26045. }, {
  26046. key: "addGlobal",
  26047. value: function addGlobal(variable) {
  26048. this.globals.push(variable);
  26049. }
  26050. }]);
  26051. return Program;
  26052. }();
  26053. /***/ }),
  26054. /***/ "./js/visualUI/types.js":
  26055. /*!******************************!*\
  26056. !*** ./js/visualUI/types.js ***!
  26057. \******************************/
  26058. /*! exports provided: Types */
  26059. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26060. "use strict";
  26061. __webpack_require__.r(__webpack_exports__);
  26062. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Types", function() { return Types; });
  26063. var Types = Object.freeze({
  26064. INTEGER: "integer",
  26065. REAL: "real",
  26066. TEXT: "text",
  26067. BOOLEAN: "boolean",
  26068. VOID: "void"
  26069. });
  26070. /***/ }),
  26071. /***/ "./js/visualUI/utils.js":
  26072. /*!******************************!*\
  26073. !*** ./js/visualUI/utils.js ***!
  26074. \******************************/
  26075. /*! exports provided: renderErrorMessage */
  26076. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26077. "use strict";
  26078. __webpack_require__.r(__webpack_exports__);
  26079. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderErrorMessage", function() { return renderErrorMessage; });
  26080. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  26081. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  26082. function renderErrorMessage(dom_obj_target, message_text) {
  26083. dom_obj_target.popup({
  26084. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  26085. transition: "fade up",
  26086. on: 'click',
  26087. closable: true,
  26088. movePopup: true,
  26089. boundary: window,
  26090. preserve: false,
  26091. target: false,
  26092. className: {
  26093. popup: 'ui popup invalid-identifier'
  26094. },
  26095. onHidden: function onHidden($module) {
  26096. dom_obj_target.popup('destroy');
  26097. }
  26098. }).popup('toggle');
  26099. }
  26100. /***/ }),
  26101. /***/ "./js/visualUI/variables.js":
  26102. /*!**********************************!*\
  26103. !*** ./js/visualUI/variables.js ***!
  26104. \**********************************/
  26105. /*! exports provided: addVariable, renderVariable */
  26106. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26107. "use strict";
  26108. __webpack_require__.r(__webpack_exports__);
  26109. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVariable", function() { return addVariable; });
  26110. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderVariable", function() { return renderVariable; });
  26111. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  26112. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  26113. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  26114. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  26115. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  26116. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  26117. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  26118. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__);
  26119. window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  26120. var counter_new_variables = 0;
  26121. function addVariable(function_obj, function_container) {
  26122. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  26123. var new_var = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('new_variable') + '_' + counter_new_variables, 1);
  26124. if (function_obj.variables_list == null) {
  26125. function_obj.variables_list = [];
  26126. }
  26127. function_obj.variables_list.push(new_var);
  26128. counter_new_variables++;
  26129. var newe = renderVariable(function_container, new_var, function_obj);
  26130. if (is_in_click) {
  26131. newe.css('display', 'none');
  26132. newe.fadeIn();
  26133. }
  26134. }
  26135. function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
  26136. if (variable_obj.name == new_name) {
  26137. return;
  26138. }
  26139. if (isValidIdentifier(new_name)) {
  26140. if (variableNameAlreadyExists(new_name, function_obj)) {
  26141. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_variable_duplicated'));
  26142. } else {
  26143. variable_obj.name = new_name;
  26144. }
  26145. } else {
  26146. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  26147. }
  26148. }
  26149. function variableNameAlreadyExists(name_var, function_obj) {
  26150. if (function_obj.parameters_list) {
  26151. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  26152. if (function_obj.parameters_list[i].name == name_var) {
  26153. return true;
  26154. }
  26155. }
  26156. }
  26157. if (function_obj.variables_list) {
  26158. for (var i = 0; i < function_obj.variables_list.length; i++) {
  26159. if (function_obj.variables_list[i].name == name_var) {
  26160. return true;
  26161. }
  26162. }
  26163. }
  26164. return false;
  26165. }
  26166. function isValidIdentifier(identifier_str) {
  26167. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  26168. }
  26169. function removeVariable(variable_obj, variable_container) {
  26170. var function_associated = variable_container.data('associatedFunction');
  26171. var index = function_associated.variables_list.indexOf(variable_obj);
  26172. if (index > -1) {
  26173. window.insertContext = true;
  26174. delete function_associated.variables_list[index];
  26175. function_associated.variables_list.splice(index, 1);
  26176. }
  26177. variable_container.children().off();
  26178. variable_container.off();
  26179. variable_container.fadeOut();
  26180. }
  26181. function updateType(variable_obj, new_type) {
  26182. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  26183. variable_obj.type = new_type;
  26184. variable_obj.dimensions = new_dimensions;
  26185. if (new_dimensions > 0) {
  26186. variable_obj.rows = new_dimensions;
  26187. variable_obj.columns = 2;
  26188. }
  26189. updateInitialValues(variable_obj);
  26190. }
  26191. function addHandlers(variable_obj, variable_container, function_obj) {
  26192. // Manage variable name:
  26193. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  26194. enableNameUpdate(variable_obj, variable_container, function_obj);
  26195. }); // Menu to change type:
  26196. variable_container.find('.ui.dropdown.variable_type').dropdown({
  26197. onChange: function onChange(value, text, $selectedItem) {
  26198. if ($selectedItem.data('dimensions')) {
  26199. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  26200. } else {
  26201. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  26202. }
  26203. renderValues(variable_obj, variable_container);
  26204. },
  26205. selectOnKeydown: false
  26206. }); // Remove variable:
  26207. variable_container.find(".remove_variable").on('click', function (e) {
  26208. removeVariable(variable_obj, variable_container);
  26209. });
  26210. }
  26211. function renderVariable(function_container, new_var, function_obj) {
  26212. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  26213. element += '<div class="ui dropdown variable_type">';
  26214. if (new_var.dimensions > 0) {
  26215. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.type.toLowerCase());
  26216. for (var i = 0; i < new_var.dimensions; i++) {
  26217. element += ' [ ] ';
  26218. }
  26219. element += '</div>';
  26220. } else {
  26221. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.type.toLowerCase()) + '</div>';
  26222. }
  26223. element += '<div class="menu">';
  26224. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  26225. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  26226. continue;
  26227. }
  26228. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  26229. }
  26230. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  26231. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  26232. continue;
  26233. }
  26234. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  26235. }
  26236. element += '</div></div> ';
  26237. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  26238. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  26239. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  26240. element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  26241. element.data('associatedFunction', function_obj);
  26242. function_container.find('.variables_list_div').append(element);
  26243. addHandlers(new_var, element, function_obj);
  26244. renderValues(new_var, element);
  26245. return element;
  26246. }
  26247. function updateColumnsAndRowsText(variable_container, variable_var) {
  26248. var prev = variable_container.find('.text').text().split('[');
  26249. if (prev.length == 2) {
  26250. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  26251. variable_container.find('.text').empty();
  26252. variable_container.find('.text').text(ff);
  26253. }
  26254. if (prev.length == 3) {
  26255. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  26256. variable_container.find('.text').empty();
  26257. variable_container.find('.text').text(ff);
  26258. }
  26259. }
  26260. function renderValues(new_var, variable_container) {
  26261. var ret = "";
  26262. var j = 0;
  26263. if (new_var.dimensions == 0) {
  26264. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26265. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  26266. } else {
  26267. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26268. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value) + '</span> </div> ';
  26269. } else {
  26270. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  26271. }
  26272. }
  26273. } else {
  26274. ret += '<table class="tabela_var">';
  26275. if (new_var.dimensions == 1) {
  26276. ret += '<tr>';
  26277. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26278. for (var k = 0; k < new_var.columns; k++) {
  26279. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  26280. }
  26281. } else {
  26282. for (var k = 0; k < new_var.columns; k++) {
  26283. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26284. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value[k]) + '</span></td>';
  26285. } else {
  26286. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  26287. }
  26288. }
  26289. }
  26290. ret += '</tr>';
  26291. ret += '</table>';
  26292. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_vector_column"></i>' + ' <i class="ui icon plus square outline add_global_vector_column"></i></div>';
  26293. }
  26294. if (new_var.dimensions == 2) {
  26295. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26296. for (var l = 0; l < new_var.rows; l++) {
  26297. ret += '<tr>';
  26298. for (var k = 0; k < new_var.columns; k++) {
  26299. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  26300. }
  26301. ret += '</tr>';
  26302. }
  26303. } else {
  26304. for (var l = 0; l < new_var.rows; l++) {
  26305. ret += '<tr>';
  26306. for (var k = 0; k < new_var.columns; k++) {
  26307. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26308. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value[l][k]) + '</span></td>';
  26309. } else {
  26310. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  26311. }
  26312. }
  26313. ret += '</tr>';
  26314. }
  26315. }
  26316. if (new_var.rows == 0) {
  26317. ret += '<tr><td></td></tr>';
  26318. }
  26319. ret += '<tr><td colspan="' + new_var.columns + '" class="tr_manage_lines"><i class="ui icon minus square outline remove_global_matrix_line"></i>' + ' <i class="ui icon plus square outline add_global_matrix_line"></i></td></tr>';
  26320. ret += '</table>';
  26321. ret += '<div class="buttons_manage_columns"><i class="ui icon minus square outline remove_global_matrix_column"></i>' + ' <i class="ui icon plus square outline add_global_matrix_column"></i></div>';
  26322. }
  26323. }
  26324. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26325. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  26326. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find('.span_value_variable').data('associatedOject', new_var);
  26327. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_simple_type").on('click', function (e) {
  26328. alternateBooleanValue(new_var, this.parentNode);
  26329. });
  26330. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".simple_var").on('click', function (e) {
  26331. enableValueUpdate(new_var, this.parentNode);
  26332. });
  26333. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_vector_var").on('click', function (e) {
  26334. alternateBooleanVectorValue(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26335. });
  26336. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".vector_var").on('click', function (e) {
  26337. enableVectorValueUpdate(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26338. });
  26339. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_vector_column").on('click', function (e) {
  26340. removeColumnVector(new_var);
  26341. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26342. renderValues(new_var, variable_container);
  26343. });
  26344. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_vector_column").on('click', function (e) {
  26345. addColumnVector(new_var);
  26346. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26347. renderValues(new_var, variable_container);
  26348. });
  26349. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_matrix_column").on('click', function (e) {
  26350. removeColumnMatrix(new_var);
  26351. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26352. renderValues(new_var, variable_container);
  26353. });
  26354. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_matrix_column").on('click', function (e) {
  26355. addColumnMatrix(new_var);
  26356. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26357. renderValues(new_var, variable_container);
  26358. });
  26359. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_matrix_line").on('click', function (e) {
  26360. removeLineMatrix(new_var);
  26361. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26362. renderValues(new_var, variable_container);
  26363. });
  26364. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_matrix_line").on('click', function (e) {
  26365. addLineMatrix(new_var);
  26366. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26367. renderValues(new_var, variable_container);
  26368. });
  26369. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_matrix_var").on('click', function (e) {
  26370. alternateBooleanMatrixValue(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26371. });
  26372. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".matrix_var").on('click', function (e) {
  26373. enableMatrixValueUpdate(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26374. });
  26375. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").append(ret);
  26376. updateColumnsAndRowsText(variable_container, new_var);
  26377. }
  26378. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  26379. var_obj.value[row][index] = !var_obj.value[row][index];
  26380. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value[row][index]));
  26381. }
  26382. function addLineMatrix(var_obj) {
  26383. var_obj.rows++;
  26384. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26385. var n_l = [];
  26386. for (var i = 0; i < var_obj.columns; i++) {
  26387. n_l.push(1);
  26388. }
  26389. var_obj.value.push(n_l);
  26390. }
  26391. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26392. var n_l = [];
  26393. for (i = 0; i < var_obj.columns; i++) {
  26394. n_l.push(1.0);
  26395. }
  26396. var_obj.value.push(n_l);
  26397. }
  26398. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26399. var n_l = [];
  26400. for (i = 0; i < var_obj.columns; i++) {
  26401. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26402. }
  26403. var_obj.value.push(n_l);
  26404. }
  26405. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26406. var n_l = [];
  26407. for (i = 0; i < var_obj.columns; i++) {
  26408. n_l.push(true);
  26409. }
  26410. var_obj.value.push(n_l);
  26411. }
  26412. }
  26413. function removeLineMatrix(var_obj) {
  26414. if (var_obj.rows == 0) {
  26415. return;
  26416. }
  26417. var_obj.rows--;
  26418. var_obj.value.splice(var_obj.value.length - 1, 1);
  26419. }
  26420. function addColumnMatrix(var_obj) {
  26421. var_obj.columns++;
  26422. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26423. for (var i = 0; i < var_obj.rows; i++) {
  26424. var_obj.value[i].push(1);
  26425. }
  26426. }
  26427. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26428. for (var i = 0; i < var_obj.rows; i++) {
  26429. var_obj.value[i].push(1.0);
  26430. }
  26431. }
  26432. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26433. for (var i = 0; i < var_obj.rows; i++) {
  26434. var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26435. }
  26436. }
  26437. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26438. for (var i = 0; i < var_obj.rows; i++) {
  26439. var_obj.value[i].push(true);
  26440. }
  26441. }
  26442. }
  26443. function removeColumnMatrix(var_obj) {
  26444. if (var_obj.columns == 0) {
  26445. return;
  26446. }
  26447. var_obj.columns--;
  26448. for (var i = 0; i < var_obj.rows; i++) {
  26449. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  26450. }
  26451. }
  26452. function addColumnVector(var_obj) {
  26453. var_obj.columns++;
  26454. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26455. var_obj.value.push(1);
  26456. }
  26457. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26458. var_obj.value.push(1.0);
  26459. }
  26460. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26461. var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26462. }
  26463. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26464. var_obj.value.push(true);
  26465. }
  26466. }
  26467. function removeColumnVector(var_obj) {
  26468. if (var_obj.columns == 0) {
  26469. return;
  26470. }
  26471. var_obj.columns--;
  26472. var_obj.value.splice(var_obj.value.length - 1, 1);
  26473. }
  26474. function alternateBooleanValue(var_obj, value_container) {
  26475. var_obj.value = !var_obj.value;
  26476. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value));
  26477. }
  26478. function alternateBooleanVectorValue(var_obj, index, value_container) {
  26479. var_obj.value[index] = !var_obj.value[index];
  26480. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value[index]));
  26481. }
  26482. function updateInitialValues(variable_obj) {
  26483. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26484. if (variable_obj.dimensions == 0) {
  26485. variable_obj.value = 1;
  26486. }
  26487. if (variable_obj.dimensions == 1) {
  26488. variable_obj.value = [1, 1];
  26489. }
  26490. if (variable_obj.dimensions == 2) {
  26491. variable_obj.value = [[1, 1], [1, 1]];
  26492. }
  26493. }
  26494. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26495. if (variable_obj.dimensions == 0) {
  26496. variable_obj.value = 1.0;
  26497. }
  26498. if (variable_obj.dimensions == 1) {
  26499. variable_obj.value = [1.0, 1.0];
  26500. }
  26501. if (variable_obj.dimensions == 2) {
  26502. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  26503. }
  26504. }
  26505. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26506. if (variable_obj.dimensions == 0) {
  26507. variable_obj.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start');
  26508. }
  26509. if (variable_obj.dimensions == 1) {
  26510. variable_obj.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')];
  26511. }
  26512. if (variable_obj.dimensions == 2) {
  26513. variable_obj.value = [[_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')], [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')]];
  26514. }
  26515. }
  26516. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26517. if (variable_obj.dimensions == 0) {
  26518. variable_obj.value = true;
  26519. }
  26520. if (variable_obj.dimensions == 1) {
  26521. variable_obj.value = [true, true];
  26522. }
  26523. if (variable_obj.dimensions == 2) {
  26524. variable_obj.value = [[true, true], [true, true]];
  26525. }
  26526. }
  26527. }
  26528. var opened_name_value_vector_global_ = false;
  26529. var opened_input_value_vector_global_ = null;
  26530. function enableVectorValueUpdate(var_obj, index, parent_node) {
  26531. if (opened_name_value_vector_global_) {
  26532. opened_input_value_vector_global_.focus();
  26533. return;
  26534. }
  26535. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26536. opened_name_value_vector_global_ = true;
  26537. parent_node.find('.span_value_variable').text('');
  26538. var input_field;
  26539. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26540. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index].toFixed(1) + "' />");
  26541. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26542. } else {
  26543. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
  26544. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26545. }
  26546. input_field.on('input', function () {
  26547. var inputWidth = input_field.textWidth() + 10;
  26548. opened_input_value_vector_global_ = input_field;
  26549. input_field.focus();
  26550. var tmpStr = input_field.val();
  26551. input_field.val('');
  26552. input_field.val(tmpStr);
  26553. input_field.css({
  26554. width: inputWidth
  26555. });
  26556. }).trigger('input');
  26557. input_field.focusout(function () {
  26558. /// update array:
  26559. if (input_field.val().trim()) {
  26560. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26561. var_obj.value[index] = parseFloat(input_field.val().trim());
  26562. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26563. } else {
  26564. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26565. var_obj.value[index] = parseInt(input_field.val().trim());
  26566. } else {
  26567. var_obj.value[index] = input_field.val().trim();
  26568. }
  26569. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26570. }
  26571. } else {
  26572. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26573. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26574. } else {
  26575. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26576. }
  26577. }
  26578. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26579. var_obj.value[index] = input_field.val();
  26580. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26581. }
  26582. input_field.off();
  26583. input_field.remove(); /// update elements:
  26584. opened_name_value_vector_global_ = false;
  26585. opened_input_value_vector_global_ = false;
  26586. });
  26587. input_field.on('keydown', function (e) {
  26588. var code = e.keyCode || e.which;
  26589. if (code == 13) {
  26590. if (input_field.val().trim()) {
  26591. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26592. var_obj.value[index] = parseFloat(input_field.val().trim());
  26593. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26594. } else {
  26595. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26596. var_obj.value[index] = parseInt(input_field.val().trim());
  26597. } else {
  26598. var_obj.value[index] = input_field.val().trim();
  26599. }
  26600. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26601. }
  26602. } else {
  26603. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26604. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26605. } else {
  26606. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26607. }
  26608. }
  26609. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26610. var_obj.value[index] = input_field.val();
  26611. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26612. }
  26613. input_field.off();
  26614. input_field.remove(); /// update elements:
  26615. opened_name_value_vector_global_ = false;
  26616. opened_input_value_vector_global_ = false;
  26617. }
  26618. if (code == 27) {
  26619. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26620. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  26621. } else {
  26622. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  26623. }
  26624. input_field.off();
  26625. input_field.remove(); /// update elements:
  26626. opened_name_value_vector_global_ = false;
  26627. opened_input_value_vector_global_ = false;
  26628. }
  26629. });
  26630. input_field.select();
  26631. }
  26632. var opened_name_value_global_var = false;
  26633. var opened_input_value_global_ar = null;
  26634. function enableValueUpdate(var_obj, parent_node) {
  26635. if (opened_name_value_global_var) {
  26636. opened_input_value_global_ar.focus();
  26637. return;
  26638. }
  26639. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26640. opened_name_value_global_var = true;
  26641. var input_field;
  26642. parent_node.find('.span_value_variable').text('');
  26643. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26644. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value.toFixed(1) + "' />");
  26645. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26646. } else {
  26647. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  26648. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26649. }
  26650. input_field.on('input', function () {
  26651. var inputWidth = input_field.textWidth() + 10;
  26652. opened_input_value_global_ar = input_field;
  26653. input_field.focus();
  26654. var tmpStr = input_field.val();
  26655. input_field.val('');
  26656. input_field.val(tmpStr);
  26657. input_field.css({
  26658. width: inputWidth
  26659. });
  26660. }).trigger('input');
  26661. input_field.focusout(function () {
  26662. /// update array:
  26663. if (input_field.val().trim()) {
  26664. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26665. var_obj.value = parseFloat(input_field.val().trim());
  26666. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26667. } else {
  26668. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26669. var_obj.value = parseInt(input_field.val().trim());
  26670. } else {
  26671. var_obj.value = input_field.val().trim();
  26672. }
  26673. parent_node.find('.span_value_variable').text(var_obj.value);
  26674. }
  26675. } else {
  26676. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26677. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26678. } else {
  26679. parent_node.find('.span_value_variable').text(var_obj.value);
  26680. }
  26681. }
  26682. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26683. var_obj.value = input_field.val();
  26684. parent_node.find('.span_value_variable').text(var_obj.value);
  26685. }
  26686. input_field.off();
  26687. input_field.remove(); /// update elements:
  26688. opened_name_value_global_var = false;
  26689. opened_input_value_global_ar = false;
  26690. });
  26691. input_field.on('keydown', function (e) {
  26692. var code = e.keyCode || e.which;
  26693. if (code == 13) {
  26694. if (input_field.val().trim()) {
  26695. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26696. var_obj.value = parseFloat(input_field.val().trim());
  26697. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26698. } else {
  26699. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26700. var_obj.value = parseInt(input_field.val().trim());
  26701. } else {
  26702. var_obj.value = input_field.val().trim();
  26703. }
  26704. parent_node.find('.span_value_variable').text(var_obj.value);
  26705. }
  26706. } else {
  26707. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26708. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26709. } else {
  26710. parent_node.find('.span_value_variable').text(var_obj.value);
  26711. }
  26712. }
  26713. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26714. var_obj.value = input_field.val();
  26715. parent_node.find('.span_value_variable').text(var_obj.value);
  26716. }
  26717. input_field.off();
  26718. input_field.remove(); /// update elements:
  26719. opened_name_value_global_var = false;
  26720. opened_input_value_global_ar = false;
  26721. }
  26722. if (code == 27) {
  26723. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26724. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  26725. } else {
  26726. parent_node.find('.span_value_variable').text(var_obj.value);
  26727. }
  26728. input_field.off();
  26729. input_field.remove(); /// update elements:
  26730. opened_name_value_global_var = false;
  26731. opened_input_value_global_ar = false;
  26732. }
  26733. });
  26734. input_field.select();
  26735. }
  26736. var opened_name_global = false;
  26737. var opened_input_global = null;
  26738. function enableNameUpdate(variable_obj, variable_container, function_obj) {
  26739. if (opened_name_global) {
  26740. opened_input_global.focus();
  26741. return;
  26742. }
  26743. opened_name_global = true;
  26744. variable_container.find('.span_name_variable').text('');
  26745. var input_name;
  26746. input_name = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  26747. input_name.insertBefore(variable_container.find('.span_name_variable'));
  26748. input_name.on('input', function () {
  26749. var inputWidth = input_name.textWidth() + 10;
  26750. opened_input_global = input_name;
  26751. input_name.focus();
  26752. var tmpStr = input_name.val();
  26753. input_name.val('');
  26754. input_name.val(tmpStr);
  26755. input_name.css({
  26756. width: inputWidth
  26757. });
  26758. }).trigger('input');
  26759. input_name.focusout(function () {
  26760. /// update array:
  26761. if (input_name.val().trim().length > 0) {
  26762. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  26763. variable_container.find('.span_name_variable').text(variable_obj.name);
  26764. } else {
  26765. variable_container.find('.span_name_variable').text(variable_obj.name);
  26766. }
  26767. input_name.off();
  26768. input_name.remove(); /// update elements:
  26769. opened_name_global = false;
  26770. opened_input_global = false;
  26771. });
  26772. input_name.on('keydown', function (e) {
  26773. var code = e.keyCode || e.which;
  26774. if (code == 13) {
  26775. if (input_name.val().trim().length > 0) {
  26776. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  26777. variable_container.find('.span_name_variable').text(variable_obj.name);
  26778. } else {
  26779. variable_container.find('.span_name_variable').text(variable_obj.name);
  26780. }
  26781. input_name.off();
  26782. input_name.remove(); /// update elements:
  26783. opened_name_global = false;
  26784. opened_input_global = false;
  26785. }
  26786. if (code == 27) {
  26787. variable_container.find('.span_name_variable').text(variable_obj.name);
  26788. input_name.off();
  26789. input_name.remove(); /// update elements:
  26790. opened_name_global = false;
  26791. opened_input_global = false;
  26792. }
  26793. });
  26794. input_name.select();
  26795. }
  26796. var opened_name_value_matrix_global_v = false;
  26797. var opened_input_value_matrix_global_v = null;
  26798. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  26799. if (opened_name_value_matrix_global_v) {
  26800. opened_input_value_matrix_global_v.focus();
  26801. return;
  26802. }
  26803. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26804. opened_name_value_matrix_global_v = true;
  26805. parent_node.find('.span_value_variable').text('');
  26806. var input_field;
  26807. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26808. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index].toFixed(1) + "' />");
  26809. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26810. } else {
  26811. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index] + "' />");
  26812. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26813. }
  26814. input_field.on('input', function () {
  26815. var inputWidth = input_field.textWidth() + 10;
  26816. opened_input_value_matrix_global_v = input_field;
  26817. input_field.focus();
  26818. var tmpStr = input_field.val();
  26819. input_field.val('');
  26820. input_field.val(tmpStr);
  26821. input_field.css({
  26822. width: inputWidth
  26823. });
  26824. }).trigger('input');
  26825. input_field.focusout(function () {
  26826. /// update array:
  26827. if (input_field.val().trim()) {
  26828. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26829. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  26830. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26831. } else {
  26832. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26833. var_obj.value[row][index] = parseInt(input_field.val().trim());
  26834. } else {
  26835. var_obj.value[row][index] = input_field.val().trim();
  26836. }
  26837. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26838. }
  26839. } else {
  26840. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26841. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26842. } else {
  26843. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26844. }
  26845. }
  26846. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26847. var_obj.value[row][index] = input_field.val();
  26848. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26849. }
  26850. input_field.off();
  26851. input_field.remove(); /// update elements:
  26852. opened_name_value_matrix_global_v = false;
  26853. opened_input_value_matrix_global_v = false;
  26854. });
  26855. input_field.on('keydown', function (e) {
  26856. var code = e.keyCode || e.which;
  26857. if (code == 13) {
  26858. if (input_field.val().trim()) {
  26859. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26860. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  26861. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26862. } else {
  26863. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26864. var_obj.value[row][index] = parseInt(input_field.val().trim());
  26865. } else {
  26866. var_obj.value[row][index] = input_field.val().trim();
  26867. }
  26868. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26869. }
  26870. } else {
  26871. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26872. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26873. } else {
  26874. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26875. }
  26876. }
  26877. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26878. var_obj.value[row][index] = input_field.val();
  26879. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26880. }
  26881. input_field.off();
  26882. input_field.remove(); /// update elements:
  26883. opened_name_value_matrix_global_v = false;
  26884. opened_input_value_matrix_global_v = false;
  26885. }
  26886. if (code == 27) {
  26887. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26888. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  26889. } else {
  26890. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  26891. }
  26892. input_field.off();
  26893. input_field.remove(); /// update elements:
  26894. opened_name_value_matrix_global_v = false;
  26895. opened_input_value_matrix_global_v = false;
  26896. }
  26897. });
  26898. input_field.select();
  26899. }
  26900. /***/ }),
  26901. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  26902. /*!****************************************************!*\
  26903. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  26904. \****************************************************/
  26905. /*! no static exports found */
  26906. /***/ (function(module, exports, __webpack_require__) {
  26907. //
  26908. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26909. * Use of this file is governed by the BSD 3-clause license that
  26910. * can be found in the LICENSE.txt file in the project root.
  26911. */
  26912. // This implementation of {@link TokenStream} loads tokens from a
  26913. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  26914. // access to any previous token by index.
  26915. //
  26916. // <p>
  26917. // This token stream ignores the value of {@link Token//getChannel}. If your
  26918. // parser requires the token stream filter tokens to only those on a particular
  26919. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  26920. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  26921. // {@link CommonTokenStream}.</p>
  26922. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  26923. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  26924. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  26925. // this is just to keep meaningful parameter types to Parser
  26926. function TokenStream() {
  26927. return this;
  26928. }
  26929. function BufferedTokenStream(tokenSource) {
  26930. TokenStream.call(this);
  26931. // The {@link TokenSource} from which tokens for this stream are fetched.
  26932. this.tokenSource = tokenSource;
  26933. // A collection of all tokens fetched from the token source. The list is
  26934. // considered a complete view of the input once {@link //fetchedEOF} is set
  26935. // to {@code true}.
  26936. this.tokens = [];
  26937. // The index into {@link //tokens} of the current token (next token to
  26938. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  26939. // be
  26940. // {@link //LT LT(1)}.
  26941. //
  26942. // <p>This field is set to -1 when the stream is first constructed or when
  26943. // {@link //setTokenSource} is called, indicating that the first token has
  26944. // not yet been fetched from the token source. For additional information,
  26945. // see the documentation of {@link IntStream} for a description of
  26946. // Initializing Methods.</p>
  26947. this.index = -1;
  26948. // Indicates whether the {@link Token//EOF} token has been fetched from
  26949. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  26950. // performance for the following cases:
  26951. //
  26952. // <ul>
  26953. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  26954. // prevent
  26955. // consuming the EOF symbol is optimized by checking the values of
  26956. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  26957. // //LA}.</li>
  26958. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  26959. // into
  26960. // {@link //tokens} is trivial with this field.</li>
  26961. // <ul>
  26962. this.fetchedEOF = false;
  26963. return this;
  26964. }
  26965. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  26966. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  26967. BufferedTokenStream.prototype.mark = function() {
  26968. return 0;
  26969. };
  26970. BufferedTokenStream.prototype.release = function(marker) {
  26971. // no resources to release
  26972. };
  26973. BufferedTokenStream.prototype.reset = function() {
  26974. this.seek(0);
  26975. };
  26976. BufferedTokenStream.prototype.seek = function(index) {
  26977. this.lazyInit();
  26978. this.index = this.adjustSeekIndex(index);
  26979. };
  26980. BufferedTokenStream.prototype.get = function(index) {
  26981. this.lazyInit();
  26982. return this.tokens[index];
  26983. };
  26984. BufferedTokenStream.prototype.consume = function() {
  26985. var skipEofCheck = false;
  26986. if (this.index >= 0) {
  26987. if (this.fetchedEOF) {
  26988. // the last token in tokens is EOF. skip check if p indexes any
  26989. // fetched token except the last.
  26990. skipEofCheck = this.index < this.tokens.length - 1;
  26991. } else {
  26992. // no EOF token in tokens. skip check if p indexes a fetched token.
  26993. skipEofCheck = this.index < this.tokens.length;
  26994. }
  26995. } else {
  26996. // not yet initialized
  26997. skipEofCheck = false;
  26998. }
  26999. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  27000. throw "cannot consume EOF";
  27001. }
  27002. if (this.sync(this.index + 1)) {
  27003. this.index = this.adjustSeekIndex(this.index + 1);
  27004. }
  27005. };
  27006. // Make sure index {@code i} in tokens has a token.
  27007. //
  27008. // @return {@code true} if a token is located at index {@code i}, otherwise
  27009. // {@code false}.
  27010. // @see //get(int i)
  27011. // /
  27012. BufferedTokenStream.prototype.sync = function(i) {
  27013. var n = i - this.tokens.length + 1; // how many more elements we need?
  27014. if (n > 0) {
  27015. var fetched = this.fetch(n);
  27016. return fetched >= n;
  27017. }
  27018. return true;
  27019. };
  27020. // Add {@code n} elements to buffer.
  27021. //
  27022. // @return The actual number of elements added to the buffer.
  27023. // /
  27024. BufferedTokenStream.prototype.fetch = function(n) {
  27025. if (this.fetchedEOF) {
  27026. return 0;
  27027. }
  27028. for (var i = 0; i < n; i++) {
  27029. var t = this.tokenSource.nextToken();
  27030. t.tokenIndex = this.tokens.length;
  27031. this.tokens.push(t);
  27032. if (t.type === Token.EOF) {
  27033. this.fetchedEOF = true;
  27034. return i + 1;
  27035. }
  27036. }
  27037. return n;
  27038. };
  27039. // Get all tokens from start..stop inclusively///
  27040. BufferedTokenStream.prototype.getTokens = function(start, stop, types) {
  27041. if (types === undefined) {
  27042. types = null;
  27043. }
  27044. if (start < 0 || stop < 0) {
  27045. return null;
  27046. }
  27047. this.lazyInit();
  27048. var subset = [];
  27049. if (stop >= this.tokens.length) {
  27050. stop = this.tokens.length - 1;
  27051. }
  27052. for (var i = start; i < stop; i++) {
  27053. var t = this.tokens[i];
  27054. if (t.type === Token.EOF) {
  27055. break;
  27056. }
  27057. if (types === null || types.contains(t.type)) {
  27058. subset.push(t);
  27059. }
  27060. }
  27061. return subset;
  27062. };
  27063. BufferedTokenStream.prototype.LA = function(i) {
  27064. return this.LT(i).type;
  27065. };
  27066. BufferedTokenStream.prototype.LB = function(k) {
  27067. if (this.index - k < 0) {
  27068. return null;
  27069. }
  27070. return this.tokens[this.index - k];
  27071. };
  27072. BufferedTokenStream.prototype.LT = function(k) {
  27073. this.lazyInit();
  27074. if (k === 0) {
  27075. return null;
  27076. }
  27077. if (k < 0) {
  27078. return this.LB(-k);
  27079. }
  27080. var i = this.index + k - 1;
  27081. this.sync(i);
  27082. if (i >= this.tokens.length) { // return EOF token
  27083. // EOF must be last token
  27084. return this.tokens[this.tokens.length - 1];
  27085. }
  27086. return this.tokens[i];
  27087. };
  27088. // Allowed derived classes to modify the behavior of operations which change
  27089. // the current stream position by adjusting the target token index of a seek
  27090. // operation. The default implementation simply returns {@code i}. If an
  27091. // exception is thrown in this method, the current stream index should not be
  27092. // changed.
  27093. //
  27094. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  27095. // that
  27096. // the seek target is always an on-channel token.</p>
  27097. //
  27098. // @param i The target token index.
  27099. // @return The adjusted target token index.
  27100. BufferedTokenStream.prototype.adjustSeekIndex = function(i) {
  27101. return i;
  27102. };
  27103. BufferedTokenStream.prototype.lazyInit = function() {
  27104. if (this.index === -1) {
  27105. this.setup();
  27106. }
  27107. };
  27108. BufferedTokenStream.prototype.setup = function() {
  27109. this.sync(0);
  27110. this.index = this.adjustSeekIndex(0);
  27111. };
  27112. // Reset this token stream by setting its token source.///
  27113. BufferedTokenStream.prototype.setTokenSource = function(tokenSource) {
  27114. this.tokenSource = tokenSource;
  27115. this.tokens = [];
  27116. this.index = -1;
  27117. this.fetchedEOF = false;
  27118. };
  27119. // Given a starting index, return the index of the next token on channel.
  27120. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  27121. // on channel between i and EOF.
  27122. // /
  27123. BufferedTokenStream.prototype.nextTokenOnChannel = function(i, channel) {
  27124. this.sync(i);
  27125. if (i >= this.tokens.length) {
  27126. return -1;
  27127. }
  27128. var token = this.tokens[i];
  27129. while (token.channel !== this.channel) {
  27130. if (token.type === Token.EOF) {
  27131. return -1;
  27132. }
  27133. i += 1;
  27134. this.sync(i);
  27135. token = this.tokens[i];
  27136. }
  27137. return i;
  27138. };
  27139. // Given a starting index, return the index of the previous token on channel.
  27140. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  27141. // on channel between i and 0.
  27142. BufferedTokenStream.prototype.previousTokenOnChannel = function(i, channel) {
  27143. while (i >= 0 && this.tokens[i].channel !== channel) {
  27144. i -= 1;
  27145. }
  27146. return i;
  27147. };
  27148. // Collect all tokens on specified channel to the right of
  27149. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  27150. // EOF. If channel is -1, find any non default channel token.
  27151. BufferedTokenStream.prototype.getHiddenTokensToRight = function(tokenIndex,
  27152. channel) {
  27153. if (channel === undefined) {
  27154. channel = -1;
  27155. }
  27156. this.lazyInit();
  27157. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  27158. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  27159. }
  27160. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  27161. var from_ = tokenIndex + 1;
  27162. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  27163. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  27164. return this.filterForChannel(from_, to, channel);
  27165. };
  27166. // Collect all tokens on specified channel to the left of
  27167. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  27168. // If channel is -1, find any non default channel token.
  27169. BufferedTokenStream.prototype.getHiddenTokensToLeft = function(tokenIndex,
  27170. channel) {
  27171. if (channel === undefined) {
  27172. channel = -1;
  27173. }
  27174. this.lazyInit();
  27175. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  27176. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  27177. }
  27178. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  27179. if (prevOnChannel === tokenIndex - 1) {
  27180. return null;
  27181. }
  27182. // if none on channel to left, prevOnChannel=-1 then from=0
  27183. var from_ = prevOnChannel + 1;
  27184. var to = tokenIndex - 1;
  27185. return this.filterForChannel(from_, to, channel);
  27186. };
  27187. BufferedTokenStream.prototype.filterForChannel = function(left, right, channel) {
  27188. var hidden = [];
  27189. for (var i = left; i < right + 1; i++) {
  27190. var t = this.tokens[i];
  27191. if (channel === -1) {
  27192. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  27193. hidden.push(t);
  27194. }
  27195. } else if (t.channel === channel) {
  27196. hidden.push(t);
  27197. }
  27198. }
  27199. if (hidden.length === 0) {
  27200. return null;
  27201. }
  27202. return hidden;
  27203. };
  27204. BufferedTokenStream.prototype.getSourceName = function() {
  27205. return this.tokenSource.getSourceName();
  27206. };
  27207. // Get the text of all tokens in this buffer.///
  27208. BufferedTokenStream.prototype.getText = function(interval) {
  27209. this.lazyInit();
  27210. this.fill();
  27211. if (interval === undefined || interval === null) {
  27212. interval = new Interval(0, this.tokens.length - 1);
  27213. }
  27214. var start = interval.start;
  27215. if (start instanceof Token) {
  27216. start = start.tokenIndex;
  27217. }
  27218. var stop = interval.stop;
  27219. if (stop instanceof Token) {
  27220. stop = stop.tokenIndex;
  27221. }
  27222. if (start === null || stop === null || start < 0 || stop < 0) {
  27223. return "";
  27224. }
  27225. if (stop >= this.tokens.length) {
  27226. stop = this.tokens.length - 1;
  27227. }
  27228. var s = "";
  27229. for (var i = start; i < stop + 1; i++) {
  27230. var t = this.tokens[i];
  27231. if (t.type === Token.EOF) {
  27232. break;
  27233. }
  27234. s = s + t.text;
  27235. }
  27236. return s;
  27237. };
  27238. // Get all tokens from lexer until EOF///
  27239. BufferedTokenStream.prototype.fill = function() {
  27240. this.lazyInit();
  27241. while (this.fetch(1000) === 1000) {
  27242. continue;
  27243. }
  27244. };
  27245. exports.BufferedTokenStream = BufferedTokenStream;
  27246. /***/ }),
  27247. /***/ "./node_modules/antlr4/CharStreams.js":
  27248. /*!********************************************!*\
  27249. !*** ./node_modules/antlr4/CharStreams.js ***!
  27250. \********************************************/
  27251. /*! no static exports found */
  27252. /***/ (function(module, exports, __webpack_require__) {
  27253. //
  27254. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27255. * Use of this file is governed by the BSD 3-clause license that
  27256. * can be found in the LICENSE.txt file in the project root.
  27257. */
  27258. //
  27259. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  27260. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  27261. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  27262. // Utility functions to create InputStreams from various sources.
  27263. //
  27264. // All returned InputStreams support the full range of Unicode
  27265. // up to U+10FFFF (the default behavior of InputStream only supports
  27266. // code points up to U+FFFF).
  27267. var CharStreams = {
  27268. // Creates an InputStream from a string.
  27269. fromString: function(str) {
  27270. return new InputStream(str, true);
  27271. },
  27272. // Asynchronously creates an InputStream from a blob given the
  27273. // encoding of the bytes in that blob (defaults to 'utf8' if
  27274. // encoding is null).
  27275. //
  27276. // Invokes onLoad(result) on success, onError(error) on
  27277. // failure.
  27278. fromBlob: function(blob, encoding, onLoad, onError) {
  27279. var reader = FileReader();
  27280. reader.onload = function(e) {
  27281. var is = new InputStream(e.target.result, true);
  27282. onLoad(is);
  27283. };
  27284. reader.onerror = onError;
  27285. reader.readAsText(blob, encoding);
  27286. },
  27287. // Creates an InputStream from a Buffer given the
  27288. // encoding of the bytes in that buffer (defaults to 'utf8' if
  27289. // encoding is null).
  27290. fromBuffer: function(buffer, encoding) {
  27291. return new InputStream(buffer.toString(encoding), true);
  27292. },
  27293. // Asynchronously creates an InputStream from a file on disk given
  27294. // the encoding of the bytes in that file (defaults to 'utf8' if
  27295. // encoding is null).
  27296. //
  27297. // Invokes callback(error, result) on completion.
  27298. fromPath: function(path, encoding, callback) {
  27299. fs.readFile(path, encoding, function(err, data) {
  27300. var is = null;
  27301. if (data !== null) {
  27302. is = new InputStream(data, true);
  27303. }
  27304. callback(err, is);
  27305. });
  27306. },
  27307. // Synchronously creates an InputStream given a path to a file
  27308. // on disk and the encoding of the bytes in that file (defaults to
  27309. // 'utf8' if encoding is null).
  27310. fromPathSync: function(path, encoding) {
  27311. var data = fs.readFileSync(path, encoding);
  27312. return new InputStream(data, true);
  27313. }
  27314. };
  27315. exports.CharStreams = CharStreams;
  27316. /***/ }),
  27317. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  27318. /*!***************************************************!*\
  27319. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  27320. \***************************************************/
  27321. /*! no static exports found */
  27322. /***/ (function(module, exports, __webpack_require__) {
  27323. //
  27324. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27325. * Use of this file is governed by the BSD 3-clause license that
  27326. * can be found in the LICENSE.txt file in the project root.
  27327. */
  27328. //
  27329. //
  27330. // This default implementation of {@link TokenFactory} creates
  27331. // {@link CommonToken} objects.
  27332. //
  27333. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  27334. function TokenFactory() {
  27335. return this;
  27336. }
  27337. function CommonTokenFactory(copyText) {
  27338. TokenFactory.call(this);
  27339. // Indicates whether {@link CommonToken//setText} should be called after
  27340. // constructing tokens to explicitly set the text. This is useful for cases
  27341. // where the input stream might not be able to provide arbitrary substrings
  27342. // of text from the input after the lexer creates a token (e.g. the
  27343. // implementation of {@link CharStream//getText} in
  27344. // {@link UnbufferedCharStream} throws an
  27345. // {@link UnsupportedOperationException}). Explicitly setting the token text
  27346. // allows {@link Token//getText} to be called at any time regardless of the
  27347. // input stream implementation.
  27348. //
  27349. // <p>
  27350. // The default value is {@code false} to avoid the performance and memory
  27351. // overhead of copying text for every token unless explicitly requested.</p>
  27352. //
  27353. this.copyText = copyText===undefined ? false : copyText;
  27354. return this;
  27355. }
  27356. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  27357. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  27358. //
  27359. // The default {@link CommonTokenFactory} instance.
  27360. //
  27361. // <p>
  27362. // This token factory does not explicitly copy token text when constructing
  27363. // tokens.</p>
  27364. //
  27365. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  27366. CommonTokenFactory.prototype.create = function(source, type, text, channel, start, stop, line, column) {
  27367. var t = new CommonToken(source, type, channel, start, stop);
  27368. t.line = line;
  27369. t.column = column;
  27370. if (text !==null) {
  27371. t.text = text;
  27372. } else if (this.copyText && source[1] !==null) {
  27373. t.text = source[1].getText(start,stop);
  27374. }
  27375. return t;
  27376. };
  27377. CommonTokenFactory.prototype.createThin = function(type, text) {
  27378. var t = new CommonToken(null, type);
  27379. t.text = text;
  27380. return t;
  27381. };
  27382. exports.CommonTokenFactory = CommonTokenFactory;
  27383. /***/ }),
  27384. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  27385. /*!**************************************************!*\
  27386. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  27387. \**************************************************/
  27388. /*! no static exports found */
  27389. /***/ (function(module, exports, __webpack_require__) {
  27390. //
  27391. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27392. * Use of this file is governed by the BSD 3-clause license that
  27393. * can be found in the LICENSE.txt file in the project root.
  27394. */
  27395. ///
  27396. //
  27397. // This class extends {@link BufferedTokenStream} with functionality to filter
  27398. // token streams to tokens on a particular channel (tokens where
  27399. // {@link Token//getChannel} returns a particular value).
  27400. //
  27401. // <p>
  27402. // This token stream provides access to all tokens by index or when calling
  27403. // methods like {@link //getText}. The channel filtering is only used for code
  27404. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  27405. // {@link //LB}.</p>
  27406. //
  27407. // <p>
  27408. // By default, tokens are placed on the default channel
  27409. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  27410. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  27411. // call {@link Lexer//setChannel}.
  27412. // </p>
  27413. //
  27414. // <p>
  27415. // Note: lexer rules which use the {@code ->skip} lexer command or call
  27416. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  27417. // such a rule will not be available as part of the token stream, regardless of
  27418. // channel.</p>
  27419. ///
  27420. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27421. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  27422. function CommonTokenStream(lexer, channel) {
  27423. BufferedTokenStream.call(this, lexer);
  27424. this.channel = channel===undefined ? Token.DEFAULT_CHANNEL : channel;
  27425. return this;
  27426. }
  27427. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  27428. CommonTokenStream.prototype.constructor = CommonTokenStream;
  27429. CommonTokenStream.prototype.adjustSeekIndex = function(i) {
  27430. return this.nextTokenOnChannel(i, this.channel);
  27431. };
  27432. CommonTokenStream.prototype.LB = function(k) {
  27433. if (k===0 || this.index-k<0) {
  27434. return null;
  27435. }
  27436. var i = this.index;
  27437. var n = 1;
  27438. // find k good tokens looking backwards
  27439. while (n <= k) {
  27440. // skip off-channel tokens
  27441. i = this.previousTokenOnChannel(i - 1, this.channel);
  27442. n += 1;
  27443. }
  27444. if (i < 0) {
  27445. return null;
  27446. }
  27447. return this.tokens[i];
  27448. };
  27449. CommonTokenStream.prototype.LT = function(k) {
  27450. this.lazyInit();
  27451. if (k === 0) {
  27452. return null;
  27453. }
  27454. if (k < 0) {
  27455. return this.LB(-k);
  27456. }
  27457. var i = this.index;
  27458. var n = 1; // we know tokens[pos] is a good one
  27459. // find k good tokens
  27460. while (n < k) {
  27461. // skip off-channel tokens, but make sure to not look past EOF
  27462. if (this.sync(i + 1)) {
  27463. i = this.nextTokenOnChannel(i + 1, this.channel);
  27464. }
  27465. n += 1;
  27466. }
  27467. return this.tokens[i];
  27468. };
  27469. // Count EOF just once.///
  27470. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function() {
  27471. var n = 0;
  27472. this.fill();
  27473. for (var i =0; i< this.tokens.length;i++) {
  27474. var t = this.tokens[i];
  27475. if( t.channel===this.channel) {
  27476. n += 1;
  27477. }
  27478. if( t.type===Token.EOF) {
  27479. break;
  27480. }
  27481. }
  27482. return n;
  27483. };
  27484. exports.CommonTokenStream = CommonTokenStream;
  27485. /***/ }),
  27486. /***/ "./node_modules/antlr4/FileStream.js":
  27487. /*!*******************************************!*\
  27488. !*** ./node_modules/antlr4/FileStream.js ***!
  27489. \*******************************************/
  27490. /*! no static exports found */
  27491. /***/ (function(module, exports, __webpack_require__) {
  27492. //
  27493. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27494. * Use of this file is governed by the BSD 3-clause license that
  27495. * can be found in the LICENSE.txt file in the project root.
  27496. */
  27497. //
  27498. //
  27499. // This is an InputStream that is loaded from a file all at once
  27500. // when you construct the object.
  27501. //
  27502. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  27503. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  27504. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  27505. function FileStream(fileName, decodeToUnicodeCodePoints) {
  27506. var data = fs.readFileSync(fileName, "utf8");
  27507. InputStream.call(this, data, decodeToUnicodeCodePoints);
  27508. this.fileName = fileName;
  27509. return this;
  27510. }
  27511. FileStream.prototype = Object.create(InputStream.prototype);
  27512. FileStream.prototype.constructor = FileStream;
  27513. exports.FileStream = FileStream;
  27514. /***/ }),
  27515. /***/ "./node_modules/antlr4/InputStream.js":
  27516. /*!********************************************!*\
  27517. !*** ./node_modules/antlr4/InputStream.js ***!
  27518. \********************************************/
  27519. /*! no static exports found */
  27520. /***/ (function(module, exports, __webpack_require__) {
  27521. //
  27522. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27523. * Use of this file is governed by the BSD 3-clause license that
  27524. * can be found in the LICENSE.txt file in the project root.
  27525. */
  27526. //
  27527. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27528. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  27529. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  27530. // Vacuum all input from a string and then treat it like a buffer.
  27531. function _loadString(stream, decodeToUnicodeCodePoints) {
  27532. stream._index = 0;
  27533. stream.data = [];
  27534. if (stream.decodeToUnicodeCodePoints) {
  27535. for (var i = 0; i < stream.strdata.length; ) {
  27536. var codePoint = stream.strdata.codePointAt(i);
  27537. stream.data.push(codePoint);
  27538. i += codePoint <= 0xFFFF ? 1 : 2;
  27539. }
  27540. } else {
  27541. for (var i = 0; i < stream.strdata.length; i++) {
  27542. var codeUnit = stream.strdata.charCodeAt(i);
  27543. stream.data.push(codeUnit);
  27544. }
  27545. }
  27546. stream._size = stream.data.length;
  27547. }
  27548. // If decodeToUnicodeCodePoints is true, the input is treated
  27549. // as a series of Unicode code points.
  27550. //
  27551. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  27552. // units.
  27553. function InputStream(data, decodeToUnicodeCodePoints) {
  27554. this.name = "<empty>";
  27555. this.strdata = data;
  27556. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  27557. _loadString(this);
  27558. return this;
  27559. }
  27560. Object.defineProperty(InputStream.prototype, "index", {
  27561. get : function() {
  27562. return this._index;
  27563. }
  27564. });
  27565. Object.defineProperty(InputStream.prototype, "size", {
  27566. get : function() {
  27567. return this._size;
  27568. }
  27569. });
  27570. // Reset the stream so that it's in the same state it was
  27571. // when the object was created *except* the data array is not
  27572. // touched.
  27573. //
  27574. InputStream.prototype.reset = function() {
  27575. this._index = 0;
  27576. };
  27577. InputStream.prototype.consume = function() {
  27578. if (this._index >= this._size) {
  27579. // assert this.LA(1) == Token.EOF
  27580. throw ("cannot consume EOF");
  27581. }
  27582. this._index += 1;
  27583. };
  27584. InputStream.prototype.LA = function(offset) {
  27585. if (offset === 0) {
  27586. return 0; // undefined
  27587. }
  27588. if (offset < 0) {
  27589. offset += 1; // e.g., translate LA(-1) to use offset=0
  27590. }
  27591. var pos = this._index + offset - 1;
  27592. if (pos < 0 || pos >= this._size) { // invalid
  27593. return Token.EOF;
  27594. }
  27595. return this.data[pos];
  27596. };
  27597. InputStream.prototype.LT = function(offset) {
  27598. return this.LA(offset);
  27599. };
  27600. // mark/release do nothing; we have entire buffer
  27601. InputStream.prototype.mark = function() {
  27602. return -1;
  27603. };
  27604. InputStream.prototype.release = function(marker) {
  27605. };
  27606. // consume() ahead until p==_index; can't just set p=_index as we must
  27607. // update line and column. If we seek backwards, just set p
  27608. //
  27609. InputStream.prototype.seek = function(_index) {
  27610. if (_index <= this._index) {
  27611. this._index = _index; // just jump; don't update stream state (line,
  27612. // ...)
  27613. return;
  27614. }
  27615. // seek forward
  27616. this._index = Math.min(_index, this._size);
  27617. };
  27618. InputStream.prototype.getText = function(start, stop) {
  27619. if (stop >= this._size) {
  27620. stop = this._size - 1;
  27621. }
  27622. if (start >= this._size) {
  27623. return "";
  27624. } else {
  27625. if (this.decodeToUnicodeCodePoints) {
  27626. var result = "";
  27627. for (var i = start; i <= stop; i++) {
  27628. result += String.fromCodePoint(this.data[i]);
  27629. }
  27630. return result;
  27631. } else {
  27632. return this.strdata.slice(start, stop + 1);
  27633. }
  27634. }
  27635. };
  27636. InputStream.prototype.toString = function() {
  27637. return this.strdata;
  27638. };
  27639. exports.InputStream = InputStream;
  27640. /***/ }),
  27641. /***/ "./node_modules/antlr4/IntervalSet.js":
  27642. /*!********************************************!*\
  27643. !*** ./node_modules/antlr4/IntervalSet.js ***!
  27644. \********************************************/
  27645. /*! no static exports found */
  27646. /***/ (function(module, exports, __webpack_require__) {
  27647. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27648. * Use of this file is governed by the BSD 3-clause license that
  27649. * can be found in the LICENSE.txt file in the project root.
  27650. */
  27651. /*jslint smarttabs:true */
  27652. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27653. /* stop is not included! */
  27654. function Interval(start, stop) {
  27655. this.start = start;
  27656. this.stop = stop;
  27657. return this;
  27658. }
  27659. Interval.prototype.contains = function(item) {
  27660. return item >= this.start && item < this.stop;
  27661. };
  27662. Interval.prototype.toString = function() {
  27663. if(this.start===this.stop-1) {
  27664. return this.start.toString();
  27665. } else {
  27666. return this.start.toString() + ".." + (this.stop-1).toString();
  27667. }
  27668. };
  27669. Object.defineProperty(Interval.prototype, "length", {
  27670. get : function() {
  27671. return this.stop - this.start;
  27672. }
  27673. });
  27674. function IntervalSet() {
  27675. this.intervals = null;
  27676. this.readOnly = false;
  27677. }
  27678. IntervalSet.prototype.first = function(v) {
  27679. if (this.intervals === null || this.intervals.length===0) {
  27680. return Token.INVALID_TYPE;
  27681. } else {
  27682. return this.intervals[0].start;
  27683. }
  27684. };
  27685. IntervalSet.prototype.addOne = function(v) {
  27686. this.addInterval(new Interval(v, v + 1));
  27687. };
  27688. IntervalSet.prototype.addRange = function(l, h) {
  27689. this.addInterval(new Interval(l, h + 1));
  27690. };
  27691. IntervalSet.prototype.addInterval = function(v) {
  27692. if (this.intervals === null) {
  27693. this.intervals = [];
  27694. this.intervals.push(v);
  27695. } else {
  27696. // find insert pos
  27697. for (var k = 0; k < this.intervals.length; k++) {
  27698. var i = this.intervals[k];
  27699. // distinct range -> insert
  27700. if (v.stop < i.start) {
  27701. this.intervals.splice(k, 0, v);
  27702. return;
  27703. }
  27704. // contiguous range -> adjust
  27705. else if (v.stop === i.start) {
  27706. this.intervals[k].start = v.start;
  27707. return;
  27708. }
  27709. // overlapping range -> adjust and reduce
  27710. else if (v.start <= i.stop) {
  27711. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  27712. this.reduce(k);
  27713. return;
  27714. }
  27715. }
  27716. // greater than any existing
  27717. this.intervals.push(v);
  27718. }
  27719. };
  27720. IntervalSet.prototype.addSet = function(other) {
  27721. if (other.intervals !== null) {
  27722. for (var k = 0; k < other.intervals.length; k++) {
  27723. var i = other.intervals[k];
  27724. this.addInterval(new Interval(i.start, i.stop));
  27725. }
  27726. }
  27727. return this;
  27728. };
  27729. IntervalSet.prototype.reduce = function(k) {
  27730. // only need to reduce if k is not the last
  27731. if (k < this.intervalslength - 1) {
  27732. var l = this.intervals[k];
  27733. var r = this.intervals[k + 1];
  27734. // if r contained in l
  27735. if (l.stop >= r.stop) {
  27736. this.intervals.pop(k + 1);
  27737. this.reduce(k);
  27738. } else if (l.stop >= r.start) {
  27739. this.intervals[k] = new Interval(l.start, r.stop);
  27740. this.intervals.pop(k + 1);
  27741. }
  27742. }
  27743. };
  27744. IntervalSet.prototype.complement = function(start, stop) {
  27745. var result = new IntervalSet();
  27746. result.addInterval(new Interval(start,stop+1));
  27747. for(var i=0; i<this.intervals.length; i++) {
  27748. result.removeRange(this.intervals[i]);
  27749. }
  27750. return result;
  27751. };
  27752. IntervalSet.prototype.contains = function(item) {
  27753. if (this.intervals === null) {
  27754. return false;
  27755. } else {
  27756. for (var k = 0; k < this.intervals.length; k++) {
  27757. if(this.intervals[k].contains(item)) {
  27758. return true;
  27759. }
  27760. }
  27761. return false;
  27762. }
  27763. };
  27764. Object.defineProperty(IntervalSet.prototype, "length", {
  27765. get : function() {
  27766. var len = 0;
  27767. this.intervals.map(function(i) {len += i.length;});
  27768. return len;
  27769. }
  27770. });
  27771. IntervalSet.prototype.removeRange = function(v) {
  27772. if(v.start===v.stop-1) {
  27773. this.removeOne(v.start);
  27774. } else if (this.intervals!==null) {
  27775. var k = 0;
  27776. for(var n=0; n<this.intervals.length; n++) {
  27777. var i = this.intervals[k];
  27778. // intervals are ordered
  27779. if (v.stop<=i.start) {
  27780. return;
  27781. }
  27782. // check for including range, split it
  27783. else if(v.start>i.start && v.stop<i.stop) {
  27784. this.intervals[k] = new Interval(i.start, v.start);
  27785. var x = new Interval(v.stop, i.stop);
  27786. this.intervals.splice(k, 0, x);
  27787. return;
  27788. }
  27789. // check for included range, remove it
  27790. else if(v.start<=i.start && v.stop>=i.stop) {
  27791. this.intervals.splice(k, 1);
  27792. k = k - 1; // need another pass
  27793. }
  27794. // check for lower boundary
  27795. else if(v.start<i.stop) {
  27796. this.intervals[k] = new Interval(i.start, v.start);
  27797. }
  27798. // check for upper boundary
  27799. else if(v.stop<i.stop) {
  27800. this.intervals[k] = new Interval(v.stop, i.stop);
  27801. }
  27802. k += 1;
  27803. }
  27804. }
  27805. };
  27806. IntervalSet.prototype.removeOne = function(v) {
  27807. if (this.intervals !== null) {
  27808. for (var k = 0; k < this.intervals.length; k++) {
  27809. var i = this.intervals[k];
  27810. // intervals is ordered
  27811. if (v < i.start) {
  27812. return;
  27813. }
  27814. // check for single value range
  27815. else if (v === i.start && v === i.stop - 1) {
  27816. this.intervals.splice(k, 1);
  27817. return;
  27818. }
  27819. // check for lower boundary
  27820. else if (v === i.start) {
  27821. this.intervals[k] = new Interval(i.start + 1, i.stop);
  27822. return;
  27823. }
  27824. // check for upper boundary
  27825. else if (v === i.stop - 1) {
  27826. this.intervals[k] = new Interval(i.start, i.stop - 1);
  27827. return;
  27828. }
  27829. // split existing range
  27830. else if (v < i.stop - 1) {
  27831. var x = new Interval(i.start, v);
  27832. i.start = v + 1;
  27833. this.intervals.splice(k, 0, x);
  27834. return;
  27835. }
  27836. }
  27837. }
  27838. };
  27839. IntervalSet.prototype.toString = function(literalNames, symbolicNames, elemsAreChar) {
  27840. literalNames = literalNames || null;
  27841. symbolicNames = symbolicNames || null;
  27842. elemsAreChar = elemsAreChar || false;
  27843. if (this.intervals === null) {
  27844. return "{}";
  27845. } else if(literalNames!==null || symbolicNames!==null) {
  27846. return this.toTokenString(literalNames, symbolicNames);
  27847. } else if(elemsAreChar) {
  27848. return this.toCharString();
  27849. } else {
  27850. return this.toIndexString();
  27851. }
  27852. };
  27853. IntervalSet.prototype.toCharString = function() {
  27854. var names = [];
  27855. for (var i = 0; i < this.intervals.length; i++) {
  27856. var v = this.intervals[i];
  27857. if(v.stop===v.start+1) {
  27858. if ( v.start===Token.EOF ) {
  27859. names.push("<EOF>");
  27860. } else {
  27861. names.push("'" + String.fromCharCode(v.start) + "'");
  27862. }
  27863. } else {
  27864. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop-1) + "'");
  27865. }
  27866. }
  27867. if (names.length > 1) {
  27868. return "{" + names.join(", ") + "}";
  27869. } else {
  27870. return names[0];
  27871. }
  27872. };
  27873. IntervalSet.prototype.toIndexString = function() {
  27874. var names = [];
  27875. for (var i = 0; i < this.intervals.length; i++) {
  27876. var v = this.intervals[i];
  27877. if(v.stop===v.start+1) {
  27878. if ( v.start===Token.EOF ) {
  27879. names.push("<EOF>");
  27880. } else {
  27881. names.push(v.start.toString());
  27882. }
  27883. } else {
  27884. names.push(v.start.toString() + ".." + (v.stop-1).toString());
  27885. }
  27886. }
  27887. if (names.length > 1) {
  27888. return "{" + names.join(", ") + "}";
  27889. } else {
  27890. return names[0];
  27891. }
  27892. };
  27893. IntervalSet.prototype.toTokenString = function(literalNames, symbolicNames) {
  27894. var names = [];
  27895. for (var i = 0; i < this.intervals.length; i++) {
  27896. var v = this.intervals[i];
  27897. for (var j = v.start; j < v.stop; j++) {
  27898. names.push(this.elementName(literalNames, symbolicNames, j));
  27899. }
  27900. }
  27901. if (names.length > 1) {
  27902. return "{" + names.join(", ") + "}";
  27903. } else {
  27904. return names[0];
  27905. }
  27906. };
  27907. IntervalSet.prototype.elementName = function(literalNames, symbolicNames, a) {
  27908. if (a === Token.EOF) {
  27909. return "<EOF>";
  27910. } else if (a === Token.EPSILON) {
  27911. return "<EPSILON>";
  27912. } else {
  27913. return literalNames[a] || symbolicNames[a];
  27914. }
  27915. };
  27916. exports.Interval = Interval;
  27917. exports.IntervalSet = IntervalSet;
  27918. /***/ }),
  27919. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  27920. /*!********************************************!*\
  27921. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  27922. \********************************************/
  27923. /*! no static exports found */
  27924. /***/ (function(module, exports, __webpack_require__) {
  27925. //
  27926. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27927. * Use of this file is governed by the BSD 3-clause license that
  27928. * can be found in the LICENSE.txt file in the project root.
  27929. */
  27930. ///
  27931. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  27932. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  27933. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27934. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  27935. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  27936. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  27937. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  27938. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  27939. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  27940. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  27941. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  27942. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  27943. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  27944. var PredictionContext = pc.PredictionContext;
  27945. var SingletonPredictionContext = pc.SingletonPredictionContext;
  27946. function LL1Analyzer (atn) {
  27947. this.atn = atn;
  27948. }
  27949. //* Special value added to the lookahead sets to indicate that we hit
  27950. // a predicate during analysis if {@code seeThruPreds==false}.
  27951. ///
  27952. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  27953. //*
  27954. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  27955. // of an {@link ATNState}. The returned array has one element for each
  27956. // outgoing transition in {@code s}. If the closure from transition
  27957. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  27958. // element at index <em>i</em> of the result will be {@code null}.
  27959. //
  27960. // @param s the ATN state
  27961. // @return the expected symbols for each outgoing transition of {@code s}.
  27962. ///
  27963. LL1Analyzer.prototype.getDecisionLookahead = function(s) {
  27964. if (s === null) {
  27965. return null;
  27966. }
  27967. var count = s.transitions.length;
  27968. var look = [];
  27969. for(var alt=0; alt< count; alt++) {
  27970. look[alt] = new IntervalSet();
  27971. var lookBusy = new Set();
  27972. var seeThruPreds = false; // fail to get lookahead upon pred
  27973. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY,
  27974. look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  27975. // Wipe out lookahead for this alternative if we found nothing
  27976. // or we had a predicate when we !seeThruPreds
  27977. if (look[alt].length===0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  27978. look[alt] = null;
  27979. }
  27980. }
  27981. return look;
  27982. };
  27983. //*
  27984. // Compute set of tokens that can follow {@code s} in the ATN in the
  27985. // specified {@code ctx}.
  27986. //
  27987. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  27988. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  27989. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  27990. // reached, {@link Token//EOF} is added to the result set.</p>
  27991. //
  27992. // @param s the ATN state
  27993. // @param stopState the ATN state to stop at. This can be a
  27994. // {@link BlockEndState} to detect epsilon paths through a closure.
  27995. // @param ctx the complete parser context, or {@code null} if the context
  27996. // should be ignored
  27997. //
  27998. // @return The set of tokens that can follow {@code s} in the ATN in the
  27999. // specified {@code ctx}.
  28000. ///
  28001. LL1Analyzer.prototype.LOOK = function(s, stopState, ctx) {
  28002. var r = new IntervalSet();
  28003. var seeThruPreds = true; // ignore preds; get all lookahead
  28004. ctx = ctx || null;
  28005. var lookContext = ctx!==null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  28006. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  28007. return r;
  28008. };
  28009. //*
  28010. // Compute set of tokens that can follow {@code s} in the ATN in the
  28011. // specified {@code ctx}.
  28012. //
  28013. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  28014. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  28015. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  28016. // {@code true} and {@code stopState} or the end of the outermost rule is
  28017. // reached, {@link Token//EOF} is added to the result set.</p>
  28018. //
  28019. // @param s the ATN state.
  28020. // @param stopState the ATN state to stop at. This can be a
  28021. // {@link BlockEndState} to detect epsilon paths through a closure.
  28022. // @param ctx The outer context, or {@code null} if the outer context should
  28023. // not be used.
  28024. // @param look The result lookahead set.
  28025. // @param lookBusy A set used for preventing epsilon closures in the ATN
  28026. // from causing a stack overflow. Outside code should pass
  28027. // {@code new Set<ATNConfig>} for this argument.
  28028. // @param calledRuleStack A set used for preventing left recursion in the
  28029. // ATN from causing a stack overflow. Outside code should pass
  28030. // {@code new BitSet()} for this argument.
  28031. // @param seeThruPreds {@code true} to true semantic predicates as
  28032. // implicitly {@code true} and "see through them", otherwise {@code false}
  28033. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  28034. // result if one is encountered.
  28035. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  28036. // outermost context is reached. This parameter has no effect if {@code ctx}
  28037. // is {@code null}.
  28038. ///
  28039. LL1Analyzer.prototype._LOOK = function(s, stopState , ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  28040. var c = new ATNConfig({state:s, alt:0, context: ctx}, null);
  28041. if (lookBusy.contains(c)) {
  28042. return;
  28043. }
  28044. lookBusy.add(c);
  28045. if (s === stopState) {
  28046. if (ctx ===null) {
  28047. look.addOne(Token.EPSILON);
  28048. return;
  28049. } else if (ctx.isEmpty() && addEOF) {
  28050. look.addOne(Token.EOF);
  28051. return;
  28052. }
  28053. }
  28054. if (s instanceof RuleStopState ) {
  28055. if (ctx ===null) {
  28056. look.addOne(Token.EPSILON);
  28057. return;
  28058. } else if (ctx.isEmpty() && addEOF) {
  28059. look.addOne(Token.EOF);
  28060. return;
  28061. }
  28062. if (ctx !== PredictionContext.EMPTY) {
  28063. // run thru all possible stack tops in ctx
  28064. for(var i=0; i<ctx.length; i++) {
  28065. var returnState = this.atn.states[ctx.getReturnState(i)];
  28066. var removed = calledRuleStack.contains(returnState.ruleIndex);
  28067. try {
  28068. calledRuleStack.remove(returnState.ruleIndex);
  28069. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28070. } finally {
  28071. if (removed) {
  28072. calledRuleStack.add(returnState.ruleIndex);
  28073. }
  28074. }
  28075. }
  28076. return;
  28077. }
  28078. }
  28079. for(var j=0; j<s.transitions.length; j++) {
  28080. var t = s.transitions[j];
  28081. if (t.constructor === RuleTransition) {
  28082. if (calledRuleStack.contains(t.target.ruleIndex)) {
  28083. continue;
  28084. }
  28085. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  28086. try {
  28087. calledRuleStack.add(t.target.ruleIndex);
  28088. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28089. } finally {
  28090. calledRuleStack.remove(t.target.ruleIndex);
  28091. }
  28092. } else if (t instanceof AbstractPredicateTransition ) {
  28093. if (seeThruPreds) {
  28094. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28095. } else {
  28096. look.addOne(LL1Analyzer.HIT_PRED);
  28097. }
  28098. } else if( t.isEpsilon) {
  28099. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28100. } else if (t.constructor === WildcardTransition) {
  28101. look.addRange( Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType );
  28102. } else {
  28103. var set = t.label;
  28104. if (set !== null) {
  28105. if (t instanceof NotSetTransition) {
  28106. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  28107. }
  28108. look.addSet(set);
  28109. }
  28110. }
  28111. }
  28112. };
  28113. exports.LL1Analyzer = LL1Analyzer;
  28114. /***/ }),
  28115. /***/ "./node_modules/antlr4/Lexer.js":
  28116. /*!**************************************!*\
  28117. !*** ./node_modules/antlr4/Lexer.js ***!
  28118. \**************************************/
  28119. /*! no static exports found */
  28120. /***/ (function(module, exports, __webpack_require__) {
  28121. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28122. * Use of this file is governed by the BSD 3-clause license that
  28123. * can be found in the LICENSE.txt file in the project root.
  28124. */
  28125. ///
  28126. // A lexer is recognizer that draws input symbols from a character stream.
  28127. // lexer grammars result in a subclass of this object. A Lexer object
  28128. // uses simplified match() and error recovery mechanisms in the interest of speed.
  28129. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28130. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  28131. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  28132. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  28133. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  28134. function TokenSource() {
  28135. return this;
  28136. }
  28137. function Lexer(input) {
  28138. Recognizer.call(this);
  28139. this._input = input;
  28140. this._factory = CommonTokenFactory.DEFAULT;
  28141. this._tokenFactorySourcePair = [ this, input ];
  28142. this._interp = null; // child classes must populate this
  28143. // The goal of all lexer rules/methods is to create a token object.
  28144. // this is an instance variable as multiple rules may collaborate to
  28145. // create a single token. nextToken will return this object after
  28146. // matching lexer rule(s). If you subclass to allow multiple token
  28147. // emissions, then set this to the last token to be matched or
  28148. // something nonnull so that the auto token emit mechanism will not
  28149. // emit another token.
  28150. this._token = null;
  28151. // What character index in the stream did the current token start at?
  28152. // Needed, for example, to get the text for current token. Set at
  28153. // the start of nextToken.
  28154. this._tokenStartCharIndex = -1;
  28155. // The line on which the first character of the token resides///
  28156. this._tokenStartLine = -1;
  28157. // The character position of first character within the line///
  28158. this._tokenStartColumn = -1;
  28159. // Once we see EOF on char stream, next token will be EOF.
  28160. // If you have DONE : EOF ; then you see DONE EOF.
  28161. this._hitEOF = false;
  28162. // The channel number for the current token///
  28163. this._channel = Token.DEFAULT_CHANNEL;
  28164. // The token type for the current token///
  28165. this._type = Token.INVALID_TYPE;
  28166. this._modeStack = [];
  28167. this._mode = Lexer.DEFAULT_MODE;
  28168. // You can set the text for the current token to override what is in
  28169. // the input char buffer. Use setText() or can set this instance var.
  28170. // /
  28171. this._text = null;
  28172. return this;
  28173. }
  28174. Lexer.prototype = Object.create(Recognizer.prototype);
  28175. Lexer.prototype.constructor = Lexer;
  28176. Lexer.DEFAULT_MODE = 0;
  28177. Lexer.MORE = -2;
  28178. Lexer.SKIP = -3;
  28179. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  28180. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  28181. Lexer.MIN_CHAR_VALUE = 0x0000;
  28182. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  28183. Lexer.prototype.reset = function() {
  28184. // wack Lexer state variables
  28185. if (this._input !== null) {
  28186. this._input.seek(0); // rewind the input
  28187. }
  28188. this._token = null;
  28189. this._type = Token.INVALID_TYPE;
  28190. this._channel = Token.DEFAULT_CHANNEL;
  28191. this._tokenStartCharIndex = -1;
  28192. this._tokenStartColumn = -1;
  28193. this._tokenStartLine = -1;
  28194. this._text = null;
  28195. this._hitEOF = false;
  28196. this._mode = Lexer.DEFAULT_MODE;
  28197. this._modeStack = [];
  28198. this._interp.reset();
  28199. };
  28200. // Return a token from this source; i.e., match a token on the char stream.
  28201. Lexer.prototype.nextToken = function() {
  28202. if (this._input === null) {
  28203. throw "nextToken requires a non-null input stream.";
  28204. }
  28205. // Mark start location in char stream so unbuffered streams are
  28206. // guaranteed at least have text of current token
  28207. var tokenStartMarker = this._input.mark();
  28208. try {
  28209. while (true) {
  28210. if (this._hitEOF) {
  28211. this.emitEOF();
  28212. return this._token;
  28213. }
  28214. this._token = null;
  28215. this._channel = Token.DEFAULT_CHANNEL;
  28216. this._tokenStartCharIndex = this._input.index;
  28217. this._tokenStartColumn = this._interp.column;
  28218. this._tokenStartLine = this._interp.line;
  28219. this._text = null;
  28220. var continueOuter = false;
  28221. while (true) {
  28222. this._type = Token.INVALID_TYPE;
  28223. var ttype = Lexer.SKIP;
  28224. try {
  28225. ttype = this._interp.match(this._input, this._mode);
  28226. } catch (e) {
  28227. if(e instanceof RecognitionException) {
  28228. this.notifyListeners(e); // report error
  28229. this.recover(e);
  28230. } else {
  28231. console.log(e.stack);
  28232. throw e;
  28233. }
  28234. }
  28235. if (this._input.LA(1) === Token.EOF) {
  28236. this._hitEOF = true;
  28237. }
  28238. if (this._type === Token.INVALID_TYPE) {
  28239. this._type = ttype;
  28240. }
  28241. if (this._type === Lexer.SKIP) {
  28242. continueOuter = true;
  28243. break;
  28244. }
  28245. if (this._type !== Lexer.MORE) {
  28246. break;
  28247. }
  28248. }
  28249. if (continueOuter) {
  28250. continue;
  28251. }
  28252. if (this._token === null) {
  28253. this.emit();
  28254. }
  28255. return this._token;
  28256. }
  28257. } finally {
  28258. // make sure we release marker after match or
  28259. // unbuffered char stream will keep buffering
  28260. this._input.release(tokenStartMarker);
  28261. }
  28262. };
  28263. // Instruct the lexer to skip creating a token for current lexer rule
  28264. // and look for another token. nextToken() knows to keep looking when
  28265. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  28266. // if token==null at end of any token rule, it creates one for you
  28267. // and emits it.
  28268. // /
  28269. Lexer.prototype.skip = function() {
  28270. this._type = Lexer.SKIP;
  28271. };
  28272. Lexer.prototype.more = function() {
  28273. this._type = Lexer.MORE;
  28274. };
  28275. Lexer.prototype.mode = function(m) {
  28276. this._mode = m;
  28277. };
  28278. Lexer.prototype.pushMode = function(m) {
  28279. if (this._interp.debug) {
  28280. console.log("pushMode " + m);
  28281. }
  28282. this._modeStack.push(this._mode);
  28283. this.mode(m);
  28284. };
  28285. Lexer.prototype.popMode = function() {
  28286. if (this._modeStack.length === 0) {
  28287. throw "Empty Stack";
  28288. }
  28289. if (this._interp.debug) {
  28290. console.log("popMode back to " + this._modeStack.slice(0, -1));
  28291. }
  28292. this.mode(this._modeStack.pop());
  28293. return this._mode;
  28294. };
  28295. // Set the char stream and reset the lexer
  28296. Object.defineProperty(Lexer.prototype, "inputStream", {
  28297. get : function() {
  28298. return this._input;
  28299. },
  28300. set : function(input) {
  28301. this._input = null;
  28302. this._tokenFactorySourcePair = [ this, this._input ];
  28303. this.reset();
  28304. this._input = input;
  28305. this._tokenFactorySourcePair = [ this, this._input ];
  28306. }
  28307. });
  28308. Object.defineProperty(Lexer.prototype, "sourceName", {
  28309. get : function sourceName() {
  28310. return this._input.sourceName;
  28311. }
  28312. });
  28313. // By default does not support multiple emits per nextToken invocation
  28314. // for efficiency reasons. Subclass and override this method, nextToken,
  28315. // and getToken (to push tokens into a list and pull from that list
  28316. // rather than a single variable as this implementation does).
  28317. // /
  28318. Lexer.prototype.emitToken = function(token) {
  28319. this._token = token;
  28320. };
  28321. // The standard method called to automatically emit a token at the
  28322. // outermost lexical rule. The token object should point into the
  28323. // char buffer start..stop. If there is a text override in 'text',
  28324. // use that to set the token's text. Override this method to emit
  28325. // custom Token objects or provide a new factory.
  28326. // /
  28327. Lexer.prototype.emit = function() {
  28328. var t = this._factory.create(this._tokenFactorySourcePair, this._type,
  28329. this._text, this._channel, this._tokenStartCharIndex, this
  28330. .getCharIndex() - 1, this._tokenStartLine,
  28331. this._tokenStartColumn);
  28332. this.emitToken(t);
  28333. return t;
  28334. };
  28335. Lexer.prototype.emitEOF = function() {
  28336. var cpos = this.column;
  28337. var lpos = this.line;
  28338. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF,
  28339. null, Token.DEFAULT_CHANNEL, this._input.index,
  28340. this._input.index - 1, lpos, cpos);
  28341. this.emitToken(eof);
  28342. return eof;
  28343. };
  28344. Object.defineProperty(Lexer.prototype, "type", {
  28345. get : function() {
  28346. return this.type;
  28347. },
  28348. set : function(type) {
  28349. this._type = type;
  28350. }
  28351. });
  28352. Object.defineProperty(Lexer.prototype, "line", {
  28353. get : function() {
  28354. return this._interp.line;
  28355. },
  28356. set : function(line) {
  28357. this._interp.line = line;
  28358. }
  28359. });
  28360. Object.defineProperty(Lexer.prototype, "column", {
  28361. get : function() {
  28362. return this._interp.column;
  28363. },
  28364. set : function(column) {
  28365. this._interp.column = column;
  28366. }
  28367. });
  28368. // What is the index of the current character of lookahead?///
  28369. Lexer.prototype.getCharIndex = function() {
  28370. return this._input.index;
  28371. };
  28372. // Return the text matched so far for the current token or any text override.
  28373. //Set the complete text of this token; it wipes any previous changes to the text.
  28374. Object.defineProperty(Lexer.prototype, "text", {
  28375. get : function() {
  28376. if (this._text !== null) {
  28377. return this._text;
  28378. } else {
  28379. return this._interp.getText(this._input);
  28380. }
  28381. },
  28382. set : function(text) {
  28383. this._text = text;
  28384. }
  28385. });
  28386. // Return a list of all Token objects in input char stream.
  28387. // Forces load of all tokens. Does not include EOF token.
  28388. // /
  28389. Lexer.prototype.getAllTokens = function() {
  28390. var tokens = [];
  28391. var t = this.nextToken();
  28392. while (t.type !== Token.EOF) {
  28393. tokens.push(t);
  28394. t = this.nextToken();
  28395. }
  28396. return tokens;
  28397. };
  28398. Lexer.prototype.notifyListeners = function(e) {
  28399. var start = this._tokenStartCharIndex;
  28400. var stop = this._input.index;
  28401. var text = this._input.getText(start, stop);
  28402. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  28403. var listener = this.getErrorListenerDispatch();
  28404. listener.syntaxError(this, null, this._tokenStartLine,
  28405. this._tokenStartColumn, msg, e);
  28406. };
  28407. Lexer.prototype.getErrorDisplay = function(s) {
  28408. var d = [];
  28409. for (var i = 0; i < s.length; i++) {
  28410. d.push(s[i]);
  28411. }
  28412. return d.join('');
  28413. };
  28414. Lexer.prototype.getErrorDisplayForChar = function(c) {
  28415. if (c.charCodeAt(0) === Token.EOF) {
  28416. return "<EOF>";
  28417. } else if (c === '\n') {
  28418. return "\\n";
  28419. } else if (c === '\t') {
  28420. return "\\t";
  28421. } else if (c === '\r') {
  28422. return "\\r";
  28423. } else {
  28424. return c;
  28425. }
  28426. };
  28427. Lexer.prototype.getCharErrorDisplay = function(c) {
  28428. return "'" + this.getErrorDisplayForChar(c) + "'";
  28429. };
  28430. // Lexers can normally match any char in it's vocabulary after matching
  28431. // a token, so do the easy thing and just kill a character and hope
  28432. // it all works out. You can instead use the rule invocation stack
  28433. // to do sophisticated error recovery if you are in a fragment rule.
  28434. // /
  28435. Lexer.prototype.recover = function(re) {
  28436. if (this._input.LA(1) !== Token.EOF) {
  28437. if (re instanceof LexerNoViableAltException) {
  28438. // skip a char and try again
  28439. this._interp.consume(this._input);
  28440. } else {
  28441. // TODO: Do we lose character or line position information?
  28442. this._input.consume();
  28443. }
  28444. }
  28445. };
  28446. exports.Lexer = Lexer;
  28447. /***/ }),
  28448. /***/ "./node_modules/antlr4/Parser.js":
  28449. /*!***************************************!*\
  28450. !*** ./node_modules/antlr4/Parser.js ***!
  28451. \***************************************/
  28452. /*! no static exports found */
  28453. /***/ (function(module, exports, __webpack_require__) {
  28454. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28455. * Use of this file is governed by the BSD 3-clause license that
  28456. * can be found in the LICENSE.txt file in the project root.
  28457. */
  28458. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28459. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  28460. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  28461. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  28462. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  28463. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  28464. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  28465. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  28466. function TraceListener(parser) {
  28467. ParseTreeListener.call(this);
  28468. this.parser = parser;
  28469. return this;
  28470. }
  28471. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  28472. TraceListener.prototype.constructor = TraceListener;
  28473. TraceListener.prototype.enterEveryRule = function(ctx) {
  28474. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  28475. };
  28476. TraceListener.prototype.visitTerminal = function( node) {
  28477. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  28478. };
  28479. TraceListener.prototype.exitEveryRule = function(ctx) {
  28480. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  28481. };
  28482. // this is all the parsing support code essentially; most of it is error
  28483. // recovery stuff.//
  28484. function Parser(input) {
  28485. Recognizer.call(this);
  28486. // The input stream.
  28487. this._input = null;
  28488. // The error handling strategy for the parser. The default value is a new
  28489. // instance of {@link DefaultErrorStrategy}.
  28490. this._errHandler = new DefaultErrorStrategy();
  28491. this._precedenceStack = [];
  28492. this._precedenceStack.push(0);
  28493. // The {@link ParserRuleContext} object for the currently executing rule.
  28494. // this is always non-null during the parsing process.
  28495. this._ctx = null;
  28496. // Specifies whether or not the parser should construct a parse tree during
  28497. // the parsing process. The default value is {@code true}.
  28498. this.buildParseTrees = true;
  28499. // When {@link //setTrace}{@code (true)} is called, a reference to the
  28500. // {@link TraceListener} is stored here so it can be easily removed in a
  28501. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  28502. // implemented as a parser listener so this field is not directly used by
  28503. // other parser methods.
  28504. this._tracer = null;
  28505. // The list of {@link ParseTreeListener} listeners registered to receive
  28506. // events during the parse.
  28507. this._parseListeners = null;
  28508. // The number of syntax errors reported during parsing. this value is
  28509. // incremented each time {@link //notifyErrorListeners} is called.
  28510. this._syntaxErrors = 0;
  28511. this.setInputStream(input);
  28512. return this;
  28513. }
  28514. Parser.prototype = Object.create(Recognizer.prototype);
  28515. Parser.prototype.contructor = Parser;
  28516. // this field maps from the serialized ATN string to the deserialized {@link
  28517. // ATN} with
  28518. // bypass alternatives.
  28519. //
  28520. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  28521. //
  28522. Parser.bypassAltsAtnCache = {};
  28523. // reset the parser's state//
  28524. Parser.prototype.reset = function() {
  28525. if (this._input !== null) {
  28526. this._input.seek(0);
  28527. }
  28528. this._errHandler.reset(this);
  28529. this._ctx = null;
  28530. this._syntaxErrors = 0;
  28531. this.setTrace(false);
  28532. this._precedenceStack = [];
  28533. this._precedenceStack.push(0);
  28534. if (this._interp !== null) {
  28535. this._interp.reset();
  28536. }
  28537. };
  28538. // Match current input symbol against {@code ttype}. If the symbol type
  28539. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  28540. // called to complete the match process.
  28541. //
  28542. // <p>If the symbol type does not match,
  28543. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  28544. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  28545. // {@code true} and the token index of the symbol returned by
  28546. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  28547. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  28548. //
  28549. // @param ttype the token type to match
  28550. // @return the matched symbol
  28551. // @throws RecognitionException if the current input symbol did not match
  28552. // {@code ttype} and the error strategy could not recover from the
  28553. // mismatched symbol
  28554. Parser.prototype.match = function(ttype) {
  28555. var t = this.getCurrentToken();
  28556. if (t.type === ttype) {
  28557. this._errHandler.reportMatch(this);
  28558. this.consume();
  28559. } else {
  28560. t = this._errHandler.recoverInline(this);
  28561. if (this.buildParseTrees && t.tokenIndex === -1) {
  28562. // we must have conjured up a new token during single token
  28563. // insertion
  28564. // if it's not the current symbol
  28565. this._ctx.addErrorNode(t);
  28566. }
  28567. }
  28568. return t;
  28569. };
  28570. // Match current input symbol as a wildcard. If the symbol type matches
  28571. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  28572. // and {@link //consume} are called to complete the match process.
  28573. //
  28574. // <p>If the symbol type does not match,
  28575. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  28576. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  28577. // {@code true} and the token index of the symbol returned by
  28578. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  28579. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  28580. //
  28581. // @return the matched symbol
  28582. // @throws RecognitionException if the current input symbol did not match
  28583. // a wildcard and the error strategy could not recover from the mismatched
  28584. // symbol
  28585. Parser.prototype.matchWildcard = function() {
  28586. var t = this.getCurrentToken();
  28587. if (t.type > 0) {
  28588. this._errHandler.reportMatch(this);
  28589. this.consume();
  28590. } else {
  28591. t = this._errHandler.recoverInline(this);
  28592. if (this._buildParseTrees && t.tokenIndex === -1) {
  28593. // we must have conjured up a new token during single token
  28594. // insertion
  28595. // if it's not the current symbol
  28596. this._ctx.addErrorNode(t);
  28597. }
  28598. }
  28599. return t;
  28600. };
  28601. Parser.prototype.getParseListeners = function() {
  28602. return this._parseListeners || [];
  28603. };
  28604. // Registers {@code listener} to receive events during the parsing process.
  28605. //
  28606. // <p>To support output-preserving grammar transformations (including but not
  28607. // limited to left-recursion removal, automated left-factoring, and
  28608. // optimized code generation), calls to listener methods during the parse
  28609. // may differ substantially from calls made by
  28610. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  28611. // particular, rule entry and exit events may occur in a different order
  28612. // during the parse than after the parser. In addition, calls to certain
  28613. // rule entry methods may be omitted.</p>
  28614. //
  28615. // <p>With the following specific exceptions, calls to listener events are
  28616. // <em>deterministic</em>, i.e. for identical input the calls to listener
  28617. // methods will be the same.</p>
  28618. //
  28619. // <ul>
  28620. // <li>Alterations to the grammar used to generate code may change the
  28621. // behavior of the listener calls.</li>
  28622. // <li>Alterations to the command line options passed to ANTLR 4 when
  28623. // generating the parser may change the behavior of the listener calls.</li>
  28624. // <li>Changing the version of the ANTLR Tool used to generate the parser
  28625. // may change the behavior of the listener calls.</li>
  28626. // </ul>
  28627. //
  28628. // @param listener the listener to add
  28629. //
  28630. // @throws NullPointerException if {@code} listener is {@code null}
  28631. //
  28632. Parser.prototype.addParseListener = function(listener) {
  28633. if (listener === null) {
  28634. throw "listener";
  28635. }
  28636. if (this._parseListeners === null) {
  28637. this._parseListeners = [];
  28638. }
  28639. this._parseListeners.push(listener);
  28640. };
  28641. //
  28642. // Remove {@code listener} from the list of parse listeners.
  28643. //
  28644. // <p>If {@code listener} is {@code null} or has not been added as a parse
  28645. // listener, this method does nothing.</p>
  28646. // @param listener the listener to remove
  28647. //
  28648. Parser.prototype.removeParseListener = function(listener) {
  28649. if (this._parseListeners !== null) {
  28650. var idx = this._parseListeners.indexOf(listener);
  28651. if (idx >= 0) {
  28652. this._parseListeners.splice(idx, 1);
  28653. }
  28654. if (this._parseListeners.length === 0) {
  28655. this._parseListeners = null;
  28656. }
  28657. }
  28658. };
  28659. // Remove all parse listeners.
  28660. Parser.prototype.removeParseListeners = function() {
  28661. this._parseListeners = null;
  28662. };
  28663. // Notify any parse listeners of an enter rule event.
  28664. Parser.prototype.triggerEnterRuleEvent = function() {
  28665. if (this._parseListeners !== null) {
  28666. var ctx = this._ctx;
  28667. this._parseListeners.map(function(listener) {
  28668. listener.enterEveryRule(ctx);
  28669. ctx.enterRule(listener);
  28670. });
  28671. }
  28672. };
  28673. //
  28674. // Notify any parse listeners of an exit rule event.
  28675. //
  28676. // @see //addParseListener
  28677. //
  28678. Parser.prototype.triggerExitRuleEvent = function() {
  28679. if (this._parseListeners !== null) {
  28680. // reverse order walk of listeners
  28681. var ctx = this._ctx;
  28682. this._parseListeners.slice(0).reverse().map(function(listener) {
  28683. ctx.exitRule(listener);
  28684. listener.exitEveryRule(ctx);
  28685. });
  28686. }
  28687. };
  28688. Parser.prototype.getTokenFactory = function() {
  28689. return this._input.tokenSource._factory;
  28690. };
  28691. // Tell our token source and error strategy about a new way to create tokens.//
  28692. Parser.prototype.setTokenFactory = function(factory) {
  28693. this._input.tokenSource._factory = factory;
  28694. };
  28695. // The ATN with bypass alternatives is expensive to create so we create it
  28696. // lazily.
  28697. //
  28698. // @throws UnsupportedOperationException if the current parser does not
  28699. // implement the {@link //getSerializedATN()} method.
  28700. //
  28701. Parser.prototype.getATNWithBypassAlts = function() {
  28702. var serializedAtn = this.getSerializedATN();
  28703. if (serializedAtn === null) {
  28704. throw "The current parser does not support an ATN with bypass alternatives.";
  28705. }
  28706. var result = this.bypassAltsAtnCache[serializedAtn];
  28707. if (result === null) {
  28708. var deserializationOptions = new ATNDeserializationOptions();
  28709. deserializationOptions.generateRuleBypassTransitions = true;
  28710. result = new ATNDeserializer(deserializationOptions)
  28711. .deserialize(serializedAtn);
  28712. this.bypassAltsAtnCache[serializedAtn] = result;
  28713. }
  28714. return result;
  28715. };
  28716. // The preferred method of getting a tree pattern. For example, here's a
  28717. // sample use:
  28718. //
  28719. // <pre>
  28720. // ParseTree t = parser.expr();
  28721. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  28722. // MyParser.RULE_expr);
  28723. // ParseTreeMatch m = p.match(t);
  28724. // String id = m.get("ID");
  28725. // </pre>
  28726. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  28727. Parser.prototype.compileParseTreePattern = function(pattern, patternRuleIndex, lexer) {
  28728. lexer = lexer || null;
  28729. if (lexer === null) {
  28730. if (this.getTokenStream() !== null) {
  28731. var tokenSource = this.getTokenStream().tokenSource;
  28732. if (tokenSource instanceof Lexer) {
  28733. lexer = tokenSource;
  28734. }
  28735. }
  28736. }
  28737. if (lexer === null) {
  28738. throw "Parser can't discover a lexer to use";
  28739. }
  28740. var m = new ParseTreePatternMatcher(lexer, this);
  28741. return m.compile(pattern, patternRuleIndex);
  28742. };
  28743. Parser.prototype.getInputStream = function() {
  28744. return this.getTokenStream();
  28745. };
  28746. Parser.prototype.setInputStream = function(input) {
  28747. this.setTokenStream(input);
  28748. };
  28749. Parser.prototype.getTokenStream = function() {
  28750. return this._input;
  28751. };
  28752. // Set the token stream and reset the parser.//
  28753. Parser.prototype.setTokenStream = function(input) {
  28754. this._input = null;
  28755. this.reset();
  28756. this._input = input;
  28757. };
  28758. // Match needs to return the current input symbol, which gets put
  28759. // into the label for the associated token ref; e.g., x=ID.
  28760. //
  28761. Parser.prototype.getCurrentToken = function() {
  28762. return this._input.LT(1);
  28763. };
  28764. Parser.prototype.notifyErrorListeners = function(msg, offendingToken, err) {
  28765. offendingToken = offendingToken || null;
  28766. err = err || null;
  28767. if (offendingToken === null) {
  28768. offendingToken = this.getCurrentToken();
  28769. }
  28770. this._syntaxErrors += 1;
  28771. var line = offendingToken.line;
  28772. var column = offendingToken.column;
  28773. var listener = this.getErrorListenerDispatch();
  28774. listener.syntaxError(this, offendingToken, line, column, msg, err);
  28775. };
  28776. //
  28777. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  28778. //
  28779. // <p>E.g., given the following input with {@code A} being the current
  28780. // lookahead symbol, this function moves the cursor to {@code B} and returns
  28781. // {@code A}.</p>
  28782. //
  28783. // <pre>
  28784. // A B
  28785. // ^
  28786. // </pre>
  28787. //
  28788. // If the parser is not in error recovery mode, the consumed symbol is added
  28789. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  28790. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  28791. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  28792. // added to the parse tree using
  28793. // {@link ParserRuleContext//addErrorNode(Token)}, and
  28794. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  28795. // listeners.
  28796. //
  28797. Parser.prototype.consume = function() {
  28798. var o = this.getCurrentToken();
  28799. if (o.type !== Token.EOF) {
  28800. this.getInputStream().consume();
  28801. }
  28802. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  28803. if (this.buildParseTrees || hasListener) {
  28804. var node;
  28805. if (this._errHandler.inErrorRecoveryMode(this)) {
  28806. node = this._ctx.addErrorNode(o);
  28807. } else {
  28808. node = this._ctx.addTokenNode(o);
  28809. }
  28810. node.invokingState = this.state;
  28811. if (hasListener) {
  28812. this._parseListeners.map(function(listener) {
  28813. if (node instanceof ErrorNode || (node.isErrorNode !== undefined && node.isErrorNode())) {
  28814. listener.visitErrorNode(node);
  28815. } else if (node instanceof TerminalNode) {
  28816. listener.visitTerminal(node);
  28817. }
  28818. });
  28819. }
  28820. }
  28821. return o;
  28822. };
  28823. Parser.prototype.addContextToParseTree = function() {
  28824. // add current context to parent if we have a parent
  28825. if (this._ctx.parentCtx !== null) {
  28826. this._ctx.parentCtx.addChild(this._ctx);
  28827. }
  28828. };
  28829. // Always called by generated parsers upon entry to a rule. Access field
  28830. // {@link //_ctx} get the current context.
  28831. Parser.prototype.enterRule = function(localctx, state, ruleIndex) {
  28832. this.state = state;
  28833. this._ctx = localctx;
  28834. this._ctx.start = this._input.LT(1);
  28835. if (this.buildParseTrees) {
  28836. this.addContextToParseTree();
  28837. }
  28838. if (this._parseListeners !== null) {
  28839. this.triggerEnterRuleEvent();
  28840. }
  28841. };
  28842. Parser.prototype.exitRule = function() {
  28843. this._ctx.stop = this._input.LT(-1);
  28844. // trigger event on _ctx, before it reverts to parent
  28845. if (this._parseListeners !== null) {
  28846. this.triggerExitRuleEvent();
  28847. }
  28848. this.state = this._ctx.invokingState;
  28849. this._ctx = this._ctx.parentCtx;
  28850. };
  28851. Parser.prototype.enterOuterAlt = function(localctx, altNum) {
  28852. localctx.setAltNumber(altNum);
  28853. // if we have new localctx, make sure we replace existing ctx
  28854. // that is previous child of parse tree
  28855. if (this.buildParseTrees && this._ctx !== localctx) {
  28856. if (this._ctx.parentCtx !== null) {
  28857. this._ctx.parentCtx.removeLastChild();
  28858. this._ctx.parentCtx.addChild(localctx);
  28859. }
  28860. }
  28861. this._ctx = localctx;
  28862. };
  28863. // Get the precedence level for the top-most precedence rule.
  28864. //
  28865. // @return The precedence level for the top-most precedence rule, or -1 if
  28866. // the parser context is not nested within a precedence rule.
  28867. Parser.prototype.getPrecedence = function() {
  28868. if (this._precedenceStack.length === 0) {
  28869. return -1;
  28870. } else {
  28871. return this._precedenceStack[this._precedenceStack.length-1];
  28872. }
  28873. };
  28874. Parser.prototype.enterRecursionRule = function(localctx, state, ruleIndex,
  28875. precedence) {
  28876. this.state = state;
  28877. this._precedenceStack.push(precedence);
  28878. this._ctx = localctx;
  28879. this._ctx.start = this._input.LT(1);
  28880. if (this._parseListeners !== null) {
  28881. this.triggerEnterRuleEvent(); // simulates rule entry for
  28882. // left-recursive rules
  28883. }
  28884. };
  28885. //
  28886. // Like {@link //enterRule} but for recursive rules.
  28887. Parser.prototype.pushNewRecursionContext = function(localctx, state, ruleIndex) {
  28888. var previous = this._ctx;
  28889. previous.parentCtx = localctx;
  28890. previous.invokingState = state;
  28891. previous.stop = this._input.LT(-1);
  28892. this._ctx = localctx;
  28893. this._ctx.start = previous.start;
  28894. if (this.buildParseTrees) {
  28895. this._ctx.addChild(previous);
  28896. }
  28897. if (this._parseListeners !== null) {
  28898. this.triggerEnterRuleEvent(); // simulates rule entry for
  28899. // left-recursive rules
  28900. }
  28901. };
  28902. Parser.prototype.unrollRecursionContexts = function(parentCtx) {
  28903. this._precedenceStack.pop();
  28904. this._ctx.stop = this._input.LT(-1);
  28905. var retCtx = this._ctx; // save current ctx (return value)
  28906. // unroll so _ctx is as it was before call to recursive method
  28907. if (this._parseListeners !== null) {
  28908. while (this._ctx !== parentCtx) {
  28909. this.triggerExitRuleEvent();
  28910. this._ctx = this._ctx.parentCtx;
  28911. }
  28912. } else {
  28913. this._ctx = parentCtx;
  28914. }
  28915. // hook into tree
  28916. retCtx.parentCtx = parentCtx;
  28917. if (this.buildParseTrees && parentCtx !== null) {
  28918. // add return ctx into invoking rule's tree
  28919. parentCtx.addChild(retCtx);
  28920. }
  28921. };
  28922. Parser.prototype.getInvokingContext = function(ruleIndex) {
  28923. var ctx = this._ctx;
  28924. while (ctx !== null) {
  28925. if (ctx.ruleIndex === ruleIndex) {
  28926. return ctx;
  28927. }
  28928. ctx = ctx.parentCtx;
  28929. }
  28930. return null;
  28931. };
  28932. Parser.prototype.precpred = function(localctx, precedence) {
  28933. return precedence >= this._precedenceStack[this._precedenceStack.length-1];
  28934. };
  28935. Parser.prototype.inContext = function(context) {
  28936. // TODO: useful in parser?
  28937. return false;
  28938. };
  28939. //
  28940. // Checks whether or not {@code symbol} can follow the current state in the
  28941. // ATN. The behavior of this method is equivalent to the following, but is
  28942. // implemented such that the complete context-sensitive follow set does not
  28943. // need to be explicitly constructed.
  28944. //
  28945. // <pre>
  28946. // return getExpectedTokens().contains(symbol);
  28947. // </pre>
  28948. //
  28949. // @param symbol the symbol type to check
  28950. // @return {@code true} if {@code symbol} can follow the current state in
  28951. // the ATN, otherwise {@code false}.
  28952. Parser.prototype.isExpectedToken = function(symbol) {
  28953. var atn = this._interp.atn;
  28954. var ctx = this._ctx;
  28955. var s = atn.states[this.state];
  28956. var following = atn.nextTokens(s);
  28957. if (following.contains(symbol)) {
  28958. return true;
  28959. }
  28960. if (!following.contains(Token.EPSILON)) {
  28961. return false;
  28962. }
  28963. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  28964. var invokingState = atn.states[ctx.invokingState];
  28965. var rt = invokingState.transitions[0];
  28966. following = atn.nextTokens(rt.followState);
  28967. if (following.contains(symbol)) {
  28968. return true;
  28969. }
  28970. ctx = ctx.parentCtx;
  28971. }
  28972. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  28973. return true;
  28974. } else {
  28975. return false;
  28976. }
  28977. };
  28978. // Computes the set of input symbols which could follow the current parser
  28979. // state and context, as given by {@link //getState} and {@link //getContext},
  28980. // respectively.
  28981. //
  28982. // @see ATN//getExpectedTokens(int, RuleContext)
  28983. //
  28984. Parser.prototype.getExpectedTokens = function() {
  28985. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  28986. };
  28987. Parser.prototype.getExpectedTokensWithinCurrentRule = function() {
  28988. var atn = this._interp.atn;
  28989. var s = atn.states[this.state];
  28990. return atn.nextTokens(s);
  28991. };
  28992. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  28993. Parser.prototype.getRuleIndex = function(ruleName) {
  28994. var ruleIndex = this.getRuleIndexMap()[ruleName];
  28995. if (ruleIndex !== null) {
  28996. return ruleIndex;
  28997. } else {
  28998. return -1;
  28999. }
  29000. };
  29001. // Return List&lt;String&gt; of the rule names in your parser instance
  29002. // leading up to a call to the current rule. You could override if
  29003. // you want more details such as the file/line info of where
  29004. // in the ATN a rule is invoked.
  29005. //
  29006. // this is very useful for error messages.
  29007. //
  29008. Parser.prototype.getRuleInvocationStack = function(p) {
  29009. p = p || null;
  29010. if (p === null) {
  29011. p = this._ctx;
  29012. }
  29013. var stack = [];
  29014. while (p !== null) {
  29015. // compute what follows who invoked us
  29016. var ruleIndex = p.ruleIndex;
  29017. if (ruleIndex < 0) {
  29018. stack.push("n/a");
  29019. } else {
  29020. stack.push(this.ruleNames[ruleIndex]);
  29021. }
  29022. p = p.parentCtx;
  29023. }
  29024. return stack;
  29025. };
  29026. // For debugging and other purposes.//
  29027. Parser.prototype.getDFAStrings = function() {
  29028. return this._interp.decisionToDFA.toString();
  29029. };
  29030. // For debugging and other purposes.//
  29031. Parser.prototype.dumpDFA = function() {
  29032. var seenOne = false;
  29033. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  29034. var dfa = this._interp.decisionToDFA[i];
  29035. if (dfa.states.length > 0) {
  29036. if (seenOne) {
  29037. console.log();
  29038. }
  29039. this.printer.println("Decision " + dfa.decision + ":");
  29040. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  29041. seenOne = true;
  29042. }
  29043. }
  29044. };
  29045. /*
  29046. " printer = function() {\r\n" +
  29047. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  29048. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  29049. " };\r\n" +
  29050. */
  29051. Parser.prototype.getSourceName = function() {
  29052. return this._input.sourceName;
  29053. };
  29054. // During a parse is sometimes useful to listen in on the rule entry and exit
  29055. // events as well as token matches. this is for quick and dirty debugging.
  29056. //
  29057. Parser.prototype.setTrace = function(trace) {
  29058. if (!trace) {
  29059. this.removeParseListener(this._tracer);
  29060. this._tracer = null;
  29061. } else {
  29062. if (this._tracer !== null) {
  29063. this.removeParseListener(this._tracer);
  29064. }
  29065. this._tracer = new TraceListener(this);
  29066. this.addParseListener(this._tracer);
  29067. }
  29068. };
  29069. exports.Parser = Parser;
  29070. /***/ }),
  29071. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  29072. /*!**************************************************!*\
  29073. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  29074. \**************************************************/
  29075. /*! no static exports found */
  29076. /***/ (function(module, exports, __webpack_require__) {
  29077. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29078. * Use of this file is governed by the BSD 3-clause license that
  29079. * can be found in the LICENSE.txt file in the project root.
  29080. */
  29081. //* A rule invocation record for parsing.
  29082. //
  29083. // Contains all of the information about the current rule not stored in the
  29084. // RuleContext. It handles parse tree children list, Any ATN state
  29085. // tracing, and the default values available for rule indications:
  29086. // start, stop, rule index, current alt number, current
  29087. // ATN state.
  29088. //
  29089. // Subclasses made for each rule and grammar track the parameters,
  29090. // return values, locals, and labels specific to that rule. These
  29091. // are the objects that are returned from rules.
  29092. //
  29093. // Note text is not an actual field of a rule return value; it is computed
  29094. // from start and stop using the input stream's toString() method. I
  29095. // could add a ctor to this so that we can pass in and store the input
  29096. // stream, but I'm not sure we want to do that. It would seem to be undefined
  29097. // to get the .text property anyway if the rule matches tokens from multiple
  29098. // input streams.
  29099. //
  29100. // I do not use getters for fields of objects that are used simply to
  29101. // group values such as this aggregate. The getters/setters are there to
  29102. // satisfy the superclass interface.
  29103. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29104. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  29105. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  29106. var TerminalNode = Tree.TerminalNode;
  29107. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  29108. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  29109. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  29110. function ParserRuleContext(parent, invokingStateNumber) {
  29111. parent = parent || null;
  29112. invokingStateNumber = invokingStateNumber || null;
  29113. RuleContext.call(this, parent, invokingStateNumber);
  29114. this.ruleIndex = -1;
  29115. // * If we are debugging or building a parse tree for a visitor,
  29116. // we need to track all of the tokens and rule invocations associated
  29117. // with this rule's context. This is empty for parsing w/o tree constr.
  29118. // operation because we don't the need to track the details about
  29119. // how we parse this rule.
  29120. // /
  29121. this.children = null;
  29122. this.start = null;
  29123. this.stop = null;
  29124. // The exception that forced this rule to return. If the rule successfully
  29125. // completed, this is {@code null}.
  29126. this.exception = null;
  29127. }
  29128. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  29129. ParserRuleContext.prototype.constructor = ParserRuleContext;
  29130. // * COPY a ctx (I'm deliberately not using copy constructor)///
  29131. ParserRuleContext.prototype.copyFrom = function(ctx) {
  29132. // from RuleContext
  29133. this.parentCtx = ctx.parentCtx;
  29134. this.invokingState = ctx.invokingState;
  29135. this.children = null;
  29136. this.start = ctx.start;
  29137. this.stop = ctx.stop;
  29138. // copy any error nodes to alt label node
  29139. if(ctx.children) {
  29140. this.children = [];
  29141. // reset parent pointer for any error nodes
  29142. ctx.children.map(function(child) {
  29143. if (child instanceof ErrorNodeImpl) {
  29144. this.children.push(child);
  29145. child.parentCtx = this;
  29146. }
  29147. }, this);
  29148. }
  29149. };
  29150. // Double dispatch methods for listeners
  29151. ParserRuleContext.prototype.enterRule = function(listener) {
  29152. };
  29153. ParserRuleContext.prototype.exitRule = function(listener) {
  29154. };
  29155. // * Does not set parent link; other add methods do that///
  29156. ParserRuleContext.prototype.addChild = function(child) {
  29157. if (this.children === null) {
  29158. this.children = [];
  29159. }
  29160. this.children.push(child);
  29161. return child;
  29162. };
  29163. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  29164. // we entered a rule. If we have // label, we will need to remove
  29165. // generic ruleContext object.
  29166. // /
  29167. ParserRuleContext.prototype.removeLastChild = function() {
  29168. if (this.children !== null) {
  29169. this.children.pop();
  29170. }
  29171. };
  29172. ParserRuleContext.prototype.addTokenNode = function(token) {
  29173. var node = new TerminalNodeImpl(token);
  29174. this.addChild(node);
  29175. node.parentCtx = this;
  29176. return node;
  29177. };
  29178. ParserRuleContext.prototype.addErrorNode = function(badToken) {
  29179. var node = new ErrorNodeImpl(badToken);
  29180. this.addChild(node);
  29181. node.parentCtx = this;
  29182. return node;
  29183. };
  29184. ParserRuleContext.prototype.getChild = function(i, type) {
  29185. type = type || null;
  29186. if (this.children === null || i < 0 || i >= this.children.length) {
  29187. return null;
  29188. }
  29189. if (type === null) {
  29190. return this.children[i];
  29191. } else {
  29192. for(var j=0; j<this.children.length; j++) {
  29193. var child = this.children[j];
  29194. if(child instanceof type) {
  29195. if(i===0) {
  29196. return child;
  29197. } else {
  29198. i -= 1;
  29199. }
  29200. }
  29201. }
  29202. return null;
  29203. }
  29204. };
  29205. ParserRuleContext.prototype.getToken = function(ttype, i) {
  29206. if (this.children === null || i < 0 || i >= this.children.length) {
  29207. return null;
  29208. }
  29209. for(var j=0; j<this.children.length; j++) {
  29210. var child = this.children[j];
  29211. if (child instanceof TerminalNode) {
  29212. if (child.symbol.type === ttype) {
  29213. if(i===0) {
  29214. return child;
  29215. } else {
  29216. i -= 1;
  29217. }
  29218. }
  29219. }
  29220. }
  29221. return null;
  29222. };
  29223. ParserRuleContext.prototype.getTokens = function(ttype ) {
  29224. if (this.children=== null) {
  29225. return [];
  29226. } else {
  29227. var tokens = [];
  29228. for(var j=0; j<this.children.length; j++) {
  29229. var child = this.children[j];
  29230. if (child instanceof TerminalNode) {
  29231. if (child.symbol.type === ttype) {
  29232. tokens.push(child);
  29233. }
  29234. }
  29235. }
  29236. return tokens;
  29237. }
  29238. };
  29239. ParserRuleContext.prototype.getTypedRuleContext = function(ctxType, i) {
  29240. return this.getChild(i, ctxType);
  29241. };
  29242. ParserRuleContext.prototype.getTypedRuleContexts = function(ctxType) {
  29243. if (this.children=== null) {
  29244. return [];
  29245. } else {
  29246. var contexts = [];
  29247. for(var j=0; j<this.children.length; j++) {
  29248. var child = this.children[j];
  29249. if (child instanceof ctxType) {
  29250. contexts.push(child);
  29251. }
  29252. }
  29253. return contexts;
  29254. }
  29255. };
  29256. ParserRuleContext.prototype.getChildCount = function() {
  29257. if (this.children=== null) {
  29258. return 0;
  29259. } else {
  29260. return this.children.length;
  29261. }
  29262. };
  29263. ParserRuleContext.prototype.getSourceInterval = function() {
  29264. if( this.start === null || this.stop === null) {
  29265. return INVALID_INTERVAL;
  29266. } else {
  29267. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  29268. }
  29269. };
  29270. RuleContext.EMPTY = new ParserRuleContext();
  29271. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  29272. ParserRuleContext.call(parent, invokingStateNumber);
  29273. this.ruleIndex = ruleIndex;
  29274. return this;
  29275. }
  29276. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  29277. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  29278. exports.ParserRuleContext = ParserRuleContext;
  29279. /***/ }),
  29280. /***/ "./node_modules/antlr4/PredictionContext.js":
  29281. /*!**************************************************!*\
  29282. !*** ./node_modules/antlr4/PredictionContext.js ***!
  29283. \**************************************************/
  29284. /*! no static exports found */
  29285. /***/ (function(module, exports, __webpack_require__) {
  29286. //
  29287. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29288. * Use of this file is governed by the BSD 3-clause license that
  29289. * can be found in the LICENSE.txt file in the project root.
  29290. */
  29291. ///
  29292. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29293. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29294. function PredictionContext(cachedHashCode) {
  29295. this.cachedHashCode = cachedHashCode;
  29296. }
  29297. // Represents {@code $} in local context prediction, which means wildcard.
  29298. // {@code//+x =//}.
  29299. // /
  29300. PredictionContext.EMPTY = null;
  29301. // Represents {@code $} in an array in full context mode, when {@code $}
  29302. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  29303. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  29304. // /
  29305. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  29306. PredictionContext.globalNodeCount = 1;
  29307. PredictionContext.id = PredictionContext.globalNodeCount;
  29308. // Stores the computed hash code of this {@link PredictionContext}. The hash
  29309. // code is computed in parts to match the following reference algorithm.
  29310. //
  29311. // <pre>
  29312. // private int referenceHashCode() {
  29313. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  29314. // //INITIAL_HASH});
  29315. //
  29316. // for (int i = 0; i &lt; {@link //size()}; i++) {
  29317. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  29318. // getParent}(i));
  29319. // }
  29320. //
  29321. // for (int i = 0; i &lt; {@link //size()}; i++) {
  29322. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  29323. // //getReturnState getReturnState}(i));
  29324. // }
  29325. //
  29326. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  29327. // //size()});
  29328. // return hash;
  29329. // }
  29330. // </pre>
  29331. // /
  29332. // This means only the {@link //EMPTY} context is in set.
  29333. PredictionContext.prototype.isEmpty = function() {
  29334. return this === PredictionContext.EMPTY;
  29335. };
  29336. PredictionContext.prototype.hasEmptyPath = function() {
  29337. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  29338. };
  29339. PredictionContext.prototype.hashCode = function() {
  29340. return this.cachedHashCode;
  29341. };
  29342. PredictionContext.prototype.updateHashCode = function(hash) {
  29343. hash.update(this.cachedHashCode);
  29344. };
  29345. /*
  29346. function calculateHashString(parent, returnState) {
  29347. return "" + parent + returnState;
  29348. }
  29349. */
  29350. // Used to cache {@link PredictionContext} objects. Its used for the shared
  29351. // context cash associated with contexts in DFA states. This cache
  29352. // can be used for both lexers and parsers.
  29353. function PredictionContextCache() {
  29354. this.cache = {};
  29355. return this;
  29356. }
  29357. // Add a context to the cache and return it. If the context already exists,
  29358. // return that one instead and do not add a new context to the cache.
  29359. // Protect shared cache from unsafe thread access.
  29360. //
  29361. PredictionContextCache.prototype.add = function(ctx) {
  29362. if (ctx === PredictionContext.EMPTY) {
  29363. return PredictionContext.EMPTY;
  29364. }
  29365. var existing = this.cache[ctx] || null;
  29366. if (existing !== null) {
  29367. return existing;
  29368. }
  29369. this.cache[ctx] = ctx;
  29370. return ctx;
  29371. };
  29372. PredictionContextCache.prototype.get = function(ctx) {
  29373. return this.cache[ctx] || null;
  29374. };
  29375. Object.defineProperty(PredictionContextCache.prototype, "length", {
  29376. get : function() {
  29377. return this.cache.length;
  29378. }
  29379. });
  29380. function SingletonPredictionContext(parent, returnState) {
  29381. var hashCode = 0;
  29382. if(parent !== null) {
  29383. var hash = new Hash();
  29384. hash.update(parent, returnState);
  29385. hashCode = hash.finish();
  29386. }
  29387. PredictionContext.call(this, hashCode);
  29388. this.parentCtx = parent;
  29389. this.returnState = returnState;
  29390. }
  29391. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  29392. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  29393. SingletonPredictionContext.create = function(parent, returnState) {
  29394. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  29395. // someone can pass in the bits of an array ctx that mean $
  29396. return PredictionContext.EMPTY;
  29397. } else {
  29398. return new SingletonPredictionContext(parent, returnState);
  29399. }
  29400. };
  29401. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  29402. get : function() {
  29403. return 1;
  29404. }
  29405. });
  29406. SingletonPredictionContext.prototype.getParent = function(index) {
  29407. return this.parentCtx;
  29408. };
  29409. SingletonPredictionContext.prototype.getReturnState = function(index) {
  29410. return this.returnState;
  29411. };
  29412. SingletonPredictionContext.prototype.equals = function(other) {
  29413. if (this === other) {
  29414. return true;
  29415. } else if (!(other instanceof SingletonPredictionContext)) {
  29416. return false;
  29417. } else if (this.hashCode() !== other.hashCode()) {
  29418. return false; // can't be same if hash is different
  29419. } else {
  29420. if(this.returnState !== other.returnState)
  29421. return false;
  29422. else if(this.parentCtx==null)
  29423. return other.parentCtx==null
  29424. else
  29425. return this.parentCtx.equals(other.parentCtx);
  29426. }
  29427. };
  29428. SingletonPredictionContext.prototype.toString = function() {
  29429. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  29430. if (up.length === 0) {
  29431. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  29432. return "$";
  29433. } else {
  29434. return "" + this.returnState;
  29435. }
  29436. } else {
  29437. return "" + this.returnState + " " + up;
  29438. }
  29439. };
  29440. function EmptyPredictionContext() {
  29441. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  29442. return this;
  29443. }
  29444. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  29445. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  29446. EmptyPredictionContext.prototype.isEmpty = function() {
  29447. return true;
  29448. };
  29449. EmptyPredictionContext.prototype.getParent = function(index) {
  29450. return null;
  29451. };
  29452. EmptyPredictionContext.prototype.getReturnState = function(index) {
  29453. return this.returnState;
  29454. };
  29455. EmptyPredictionContext.prototype.equals = function(other) {
  29456. return this === other;
  29457. };
  29458. EmptyPredictionContext.prototype.toString = function() {
  29459. return "$";
  29460. };
  29461. PredictionContext.EMPTY = new EmptyPredictionContext();
  29462. function ArrayPredictionContext(parents, returnStates) {
  29463. // Parent can be null only if full ctx mode and we make an array
  29464. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  29465. // null parent and
  29466. // returnState == {@link //EMPTY_RETURN_STATE}.
  29467. var h = new Hash();
  29468. h.update(parents, returnStates);
  29469. var hashCode = h.finish();
  29470. PredictionContext.call(this, hashCode);
  29471. this.parents = parents;
  29472. this.returnStates = returnStates;
  29473. return this;
  29474. }
  29475. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  29476. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  29477. ArrayPredictionContext.prototype.isEmpty = function() {
  29478. // since EMPTY_RETURN_STATE can only appear in the last position, we
  29479. // don't need to verify that size==1
  29480. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  29481. };
  29482. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  29483. get : function() {
  29484. return this.returnStates.length;
  29485. }
  29486. });
  29487. ArrayPredictionContext.prototype.getParent = function(index) {
  29488. return this.parents[index];
  29489. };
  29490. ArrayPredictionContext.prototype.getReturnState = function(index) {
  29491. return this.returnStates[index];
  29492. };
  29493. ArrayPredictionContext.prototype.equals = function(other) {
  29494. if (this === other) {
  29495. return true;
  29496. } else if (!(other instanceof ArrayPredictionContext)) {
  29497. return false;
  29498. } else if (this.hashCode() !== other.hashCode()) {
  29499. return false; // can't be same if hash is different
  29500. } else {
  29501. return this.returnStates === other.returnStates &&
  29502. this.parents === other.parents;
  29503. }
  29504. };
  29505. ArrayPredictionContext.prototype.toString = function() {
  29506. if (this.isEmpty()) {
  29507. return "[]";
  29508. } else {
  29509. var s = "[";
  29510. for (var i = 0; i < this.returnStates.length; i++) {
  29511. if (i > 0) {
  29512. s = s + ", ";
  29513. }
  29514. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  29515. s = s + "$";
  29516. continue;
  29517. }
  29518. s = s + this.returnStates[i];
  29519. if (this.parents[i] !== null) {
  29520. s = s + " " + this.parents[i];
  29521. } else {
  29522. s = s + "null";
  29523. }
  29524. }
  29525. return s + "]";
  29526. }
  29527. };
  29528. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  29529. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  29530. // /
  29531. function predictionContextFromRuleContext(atn, outerContext) {
  29532. if (outerContext === undefined || outerContext === null) {
  29533. outerContext = RuleContext.EMPTY;
  29534. }
  29535. // if we are in RuleContext of start rule, s, then PredictionContext
  29536. // is EMPTY. Nobody called us. (if we are empty, return empty)
  29537. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  29538. return PredictionContext.EMPTY;
  29539. }
  29540. // If we have a parent, convert it to a PredictionContext graph
  29541. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  29542. var state = atn.states[outerContext.invokingState];
  29543. var transition = state.transitions[0];
  29544. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  29545. }
  29546. /*
  29547. function calculateListsHashString(parents, returnStates) {
  29548. var s = "";
  29549. parents.map(function(p) {
  29550. s = s + p;
  29551. });
  29552. returnStates.map(function(r) {
  29553. s = s + r;
  29554. });
  29555. return s;
  29556. }
  29557. */
  29558. function merge(a, b, rootIsWildcard, mergeCache) {
  29559. // share same graph if both same
  29560. if (a === b) {
  29561. return a;
  29562. }
  29563. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  29564. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  29565. }
  29566. // At least one of a or b is array
  29567. // If one is $ and rootIsWildcard, return $ as// wildcard
  29568. if (rootIsWildcard) {
  29569. if (a instanceof EmptyPredictionContext) {
  29570. return a;
  29571. }
  29572. if (b instanceof EmptyPredictionContext) {
  29573. return b;
  29574. }
  29575. }
  29576. // convert singleton so both are arrays to normalize
  29577. if (a instanceof SingletonPredictionContext) {
  29578. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  29579. }
  29580. if (b instanceof SingletonPredictionContext) {
  29581. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  29582. }
  29583. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  29584. }
  29585. //
  29586. // Merge two {@link SingletonPredictionContext} instances.
  29587. //
  29588. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  29589. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  29590. // type="image/svg+xml"/></p>
  29591. //
  29592. // <p>Same stack top, parents differ; merge parents giving array node, then
  29593. // remainders of those graphs. A new root node is created to point to the
  29594. // merged parents.<br>
  29595. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  29596. // type="image/svg+xml"/></p>
  29597. //
  29598. // <p>Different stack tops pointing to same parent. Make array node for the
  29599. // root where both element in the root point to the same (original)
  29600. // parent.<br>
  29601. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  29602. // type="image/svg+xml"/></p>
  29603. //
  29604. // <p>Different stack tops pointing to different parents. Make array node for
  29605. // the root where each element points to the corresponding original
  29606. // parent.<br>
  29607. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  29608. // type="image/svg+xml"/></p>
  29609. //
  29610. // @param a the first {@link SingletonPredictionContext}
  29611. // @param b the second {@link SingletonPredictionContext}
  29612. // @param rootIsWildcard {@code true} if this is a local-context merge,
  29613. // otherwise false to indicate a full-context merge
  29614. // @param mergeCache
  29615. // /
  29616. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  29617. if (mergeCache !== null) {
  29618. var previous = mergeCache.get(a, b);
  29619. if (previous !== null) {
  29620. return previous;
  29621. }
  29622. previous = mergeCache.get(b, a);
  29623. if (previous !== null) {
  29624. return previous;
  29625. }
  29626. }
  29627. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  29628. if (rootMerge !== null) {
  29629. if (mergeCache !== null) {
  29630. mergeCache.set(a, b, rootMerge);
  29631. }
  29632. return rootMerge;
  29633. }
  29634. if (a.returnState === b.returnState) {
  29635. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  29636. // if parent is same as existing a or b parent or reduced to a parent,
  29637. // return it
  29638. if (parent === a.parentCtx) {
  29639. return a; // ax + bx = ax, if a=b
  29640. }
  29641. if (parent === b.parentCtx) {
  29642. return b; // ax + bx = bx, if a=b
  29643. }
  29644. // else: ax + ay = a'[x,y]
  29645. // merge parents x and y, giving array node with x,y then remainders
  29646. // of those graphs. dup a, a' points at merged array
  29647. // new joined parent so create new singleton pointing to it, a'
  29648. var spc = SingletonPredictionContext.create(parent, a.returnState);
  29649. if (mergeCache !== null) {
  29650. mergeCache.set(a, b, spc);
  29651. }
  29652. return spc;
  29653. } else { // a != b payloads differ
  29654. // see if we can collapse parents due to $+x parents if local ctx
  29655. var singleParent = null;
  29656. if (a === b || (a.parentCtx !== null && a.parentCtx === b.parentCtx)) { // ax +
  29657. // bx =
  29658. // [a,b]x
  29659. singleParent = a.parentCtx;
  29660. }
  29661. if (singleParent !== null) { // parents are same
  29662. // sort payloads and use same parent
  29663. var payloads = [ a.returnState, b.returnState ];
  29664. if (a.returnState > b.returnState) {
  29665. payloads[0] = b.returnState;
  29666. payloads[1] = a.returnState;
  29667. }
  29668. var parents = [ singleParent, singleParent ];
  29669. var apc = new ArrayPredictionContext(parents, payloads);
  29670. if (mergeCache !== null) {
  29671. mergeCache.set(a, b, apc);
  29672. }
  29673. return apc;
  29674. }
  29675. // parents differ and can't merge them. Just pack together
  29676. // into array; can't merge.
  29677. // ax + by = [ax,by]
  29678. var payloads = [ a.returnState, b.returnState ];
  29679. var parents = [ a.parentCtx, b.parentCtx ];
  29680. if (a.returnState > b.returnState) { // sort by payload
  29681. payloads[0] = b.returnState;
  29682. payloads[1] = a.returnState;
  29683. parents = [ b.parentCtx, a.parentCtx ];
  29684. }
  29685. var a_ = new ArrayPredictionContext(parents, payloads);
  29686. if (mergeCache !== null) {
  29687. mergeCache.set(a, b, a_);
  29688. }
  29689. return a_;
  29690. }
  29691. }
  29692. //
  29693. // Handle case where at least one of {@code a} or {@code b} is
  29694. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  29695. // to represent {@link //EMPTY}.
  29696. //
  29697. // <h2>Local-Context Merges</h2>
  29698. //
  29699. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  29700. // is true.</p>
  29701. //
  29702. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  29703. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  29704. //
  29705. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  29706. // {@code //EMPTY}; return left graph.<br>
  29707. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  29708. //
  29709. // <p>Special case of last merge if local context.<br>
  29710. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  29711. //
  29712. // <h2>Full-Context Merges</h2>
  29713. //
  29714. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  29715. // is false.</p>
  29716. //
  29717. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  29718. //
  29719. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  29720. // null parent).<br>
  29721. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  29722. //
  29723. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  29724. //
  29725. // @param a the first {@link SingletonPredictionContext}
  29726. // @param b the second {@link SingletonPredictionContext}
  29727. // @param rootIsWildcard {@code true} if this is a local-context merge,
  29728. // otherwise false to indicate a full-context merge
  29729. // /
  29730. function mergeRoot(a, b, rootIsWildcard) {
  29731. if (rootIsWildcard) {
  29732. if (a === PredictionContext.EMPTY) {
  29733. return PredictionContext.EMPTY; // // + b =//
  29734. }
  29735. if (b === PredictionContext.EMPTY) {
  29736. return PredictionContext.EMPTY; // a +// =//
  29737. }
  29738. } else {
  29739. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  29740. return PredictionContext.EMPTY; // $ + $ = $
  29741. } else if (a === PredictionContext.EMPTY) { // $ + x = [$,x]
  29742. var payloads = [ b.returnState,
  29743. PredictionContext.EMPTY_RETURN_STATE ];
  29744. var parents = [ b.parentCtx, null ];
  29745. return new ArrayPredictionContext(parents, payloads);
  29746. } else if (b === PredictionContext.EMPTY) { // x + $ = [$,x] ($ is always first if present)
  29747. var payloads = [ a.returnState, PredictionContext.EMPTY_RETURN_STATE ];
  29748. var parents = [ a.parentCtx, null ];
  29749. return new ArrayPredictionContext(parents, payloads);
  29750. }
  29751. }
  29752. return null;
  29753. }
  29754. //
  29755. // Merge two {@link ArrayPredictionContext} instances.
  29756. //
  29757. // <p>Different tops, different parents.<br>
  29758. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  29759. //
  29760. // <p>Shared top, same parents.<br>
  29761. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  29762. //
  29763. // <p>Shared top, different parents.<br>
  29764. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  29765. //
  29766. // <p>Shared top, all shared parents.<br>
  29767. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  29768. // type="image/svg+xml"/></p>
  29769. //
  29770. // <p>Equal tops, merge parents and reduce top to
  29771. // {@link SingletonPredictionContext}.<br>
  29772. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  29773. // /
  29774. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  29775. if (mergeCache !== null) {
  29776. var previous = mergeCache.get(a, b);
  29777. if (previous !== null) {
  29778. return previous;
  29779. }
  29780. previous = mergeCache.get(b, a);
  29781. if (previous !== null) {
  29782. return previous;
  29783. }
  29784. }
  29785. // merge sorted payloads a + b => M
  29786. var i = 0; // walks a
  29787. var j = 0; // walks b
  29788. var k = 0; // walks target M array
  29789. var mergedReturnStates = [];
  29790. var mergedParents = [];
  29791. // walk and merge to yield mergedParents, mergedReturnStates
  29792. while (i < a.returnStates.length && j < b.returnStates.length) {
  29793. var a_parent = a.parents[i];
  29794. var b_parent = b.parents[j];
  29795. if (a.returnStates[i] === b.returnStates[j]) {
  29796. // same payload (stack tops are equal), must yield merged singleton
  29797. var payload = a.returnStates[i];
  29798. // $+$ = $
  29799. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE &&
  29800. a_parent === null && b_parent === null;
  29801. var ax_ax = (a_parent !== null && b_parent !== null && a_parent === b_parent); // ax+ax
  29802. // ->
  29803. // ax
  29804. if (bothDollars || ax_ax) {
  29805. mergedParents[k] = a_parent; // choose left
  29806. mergedReturnStates[k] = payload;
  29807. } else { // ax+ay -> a'[x,y]
  29808. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  29809. mergedParents[k] = mergedParent;
  29810. mergedReturnStates[k] = payload;
  29811. }
  29812. i += 1; // hop over left one as usual
  29813. j += 1; // but also skip one in right side since we merge
  29814. } else if (a.returnStates[i] < b.returnStates[j]) { // copy a[i] to M
  29815. mergedParents[k] = a_parent;
  29816. mergedReturnStates[k] = a.returnStates[i];
  29817. i += 1;
  29818. } else { // b > a, copy b[j] to M
  29819. mergedParents[k] = b_parent;
  29820. mergedReturnStates[k] = b.returnStates[j];
  29821. j += 1;
  29822. }
  29823. k += 1;
  29824. }
  29825. // copy over any payloads remaining in either array
  29826. if (i < a.returnStates.length) {
  29827. for (var p = i; p < a.returnStates.length; p++) {
  29828. mergedParents[k] = a.parents[p];
  29829. mergedReturnStates[k] = a.returnStates[p];
  29830. k += 1;
  29831. }
  29832. } else {
  29833. for (var p = j; p < b.returnStates.length; p++) {
  29834. mergedParents[k] = b.parents[p];
  29835. mergedReturnStates[k] = b.returnStates[p];
  29836. k += 1;
  29837. }
  29838. }
  29839. // trim merged if we combined a few that had same stack tops
  29840. if (k < mergedParents.length) { // write index < last position; trim
  29841. if (k === 1) { // for just one merged element, return singleton top
  29842. var a_ = SingletonPredictionContext.create(mergedParents[0],
  29843. mergedReturnStates[0]);
  29844. if (mergeCache !== null) {
  29845. mergeCache.set(a, b, a_);
  29846. }
  29847. return a_;
  29848. }
  29849. mergedParents = mergedParents.slice(0, k);
  29850. mergedReturnStates = mergedReturnStates.slice(0, k);
  29851. }
  29852. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  29853. // if we created same array as a or b, return that instead
  29854. // TODO: track whether this is possible above during merge sort for speed
  29855. if (M === a) {
  29856. if (mergeCache !== null) {
  29857. mergeCache.set(a, b, a);
  29858. }
  29859. return a;
  29860. }
  29861. if (M === b) {
  29862. if (mergeCache !== null) {
  29863. mergeCache.set(a, b, b);
  29864. }
  29865. return b;
  29866. }
  29867. combineCommonParents(mergedParents);
  29868. if (mergeCache !== null) {
  29869. mergeCache.set(a, b, M);
  29870. }
  29871. return M;
  29872. }
  29873. //
  29874. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  29875. // ones.
  29876. // /
  29877. function combineCommonParents(parents) {
  29878. var uniqueParents = {};
  29879. for (var p = 0; p < parents.length; p++) {
  29880. var parent = parents[p];
  29881. if (!(parent in uniqueParents)) {
  29882. uniqueParents[parent] = parent;
  29883. }
  29884. }
  29885. for (var q = 0; q < parents.length; q++) {
  29886. parents[q] = uniqueParents[parents[q]];
  29887. }
  29888. }
  29889. function getCachedPredictionContext(context, contextCache, visited) {
  29890. if (context.isEmpty()) {
  29891. return context;
  29892. }
  29893. var existing = visited[context] || null;
  29894. if (existing !== null) {
  29895. return existing;
  29896. }
  29897. existing = contextCache.get(context);
  29898. if (existing !== null) {
  29899. visited[context] = existing;
  29900. return existing;
  29901. }
  29902. var changed = false;
  29903. var parents = [];
  29904. for (var i = 0; i < parents.length; i++) {
  29905. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  29906. if (changed || parent !== context.getParent(i)) {
  29907. if (!changed) {
  29908. parents = [];
  29909. for (var j = 0; j < context.length; j++) {
  29910. parents[j] = context.getParent(j);
  29911. }
  29912. changed = true;
  29913. }
  29914. parents[i] = parent;
  29915. }
  29916. }
  29917. if (!changed) {
  29918. contextCache.add(context);
  29919. visited[context] = context;
  29920. return context;
  29921. }
  29922. var updated = null;
  29923. if (parents.length === 0) {
  29924. updated = PredictionContext.EMPTY;
  29925. } else if (parents.length === 1) {
  29926. updated = SingletonPredictionContext.create(parents[0], context
  29927. .getReturnState(0));
  29928. } else {
  29929. updated = new ArrayPredictionContext(parents, context.returnStates);
  29930. }
  29931. contextCache.add(updated);
  29932. visited[updated] = updated;
  29933. visited[context] = updated;
  29934. return updated;
  29935. }
  29936. // ter's recursive version of Sam's getAllNodes()
  29937. function getAllContextNodes(context, nodes, visited) {
  29938. if (nodes === null) {
  29939. nodes = [];
  29940. return getAllContextNodes(context, nodes, visited);
  29941. } else if (visited === null) {
  29942. visited = {};
  29943. return getAllContextNodes(context, nodes, visited);
  29944. } else {
  29945. if (context === null || visited[context] !== null) {
  29946. return nodes;
  29947. }
  29948. visited[context] = context;
  29949. nodes.push(context);
  29950. for (var i = 0; i < context.length; i++) {
  29951. getAllContextNodes(context.getParent(i), nodes, visited);
  29952. }
  29953. return nodes;
  29954. }
  29955. }
  29956. exports.merge = merge;
  29957. exports.PredictionContext = PredictionContext;
  29958. exports.PredictionContextCache = PredictionContextCache;
  29959. exports.SingletonPredictionContext = SingletonPredictionContext;
  29960. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  29961. exports.getCachedPredictionContext = getCachedPredictionContext;
  29962. /***/ }),
  29963. /***/ "./node_modules/antlr4/Recognizer.js":
  29964. /*!*******************************************!*\
  29965. !*** ./node_modules/antlr4/Recognizer.js ***!
  29966. \*******************************************/
  29967. /*! no static exports found */
  29968. /***/ (function(module, exports, __webpack_require__) {
  29969. //
  29970. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29971. * Use of this file is governed by the BSD 3-clause license that
  29972. * can be found in the LICENSE.txt file in the project root.
  29973. */
  29974. //
  29975. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  29976. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  29977. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  29978. function Recognizer() {
  29979. this._listeners = [ ConsoleErrorListener.INSTANCE ];
  29980. this._interp = null;
  29981. this._stateNumber = -1;
  29982. return this;
  29983. }
  29984. Recognizer.tokenTypeMapCache = {};
  29985. Recognizer.ruleIndexMapCache = {};
  29986. Recognizer.prototype.checkVersion = function(toolVersion) {
  29987. var runtimeVersion = "4.7.1";
  29988. if (runtimeVersion!==toolVersion) {
  29989. console.log("ANTLR runtime and generated code versions disagree: "+runtimeVersion+"!="+toolVersion);
  29990. }
  29991. };
  29992. Recognizer.prototype.addErrorListener = function(listener) {
  29993. this._listeners.push(listener);
  29994. };
  29995. Recognizer.prototype.removeErrorListeners = function() {
  29996. this._listeners = [];
  29997. };
  29998. Recognizer.prototype.getTokenTypeMap = function() {
  29999. var tokenNames = this.getTokenNames();
  30000. if (tokenNames===null) {
  30001. throw("The current recognizer does not provide a list of token names.");
  30002. }
  30003. var result = this.tokenTypeMapCache[tokenNames];
  30004. if(result===undefined) {
  30005. result = tokenNames.reduce(function(o, k, i) { o[k] = i; });
  30006. result.EOF = Token.EOF;
  30007. this.tokenTypeMapCache[tokenNames] = result;
  30008. }
  30009. return result;
  30010. };
  30011. // Get a map from rule names to rule indexes.
  30012. //
  30013. // <p>Used for XPath and tree pattern compilation.</p>
  30014. //
  30015. Recognizer.prototype.getRuleIndexMap = function() {
  30016. var ruleNames = this.ruleNames;
  30017. if (ruleNames===null) {
  30018. throw("The current recognizer does not provide a list of rule names.");
  30019. }
  30020. var result = this.ruleIndexMapCache[ruleNames];
  30021. if(result===undefined) {
  30022. result = ruleNames.reduce(function(o, k, i) { o[k] = i; });
  30023. this.ruleIndexMapCache[ruleNames] = result;
  30024. }
  30025. return result;
  30026. };
  30027. Recognizer.prototype.getTokenType = function(tokenName) {
  30028. var ttype = this.getTokenTypeMap()[tokenName];
  30029. if (ttype !==undefined) {
  30030. return ttype;
  30031. } else {
  30032. return Token.INVALID_TYPE;
  30033. }
  30034. };
  30035. // What is the error header, normally line/character position information?//
  30036. Recognizer.prototype.getErrorHeader = function(e) {
  30037. var line = e.getOffendingToken().line;
  30038. var column = e.getOffendingToken().column;
  30039. return "line " + line + ":" + column;
  30040. };
  30041. // How should a token be displayed in an error message? The default
  30042. // is to display just the text, but during development you might
  30043. // want to have a lot of information spit out. Override in that case
  30044. // to use t.toString() (which, for CommonToken, dumps everything about
  30045. // the token). This is better than forcing you to override a method in
  30046. // your token objects because you don't have to go modify your lexer
  30047. // so that it creates a new Java type.
  30048. //
  30049. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  30050. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  30051. // feature when necessary. For example, see
  30052. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  30053. //
  30054. Recognizer.prototype.getTokenErrorDisplay = function(t) {
  30055. if (t===null) {
  30056. return "<no token>";
  30057. }
  30058. var s = t.text;
  30059. if (s===null) {
  30060. if (t.type===Token.EOF) {
  30061. s = "<EOF>";
  30062. } else {
  30063. s = "<" + t.type + ">";
  30064. }
  30065. }
  30066. s = s.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t");
  30067. return "'" + s + "'";
  30068. };
  30069. Recognizer.prototype.getErrorListenerDispatch = function() {
  30070. return new ProxyErrorListener(this._listeners);
  30071. };
  30072. // subclass needs to override these if there are sempreds or actions
  30073. // that the ATN interp needs to execute
  30074. Recognizer.prototype.sempred = function(localctx, ruleIndex, actionIndex) {
  30075. return true;
  30076. };
  30077. Recognizer.prototype.precpred = function(localctx , precedence) {
  30078. return true;
  30079. };
  30080. //Indicate that the recognizer has changed internal state that is
  30081. //consistent with the ATN state passed in. This way we always know
  30082. //where we are in the ATN as the parser goes along. The rule
  30083. //context objects form a stack that lets us see the stack of
  30084. //invoking rules. Combine this and we have complete ATN
  30085. //configuration information.
  30086. Object.defineProperty(Recognizer.prototype, "state", {
  30087. get : function() {
  30088. return this._stateNumber;
  30089. },
  30090. set : function(state) {
  30091. this._stateNumber = state;
  30092. }
  30093. });
  30094. exports.Recognizer = Recognizer;
  30095. /***/ }),
  30096. /***/ "./node_modules/antlr4/RuleContext.js":
  30097. /*!********************************************!*\
  30098. !*** ./node_modules/antlr4/RuleContext.js ***!
  30099. \********************************************/
  30100. /*! no static exports found */
  30101. /***/ (function(module, exports, __webpack_require__) {
  30102. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30103. * Use of this file is governed by the BSD 3-clause license that
  30104. * can be found in the LICENSE.txt file in the project root.
  30105. */
  30106. ///
  30107. // A rule context is a record of a single rule invocation. It knows
  30108. // which context invoked it, if any. If there is no parent context, then
  30109. // naturally the invoking state is not valid. The parent link
  30110. // provides a chain upwards from the current rule invocation to the root
  30111. // of the invocation tree, forming a stack. We actually carry no
  30112. // information about the rule associated with this context (except
  30113. // when parsing). We keep only the state number of the invoking state from
  30114. // the ATN submachine that invoked this. Contrast this with the s
  30115. // pointer inside ParserRuleContext that tracks the current state
  30116. // being "executed" for the current rule.
  30117. //
  30118. // The parent contexts are useful for computing lookahead sets and
  30119. // getting error information.
  30120. //
  30121. // These objects are used during parsing and prediction.
  30122. // For the special case of parsers, we use the subclass
  30123. // ParserRuleContext.
  30124. //
  30125. // @see ParserRuleContext
  30126. ///
  30127. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  30128. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  30129. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  30130. function RuleContext(parent, invokingState) {
  30131. RuleNode.call(this);
  30132. // What context invoked this rule?
  30133. this.parentCtx = parent || null;
  30134. // What state invoked the rule associated with this context?
  30135. // The "return address" is the followState of invokingState
  30136. // If parent is null, this should be -1.
  30137. this.invokingState = invokingState || -1;
  30138. return this;
  30139. }
  30140. RuleContext.prototype = Object.create(RuleNode.prototype);
  30141. RuleContext.prototype.constructor = RuleContext;
  30142. RuleContext.prototype.depth = function() {
  30143. var n = 0;
  30144. var p = this;
  30145. while (p !== null) {
  30146. p = p.parentCtx;
  30147. n += 1;
  30148. }
  30149. return n;
  30150. };
  30151. // A context is empty if there is no invoking state; meaning nobody call
  30152. // current context.
  30153. RuleContext.prototype.isEmpty = function() {
  30154. return this.invokingState === -1;
  30155. };
  30156. // satisfy the ParseTree / SyntaxTree interface
  30157. RuleContext.prototype.getSourceInterval = function() {
  30158. return INVALID_INTERVAL;
  30159. };
  30160. RuleContext.prototype.getRuleContext = function() {
  30161. return this;
  30162. };
  30163. RuleContext.prototype.getPayload = function() {
  30164. return this;
  30165. };
  30166. // Return the combined text of all child nodes. This method only considers
  30167. // tokens which have been added to the parse tree.
  30168. // <p>
  30169. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  30170. // added to the parse trees, they will not appear in the output of this
  30171. // method.
  30172. // /
  30173. RuleContext.prototype.getText = function() {
  30174. if (this.getChildCount() === 0) {
  30175. return "";
  30176. } else {
  30177. return this.children.map(function(child) {
  30178. return child.getText();
  30179. }).join("");
  30180. }
  30181. };
  30182. // For rule associated with this parse tree internal node, return
  30183. // the outer alternative number used to match the input. Default
  30184. // implementation does not compute nor store this alt num. Create
  30185. // a subclass of ParserRuleContext with backing field and set
  30186. // option contextSuperClass.
  30187. // to set it.
  30188. RuleContext.prototype.getAltNumber = function() { return INVALID_ALT_NUMBER; }
  30189. // Set the outer alternative number for this context node. Default
  30190. // implementation does nothing to avoid backing field overhead for
  30191. // trees that don't need it. Create
  30192. // a subclass of ParserRuleContext with backing field and set
  30193. // option contextSuperClass.
  30194. RuleContext.prototype.setAltNumber = function(altNumber) { }
  30195. RuleContext.prototype.getChild = function(i) {
  30196. return null;
  30197. };
  30198. RuleContext.prototype.getChildCount = function() {
  30199. return 0;
  30200. };
  30201. RuleContext.prototype.accept = function(visitor) {
  30202. return visitor.visitChildren(this);
  30203. };
  30204. //need to manage circular dependencies, so export now
  30205. exports.RuleContext = RuleContext;
  30206. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  30207. // Print out a whole tree, not just a node, in LISP format
  30208. // (root child1 .. childN). Print just a node if this is a leaf.
  30209. //
  30210. RuleContext.prototype.toStringTree = function(ruleNames, recog) {
  30211. return Trees.toStringTree(this, ruleNames, recog);
  30212. };
  30213. RuleContext.prototype.toString = function(ruleNames, stop) {
  30214. ruleNames = ruleNames || null;
  30215. stop = stop || null;
  30216. var p = this;
  30217. var s = "[";
  30218. while (p !== null && p !== stop) {
  30219. if (ruleNames === null) {
  30220. if (!p.isEmpty()) {
  30221. s += p.invokingState;
  30222. }
  30223. } else {
  30224. var ri = p.ruleIndex;
  30225. var ruleName = (ri >= 0 && ri < ruleNames.length) ? ruleNames[ri]
  30226. : "" + ri;
  30227. s += ruleName;
  30228. }
  30229. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  30230. s += " ";
  30231. }
  30232. p = p.parentCtx;
  30233. }
  30234. s += "]";
  30235. return s;
  30236. };
  30237. /***/ }),
  30238. /***/ "./node_modules/antlr4/Token.js":
  30239. /*!**************************************!*\
  30240. !*** ./node_modules/antlr4/Token.js ***!
  30241. \**************************************/
  30242. /*! no static exports found */
  30243. /***/ (function(module, exports) {
  30244. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30245. * Use of this file is governed by the BSD 3-clause license that
  30246. * can be found in the LICENSE.txt file in the project root.
  30247. */
  30248. //
  30249. // A token has properties: text, type, line, character position in the line
  30250. // (so we can ignore tabs), token channel, index, and source from which
  30251. // we obtained this token.
  30252. function Token() {
  30253. this.source = null;
  30254. this.type = null; // token type of the token
  30255. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  30256. this.start = null; // optional; return -1 if not implemented.
  30257. this.stop = null; // optional; return -1 if not implemented.
  30258. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  30259. this.line = null; // line=1..n of the 1st character
  30260. this.column = null; // beginning of the line at which it occurs, 0..n-1
  30261. this._text = null; // text of the token.
  30262. return this;
  30263. }
  30264. Token.INVALID_TYPE = 0;
  30265. // During lookahead operations, this "token" signifies we hit rule end ATN state
  30266. // and did not follow it despite needing to.
  30267. Token.EPSILON = -2;
  30268. Token.MIN_USER_TOKEN_TYPE = 1;
  30269. Token.EOF = -1;
  30270. // All tokens go to the parser (unless skip() is called in that rule)
  30271. // on a particular "channel". The parser tunes to a particular channel
  30272. // so that whitespace etc... can go to the parser on a "hidden" channel.
  30273. Token.DEFAULT_CHANNEL = 0;
  30274. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  30275. // by parser.
  30276. Token.HIDDEN_CHANNEL = 1;
  30277. // Explicitly set the text for this token. If {code text} is not
  30278. // {@code null}, then {@link //getText} will return this value rather than
  30279. // extracting the text from the input.
  30280. //
  30281. // @param text The explicit text of the token, or {@code null} if the text
  30282. // should be obtained from the input along with the start and stop indexes
  30283. // of the token.
  30284. Object.defineProperty(Token.prototype, "text", {
  30285. get : function() {
  30286. return this._text;
  30287. },
  30288. set : function(text) {
  30289. this._text = text;
  30290. }
  30291. });
  30292. Token.prototype.getTokenSource = function() {
  30293. return this.source[0];
  30294. };
  30295. Token.prototype.getInputStream = function() {
  30296. return this.source[1];
  30297. };
  30298. function CommonToken(source, type, channel, start, stop) {
  30299. Token.call(this);
  30300. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  30301. this.type = type !== undefined ? type : null;
  30302. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  30303. this.start = start !== undefined ? start : -1;
  30304. this.stop = stop !== undefined ? stop : -1;
  30305. this.tokenIndex = -1;
  30306. if (this.source[0] !== null) {
  30307. this.line = source[0].line;
  30308. this.column = source[0].column;
  30309. } else {
  30310. this.column = -1;
  30311. }
  30312. return this;
  30313. }
  30314. CommonToken.prototype = Object.create(Token.prototype);
  30315. CommonToken.prototype.constructor = CommonToken;
  30316. // An empty {@link Pair} which is used as the default value of
  30317. // {@link //source} for tokens that do not have a source.
  30318. CommonToken.EMPTY_SOURCE = [ null, null ];
  30319. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  30320. //
  30321. // <p>
  30322. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  30323. // constructed token will share a reference to the {@link //text} field and
  30324. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  30325. // be assigned the result of calling {@link //getText}, and {@link //source}
  30326. // will be constructed from the result of {@link Token//getTokenSource} and
  30327. // {@link Token//getInputStream}.</p>
  30328. //
  30329. // @param oldToken The token to copy.
  30330. //
  30331. CommonToken.prototype.clone = function() {
  30332. var t = new CommonToken(this.source, this.type, this.channel, this.start,
  30333. this.stop);
  30334. t.tokenIndex = this.tokenIndex;
  30335. t.line = this.line;
  30336. t.column = this.column;
  30337. t.text = this.text;
  30338. return t;
  30339. };
  30340. Object.defineProperty(CommonToken.prototype, "text", {
  30341. get : function() {
  30342. if (this._text !== null) {
  30343. return this._text;
  30344. }
  30345. var input = this.getInputStream();
  30346. if (input === null) {
  30347. return null;
  30348. }
  30349. var n = input.size;
  30350. if (this.start < n && this.stop < n) {
  30351. return input.getText(this.start, this.stop);
  30352. } else {
  30353. return "<EOF>";
  30354. }
  30355. },
  30356. set : function(text) {
  30357. this._text = text;
  30358. }
  30359. });
  30360. CommonToken.prototype.toString = function() {
  30361. var txt = this.text;
  30362. if (txt !== null) {
  30363. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  30364. } else {
  30365. txt = "<no text>";
  30366. }
  30367. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" +
  30368. txt + "',<" + this.type + ">" +
  30369. (this.channel > 0 ? ",channel=" + this.channel : "") + "," +
  30370. this.line + ":" + this.column + "]";
  30371. };
  30372. exports.Token = Token;
  30373. exports.CommonToken = CommonToken;
  30374. /***/ }),
  30375. /***/ "./node_modules/antlr4/Utils.js":
  30376. /*!**************************************!*\
  30377. !*** ./node_modules/antlr4/Utils.js ***!
  30378. \**************************************/
  30379. /*! no static exports found */
  30380. /***/ (function(module, exports) {
  30381. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30382. * Use of this file is governed by the BSD 3-clause license that
  30383. * can be found in the LICENSE.txt file in the project root.
  30384. */
  30385. function arrayToString(a) {
  30386. return "[" + a.join(", ") + "]";
  30387. }
  30388. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  30389. String.prototype.hashCode = function () {
  30390. var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i,
  30391. key = this.toString();
  30392. remainder = key.length & 3; // key.length % 4
  30393. bytes = key.length - remainder;
  30394. h1 = String.prototype.seed;
  30395. c1 = 0xcc9e2d51;
  30396. c2 = 0x1b873593;
  30397. i = 0;
  30398. while (i < bytes) {
  30399. k1 =
  30400. ((key.charCodeAt(i) & 0xff)) |
  30401. ((key.charCodeAt(++i) & 0xff) << 8) |
  30402. ((key.charCodeAt(++i) & 0xff) << 16) |
  30403. ((key.charCodeAt(++i) & 0xff) << 24);
  30404. ++i;
  30405. k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;
  30406. k1 = (k1 << 15) | (k1 >>> 17);
  30407. k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;
  30408. h1 ^= k1;
  30409. h1 = (h1 << 13) | (h1 >>> 19);
  30410. h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;
  30411. h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));
  30412. }
  30413. k1 = 0;
  30414. switch (remainder) {
  30415. case 3:
  30416. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  30417. case 2:
  30418. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  30419. case 1:
  30420. k1 ^= (key.charCodeAt(i) & 0xff);
  30421. k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;
  30422. k1 = (k1 << 15) | (k1 >>> 17);
  30423. k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;
  30424. h1 ^= k1;
  30425. }
  30426. h1 ^= key.length;
  30427. h1 ^= h1 >>> 16;
  30428. h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;
  30429. h1 ^= h1 >>> 13;
  30430. h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;
  30431. h1 ^= h1 >>> 16;
  30432. return h1 >>> 0;
  30433. };
  30434. function standardEqualsFunction(a, b) {
  30435. return a.equals(b);
  30436. }
  30437. function standardHashCodeFunction(a) {
  30438. return a.hashCode();
  30439. }
  30440. function Set(hashFunction, equalsFunction) {
  30441. this.data = {};
  30442. this.hashFunction = hashFunction || standardHashCodeFunction;
  30443. this.equalsFunction = equalsFunction || standardEqualsFunction;
  30444. return this;
  30445. }
  30446. Object.defineProperty(Set.prototype, "length", {
  30447. get: function () {
  30448. var l = 0;
  30449. for (var key in this.data) {
  30450. if (key.indexOf("hash_") === 0) {
  30451. l = l + this.data[key].length;
  30452. }
  30453. }
  30454. return l;
  30455. }
  30456. });
  30457. Set.prototype.add = function (value) {
  30458. var hash = this.hashFunction(value);
  30459. var key = "hash_" + hash;
  30460. if (key in this.data) {
  30461. var values = this.data[key];
  30462. for (var i = 0; i < values.length; i++) {
  30463. if (this.equalsFunction(value, values[i])) {
  30464. return values[i];
  30465. }
  30466. }
  30467. values.push(value);
  30468. return value;
  30469. } else {
  30470. this.data[key] = [value];
  30471. return value;
  30472. }
  30473. };
  30474. Set.prototype.contains = function (value) {
  30475. return this.get(value) != null;
  30476. };
  30477. Set.prototype.get = function (value) {
  30478. var hash = this.hashFunction(value);
  30479. var key = "hash_" + hash;
  30480. if (key in this.data) {
  30481. var values = this.data[key];
  30482. for (var i = 0; i < values.length; i++) {
  30483. if (this.equalsFunction(value, values[i])) {
  30484. return values[i];
  30485. }
  30486. }
  30487. }
  30488. return null;
  30489. };
  30490. Set.prototype.values = function () {
  30491. var l = [];
  30492. for (var key in this.data) {
  30493. if (key.indexOf("hash_") === 0) {
  30494. l = l.concat(this.data[key]);
  30495. }
  30496. }
  30497. return l;
  30498. };
  30499. Set.prototype.toString = function () {
  30500. return arrayToString(this.values());
  30501. };
  30502. function BitSet() {
  30503. this.data = [];
  30504. return this;
  30505. }
  30506. BitSet.prototype.add = function (value) {
  30507. this.data[value] = true;
  30508. };
  30509. BitSet.prototype.or = function (set) {
  30510. var bits = this;
  30511. Object.keys(set.data).map(function (alt) {
  30512. bits.add(alt);
  30513. });
  30514. };
  30515. BitSet.prototype.remove = function (value) {
  30516. delete this.data[value];
  30517. };
  30518. BitSet.prototype.contains = function (value) {
  30519. return this.data[value] === true;
  30520. };
  30521. BitSet.prototype.values = function () {
  30522. return Object.keys(this.data);
  30523. };
  30524. BitSet.prototype.minValue = function () {
  30525. return Math.min.apply(null, this.values());
  30526. };
  30527. BitSet.prototype.hashCode = function () {
  30528. var hash = new Hash();
  30529. hash.update(this.values());
  30530. return hash.finish();
  30531. };
  30532. BitSet.prototype.equals = function (other) {
  30533. if (!(other instanceof BitSet)) {
  30534. return false;
  30535. }
  30536. return this.hashCode() === other.hashCode();
  30537. };
  30538. Object.defineProperty(BitSet.prototype, "length", {
  30539. get: function () {
  30540. return this.values().length;
  30541. }
  30542. });
  30543. BitSet.prototype.toString = function () {
  30544. return "{" + this.values().join(", ") + "}";
  30545. };
  30546. function Map(hashFunction, equalsFunction) {
  30547. this.data = {};
  30548. this.hashFunction = hashFunction || standardHashCodeFunction;
  30549. this.equalsFunction = equalsFunction || standardEqualsFunction;
  30550. return this;
  30551. }
  30552. Object.defineProperty(Map.prototype, "length", {
  30553. get: function () {
  30554. var l = 0;
  30555. for (var hashKey in this.data) {
  30556. if (hashKey.indexOf("hash_") === 0) {
  30557. l = l + this.data[hashKey].length;
  30558. }
  30559. }
  30560. return l;
  30561. }
  30562. });
  30563. Map.prototype.put = function (key, value) {
  30564. var hashKey = "hash_" + this.hashFunction(key);
  30565. if (hashKey in this.data) {
  30566. var entries = this.data[hashKey];
  30567. for (var i = 0; i < entries.length; i++) {
  30568. var entry = entries[i];
  30569. if (this.equalsFunction(key, entry.key)) {
  30570. var oldValue = entry.value;
  30571. entry.value = value;
  30572. return oldValue;
  30573. }
  30574. }
  30575. entries.push({key:key, value:value});
  30576. return value;
  30577. } else {
  30578. this.data[hashKey] = [{key:key, value:value}];
  30579. return value;
  30580. }
  30581. };
  30582. Map.prototype.containsKey = function (key) {
  30583. var hashKey = "hash_" + this.hashFunction(key);
  30584. if(hashKey in this.data) {
  30585. var entries = this.data[hashKey];
  30586. for (var i = 0; i < entries.length; i++) {
  30587. var entry = entries[i];
  30588. if (this.equalsFunction(key, entry.key))
  30589. return true;
  30590. }
  30591. }
  30592. return false;
  30593. };
  30594. Map.prototype.get = function (key) {
  30595. var hashKey = "hash_" + this.hashFunction(key);
  30596. if(hashKey in this.data) {
  30597. var entries = this.data[hashKey];
  30598. for (var i = 0; i < entries.length; i++) {
  30599. var entry = entries[i];
  30600. if (this.equalsFunction(key, entry.key))
  30601. return entry.value;
  30602. }
  30603. }
  30604. return null;
  30605. };
  30606. Map.prototype.entries = function () {
  30607. var l = [];
  30608. for (var key in this.data) {
  30609. if (key.indexOf("hash_") === 0) {
  30610. l = l.concat(this.data[key]);
  30611. }
  30612. }
  30613. return l;
  30614. };
  30615. Map.prototype.getKeys = function () {
  30616. return this.entries().map(function(e) {
  30617. return e.key;
  30618. });
  30619. };
  30620. Map.prototype.getValues = function () {
  30621. return this.entries().map(function(e) {
  30622. return e.value;
  30623. });
  30624. };
  30625. Map.prototype.toString = function () {
  30626. var ss = this.entries().map(function(entry) {
  30627. return '{' + entry.key + ':' + entry.value + '}';
  30628. });
  30629. return '[' + ss.join(", ") + ']';
  30630. };
  30631. function AltDict() {
  30632. this.data = {};
  30633. return this;
  30634. }
  30635. AltDict.prototype.get = function (key) {
  30636. key = "k-" + key;
  30637. if (key in this.data) {
  30638. return this.data[key];
  30639. } else {
  30640. return null;
  30641. }
  30642. };
  30643. AltDict.prototype.put = function (key, value) {
  30644. key = "k-" + key;
  30645. this.data[key] = value;
  30646. };
  30647. AltDict.prototype.values = function () {
  30648. var data = this.data;
  30649. var keys = Object.keys(this.data);
  30650. return keys.map(function (key) {
  30651. return data[key];
  30652. });
  30653. };
  30654. function DoubleDict() {
  30655. return this;
  30656. }
  30657. function Hash() {
  30658. this.count = 0;
  30659. this.hash = 0;
  30660. return this;
  30661. }
  30662. Hash.prototype.update = function () {
  30663. for(var i=0;i<arguments.length;i++) {
  30664. var value = arguments[i];
  30665. if (value == null)
  30666. continue;
  30667. if(Array.isArray(value))
  30668. this.update.apply(value);
  30669. else {
  30670. var k = 0;
  30671. switch (typeof(value)) {
  30672. case 'undefined':
  30673. case 'function':
  30674. continue;
  30675. case 'number':
  30676. case 'boolean':
  30677. k = value;
  30678. break;
  30679. case 'string':
  30680. k = value.hashCode();
  30681. break;
  30682. default:
  30683. value.updateHashCode(this);
  30684. continue;
  30685. }
  30686. k = k * 0xCC9E2D51;
  30687. k = (k << 15) | (k >>> (32 - 15));
  30688. k = k * 0x1B873593;
  30689. this.count = this.count + 1;
  30690. var hash = this.hash ^ k;
  30691. hash = (hash << 13) | (hash >>> (32 - 13));
  30692. hash = hash * 5 + 0xE6546B64;
  30693. this.hash = hash;
  30694. }
  30695. }
  30696. }
  30697. Hash.prototype.finish = function () {
  30698. var hash = this.hash ^ (this.count * 4);
  30699. hash = hash ^ (hash >>> 16);
  30700. hash = hash * 0x85EBCA6B;
  30701. hash = hash ^ (hash >>> 13);
  30702. hash = hash * 0xC2B2AE35;
  30703. hash = hash ^ (hash >>> 16);
  30704. return hash;
  30705. }
  30706. function hashStuff() {
  30707. var hash = new Hash();
  30708. hash.update.apply(arguments);
  30709. return hash.finish();
  30710. }
  30711. DoubleDict.prototype.get = function (a, b) {
  30712. var d = this[a] || null;
  30713. return d === null ? null : (d[b] || null);
  30714. };
  30715. DoubleDict.prototype.set = function (a, b, o) {
  30716. var d = this[a] || null;
  30717. if (d === null) {
  30718. d = {};
  30719. this[a] = d;
  30720. }
  30721. d[b] = o;
  30722. };
  30723. function escapeWhitespace(s, escapeSpaces) {
  30724. s = s.replace(/\t/g, "\\t")
  30725. .replace(/\n/g, "\\n")
  30726. .replace(/\r/g, "\\r");
  30727. if (escapeSpaces) {
  30728. s = s.replace(/ /g, "\u00B7");
  30729. }
  30730. return s;
  30731. }
  30732. function titleCase(str) {
  30733. return str.replace(/\w\S*/g, function (txt) {
  30734. return txt.charAt(0).toUpperCase() + txt.substr(1);
  30735. });
  30736. };
  30737. function equalArrays(a, b)
  30738. {
  30739. if (!Array.isArray(a) || !Array.isArray(b))
  30740. return false;
  30741. if (a == b)
  30742. return true;
  30743. if (a.length != b.length)
  30744. return false;
  30745. for (var i = 0; i < a.length; i++) {
  30746. if (a[i] == b[i])
  30747. continue;
  30748. if (!a[i].equals(b[i]))
  30749. return false;
  30750. }
  30751. return true;
  30752. };
  30753. exports.Hash = Hash;
  30754. exports.Set = Set;
  30755. exports.Map = Map;
  30756. exports.BitSet = BitSet;
  30757. exports.AltDict = AltDict;
  30758. exports.DoubleDict = DoubleDict;
  30759. exports.hashStuff = hashStuff;
  30760. exports.escapeWhitespace = escapeWhitespace;
  30761. exports.arrayToString = arrayToString;
  30762. exports.titleCase = titleCase;
  30763. exports.equalArrays = equalArrays;
  30764. /***/ }),
  30765. /***/ "./node_modules/antlr4/atn/ATN.js":
  30766. /*!****************************************!*\
  30767. !*** ./node_modules/antlr4/atn/ATN.js ***!
  30768. \****************************************/
  30769. /*! no static exports found */
  30770. /***/ (function(module, exports, __webpack_require__) {
  30771. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30772. * Use of this file is governed by the BSD 3-clause license that
  30773. * can be found in the LICENSE.txt file in the project root.
  30774. */
  30775. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  30776. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  30777. function ATN(grammarType , maxTokenType) {
  30778. // Used for runtime deserialization of ATNs from strings///
  30779. // The type of the ATN.
  30780. this.grammarType = grammarType;
  30781. // The maximum value for any symbol recognized by a transition in the ATN.
  30782. this.maxTokenType = maxTokenType;
  30783. this.states = [];
  30784. // Each subrule/rule is a decision point and we must track them so we
  30785. // can go back later and build DFA predictors for them. This includes
  30786. // all the rules, subrules, optional blocks, ()+, ()* etc...
  30787. this.decisionToState = [];
  30788. // Maps from rule index to starting state number.
  30789. this.ruleToStartState = [];
  30790. // Maps from rule index to stop state number.
  30791. this.ruleToStopState = null;
  30792. this.modeNameToStartState = {};
  30793. // For lexer ATNs, this maps the rule index to the resulting token type.
  30794. // For parser ATNs, this maps the rule index to the generated bypass token
  30795. // type if the
  30796. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  30797. // deserialization option was specified; otherwise, this is {@code null}.
  30798. this.ruleToTokenType = null;
  30799. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  30800. // be referenced by action transitions in the ATN.
  30801. this.lexerActions = null;
  30802. this.modeToStartState = [];
  30803. return this;
  30804. }
  30805. // Compute the set of valid tokens that can occur starting in state {@code s}.
  30806. // If {@code ctx} is null, the set of tokens will not include what can follow
  30807. // the rule surrounding {@code s}. In other words, the set will be
  30808. // restricted to tokens reachable staying within {@code s}'s rule.
  30809. ATN.prototype.nextTokensInContext = function(s, ctx) {
  30810. var anal = new LL1Analyzer(this);
  30811. return anal.LOOK(s, null, ctx);
  30812. };
  30813. // Compute the set of valid tokens that can occur starting in {@code s} and
  30814. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  30815. // rule.
  30816. ATN.prototype.nextTokensNoContext = function(s) {
  30817. if (s.nextTokenWithinRule !== null ) {
  30818. return s.nextTokenWithinRule;
  30819. }
  30820. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  30821. s.nextTokenWithinRule.readOnly = true;
  30822. return s.nextTokenWithinRule;
  30823. };
  30824. ATN.prototype.nextTokens = function(s, ctx) {
  30825. if ( ctx===undefined ) {
  30826. return this.nextTokensNoContext(s);
  30827. } else {
  30828. return this.nextTokensInContext(s, ctx);
  30829. }
  30830. };
  30831. ATN.prototype.addState = function( state) {
  30832. if ( state !== null ) {
  30833. state.atn = this;
  30834. state.stateNumber = this.states.length;
  30835. }
  30836. this.states.push(state);
  30837. };
  30838. ATN.prototype.removeState = function( state) {
  30839. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  30840. };
  30841. ATN.prototype.defineDecisionState = function( s) {
  30842. this.decisionToState.push(s);
  30843. s.decision = this.decisionToState.length-1;
  30844. return s.decision;
  30845. };
  30846. ATN.prototype.getDecisionState = function( decision) {
  30847. if (this.decisionToState.length===0) {
  30848. return null;
  30849. } else {
  30850. return this.decisionToState[decision];
  30851. }
  30852. };
  30853. // Computes the set of input symbols which could follow ATN state number
  30854. // {@code stateNumber} in the specified full {@code context}. This method
  30855. // considers the complete parser context, but does not evaluate semantic
  30856. // predicates (i.e. all predicates encountered during the calculation are
  30857. // assumed true). If a path in the ATN exists from the starting state to the
  30858. // {@link RuleStopState} of the outermost context without matching any
  30859. // symbols, {@link Token//EOF} is added to the returned set.
  30860. //
  30861. // <p>If {@code context} is {@code null}, it is treated as
  30862. // {@link ParserRuleContext//EMPTY}.</p>
  30863. //
  30864. // @param stateNumber the ATN state number
  30865. // @param context the full parse context
  30866. // @return The set of potentially valid input symbols which could follow the
  30867. // specified state in the specified context.
  30868. // @throws IllegalArgumentException if the ATN does not contain a state with
  30869. // number {@code stateNumber}
  30870. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  30871. ATN.prototype.getExpectedTokens = function( stateNumber, ctx ) {
  30872. if ( stateNumber < 0 || stateNumber >= this.states.length ) {
  30873. throw("Invalid state number.");
  30874. }
  30875. var s = this.states[stateNumber];
  30876. var following = this.nextTokens(s);
  30877. if (!following.contains(Token.EPSILON)) {
  30878. return following;
  30879. }
  30880. var expected = new IntervalSet();
  30881. expected.addSet(following);
  30882. expected.removeOne(Token.EPSILON);
  30883. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  30884. var invokingState = this.states[ctx.invokingState];
  30885. var rt = invokingState.transitions[0];
  30886. following = this.nextTokens(rt.followState);
  30887. expected.addSet(following);
  30888. expected.removeOne(Token.EPSILON);
  30889. ctx = ctx.parentCtx;
  30890. }
  30891. if (following.contains(Token.EPSILON)) {
  30892. expected.addOne(Token.EOF);
  30893. }
  30894. return expected;
  30895. };
  30896. ATN.INVALID_ALT_NUMBER = 0;
  30897. exports.ATN = ATN;
  30898. /***/ }),
  30899. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  30900. /*!**********************************************!*\
  30901. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  30902. \**********************************************/
  30903. /*! no static exports found */
  30904. /***/ (function(module, exports, __webpack_require__) {
  30905. //
  30906. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30907. * Use of this file is governed by the BSD 3-clause license that
  30908. * can be found in the LICENSE.txt file in the project root.
  30909. */
  30910. ///
  30911. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  30912. // The syntactic context is a graph-structured stack node whose
  30913. // path(s) to the root is the rule invocation(s)
  30914. // chain used to arrive at the state. The semantic context is
  30915. // the tree of semantic predicates encountered before reaching
  30916. // an ATN state.
  30917. ///
  30918. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  30919. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  30920. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  30921. function checkParams(params, isCfg) {
  30922. if(params===null) {
  30923. var result = { state:null, alt:null, context:null, semanticContext:null };
  30924. if(isCfg) {
  30925. result.reachesIntoOuterContext = 0;
  30926. }
  30927. return result;
  30928. } else {
  30929. var props = {};
  30930. props.state = params.state || null;
  30931. props.alt = (params.alt === undefined) ? null : params.alt;
  30932. props.context = params.context || null;
  30933. props.semanticContext = params.semanticContext || null;
  30934. if(isCfg) {
  30935. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  30936. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  30937. }
  30938. return props;
  30939. }
  30940. }
  30941. function ATNConfig(params, config) {
  30942. this.checkContext(params, config);
  30943. params = checkParams(params);
  30944. config = checkParams(config, true);
  30945. // The ATN state associated with this configuration///
  30946. this.state = params.state!==null ? params.state : config.state;
  30947. // What alt (or lexer rule) is predicted by this configuration///
  30948. this.alt = params.alt!==null ? params.alt : config.alt;
  30949. // The stack of invoking states leading to the rule/states associated
  30950. // with this config. We track only those contexts pushed during
  30951. // execution of the ATN simulator.
  30952. this.context = params.context!==null ? params.context : config.context;
  30953. this.semanticContext = params.semanticContext!==null ? params.semanticContext :
  30954. (config.semanticContext!==null ? config.semanticContext : SemanticContext.NONE);
  30955. // We cannot execute predicates dependent upon local context unless
  30956. // we know for sure we are in the correct context. Because there is
  30957. // no way to do this efficiently, we simply cannot evaluate
  30958. // dependent predicates unless we are in the rule that initially
  30959. // invokes the ATN simulator.
  30960. //
  30961. // closure() tracks the depth of how far we dip into the
  30962. // outer context: depth &gt; 0. Note that it may not be totally
  30963. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  30964. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  30965. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  30966. return this;
  30967. }
  30968. ATNConfig.prototype.checkContext = function(params, config) {
  30969. if((params.context===null || params.context===undefined) &&
  30970. (config===null || config.context===null || config.context===undefined)) {
  30971. this.context = null;
  30972. }
  30973. };
  30974. ATNConfig.prototype.hashCode = function() {
  30975. var hash = new Hash();
  30976. this.updateHashCode(hash);
  30977. return hash.finish();
  30978. };
  30979. ATNConfig.prototype.updateHashCode = function(hash) {
  30980. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  30981. };
  30982. // An ATN configuration is equal to another if both have
  30983. // the same state, they predict the same alternative, and
  30984. // syntactic/semantic contexts are the same.
  30985. ATNConfig.prototype.equals = function(other) {
  30986. if (this === other) {
  30987. return true;
  30988. } else if (! (other instanceof ATNConfig)) {
  30989. return false;
  30990. } else {
  30991. return this.state.stateNumber===other.state.stateNumber &&
  30992. this.alt===other.alt &&
  30993. (this.context===null ? other.context===null : this.context.equals(other.context)) &&
  30994. this.semanticContext.equals(other.semanticContext) &&
  30995. this.precedenceFilterSuppressed===other.precedenceFilterSuppressed;
  30996. }
  30997. };
  30998. ATNConfig.prototype.hashCodeForConfigSet = function() {
  30999. var hash = new Hash();
  31000. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  31001. return hash.finish();
  31002. };
  31003. ATNConfig.prototype.equalsForConfigSet = function(other) {
  31004. if (this === other) {
  31005. return true;
  31006. } else if (! (other instanceof ATNConfig)) {
  31007. return false;
  31008. } else {
  31009. return this.state.stateNumber===other.state.stateNumber &&
  31010. this.alt===other.alt &&
  31011. this.semanticContext.equals(other.semanticContext);
  31012. }
  31013. };
  31014. ATNConfig.prototype.toString = function() {
  31015. return "(" + this.state + "," + this.alt +
  31016. (this.context!==null ? ",[" + this.context.toString() + "]" : "") +
  31017. (this.semanticContext !== SemanticContext.NONE ?
  31018. ("," + this.semanticContext.toString())
  31019. : "") +
  31020. (this.reachesIntoOuterContext>0 ?
  31021. (",up=" + this.reachesIntoOuterContext)
  31022. : "") + ")";
  31023. };
  31024. function LexerATNConfig(params, config) {
  31025. ATNConfig.call(this, params, config);
  31026. // This is the backing field for {@link //getLexerActionExecutor}.
  31027. var lexerActionExecutor = params.lexerActionExecutor || null;
  31028. this.lexerActionExecutor = lexerActionExecutor || (config!==null ? config.lexerActionExecutor : null);
  31029. this.passedThroughNonGreedyDecision = config!==null ? this.checkNonGreedyDecision(config, this.state) : false;
  31030. return this;
  31031. }
  31032. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  31033. LexerATNConfig.prototype.constructor = LexerATNConfig;
  31034. LexerATNConfig.prototype.updateHashCode = function(hash) {
  31035. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  31036. };
  31037. LexerATNConfig.prototype.equals = function(other) {
  31038. return this === other ||
  31039. (other instanceof LexerATNConfig &&
  31040. this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision &&
  31041. (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) &&
  31042. ATNConfig.prototype.equals.call(this, other));
  31043. };
  31044. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  31045. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  31046. LexerATNConfig.prototype.checkNonGreedyDecision = function(source, target) {
  31047. return source.passedThroughNonGreedyDecision ||
  31048. (target instanceof DecisionState) && target.nonGreedy;
  31049. };
  31050. exports.ATNConfig = ATNConfig;
  31051. exports.LexerATNConfig = LexerATNConfig;
  31052. /***/ }),
  31053. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  31054. /*!*************************************************!*\
  31055. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  31056. \*************************************************/
  31057. /*! no static exports found */
  31058. /***/ (function(module, exports, __webpack_require__) {
  31059. //
  31060. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31061. * Use of this file is governed by the BSD 3-clause license that
  31062. * can be found in the LICENSE.txt file in the project root.
  31063. */
  31064. //
  31065. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  31066. // info about the set, with support for combining similar configurations using a
  31067. // graph-structured stack.
  31068. ///
  31069. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31070. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  31071. var Hash = Utils.Hash;
  31072. var Set = Utils.Set;
  31073. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  31074. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  31075. function hashATNConfig(c) {
  31076. return c.hashCodeForConfigSet();
  31077. }
  31078. function equalATNConfigs(a, b) {
  31079. if ( a===b ) {
  31080. return true;
  31081. } else if ( a===null || b===null ) {
  31082. return false;
  31083. } else
  31084. return a.equalsForConfigSet(b);
  31085. }
  31086. function ATNConfigSet(fullCtx) {
  31087. //
  31088. // The reason that we need this is because we don't want the hash map to use
  31089. // the standard hash code and equals. We need all configurations with the
  31090. // same
  31091. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  31092. // doubles
  31093. // the number of objects associated with ATNConfigs. The other solution is
  31094. // to
  31095. // use a hash table that lets us specify the equals/hashcode operation.
  31096. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  31097. // when we go readonly as this set becomes a DFA state.
  31098. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  31099. // Indicates that this configuration set is part of a full context
  31100. // LL prediction. It will be used to determine how to merge $. With SLL
  31101. // it's a wildcard whereas it is not for LL context merge.
  31102. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  31103. // Indicates that the set of configurations is read-only. Do not
  31104. // allow any code to manipulate the set; DFA states will point at
  31105. // the sets and they must not change. This does not protect the other
  31106. // fields; in particular, conflictingAlts is set after
  31107. // we've made this readonly.
  31108. this.readOnly = false;
  31109. // Track the elements as they are added to the set; supports get(i)///
  31110. this.configs = [];
  31111. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  31112. // together, saves recomputation
  31113. // TODO: can we track conflicts as they are added to save scanning configs
  31114. // later?
  31115. this.uniqueAlt = 0;
  31116. this.conflictingAlts = null;
  31117. // Used in parser and lexer. In lexer, it indicates we hit a pred
  31118. // while computing a closure operation. Don't make a DFA state from this.
  31119. this.hasSemanticContext = false;
  31120. this.dipsIntoOuterContext = false;
  31121. this.cachedHashCode = -1;
  31122. return this;
  31123. }
  31124. // Adding a new config means merging contexts with existing configs for
  31125. // {@code (s, i, pi, _)}, where {@code s} is the
  31126. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  31127. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  31128. // {@code (s,i,pi)} as key.
  31129. //
  31130. // <p>This method updates {@link //dipsIntoOuterContext} and
  31131. // {@link //hasSemanticContext} when necessary.</p>
  31132. // /
  31133. ATNConfigSet.prototype.add = function(config, mergeCache) {
  31134. if (mergeCache === undefined) {
  31135. mergeCache = null;
  31136. }
  31137. if (this.readOnly) {
  31138. throw "This set is readonly";
  31139. }
  31140. if (config.semanticContext !== SemanticContext.NONE) {
  31141. this.hasSemanticContext = true;
  31142. }
  31143. if (config.reachesIntoOuterContext > 0) {
  31144. this.dipsIntoOuterContext = true;
  31145. }
  31146. var existing = this.configLookup.add(config);
  31147. if (existing === config) {
  31148. this.cachedHashCode = -1;
  31149. this.configs.push(config); // track order here
  31150. return true;
  31151. }
  31152. // a previous (s,i,pi,_), merge with it and save result
  31153. var rootIsWildcard = !this.fullCtx;
  31154. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  31155. // no need to check for existing.context, config.context in cache
  31156. // since only way to create new graphs is "call rule" and here. We
  31157. // cache at both places.
  31158. existing.reachesIntoOuterContext = Math.max( existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  31159. // make sure to preserve the precedence filter suppression during the merge
  31160. if (config.precedenceFilterSuppressed) {
  31161. existing.precedenceFilterSuppressed = true;
  31162. }
  31163. existing.context = merged; // replace context; no need to alt mapping
  31164. return true;
  31165. };
  31166. ATNConfigSet.prototype.getStates = function() {
  31167. var states = new Set();
  31168. for (var i = 0; i < this.configs.length; i++) {
  31169. states.add(this.configs[i].state);
  31170. }
  31171. return states;
  31172. };
  31173. ATNConfigSet.prototype.getPredicates = function() {
  31174. var preds = [];
  31175. for (var i = 0; i < this.configs.length; i++) {
  31176. var c = this.configs[i].semanticContext;
  31177. if (c !== SemanticContext.NONE) {
  31178. preds.push(c.semanticContext);
  31179. }
  31180. }
  31181. return preds;
  31182. };
  31183. Object.defineProperty(ATNConfigSet.prototype, "items", {
  31184. get : function() {
  31185. return this.configs;
  31186. }
  31187. });
  31188. ATNConfigSet.prototype.optimizeConfigs = function(interpreter) {
  31189. if (this.readOnly) {
  31190. throw "This set is readonly";
  31191. }
  31192. if (this.configLookup.length === 0) {
  31193. return;
  31194. }
  31195. for (var i = 0; i < this.configs.length; i++) {
  31196. var config = this.configs[i];
  31197. config.context = interpreter.getCachedContext(config.context);
  31198. }
  31199. };
  31200. ATNConfigSet.prototype.addAll = function(coll) {
  31201. for (var i = 0; i < coll.length; i++) {
  31202. this.add(coll[i]);
  31203. }
  31204. return false;
  31205. };
  31206. ATNConfigSet.prototype.equals = function(other) {
  31207. return this === other ||
  31208. (other instanceof ATNConfigSet &&
  31209. Utils.equalArrays(this.configs, other.configs) &&
  31210. this.fullCtx === other.fullCtx &&
  31211. this.uniqueAlt === other.uniqueAlt &&
  31212. this.conflictingAlts === other.conflictingAlts &&
  31213. this.hasSemanticContext === other.hasSemanticContext &&
  31214. this.dipsIntoOuterContext === other.dipsIntoOuterContext);
  31215. };
  31216. ATNConfigSet.prototype.hashCode = function() {
  31217. var hash = new Hash();
  31218. this.updateHashCode(hash);
  31219. return hash.finish();
  31220. };
  31221. ATNConfigSet.prototype.updateHashCode = function(hash) {
  31222. if (this.readOnly) {
  31223. if (this.cachedHashCode === -1) {
  31224. var hash = new Hash();
  31225. hash.update(this.configs);
  31226. this.cachedHashCode = hash.finish();
  31227. }
  31228. hash.update(this.cachedHashCode);
  31229. } else {
  31230. hash.update(this.configs);
  31231. }
  31232. };
  31233. Object.defineProperty(ATNConfigSet.prototype, "length", {
  31234. get : function() {
  31235. return this.configs.length;
  31236. }
  31237. });
  31238. ATNConfigSet.prototype.isEmpty = function() {
  31239. return this.configs.length === 0;
  31240. };
  31241. ATNConfigSet.prototype.contains = function(item) {
  31242. if (this.configLookup === null) {
  31243. throw "This method is not implemented for readonly sets.";
  31244. }
  31245. return this.configLookup.contains(item);
  31246. };
  31247. ATNConfigSet.prototype.containsFast = function(item) {
  31248. if (this.configLookup === null) {
  31249. throw "This method is not implemented for readonly sets.";
  31250. }
  31251. return this.configLookup.containsFast(item);
  31252. };
  31253. ATNConfigSet.prototype.clear = function() {
  31254. if (this.readOnly) {
  31255. throw "This set is readonly";
  31256. }
  31257. this.configs = [];
  31258. this.cachedHashCode = -1;
  31259. this.configLookup = new Set();
  31260. };
  31261. ATNConfigSet.prototype.setReadonly = function(readOnly) {
  31262. this.readOnly = readOnly;
  31263. if (readOnly) {
  31264. this.configLookup = null; // can't mod, no need for lookup cache
  31265. }
  31266. };
  31267. ATNConfigSet.prototype.toString = function() {
  31268. return Utils.arrayToString(this.configs) +
  31269. (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") +
  31270. (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") +
  31271. (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") +
  31272. (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  31273. };
  31274. function OrderedATNConfigSet() {
  31275. ATNConfigSet.call(this);
  31276. this.configLookup = new Set();
  31277. return this;
  31278. }
  31279. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  31280. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  31281. exports.ATNConfigSet = ATNConfigSet;
  31282. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  31283. /***/ }),
  31284. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  31285. /*!**************************************************************!*\
  31286. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  31287. \**************************************************************/
  31288. /*! no static exports found */
  31289. /***/ (function(module, exports) {
  31290. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31291. * Use of this file is governed by the BSD 3-clause license that
  31292. * can be found in the LICENSE.txt file in the project root.
  31293. */
  31294. function ATNDeserializationOptions(copyFrom) {
  31295. if(copyFrom===undefined) {
  31296. copyFrom = null;
  31297. }
  31298. this.readOnly = false;
  31299. this.verifyATN = copyFrom===null ? true : copyFrom.verifyATN;
  31300. this.generateRuleBypassTransitions = copyFrom===null ? false : copyFrom.generateRuleBypassTransitions;
  31301. return this;
  31302. }
  31303. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  31304. ATNDeserializationOptions.defaultOptions.readOnly = true;
  31305. // def __setattr__(self, key, value):
  31306. // if key!="readOnly" and self.readOnly:
  31307. // raise Exception("The object is read only.")
  31308. // super(type(self), self).__setattr__(key,value)
  31309. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  31310. /***/ }),
  31311. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  31312. /*!****************************************************!*\
  31313. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  31314. \****************************************************/
  31315. /*! no static exports found */
  31316. /***/ (function(module, exports, __webpack_require__) {
  31317. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31318. * Use of this file is governed by the BSD 3-clause license that
  31319. * can be found in the LICENSE.txt file in the project root.
  31320. */
  31321. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31322. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31323. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  31324. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  31325. var ATNState = ATNStates.ATNState;
  31326. var BasicState = ATNStates.BasicState;
  31327. var DecisionState = ATNStates.DecisionState;
  31328. var BlockStartState = ATNStates.BlockStartState;
  31329. var BlockEndState = ATNStates.BlockEndState;
  31330. var LoopEndState = ATNStates.LoopEndState;
  31331. var RuleStartState = ATNStates.RuleStartState;
  31332. var RuleStopState = ATNStates.RuleStopState;
  31333. var TokensStartState = ATNStates.TokensStartState;
  31334. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  31335. var StarLoopbackState = ATNStates.StarLoopbackState;
  31336. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  31337. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  31338. var StarBlockStartState = ATNStates.StarBlockStartState;
  31339. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  31340. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  31341. var Transition = Transitions.Transition;
  31342. var AtomTransition = Transitions.AtomTransition;
  31343. var SetTransition = Transitions.SetTransition;
  31344. var NotSetTransition = Transitions.NotSetTransition;
  31345. var RuleTransition = Transitions.RuleTransition;
  31346. var RangeTransition = Transitions.RangeTransition;
  31347. var ActionTransition = Transitions.ActionTransition;
  31348. var EpsilonTransition = Transitions.EpsilonTransition;
  31349. var WildcardTransition = Transitions.WildcardTransition;
  31350. var PredicateTransition = Transitions.PredicateTransition;
  31351. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  31352. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31353. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31354. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  31355. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  31356. var LexerActionType = LexerActions.LexerActionType;
  31357. var LexerSkipAction = LexerActions.LexerSkipAction;
  31358. var LexerChannelAction = LexerActions.LexerChannelAction;
  31359. var LexerCustomAction = LexerActions.LexerCustomAction;
  31360. var LexerMoreAction = LexerActions.LexerMoreAction;
  31361. var LexerTypeAction = LexerActions.LexerTypeAction;
  31362. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  31363. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  31364. var LexerModeAction = LexerActions.LexerModeAction;
  31365. // This is the earliest supported serialized UUID.
  31366. // stick to serialized version for now, we don't need a UUID instance
  31367. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  31368. //
  31369. // This UUID indicates the serialized ATN contains two sets of
  31370. // IntervalSets, where the second set's values are encoded as
  31371. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  31372. //
  31373. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  31374. // This list contains all of the currently supported UUIDs, ordered by when
  31375. // the feature first appeared in this branch.
  31376. var SUPPORTED_UUIDS = [ BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP ];
  31377. var SERIALIZED_VERSION = 3;
  31378. // This is the current serialized UUID.
  31379. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  31380. function initArray( length, value) {
  31381. var tmp = [];
  31382. tmp[length-1] = value;
  31383. return tmp.map(function(i) {return value;});
  31384. }
  31385. function ATNDeserializer (options) {
  31386. if ( options=== undefined || options === null ) {
  31387. options = ATNDeserializationOptions.defaultOptions;
  31388. }
  31389. this.deserializationOptions = options;
  31390. this.stateFactories = null;
  31391. this.actionFactories = null;
  31392. return this;
  31393. }
  31394. // Determines if a particular serialized representation of an ATN supports
  31395. // a particular feature, identified by the {@link UUID} used for serializing
  31396. // the ATN at the time the feature was first introduced.
  31397. //
  31398. // @param feature The {@link UUID} marking the first time the feature was
  31399. // supported in the serialized ATN.
  31400. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  31401. // currently being deserialized.
  31402. // @return {@code true} if the {@code actualUuid} value represents a
  31403. // serialized ATN at or after the feature identified by {@code feature} was
  31404. // introduced; otherwise, {@code false}.
  31405. ATNDeserializer.prototype.isFeatureSupported = function(feature, actualUuid) {
  31406. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  31407. if (idx1<0) {
  31408. return false;
  31409. }
  31410. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  31411. return idx2 >= idx1;
  31412. };
  31413. ATNDeserializer.prototype.deserialize = function(data) {
  31414. this.reset(data);
  31415. this.checkVersion();
  31416. this.checkUUID();
  31417. var atn = this.readATN();
  31418. this.readStates(atn);
  31419. this.readRules(atn);
  31420. this.readModes(atn);
  31421. var sets = [];
  31422. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  31423. this.readSets(atn, sets, this.readInt.bind(this));
  31424. // Next, if the ATN was serialized with the Unicode SMP feature,
  31425. // deserialize sets with 32-bit arguments <= U+10FFFF.
  31426. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  31427. this.readSets(atn, sets, this.readInt32.bind(this));
  31428. }
  31429. this.readEdges(atn, sets);
  31430. this.readDecisions(atn);
  31431. this.readLexerActions(atn);
  31432. this.markPrecedenceDecisions(atn);
  31433. this.verifyATN(atn);
  31434. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER ) {
  31435. this.generateRuleBypassTransitions(atn);
  31436. // re-verify after modification
  31437. this.verifyATN(atn);
  31438. }
  31439. return atn;
  31440. };
  31441. ATNDeserializer.prototype.reset = function(data) {
  31442. var adjust = function(c) {
  31443. var v = c.charCodeAt(0);
  31444. return v>1 ? v-2 : v + 65533;
  31445. };
  31446. var temp = data.split("").map(adjust);
  31447. // don't adjust the first value since that's the version number
  31448. temp[0] = data.charCodeAt(0);
  31449. this.data = temp;
  31450. this.pos = 0;
  31451. };
  31452. ATNDeserializer.prototype.checkVersion = function() {
  31453. var version = this.readInt();
  31454. if ( version !== SERIALIZED_VERSION ) {
  31455. throw ("Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").");
  31456. }
  31457. };
  31458. ATNDeserializer.prototype.checkUUID = function() {
  31459. var uuid = this.readUUID();
  31460. if (SUPPORTED_UUIDS.indexOf(uuid)<0) {
  31461. throw ("Could not deserialize ATN with UUID: " + uuid +
  31462. " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID);
  31463. }
  31464. this.uuid = uuid;
  31465. };
  31466. ATNDeserializer.prototype.readATN = function() {
  31467. var grammarType = this.readInt();
  31468. var maxTokenType = this.readInt();
  31469. return new ATN(grammarType, maxTokenType);
  31470. };
  31471. ATNDeserializer.prototype.readStates = function(atn) {
  31472. var j, pair, stateNumber;
  31473. var loopBackStateNumbers = [];
  31474. var endStateNumbers = [];
  31475. var nstates = this.readInt();
  31476. for(var i=0; i<nstates; i++) {
  31477. var stype = this.readInt();
  31478. // ignore bad type of states
  31479. if (stype===ATNState.INVALID_TYPE) {
  31480. atn.addState(null);
  31481. continue;
  31482. }
  31483. var ruleIndex = this.readInt();
  31484. if (ruleIndex === 0xFFFF) {
  31485. ruleIndex = -1;
  31486. }
  31487. var s = this.stateFactory(stype, ruleIndex);
  31488. if (stype === ATNState.LOOP_END) { // special case
  31489. var loopBackStateNumber = this.readInt();
  31490. loopBackStateNumbers.push([s, loopBackStateNumber]);
  31491. } else if(s instanceof BlockStartState) {
  31492. var endStateNumber = this.readInt();
  31493. endStateNumbers.push([s, endStateNumber]);
  31494. }
  31495. atn.addState(s);
  31496. }
  31497. // delay the assignment of loop back and end states until we know all the
  31498. // state instances have been initialized
  31499. for (j=0; j<loopBackStateNumbers.length; j++) {
  31500. pair = loopBackStateNumbers[j];
  31501. pair[0].loopBackState = atn.states[pair[1]];
  31502. }
  31503. for (j=0; j<endStateNumbers.length; j++) {
  31504. pair = endStateNumbers[j];
  31505. pair[0].endState = atn.states[pair[1]];
  31506. }
  31507. var numNonGreedyStates = this.readInt();
  31508. for (j=0; j<numNonGreedyStates; j++) {
  31509. stateNumber = this.readInt();
  31510. atn.states[stateNumber].nonGreedy = true;
  31511. }
  31512. var numPrecedenceStates = this.readInt();
  31513. for (j=0; j<numPrecedenceStates; j++) {
  31514. stateNumber = this.readInt();
  31515. atn.states[stateNumber].isPrecedenceRule = true;
  31516. }
  31517. };
  31518. ATNDeserializer.prototype.readRules = function(atn) {
  31519. var i;
  31520. var nrules = this.readInt();
  31521. if (atn.grammarType === ATNType.LEXER ) {
  31522. atn.ruleToTokenType = initArray(nrules, 0);
  31523. }
  31524. atn.ruleToStartState = initArray(nrules, 0);
  31525. for (i=0; i<nrules; i++) {
  31526. var s = this.readInt();
  31527. var startState = atn.states[s];
  31528. atn.ruleToStartState[i] = startState;
  31529. if ( atn.grammarType === ATNType.LEXER ) {
  31530. var tokenType = this.readInt();
  31531. if (tokenType === 0xFFFF) {
  31532. tokenType = Token.EOF;
  31533. }
  31534. atn.ruleToTokenType[i] = tokenType;
  31535. }
  31536. }
  31537. atn.ruleToStopState = initArray(nrules, 0);
  31538. for (i=0; i<atn.states.length; i++) {
  31539. var state = atn.states[i];
  31540. if (!(state instanceof RuleStopState)) {
  31541. continue;
  31542. }
  31543. atn.ruleToStopState[state.ruleIndex] = state;
  31544. atn.ruleToStartState[state.ruleIndex].stopState = state;
  31545. }
  31546. };
  31547. ATNDeserializer.prototype.readModes = function(atn) {
  31548. var nmodes = this.readInt();
  31549. for (var i=0; i<nmodes; i++) {
  31550. var s = this.readInt();
  31551. atn.modeToStartState.push(atn.states[s]);
  31552. }
  31553. };
  31554. ATNDeserializer.prototype.readSets = function(atn, sets, readUnicode) {
  31555. var m = this.readInt();
  31556. for (var i=0; i<m; i++) {
  31557. var iset = new IntervalSet();
  31558. sets.push(iset);
  31559. var n = this.readInt();
  31560. var containsEof = this.readInt();
  31561. if (containsEof!==0) {
  31562. iset.addOne(-1);
  31563. }
  31564. for (var j=0; j<n; j++) {
  31565. var i1 = readUnicode();
  31566. var i2 = readUnicode();
  31567. iset.addRange(i1, i2);
  31568. }
  31569. }
  31570. };
  31571. ATNDeserializer.prototype.readEdges = function(atn, sets) {
  31572. var i, j, state, trans, target;
  31573. var nedges = this.readInt();
  31574. for (i=0; i<nedges; i++) {
  31575. var src = this.readInt();
  31576. var trg = this.readInt();
  31577. var ttype = this.readInt();
  31578. var arg1 = this.readInt();
  31579. var arg2 = this.readInt();
  31580. var arg3 = this.readInt();
  31581. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  31582. var srcState = atn.states[src];
  31583. srcState.addTransition(trans);
  31584. }
  31585. // edges for rule stop states can be derived, so they aren't serialized
  31586. for (i=0; i<atn.states.length; i++) {
  31587. state = atn.states[i];
  31588. for (j=0; j<state.transitions.length; j++) {
  31589. var t = state.transitions[j];
  31590. if (!(t instanceof RuleTransition)) {
  31591. continue;
  31592. }
  31593. var outermostPrecedenceReturn = -1;
  31594. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  31595. if (t.precedence === 0) {
  31596. outermostPrecedenceReturn = t.target.ruleIndex;
  31597. }
  31598. }
  31599. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  31600. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  31601. }
  31602. }
  31603. for (i=0; i<atn.states.length; i++) {
  31604. state = atn.states[i];
  31605. if (state instanceof BlockStartState) {
  31606. // we need to know the end state to set its start state
  31607. if (state.endState === null) {
  31608. throw ("IllegalState");
  31609. }
  31610. // block end states can only be associated to a single block start
  31611. // state
  31612. if ( state.endState.startState !== null) {
  31613. throw ("IllegalState");
  31614. }
  31615. state.endState.startState = state;
  31616. }
  31617. if (state instanceof PlusLoopbackState) {
  31618. for (j=0; j<state.transitions.length; j++) {
  31619. target = state.transitions[j].target;
  31620. if (target instanceof PlusBlockStartState) {
  31621. target.loopBackState = state;
  31622. }
  31623. }
  31624. } else if (state instanceof StarLoopbackState) {
  31625. for (j=0; j<state.transitions.length; j++) {
  31626. target = state.transitions[j].target;
  31627. if (target instanceof StarLoopEntryState) {
  31628. target.loopBackState = state;
  31629. }
  31630. }
  31631. }
  31632. }
  31633. };
  31634. ATNDeserializer.prototype.readDecisions = function(atn) {
  31635. var ndecisions = this.readInt();
  31636. for (var i=0; i<ndecisions; i++) {
  31637. var s = this.readInt();
  31638. var decState = atn.states[s];
  31639. atn.decisionToState.push(decState);
  31640. decState.decision = i;
  31641. }
  31642. };
  31643. ATNDeserializer.prototype.readLexerActions = function(atn) {
  31644. if (atn.grammarType === ATNType.LEXER) {
  31645. var count = this.readInt();
  31646. atn.lexerActions = initArray(count, null);
  31647. for (var i=0; i<count; i++) {
  31648. var actionType = this.readInt();
  31649. var data1 = this.readInt();
  31650. if (data1 === 0xFFFF) {
  31651. data1 = -1;
  31652. }
  31653. var data2 = this.readInt();
  31654. if (data2 === 0xFFFF) {
  31655. data2 = -1;
  31656. }
  31657. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  31658. atn.lexerActions[i] = lexerAction;
  31659. }
  31660. }
  31661. };
  31662. ATNDeserializer.prototype.generateRuleBypassTransitions = function(atn) {
  31663. var i;
  31664. var count = atn.ruleToStartState.length;
  31665. for(i=0; i<count; i++) {
  31666. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  31667. }
  31668. for(i=0; i<count; i++) {
  31669. this.generateRuleBypassTransition(atn, i);
  31670. }
  31671. };
  31672. ATNDeserializer.prototype.generateRuleBypassTransition = function(atn, idx) {
  31673. var i, state;
  31674. var bypassStart = new BasicBlockStartState();
  31675. bypassStart.ruleIndex = idx;
  31676. atn.addState(bypassStart);
  31677. var bypassStop = new BlockEndState();
  31678. bypassStop.ruleIndex = idx;
  31679. atn.addState(bypassStop);
  31680. bypassStart.endState = bypassStop;
  31681. atn.defineDecisionState(bypassStart);
  31682. bypassStop.startState = bypassStart;
  31683. var excludeTransition = null;
  31684. var endState = null;
  31685. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  31686. // wrap from the beginning of the rule to the StarLoopEntryState
  31687. endState = null;
  31688. for(i=0; i<atn.states.length; i++) {
  31689. state = atn.states[i];
  31690. if (this.stateIsEndStateFor(state, idx)) {
  31691. endState = state;
  31692. excludeTransition = state.loopBackState.transitions[0];
  31693. break;
  31694. }
  31695. }
  31696. if (excludeTransition === null) {
  31697. throw ("Couldn't identify final state of the precedence rule prefix section.");
  31698. }
  31699. } else {
  31700. endState = atn.ruleToStopState[idx];
  31701. }
  31702. // all non-excluded transitions that currently target end state need to
  31703. // target blockEnd instead
  31704. for(i=0; i<atn.states.length; i++) {
  31705. state = atn.states[i];
  31706. for(var j=0; j<state.transitions.length; j++) {
  31707. var transition = state.transitions[j];
  31708. if (transition === excludeTransition) {
  31709. continue;
  31710. }
  31711. if (transition.target === endState) {
  31712. transition.target = bypassStop;
  31713. }
  31714. }
  31715. }
  31716. // all transitions leaving the rule start state need to leave blockStart
  31717. // instead
  31718. var ruleToStartState = atn.ruleToStartState[idx];
  31719. var count = ruleToStartState.transitions.length;
  31720. while ( count > 0) {
  31721. bypassStart.addTransition(ruleToStartState.transitions[count-1]);
  31722. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  31723. }
  31724. // link the new states
  31725. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  31726. bypassStop.addTransition(new EpsilonTransition(endState));
  31727. var matchState = new BasicState();
  31728. atn.addState(matchState);
  31729. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  31730. bypassStart.addTransition(new EpsilonTransition(matchState));
  31731. };
  31732. ATNDeserializer.prototype.stateIsEndStateFor = function(state, idx) {
  31733. if ( state.ruleIndex !== idx) {
  31734. return null;
  31735. }
  31736. if (!( state instanceof StarLoopEntryState)) {
  31737. return null;
  31738. }
  31739. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  31740. if (!( maybeLoopEndState instanceof LoopEndState)) {
  31741. return null;
  31742. }
  31743. if (maybeLoopEndState.epsilonOnlyTransitions &&
  31744. (maybeLoopEndState.transitions[0].target instanceof RuleStopState)) {
  31745. return state;
  31746. } else {
  31747. return null;
  31748. }
  31749. };
  31750. //
  31751. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  31752. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  31753. // correct value.
  31754. //
  31755. // @param atn The ATN.
  31756. //
  31757. ATNDeserializer.prototype.markPrecedenceDecisions = function(atn) {
  31758. for(var i=0; i<atn.states.length; i++) {
  31759. var state = atn.states[i];
  31760. if (!( state instanceof StarLoopEntryState)) {
  31761. continue;
  31762. }
  31763. // We analyze the ATN to determine if this ATN decision state is the
  31764. // decision for the closure block that determines whether a
  31765. // precedence rule should continue or complete.
  31766. //
  31767. if ( atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  31768. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  31769. if (maybeLoopEndState instanceof LoopEndState) {
  31770. if ( maybeLoopEndState.epsilonOnlyTransitions &&
  31771. (maybeLoopEndState.transitions[0].target instanceof RuleStopState)) {
  31772. state.isPrecedenceDecision = true;
  31773. }
  31774. }
  31775. }
  31776. }
  31777. };
  31778. ATNDeserializer.prototype.verifyATN = function(atn) {
  31779. if (!this.deserializationOptions.verifyATN) {
  31780. return;
  31781. }
  31782. // verify assumptions
  31783. for(var i=0; i<atn.states.length; i++) {
  31784. var state = atn.states[i];
  31785. if (state === null) {
  31786. continue;
  31787. }
  31788. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  31789. if (state instanceof PlusBlockStartState) {
  31790. this.checkCondition(state.loopBackState !== null);
  31791. } else if (state instanceof StarLoopEntryState) {
  31792. this.checkCondition(state.loopBackState !== null);
  31793. this.checkCondition(state.transitions.length === 2);
  31794. if (state.transitions[0].target instanceof StarBlockStartState) {
  31795. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  31796. this.checkCondition(!state.nonGreedy);
  31797. } else if (state.transitions[0].target instanceof LoopEndState) {
  31798. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  31799. this.checkCondition(state.nonGreedy);
  31800. } else {
  31801. throw("IllegalState");
  31802. }
  31803. } else if (state instanceof StarLoopbackState) {
  31804. this.checkCondition(state.transitions.length === 1);
  31805. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  31806. } else if (state instanceof LoopEndState) {
  31807. this.checkCondition(state.loopBackState !== null);
  31808. } else if (state instanceof RuleStartState) {
  31809. this.checkCondition(state.stopState !== null);
  31810. } else if (state instanceof BlockStartState) {
  31811. this.checkCondition(state.endState !== null);
  31812. } else if (state instanceof BlockEndState) {
  31813. this.checkCondition(state.startState !== null);
  31814. } else if (state instanceof DecisionState) {
  31815. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  31816. } else {
  31817. this.checkCondition(state.transitions.length <= 1 || (state instanceof RuleStopState));
  31818. }
  31819. }
  31820. };
  31821. ATNDeserializer.prototype.checkCondition = function(condition, message) {
  31822. if (!condition) {
  31823. if (message === undefined || message===null) {
  31824. message = "IllegalState";
  31825. }
  31826. throw (message);
  31827. }
  31828. };
  31829. ATNDeserializer.prototype.readInt = function() {
  31830. return this.data[this.pos++];
  31831. };
  31832. ATNDeserializer.prototype.readInt32 = function() {
  31833. var low = this.readInt();
  31834. var high = this.readInt();
  31835. return low | (high << 16);
  31836. };
  31837. ATNDeserializer.prototype.readLong = function() {
  31838. var low = this.readInt32();
  31839. var high = this.readInt32();
  31840. return (low & 0x00000000FFFFFFFF) | (high << 32);
  31841. };
  31842. function createByteToHex() {
  31843. var bth = [];
  31844. for (var i = 0; i < 256; i++) {
  31845. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  31846. }
  31847. return bth;
  31848. }
  31849. var byteToHex = createByteToHex();
  31850. ATNDeserializer.prototype.readUUID = function() {
  31851. var bb = [];
  31852. for(var i=7;i>=0;i--) {
  31853. var int = this.readInt();
  31854. /* jshint bitwise: false */
  31855. bb[(2*i)+1] = int & 0xFF;
  31856. bb[2*i] = (int >> 8) & 0xFF;
  31857. }
  31858. return byteToHex[bb[0]] + byteToHex[bb[1]] +
  31859. byteToHex[bb[2]] + byteToHex[bb[3]] + '-' +
  31860. byteToHex[bb[4]] + byteToHex[bb[5]] + '-' +
  31861. byteToHex[bb[6]] + byteToHex[bb[7]] + '-' +
  31862. byteToHex[bb[8]] + byteToHex[bb[9]] + '-' +
  31863. byteToHex[bb[10]] + byteToHex[bb[11]] +
  31864. byteToHex[bb[12]] + byteToHex[bb[13]] +
  31865. byteToHex[bb[14]] + byteToHex[bb[15]];
  31866. };
  31867. ATNDeserializer.prototype.edgeFactory = function(atn, type, src, trg, arg1, arg2, arg3, sets) {
  31868. var target = atn.states[trg];
  31869. switch(type) {
  31870. case Transition.EPSILON:
  31871. return new EpsilonTransition(target);
  31872. case Transition.RANGE:
  31873. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  31874. case Transition.RULE:
  31875. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  31876. case Transition.PREDICATE:
  31877. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  31878. case Transition.PRECEDENCE:
  31879. return new PrecedencePredicateTransition(target, arg1);
  31880. case Transition.ATOM:
  31881. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  31882. case Transition.ACTION:
  31883. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  31884. case Transition.SET:
  31885. return new SetTransition(target, sets[arg1]);
  31886. case Transition.NOT_SET:
  31887. return new NotSetTransition(target, sets[arg1]);
  31888. case Transition.WILDCARD:
  31889. return new WildcardTransition(target);
  31890. default:
  31891. throw "The specified transition type: " + type + " is not valid.";
  31892. }
  31893. };
  31894. ATNDeserializer.prototype.stateFactory = function(type, ruleIndex) {
  31895. if (this.stateFactories === null) {
  31896. var sf = [];
  31897. sf[ATNState.INVALID_TYPE] = null;
  31898. sf[ATNState.BASIC] = function() { return new BasicState(); };
  31899. sf[ATNState.RULE_START] = function() { return new RuleStartState(); };
  31900. sf[ATNState.BLOCK_START] = function() { return new BasicBlockStartState(); };
  31901. sf[ATNState.PLUS_BLOCK_START] = function() { return new PlusBlockStartState(); };
  31902. sf[ATNState.STAR_BLOCK_START] = function() { return new StarBlockStartState(); };
  31903. sf[ATNState.TOKEN_START] = function() { return new TokensStartState(); };
  31904. sf[ATNState.RULE_STOP] = function() { return new RuleStopState(); };
  31905. sf[ATNState.BLOCK_END] = function() { return new BlockEndState(); };
  31906. sf[ATNState.STAR_LOOP_BACK] = function() { return new StarLoopbackState(); };
  31907. sf[ATNState.STAR_LOOP_ENTRY] = function() { return new StarLoopEntryState(); };
  31908. sf[ATNState.PLUS_LOOP_BACK] = function() { return new PlusLoopbackState(); };
  31909. sf[ATNState.LOOP_END] = function() { return new LoopEndState(); };
  31910. this.stateFactories = sf;
  31911. }
  31912. if (type>this.stateFactories.length || this.stateFactories[type] === null) {
  31913. throw("The specified state type " + type + " is not valid.");
  31914. } else {
  31915. var s = this.stateFactories[type]();
  31916. if (s!==null) {
  31917. s.ruleIndex = ruleIndex;
  31918. return s;
  31919. }
  31920. }
  31921. };
  31922. ATNDeserializer.prototype.lexerActionFactory = function(type, data1, data2) {
  31923. if (this.actionFactories === null) {
  31924. var af = [];
  31925. af[LexerActionType.CHANNEL] = function(data1, data2) { return new LexerChannelAction(data1); };
  31926. af[LexerActionType.CUSTOM] = function(data1, data2) { return new LexerCustomAction(data1, data2); };
  31927. af[LexerActionType.MODE] = function(data1, data2) { return new LexerModeAction(data1); };
  31928. af[LexerActionType.MORE] = function(data1, data2) { return LexerMoreAction.INSTANCE; };
  31929. af[LexerActionType.POP_MODE] = function(data1, data2) { return LexerPopModeAction.INSTANCE; };
  31930. af[LexerActionType.PUSH_MODE] = function(data1, data2) { return new LexerPushModeAction(data1); };
  31931. af[LexerActionType.SKIP] = function(data1, data2) { return LexerSkipAction.INSTANCE; };
  31932. af[LexerActionType.TYPE] = function(data1, data2) { return new LexerTypeAction(data1); };
  31933. this.actionFactories = af;
  31934. }
  31935. if (type>this.actionFactories.length || this.actionFactories[type] === null) {
  31936. throw("The specified lexer action type " + type + " is not valid.");
  31937. } else {
  31938. return this.actionFactories[type](data1, data2);
  31939. }
  31940. };
  31941. exports.ATNDeserializer = ATNDeserializer;
  31942. /***/ }),
  31943. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  31944. /*!*************************************************!*\
  31945. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  31946. \*************************************************/
  31947. /*! no static exports found */
  31948. /***/ (function(module, exports, __webpack_require__) {
  31949. //
  31950. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31951. * Use of this file is governed by the BSD 3-clause license that
  31952. * can be found in the LICENSE.txt file in the project root.
  31953. */
  31954. ///
  31955. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  31956. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  31957. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  31958. function ATNSimulator(atn, sharedContextCache) {
  31959. // The context cache maps all PredictionContext objects that are ==
  31960. // to a single cached copy. This cache is shared across all contexts
  31961. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  31962. // to use only cached nodes/graphs in addDFAState(). We don't want to
  31963. // fill this during closure() since there are lots of contexts that
  31964. // pop up but are not used ever again. It also greatly slows down closure().
  31965. //
  31966. // <p>This cache makes a huge difference in memory and a little bit in speed.
  31967. // For the Java grammar on java.*, it dropped the memory requirements
  31968. // at the end from 25M to 16M. We don't store any of the full context
  31969. // graphs in the DFA because they are limited to local context only,
  31970. // but apparently there's a lot of repetition there as well. We optimize
  31971. // the config contexts before storing the config set in the DFA states
  31972. // by literally rebuilding them with cached subgraphs only.</p>
  31973. //
  31974. // <p>I tried a cache for use during closure operations, that was
  31975. // whacked after each adaptivePredict(). It cost a little bit
  31976. // more time I think and doesn't save on the overall footprint
  31977. // so it's not worth the complexity.</p>
  31978. ///
  31979. this.atn = atn;
  31980. this.sharedContextCache = sharedContextCache;
  31981. return this;
  31982. }
  31983. // Must distinguish between missing edge and edge we know leads nowhere///
  31984. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  31985. ATNSimulator.prototype.getCachedContext = function(context) {
  31986. if (this.sharedContextCache ===null) {
  31987. return context;
  31988. }
  31989. var visited = {};
  31990. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  31991. };
  31992. exports.ATNSimulator = ATNSimulator;
  31993. /***/ }),
  31994. /***/ "./node_modules/antlr4/atn/ATNState.js":
  31995. /*!*********************************************!*\
  31996. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  31997. \*********************************************/
  31998. /*! no static exports found */
  31999. /***/ (function(module, exports) {
  32000. //
  32001. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32002. * Use of this file is governed by the BSD 3-clause license that
  32003. * can be found in the LICENSE.txt file in the project root.
  32004. */
  32005. //
  32006. // The following images show the relation of states and
  32007. // {@link ATNState//transitions} for various grammar constructs.
  32008. //
  32009. // <ul>
  32010. //
  32011. // <li>Solid edges marked with an &//0949; indicate a required
  32012. // {@link EpsilonTransition}.</li>
  32013. //
  32014. // <li>Dashed edges indicate locations where any transition derived from
  32015. // {@link Transition} might appear.</li>
  32016. //
  32017. // <li>Dashed nodes are place holders for either a sequence of linked
  32018. // {@link BasicState} states or the inclusion of a block representing a nested
  32019. // construct in one of the forms below.</li>
  32020. //
  32021. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  32022. // any number of alternatives (one or more). Nodes without the {@code ...} only
  32023. // support the exact number of alternatives shown in the diagram.</li>
  32024. //
  32025. // </ul>
  32026. //
  32027. // <h2>Basic Blocks</h2>
  32028. //
  32029. // <h3>Rule</h3>
  32030. //
  32031. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  32032. //
  32033. // <h3>Block of 1 or more alternatives</h3>
  32034. //
  32035. // <embed src="images/Block.svg" type="image/svg+xml"/>
  32036. //
  32037. // <h2>Greedy Loops</h2>
  32038. //
  32039. // <h3>Greedy Closure: {@code (...)*}</h3>
  32040. //
  32041. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  32042. //
  32043. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  32044. //
  32045. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  32046. //
  32047. // <h3>Greedy Optional: {@code (...)?}</h3>
  32048. //
  32049. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  32050. //
  32051. // <h2>Non-Greedy Loops</h2>
  32052. //
  32053. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  32054. //
  32055. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  32056. //
  32057. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  32058. //
  32059. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  32060. //
  32061. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  32062. //
  32063. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  32064. //
  32065. var INITIAL_NUM_TRANSITIONS = 4;
  32066. function ATNState() {
  32067. // Which ATN are we in?
  32068. this.atn = null;
  32069. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  32070. this.stateType = null;
  32071. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  32072. this.epsilonOnlyTransitions = false;
  32073. // Track the transitions emanating from this ATN state.
  32074. this.transitions = [];
  32075. // Used to cache lookahead during parsing, not used during construction
  32076. this.nextTokenWithinRule = null;
  32077. return this;
  32078. }
  32079. // constants for serialization
  32080. ATNState.INVALID_TYPE = 0;
  32081. ATNState.BASIC = 1;
  32082. ATNState.RULE_START = 2;
  32083. ATNState.BLOCK_START = 3;
  32084. ATNState.PLUS_BLOCK_START = 4;
  32085. ATNState.STAR_BLOCK_START = 5;
  32086. ATNState.TOKEN_START = 6;
  32087. ATNState.RULE_STOP = 7;
  32088. ATNState.BLOCK_END = 8;
  32089. ATNState.STAR_LOOP_BACK = 9;
  32090. ATNState.STAR_LOOP_ENTRY = 10;
  32091. ATNState.PLUS_LOOP_BACK = 11;
  32092. ATNState.LOOP_END = 12;
  32093. ATNState.serializationNames = [
  32094. "INVALID",
  32095. "BASIC",
  32096. "RULE_START",
  32097. "BLOCK_START",
  32098. "PLUS_BLOCK_START",
  32099. "STAR_BLOCK_START",
  32100. "TOKEN_START",
  32101. "RULE_STOP",
  32102. "BLOCK_END",
  32103. "STAR_LOOP_BACK",
  32104. "STAR_LOOP_ENTRY",
  32105. "PLUS_LOOP_BACK",
  32106. "LOOP_END" ];
  32107. ATNState.INVALID_STATE_NUMBER = -1;
  32108. ATNState.prototype.toString = function() {
  32109. return this.stateNumber;
  32110. };
  32111. ATNState.prototype.equals = function(other) {
  32112. if (other instanceof ATNState) {
  32113. return this.stateNumber===other.stateNumber;
  32114. } else {
  32115. return false;
  32116. }
  32117. };
  32118. ATNState.prototype.isNonGreedyExitState = function() {
  32119. return false;
  32120. };
  32121. ATNState.prototype.addTransition = function(trans, index) {
  32122. if(index===undefined) {
  32123. index = -1;
  32124. }
  32125. if (this.transitions.length===0) {
  32126. this.epsilonOnlyTransitions = trans.isEpsilon;
  32127. } else if(this.epsilonOnlyTransitions !== trans.isEpsilon) {
  32128. this.epsilonOnlyTransitions = false;
  32129. }
  32130. if (index===-1) {
  32131. this.transitions.push(trans);
  32132. } else {
  32133. this.transitions.splice(index, 1, trans);
  32134. }
  32135. };
  32136. function BasicState() {
  32137. ATNState.call(this);
  32138. this.stateType = ATNState.BASIC;
  32139. return this;
  32140. }
  32141. BasicState.prototype = Object.create(ATNState.prototype);
  32142. BasicState.prototype.constructor = BasicState;
  32143. function DecisionState() {
  32144. ATNState.call(this);
  32145. this.decision = -1;
  32146. this.nonGreedy = false;
  32147. return this;
  32148. }
  32149. DecisionState.prototype = Object.create(ATNState.prototype);
  32150. DecisionState.prototype.constructor = DecisionState;
  32151. // The start of a regular {@code (...)} block.
  32152. function BlockStartState() {
  32153. DecisionState.call(this);
  32154. this.endState = null;
  32155. return this;
  32156. }
  32157. BlockStartState.prototype = Object.create(DecisionState.prototype);
  32158. BlockStartState.prototype.constructor = BlockStartState;
  32159. function BasicBlockStartState() {
  32160. BlockStartState.call(this);
  32161. this.stateType = ATNState.BLOCK_START;
  32162. return this;
  32163. }
  32164. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32165. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  32166. // Terminal node of a simple {@code (a|b|c)} block.
  32167. function BlockEndState() {
  32168. ATNState.call(this);
  32169. this.stateType = ATNState.BLOCK_END;
  32170. this.startState = null;
  32171. return this;
  32172. }
  32173. BlockEndState.prototype = Object.create(ATNState.prototype);
  32174. BlockEndState.prototype.constructor = BlockEndState;
  32175. // The last node in the ATN for a rule, unless that rule is the start symbol.
  32176. // In that case, there is one transition to EOF. Later, we might encode
  32177. // references to all calls to this rule to compute FOLLOW sets for
  32178. // error handling.
  32179. //
  32180. function RuleStopState() {
  32181. ATNState.call(this);
  32182. this.stateType = ATNState.RULE_STOP;
  32183. return this;
  32184. }
  32185. RuleStopState.prototype = Object.create(ATNState.prototype);
  32186. RuleStopState.prototype.constructor = RuleStopState;
  32187. function RuleStartState() {
  32188. ATNState.call(this);
  32189. this.stateType = ATNState.RULE_START;
  32190. this.stopState = null;
  32191. this.isPrecedenceRule = false;
  32192. return this;
  32193. }
  32194. RuleStartState.prototype = Object.create(ATNState.prototype);
  32195. RuleStartState.prototype.constructor = RuleStartState;
  32196. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  32197. // one to the loop back to start of the block and one to exit.
  32198. //
  32199. function PlusLoopbackState() {
  32200. DecisionState.call(this);
  32201. this.stateType = ATNState.PLUS_LOOP_BACK;
  32202. return this;
  32203. }
  32204. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  32205. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  32206. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  32207. // we don't use for code generation; somebody might need it, so I'm defining
  32208. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  32209. // real decision-making note for {@code A+}.
  32210. //
  32211. function PlusBlockStartState() {
  32212. BlockStartState.call(this);
  32213. this.stateType = ATNState.PLUS_BLOCK_START;
  32214. this.loopBackState = null;
  32215. return this;
  32216. }
  32217. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32218. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  32219. // The block that begins a closure loop.
  32220. function StarBlockStartState() {
  32221. BlockStartState.call(this);
  32222. this.stateType = ATNState.STAR_BLOCK_START;
  32223. return this;
  32224. }
  32225. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32226. StarBlockStartState.prototype.constructor = StarBlockStartState;
  32227. function StarLoopbackState() {
  32228. ATNState.call(this);
  32229. this.stateType = ATNState.STAR_LOOP_BACK;
  32230. return this;
  32231. }
  32232. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  32233. StarLoopbackState.prototype.constructor = StarLoopbackState;
  32234. function StarLoopEntryState() {
  32235. DecisionState.call(this);
  32236. this.stateType = ATNState.STAR_LOOP_ENTRY;
  32237. this.loopBackState = null;
  32238. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  32239. this.isPrecedenceDecision = null;
  32240. return this;
  32241. }
  32242. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  32243. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  32244. // Mark the end of a * or + loop.
  32245. function LoopEndState() {
  32246. ATNState.call(this);
  32247. this.stateType = ATNState.LOOP_END;
  32248. this.loopBackState = null;
  32249. return this;
  32250. }
  32251. LoopEndState.prototype = Object.create(ATNState.prototype);
  32252. LoopEndState.prototype.constructor = LoopEndState;
  32253. // The Tokens rule start state linking to each lexer rule start state */
  32254. function TokensStartState() {
  32255. DecisionState.call(this);
  32256. this.stateType = ATNState.TOKEN_START;
  32257. return this;
  32258. }
  32259. TokensStartState.prototype = Object.create(DecisionState.prototype);
  32260. TokensStartState.prototype.constructor = TokensStartState;
  32261. exports.ATNState = ATNState;
  32262. exports.BasicState = BasicState;
  32263. exports.DecisionState = DecisionState;
  32264. exports.BlockStartState = BlockStartState;
  32265. exports.BlockEndState = BlockEndState;
  32266. exports.LoopEndState = LoopEndState;
  32267. exports.RuleStartState = RuleStartState;
  32268. exports.RuleStopState = RuleStopState;
  32269. exports.TokensStartState = TokensStartState;
  32270. exports.PlusLoopbackState = PlusLoopbackState;
  32271. exports.StarLoopbackState = StarLoopbackState;
  32272. exports.StarLoopEntryState = StarLoopEntryState;
  32273. exports.PlusBlockStartState = PlusBlockStartState;
  32274. exports.StarBlockStartState = StarBlockStartState;
  32275. exports.BasicBlockStartState = BasicBlockStartState;
  32276. /***/ }),
  32277. /***/ "./node_modules/antlr4/atn/ATNType.js":
  32278. /*!********************************************!*\
  32279. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  32280. \********************************************/
  32281. /*! no static exports found */
  32282. /***/ (function(module, exports) {
  32283. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32284. * Use of this file is governed by the BSD 3-clause license that
  32285. * can be found in the LICENSE.txt file in the project root.
  32286. */
  32287. ///
  32288. // Represents the type of recognizer an ATN applies to.
  32289. function ATNType() {
  32290. }
  32291. ATNType.LEXER = 0;
  32292. ATNType.PARSER = 1;
  32293. exports.ATNType = ATNType;
  32294. /***/ }),
  32295. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  32296. /*!******************************************************!*\
  32297. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  32298. \******************************************************/
  32299. /*! no static exports found */
  32300. /***/ (function(module, exports, __webpack_require__) {
  32301. //
  32302. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32303. * Use of this file is governed by the BSD 3-clause license that
  32304. * can be found in the LICENSE.txt file in the project root.
  32305. */
  32306. ///
  32307. // When we hit an accept state in either the DFA or the ATN, we
  32308. // have to notify the character stream to start buffering characters
  32309. // via {@link IntStream//mark} and record the current state. The current sim state
  32310. // includes the current index into the input, the current line,
  32311. // and current character position in that line. Note that the Lexer is
  32312. // tracking the starting line and characterization of the token. These
  32313. // variables track the "state" of the simulator when it hits an accept state.
  32314. //
  32315. // <p>We track these variables separately for the DFA and ATN simulation
  32316. // because the DFA simulation often has to fail over to the ATN
  32317. // simulation. If the ATN simulation fails, we need the DFA to fall
  32318. // back to its previously accepted state, if any. If the ATN succeeds,
  32319. // then the ATN does the accept and the DFA simulator that invoked it
  32320. // can simply return the predicted token type.</p>
  32321. ///
  32322. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32323. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32324. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  32325. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  32326. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  32327. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  32328. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  32329. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  32330. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  32331. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  32332. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  32333. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  32334. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  32335. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32336. function resetSimState(sim) {
  32337. sim.index = -1;
  32338. sim.line = 0;
  32339. sim.column = -1;
  32340. sim.dfaState = null;
  32341. }
  32342. function SimState() {
  32343. resetSimState(this);
  32344. return this;
  32345. }
  32346. SimState.prototype.reset = function() {
  32347. resetSimState(this);
  32348. };
  32349. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  32350. ATNSimulator.call(this, atn, sharedContextCache);
  32351. this.decisionToDFA = decisionToDFA;
  32352. this.recog = recog;
  32353. // The current token's starting index into the character stream.
  32354. // Shared across DFA to ATN simulation in case the ATN fails and the
  32355. // DFA did not have a previous accept state. In this case, we use the
  32356. // ATN-generated exception object.
  32357. this.startIndex = -1;
  32358. // line number 1..n within the input///
  32359. this.line = 1;
  32360. // The index of the character relative to the beginning of the line
  32361. // 0..n-1///
  32362. this.column = 0;
  32363. this.mode = Lexer.DEFAULT_MODE;
  32364. // Used during DFA/ATN exec to record the most recent accept configuration
  32365. // info
  32366. this.prevAccept = new SimState();
  32367. // done
  32368. return this;
  32369. }
  32370. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  32371. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  32372. LexerATNSimulator.debug = false;
  32373. LexerATNSimulator.dfa_debug = false;
  32374. LexerATNSimulator.MIN_DFA_EDGE = 0;
  32375. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  32376. LexerATNSimulator.match_calls = 0;
  32377. LexerATNSimulator.prototype.copyState = function(simulator) {
  32378. this.column = simulator.column;
  32379. this.line = simulator.line;
  32380. this.mode = simulator.mode;
  32381. this.startIndex = simulator.startIndex;
  32382. };
  32383. LexerATNSimulator.prototype.match = function(input, mode) {
  32384. this.match_calls += 1;
  32385. this.mode = mode;
  32386. var mark = input.mark();
  32387. try {
  32388. this.startIndex = input.index;
  32389. this.prevAccept.reset();
  32390. var dfa = this.decisionToDFA[mode];
  32391. if (dfa.s0 === null) {
  32392. return this.matchATN(input);
  32393. } else {
  32394. return this.execATN(input, dfa.s0);
  32395. }
  32396. } finally {
  32397. input.release(mark);
  32398. }
  32399. };
  32400. LexerATNSimulator.prototype.reset = function() {
  32401. this.prevAccept.reset();
  32402. this.startIndex = -1;
  32403. this.line = 1;
  32404. this.column = 0;
  32405. this.mode = Lexer.DEFAULT_MODE;
  32406. };
  32407. LexerATNSimulator.prototype.matchATN = function(input) {
  32408. var startState = this.atn.modeToStartState[this.mode];
  32409. if (LexerATNSimulator.debug) {
  32410. console.log("matchATN mode " + this.mode + " start: " + startState);
  32411. }
  32412. var old_mode = this.mode;
  32413. var s0_closure = this.computeStartState(input, startState);
  32414. var suppressEdge = s0_closure.hasSemanticContext;
  32415. s0_closure.hasSemanticContext = false;
  32416. var next = this.addDFAState(s0_closure);
  32417. if (!suppressEdge) {
  32418. this.decisionToDFA[this.mode].s0 = next;
  32419. }
  32420. var predict = this.execATN(input, next);
  32421. if (LexerATNSimulator.debug) {
  32422. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  32423. }
  32424. return predict;
  32425. };
  32426. LexerATNSimulator.prototype.execATN = function(input, ds0) {
  32427. if (LexerATNSimulator.debug) {
  32428. console.log("start state closure=" + ds0.configs);
  32429. }
  32430. if (ds0.isAcceptState) {
  32431. // allow zero-length tokens
  32432. this.captureSimState(this.prevAccept, input, ds0);
  32433. }
  32434. var t = input.LA(1);
  32435. var s = ds0; // s is current/from DFA state
  32436. while (true) { // while more work
  32437. if (LexerATNSimulator.debug) {
  32438. console.log("execATN loop starting closure: " + s.configs);
  32439. }
  32440. // As we move src->trg, src->trg, we keep track of the previous trg to
  32441. // avoid looking up the DFA state again, which is expensive.
  32442. // If the previous target was already part of the DFA, we might
  32443. // be able to avoid doing a reach operation upon t. If s!=null,
  32444. // it means that semantic predicates didn't prevent us from
  32445. // creating a DFA state. Once we know s!=null, we check to see if
  32446. // the DFA state has an edge already for t. If so, we can just reuse
  32447. // it's configuration set; there's no point in re-computing it.
  32448. // This is kind of like doing DFA simulation within the ATN
  32449. // simulation because DFA simulation is really just a way to avoid
  32450. // computing reach/closure sets. Technically, once we know that
  32451. // we have a previously added DFA state, we could jump over to
  32452. // the DFA simulator. But, that would mean popping back and forth
  32453. // a lot and making things more complicated algorithmically.
  32454. // This optimization makes a lot of sense for loops within DFA.
  32455. // A character will take us back to an existing DFA state
  32456. // that already has lots of edges out of it. e.g., .* in comments.
  32457. // print("Target for:" + str(s) + " and:" + str(t))
  32458. var target = this.getExistingTargetState(s, t);
  32459. // print("Existing:" + str(target))
  32460. if (target === null) {
  32461. target = this.computeTargetState(input, s, t);
  32462. // print("Computed:" + str(target))
  32463. }
  32464. if (target === ATNSimulator.ERROR) {
  32465. break;
  32466. }
  32467. // If this is a consumable input element, make sure to consume before
  32468. // capturing the accept state so the input index, line, and char
  32469. // position accurately reflect the state of the interpreter at the
  32470. // end of the token.
  32471. if (t !== Token.EOF) {
  32472. this.consume(input);
  32473. }
  32474. if (target.isAcceptState) {
  32475. this.captureSimState(this.prevAccept, input, target);
  32476. if (t === Token.EOF) {
  32477. break;
  32478. }
  32479. }
  32480. t = input.LA(1);
  32481. s = target; // flip; current DFA target becomes new src/from state
  32482. }
  32483. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  32484. };
  32485. // Get an existing target state for an edge in the DFA. If the target state
  32486. // for the edge has not yet been computed or is otherwise not available,
  32487. // this method returns {@code null}.
  32488. //
  32489. // @param s The current DFA state
  32490. // @param t The next input symbol
  32491. // @return The existing target DFA state for the given input symbol
  32492. // {@code t}, or {@code null} if the target state for this edge is not
  32493. // already cached
  32494. LexerATNSimulator.prototype.getExistingTargetState = function(s, t) {
  32495. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  32496. return null;
  32497. }
  32498. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  32499. if(target===undefined) {
  32500. target = null;
  32501. }
  32502. if (LexerATNSimulator.debug && target !== null) {
  32503. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  32504. }
  32505. return target;
  32506. };
  32507. // Compute a target state for an edge in the DFA, and attempt to add the
  32508. // computed state and corresponding edge to the DFA.
  32509. //
  32510. // @param input The input stream
  32511. // @param s The current DFA state
  32512. // @param t The next input symbol
  32513. //
  32514. // @return The computed target DFA state for the given input symbol
  32515. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  32516. // returns {@link //ERROR}.
  32517. LexerATNSimulator.prototype.computeTargetState = function(input, s, t) {
  32518. var reach = new OrderedATNConfigSet();
  32519. // if we don't find an existing DFA state
  32520. // Fill reach starting from closure, following t transitions
  32521. this.getReachableConfigSet(input, s.configs, reach, t);
  32522. if (reach.items.length === 0) { // we got nowhere on t from s
  32523. if (!reach.hasSemanticContext) {
  32524. // we got nowhere on t, don't throw out this knowledge; it'd
  32525. // cause a failover from DFA later.
  32526. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  32527. }
  32528. // stop when we can't match any more char
  32529. return ATNSimulator.ERROR;
  32530. }
  32531. // Add an edge from s to target DFA found/created for reach
  32532. return this.addDFAEdge(s, t, null, reach);
  32533. };
  32534. LexerATNSimulator.prototype.failOrAccept = function(prevAccept, input, reach, t) {
  32535. if (this.prevAccept.dfaState !== null) {
  32536. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  32537. this.accept(input, lexerActionExecutor, this.startIndex,
  32538. prevAccept.index, prevAccept.line, prevAccept.column);
  32539. return prevAccept.dfaState.prediction;
  32540. } else {
  32541. // if no accept and EOF is first char, return EOF
  32542. if (t === Token.EOF && input.index === this.startIndex) {
  32543. return Token.EOF;
  32544. }
  32545. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  32546. }
  32547. };
  32548. // Given a starting configuration set, figure out all ATN configurations
  32549. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  32550. // parameter.
  32551. LexerATNSimulator.prototype.getReachableConfigSet = function(input, closure,
  32552. reach, t) {
  32553. // this is used to skip processing for configs which have a lower priority
  32554. // than a config that already reached an accept state for the same rule
  32555. var skipAlt = ATN.INVALID_ALT_NUMBER;
  32556. for (var i = 0; i < closure.items.length; i++) {
  32557. var cfg = closure.items[i];
  32558. var currentAltReachedAcceptState = (cfg.alt === skipAlt);
  32559. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  32560. continue;
  32561. }
  32562. if (LexerATNSimulator.debug) {
  32563. console.log("testing %s at %s\n", this.getTokenName(t), cfg
  32564. .toString(this.recog, true));
  32565. }
  32566. for (var j = 0; j < cfg.state.transitions.length; j++) {
  32567. var trans = cfg.state.transitions[j]; // for each transition
  32568. var target = this.getReachableTarget(trans, t);
  32569. if (target !== null) {
  32570. var lexerActionExecutor = cfg.lexerActionExecutor;
  32571. if (lexerActionExecutor !== null) {
  32572. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  32573. }
  32574. var treatEofAsEpsilon = (t === Token.EOF);
  32575. var config = new LexerATNConfig({state:target, lexerActionExecutor:lexerActionExecutor}, cfg);
  32576. if (this.closure(input, config, reach,
  32577. currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  32578. // any remaining configs for this alt have a lower priority
  32579. // than the one that just reached an accept state.
  32580. skipAlt = cfg.alt;
  32581. }
  32582. }
  32583. }
  32584. }
  32585. };
  32586. LexerATNSimulator.prototype.accept = function(input, lexerActionExecutor,
  32587. startIndex, index, line, charPos) {
  32588. if (LexerATNSimulator.debug) {
  32589. console.log("ACTION %s\n", lexerActionExecutor);
  32590. }
  32591. // seek to after last char in token
  32592. input.seek(index);
  32593. this.line = line;
  32594. this.column = charPos;
  32595. if (lexerActionExecutor !== null && this.recog !== null) {
  32596. lexerActionExecutor.execute(this.recog, input, startIndex);
  32597. }
  32598. };
  32599. LexerATNSimulator.prototype.getReachableTarget = function(trans, t) {
  32600. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  32601. return trans.target;
  32602. } else {
  32603. return null;
  32604. }
  32605. };
  32606. LexerATNSimulator.prototype.computeStartState = function(input, p) {
  32607. var initialContext = PredictionContext.EMPTY;
  32608. var configs = new OrderedATNConfigSet();
  32609. for (var i = 0; i < p.transitions.length; i++) {
  32610. var target = p.transitions[i].target;
  32611. var cfg = new LexerATNConfig({state:target, alt:i+1, context:initialContext}, null);
  32612. this.closure(input, cfg, configs, false, false, false);
  32613. }
  32614. return configs;
  32615. };
  32616. // Since the alternatives within any lexer decision are ordered by
  32617. // preference, this method stops pursuing the closure as soon as an accept
  32618. // state is reached. After the first accept state is reached by depth-first
  32619. // search from {@code config}, all other (potentially reachable) states for
  32620. // this rule would have a lower priority.
  32621. //
  32622. // @return {@code true} if an accept state is reached, otherwise
  32623. // {@code false}.
  32624. LexerATNSimulator.prototype.closure = function(input, config, configs,
  32625. currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  32626. var cfg = null;
  32627. if (LexerATNSimulator.debug) {
  32628. console.log("closure(" + config.toString(this.recog, true) + ")");
  32629. }
  32630. if (config.state instanceof RuleStopState) {
  32631. if (LexerATNSimulator.debug) {
  32632. if (this.recog !== null) {
  32633. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  32634. } else {
  32635. console.log("closure at rule stop %s\n", config);
  32636. }
  32637. }
  32638. if (config.context === null || config.context.hasEmptyPath()) {
  32639. if (config.context === null || config.context.isEmpty()) {
  32640. configs.add(config);
  32641. return true;
  32642. } else {
  32643. configs.add(new LexerATNConfig({ state:config.state, context:PredictionContext.EMPTY}, config));
  32644. currentAltReachedAcceptState = true;
  32645. }
  32646. }
  32647. if (config.context !== null && !config.context.isEmpty()) {
  32648. for (var i = 0; i < config.context.length; i++) {
  32649. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  32650. var newContext = config.context.getParent(i); // "pop" return state
  32651. var returnState = this.atn.states[config.context.getReturnState(i)];
  32652. cfg = new LexerATNConfig({ state:returnState, context:newContext }, config);
  32653. currentAltReachedAcceptState = this.closure(input, cfg,
  32654. configs, currentAltReachedAcceptState, speculative,
  32655. treatEofAsEpsilon);
  32656. }
  32657. }
  32658. }
  32659. return currentAltReachedAcceptState;
  32660. }
  32661. // optimization
  32662. if (!config.state.epsilonOnlyTransitions) {
  32663. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  32664. configs.add(config);
  32665. }
  32666. }
  32667. for (var j = 0; j < config.state.transitions.length; j++) {
  32668. var trans = config.state.transitions[j];
  32669. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  32670. if (cfg !== null) {
  32671. currentAltReachedAcceptState = this.closure(input, cfg, configs,
  32672. currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  32673. }
  32674. }
  32675. return currentAltReachedAcceptState;
  32676. };
  32677. // side-effect: can alter configs.hasSemanticContext
  32678. LexerATNSimulator.prototype.getEpsilonTarget = function(input, config, trans,
  32679. configs, speculative, treatEofAsEpsilon) {
  32680. var cfg = null;
  32681. if (trans.serializationType === Transition.RULE) {
  32682. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  32683. cfg = new LexerATNConfig( { state:trans.target, context:newContext}, config);
  32684. } else if (trans.serializationType === Transition.PRECEDENCE) {
  32685. throw "Precedence predicates are not supported in lexers.";
  32686. } else if (trans.serializationType === Transition.PREDICATE) {
  32687. // Track traversing semantic predicates. If we traverse,
  32688. // we cannot add a DFA state for this "reach" computation
  32689. // because the DFA would not test the predicate again in the
  32690. // future. Rather than creating collections of semantic predicates
  32691. // like v3 and testing them on prediction, v4 will test them on the
  32692. // fly all the time using the ATN not the DFA. This is slower but
  32693. // semantically it's not used that often. One of the key elements to
  32694. // this predicate mechanism is not adding DFA states that see
  32695. // predicates immediately afterwards in the ATN. For example,
  32696. // a : ID {p1}? | ID {p2}? ;
  32697. // should create the start state for rule 'a' (to save start state
  32698. // competition), but should not create target of ID state. The
  32699. // collection of ATN states the following ID references includes
  32700. // states reached by traversing predicates. Since this is when we
  32701. // test them, we cannot cash the DFA state target of ID.
  32702. if (LexerATNSimulator.debug) {
  32703. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  32704. }
  32705. configs.hasSemanticContext = true;
  32706. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  32707. cfg = new LexerATNConfig({ state:trans.target}, config);
  32708. }
  32709. } else if (trans.serializationType === Transition.ACTION) {
  32710. if (config.context === null || config.context.hasEmptyPath()) {
  32711. // execute actions anywhere in the start rule for a token.
  32712. //
  32713. // TODO: if the entry rule is invoked recursively, some
  32714. // actions may be executed during the recursive call. The
  32715. // problem can appear when hasEmptyPath() is true but
  32716. // isEmpty() is false. In this case, the config needs to be
  32717. // split into two contexts - one with just the empty path
  32718. // and another with everything but the empty path.
  32719. // Unfortunately, the current algorithm does not allow
  32720. // getEpsilonTarget to return two configurations, so
  32721. // additional modifications are needed before we can support
  32722. // the split operation.
  32723. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor,
  32724. this.atn.lexerActions[trans.actionIndex]);
  32725. cfg = new LexerATNConfig({ state:trans.target, lexerActionExecutor:lexerActionExecutor }, config);
  32726. } else {
  32727. // ignore actions in referenced rules
  32728. cfg = new LexerATNConfig( { state:trans.target}, config);
  32729. }
  32730. } else if (trans.serializationType === Transition.EPSILON) {
  32731. cfg = new LexerATNConfig({ state:trans.target}, config);
  32732. } else if (trans.serializationType === Transition.ATOM ||
  32733. trans.serializationType === Transition.RANGE ||
  32734. trans.serializationType === Transition.SET) {
  32735. if (treatEofAsEpsilon) {
  32736. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  32737. cfg = new LexerATNConfig( { state:trans.target }, config);
  32738. }
  32739. }
  32740. }
  32741. return cfg;
  32742. };
  32743. // Evaluate a predicate specified in the lexer.
  32744. //
  32745. // <p>If {@code speculative} is {@code true}, this method was called before
  32746. // {@link //consume} for the matched character. This method should call
  32747. // {@link //consume} before evaluating the predicate to ensure position
  32748. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  32749. // and {@link Lexer//getcolumn}, properly reflect the current
  32750. // lexer state. This method should restore {@code input} and the simulator
  32751. // to the original state before returning (i.e. undo the actions made by the
  32752. // call to {@link //consume}.</p>
  32753. //
  32754. // @param input The input stream.
  32755. // @param ruleIndex The rule containing the predicate.
  32756. // @param predIndex The index of the predicate within the rule.
  32757. // @param speculative {@code true} if the current index in {@code input} is
  32758. // one character before the predicate's location.
  32759. //
  32760. // @return {@code true} if the specified predicate evaluates to
  32761. // {@code true}.
  32762. // /
  32763. LexerATNSimulator.prototype.evaluatePredicate = function(input, ruleIndex,
  32764. predIndex, speculative) {
  32765. // assume true if no recognizer was provided
  32766. if (this.recog === null) {
  32767. return true;
  32768. }
  32769. if (!speculative) {
  32770. return this.recog.sempred(null, ruleIndex, predIndex);
  32771. }
  32772. var savedcolumn = this.column;
  32773. var savedLine = this.line;
  32774. var index = input.index;
  32775. var marker = input.mark();
  32776. try {
  32777. this.consume(input);
  32778. return this.recog.sempred(null, ruleIndex, predIndex);
  32779. } finally {
  32780. this.column = savedcolumn;
  32781. this.line = savedLine;
  32782. input.seek(index);
  32783. input.release(marker);
  32784. }
  32785. };
  32786. LexerATNSimulator.prototype.captureSimState = function(settings, input, dfaState) {
  32787. settings.index = input.index;
  32788. settings.line = this.line;
  32789. settings.column = this.column;
  32790. settings.dfaState = dfaState;
  32791. };
  32792. LexerATNSimulator.prototype.addDFAEdge = function(from_, tk, to, cfgs) {
  32793. if (to === undefined) {
  32794. to = null;
  32795. }
  32796. if (cfgs === undefined) {
  32797. cfgs = null;
  32798. }
  32799. if (to === null && cfgs !== null) {
  32800. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  32801. // marker indicating dynamic predicate evaluation makes this edge
  32802. // dependent on the specific input sequence, so the static edge in the
  32803. // DFA should be omitted. The target DFAState is still created since
  32804. // execATN has the ability to resynchronize with the DFA state cache
  32805. // following the predicate evaluation step.
  32806. //
  32807. // TJP notes: next time through the DFA, we see a pred again and eval.
  32808. // If that gets us to a previously created (but dangling) DFA
  32809. // state, we can continue in pure DFA mode from there.
  32810. // /
  32811. var suppressEdge = cfgs.hasSemanticContext;
  32812. cfgs.hasSemanticContext = false;
  32813. to = this.addDFAState(cfgs);
  32814. if (suppressEdge) {
  32815. return to;
  32816. }
  32817. }
  32818. // add the edge
  32819. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  32820. // Only track edges within the DFA bounds
  32821. return to;
  32822. }
  32823. if (LexerATNSimulator.debug) {
  32824. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  32825. }
  32826. if (from_.edges === null) {
  32827. // make room for tokens 1..n and -1 masquerading as index 0
  32828. from_.edges = [];
  32829. }
  32830. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  32831. return to;
  32832. };
  32833. // Add a new DFA state if there isn't one with this set of
  32834. // configurations already. This method also detects the first
  32835. // configuration containing an ATN rule stop state. Later, when
  32836. // traversing the DFA, we will know which rule to accept.
  32837. LexerATNSimulator.prototype.addDFAState = function(configs) {
  32838. var proposed = new DFAState(null, configs);
  32839. var firstConfigWithRuleStopState = null;
  32840. for (var i = 0; i < configs.items.length; i++) {
  32841. var cfg = configs.items[i];
  32842. if (cfg.state instanceof RuleStopState) {
  32843. firstConfigWithRuleStopState = cfg;
  32844. break;
  32845. }
  32846. }
  32847. if (firstConfigWithRuleStopState !== null) {
  32848. proposed.isAcceptState = true;
  32849. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  32850. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  32851. }
  32852. var dfa = this.decisionToDFA[this.mode];
  32853. var existing = dfa.states.get(proposed);
  32854. if (existing!==null) {
  32855. return existing;
  32856. }
  32857. var newState = proposed;
  32858. newState.stateNumber = dfa.states.length;
  32859. configs.setReadonly(true);
  32860. newState.configs = configs;
  32861. dfa.states.add(newState);
  32862. return newState;
  32863. };
  32864. LexerATNSimulator.prototype.getDFA = function(mode) {
  32865. return this.decisionToDFA[mode];
  32866. };
  32867. // Get the text matched so far for the current token.
  32868. LexerATNSimulator.prototype.getText = function(input) {
  32869. // index is first lookahead char, don't include.
  32870. return input.getText(this.startIndex, input.index - 1);
  32871. };
  32872. LexerATNSimulator.prototype.consume = function(input) {
  32873. var curChar = input.LA(1);
  32874. if (curChar === "\n".charCodeAt(0)) {
  32875. this.line += 1;
  32876. this.column = 0;
  32877. } else {
  32878. this.column += 1;
  32879. }
  32880. input.consume();
  32881. };
  32882. LexerATNSimulator.prototype.getTokenName = function(tt) {
  32883. if (tt === -1) {
  32884. return "EOF";
  32885. } else {
  32886. return "'" + String.fromCharCode(tt) + "'";
  32887. }
  32888. };
  32889. exports.LexerATNSimulator = LexerATNSimulator;
  32890. /***/ }),
  32891. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  32892. /*!************************************************!*\
  32893. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  32894. \************************************************/
  32895. /*! no static exports found */
  32896. /***/ (function(module, exports) {
  32897. //
  32898. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32899. * Use of this file is governed by the BSD 3-clause license that
  32900. * can be found in the LICENSE.txt file in the project root.
  32901. */
  32902. //
  32903. function LexerActionType() {
  32904. }
  32905. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  32906. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  32907. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  32908. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  32909. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  32910. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  32911. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  32912. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  32913. function LexerAction(action) {
  32914. this.actionType = action;
  32915. this.isPositionDependent = false;
  32916. return this;
  32917. }
  32918. LexerAction.prototype.hashCode = function() {
  32919. var hash = new Hash();
  32920. this.updateHashCode(hash);
  32921. return hash.finish()
  32922. };
  32923. LexerAction.prototype.updateHashCode = function(hash) {
  32924. hash.update(this.actionType);
  32925. };
  32926. LexerAction.prototype.equals = function(other) {
  32927. return this === other;
  32928. };
  32929. //
  32930. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  32931. //
  32932. // <p>The {@code skip} command does not have any parameters, so this action is
  32933. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  32934. function LexerSkipAction() {
  32935. LexerAction.call(this, LexerActionType.SKIP);
  32936. return this;
  32937. }
  32938. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  32939. LexerSkipAction.prototype.constructor = LexerSkipAction;
  32940. // Provides a singleton instance of this parameterless lexer action.
  32941. LexerSkipAction.INSTANCE = new LexerSkipAction();
  32942. LexerSkipAction.prototype.execute = function(lexer) {
  32943. lexer.skip();
  32944. };
  32945. LexerSkipAction.prototype.toString = function() {
  32946. return "skip";
  32947. };
  32948. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  32949. // with the assigned type.
  32950. function LexerTypeAction(type) {
  32951. LexerAction.call(this, LexerActionType.TYPE);
  32952. this.type = type;
  32953. return this;
  32954. }
  32955. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  32956. LexerTypeAction.prototype.constructor = LexerTypeAction;
  32957. LexerTypeAction.prototype.execute = function(lexer) {
  32958. lexer.type = this.type;
  32959. };
  32960. LexerTypeAction.prototype.updateHashCode = function(hash) {
  32961. hash.update(this.actionType, this.type);
  32962. };
  32963. LexerTypeAction.prototype.equals = function(other) {
  32964. if(this === other) {
  32965. return true;
  32966. } else if (! (other instanceof LexerTypeAction)) {
  32967. return false;
  32968. } else {
  32969. return this.type === other.type;
  32970. }
  32971. };
  32972. LexerTypeAction.prototype.toString = function() {
  32973. return "type(" + this.type + ")";
  32974. };
  32975. // Implements the {@code pushMode} lexer action by calling
  32976. // {@link Lexer//pushMode} with the assigned mode.
  32977. function LexerPushModeAction(mode) {
  32978. LexerAction.call(this, LexerActionType.PUSH_MODE);
  32979. this.mode = mode;
  32980. return this;
  32981. }
  32982. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  32983. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  32984. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  32985. // value provided by {@link //getMode}.</p>
  32986. LexerPushModeAction.prototype.execute = function(lexer) {
  32987. lexer.pushMode(this.mode);
  32988. };
  32989. LexerPushModeAction.prototype.updateHashCode = function(hash) {
  32990. hash.update(this.actionType, this.mode);
  32991. };
  32992. LexerPushModeAction.prototype.equals = function(other) {
  32993. if (this === other) {
  32994. return true;
  32995. } else if (! (other instanceof LexerPushModeAction)) {
  32996. return false;
  32997. } else {
  32998. return this.mode === other.mode;
  32999. }
  33000. };
  33001. LexerPushModeAction.prototype.toString = function() {
  33002. return "pushMode(" + this.mode + ")";
  33003. };
  33004. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  33005. //
  33006. // <p>The {@code popMode} command does not have any parameters, so this action is
  33007. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  33008. function LexerPopModeAction() {
  33009. LexerAction.call(this,LexerActionType.POP_MODE);
  33010. return this;
  33011. }
  33012. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  33013. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  33014. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  33015. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  33016. LexerPopModeAction.prototype.execute = function(lexer) {
  33017. lexer.popMode();
  33018. };
  33019. LexerPopModeAction.prototype.toString = function() {
  33020. return "popMode";
  33021. };
  33022. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  33023. //
  33024. // <p>The {@code more} command does not have any parameters, so this action is
  33025. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  33026. function LexerMoreAction() {
  33027. LexerAction.call(this, LexerActionType.MORE);
  33028. return this;
  33029. }
  33030. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  33031. LexerMoreAction.prototype.constructor = LexerMoreAction;
  33032. LexerMoreAction.INSTANCE = new LexerMoreAction();
  33033. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  33034. LexerMoreAction.prototype.execute = function(lexer) {
  33035. lexer.more();
  33036. };
  33037. LexerMoreAction.prototype.toString = function() {
  33038. return "more";
  33039. };
  33040. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  33041. // the assigned mode.
  33042. function LexerModeAction(mode) {
  33043. LexerAction.call(this, LexerActionType.MODE);
  33044. this.mode = mode;
  33045. return this;
  33046. }
  33047. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  33048. LexerModeAction.prototype.constructor = LexerModeAction;
  33049. // <p>This action is implemented by calling {@link Lexer//mode} with the
  33050. // value provided by {@link //getMode}.</p>
  33051. LexerModeAction.prototype.execute = function(lexer) {
  33052. lexer.mode(this.mode);
  33053. };
  33054. LexerModeAction.prototype.updateHashCode = function(hash) {
  33055. hash.update(this.actionType, this.mode);
  33056. };
  33057. LexerModeAction.prototype.equals = function(other) {
  33058. if (this === other) {
  33059. return true;
  33060. } else if (! (other instanceof LexerModeAction)) {
  33061. return false;
  33062. } else {
  33063. return this.mode === other.mode;
  33064. }
  33065. };
  33066. LexerModeAction.prototype.toString = function() {
  33067. return "mode(" + this.mode + ")";
  33068. };
  33069. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  33070. // rule and action indexes assigned to the custom action. The implementation of
  33071. // a custom action is added to the generated code for the lexer in an override
  33072. // of {@link Recognizer//action} when the grammar is compiled.
  33073. //
  33074. // <p>This class may represent embedded actions created with the <code>{...}</code>
  33075. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  33076. // command argument could not be evaluated when the grammar was compiled.</p>
  33077. // Constructs a custom lexer action with the specified rule and action
  33078. // indexes.
  33079. //
  33080. // @param ruleIndex The rule index to use for calls to
  33081. // {@link Recognizer//action}.
  33082. // @param actionIndex The action index to use for calls to
  33083. // {@link Recognizer//action}.
  33084. function LexerCustomAction(ruleIndex, actionIndex) {
  33085. LexerAction.call(this, LexerActionType.CUSTOM);
  33086. this.ruleIndex = ruleIndex;
  33087. this.actionIndex = actionIndex;
  33088. this.isPositionDependent = true;
  33089. return this;
  33090. }
  33091. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  33092. LexerCustomAction.prototype.constructor = LexerCustomAction;
  33093. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  33094. // appropriate rule and action indexes.</p>
  33095. LexerCustomAction.prototype.execute = function(lexer) {
  33096. lexer.action(null, this.ruleIndex, this.actionIndex);
  33097. };
  33098. LexerCustomAction.prototype.updateHashCode = function(hash) {
  33099. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  33100. };
  33101. LexerCustomAction.prototype.equals = function(other) {
  33102. if (this === other) {
  33103. return true;
  33104. } else if (! (other instanceof LexerCustomAction)) {
  33105. return false;
  33106. } else {
  33107. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  33108. }
  33109. };
  33110. // Implements the {@code channel} lexer action by calling
  33111. // {@link Lexer//setChannel} with the assigned channel.
  33112. // Constructs a new {@code channel} action with the specified channel value.
  33113. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  33114. function LexerChannelAction(channel) {
  33115. LexerAction.call(this, LexerActionType.CHANNEL);
  33116. this.channel = channel;
  33117. return this;
  33118. }
  33119. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  33120. LexerChannelAction.prototype.constructor = LexerChannelAction;
  33121. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  33122. // value provided by {@link //getChannel}.</p>
  33123. LexerChannelAction.prototype.execute = function(lexer) {
  33124. lexer._channel = this.channel;
  33125. };
  33126. LexerChannelAction.prototype.updateHashCode = function(hash) {
  33127. hash.update(this.actionType, this.channel);
  33128. };
  33129. LexerChannelAction.prototype.equals = function(other) {
  33130. if (this === other) {
  33131. return true;
  33132. } else if (! (other instanceof LexerChannelAction)) {
  33133. return false;
  33134. } else {
  33135. return this.channel === other.channel;
  33136. }
  33137. };
  33138. LexerChannelAction.prototype.toString = function() {
  33139. return "channel(" + this.channel + ")";
  33140. };
  33141. // This implementation of {@link LexerAction} is used for tracking input offsets
  33142. // for position-dependent actions within a {@link LexerActionExecutor}.
  33143. //
  33144. // <p>This action is not serialized as part of the ATN, and is only required for
  33145. // position-dependent lexer actions which appear at a location other than the
  33146. // end of a rule. For more information about DFA optimizations employed for
  33147. // lexer actions, see {@link LexerActionExecutor//append} and
  33148. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  33149. // Constructs a new indexed custom action by associating a character offset
  33150. // with a {@link LexerAction}.
  33151. //
  33152. // <p>Note: This class is only required for lexer actions for which
  33153. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  33154. //
  33155. // @param offset The offset into the input {@link CharStream}, relative to
  33156. // the token start index, at which the specified lexer action should be
  33157. // executed.
  33158. // @param action The lexer action to execute at a particular offset in the
  33159. // input {@link CharStream}.
  33160. function LexerIndexedCustomAction(offset, action) {
  33161. LexerAction.call(this, action.actionType);
  33162. this.offset = offset;
  33163. this.action = action;
  33164. this.isPositionDependent = true;
  33165. return this;
  33166. }
  33167. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  33168. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  33169. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  33170. // using the provided {@code lexer}.</p>
  33171. LexerIndexedCustomAction.prototype.execute = function(lexer) {
  33172. // assume the input stream position was properly set by the calling code
  33173. this.action.execute(lexer);
  33174. };
  33175. LexerIndexedCustomAction.prototype.updateHashCode = function(hash) {
  33176. hash.update(this.actionType, this.offset, this.action);
  33177. };
  33178. LexerIndexedCustomAction.prototype.equals = function(other) {
  33179. if (this === other) {
  33180. return true;
  33181. } else if (! (other instanceof LexerIndexedCustomAction)) {
  33182. return false;
  33183. } else {
  33184. return this.offset === other.offset && this.action === other.action;
  33185. }
  33186. };
  33187. exports.LexerActionType = LexerActionType;
  33188. exports.LexerSkipAction = LexerSkipAction;
  33189. exports.LexerChannelAction = LexerChannelAction;
  33190. exports.LexerCustomAction = LexerCustomAction;
  33191. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  33192. exports.LexerMoreAction = LexerMoreAction;
  33193. exports.LexerTypeAction = LexerTypeAction;
  33194. exports.LexerPushModeAction = LexerPushModeAction;
  33195. exports.LexerPopModeAction = LexerPopModeAction;
  33196. exports.LexerModeAction = LexerModeAction;
  33197. /***/ }),
  33198. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  33199. /*!********************************************************!*\
  33200. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  33201. \********************************************************/
  33202. /*! no static exports found */
  33203. /***/ (function(module, exports, __webpack_require__) {
  33204. //
  33205. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33206. * Use of this file is governed by the BSD 3-clause license that
  33207. * can be found in the LICENSE.txt file in the project root.
  33208. */
  33209. ///
  33210. // Represents an executor for a sequence of lexer actions which traversed during
  33211. // the matching operation of a lexer rule (token).
  33212. //
  33213. // <p>The executor tracks position information for position-dependent lexer actions
  33214. // efficiently, ensuring that actions appearing only at the end of the rule do
  33215. // not cause bloating of the {@link DFA} created for the lexer.</p>
  33216. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  33217. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  33218. function LexerActionExecutor(lexerActions) {
  33219. this.lexerActions = lexerActions === null ? [] : lexerActions;
  33220. // Caches the result of {@link //hashCode} since the hash code is an element
  33221. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  33222. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  33223. // lexerActions]))
  33224. return this;
  33225. }
  33226. // Creates a {@link LexerActionExecutor} which executes the actions for
  33227. // the input {@code lexerActionExecutor} followed by a specified
  33228. // {@code lexerAction}.
  33229. //
  33230. // @param lexerActionExecutor The executor for actions already traversed by
  33231. // the lexer while matching a token within a particular
  33232. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  33233. // though it were an empty executor.
  33234. // @param lexerAction The lexer action to execute after the actions
  33235. // specified in {@code lexerActionExecutor}.
  33236. //
  33237. // @return A {@link LexerActionExecutor} for executing the combine actions
  33238. // of {@code lexerActionExecutor} and {@code lexerAction}.
  33239. LexerActionExecutor.append = function(lexerActionExecutor, lexerAction) {
  33240. if (lexerActionExecutor === null) {
  33241. return new LexerActionExecutor([ lexerAction ]);
  33242. }
  33243. var lexerActions = lexerActionExecutor.lexerActions.concat([ lexerAction ]);
  33244. return new LexerActionExecutor(lexerActions);
  33245. };
  33246. // Creates a {@link LexerActionExecutor} which encodes the current offset
  33247. // for position-dependent lexer actions.
  33248. //
  33249. // <p>Normally, when the executor encounters lexer actions where
  33250. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  33251. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  33252. // position to the <em>end</em> of the current token. This behavior provides
  33253. // for efficient DFA representation of lexer actions which appear at the end
  33254. // of a lexer rule, even when the lexer rule matches a variable number of
  33255. // characters.</p>
  33256. //
  33257. // <p>Prior to traversing a match transition in the ATN, the current offset
  33258. // from the token start index is assigned to all position-dependent lexer
  33259. // actions which have not already been assigned a fixed offset. By storing
  33260. // the offsets relative to the token start index, the DFA representation of
  33261. // lexer actions which appear in the middle of tokens remains efficient due
  33262. // to sharing among tokens of the same length, regardless of their absolute
  33263. // position in the input stream.</p>
  33264. //
  33265. // <p>If the current executor already has offsets assigned to all
  33266. // position-dependent lexer actions, the method returns {@code this}.</p>
  33267. //
  33268. // @param offset The current offset to assign to all position-dependent
  33269. // lexer actions which do not already have offsets assigned.
  33270. //
  33271. // @return A {@link LexerActionExecutor} which stores input stream offsets
  33272. // for all position-dependent lexer actions.
  33273. // /
  33274. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function(offset) {
  33275. var updatedLexerActions = null;
  33276. for (var i = 0; i < this.lexerActions.length; i++) {
  33277. if (this.lexerActions[i].isPositionDependent &&
  33278. !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  33279. if (updatedLexerActions === null) {
  33280. updatedLexerActions = this.lexerActions.concat([]);
  33281. }
  33282. updatedLexerActions[i] = new LexerIndexedCustomAction(offset,
  33283. this.lexerActions[i]);
  33284. }
  33285. }
  33286. if (updatedLexerActions === null) {
  33287. return this;
  33288. } else {
  33289. return new LexerActionExecutor(updatedLexerActions);
  33290. }
  33291. };
  33292. // Execute the actions encapsulated by this executor within the context of a
  33293. // particular {@link Lexer}.
  33294. //
  33295. // <p>This method calls {@link IntStream//seek} to set the position of the
  33296. // {@code input} {@link CharStream} prior to calling
  33297. // {@link LexerAction//execute} on a position-dependent action. Before the
  33298. // method returns, the input position will be restored to the same position
  33299. // it was in when the method was invoked.</p>
  33300. //
  33301. // @param lexer The lexer instance.
  33302. // @param input The input stream which is the source for the current token.
  33303. // When this method is called, the current {@link IntStream//index} for
  33304. // {@code input} should be the start of the following token, i.e. 1
  33305. // character past the end of the current token.
  33306. // @param startIndex The token start index. This value may be passed to
  33307. // {@link IntStream//seek} to set the {@code input} position to the beginning
  33308. // of the token.
  33309. // /
  33310. LexerActionExecutor.prototype.execute = function(lexer, input, startIndex) {
  33311. var requiresSeek = false;
  33312. var stopIndex = input.index;
  33313. try {
  33314. for (var i = 0; i < this.lexerActions.length; i++) {
  33315. var lexerAction = this.lexerActions[i];
  33316. if (lexerAction instanceof LexerIndexedCustomAction) {
  33317. var offset = lexerAction.offset;
  33318. input.seek(startIndex + offset);
  33319. lexerAction = lexerAction.action;
  33320. requiresSeek = (startIndex + offset) !== stopIndex;
  33321. } else if (lexerAction.isPositionDependent) {
  33322. input.seek(stopIndex);
  33323. requiresSeek = false;
  33324. }
  33325. lexerAction.execute(lexer);
  33326. }
  33327. } finally {
  33328. if (requiresSeek) {
  33329. input.seek(stopIndex);
  33330. }
  33331. }
  33332. };
  33333. LexerActionExecutor.prototype.hashCode = function() {
  33334. return this.cachedHashCode;
  33335. };
  33336. LexerActionExecutor.prototype.updateHashCode = function(hash) {
  33337. hash.update(this.cachedHashCode);
  33338. };
  33339. LexerActionExecutor.prototype.equals = function(other) {
  33340. if (this === other) {
  33341. return true;
  33342. } else if (!(other instanceof LexerActionExecutor)) {
  33343. return false;
  33344. } else if (this.cachedHashCode != other.cachedHashCode) {
  33345. return false;
  33346. } else if (this.lexerActions.length != other.lexerActions.length) {
  33347. return false;
  33348. } else {
  33349. var numActions = this.lexerActions.length
  33350. for (var idx = 0; idx < numActions; ++idx) {
  33351. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  33352. return false;
  33353. }
  33354. }
  33355. return true;
  33356. }
  33357. };
  33358. exports.LexerActionExecutor = LexerActionExecutor;
  33359. /***/ }),
  33360. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  33361. /*!*******************************************************!*\
  33362. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  33363. \*******************************************************/
  33364. /*! no static exports found */
  33365. /***/ (function(module, exports, __webpack_require__) {
  33366. //
  33367. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33368. * Use of this file is governed by the BSD 3-clause license that
  33369. * can be found in the LICENSE.txt file in the project root.
  33370. */
  33371. //
  33372. //
  33373. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  33374. //
  33375. // <p>
  33376. // The basic complexity of the adaptive strategy makes it harder to understand.
  33377. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  33378. // requests go through the DFA first. If they reach a state without an edge for
  33379. // the current symbol, the algorithm fails over to the ATN simulation to
  33380. // complete the DFA path for the current input (until it finds a conflict state
  33381. // or uniquely predicting state).</p>
  33382. //
  33383. // <p>
  33384. // All of that is done without using the outer context because we want to create
  33385. // a DFA that is not dependent upon the rule invocation stack when we do a
  33386. // prediction. One DFA works in all contexts. We avoid using context not
  33387. // necessarily because it's slower, although it can be, but because of the DFA
  33388. // caching problem. The closure routine only considers the rule invocation stack
  33389. // created during prediction beginning in the decision rule. For example, if
  33390. // prediction occurs without invoking another rule's ATN, there are no context
  33391. // stacks in the configurations. When lack of context leads to a conflict, we
  33392. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  33393. // strategy (versus full LL(*)).</p>
  33394. //
  33395. // <p>
  33396. // When SLL yields a configuration set with conflict, we rewind the input and
  33397. // retry the ATN simulation, this time using full outer context without adding
  33398. // to the DFA. Configuration context stacks will be the full invocation stacks
  33399. // from the start rule. If we get a conflict using full context, then we can
  33400. // definitively say we have a true ambiguity for that input sequence. If we
  33401. // don't get a conflict, it implies that the decision is sensitive to the outer
  33402. // context. (It is not context-sensitive in the sense of context-sensitive
  33403. // grammars.)</p>
  33404. //
  33405. // <p>
  33406. // The next time we reach this DFA state with an SLL conflict, through DFA
  33407. // simulation, we will again retry the ATN simulation using full context mode.
  33408. // This is slow because we can't save the results and have to "interpret" the
  33409. // ATN each time we get that input.</p>
  33410. //
  33411. // <p>
  33412. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  33413. //
  33414. // <p>
  33415. // We could cache results from full context to predicted alternative easily and
  33416. // that saves a lot of time but doesn't work in presence of predicates. The set
  33417. // of visible predicates from the ATN start state changes depending on the
  33418. // context, because closure can fall off the end of a rule. I tried to cache
  33419. // tuples (stack context, semantic context, predicted alt) but it was slower
  33420. // than interpreting and much more complicated. Also required a huge amount of
  33421. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  33422. // to keep this algorithm simple. By launching multiple threads, we can improve
  33423. // the speed of parsing across a large number of files.</p>
  33424. //
  33425. // <p>
  33426. // There is no strict ordering between the amount of input used by SLL vs LL,
  33427. // which makes it really hard to build a cache for full context. Let's say that
  33428. // we have input A B C that leads to an SLL conflict with full context X. That
  33429. // implies that using X we might only use A B but we could also use A B C D to
  33430. // resolve conflict. Input A B C D could predict alternative 1 in one position
  33431. // in the input and A B C E could predict alternative 2 in another position in
  33432. // input. The conflicting SLL configurations could still be non-unique in the
  33433. // full context prediction, which would lead us to requiring more input than the
  33434. // original A B C. To make a prediction cache work, we have to track the exact
  33435. // input used during the previous prediction. That amounts to a cache that maps
  33436. // X to a specific DFA for that context.</p>
  33437. //
  33438. // <p>
  33439. // Something should be done for left-recursive expression predictions. They are
  33440. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  33441. // with full LL thing Sam does.</p>
  33442. //
  33443. // <p>
  33444. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  33445. //
  33446. // <p>
  33447. // We avoid doing full context retry when the outer context is empty, we did not
  33448. // dip into the outer context by falling off the end of the decision state rule,
  33449. // or when we force SLL mode.</p>
  33450. //
  33451. // <p>
  33452. // As an example of the not dip into outer context case, consider as super
  33453. // constructor calls versus function calls. One grammar might look like
  33454. // this:</p>
  33455. //
  33456. // <pre>
  33457. // ctorBody
  33458. // : '{' superCall? stat* '}'
  33459. // ;
  33460. // </pre>
  33461. //
  33462. // <p>
  33463. // Or, you might see something like</p>
  33464. //
  33465. // <pre>
  33466. // stat
  33467. // : superCall ';'
  33468. // | expression ';'
  33469. // | ...
  33470. // ;
  33471. // </pre>
  33472. //
  33473. // <p>
  33474. // In both cases I believe that no closure operations will dip into the outer
  33475. // context. In the first case ctorBody in the worst case will stop at the '}'.
  33476. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  33477. // entry rule and not dip into the outer context.</p>
  33478. //
  33479. // <p>
  33480. // <strong>PREDICATES</strong></p>
  33481. //
  33482. // <p>
  33483. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  33484. // LL simulation deals with predicates differently. SLL collects predicates as
  33485. // it performs closure operations like ANTLR v3 did. It delays predicate
  33486. // evaluation until it reaches and accept state. This allows us to cache the SLL
  33487. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  33488. // closure, the DFA state configuration sets would be different and we couldn't
  33489. // build up a suitable DFA.</p>
  33490. //
  33491. // <p>
  33492. // When building a DFA accept state during ATN simulation, we evaluate any
  33493. // predicates and return the sole semantically valid alternative. If there is
  33494. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  33495. // we throw an exception. Alternatives without predicates act like they have
  33496. // true predicates. The simple way to think about it is to strip away all
  33497. // alternatives with false predicates and choose the minimum alternative that
  33498. // remains.</p>
  33499. //
  33500. // <p>
  33501. // When we start in the DFA and reach an accept state that's predicated, we test
  33502. // those and return the minimum semantically viable alternative. If no
  33503. // alternatives are viable, we throw an exception.</p>
  33504. //
  33505. // <p>
  33506. // During full LL ATN simulation, closure always evaluates predicates and
  33507. // on-the-fly. This is crucial to reducing the configuration set size during
  33508. // closure. It hits a landmine when parsing with the Java grammar, for example,
  33509. // without this on-the-fly evaluation.</p>
  33510. //
  33511. // <p>
  33512. // <strong>SHARING DFA</strong></p>
  33513. //
  33514. // <p>
  33515. // All instances of the same parser share the same decision DFAs through a
  33516. // static field. Each instance gets its own ATN simulator but they share the
  33517. // same {@link //decisionToDFA} field. They also share a
  33518. // {@link PredictionContextCache} object that makes sure that all
  33519. // {@link PredictionContext} objects are shared among the DFA states. This makes
  33520. // a big size difference.</p>
  33521. //
  33522. // <p>
  33523. // <strong>THREAD SAFETY</strong></p>
  33524. //
  33525. // <p>
  33526. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  33527. // it adds a new DFA object to that array. {@link //addDFAEdge}
  33528. // locks on the DFA for the current decision when setting the
  33529. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  33530. // the DFA for the current decision when looking up a DFA state to see if it
  33531. // already exists. We must make sure that all requests to add DFA states that
  33532. // are equivalent result in the same shared DFA object. This is because lots of
  33533. // threads will be trying to update the DFA at once. The
  33534. // {@link //addDFAState} method also locks inside the DFA lock
  33535. // but this time on the shared context cache when it rebuilds the
  33536. // configurations' {@link PredictionContext} objects using cached
  33537. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  33538. // safe as long as we can guarantee that all threads referencing
  33539. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  33540. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  33541. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  33542. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  33543. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  33544. // {@code dfa.edges[t]} to be non-null. The
  33545. // {@link //addDFAEdge} method could be racing to set the field
  33546. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  33547. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  33548. // way it will work because it's not doing a test and set operation.</p>
  33549. //
  33550. // <p>
  33551. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  33552. // Parsing)</strong></p>
  33553. //
  33554. // <p>
  33555. // Sam pointed out that if SLL does not give a syntax error, then there is no
  33556. // point in doing full LL, which is slower. We only have to try LL if we get a
  33557. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  33558. // mode with the {@link BailErrorStrategy}:</p>
  33559. //
  33560. // <pre>
  33561. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  33562. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  33563. // </pre>
  33564. //
  33565. // <p>
  33566. // If it does not get a syntax error, then we're done. If it does get a syntax
  33567. // error, we need to retry with the combined SLL/LL strategy.</p>
  33568. //
  33569. // <p>
  33570. // The reason this works is as follows. If there are no SLL conflicts, then the
  33571. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  33572. // the full LL analysis must yield a set of viable alternatives which is a
  33573. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  33574. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  33575. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  33576. // is truly ambiguous on the current input. If the LL set is smaller, then the
  33577. // SLL conflict resolution might choose an alternative that the full LL would
  33578. // rule out as a possibility based upon better context information. If that's
  33579. // the case, then the SLL parse will definitely get an error because the full LL
  33580. // analysis says it's not viable. If SLL conflict resolution chooses an
  33581. // alternative within the LL set, them both SLL and LL would choose the same
  33582. // alternative because they both choose the minimum of multiple conflicting
  33583. // alternatives.</p>
  33584. //
  33585. // <p>
  33586. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  33587. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  33588. // parsing will get an error because SLL will pursue alternative 1. If
  33589. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  33590. // choose the same alternative because alternative one is the minimum of either
  33591. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  33592. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  33593. //
  33594. // <p>
  33595. // Of course, if the input is invalid, then we will get an error for sure in
  33596. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  33597. // the input.</p>
  33598. //
  33599. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  33600. var Set = Utils.Set;
  33601. var BitSet = Utils.BitSet;
  33602. var DoubleDict = Utils.DoubleDict;
  33603. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  33604. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  33605. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  33606. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  33607. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  33608. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  33609. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  33610. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  33611. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  33612. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  33613. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  33614. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  33615. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  33616. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  33617. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  33618. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  33619. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  33620. var Transition = Transitions.Transition;
  33621. var SetTransition = Transitions.SetTransition;
  33622. var NotSetTransition = Transitions.NotSetTransition;
  33623. var RuleTransition = Transitions.RuleTransition;
  33624. var ActionTransition = Transitions.ActionTransition;
  33625. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  33626. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  33627. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  33628. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  33629. ATNSimulator.call(this, atn, sharedContextCache);
  33630. this.parser = parser;
  33631. this.decisionToDFA = decisionToDFA;
  33632. // SLL, LL, or LL + exact ambig detection?//
  33633. this.predictionMode = PredictionMode.LL;
  33634. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  33635. this._input = null;
  33636. this._startIndex = 0;
  33637. this._outerContext = null;
  33638. this._dfa = null;
  33639. // Each prediction operation uses a cache for merge of prediction contexts.
  33640. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  33641. // isn't synchronized but we're ok since two threads shouldn't reuse same
  33642. // parser/atnsim object because it can only handle one input at a time.
  33643. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  33644. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  33645. // also be examined during cache lookup.
  33646. //
  33647. this.mergeCache = null;
  33648. return this;
  33649. }
  33650. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  33651. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  33652. ParserATNSimulator.prototype.debug = false;
  33653. ParserATNSimulator.prototype.debug_closure = false;
  33654. ParserATNSimulator.prototype.debug_add = false;
  33655. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  33656. ParserATNSimulator.prototype.dfa_debug = false;
  33657. ParserATNSimulator.prototype.retry_debug = false;
  33658. ParserATNSimulator.prototype.reset = function() {
  33659. };
  33660. ParserATNSimulator.prototype.adaptivePredict = function(input, decision, outerContext) {
  33661. if (this.debug || this.debug_list_atn_decisions) {
  33662. console.log("adaptivePredict decision " + decision +
  33663. " exec LA(1)==" + this.getLookaheadName(input) +
  33664. " line " + input.LT(1).line + ":" +
  33665. input.LT(1).column);
  33666. }
  33667. this._input = input;
  33668. this._startIndex = input.index;
  33669. this._outerContext = outerContext;
  33670. var dfa = this.decisionToDFA[decision];
  33671. this._dfa = dfa;
  33672. var m = input.mark();
  33673. var index = input.index;
  33674. // Now we are certain to have a specific decision's DFA
  33675. // But, do we still need an initial state?
  33676. try {
  33677. var s0;
  33678. if (dfa.precedenceDfa) {
  33679. // the start state for a precedence DFA depends on the current
  33680. // parser precedence, and is provided by a DFA method.
  33681. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  33682. } else {
  33683. // the start state for a "regular" DFA is just s0
  33684. s0 = dfa.s0;
  33685. }
  33686. if (s0===null) {
  33687. if (outerContext===null) {
  33688. outerContext = RuleContext.EMPTY;
  33689. }
  33690. if (this.debug || this.debug_list_atn_decisions) {
  33691. console.log("predictATN decision " + dfa.decision +
  33692. " exec LA(1)==" + this.getLookaheadName(input) +
  33693. ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  33694. }
  33695. var fullCtx = false;
  33696. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  33697. if( dfa.precedenceDfa) {
  33698. // If this is a precedence DFA, we use applyPrecedenceFilter
  33699. // to convert the computed start state to a precedence start
  33700. // state. We then use DFA.setPrecedenceStartState to set the
  33701. // appropriate start state for the precedence level rather
  33702. // than simply setting DFA.s0.
  33703. //
  33704. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  33705. s0_closure = this.applyPrecedenceFilter(s0_closure);
  33706. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  33707. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  33708. } else {
  33709. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  33710. dfa.s0 = s0;
  33711. }
  33712. }
  33713. var alt = this.execATN(dfa, s0, input, index, outerContext);
  33714. if (this.debug) {
  33715. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  33716. }
  33717. return alt;
  33718. } finally {
  33719. this._dfa = null;
  33720. this.mergeCache = null; // wack cache after each prediction
  33721. input.seek(index);
  33722. input.release(m);
  33723. }
  33724. };
  33725. // Performs ATN simulation to compute a predicted alternative based
  33726. // upon the remaining input, but also updates the DFA cache to avoid
  33727. // having to traverse the ATN again for the same input sequence.
  33728. // There are some key conditions we're looking for after computing a new
  33729. // set of ATN configs (proposed DFA state):
  33730. // if the set is empty, there is no viable alternative for current symbol
  33731. // does the state uniquely predict an alternative?
  33732. // does the state have a conflict that would prevent us from
  33733. // putting it on the work list?
  33734. // We also have some key operations to do:
  33735. // add an edge from previous DFA state to potentially new DFA state, D,
  33736. // upon current symbol but only if adding to work list, which means in all
  33737. // cases except no viable alternative (and possibly non-greedy decisions?)
  33738. // collecting predicates and adding semantic context to DFA accept states
  33739. // adding rule context to context-sensitive DFA accept states
  33740. // consuming an input symbol
  33741. // reporting a conflict
  33742. // reporting an ambiguity
  33743. // reporting a context sensitivity
  33744. // reporting insufficient predicates
  33745. // cover these cases:
  33746. // dead end
  33747. // single alt
  33748. // single alt + preds
  33749. // conflict
  33750. // conflict + preds
  33751. //
  33752. ParserATNSimulator.prototype.execATN = function(dfa, s0, input, startIndex, outerContext ) {
  33753. if (this.debug || this.debug_list_atn_decisions) {
  33754. console.log("execATN decision " + dfa.decision +
  33755. " exec LA(1)==" + this.getLookaheadName(input) +
  33756. " line " + input.LT(1).line + ":" + input.LT(1).column);
  33757. }
  33758. var alt;
  33759. var previousD = s0;
  33760. if (this.debug) {
  33761. console.log("s0 = " + s0);
  33762. }
  33763. var t = input.LA(1);
  33764. while(true) { // while more work
  33765. var D = this.getExistingTargetState(previousD, t);
  33766. if(D===null) {
  33767. D = this.computeTargetState(dfa, previousD, t);
  33768. }
  33769. if(D===ATNSimulator.ERROR) {
  33770. // if any configs in previous dipped into outer context, that
  33771. // means that input up to t actually finished entry rule
  33772. // at least for SLL decision. Full LL doesn't dip into outer
  33773. // so don't need special case.
  33774. // We will get an error no matter what so delay until after
  33775. // decision; better error message. Also, no reachable target
  33776. // ATN states in SLL implies LL will also get nowhere.
  33777. // If conflict in states that dip out, choose min since we
  33778. // will get error no matter what.
  33779. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  33780. input.seek(startIndex);
  33781. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  33782. if(alt!==ATN.INVALID_ALT_NUMBER) {
  33783. return alt;
  33784. } else {
  33785. throw e;
  33786. }
  33787. }
  33788. if(D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  33789. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  33790. var conflictingAlts = null;
  33791. if (D.predicates!==null) {
  33792. if (this.debug) {
  33793. console.log("DFA state has preds in DFA sim LL failover");
  33794. }
  33795. var conflictIndex = input.index;
  33796. if(conflictIndex !== startIndex) {
  33797. input.seek(startIndex);
  33798. }
  33799. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  33800. if (conflictingAlts.length===1) {
  33801. if(this.debug) {
  33802. console.log("Full LL avoided");
  33803. }
  33804. return conflictingAlts.minValue();
  33805. }
  33806. if (conflictIndex !== startIndex) {
  33807. // restore the index so reporting the fallback to full
  33808. // context occurs with the index at the correct spot
  33809. input.seek(conflictIndex);
  33810. }
  33811. }
  33812. if (this.dfa_debug) {
  33813. console.log("ctx sensitive state " + outerContext +" in " + D);
  33814. }
  33815. var fullCtx = true;
  33816. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  33817. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  33818. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  33819. return alt;
  33820. }
  33821. if (D.isAcceptState) {
  33822. if (D.predicates===null) {
  33823. return D.prediction;
  33824. }
  33825. var stopIndex = input.index;
  33826. input.seek(startIndex);
  33827. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  33828. if (alts.length===0) {
  33829. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  33830. } else if (alts.length===1) {
  33831. return alts.minValue();
  33832. } else {
  33833. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  33834. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  33835. return alts.minValue();
  33836. }
  33837. }
  33838. previousD = D;
  33839. if (t !== Token.EOF) {
  33840. input.consume();
  33841. t = input.LA(1);
  33842. }
  33843. }
  33844. };
  33845. //
  33846. // Get an existing target state for an edge in the DFA. If the target state
  33847. // for the edge has not yet been computed or is otherwise not available,
  33848. // this method returns {@code null}.
  33849. //
  33850. // @param previousD The current DFA state
  33851. // @param t The next input symbol
  33852. // @return The existing target DFA state for the given input symbol
  33853. // {@code t}, or {@code null} if the target state for this edge is not
  33854. // already cached
  33855. //
  33856. ParserATNSimulator.prototype.getExistingTargetState = function(previousD, t) {
  33857. var edges = previousD.edges;
  33858. if (edges===null) {
  33859. return null;
  33860. } else {
  33861. return edges[t + 1] || null;
  33862. }
  33863. };
  33864. //
  33865. // Compute a target state for an edge in the DFA, and attempt to add the
  33866. // computed state and corresponding edge to the DFA.
  33867. //
  33868. // @param dfa The DFA
  33869. // @param previousD The current DFA state
  33870. // @param t The next input symbol
  33871. //
  33872. // @return The computed target DFA state for the given input symbol
  33873. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  33874. // returns {@link //ERROR}.
  33875. //
  33876. ParserATNSimulator.prototype.computeTargetState = function(dfa, previousD, t) {
  33877. var reach = this.computeReachSet(previousD.configs, t, false);
  33878. if(reach===null) {
  33879. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  33880. return ATNSimulator.ERROR;
  33881. }
  33882. // create new target state; we'll add to DFA after it's complete
  33883. var D = new DFAState(null, reach);
  33884. var predictedAlt = this.getUniqueAlt(reach);
  33885. if (this.debug) {
  33886. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  33887. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) +
  33888. ", previous=" + previousD.configs +
  33889. ", configs=" + reach +
  33890. ", predict=" + predictedAlt +
  33891. ", allSubsetsConflict=" +
  33892. PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" +
  33893. this.getConflictingAlts(reach));
  33894. }
  33895. if (predictedAlt!==ATN.INVALID_ALT_NUMBER) {
  33896. // NO CONFLICT, UNIQUELY PREDICTED ALT
  33897. D.isAcceptState = true;
  33898. D.configs.uniqueAlt = predictedAlt;
  33899. D.prediction = predictedAlt;
  33900. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  33901. // MORE THAN ONE VIABLE ALTERNATIVE
  33902. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  33903. D.requiresFullContext = true;
  33904. // in SLL-only mode, we will stop at this state and return the minimum alt
  33905. D.isAcceptState = true;
  33906. D.prediction = D.configs.conflictingAlts.minValue();
  33907. }
  33908. if (D.isAcceptState && D.configs.hasSemanticContext) {
  33909. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  33910. if( D.predicates!==null) {
  33911. D.prediction = ATN.INVALID_ALT_NUMBER;
  33912. }
  33913. }
  33914. // all adds to dfa are done after we've created full D state
  33915. D = this.addDFAEdge(dfa, previousD, t, D);
  33916. return D;
  33917. };
  33918. ParserATNSimulator.prototype.predicateDFAState = function(dfaState, decisionState) {
  33919. // We need to test all predicates, even in DFA states that
  33920. // uniquely predict alternative.
  33921. var nalts = decisionState.transitions.length;
  33922. // Update DFA so reach becomes accept state with (predicate,alt)
  33923. // pairs if preds found for conflicting alts
  33924. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  33925. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  33926. if (altToPred!==null) {
  33927. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  33928. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  33929. } else {
  33930. // There are preds in configs but they might go away
  33931. // when OR'd together like {p}? || NONE == NONE. If neither
  33932. // alt has preds, resolve to min alt
  33933. dfaState.prediction = altsToCollectPredsFrom.minValue();
  33934. }
  33935. };
  33936. // comes back with reach.uniqueAlt set to a valid alt
  33937. ParserATNSimulator.prototype.execATNWithFullContext = function(dfa, D, // how far we got before failing over
  33938. s0,
  33939. input,
  33940. startIndex,
  33941. outerContext) {
  33942. if (this.debug || this.debug_list_atn_decisions) {
  33943. console.log("execATNWithFullContext "+s0);
  33944. }
  33945. var fullCtx = true;
  33946. var foundExactAmbig = false;
  33947. var reach = null;
  33948. var previous = s0;
  33949. input.seek(startIndex);
  33950. var t = input.LA(1);
  33951. var predictedAlt = -1;
  33952. while (true) { // while more work
  33953. reach = this.computeReachSet(previous, t, fullCtx);
  33954. if (reach===null) {
  33955. // if any configs in previous dipped into outer context, that
  33956. // means that input up to t actually finished entry rule
  33957. // at least for LL decision. Full LL doesn't dip into outer
  33958. // so don't need special case.
  33959. // We will get an error no matter what so delay until after
  33960. // decision; better error message. Also, no reachable target
  33961. // ATN states in SLL implies LL will also get nowhere.
  33962. // If conflict in states that dip out, choose min since we
  33963. // will get error no matter what.
  33964. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  33965. input.seek(startIndex);
  33966. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  33967. if(alt!==ATN.INVALID_ALT_NUMBER) {
  33968. return alt;
  33969. } else {
  33970. throw e;
  33971. }
  33972. }
  33973. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  33974. if(this.debug) {
  33975. console.log("LL altSubSets=" + altSubSets + ", predict=" +
  33976. PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" +
  33977. PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  33978. }
  33979. reach.uniqueAlt = this.getUniqueAlt(reach);
  33980. // unique prediction?
  33981. if(reach.uniqueAlt!==ATN.INVALID_ALT_NUMBER) {
  33982. predictedAlt = reach.uniqueAlt;
  33983. break;
  33984. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  33985. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  33986. if(predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  33987. break;
  33988. }
  33989. } else {
  33990. // In exact ambiguity mode, we never try to terminate early.
  33991. // Just keeps scarfing until we know what the conflict is
  33992. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  33993. foundExactAmbig = true;
  33994. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  33995. break;
  33996. }
  33997. // else there are multiple non-conflicting subsets or
  33998. // we're not sure what the ambiguity is yet.
  33999. // So, keep going.
  34000. }
  34001. previous = reach;
  34002. if( t !== Token.EOF) {
  34003. input.consume();
  34004. t = input.LA(1);
  34005. }
  34006. }
  34007. // If the configuration set uniquely predicts an alternative,
  34008. // without conflict, then we know that it's a full LL decision
  34009. // not SLL.
  34010. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER ) {
  34011. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  34012. return predictedAlt;
  34013. }
  34014. // We do not check predicates here because we have checked them
  34015. // on-the-fly when doing full context prediction.
  34016. //
  34017. // In non-exact ambiguity detection mode, we might actually be able to
  34018. // detect an exact ambiguity, but I'm not going to spend the cycles
  34019. // needed to check. We only emit ambiguity warnings in exact ambiguity
  34020. // mode.
  34021. //
  34022. // For example, we might know that we have conflicting configurations.
  34023. // But, that does not mean that there is no way forward without a
  34024. // conflict. It's possible to have nonconflicting alt subsets as in:
  34025. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  34026. // from
  34027. //
  34028. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  34029. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  34030. //
  34031. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  34032. // would resolve this without conflict to alternative 1. Any other viable
  34033. // next sequence, however, is associated with a conflict. We stop
  34034. // looking for input because no amount of further lookahead will alter
  34035. // the fact that we should predict alternative 1. We just can't say for
  34036. // sure that there is an ambiguity without looking further.
  34037. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  34038. return predictedAlt;
  34039. };
  34040. ParserATNSimulator.prototype.computeReachSet = function(closure, t, fullCtx) {
  34041. if (this.debug) {
  34042. console.log("in computeReachSet, starting closure: " + closure);
  34043. }
  34044. if( this.mergeCache===null) {
  34045. this.mergeCache = new DoubleDict();
  34046. }
  34047. var intermediate = new ATNConfigSet(fullCtx);
  34048. // Configurations already in a rule stop state indicate reaching the end
  34049. // of the decision rule (local context) or end of the start rule (full
  34050. // context). Once reached, these configurations are never updated by a
  34051. // closure operation, so they are handled separately for the performance
  34052. // advantage of having a smaller intermediate set when calling closure.
  34053. //
  34054. // For full-context reach operations, separate handling is required to
  34055. // ensure that the alternative matching the longest overall sequence is
  34056. // chosen when multiple such configurations can match the input.
  34057. var skippedStopStates = null;
  34058. // First figure out where we can reach on input t
  34059. for (var i=0; i<closure.items.length;i++) {
  34060. var c = closure.items[i];
  34061. if(this.debug_add) {
  34062. console.log("testing " + this.getTokenName(t) + " at " + c);
  34063. }
  34064. if (c.state instanceof RuleStopState) {
  34065. if (fullCtx || t === Token.EOF) {
  34066. if (skippedStopStates===null) {
  34067. skippedStopStates = [];
  34068. }
  34069. skippedStopStates.push(c);
  34070. if(this.debug_add) {
  34071. console.log("added " + c + " to skippedStopStates");
  34072. }
  34073. }
  34074. continue;
  34075. }
  34076. for(var j=0;j<c.state.transitions.length;j++) {
  34077. var trans = c.state.transitions[j];
  34078. var target = this.getReachableTarget(trans, t);
  34079. if (target!==null) {
  34080. var cfg = new ATNConfig({state:target}, c);
  34081. intermediate.add(cfg, this.mergeCache);
  34082. if(this.debug_add) {
  34083. console.log("added " + cfg + " to intermediate");
  34084. }
  34085. }
  34086. }
  34087. }
  34088. // Now figure out where the reach operation can take us...
  34089. var reach = null;
  34090. // This block optimizes the reach operation for intermediate sets which
  34091. // trivially indicate a termination state for the overall
  34092. // adaptivePredict operation.
  34093. //
  34094. // The conditions assume that intermediate
  34095. // contains all configurations relevant to the reach set, but this
  34096. // condition is not true when one or more configurations have been
  34097. // withheld in skippedStopStates, or when the current symbol is EOF.
  34098. //
  34099. if (skippedStopStates===null && t!==Token.EOF) {
  34100. if (intermediate.items.length===1) {
  34101. // Don't pursue the closure if there is just one state.
  34102. // It can only have one alternative; just add to result
  34103. // Also don't pursue the closure if there is unique alternative
  34104. // among the configurations.
  34105. reach = intermediate;
  34106. } else if (this.getUniqueAlt(intermediate)!==ATN.INVALID_ALT_NUMBER) {
  34107. // Also don't pursue the closure if there is unique alternative
  34108. // among the configurations.
  34109. reach = intermediate;
  34110. }
  34111. }
  34112. // If the reach set could not be trivially determined, perform a closure
  34113. // operation on the intermediate set to compute its initial value.
  34114. //
  34115. if (reach===null) {
  34116. reach = new ATNConfigSet(fullCtx);
  34117. var closureBusy = new Set();
  34118. var treatEofAsEpsilon = t === Token.EOF;
  34119. for (var k=0; k<intermediate.items.length;k++) {
  34120. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  34121. }
  34122. }
  34123. if (t === Token.EOF) {
  34124. // After consuming EOF no additional input is possible, so we are
  34125. // only interested in configurations which reached the end of the
  34126. // decision rule (local context) or end of the start rule (full
  34127. // context). Update reach to contain only these configurations. This
  34128. // handles both explicit EOF transitions in the grammar and implicit
  34129. // EOF transitions following the end of the decision or start rule.
  34130. //
  34131. // When reach==intermediate, no closure operation was performed. In
  34132. // this case, removeAllConfigsNotInRuleStopState needs to check for
  34133. // reachable rule stop states as well as configurations already in
  34134. // a rule stop state.
  34135. //
  34136. // This is handled before the configurations in skippedStopStates,
  34137. // because any configurations potentially added from that list are
  34138. // already guaranteed to meet this condition whether or not it's
  34139. // required.
  34140. //
  34141. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  34142. }
  34143. // If skippedStopStates!==null, then it contains at least one
  34144. // configuration. For full-context reach operations, these
  34145. // configurations reached the end of the start rule, in which case we
  34146. // only add them back to reach if no configuration during the current
  34147. // closure operation reached such a state. This ensures adaptivePredict
  34148. // chooses an alternative matching the longest overall sequence when
  34149. // multiple alternatives are viable.
  34150. //
  34151. if (skippedStopStates!==null && ( (! fullCtx) || (! PredictionMode.hasConfigInRuleStopState(reach)))) {
  34152. for (var l=0; l<skippedStopStates.length;l++) {
  34153. reach.add(skippedStopStates[l], this.mergeCache);
  34154. }
  34155. }
  34156. if (reach.items.length===0) {
  34157. return null;
  34158. } else {
  34159. return reach;
  34160. }
  34161. };
  34162. //
  34163. // Return a configuration set containing only the configurations from
  34164. // {@code configs} which are in a {@link RuleStopState}. If all
  34165. // configurations in {@code configs} are already in a rule stop state, this
  34166. // method simply returns {@code configs}.
  34167. //
  34168. // <p>When {@code lookToEndOfRule} is true, this method uses
  34169. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  34170. // not already in a rule stop state to see if a rule stop state is reachable
  34171. // from the configuration via epsilon-only transitions.</p>
  34172. //
  34173. // @param configs the configuration set to update
  34174. // @param lookToEndOfRule when true, this method checks for rule stop states
  34175. // reachable by epsilon-only transitions from each configuration in
  34176. // {@code configs}.
  34177. //
  34178. // @return {@code configs} if all configurations in {@code configs} are in a
  34179. // rule stop state, otherwise return a new configuration set containing only
  34180. // the configurations from {@code configs} which are in a rule stop state
  34181. //
  34182. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function(configs, lookToEndOfRule) {
  34183. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  34184. return configs;
  34185. }
  34186. var result = new ATNConfigSet(configs.fullCtx);
  34187. for(var i=0; i<configs.items.length;i++) {
  34188. var config = configs.items[i];
  34189. if (config.state instanceof RuleStopState) {
  34190. result.add(config, this.mergeCache);
  34191. continue;
  34192. }
  34193. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  34194. var nextTokens = this.atn.nextTokens(config.state);
  34195. if (nextTokens.contains(Token.EPSILON)) {
  34196. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  34197. result.add(new ATNConfig({state:endOfRuleState}, config), this.mergeCache);
  34198. }
  34199. }
  34200. }
  34201. return result;
  34202. };
  34203. ParserATNSimulator.prototype.computeStartState = function(p, ctx, fullCtx) {
  34204. // always at least the implicit call to start rule
  34205. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  34206. var configs = new ATNConfigSet(fullCtx);
  34207. for(var i=0;i<p.transitions.length;i++) {
  34208. var target = p.transitions[i].target;
  34209. var c = new ATNConfig({ state:target, alt:i+1, context:initialContext }, null);
  34210. var closureBusy = new Set();
  34211. this.closure(c, configs, closureBusy, true, fullCtx, false);
  34212. }
  34213. return configs;
  34214. };
  34215. //
  34216. // This method transforms the start state computed by
  34217. // {@link //computeStartState} to the special start state used by a
  34218. // precedence DFA for a particular precedence value. The transformation
  34219. // process applies the following changes to the start state's configuration
  34220. // set.
  34221. //
  34222. // <ol>
  34223. // <li>Evaluate the precedence predicates for each configuration using
  34224. // {@link SemanticContext//evalPrecedence}.</li>
  34225. // <li>Remove all configurations which predict an alternative greater than
  34226. // 1, for which another configuration that predicts alternative 1 is in the
  34227. // same ATN state with the same prediction context. This transformation is
  34228. // valid for the following reasons:
  34229. // <ul>
  34230. // <li>The closure block cannot contain any epsilon transitions which bypass
  34231. // the body of the closure, so all states reachable via alternative 1 are
  34232. // part of the precedence alternatives of the transformed left-recursive
  34233. // rule.</li>
  34234. // <li>The "primary" portion of a left recursive rule cannot contain an
  34235. // epsilon transition, so the only way an alternative other than 1 can exist
  34236. // in a state that is also reachable via alternative 1 is by nesting calls
  34237. // to the left-recursive rule, with the outer calls not being at the
  34238. // preferred precedence level.</li>
  34239. // </ul>
  34240. // </li>
  34241. // </ol>
  34242. //
  34243. // <p>
  34244. // The prediction context must be considered by this filter to address
  34245. // situations like the following.
  34246. // </p>
  34247. // <code>
  34248. // <pre>
  34249. // grammar TA;
  34250. // prog: statement* EOF;
  34251. // statement: letterA | statement letterA 'b' ;
  34252. // letterA: 'a';
  34253. // </pre>
  34254. // </code>
  34255. // <p>
  34256. // If the above grammar, the ATN state immediately before the token
  34257. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  34258. // of both the primary and closure blocks of the left-recursive rule
  34259. // {@code statement}. The prediction context associated with each of these
  34260. // configurations distinguishes between them, and prevents the alternative
  34261. // which stepped out to {@code prog} (and then back in to {@code statement}
  34262. // from being eliminated by the filter.
  34263. // </p>
  34264. //
  34265. // @param configs The configuration set computed by
  34266. // {@link //computeStartState} as the start state for the DFA.
  34267. // @return The transformed configuration set representing the start state
  34268. // for a precedence DFA at a particular precedence level (determined by
  34269. // calling {@link Parser//getPrecedence}).
  34270. //
  34271. ParserATNSimulator.prototype.applyPrecedenceFilter = function(configs) {
  34272. var config;
  34273. var statesFromAlt1 = [];
  34274. var configSet = new ATNConfigSet(configs.fullCtx);
  34275. for(var i=0; i<configs.items.length; i++) {
  34276. config = configs.items[i];
  34277. // handle alt 1 first
  34278. if (config.alt !== 1) {
  34279. continue;
  34280. }
  34281. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  34282. if (updatedContext===null) {
  34283. // the configuration was eliminated
  34284. continue;
  34285. }
  34286. statesFromAlt1[config.state.stateNumber] = config.context;
  34287. if (updatedContext !== config.semanticContext) {
  34288. configSet.add(new ATNConfig({semanticContext:updatedContext}, config), this.mergeCache);
  34289. } else {
  34290. configSet.add(config, this.mergeCache);
  34291. }
  34292. }
  34293. for(i=0; i<configs.items.length; i++) {
  34294. config = configs.items[i];
  34295. if (config.alt === 1) {
  34296. // already handled
  34297. continue;
  34298. }
  34299. // In the future, this elimination step could be updated to also
  34300. // filter the prediction context for alternatives predicting alt>1
  34301. // (basically a graph subtraction algorithm).
  34302. if (!config.precedenceFilterSuppressed) {
  34303. var context = statesFromAlt1[config.state.stateNumber] || null;
  34304. if (context!==null && context.equals(config.context)) {
  34305. // eliminated
  34306. continue;
  34307. }
  34308. }
  34309. configSet.add(config, this.mergeCache);
  34310. }
  34311. return configSet;
  34312. };
  34313. ParserATNSimulator.prototype.getReachableTarget = function(trans, ttype) {
  34314. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  34315. return trans.target;
  34316. } else {
  34317. return null;
  34318. }
  34319. };
  34320. ParserATNSimulator.prototype.getPredsForAmbigAlts = function(ambigAlts, configs, nalts) {
  34321. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  34322. // altToPred starts as an array of all null contexts. The entry at index i
  34323. // corresponds to alternative i. altToPred[i] may have one of three values:
  34324. // 1. null: no ATNConfig c is found such that c.alt==i
  34325. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  34326. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  34327. // alt i has at least one unpredicated config.
  34328. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  34329. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  34330. //
  34331. // From this, it is clear that NONE||anything==NONE.
  34332. //
  34333. var altToPred = [];
  34334. for(var i=0;i<configs.items.length;i++) {
  34335. var c = configs.items[i];
  34336. if(ambigAlts.contains( c.alt )) {
  34337. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  34338. }
  34339. }
  34340. var nPredAlts = 0;
  34341. for (i =1;i< nalts+1;i++) {
  34342. var pred = altToPred[i] || null;
  34343. if (pred===null) {
  34344. altToPred[i] = SemanticContext.NONE;
  34345. } else if (pred !== SemanticContext.NONE) {
  34346. nPredAlts += 1;
  34347. }
  34348. }
  34349. // nonambig alts are null in altToPred
  34350. if (nPredAlts===0) {
  34351. altToPred = null;
  34352. }
  34353. if (this.debug) {
  34354. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  34355. }
  34356. return altToPred;
  34357. };
  34358. ParserATNSimulator.prototype.getPredicatePredictions = function(ambigAlts, altToPred) {
  34359. var pairs = [];
  34360. var containsPredicate = false;
  34361. for (var i=1; i<altToPred.length;i++) {
  34362. var pred = altToPred[i];
  34363. // unpredicated is indicated by SemanticContext.NONE
  34364. if( ambigAlts!==null && ambigAlts.contains( i )) {
  34365. pairs.push(new PredPrediction(pred, i));
  34366. }
  34367. if (pred !== SemanticContext.NONE) {
  34368. containsPredicate = true;
  34369. }
  34370. }
  34371. if (! containsPredicate) {
  34372. return null;
  34373. }
  34374. return pairs;
  34375. };
  34376. //
  34377. // This method is used to improve the localization of error messages by
  34378. // choosing an alternative rather than throwing a
  34379. // {@link NoViableAltException} in particular prediction scenarios where the
  34380. // {@link //ERROR} state was reached during ATN simulation.
  34381. //
  34382. // <p>
  34383. // The default implementation of this method uses the following
  34384. // algorithm to identify an ATN configuration which successfully parsed the
  34385. // decision entry rule. Choosing such an alternative ensures that the
  34386. // {@link ParserRuleContext} returned by the calling rule will be complete
  34387. // and valid, and the syntax error will be reported later at a more
  34388. // localized location.</p>
  34389. //
  34390. // <ul>
  34391. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  34392. // they are semantically valid if predicated, return the min associated alt.</li>
  34393. // <li>Else, if a semantically invalid but syntactically valid path exist
  34394. // or paths exist, return the minimum associated alt.
  34395. // </li>
  34396. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  34397. // </ul>
  34398. //
  34399. // <p>
  34400. // In some scenarios, the algorithm described above could predict an
  34401. // alternative which will result in a {@link FailedPredicateException} in
  34402. // the parser. Specifically, this could occur if the <em>only</em> configuration
  34403. // capable of successfully parsing to the end of the decision rule is
  34404. // blocked by a semantic predicate. By choosing this alternative within
  34405. // {@link //adaptivePredict} instead of throwing a
  34406. // {@link NoViableAltException}, the resulting
  34407. // {@link FailedPredicateException} in the parser will identify the specific
  34408. // predicate which is preventing the parser from successfully parsing the
  34409. // decision rule, which helps developers identify and correct logic errors
  34410. // in semantic predicates.
  34411. // </p>
  34412. //
  34413. // @param configs The ATN configurations which were valid immediately before
  34414. // the {@link //ERROR} state was reached
  34415. // @param outerContext The is the \gamma_0 initial parser context from the paper
  34416. // or the parser stack at the instant before prediction commences.
  34417. //
  34418. // @return The value to return from {@link //adaptivePredict}, or
  34419. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  34420. // identified and {@link //adaptivePredict} should report an error instead.
  34421. //
  34422. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function(configs, outerContext) {
  34423. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  34424. var semValidConfigs = cfgs[0];
  34425. var semInvalidConfigs = cfgs[1];
  34426. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  34427. if (alt!==ATN.INVALID_ALT_NUMBER) { // semantically/syntactically viable path exists
  34428. return alt;
  34429. }
  34430. // Is there a syntactically valid path with a failed pred?
  34431. if (semInvalidConfigs.items.length>0) {
  34432. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  34433. if (alt!==ATN.INVALID_ALT_NUMBER) { // syntactically viable path exists
  34434. return alt;
  34435. }
  34436. }
  34437. return ATN.INVALID_ALT_NUMBER;
  34438. };
  34439. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function(configs) {
  34440. var alts = [];
  34441. for(var i=0;i<configs.items.length; i++) {
  34442. var c = configs.items[i];
  34443. if (c.reachesIntoOuterContext>0 || ((c.state instanceof RuleStopState) && c.context.hasEmptyPath())) {
  34444. if(alts.indexOf(c.alt)<0) {
  34445. alts.push(c.alt);
  34446. }
  34447. }
  34448. }
  34449. if (alts.length===0) {
  34450. return ATN.INVALID_ALT_NUMBER;
  34451. } else {
  34452. return Math.min.apply(null, alts);
  34453. }
  34454. };
  34455. // Walk the list of configurations and split them according to
  34456. // those that have preds evaluating to true/false. If no pred, assume
  34457. // true pred and include in succeeded set. Returns Pair of sets.
  34458. //
  34459. // Create a new set so as not to alter the incoming parameter.
  34460. //
  34461. // Assumption: the input stream has been restored to the starting point
  34462. // prediction, which is where predicates need to evaluate.
  34463. //
  34464. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function( configs, outerContext) {
  34465. var succeeded = new ATNConfigSet(configs.fullCtx);
  34466. var failed = new ATNConfigSet(configs.fullCtx);
  34467. for(var i=0;i<configs.items.length; i++) {
  34468. var c = configs.items[i];
  34469. if (c.semanticContext !== SemanticContext.NONE) {
  34470. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  34471. if (predicateEvaluationResult) {
  34472. succeeded.add(c);
  34473. } else {
  34474. failed.add(c);
  34475. }
  34476. } else {
  34477. succeeded.add(c);
  34478. }
  34479. }
  34480. return [succeeded, failed];
  34481. };
  34482. // Look through a list of predicate/alt pairs, returning alts for the
  34483. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  34484. // unpredicated config which behaves as "always true." If !complete
  34485. // then we stop at the first predicate that evaluates to true. This
  34486. // includes pairs with null predicates.
  34487. //
  34488. ParserATNSimulator.prototype.evalSemanticContext = function(predPredictions, outerContext, complete) {
  34489. var predictions = new BitSet();
  34490. for(var i=0;i<predPredictions.length;i++) {
  34491. var pair = predPredictions[i];
  34492. if (pair.pred === SemanticContext.NONE) {
  34493. predictions.add(pair.alt);
  34494. if (! complete) {
  34495. break;
  34496. }
  34497. continue;
  34498. }
  34499. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  34500. if (this.debug || this.dfa_debug) {
  34501. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  34502. }
  34503. if (predicateEvaluationResult) {
  34504. if (this.debug || this.dfa_debug) {
  34505. console.log("PREDICT " + pair.alt);
  34506. }
  34507. predictions.add(pair.alt);
  34508. if (! complete) {
  34509. break;
  34510. }
  34511. }
  34512. }
  34513. return predictions;
  34514. };
  34515. // TODO: If we are doing predicates, there is no point in pursuing
  34516. // closure operations if we reach a DFA state that uniquely predicts
  34517. // alternative. We will not be caching that DFA state and it is a
  34518. // waste to pursue the closure. Might have to advance when we do
  34519. // ambig detection thought :(
  34520. //
  34521. ParserATNSimulator.prototype.closure = function(config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  34522. var initialDepth = 0;
  34523. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates,
  34524. fullCtx, initialDepth, treatEofAsEpsilon);
  34525. };
  34526. ParserATNSimulator.prototype.closureCheckingStopState = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  34527. if (this.debug || this.debug_closure) {
  34528. console.log("closure(" + config.toString(this.parser,true) + ")");
  34529. // console.log("configs(" + configs.toString() + ")");
  34530. if(config.reachesIntoOuterContext>50) {
  34531. throw "problem";
  34532. }
  34533. }
  34534. if (config.state instanceof RuleStopState) {
  34535. // We hit rule end. If we have context info, use it
  34536. // run thru all possible stack tops in ctx
  34537. if (! config.context.isEmpty()) {
  34538. for ( var i =0; i<config.context.length; i++) {
  34539. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  34540. if (fullCtx) {
  34541. configs.add(new ATNConfig({state:config.state, context:PredictionContext.EMPTY}, config), this.mergeCache);
  34542. continue;
  34543. } else {
  34544. // we have no context info, just chase follow links (if greedy)
  34545. if (this.debug) {
  34546. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  34547. }
  34548. this.closure_(config, configs, closureBusy, collectPredicates,
  34549. fullCtx, depth, treatEofAsEpsilon);
  34550. }
  34551. continue;
  34552. }
  34553. var returnState = this.atn.states[config.context.getReturnState(i)];
  34554. var newContext = config.context.getParent(i); // "pop" return state
  34555. var parms = {state:returnState, alt:config.alt, context:newContext, semanticContext:config.semanticContext};
  34556. var c = new ATNConfig(parms, null);
  34557. // While we have context to pop back from, we may have
  34558. // gotten that context AFTER having falling off a rule.
  34559. // Make sure we track that we are now out of context.
  34560. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  34561. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  34562. }
  34563. return;
  34564. } else if( fullCtx) {
  34565. // reached end of start rule
  34566. configs.add(config, this.mergeCache);
  34567. return;
  34568. } else {
  34569. // else if we have no context info, just chase follow links (if greedy)
  34570. if (this.debug) {
  34571. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  34572. }
  34573. }
  34574. }
  34575. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  34576. };
  34577. // Do the actual work of walking epsilon edges//
  34578. ParserATNSimulator.prototype.closure_ = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  34579. var p = config.state;
  34580. // optimization
  34581. if (! p.epsilonOnlyTransitions) {
  34582. configs.add(config, this.mergeCache);
  34583. // make sure to not return here, because EOF transitions can act as
  34584. // both epsilon transitions and non-epsilon transitions.
  34585. }
  34586. for(var i = 0;i<p.transitions.length; i++) {
  34587. if(i==0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config))
  34588. continue;
  34589. var t = p.transitions[i];
  34590. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  34591. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  34592. if (c!==null) {
  34593. if (!t.isEpsilon && closureBusy.add(c)!==c){
  34594. // avoid infinite recursion for EOF* and EOF+
  34595. continue;
  34596. }
  34597. var newDepth = depth;
  34598. if ( config.state instanceof RuleStopState) {
  34599. // target fell off end of rule; mark resulting c as having dipped into outer context
  34600. // We can't get here if incoming config was rule stop and we had context
  34601. // track how far we dip into outer context. Might
  34602. // come in handy and we avoid evaluating context dependent
  34603. // preds if this is > 0.
  34604. if (closureBusy.add(c)!==c) {
  34605. // avoid infinite recursion for right-recursive rules
  34606. continue;
  34607. }
  34608. if (this._dfa !== null && this._dfa.precedenceDfa) {
  34609. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  34610. c.precedenceFilterSuppressed = true;
  34611. }
  34612. }
  34613. c.reachesIntoOuterContext += 1;
  34614. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  34615. newDepth -= 1;
  34616. if (this.debug) {
  34617. console.log("dips into outer ctx: " + c);
  34618. }
  34619. } else if (t instanceof RuleTransition) {
  34620. // latch when newDepth goes negative - once we step out of the entry context we can't return
  34621. if (newDepth >= 0) {
  34622. newDepth += 1;
  34623. }
  34624. }
  34625. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  34626. }
  34627. }
  34628. };
  34629. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function(config) {
  34630. // return False
  34631. var p = config.state;
  34632. // First check to see if we are in StarLoopEntryState generated during
  34633. // left-recursion elimination. For efficiency, also check if
  34634. // the context has an empty stack case. If so, it would mean
  34635. // global FOLLOW so we can't perform optimization
  34636. // Are we the special loop entry/exit state? or SLL wildcard
  34637. if(p.stateType != ATNState.STAR_LOOP_ENTRY)
  34638. return false;
  34639. if(p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision ||
  34640. config.context.isEmpty() || config.context.hasEmptyPath())
  34641. return false;
  34642. // Require all return states to return back to the same rule that p is in.
  34643. var numCtxs = config.context.length;
  34644. for(var i=0; i<numCtxs; i++) { // for each stack context
  34645. var returnState = this.atn.states[config.context.getReturnState(i)];
  34646. if (returnState.ruleIndex != p.ruleIndex)
  34647. return false;
  34648. }
  34649. var decisionStartState = p.transitions[0].target;
  34650. var blockEndStateNum = decisionStartState.endState.stateNumber;
  34651. var blockEndState = this.atn.states[blockEndStateNum];
  34652. // Verify that the top of each stack context leads to loop entry/exit
  34653. // state through epsilon edges and w/o leaving rule.
  34654. for(var i=0; i<numCtxs; i++) { // for each stack context
  34655. var returnStateNumber = config.context.getReturnState(i);
  34656. var returnState = this.atn.states[returnStateNumber];
  34657. // all states must have single outgoing epsilon edge
  34658. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon)
  34659. return false;
  34660. // Look for prefix op case like 'not expr', (' type ')' expr
  34661. var returnStateTarget = returnState.transitions[0].target;
  34662. if ( returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p )
  34663. continue;
  34664. // Look for 'expr op expr' or case where expr's return state is block end
  34665. // of (...)* internal block; the block end points to loop back
  34666. // which points to p but we don't need to check that
  34667. if ( returnState == blockEndState )
  34668. continue;
  34669. // Look for ternary expr ? expr : expr. The return state points at block end,
  34670. // which points at loop entry state
  34671. if ( returnStateTarget == blockEndState )
  34672. continue;
  34673. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  34674. // return state points at block end state of (...)* internal block
  34675. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1
  34676. && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p)
  34677. continue;
  34678. // anything else ain't conforming
  34679. return false;
  34680. }
  34681. return true;
  34682. };
  34683. ParserATNSimulator.prototype.getRuleName = function( index) {
  34684. if (this.parser!==null && index>=0) {
  34685. return this.parser.ruleNames[index];
  34686. } else {
  34687. return "<rule " + index + ">";
  34688. }
  34689. };
  34690. ParserATNSimulator.prototype.getEpsilonTarget = function(config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  34691. switch(t.serializationType) {
  34692. case Transition.RULE:
  34693. return this.ruleTransition(config, t);
  34694. case Transition.PRECEDENCE:
  34695. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  34696. case Transition.PREDICATE:
  34697. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  34698. case Transition.ACTION:
  34699. return this.actionTransition(config, t);
  34700. case Transition.EPSILON:
  34701. return new ATNConfig({state:t.target}, config);
  34702. case Transition.ATOM:
  34703. case Transition.RANGE:
  34704. case Transition.SET:
  34705. // EOF transitions act like epsilon transitions after the first EOF
  34706. // transition is traversed
  34707. if (treatEofAsEpsilon) {
  34708. if (t.matches(Token.EOF, 0, 1)) {
  34709. return new ATNConfig({state: t.target}, config);
  34710. }
  34711. }
  34712. return null;
  34713. default:
  34714. return null;
  34715. }
  34716. };
  34717. ParserATNSimulator.prototype.actionTransition = function(config, t) {
  34718. if (this.debug) {
  34719. var index = t.actionIndex==-1 ? 65535 : t.actionIndex;
  34720. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  34721. }
  34722. return new ATNConfig({state:t.target}, config);
  34723. };
  34724. ParserATNSimulator.prototype.precedenceTransition = function(config, pt, collectPredicates, inContext, fullCtx) {
  34725. if (this.debug) {
  34726. console.log("PRED (collectPredicates=" + collectPredicates + ") " +
  34727. pt.precedence + ">=_p, ctx dependent=true");
  34728. if (this.parser!==null) {
  34729. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  34730. }
  34731. }
  34732. var c = null;
  34733. if (collectPredicates && inContext) {
  34734. if (fullCtx) {
  34735. // In full context mode, we can evaluate predicates on-the-fly
  34736. // during closure, which dramatically reduces the size of
  34737. // the config sets. It also obviates the need to test predicates
  34738. // later during conflict resolution.
  34739. var currentPosition = this._input.index;
  34740. this._input.seek(this._startIndex);
  34741. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  34742. this._input.seek(currentPosition);
  34743. if (predSucceeds) {
  34744. c = new ATNConfig({state:pt.target}, config); // no pred context
  34745. }
  34746. } else {
  34747. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  34748. c = new ATNConfig({state:pt.target, semanticContext:newSemCtx}, config);
  34749. }
  34750. } else {
  34751. c = new ATNConfig({state:pt.target}, config);
  34752. }
  34753. if (this.debug) {
  34754. console.log("config from pred transition=" + c);
  34755. }
  34756. return c;
  34757. };
  34758. ParserATNSimulator.prototype.predTransition = function(config, pt, collectPredicates, inContext, fullCtx) {
  34759. if (this.debug) {
  34760. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex +
  34761. ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  34762. if (this.parser!==null) {
  34763. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  34764. }
  34765. }
  34766. var c = null;
  34767. if (collectPredicates && ((pt.isCtxDependent && inContext) || ! pt.isCtxDependent)) {
  34768. if (fullCtx) {
  34769. // In full context mode, we can evaluate predicates on-the-fly
  34770. // during closure, which dramatically reduces the size of
  34771. // the config sets. It also obviates the need to test predicates
  34772. // later during conflict resolution.
  34773. var currentPosition = this._input.index;
  34774. this._input.seek(this._startIndex);
  34775. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  34776. this._input.seek(currentPosition);
  34777. if (predSucceeds) {
  34778. c = new ATNConfig({state:pt.target}, config); // no pred context
  34779. }
  34780. } else {
  34781. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  34782. c = new ATNConfig({state:pt.target, semanticContext:newSemCtx}, config);
  34783. }
  34784. } else {
  34785. c = new ATNConfig({state:pt.target}, config);
  34786. }
  34787. if (this.debug) {
  34788. console.log("config from pred transition=" + c);
  34789. }
  34790. return c;
  34791. };
  34792. ParserATNSimulator.prototype.ruleTransition = function(config, t) {
  34793. if (this.debug) {
  34794. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  34795. }
  34796. var returnState = t.followState;
  34797. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  34798. return new ATNConfig({state:t.target, context:newContext}, config );
  34799. };
  34800. ParserATNSimulator.prototype.getConflictingAlts = function(configs) {
  34801. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  34802. return PredictionMode.getAlts(altsets);
  34803. };
  34804. // Sam pointed out a problem with the previous definition, v3, of
  34805. // ambiguous states. If we have another state associated with conflicting
  34806. // alternatives, we should keep going. For example, the following grammar
  34807. //
  34808. // s : (ID | ID ID?) ';' ;
  34809. //
  34810. // When the ATN simulation reaches the state before ';', it has a DFA
  34811. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  34812. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  34813. // because alternative to has another way to continue, via [6|2|[]].
  34814. // The key is that we have a single state that has config's only associated
  34815. // with a single alternative, 2, and crucially the state transitions
  34816. // among the configurations are all non-epsilon transitions. That means
  34817. // we don't consider any conflicts that include alternative 2. So, we
  34818. // ignore the conflict between alts 1 and 2. We ignore a set of
  34819. // conflicting alts when there is an intersection with an alternative
  34820. // associated with a single alt state in the state&rarr;config-list map.
  34821. //
  34822. // It's also the case that we might have two conflicting configurations but
  34823. // also a 3rd nonconflicting configuration for a different alternative:
  34824. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  34825. //
  34826. // a : A | A | A B ;
  34827. //
  34828. // After matching input A, we reach the stop state for rule A, state 1.
  34829. // State 8 is the state right before B. Clearly alternatives 1 and 2
  34830. // conflict and no amount of further lookahead will separate the two.
  34831. // However, alternative 3 will be able to continue and so we do not
  34832. // stop working on this state. In the previous example, we're concerned
  34833. // with states associated with the conflicting alternatives. Here alt
  34834. // 3 is not associated with the conflicting configs, but since we can continue
  34835. // looking for input reasonably, I don't declare the state done. We
  34836. // ignore a set of conflicting alts when we have an alternative
  34837. // that we still need to pursue.
  34838. //
  34839. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function(configs) {
  34840. var conflictingAlts = null;
  34841. if (configs.uniqueAlt!== ATN.INVALID_ALT_NUMBER) {
  34842. conflictingAlts = new BitSet();
  34843. conflictingAlts.add(configs.uniqueAlt);
  34844. } else {
  34845. conflictingAlts = configs.conflictingAlts;
  34846. }
  34847. return conflictingAlts;
  34848. };
  34849. ParserATNSimulator.prototype.getTokenName = function( t) {
  34850. if (t===Token.EOF) {
  34851. return "EOF";
  34852. }
  34853. if( this.parser!==null && this.parser.literalNames!==null) {
  34854. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  34855. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  34856. console.log("" + this.parser.getInputStream().getTokens());
  34857. } else {
  34858. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  34859. return name + "<" + t + ">";
  34860. }
  34861. }
  34862. return "" + t;
  34863. };
  34864. ParserATNSimulator.prototype.getLookaheadName = function(input) {
  34865. return this.getTokenName(input.LA(1));
  34866. };
  34867. // Used for debugging in adaptivePredict around execATN but I cut
  34868. // it out for clarity now that alg. works well. We can leave this
  34869. // "dead" code for a bit.
  34870. //
  34871. ParserATNSimulator.prototype.dumpDeadEndConfigs = function(nvae) {
  34872. console.log("dead end configs: ");
  34873. var decs = nvae.getDeadEndConfigs();
  34874. for(var i=0; i<decs.length; i++) {
  34875. var c = decs[i];
  34876. var trans = "no edges";
  34877. if (c.state.transitions.length>0) {
  34878. var t = c.state.transitions[0];
  34879. if (t instanceof AtomTransition) {
  34880. trans = "Atom "+ this.getTokenName(t.label);
  34881. } else if (t instanceof SetTransition) {
  34882. var neg = (t instanceof NotSetTransition);
  34883. trans = (neg ? "~" : "") + "Set " + t.set;
  34884. }
  34885. }
  34886. console.error(c.toString(this.parser, true) + ":" + trans);
  34887. }
  34888. };
  34889. ParserATNSimulator.prototype.noViableAlt = function(input, outerContext, configs, startIndex) {
  34890. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  34891. };
  34892. ParserATNSimulator.prototype.getUniqueAlt = function(configs) {
  34893. var alt = ATN.INVALID_ALT_NUMBER;
  34894. for(var i=0;i<configs.items.length;i++) {
  34895. var c = configs.items[i];
  34896. if (alt === ATN.INVALID_ALT_NUMBER) {
  34897. alt = c.alt // found first alt
  34898. } else if( c.alt!==alt) {
  34899. return ATN.INVALID_ALT_NUMBER;
  34900. }
  34901. }
  34902. return alt;
  34903. };
  34904. //
  34905. // Add an edge to the DFA, if possible. This method calls
  34906. // {@link //addDFAState} to ensure the {@code to} state is present in the
  34907. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  34908. // range of edges that can be represented in the DFA tables, this method
  34909. // returns without adding the edge to the DFA.
  34910. //
  34911. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  34912. // Otherwise, this method returns the {@link DFAState} returned by calling
  34913. // {@link //addDFAState} for the {@code to} state.</p>
  34914. //
  34915. // @param dfa The DFA
  34916. // @param from The source state for the edge
  34917. // @param t The input symbol
  34918. // @param to The target state for the edge
  34919. //
  34920. // @return If {@code to} is {@code null}, this method returns {@code null};
  34921. // otherwise this method returns the result of calling {@link //addDFAState}
  34922. // on {@code to}
  34923. //
  34924. ParserATNSimulator.prototype.addDFAEdge = function(dfa, from_, t, to) {
  34925. if( this.debug) {
  34926. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  34927. }
  34928. if (to===null) {
  34929. return null;
  34930. }
  34931. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  34932. if (from_===null || t < -1 || t > this.atn.maxTokenType) {
  34933. return to;
  34934. }
  34935. if (from_.edges===null) {
  34936. from_.edges = [];
  34937. }
  34938. from_.edges[t+1] = to; // connect
  34939. if (this.debug) {
  34940. var literalNames = this.parser===null ? null : this.parser.literalNames;
  34941. var symbolicNames = this.parser===null ? null : this.parser.symbolicNames;
  34942. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  34943. }
  34944. return to;
  34945. };
  34946. //
  34947. // Add state {@code D} to the DFA if it is not already present, and return
  34948. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  34949. // is already in the DFA, the existing state is returned. Otherwise this
  34950. // method returns {@code D} after adding it to the DFA.
  34951. //
  34952. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  34953. // does not change the DFA.</p>
  34954. //
  34955. // @param dfa The dfa
  34956. // @param D The DFA state to add
  34957. // @return The state stored in the DFA. This will be either the existing
  34958. // state if {@code D} is already in the DFA, or {@code D} itself if the
  34959. // state was not already present.
  34960. //
  34961. ParserATNSimulator.prototype.addDFAState = function(dfa, D) {
  34962. if (D == ATNSimulator.ERROR) {
  34963. return D;
  34964. }
  34965. var existing = dfa.states.get(D);
  34966. if(existing!==null) {
  34967. return existing;
  34968. }
  34969. D.stateNumber = dfa.states.length;
  34970. if (! D.configs.readOnly) {
  34971. D.configs.optimizeConfigs(this);
  34972. D.configs.setReadonly(true);
  34973. }
  34974. dfa.states.add(D);
  34975. if (this.debug) {
  34976. console.log("adding new DFA state: " + D);
  34977. }
  34978. return D;
  34979. };
  34980. ParserATNSimulator.prototype.reportAttemptingFullContext = function(dfa, conflictingAlts, configs, startIndex, stopIndex) {
  34981. if (this.debug || this.retry_debug) {
  34982. var interval = new Interval(startIndex, stopIndex + 1);
  34983. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs +
  34984. ", input=" + this.parser.getTokenStream().getText(interval));
  34985. }
  34986. if (this.parser!==null) {
  34987. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  34988. }
  34989. };
  34990. ParserATNSimulator.prototype.reportContextSensitivity = function(dfa, prediction, configs, startIndex, stopIndex) {
  34991. if (this.debug || this.retry_debug) {
  34992. var interval = new Interval(startIndex, stopIndex + 1);
  34993. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs +
  34994. ", input=" + this.parser.getTokenStream().getText(interval));
  34995. }
  34996. if (this.parser!==null) {
  34997. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  34998. }
  34999. };
  35000. // If context sensitive parsing, we know it's ambiguity not conflict//
  35001. ParserATNSimulator.prototype.reportAmbiguity = function(dfa, D, startIndex, stopIndex,
  35002. exact, ambigAlts, configs ) {
  35003. if (this.debug || this.retry_debug) {
  35004. var interval = new Interval(startIndex, stopIndex + 1);
  35005. console.log("reportAmbiguity " + ambigAlts + ":" + configs +
  35006. ", input=" + this.parser.getTokenStream().getText(interval));
  35007. }
  35008. if (this.parser!==null) {
  35009. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  35010. }
  35011. };
  35012. exports.ParserATNSimulator = ParserATNSimulator;
  35013. /***/ }),
  35014. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  35015. /*!***************************************************!*\
  35016. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  35017. \***************************************************/
  35018. /*! no static exports found */
  35019. /***/ (function(module, exports, __webpack_require__) {
  35020. //
  35021. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35022. * Use of this file is governed by the BSD 3-clause license that
  35023. * can be found in the LICENSE.txt file in the project root.
  35024. */
  35025. //
  35026. //
  35027. // This enumeration defines the prediction modes available in ANTLR 4 along with
  35028. // utility methods for analyzing configuration sets for conflicts and/or
  35029. // ambiguities.
  35030. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  35031. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  35032. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  35033. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  35034. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  35035. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  35036. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  35037. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  35038. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  35039. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  35040. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  35041. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  35042. function PredictionMode() {
  35043. return this;
  35044. }
  35045. //
  35046. // The SLL(*) prediction mode. This prediction mode ignores the current
  35047. // parser context when making predictions. This is the fastest prediction
  35048. // mode, and provides correct results for many grammars. This prediction
  35049. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  35050. // may result in syntax errors for grammar and input combinations which are
  35051. // not SLL.
  35052. //
  35053. // <p>
  35054. // When using this prediction mode, the parser will either return a correct
  35055. // parse tree (i.e. the same parse tree that would be returned with the
  35056. // {@link //LL} prediction mode), or it will report a syntax error. If a
  35057. // syntax error is encountered when using the {@link //SLL} prediction mode,
  35058. // it may be due to either an actual syntax error in the input or indicate
  35059. // that the particular combination of grammar and input requires the more
  35060. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  35061. //
  35062. // <p>
  35063. // This prediction mode does not provide any guarantees for prediction
  35064. // behavior for syntactically-incorrect inputs.</p>
  35065. //
  35066. PredictionMode.SLL = 0;
  35067. //
  35068. // The LL(*) prediction mode. This prediction mode allows the current parser
  35069. // context to be used for resolving SLL conflicts that occur during
  35070. // prediction. This is the fastest prediction mode that guarantees correct
  35071. // parse results for all combinations of grammars with syntactically correct
  35072. // inputs.
  35073. //
  35074. // <p>
  35075. // When using this prediction mode, the parser will make correct decisions
  35076. // for all syntactically-correct grammar and input combinations. However, in
  35077. // cases where the grammar is truly ambiguous this prediction mode might not
  35078. // report a precise answer for <em>exactly which</em> alternatives are
  35079. // ambiguous.</p>
  35080. //
  35081. // <p>
  35082. // This prediction mode does not provide any guarantees for prediction
  35083. // behavior for syntactically-incorrect inputs.</p>
  35084. //
  35085. PredictionMode.LL = 1;
  35086. //
  35087. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  35088. // the correctness guarantees provided by the {@link //LL} prediction mode,
  35089. // this prediction mode instructs the prediction algorithm to determine the
  35090. // complete and exact set of ambiguous alternatives for every ambiguous
  35091. // decision encountered while parsing.
  35092. //
  35093. // <p>
  35094. // This prediction mode may be used for diagnosing ambiguities during
  35095. // grammar development. Due to the performance overhead of calculating sets
  35096. // of ambiguous alternatives, this prediction mode should be avoided when
  35097. // the exact results are not necessary.</p>
  35098. //
  35099. // <p>
  35100. // This prediction mode does not provide any guarantees for prediction
  35101. // behavior for syntactically-incorrect inputs.</p>
  35102. //
  35103. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  35104. //
  35105. // Computes the SLL prediction termination condition.
  35106. //
  35107. // <p>
  35108. // This method computes the SLL prediction termination condition for both of
  35109. // the following cases.</p>
  35110. //
  35111. // <ul>
  35112. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  35113. // <li>Pure SLL without LL fallback</li>
  35114. // </ul>
  35115. //
  35116. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  35117. //
  35118. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  35119. // ensured regardless of how the termination condition is computed by this
  35120. // method. Due to the substantially higher cost of LL prediction, the
  35121. // prediction should only fall back to LL when the additional lookahead
  35122. // cannot lead to a unique SLL prediction.</p>
  35123. //
  35124. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  35125. // conflicting subsets should fall back to full LL, even if the
  35126. // configuration sets don't resolve to the same alternative (e.g.
  35127. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  35128. // configuration, SLL could continue with the hopes that more lookahead will
  35129. // resolve via one of those non-conflicting configurations.</p>
  35130. //
  35131. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  35132. // stops when it sees only conflicting configuration subsets. In contrast,
  35133. // full LL keeps going when there is uncertainty.</p>
  35134. //
  35135. // <p><strong>HEURISTIC</strong></p>
  35136. //
  35137. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  35138. // unless we see a state that only has one alternative associated with it.
  35139. // The single-alt-state thing lets prediction continue upon rules like
  35140. // (otherwise, it would admit defeat too soon):</p>
  35141. //
  35142. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  35143. //
  35144. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  35145. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  35146. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  35147. // processing this node because alternative to has another way to continue,
  35148. // via {@code [6|2|[]]}.</p>
  35149. //
  35150. // <p>It also let's us continue for this rule:</p>
  35151. //
  35152. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  35153. //
  35154. // <p>After matching input A, we reach the stop state for rule A, state 1.
  35155. // State 8 is the state right before B. Clearly alternatives 1 and 2
  35156. // conflict and no amount of further lookahead will separate the two.
  35157. // However, alternative 3 will be able to continue and so we do not stop
  35158. // working on this state. In the previous example, we're concerned with
  35159. // states associated with the conflicting alternatives. Here alt 3 is not
  35160. // associated with the conflicting configs, but since we can continue
  35161. // looking for input reasonably, don't declare the state done.</p>
  35162. //
  35163. // <p><strong>PURE SLL PARSING</strong></p>
  35164. //
  35165. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  35166. // combine stack contexts for configurations that differ only by semantic
  35167. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  35168. //
  35169. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  35170. //
  35171. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  35172. // states because they need to create the DFA cache that works in all
  35173. // semantic situations. In contrast, full LL evaluates predicates collected
  35174. // during start state computation so it can ignore predicates thereafter.
  35175. // This means that SLL termination detection can totally ignore semantic
  35176. // predicates.</p>
  35177. //
  35178. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  35179. // semantic predicate contexts so we might see two configurations like the
  35180. // following.</p>
  35181. //
  35182. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  35183. //
  35184. // <p>Before testing these configurations against others, we have to merge
  35185. // {@code x} and {@code x'} (without modifying the existing configurations).
  35186. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  35187. // the following configurations.</p>
  35188. //
  35189. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  35190. //
  35191. // <p>If the configuration set has predicates (as indicated by
  35192. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  35193. // the configurations to strip out all of the predicates so that a standard
  35194. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  35195. //
  35196. PredictionMode.hasSLLConflictTerminatingPrediction = function( mode, configs) {
  35197. // Configs in rule stop states indicate reaching the end of the decision
  35198. // rule (local context) or end of start rule (full context). If all
  35199. // configs meet this condition, then none of the configurations is able
  35200. // to match additional input so we terminate prediction.
  35201. //
  35202. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  35203. return true;
  35204. }
  35205. // pure SLL mode parsing
  35206. if (mode === PredictionMode.SLL) {
  35207. // Don't bother with combining configs from different semantic
  35208. // contexts if we can fail over to full LL; costs more time
  35209. // since we'll often fail over anyway.
  35210. if (configs.hasSemanticContext) {
  35211. // dup configs, tossing out semantic predicates
  35212. var dup = new ATNConfigSet();
  35213. for(var i=0;i<configs.items.length;i++) {
  35214. var c = configs.items[i];
  35215. c = new ATNConfig({semanticContext:SemanticContext.NONE}, c);
  35216. dup.add(c);
  35217. }
  35218. configs = dup;
  35219. }
  35220. // now we have combined contexts for configs with dissimilar preds
  35221. }
  35222. // pure SLL or combined SLL+LL mode parsing
  35223. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  35224. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  35225. };
  35226. // Checks if any configuration in {@code configs} is in a
  35227. // {@link RuleStopState}. Configurations meeting this condition have reached
  35228. // the end of the decision rule (local context) or end of start rule (full
  35229. // context).
  35230. //
  35231. // @param configs the configuration set to test
  35232. // @return {@code true} if any configuration in {@code configs} is in a
  35233. // {@link RuleStopState}, otherwise {@code false}
  35234. PredictionMode.hasConfigInRuleStopState = function(configs) {
  35235. for(var i=0;i<configs.items.length;i++) {
  35236. var c = configs.items[i];
  35237. if (c.state instanceof RuleStopState) {
  35238. return true;
  35239. }
  35240. }
  35241. return false;
  35242. };
  35243. // Checks if all configurations in {@code configs} are in a
  35244. // {@link RuleStopState}. Configurations meeting this condition have reached
  35245. // the end of the decision rule (local context) or end of start rule (full
  35246. // context).
  35247. //
  35248. // @param configs the configuration set to test
  35249. // @return {@code true} if all configurations in {@code configs} are in a
  35250. // {@link RuleStopState}, otherwise {@code false}
  35251. PredictionMode.allConfigsInRuleStopStates = function(configs) {
  35252. for(var i=0;i<configs.items.length;i++) {
  35253. var c = configs.items[i];
  35254. if (!(c.state instanceof RuleStopState)) {
  35255. return false;
  35256. }
  35257. }
  35258. return true;
  35259. };
  35260. //
  35261. // Full LL prediction termination.
  35262. //
  35263. // <p>Can we stop looking ahead during ATN simulation or is there some
  35264. // uncertainty as to which alternative we will ultimately pick, after
  35265. // consuming more input? Even if there are partial conflicts, we might know
  35266. // that everything is going to resolve to the same minimum alternative. That
  35267. // means we can stop since no more lookahead will change that fact. On the
  35268. // other hand, there might be multiple conflicts that resolve to different
  35269. // minimums. That means we need more look ahead to decide which of those
  35270. // alternatives we should predict.</p>
  35271. //
  35272. // <p>The basic idea is to split the set of configurations {@code C}, into
  35273. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  35274. // non-conflicting configurations. Two configurations conflict if they have
  35275. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  35276. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  35277. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  35278. //
  35279. // <p>Reduce these configuration subsets to the set of possible alternatives.
  35280. // You can compute the alternative subsets in one pass as follows:</p>
  35281. //
  35282. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  35283. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  35284. //
  35285. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  35286. //
  35287. // <pre>
  35288. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  35289. // alt and not pred
  35290. // </pre>
  35291. //
  35292. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  35293. //
  35294. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  35295. // {@code s} and {@code ctx}.</p>
  35296. //
  35297. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  35298. // the union of these alternative subsets is a singleton, then no amount of
  35299. // more lookahead will help us. We will always pick that alternative. If,
  35300. // however, there is more than one alternative, then we are uncertain which
  35301. // alternative to predict and must continue looking for resolution. We may
  35302. // or may not discover an ambiguity in the future, even if there are no
  35303. // conflicting subsets this round.</p>
  35304. //
  35305. // <p>The biggest sin is to terminate early because it means we've made a
  35306. // decision but were uncertain as to the eventual outcome. We haven't used
  35307. // enough lookahead. On the other hand, announcing a conflict too late is no
  35308. // big deal; you will still have the conflict. It's just inefficient. It
  35309. // might even look until the end of file.</p>
  35310. //
  35311. // <p>No special consideration for semantic predicates is required because
  35312. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  35313. // no configuration contains a semantic context during the termination
  35314. // check.</p>
  35315. //
  35316. // <p><strong>CONFLICTING CONFIGS</strong></p>
  35317. //
  35318. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  35319. // when {@code i!=j} but {@code x=x'}. Because we merge all
  35320. // {@code (s, i, _)} configurations together, that means that there are at
  35321. // most {@code n} configurations associated with state {@code s} for
  35322. // {@code n} possible alternatives in the decision. The merged stacks
  35323. // complicate the comparison of configuration contexts {@code x} and
  35324. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  35325. // merge and checking to see if the merged result is either {@code x} or
  35326. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  35327. // is the superset, then {@code i} is the only possible prediction since the
  35328. // others resolve to {@code min(i)} as well. However, if {@code x} is
  35329. // associated with {@code j>i} then at least one stack configuration for
  35330. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  35331. // should keep going, looking for more lookahead due to the uncertainty.</p>
  35332. //
  35333. // <p>For simplicity, I'm doing a equality check between {@code x} and
  35334. // {@code x'} that lets the algorithm continue to consume lookahead longer
  35335. // than necessary. The reason I like the equality is of course the
  35336. // simplicity but also because that is the test you need to detect the
  35337. // alternatives that are actually in conflict.</p>
  35338. //
  35339. // <p><strong>CONTINUE/STOP RULE</strong></p>
  35340. //
  35341. // <p>Continue if union of resolved alternative sets from non-conflicting and
  35342. // conflicting alternative subsets has more than one alternative. We are
  35343. // uncertain about which alternative to predict.</p>
  35344. //
  35345. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  35346. // alternatives are still in the running for the amount of input we've
  35347. // consumed at this point. The conflicting sets let us to strip away
  35348. // configurations that won't lead to more states because we resolve
  35349. // conflicts to the configuration with a minimum alternate for the
  35350. // conflicting set.</p>
  35351. //
  35352. // <p><strong>CASES</strong></p>
  35353. //
  35354. // <ul>
  35355. //
  35356. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  35357. //
  35358. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  35359. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  35360. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  35361. // {@code {1,3}} =&gt; continue
  35362. // </li>
  35363. //
  35364. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  35365. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  35366. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  35367. // {@code {1}} =&gt; stop and predict 1</li>
  35368. //
  35369. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  35370. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  35371. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  35372. // ambiguity {@code {1,2}}</li>
  35373. //
  35374. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  35375. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  35376. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  35377. //
  35378. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  35379. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  35380. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  35381. //
  35382. // </ul>
  35383. //
  35384. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  35385. //
  35386. // <p>If all states report the same conflicting set of alternatives, then we
  35387. // know we have the exact ambiguity set.</p>
  35388. //
  35389. // <p><code>|A_<em>i</em>|&gt;1</code> and
  35390. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  35391. //
  35392. // <p>In other words, we continue examining lookahead until all {@code A_i}
  35393. // have more than one alternative and all {@code A_i} are the same. If
  35394. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  35395. // because the resolved set is {@code {1}}. To determine what the real
  35396. // ambiguity is, we have to know whether the ambiguity is between one and
  35397. // two or one and three so we keep going. We can only stop prediction when
  35398. // we need exact ambiguity detection when the sets look like
  35399. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  35400. //
  35401. PredictionMode.resolvesToJustOneViableAlt = function(altsets) {
  35402. return PredictionMode.getSingleViableAlt(altsets);
  35403. };
  35404. //
  35405. // Determines if every alternative subset in {@code altsets} contains more
  35406. // than one alternative.
  35407. //
  35408. // @param altsets a collection of alternative subsets
  35409. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  35410. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  35411. //
  35412. PredictionMode.allSubsetsConflict = function(altsets) {
  35413. return ! PredictionMode.hasNonConflictingAltSet(altsets);
  35414. };
  35415. //
  35416. // Determines if any single alternative subset in {@code altsets} contains
  35417. // exactly one alternative.
  35418. //
  35419. // @param altsets a collection of alternative subsets
  35420. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  35421. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  35422. //
  35423. PredictionMode.hasNonConflictingAltSet = function(altsets) {
  35424. for(var i=0;i<altsets.length;i++) {
  35425. var alts = altsets[i];
  35426. if (alts.length===1) {
  35427. return true;
  35428. }
  35429. }
  35430. return false;
  35431. };
  35432. //
  35433. // Determines if any single alternative subset in {@code altsets} contains
  35434. // more than one alternative.
  35435. //
  35436. // @param altsets a collection of alternative subsets
  35437. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  35438. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  35439. //
  35440. PredictionMode.hasConflictingAltSet = function(altsets) {
  35441. for(var i=0;i<altsets.length;i++) {
  35442. var alts = altsets[i];
  35443. if (alts.length>1) {
  35444. return true;
  35445. }
  35446. }
  35447. return false;
  35448. };
  35449. //
  35450. // Determines if every alternative subset in {@code altsets} is equivalent.
  35451. //
  35452. // @param altsets a collection of alternative subsets
  35453. // @return {@code true} if every member of {@code altsets} is equal to the
  35454. // others, otherwise {@code false}
  35455. //
  35456. PredictionMode.allSubsetsEqual = function(altsets) {
  35457. var first = null;
  35458. for(var i=0;i<altsets.length;i++) {
  35459. var alts = altsets[i];
  35460. if (first === null) {
  35461. first = alts;
  35462. } else if (alts!==first) {
  35463. return false;
  35464. }
  35465. }
  35466. return true;
  35467. };
  35468. //
  35469. // Returns the unique alternative predicted by all alternative subsets in
  35470. // {@code altsets}. If no such alternative exists, this method returns
  35471. // {@link ATN//INVALID_ALT_NUMBER}.
  35472. //
  35473. // @param altsets a collection of alternative subsets
  35474. //
  35475. PredictionMode.getUniqueAlt = function(altsets) {
  35476. var all = PredictionMode.getAlts(altsets);
  35477. if (all.length===1) {
  35478. return all.minValue();
  35479. } else {
  35480. return ATN.INVALID_ALT_NUMBER;
  35481. }
  35482. };
  35483. // Gets the complete set of represented alternatives for a collection of
  35484. // alternative subsets. This method returns the union of each {@link BitSet}
  35485. // in {@code altsets}.
  35486. //
  35487. // @param altsets a collection of alternative subsets
  35488. // @return the set of represented alternatives in {@code altsets}
  35489. //
  35490. PredictionMode.getAlts = function(altsets) {
  35491. var all = new BitSet();
  35492. altsets.map( function(alts) { all.or(alts); });
  35493. return all;
  35494. };
  35495. //
  35496. // This function gets the conflicting alt subsets from a configuration set.
  35497. // For each configuration {@code c} in {@code configs}:
  35498. //
  35499. // <pre>
  35500. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  35501. // alt and not pred
  35502. // </pre>
  35503. PredictionMode.getConflictingAltSubsets = function(configs) {
  35504. var configToAlts = new Map();
  35505. configToAlts.hashFunction = function(cfg) { hashStuff(cfg.state.stateNumber, cfg.context); };
  35506. configToAlts.equalsFunction = function(c1, c2) { return c1.state.stateNumber==c2.state.stateNumber && c1.context.equals(c2.context);}
  35507. configs.items.map(function(cfg) {
  35508. var alts = configToAlts.get(cfg);
  35509. if (alts === null) {
  35510. alts = new BitSet();
  35511. configToAlts.put(cfg, alts);
  35512. }
  35513. alts.add(cfg.alt);
  35514. });
  35515. return configToAlts.getValues();
  35516. };
  35517. //
  35518. // Get a map from state to alt subset from a configuration set. For each
  35519. // configuration {@code c} in {@code configs}:
  35520. //
  35521. // <pre>
  35522. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  35523. // </pre>
  35524. //
  35525. PredictionMode.getStateToAltMap = function(configs) {
  35526. var m = new AltDict();
  35527. configs.items.map(function(c) {
  35528. var alts = m.get(c.state);
  35529. if (alts === null) {
  35530. alts = new BitSet();
  35531. m.put(c.state, alts);
  35532. }
  35533. alts.add(c.alt);
  35534. });
  35535. return m;
  35536. };
  35537. PredictionMode.hasStateAssociatedWithOneAlt = function(configs) {
  35538. var values = PredictionMode.getStateToAltMap(configs).values();
  35539. for(var i=0;i<values.length;i++) {
  35540. if (values[i].length===1) {
  35541. return true;
  35542. }
  35543. }
  35544. return false;
  35545. };
  35546. PredictionMode.getSingleViableAlt = function(altsets) {
  35547. var result = null;
  35548. for(var i=0;i<altsets.length;i++) {
  35549. var alts = altsets[i];
  35550. var minAlt = alts.minValue();
  35551. if(result===null) {
  35552. result = minAlt;
  35553. } else if(result!==minAlt) { // more than 1 viable alt
  35554. return ATN.INVALID_ALT_NUMBER;
  35555. }
  35556. }
  35557. return result;
  35558. };
  35559. exports.PredictionMode = PredictionMode;
  35560. /***/ }),
  35561. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  35562. /*!****************************************************!*\
  35563. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  35564. \****************************************************/
  35565. /*! no static exports found */
  35566. /***/ (function(module, exports, __webpack_require__) {
  35567. //
  35568. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35569. * Use of this file is governed by the BSD 3-clause license that
  35570. * can be found in the LICENSE.txt file in the project root.
  35571. */
  35572. //
  35573. // A tree structure used to record the semantic context in which
  35574. // an ATN configuration is valid. It's either a single predicate,
  35575. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  35576. //
  35577. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  35578. // {@link SemanticContext} within the scope of this outer class.</p>
  35579. //
  35580. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  35581. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  35582. function SemanticContext() {
  35583. return this;
  35584. }
  35585. SemanticContext.prototype.hashCode = function() {
  35586. var hash = new Hash();
  35587. this.updateHashCode(hash);
  35588. return hash.finish();
  35589. };
  35590. // For context independent predicates, we evaluate them without a local
  35591. // context (i.e., null context). That way, we can evaluate them without
  35592. // having to create proper rule-specific context during prediction (as
  35593. // opposed to the parser, which creates them naturally). In a practical
  35594. // sense, this avoids a cast exception from RuleContext to myruleContext.
  35595. //
  35596. // <p>For context dependent predicates, we must pass in a local context so that
  35597. // references such as $arg evaluate properly as _localctx.arg. We only
  35598. // capture context dependent predicates in the context in which we begin
  35599. // prediction, so we passed in the outer context here in case of context
  35600. // dependent predicate evaluation.</p>
  35601. //
  35602. SemanticContext.prototype.evaluate = function(parser, outerContext) {
  35603. };
  35604. //
  35605. // Evaluate the precedence predicates for the context and reduce the result.
  35606. //
  35607. // @param parser The parser instance.
  35608. // @param outerContext The current parser context object.
  35609. // @return The simplified semantic context after precedence predicates are
  35610. // evaluated, which will be one of the following values.
  35611. // <ul>
  35612. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  35613. // precedence predicates are evaluated.</li>
  35614. // <li>{@code null}: if the predicate simplifies to {@code false} after
  35615. // precedence predicates are evaluated.</li>
  35616. // <li>{@code this}: if the semantic context is not changed as a result of
  35617. // precedence predicate evaluation.</li>
  35618. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  35619. // semantic context after precedence predicates are evaluated.</li>
  35620. // </ul>
  35621. //
  35622. SemanticContext.prototype.evalPrecedence = function(parser, outerContext) {
  35623. return this;
  35624. };
  35625. SemanticContext.andContext = function(a, b) {
  35626. if (a === null || a === SemanticContext.NONE) {
  35627. return b;
  35628. }
  35629. if (b === null || b === SemanticContext.NONE) {
  35630. return a;
  35631. }
  35632. var result = new AND(a, b);
  35633. if (result.opnds.length === 1) {
  35634. return result.opnds[0];
  35635. } else {
  35636. return result;
  35637. }
  35638. };
  35639. SemanticContext.orContext = function(a, b) {
  35640. if (a === null) {
  35641. return b;
  35642. }
  35643. if (b === null) {
  35644. return a;
  35645. }
  35646. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  35647. return SemanticContext.NONE;
  35648. }
  35649. var result = new OR(a, b);
  35650. if (result.opnds.length === 1) {
  35651. return result.opnds[0];
  35652. } else {
  35653. return result;
  35654. }
  35655. };
  35656. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  35657. SemanticContext.call(this);
  35658. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  35659. this.predIndex = predIndex === undefined ? -1 : predIndex;
  35660. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  35661. return this;
  35662. }
  35663. Predicate.prototype = Object.create(SemanticContext.prototype);
  35664. Predicate.prototype.constructor = Predicate;
  35665. //The default {@link SemanticContext}, which is semantically equivalent to
  35666. //a predicate of the form {@code {true}?}.
  35667. //
  35668. SemanticContext.NONE = new Predicate();
  35669. Predicate.prototype.evaluate = function(parser, outerContext) {
  35670. var localctx = this.isCtxDependent ? outerContext : null;
  35671. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  35672. };
  35673. Predicate.prototype.updateHashCode = function(hash) {
  35674. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  35675. };
  35676. Predicate.prototype.equals = function(other) {
  35677. if (this === other) {
  35678. return true;
  35679. } else if (!(other instanceof Predicate)) {
  35680. return false;
  35681. } else {
  35682. return this.ruleIndex === other.ruleIndex &&
  35683. this.predIndex === other.predIndex &&
  35684. this.isCtxDependent === other.isCtxDependent;
  35685. }
  35686. };
  35687. Predicate.prototype.toString = function() {
  35688. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  35689. };
  35690. function PrecedencePredicate(precedence) {
  35691. SemanticContext.call(this);
  35692. this.precedence = precedence === undefined ? 0 : precedence;
  35693. }
  35694. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  35695. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  35696. PrecedencePredicate.prototype.evaluate = function(parser, outerContext) {
  35697. return parser.precpred(outerContext, this.precedence);
  35698. };
  35699. PrecedencePredicate.prototype.evalPrecedence = function(parser, outerContext) {
  35700. if (parser.precpred(outerContext, this.precedence)) {
  35701. return SemanticContext.NONE;
  35702. } else {
  35703. return null;
  35704. }
  35705. };
  35706. PrecedencePredicate.prototype.compareTo = function(other) {
  35707. return this.precedence - other.precedence;
  35708. };
  35709. PrecedencePredicate.prototype.updateHashCode = function(hash) {
  35710. hash.update(31);
  35711. };
  35712. PrecedencePredicate.prototype.equals = function(other) {
  35713. if (this === other) {
  35714. return true;
  35715. } else if (!(other instanceof PrecedencePredicate)) {
  35716. return false;
  35717. } else {
  35718. return this.precedence === other.precedence;
  35719. }
  35720. };
  35721. PrecedencePredicate.prototype.toString = function() {
  35722. return "{"+this.precedence+">=prec}?";
  35723. };
  35724. PrecedencePredicate.filterPrecedencePredicates = function(set) {
  35725. var result = [];
  35726. set.values().map( function(context) {
  35727. if (context instanceof PrecedencePredicate) {
  35728. result.push(context);
  35729. }
  35730. });
  35731. return result;
  35732. };
  35733. // A semantic context which is true whenever none of the contained contexts
  35734. // is false.
  35735. //
  35736. function AND(a, b) {
  35737. SemanticContext.call(this);
  35738. var operands = new Set();
  35739. if (a instanceof AND) {
  35740. a.opnds.map(function(o) {
  35741. operands.add(o);
  35742. });
  35743. } else {
  35744. operands.add(a);
  35745. }
  35746. if (b instanceof AND) {
  35747. b.opnds.map(function(o) {
  35748. operands.add(o);
  35749. });
  35750. } else {
  35751. operands.add(b);
  35752. }
  35753. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  35754. if (precedencePredicates.length > 0) {
  35755. // interested in the transition with the lowest precedence
  35756. var reduced = null;
  35757. precedencePredicates.map( function(p) {
  35758. if(reduced===null || p.precedence<reduced.precedence) {
  35759. reduced = p;
  35760. }
  35761. });
  35762. operands.add(reduced);
  35763. }
  35764. this.opnds = operands.values();
  35765. return this;
  35766. }
  35767. AND.prototype = Object.create(SemanticContext.prototype);
  35768. AND.prototype.constructor = AND;
  35769. AND.prototype.equals = function(other) {
  35770. if (this === other) {
  35771. return true;
  35772. } else if (!(other instanceof AND)) {
  35773. return false;
  35774. } else {
  35775. return this.opnds === other.opnds;
  35776. }
  35777. };
  35778. AND.prototype.updateHashCode = function(hash) {
  35779. hash.update(this.opnds, "AND");
  35780. };
  35781. //
  35782. // {@inheritDoc}
  35783. //
  35784. // <p>
  35785. // The evaluation of predicates by this context is short-circuiting, but
  35786. // unordered.</p>
  35787. //
  35788. AND.prototype.evaluate = function(parser, outerContext) {
  35789. for (var i = 0; i < this.opnds.length; i++) {
  35790. if (!this.opnds[i].evaluate(parser, outerContext)) {
  35791. return false;
  35792. }
  35793. }
  35794. return true;
  35795. };
  35796. AND.prototype.evalPrecedence = function(parser, outerContext) {
  35797. var differs = false;
  35798. var operands = [];
  35799. for (var i = 0; i < this.opnds.length; i++) {
  35800. var context = this.opnds[i];
  35801. var evaluated = context.evalPrecedence(parser, outerContext);
  35802. differs |= (evaluated !== context);
  35803. if (evaluated === null) {
  35804. // The AND context is false if any element is false
  35805. return null;
  35806. } else if (evaluated !== SemanticContext.NONE) {
  35807. // Reduce the result by skipping true elements
  35808. operands.push(evaluated);
  35809. }
  35810. }
  35811. if (!differs) {
  35812. return this;
  35813. }
  35814. if (operands.length === 0) {
  35815. // all elements were true, so the AND context is true
  35816. return SemanticContext.NONE;
  35817. }
  35818. var result = null;
  35819. operands.map(function(o) {
  35820. result = result === null ? o : SemanticContext.andContext(result, o);
  35821. });
  35822. return result;
  35823. };
  35824. AND.prototype.toString = function() {
  35825. var s = "";
  35826. this.opnds.map(function(o) {
  35827. s += "&& " + o.toString();
  35828. });
  35829. return s.length > 3 ? s.slice(3) : s;
  35830. };
  35831. //
  35832. // A semantic context which is true whenever at least one of the contained
  35833. // contexts is true.
  35834. //
  35835. function OR(a, b) {
  35836. SemanticContext.call(this);
  35837. var operands = new Set();
  35838. if (a instanceof OR) {
  35839. a.opnds.map(function(o) {
  35840. operands.add(o);
  35841. });
  35842. } else {
  35843. operands.add(a);
  35844. }
  35845. if (b instanceof OR) {
  35846. b.opnds.map(function(o) {
  35847. operands.add(o);
  35848. });
  35849. } else {
  35850. operands.add(b);
  35851. }
  35852. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  35853. if (precedencePredicates.length > 0) {
  35854. // interested in the transition with the highest precedence
  35855. var s = precedencePredicates.sort(function(a, b) {
  35856. return a.compareTo(b);
  35857. });
  35858. var reduced = s[s.length-1];
  35859. operands.add(reduced);
  35860. }
  35861. this.opnds = operands.values();
  35862. return this;
  35863. }
  35864. OR.prototype = Object.create(SemanticContext.prototype);
  35865. OR.prototype.constructor = OR;
  35866. OR.prototype.constructor = function(other) {
  35867. if (this === other) {
  35868. return true;
  35869. } else if (!(other instanceof OR)) {
  35870. return false;
  35871. } else {
  35872. return this.opnds === other.opnds;
  35873. }
  35874. };
  35875. OR.prototype.updateHashCode = function(hash) {
  35876. hash.update(this.opnds, "OR");
  35877. };
  35878. // <p>
  35879. // The evaluation of predicates by this context is short-circuiting, but
  35880. // unordered.</p>
  35881. //
  35882. OR.prototype.evaluate = function(parser, outerContext) {
  35883. for (var i = 0; i < this.opnds.length; i++) {
  35884. if (this.opnds[i].evaluate(parser, outerContext)) {
  35885. return true;
  35886. }
  35887. }
  35888. return false;
  35889. };
  35890. OR.prototype.evalPrecedence = function(parser, outerContext) {
  35891. var differs = false;
  35892. var operands = [];
  35893. for (var i = 0; i < this.opnds.length; i++) {
  35894. var context = this.opnds[i];
  35895. var evaluated = context.evalPrecedence(parser, outerContext);
  35896. differs |= (evaluated !== context);
  35897. if (evaluated === SemanticContext.NONE) {
  35898. // The OR context is true if any element is true
  35899. return SemanticContext.NONE;
  35900. } else if (evaluated !== null) {
  35901. // Reduce the result by skipping false elements
  35902. operands.push(evaluated);
  35903. }
  35904. }
  35905. if (!differs) {
  35906. return this;
  35907. }
  35908. if (operands.length === 0) {
  35909. // all elements were false, so the OR context is false
  35910. return null;
  35911. }
  35912. var result = null;
  35913. operands.map(function(o) {
  35914. return result === null ? o : SemanticContext.orContext(result, o);
  35915. });
  35916. return result;
  35917. };
  35918. OR.prototype.toString = function() {
  35919. var s = "";
  35920. this.opnds.map(function(o) {
  35921. s += "|| " + o.toString();
  35922. });
  35923. return s.length > 3 ? s.slice(3) : s;
  35924. };
  35925. exports.SemanticContext = SemanticContext;
  35926. exports.PrecedencePredicate = PrecedencePredicate;
  35927. exports.Predicate = Predicate;
  35928. /***/ }),
  35929. /***/ "./node_modules/antlr4/atn/Transition.js":
  35930. /*!***********************************************!*\
  35931. !*** ./node_modules/antlr4/atn/Transition.js ***!
  35932. \***********************************************/
  35933. /*! no static exports found */
  35934. /***/ (function(module, exports, __webpack_require__) {
  35935. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35936. * Use of this file is governed by the BSD 3-clause license that
  35937. * can be found in the LICENSE.txt file in the project root.
  35938. */
  35939. //
  35940. // An ATN transition between any two ATN states. Subclasses define
  35941. // atom, set, epsilon, action, predicate, rule transitions.
  35942. //
  35943. // <p>This is a one way link. It emanates from a state (usually via a list of
  35944. // transitions) and has a target state.</p>
  35945. //
  35946. // <p>Since we never have to change the ATN transitions once we construct it,
  35947. // we can fix these transitions as specific classes. The DFA transitions
  35948. // on the other hand need to update the labels as it adds transitions to
  35949. // the states. We'll use the term Edge for the DFA to distinguish them from
  35950. // ATN transitions.</p>
  35951. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  35952. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  35953. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  35954. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  35955. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  35956. function Transition (target) {
  35957. // The target of this transition.
  35958. if (target===undefined || target===null) {
  35959. throw "target cannot be null.";
  35960. }
  35961. this.target = target;
  35962. // Are we epsilon, action, sempred?
  35963. this.isEpsilon = false;
  35964. this.label = null;
  35965. return this;
  35966. }
  35967. // constants for serialization
  35968. Transition.EPSILON = 1;
  35969. Transition.RANGE = 2;
  35970. Transition.RULE = 3;
  35971. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  35972. Transition.ATOM = 5;
  35973. Transition.ACTION = 6;
  35974. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  35975. Transition.NOT_SET = 8;
  35976. Transition.WILDCARD = 9;
  35977. Transition.PRECEDENCE = 10;
  35978. Transition.serializationNames = [
  35979. "INVALID",
  35980. "EPSILON",
  35981. "RANGE",
  35982. "RULE",
  35983. "PREDICATE",
  35984. "ATOM",
  35985. "ACTION",
  35986. "SET",
  35987. "NOT_SET",
  35988. "WILDCARD",
  35989. "PRECEDENCE"
  35990. ];
  35991. Transition.serializationTypes = {
  35992. EpsilonTransition: Transition.EPSILON,
  35993. RangeTransition: Transition.RANGE,
  35994. RuleTransition: Transition.RULE,
  35995. PredicateTransition: Transition.PREDICATE,
  35996. AtomTransition: Transition.ATOM,
  35997. ActionTransition: Transition.ACTION,
  35998. SetTransition: Transition.SET,
  35999. NotSetTransition: Transition.NOT_SET,
  36000. WildcardTransition: Transition.WILDCARD,
  36001. PrecedencePredicateTransition: Transition.PRECEDENCE
  36002. };
  36003. // TODO: make all transitions sets? no, should remove set edges
  36004. function AtomTransition(target, label) {
  36005. Transition.call(this, target);
  36006. this.label_ = label; // The token type or character value; or, signifies special label.
  36007. this.label = this.makeLabel();
  36008. this.serializationType = Transition.ATOM;
  36009. return this;
  36010. }
  36011. AtomTransition.prototype = Object.create(Transition.prototype);
  36012. AtomTransition.prototype.constructor = AtomTransition;
  36013. AtomTransition.prototype.makeLabel = function() {
  36014. var s = new IntervalSet();
  36015. s.addOne(this.label_);
  36016. return s;
  36017. };
  36018. AtomTransition.prototype.matches = function( symbol, minVocabSymbol, maxVocabSymbol) {
  36019. return this.label_ === symbol;
  36020. };
  36021. AtomTransition.prototype.toString = function() {
  36022. return this.label_;
  36023. };
  36024. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  36025. Transition.call(this, ruleStart);
  36026. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  36027. this.precedence = precedence;
  36028. this.followState = followState; // what node to begin computations following ref to rule
  36029. this.serializationType = Transition.RULE;
  36030. this.isEpsilon = true;
  36031. return this;
  36032. }
  36033. RuleTransition.prototype = Object.create(Transition.prototype);
  36034. RuleTransition.prototype.constructor = RuleTransition;
  36035. RuleTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36036. return false;
  36037. };
  36038. function EpsilonTransition(target, outermostPrecedenceReturn) {
  36039. Transition.call(this, target);
  36040. this.serializationType = Transition.EPSILON;
  36041. this.isEpsilon = true;
  36042. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  36043. return this;
  36044. }
  36045. EpsilonTransition.prototype = Object.create(Transition.prototype);
  36046. EpsilonTransition.prototype.constructor = EpsilonTransition;
  36047. EpsilonTransition.prototype.matches = function( symbol, minVocabSymbol, maxVocabSymbol) {
  36048. return false;
  36049. };
  36050. EpsilonTransition.prototype.toString = function() {
  36051. return "epsilon";
  36052. };
  36053. function RangeTransition(target, start, stop) {
  36054. Transition.call(this, target);
  36055. this.serializationType = Transition.RANGE;
  36056. this.start = start;
  36057. this.stop = stop;
  36058. this.label = this.makeLabel();
  36059. return this;
  36060. }
  36061. RangeTransition.prototype = Object.create(Transition.prototype);
  36062. RangeTransition.prototype.constructor = RangeTransition;
  36063. RangeTransition.prototype.makeLabel = function() {
  36064. var s = new IntervalSet();
  36065. s.addRange(this.start, this.stop);
  36066. return s;
  36067. };
  36068. RangeTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36069. return symbol >= this.start && symbol <= this.stop;
  36070. };
  36071. RangeTransition.prototype.toString = function() {
  36072. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  36073. };
  36074. function AbstractPredicateTransition(target) {
  36075. Transition.call(this, target);
  36076. return this;
  36077. }
  36078. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  36079. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  36080. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  36081. AbstractPredicateTransition.call(this, target);
  36082. this.serializationType = Transition.PREDICATE;
  36083. this.ruleIndex = ruleIndex;
  36084. this.predIndex = predIndex;
  36085. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  36086. this.isEpsilon = true;
  36087. return this;
  36088. }
  36089. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  36090. PredicateTransition.prototype.constructor = PredicateTransition;
  36091. PredicateTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36092. return false;
  36093. };
  36094. PredicateTransition.prototype.getPredicate = function() {
  36095. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  36096. };
  36097. PredicateTransition.prototype.toString = function() {
  36098. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  36099. };
  36100. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  36101. Transition.call(this, target);
  36102. this.serializationType = Transition.ACTION;
  36103. this.ruleIndex = ruleIndex;
  36104. this.actionIndex = actionIndex===undefined ? -1 : actionIndex;
  36105. this.isCtxDependent = isCtxDependent===undefined ? false : isCtxDependent; // e.g., $i ref in pred
  36106. this.isEpsilon = true;
  36107. return this;
  36108. }
  36109. ActionTransition.prototype = Object.create(Transition.prototype);
  36110. ActionTransition.prototype.constructor = ActionTransition;
  36111. ActionTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36112. return false;
  36113. };
  36114. ActionTransition.prototype.toString = function() {
  36115. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  36116. };
  36117. // A transition containing a set of values.
  36118. function SetTransition(target, set) {
  36119. Transition.call(this, target);
  36120. this.serializationType = Transition.SET;
  36121. if (set !==undefined && set !==null) {
  36122. this.label = set;
  36123. } else {
  36124. this.label = new IntervalSet();
  36125. this.label.addOne(Token.INVALID_TYPE);
  36126. }
  36127. return this;
  36128. }
  36129. SetTransition.prototype = Object.create(Transition.prototype);
  36130. SetTransition.prototype.constructor = SetTransition;
  36131. SetTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36132. return this.label.contains(symbol);
  36133. };
  36134. SetTransition.prototype.toString = function() {
  36135. return this.label.toString();
  36136. };
  36137. function NotSetTransition(target, set) {
  36138. SetTransition.call(this, target, set);
  36139. this.serializationType = Transition.NOT_SET;
  36140. return this;
  36141. }
  36142. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  36143. NotSetTransition.prototype.constructor = NotSetTransition;
  36144. NotSetTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36145. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol &&
  36146. !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  36147. };
  36148. NotSetTransition.prototype.toString = function() {
  36149. return '~' + SetTransition.prototype.toString.call(this);
  36150. };
  36151. function WildcardTransition(target) {
  36152. Transition.call(this, target);
  36153. this.serializationType = Transition.WILDCARD;
  36154. return this;
  36155. }
  36156. WildcardTransition.prototype = Object.create(Transition.prototype);
  36157. WildcardTransition.prototype.constructor = WildcardTransition;
  36158. WildcardTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36159. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  36160. };
  36161. WildcardTransition.prototype.toString = function() {
  36162. return ".";
  36163. };
  36164. function PrecedencePredicateTransition(target, precedence) {
  36165. AbstractPredicateTransition.call(this, target);
  36166. this.serializationType = Transition.PRECEDENCE;
  36167. this.precedence = precedence;
  36168. this.isEpsilon = true;
  36169. return this;
  36170. }
  36171. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  36172. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  36173. PrecedencePredicateTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36174. return false;
  36175. };
  36176. PrecedencePredicateTransition.prototype.getPredicate = function() {
  36177. return new PrecedencePredicate(this.precedence);
  36178. };
  36179. PrecedencePredicateTransition.prototype.toString = function() {
  36180. return this.precedence + " >= _p";
  36181. };
  36182. exports.Transition = Transition;
  36183. exports.AtomTransition = AtomTransition;
  36184. exports.SetTransition = SetTransition;
  36185. exports.NotSetTransition = NotSetTransition;
  36186. exports.RuleTransition = RuleTransition;
  36187. exports.ActionTransition = ActionTransition;
  36188. exports.EpsilonTransition = EpsilonTransition;
  36189. exports.RangeTransition = RangeTransition;
  36190. exports.WildcardTransition = WildcardTransition;
  36191. exports.PredicateTransition = PredicateTransition;
  36192. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  36193. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  36194. /***/ }),
  36195. /***/ "./node_modules/antlr4/atn/index.js":
  36196. /*!******************************************!*\
  36197. !*** ./node_modules/antlr4/atn/index.js ***!
  36198. \******************************************/
  36199. /*! no static exports found */
  36200. /***/ (function(module, exports, __webpack_require__) {
  36201. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36202. * Use of this file is governed by the BSD 3-clause license that
  36203. * can be found in the LICENSE.txt file in the project root.
  36204. */
  36205. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  36206. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  36207. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  36208. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  36209. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  36210. /***/ }),
  36211. /***/ "./node_modules/antlr4/dfa/DFA.js":
  36212. /*!****************************************!*\
  36213. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  36214. \****************************************/
  36215. /*! no static exports found */
  36216. /***/ (function(module, exports, __webpack_require__) {
  36217. //
  36218. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36219. * Use of this file is governed by the BSD 3-clause license that
  36220. * can be found in the LICENSE.txt file in the project root.
  36221. */
  36222. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  36223. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  36224. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  36225. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  36226. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  36227. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  36228. function DFA(atnStartState, decision) {
  36229. if (decision === undefined) {
  36230. decision = 0;
  36231. }
  36232. // From which ATN state did we create this DFA?
  36233. this.atnStartState = atnStartState;
  36234. this.decision = decision;
  36235. // A set of all DFA states. Use {@link Map} so we can get old state back
  36236. // ({@link Set} only allows you to see if it's there).
  36237. this._states = new Set();
  36238. this.s0 = null;
  36239. // {@code true} if this DFA is for a precedence decision; otherwise,
  36240. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  36241. // {@link //setPrecedenceDfa}.
  36242. this.precedenceDfa = false;
  36243. if (atnStartState instanceof StarLoopEntryState)
  36244. {
  36245. if (atnStartState.isPrecedenceDecision) {
  36246. this.precedenceDfa = true;
  36247. var precedenceState = new DFAState(null, new ATNConfigSet());
  36248. precedenceState.edges = [];
  36249. precedenceState.isAcceptState = false;
  36250. precedenceState.requiresFullContext = false;
  36251. this.s0 = precedenceState;
  36252. }
  36253. }
  36254. return this;
  36255. }
  36256. // Get the start state for a specific precedence value.
  36257. //
  36258. // @param precedence The current precedence.
  36259. // @return The start state corresponding to the specified precedence, or
  36260. // {@code null} if no start state exists for the specified precedence.
  36261. //
  36262. // @throws IllegalStateException if this is not a precedence DFA.
  36263. // @see //isPrecedenceDfa()
  36264. DFA.prototype.getPrecedenceStartState = function(precedence) {
  36265. if (!(this.precedenceDfa)) {
  36266. throw ("Only precedence DFAs may contain a precedence start state.");
  36267. }
  36268. // s0.edges is never null for a precedence DFA
  36269. if (precedence < 0 || precedence >= this.s0.edges.length) {
  36270. return null;
  36271. }
  36272. return this.s0.edges[precedence] || null;
  36273. };
  36274. // Set the start state for a specific precedence value.
  36275. //
  36276. // @param precedence The current precedence.
  36277. // @param startState The start state corresponding to the specified
  36278. // precedence.
  36279. //
  36280. // @throws IllegalStateException if this is not a precedence DFA.
  36281. // @see //isPrecedenceDfa()
  36282. //
  36283. DFA.prototype.setPrecedenceStartState = function(precedence, startState) {
  36284. if (!(this.precedenceDfa)) {
  36285. throw ("Only precedence DFAs may contain a precedence start state.");
  36286. }
  36287. if (precedence < 0) {
  36288. return;
  36289. }
  36290. // synchronization on s0 here is ok. when the DFA is turned into a
  36291. // precedence DFA, s0 will be initialized once and not updated again
  36292. // s0.edges is never null for a precedence DFA
  36293. this.s0.edges[precedence] = startState;
  36294. };
  36295. //
  36296. // Sets whether this is a precedence DFA. If the specified value differs
  36297. // from the current DFA configuration, the following actions are taken;
  36298. // otherwise no changes are made to the current DFA.
  36299. //
  36300. // <ul>
  36301. // <li>The {@link //states} map is cleared</li>
  36302. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  36303. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  36304. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  36305. // store the start states for individual precedence values.</li>
  36306. // <li>The {@link //precedenceDfa} field is updated</li>
  36307. // </ul>
  36308. //
  36309. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  36310. // {@code false}
  36311. DFA.prototype.setPrecedenceDfa = function(precedenceDfa) {
  36312. if (this.precedenceDfa!==precedenceDfa) {
  36313. this._states = new DFAStatesSet();
  36314. if (precedenceDfa) {
  36315. var precedenceState = new DFAState(null, new ATNConfigSet());
  36316. precedenceState.edges = [];
  36317. precedenceState.isAcceptState = false;
  36318. precedenceState.requiresFullContext = false;
  36319. this.s0 = precedenceState;
  36320. } else {
  36321. this.s0 = null;
  36322. }
  36323. this.precedenceDfa = precedenceDfa;
  36324. }
  36325. };
  36326. Object.defineProperty(DFA.prototype, "states", {
  36327. get : function() {
  36328. return this._states;
  36329. }
  36330. });
  36331. // Return a list of all states in this DFA, ordered by state number.
  36332. DFA.prototype.sortedStates = function() {
  36333. var list = this._states.values();
  36334. return list.sort(function(a, b) {
  36335. return a.stateNumber - b.stateNumber;
  36336. });
  36337. };
  36338. DFA.prototype.toString = function(literalNames, symbolicNames) {
  36339. literalNames = literalNames || null;
  36340. symbolicNames = symbolicNames || null;
  36341. if (this.s0 === null) {
  36342. return "";
  36343. }
  36344. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  36345. return serializer.toString();
  36346. };
  36347. DFA.prototype.toLexerString = function() {
  36348. if (this.s0 === null) {
  36349. return "";
  36350. }
  36351. var serializer = new LexerDFASerializer(this);
  36352. return serializer.toString();
  36353. };
  36354. exports.DFA = DFA;
  36355. /***/ }),
  36356. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  36357. /*!**************************************************!*\
  36358. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  36359. \**************************************************/
  36360. /*! no static exports found */
  36361. /***/ (function(module, exports) {
  36362. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36363. * Use of this file is governed by the BSD 3-clause license that
  36364. * can be found in the LICENSE.txt file in the project root.
  36365. */
  36366. // A DFA walker that knows how to dump them to serialized strings.#/
  36367. function DFASerializer(dfa, literalNames, symbolicNames) {
  36368. this.dfa = dfa;
  36369. this.literalNames = literalNames || [];
  36370. this.symbolicNames = symbolicNames || [];
  36371. return this;
  36372. }
  36373. DFASerializer.prototype.toString = function() {
  36374. if(this.dfa.s0 === null) {
  36375. return null;
  36376. }
  36377. var buf = "";
  36378. var states = this.dfa.sortedStates();
  36379. for(var i=0;i<states.length;i++) {
  36380. var s = states[i];
  36381. if(s.edges!==null) {
  36382. var n = s.edges.length;
  36383. for(var j=0;j<n;j++) {
  36384. var t = s.edges[j] || null;
  36385. if(t!==null && t.stateNumber !== 0x7FFFFFFF) {
  36386. buf = buf.concat(this.getStateString(s));
  36387. buf = buf.concat("-");
  36388. buf = buf.concat(this.getEdgeLabel(j));
  36389. buf = buf.concat("->");
  36390. buf = buf.concat(this.getStateString(t));
  36391. buf = buf.concat('\n');
  36392. }
  36393. }
  36394. }
  36395. }
  36396. return buf.length===0 ? null : buf;
  36397. };
  36398. DFASerializer.prototype.getEdgeLabel = function(i) {
  36399. if (i===0) {
  36400. return "EOF";
  36401. } else if(this.literalNames !==null || this.symbolicNames!==null) {
  36402. return this.literalNames[i-1] || this.symbolicNames[i-1];
  36403. } else {
  36404. return String.fromCharCode(i-1);
  36405. }
  36406. };
  36407. DFASerializer.prototype.getStateString = function(s) {
  36408. var baseStateStr = ( s.isAcceptState ? ":" : "") + "s" + s.stateNumber + ( s.requiresFullContext ? "^" : "");
  36409. if(s.isAcceptState) {
  36410. if (s.predicates !== null) {
  36411. return baseStateStr + "=>" + s.predicates.toString();
  36412. } else {
  36413. return baseStateStr + "=>" + s.prediction.toString();
  36414. }
  36415. } else {
  36416. return baseStateStr;
  36417. }
  36418. };
  36419. function LexerDFASerializer(dfa) {
  36420. DFASerializer.call(this, dfa, null);
  36421. return this;
  36422. }
  36423. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  36424. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  36425. LexerDFASerializer.prototype.getEdgeLabel = function(i) {
  36426. return "'" + String.fromCharCode(i) + "'";
  36427. };
  36428. exports.DFASerializer = DFASerializer;
  36429. exports.LexerDFASerializer = LexerDFASerializer;
  36430. /***/ }),
  36431. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  36432. /*!*********************************************!*\
  36433. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  36434. \*********************************************/
  36435. /*! no static exports found */
  36436. /***/ (function(module, exports, __webpack_require__) {
  36437. //
  36438. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36439. * Use of this file is governed by the BSD 3-clause license that
  36440. * can be found in the LICENSE.txt file in the project root.
  36441. */
  36442. ///
  36443. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  36444. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  36445. var Hash = Utils.Hash;
  36446. var Set = Utils.Set;
  36447. // Map a predicate to a predicted alternative.///
  36448. function PredPrediction(pred, alt) {
  36449. this.alt = alt;
  36450. this.pred = pred;
  36451. return this;
  36452. }
  36453. PredPrediction.prototype.toString = function() {
  36454. return "(" + this.pred + ", " + this.alt + ")";
  36455. };
  36456. // A DFA state represents a set of possible ATN configurations.
  36457. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  36458. // to keep track of all possible states the ATN can be in after
  36459. // reading each input symbol. That is to say, after reading
  36460. // input a1a2..an, the DFA is in a state that represents the
  36461. // subset T of the states of the ATN that are reachable from the
  36462. // ATN's start state along some path labeled a1a2..an."
  36463. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  36464. // would be a bitset representing the set of states the
  36465. // ATN could be in. We need to track the alt predicted by each
  36466. // state as well, however. More importantly, we need to maintain
  36467. // a stack of states, tracking the closure operations as they
  36468. // jump from rule to rule, emulating rule invocations (method calls).
  36469. // I have to add a stack to simulate the proper lookahead sequences for
  36470. // the underlying LL grammar from which the ATN was derived.
  36471. //
  36472. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  36473. // is both a state (ala normal conversion) and a RuleContext describing
  36474. // the chain of rules (if any) followed to arrive at that state.</p>
  36475. //
  36476. // <p>A DFA state may have multiple references to a particular state,
  36477. // but with different ATN contexts (with same or different alts)
  36478. // meaning that state was reached via a different set of rule invocations.</p>
  36479. // /
  36480. function DFAState(stateNumber, configs) {
  36481. if (stateNumber === null) {
  36482. stateNumber = -1;
  36483. }
  36484. if (configs === null) {
  36485. configs = new ATNConfigSet();
  36486. }
  36487. this.stateNumber = stateNumber;
  36488. this.configs = configs;
  36489. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  36490. // {@link Token//EOF} maps to {@code edges[0]}.
  36491. this.edges = null;
  36492. this.isAcceptState = false;
  36493. // if accept state, what ttype do we match or alt do we predict?
  36494. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  36495. // //predicates}{@code !=null} or
  36496. // {@link //requiresFullContext}.
  36497. this.prediction = 0;
  36498. this.lexerActionExecutor = null;
  36499. // Indicates that this state was created during SLL prediction that
  36500. // discovered a conflict between the configurations in the state. Future
  36501. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  36502. // full context prediction if this field is true.
  36503. this.requiresFullContext = false;
  36504. // During SLL parsing, this is a list of predicates associated with the
  36505. // ATN configurations of the DFA state. When we have predicates,
  36506. // {@link //requiresFullContext} is {@code false} since full context
  36507. // prediction evaluates predicates
  36508. // on-the-fly. If this is not null, then {@link //prediction} is
  36509. // {@link ATN//INVALID_ALT_NUMBER}.
  36510. //
  36511. // <p>We only use these for non-{@link //requiresFullContext} but
  36512. // conflicting states. That
  36513. // means we know from the context (it's $ or we don't dip into outer
  36514. // context) that it's an ambiguity not a conflict.</p>
  36515. //
  36516. // <p>This list is computed by {@link
  36517. // ParserATNSimulator//predicateDFAState}.</p>
  36518. this.predicates = null;
  36519. return this;
  36520. }
  36521. // Get the set of all alts mentioned by all ATN configurations in this
  36522. // DFA state.
  36523. DFAState.prototype.getAltSet = function() {
  36524. var alts = new Set();
  36525. if (this.configs !== null) {
  36526. for (var i = 0; i < this.configs.length; i++) {
  36527. var c = this.configs[i];
  36528. alts.add(c.alt);
  36529. }
  36530. }
  36531. if (alts.length === 0) {
  36532. return null;
  36533. } else {
  36534. return alts;
  36535. }
  36536. };
  36537. // Two {@link DFAState} instances are equal if their ATN configuration sets
  36538. // are the same. This method is used to see if a state already exists.
  36539. //
  36540. // <p>Because the number of alternatives and number of ATN configurations are
  36541. // finite, there is a finite number of DFA states that can be processed.
  36542. // This is necessary to show that the algorithm terminates.</p>
  36543. //
  36544. // <p>Cannot test the DFA state numbers here because in
  36545. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  36546. // exists that has this exact set of ATN configurations. The
  36547. // {@link //stateNumber} is irrelevant.</p>
  36548. DFAState.prototype.equals = function(other) {
  36549. // compare set of ATN configurations in this set with other
  36550. return this === other ||
  36551. (other instanceof DFAState &&
  36552. this.configs.equals(other.configs));
  36553. };
  36554. DFAState.prototype.toString = function() {
  36555. var s = "" + this.stateNumber + ":" + this.configs;
  36556. if(this.isAcceptState) {
  36557. s = s + "=>";
  36558. if (this.predicates !== null)
  36559. s = s + this.predicates;
  36560. else
  36561. s = s + this.prediction;
  36562. }
  36563. return s;
  36564. };
  36565. DFAState.prototype.hashCode = function() {
  36566. var hash = new Hash();
  36567. hash.update(this.configs);
  36568. if(this.isAcceptState) {
  36569. if (this.predicates !== null)
  36570. hash.update(this.predicates);
  36571. else
  36572. hash.update(this.prediction);
  36573. }
  36574. return hash.finish();
  36575. };
  36576. exports.DFAState = DFAState;
  36577. exports.PredPrediction = PredPrediction;
  36578. /***/ }),
  36579. /***/ "./node_modules/antlr4/dfa/index.js":
  36580. /*!******************************************!*\
  36581. !*** ./node_modules/antlr4/dfa/index.js ***!
  36582. \******************************************/
  36583. /*! no static exports found */
  36584. /***/ (function(module, exports, __webpack_require__) {
  36585. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36586. * Use of this file is governed by the BSD 3-clause license that
  36587. * can be found in the LICENSE.txt file in the project root.
  36588. */
  36589. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  36590. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  36591. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  36592. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  36593. /***/ }),
  36594. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  36595. /*!**************************************************************!*\
  36596. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  36597. \**************************************************************/
  36598. /*! no static exports found */
  36599. /***/ (function(module, exports, __webpack_require__) {
  36600. //
  36601. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36602. * Use of this file is governed by the BSD 3-clause license that
  36603. * can be found in the LICENSE.txt file in the project root.
  36604. */
  36605. //
  36606. //
  36607. // This implementation of {@link ANTLRErrorListener} can be used to identify
  36608. // certain potential correctness and performance problems in grammars. "Reports"
  36609. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  36610. // message.
  36611. //
  36612. // <ul>
  36613. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  36614. // grammar can match the input.</li>
  36615. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  36616. // prediction resolved an SLL conflict to a unique alternative which equaled the
  36617. // minimum alternative of the SLL conflict.</li>
  36618. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  36619. // full-context prediction resolved an SLL conflict to a unique alternative,
  36620. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  36621. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  36622. // this situation occurs.</li>
  36623. // </ul>
  36624. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  36625. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  36626. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  36627. function DiagnosticErrorListener(exactOnly) {
  36628. ErrorListener.call(this);
  36629. exactOnly = exactOnly || true;
  36630. // whether all ambiguities or only exact ambiguities are reported.
  36631. this.exactOnly = exactOnly;
  36632. return this;
  36633. }
  36634. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  36635. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  36636. DiagnosticErrorListener.prototype.reportAmbiguity = function(recognizer, dfa,
  36637. startIndex, stopIndex, exact, ambigAlts, configs) {
  36638. if (this.exactOnly && !exact) {
  36639. return;
  36640. }
  36641. var msg = "reportAmbiguity d=" +
  36642. this.getDecisionDescription(recognizer, dfa) +
  36643. ": ambigAlts=" +
  36644. this.getConflictingAlts(ambigAlts, configs) +
  36645. ", input='" +
  36646. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  36647. recognizer.notifyErrorListeners(msg);
  36648. };
  36649. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function(
  36650. recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  36651. var msg = "reportAttemptingFullContext d=" +
  36652. this.getDecisionDescription(recognizer, dfa) +
  36653. ", input='" +
  36654. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  36655. recognizer.notifyErrorListeners(msg);
  36656. };
  36657. DiagnosticErrorListener.prototype.reportContextSensitivity = function(
  36658. recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  36659. var msg = "reportContextSensitivity d=" +
  36660. this.getDecisionDescription(recognizer, dfa) +
  36661. ", input='" +
  36662. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  36663. recognizer.notifyErrorListeners(msg);
  36664. };
  36665. DiagnosticErrorListener.prototype.getDecisionDescription = function(recognizer, dfa) {
  36666. var decision = dfa.decision;
  36667. var ruleIndex = dfa.atnStartState.ruleIndex;
  36668. var ruleNames = recognizer.ruleNames;
  36669. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  36670. return "" + decision;
  36671. }
  36672. var ruleName = ruleNames[ruleIndex] || null;
  36673. if (ruleName === null || ruleName.length === 0) {
  36674. return "" + decision;
  36675. }
  36676. return "" + decision + " (" + ruleName + ")";
  36677. };
  36678. //
  36679. // Computes the set of conflicting or ambiguous alternatives from a
  36680. // configuration set, if that information was not already provided by the
  36681. // parser.
  36682. //
  36683. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  36684. // reported by the parser.
  36685. // @param configs The conflicting or ambiguous configuration set.
  36686. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  36687. // returns the set of alternatives represented in {@code configs}.
  36688. //
  36689. DiagnosticErrorListener.prototype.getConflictingAlts = function(reportedAlts, configs) {
  36690. if (reportedAlts !== null) {
  36691. return reportedAlts;
  36692. }
  36693. var result = new BitSet();
  36694. for (var i = 0; i < configs.items.length; i++) {
  36695. result.add(configs.items[i].alt);
  36696. }
  36697. return "{" + result.values().join(", ") + "}";
  36698. };
  36699. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  36700. /***/ }),
  36701. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  36702. /*!****************************************************!*\
  36703. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  36704. \****************************************************/
  36705. /*! no static exports found */
  36706. /***/ (function(module, exports) {
  36707. //
  36708. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36709. * Use of this file is governed by the BSD 3-clause license that
  36710. * can be found in the LICENSE.txt file in the project root.
  36711. */
  36712. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  36713. // default implementation of each method does nothing, but can be overridden as
  36714. // necessary.
  36715. function ErrorListener() {
  36716. return this;
  36717. }
  36718. ErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  36719. };
  36720. ErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  36721. };
  36722. ErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  36723. };
  36724. ErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  36725. };
  36726. function ConsoleErrorListener() {
  36727. ErrorListener.call(this);
  36728. return this;
  36729. }
  36730. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  36731. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  36732. //
  36733. // Provides a default instance of {@link ConsoleErrorListener}.
  36734. //
  36735. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  36736. //
  36737. // {@inheritDoc}
  36738. //
  36739. // <p>
  36740. // This implementation prints messages to {@link System//err} containing the
  36741. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  36742. // the following format.</p>
  36743. //
  36744. // <pre>
  36745. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  36746. // </pre>
  36747. //
  36748. ConsoleErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  36749. console.error("line " + line + ":" + column + " " + msg);
  36750. };
  36751. function ProxyErrorListener(delegates) {
  36752. ErrorListener.call(this);
  36753. if (delegates===null) {
  36754. throw "delegates";
  36755. }
  36756. this.delegates = delegates;
  36757. return this;
  36758. }
  36759. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  36760. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  36761. ProxyErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  36762. this.delegates.map(function(d) { d.syntaxError(recognizer, offendingSymbol, line, column, msg, e); });
  36763. };
  36764. ProxyErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  36765. this.delegates.map(function(d) { d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs); });
  36766. };
  36767. ProxyErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  36768. this.delegates.map(function(d) { d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs); });
  36769. };
  36770. ProxyErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  36771. this.delegates.map(function(d) { d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs); });
  36772. };
  36773. exports.ErrorListener = ErrorListener;
  36774. exports.ConsoleErrorListener = ConsoleErrorListener;
  36775. exports.ProxyErrorListener = ProxyErrorListener;
  36776. /***/ }),
  36777. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  36778. /*!****************************************************!*\
  36779. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  36780. \****************************************************/
  36781. /*! no static exports found */
  36782. /***/ (function(module, exports, __webpack_require__) {
  36783. //
  36784. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36785. * Use of this file is governed by the BSD 3-clause license that
  36786. * can be found in the LICENSE.txt file in the project root.
  36787. */
  36788. //
  36789. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  36790. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  36791. var NoViableAltException = Errors.NoViableAltException;
  36792. var InputMismatchException = Errors.InputMismatchException;
  36793. var FailedPredicateException = Errors.FailedPredicateException;
  36794. var ParseCancellationException = Errors.ParseCancellationException;
  36795. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  36796. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  36797. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  36798. function ErrorStrategy() {
  36799. }
  36800. ErrorStrategy.prototype.reset = function(recognizer){
  36801. };
  36802. ErrorStrategy.prototype.recoverInline = function(recognizer){
  36803. };
  36804. ErrorStrategy.prototype.recover = function(recognizer, e){
  36805. };
  36806. ErrorStrategy.prototype.sync = function(recognizer){
  36807. };
  36808. ErrorStrategy.prototype.inErrorRecoveryMode = function(recognizer){
  36809. };
  36810. ErrorStrategy.prototype.reportError = function(recognizer){
  36811. };
  36812. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  36813. // error reporting and recovery in ANTLR parsers.
  36814. //
  36815. function DefaultErrorStrategy() {
  36816. ErrorStrategy.call(this);
  36817. // Indicates whether the error strategy is currently "recovering from an
  36818. // error". This is used to suppress reporting multiple error messages while
  36819. // attempting to recover from a detected syntax error.
  36820. //
  36821. // @see //inErrorRecoveryMode
  36822. //
  36823. this.errorRecoveryMode = false;
  36824. // The index into the input stream where the last error occurred.
  36825. // This is used to prevent infinite loops where an error is found
  36826. // but no token is consumed during recovery...another error is found,
  36827. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  36828. // one token/tree node is consumed for two errors.
  36829. //
  36830. this.lastErrorIndex = -1;
  36831. this.lastErrorStates = null;
  36832. return this;
  36833. }
  36834. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  36835. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  36836. // <p>The default implementation simply calls {@link //endErrorCondition} to
  36837. // ensure that the handler is not in error recovery mode.</p>
  36838. DefaultErrorStrategy.prototype.reset = function(recognizer) {
  36839. this.endErrorCondition(recognizer);
  36840. };
  36841. //
  36842. // This method is called to enter error recovery mode when a recognition
  36843. // exception is reported.
  36844. //
  36845. // @param recognizer the parser instance
  36846. //
  36847. DefaultErrorStrategy.prototype.beginErrorCondition = function(recognizer) {
  36848. this.errorRecoveryMode = true;
  36849. };
  36850. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function(recognizer) {
  36851. return this.errorRecoveryMode;
  36852. };
  36853. //
  36854. // This method is called to leave error recovery mode after recovering from
  36855. // a recognition exception.
  36856. //
  36857. // @param recognizer
  36858. //
  36859. DefaultErrorStrategy.prototype.endErrorCondition = function(recognizer) {
  36860. this.errorRecoveryMode = false;
  36861. this.lastErrorStates = null;
  36862. this.lastErrorIndex = -1;
  36863. };
  36864. //
  36865. // {@inheritDoc}
  36866. //
  36867. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  36868. //
  36869. DefaultErrorStrategy.prototype.reportMatch = function(recognizer) {
  36870. this.endErrorCondition(recognizer);
  36871. };
  36872. //
  36873. // {@inheritDoc}
  36874. //
  36875. // <p>The default implementation returns immediately if the handler is already
  36876. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  36877. // and dispatches the reporting task based on the runtime type of {@code e}
  36878. // according to the following table.</p>
  36879. //
  36880. // <ul>
  36881. // <li>{@link NoViableAltException}: Dispatches the call to
  36882. // {@link //reportNoViableAlternative}</li>
  36883. // <li>{@link InputMismatchException}: Dispatches the call to
  36884. // {@link //reportInputMismatch}</li>
  36885. // <li>{@link FailedPredicateException}: Dispatches the call to
  36886. // {@link //reportFailedPredicate}</li>
  36887. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  36888. // the exception</li>
  36889. // </ul>
  36890. //
  36891. DefaultErrorStrategy.prototype.reportError = function(recognizer, e) {
  36892. // if we've already reported an error and have not matched a token
  36893. // yet successfully, don't report any errors.
  36894. if(this.inErrorRecoveryMode(recognizer)) {
  36895. return; // don't report spurious errors
  36896. }
  36897. this.beginErrorCondition(recognizer);
  36898. if ( e instanceof NoViableAltException ) {
  36899. this.reportNoViableAlternative(recognizer, e);
  36900. } else if ( e instanceof InputMismatchException ) {
  36901. this.reportInputMismatch(recognizer, e);
  36902. } else if ( e instanceof FailedPredicateException ) {
  36903. this.reportFailedPredicate(recognizer, e);
  36904. } else {
  36905. console.log("unknown recognition error type: " + e.constructor.name);
  36906. console.log(e.stack);
  36907. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  36908. }
  36909. };
  36910. //
  36911. // {@inheritDoc}
  36912. //
  36913. // <p>The default implementation resynchronizes the parser by consuming tokens
  36914. // until we find one in the resynchronization set--loosely the set of tokens
  36915. // that can follow the current rule.</p>
  36916. //
  36917. DefaultErrorStrategy.prototype.recover = function(recognizer, e) {
  36918. if (this.lastErrorIndex===recognizer.getInputStream().index &&
  36919. this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state)>=0) {
  36920. // uh oh, another error at same token index and previously-visited
  36921. // state in ATN; must be a case where LT(1) is in the recovery
  36922. // token set so nothing got consumed. Consume a single token
  36923. // at least to prevent an infinite loop; this is a failsafe.
  36924. recognizer.consume();
  36925. }
  36926. this.lastErrorIndex = recognizer._input.index;
  36927. if (this.lastErrorStates === null) {
  36928. this.lastErrorStates = [];
  36929. }
  36930. this.lastErrorStates.push(recognizer.state);
  36931. var followSet = this.getErrorRecoverySet(recognizer);
  36932. this.consumeUntil(recognizer, followSet);
  36933. };
  36934. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  36935. // that the current lookahead symbol is consistent with what were expecting
  36936. // at this point in the ATN. You can call this anytime but ANTLR only
  36937. // generates code to check before subrules/loops and each iteration.
  36938. //
  36939. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  36940. // subrules. E.g.,</p>
  36941. //
  36942. // <pre>
  36943. // a : sync ( stuff sync )* ;
  36944. // sync : {consume to what can follow sync} ;
  36945. // </pre>
  36946. //
  36947. // At the start of a sub rule upon error, {@link //sync} performs single
  36948. // token deletion, if possible. If it can't do that, it bails on the current
  36949. // rule and uses the default error recovery, which consumes until the
  36950. // resynchronization set of the current rule.
  36951. //
  36952. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  36953. // with an empty alternative), then the expected set includes what follows
  36954. // the subrule.</p>
  36955. //
  36956. // <p>During loop iteration, it consumes until it sees a token that can start a
  36957. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  36958. // stay in the loop as long as possible.</p>
  36959. //
  36960. // <p><strong>ORIGINS</strong></p>
  36961. //
  36962. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  36963. // A single mismatch token or missing token would force the parser to bail
  36964. // out of the entire rules surrounding the loop. So, for rule</p>
  36965. //
  36966. // <pre>
  36967. // classDef : 'class' ID '{' member* '}'
  36968. // </pre>
  36969. //
  36970. // input with an extra token between members would force the parser to
  36971. // consume until it found the next class definition rather than the next
  36972. // member definition of the current class.
  36973. //
  36974. // <p>This functionality cost a little bit of effort because the parser has to
  36975. // compare token set at the start of the loop and at each iteration. If for
  36976. // some reason speed is suffering for you, you can turn off this
  36977. // functionality by simply overriding this method as a blank { }.</p>
  36978. //
  36979. DefaultErrorStrategy.prototype.sync = function(recognizer) {
  36980. // If already recovering, don't try to sync
  36981. if (this.inErrorRecoveryMode(recognizer)) {
  36982. return;
  36983. }
  36984. var s = recognizer._interp.atn.states[recognizer.state];
  36985. var la = recognizer.getTokenStream().LA(1);
  36986. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  36987. var nextTokens = recognizer.atn.nextTokens(s);
  36988. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  36989. return;
  36990. }
  36991. switch (s.stateType) {
  36992. case ATNState.BLOCK_START:
  36993. case ATNState.STAR_BLOCK_START:
  36994. case ATNState.PLUS_BLOCK_START:
  36995. case ATNState.STAR_LOOP_ENTRY:
  36996. // report error and recover if possible
  36997. if( this.singleTokenDeletion(recognizer) !== null) {
  36998. return;
  36999. } else {
  37000. throw new InputMismatchException(recognizer);
  37001. }
  37002. break;
  37003. case ATNState.PLUS_LOOP_BACK:
  37004. case ATNState.STAR_LOOP_BACK:
  37005. this.reportUnwantedToken(recognizer);
  37006. var expecting = new IntervalSet();
  37007. expecting.addSet(recognizer.getExpectedTokens());
  37008. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  37009. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  37010. break;
  37011. default:
  37012. // do nothing if we can't identify the exact kind of ATN state
  37013. }
  37014. };
  37015. // This is called by {@link //reportError} when the exception is a
  37016. // {@link NoViableAltException}.
  37017. //
  37018. // @see //reportError
  37019. //
  37020. // @param recognizer the parser instance
  37021. // @param e the recognition exception
  37022. //
  37023. DefaultErrorStrategy.prototype.reportNoViableAlternative = function(recognizer, e) {
  37024. var tokens = recognizer.getTokenStream();
  37025. var input;
  37026. if(tokens !== null) {
  37027. if (e.startToken.type===Token.EOF) {
  37028. input = "<EOF>";
  37029. } else {
  37030. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  37031. }
  37032. } else {
  37033. input = "<unknown input>";
  37034. }
  37035. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  37036. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37037. };
  37038. //
  37039. // This is called by {@link //reportError} when the exception is an
  37040. // {@link InputMismatchException}.
  37041. //
  37042. // @see //reportError
  37043. //
  37044. // @param recognizer the parser instance
  37045. // @param e the recognition exception
  37046. //
  37047. DefaultErrorStrategy.prototype.reportInputMismatch = function(recognizer, e) {
  37048. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) +
  37049. " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  37050. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37051. };
  37052. //
  37053. // This is called by {@link //reportError} when the exception is a
  37054. // {@link FailedPredicateException}.
  37055. //
  37056. // @see //reportError
  37057. //
  37058. // @param recognizer the parser instance
  37059. // @param e the recognition exception
  37060. //
  37061. DefaultErrorStrategy.prototype.reportFailedPredicate = function(recognizer, e) {
  37062. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  37063. var msg = "rule " + ruleName + " " + e.message;
  37064. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37065. };
  37066. // This method is called to report a syntax error which requires the removal
  37067. // of a token from the input stream. At the time this method is called, the
  37068. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  37069. // removed from the input stream. When this method returns,
  37070. // {@code recognizer} is in error recovery mode.
  37071. //
  37072. // <p>This method is called when {@link //singleTokenDeletion} identifies
  37073. // single-token deletion as a viable recovery strategy for a mismatched
  37074. // input error.</p>
  37075. //
  37076. // <p>The default implementation simply returns if the handler is already in
  37077. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  37078. // enter error recovery mode, followed by calling
  37079. // {@link Parser//notifyErrorListeners}.</p>
  37080. //
  37081. // @param recognizer the parser instance
  37082. //
  37083. DefaultErrorStrategy.prototype.reportUnwantedToken = function(recognizer) {
  37084. if (this.inErrorRecoveryMode(recognizer)) {
  37085. return;
  37086. }
  37087. this.beginErrorCondition(recognizer);
  37088. var t = recognizer.getCurrentToken();
  37089. var tokenName = this.getTokenErrorDisplay(t);
  37090. var expecting = this.getExpectedTokens(recognizer);
  37091. var msg = "extraneous input " + tokenName + " expecting " +
  37092. expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  37093. recognizer.notifyErrorListeners(msg, t, null);
  37094. };
  37095. // This method is called to report a syntax error which requires the
  37096. // insertion of a missing token into the input stream. At the time this
  37097. // method is called, the missing token has not yet been inserted. When this
  37098. // method returns, {@code recognizer} is in error recovery mode.
  37099. //
  37100. // <p>This method is called when {@link //singleTokenInsertion} identifies
  37101. // single-token insertion as a viable recovery strategy for a mismatched
  37102. // input error.</p>
  37103. //
  37104. // <p>The default implementation simply returns if the handler is already in
  37105. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  37106. // enter error recovery mode, followed by calling
  37107. // {@link Parser//notifyErrorListeners}.</p>
  37108. //
  37109. // @param recognizer the parser instance
  37110. //
  37111. DefaultErrorStrategy.prototype.reportMissingToken = function(recognizer) {
  37112. if ( this.inErrorRecoveryMode(recognizer)) {
  37113. return;
  37114. }
  37115. this.beginErrorCondition(recognizer);
  37116. var t = recognizer.getCurrentToken();
  37117. var expecting = this.getExpectedTokens(recognizer);
  37118. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) +
  37119. " at " + this.getTokenErrorDisplay(t);
  37120. recognizer.notifyErrorListeners(msg, t, null);
  37121. };
  37122. // <p>The default implementation attempts to recover from the mismatched input
  37123. // by using single token insertion and deletion as described below. If the
  37124. // recovery attempt fails, this method throws an
  37125. // {@link InputMismatchException}.</p>
  37126. //
  37127. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  37128. //
  37129. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  37130. // right token, however, then assume {@code LA(1)} is some extra spurious
  37131. // token and delete it. Then consume and return the next token (which was
  37132. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  37133. //
  37134. // <p>This recovery strategy is implemented by {@link
  37135. // //singleTokenDeletion}.</p>
  37136. //
  37137. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  37138. //
  37139. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  37140. // after the expected {@code LA(1)} token, then assume the token is missing
  37141. // and use the parser's {@link TokenFactory} to create it on the fly. The
  37142. // "insertion" is performed by returning the created token as the successful
  37143. // result of the match operation.</p>
  37144. //
  37145. // <p>This recovery strategy is implemented by {@link
  37146. // //singleTokenInsertion}.</p>
  37147. //
  37148. // <p><strong>EXAMPLE</strong></p>
  37149. //
  37150. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  37151. // the parser returns from the nested call to {@code expr}, it will have
  37152. // call chain:</p>
  37153. //
  37154. // <pre>
  37155. // stat &rarr; expr &rarr; atom
  37156. // </pre>
  37157. //
  37158. // and it will be trying to match the {@code ')'} at this point in the
  37159. // derivation:
  37160. //
  37161. // <pre>
  37162. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  37163. // ^
  37164. // </pre>
  37165. //
  37166. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  37167. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  37168. // is in the set of tokens that can follow the {@code ')'} token reference
  37169. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  37170. //
  37171. DefaultErrorStrategy.prototype.recoverInline = function(recognizer) {
  37172. // SINGLE TOKEN DELETION
  37173. var matchedSymbol = this.singleTokenDeletion(recognizer);
  37174. if (matchedSymbol !== null) {
  37175. // we have deleted the extra token.
  37176. // now, move past ttype token as if all were ok
  37177. recognizer.consume();
  37178. return matchedSymbol;
  37179. }
  37180. // SINGLE TOKEN INSERTION
  37181. if (this.singleTokenInsertion(recognizer)) {
  37182. return this.getMissingSymbol(recognizer);
  37183. }
  37184. // even that didn't work; must throw the exception
  37185. throw new InputMismatchException(recognizer);
  37186. };
  37187. //
  37188. // This method implements the single-token insertion inline error recovery
  37189. // strategy. It is called by {@link //recoverInline} if the single-token
  37190. // deletion strategy fails to recover from the mismatched input. If this
  37191. // method returns {@code true}, {@code recognizer} will be in error recovery
  37192. // mode.
  37193. //
  37194. // <p>This method determines whether or not single-token insertion is viable by
  37195. // checking if the {@code LA(1)} input symbol could be successfully matched
  37196. // if it were instead the {@code LA(2)} symbol. If this method returns
  37197. // {@code true}, the caller is responsible for creating and inserting a
  37198. // token with the correct type to produce this behavior.</p>
  37199. //
  37200. // @param recognizer the parser instance
  37201. // @return {@code true} if single-token insertion is a viable recovery
  37202. // strategy for the current mismatched input, otherwise {@code false}
  37203. //
  37204. DefaultErrorStrategy.prototype.singleTokenInsertion = function(recognizer) {
  37205. var currentSymbolType = recognizer.getTokenStream().LA(1);
  37206. // if current token is consistent with what could come after current
  37207. // ATN state, then we know we're missing a token; error recovery
  37208. // is free to conjure up and insert the missing token
  37209. var atn = recognizer._interp.atn;
  37210. var currentState = atn.states[recognizer.state];
  37211. var next = currentState.transitions[0].target;
  37212. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  37213. if (expectingAtLL2.contains(currentSymbolType) ){
  37214. this.reportMissingToken(recognizer);
  37215. return true;
  37216. } else {
  37217. return false;
  37218. }
  37219. };
  37220. // This method implements the single-token deletion inline error recovery
  37221. // strategy. It is called by {@link //recoverInline} to attempt to recover
  37222. // from mismatched input. If this method returns null, the parser and error
  37223. // handler state will not have changed. If this method returns non-null,
  37224. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  37225. // returned token was a successful match.
  37226. //
  37227. // <p>If the single-token deletion is successful, this method calls
  37228. // {@link //reportUnwantedToken} to report the error, followed by
  37229. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  37230. // before returning {@link //reportMatch} is called to signal a successful
  37231. // match.</p>
  37232. //
  37233. // @param recognizer the parser instance
  37234. // @return the successfully matched {@link Token} instance if single-token
  37235. // deletion successfully recovers from the mismatched input, otherwise
  37236. // {@code null}
  37237. //
  37238. DefaultErrorStrategy.prototype.singleTokenDeletion = function(recognizer) {
  37239. var nextTokenType = recognizer.getTokenStream().LA(2);
  37240. var expecting = this.getExpectedTokens(recognizer);
  37241. if (expecting.contains(nextTokenType)) {
  37242. this.reportUnwantedToken(recognizer);
  37243. // print("recoverFromMismatchedToken deleting " \
  37244. // + str(recognizer.getTokenStream().LT(1)) \
  37245. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  37246. // + " is what we want", file=sys.stderr)
  37247. recognizer.consume(); // simply delete extra token
  37248. // we want to return the token we're actually matching
  37249. var matchedSymbol = recognizer.getCurrentToken();
  37250. this.reportMatch(recognizer); // we know current token is correct
  37251. return matchedSymbol;
  37252. } else {
  37253. return null;
  37254. }
  37255. };
  37256. // Conjure up a missing token during error recovery.
  37257. //
  37258. // The recognizer attempts to recover from single missing
  37259. // symbols. But, actions might refer to that missing symbol.
  37260. // For example, x=ID {f($x);}. The action clearly assumes
  37261. // that there has been an identifier matched previously and that
  37262. // $x points at that token. If that token is missing, but
  37263. // the next token in the stream is what we want we assume that
  37264. // this token is missing and we keep going. Because we
  37265. // have to return some token to replace the missing token,
  37266. // we have to conjure one up. This method gives the user control
  37267. // over the tokens returned for missing tokens. Mostly,
  37268. // you will want to create something special for identifier
  37269. // tokens. For literals such as '{' and ',', the default
  37270. // action in the parser or tree parser works. It simply creates
  37271. // a CommonToken of the appropriate type. The text will be the token.
  37272. // If you change what tokens must be created by the lexer,
  37273. // override this method to create the appropriate tokens.
  37274. //
  37275. DefaultErrorStrategy.prototype.getMissingSymbol = function(recognizer) {
  37276. var currentSymbol = recognizer.getCurrentToken();
  37277. var expecting = this.getExpectedTokens(recognizer);
  37278. var expectedTokenType = expecting.first(); // get any element
  37279. var tokenText;
  37280. if (expectedTokenType===Token.EOF) {
  37281. tokenText = "<missing EOF>";
  37282. } else {
  37283. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  37284. }
  37285. var current = currentSymbol;
  37286. var lookback = recognizer.getTokenStream().LT(-1);
  37287. if (current.type===Token.EOF && lookback !== null) {
  37288. current = lookback;
  37289. }
  37290. return recognizer.getTokenFactory().create(current.source,
  37291. expectedTokenType, tokenText, Token.DEFAULT_CHANNEL,
  37292. -1, -1, current.line, current.column);
  37293. };
  37294. DefaultErrorStrategy.prototype.getExpectedTokens = function(recognizer) {
  37295. return recognizer.getExpectedTokens();
  37296. };
  37297. // How should a token be displayed in an error message? The default
  37298. // is to display just the text, but during development you might
  37299. // want to have a lot of information spit out. Override in that case
  37300. // to use t.toString() (which, for CommonToken, dumps everything about
  37301. // the token). This is better than forcing you to override a method in
  37302. // your token objects because you don't have to go modify your lexer
  37303. // so that it creates a new Java type.
  37304. //
  37305. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function(t) {
  37306. if (t === null) {
  37307. return "<no token>";
  37308. }
  37309. var s = t.text;
  37310. if (s === null) {
  37311. if (t.type===Token.EOF) {
  37312. s = "<EOF>";
  37313. } else {
  37314. s = "<" + t.type + ">";
  37315. }
  37316. }
  37317. return this.escapeWSAndQuote(s);
  37318. };
  37319. DefaultErrorStrategy.prototype.escapeWSAndQuote = function(s) {
  37320. s = s.replace(/\n/g,"\\n");
  37321. s = s.replace(/\r/g,"\\r");
  37322. s = s.replace(/\t/g,"\\t");
  37323. return "'" + s + "'";
  37324. };
  37325. // Compute the error recovery set for the current rule. During
  37326. // rule invocation, the parser pushes the set of tokens that can
  37327. // follow that rule reference on the stack; this amounts to
  37328. // computing FIRST of what follows the rule reference in the
  37329. // enclosing rule. See LinearApproximator.FIRST().
  37330. // This local follow set only includes tokens
  37331. // from within the rule; i.e., the FIRST computation done by
  37332. // ANTLR stops at the end of a rule.
  37333. //
  37334. // EXAMPLE
  37335. //
  37336. // When you find a "no viable alt exception", the input is not
  37337. // consistent with any of the alternatives for rule r. The best
  37338. // thing to do is to consume tokens until you see something that
  37339. // can legally follow a call to r//or* any rule that called r.
  37340. // You don't want the exact set of viable next tokens because the
  37341. // input might just be missing a token--you might consume the
  37342. // rest of the input looking for one of the missing tokens.
  37343. //
  37344. // Consider grammar:
  37345. //
  37346. // a : '[' b ']'
  37347. // | '(' b ')'
  37348. // ;
  37349. // b : c '^' INT ;
  37350. // c : ID
  37351. // | INT
  37352. // ;
  37353. //
  37354. // At each rule invocation, the set of tokens that could follow
  37355. // that rule is pushed on a stack. Here are the various
  37356. // context-sensitive follow sets:
  37357. //
  37358. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  37359. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  37360. // FOLLOW(c_in_b) = FIRST('^') = '^'
  37361. //
  37362. // Upon erroneous input "[]", the call chain is
  37363. //
  37364. // a -> b -> c
  37365. //
  37366. // and, hence, the follow context stack is:
  37367. //
  37368. // depth follow set start of rule execution
  37369. // 0 <EOF> a (from main())
  37370. // 1 ']' b
  37371. // 2 '^' c
  37372. //
  37373. // Notice that ')' is not included, because b would have to have
  37374. // been called from a different context in rule a for ')' to be
  37375. // included.
  37376. //
  37377. // For error recovery, we cannot consider FOLLOW(c)
  37378. // (context-sensitive or otherwise). We need the combined set of
  37379. // all context-sensitive FOLLOW sets--the set of all tokens that
  37380. // could follow any reference in the call chain. We need to
  37381. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  37382. // we resync'd to that token, we'd consume until EOF. We need to
  37383. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  37384. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  37385. // not consume anything. After printing an error, rule c would
  37386. // return normally. Rule b would not find the required '^' though.
  37387. // At this point, it gets a mismatched token error and throws an
  37388. // exception (since LA(1) is not in the viable following token
  37389. // set). The rule exception handler tries to recover, but finds
  37390. // the same recovery set and doesn't consume anything. Rule b
  37391. // exits normally returning to rule a. Now it finds the ']' (and
  37392. // with the successful match exits errorRecovery mode).
  37393. //
  37394. // So, you can see that the parser walks up the call chain looking
  37395. // for the token that was a member of the recovery set.
  37396. //
  37397. // Errors are not generated in errorRecovery mode.
  37398. //
  37399. // ANTLR's error recovery mechanism is based upon original ideas:
  37400. //
  37401. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  37402. //
  37403. // and
  37404. //
  37405. // "A note on error recovery in recursive descent parsers":
  37406. // http://portal.acm.org/citation.cfm?id=947902.947905
  37407. //
  37408. // Later, Josef Grosch had some good ideas:
  37409. //
  37410. // "Efficient and Comfortable Error Recovery in Recursive Descent
  37411. // Parsers":
  37412. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  37413. //
  37414. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  37415. // at run-time upon error to avoid overhead during parsing.
  37416. //
  37417. DefaultErrorStrategy.prototype.getErrorRecoverySet = function(recognizer) {
  37418. var atn = recognizer._interp.atn;
  37419. var ctx = recognizer._ctx;
  37420. var recoverSet = new IntervalSet();
  37421. while (ctx !== null && ctx.invokingState>=0) {
  37422. // compute what follows who invoked us
  37423. var invokingState = atn.states[ctx.invokingState];
  37424. var rt = invokingState.transitions[0];
  37425. var follow = atn.nextTokens(rt.followState);
  37426. recoverSet.addSet(follow);
  37427. ctx = ctx.parentCtx;
  37428. }
  37429. recoverSet.removeOne(Token.EPSILON);
  37430. return recoverSet;
  37431. };
  37432. // Consume tokens until one matches the given token set.//
  37433. DefaultErrorStrategy.prototype.consumeUntil = function(recognizer, set) {
  37434. var ttype = recognizer.getTokenStream().LA(1);
  37435. while( ttype !== Token.EOF && !set.contains(ttype)) {
  37436. recognizer.consume();
  37437. ttype = recognizer.getTokenStream().LA(1);
  37438. }
  37439. };
  37440. //
  37441. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  37442. // by immediately canceling the parse operation with a
  37443. // {@link ParseCancellationException}. The implementation ensures that the
  37444. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  37445. // that were not completed prior to encountering the error.
  37446. //
  37447. // <p>
  37448. // This error strategy is useful in the following scenarios.</p>
  37449. //
  37450. // <ul>
  37451. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  37452. // stage of two-stage parsing to immediately terminate if an error is
  37453. // encountered, and immediately fall back to the second stage. In addition to
  37454. // avoiding wasted work by attempting to recover from errors here, the empty
  37455. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  37456. // the first stage.</li>
  37457. // <li><strong>Silent validation:</strong> When syntax errors are not being
  37458. // reported or logged, and the parse result is simply ignored if errors occur,
  37459. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  37460. // when the result will be ignored either way.</li>
  37461. // </ul>
  37462. //
  37463. // <p>
  37464. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  37465. //
  37466. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  37467. //
  37468. function BailErrorStrategy() {
  37469. DefaultErrorStrategy.call(this);
  37470. return this;
  37471. }
  37472. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  37473. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  37474. // Instead of recovering from exception {@code e}, re-throw it wrapped
  37475. // in a {@link ParseCancellationException} so it is not caught by the
  37476. // rule function catches. Use {@link Exception//getCause()} to get the
  37477. // original {@link RecognitionException}.
  37478. //
  37479. BailErrorStrategy.prototype.recover = function(recognizer, e) {
  37480. var context = recognizer._ctx;
  37481. while (context !== null) {
  37482. context.exception = e;
  37483. context = context.parentCtx;
  37484. }
  37485. throw new ParseCancellationException(e);
  37486. };
  37487. // Make sure we don't attempt to recover inline; if the parser
  37488. // successfully recovers, it won't throw an exception.
  37489. //
  37490. BailErrorStrategy.prototype.recoverInline = function(recognizer) {
  37491. this.recover(recognizer, new InputMismatchException(recognizer));
  37492. };
  37493. // Make sure we don't attempt to recover from problems in subrules.//
  37494. BailErrorStrategy.prototype.sync = function(recognizer) {
  37495. // pass
  37496. };
  37497. exports.BailErrorStrategy = BailErrorStrategy;
  37498. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  37499. /***/ }),
  37500. /***/ "./node_modules/antlr4/error/Errors.js":
  37501. /*!*********************************************!*\
  37502. !*** ./node_modules/antlr4/error/Errors.js ***!
  37503. \*********************************************/
  37504. /*! no static exports found */
  37505. /***/ (function(module, exports, __webpack_require__) {
  37506. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37507. * Use of this file is governed by the BSD 3-clause license that
  37508. * can be found in the LICENSE.txt file in the project root.
  37509. */
  37510. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  37511. // 3 kinds of errors: prediction errors, failed predicate errors, and
  37512. // mismatched input errors. In each case, the parser knows where it is
  37513. // in the input, where it is in the ATN, the rule invocation stack,
  37514. // and what kind of problem occurred.
  37515. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  37516. function RecognitionException(params) {
  37517. Error.call(this);
  37518. if (!!Error.captureStackTrace) {
  37519. Error.captureStackTrace(this, RecognitionException);
  37520. } else {
  37521. var stack = new Error().stack;
  37522. }
  37523. this.message = params.message;
  37524. this.recognizer = params.recognizer;
  37525. this.input = params.input;
  37526. this.ctx = params.ctx;
  37527. // The current {@link Token} when an error occurred. Since not all streams
  37528. // support accessing symbols by index, we have to track the {@link Token}
  37529. // instance itself.
  37530. this.offendingToken = null;
  37531. // Get the ATN state number the parser was in at the time the error
  37532. // occurred. For {@link NoViableAltException} and
  37533. // {@link LexerNoViableAltException} exceptions, this is the
  37534. // {@link DecisionState} number. For others, it is the state whose outgoing
  37535. // edge we couldn't match.
  37536. this.offendingState = -1;
  37537. if (this.recognizer!==null) {
  37538. this.offendingState = this.recognizer.state;
  37539. }
  37540. return this;
  37541. }
  37542. RecognitionException.prototype = Object.create(Error.prototype);
  37543. RecognitionException.prototype.constructor = RecognitionException;
  37544. // <p>If the state number is not known, this method returns -1.</p>
  37545. //
  37546. // Gets the set of input symbols which could potentially follow the
  37547. // previously matched symbol at the time this exception was thrown.
  37548. //
  37549. // <p>If the set of expected tokens is not known and could not be computed,
  37550. // this method returns {@code null}.</p>
  37551. //
  37552. // @return The set of token types that could potentially follow the current
  37553. // state in the ATN, or {@code null} if the information is not available.
  37554. // /
  37555. RecognitionException.prototype.getExpectedTokens = function() {
  37556. if (this.recognizer!==null) {
  37557. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  37558. } else {
  37559. return null;
  37560. }
  37561. };
  37562. RecognitionException.prototype.toString = function() {
  37563. return this.message;
  37564. };
  37565. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  37566. RecognitionException.call(this, {message:"", recognizer:lexer, input:input, ctx:null});
  37567. this.startIndex = startIndex;
  37568. this.deadEndConfigs = deadEndConfigs;
  37569. return this;
  37570. }
  37571. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  37572. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  37573. LexerNoViableAltException.prototype.toString = function() {
  37574. var symbol = "";
  37575. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  37576. symbol = this.input.getText((this.startIndex,this.startIndex));
  37577. }
  37578. return "LexerNoViableAltException" + symbol;
  37579. };
  37580. // Indicates that the parser could not decide which of two or more paths
  37581. // to take based upon the remaining input. It tracks the starting token
  37582. // of the offending input and also knows where the parser was
  37583. // in the various paths when the error. Reported by reportNoViableAlternative()
  37584. //
  37585. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  37586. ctx = ctx || recognizer._ctx;
  37587. offendingToken = offendingToken || recognizer.getCurrentToken();
  37588. startToken = startToken || recognizer.getCurrentToken();
  37589. input = input || recognizer.getInputStream();
  37590. RecognitionException.call(this, {message:"", recognizer:recognizer, input:input, ctx:ctx});
  37591. // Which configurations did we try at input.index() that couldn't match
  37592. // input.LT(1)?//
  37593. this.deadEndConfigs = deadEndConfigs;
  37594. // The token object at the start index; the input stream might
  37595. // not be buffering tokens so get a reference to it. (At the
  37596. // time the error occurred, of course the stream needs to keep a
  37597. // buffer all of the tokens but later we might not have access to those.)
  37598. this.startToken = startToken;
  37599. this.offendingToken = offendingToken;
  37600. }
  37601. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  37602. NoViableAltException.prototype.constructor = NoViableAltException;
  37603. // This signifies any kind of mismatched input exceptions such as
  37604. // when the current input does not match the expected token.
  37605. //
  37606. function InputMismatchException(recognizer) {
  37607. RecognitionException.call(this, {message:"", recognizer:recognizer, input:recognizer.getInputStream(), ctx:recognizer._ctx});
  37608. this.offendingToken = recognizer.getCurrentToken();
  37609. }
  37610. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  37611. InputMismatchException.prototype.constructor = InputMismatchException;
  37612. // A semantic predicate failed during validation. Validation of predicates
  37613. // occurs when normally parsing the alternative just like matching a token.
  37614. // Disambiguating predicate evaluation occurs when we test a predicate during
  37615. // prediction.
  37616. function FailedPredicateException(recognizer, predicate, message) {
  37617. RecognitionException.call(this, {message:this.formatMessage(predicate,message || null), recognizer:recognizer,
  37618. input:recognizer.getInputStream(), ctx:recognizer._ctx});
  37619. var s = recognizer._interp.atn.states[recognizer.state];
  37620. var trans = s.transitions[0];
  37621. if (trans instanceof PredicateTransition) {
  37622. this.ruleIndex = trans.ruleIndex;
  37623. this.predicateIndex = trans.predIndex;
  37624. } else {
  37625. this.ruleIndex = 0;
  37626. this.predicateIndex = 0;
  37627. }
  37628. this.predicate = predicate;
  37629. this.offendingToken = recognizer.getCurrentToken();
  37630. return this;
  37631. }
  37632. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  37633. FailedPredicateException.prototype.constructor = FailedPredicateException;
  37634. FailedPredicateException.prototype.formatMessage = function(predicate, message) {
  37635. if (message !==null) {
  37636. return message;
  37637. } else {
  37638. return "failed predicate: {" + predicate + "}?";
  37639. }
  37640. };
  37641. function ParseCancellationException() {
  37642. Error.call(this);
  37643. Error.captureStackTrace(this, ParseCancellationException);
  37644. return this;
  37645. }
  37646. ParseCancellationException.prototype = Object.create(Error.prototype);
  37647. ParseCancellationException.prototype.constructor = ParseCancellationException;
  37648. exports.RecognitionException = RecognitionException;
  37649. exports.NoViableAltException = NoViableAltException;
  37650. exports.LexerNoViableAltException = LexerNoViableAltException;
  37651. exports.InputMismatchException = InputMismatchException;
  37652. exports.FailedPredicateException = FailedPredicateException;
  37653. exports.ParseCancellationException = ParseCancellationException;
  37654. /***/ }),
  37655. /***/ "./node_modules/antlr4/error/index.js":
  37656. /*!********************************************!*\
  37657. !*** ./node_modules/antlr4/error/index.js ***!
  37658. \********************************************/
  37659. /*! no static exports found */
  37660. /***/ (function(module, exports, __webpack_require__) {
  37661. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37662. * Use of this file is governed by the BSD 3-clause license that
  37663. * can be found in the LICENSE.txt file in the project root.
  37664. */
  37665. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  37666. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  37667. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  37668. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  37669. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  37670. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  37671. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  37672. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  37673. /***/ }),
  37674. /***/ "./node_modules/antlr4/index.js":
  37675. /*!**************************************!*\
  37676. !*** ./node_modules/antlr4/index.js ***!
  37677. \**************************************/
  37678. /*! no static exports found */
  37679. /***/ (function(module, exports, __webpack_require__) {
  37680. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37681. * Use of this file is governed by the BSD 3-clause license that
  37682. * can be found in the LICENSE.txt file in the project root.
  37683. */
  37684. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  37685. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  37686. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  37687. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  37688. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  37689. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  37690. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  37691. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  37692. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  37693. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  37694. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  37695. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  37696. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  37697. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  37698. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  37699. exports.PredictionContextCache = pc.PredictionContextCache;
  37700. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  37701. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  37702. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  37703. /***/ }),
  37704. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  37705. /*!******************************************************!*\
  37706. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  37707. \******************************************************/
  37708. /*! no static exports found */
  37709. /***/ (function(module, exports) {
  37710. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  37711. if (!String.prototype.codePointAt) {
  37712. (function() {
  37713. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  37714. var defineProperty = (function() {
  37715. // IE 8 only supports `Object.defineProperty` on DOM elements
  37716. try {
  37717. var object = {};
  37718. var $defineProperty = Object.defineProperty;
  37719. var result = $defineProperty(object, object, object) && $defineProperty;
  37720. } catch(error) {}
  37721. return result;
  37722. }());
  37723. var codePointAt = function(position) {
  37724. if (this == null) {
  37725. throw TypeError();
  37726. }
  37727. var string = String(this);
  37728. var size = string.length;
  37729. // `ToInteger`
  37730. var index = position ? Number(position) : 0;
  37731. if (index != index) { // better `isNaN`
  37732. index = 0;
  37733. }
  37734. // Account for out-of-bounds indices:
  37735. if (index < 0 || index >= size) {
  37736. return undefined;
  37737. }
  37738. // Get the first code unit
  37739. var first = string.charCodeAt(index);
  37740. var second;
  37741. if ( // check if it’s the start of a surrogate pair
  37742. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  37743. size > index + 1 // there is a next code unit
  37744. ) {
  37745. second = string.charCodeAt(index + 1);
  37746. if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
  37747. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  37748. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  37749. }
  37750. }
  37751. return first;
  37752. };
  37753. if (defineProperty) {
  37754. defineProperty(String.prototype, 'codePointAt', {
  37755. 'value': codePointAt,
  37756. 'configurable': true,
  37757. 'writable': true
  37758. });
  37759. } else {
  37760. String.prototype.codePointAt = codePointAt;
  37761. }
  37762. }());
  37763. }
  37764. /***/ }),
  37765. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  37766. /*!********************************************************!*\
  37767. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  37768. \********************************************************/
  37769. /*! no static exports found */
  37770. /***/ (function(module, exports) {
  37771. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  37772. if (!String.fromCodePoint) {
  37773. (function() {
  37774. var defineProperty = (function() {
  37775. // IE 8 only supports `Object.defineProperty` on DOM elements
  37776. try {
  37777. var object = {};
  37778. var $defineProperty = Object.defineProperty;
  37779. var result = $defineProperty(object, object, object) && $defineProperty;
  37780. } catch(error) {}
  37781. return result;
  37782. }());
  37783. var stringFromCharCode = String.fromCharCode;
  37784. var floor = Math.floor;
  37785. var fromCodePoint = function(_) {
  37786. var MAX_SIZE = 0x4000;
  37787. var codeUnits = [];
  37788. var highSurrogate;
  37789. var lowSurrogate;
  37790. var index = -1;
  37791. var length = arguments.length;
  37792. if (!length) {
  37793. return '';
  37794. }
  37795. var result = '';
  37796. while (++index < length) {
  37797. var codePoint = Number(arguments[index]);
  37798. if (
  37799. !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  37800. codePoint < 0 || // not a valid Unicode code point
  37801. codePoint > 0x10FFFF || // not a valid Unicode code point
  37802. floor(codePoint) != codePoint // not an integer
  37803. ) {
  37804. throw RangeError('Invalid code point: ' + codePoint);
  37805. }
  37806. if (codePoint <= 0xFFFF) { // BMP code point
  37807. codeUnits.push(codePoint);
  37808. } else { // Astral code point; split in surrogate halves
  37809. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  37810. codePoint -= 0x10000;
  37811. highSurrogate = (codePoint >> 10) + 0xD800;
  37812. lowSurrogate = (codePoint % 0x400) + 0xDC00;
  37813. codeUnits.push(highSurrogate, lowSurrogate);
  37814. }
  37815. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  37816. result += stringFromCharCode.apply(null, codeUnits);
  37817. codeUnits.length = 0;
  37818. }
  37819. }
  37820. return result;
  37821. };
  37822. if (defineProperty) {
  37823. defineProperty(String, 'fromCodePoint', {
  37824. 'value': fromCodePoint,
  37825. 'configurable': true,
  37826. 'writable': true
  37827. });
  37828. } else {
  37829. String.fromCodePoint = fromCodePoint;
  37830. }
  37831. }());
  37832. }
  37833. /***/ }),
  37834. /***/ "./node_modules/antlr4/tree/Tree.js":
  37835. /*!******************************************!*\
  37836. !*** ./node_modules/antlr4/tree/Tree.js ***!
  37837. \******************************************/
  37838. /*! no static exports found */
  37839. /***/ (function(module, exports, __webpack_require__) {
  37840. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37841. * Use of this file is governed by the BSD 3-clause license that
  37842. * can be found in the LICENSE.txt file in the project root.
  37843. */
  37844. ///
  37845. // The basic notion of a tree has a parent, a payload, and a list of children.
  37846. // It is the most abstract interface for all the trees used by ANTLR.
  37847. ///
  37848. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  37849. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  37850. var INVALID_INTERVAL = new Interval(-1, -2);
  37851. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  37852. function Tree() {
  37853. return this;
  37854. }
  37855. function SyntaxTree() {
  37856. Tree.call(this);
  37857. return this;
  37858. }
  37859. SyntaxTree.prototype = Object.create(Tree.prototype);
  37860. SyntaxTree.prototype.constructor = SyntaxTree;
  37861. function ParseTree() {
  37862. SyntaxTree.call(this);
  37863. return this;
  37864. }
  37865. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  37866. ParseTree.prototype.constructor = ParseTree;
  37867. function RuleNode() {
  37868. ParseTree.call(this);
  37869. return this;
  37870. }
  37871. RuleNode.prototype = Object.create(ParseTree.prototype);
  37872. RuleNode.prototype.constructor = RuleNode;
  37873. function TerminalNode() {
  37874. ParseTree.call(this);
  37875. return this;
  37876. }
  37877. TerminalNode.prototype = Object.create(ParseTree.prototype);
  37878. TerminalNode.prototype.constructor = TerminalNode;
  37879. function ErrorNode() {
  37880. TerminalNode.call(this);
  37881. return this;
  37882. }
  37883. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  37884. ErrorNode.prototype.constructor = ErrorNode;
  37885. function ParseTreeVisitor() {
  37886. return this;
  37887. }
  37888. ParseTreeVisitor.prototype.visit = function(ctx) {
  37889. if (Array.isArray(ctx)) {
  37890. return ctx.map(function(child) {
  37891. return child.accept(this);
  37892. }, this);
  37893. } else {
  37894. return ctx.accept(this);
  37895. }
  37896. };
  37897. ParseTreeVisitor.prototype.visitChildren = function(ctx) {
  37898. return this.visit(ctx.children);
  37899. }
  37900. ParseTreeVisitor.prototype.visitTerminal = function(node) {
  37901. };
  37902. ParseTreeVisitor.prototype.visitErrorNode = function(node) {
  37903. };
  37904. function ParseTreeListener() {
  37905. return this;
  37906. }
  37907. ParseTreeListener.prototype.visitTerminal = function(node) {
  37908. };
  37909. ParseTreeListener.prototype.visitErrorNode = function(node) {
  37910. };
  37911. ParseTreeListener.prototype.enterEveryRule = function(node) {
  37912. };
  37913. ParseTreeListener.prototype.exitEveryRule = function(node) {
  37914. };
  37915. function TerminalNodeImpl(symbol) {
  37916. TerminalNode.call(this);
  37917. this.parentCtx = null;
  37918. this.symbol = symbol;
  37919. return this;
  37920. }
  37921. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  37922. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  37923. TerminalNodeImpl.prototype.getChild = function(i) {
  37924. return null;
  37925. };
  37926. TerminalNodeImpl.prototype.getSymbol = function() {
  37927. return this.symbol;
  37928. };
  37929. TerminalNodeImpl.prototype.getParent = function() {
  37930. return this.parentCtx;
  37931. };
  37932. TerminalNodeImpl.prototype.getPayload = function() {
  37933. return this.symbol;
  37934. };
  37935. TerminalNodeImpl.prototype.getSourceInterval = function() {
  37936. if (this.symbol === null) {
  37937. return INVALID_INTERVAL;
  37938. }
  37939. var tokenIndex = this.symbol.tokenIndex;
  37940. return new Interval(tokenIndex, tokenIndex);
  37941. };
  37942. TerminalNodeImpl.prototype.getChildCount = function() {
  37943. return 0;
  37944. };
  37945. TerminalNodeImpl.prototype.accept = function(visitor) {
  37946. return visitor.visitTerminal(this);
  37947. };
  37948. TerminalNodeImpl.prototype.getText = function() {
  37949. return this.symbol.text;
  37950. };
  37951. TerminalNodeImpl.prototype.toString = function() {
  37952. if (this.symbol.type === Token.EOF) {
  37953. return "<EOF>";
  37954. } else {
  37955. return this.symbol.text;
  37956. }
  37957. };
  37958. // Represents a token that was consumed during resynchronization
  37959. // rather than during a valid match operation. For example,
  37960. // we will create this kind of a node during single token insertion
  37961. // and deletion as well as during "consume until error recovery set"
  37962. // upon no viable alternative exceptions.
  37963. function ErrorNodeImpl(token) {
  37964. TerminalNodeImpl.call(this, token);
  37965. return this;
  37966. }
  37967. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  37968. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  37969. ErrorNodeImpl.prototype.isErrorNode = function() {
  37970. return true;
  37971. };
  37972. ErrorNodeImpl.prototype.accept = function(visitor) {
  37973. return visitor.visitErrorNode(this);
  37974. };
  37975. function ParseTreeWalker() {
  37976. return this;
  37977. }
  37978. ParseTreeWalker.prototype.walk = function(listener, t) {
  37979. var errorNode = t instanceof ErrorNode ||
  37980. (t.isErrorNode !== undefined && t.isErrorNode());
  37981. if (errorNode) {
  37982. listener.visitErrorNode(t);
  37983. } else if (t instanceof TerminalNode) {
  37984. listener.visitTerminal(t);
  37985. } else {
  37986. this.enterRule(listener, t);
  37987. for (var i = 0; i < t.getChildCount(); i++) {
  37988. var child = t.getChild(i);
  37989. this.walk(listener, child);
  37990. }
  37991. this.exitRule(listener, t);
  37992. }
  37993. };
  37994. //
  37995. // The discovery of a rule node, involves sending two events: the generic
  37996. // {@link ParseTreeListener//enterEveryRule} and a
  37997. // {@link RuleContext}-specific event. First we trigger the generic and then
  37998. // the rule specific. We to them in reverse order upon finishing the node.
  37999. //
  38000. ParseTreeWalker.prototype.enterRule = function(listener, r) {
  38001. var ctx = r.getRuleContext();
  38002. listener.enterEveryRule(ctx);
  38003. ctx.enterRule(listener);
  38004. };
  38005. ParseTreeWalker.prototype.exitRule = function(listener, r) {
  38006. var ctx = r.getRuleContext();
  38007. ctx.exitRule(listener);
  38008. listener.exitEveryRule(ctx);
  38009. };
  38010. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  38011. exports.RuleNode = RuleNode;
  38012. exports.ErrorNode = ErrorNode;
  38013. exports.TerminalNode = TerminalNode;
  38014. exports.ErrorNodeImpl = ErrorNodeImpl;
  38015. exports.TerminalNodeImpl = TerminalNodeImpl;
  38016. exports.ParseTreeListener = ParseTreeListener;
  38017. exports.ParseTreeVisitor = ParseTreeVisitor;
  38018. exports.ParseTreeWalker = ParseTreeWalker;
  38019. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  38020. /***/ }),
  38021. /***/ "./node_modules/antlr4/tree/Trees.js":
  38022. /*!*******************************************!*\
  38023. !*** ./node_modules/antlr4/tree/Trees.js ***!
  38024. \*******************************************/
  38025. /*! no static exports found */
  38026. /***/ (function(module, exports, __webpack_require__) {
  38027. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38028. * Use of this file is governed by the BSD 3-clause license that
  38029. * can be found in the LICENSE.txt file in the project root.
  38030. */
  38031. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  38032. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  38033. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  38034. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  38035. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  38036. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  38037. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  38038. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  38039. /** A set of utility routines useful for all kinds of ANTLR trees. */
  38040. function Trees() {
  38041. }
  38042. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  38043. // node payloads to get the text for the nodes. Detect
  38044. // parse trees and extract data appropriately.
  38045. Trees.toStringTree = function(tree, ruleNames, recog) {
  38046. ruleNames = ruleNames || null;
  38047. recog = recog || null;
  38048. if(recog!==null) {
  38049. ruleNames = recog.ruleNames;
  38050. }
  38051. var s = Trees.getNodeText(tree, ruleNames);
  38052. s = Utils.escapeWhitespace(s, false);
  38053. var c = tree.getChildCount();
  38054. if(c===0) {
  38055. return s;
  38056. }
  38057. var res = "(" + s + ' ';
  38058. if(c>0) {
  38059. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  38060. res = res.concat(s);
  38061. }
  38062. for(var i=1;i<c;i++) {
  38063. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  38064. res = res.concat(' ' + s);
  38065. }
  38066. res = res.concat(")");
  38067. return res;
  38068. };
  38069. Trees.getNodeText = function(t, ruleNames, recog) {
  38070. ruleNames = ruleNames || null;
  38071. recog = recog || null;
  38072. if(recog!==null) {
  38073. ruleNames = recog.ruleNames;
  38074. }
  38075. if(ruleNames!==null) {
  38076. if (t instanceof RuleContext) {
  38077. var altNumber = t.getAltNumber();
  38078. if ( altNumber!=INVALID_ALT_NUMBER ) {
  38079. return ruleNames[t.ruleIndex]+":"+altNumber;
  38080. }
  38081. return ruleNames[t.ruleIndex];
  38082. } else if ( t instanceof ErrorNode) {
  38083. return t.toString();
  38084. } else if(t instanceof TerminalNode) {
  38085. if(t.symbol!==null) {
  38086. return t.symbol.text;
  38087. }
  38088. }
  38089. }
  38090. // no recog for rule names
  38091. var payload = t.getPayload();
  38092. if (payload instanceof Token ) {
  38093. return payload.text;
  38094. }
  38095. return t.getPayload().toString();
  38096. };
  38097. // Return ordered list of all children of this node
  38098. Trees.getChildren = function(t) {
  38099. var list = [];
  38100. for(var i=0;i<t.getChildCount();i++) {
  38101. list.push(t.getChild(i));
  38102. }
  38103. return list;
  38104. };
  38105. // Return a list of all ancestors of this node. The first node of
  38106. // list is the root and the last is the parent of this node.
  38107. //
  38108. Trees.getAncestors = function(t) {
  38109. var ancestors = [];
  38110. t = t.getParent();
  38111. while(t!==null) {
  38112. ancestors = [t].concat(ancestors);
  38113. t = t.getParent();
  38114. }
  38115. return ancestors;
  38116. };
  38117. Trees.findAllTokenNodes = function(t, ttype) {
  38118. return Trees.findAllNodes(t, ttype, true);
  38119. };
  38120. Trees.findAllRuleNodes = function(t, ruleIndex) {
  38121. return Trees.findAllNodes(t, ruleIndex, false);
  38122. };
  38123. Trees.findAllNodes = function(t, index, findTokens) {
  38124. var nodes = [];
  38125. Trees._findAllNodes(t, index, findTokens, nodes);
  38126. return nodes;
  38127. };
  38128. Trees._findAllNodes = function(t, index, findTokens, nodes) {
  38129. // check this node (the root) first
  38130. if(findTokens && (t instanceof TerminalNode)) {
  38131. if(t.symbol.type===index) {
  38132. nodes.push(t);
  38133. }
  38134. } else if(!findTokens && (t instanceof ParserRuleContext)) {
  38135. if(t.ruleIndex===index) {
  38136. nodes.push(t);
  38137. }
  38138. }
  38139. // check children
  38140. for(var i=0;i<t.getChildCount();i++) {
  38141. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  38142. }
  38143. };
  38144. Trees.descendants = function(t) {
  38145. var nodes = [t];
  38146. for(var i=0;i<t.getChildCount();i++) {
  38147. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  38148. }
  38149. return nodes;
  38150. };
  38151. exports.Trees = Trees;
  38152. /***/ }),
  38153. /***/ "./node_modules/antlr4/tree/index.js":
  38154. /*!*******************************************!*\
  38155. !*** ./node_modules/antlr4/tree/index.js ***!
  38156. \*******************************************/
  38157. /*! no static exports found */
  38158. /***/ (function(module, exports, __webpack_require__) {
  38159. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38160. * Use of this file is governed by the BSD 3-clause license that
  38161. * can be found in the LICENSE.txt file in the project root.
  38162. */
  38163. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  38164. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  38165. exports.RuleNode = Tree.RuleNode;
  38166. exports.ParseTreeListener = Tree.ParseTreeListener;
  38167. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  38168. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  38169. /***/ }),
  38170. /***/ "./node_modules/decimal.js/decimal.js":
  38171. /*!********************************************!*\
  38172. !*** ./node_modules/decimal.js/decimal.js ***!
  38173. \********************************************/
  38174. /*! no static exports found */
  38175. /***/ (function(module, exports, __webpack_require__) {
  38176. var __WEBPACK_AMD_DEFINE_RESULT__;/*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  38177. ;(function (globalScope) {
  38178. 'use strict';
  38179. /*
  38180. * decimal.js v10.0.1
  38181. * An arbitrary-precision Decimal type for JavaScript.
  38182. * https://github.com/MikeMcl/decimal.js
  38183. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  38184. * MIT Licence
  38185. */
  38186. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  38187. // The maximum exponent magnitude.
  38188. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  38189. var EXP_LIMIT = 9e15, // 0 to 9e15
  38190. // The limit on the value of `precision`, and on the value of the first argument to
  38191. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  38192. MAX_DIGITS = 1e9, // 0 to 1e9
  38193. // Base conversion alphabet.
  38194. NUMERALS = '0123456789abcdef',
  38195. // The natural logarithm of 10 (1025 digits).
  38196. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  38197. // Pi (1025 digits).
  38198. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  38199. // The initial configuration properties of the Decimal constructor.
  38200. DEFAULTS = {
  38201. // These values must be integers within the stated ranges (inclusive).
  38202. // Most of these values can be changed at run-time using the `Decimal.config` method.
  38203. // The maximum number of significant digits of the result of a calculation or base conversion.
  38204. // E.g. `Decimal.config({ precision: 20 });`
  38205. precision: 20, // 1 to MAX_DIGITS
  38206. // The rounding mode used when rounding to `precision`.
  38207. //
  38208. // ROUND_UP 0 Away from zero.
  38209. // ROUND_DOWN 1 Towards zero.
  38210. // ROUND_CEIL 2 Towards +Infinity.
  38211. // ROUND_FLOOR 3 Towards -Infinity.
  38212. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  38213. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  38214. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  38215. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  38216. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  38217. //
  38218. // E.g.
  38219. // `Decimal.rounding = 4;`
  38220. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  38221. rounding: 4, // 0 to 8
  38222. // The modulo mode used when calculating the modulus: a mod n.
  38223. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  38224. // The remainder (r) is calculated as: r = a - n * q.
  38225. //
  38226. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  38227. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  38228. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  38229. // HALF_EVEN 6 The IEEE 754 remainder function.
  38230. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  38231. //
  38232. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  38233. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  38234. // be used, but they may not give useful results.
  38235. modulo: 1, // 0 to 9
  38236. // The exponent value at and beneath which `toString` returns exponential notation.
  38237. // JavaScript numbers: -7
  38238. toExpNeg: -7, // 0 to -EXP_LIMIT
  38239. // The exponent value at and above which `toString` returns exponential notation.
  38240. // JavaScript numbers: 21
  38241. toExpPos: 21, // 0 to EXP_LIMIT
  38242. // The minimum exponent value, beneath which underflow to zero occurs.
  38243. // JavaScript numbers: -324 (5e-324)
  38244. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  38245. // The maximum exponent value, above which overflow to Infinity occurs.
  38246. // JavaScript numbers: 308 (1.7976931348623157e+308)
  38247. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  38248. // Whether to use cryptographically-secure random number generation, if available.
  38249. crypto: false // true/false
  38250. },
  38251. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  38252. Decimal, inexact, noConflict, quadrant,
  38253. external = true,
  38254. decimalError = '[DecimalError] ',
  38255. invalidArgument = decimalError + 'Invalid argument: ',
  38256. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  38257. cryptoUnavailable = decimalError + 'crypto unavailable',
  38258. mathfloor = Math.floor,
  38259. mathpow = Math.pow,
  38260. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  38261. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  38262. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  38263. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  38264. BASE = 1e7,
  38265. LOG_BASE = 7,
  38266. MAX_SAFE_INTEGER = 9007199254740991,
  38267. LN10_PRECISION = LN10.length - 1,
  38268. PI_PRECISION = PI.length - 1,
  38269. // Decimal.prototype object
  38270. P = { name: '[object Decimal]' };
  38271. // Decimal prototype methods
  38272. /*
  38273. * absoluteValue abs
  38274. * ceil
  38275. * comparedTo cmp
  38276. * cosine cos
  38277. * cubeRoot cbrt
  38278. * decimalPlaces dp
  38279. * dividedBy div
  38280. * dividedToIntegerBy divToInt
  38281. * equals eq
  38282. * floor
  38283. * greaterThan gt
  38284. * greaterThanOrEqualTo gte
  38285. * hyperbolicCosine cosh
  38286. * hyperbolicSine sinh
  38287. * hyperbolicTangent tanh
  38288. * inverseCosine acos
  38289. * inverseHyperbolicCosine acosh
  38290. * inverseHyperbolicSine asinh
  38291. * inverseHyperbolicTangent atanh
  38292. * inverseSine asin
  38293. * inverseTangent atan
  38294. * isFinite
  38295. * isInteger isInt
  38296. * isNaN
  38297. * isNegative isNeg
  38298. * isPositive isPos
  38299. * isZero
  38300. * lessThan lt
  38301. * lessThanOrEqualTo lte
  38302. * logarithm log
  38303. * [maximum] [max]
  38304. * [minimum] [min]
  38305. * minus sub
  38306. * modulo mod
  38307. * naturalExponential exp
  38308. * naturalLogarithm ln
  38309. * negated neg
  38310. * plus add
  38311. * precision sd
  38312. * round
  38313. * sine sin
  38314. * squareRoot sqrt
  38315. * tangent tan
  38316. * times mul
  38317. * toBinary
  38318. * toDecimalPlaces toDP
  38319. * toExponential
  38320. * toFixed
  38321. * toFraction
  38322. * toHexadecimal toHex
  38323. * toNearest
  38324. * toNumber
  38325. * toOctal
  38326. * toPower pow
  38327. * toPrecision
  38328. * toSignificantDigits toSD
  38329. * toString
  38330. * truncated trunc
  38331. * valueOf toJSON
  38332. */
  38333. /*
  38334. * Return a new Decimal whose value is the absolute value of this Decimal.
  38335. *
  38336. */
  38337. P.absoluteValue = P.abs = function () {
  38338. var x = new this.constructor(this);
  38339. if (x.s < 0) x.s = 1;
  38340. return finalise(x);
  38341. };
  38342. /*
  38343. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  38344. * direction of positive Infinity.
  38345. *
  38346. */
  38347. P.ceil = function () {
  38348. return finalise(new this.constructor(this), this.e + 1, 2);
  38349. };
  38350. /*
  38351. * Return
  38352. * 1 if the value of this Decimal is greater than the value of `y`,
  38353. * -1 if the value of this Decimal is less than the value of `y`,
  38354. * 0 if they have the same value,
  38355. * NaN if the value of either Decimal is NaN.
  38356. *
  38357. */
  38358. P.comparedTo = P.cmp = function (y) {
  38359. var i, j, xdL, ydL,
  38360. x = this,
  38361. xd = x.d,
  38362. yd = (y = new x.constructor(y)).d,
  38363. xs = x.s,
  38364. ys = y.s;
  38365. // Either NaN or ±Infinity?
  38366. if (!xd || !yd) {
  38367. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  38368. }
  38369. // Either zero?
  38370. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  38371. // Signs differ?
  38372. if (xs !== ys) return xs;
  38373. // Compare exponents.
  38374. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  38375. xdL = xd.length;
  38376. ydL = yd.length;
  38377. // Compare digit by digit.
  38378. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  38379. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  38380. }
  38381. // Compare lengths.
  38382. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  38383. };
  38384. /*
  38385. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  38386. *
  38387. * Domain: [-Infinity, Infinity]
  38388. * Range: [-1, 1]
  38389. *
  38390. * cos(0) = 1
  38391. * cos(-0) = 1
  38392. * cos(Infinity) = NaN
  38393. * cos(-Infinity) = NaN
  38394. * cos(NaN) = NaN
  38395. *
  38396. */
  38397. P.cosine = P.cos = function () {
  38398. var pr, rm,
  38399. x = this,
  38400. Ctor = x.constructor;
  38401. if (!x.d) return new Ctor(NaN);
  38402. // cos(0) = cos(-0) = 1
  38403. if (!x.d[0]) return new Ctor(1);
  38404. pr = Ctor.precision;
  38405. rm = Ctor.rounding;
  38406. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  38407. Ctor.rounding = 1;
  38408. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  38409. Ctor.precision = pr;
  38410. Ctor.rounding = rm;
  38411. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  38412. };
  38413. /*
  38414. *
  38415. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  38416. * `precision` significant digits using rounding mode `rounding`.
  38417. *
  38418. * cbrt(0) = 0
  38419. * cbrt(-0) = -0
  38420. * cbrt(1) = 1
  38421. * cbrt(-1) = -1
  38422. * cbrt(N) = N
  38423. * cbrt(-I) = -I
  38424. * cbrt(I) = I
  38425. *
  38426. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  38427. *
  38428. */
  38429. P.cubeRoot = P.cbrt = function () {
  38430. var e, m, n, r, rep, s, sd, t, t3, t3plusx,
  38431. x = this,
  38432. Ctor = x.constructor;
  38433. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  38434. external = false;
  38435. // Initial estimate.
  38436. s = x.s * Math.pow(x.s * x, 1 / 3);
  38437. // Math.cbrt underflow/overflow?
  38438. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  38439. if (!s || Math.abs(s) == 1 / 0) {
  38440. n = digitsToString(x.d);
  38441. e = x.e;
  38442. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  38443. if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00');
  38444. s = Math.pow(n, 1 / 3);
  38445. // Rarely, e may be one less than the result exponent value.
  38446. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  38447. if (s == 1 / 0) {
  38448. n = '5e' + e;
  38449. } else {
  38450. n = s.toExponential();
  38451. n = n.slice(0, n.indexOf('e') + 1) + e;
  38452. }
  38453. r = new Ctor(n);
  38454. r.s = x.s;
  38455. } else {
  38456. r = new Ctor(s.toString());
  38457. }
  38458. sd = (e = Ctor.precision) + 3;
  38459. // Halley's method.
  38460. // TODO? Compare Newton's method.
  38461. for (;;) {
  38462. t = r;
  38463. t3 = t.times(t).times(t);
  38464. t3plusx = t3.plus(x);
  38465. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  38466. // TODO? Replace with for-loop and checkRoundingDigits.
  38467. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  38468. n = n.slice(sd - 3, sd + 1);
  38469. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  38470. // , i.e. approaching a rounding boundary, continue the iteration.
  38471. if (n == '9999' || !rep && n == '4999') {
  38472. // On the first iteration only, check to see if rounding up gives the exact result as the
  38473. // nines may infinitely repeat.
  38474. if (!rep) {
  38475. finalise(t, e + 1, 0);
  38476. if (t.times(t).times(t).eq(x)) {
  38477. r = t;
  38478. break;
  38479. }
  38480. }
  38481. sd += 4;
  38482. rep = 1;
  38483. } else {
  38484. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  38485. // If not, then there are further digits and m will be truthy.
  38486. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  38487. // Truncate to the first rounding digit.
  38488. finalise(r, e + 1, 1);
  38489. m = !r.times(r).times(r).eq(x);
  38490. }
  38491. break;
  38492. }
  38493. }
  38494. }
  38495. external = true;
  38496. return finalise(r, e, Ctor.rounding, m);
  38497. };
  38498. /*
  38499. * Return the number of decimal places of the value of this Decimal.
  38500. *
  38501. */
  38502. P.decimalPlaces = P.dp = function () {
  38503. var w,
  38504. d = this.d,
  38505. n = NaN;
  38506. if (d) {
  38507. w = d.length - 1;
  38508. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  38509. // Subtract the number of trailing zeros of the last word.
  38510. w = d[w];
  38511. if (w) for (; w % 10 == 0; w /= 10) n--;
  38512. if (n < 0) n = 0;
  38513. }
  38514. return n;
  38515. };
  38516. /*
  38517. * n / 0 = I
  38518. * n / N = N
  38519. * n / I = 0
  38520. * 0 / n = 0
  38521. * 0 / 0 = N
  38522. * 0 / N = N
  38523. * 0 / I = 0
  38524. * N / n = N
  38525. * N / 0 = N
  38526. * N / N = N
  38527. * N / I = N
  38528. * I / n = I
  38529. * I / 0 = I
  38530. * I / N = N
  38531. * I / I = N
  38532. *
  38533. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  38534. * `precision` significant digits using rounding mode `rounding`.
  38535. *
  38536. */
  38537. P.dividedBy = P.div = function (y) {
  38538. return divide(this, new this.constructor(y));
  38539. };
  38540. /*
  38541. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  38542. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  38543. *
  38544. */
  38545. P.dividedToIntegerBy = P.divToInt = function (y) {
  38546. var x = this,
  38547. Ctor = x.constructor;
  38548. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  38549. };
  38550. /*
  38551. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  38552. *
  38553. */
  38554. P.equals = P.eq = function (y) {
  38555. return this.cmp(y) === 0;
  38556. };
  38557. /*
  38558. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  38559. * direction of negative Infinity.
  38560. *
  38561. */
  38562. P.floor = function () {
  38563. return finalise(new this.constructor(this), this.e + 1, 3);
  38564. };
  38565. /*
  38566. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  38567. * false.
  38568. *
  38569. */
  38570. P.greaterThan = P.gt = function (y) {
  38571. return this.cmp(y) > 0;
  38572. };
  38573. /*
  38574. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  38575. * otherwise return false.
  38576. *
  38577. */
  38578. P.greaterThanOrEqualTo = P.gte = function (y) {
  38579. var k = this.cmp(y);
  38580. return k == 1 || k === 0;
  38581. };
  38582. /*
  38583. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  38584. * Decimal.
  38585. *
  38586. * Domain: [-Infinity, Infinity]
  38587. * Range: [1, Infinity]
  38588. *
  38589. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  38590. *
  38591. * cosh(0) = 1
  38592. * cosh(-0) = 1
  38593. * cosh(Infinity) = Infinity
  38594. * cosh(-Infinity) = Infinity
  38595. * cosh(NaN) = NaN
  38596. *
  38597. * x time taken (ms) result
  38598. * 1000 9 9.8503555700852349694e+433
  38599. * 10000 25 4.4034091128314607936e+4342
  38600. * 100000 171 1.4033316802130615897e+43429
  38601. * 1000000 3817 1.5166076984010437725e+434294
  38602. * 10000000 abandoned after 2 minute wait
  38603. *
  38604. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  38605. *
  38606. */
  38607. P.hyperbolicCosine = P.cosh = function () {
  38608. var k, n, pr, rm, len,
  38609. x = this,
  38610. Ctor = x.constructor,
  38611. one = new Ctor(1);
  38612. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  38613. if (x.isZero()) return one;
  38614. pr = Ctor.precision;
  38615. rm = Ctor.rounding;
  38616. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  38617. Ctor.rounding = 1;
  38618. len = x.d.length;
  38619. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  38620. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  38621. // Estimate the optimum number of times to use the argument reduction.
  38622. // TODO? Estimation reused from cosine() and may not be optimal here.
  38623. if (len < 32) {
  38624. k = Math.ceil(len / 3);
  38625. n = Math.pow(4, -k).toString();
  38626. } else {
  38627. k = 16;
  38628. n = '2.3283064365386962890625e-10';
  38629. }
  38630. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  38631. // Reverse argument reduction
  38632. var cosh2_x,
  38633. i = k,
  38634. d8 = new Ctor(8);
  38635. for (; i--;) {
  38636. cosh2_x = x.times(x);
  38637. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  38638. }
  38639. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  38640. };
  38641. /*
  38642. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  38643. * Decimal.
  38644. *
  38645. * Domain: [-Infinity, Infinity]
  38646. * Range: [-Infinity, Infinity]
  38647. *
  38648. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  38649. *
  38650. * sinh(0) = 0
  38651. * sinh(-0) = -0
  38652. * sinh(Infinity) = Infinity
  38653. * sinh(-Infinity) = -Infinity
  38654. * sinh(NaN) = NaN
  38655. *
  38656. * x time taken (ms)
  38657. * 10 2 ms
  38658. * 100 5 ms
  38659. * 1000 14 ms
  38660. * 10000 82 ms
  38661. * 100000 886 ms 1.4033316802130615897e+43429
  38662. * 200000 2613 ms
  38663. * 300000 5407 ms
  38664. * 400000 8824 ms
  38665. * 500000 13026 ms 8.7080643612718084129e+217146
  38666. * 1000000 48543 ms
  38667. *
  38668. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  38669. *
  38670. */
  38671. P.hyperbolicSine = P.sinh = function () {
  38672. var k, pr, rm, len,
  38673. x = this,
  38674. Ctor = x.constructor;
  38675. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  38676. pr = Ctor.precision;
  38677. rm = Ctor.rounding;
  38678. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  38679. Ctor.rounding = 1;
  38680. len = x.d.length;
  38681. if (len < 3) {
  38682. x = taylorSeries(Ctor, 2, x, x, true);
  38683. } else {
  38684. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  38685. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  38686. // 3 multiplications and 1 addition
  38687. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  38688. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  38689. // 4 multiplications and 2 additions
  38690. // Estimate the optimum number of times to use the argument reduction.
  38691. k = 1.4 * Math.sqrt(len);
  38692. k = k > 16 ? 16 : k | 0;
  38693. x = x.times(Math.pow(5, -k));
  38694. x = taylorSeries(Ctor, 2, x, x, true);
  38695. // Reverse argument reduction
  38696. var sinh2_x,
  38697. d5 = new Ctor(5),
  38698. d16 = new Ctor(16),
  38699. d20 = new Ctor(20);
  38700. for (; k--;) {
  38701. sinh2_x = x.times(x);
  38702. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  38703. }
  38704. }
  38705. Ctor.precision = pr;
  38706. Ctor.rounding = rm;
  38707. return finalise(x, pr, rm, true);
  38708. };
  38709. /*
  38710. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  38711. * Decimal.
  38712. *
  38713. * Domain: [-Infinity, Infinity]
  38714. * Range: [-1, 1]
  38715. *
  38716. * tanh(x) = sinh(x) / cosh(x)
  38717. *
  38718. * tanh(0) = 0
  38719. * tanh(-0) = -0
  38720. * tanh(Infinity) = 1
  38721. * tanh(-Infinity) = -1
  38722. * tanh(NaN) = NaN
  38723. *
  38724. */
  38725. P.hyperbolicTangent = P.tanh = function () {
  38726. var pr, rm,
  38727. x = this,
  38728. Ctor = x.constructor;
  38729. if (!x.isFinite()) return new Ctor(x.s);
  38730. if (x.isZero()) return new Ctor(x);
  38731. pr = Ctor.precision;
  38732. rm = Ctor.rounding;
  38733. Ctor.precision = pr + 7;
  38734. Ctor.rounding = 1;
  38735. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  38736. };
  38737. /*
  38738. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  38739. * this Decimal.
  38740. *
  38741. * Domain: [-1, 1]
  38742. * Range: [0, pi]
  38743. *
  38744. * acos(x) = pi/2 - asin(x)
  38745. *
  38746. * acos(0) = pi/2
  38747. * acos(-0) = pi/2
  38748. * acos(1) = 0
  38749. * acos(-1) = pi
  38750. * acos(1/2) = pi/3
  38751. * acos(-1/2) = 2*pi/3
  38752. * acos(|x| > 1) = NaN
  38753. * acos(NaN) = NaN
  38754. *
  38755. */
  38756. P.inverseCosine = P.acos = function () {
  38757. var halfPi,
  38758. x = this,
  38759. Ctor = x.constructor,
  38760. k = x.abs().cmp(1),
  38761. pr = Ctor.precision,
  38762. rm = Ctor.rounding;
  38763. if (k !== -1) {
  38764. return k === 0
  38765. // |x| is 1
  38766. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  38767. // |x| > 1 or x is NaN
  38768. : new Ctor(NaN);
  38769. }
  38770. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  38771. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  38772. Ctor.precision = pr + 6;
  38773. Ctor.rounding = 1;
  38774. x = x.asin();
  38775. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  38776. Ctor.precision = pr;
  38777. Ctor.rounding = rm;
  38778. return halfPi.minus(x);
  38779. };
  38780. /*
  38781. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  38782. * value of this Decimal.
  38783. *
  38784. * Domain: [1, Infinity]
  38785. * Range: [0, Infinity]
  38786. *
  38787. * acosh(x) = ln(x + sqrt(x^2 - 1))
  38788. *
  38789. * acosh(x < 1) = NaN
  38790. * acosh(NaN) = NaN
  38791. * acosh(Infinity) = Infinity
  38792. * acosh(-Infinity) = NaN
  38793. * acosh(0) = NaN
  38794. * acosh(-0) = NaN
  38795. * acosh(1) = 0
  38796. * acosh(-1) = NaN
  38797. *
  38798. */
  38799. P.inverseHyperbolicCosine = P.acosh = function () {
  38800. var pr, rm,
  38801. x = this,
  38802. Ctor = x.constructor;
  38803. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  38804. if (!x.isFinite()) return new Ctor(x);
  38805. pr = Ctor.precision;
  38806. rm = Ctor.rounding;
  38807. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  38808. Ctor.rounding = 1;
  38809. external = false;
  38810. x = x.times(x).minus(1).sqrt().plus(x);
  38811. external = true;
  38812. Ctor.precision = pr;
  38813. Ctor.rounding = rm;
  38814. return x.ln();
  38815. };
  38816. /*
  38817. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  38818. * of this Decimal.
  38819. *
  38820. * Domain: [-Infinity, Infinity]
  38821. * Range: [-Infinity, Infinity]
  38822. *
  38823. * asinh(x) = ln(x + sqrt(x^2 + 1))
  38824. *
  38825. * asinh(NaN) = NaN
  38826. * asinh(Infinity) = Infinity
  38827. * asinh(-Infinity) = -Infinity
  38828. * asinh(0) = 0
  38829. * asinh(-0) = -0
  38830. *
  38831. */
  38832. P.inverseHyperbolicSine = P.asinh = function () {
  38833. var pr, rm,
  38834. x = this,
  38835. Ctor = x.constructor;
  38836. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  38837. pr = Ctor.precision;
  38838. rm = Ctor.rounding;
  38839. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  38840. Ctor.rounding = 1;
  38841. external = false;
  38842. x = x.times(x).plus(1).sqrt().plus(x);
  38843. external = true;
  38844. Ctor.precision = pr;
  38845. Ctor.rounding = rm;
  38846. return x.ln();
  38847. };
  38848. /*
  38849. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  38850. * value of this Decimal.
  38851. *
  38852. * Domain: [-1, 1]
  38853. * Range: [-Infinity, Infinity]
  38854. *
  38855. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  38856. *
  38857. * atanh(|x| > 1) = NaN
  38858. * atanh(NaN) = NaN
  38859. * atanh(Infinity) = NaN
  38860. * atanh(-Infinity) = NaN
  38861. * atanh(0) = 0
  38862. * atanh(-0) = -0
  38863. * atanh(1) = Infinity
  38864. * atanh(-1) = -Infinity
  38865. *
  38866. */
  38867. P.inverseHyperbolicTangent = P.atanh = function () {
  38868. var pr, rm, wpr, xsd,
  38869. x = this,
  38870. Ctor = x.constructor;
  38871. if (!x.isFinite()) return new Ctor(NaN);
  38872. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  38873. pr = Ctor.precision;
  38874. rm = Ctor.rounding;
  38875. xsd = x.sd();
  38876. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  38877. Ctor.precision = wpr = xsd - x.e;
  38878. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  38879. Ctor.precision = pr + 4;
  38880. Ctor.rounding = 1;
  38881. x = x.ln();
  38882. Ctor.precision = pr;
  38883. Ctor.rounding = rm;
  38884. return x.times(0.5);
  38885. };
  38886. /*
  38887. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  38888. * Decimal.
  38889. *
  38890. * Domain: [-Infinity, Infinity]
  38891. * Range: [-pi/2, pi/2]
  38892. *
  38893. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  38894. *
  38895. * asin(0) = 0
  38896. * asin(-0) = -0
  38897. * asin(1/2) = pi/6
  38898. * asin(-1/2) = -pi/6
  38899. * asin(1) = pi/2
  38900. * asin(-1) = -pi/2
  38901. * asin(|x| > 1) = NaN
  38902. * asin(NaN) = NaN
  38903. *
  38904. * TODO? Compare performance of Taylor series.
  38905. *
  38906. */
  38907. P.inverseSine = P.asin = function () {
  38908. var halfPi, k,
  38909. pr, rm,
  38910. x = this,
  38911. Ctor = x.constructor;
  38912. if (x.isZero()) return new Ctor(x);
  38913. k = x.abs().cmp(1);
  38914. pr = Ctor.precision;
  38915. rm = Ctor.rounding;
  38916. if (k !== -1) {
  38917. // |x| is 1
  38918. if (k === 0) {
  38919. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  38920. halfPi.s = x.s;
  38921. return halfPi;
  38922. }
  38923. // |x| > 1 or x is NaN
  38924. return new Ctor(NaN);
  38925. }
  38926. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  38927. Ctor.precision = pr + 6;
  38928. Ctor.rounding = 1;
  38929. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  38930. Ctor.precision = pr;
  38931. Ctor.rounding = rm;
  38932. return x.times(2);
  38933. };
  38934. /*
  38935. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  38936. * of this Decimal.
  38937. *
  38938. * Domain: [-Infinity, Infinity]
  38939. * Range: [-pi/2, pi/2]
  38940. *
  38941. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  38942. *
  38943. * atan(0) = 0
  38944. * atan(-0) = -0
  38945. * atan(1) = pi/4
  38946. * atan(-1) = -pi/4
  38947. * atan(Infinity) = pi/2
  38948. * atan(-Infinity) = -pi/2
  38949. * atan(NaN) = NaN
  38950. *
  38951. */
  38952. P.inverseTangent = P.atan = function () {
  38953. var i, j, k, n, px, t, r, wpr, x2,
  38954. x = this,
  38955. Ctor = x.constructor,
  38956. pr = Ctor.precision,
  38957. rm = Ctor.rounding;
  38958. if (!x.isFinite()) {
  38959. if (!x.s) return new Ctor(NaN);
  38960. if (pr + 4 <= PI_PRECISION) {
  38961. r = getPi(Ctor, pr + 4, rm).times(0.5);
  38962. r.s = x.s;
  38963. return r;
  38964. }
  38965. } else if (x.isZero()) {
  38966. return new Ctor(x);
  38967. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  38968. r = getPi(Ctor, pr + 4, rm).times(0.25);
  38969. r.s = x.s;
  38970. return r;
  38971. }
  38972. Ctor.precision = wpr = pr + 10;
  38973. Ctor.rounding = 1;
  38974. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  38975. // Argument reduction
  38976. // Ensure |x| < 0.42
  38977. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  38978. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  38979. for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1));
  38980. external = false;
  38981. j = Math.ceil(wpr / LOG_BASE);
  38982. n = 1;
  38983. x2 = x.times(x);
  38984. r = new Ctor(x);
  38985. px = x;
  38986. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  38987. for (; i !== -1;) {
  38988. px = px.times(x2);
  38989. t = r.minus(px.div(n += 2));
  38990. px = px.times(x2);
  38991. r = t.plus(px.div(n += 2));
  38992. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;);
  38993. }
  38994. if (k) r = r.times(2 << (k - 1));
  38995. external = true;
  38996. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  38997. };
  38998. /*
  38999. * Return true if the value of this Decimal is a finite number, otherwise return false.
  39000. *
  39001. */
  39002. P.isFinite = function () {
  39003. return !!this.d;
  39004. };
  39005. /*
  39006. * Return true if the value of this Decimal is an integer, otherwise return false.
  39007. *
  39008. */
  39009. P.isInteger = P.isInt = function () {
  39010. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  39011. };
  39012. /*
  39013. * Return true if the value of this Decimal is NaN, otherwise return false.
  39014. *
  39015. */
  39016. P.isNaN = function () {
  39017. return !this.s;
  39018. };
  39019. /*
  39020. * Return true if the value of this Decimal is negative, otherwise return false.
  39021. *
  39022. */
  39023. P.isNegative = P.isNeg = function () {
  39024. return this.s < 0;
  39025. };
  39026. /*
  39027. * Return true if the value of this Decimal is positive, otherwise return false.
  39028. *
  39029. */
  39030. P.isPositive = P.isPos = function () {
  39031. return this.s > 0;
  39032. };
  39033. /*
  39034. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  39035. *
  39036. */
  39037. P.isZero = function () {
  39038. return !!this.d && this.d[0] === 0;
  39039. };
  39040. /*
  39041. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  39042. *
  39043. */
  39044. P.lessThan = P.lt = function (y) {
  39045. return this.cmp(y) < 0;
  39046. };
  39047. /*
  39048. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  39049. *
  39050. */
  39051. P.lessThanOrEqualTo = P.lte = function (y) {
  39052. return this.cmp(y) < 1;
  39053. };
  39054. /*
  39055. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  39056. * significant digits using rounding mode `rounding`.
  39057. *
  39058. * If no base is specified, return log[10](arg).
  39059. *
  39060. * log[base](arg) = ln(arg) / ln(base)
  39061. *
  39062. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  39063. * otherwise:
  39064. *
  39065. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  39066. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  39067. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  39068. *
  39069. * log[-b](a) = NaN
  39070. * log[0](a) = NaN
  39071. * log[1](a) = NaN
  39072. * log[NaN](a) = NaN
  39073. * log[Infinity](a) = NaN
  39074. * log[b](0) = -Infinity
  39075. * log[b](-0) = -Infinity
  39076. * log[b](-a) = NaN
  39077. * log[b](1) = 0
  39078. * log[b](Infinity) = Infinity
  39079. * log[b](NaN) = NaN
  39080. *
  39081. * [base] {number|string|Decimal} The base of the logarithm.
  39082. *
  39083. */
  39084. P.logarithm = P.log = function (base) {
  39085. var isBase10, d, denominator, k, inf, num, sd, r,
  39086. arg = this,
  39087. Ctor = arg.constructor,
  39088. pr = Ctor.precision,
  39089. rm = Ctor.rounding,
  39090. guard = 5;
  39091. // Default base is 10.
  39092. if (base == null) {
  39093. base = new Ctor(10);
  39094. isBase10 = true;
  39095. } else {
  39096. base = new Ctor(base);
  39097. d = base.d;
  39098. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  39099. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  39100. isBase10 = base.eq(10);
  39101. }
  39102. d = arg.d;
  39103. // Is arg negative, non-finite, 0 or 1?
  39104. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  39105. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  39106. }
  39107. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  39108. // integer power of 10.
  39109. if (isBase10) {
  39110. if (d.length > 1) {
  39111. inf = true;
  39112. } else {
  39113. for (k = d[0]; k % 10 === 0;) k /= 10;
  39114. inf = k !== 1;
  39115. }
  39116. }
  39117. external = false;
  39118. sd = pr + guard;
  39119. num = naturalLogarithm(arg, sd);
  39120. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  39121. // The result will have 5 rounding digits.
  39122. r = divide(num, denominator, sd, 1);
  39123. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  39124. // calculate 10 further digits.
  39125. //
  39126. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  39127. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  39128. // further digits, the last 14 are nines, round up and assume the result is exact.
  39129. // Also assume the result is exact if the last 14 are zero.
  39130. //
  39131. // Example of a result that will be incorrectly rounded:
  39132. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  39133. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  39134. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  39135. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  39136. // place is still 2.6.
  39137. if (checkRoundingDigits(r.d, k = pr, rm)) {
  39138. do {
  39139. sd += 10;
  39140. num = naturalLogarithm(arg, sd);
  39141. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  39142. r = divide(num, denominator, sd, 1);
  39143. if (!inf) {
  39144. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  39145. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  39146. r = finalise(r, pr + 1, 0);
  39147. }
  39148. break;
  39149. }
  39150. } while (checkRoundingDigits(r.d, k += 10, rm));
  39151. }
  39152. external = true;
  39153. return finalise(r, pr, rm);
  39154. };
  39155. /*
  39156. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  39157. *
  39158. * arguments {number|string|Decimal}
  39159. *
  39160. P.max = function () {
  39161. Array.prototype.push.call(arguments, this);
  39162. return maxOrMin(this.constructor, arguments, 'lt');
  39163. };
  39164. */
  39165. /*
  39166. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  39167. *
  39168. * arguments {number|string|Decimal}
  39169. *
  39170. P.min = function () {
  39171. Array.prototype.push.call(arguments, this);
  39172. return maxOrMin(this.constructor, arguments, 'gt');
  39173. };
  39174. */
  39175. /*
  39176. * n - 0 = n
  39177. * n - N = N
  39178. * n - I = -I
  39179. * 0 - n = -n
  39180. * 0 - 0 = 0
  39181. * 0 - N = N
  39182. * 0 - I = -I
  39183. * N - n = N
  39184. * N - 0 = N
  39185. * N - N = N
  39186. * N - I = N
  39187. * I - n = I
  39188. * I - 0 = I
  39189. * I - N = N
  39190. * I - I = N
  39191. *
  39192. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  39193. * significant digits using rounding mode `rounding`.
  39194. *
  39195. */
  39196. P.minus = P.sub = function (y) {
  39197. var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd,
  39198. x = this,
  39199. Ctor = x.constructor;
  39200. y = new Ctor(y);
  39201. // If either is not finite...
  39202. if (!x.d || !y.d) {
  39203. // Return NaN if either is NaN.
  39204. if (!x.s || !y.s) y = new Ctor(NaN);
  39205. // Return y negated if x is finite and y is ±Infinity.
  39206. else if (x.d) y.s = -y.s;
  39207. // Return x if y is finite and x is ±Infinity.
  39208. // Return x if both are ±Infinity with different signs.
  39209. // Return NaN if both are ±Infinity with the same sign.
  39210. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  39211. return y;
  39212. }
  39213. // If signs differ...
  39214. if (x.s != y.s) {
  39215. y.s = -y.s;
  39216. return x.plus(y);
  39217. }
  39218. xd = x.d;
  39219. yd = y.d;
  39220. pr = Ctor.precision;
  39221. rm = Ctor.rounding;
  39222. // If either is zero...
  39223. if (!xd[0] || !yd[0]) {
  39224. // Return y negated if x is zero and y is non-zero.
  39225. if (yd[0]) y.s = -y.s;
  39226. // Return x if y is zero and x is non-zero.
  39227. else if (xd[0]) y = new Ctor(x);
  39228. // Return zero if both are zero.
  39229. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  39230. else return new Ctor(rm === 3 ? -0 : 0);
  39231. return external ? finalise(y, pr, rm) : y;
  39232. }
  39233. // x and y are finite, non-zero numbers with the same sign.
  39234. // Calculate base 1e7 exponents.
  39235. e = mathfloor(y.e / LOG_BASE);
  39236. xe = mathfloor(x.e / LOG_BASE);
  39237. xd = xd.slice();
  39238. k = xe - e;
  39239. // If base 1e7 exponents differ...
  39240. if (k) {
  39241. xLTy = k < 0;
  39242. if (xLTy) {
  39243. d = xd;
  39244. k = -k;
  39245. len = yd.length;
  39246. } else {
  39247. d = yd;
  39248. e = xe;
  39249. len = xd.length;
  39250. }
  39251. // Numbers with massively different exponents would result in a very high number of
  39252. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  39253. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  39254. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  39255. if (k > i) {
  39256. k = i;
  39257. d.length = 1;
  39258. }
  39259. // Prepend zeros to equalise exponents.
  39260. d.reverse();
  39261. for (i = k; i--;) d.push(0);
  39262. d.reverse();
  39263. // Base 1e7 exponents equal.
  39264. } else {
  39265. // Check digits to determine which is the bigger number.
  39266. i = xd.length;
  39267. len = yd.length;
  39268. xLTy = i < len;
  39269. if (xLTy) len = i;
  39270. for (i = 0; i < len; i++) {
  39271. if (xd[i] != yd[i]) {
  39272. xLTy = xd[i] < yd[i];
  39273. break;
  39274. }
  39275. }
  39276. k = 0;
  39277. }
  39278. if (xLTy) {
  39279. d = xd;
  39280. xd = yd;
  39281. yd = d;
  39282. y.s = -y.s;
  39283. }
  39284. len = xd.length;
  39285. // Append zeros to `xd` if shorter.
  39286. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  39287. for (i = yd.length - len; i > 0; --i) xd[len++] = 0;
  39288. // Subtract yd from xd.
  39289. for (i = yd.length; i > k;) {
  39290. if (xd[--i] < yd[i]) {
  39291. for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;
  39292. --xd[j];
  39293. xd[i] += BASE;
  39294. }
  39295. xd[i] -= yd[i];
  39296. }
  39297. // Remove trailing zeros.
  39298. for (; xd[--len] === 0;) xd.pop();
  39299. // Remove leading zeros and adjust exponent accordingly.
  39300. for (; xd[0] === 0; xd.shift()) --e;
  39301. // Zero?
  39302. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  39303. y.d = xd;
  39304. y.e = getBase10Exponent(xd, e);
  39305. return external ? finalise(y, pr, rm) : y;
  39306. };
  39307. /*
  39308. * n % 0 = N
  39309. * n % N = N
  39310. * n % I = n
  39311. * 0 % n = 0
  39312. * -0 % n = -0
  39313. * 0 % 0 = N
  39314. * 0 % N = N
  39315. * 0 % I = 0
  39316. * N % n = N
  39317. * N % 0 = N
  39318. * N % N = N
  39319. * N % I = N
  39320. * I % n = N
  39321. * I % 0 = N
  39322. * I % N = N
  39323. * I % I = N
  39324. *
  39325. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  39326. * `precision` significant digits using rounding mode `rounding`.
  39327. *
  39328. * The result depends on the modulo mode.
  39329. *
  39330. */
  39331. P.modulo = P.mod = function (y) {
  39332. var q,
  39333. x = this,
  39334. Ctor = x.constructor;
  39335. y = new Ctor(y);
  39336. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  39337. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  39338. // Return x if y is ±Infinity or x is ±0.
  39339. if (!y.d || x.d && !x.d[0]) {
  39340. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  39341. }
  39342. // Prevent rounding of intermediate calculations.
  39343. external = false;
  39344. if (Ctor.modulo == 9) {
  39345. // Euclidian division: q = sign(y) * floor(x / abs(y))
  39346. // result = x - q * y where 0 <= result < abs(y)
  39347. q = divide(x, y.abs(), 0, 3, 1);
  39348. q.s *= y.s;
  39349. } else {
  39350. q = divide(x, y, 0, Ctor.modulo, 1);
  39351. }
  39352. q = q.times(y);
  39353. external = true;
  39354. return x.minus(q);
  39355. };
  39356. /*
  39357. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  39358. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  39359. * significant digits using rounding mode `rounding`.
  39360. *
  39361. */
  39362. P.naturalExponential = P.exp = function () {
  39363. return naturalExponential(this);
  39364. };
  39365. /*
  39366. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  39367. * rounded to `precision` significant digits using rounding mode `rounding`.
  39368. *
  39369. */
  39370. P.naturalLogarithm = P.ln = function () {
  39371. return naturalLogarithm(this);
  39372. };
  39373. /*
  39374. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  39375. * -1.
  39376. *
  39377. */
  39378. P.negated = P.neg = function () {
  39379. var x = new this.constructor(this);
  39380. x.s = -x.s;
  39381. return finalise(x);
  39382. };
  39383. /*
  39384. * n + 0 = n
  39385. * n + N = N
  39386. * n + I = I
  39387. * 0 + n = n
  39388. * 0 + 0 = 0
  39389. * 0 + N = N
  39390. * 0 + I = I
  39391. * N + n = N
  39392. * N + 0 = N
  39393. * N + N = N
  39394. * N + I = N
  39395. * I + n = I
  39396. * I + 0 = I
  39397. * I + N = N
  39398. * I + I = I
  39399. *
  39400. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  39401. * significant digits using rounding mode `rounding`.
  39402. *
  39403. */
  39404. P.plus = P.add = function (y) {
  39405. var carry, d, e, i, k, len, pr, rm, xd, yd,
  39406. x = this,
  39407. Ctor = x.constructor;
  39408. y = new Ctor(y);
  39409. // If either is not finite...
  39410. if (!x.d || !y.d) {
  39411. // Return NaN if either is NaN.
  39412. if (!x.s || !y.s) y = new Ctor(NaN);
  39413. // Return x if y is finite and x is ±Infinity.
  39414. // Return x if both are ±Infinity with the same sign.
  39415. // Return NaN if both are ±Infinity with different signs.
  39416. // Return y if x is finite and y is ±Infinity.
  39417. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  39418. return y;
  39419. }
  39420. // If signs differ...
  39421. if (x.s != y.s) {
  39422. y.s = -y.s;
  39423. return x.minus(y);
  39424. }
  39425. xd = x.d;
  39426. yd = y.d;
  39427. pr = Ctor.precision;
  39428. rm = Ctor.rounding;
  39429. // If either is zero...
  39430. if (!xd[0] || !yd[0]) {
  39431. // Return x if y is zero.
  39432. // Return y if y is non-zero.
  39433. if (!yd[0]) y = new Ctor(x);
  39434. return external ? finalise(y, pr, rm) : y;
  39435. }
  39436. // x and y are finite, non-zero numbers with the same sign.
  39437. // Calculate base 1e7 exponents.
  39438. k = mathfloor(x.e / LOG_BASE);
  39439. e = mathfloor(y.e / LOG_BASE);
  39440. xd = xd.slice();
  39441. i = k - e;
  39442. // If base 1e7 exponents differ...
  39443. if (i) {
  39444. if (i < 0) {
  39445. d = xd;
  39446. i = -i;
  39447. len = yd.length;
  39448. } else {
  39449. d = yd;
  39450. e = k;
  39451. len = xd.length;
  39452. }
  39453. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  39454. k = Math.ceil(pr / LOG_BASE);
  39455. len = k > len ? k + 1 : len + 1;
  39456. if (i > len) {
  39457. i = len;
  39458. d.length = 1;
  39459. }
  39460. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  39461. d.reverse();
  39462. for (; i--;) d.push(0);
  39463. d.reverse();
  39464. }
  39465. len = xd.length;
  39466. i = yd.length;
  39467. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  39468. if (len - i < 0) {
  39469. i = len;
  39470. d = yd;
  39471. yd = xd;
  39472. xd = d;
  39473. }
  39474. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  39475. for (carry = 0; i;) {
  39476. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  39477. xd[i] %= BASE;
  39478. }
  39479. if (carry) {
  39480. xd.unshift(carry);
  39481. ++e;
  39482. }
  39483. // Remove trailing zeros.
  39484. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  39485. for (len = xd.length; xd[--len] == 0;) xd.pop();
  39486. y.d = xd;
  39487. y.e = getBase10Exponent(xd, e);
  39488. return external ? finalise(y, pr, rm) : y;
  39489. };
  39490. /*
  39491. * Return the number of significant digits of the value of this Decimal.
  39492. *
  39493. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  39494. *
  39495. */
  39496. P.precision = P.sd = function (z) {
  39497. var k,
  39498. x = this;
  39499. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  39500. if (x.d) {
  39501. k = getPrecision(x.d);
  39502. if (z && x.e + 1 > k) k = x.e + 1;
  39503. } else {
  39504. k = NaN;
  39505. }
  39506. return k;
  39507. };
  39508. /*
  39509. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  39510. * rounding mode `rounding`.
  39511. *
  39512. */
  39513. P.round = function () {
  39514. var x = this,
  39515. Ctor = x.constructor;
  39516. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  39517. };
  39518. /*
  39519. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  39520. *
  39521. * Domain: [-Infinity, Infinity]
  39522. * Range: [-1, 1]
  39523. *
  39524. * sin(x) = x - x^3/3! + x^5/5! - ...
  39525. *
  39526. * sin(0) = 0
  39527. * sin(-0) = -0
  39528. * sin(Infinity) = NaN
  39529. * sin(-Infinity) = NaN
  39530. * sin(NaN) = NaN
  39531. *
  39532. */
  39533. P.sine = P.sin = function () {
  39534. var pr, rm,
  39535. x = this,
  39536. Ctor = x.constructor;
  39537. if (!x.isFinite()) return new Ctor(NaN);
  39538. if (x.isZero()) return new Ctor(x);
  39539. pr = Ctor.precision;
  39540. rm = Ctor.rounding;
  39541. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  39542. Ctor.rounding = 1;
  39543. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  39544. Ctor.precision = pr;
  39545. Ctor.rounding = rm;
  39546. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  39547. };
  39548. /*
  39549. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  39550. * significant digits using rounding mode `rounding`.
  39551. *
  39552. * sqrt(-n) = N
  39553. * sqrt(N) = N
  39554. * sqrt(-I) = N
  39555. * sqrt(I) = I
  39556. * sqrt(0) = 0
  39557. * sqrt(-0) = -0
  39558. *
  39559. */
  39560. P.squareRoot = P.sqrt = function () {
  39561. var m, n, sd, r, rep, t,
  39562. x = this,
  39563. d = x.d,
  39564. e = x.e,
  39565. s = x.s,
  39566. Ctor = x.constructor;
  39567. // Negative/NaN/Infinity/zero?
  39568. if (s !== 1 || !d || !d[0]) {
  39569. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  39570. }
  39571. external = false;
  39572. // Initial estimate.
  39573. s = Math.sqrt(+x);
  39574. // Math.sqrt underflow/overflow?
  39575. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  39576. if (s == 0 || s == 1 / 0) {
  39577. n = digitsToString(d);
  39578. if ((n.length + e) % 2 == 0) n += '0';
  39579. s = Math.sqrt(n);
  39580. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  39581. if (s == 1 / 0) {
  39582. n = '1e' + e;
  39583. } else {
  39584. n = s.toExponential();
  39585. n = n.slice(0, n.indexOf('e') + 1) + e;
  39586. }
  39587. r = new Ctor(n);
  39588. } else {
  39589. r = new Ctor(s.toString());
  39590. }
  39591. sd = (e = Ctor.precision) + 3;
  39592. // Newton-Raphson iteration.
  39593. for (;;) {
  39594. t = r;
  39595. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  39596. // TODO? Replace with for-loop and checkRoundingDigits.
  39597. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  39598. n = n.slice(sd - 3, sd + 1);
  39599. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  39600. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  39601. if (n == '9999' || !rep && n == '4999') {
  39602. // On the first iteration only, check to see if rounding up gives the exact result as the
  39603. // nines may infinitely repeat.
  39604. if (!rep) {
  39605. finalise(t, e + 1, 0);
  39606. if (t.times(t).eq(x)) {
  39607. r = t;
  39608. break;
  39609. }
  39610. }
  39611. sd += 4;
  39612. rep = 1;
  39613. } else {
  39614. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  39615. // If not, then there are further digits and m will be truthy.
  39616. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  39617. // Truncate to the first rounding digit.
  39618. finalise(r, e + 1, 1);
  39619. m = !r.times(r).eq(x);
  39620. }
  39621. break;
  39622. }
  39623. }
  39624. }
  39625. external = true;
  39626. return finalise(r, e, Ctor.rounding, m);
  39627. };
  39628. /*
  39629. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  39630. *
  39631. * Domain: [-Infinity, Infinity]
  39632. * Range: [-Infinity, Infinity]
  39633. *
  39634. * tan(0) = 0
  39635. * tan(-0) = -0
  39636. * tan(Infinity) = NaN
  39637. * tan(-Infinity) = NaN
  39638. * tan(NaN) = NaN
  39639. *
  39640. */
  39641. P.tangent = P.tan = function () {
  39642. var pr, rm,
  39643. x = this,
  39644. Ctor = x.constructor;
  39645. if (!x.isFinite()) return new Ctor(NaN);
  39646. if (x.isZero()) return new Ctor(x);
  39647. pr = Ctor.precision;
  39648. rm = Ctor.rounding;
  39649. Ctor.precision = pr + 10;
  39650. Ctor.rounding = 1;
  39651. x = x.sin();
  39652. x.s = 1;
  39653. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  39654. Ctor.precision = pr;
  39655. Ctor.rounding = rm;
  39656. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  39657. };
  39658. /*
  39659. * n * 0 = 0
  39660. * n * N = N
  39661. * n * I = I
  39662. * 0 * n = 0
  39663. * 0 * 0 = 0
  39664. * 0 * N = N
  39665. * 0 * I = N
  39666. * N * n = N
  39667. * N * 0 = N
  39668. * N * N = N
  39669. * N * I = N
  39670. * I * n = I
  39671. * I * 0 = N
  39672. * I * N = N
  39673. * I * I = I
  39674. *
  39675. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  39676. * digits using rounding mode `rounding`.
  39677. *
  39678. */
  39679. P.times = P.mul = function (y) {
  39680. var carry, e, i, k, r, rL, t, xdL, ydL,
  39681. x = this,
  39682. Ctor = x.constructor,
  39683. xd = x.d,
  39684. yd = (y = new Ctor(y)).d;
  39685. y.s *= x.s;
  39686. // If either is NaN, ±Infinity or ±0...
  39687. if (!xd || !xd[0] || !yd || !yd[0]) {
  39688. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  39689. // Return NaN if either is NaN.
  39690. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  39691. ? NaN
  39692. // Return ±Infinity if either is ±Infinity.
  39693. // Return ±0 if either is ±0.
  39694. : !xd || !yd ? y.s / 0 : y.s * 0);
  39695. }
  39696. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  39697. xdL = xd.length;
  39698. ydL = yd.length;
  39699. // Ensure xd points to the longer array.
  39700. if (xdL < ydL) {
  39701. r = xd;
  39702. xd = yd;
  39703. yd = r;
  39704. rL = xdL;
  39705. xdL = ydL;
  39706. ydL = rL;
  39707. }
  39708. // Initialise the result array with zeros.
  39709. r = [];
  39710. rL = xdL + ydL;
  39711. for (i = rL; i--;) r.push(0);
  39712. // Multiply!
  39713. for (i = ydL; --i >= 0;) {
  39714. carry = 0;
  39715. for (k = xdL + i; k > i;) {
  39716. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  39717. r[k--] = t % BASE | 0;
  39718. carry = t / BASE | 0;
  39719. }
  39720. r[k] = (r[k] + carry) % BASE | 0;
  39721. }
  39722. // Remove trailing zeros.
  39723. for (; !r[--rL];) r.pop();
  39724. if (carry) ++e;
  39725. else r.shift();
  39726. y.d = r;
  39727. y.e = getBase10Exponent(r, e);
  39728. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  39729. };
  39730. /*
  39731. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  39732. * digits using rounding mode `rm`.
  39733. *
  39734. * If the optional `sd` argument is present then return binary exponential notation.
  39735. *
  39736. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  39737. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39738. *
  39739. */
  39740. P.toBinary = function (sd, rm) {
  39741. return toStringBinary(this, 2, sd, rm);
  39742. };
  39743. /*
  39744. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  39745. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  39746. *
  39747. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  39748. *
  39749. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  39750. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39751. *
  39752. */
  39753. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  39754. var x = this,
  39755. Ctor = x.constructor;
  39756. x = new Ctor(x);
  39757. if (dp === void 0) return x;
  39758. checkInt32(dp, 0, MAX_DIGITS);
  39759. if (rm === void 0) rm = Ctor.rounding;
  39760. else checkInt32(rm, 0, 8);
  39761. return finalise(x, dp + x.e + 1, rm);
  39762. };
  39763. /*
  39764. * Return a string representing the value of this Decimal in exponential notation rounded to
  39765. * `dp` fixed decimal places using rounding mode `rounding`.
  39766. *
  39767. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  39768. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39769. *
  39770. */
  39771. P.toExponential = function (dp, rm) {
  39772. var str,
  39773. x = this,
  39774. Ctor = x.constructor;
  39775. if (dp === void 0) {
  39776. str = finiteToString(x, true);
  39777. } else {
  39778. checkInt32(dp, 0, MAX_DIGITS);
  39779. if (rm === void 0) rm = Ctor.rounding;
  39780. else checkInt32(rm, 0, 8);
  39781. x = finalise(new Ctor(x), dp + 1, rm);
  39782. str = finiteToString(x, true, dp + 1);
  39783. }
  39784. return x.isNeg() && !x.isZero() ? '-' + str : str;
  39785. };
  39786. /*
  39787. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  39788. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  39789. * omitted.
  39790. *
  39791. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  39792. *
  39793. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  39794. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39795. *
  39796. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  39797. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  39798. * (-0).toFixed(3) is '0.000'.
  39799. * (-0.5).toFixed(0) is '-0'.
  39800. *
  39801. */
  39802. P.toFixed = function (dp, rm) {
  39803. var str, y,
  39804. x = this,
  39805. Ctor = x.constructor;
  39806. if (dp === void 0) {
  39807. str = finiteToString(x);
  39808. } else {
  39809. checkInt32(dp, 0, MAX_DIGITS);
  39810. if (rm === void 0) rm = Ctor.rounding;
  39811. else checkInt32(rm, 0, 8);
  39812. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  39813. str = finiteToString(y, false, dp + y.e + 1);
  39814. }
  39815. // To determine whether to add the minus sign look at the value before it was rounded,
  39816. // i.e. look at `x` rather than `y`.
  39817. return x.isNeg() && !x.isZero() ? '-' + str : str;
  39818. };
  39819. /*
  39820. * Return an array representing the value of this Decimal as a simple fraction with an integer
  39821. * numerator and an integer denominator.
  39822. *
  39823. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  39824. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  39825. * value necessary to represent the number exactly.
  39826. *
  39827. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  39828. *
  39829. */
  39830. P.toFraction = function (maxD) {
  39831. var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r,
  39832. x = this,
  39833. xd = x.d,
  39834. Ctor = x.constructor;
  39835. if (!xd) return new Ctor(x);
  39836. n1 = d0 = new Ctor(1);
  39837. d1 = n0 = new Ctor(0);
  39838. d = new Ctor(d1);
  39839. e = d.e = getPrecision(xd) - x.e - 1;
  39840. k = e % LOG_BASE;
  39841. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  39842. if (maxD == null) {
  39843. // d is 10**e, the minimum max-denominator needed.
  39844. maxD = e > 0 ? d : n1;
  39845. } else {
  39846. n = new Ctor(maxD);
  39847. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  39848. maxD = n.gt(d) ? (e > 0 ? d : n1) : n;
  39849. }
  39850. external = false;
  39851. n = new Ctor(digitsToString(xd));
  39852. pr = Ctor.precision;
  39853. Ctor.precision = e = xd.length * LOG_BASE * 2;
  39854. for (;;) {
  39855. q = divide(n, d, 0, 1, 1);
  39856. d2 = d0.plus(q.times(d1));
  39857. if (d2.cmp(maxD) == 1) break;
  39858. d0 = d1;
  39859. d1 = d2;
  39860. d2 = n1;
  39861. n1 = n0.plus(q.times(d2));
  39862. n0 = d2;
  39863. d2 = d;
  39864. d = n.minus(q.times(d2));
  39865. n = d2;
  39866. }
  39867. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  39868. n0 = n0.plus(d2.times(n1));
  39869. d0 = d0.plus(d2.times(d1));
  39870. n0.s = n1.s = x.s;
  39871. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  39872. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1
  39873. ? [n1, d1] : [n0, d0];
  39874. Ctor.precision = pr;
  39875. external = true;
  39876. return r;
  39877. };
  39878. /*
  39879. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  39880. * digits using rounding mode `rm`.
  39881. *
  39882. * If the optional `sd` argument is present then return binary exponential notation.
  39883. *
  39884. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  39885. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39886. *
  39887. */
  39888. P.toHexadecimal = P.toHex = function (sd, rm) {
  39889. return toStringBinary(this, 16, sd, rm);
  39890. };
  39891. /*
  39892. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  39893. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  39894. *
  39895. * The return value will always have the same sign as this Decimal, unless either this Decimal
  39896. * or `y` is NaN, in which case the return value will be also be NaN.
  39897. *
  39898. * The return value is not affected by the value of `precision`.
  39899. *
  39900. * y {number|string|Decimal} The magnitude to round to a multiple of.
  39901. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39902. *
  39903. * 'toNearest() rounding mode not an integer: {rm}'
  39904. * 'toNearest() rounding mode out of range: {rm}'
  39905. *
  39906. */
  39907. P.toNearest = function (y, rm) {
  39908. var x = this,
  39909. Ctor = x.constructor;
  39910. x = new Ctor(x);
  39911. if (y == null) {
  39912. // If x is not finite, return x.
  39913. if (!x.d) return x;
  39914. y = new Ctor(1);
  39915. rm = Ctor.rounding;
  39916. } else {
  39917. y = new Ctor(y);
  39918. if (rm === void 0) {
  39919. rm = Ctor.rounding;
  39920. } else {
  39921. checkInt32(rm, 0, 8);
  39922. }
  39923. // If x is not finite, return x if y is not NaN, else NaN.
  39924. if (!x.d) return y.s ? x : y;
  39925. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  39926. if (!y.d) {
  39927. if (y.s) y.s = x.s;
  39928. return y;
  39929. }
  39930. }
  39931. // If y is not zero, calculate the nearest multiple of y to x.
  39932. if (y.d[0]) {
  39933. external = false;
  39934. x = divide(x, y, 0, rm, 1).times(y);
  39935. external = true;
  39936. finalise(x);
  39937. // If y is zero, return zero with the sign of x.
  39938. } else {
  39939. y.s = x.s;
  39940. x = y;
  39941. }
  39942. return x;
  39943. };
  39944. /*
  39945. * Return the value of this Decimal converted to a number primitive.
  39946. * Zero keeps its sign.
  39947. *
  39948. */
  39949. P.toNumber = function () {
  39950. return +this;
  39951. };
  39952. /*
  39953. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  39954. * digits using rounding mode `rm`.
  39955. *
  39956. * If the optional `sd` argument is present then return binary exponential notation.
  39957. *
  39958. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  39959. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  39960. *
  39961. */
  39962. P.toOctal = function (sd, rm) {
  39963. return toStringBinary(this, 8, sd, rm);
  39964. };
  39965. /*
  39966. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  39967. * to `precision` significant digits using rounding mode `rounding`.
  39968. *
  39969. * ECMAScript compliant.
  39970. *
  39971. * pow(x, NaN) = NaN
  39972. * pow(x, ±0) = 1
  39973. * pow(NaN, non-zero) = NaN
  39974. * pow(abs(x) > 1, +Infinity) = +Infinity
  39975. * pow(abs(x) > 1, -Infinity) = +0
  39976. * pow(abs(x) == 1, ±Infinity) = NaN
  39977. * pow(abs(x) < 1, +Infinity) = +0
  39978. * pow(abs(x) < 1, -Infinity) = +Infinity
  39979. * pow(+Infinity, y > 0) = +Infinity
  39980. * pow(+Infinity, y < 0) = +0
  39981. * pow(-Infinity, odd integer > 0) = -Infinity
  39982. * pow(-Infinity, even integer > 0) = +Infinity
  39983. * pow(-Infinity, odd integer < 0) = -0
  39984. * pow(-Infinity, even integer < 0) = +0
  39985. * pow(+0, y > 0) = +0
  39986. * pow(+0, y < 0) = +Infinity
  39987. * pow(-0, odd integer > 0) = -0
  39988. * pow(-0, even integer > 0) = +0
  39989. * pow(-0, odd integer < 0) = -Infinity
  39990. * pow(-0, even integer < 0) = +Infinity
  39991. * pow(finite x < 0, finite non-integer) = NaN
  39992. *
  39993. * For non-integer or very large exponents pow(x, y) is calculated using
  39994. *
  39995. * x^y = exp(y*ln(x))
  39996. *
  39997. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  39998. * probability of an incorrectly rounded result
  39999. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  40000. * i.e. 1 in 250,000,000,000,000
  40001. *
  40002. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  40003. *
  40004. * y {number|string|Decimal} The power to which to raise this Decimal.
  40005. *
  40006. */
  40007. P.toPower = P.pow = function (y) {
  40008. var e, k, pr, r, rm, s,
  40009. x = this,
  40010. Ctor = x.constructor,
  40011. yn = +(y = new Ctor(y));
  40012. // Either ±Infinity, NaN or ±0?
  40013. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  40014. x = new Ctor(x);
  40015. if (x.eq(1)) return x;
  40016. pr = Ctor.precision;
  40017. rm = Ctor.rounding;
  40018. if (y.eq(1)) return finalise(x, pr, rm);
  40019. // y exponent
  40020. e = mathfloor(y.e / LOG_BASE);
  40021. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  40022. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  40023. r = intPow(Ctor, x, k, pr);
  40024. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  40025. }
  40026. s = x.s;
  40027. // if x is negative
  40028. if (s < 0) {
  40029. // if y is not an integer
  40030. if (e < y.d.length - 1) return new Ctor(NaN);
  40031. // Result is positive if x is negative and the last digit of integer y is even.
  40032. if ((y.d[e] & 1) == 0) s = 1;
  40033. // if x.eq(-1)
  40034. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  40035. x.s = s;
  40036. return x;
  40037. }
  40038. }
  40039. // Estimate result exponent.
  40040. // x^y = 10^e, where e = y * log10(x)
  40041. // log10(x) = log10(x_significand) + x_exponent
  40042. // log10(x_significand) = ln(x_significand) / ln(10)
  40043. k = mathpow(+x, yn);
  40044. e = k == 0 || !isFinite(k)
  40045. ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1))
  40046. : new Ctor(k + '').e;
  40047. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  40048. // Overflow/underflow?
  40049. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  40050. external = false;
  40051. Ctor.rounding = x.s = 1;
  40052. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  40053. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  40054. // new Decimal(2.32456).pow('2087987436534566.46411')
  40055. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  40056. k = Math.min(12, (e + '').length);
  40057. // r = x^y = exp(y*ln(x))
  40058. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  40059. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  40060. if (r.d) {
  40061. // Truncate to the required precision plus five rounding digits.
  40062. r = finalise(r, pr + 5, 1);
  40063. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  40064. // the result.
  40065. if (checkRoundingDigits(r.d, pr, rm)) {
  40066. e = pr + 10;
  40067. // Truncate to the increased precision plus five rounding digits.
  40068. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  40069. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  40070. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  40071. r = finalise(r, pr + 1, 0);
  40072. }
  40073. }
  40074. }
  40075. r.s = s;
  40076. external = true;
  40077. Ctor.rounding = rm;
  40078. return finalise(r, pr, rm);
  40079. };
  40080. /*
  40081. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  40082. * using rounding mode `rounding`.
  40083. *
  40084. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  40085. * the integer part of the value in normal notation.
  40086. *
  40087. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40088. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40089. *
  40090. */
  40091. P.toPrecision = function (sd, rm) {
  40092. var str,
  40093. x = this,
  40094. Ctor = x.constructor;
  40095. if (sd === void 0) {
  40096. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40097. } else {
  40098. checkInt32(sd, 1, MAX_DIGITS);
  40099. if (rm === void 0) rm = Ctor.rounding;
  40100. else checkInt32(rm, 0, 8);
  40101. x = finalise(new Ctor(x), sd, rm);
  40102. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  40103. }
  40104. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40105. };
  40106. /*
  40107. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  40108. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  40109. * omitted.
  40110. *
  40111. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40112. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40113. *
  40114. * 'toSD() digits out of range: {sd}'
  40115. * 'toSD() digits not an integer: {sd}'
  40116. * 'toSD() rounding mode not an integer: {rm}'
  40117. * 'toSD() rounding mode out of range: {rm}'
  40118. *
  40119. */
  40120. P.toSignificantDigits = P.toSD = function (sd, rm) {
  40121. var x = this,
  40122. Ctor = x.constructor;
  40123. if (sd === void 0) {
  40124. sd = Ctor.precision;
  40125. rm = Ctor.rounding;
  40126. } else {
  40127. checkInt32(sd, 1, MAX_DIGITS);
  40128. if (rm === void 0) rm = Ctor.rounding;
  40129. else checkInt32(rm, 0, 8);
  40130. }
  40131. return finalise(new Ctor(x), sd, rm);
  40132. };
  40133. /*
  40134. * Return a string representing the value of this Decimal.
  40135. *
  40136. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  40137. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  40138. *
  40139. */
  40140. P.toString = function () {
  40141. var x = this,
  40142. Ctor = x.constructor,
  40143. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40144. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40145. };
  40146. /*
  40147. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  40148. *
  40149. */
  40150. P.truncated = P.trunc = function () {
  40151. return finalise(new this.constructor(this), this.e + 1, 1);
  40152. };
  40153. /*
  40154. * Return a string representing the value of this Decimal.
  40155. * Unlike `toString`, negative zero will include the minus sign.
  40156. *
  40157. */
  40158. P.valueOf = P.toJSON = function () {
  40159. var x = this,
  40160. Ctor = x.constructor,
  40161. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40162. return x.isNeg() ? '-' + str : str;
  40163. };
  40164. /*
  40165. // Add aliases to match BigDecimal method names.
  40166. // P.add = P.plus;
  40167. P.subtract = P.minus;
  40168. P.multiply = P.times;
  40169. P.divide = P.div;
  40170. P.remainder = P.mod;
  40171. P.compareTo = P.cmp;
  40172. P.negate = P.neg;
  40173. */
  40174. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  40175. /*
  40176. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  40177. * finiteToString, naturalExponential, naturalLogarithm
  40178. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  40179. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  40180. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  40181. * convertBase toStringBinary, parseOther
  40182. * cos P.cos
  40183. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  40184. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  40185. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  40186. * taylorSeries, atan2, parseOther
  40187. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  40188. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  40189. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  40190. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  40191. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  40192. * P.truncated, divide, getLn10, getPi, naturalExponential,
  40193. * naturalLogarithm, ceil, floor, round, trunc
  40194. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  40195. * toStringBinary
  40196. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  40197. * getLn10 P.logarithm, naturalLogarithm
  40198. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  40199. * getPrecision P.precision, P.toFraction
  40200. * getZeroString digitsToString, finiteToString
  40201. * intPow P.toPower, parseOther
  40202. * isOdd toLessThanHalfPi
  40203. * maxOrMin max, min
  40204. * naturalExponential P.naturalExponential, P.toPower
  40205. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  40206. * P.toPower, naturalExponential
  40207. * nonFiniteToString finiteToString, toStringBinary
  40208. * parseDecimal Decimal
  40209. * parseOther Decimal
  40210. * sin P.sin
  40211. * taylorSeries P.cosh, P.sinh, cos, sin
  40212. * toLessThanHalfPi P.cos, P.sin
  40213. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  40214. * truncate intPow
  40215. *
  40216. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  40217. * naturalLogarithm, config, parseOther, random, Decimal
  40218. */
  40219. function digitsToString(d) {
  40220. var i, k, ws,
  40221. indexOfLastWord = d.length - 1,
  40222. str = '',
  40223. w = d[0];
  40224. if (indexOfLastWord > 0) {
  40225. str += w;
  40226. for (i = 1; i < indexOfLastWord; i++) {
  40227. ws = d[i] + '';
  40228. k = LOG_BASE - ws.length;
  40229. if (k) str += getZeroString(k);
  40230. str += ws;
  40231. }
  40232. w = d[i];
  40233. ws = w + '';
  40234. k = LOG_BASE - ws.length;
  40235. if (k) str += getZeroString(k);
  40236. } else if (w === 0) {
  40237. return '0';
  40238. }
  40239. // Remove trailing zeros of last w.
  40240. for (; w % 10 === 0;) w /= 10;
  40241. return str + w;
  40242. }
  40243. function checkInt32(i, min, max) {
  40244. if (i !== ~~i || i < min || i > max) {
  40245. throw Error(invalidArgument + i);
  40246. }
  40247. }
  40248. /*
  40249. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  40250. * `repeating == null` if caller is `log` or `pow`,
  40251. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  40252. */
  40253. function checkRoundingDigits(d, i, rm, repeating) {
  40254. var di, k, r, rd;
  40255. // Get the length of the first word of the array d.
  40256. for (k = d[0]; k >= 10; k /= 10) --i;
  40257. // Is the rounding digit in the first word of d?
  40258. if (--i < 0) {
  40259. i += LOG_BASE;
  40260. di = 0;
  40261. } else {
  40262. di = Math.ceil((i + 1) / LOG_BASE);
  40263. i %= LOG_BASE;
  40264. }
  40265. // i is the index (0 - 6) of the rounding digit.
  40266. // E.g. if within the word 3487563 the first rounding digit is 5,
  40267. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  40268. k = mathpow(10, LOG_BASE - i);
  40269. rd = d[di] % k | 0;
  40270. if (repeating == null) {
  40271. if (i < 3) {
  40272. if (i == 0) rd = rd / 100 | 0;
  40273. else if (i == 1) rd = rd / 10 | 0;
  40274. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  40275. } else {
  40276. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) &&
  40277. (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 ||
  40278. (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  40279. }
  40280. } else {
  40281. if (i < 4) {
  40282. if (i == 0) rd = rd / 1000 | 0;
  40283. else if (i == 1) rd = rd / 100 | 0;
  40284. else if (i == 2) rd = rd / 10 | 0;
  40285. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  40286. } else {
  40287. r = ((repeating || rm < 4) && rd + 1 == k ||
  40288. (!repeating && rm > 3) && rd + 1 == k / 2) &&
  40289. (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  40290. }
  40291. }
  40292. return r;
  40293. }
  40294. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  40295. // Eg. convertBase('255', 10, 16) returns [15, 15].
  40296. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  40297. function convertBase(str, baseIn, baseOut) {
  40298. var j,
  40299. arr = [0],
  40300. arrL,
  40301. i = 0,
  40302. strL = str.length;
  40303. for (; i < strL;) {
  40304. for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;
  40305. arr[0] += NUMERALS.indexOf(str.charAt(i++));
  40306. for (j = 0; j < arr.length; j++) {
  40307. if (arr[j] > baseOut - 1) {
  40308. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  40309. arr[j + 1] += arr[j] / baseOut | 0;
  40310. arr[j] %= baseOut;
  40311. }
  40312. }
  40313. }
  40314. return arr.reverse();
  40315. }
  40316. /*
  40317. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  40318. * |x| < pi/2
  40319. *
  40320. */
  40321. function cosine(Ctor, x) {
  40322. var k, y,
  40323. len = x.d.length;
  40324. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  40325. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  40326. // Estimate the optimum number of times to use the argument reduction.
  40327. if (len < 32) {
  40328. k = Math.ceil(len / 3);
  40329. y = Math.pow(4, -k).toString();
  40330. } else {
  40331. k = 16;
  40332. y = '2.3283064365386962890625e-10';
  40333. }
  40334. Ctor.precision += k;
  40335. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  40336. // Reverse argument reduction
  40337. for (var i = k; i--;) {
  40338. var cos2x = x.times(x);
  40339. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  40340. }
  40341. Ctor.precision -= k;
  40342. return x;
  40343. }
  40344. /*
  40345. * Perform division in the specified base.
  40346. */
  40347. var divide = (function () {
  40348. // Assumes non-zero x and k, and hence non-zero result.
  40349. function multiplyInteger(x, k, base) {
  40350. var temp,
  40351. carry = 0,
  40352. i = x.length;
  40353. for (x = x.slice(); i--;) {
  40354. temp = x[i] * k + carry;
  40355. x[i] = temp % base | 0;
  40356. carry = temp / base | 0;
  40357. }
  40358. if (carry) x.unshift(carry);
  40359. return x;
  40360. }
  40361. function compare(a, b, aL, bL) {
  40362. var i, r;
  40363. if (aL != bL) {
  40364. r = aL > bL ? 1 : -1;
  40365. } else {
  40366. for (i = r = 0; i < aL; i++) {
  40367. if (a[i] != b[i]) {
  40368. r = a[i] > b[i] ? 1 : -1;
  40369. break;
  40370. }
  40371. }
  40372. }
  40373. return r;
  40374. }
  40375. function subtract(a, b, aL, base) {
  40376. var i = 0;
  40377. // Subtract b from a.
  40378. for (; aL--;) {
  40379. a[aL] -= i;
  40380. i = a[aL] < b[aL] ? 1 : 0;
  40381. a[aL] = i * base + a[aL] - b[aL];
  40382. }
  40383. // Remove leading zeros.
  40384. for (; !a[0] && a.length > 1;) a.shift();
  40385. }
  40386. return function (x, y, pr, rm, dp, base) {
  40387. var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0,
  40388. yL, yz,
  40389. Ctor = x.constructor,
  40390. sign = x.s == y.s ? 1 : -1,
  40391. xd = x.d,
  40392. yd = y.d;
  40393. // Either NaN, Infinity or 0?
  40394. if (!xd || !xd[0] || !yd || !yd[0]) {
  40395. return new Ctor(// Return NaN if either NaN, or both Infinity or 0.
  40396. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  40397. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  40398. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  40399. }
  40400. if (base) {
  40401. logBase = 1;
  40402. e = x.e - y.e;
  40403. } else {
  40404. base = BASE;
  40405. logBase = LOG_BASE;
  40406. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  40407. }
  40408. yL = yd.length;
  40409. xL = xd.length;
  40410. q = new Ctor(sign);
  40411. qd = q.d = [];
  40412. // Result exponent may be one less than e.
  40413. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  40414. for (i = 0; yd[i] == (xd[i] || 0); i++);
  40415. if (yd[i] > (xd[i] || 0)) e--;
  40416. if (pr == null) {
  40417. sd = pr = Ctor.precision;
  40418. rm = Ctor.rounding;
  40419. } else if (dp) {
  40420. sd = pr + (x.e - y.e) + 1;
  40421. } else {
  40422. sd = pr;
  40423. }
  40424. if (sd < 0) {
  40425. qd.push(1);
  40426. more = true;
  40427. } else {
  40428. // Convert precision in number of base 10 digits to base 1e7 digits.
  40429. sd = sd / logBase + 2 | 0;
  40430. i = 0;
  40431. // divisor < 1e7
  40432. if (yL == 1) {
  40433. k = 0;
  40434. yd = yd[0];
  40435. sd++;
  40436. // k is the carry.
  40437. for (; (i < xL || k) && sd--; i++) {
  40438. t = k * base + (xd[i] || 0);
  40439. qd[i] = t / yd | 0;
  40440. k = t % yd | 0;
  40441. }
  40442. more = k || i < xL;
  40443. // divisor >= 1e7
  40444. } else {
  40445. // Normalise xd and yd so highest order digit of yd is >= base/2
  40446. k = base / (yd[0] + 1) | 0;
  40447. if (k > 1) {
  40448. yd = multiplyInteger(yd, k, base);
  40449. xd = multiplyInteger(xd, k, base);
  40450. yL = yd.length;
  40451. xL = xd.length;
  40452. }
  40453. xi = yL;
  40454. rem = xd.slice(0, yL);
  40455. remL = rem.length;
  40456. // Add zeros to make remainder as long as divisor.
  40457. for (; remL < yL;) rem[remL++] = 0;
  40458. yz = yd.slice();
  40459. yz.unshift(0);
  40460. yd0 = yd[0];
  40461. if (yd[1] >= base / 2) ++yd0;
  40462. do {
  40463. k = 0;
  40464. // Compare divisor and remainder.
  40465. cmp = compare(yd, rem, yL, remL);
  40466. // If divisor < remainder.
  40467. if (cmp < 0) {
  40468. // Calculate trial digit, k.
  40469. rem0 = rem[0];
  40470. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  40471. // k will be how many times the divisor goes into the current remainder.
  40472. k = rem0 / yd0 | 0;
  40473. // Algorithm:
  40474. // 1. product = divisor * trial digit (k)
  40475. // 2. if product > remainder: product -= divisor, k--
  40476. // 3. remainder -= product
  40477. // 4. if product was < remainder at 2:
  40478. // 5. compare new remainder and divisor
  40479. // 6. If remainder > divisor: remainder -= divisor, k++
  40480. if (k > 1) {
  40481. if (k >= base) k = base - 1;
  40482. // product = divisor * trial digit.
  40483. prod = multiplyInteger(yd, k, base);
  40484. prodL = prod.length;
  40485. remL = rem.length;
  40486. // Compare product and remainder.
  40487. cmp = compare(prod, rem, prodL, remL);
  40488. // product > remainder.
  40489. if (cmp == 1) {
  40490. k--;
  40491. // Subtract divisor from product.
  40492. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  40493. }
  40494. } else {
  40495. // cmp is -1.
  40496. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  40497. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  40498. if (k == 0) cmp = k = 1;
  40499. prod = yd.slice();
  40500. }
  40501. prodL = prod.length;
  40502. if (prodL < remL) prod.unshift(0);
  40503. // Subtract product from remainder.
  40504. subtract(rem, prod, remL, base);
  40505. // If product was < previous remainder.
  40506. if (cmp == -1) {
  40507. remL = rem.length;
  40508. // Compare divisor and new remainder.
  40509. cmp = compare(yd, rem, yL, remL);
  40510. // If divisor < new remainder, subtract divisor from remainder.
  40511. if (cmp < 1) {
  40512. k++;
  40513. // Subtract divisor from remainder.
  40514. subtract(rem, yL < remL ? yz : yd, remL, base);
  40515. }
  40516. }
  40517. remL = rem.length;
  40518. } else if (cmp === 0) {
  40519. k++;
  40520. rem = [0];
  40521. } // if cmp === 1, k will be 0
  40522. // Add the next digit, k, to the result array.
  40523. qd[i++] = k;
  40524. // Update the remainder.
  40525. if (cmp && rem[0]) {
  40526. rem[remL++] = xd[xi] || 0;
  40527. } else {
  40528. rem = [xd[xi]];
  40529. remL = 1;
  40530. }
  40531. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  40532. more = rem[0] !== void 0;
  40533. }
  40534. // Leading zero?
  40535. if (!qd[0]) qd.shift();
  40536. }
  40537. // logBase is 1 when divide is being used for base conversion.
  40538. if (logBase == 1) {
  40539. q.e = e;
  40540. inexact = more;
  40541. } else {
  40542. // To calculate q.e, first get the number of digits of qd[0].
  40543. for (i = 1, k = qd[0]; k >= 10; k /= 10) i++;
  40544. q.e = i + e * logBase - 1;
  40545. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  40546. }
  40547. return q;
  40548. };
  40549. })();
  40550. /*
  40551. * Round `x` to `sd` significant digits using rounding mode `rm`.
  40552. * Check for over/under-flow.
  40553. */
  40554. function finalise(x, sd, rm, isTruncated) {
  40555. var digits, i, j, k, rd, roundUp, w, xd, xdi,
  40556. Ctor = x.constructor;
  40557. // Don't round if sd is null or undefined.
  40558. out: if (sd != null) {
  40559. xd = x.d;
  40560. // Infinity/NaN.
  40561. if (!xd) return x;
  40562. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  40563. // w: the word of xd containing rd, a base 1e7 number.
  40564. // xdi: the index of w within xd.
  40565. // digits: the number of digits of w.
  40566. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  40567. // they had leading zeros)
  40568. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  40569. // Get the length of the first word of the digits array xd.
  40570. for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;
  40571. i = sd - digits;
  40572. // Is the rounding digit in the first word of xd?
  40573. if (i < 0) {
  40574. i += LOG_BASE;
  40575. j = sd;
  40576. w = xd[xdi = 0];
  40577. // Get the rounding digit at index j of w.
  40578. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  40579. } else {
  40580. xdi = Math.ceil((i + 1) / LOG_BASE);
  40581. k = xd.length;
  40582. if (xdi >= k) {
  40583. if (isTruncated) {
  40584. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  40585. for (; k++ <= xdi;) xd.push(0);
  40586. w = rd = 0;
  40587. digits = 1;
  40588. i %= LOG_BASE;
  40589. j = i - LOG_BASE + 1;
  40590. } else {
  40591. break out;
  40592. }
  40593. } else {
  40594. w = k = xd[xdi];
  40595. // Get the number of digits of w.
  40596. for (digits = 1; k >= 10; k /= 10) digits++;
  40597. // Get the index of rd within w.
  40598. i %= LOG_BASE;
  40599. // Get the index of rd within w, adjusted for leading zeros.
  40600. // The number of leading zeros of w is given by LOG_BASE - digits.
  40601. j = i - LOG_BASE + digits;
  40602. // Get the rounding digit at index j of w.
  40603. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  40604. }
  40605. }
  40606. // Are there any non-zero digits after the rounding digit?
  40607. isTruncated = isTruncated || sd < 0 ||
  40608. xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  40609. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  40610. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  40611. // will give 714.
  40612. roundUp = rm < 4
  40613. ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
  40614. : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  40615. // Check whether the digit to the left of the rounding digit is odd.
  40616. ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 ||
  40617. rm == (x.s < 0 ? 8 : 7));
  40618. if (sd < 1 || !xd[0]) {
  40619. xd.length = 0;
  40620. if (roundUp) {
  40621. // Convert sd to decimal places.
  40622. sd -= x.e + 1;
  40623. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  40624. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  40625. x.e = -sd || 0;
  40626. } else {
  40627. // Zero.
  40628. xd[0] = x.e = 0;
  40629. }
  40630. return x;
  40631. }
  40632. // Remove excess digits.
  40633. if (i == 0) {
  40634. xd.length = xdi;
  40635. k = 1;
  40636. xdi--;
  40637. } else {
  40638. xd.length = xdi + 1;
  40639. k = mathpow(10, LOG_BASE - i);
  40640. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  40641. // j > 0 means i > number of leading zeros of w.
  40642. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  40643. }
  40644. if (roundUp) {
  40645. for (;;) {
  40646. // Is the digit to be rounded up in the first word of xd?
  40647. if (xdi == 0) {
  40648. // i will be the length of xd[0] before k is added.
  40649. for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;
  40650. j = xd[0] += k;
  40651. for (k = 1; j >= 10; j /= 10) k++;
  40652. // if i != k the length has increased.
  40653. if (i != k) {
  40654. x.e++;
  40655. if (xd[0] == BASE) xd[0] = 1;
  40656. }
  40657. break;
  40658. } else {
  40659. xd[xdi] += k;
  40660. if (xd[xdi] != BASE) break;
  40661. xd[xdi--] = 0;
  40662. k = 1;
  40663. }
  40664. }
  40665. }
  40666. // Remove trailing zeros.
  40667. for (i = xd.length; xd[--i] === 0;) xd.pop();
  40668. }
  40669. if (external) {
  40670. // Overflow?
  40671. if (x.e > Ctor.maxE) {
  40672. // Infinity.
  40673. x.d = null;
  40674. x.e = NaN;
  40675. // Underflow?
  40676. } else if (x.e < Ctor.minE) {
  40677. // Zero.
  40678. x.e = 0;
  40679. x.d = [0];
  40680. // Ctor.underflow = true;
  40681. } // else Ctor.underflow = false;
  40682. }
  40683. return x;
  40684. }
  40685. function finiteToString(x, isExp, sd) {
  40686. if (!x.isFinite()) return nonFiniteToString(x);
  40687. var k,
  40688. e = x.e,
  40689. str = digitsToString(x.d),
  40690. len = str.length;
  40691. if (isExp) {
  40692. if (sd && (k = sd - len) > 0) {
  40693. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  40694. } else if (len > 1) {
  40695. str = str.charAt(0) + '.' + str.slice(1);
  40696. }
  40697. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  40698. } else if (e < 0) {
  40699. str = '0.' + getZeroString(-e - 1) + str;
  40700. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  40701. } else if (e >= len) {
  40702. str += getZeroString(e + 1 - len);
  40703. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  40704. } else {
  40705. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  40706. if (sd && (k = sd - len) > 0) {
  40707. if (e + 1 === len) str += '.';
  40708. str += getZeroString(k);
  40709. }
  40710. }
  40711. return str;
  40712. }
  40713. // Calculate the base 10 exponent from the base 1e7 exponent.
  40714. function getBase10Exponent(digits, e) {
  40715. var w = digits[0];
  40716. // Add the number of digits of the first word of the digits array.
  40717. for ( e *= LOG_BASE; w >= 10; w /= 10) e++;
  40718. return e;
  40719. }
  40720. function getLn10(Ctor, sd, pr) {
  40721. if (sd > LN10_PRECISION) {
  40722. // Reset global state in case the exception is caught.
  40723. external = true;
  40724. if (pr) Ctor.precision = pr;
  40725. throw Error(precisionLimitExceeded);
  40726. }
  40727. return finalise(new Ctor(LN10), sd, 1, true);
  40728. }
  40729. function getPi(Ctor, sd, rm) {
  40730. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  40731. return finalise(new Ctor(PI), sd, rm, true);
  40732. }
  40733. function getPrecision(digits) {
  40734. var w = digits.length - 1,
  40735. len = w * LOG_BASE + 1;
  40736. w = digits[w];
  40737. // If non-zero...
  40738. if (w) {
  40739. // Subtract the number of trailing zeros of the last word.
  40740. for (; w % 10 == 0; w /= 10) len--;
  40741. // Add the number of digits of the first word.
  40742. for (w = digits[0]; w >= 10; w /= 10) len++;
  40743. }
  40744. return len;
  40745. }
  40746. function getZeroString(k) {
  40747. var zs = '';
  40748. for (; k--;) zs += '0';
  40749. return zs;
  40750. }
  40751. /*
  40752. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  40753. * integer of type number.
  40754. *
  40755. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  40756. *
  40757. */
  40758. function intPow(Ctor, x, n, pr) {
  40759. var isTruncated,
  40760. r = new Ctor(1),
  40761. // Max n of 9007199254740991 takes 53 loop iterations.
  40762. // Maximum digits array length; leaves [28, 34] guard digits.
  40763. k = Math.ceil(pr / LOG_BASE + 4);
  40764. external = false;
  40765. for (;;) {
  40766. if (n % 2) {
  40767. r = r.times(x);
  40768. if (truncate(r.d, k)) isTruncated = true;
  40769. }
  40770. n = mathfloor(n / 2);
  40771. if (n === 0) {
  40772. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  40773. n = r.d.length - 1;
  40774. if (isTruncated && r.d[n] === 0) ++r.d[n];
  40775. break;
  40776. }
  40777. x = x.times(x);
  40778. truncate(x.d, k);
  40779. }
  40780. external = true;
  40781. return r;
  40782. }
  40783. function isOdd(n) {
  40784. return n.d[n.d.length - 1] & 1;
  40785. }
  40786. /*
  40787. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  40788. */
  40789. function maxOrMin(Ctor, args, ltgt) {
  40790. var y,
  40791. x = new Ctor(args[0]),
  40792. i = 0;
  40793. for (; ++i < args.length;) {
  40794. y = new Ctor(args[i]);
  40795. if (!y.s) {
  40796. x = y;
  40797. break;
  40798. } else if (x[ltgt](y)) {
  40799. x = y;
  40800. }
  40801. }
  40802. return x;
  40803. }
  40804. /*
  40805. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  40806. * digits.
  40807. *
  40808. * Taylor/Maclaurin series.
  40809. *
  40810. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  40811. *
  40812. * Argument reduction:
  40813. * Repeat x = x / 32, k += 5, until |x| < 0.1
  40814. * exp(x) = exp(x / 2^k)^(2^k)
  40815. *
  40816. * Previously, the argument was initially reduced by
  40817. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  40818. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  40819. * found to be slower than just dividing repeatedly by 32 as above.
  40820. *
  40821. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  40822. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  40823. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  40824. *
  40825. * exp(Infinity) = Infinity
  40826. * exp(-Infinity) = 0
  40827. * exp(NaN) = NaN
  40828. * exp(±0) = 1
  40829. *
  40830. * exp(x) is non-terminating for any finite, non-zero x.
  40831. *
  40832. * The result will always be correctly rounded.
  40833. *
  40834. */
  40835. function naturalExponential(x, sd) {
  40836. var denominator, guard, j, pow, sum, t, wpr,
  40837. rep = 0,
  40838. i = 0,
  40839. k = 0,
  40840. Ctor = x.constructor,
  40841. rm = Ctor.rounding,
  40842. pr = Ctor.precision;
  40843. // 0/NaN/Infinity?
  40844. if (!x.d || !x.d[0] || x.e > 17) {
  40845. return new Ctor(x.d
  40846. ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0
  40847. : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  40848. }
  40849. if (sd == null) {
  40850. external = false;
  40851. wpr = pr;
  40852. } else {
  40853. wpr = sd;
  40854. }
  40855. t = new Ctor(0.03125);
  40856. // while abs(x) >= 0.1
  40857. while (x.e > -2) {
  40858. // x = x / 2^5
  40859. x = x.times(t);
  40860. k += 5;
  40861. }
  40862. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  40863. // necessary to ensure the first 4 rounding digits are correct.
  40864. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  40865. wpr += guard;
  40866. denominator = pow = sum = new Ctor(1);
  40867. Ctor.precision = wpr;
  40868. for (;;) {
  40869. pow = finalise(pow.times(x), wpr, 1);
  40870. denominator = denominator.times(++i);
  40871. t = sum.plus(divide(pow, denominator, wpr, 1));
  40872. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  40873. j = k;
  40874. while (j--) sum = finalise(sum.times(sum), wpr, 1);
  40875. // Check to see if the first 4 rounding digits are [49]999.
  40876. // If so, repeat the summation with a higher precision, otherwise
  40877. // e.g. with precision: 18, rounding: 1
  40878. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  40879. // `wpr - guard` is the index of first rounding digit.
  40880. if (sd == null) {
  40881. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  40882. Ctor.precision = wpr += 10;
  40883. denominator = pow = t = new Ctor(1);
  40884. i = 0;
  40885. rep++;
  40886. } else {
  40887. return finalise(sum, Ctor.precision = pr, rm, external = true);
  40888. }
  40889. } else {
  40890. Ctor.precision = pr;
  40891. return sum;
  40892. }
  40893. }
  40894. sum = t;
  40895. }
  40896. }
  40897. /*
  40898. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  40899. * digits.
  40900. *
  40901. * ln(-n) = NaN
  40902. * ln(0) = -Infinity
  40903. * ln(-0) = -Infinity
  40904. * ln(1) = 0
  40905. * ln(Infinity) = Infinity
  40906. * ln(-Infinity) = NaN
  40907. * ln(NaN) = NaN
  40908. *
  40909. * ln(n) (n != 1) is non-terminating.
  40910. *
  40911. */
  40912. function naturalLogarithm(y, sd) {
  40913. var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2,
  40914. n = 1,
  40915. guard = 10,
  40916. x = y,
  40917. xd = x.d,
  40918. Ctor = x.constructor,
  40919. rm = Ctor.rounding,
  40920. pr = Ctor.precision;
  40921. // Is x negative or Infinity, NaN, 0 or 1?
  40922. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  40923. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  40924. }
  40925. if (sd == null) {
  40926. external = false;
  40927. wpr = pr;
  40928. } else {
  40929. wpr = sd;
  40930. }
  40931. Ctor.precision = wpr += guard;
  40932. c = digitsToString(xd);
  40933. c0 = c.charAt(0);
  40934. if (Math.abs(e = x.e) < 1.5e15) {
  40935. // Argument reduction.
  40936. // The series converges faster the closer the argument is to 1, so using
  40937. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  40938. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  40939. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  40940. // later be divided by this number, then separate out the power of 10 using
  40941. // ln(a*10^b) = ln(a) + b*ln(10).
  40942. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  40943. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  40944. // max n is 6 (gives 0.7 - 1.3)
  40945. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  40946. x = x.times(y);
  40947. c = digitsToString(x.d);
  40948. c0 = c.charAt(0);
  40949. n++;
  40950. }
  40951. e = x.e;
  40952. if (c0 > 1) {
  40953. x = new Ctor('0.' + c);
  40954. e++;
  40955. } else {
  40956. x = new Ctor(c0 + '.' + c.slice(1));
  40957. }
  40958. } else {
  40959. // The argument reduction method above may result in overflow if the argument y is a massive
  40960. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  40961. // function using ln(x*10^e) = ln(x) + e*ln(10).
  40962. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  40963. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  40964. Ctor.precision = pr;
  40965. return sd == null ? finalise(x, pr, rm, external = true) : x;
  40966. }
  40967. // x1 is x reduced to a value near 1.
  40968. x1 = x;
  40969. // Taylor series.
  40970. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  40971. // where x = (y - 1)/(y + 1) (|x| < 1)
  40972. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  40973. x2 = finalise(x.times(x), wpr, 1);
  40974. denominator = 3;
  40975. for (;;) {
  40976. numerator = finalise(numerator.times(x2), wpr, 1);
  40977. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  40978. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  40979. sum = sum.times(2);
  40980. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  40981. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  40982. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  40983. sum = divide(sum, new Ctor(n), wpr, 1);
  40984. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  40985. // been repeated previously) and the first 4 rounding digits 9999?
  40986. // If so, restart the summation with a higher precision, otherwise
  40987. // e.g. with precision: 12, rounding: 1
  40988. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  40989. // `wpr - guard` is the index of first rounding digit.
  40990. if (sd == null) {
  40991. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  40992. Ctor.precision = wpr += guard;
  40993. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  40994. x2 = finalise(x.times(x), wpr, 1);
  40995. denominator = rep = 1;
  40996. } else {
  40997. return finalise(sum, Ctor.precision = pr, rm, external = true);
  40998. }
  40999. } else {
  41000. Ctor.precision = pr;
  41001. return sum;
  41002. }
  41003. }
  41004. sum = t;
  41005. denominator += 2;
  41006. }
  41007. }
  41008. // ±Infinity, NaN.
  41009. function nonFiniteToString(x) {
  41010. // Unsigned.
  41011. return String(x.s * x.s / 0);
  41012. }
  41013. /*
  41014. * Parse the value of a new Decimal `x` from string `str`.
  41015. */
  41016. function parseDecimal(x, str) {
  41017. var e, i, len;
  41018. // Decimal point?
  41019. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  41020. // Exponential form?
  41021. if ((i = str.search(/e/i)) > 0) {
  41022. // Determine exponent.
  41023. if (e < 0) e = i;
  41024. e += +str.slice(i + 1);
  41025. str = str.substring(0, i);
  41026. } else if (e < 0) {
  41027. // Integer.
  41028. e = str.length;
  41029. }
  41030. // Determine leading zeros.
  41031. for (i = 0; str.charCodeAt(i) === 48; i++);
  41032. // Determine trailing zeros.
  41033. for (len = str.length; str.charCodeAt(len - 1) === 48; --len);
  41034. str = str.slice(i, len);
  41035. if (str) {
  41036. len -= i;
  41037. x.e = e = e - i - 1;
  41038. x.d = [];
  41039. // Transform base
  41040. // e is the base 10 exponent.
  41041. // i is where to slice str to get the first word of the digits array.
  41042. i = (e + 1) % LOG_BASE;
  41043. if (e < 0) i += LOG_BASE;
  41044. if (i < len) {
  41045. if (i) x.d.push(+str.slice(0, i));
  41046. for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));
  41047. str = str.slice(i);
  41048. i = LOG_BASE - str.length;
  41049. } else {
  41050. i -= len;
  41051. }
  41052. for (; i--;) str += '0';
  41053. x.d.push(+str);
  41054. if (external) {
  41055. // Overflow?
  41056. if (x.e > x.constructor.maxE) {
  41057. // Infinity.
  41058. x.d = null;
  41059. x.e = NaN;
  41060. // Underflow?
  41061. } else if (x.e < x.constructor.minE) {
  41062. // Zero.
  41063. x.e = 0;
  41064. x.d = [0];
  41065. // x.constructor.underflow = true;
  41066. } // else x.constructor.underflow = false;
  41067. }
  41068. } else {
  41069. // Zero.
  41070. x.e = 0;
  41071. x.d = [0];
  41072. }
  41073. return x;
  41074. }
  41075. /*
  41076. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  41077. */
  41078. function parseOther(x, str) {
  41079. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  41080. if (str === 'Infinity' || str === 'NaN') {
  41081. if (!+str) x.s = NaN;
  41082. x.e = NaN;
  41083. x.d = null;
  41084. return x;
  41085. }
  41086. if (isHex.test(str)) {
  41087. base = 16;
  41088. str = str.toLowerCase();
  41089. } else if (isBinary.test(str)) {
  41090. base = 2;
  41091. } else if (isOctal.test(str)) {
  41092. base = 8;
  41093. } else {
  41094. throw Error(invalidArgument + str);
  41095. }
  41096. // Is there a binary exponent part?
  41097. i = str.search(/p/i);
  41098. if (i > 0) {
  41099. p = +str.slice(i + 1);
  41100. str = str.substring(2, i);
  41101. } else {
  41102. str = str.slice(2);
  41103. }
  41104. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  41105. // fraction part will be restored.
  41106. i = str.indexOf('.');
  41107. isFloat = i >= 0;
  41108. Ctor = x.constructor;
  41109. if (isFloat) {
  41110. str = str.replace('.', '');
  41111. len = str.length;
  41112. i = len - i;
  41113. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  41114. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  41115. }
  41116. xd = convertBase(str, base, BASE);
  41117. xe = xd.length - 1;
  41118. // Remove trailing zeros.
  41119. for (i = xe; xd[i] === 0; --i) xd.pop();
  41120. if (i < 0) return new Ctor(x.s * 0);
  41121. x.e = getBase10Exponent(xd, xe);
  41122. x.d = xd;
  41123. external = false;
  41124. // At what precision to perform the division to ensure exact conversion?
  41125. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  41126. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  41127. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  41128. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  41129. // Therefore using 4 * the number of digits of str will always be enough.
  41130. if (isFloat) x = divide(x, divisor, len * 4);
  41131. // Multiply by the binary exponent part if present.
  41132. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  41133. external = true;
  41134. return x;
  41135. }
  41136. /*
  41137. * sin(x) = x - x^3/3! + x^5/5! - ...
  41138. * |x| < pi/2
  41139. *
  41140. */
  41141. function sine(Ctor, x) {
  41142. var k,
  41143. len = x.d.length;
  41144. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  41145. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  41146. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  41147. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  41148. // Estimate the optimum number of times to use the argument reduction.
  41149. k = 1.4 * Math.sqrt(len);
  41150. k = k > 16 ? 16 : k | 0;
  41151. // Max k before Math.pow precision loss is 22
  41152. x = x.times(Math.pow(5, -k));
  41153. x = taylorSeries(Ctor, 2, x, x);
  41154. // Reverse argument reduction
  41155. var sin2_x,
  41156. d5 = new Ctor(5),
  41157. d16 = new Ctor(16),
  41158. d20 = new Ctor(20);
  41159. for (; k--;) {
  41160. sin2_x = x.times(x);
  41161. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  41162. }
  41163. return x;
  41164. }
  41165. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  41166. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  41167. var j, t, u, x2,
  41168. i = 1,
  41169. pr = Ctor.precision,
  41170. k = Math.ceil(pr / LOG_BASE);
  41171. external = false;
  41172. x2 = x.times(x);
  41173. u = new Ctor(y);
  41174. for (;;) {
  41175. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  41176. u = isHyperbolic ? y.plus(t) : y.minus(t);
  41177. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  41178. t = u.plus(y);
  41179. if (t.d[k] !== void 0) {
  41180. for (j = k; t.d[j] === u.d[j] && j--;);
  41181. if (j == -1) break;
  41182. }
  41183. j = u;
  41184. u = y;
  41185. y = t;
  41186. t = j;
  41187. i++;
  41188. }
  41189. external = true;
  41190. t.d.length = k + 1;
  41191. return t;
  41192. }
  41193. // Return the absolute value of `x` reduced to less than or equal to half pi.
  41194. function toLessThanHalfPi(Ctor, x) {
  41195. var t,
  41196. isNeg = x.s < 0,
  41197. pi = getPi(Ctor, Ctor.precision, 1),
  41198. halfPi = pi.times(0.5);
  41199. x = x.abs();
  41200. if (x.lte(halfPi)) {
  41201. quadrant = isNeg ? 4 : 1;
  41202. return x;
  41203. }
  41204. t = x.divToInt(pi);
  41205. if (t.isZero()) {
  41206. quadrant = isNeg ? 3 : 2;
  41207. } else {
  41208. x = x.minus(t.times(pi));
  41209. // 0 <= x < pi
  41210. if (x.lte(halfPi)) {
  41211. quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1);
  41212. return x;
  41213. }
  41214. quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2);
  41215. }
  41216. return x.minus(pi).abs();
  41217. }
  41218. /*
  41219. * Return the value of Decimal `x` as a string in base `baseOut`.
  41220. *
  41221. * If the optional `sd` argument is present include a binary exponent suffix.
  41222. */
  41223. function toStringBinary(x, baseOut, sd, rm) {
  41224. var base, e, i, k, len, roundUp, str, xd, y,
  41225. Ctor = x.constructor,
  41226. isExp = sd !== void 0;
  41227. if (isExp) {
  41228. checkInt32(sd, 1, MAX_DIGITS);
  41229. if (rm === void 0) rm = Ctor.rounding;
  41230. else checkInt32(rm, 0, 8);
  41231. } else {
  41232. sd = Ctor.precision;
  41233. rm = Ctor.rounding;
  41234. }
  41235. if (!x.isFinite()) {
  41236. str = nonFiniteToString(x);
  41237. } else {
  41238. str = finiteToString(x);
  41239. i = str.indexOf('.');
  41240. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  41241. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  41242. // minBinaryExponent = floor(decimalExponent * log[2](10))
  41243. // log[2](10) = 3.321928094887362347870319429489390175864
  41244. if (isExp) {
  41245. base = 2;
  41246. if (baseOut == 16) {
  41247. sd = sd * 4 - 3;
  41248. } else if (baseOut == 8) {
  41249. sd = sd * 3 - 2;
  41250. }
  41251. } else {
  41252. base = baseOut;
  41253. }
  41254. // Convert the number as an integer then divide the result by its base raised to a power such
  41255. // that the fraction part will be restored.
  41256. // Non-integer.
  41257. if (i >= 0) {
  41258. str = str.replace('.', '');
  41259. y = new Ctor(1);
  41260. y.e = str.length - i;
  41261. y.d = convertBase(finiteToString(y), 10, base);
  41262. y.e = y.d.length;
  41263. }
  41264. xd = convertBase(str, 10, base);
  41265. e = len = xd.length;
  41266. // Remove trailing zeros.
  41267. for (; xd[--len] == 0;) xd.pop();
  41268. if (!xd[0]) {
  41269. str = isExp ? '0p+0' : '0';
  41270. } else {
  41271. if (i < 0) {
  41272. e--;
  41273. } else {
  41274. x = new Ctor(x);
  41275. x.d = xd;
  41276. x.e = e;
  41277. x = divide(x, y, sd, rm, 0, base);
  41278. xd = x.d;
  41279. e = x.e;
  41280. roundUp = inexact;
  41281. }
  41282. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  41283. i = xd[sd];
  41284. k = base / 2;
  41285. roundUp = roundUp || xd[sd + 1] !== void 0;
  41286. roundUp = rm < 4
  41287. ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))
  41288. : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||
  41289. rm === (x.s < 0 ? 8 : 7));
  41290. xd.length = sd;
  41291. if (roundUp) {
  41292. // Rounding up may mean the previous digit has to be rounded up and so on.
  41293. for (; ++xd[--sd] > base - 1;) {
  41294. xd[sd] = 0;
  41295. if (!sd) {
  41296. ++e;
  41297. xd.unshift(1);
  41298. }
  41299. }
  41300. }
  41301. // Determine trailing zeros.
  41302. for (len = xd.length; !xd[len - 1]; --len);
  41303. // E.g. [4, 11, 15] becomes 4bf.
  41304. for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);
  41305. // Add binary exponent suffix?
  41306. if (isExp) {
  41307. if (len > 1) {
  41308. if (baseOut == 16 || baseOut == 8) {
  41309. i = baseOut == 16 ? 4 : 3;
  41310. for (--len; len % i; len++) str += '0';
  41311. xd = convertBase(str, base, baseOut);
  41312. for (len = xd.length; !xd[len - 1]; --len);
  41313. // xd[0] will always be be 1
  41314. for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);
  41315. } else {
  41316. str = str.charAt(0) + '.' + str.slice(1);
  41317. }
  41318. }
  41319. str = str + (e < 0 ? 'p' : 'p+') + e;
  41320. } else if (e < 0) {
  41321. for (; ++e;) str = '0' + str;
  41322. str = '0.' + str;
  41323. } else {
  41324. if (++e > len) for (e -= len; e-- ;) str += '0';
  41325. else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  41326. }
  41327. }
  41328. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  41329. }
  41330. return x.s < 0 ? '-' + str : str;
  41331. }
  41332. // Does not strip trailing zeros.
  41333. function truncate(arr, len) {
  41334. if (arr.length > len) {
  41335. arr.length = len;
  41336. return true;
  41337. }
  41338. }
  41339. // Decimal methods
  41340. /*
  41341. * abs
  41342. * acos
  41343. * acosh
  41344. * add
  41345. * asin
  41346. * asinh
  41347. * atan
  41348. * atanh
  41349. * atan2
  41350. * cbrt
  41351. * ceil
  41352. * clone
  41353. * config
  41354. * cos
  41355. * cosh
  41356. * div
  41357. * exp
  41358. * floor
  41359. * hypot
  41360. * ln
  41361. * log
  41362. * log2
  41363. * log10
  41364. * max
  41365. * min
  41366. * mod
  41367. * mul
  41368. * pow
  41369. * random
  41370. * round
  41371. * set
  41372. * sign
  41373. * sin
  41374. * sinh
  41375. * sqrt
  41376. * sub
  41377. * tan
  41378. * tanh
  41379. * trunc
  41380. */
  41381. /*
  41382. * Return a new Decimal whose value is the absolute value of `x`.
  41383. *
  41384. * x {number|string|Decimal}
  41385. *
  41386. */
  41387. function abs(x) {
  41388. return new this(x).abs();
  41389. }
  41390. /*
  41391. * Return a new Decimal whose value is the arccosine in radians of `x`.
  41392. *
  41393. * x {number|string|Decimal}
  41394. *
  41395. */
  41396. function acos(x) {
  41397. return new this(x).acos();
  41398. }
  41399. /*
  41400. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  41401. * `precision` significant digits using rounding mode `rounding`.
  41402. *
  41403. * x {number|string|Decimal} A value in radians.
  41404. *
  41405. */
  41406. function acosh(x) {
  41407. return new this(x).acosh();
  41408. }
  41409. /*
  41410. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  41411. * digits using rounding mode `rounding`.
  41412. *
  41413. * x {number|string|Decimal}
  41414. * y {number|string|Decimal}
  41415. *
  41416. */
  41417. function add(x, y) {
  41418. return new this(x).plus(y);
  41419. }
  41420. /*
  41421. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  41422. * significant digits using rounding mode `rounding`.
  41423. *
  41424. * x {number|string|Decimal}
  41425. *
  41426. */
  41427. function asin(x) {
  41428. return new this(x).asin();
  41429. }
  41430. /*
  41431. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  41432. * `precision` significant digits using rounding mode `rounding`.
  41433. *
  41434. * x {number|string|Decimal} A value in radians.
  41435. *
  41436. */
  41437. function asinh(x) {
  41438. return new this(x).asinh();
  41439. }
  41440. /*
  41441. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  41442. * significant digits using rounding mode `rounding`.
  41443. *
  41444. * x {number|string|Decimal}
  41445. *
  41446. */
  41447. function atan(x) {
  41448. return new this(x).atan();
  41449. }
  41450. /*
  41451. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  41452. * `precision` significant digits using rounding mode `rounding`.
  41453. *
  41454. * x {number|string|Decimal} A value in radians.
  41455. *
  41456. */
  41457. function atanh(x) {
  41458. return new this(x).atanh();
  41459. }
  41460. /*
  41461. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  41462. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  41463. *
  41464. * Domain: [-Infinity, Infinity]
  41465. * Range: [-pi, pi]
  41466. *
  41467. * y {number|string|Decimal} The y-coordinate.
  41468. * x {number|string|Decimal} The x-coordinate.
  41469. *
  41470. * atan2(±0, -0) = ±pi
  41471. * atan2(±0, +0) = ±0
  41472. * atan2(±0, -x) = ±pi for x > 0
  41473. * atan2(±0, x) = ±0 for x > 0
  41474. * atan2(-y, ±0) = -pi/2 for y > 0
  41475. * atan2(y, ±0) = pi/2 for y > 0
  41476. * atan2(±y, -Infinity) = ±pi for finite y > 0
  41477. * atan2(±y, +Infinity) = ±0 for finite y > 0
  41478. * atan2(±Infinity, x) = ±pi/2 for finite x
  41479. * atan2(±Infinity, -Infinity) = ±3*pi/4
  41480. * atan2(±Infinity, +Infinity) = ±pi/4
  41481. * atan2(NaN, x) = NaN
  41482. * atan2(y, NaN) = NaN
  41483. *
  41484. */
  41485. function atan2(y, x) {
  41486. y = new this(y);
  41487. x = new this(x);
  41488. var r,
  41489. pr = this.precision,
  41490. rm = this.rounding,
  41491. wpr = pr + 4;
  41492. // Either NaN
  41493. if (!y.s || !x.s) {
  41494. r = new this(NaN);
  41495. // Both ±Infinity
  41496. } else if (!y.d && !x.d) {
  41497. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  41498. r.s = y.s;
  41499. // x is ±Infinity or y is ±0
  41500. } else if (!x.d || y.isZero()) {
  41501. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  41502. r.s = y.s;
  41503. // y is ±Infinity or x is ±0
  41504. } else if (!y.d || x.isZero()) {
  41505. r = getPi(this, wpr, 1).times(0.5);
  41506. r.s = y.s;
  41507. // Both non-zero and finite
  41508. } else if (x.s < 0) {
  41509. this.precision = wpr;
  41510. this.rounding = 1;
  41511. r = this.atan(divide(y, x, wpr, 1));
  41512. x = getPi(this, wpr, 1);
  41513. this.precision = pr;
  41514. this.rounding = rm;
  41515. r = y.s < 0 ? r.minus(x) : r.plus(x);
  41516. } else {
  41517. r = this.atan(divide(y, x, wpr, 1));
  41518. }
  41519. return r;
  41520. }
  41521. /*
  41522. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  41523. * digits using rounding mode `rounding`.
  41524. *
  41525. * x {number|string|Decimal}
  41526. *
  41527. */
  41528. function cbrt(x) {
  41529. return new this(x).cbrt();
  41530. }
  41531. /*
  41532. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  41533. *
  41534. * x {number|string|Decimal}
  41535. *
  41536. */
  41537. function ceil(x) {
  41538. return finalise(x = new this(x), x.e + 1, 2);
  41539. }
  41540. /*
  41541. * Configure global settings for a Decimal constructor.
  41542. *
  41543. * `obj` is an object with one or more of the following properties,
  41544. *
  41545. * precision {number}
  41546. * rounding {number}
  41547. * toExpNeg {number}
  41548. * toExpPos {number}
  41549. * maxE {number}
  41550. * minE {number}
  41551. * modulo {number}
  41552. * crypto {boolean|number}
  41553. * defaults {true}
  41554. *
  41555. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  41556. *
  41557. */
  41558. function config(obj) {
  41559. if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected');
  41560. var i, p, v,
  41561. useDefaults = obj.defaults === true,
  41562. ps = [
  41563. 'precision', 1, MAX_DIGITS,
  41564. 'rounding', 0, 8,
  41565. 'toExpNeg', -EXP_LIMIT, 0,
  41566. 'toExpPos', 0, EXP_LIMIT,
  41567. 'maxE', 0, EXP_LIMIT,
  41568. 'minE', -EXP_LIMIT, 0,
  41569. 'modulo', 0, 9
  41570. ];
  41571. for (i = 0; i < ps.length; i += 3) {
  41572. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  41573. if ((v = obj[p]) !== void 0) {
  41574. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;
  41575. else throw Error(invalidArgument + p + ': ' + v);
  41576. }
  41577. }
  41578. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  41579. if ((v = obj[p]) !== void 0) {
  41580. if (v === true || v === false || v === 0 || v === 1) {
  41581. if (v) {
  41582. if (typeof crypto != 'undefined' && crypto &&
  41583. (crypto.getRandomValues || crypto.randomBytes)) {
  41584. this[p] = true;
  41585. } else {
  41586. throw Error(cryptoUnavailable);
  41587. }
  41588. } else {
  41589. this[p] = false;
  41590. }
  41591. } else {
  41592. throw Error(invalidArgument + p + ': ' + v);
  41593. }
  41594. }
  41595. return this;
  41596. }
  41597. /*
  41598. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  41599. * digits using rounding mode `rounding`.
  41600. *
  41601. * x {number|string|Decimal} A value in radians.
  41602. *
  41603. */
  41604. function cos(x) {
  41605. return new this(x).cos();
  41606. }
  41607. /*
  41608. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  41609. * significant digits using rounding mode `rounding`.
  41610. *
  41611. * x {number|string|Decimal} A value in radians.
  41612. *
  41613. */
  41614. function cosh(x) {
  41615. return new this(x).cosh();
  41616. }
  41617. /*
  41618. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  41619. * constructor.
  41620. *
  41621. */
  41622. function clone(obj) {
  41623. var i, p, ps;
  41624. /*
  41625. * The Decimal constructor and exported function.
  41626. * Return a new Decimal instance.
  41627. *
  41628. * v {number|string|Decimal} A numeric value.
  41629. *
  41630. */
  41631. function Decimal(v) {
  41632. var e, i, t,
  41633. x = this;
  41634. // Decimal called without new.
  41635. if (!(x instanceof Decimal)) return new Decimal(v);
  41636. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  41637. // which points to Object.
  41638. x.constructor = Decimal;
  41639. // Duplicate.
  41640. if (v instanceof Decimal) {
  41641. x.s = v.s;
  41642. x.e = v.e;
  41643. x.d = (v = v.d) ? v.slice() : v;
  41644. return;
  41645. }
  41646. t = typeof v;
  41647. if (t === 'number') {
  41648. if (v === 0) {
  41649. x.s = 1 / v < 0 ? -1 : 1;
  41650. x.e = 0;
  41651. x.d = [0];
  41652. return;
  41653. }
  41654. if (v < 0) {
  41655. v = -v;
  41656. x.s = -1;
  41657. } else {
  41658. x.s = 1;
  41659. }
  41660. // Fast path for small integers.
  41661. if (v === ~~v && v < 1e7) {
  41662. for (e = 0, i = v; i >= 10; i /= 10) e++;
  41663. x.e = e;
  41664. x.d = [v];
  41665. return;
  41666. // Infinity, NaN.
  41667. } else if (v * 0 !== 0) {
  41668. if (!v) x.s = NaN;
  41669. x.e = NaN;
  41670. x.d = null;
  41671. return;
  41672. }
  41673. return parseDecimal(x, v.toString());
  41674. } else if (t !== 'string') {
  41675. throw Error(invalidArgument + v);
  41676. }
  41677. // Minus sign?
  41678. if (v.charCodeAt(0) === 45) {
  41679. v = v.slice(1);
  41680. x.s = -1;
  41681. } else {
  41682. x.s = 1;
  41683. }
  41684. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  41685. }
  41686. Decimal.prototype = P;
  41687. Decimal.ROUND_UP = 0;
  41688. Decimal.ROUND_DOWN = 1;
  41689. Decimal.ROUND_CEIL = 2;
  41690. Decimal.ROUND_FLOOR = 3;
  41691. Decimal.ROUND_HALF_UP = 4;
  41692. Decimal.ROUND_HALF_DOWN = 5;
  41693. Decimal.ROUND_HALF_EVEN = 6;
  41694. Decimal.ROUND_HALF_CEIL = 7;
  41695. Decimal.ROUND_HALF_FLOOR = 8;
  41696. Decimal.EUCLID = 9;
  41697. Decimal.config = Decimal.set = config;
  41698. Decimal.clone = clone;
  41699. Decimal.isDecimal = isDecimalInstance;
  41700. Decimal.abs = abs;
  41701. Decimal.acos = acos;
  41702. Decimal.acosh = acosh; // ES6
  41703. Decimal.add = add;
  41704. Decimal.asin = asin;
  41705. Decimal.asinh = asinh; // ES6
  41706. Decimal.atan = atan;
  41707. Decimal.atanh = atanh; // ES6
  41708. Decimal.atan2 = atan2;
  41709. Decimal.cbrt = cbrt; // ES6
  41710. Decimal.ceil = ceil;
  41711. Decimal.cos = cos;
  41712. Decimal.cosh = cosh; // ES6
  41713. Decimal.div = div;
  41714. Decimal.exp = exp;
  41715. Decimal.floor = floor;
  41716. Decimal.hypot = hypot; // ES6
  41717. Decimal.ln = ln;
  41718. Decimal.log = log;
  41719. Decimal.log10 = log10; // ES6
  41720. Decimal.log2 = log2; // ES6
  41721. Decimal.max = max;
  41722. Decimal.min = min;
  41723. Decimal.mod = mod;
  41724. Decimal.mul = mul;
  41725. Decimal.pow = pow;
  41726. Decimal.random = random;
  41727. Decimal.round = round;
  41728. Decimal.sign = sign; // ES6
  41729. Decimal.sin = sin;
  41730. Decimal.sinh = sinh; // ES6
  41731. Decimal.sqrt = sqrt;
  41732. Decimal.sub = sub;
  41733. Decimal.tan = tan;
  41734. Decimal.tanh = tanh; // ES6
  41735. Decimal.trunc = trunc; // ES6
  41736. if (obj === void 0) obj = {};
  41737. if (obj) {
  41738. if (obj.defaults !== true) {
  41739. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  41740. for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  41741. }
  41742. }
  41743. Decimal.config(obj);
  41744. return Decimal;
  41745. }
  41746. /*
  41747. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  41748. * digits using rounding mode `rounding`.
  41749. *
  41750. * x {number|string|Decimal}
  41751. * y {number|string|Decimal}
  41752. *
  41753. */
  41754. function div(x, y) {
  41755. return new this(x).div(y);
  41756. }
  41757. /*
  41758. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  41759. * significant digits using rounding mode `rounding`.
  41760. *
  41761. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  41762. *
  41763. */
  41764. function exp(x) {
  41765. return new this(x).exp();
  41766. }
  41767. /*
  41768. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  41769. *
  41770. * x {number|string|Decimal}
  41771. *
  41772. */
  41773. function floor(x) {
  41774. return finalise(x = new this(x), x.e + 1, 3);
  41775. }
  41776. /*
  41777. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  41778. * rounded to `precision` significant digits using rounding mode `rounding`.
  41779. *
  41780. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  41781. *
  41782. */
  41783. function hypot() {
  41784. var i, n,
  41785. t = new this(0);
  41786. external = false;
  41787. for (i = 0; i < arguments.length;) {
  41788. n = new this(arguments[i++]);
  41789. if (!n.d) {
  41790. if (n.s) {
  41791. external = true;
  41792. return new this(1 / 0);
  41793. }
  41794. t = n;
  41795. } else if (t.d) {
  41796. t = t.plus(n.times(n));
  41797. }
  41798. }
  41799. external = true;
  41800. return t.sqrt();
  41801. }
  41802. /*
  41803. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  41804. * otherwise return false.
  41805. *
  41806. */
  41807. function isDecimalInstance(obj) {
  41808. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  41809. }
  41810. /*
  41811. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  41812. * significant digits using rounding mode `rounding`.
  41813. *
  41814. * x {number|string|Decimal}
  41815. *
  41816. */
  41817. function ln(x) {
  41818. return new this(x).ln();
  41819. }
  41820. /*
  41821. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  41822. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  41823. *
  41824. * log[y](x)
  41825. *
  41826. * x {number|string|Decimal} The argument of the logarithm.
  41827. * y {number|string|Decimal} The base of the logarithm.
  41828. *
  41829. */
  41830. function log(x, y) {
  41831. return new this(x).log(y);
  41832. }
  41833. /*
  41834. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  41835. * significant digits using rounding mode `rounding`.
  41836. *
  41837. * x {number|string|Decimal}
  41838. *
  41839. */
  41840. function log2(x) {
  41841. return new this(x).log(2);
  41842. }
  41843. /*
  41844. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  41845. * significant digits using rounding mode `rounding`.
  41846. *
  41847. * x {number|string|Decimal}
  41848. *
  41849. */
  41850. function log10(x) {
  41851. return new this(x).log(10);
  41852. }
  41853. /*
  41854. * Return a new Decimal whose value is the maximum of the arguments.
  41855. *
  41856. * arguments {number|string|Decimal}
  41857. *
  41858. */
  41859. function max() {
  41860. return maxOrMin(this, arguments, 'lt');
  41861. }
  41862. /*
  41863. * Return a new Decimal whose value is the minimum of the arguments.
  41864. *
  41865. * arguments {number|string|Decimal}
  41866. *
  41867. */
  41868. function min() {
  41869. return maxOrMin(this, arguments, 'gt');
  41870. }
  41871. /*
  41872. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  41873. * using rounding mode `rounding`.
  41874. *
  41875. * x {number|string|Decimal}
  41876. * y {number|string|Decimal}
  41877. *
  41878. */
  41879. function mod(x, y) {
  41880. return new this(x).mod(y);
  41881. }
  41882. /*
  41883. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  41884. * digits using rounding mode `rounding`.
  41885. *
  41886. * x {number|string|Decimal}
  41887. * y {number|string|Decimal}
  41888. *
  41889. */
  41890. function mul(x, y) {
  41891. return new this(x).mul(y);
  41892. }
  41893. /*
  41894. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  41895. * significant digits using rounding mode `rounding`.
  41896. *
  41897. * x {number|string|Decimal} The base.
  41898. * y {number|string|Decimal} The exponent.
  41899. *
  41900. */
  41901. function pow(x, y) {
  41902. return new this(x).pow(y);
  41903. }
  41904. /*
  41905. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  41906. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  41907. * are produced).
  41908. *
  41909. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  41910. *
  41911. */
  41912. function random(sd) {
  41913. var d, e, k, n,
  41914. i = 0,
  41915. r = new this(1),
  41916. rd = [];
  41917. if (sd === void 0) sd = this.precision;
  41918. else checkInt32(sd, 1, MAX_DIGITS);
  41919. k = Math.ceil(sd / LOG_BASE);
  41920. if (!this.crypto) {
  41921. for (; i < k;) rd[i++] = Math.random() * 1e7 | 0;
  41922. // Browsers supporting crypto.getRandomValues.
  41923. } else if (crypto.getRandomValues) {
  41924. d = crypto.getRandomValues(new Uint32Array(k));
  41925. for (; i < k;) {
  41926. n = d[i];
  41927. // 0 <= n < 4294967296
  41928. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  41929. if (n >= 4.29e9) {
  41930. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  41931. } else {
  41932. // 0 <= n <= 4289999999
  41933. // 0 <= (n % 1e7) <= 9999999
  41934. rd[i++] = n % 1e7;
  41935. }
  41936. }
  41937. // Node.js supporting crypto.randomBytes.
  41938. } else if (crypto.randomBytes) {
  41939. // buffer
  41940. d = crypto.randomBytes(k *= 4);
  41941. for (; i < k;) {
  41942. // 0 <= n < 2147483648
  41943. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  41944. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  41945. if (n >= 2.14e9) {
  41946. crypto.randomBytes(4).copy(d, i);
  41947. } else {
  41948. // 0 <= n <= 2139999999
  41949. // 0 <= (n % 1e7) <= 9999999
  41950. rd.push(n % 1e7);
  41951. i += 4;
  41952. }
  41953. }
  41954. i = k / 4;
  41955. } else {
  41956. throw Error(cryptoUnavailable);
  41957. }
  41958. k = rd[--i];
  41959. sd %= LOG_BASE;
  41960. // Convert trailing digits to zeros according to sd.
  41961. if (k && sd) {
  41962. n = mathpow(10, LOG_BASE - sd);
  41963. rd[i] = (k / n | 0) * n;
  41964. }
  41965. // Remove trailing words which are zero.
  41966. for (; rd[i] === 0; i--) rd.pop();
  41967. // Zero?
  41968. if (i < 0) {
  41969. e = 0;
  41970. rd = [0];
  41971. } else {
  41972. e = -1;
  41973. // Remove leading words which are zero and adjust exponent accordingly.
  41974. for (; rd[0] === 0; e -= LOG_BASE) rd.shift();
  41975. // Count the digits of the first word of rd to determine leading zeros.
  41976. for (k = 1, n = rd[0]; n >= 10; n /= 10) k++;
  41977. // Adjust the exponent for leading zeros of the first word of rd.
  41978. if (k < LOG_BASE) e -= LOG_BASE - k;
  41979. }
  41980. r.e = e;
  41981. r.d = rd;
  41982. return r;
  41983. }
  41984. /*
  41985. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  41986. *
  41987. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  41988. *
  41989. * x {number|string|Decimal}
  41990. *
  41991. */
  41992. function round(x) {
  41993. return finalise(x = new this(x), x.e + 1, this.rounding);
  41994. }
  41995. /*
  41996. * Return
  41997. * 1 if x > 0,
  41998. * -1 if x < 0,
  41999. * 0 if x is 0,
  42000. * -0 if x is -0,
  42001. * NaN otherwise
  42002. *
  42003. */
  42004. function sign(x) {
  42005. x = new this(x);
  42006. return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;
  42007. }
  42008. /*
  42009. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  42010. * using rounding mode `rounding`.
  42011. *
  42012. * x {number|string|Decimal} A value in radians.
  42013. *
  42014. */
  42015. function sin(x) {
  42016. return new this(x).sin();
  42017. }
  42018. /*
  42019. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  42020. * significant digits using rounding mode `rounding`.
  42021. *
  42022. * x {number|string|Decimal} A value in radians.
  42023. *
  42024. */
  42025. function sinh(x) {
  42026. return new this(x).sinh();
  42027. }
  42028. /*
  42029. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  42030. * digits using rounding mode `rounding`.
  42031. *
  42032. * x {number|string|Decimal}
  42033. *
  42034. */
  42035. function sqrt(x) {
  42036. return new this(x).sqrt();
  42037. }
  42038. /*
  42039. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  42040. * using rounding mode `rounding`.
  42041. *
  42042. * x {number|string|Decimal}
  42043. * y {number|string|Decimal}
  42044. *
  42045. */
  42046. function sub(x, y) {
  42047. return new this(x).sub(y);
  42048. }
  42049. /*
  42050. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  42051. * digits using rounding mode `rounding`.
  42052. *
  42053. * x {number|string|Decimal} A value in radians.
  42054. *
  42055. */
  42056. function tan(x) {
  42057. return new this(x).tan();
  42058. }
  42059. /*
  42060. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  42061. * significant digits using rounding mode `rounding`.
  42062. *
  42063. * x {number|string|Decimal} A value in radians.
  42064. *
  42065. */
  42066. function tanh(x) {
  42067. return new this(x).tanh();
  42068. }
  42069. /*
  42070. * Return a new Decimal whose value is `x` truncated to an integer.
  42071. *
  42072. * x {number|string|Decimal}
  42073. *
  42074. */
  42075. function trunc(x) {
  42076. return finalise(x = new this(x), x.e + 1, 1);
  42077. }
  42078. // Create and configure initial Decimal constructor.
  42079. Decimal = clone(DEFAULTS);
  42080. Decimal['default'] = Decimal.Decimal = Decimal;
  42081. // Create the internal constants from their string values.
  42082. LN10 = new Decimal(LN10);
  42083. PI = new Decimal(PI);
  42084. // Export.
  42085. // AMD.
  42086. if (true) {
  42087. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  42088. return Decimal;
  42089. }).call(exports, __webpack_require__, exports, module),
  42090. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  42091. // Node and other environments that support module.exports.
  42092. } else {}
  42093. })(this);
  42094. /***/ }),
  42095. /***/ "./node_modules/jquery/dist/jquery.js":
  42096. /*!********************************************!*\
  42097. !*** ./node_modules/jquery/dist/jquery.js ***!
  42098. \********************************************/
  42099. /*! no static exports found */
  42100. /***/ (function(module, exports, __webpack_require__) {
  42101. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  42102. * jQuery JavaScript Library v3.3.1
  42103. * https://jquery.com/
  42104. *
  42105. * Includes Sizzle.js
  42106. * https://sizzlejs.com/
  42107. *
  42108. * Copyright JS Foundation and other contributors
  42109. * Released under the MIT license
  42110. * https://jquery.org/license
  42111. *
  42112. * Date: 2018-01-20T17:24Z
  42113. */
  42114. ( function( global, factory ) {
  42115. "use strict";
  42116. if ( true && typeof module.exports === "object" ) {
  42117. // For CommonJS and CommonJS-like environments where a proper `window`
  42118. // is present, execute the factory and get jQuery.
  42119. // For environments that do not have a `window` with a `document`
  42120. // (such as Node.js), expose a factory as module.exports.
  42121. // This accentuates the need for the creation of a real `window`.
  42122. // e.g. var jQuery = require("jquery")(window);
  42123. // See ticket #14549 for more info.
  42124. module.exports = global.document ?
  42125. factory( global, true ) :
  42126. function( w ) {
  42127. if ( !w.document ) {
  42128. throw new Error( "jQuery requires a window with a document" );
  42129. }
  42130. return factory( w );
  42131. };
  42132. } else {
  42133. factory( global );
  42134. }
  42135. // Pass this if window is not defined yet
  42136. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  42137. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  42138. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  42139. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  42140. // enough that all such attempts are guarded in a try block.
  42141. "use strict";
  42142. var arr = [];
  42143. var document = window.document;
  42144. var getProto = Object.getPrototypeOf;
  42145. var slice = arr.slice;
  42146. var concat = arr.concat;
  42147. var push = arr.push;
  42148. var indexOf = arr.indexOf;
  42149. var class2type = {};
  42150. var toString = class2type.toString;
  42151. var hasOwn = class2type.hasOwnProperty;
  42152. var fnToString = hasOwn.toString;
  42153. var ObjectFunctionString = fnToString.call( Object );
  42154. var support = {};
  42155. var isFunction = function isFunction( obj ) {
  42156. // Support: Chrome <=57, Firefox <=52
  42157. // In some browsers, typeof returns "function" for HTML <object> elements
  42158. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  42159. // We don't want to classify *any* DOM node as a function.
  42160. return typeof obj === "function" && typeof obj.nodeType !== "number";
  42161. };
  42162. var isWindow = function isWindow( obj ) {
  42163. return obj != null && obj === obj.window;
  42164. };
  42165. var preservedScriptAttributes = {
  42166. type: true,
  42167. src: true,
  42168. noModule: true
  42169. };
  42170. function DOMEval( code, doc, node ) {
  42171. doc = doc || document;
  42172. var i,
  42173. script = doc.createElement( "script" );
  42174. script.text = code;
  42175. if ( node ) {
  42176. for ( i in preservedScriptAttributes ) {
  42177. if ( node[ i ] ) {
  42178. script[ i ] = node[ i ];
  42179. }
  42180. }
  42181. }
  42182. doc.head.appendChild( script ).parentNode.removeChild( script );
  42183. }
  42184. function toType( obj ) {
  42185. if ( obj == null ) {
  42186. return obj + "";
  42187. }
  42188. // Support: Android <=2.3 only (functionish RegExp)
  42189. return typeof obj === "object" || typeof obj === "function" ?
  42190. class2type[ toString.call( obj ) ] || "object" :
  42191. typeof obj;
  42192. }
  42193. /* global Symbol */
  42194. // Defining this global in .eslintrc.json would create a danger of using the global
  42195. // unguarded in another place, it seems safer to define global only for this module
  42196. var
  42197. version = "3.3.1",
  42198. // Define a local copy of jQuery
  42199. jQuery = function( selector, context ) {
  42200. // The jQuery object is actually just the init constructor 'enhanced'
  42201. // Need init if jQuery is called (just allow error to be thrown if not included)
  42202. return new jQuery.fn.init( selector, context );
  42203. },
  42204. // Support: Android <=4.0 only
  42205. // Make sure we trim BOM and NBSP
  42206. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  42207. jQuery.fn = jQuery.prototype = {
  42208. // The current version of jQuery being used
  42209. jquery: version,
  42210. constructor: jQuery,
  42211. // The default length of a jQuery object is 0
  42212. length: 0,
  42213. toArray: function() {
  42214. return slice.call( this );
  42215. },
  42216. // Get the Nth element in the matched element set OR
  42217. // Get the whole matched element set as a clean array
  42218. get: function( num ) {
  42219. // Return all the elements in a clean array
  42220. if ( num == null ) {
  42221. return slice.call( this );
  42222. }
  42223. // Return just the one element from the set
  42224. return num < 0 ? this[ num + this.length ] : this[ num ];
  42225. },
  42226. // Take an array of elements and push it onto the stack
  42227. // (returning the new matched element set)
  42228. pushStack: function( elems ) {
  42229. // Build a new jQuery matched element set
  42230. var ret = jQuery.merge( this.constructor(), elems );
  42231. // Add the old object onto the stack (as a reference)
  42232. ret.prevObject = this;
  42233. // Return the newly-formed element set
  42234. return ret;
  42235. },
  42236. // Execute a callback for every element in the matched set.
  42237. each: function( callback ) {
  42238. return jQuery.each( this, callback );
  42239. },
  42240. map: function( callback ) {
  42241. return this.pushStack( jQuery.map( this, function( elem, i ) {
  42242. return callback.call( elem, i, elem );
  42243. } ) );
  42244. },
  42245. slice: function() {
  42246. return this.pushStack( slice.apply( this, arguments ) );
  42247. },
  42248. first: function() {
  42249. return this.eq( 0 );
  42250. },
  42251. last: function() {
  42252. return this.eq( -1 );
  42253. },
  42254. eq: function( i ) {
  42255. var len = this.length,
  42256. j = +i + ( i < 0 ? len : 0 );
  42257. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  42258. },
  42259. end: function() {
  42260. return this.prevObject || this.constructor();
  42261. },
  42262. // For internal use only.
  42263. // Behaves like an Array's method, not like a jQuery method.
  42264. push: push,
  42265. sort: arr.sort,
  42266. splice: arr.splice
  42267. };
  42268. jQuery.extend = jQuery.fn.extend = function() {
  42269. var options, name, src, copy, copyIsArray, clone,
  42270. target = arguments[ 0 ] || {},
  42271. i = 1,
  42272. length = arguments.length,
  42273. deep = false;
  42274. // Handle a deep copy situation
  42275. if ( typeof target === "boolean" ) {
  42276. deep = target;
  42277. // Skip the boolean and the target
  42278. target = arguments[ i ] || {};
  42279. i++;
  42280. }
  42281. // Handle case when target is a string or something (possible in deep copy)
  42282. if ( typeof target !== "object" && !isFunction( target ) ) {
  42283. target = {};
  42284. }
  42285. // Extend jQuery itself if only one argument is passed
  42286. if ( i === length ) {
  42287. target = this;
  42288. i--;
  42289. }
  42290. for ( ; i < length; i++ ) {
  42291. // Only deal with non-null/undefined values
  42292. if ( ( options = arguments[ i ] ) != null ) {
  42293. // Extend the base object
  42294. for ( name in options ) {
  42295. src = target[ name ];
  42296. copy = options[ name ];
  42297. // Prevent never-ending loop
  42298. if ( target === copy ) {
  42299. continue;
  42300. }
  42301. // Recurse if we're merging plain objects or arrays
  42302. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  42303. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  42304. if ( copyIsArray ) {
  42305. copyIsArray = false;
  42306. clone = src && Array.isArray( src ) ? src : [];
  42307. } else {
  42308. clone = src && jQuery.isPlainObject( src ) ? src : {};
  42309. }
  42310. // Never move original objects, clone them
  42311. target[ name ] = jQuery.extend( deep, clone, copy );
  42312. // Don't bring in undefined values
  42313. } else if ( copy !== undefined ) {
  42314. target[ name ] = copy;
  42315. }
  42316. }
  42317. }
  42318. }
  42319. // Return the modified object
  42320. return target;
  42321. };
  42322. jQuery.extend( {
  42323. // Unique for each copy of jQuery on the page
  42324. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  42325. // Assume jQuery is ready without the ready module
  42326. isReady: true,
  42327. error: function( msg ) {
  42328. throw new Error( msg );
  42329. },
  42330. noop: function() {},
  42331. isPlainObject: function( obj ) {
  42332. var proto, Ctor;
  42333. // Detect obvious negatives
  42334. // Use toString instead of jQuery.type to catch host objects
  42335. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  42336. return false;
  42337. }
  42338. proto = getProto( obj );
  42339. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  42340. if ( !proto ) {
  42341. return true;
  42342. }
  42343. // Objects with prototype are plain iff they were constructed by a global Object function
  42344. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  42345. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  42346. },
  42347. isEmptyObject: function( obj ) {
  42348. /* eslint-disable no-unused-vars */
  42349. // See https://github.com/eslint/eslint/issues/6125
  42350. var name;
  42351. for ( name in obj ) {
  42352. return false;
  42353. }
  42354. return true;
  42355. },
  42356. // Evaluates a script in a global context
  42357. globalEval: function( code ) {
  42358. DOMEval( code );
  42359. },
  42360. each: function( obj, callback ) {
  42361. var length, i = 0;
  42362. if ( isArrayLike( obj ) ) {
  42363. length = obj.length;
  42364. for ( ; i < length; i++ ) {
  42365. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  42366. break;
  42367. }
  42368. }
  42369. } else {
  42370. for ( i in obj ) {
  42371. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  42372. break;
  42373. }
  42374. }
  42375. }
  42376. return obj;
  42377. },
  42378. // Support: Android <=4.0 only
  42379. trim: function( text ) {
  42380. return text == null ?
  42381. "" :
  42382. ( text + "" ).replace( rtrim, "" );
  42383. },
  42384. // results is for internal usage only
  42385. makeArray: function( arr, results ) {
  42386. var ret = results || [];
  42387. if ( arr != null ) {
  42388. if ( isArrayLike( Object( arr ) ) ) {
  42389. jQuery.merge( ret,
  42390. typeof arr === "string" ?
  42391. [ arr ] : arr
  42392. );
  42393. } else {
  42394. push.call( ret, arr );
  42395. }
  42396. }
  42397. return ret;
  42398. },
  42399. inArray: function( elem, arr, i ) {
  42400. return arr == null ? -1 : indexOf.call( arr, elem, i );
  42401. },
  42402. // Support: Android <=4.0 only, PhantomJS 1 only
  42403. // push.apply(_, arraylike) throws on ancient WebKit
  42404. merge: function( first, second ) {
  42405. var len = +second.length,
  42406. j = 0,
  42407. i = first.length;
  42408. for ( ; j < len; j++ ) {
  42409. first[ i++ ] = second[ j ];
  42410. }
  42411. first.length = i;
  42412. return first;
  42413. },
  42414. grep: function( elems, callback, invert ) {
  42415. var callbackInverse,
  42416. matches = [],
  42417. i = 0,
  42418. length = elems.length,
  42419. callbackExpect = !invert;
  42420. // Go through the array, only saving the items
  42421. // that pass the validator function
  42422. for ( ; i < length; i++ ) {
  42423. callbackInverse = !callback( elems[ i ], i );
  42424. if ( callbackInverse !== callbackExpect ) {
  42425. matches.push( elems[ i ] );
  42426. }
  42427. }
  42428. return matches;
  42429. },
  42430. // arg is for internal usage only
  42431. map: function( elems, callback, arg ) {
  42432. var length, value,
  42433. i = 0,
  42434. ret = [];
  42435. // Go through the array, translating each of the items to their new values
  42436. if ( isArrayLike( elems ) ) {
  42437. length = elems.length;
  42438. for ( ; i < length; i++ ) {
  42439. value = callback( elems[ i ], i, arg );
  42440. if ( value != null ) {
  42441. ret.push( value );
  42442. }
  42443. }
  42444. // Go through every key on the object,
  42445. } else {
  42446. for ( i in elems ) {
  42447. value = callback( elems[ i ], i, arg );
  42448. if ( value != null ) {
  42449. ret.push( value );
  42450. }
  42451. }
  42452. }
  42453. // Flatten any nested arrays
  42454. return concat.apply( [], ret );
  42455. },
  42456. // A global GUID counter for objects
  42457. guid: 1,
  42458. // jQuery.support is not used in Core but other projects attach their
  42459. // properties to it so it needs to exist.
  42460. support: support
  42461. } );
  42462. if ( typeof Symbol === "function" ) {
  42463. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  42464. }
  42465. // Populate the class2type map
  42466. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  42467. function( i, name ) {
  42468. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  42469. } );
  42470. function isArrayLike( obj ) {
  42471. // Support: real iOS 8.2 only (not reproducible in simulator)
  42472. // `in` check used to prevent JIT error (gh-2145)
  42473. // hasOwn isn't used here due to false negatives
  42474. // regarding Nodelist length in IE
  42475. var length = !!obj && "length" in obj && obj.length,
  42476. type = toType( obj );
  42477. if ( isFunction( obj ) || isWindow( obj ) ) {
  42478. return false;
  42479. }
  42480. return type === "array" || length === 0 ||
  42481. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  42482. }
  42483. var Sizzle =
  42484. /*!
  42485. * Sizzle CSS Selector Engine v2.3.3
  42486. * https://sizzlejs.com/
  42487. *
  42488. * Copyright jQuery Foundation and other contributors
  42489. * Released under the MIT license
  42490. * http://jquery.org/license
  42491. *
  42492. * Date: 2016-08-08
  42493. */
  42494. (function( window ) {
  42495. var i,
  42496. support,
  42497. Expr,
  42498. getText,
  42499. isXML,
  42500. tokenize,
  42501. compile,
  42502. select,
  42503. outermostContext,
  42504. sortInput,
  42505. hasDuplicate,
  42506. // Local document vars
  42507. setDocument,
  42508. document,
  42509. docElem,
  42510. documentIsHTML,
  42511. rbuggyQSA,
  42512. rbuggyMatches,
  42513. matches,
  42514. contains,
  42515. // Instance-specific data
  42516. expando = "sizzle" + 1 * new Date(),
  42517. preferredDoc = window.document,
  42518. dirruns = 0,
  42519. done = 0,
  42520. classCache = createCache(),
  42521. tokenCache = createCache(),
  42522. compilerCache = createCache(),
  42523. sortOrder = function( a, b ) {
  42524. if ( a === b ) {
  42525. hasDuplicate = true;
  42526. }
  42527. return 0;
  42528. },
  42529. // Instance methods
  42530. hasOwn = ({}).hasOwnProperty,
  42531. arr = [],
  42532. pop = arr.pop,
  42533. push_native = arr.push,
  42534. push = arr.push,
  42535. slice = arr.slice,
  42536. // Use a stripped-down indexOf as it's faster than native
  42537. // https://jsperf.com/thor-indexof-vs-for/5
  42538. indexOf = function( list, elem ) {
  42539. var i = 0,
  42540. len = list.length;
  42541. for ( ; i < len; i++ ) {
  42542. if ( list[i] === elem ) {
  42543. return i;
  42544. }
  42545. }
  42546. return -1;
  42547. },
  42548. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  42549. // Regular expressions
  42550. // http://www.w3.org/TR/css3-selectors/#whitespace
  42551. whitespace = "[\\x20\\t\\r\\n\\f]",
  42552. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  42553. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  42554. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  42555. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  42556. // Operator (capture 2)
  42557. "*([*^$|!~]?=)" + whitespace +
  42558. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  42559. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  42560. "*\\]",
  42561. pseudos = ":(" + identifier + ")(?:\\((" +
  42562. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  42563. // 1. quoted (capture 3; capture 4 or capture 5)
  42564. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  42565. // 2. simple (capture 6)
  42566. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  42567. // 3. anything else (capture 2)
  42568. ".*" +
  42569. ")\\)|)",
  42570. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  42571. rwhitespace = new RegExp( whitespace + "+", "g" ),
  42572. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  42573. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  42574. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  42575. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  42576. rpseudo = new RegExp( pseudos ),
  42577. ridentifier = new RegExp( "^" + identifier + "$" ),
  42578. matchExpr = {
  42579. "ID": new RegExp( "^#(" + identifier + ")" ),
  42580. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  42581. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  42582. "ATTR": new RegExp( "^" + attributes ),
  42583. "PSEUDO": new RegExp( "^" + pseudos ),
  42584. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  42585. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  42586. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  42587. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  42588. // For use in libraries implementing .is()
  42589. // We use this for POS matching in `select`
  42590. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  42591. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  42592. },
  42593. rinputs = /^(?:input|select|textarea|button)$/i,
  42594. rheader = /^h\d$/i,
  42595. rnative = /^[^{]+\{\s*\[native \w/,
  42596. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  42597. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  42598. rsibling = /[+~]/,
  42599. // CSS escapes
  42600. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  42601. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  42602. funescape = function( _, escaped, escapedWhitespace ) {
  42603. var high = "0x" + escaped - 0x10000;
  42604. // NaN means non-codepoint
  42605. // Support: Firefox<24
  42606. // Workaround erroneous numeric interpretation of +"0x"
  42607. return high !== high || escapedWhitespace ?
  42608. escaped :
  42609. high < 0 ?
  42610. // BMP codepoint
  42611. String.fromCharCode( high + 0x10000 ) :
  42612. // Supplemental Plane codepoint (surrogate pair)
  42613. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  42614. },
  42615. // CSS string/identifier serialization
  42616. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  42617. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  42618. fcssescape = function( ch, asCodePoint ) {
  42619. if ( asCodePoint ) {
  42620. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  42621. if ( ch === "\0" ) {
  42622. return "\uFFFD";
  42623. }
  42624. // Control characters and (dependent upon position) numbers get escaped as code points
  42625. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  42626. }
  42627. // Other potentially-special ASCII characters get backslash-escaped
  42628. return "\\" + ch;
  42629. },
  42630. // Used for iframes
  42631. // See setDocument()
  42632. // Removing the function wrapper causes a "Permission Denied"
  42633. // error in IE
  42634. unloadHandler = function() {
  42635. setDocument();
  42636. },
  42637. disabledAncestor = addCombinator(
  42638. function( elem ) {
  42639. return elem.disabled === true && ("form" in elem || "label" in elem);
  42640. },
  42641. { dir: "parentNode", next: "legend" }
  42642. );
  42643. // Optimize for push.apply( _, NodeList )
  42644. try {
  42645. push.apply(
  42646. (arr = slice.call( preferredDoc.childNodes )),
  42647. preferredDoc.childNodes
  42648. );
  42649. // Support: Android<4.0
  42650. // Detect silently failing push.apply
  42651. arr[ preferredDoc.childNodes.length ].nodeType;
  42652. } catch ( e ) {
  42653. push = { apply: arr.length ?
  42654. // Leverage slice if possible
  42655. function( target, els ) {
  42656. push_native.apply( target, slice.call(els) );
  42657. } :
  42658. // Support: IE<9
  42659. // Otherwise append directly
  42660. function( target, els ) {
  42661. var j = target.length,
  42662. i = 0;
  42663. // Can't trust NodeList.length
  42664. while ( (target[j++] = els[i++]) ) {}
  42665. target.length = j - 1;
  42666. }
  42667. };
  42668. }
  42669. function Sizzle( selector, context, results, seed ) {
  42670. var m, i, elem, nid, match, groups, newSelector,
  42671. newContext = context && context.ownerDocument,
  42672. // nodeType defaults to 9, since context defaults to document
  42673. nodeType = context ? context.nodeType : 9;
  42674. results = results || [];
  42675. // Return early from calls with invalid selector or context
  42676. if ( typeof selector !== "string" || !selector ||
  42677. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  42678. return results;
  42679. }
  42680. // Try to shortcut find operations (as opposed to filters) in HTML documents
  42681. if ( !seed ) {
  42682. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  42683. setDocument( context );
  42684. }
  42685. context = context || document;
  42686. if ( documentIsHTML ) {
  42687. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  42688. // (excepting DocumentFragment context, where the methods don't exist)
  42689. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  42690. // ID selector
  42691. if ( (m = match[1]) ) {
  42692. // Document context
  42693. if ( nodeType === 9 ) {
  42694. if ( (elem = context.getElementById( m )) ) {
  42695. // Support: IE, Opera, Webkit
  42696. // TODO: identify versions
  42697. // getElementById can match elements by name instead of ID
  42698. if ( elem.id === m ) {
  42699. results.push( elem );
  42700. return results;
  42701. }
  42702. } else {
  42703. return results;
  42704. }
  42705. // Element context
  42706. } else {
  42707. // Support: IE, Opera, Webkit
  42708. // TODO: identify versions
  42709. // getElementById can match elements by name instead of ID
  42710. if ( newContext && (elem = newContext.getElementById( m )) &&
  42711. contains( context, elem ) &&
  42712. elem.id === m ) {
  42713. results.push( elem );
  42714. return results;
  42715. }
  42716. }
  42717. // Type selector
  42718. } else if ( match[2] ) {
  42719. push.apply( results, context.getElementsByTagName( selector ) );
  42720. return results;
  42721. // Class selector
  42722. } else if ( (m = match[3]) && support.getElementsByClassName &&
  42723. context.getElementsByClassName ) {
  42724. push.apply( results, context.getElementsByClassName( m ) );
  42725. return results;
  42726. }
  42727. }
  42728. // Take advantage of querySelectorAll
  42729. if ( support.qsa &&
  42730. !compilerCache[ selector + " " ] &&
  42731. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  42732. if ( nodeType !== 1 ) {
  42733. newContext = context;
  42734. newSelector = selector;
  42735. // qSA looks outside Element context, which is not what we want
  42736. // Thanks to Andrew Dupont for this workaround technique
  42737. // Support: IE <=8
  42738. // Exclude object elements
  42739. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  42740. // Capture the context ID, setting it first if necessary
  42741. if ( (nid = context.getAttribute( "id" )) ) {
  42742. nid = nid.replace( rcssescape, fcssescape );
  42743. } else {
  42744. context.setAttribute( "id", (nid = expando) );
  42745. }
  42746. // Prefix every selector in the list
  42747. groups = tokenize( selector );
  42748. i = groups.length;
  42749. while ( i-- ) {
  42750. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  42751. }
  42752. newSelector = groups.join( "," );
  42753. // Expand context for sibling selectors
  42754. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  42755. context;
  42756. }
  42757. if ( newSelector ) {
  42758. try {
  42759. push.apply( results,
  42760. newContext.querySelectorAll( newSelector )
  42761. );
  42762. return results;
  42763. } catch ( qsaError ) {
  42764. } finally {
  42765. if ( nid === expando ) {
  42766. context.removeAttribute( "id" );
  42767. }
  42768. }
  42769. }
  42770. }
  42771. }
  42772. }
  42773. // All others
  42774. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  42775. }
  42776. /**
  42777. * Create key-value caches of limited size
  42778. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  42779. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  42780. * deleting the oldest entry
  42781. */
  42782. function createCache() {
  42783. var keys = [];
  42784. function cache( key, value ) {
  42785. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  42786. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  42787. // Only keep the most recent entries
  42788. delete cache[ keys.shift() ];
  42789. }
  42790. return (cache[ key + " " ] = value);
  42791. }
  42792. return cache;
  42793. }
  42794. /**
  42795. * Mark a function for special use by Sizzle
  42796. * @param {Function} fn The function to mark
  42797. */
  42798. function markFunction( fn ) {
  42799. fn[ expando ] = true;
  42800. return fn;
  42801. }
  42802. /**
  42803. * Support testing using an element
  42804. * @param {Function} fn Passed the created element and returns a boolean result
  42805. */
  42806. function assert( fn ) {
  42807. var el = document.createElement("fieldset");
  42808. try {
  42809. return !!fn( el );
  42810. } catch (e) {
  42811. return false;
  42812. } finally {
  42813. // Remove from its parent by default
  42814. if ( el.parentNode ) {
  42815. el.parentNode.removeChild( el );
  42816. }
  42817. // release memory in IE
  42818. el = null;
  42819. }
  42820. }
  42821. /**
  42822. * Adds the same handler for all of the specified attrs
  42823. * @param {String} attrs Pipe-separated list of attributes
  42824. * @param {Function} handler The method that will be applied
  42825. */
  42826. function addHandle( attrs, handler ) {
  42827. var arr = attrs.split("|"),
  42828. i = arr.length;
  42829. while ( i-- ) {
  42830. Expr.attrHandle[ arr[i] ] = handler;
  42831. }
  42832. }
  42833. /**
  42834. * Checks document order of two siblings
  42835. * @param {Element} a
  42836. * @param {Element} b
  42837. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  42838. */
  42839. function siblingCheck( a, b ) {
  42840. var cur = b && a,
  42841. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  42842. a.sourceIndex - b.sourceIndex;
  42843. // Use IE sourceIndex if available on both nodes
  42844. if ( diff ) {
  42845. return diff;
  42846. }
  42847. // Check if b follows a
  42848. if ( cur ) {
  42849. while ( (cur = cur.nextSibling) ) {
  42850. if ( cur === b ) {
  42851. return -1;
  42852. }
  42853. }
  42854. }
  42855. return a ? 1 : -1;
  42856. }
  42857. /**
  42858. * Returns a function to use in pseudos for input types
  42859. * @param {String} type
  42860. */
  42861. function createInputPseudo( type ) {
  42862. return function( elem ) {
  42863. var name = elem.nodeName.toLowerCase();
  42864. return name === "input" && elem.type === type;
  42865. };
  42866. }
  42867. /**
  42868. * Returns a function to use in pseudos for buttons
  42869. * @param {String} type
  42870. */
  42871. function createButtonPseudo( type ) {
  42872. return function( elem ) {
  42873. var name = elem.nodeName.toLowerCase();
  42874. return (name === "input" || name === "button") && elem.type === type;
  42875. };
  42876. }
  42877. /**
  42878. * Returns a function to use in pseudos for :enabled/:disabled
  42879. * @param {Boolean} disabled true for :disabled; false for :enabled
  42880. */
  42881. function createDisabledPseudo( disabled ) {
  42882. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  42883. return function( elem ) {
  42884. // Only certain elements can match :enabled or :disabled
  42885. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  42886. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  42887. if ( "form" in elem ) {
  42888. // Check for inherited disabledness on relevant non-disabled elements:
  42889. // * listed form-associated elements in a disabled fieldset
  42890. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  42891. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  42892. // * option elements in a disabled optgroup
  42893. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  42894. // All such elements have a "form" property.
  42895. if ( elem.parentNode && elem.disabled === false ) {
  42896. // Option elements defer to a parent optgroup if present
  42897. if ( "label" in elem ) {
  42898. if ( "label" in elem.parentNode ) {
  42899. return elem.parentNode.disabled === disabled;
  42900. } else {
  42901. return elem.disabled === disabled;
  42902. }
  42903. }
  42904. // Support: IE 6 - 11
  42905. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  42906. return elem.isDisabled === disabled ||
  42907. // Where there is no isDisabled, check manually
  42908. /* jshint -W018 */
  42909. elem.isDisabled !== !disabled &&
  42910. disabledAncestor( elem ) === disabled;
  42911. }
  42912. return elem.disabled === disabled;
  42913. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  42914. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  42915. // even exist on them, let alone have a boolean value.
  42916. } else if ( "label" in elem ) {
  42917. return elem.disabled === disabled;
  42918. }
  42919. // Remaining elements are neither :enabled nor :disabled
  42920. return false;
  42921. };
  42922. }
  42923. /**
  42924. * Returns a function to use in pseudos for positionals
  42925. * @param {Function} fn
  42926. */
  42927. function createPositionalPseudo( fn ) {
  42928. return markFunction(function( argument ) {
  42929. argument = +argument;
  42930. return markFunction(function( seed, matches ) {
  42931. var j,
  42932. matchIndexes = fn( [], seed.length, argument ),
  42933. i = matchIndexes.length;
  42934. // Match elements found at the specified indexes
  42935. while ( i-- ) {
  42936. if ( seed[ (j = matchIndexes[i]) ] ) {
  42937. seed[j] = !(matches[j] = seed[j]);
  42938. }
  42939. }
  42940. });
  42941. });
  42942. }
  42943. /**
  42944. * Checks a node for validity as a Sizzle context
  42945. * @param {Element|Object=} context
  42946. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  42947. */
  42948. function testContext( context ) {
  42949. return context && typeof context.getElementsByTagName !== "undefined" && context;
  42950. }
  42951. // Expose support vars for convenience
  42952. support = Sizzle.support = {};
  42953. /**
  42954. * Detects XML nodes
  42955. * @param {Element|Object} elem An element or a document
  42956. * @returns {Boolean} True iff elem is a non-HTML XML node
  42957. */
  42958. isXML = Sizzle.isXML = function( elem ) {
  42959. // documentElement is verified for cases where it doesn't yet exist
  42960. // (such as loading iframes in IE - #4833)
  42961. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  42962. return documentElement ? documentElement.nodeName !== "HTML" : false;
  42963. };
  42964. /**
  42965. * Sets document-related variables once based on the current document
  42966. * @param {Element|Object} [doc] An element or document object to use to set the document
  42967. * @returns {Object} Returns the current document
  42968. */
  42969. setDocument = Sizzle.setDocument = function( node ) {
  42970. var hasCompare, subWindow,
  42971. doc = node ? node.ownerDocument || node : preferredDoc;
  42972. // Return early if doc is invalid or already selected
  42973. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  42974. return document;
  42975. }
  42976. // Update global variables
  42977. document = doc;
  42978. docElem = document.documentElement;
  42979. documentIsHTML = !isXML( document );
  42980. // Support: IE 9-11, Edge
  42981. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  42982. if ( preferredDoc !== document &&
  42983. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  42984. // Support: IE 11, Edge
  42985. if ( subWindow.addEventListener ) {
  42986. subWindow.addEventListener( "unload", unloadHandler, false );
  42987. // Support: IE 9 - 10 only
  42988. } else if ( subWindow.attachEvent ) {
  42989. subWindow.attachEvent( "onunload", unloadHandler );
  42990. }
  42991. }
  42992. /* Attributes
  42993. ---------------------------------------------------------------------- */
  42994. // Support: IE<8
  42995. // Verify that getAttribute really returns attributes and not properties
  42996. // (excepting IE8 booleans)
  42997. support.attributes = assert(function( el ) {
  42998. el.className = "i";
  42999. return !el.getAttribute("className");
  43000. });
  43001. /* getElement(s)By*
  43002. ---------------------------------------------------------------------- */
  43003. // Check if getElementsByTagName("*") returns only elements
  43004. support.getElementsByTagName = assert(function( el ) {
  43005. el.appendChild( document.createComment("") );
  43006. return !el.getElementsByTagName("*").length;
  43007. });
  43008. // Support: IE<9
  43009. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  43010. // Support: IE<10
  43011. // Check if getElementById returns elements by name
  43012. // The broken getElementById methods don't pick up programmatically-set names,
  43013. // so use a roundabout getElementsByName test
  43014. support.getById = assert(function( el ) {
  43015. docElem.appendChild( el ).id = expando;
  43016. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  43017. });
  43018. // ID filter and find
  43019. if ( support.getById ) {
  43020. Expr.filter["ID"] = function( id ) {
  43021. var attrId = id.replace( runescape, funescape );
  43022. return function( elem ) {
  43023. return elem.getAttribute("id") === attrId;
  43024. };
  43025. };
  43026. Expr.find["ID"] = function( id, context ) {
  43027. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  43028. var elem = context.getElementById( id );
  43029. return elem ? [ elem ] : [];
  43030. }
  43031. };
  43032. } else {
  43033. Expr.filter["ID"] = function( id ) {
  43034. var attrId = id.replace( runescape, funescape );
  43035. return function( elem ) {
  43036. var node = typeof elem.getAttributeNode !== "undefined" &&
  43037. elem.getAttributeNode("id");
  43038. return node && node.value === attrId;
  43039. };
  43040. };
  43041. // Support: IE 6 - 7 only
  43042. // getElementById is not reliable as a find shortcut
  43043. Expr.find["ID"] = function( id, context ) {
  43044. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  43045. var node, i, elems,
  43046. elem = context.getElementById( id );
  43047. if ( elem ) {
  43048. // Verify the id attribute
  43049. node = elem.getAttributeNode("id");
  43050. if ( node && node.value === id ) {
  43051. return [ elem ];
  43052. }
  43053. // Fall back on getElementsByName
  43054. elems = context.getElementsByName( id );
  43055. i = 0;
  43056. while ( (elem = elems[i++]) ) {
  43057. node = elem.getAttributeNode("id");
  43058. if ( node && node.value === id ) {
  43059. return [ elem ];
  43060. }
  43061. }
  43062. }
  43063. return [];
  43064. }
  43065. };
  43066. }
  43067. // Tag
  43068. Expr.find["TAG"] = support.getElementsByTagName ?
  43069. function( tag, context ) {
  43070. if ( typeof context.getElementsByTagName !== "undefined" ) {
  43071. return context.getElementsByTagName( tag );
  43072. // DocumentFragment nodes don't have gEBTN
  43073. } else if ( support.qsa ) {
  43074. return context.querySelectorAll( tag );
  43075. }
  43076. } :
  43077. function( tag, context ) {
  43078. var elem,
  43079. tmp = [],
  43080. i = 0,
  43081. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  43082. results = context.getElementsByTagName( tag );
  43083. // Filter out possible comments
  43084. if ( tag === "*" ) {
  43085. while ( (elem = results[i++]) ) {
  43086. if ( elem.nodeType === 1 ) {
  43087. tmp.push( elem );
  43088. }
  43089. }
  43090. return tmp;
  43091. }
  43092. return results;
  43093. };
  43094. // Class
  43095. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  43096. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  43097. return context.getElementsByClassName( className );
  43098. }
  43099. };
  43100. /* QSA/matchesSelector
  43101. ---------------------------------------------------------------------- */
  43102. // QSA and matchesSelector support
  43103. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  43104. rbuggyMatches = [];
  43105. // qSa(:focus) reports false when true (Chrome 21)
  43106. // We allow this because of a bug in IE8/9 that throws an error
  43107. // whenever `document.activeElement` is accessed on an iframe
  43108. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  43109. // See https://bugs.jquery.com/ticket/13378
  43110. rbuggyQSA = [];
  43111. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  43112. // Build QSA regex
  43113. // Regex strategy adopted from Diego Perini
  43114. assert(function( el ) {
  43115. // Select is set to empty string on purpose
  43116. // This is to test IE's treatment of not explicitly
  43117. // setting a boolean content attribute,
  43118. // since its presence should be enough
  43119. // https://bugs.jquery.com/ticket/12359
  43120. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  43121. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  43122. "<option selected=''></option></select>";
  43123. // Support: IE8, Opera 11-12.16
  43124. // Nothing should be selected when empty strings follow ^= or $= or *=
  43125. // The test attribute must be unknown in Opera but "safe" for WinRT
  43126. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  43127. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  43128. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  43129. }
  43130. // Support: IE8
  43131. // Boolean attributes and "value" are not treated correctly
  43132. if ( !el.querySelectorAll("[selected]").length ) {
  43133. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  43134. }
  43135. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  43136. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  43137. rbuggyQSA.push("~=");
  43138. }
  43139. // Webkit/Opera - :checked should return selected option elements
  43140. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  43141. // IE8 throws error here and will not see later tests
  43142. if ( !el.querySelectorAll(":checked").length ) {
  43143. rbuggyQSA.push(":checked");
  43144. }
  43145. // Support: Safari 8+, iOS 8+
  43146. // https://bugs.webkit.org/show_bug.cgi?id=136851
  43147. // In-page `selector#id sibling-combinator selector` fails
  43148. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  43149. rbuggyQSA.push(".#.+[+~]");
  43150. }
  43151. });
  43152. assert(function( el ) {
  43153. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  43154. "<select disabled='disabled'><option/></select>";
  43155. // Support: Windows 8 Native Apps
  43156. // The type and name attributes are restricted during .innerHTML assignment
  43157. var input = document.createElement("input");
  43158. input.setAttribute( "type", "hidden" );
  43159. el.appendChild( input ).setAttribute( "name", "D" );
  43160. // Support: IE8
  43161. // Enforce case-sensitivity of name attribute
  43162. if ( el.querySelectorAll("[name=d]").length ) {
  43163. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  43164. }
  43165. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  43166. // IE8 throws error here and will not see later tests
  43167. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  43168. rbuggyQSA.push( ":enabled", ":disabled" );
  43169. }
  43170. // Support: IE9-11+
  43171. // IE's :disabled selector does not pick up the children of disabled fieldsets
  43172. docElem.appendChild( el ).disabled = true;
  43173. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  43174. rbuggyQSA.push( ":enabled", ":disabled" );
  43175. }
  43176. // Opera 10-11 does not throw on post-comma invalid pseudos
  43177. el.querySelectorAll("*,:x");
  43178. rbuggyQSA.push(",.*:");
  43179. });
  43180. }
  43181. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  43182. docElem.webkitMatchesSelector ||
  43183. docElem.mozMatchesSelector ||
  43184. docElem.oMatchesSelector ||
  43185. docElem.msMatchesSelector) )) ) {
  43186. assert(function( el ) {
  43187. // Check to see if it's possible to do matchesSelector
  43188. // on a disconnected node (IE 9)
  43189. support.disconnectedMatch = matches.call( el, "*" );
  43190. // This should fail with an exception
  43191. // Gecko does not error, returns false instead
  43192. matches.call( el, "[s!='']:x" );
  43193. rbuggyMatches.push( "!=", pseudos );
  43194. });
  43195. }
  43196. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  43197. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  43198. /* Contains
  43199. ---------------------------------------------------------------------- */
  43200. hasCompare = rnative.test( docElem.compareDocumentPosition );
  43201. // Element contains another
  43202. // Purposefully self-exclusive
  43203. // As in, an element does not contain itself
  43204. contains = hasCompare || rnative.test( docElem.contains ) ?
  43205. function( a, b ) {
  43206. var adown = a.nodeType === 9 ? a.documentElement : a,
  43207. bup = b && b.parentNode;
  43208. return a === bup || !!( bup && bup.nodeType === 1 && (
  43209. adown.contains ?
  43210. adown.contains( bup ) :
  43211. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  43212. ));
  43213. } :
  43214. function( a, b ) {
  43215. if ( b ) {
  43216. while ( (b = b.parentNode) ) {
  43217. if ( b === a ) {
  43218. return true;
  43219. }
  43220. }
  43221. }
  43222. return false;
  43223. };
  43224. /* Sorting
  43225. ---------------------------------------------------------------------- */
  43226. // Document order sorting
  43227. sortOrder = hasCompare ?
  43228. function( a, b ) {
  43229. // Flag for duplicate removal
  43230. if ( a === b ) {
  43231. hasDuplicate = true;
  43232. return 0;
  43233. }
  43234. // Sort on method existence if only one input has compareDocumentPosition
  43235. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  43236. if ( compare ) {
  43237. return compare;
  43238. }
  43239. // Calculate position if both inputs belong to the same document
  43240. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  43241. a.compareDocumentPosition( b ) :
  43242. // Otherwise we know they are disconnected
  43243. 1;
  43244. // Disconnected nodes
  43245. if ( compare & 1 ||
  43246. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  43247. // Choose the first element that is related to our preferred document
  43248. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  43249. return -1;
  43250. }
  43251. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  43252. return 1;
  43253. }
  43254. // Maintain original order
  43255. return sortInput ?
  43256. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  43257. 0;
  43258. }
  43259. return compare & 4 ? -1 : 1;
  43260. } :
  43261. function( a, b ) {
  43262. // Exit early if the nodes are identical
  43263. if ( a === b ) {
  43264. hasDuplicate = true;
  43265. return 0;
  43266. }
  43267. var cur,
  43268. i = 0,
  43269. aup = a.parentNode,
  43270. bup = b.parentNode,
  43271. ap = [ a ],
  43272. bp = [ b ];
  43273. // Parentless nodes are either documents or disconnected
  43274. if ( !aup || !bup ) {
  43275. return a === document ? -1 :
  43276. b === document ? 1 :
  43277. aup ? -1 :
  43278. bup ? 1 :
  43279. sortInput ?
  43280. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  43281. 0;
  43282. // If the nodes are siblings, we can do a quick check
  43283. } else if ( aup === bup ) {
  43284. return siblingCheck( a, b );
  43285. }
  43286. // Otherwise we need full lists of their ancestors for comparison
  43287. cur = a;
  43288. while ( (cur = cur.parentNode) ) {
  43289. ap.unshift( cur );
  43290. }
  43291. cur = b;
  43292. while ( (cur = cur.parentNode) ) {
  43293. bp.unshift( cur );
  43294. }
  43295. // Walk down the tree looking for a discrepancy
  43296. while ( ap[i] === bp[i] ) {
  43297. i++;
  43298. }
  43299. return i ?
  43300. // Do a sibling check if the nodes have a common ancestor
  43301. siblingCheck( ap[i], bp[i] ) :
  43302. // Otherwise nodes in our document sort first
  43303. ap[i] === preferredDoc ? -1 :
  43304. bp[i] === preferredDoc ? 1 :
  43305. 0;
  43306. };
  43307. return document;
  43308. };
  43309. Sizzle.matches = function( expr, elements ) {
  43310. return Sizzle( expr, null, null, elements );
  43311. };
  43312. Sizzle.matchesSelector = function( elem, expr ) {
  43313. // Set document vars if needed
  43314. if ( ( elem.ownerDocument || elem ) !== document ) {
  43315. setDocument( elem );
  43316. }
  43317. // Make sure that attribute selectors are quoted
  43318. expr = expr.replace( rattributeQuotes, "='$1']" );
  43319. if ( support.matchesSelector && documentIsHTML &&
  43320. !compilerCache[ expr + " " ] &&
  43321. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  43322. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  43323. try {
  43324. var ret = matches.call( elem, expr );
  43325. // IE 9's matchesSelector returns false on disconnected nodes
  43326. if ( ret || support.disconnectedMatch ||
  43327. // As well, disconnected nodes are said to be in a document
  43328. // fragment in IE 9
  43329. elem.document && elem.document.nodeType !== 11 ) {
  43330. return ret;
  43331. }
  43332. } catch (e) {}
  43333. }
  43334. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  43335. };
  43336. Sizzle.contains = function( context, elem ) {
  43337. // Set document vars if needed
  43338. if ( ( context.ownerDocument || context ) !== document ) {
  43339. setDocument( context );
  43340. }
  43341. return contains( context, elem );
  43342. };
  43343. Sizzle.attr = function( elem, name ) {
  43344. // Set document vars if needed
  43345. if ( ( elem.ownerDocument || elem ) !== document ) {
  43346. setDocument( elem );
  43347. }
  43348. var fn = Expr.attrHandle[ name.toLowerCase() ],
  43349. // Don't get fooled by Object.prototype properties (jQuery #13807)
  43350. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  43351. fn( elem, name, !documentIsHTML ) :
  43352. undefined;
  43353. return val !== undefined ?
  43354. val :
  43355. support.attributes || !documentIsHTML ?
  43356. elem.getAttribute( name ) :
  43357. (val = elem.getAttributeNode(name)) && val.specified ?
  43358. val.value :
  43359. null;
  43360. };
  43361. Sizzle.escape = function( sel ) {
  43362. return (sel + "").replace( rcssescape, fcssescape );
  43363. };
  43364. Sizzle.error = function( msg ) {
  43365. throw new Error( "Syntax error, unrecognized expression: " + msg );
  43366. };
  43367. /**
  43368. * Document sorting and removing duplicates
  43369. * @param {ArrayLike} results
  43370. */
  43371. Sizzle.uniqueSort = function( results ) {
  43372. var elem,
  43373. duplicates = [],
  43374. j = 0,
  43375. i = 0;
  43376. // Unless we *know* we can detect duplicates, assume their presence
  43377. hasDuplicate = !support.detectDuplicates;
  43378. sortInput = !support.sortStable && results.slice( 0 );
  43379. results.sort( sortOrder );
  43380. if ( hasDuplicate ) {
  43381. while ( (elem = results[i++]) ) {
  43382. if ( elem === results[ i ] ) {
  43383. j = duplicates.push( i );
  43384. }
  43385. }
  43386. while ( j-- ) {
  43387. results.splice( duplicates[ j ], 1 );
  43388. }
  43389. }
  43390. // Clear input after sorting to release objects
  43391. // See https://github.com/jquery/sizzle/pull/225
  43392. sortInput = null;
  43393. return results;
  43394. };
  43395. /**
  43396. * Utility function for retrieving the text value of an array of DOM nodes
  43397. * @param {Array|Element} elem
  43398. */
  43399. getText = Sizzle.getText = function( elem ) {
  43400. var node,
  43401. ret = "",
  43402. i = 0,
  43403. nodeType = elem.nodeType;
  43404. if ( !nodeType ) {
  43405. // If no nodeType, this is expected to be an array
  43406. while ( (node = elem[i++]) ) {
  43407. // Do not traverse comment nodes
  43408. ret += getText( node );
  43409. }
  43410. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  43411. // Use textContent for elements
  43412. // innerText usage removed for consistency of new lines (jQuery #11153)
  43413. if ( typeof elem.textContent === "string" ) {
  43414. return elem.textContent;
  43415. } else {
  43416. // Traverse its children
  43417. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  43418. ret += getText( elem );
  43419. }
  43420. }
  43421. } else if ( nodeType === 3 || nodeType === 4 ) {
  43422. return elem.nodeValue;
  43423. }
  43424. // Do not include comment or processing instruction nodes
  43425. return ret;
  43426. };
  43427. Expr = Sizzle.selectors = {
  43428. // Can be adjusted by the user
  43429. cacheLength: 50,
  43430. createPseudo: markFunction,
  43431. match: matchExpr,
  43432. attrHandle: {},
  43433. find: {},
  43434. relative: {
  43435. ">": { dir: "parentNode", first: true },
  43436. " ": { dir: "parentNode" },
  43437. "+": { dir: "previousSibling", first: true },
  43438. "~": { dir: "previousSibling" }
  43439. },
  43440. preFilter: {
  43441. "ATTR": function( match ) {
  43442. match[1] = match[1].replace( runescape, funescape );
  43443. // Move the given value to match[3] whether quoted or unquoted
  43444. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  43445. if ( match[2] === "~=" ) {
  43446. match[3] = " " + match[3] + " ";
  43447. }
  43448. return match.slice( 0, 4 );
  43449. },
  43450. "CHILD": function( match ) {
  43451. /* matches from matchExpr["CHILD"]
  43452. 1 type (only|nth|...)
  43453. 2 what (child|of-type)
  43454. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  43455. 4 xn-component of xn+y argument ([+-]?\d*n|)
  43456. 5 sign of xn-component
  43457. 6 x of xn-component
  43458. 7 sign of y-component
  43459. 8 y of y-component
  43460. */
  43461. match[1] = match[1].toLowerCase();
  43462. if ( match[1].slice( 0, 3 ) === "nth" ) {
  43463. // nth-* requires argument
  43464. if ( !match[3] ) {
  43465. Sizzle.error( match[0] );
  43466. }
  43467. // numeric x and y parameters for Expr.filter.CHILD
  43468. // remember that false/true cast respectively to 0/1
  43469. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  43470. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  43471. // other types prohibit arguments
  43472. } else if ( match[3] ) {
  43473. Sizzle.error( match[0] );
  43474. }
  43475. return match;
  43476. },
  43477. "PSEUDO": function( match ) {
  43478. var excess,
  43479. unquoted = !match[6] && match[2];
  43480. if ( matchExpr["CHILD"].test( match[0] ) ) {
  43481. return null;
  43482. }
  43483. // Accept quoted arguments as-is
  43484. if ( match[3] ) {
  43485. match[2] = match[4] || match[5] || "";
  43486. // Strip excess characters from unquoted arguments
  43487. } else if ( unquoted && rpseudo.test( unquoted ) &&
  43488. // Get excess from tokenize (recursively)
  43489. (excess = tokenize( unquoted, true )) &&
  43490. // advance to the next closing parenthesis
  43491. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  43492. // excess is a negative index
  43493. match[0] = match[0].slice( 0, excess );
  43494. match[2] = unquoted.slice( 0, excess );
  43495. }
  43496. // Return only captures needed by the pseudo filter method (type and argument)
  43497. return match.slice( 0, 3 );
  43498. }
  43499. },
  43500. filter: {
  43501. "TAG": function( nodeNameSelector ) {
  43502. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  43503. return nodeNameSelector === "*" ?
  43504. function() { return true; } :
  43505. function( elem ) {
  43506. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  43507. };
  43508. },
  43509. "CLASS": function( className ) {
  43510. var pattern = classCache[ className + " " ];
  43511. return pattern ||
  43512. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  43513. classCache( className, function( elem ) {
  43514. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  43515. });
  43516. },
  43517. "ATTR": function( name, operator, check ) {
  43518. return function( elem ) {
  43519. var result = Sizzle.attr( elem, name );
  43520. if ( result == null ) {
  43521. return operator === "!=";
  43522. }
  43523. if ( !operator ) {
  43524. return true;
  43525. }
  43526. result += "";
  43527. return operator === "=" ? result === check :
  43528. operator === "!=" ? result !== check :
  43529. operator === "^=" ? check && result.indexOf( check ) === 0 :
  43530. operator === "*=" ? check && result.indexOf( check ) > -1 :
  43531. operator === "$=" ? check && result.slice( -check.length ) === check :
  43532. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  43533. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  43534. false;
  43535. };
  43536. },
  43537. "CHILD": function( type, what, argument, first, last ) {
  43538. var simple = type.slice( 0, 3 ) !== "nth",
  43539. forward = type.slice( -4 ) !== "last",
  43540. ofType = what === "of-type";
  43541. return first === 1 && last === 0 ?
  43542. // Shortcut for :nth-*(n)
  43543. function( elem ) {
  43544. return !!elem.parentNode;
  43545. } :
  43546. function( elem, context, xml ) {
  43547. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  43548. dir = simple !== forward ? "nextSibling" : "previousSibling",
  43549. parent = elem.parentNode,
  43550. name = ofType && elem.nodeName.toLowerCase(),
  43551. useCache = !xml && !ofType,
  43552. diff = false;
  43553. if ( parent ) {
  43554. // :(first|last|only)-(child|of-type)
  43555. if ( simple ) {
  43556. while ( dir ) {
  43557. node = elem;
  43558. while ( (node = node[ dir ]) ) {
  43559. if ( ofType ?
  43560. node.nodeName.toLowerCase() === name :
  43561. node.nodeType === 1 ) {
  43562. return false;
  43563. }
  43564. }
  43565. // Reverse direction for :only-* (if we haven't yet done so)
  43566. start = dir = type === "only" && !start && "nextSibling";
  43567. }
  43568. return true;
  43569. }
  43570. start = [ forward ? parent.firstChild : parent.lastChild ];
  43571. // non-xml :nth-child(...) stores cache data on `parent`
  43572. if ( forward && useCache ) {
  43573. // Seek `elem` from a previously-cached index
  43574. // ...in a gzip-friendly way
  43575. node = parent;
  43576. outerCache = node[ expando ] || (node[ expando ] = {});
  43577. // Support: IE <9 only
  43578. // Defend against cloned attroperties (jQuery gh-1709)
  43579. uniqueCache = outerCache[ node.uniqueID ] ||
  43580. (outerCache[ node.uniqueID ] = {});
  43581. cache = uniqueCache[ type ] || [];
  43582. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  43583. diff = nodeIndex && cache[ 2 ];
  43584. node = nodeIndex && parent.childNodes[ nodeIndex ];
  43585. while ( (node = ++nodeIndex && node && node[ dir ] ||
  43586. // Fallback to seeking `elem` from the start
  43587. (diff = nodeIndex = 0) || start.pop()) ) {
  43588. // When found, cache indexes on `parent` and break
  43589. if ( node.nodeType === 1 && ++diff && node === elem ) {
  43590. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  43591. break;
  43592. }
  43593. }
  43594. } else {
  43595. // Use previously-cached element index if available
  43596. if ( useCache ) {
  43597. // ...in a gzip-friendly way
  43598. node = elem;
  43599. outerCache = node[ expando ] || (node[ expando ] = {});
  43600. // Support: IE <9 only
  43601. // Defend against cloned attroperties (jQuery gh-1709)
  43602. uniqueCache = outerCache[ node.uniqueID ] ||
  43603. (outerCache[ node.uniqueID ] = {});
  43604. cache = uniqueCache[ type ] || [];
  43605. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  43606. diff = nodeIndex;
  43607. }
  43608. // xml :nth-child(...)
  43609. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  43610. if ( diff === false ) {
  43611. // Use the same loop as above to seek `elem` from the start
  43612. while ( (node = ++nodeIndex && node && node[ dir ] ||
  43613. (diff = nodeIndex = 0) || start.pop()) ) {
  43614. if ( ( ofType ?
  43615. node.nodeName.toLowerCase() === name :
  43616. node.nodeType === 1 ) &&
  43617. ++diff ) {
  43618. // Cache the index of each encountered element
  43619. if ( useCache ) {
  43620. outerCache = node[ expando ] || (node[ expando ] = {});
  43621. // Support: IE <9 only
  43622. // Defend against cloned attroperties (jQuery gh-1709)
  43623. uniqueCache = outerCache[ node.uniqueID ] ||
  43624. (outerCache[ node.uniqueID ] = {});
  43625. uniqueCache[ type ] = [ dirruns, diff ];
  43626. }
  43627. if ( node === elem ) {
  43628. break;
  43629. }
  43630. }
  43631. }
  43632. }
  43633. }
  43634. // Incorporate the offset, then check against cycle size
  43635. diff -= last;
  43636. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  43637. }
  43638. };
  43639. },
  43640. "PSEUDO": function( pseudo, argument ) {
  43641. // pseudo-class names are case-insensitive
  43642. // http://www.w3.org/TR/selectors/#pseudo-classes
  43643. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  43644. // Remember that setFilters inherits from pseudos
  43645. var args,
  43646. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  43647. Sizzle.error( "unsupported pseudo: " + pseudo );
  43648. // The user may use createPseudo to indicate that
  43649. // arguments are needed to create the filter function
  43650. // just as Sizzle does
  43651. if ( fn[ expando ] ) {
  43652. return fn( argument );
  43653. }
  43654. // But maintain support for old signatures
  43655. if ( fn.length > 1 ) {
  43656. args = [ pseudo, pseudo, "", argument ];
  43657. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  43658. markFunction(function( seed, matches ) {
  43659. var idx,
  43660. matched = fn( seed, argument ),
  43661. i = matched.length;
  43662. while ( i-- ) {
  43663. idx = indexOf( seed, matched[i] );
  43664. seed[ idx ] = !( matches[ idx ] = matched[i] );
  43665. }
  43666. }) :
  43667. function( elem ) {
  43668. return fn( elem, 0, args );
  43669. };
  43670. }
  43671. return fn;
  43672. }
  43673. },
  43674. pseudos: {
  43675. // Potentially complex pseudos
  43676. "not": markFunction(function( selector ) {
  43677. // Trim the selector passed to compile
  43678. // to avoid treating leading and trailing
  43679. // spaces as combinators
  43680. var input = [],
  43681. results = [],
  43682. matcher = compile( selector.replace( rtrim, "$1" ) );
  43683. return matcher[ expando ] ?
  43684. markFunction(function( seed, matches, context, xml ) {
  43685. var elem,
  43686. unmatched = matcher( seed, null, xml, [] ),
  43687. i = seed.length;
  43688. // Match elements unmatched by `matcher`
  43689. while ( i-- ) {
  43690. if ( (elem = unmatched[i]) ) {
  43691. seed[i] = !(matches[i] = elem);
  43692. }
  43693. }
  43694. }) :
  43695. function( elem, context, xml ) {
  43696. input[0] = elem;
  43697. matcher( input, null, xml, results );
  43698. // Don't keep the element (issue #299)
  43699. input[0] = null;
  43700. return !results.pop();
  43701. };
  43702. }),
  43703. "has": markFunction(function( selector ) {
  43704. return function( elem ) {
  43705. return Sizzle( selector, elem ).length > 0;
  43706. };
  43707. }),
  43708. "contains": markFunction(function( text ) {
  43709. text = text.replace( runescape, funescape );
  43710. return function( elem ) {
  43711. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  43712. };
  43713. }),
  43714. // "Whether an element is represented by a :lang() selector
  43715. // is based solely on the element's language value
  43716. // being equal to the identifier C,
  43717. // or beginning with the identifier C immediately followed by "-".
  43718. // The matching of C against the element's language value is performed case-insensitively.
  43719. // The identifier C does not have to be a valid language name."
  43720. // http://www.w3.org/TR/selectors/#lang-pseudo
  43721. "lang": markFunction( function( lang ) {
  43722. // lang value must be a valid identifier
  43723. if ( !ridentifier.test(lang || "") ) {
  43724. Sizzle.error( "unsupported lang: " + lang );
  43725. }
  43726. lang = lang.replace( runescape, funescape ).toLowerCase();
  43727. return function( elem ) {
  43728. var elemLang;
  43729. do {
  43730. if ( (elemLang = documentIsHTML ?
  43731. elem.lang :
  43732. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  43733. elemLang = elemLang.toLowerCase();
  43734. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  43735. }
  43736. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  43737. return false;
  43738. };
  43739. }),
  43740. // Miscellaneous
  43741. "target": function( elem ) {
  43742. var hash = window.location && window.location.hash;
  43743. return hash && hash.slice( 1 ) === elem.id;
  43744. },
  43745. "root": function( elem ) {
  43746. return elem === docElem;
  43747. },
  43748. "focus": function( elem ) {
  43749. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  43750. },
  43751. // Boolean properties
  43752. "enabled": createDisabledPseudo( false ),
  43753. "disabled": createDisabledPseudo( true ),
  43754. "checked": function( elem ) {
  43755. // In CSS3, :checked should return both checked and selected elements
  43756. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  43757. var nodeName = elem.nodeName.toLowerCase();
  43758. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  43759. },
  43760. "selected": function( elem ) {
  43761. // Accessing this property makes selected-by-default
  43762. // options in Safari work properly
  43763. if ( elem.parentNode ) {
  43764. elem.parentNode.selectedIndex;
  43765. }
  43766. return elem.selected === true;
  43767. },
  43768. // Contents
  43769. "empty": function( elem ) {
  43770. // http://www.w3.org/TR/selectors/#empty-pseudo
  43771. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  43772. // but not by others (comment: 8; processing instruction: 7; etc.)
  43773. // nodeType < 6 works because attributes (2) do not appear as children
  43774. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  43775. if ( elem.nodeType < 6 ) {
  43776. return false;
  43777. }
  43778. }
  43779. return true;
  43780. },
  43781. "parent": function( elem ) {
  43782. return !Expr.pseudos["empty"]( elem );
  43783. },
  43784. // Element/input types
  43785. "header": function( elem ) {
  43786. return rheader.test( elem.nodeName );
  43787. },
  43788. "input": function( elem ) {
  43789. return rinputs.test( elem.nodeName );
  43790. },
  43791. "button": function( elem ) {
  43792. var name = elem.nodeName.toLowerCase();
  43793. return name === "input" && elem.type === "button" || name === "button";
  43794. },
  43795. "text": function( elem ) {
  43796. var attr;
  43797. return elem.nodeName.toLowerCase() === "input" &&
  43798. elem.type === "text" &&
  43799. // Support: IE<8
  43800. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  43801. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  43802. },
  43803. // Position-in-collection
  43804. "first": createPositionalPseudo(function() {
  43805. return [ 0 ];
  43806. }),
  43807. "last": createPositionalPseudo(function( matchIndexes, length ) {
  43808. return [ length - 1 ];
  43809. }),
  43810. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  43811. return [ argument < 0 ? argument + length : argument ];
  43812. }),
  43813. "even": createPositionalPseudo(function( matchIndexes, length ) {
  43814. var i = 0;
  43815. for ( ; i < length; i += 2 ) {
  43816. matchIndexes.push( i );
  43817. }
  43818. return matchIndexes;
  43819. }),
  43820. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  43821. var i = 1;
  43822. for ( ; i < length; i += 2 ) {
  43823. matchIndexes.push( i );
  43824. }
  43825. return matchIndexes;
  43826. }),
  43827. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  43828. var i = argument < 0 ? argument + length : argument;
  43829. for ( ; --i >= 0; ) {
  43830. matchIndexes.push( i );
  43831. }
  43832. return matchIndexes;
  43833. }),
  43834. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  43835. var i = argument < 0 ? argument + length : argument;
  43836. for ( ; ++i < length; ) {
  43837. matchIndexes.push( i );
  43838. }
  43839. return matchIndexes;
  43840. })
  43841. }
  43842. };
  43843. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  43844. // Add button/input type pseudos
  43845. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  43846. Expr.pseudos[ i ] = createInputPseudo( i );
  43847. }
  43848. for ( i in { submit: true, reset: true } ) {
  43849. Expr.pseudos[ i ] = createButtonPseudo( i );
  43850. }
  43851. // Easy API for creating new setFilters
  43852. function setFilters() {}
  43853. setFilters.prototype = Expr.filters = Expr.pseudos;
  43854. Expr.setFilters = new setFilters();
  43855. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  43856. var matched, match, tokens, type,
  43857. soFar, groups, preFilters,
  43858. cached = tokenCache[ selector + " " ];
  43859. if ( cached ) {
  43860. return parseOnly ? 0 : cached.slice( 0 );
  43861. }
  43862. soFar = selector;
  43863. groups = [];
  43864. preFilters = Expr.preFilter;
  43865. while ( soFar ) {
  43866. // Comma and first run
  43867. if ( !matched || (match = rcomma.exec( soFar )) ) {
  43868. if ( match ) {
  43869. // Don't consume trailing commas as valid
  43870. soFar = soFar.slice( match[0].length ) || soFar;
  43871. }
  43872. groups.push( (tokens = []) );
  43873. }
  43874. matched = false;
  43875. // Combinators
  43876. if ( (match = rcombinators.exec( soFar )) ) {
  43877. matched = match.shift();
  43878. tokens.push({
  43879. value: matched,
  43880. // Cast descendant combinators to space
  43881. type: match[0].replace( rtrim, " " )
  43882. });
  43883. soFar = soFar.slice( matched.length );
  43884. }
  43885. // Filters
  43886. for ( type in Expr.filter ) {
  43887. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  43888. (match = preFilters[ type ]( match ))) ) {
  43889. matched = match.shift();
  43890. tokens.push({
  43891. value: matched,
  43892. type: type,
  43893. matches: match
  43894. });
  43895. soFar = soFar.slice( matched.length );
  43896. }
  43897. }
  43898. if ( !matched ) {
  43899. break;
  43900. }
  43901. }
  43902. // Return the length of the invalid excess
  43903. // if we're just parsing
  43904. // Otherwise, throw an error or return tokens
  43905. return parseOnly ?
  43906. soFar.length :
  43907. soFar ?
  43908. Sizzle.error( selector ) :
  43909. // Cache the tokens
  43910. tokenCache( selector, groups ).slice( 0 );
  43911. };
  43912. function toSelector( tokens ) {
  43913. var i = 0,
  43914. len = tokens.length,
  43915. selector = "";
  43916. for ( ; i < len; i++ ) {
  43917. selector += tokens[i].value;
  43918. }
  43919. return selector;
  43920. }
  43921. function addCombinator( matcher, combinator, base ) {
  43922. var dir = combinator.dir,
  43923. skip = combinator.next,
  43924. key = skip || dir,
  43925. checkNonElements = base && key === "parentNode",
  43926. doneName = done++;
  43927. return combinator.first ?
  43928. // Check against closest ancestor/preceding element
  43929. function( elem, context, xml ) {
  43930. while ( (elem = elem[ dir ]) ) {
  43931. if ( elem.nodeType === 1 || checkNonElements ) {
  43932. return matcher( elem, context, xml );
  43933. }
  43934. }
  43935. return false;
  43936. } :
  43937. // Check against all ancestor/preceding elements
  43938. function( elem, context, xml ) {
  43939. var oldCache, uniqueCache, outerCache,
  43940. newCache = [ dirruns, doneName ];
  43941. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  43942. if ( xml ) {
  43943. while ( (elem = elem[ dir ]) ) {
  43944. if ( elem.nodeType === 1 || checkNonElements ) {
  43945. if ( matcher( elem, context, xml ) ) {
  43946. return true;
  43947. }
  43948. }
  43949. }
  43950. } else {
  43951. while ( (elem = elem[ dir ]) ) {
  43952. if ( elem.nodeType === 1 || checkNonElements ) {
  43953. outerCache = elem[ expando ] || (elem[ expando ] = {});
  43954. // Support: IE <9 only
  43955. // Defend against cloned attroperties (jQuery gh-1709)
  43956. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  43957. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  43958. elem = elem[ dir ] || elem;
  43959. } else if ( (oldCache = uniqueCache[ key ]) &&
  43960. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  43961. // Assign to newCache so results back-propagate to previous elements
  43962. return (newCache[ 2 ] = oldCache[ 2 ]);
  43963. } else {
  43964. // Reuse newcache so results back-propagate to previous elements
  43965. uniqueCache[ key ] = newCache;
  43966. // A match means we're done; a fail means we have to keep checking
  43967. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  43968. return true;
  43969. }
  43970. }
  43971. }
  43972. }
  43973. }
  43974. return false;
  43975. };
  43976. }
  43977. function elementMatcher( matchers ) {
  43978. return matchers.length > 1 ?
  43979. function( elem, context, xml ) {
  43980. var i = matchers.length;
  43981. while ( i-- ) {
  43982. if ( !matchers[i]( elem, context, xml ) ) {
  43983. return false;
  43984. }
  43985. }
  43986. return true;
  43987. } :
  43988. matchers[0];
  43989. }
  43990. function multipleContexts( selector, contexts, results ) {
  43991. var i = 0,
  43992. len = contexts.length;
  43993. for ( ; i < len; i++ ) {
  43994. Sizzle( selector, contexts[i], results );
  43995. }
  43996. return results;
  43997. }
  43998. function condense( unmatched, map, filter, context, xml ) {
  43999. var elem,
  44000. newUnmatched = [],
  44001. i = 0,
  44002. len = unmatched.length,
  44003. mapped = map != null;
  44004. for ( ; i < len; i++ ) {
  44005. if ( (elem = unmatched[i]) ) {
  44006. if ( !filter || filter( elem, context, xml ) ) {
  44007. newUnmatched.push( elem );
  44008. if ( mapped ) {
  44009. map.push( i );
  44010. }
  44011. }
  44012. }
  44013. }
  44014. return newUnmatched;
  44015. }
  44016. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  44017. if ( postFilter && !postFilter[ expando ] ) {
  44018. postFilter = setMatcher( postFilter );
  44019. }
  44020. if ( postFinder && !postFinder[ expando ] ) {
  44021. postFinder = setMatcher( postFinder, postSelector );
  44022. }
  44023. return markFunction(function( seed, results, context, xml ) {
  44024. var temp, i, elem,
  44025. preMap = [],
  44026. postMap = [],
  44027. preexisting = results.length,
  44028. // Get initial elements from seed or context
  44029. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  44030. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  44031. matcherIn = preFilter && ( seed || !selector ) ?
  44032. condense( elems, preMap, preFilter, context, xml ) :
  44033. elems,
  44034. matcherOut = matcher ?
  44035. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  44036. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  44037. // ...intermediate processing is necessary
  44038. [] :
  44039. // ...otherwise use results directly
  44040. results :
  44041. matcherIn;
  44042. // Find primary matches
  44043. if ( matcher ) {
  44044. matcher( matcherIn, matcherOut, context, xml );
  44045. }
  44046. // Apply postFilter
  44047. if ( postFilter ) {
  44048. temp = condense( matcherOut, postMap );
  44049. postFilter( temp, [], context, xml );
  44050. // Un-match failing elements by moving them back to matcherIn
  44051. i = temp.length;
  44052. while ( i-- ) {
  44053. if ( (elem = temp[i]) ) {
  44054. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  44055. }
  44056. }
  44057. }
  44058. if ( seed ) {
  44059. if ( postFinder || preFilter ) {
  44060. if ( postFinder ) {
  44061. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  44062. temp = [];
  44063. i = matcherOut.length;
  44064. while ( i-- ) {
  44065. if ( (elem = matcherOut[i]) ) {
  44066. // Restore matcherIn since elem is not yet a final match
  44067. temp.push( (matcherIn[i] = elem) );
  44068. }
  44069. }
  44070. postFinder( null, (matcherOut = []), temp, xml );
  44071. }
  44072. // Move matched elements from seed to results to keep them synchronized
  44073. i = matcherOut.length;
  44074. while ( i-- ) {
  44075. if ( (elem = matcherOut[i]) &&
  44076. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  44077. seed[temp] = !(results[temp] = elem);
  44078. }
  44079. }
  44080. }
  44081. // Add elements to results, through postFinder if defined
  44082. } else {
  44083. matcherOut = condense(
  44084. matcherOut === results ?
  44085. matcherOut.splice( preexisting, matcherOut.length ) :
  44086. matcherOut
  44087. );
  44088. if ( postFinder ) {
  44089. postFinder( null, results, matcherOut, xml );
  44090. } else {
  44091. push.apply( results, matcherOut );
  44092. }
  44093. }
  44094. });
  44095. }
  44096. function matcherFromTokens( tokens ) {
  44097. var checkContext, matcher, j,
  44098. len = tokens.length,
  44099. leadingRelative = Expr.relative[ tokens[0].type ],
  44100. implicitRelative = leadingRelative || Expr.relative[" "],
  44101. i = leadingRelative ? 1 : 0,
  44102. // The foundational matcher ensures that elements are reachable from top-level context(s)
  44103. matchContext = addCombinator( function( elem ) {
  44104. return elem === checkContext;
  44105. }, implicitRelative, true ),
  44106. matchAnyContext = addCombinator( function( elem ) {
  44107. return indexOf( checkContext, elem ) > -1;
  44108. }, implicitRelative, true ),
  44109. matchers = [ function( elem, context, xml ) {
  44110. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  44111. (checkContext = context).nodeType ?
  44112. matchContext( elem, context, xml ) :
  44113. matchAnyContext( elem, context, xml ) );
  44114. // Avoid hanging onto element (issue #299)
  44115. checkContext = null;
  44116. return ret;
  44117. } ];
  44118. for ( ; i < len; i++ ) {
  44119. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  44120. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  44121. } else {
  44122. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  44123. // Return special upon seeing a positional matcher
  44124. if ( matcher[ expando ] ) {
  44125. // Find the next relative operator (if any) for proper handling
  44126. j = ++i;
  44127. for ( ; j < len; j++ ) {
  44128. if ( Expr.relative[ tokens[j].type ] ) {
  44129. break;
  44130. }
  44131. }
  44132. return setMatcher(
  44133. i > 1 && elementMatcher( matchers ),
  44134. i > 1 && toSelector(
  44135. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  44136. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  44137. ).replace( rtrim, "$1" ),
  44138. matcher,
  44139. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  44140. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  44141. j < len && toSelector( tokens )
  44142. );
  44143. }
  44144. matchers.push( matcher );
  44145. }
  44146. }
  44147. return elementMatcher( matchers );
  44148. }
  44149. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  44150. var bySet = setMatchers.length > 0,
  44151. byElement = elementMatchers.length > 0,
  44152. superMatcher = function( seed, context, xml, results, outermost ) {
  44153. var elem, j, matcher,
  44154. matchedCount = 0,
  44155. i = "0",
  44156. unmatched = seed && [],
  44157. setMatched = [],
  44158. contextBackup = outermostContext,
  44159. // We must always have either seed elements or outermost context
  44160. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  44161. // Use integer dirruns iff this is the outermost matcher
  44162. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  44163. len = elems.length;
  44164. if ( outermost ) {
  44165. outermostContext = context === document || context || outermost;
  44166. }
  44167. // Add elements passing elementMatchers directly to results
  44168. // Support: IE<9, Safari
  44169. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  44170. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  44171. if ( byElement && elem ) {
  44172. j = 0;
  44173. if ( !context && elem.ownerDocument !== document ) {
  44174. setDocument( elem );
  44175. xml = !documentIsHTML;
  44176. }
  44177. while ( (matcher = elementMatchers[j++]) ) {
  44178. if ( matcher( elem, context || document, xml) ) {
  44179. results.push( elem );
  44180. break;
  44181. }
  44182. }
  44183. if ( outermost ) {
  44184. dirruns = dirrunsUnique;
  44185. }
  44186. }
  44187. // Track unmatched elements for set filters
  44188. if ( bySet ) {
  44189. // They will have gone through all possible matchers
  44190. if ( (elem = !matcher && elem) ) {
  44191. matchedCount--;
  44192. }
  44193. // Lengthen the array for every element, matched or not
  44194. if ( seed ) {
  44195. unmatched.push( elem );
  44196. }
  44197. }
  44198. }
  44199. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  44200. // makes the latter nonnegative.
  44201. matchedCount += i;
  44202. // Apply set filters to unmatched elements
  44203. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  44204. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  44205. // no element matchers and no seed.
  44206. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  44207. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  44208. // numerically zero.
  44209. if ( bySet && i !== matchedCount ) {
  44210. j = 0;
  44211. while ( (matcher = setMatchers[j++]) ) {
  44212. matcher( unmatched, setMatched, context, xml );
  44213. }
  44214. if ( seed ) {
  44215. // Reintegrate element matches to eliminate the need for sorting
  44216. if ( matchedCount > 0 ) {
  44217. while ( i-- ) {
  44218. if ( !(unmatched[i] || setMatched[i]) ) {
  44219. setMatched[i] = pop.call( results );
  44220. }
  44221. }
  44222. }
  44223. // Discard index placeholder values to get only actual matches
  44224. setMatched = condense( setMatched );
  44225. }
  44226. // Add matches to results
  44227. push.apply( results, setMatched );
  44228. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  44229. if ( outermost && !seed && setMatched.length > 0 &&
  44230. ( matchedCount + setMatchers.length ) > 1 ) {
  44231. Sizzle.uniqueSort( results );
  44232. }
  44233. }
  44234. // Override manipulation of globals by nested matchers
  44235. if ( outermost ) {
  44236. dirruns = dirrunsUnique;
  44237. outermostContext = contextBackup;
  44238. }
  44239. return unmatched;
  44240. };
  44241. return bySet ?
  44242. markFunction( superMatcher ) :
  44243. superMatcher;
  44244. }
  44245. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  44246. var i,
  44247. setMatchers = [],
  44248. elementMatchers = [],
  44249. cached = compilerCache[ selector + " " ];
  44250. if ( !cached ) {
  44251. // Generate a function of recursive functions that can be used to check each element
  44252. if ( !match ) {
  44253. match = tokenize( selector );
  44254. }
  44255. i = match.length;
  44256. while ( i-- ) {
  44257. cached = matcherFromTokens( match[i] );
  44258. if ( cached[ expando ] ) {
  44259. setMatchers.push( cached );
  44260. } else {
  44261. elementMatchers.push( cached );
  44262. }
  44263. }
  44264. // Cache the compiled function
  44265. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  44266. // Save selector and tokenization
  44267. cached.selector = selector;
  44268. }
  44269. return cached;
  44270. };
  44271. /**
  44272. * A low-level selection function that works with Sizzle's compiled
  44273. * selector functions
  44274. * @param {String|Function} selector A selector or a pre-compiled
  44275. * selector function built with Sizzle.compile
  44276. * @param {Element} context
  44277. * @param {Array} [results]
  44278. * @param {Array} [seed] A set of elements to match against
  44279. */
  44280. select = Sizzle.select = function( selector, context, results, seed ) {
  44281. var i, tokens, token, type, find,
  44282. compiled = typeof selector === "function" && selector,
  44283. match = !seed && tokenize( (selector = compiled.selector || selector) );
  44284. results = results || [];
  44285. // Try to minimize operations if there is only one selector in the list and no seed
  44286. // (the latter of which guarantees us context)
  44287. if ( match.length === 1 ) {
  44288. // Reduce context if the leading compound selector is an ID
  44289. tokens = match[0] = match[0].slice( 0 );
  44290. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  44291. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  44292. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  44293. if ( !context ) {
  44294. return results;
  44295. // Precompiled matchers will still verify ancestry, so step up a level
  44296. } else if ( compiled ) {
  44297. context = context.parentNode;
  44298. }
  44299. selector = selector.slice( tokens.shift().value.length );
  44300. }
  44301. // Fetch a seed set for right-to-left matching
  44302. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  44303. while ( i-- ) {
  44304. token = tokens[i];
  44305. // Abort if we hit a combinator
  44306. if ( Expr.relative[ (type = token.type) ] ) {
  44307. break;
  44308. }
  44309. if ( (find = Expr.find[ type ]) ) {
  44310. // Search, expanding context for leading sibling combinators
  44311. if ( (seed = find(
  44312. token.matches[0].replace( runescape, funescape ),
  44313. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  44314. )) ) {
  44315. // If seed is empty or no tokens remain, we can return early
  44316. tokens.splice( i, 1 );
  44317. selector = seed.length && toSelector( tokens );
  44318. if ( !selector ) {
  44319. push.apply( results, seed );
  44320. return results;
  44321. }
  44322. break;
  44323. }
  44324. }
  44325. }
  44326. }
  44327. // Compile and execute a filtering function if one is not provided
  44328. // Provide `match` to avoid retokenization if we modified the selector above
  44329. ( compiled || compile( selector, match ) )(
  44330. seed,
  44331. context,
  44332. !documentIsHTML,
  44333. results,
  44334. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  44335. );
  44336. return results;
  44337. };
  44338. // One-time assignments
  44339. // Sort stability
  44340. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  44341. // Support: Chrome 14-35+
  44342. // Always assume duplicates if they aren't passed to the comparison function
  44343. support.detectDuplicates = !!hasDuplicate;
  44344. // Initialize against the default document
  44345. setDocument();
  44346. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  44347. // Detached nodes confoundingly follow *each other*
  44348. support.sortDetached = assert(function( el ) {
  44349. // Should return 1, but returns 4 (following)
  44350. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  44351. });
  44352. // Support: IE<8
  44353. // Prevent attribute/property "interpolation"
  44354. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  44355. if ( !assert(function( el ) {
  44356. el.innerHTML = "<a href='#'></a>";
  44357. return el.firstChild.getAttribute("href") === "#" ;
  44358. }) ) {
  44359. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  44360. if ( !isXML ) {
  44361. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  44362. }
  44363. });
  44364. }
  44365. // Support: IE<9
  44366. // Use defaultValue in place of getAttribute("value")
  44367. if ( !support.attributes || !assert(function( el ) {
  44368. el.innerHTML = "<input/>";
  44369. el.firstChild.setAttribute( "value", "" );
  44370. return el.firstChild.getAttribute( "value" ) === "";
  44371. }) ) {
  44372. addHandle( "value", function( elem, name, isXML ) {
  44373. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  44374. return elem.defaultValue;
  44375. }
  44376. });
  44377. }
  44378. // Support: IE<9
  44379. // Use getAttributeNode to fetch booleans when getAttribute lies
  44380. if ( !assert(function( el ) {
  44381. return el.getAttribute("disabled") == null;
  44382. }) ) {
  44383. addHandle( booleans, function( elem, name, isXML ) {
  44384. var val;
  44385. if ( !isXML ) {
  44386. return elem[ name ] === true ? name.toLowerCase() :
  44387. (val = elem.getAttributeNode( name )) && val.specified ?
  44388. val.value :
  44389. null;
  44390. }
  44391. });
  44392. }
  44393. return Sizzle;
  44394. })( window );
  44395. jQuery.find = Sizzle;
  44396. jQuery.expr = Sizzle.selectors;
  44397. // Deprecated
  44398. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  44399. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  44400. jQuery.text = Sizzle.getText;
  44401. jQuery.isXMLDoc = Sizzle.isXML;
  44402. jQuery.contains = Sizzle.contains;
  44403. jQuery.escapeSelector = Sizzle.escape;
  44404. var dir = function( elem, dir, until ) {
  44405. var matched = [],
  44406. truncate = until !== undefined;
  44407. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  44408. if ( elem.nodeType === 1 ) {
  44409. if ( truncate && jQuery( elem ).is( until ) ) {
  44410. break;
  44411. }
  44412. matched.push( elem );
  44413. }
  44414. }
  44415. return matched;
  44416. };
  44417. var siblings = function( n, elem ) {
  44418. var matched = [];
  44419. for ( ; n; n = n.nextSibling ) {
  44420. if ( n.nodeType === 1 && n !== elem ) {
  44421. matched.push( n );
  44422. }
  44423. }
  44424. return matched;
  44425. };
  44426. var rneedsContext = jQuery.expr.match.needsContext;
  44427. function nodeName( elem, name ) {
  44428. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  44429. };
  44430. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  44431. // Implement the identical functionality for filter and not
  44432. function winnow( elements, qualifier, not ) {
  44433. if ( isFunction( qualifier ) ) {
  44434. return jQuery.grep( elements, function( elem, i ) {
  44435. return !!qualifier.call( elem, i, elem ) !== not;
  44436. } );
  44437. }
  44438. // Single element
  44439. if ( qualifier.nodeType ) {
  44440. return jQuery.grep( elements, function( elem ) {
  44441. return ( elem === qualifier ) !== not;
  44442. } );
  44443. }
  44444. // Arraylike of elements (jQuery, arguments, Array)
  44445. if ( typeof qualifier !== "string" ) {
  44446. return jQuery.grep( elements, function( elem ) {
  44447. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  44448. } );
  44449. }
  44450. // Filtered directly for both simple and complex selectors
  44451. return jQuery.filter( qualifier, elements, not );
  44452. }
  44453. jQuery.filter = function( expr, elems, not ) {
  44454. var elem = elems[ 0 ];
  44455. if ( not ) {
  44456. expr = ":not(" + expr + ")";
  44457. }
  44458. if ( elems.length === 1 && elem.nodeType === 1 ) {
  44459. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  44460. }
  44461. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  44462. return elem.nodeType === 1;
  44463. } ) );
  44464. };
  44465. jQuery.fn.extend( {
  44466. find: function( selector ) {
  44467. var i, ret,
  44468. len = this.length,
  44469. self = this;
  44470. if ( typeof selector !== "string" ) {
  44471. return this.pushStack( jQuery( selector ).filter( function() {
  44472. for ( i = 0; i < len; i++ ) {
  44473. if ( jQuery.contains( self[ i ], this ) ) {
  44474. return true;
  44475. }
  44476. }
  44477. } ) );
  44478. }
  44479. ret = this.pushStack( [] );
  44480. for ( i = 0; i < len; i++ ) {
  44481. jQuery.find( selector, self[ i ], ret );
  44482. }
  44483. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  44484. },
  44485. filter: function( selector ) {
  44486. return this.pushStack( winnow( this, selector || [], false ) );
  44487. },
  44488. not: function( selector ) {
  44489. return this.pushStack( winnow( this, selector || [], true ) );
  44490. },
  44491. is: function( selector ) {
  44492. return !!winnow(
  44493. this,
  44494. // If this is a positional/relative selector, check membership in the returned set
  44495. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  44496. typeof selector === "string" && rneedsContext.test( selector ) ?
  44497. jQuery( selector ) :
  44498. selector || [],
  44499. false
  44500. ).length;
  44501. }
  44502. } );
  44503. // Initialize a jQuery object
  44504. // A central reference to the root jQuery(document)
  44505. var rootjQuery,
  44506. // A simple way to check for HTML strings
  44507. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  44508. // Strict HTML recognition (#11290: must start with <)
  44509. // Shortcut simple #id case for speed
  44510. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  44511. init = jQuery.fn.init = function( selector, context, root ) {
  44512. var match, elem;
  44513. // HANDLE: $(""), $(null), $(undefined), $(false)
  44514. if ( !selector ) {
  44515. return this;
  44516. }
  44517. // Method init() accepts an alternate rootjQuery
  44518. // so migrate can support jQuery.sub (gh-2101)
  44519. root = root || rootjQuery;
  44520. // Handle HTML strings
  44521. if ( typeof selector === "string" ) {
  44522. if ( selector[ 0 ] === "<" &&
  44523. selector[ selector.length - 1 ] === ">" &&
  44524. selector.length >= 3 ) {
  44525. // Assume that strings that start and end with <> are HTML and skip the regex check
  44526. match = [ null, selector, null ];
  44527. } else {
  44528. match = rquickExpr.exec( selector );
  44529. }
  44530. // Match html or make sure no context is specified for #id
  44531. if ( match && ( match[ 1 ] || !context ) ) {
  44532. // HANDLE: $(html) -> $(array)
  44533. if ( match[ 1 ] ) {
  44534. context = context instanceof jQuery ? context[ 0 ] : context;
  44535. // Option to run scripts is true for back-compat
  44536. // Intentionally let the error be thrown if parseHTML is not present
  44537. jQuery.merge( this, jQuery.parseHTML(
  44538. match[ 1 ],
  44539. context && context.nodeType ? context.ownerDocument || context : document,
  44540. true
  44541. ) );
  44542. // HANDLE: $(html, props)
  44543. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  44544. for ( match in context ) {
  44545. // Properties of context are called as methods if possible
  44546. if ( isFunction( this[ match ] ) ) {
  44547. this[ match ]( context[ match ] );
  44548. // ...and otherwise set as attributes
  44549. } else {
  44550. this.attr( match, context[ match ] );
  44551. }
  44552. }
  44553. }
  44554. return this;
  44555. // HANDLE: $(#id)
  44556. } else {
  44557. elem = document.getElementById( match[ 2 ] );
  44558. if ( elem ) {
  44559. // Inject the element directly into the jQuery object
  44560. this[ 0 ] = elem;
  44561. this.length = 1;
  44562. }
  44563. return this;
  44564. }
  44565. // HANDLE: $(expr, $(...))
  44566. } else if ( !context || context.jquery ) {
  44567. return ( context || root ).find( selector );
  44568. // HANDLE: $(expr, context)
  44569. // (which is just equivalent to: $(context).find(expr)
  44570. } else {
  44571. return this.constructor( context ).find( selector );
  44572. }
  44573. // HANDLE: $(DOMElement)
  44574. } else if ( selector.nodeType ) {
  44575. this[ 0 ] = selector;
  44576. this.length = 1;
  44577. return this;
  44578. // HANDLE: $(function)
  44579. // Shortcut for document ready
  44580. } else if ( isFunction( selector ) ) {
  44581. return root.ready !== undefined ?
  44582. root.ready( selector ) :
  44583. // Execute immediately if ready is not present
  44584. selector( jQuery );
  44585. }
  44586. return jQuery.makeArray( selector, this );
  44587. };
  44588. // Give the init function the jQuery prototype for later instantiation
  44589. init.prototype = jQuery.fn;
  44590. // Initialize central reference
  44591. rootjQuery = jQuery( document );
  44592. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  44593. // Methods guaranteed to produce a unique set when starting from a unique set
  44594. guaranteedUnique = {
  44595. children: true,
  44596. contents: true,
  44597. next: true,
  44598. prev: true
  44599. };
  44600. jQuery.fn.extend( {
  44601. has: function( target ) {
  44602. var targets = jQuery( target, this ),
  44603. l = targets.length;
  44604. return this.filter( function() {
  44605. var i = 0;
  44606. for ( ; i < l; i++ ) {
  44607. if ( jQuery.contains( this, targets[ i ] ) ) {
  44608. return true;
  44609. }
  44610. }
  44611. } );
  44612. },
  44613. closest: function( selectors, context ) {
  44614. var cur,
  44615. i = 0,
  44616. l = this.length,
  44617. matched = [],
  44618. targets = typeof selectors !== "string" && jQuery( selectors );
  44619. // Positional selectors never match, since there's no _selection_ context
  44620. if ( !rneedsContext.test( selectors ) ) {
  44621. for ( ; i < l; i++ ) {
  44622. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  44623. // Always skip document fragments
  44624. if ( cur.nodeType < 11 && ( targets ?
  44625. targets.index( cur ) > -1 :
  44626. // Don't pass non-elements to Sizzle
  44627. cur.nodeType === 1 &&
  44628. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  44629. matched.push( cur );
  44630. break;
  44631. }
  44632. }
  44633. }
  44634. }
  44635. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  44636. },
  44637. // Determine the position of an element within the set
  44638. index: function( elem ) {
  44639. // No argument, return index in parent
  44640. if ( !elem ) {
  44641. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  44642. }
  44643. // Index in selector
  44644. if ( typeof elem === "string" ) {
  44645. return indexOf.call( jQuery( elem ), this[ 0 ] );
  44646. }
  44647. // Locate the position of the desired element
  44648. return indexOf.call( this,
  44649. // If it receives a jQuery object, the first element is used
  44650. elem.jquery ? elem[ 0 ] : elem
  44651. );
  44652. },
  44653. add: function( selector, context ) {
  44654. return this.pushStack(
  44655. jQuery.uniqueSort(
  44656. jQuery.merge( this.get(), jQuery( selector, context ) )
  44657. )
  44658. );
  44659. },
  44660. addBack: function( selector ) {
  44661. return this.add( selector == null ?
  44662. this.prevObject : this.prevObject.filter( selector )
  44663. );
  44664. }
  44665. } );
  44666. function sibling( cur, dir ) {
  44667. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  44668. return cur;
  44669. }
  44670. jQuery.each( {
  44671. parent: function( elem ) {
  44672. var parent = elem.parentNode;
  44673. return parent && parent.nodeType !== 11 ? parent : null;
  44674. },
  44675. parents: function( elem ) {
  44676. return dir( elem, "parentNode" );
  44677. },
  44678. parentsUntil: function( elem, i, until ) {
  44679. return dir( elem, "parentNode", until );
  44680. },
  44681. next: function( elem ) {
  44682. return sibling( elem, "nextSibling" );
  44683. },
  44684. prev: function( elem ) {
  44685. return sibling( elem, "previousSibling" );
  44686. },
  44687. nextAll: function( elem ) {
  44688. return dir( elem, "nextSibling" );
  44689. },
  44690. prevAll: function( elem ) {
  44691. return dir( elem, "previousSibling" );
  44692. },
  44693. nextUntil: function( elem, i, until ) {
  44694. return dir( elem, "nextSibling", until );
  44695. },
  44696. prevUntil: function( elem, i, until ) {
  44697. return dir( elem, "previousSibling", until );
  44698. },
  44699. siblings: function( elem ) {
  44700. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  44701. },
  44702. children: function( elem ) {
  44703. return siblings( elem.firstChild );
  44704. },
  44705. contents: function( elem ) {
  44706. if ( nodeName( elem, "iframe" ) ) {
  44707. return elem.contentDocument;
  44708. }
  44709. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  44710. // Treat the template element as a regular one in browsers that
  44711. // don't support it.
  44712. if ( nodeName( elem, "template" ) ) {
  44713. elem = elem.content || elem;
  44714. }
  44715. return jQuery.merge( [], elem.childNodes );
  44716. }
  44717. }, function( name, fn ) {
  44718. jQuery.fn[ name ] = function( until, selector ) {
  44719. var matched = jQuery.map( this, fn, until );
  44720. if ( name.slice( -5 ) !== "Until" ) {
  44721. selector = until;
  44722. }
  44723. if ( selector && typeof selector === "string" ) {
  44724. matched = jQuery.filter( selector, matched );
  44725. }
  44726. if ( this.length > 1 ) {
  44727. // Remove duplicates
  44728. if ( !guaranteedUnique[ name ] ) {
  44729. jQuery.uniqueSort( matched );
  44730. }
  44731. // Reverse order for parents* and prev-derivatives
  44732. if ( rparentsprev.test( name ) ) {
  44733. matched.reverse();
  44734. }
  44735. }
  44736. return this.pushStack( matched );
  44737. };
  44738. } );
  44739. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  44740. // Convert String-formatted options into Object-formatted ones
  44741. function createOptions( options ) {
  44742. var object = {};
  44743. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  44744. object[ flag ] = true;
  44745. } );
  44746. return object;
  44747. }
  44748. /*
  44749. * Create a callback list using the following parameters:
  44750. *
  44751. * options: an optional list of space-separated options that will change how
  44752. * the callback list behaves or a more traditional option object
  44753. *
  44754. * By default a callback list will act like an event callback list and can be
  44755. * "fired" multiple times.
  44756. *
  44757. * Possible options:
  44758. *
  44759. * once: will ensure the callback list can only be fired once (like a Deferred)
  44760. *
  44761. * memory: will keep track of previous values and will call any callback added
  44762. * after the list has been fired right away with the latest "memorized"
  44763. * values (like a Deferred)
  44764. *
  44765. * unique: will ensure a callback can only be added once (no duplicate in the list)
  44766. *
  44767. * stopOnFalse: interrupt callings when a callback returns false
  44768. *
  44769. */
  44770. jQuery.Callbacks = function( options ) {
  44771. // Convert options from String-formatted to Object-formatted if needed
  44772. // (we check in cache first)
  44773. options = typeof options === "string" ?
  44774. createOptions( options ) :
  44775. jQuery.extend( {}, options );
  44776. var // Flag to know if list is currently firing
  44777. firing,
  44778. // Last fire value for non-forgettable lists
  44779. memory,
  44780. // Flag to know if list was already fired
  44781. fired,
  44782. // Flag to prevent firing
  44783. locked,
  44784. // Actual callback list
  44785. list = [],
  44786. // Queue of execution data for repeatable lists
  44787. queue = [],
  44788. // Index of currently firing callback (modified by add/remove as needed)
  44789. firingIndex = -1,
  44790. // Fire callbacks
  44791. fire = function() {
  44792. // Enforce single-firing
  44793. locked = locked || options.once;
  44794. // Execute callbacks for all pending executions,
  44795. // respecting firingIndex overrides and runtime changes
  44796. fired = firing = true;
  44797. for ( ; queue.length; firingIndex = -1 ) {
  44798. memory = queue.shift();
  44799. while ( ++firingIndex < list.length ) {
  44800. // Run callback and check for early termination
  44801. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  44802. options.stopOnFalse ) {
  44803. // Jump to end and forget the data so .add doesn't re-fire
  44804. firingIndex = list.length;
  44805. memory = false;
  44806. }
  44807. }
  44808. }
  44809. // Forget the data if we're done with it
  44810. if ( !options.memory ) {
  44811. memory = false;
  44812. }
  44813. firing = false;
  44814. // Clean up if we're done firing for good
  44815. if ( locked ) {
  44816. // Keep an empty list if we have data for future add calls
  44817. if ( memory ) {
  44818. list = [];
  44819. // Otherwise, this object is spent
  44820. } else {
  44821. list = "";
  44822. }
  44823. }
  44824. },
  44825. // Actual Callbacks object
  44826. self = {
  44827. // Add a callback or a collection of callbacks to the list
  44828. add: function() {
  44829. if ( list ) {
  44830. // If we have memory from a past run, we should fire after adding
  44831. if ( memory && !firing ) {
  44832. firingIndex = list.length - 1;
  44833. queue.push( memory );
  44834. }
  44835. ( function add( args ) {
  44836. jQuery.each( args, function( _, arg ) {
  44837. if ( isFunction( arg ) ) {
  44838. if ( !options.unique || !self.has( arg ) ) {
  44839. list.push( arg );
  44840. }
  44841. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  44842. // Inspect recursively
  44843. add( arg );
  44844. }
  44845. } );
  44846. } )( arguments );
  44847. if ( memory && !firing ) {
  44848. fire();
  44849. }
  44850. }
  44851. return this;
  44852. },
  44853. // Remove a callback from the list
  44854. remove: function() {
  44855. jQuery.each( arguments, function( _, arg ) {
  44856. var index;
  44857. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  44858. list.splice( index, 1 );
  44859. // Handle firing indexes
  44860. if ( index <= firingIndex ) {
  44861. firingIndex--;
  44862. }
  44863. }
  44864. } );
  44865. return this;
  44866. },
  44867. // Check if a given callback is in the list.
  44868. // If no argument is given, return whether or not list has callbacks attached.
  44869. has: function( fn ) {
  44870. return fn ?
  44871. jQuery.inArray( fn, list ) > -1 :
  44872. list.length > 0;
  44873. },
  44874. // Remove all callbacks from the list
  44875. empty: function() {
  44876. if ( list ) {
  44877. list = [];
  44878. }
  44879. return this;
  44880. },
  44881. // Disable .fire and .add
  44882. // Abort any current/pending executions
  44883. // Clear all callbacks and values
  44884. disable: function() {
  44885. locked = queue = [];
  44886. list = memory = "";
  44887. return this;
  44888. },
  44889. disabled: function() {
  44890. return !list;
  44891. },
  44892. // Disable .fire
  44893. // Also disable .add unless we have memory (since it would have no effect)
  44894. // Abort any pending executions
  44895. lock: function() {
  44896. locked = queue = [];
  44897. if ( !memory && !firing ) {
  44898. list = memory = "";
  44899. }
  44900. return this;
  44901. },
  44902. locked: function() {
  44903. return !!locked;
  44904. },
  44905. // Call all callbacks with the given context and arguments
  44906. fireWith: function( context, args ) {
  44907. if ( !locked ) {
  44908. args = args || [];
  44909. args = [ context, args.slice ? args.slice() : args ];
  44910. queue.push( args );
  44911. if ( !firing ) {
  44912. fire();
  44913. }
  44914. }
  44915. return this;
  44916. },
  44917. // Call all the callbacks with the given arguments
  44918. fire: function() {
  44919. self.fireWith( this, arguments );
  44920. return this;
  44921. },
  44922. // To know if the callbacks have already been called at least once
  44923. fired: function() {
  44924. return !!fired;
  44925. }
  44926. };
  44927. return self;
  44928. };
  44929. function Identity( v ) {
  44930. return v;
  44931. }
  44932. function Thrower( ex ) {
  44933. throw ex;
  44934. }
  44935. function adoptValue( value, resolve, reject, noValue ) {
  44936. var method;
  44937. try {
  44938. // Check for promise aspect first to privilege synchronous behavior
  44939. if ( value && isFunction( ( method = value.promise ) ) ) {
  44940. method.call( value ).done( resolve ).fail( reject );
  44941. // Other thenables
  44942. } else if ( value && isFunction( ( method = value.then ) ) ) {
  44943. method.call( value, resolve, reject );
  44944. // Other non-thenables
  44945. } else {
  44946. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  44947. // * false: [ value ].slice( 0 ) => resolve( value )
  44948. // * true: [ value ].slice( 1 ) => resolve()
  44949. resolve.apply( undefined, [ value ].slice( noValue ) );
  44950. }
  44951. // For Promises/A+, convert exceptions into rejections
  44952. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  44953. // Deferred#then to conditionally suppress rejection.
  44954. } catch ( value ) {
  44955. // Support: Android 4.0 only
  44956. // Strict mode functions invoked without .call/.apply get global-object context
  44957. reject.apply( undefined, [ value ] );
  44958. }
  44959. }
  44960. jQuery.extend( {
  44961. Deferred: function( func ) {
  44962. var tuples = [
  44963. // action, add listener, callbacks,
  44964. // ... .then handlers, argument index, [final state]
  44965. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  44966. jQuery.Callbacks( "memory" ), 2 ],
  44967. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  44968. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  44969. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  44970. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  44971. ],
  44972. state = "pending",
  44973. promise = {
  44974. state: function() {
  44975. return state;
  44976. },
  44977. always: function() {
  44978. deferred.done( arguments ).fail( arguments );
  44979. return this;
  44980. },
  44981. "catch": function( fn ) {
  44982. return promise.then( null, fn );
  44983. },
  44984. // Keep pipe for back-compat
  44985. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  44986. var fns = arguments;
  44987. return jQuery.Deferred( function( newDefer ) {
  44988. jQuery.each( tuples, function( i, tuple ) {
  44989. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  44990. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  44991. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  44992. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  44993. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  44994. deferred[ tuple[ 1 ] ]( function() {
  44995. var returned = fn && fn.apply( this, arguments );
  44996. if ( returned && isFunction( returned.promise ) ) {
  44997. returned.promise()
  44998. .progress( newDefer.notify )
  44999. .done( newDefer.resolve )
  45000. .fail( newDefer.reject );
  45001. } else {
  45002. newDefer[ tuple[ 0 ] + "With" ](
  45003. this,
  45004. fn ? [ returned ] : arguments
  45005. );
  45006. }
  45007. } );
  45008. } );
  45009. fns = null;
  45010. } ).promise();
  45011. },
  45012. then: function( onFulfilled, onRejected, onProgress ) {
  45013. var maxDepth = 0;
  45014. function resolve( depth, deferred, handler, special ) {
  45015. return function() {
  45016. var that = this,
  45017. args = arguments,
  45018. mightThrow = function() {
  45019. var returned, then;
  45020. // Support: Promises/A+ section 2.3.3.3.3
  45021. // https://promisesaplus.com/#point-59
  45022. // Ignore double-resolution attempts
  45023. if ( depth < maxDepth ) {
  45024. return;
  45025. }
  45026. returned = handler.apply( that, args );
  45027. // Support: Promises/A+ section 2.3.1
  45028. // https://promisesaplus.com/#point-48
  45029. if ( returned === deferred.promise() ) {
  45030. throw new TypeError( "Thenable self-resolution" );
  45031. }
  45032. // Support: Promises/A+ sections 2.3.3.1, 3.5
  45033. // https://promisesaplus.com/#point-54
  45034. // https://promisesaplus.com/#point-75
  45035. // Retrieve `then` only once
  45036. then = returned &&
  45037. // Support: Promises/A+ section 2.3.4
  45038. // https://promisesaplus.com/#point-64
  45039. // Only check objects and functions for thenability
  45040. ( typeof returned === "object" ||
  45041. typeof returned === "function" ) &&
  45042. returned.then;
  45043. // Handle a returned thenable
  45044. if ( isFunction( then ) ) {
  45045. // Special processors (notify) just wait for resolution
  45046. if ( special ) {
  45047. then.call(
  45048. returned,
  45049. resolve( maxDepth, deferred, Identity, special ),
  45050. resolve( maxDepth, deferred, Thrower, special )
  45051. );
  45052. // Normal processors (resolve) also hook into progress
  45053. } else {
  45054. // ...and disregard older resolution values
  45055. maxDepth++;
  45056. then.call(
  45057. returned,
  45058. resolve( maxDepth, deferred, Identity, special ),
  45059. resolve( maxDepth, deferred, Thrower, special ),
  45060. resolve( maxDepth, deferred, Identity,
  45061. deferred.notifyWith )
  45062. );
  45063. }
  45064. // Handle all other returned values
  45065. } else {
  45066. // Only substitute handlers pass on context
  45067. // and multiple values (non-spec behavior)
  45068. if ( handler !== Identity ) {
  45069. that = undefined;
  45070. args = [ returned ];
  45071. }
  45072. // Process the value(s)
  45073. // Default process is resolve
  45074. ( special || deferred.resolveWith )( that, args );
  45075. }
  45076. },
  45077. // Only normal processors (resolve) catch and reject exceptions
  45078. process = special ?
  45079. mightThrow :
  45080. function() {
  45081. try {
  45082. mightThrow();
  45083. } catch ( e ) {
  45084. if ( jQuery.Deferred.exceptionHook ) {
  45085. jQuery.Deferred.exceptionHook( e,
  45086. process.stackTrace );
  45087. }
  45088. // Support: Promises/A+ section 2.3.3.3.4.1
  45089. // https://promisesaplus.com/#point-61
  45090. // Ignore post-resolution exceptions
  45091. if ( depth + 1 >= maxDepth ) {
  45092. // Only substitute handlers pass on context
  45093. // and multiple values (non-spec behavior)
  45094. if ( handler !== Thrower ) {
  45095. that = undefined;
  45096. args = [ e ];
  45097. }
  45098. deferred.rejectWith( that, args );
  45099. }
  45100. }
  45101. };
  45102. // Support: Promises/A+ section 2.3.3.3.1
  45103. // https://promisesaplus.com/#point-57
  45104. // Re-resolve promises immediately to dodge false rejection from
  45105. // subsequent errors
  45106. if ( depth ) {
  45107. process();
  45108. } else {
  45109. // Call an optional hook to record the stack, in case of exception
  45110. // since it's otherwise lost when execution goes async
  45111. if ( jQuery.Deferred.getStackHook ) {
  45112. process.stackTrace = jQuery.Deferred.getStackHook();
  45113. }
  45114. window.setTimeout( process );
  45115. }
  45116. };
  45117. }
  45118. return jQuery.Deferred( function( newDefer ) {
  45119. // progress_handlers.add( ... )
  45120. tuples[ 0 ][ 3 ].add(
  45121. resolve(
  45122. 0,
  45123. newDefer,
  45124. isFunction( onProgress ) ?
  45125. onProgress :
  45126. Identity,
  45127. newDefer.notifyWith
  45128. )
  45129. );
  45130. // fulfilled_handlers.add( ... )
  45131. tuples[ 1 ][ 3 ].add(
  45132. resolve(
  45133. 0,
  45134. newDefer,
  45135. isFunction( onFulfilled ) ?
  45136. onFulfilled :
  45137. Identity
  45138. )
  45139. );
  45140. // rejected_handlers.add( ... )
  45141. tuples[ 2 ][ 3 ].add(
  45142. resolve(
  45143. 0,
  45144. newDefer,
  45145. isFunction( onRejected ) ?
  45146. onRejected :
  45147. Thrower
  45148. )
  45149. );
  45150. } ).promise();
  45151. },
  45152. // Get a promise for this deferred
  45153. // If obj is provided, the promise aspect is added to the object
  45154. promise: function( obj ) {
  45155. return obj != null ? jQuery.extend( obj, promise ) : promise;
  45156. }
  45157. },
  45158. deferred = {};
  45159. // Add list-specific methods
  45160. jQuery.each( tuples, function( i, tuple ) {
  45161. var list = tuple[ 2 ],
  45162. stateString = tuple[ 5 ];
  45163. // promise.progress = list.add
  45164. // promise.done = list.add
  45165. // promise.fail = list.add
  45166. promise[ tuple[ 1 ] ] = list.add;
  45167. // Handle state
  45168. if ( stateString ) {
  45169. list.add(
  45170. function() {
  45171. // state = "resolved" (i.e., fulfilled)
  45172. // state = "rejected"
  45173. state = stateString;
  45174. },
  45175. // rejected_callbacks.disable
  45176. // fulfilled_callbacks.disable
  45177. tuples[ 3 - i ][ 2 ].disable,
  45178. // rejected_handlers.disable
  45179. // fulfilled_handlers.disable
  45180. tuples[ 3 - i ][ 3 ].disable,
  45181. // progress_callbacks.lock
  45182. tuples[ 0 ][ 2 ].lock,
  45183. // progress_handlers.lock
  45184. tuples[ 0 ][ 3 ].lock
  45185. );
  45186. }
  45187. // progress_handlers.fire
  45188. // fulfilled_handlers.fire
  45189. // rejected_handlers.fire
  45190. list.add( tuple[ 3 ].fire );
  45191. // deferred.notify = function() { deferred.notifyWith(...) }
  45192. // deferred.resolve = function() { deferred.resolveWith(...) }
  45193. // deferred.reject = function() { deferred.rejectWith(...) }
  45194. deferred[ tuple[ 0 ] ] = function() {
  45195. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  45196. return this;
  45197. };
  45198. // deferred.notifyWith = list.fireWith
  45199. // deferred.resolveWith = list.fireWith
  45200. // deferred.rejectWith = list.fireWith
  45201. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  45202. } );
  45203. // Make the deferred a promise
  45204. promise.promise( deferred );
  45205. // Call given func if any
  45206. if ( func ) {
  45207. func.call( deferred, deferred );
  45208. }
  45209. // All done!
  45210. return deferred;
  45211. },
  45212. // Deferred helper
  45213. when: function( singleValue ) {
  45214. var
  45215. // count of uncompleted subordinates
  45216. remaining = arguments.length,
  45217. // count of unprocessed arguments
  45218. i = remaining,
  45219. // subordinate fulfillment data
  45220. resolveContexts = Array( i ),
  45221. resolveValues = slice.call( arguments ),
  45222. // the master Deferred
  45223. master = jQuery.Deferred(),
  45224. // subordinate callback factory
  45225. updateFunc = function( i ) {
  45226. return function( value ) {
  45227. resolveContexts[ i ] = this;
  45228. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  45229. if ( !( --remaining ) ) {
  45230. master.resolveWith( resolveContexts, resolveValues );
  45231. }
  45232. };
  45233. };
  45234. // Single- and empty arguments are adopted like Promise.resolve
  45235. if ( remaining <= 1 ) {
  45236. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  45237. !remaining );
  45238. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  45239. if ( master.state() === "pending" ||
  45240. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  45241. return master.then();
  45242. }
  45243. }
  45244. // Multiple arguments are aggregated like Promise.all array elements
  45245. while ( i-- ) {
  45246. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  45247. }
  45248. return master.promise();
  45249. }
  45250. } );
  45251. // These usually indicate a programmer mistake during development,
  45252. // warn about them ASAP rather than swallowing them by default.
  45253. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  45254. jQuery.Deferred.exceptionHook = function( error, stack ) {
  45255. // Support: IE 8 - 9 only
  45256. // Console exists when dev tools are open, which can happen at any time
  45257. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  45258. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  45259. }
  45260. };
  45261. jQuery.readyException = function( error ) {
  45262. window.setTimeout( function() {
  45263. throw error;
  45264. } );
  45265. };
  45266. // The deferred used on DOM ready
  45267. var readyList = jQuery.Deferred();
  45268. jQuery.fn.ready = function( fn ) {
  45269. readyList
  45270. .then( fn )
  45271. // Wrap jQuery.readyException in a function so that the lookup
  45272. // happens at the time of error handling instead of callback
  45273. // registration.
  45274. .catch( function( error ) {
  45275. jQuery.readyException( error );
  45276. } );
  45277. return this;
  45278. };
  45279. jQuery.extend( {
  45280. // Is the DOM ready to be used? Set to true once it occurs.
  45281. isReady: false,
  45282. // A counter to track how many items to wait for before
  45283. // the ready event fires. See #6781
  45284. readyWait: 1,
  45285. // Handle when the DOM is ready
  45286. ready: function( wait ) {
  45287. // Abort if there are pending holds or we're already ready
  45288. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  45289. return;
  45290. }
  45291. // Remember that the DOM is ready
  45292. jQuery.isReady = true;
  45293. // If a normal DOM Ready event fired, decrement, and wait if need be
  45294. if ( wait !== true && --jQuery.readyWait > 0 ) {
  45295. return;
  45296. }
  45297. // If there are functions bound, to execute
  45298. readyList.resolveWith( document, [ jQuery ] );
  45299. }
  45300. } );
  45301. jQuery.ready.then = readyList.then;
  45302. // The ready event handler and self cleanup method
  45303. function completed() {
  45304. document.removeEventListener( "DOMContentLoaded", completed );
  45305. window.removeEventListener( "load", completed );
  45306. jQuery.ready();
  45307. }
  45308. // Catch cases where $(document).ready() is called
  45309. // after the browser event has already occurred.
  45310. // Support: IE <=9 - 10 only
  45311. // Older IE sometimes signals "interactive" too soon
  45312. if ( document.readyState === "complete" ||
  45313. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  45314. // Handle it asynchronously to allow scripts the opportunity to delay ready
  45315. window.setTimeout( jQuery.ready );
  45316. } else {
  45317. // Use the handy event callback
  45318. document.addEventListener( "DOMContentLoaded", completed );
  45319. // A fallback to window.onload, that will always work
  45320. window.addEventListener( "load", completed );
  45321. }
  45322. // Multifunctional method to get and set values of a collection
  45323. // The value/s can optionally be executed if it's a function
  45324. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  45325. var i = 0,
  45326. len = elems.length,
  45327. bulk = key == null;
  45328. // Sets many values
  45329. if ( toType( key ) === "object" ) {
  45330. chainable = true;
  45331. for ( i in key ) {
  45332. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  45333. }
  45334. // Sets one value
  45335. } else if ( value !== undefined ) {
  45336. chainable = true;
  45337. if ( !isFunction( value ) ) {
  45338. raw = true;
  45339. }
  45340. if ( bulk ) {
  45341. // Bulk operations run against the entire set
  45342. if ( raw ) {
  45343. fn.call( elems, value );
  45344. fn = null;
  45345. // ...except when executing function values
  45346. } else {
  45347. bulk = fn;
  45348. fn = function( elem, key, value ) {
  45349. return bulk.call( jQuery( elem ), value );
  45350. };
  45351. }
  45352. }
  45353. if ( fn ) {
  45354. for ( ; i < len; i++ ) {
  45355. fn(
  45356. elems[ i ], key, raw ?
  45357. value :
  45358. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  45359. );
  45360. }
  45361. }
  45362. }
  45363. if ( chainable ) {
  45364. return elems;
  45365. }
  45366. // Gets
  45367. if ( bulk ) {
  45368. return fn.call( elems );
  45369. }
  45370. return len ? fn( elems[ 0 ], key ) : emptyGet;
  45371. };
  45372. // Matches dashed string for camelizing
  45373. var rmsPrefix = /^-ms-/,
  45374. rdashAlpha = /-([a-z])/g;
  45375. // Used by camelCase as callback to replace()
  45376. function fcamelCase( all, letter ) {
  45377. return letter.toUpperCase();
  45378. }
  45379. // Convert dashed to camelCase; used by the css and data modules
  45380. // Support: IE <=9 - 11, Edge 12 - 15
  45381. // Microsoft forgot to hump their vendor prefix (#9572)
  45382. function camelCase( string ) {
  45383. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  45384. }
  45385. var acceptData = function( owner ) {
  45386. // Accepts only:
  45387. // - Node
  45388. // - Node.ELEMENT_NODE
  45389. // - Node.DOCUMENT_NODE
  45390. // - Object
  45391. // - Any
  45392. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  45393. };
  45394. function Data() {
  45395. this.expando = jQuery.expando + Data.uid++;
  45396. }
  45397. Data.uid = 1;
  45398. Data.prototype = {
  45399. cache: function( owner ) {
  45400. // Check if the owner object already has a cache
  45401. var value = owner[ this.expando ];
  45402. // If not, create one
  45403. if ( !value ) {
  45404. value = {};
  45405. // We can accept data for non-element nodes in modern browsers,
  45406. // but we should not, see #8335.
  45407. // Always return an empty object.
  45408. if ( acceptData( owner ) ) {
  45409. // If it is a node unlikely to be stringify-ed or looped over
  45410. // use plain assignment
  45411. if ( owner.nodeType ) {
  45412. owner[ this.expando ] = value;
  45413. // Otherwise secure it in a non-enumerable property
  45414. // configurable must be true to allow the property to be
  45415. // deleted when data is removed
  45416. } else {
  45417. Object.defineProperty( owner, this.expando, {
  45418. value: value,
  45419. configurable: true
  45420. } );
  45421. }
  45422. }
  45423. }
  45424. return value;
  45425. },
  45426. set: function( owner, data, value ) {
  45427. var prop,
  45428. cache = this.cache( owner );
  45429. // Handle: [ owner, key, value ] args
  45430. // Always use camelCase key (gh-2257)
  45431. if ( typeof data === "string" ) {
  45432. cache[ camelCase( data ) ] = value;
  45433. // Handle: [ owner, { properties } ] args
  45434. } else {
  45435. // Copy the properties one-by-one to the cache object
  45436. for ( prop in data ) {
  45437. cache[ camelCase( prop ) ] = data[ prop ];
  45438. }
  45439. }
  45440. return cache;
  45441. },
  45442. get: function( owner, key ) {
  45443. return key === undefined ?
  45444. this.cache( owner ) :
  45445. // Always use camelCase key (gh-2257)
  45446. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  45447. },
  45448. access: function( owner, key, value ) {
  45449. // In cases where either:
  45450. //
  45451. // 1. No key was specified
  45452. // 2. A string key was specified, but no value provided
  45453. //
  45454. // Take the "read" path and allow the get method to determine
  45455. // which value to return, respectively either:
  45456. //
  45457. // 1. The entire cache object
  45458. // 2. The data stored at the key
  45459. //
  45460. if ( key === undefined ||
  45461. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  45462. return this.get( owner, key );
  45463. }
  45464. // When the key is not a string, or both a key and value
  45465. // are specified, set or extend (existing objects) with either:
  45466. //
  45467. // 1. An object of properties
  45468. // 2. A key and value
  45469. //
  45470. this.set( owner, key, value );
  45471. // Since the "set" path can have two possible entry points
  45472. // return the expected data based on which path was taken[*]
  45473. return value !== undefined ? value : key;
  45474. },
  45475. remove: function( owner, key ) {
  45476. var i,
  45477. cache = owner[ this.expando ];
  45478. if ( cache === undefined ) {
  45479. return;
  45480. }
  45481. if ( key !== undefined ) {
  45482. // Support array or space separated string of keys
  45483. if ( Array.isArray( key ) ) {
  45484. // If key is an array of keys...
  45485. // We always set camelCase keys, so remove that.
  45486. key = key.map( camelCase );
  45487. } else {
  45488. key = camelCase( key );
  45489. // If a key with the spaces exists, use it.
  45490. // Otherwise, create an array by matching non-whitespace
  45491. key = key in cache ?
  45492. [ key ] :
  45493. ( key.match( rnothtmlwhite ) || [] );
  45494. }
  45495. i = key.length;
  45496. while ( i-- ) {
  45497. delete cache[ key[ i ] ];
  45498. }
  45499. }
  45500. // Remove the expando if there's no more data
  45501. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  45502. // Support: Chrome <=35 - 45
  45503. // Webkit & Blink performance suffers when deleting properties
  45504. // from DOM nodes, so set to undefined instead
  45505. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  45506. if ( owner.nodeType ) {
  45507. owner[ this.expando ] = undefined;
  45508. } else {
  45509. delete owner[ this.expando ];
  45510. }
  45511. }
  45512. },
  45513. hasData: function( owner ) {
  45514. var cache = owner[ this.expando ];
  45515. return cache !== undefined && !jQuery.isEmptyObject( cache );
  45516. }
  45517. };
  45518. var dataPriv = new Data();
  45519. var dataUser = new Data();
  45520. // Implementation Summary
  45521. //
  45522. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  45523. // 2. Improve the module's maintainability by reducing the storage
  45524. // paths to a single mechanism.
  45525. // 3. Use the same single mechanism to support "private" and "user" data.
  45526. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  45527. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  45528. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  45529. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  45530. rmultiDash = /[A-Z]/g;
  45531. function getData( data ) {
  45532. if ( data === "true" ) {
  45533. return true;
  45534. }
  45535. if ( data === "false" ) {
  45536. return false;
  45537. }
  45538. if ( data === "null" ) {
  45539. return null;
  45540. }
  45541. // Only convert to a number if it doesn't change the string
  45542. if ( data === +data + "" ) {
  45543. return +data;
  45544. }
  45545. if ( rbrace.test( data ) ) {
  45546. return JSON.parse( data );
  45547. }
  45548. return data;
  45549. }
  45550. function dataAttr( elem, key, data ) {
  45551. var name;
  45552. // If nothing was found internally, try to fetch any
  45553. // data from the HTML5 data-* attribute
  45554. if ( data === undefined && elem.nodeType === 1 ) {
  45555. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  45556. data = elem.getAttribute( name );
  45557. if ( typeof data === "string" ) {
  45558. try {
  45559. data = getData( data );
  45560. } catch ( e ) {}
  45561. // Make sure we set the data so it isn't changed later
  45562. dataUser.set( elem, key, data );
  45563. } else {
  45564. data = undefined;
  45565. }
  45566. }
  45567. return data;
  45568. }
  45569. jQuery.extend( {
  45570. hasData: function( elem ) {
  45571. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  45572. },
  45573. data: function( elem, name, data ) {
  45574. return dataUser.access( elem, name, data );
  45575. },
  45576. removeData: function( elem, name ) {
  45577. dataUser.remove( elem, name );
  45578. },
  45579. // TODO: Now that all calls to _data and _removeData have been replaced
  45580. // with direct calls to dataPriv methods, these can be deprecated.
  45581. _data: function( elem, name, data ) {
  45582. return dataPriv.access( elem, name, data );
  45583. },
  45584. _removeData: function( elem, name ) {
  45585. dataPriv.remove( elem, name );
  45586. }
  45587. } );
  45588. jQuery.fn.extend( {
  45589. data: function( key, value ) {
  45590. var i, name, data,
  45591. elem = this[ 0 ],
  45592. attrs = elem && elem.attributes;
  45593. // Gets all values
  45594. if ( key === undefined ) {
  45595. if ( this.length ) {
  45596. data = dataUser.get( elem );
  45597. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  45598. i = attrs.length;
  45599. while ( i-- ) {
  45600. // Support: IE 11 only
  45601. // The attrs elements can be null (#14894)
  45602. if ( attrs[ i ] ) {
  45603. name = attrs[ i ].name;
  45604. if ( name.indexOf( "data-" ) === 0 ) {
  45605. name = camelCase( name.slice( 5 ) );
  45606. dataAttr( elem, name, data[ name ] );
  45607. }
  45608. }
  45609. }
  45610. dataPriv.set( elem, "hasDataAttrs", true );
  45611. }
  45612. }
  45613. return data;
  45614. }
  45615. // Sets multiple values
  45616. if ( typeof key === "object" ) {
  45617. return this.each( function() {
  45618. dataUser.set( this, key );
  45619. } );
  45620. }
  45621. return access( this, function( value ) {
  45622. var data;
  45623. // The calling jQuery object (element matches) is not empty
  45624. // (and therefore has an element appears at this[ 0 ]) and the
  45625. // `value` parameter was not undefined. An empty jQuery object
  45626. // will result in `undefined` for elem = this[ 0 ] which will
  45627. // throw an exception if an attempt to read a data cache is made.
  45628. if ( elem && value === undefined ) {
  45629. // Attempt to get data from the cache
  45630. // The key will always be camelCased in Data
  45631. data = dataUser.get( elem, key );
  45632. if ( data !== undefined ) {
  45633. return data;
  45634. }
  45635. // Attempt to "discover" the data in
  45636. // HTML5 custom data-* attrs
  45637. data = dataAttr( elem, key );
  45638. if ( data !== undefined ) {
  45639. return data;
  45640. }
  45641. // We tried really hard, but the data doesn't exist.
  45642. return;
  45643. }
  45644. // Set the data...
  45645. this.each( function() {
  45646. // We always store the camelCased key
  45647. dataUser.set( this, key, value );
  45648. } );
  45649. }, null, value, arguments.length > 1, null, true );
  45650. },
  45651. removeData: function( key ) {
  45652. return this.each( function() {
  45653. dataUser.remove( this, key );
  45654. } );
  45655. }
  45656. } );
  45657. jQuery.extend( {
  45658. queue: function( elem, type, data ) {
  45659. var queue;
  45660. if ( elem ) {
  45661. type = ( type || "fx" ) + "queue";
  45662. queue = dataPriv.get( elem, type );
  45663. // Speed up dequeue by getting out quickly if this is just a lookup
  45664. if ( data ) {
  45665. if ( !queue || Array.isArray( data ) ) {
  45666. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  45667. } else {
  45668. queue.push( data );
  45669. }
  45670. }
  45671. return queue || [];
  45672. }
  45673. },
  45674. dequeue: function( elem, type ) {
  45675. type = type || "fx";
  45676. var queue = jQuery.queue( elem, type ),
  45677. startLength = queue.length,
  45678. fn = queue.shift(),
  45679. hooks = jQuery._queueHooks( elem, type ),
  45680. next = function() {
  45681. jQuery.dequeue( elem, type );
  45682. };
  45683. // If the fx queue is dequeued, always remove the progress sentinel
  45684. if ( fn === "inprogress" ) {
  45685. fn = queue.shift();
  45686. startLength--;
  45687. }
  45688. if ( fn ) {
  45689. // Add a progress sentinel to prevent the fx queue from being
  45690. // automatically dequeued
  45691. if ( type === "fx" ) {
  45692. queue.unshift( "inprogress" );
  45693. }
  45694. // Clear up the last queue stop function
  45695. delete hooks.stop;
  45696. fn.call( elem, next, hooks );
  45697. }
  45698. if ( !startLength && hooks ) {
  45699. hooks.empty.fire();
  45700. }
  45701. },
  45702. // Not public - generate a queueHooks object, or return the current one
  45703. _queueHooks: function( elem, type ) {
  45704. var key = type + "queueHooks";
  45705. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  45706. empty: jQuery.Callbacks( "once memory" ).add( function() {
  45707. dataPriv.remove( elem, [ type + "queue", key ] );
  45708. } )
  45709. } );
  45710. }
  45711. } );
  45712. jQuery.fn.extend( {
  45713. queue: function( type, data ) {
  45714. var setter = 2;
  45715. if ( typeof type !== "string" ) {
  45716. data = type;
  45717. type = "fx";
  45718. setter--;
  45719. }
  45720. if ( arguments.length < setter ) {
  45721. return jQuery.queue( this[ 0 ], type );
  45722. }
  45723. return data === undefined ?
  45724. this :
  45725. this.each( function() {
  45726. var queue = jQuery.queue( this, type, data );
  45727. // Ensure a hooks for this queue
  45728. jQuery._queueHooks( this, type );
  45729. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  45730. jQuery.dequeue( this, type );
  45731. }
  45732. } );
  45733. },
  45734. dequeue: function( type ) {
  45735. return this.each( function() {
  45736. jQuery.dequeue( this, type );
  45737. } );
  45738. },
  45739. clearQueue: function( type ) {
  45740. return this.queue( type || "fx", [] );
  45741. },
  45742. // Get a promise resolved when queues of a certain type
  45743. // are emptied (fx is the type by default)
  45744. promise: function( type, obj ) {
  45745. var tmp,
  45746. count = 1,
  45747. defer = jQuery.Deferred(),
  45748. elements = this,
  45749. i = this.length,
  45750. resolve = function() {
  45751. if ( !( --count ) ) {
  45752. defer.resolveWith( elements, [ elements ] );
  45753. }
  45754. };
  45755. if ( typeof type !== "string" ) {
  45756. obj = type;
  45757. type = undefined;
  45758. }
  45759. type = type || "fx";
  45760. while ( i-- ) {
  45761. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  45762. if ( tmp && tmp.empty ) {
  45763. count++;
  45764. tmp.empty.add( resolve );
  45765. }
  45766. }
  45767. resolve();
  45768. return defer.promise( obj );
  45769. }
  45770. } );
  45771. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  45772. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  45773. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  45774. var isHiddenWithinTree = function( elem, el ) {
  45775. // isHiddenWithinTree might be called from jQuery#filter function;
  45776. // in that case, element will be second argument
  45777. elem = el || elem;
  45778. // Inline style trumps all
  45779. return elem.style.display === "none" ||
  45780. elem.style.display === "" &&
  45781. // Otherwise, check computed style
  45782. // Support: Firefox <=43 - 45
  45783. // Disconnected elements can have computed display: none, so first confirm that elem is
  45784. // in the document.
  45785. jQuery.contains( elem.ownerDocument, elem ) &&
  45786. jQuery.css( elem, "display" ) === "none";
  45787. };
  45788. var swap = function( elem, options, callback, args ) {
  45789. var ret, name,
  45790. old = {};
  45791. // Remember the old values, and insert the new ones
  45792. for ( name in options ) {
  45793. old[ name ] = elem.style[ name ];
  45794. elem.style[ name ] = options[ name ];
  45795. }
  45796. ret = callback.apply( elem, args || [] );
  45797. // Revert the old values
  45798. for ( name in options ) {
  45799. elem.style[ name ] = old[ name ];
  45800. }
  45801. return ret;
  45802. };
  45803. function adjustCSS( elem, prop, valueParts, tween ) {
  45804. var adjusted, scale,
  45805. maxIterations = 20,
  45806. currentValue = tween ?
  45807. function() {
  45808. return tween.cur();
  45809. } :
  45810. function() {
  45811. return jQuery.css( elem, prop, "" );
  45812. },
  45813. initial = currentValue(),
  45814. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  45815. // Starting value computation is required for potential unit mismatches
  45816. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  45817. rcssNum.exec( jQuery.css( elem, prop ) );
  45818. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  45819. // Support: Firefox <=54
  45820. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  45821. initial = initial / 2;
  45822. // Trust units reported by jQuery.css
  45823. unit = unit || initialInUnit[ 3 ];
  45824. // Iteratively approximate from a nonzero starting point
  45825. initialInUnit = +initial || 1;
  45826. while ( maxIterations-- ) {
  45827. // Evaluate and update our best guess (doubling guesses that zero out).
  45828. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  45829. jQuery.style( elem, prop, initialInUnit + unit );
  45830. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  45831. maxIterations = 0;
  45832. }
  45833. initialInUnit = initialInUnit / scale;
  45834. }
  45835. initialInUnit = initialInUnit * 2;
  45836. jQuery.style( elem, prop, initialInUnit + unit );
  45837. // Make sure we update the tween properties later on
  45838. valueParts = valueParts || [];
  45839. }
  45840. if ( valueParts ) {
  45841. initialInUnit = +initialInUnit || +initial || 0;
  45842. // Apply relative offset (+=/-=) if specified
  45843. adjusted = valueParts[ 1 ] ?
  45844. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  45845. +valueParts[ 2 ];
  45846. if ( tween ) {
  45847. tween.unit = unit;
  45848. tween.start = initialInUnit;
  45849. tween.end = adjusted;
  45850. }
  45851. }
  45852. return adjusted;
  45853. }
  45854. var defaultDisplayMap = {};
  45855. function getDefaultDisplay( elem ) {
  45856. var temp,
  45857. doc = elem.ownerDocument,
  45858. nodeName = elem.nodeName,
  45859. display = defaultDisplayMap[ nodeName ];
  45860. if ( display ) {
  45861. return display;
  45862. }
  45863. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  45864. display = jQuery.css( temp, "display" );
  45865. temp.parentNode.removeChild( temp );
  45866. if ( display === "none" ) {
  45867. display = "block";
  45868. }
  45869. defaultDisplayMap[ nodeName ] = display;
  45870. return display;
  45871. }
  45872. function showHide( elements, show ) {
  45873. var display, elem,
  45874. values = [],
  45875. index = 0,
  45876. length = elements.length;
  45877. // Determine new display value for elements that need to change
  45878. for ( ; index < length; index++ ) {
  45879. elem = elements[ index ];
  45880. if ( !elem.style ) {
  45881. continue;
  45882. }
  45883. display = elem.style.display;
  45884. if ( show ) {
  45885. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  45886. // check is required in this first loop unless we have a nonempty display value (either
  45887. // inline or about-to-be-restored)
  45888. if ( display === "none" ) {
  45889. values[ index ] = dataPriv.get( elem, "display" ) || null;
  45890. if ( !values[ index ] ) {
  45891. elem.style.display = "";
  45892. }
  45893. }
  45894. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  45895. values[ index ] = getDefaultDisplay( elem );
  45896. }
  45897. } else {
  45898. if ( display !== "none" ) {
  45899. values[ index ] = "none";
  45900. // Remember what we're overwriting
  45901. dataPriv.set( elem, "display", display );
  45902. }
  45903. }
  45904. }
  45905. // Set the display of the elements in a second loop to avoid constant reflow
  45906. for ( index = 0; index < length; index++ ) {
  45907. if ( values[ index ] != null ) {
  45908. elements[ index ].style.display = values[ index ];
  45909. }
  45910. }
  45911. return elements;
  45912. }
  45913. jQuery.fn.extend( {
  45914. show: function() {
  45915. return showHide( this, true );
  45916. },
  45917. hide: function() {
  45918. return showHide( this );
  45919. },
  45920. toggle: function( state ) {
  45921. if ( typeof state === "boolean" ) {
  45922. return state ? this.show() : this.hide();
  45923. }
  45924. return this.each( function() {
  45925. if ( isHiddenWithinTree( this ) ) {
  45926. jQuery( this ).show();
  45927. } else {
  45928. jQuery( this ).hide();
  45929. }
  45930. } );
  45931. }
  45932. } );
  45933. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  45934. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  45935. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  45936. // We have to close these tags to support XHTML (#13200)
  45937. var wrapMap = {
  45938. // Support: IE <=9 only
  45939. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  45940. // XHTML parsers do not magically insert elements in the
  45941. // same way that tag soup parsers do. So we cannot shorten
  45942. // this by omitting <tbody> or other required elements.
  45943. thead: [ 1, "<table>", "</table>" ],
  45944. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  45945. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  45946. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  45947. _default: [ 0, "", "" ]
  45948. };
  45949. // Support: IE <=9 only
  45950. wrapMap.optgroup = wrapMap.option;
  45951. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  45952. wrapMap.th = wrapMap.td;
  45953. function getAll( context, tag ) {
  45954. // Support: IE <=9 - 11 only
  45955. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  45956. var ret;
  45957. if ( typeof context.getElementsByTagName !== "undefined" ) {
  45958. ret = context.getElementsByTagName( tag || "*" );
  45959. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  45960. ret = context.querySelectorAll( tag || "*" );
  45961. } else {
  45962. ret = [];
  45963. }
  45964. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  45965. return jQuery.merge( [ context ], ret );
  45966. }
  45967. return ret;
  45968. }
  45969. // Mark scripts as having already been evaluated
  45970. function setGlobalEval( elems, refElements ) {
  45971. var i = 0,
  45972. l = elems.length;
  45973. for ( ; i < l; i++ ) {
  45974. dataPriv.set(
  45975. elems[ i ],
  45976. "globalEval",
  45977. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  45978. );
  45979. }
  45980. }
  45981. var rhtml = /<|&#?\w+;/;
  45982. function buildFragment( elems, context, scripts, selection, ignored ) {
  45983. var elem, tmp, tag, wrap, contains, j,
  45984. fragment = context.createDocumentFragment(),
  45985. nodes = [],
  45986. i = 0,
  45987. l = elems.length;
  45988. for ( ; i < l; i++ ) {
  45989. elem = elems[ i ];
  45990. if ( elem || elem === 0 ) {
  45991. // Add nodes directly
  45992. if ( toType( elem ) === "object" ) {
  45993. // Support: Android <=4.0 only, PhantomJS 1 only
  45994. // push.apply(_, arraylike) throws on ancient WebKit
  45995. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  45996. // Convert non-html into a text node
  45997. } else if ( !rhtml.test( elem ) ) {
  45998. nodes.push( context.createTextNode( elem ) );
  45999. // Convert html into DOM nodes
  46000. } else {
  46001. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  46002. // Deserialize a standard representation
  46003. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  46004. wrap = wrapMap[ tag ] || wrapMap._default;
  46005. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  46006. // Descend through wrappers to the right content
  46007. j = wrap[ 0 ];
  46008. while ( j-- ) {
  46009. tmp = tmp.lastChild;
  46010. }
  46011. // Support: Android <=4.0 only, PhantomJS 1 only
  46012. // push.apply(_, arraylike) throws on ancient WebKit
  46013. jQuery.merge( nodes, tmp.childNodes );
  46014. // Remember the top-level container
  46015. tmp = fragment.firstChild;
  46016. // Ensure the created nodes are orphaned (#12392)
  46017. tmp.textContent = "";
  46018. }
  46019. }
  46020. }
  46021. // Remove wrapper from fragment
  46022. fragment.textContent = "";
  46023. i = 0;
  46024. while ( ( elem = nodes[ i++ ] ) ) {
  46025. // Skip elements already in the context collection (trac-4087)
  46026. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  46027. if ( ignored ) {
  46028. ignored.push( elem );
  46029. }
  46030. continue;
  46031. }
  46032. contains = jQuery.contains( elem.ownerDocument, elem );
  46033. // Append to fragment
  46034. tmp = getAll( fragment.appendChild( elem ), "script" );
  46035. // Preserve script evaluation history
  46036. if ( contains ) {
  46037. setGlobalEval( tmp );
  46038. }
  46039. // Capture executables
  46040. if ( scripts ) {
  46041. j = 0;
  46042. while ( ( elem = tmp[ j++ ] ) ) {
  46043. if ( rscriptType.test( elem.type || "" ) ) {
  46044. scripts.push( elem );
  46045. }
  46046. }
  46047. }
  46048. }
  46049. return fragment;
  46050. }
  46051. ( function() {
  46052. var fragment = document.createDocumentFragment(),
  46053. div = fragment.appendChild( document.createElement( "div" ) ),
  46054. input = document.createElement( "input" );
  46055. // Support: Android 4.0 - 4.3 only
  46056. // Check state lost if the name is set (#11217)
  46057. // Support: Windows Web Apps (WWA)
  46058. // `name` and `type` must use .setAttribute for WWA (#14901)
  46059. input.setAttribute( "type", "radio" );
  46060. input.setAttribute( "checked", "checked" );
  46061. input.setAttribute( "name", "t" );
  46062. div.appendChild( input );
  46063. // Support: Android <=4.1 only
  46064. // Older WebKit doesn't clone checked state correctly in fragments
  46065. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  46066. // Support: IE <=11 only
  46067. // Make sure textarea (and checkbox) defaultValue is properly cloned
  46068. div.innerHTML = "<textarea>x</textarea>";
  46069. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  46070. } )();
  46071. var documentElement = document.documentElement;
  46072. var
  46073. rkeyEvent = /^key/,
  46074. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  46075. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  46076. function returnTrue() {
  46077. return true;
  46078. }
  46079. function returnFalse() {
  46080. return false;
  46081. }
  46082. // Support: IE <=9 only
  46083. // See #13393 for more info
  46084. function safeActiveElement() {
  46085. try {
  46086. return document.activeElement;
  46087. } catch ( err ) { }
  46088. }
  46089. function on( elem, types, selector, data, fn, one ) {
  46090. var origFn, type;
  46091. // Types can be a map of types/handlers
  46092. if ( typeof types === "object" ) {
  46093. // ( types-Object, selector, data )
  46094. if ( typeof selector !== "string" ) {
  46095. // ( types-Object, data )
  46096. data = data || selector;
  46097. selector = undefined;
  46098. }
  46099. for ( type in types ) {
  46100. on( elem, type, selector, data, types[ type ], one );
  46101. }
  46102. return elem;
  46103. }
  46104. if ( data == null && fn == null ) {
  46105. // ( types, fn )
  46106. fn = selector;
  46107. data = selector = undefined;
  46108. } else if ( fn == null ) {
  46109. if ( typeof selector === "string" ) {
  46110. // ( types, selector, fn )
  46111. fn = data;
  46112. data = undefined;
  46113. } else {
  46114. // ( types, data, fn )
  46115. fn = data;
  46116. data = selector;
  46117. selector = undefined;
  46118. }
  46119. }
  46120. if ( fn === false ) {
  46121. fn = returnFalse;
  46122. } else if ( !fn ) {
  46123. return elem;
  46124. }
  46125. if ( one === 1 ) {
  46126. origFn = fn;
  46127. fn = function( event ) {
  46128. // Can use an empty set, since event contains the info
  46129. jQuery().off( event );
  46130. return origFn.apply( this, arguments );
  46131. };
  46132. // Use same guid so caller can remove using origFn
  46133. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  46134. }
  46135. return elem.each( function() {
  46136. jQuery.event.add( this, types, fn, data, selector );
  46137. } );
  46138. }
  46139. /*
  46140. * Helper functions for managing events -- not part of the public interface.
  46141. * Props to Dean Edwards' addEvent library for many of the ideas.
  46142. */
  46143. jQuery.event = {
  46144. global: {},
  46145. add: function( elem, types, handler, data, selector ) {
  46146. var handleObjIn, eventHandle, tmp,
  46147. events, t, handleObj,
  46148. special, handlers, type, namespaces, origType,
  46149. elemData = dataPriv.get( elem );
  46150. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  46151. if ( !elemData ) {
  46152. return;
  46153. }
  46154. // Caller can pass in an object of custom data in lieu of the handler
  46155. if ( handler.handler ) {
  46156. handleObjIn = handler;
  46157. handler = handleObjIn.handler;
  46158. selector = handleObjIn.selector;
  46159. }
  46160. // Ensure that invalid selectors throw exceptions at attach time
  46161. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  46162. if ( selector ) {
  46163. jQuery.find.matchesSelector( documentElement, selector );
  46164. }
  46165. // Make sure that the handler has a unique ID, used to find/remove it later
  46166. if ( !handler.guid ) {
  46167. handler.guid = jQuery.guid++;
  46168. }
  46169. // Init the element's event structure and main handler, if this is the first
  46170. if ( !( events = elemData.events ) ) {
  46171. events = elemData.events = {};
  46172. }
  46173. if ( !( eventHandle = elemData.handle ) ) {
  46174. eventHandle = elemData.handle = function( e ) {
  46175. // Discard the second event of a jQuery.event.trigger() and
  46176. // when an event is called after a page has unloaded
  46177. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  46178. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  46179. };
  46180. }
  46181. // Handle multiple events separated by a space
  46182. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  46183. t = types.length;
  46184. while ( t-- ) {
  46185. tmp = rtypenamespace.exec( types[ t ] ) || [];
  46186. type = origType = tmp[ 1 ];
  46187. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  46188. // There *must* be a type, no attaching namespace-only handlers
  46189. if ( !type ) {
  46190. continue;
  46191. }
  46192. // If event changes its type, use the special event handlers for the changed type
  46193. special = jQuery.event.special[ type ] || {};
  46194. // If selector defined, determine special event api type, otherwise given type
  46195. type = ( selector ? special.delegateType : special.bindType ) || type;
  46196. // Update special based on newly reset type
  46197. special = jQuery.event.special[ type ] || {};
  46198. // handleObj is passed to all event handlers
  46199. handleObj = jQuery.extend( {
  46200. type: type,
  46201. origType: origType,
  46202. data: data,
  46203. handler: handler,
  46204. guid: handler.guid,
  46205. selector: selector,
  46206. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  46207. namespace: namespaces.join( "." )
  46208. }, handleObjIn );
  46209. // Init the event handler queue if we're the first
  46210. if ( !( handlers = events[ type ] ) ) {
  46211. handlers = events[ type ] = [];
  46212. handlers.delegateCount = 0;
  46213. // Only use addEventListener if the special events handler returns false
  46214. if ( !special.setup ||
  46215. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  46216. if ( elem.addEventListener ) {
  46217. elem.addEventListener( type, eventHandle );
  46218. }
  46219. }
  46220. }
  46221. if ( special.add ) {
  46222. special.add.call( elem, handleObj );
  46223. if ( !handleObj.handler.guid ) {
  46224. handleObj.handler.guid = handler.guid;
  46225. }
  46226. }
  46227. // Add to the element's handler list, delegates in front
  46228. if ( selector ) {
  46229. handlers.splice( handlers.delegateCount++, 0, handleObj );
  46230. } else {
  46231. handlers.push( handleObj );
  46232. }
  46233. // Keep track of which events have ever been used, for event optimization
  46234. jQuery.event.global[ type ] = true;
  46235. }
  46236. },
  46237. // Detach an event or set of events from an element
  46238. remove: function( elem, types, handler, selector, mappedTypes ) {
  46239. var j, origCount, tmp,
  46240. events, t, handleObj,
  46241. special, handlers, type, namespaces, origType,
  46242. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  46243. if ( !elemData || !( events = elemData.events ) ) {
  46244. return;
  46245. }
  46246. // Once for each type.namespace in types; type may be omitted
  46247. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  46248. t = types.length;
  46249. while ( t-- ) {
  46250. tmp = rtypenamespace.exec( types[ t ] ) || [];
  46251. type = origType = tmp[ 1 ];
  46252. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  46253. // Unbind all events (on this namespace, if provided) for the element
  46254. if ( !type ) {
  46255. for ( type in events ) {
  46256. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  46257. }
  46258. continue;
  46259. }
  46260. special = jQuery.event.special[ type ] || {};
  46261. type = ( selector ? special.delegateType : special.bindType ) || type;
  46262. handlers = events[ type ] || [];
  46263. tmp = tmp[ 2 ] &&
  46264. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  46265. // Remove matching events
  46266. origCount = j = handlers.length;
  46267. while ( j-- ) {
  46268. handleObj = handlers[ j ];
  46269. if ( ( mappedTypes || origType === handleObj.origType ) &&
  46270. ( !handler || handler.guid === handleObj.guid ) &&
  46271. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  46272. ( !selector || selector === handleObj.selector ||
  46273. selector === "**" && handleObj.selector ) ) {
  46274. handlers.splice( j, 1 );
  46275. if ( handleObj.selector ) {
  46276. handlers.delegateCount--;
  46277. }
  46278. if ( special.remove ) {
  46279. special.remove.call( elem, handleObj );
  46280. }
  46281. }
  46282. }
  46283. // Remove generic event handler if we removed something and no more handlers exist
  46284. // (avoids potential for endless recursion during removal of special event handlers)
  46285. if ( origCount && !handlers.length ) {
  46286. if ( !special.teardown ||
  46287. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  46288. jQuery.removeEvent( elem, type, elemData.handle );
  46289. }
  46290. delete events[ type ];
  46291. }
  46292. }
  46293. // Remove data and the expando if it's no longer used
  46294. if ( jQuery.isEmptyObject( events ) ) {
  46295. dataPriv.remove( elem, "handle events" );
  46296. }
  46297. },
  46298. dispatch: function( nativeEvent ) {
  46299. // Make a writable jQuery.Event from the native event object
  46300. var event = jQuery.event.fix( nativeEvent );
  46301. var i, j, ret, matched, handleObj, handlerQueue,
  46302. args = new Array( arguments.length ),
  46303. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  46304. special = jQuery.event.special[ event.type ] || {};
  46305. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  46306. args[ 0 ] = event;
  46307. for ( i = 1; i < arguments.length; i++ ) {
  46308. args[ i ] = arguments[ i ];
  46309. }
  46310. event.delegateTarget = this;
  46311. // Call the preDispatch hook for the mapped type, and let it bail if desired
  46312. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  46313. return;
  46314. }
  46315. // Determine handlers
  46316. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  46317. // Run delegates first; they may want to stop propagation beneath us
  46318. i = 0;
  46319. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  46320. event.currentTarget = matched.elem;
  46321. j = 0;
  46322. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  46323. !event.isImmediatePropagationStopped() ) {
  46324. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  46325. // a subset or equal to those in the bound event (both can have no namespace).
  46326. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  46327. event.handleObj = handleObj;
  46328. event.data = handleObj.data;
  46329. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  46330. handleObj.handler ).apply( matched.elem, args );
  46331. if ( ret !== undefined ) {
  46332. if ( ( event.result = ret ) === false ) {
  46333. event.preventDefault();
  46334. event.stopPropagation();
  46335. }
  46336. }
  46337. }
  46338. }
  46339. }
  46340. // Call the postDispatch hook for the mapped type
  46341. if ( special.postDispatch ) {
  46342. special.postDispatch.call( this, event );
  46343. }
  46344. return event.result;
  46345. },
  46346. handlers: function( event, handlers ) {
  46347. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  46348. handlerQueue = [],
  46349. delegateCount = handlers.delegateCount,
  46350. cur = event.target;
  46351. // Find delegate handlers
  46352. if ( delegateCount &&
  46353. // Support: IE <=9
  46354. // Black-hole SVG <use> instance trees (trac-13180)
  46355. cur.nodeType &&
  46356. // Support: Firefox <=42
  46357. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  46358. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  46359. // Support: IE 11 only
  46360. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  46361. !( event.type === "click" && event.button >= 1 ) ) {
  46362. for ( ; cur !== this; cur = cur.parentNode || this ) {
  46363. // Don't check non-elements (#13208)
  46364. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  46365. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  46366. matchedHandlers = [];
  46367. matchedSelectors = {};
  46368. for ( i = 0; i < delegateCount; i++ ) {
  46369. handleObj = handlers[ i ];
  46370. // Don't conflict with Object.prototype properties (#13203)
  46371. sel = handleObj.selector + " ";
  46372. if ( matchedSelectors[ sel ] === undefined ) {
  46373. matchedSelectors[ sel ] = handleObj.needsContext ?
  46374. jQuery( sel, this ).index( cur ) > -1 :
  46375. jQuery.find( sel, this, null, [ cur ] ).length;
  46376. }
  46377. if ( matchedSelectors[ sel ] ) {
  46378. matchedHandlers.push( handleObj );
  46379. }
  46380. }
  46381. if ( matchedHandlers.length ) {
  46382. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  46383. }
  46384. }
  46385. }
  46386. }
  46387. // Add the remaining (directly-bound) handlers
  46388. cur = this;
  46389. if ( delegateCount < handlers.length ) {
  46390. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  46391. }
  46392. return handlerQueue;
  46393. },
  46394. addProp: function( name, hook ) {
  46395. Object.defineProperty( jQuery.Event.prototype, name, {
  46396. enumerable: true,
  46397. configurable: true,
  46398. get: isFunction( hook ) ?
  46399. function() {
  46400. if ( this.originalEvent ) {
  46401. return hook( this.originalEvent );
  46402. }
  46403. } :
  46404. function() {
  46405. if ( this.originalEvent ) {
  46406. return this.originalEvent[ name ];
  46407. }
  46408. },
  46409. set: function( value ) {
  46410. Object.defineProperty( this, name, {
  46411. enumerable: true,
  46412. configurable: true,
  46413. writable: true,
  46414. value: value
  46415. } );
  46416. }
  46417. } );
  46418. },
  46419. fix: function( originalEvent ) {
  46420. return originalEvent[ jQuery.expando ] ?
  46421. originalEvent :
  46422. new jQuery.Event( originalEvent );
  46423. },
  46424. special: {
  46425. load: {
  46426. // Prevent triggered image.load events from bubbling to window.load
  46427. noBubble: true
  46428. },
  46429. focus: {
  46430. // Fire native event if possible so blur/focus sequence is correct
  46431. trigger: function() {
  46432. if ( this !== safeActiveElement() && this.focus ) {
  46433. this.focus();
  46434. return false;
  46435. }
  46436. },
  46437. delegateType: "focusin"
  46438. },
  46439. blur: {
  46440. trigger: function() {
  46441. if ( this === safeActiveElement() && this.blur ) {
  46442. this.blur();
  46443. return false;
  46444. }
  46445. },
  46446. delegateType: "focusout"
  46447. },
  46448. click: {
  46449. // For checkbox, fire native event so checked state will be right
  46450. trigger: function() {
  46451. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  46452. this.click();
  46453. return false;
  46454. }
  46455. },
  46456. // For cross-browser consistency, don't fire native .click() on links
  46457. _default: function( event ) {
  46458. return nodeName( event.target, "a" );
  46459. }
  46460. },
  46461. beforeunload: {
  46462. postDispatch: function( event ) {
  46463. // Support: Firefox 20+
  46464. // Firefox doesn't alert if the returnValue field is not set.
  46465. if ( event.result !== undefined && event.originalEvent ) {
  46466. event.originalEvent.returnValue = event.result;
  46467. }
  46468. }
  46469. }
  46470. }
  46471. };
  46472. jQuery.removeEvent = function( elem, type, handle ) {
  46473. // This "if" is needed for plain objects
  46474. if ( elem.removeEventListener ) {
  46475. elem.removeEventListener( type, handle );
  46476. }
  46477. };
  46478. jQuery.Event = function( src, props ) {
  46479. // Allow instantiation without the 'new' keyword
  46480. if ( !( this instanceof jQuery.Event ) ) {
  46481. return new jQuery.Event( src, props );
  46482. }
  46483. // Event object
  46484. if ( src && src.type ) {
  46485. this.originalEvent = src;
  46486. this.type = src.type;
  46487. // Events bubbling up the document may have been marked as prevented
  46488. // by a handler lower down the tree; reflect the correct value.
  46489. this.isDefaultPrevented = src.defaultPrevented ||
  46490. src.defaultPrevented === undefined &&
  46491. // Support: Android <=2.3 only
  46492. src.returnValue === false ?
  46493. returnTrue :
  46494. returnFalse;
  46495. // Create target properties
  46496. // Support: Safari <=6 - 7 only
  46497. // Target should not be a text node (#504, #13143)
  46498. this.target = ( src.target && src.target.nodeType === 3 ) ?
  46499. src.target.parentNode :
  46500. src.target;
  46501. this.currentTarget = src.currentTarget;
  46502. this.relatedTarget = src.relatedTarget;
  46503. // Event type
  46504. } else {
  46505. this.type = src;
  46506. }
  46507. // Put explicitly provided properties onto the event object
  46508. if ( props ) {
  46509. jQuery.extend( this, props );
  46510. }
  46511. // Create a timestamp if incoming event doesn't have one
  46512. this.timeStamp = src && src.timeStamp || Date.now();
  46513. // Mark it as fixed
  46514. this[ jQuery.expando ] = true;
  46515. };
  46516. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  46517. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  46518. jQuery.Event.prototype = {
  46519. constructor: jQuery.Event,
  46520. isDefaultPrevented: returnFalse,
  46521. isPropagationStopped: returnFalse,
  46522. isImmediatePropagationStopped: returnFalse,
  46523. isSimulated: false,
  46524. preventDefault: function() {
  46525. var e = this.originalEvent;
  46526. this.isDefaultPrevented = returnTrue;
  46527. if ( e && !this.isSimulated ) {
  46528. e.preventDefault();
  46529. }
  46530. },
  46531. stopPropagation: function() {
  46532. var e = this.originalEvent;
  46533. this.isPropagationStopped = returnTrue;
  46534. if ( e && !this.isSimulated ) {
  46535. e.stopPropagation();
  46536. }
  46537. },
  46538. stopImmediatePropagation: function() {
  46539. var e = this.originalEvent;
  46540. this.isImmediatePropagationStopped = returnTrue;
  46541. if ( e && !this.isSimulated ) {
  46542. e.stopImmediatePropagation();
  46543. }
  46544. this.stopPropagation();
  46545. }
  46546. };
  46547. // Includes all common event props including KeyEvent and MouseEvent specific props
  46548. jQuery.each( {
  46549. altKey: true,
  46550. bubbles: true,
  46551. cancelable: true,
  46552. changedTouches: true,
  46553. ctrlKey: true,
  46554. detail: true,
  46555. eventPhase: true,
  46556. metaKey: true,
  46557. pageX: true,
  46558. pageY: true,
  46559. shiftKey: true,
  46560. view: true,
  46561. "char": true,
  46562. charCode: true,
  46563. key: true,
  46564. keyCode: true,
  46565. button: true,
  46566. buttons: true,
  46567. clientX: true,
  46568. clientY: true,
  46569. offsetX: true,
  46570. offsetY: true,
  46571. pointerId: true,
  46572. pointerType: true,
  46573. screenX: true,
  46574. screenY: true,
  46575. targetTouches: true,
  46576. toElement: true,
  46577. touches: true,
  46578. which: function( event ) {
  46579. var button = event.button;
  46580. // Add which for key events
  46581. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  46582. return event.charCode != null ? event.charCode : event.keyCode;
  46583. }
  46584. // Add which for click: 1 === left; 2 === middle; 3 === right
  46585. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  46586. if ( button & 1 ) {
  46587. return 1;
  46588. }
  46589. if ( button & 2 ) {
  46590. return 3;
  46591. }
  46592. if ( button & 4 ) {
  46593. return 2;
  46594. }
  46595. return 0;
  46596. }
  46597. return event.which;
  46598. }
  46599. }, jQuery.event.addProp );
  46600. // Create mouseenter/leave events using mouseover/out and event-time checks
  46601. // so that event delegation works in jQuery.
  46602. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  46603. //
  46604. // Support: Safari 7 only
  46605. // Safari sends mouseenter too often; see:
  46606. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  46607. // for the description of the bug (it existed in older Chrome versions as well).
  46608. jQuery.each( {
  46609. mouseenter: "mouseover",
  46610. mouseleave: "mouseout",
  46611. pointerenter: "pointerover",
  46612. pointerleave: "pointerout"
  46613. }, function( orig, fix ) {
  46614. jQuery.event.special[ orig ] = {
  46615. delegateType: fix,
  46616. bindType: fix,
  46617. handle: function( event ) {
  46618. var ret,
  46619. target = this,
  46620. related = event.relatedTarget,
  46621. handleObj = event.handleObj;
  46622. // For mouseenter/leave call the handler if related is outside the target.
  46623. // NB: No relatedTarget if the mouse left/entered the browser window
  46624. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  46625. event.type = handleObj.origType;
  46626. ret = handleObj.handler.apply( this, arguments );
  46627. event.type = fix;
  46628. }
  46629. return ret;
  46630. }
  46631. };
  46632. } );
  46633. jQuery.fn.extend( {
  46634. on: function( types, selector, data, fn ) {
  46635. return on( this, types, selector, data, fn );
  46636. },
  46637. one: function( types, selector, data, fn ) {
  46638. return on( this, types, selector, data, fn, 1 );
  46639. },
  46640. off: function( types, selector, fn ) {
  46641. var handleObj, type;
  46642. if ( types && types.preventDefault && types.handleObj ) {
  46643. // ( event ) dispatched jQuery.Event
  46644. handleObj = types.handleObj;
  46645. jQuery( types.delegateTarget ).off(
  46646. handleObj.namespace ?
  46647. handleObj.origType + "." + handleObj.namespace :
  46648. handleObj.origType,
  46649. handleObj.selector,
  46650. handleObj.handler
  46651. );
  46652. return this;
  46653. }
  46654. if ( typeof types === "object" ) {
  46655. // ( types-object [, selector] )
  46656. for ( type in types ) {
  46657. this.off( type, selector, types[ type ] );
  46658. }
  46659. return this;
  46660. }
  46661. if ( selector === false || typeof selector === "function" ) {
  46662. // ( types [, fn] )
  46663. fn = selector;
  46664. selector = undefined;
  46665. }
  46666. if ( fn === false ) {
  46667. fn = returnFalse;
  46668. }
  46669. return this.each( function() {
  46670. jQuery.event.remove( this, types, fn, selector );
  46671. } );
  46672. }
  46673. } );
  46674. var
  46675. /* eslint-disable max-len */
  46676. // See https://github.com/eslint/eslint/issues/3229
  46677. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  46678. /* eslint-enable */
  46679. // Support: IE <=10 - 11, Edge 12 - 13 only
  46680. // In IE/Edge using regex groups here causes severe slowdowns.
  46681. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  46682. rnoInnerhtml = /<script|<style|<link/i,
  46683. // checked="checked" or checked
  46684. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  46685. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  46686. // Prefer a tbody over its parent table for containing new rows
  46687. function manipulationTarget( elem, content ) {
  46688. if ( nodeName( elem, "table" ) &&
  46689. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  46690. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  46691. }
  46692. return elem;
  46693. }
  46694. // Replace/restore the type attribute of script elements for safe DOM manipulation
  46695. function disableScript( elem ) {
  46696. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  46697. return elem;
  46698. }
  46699. function restoreScript( elem ) {
  46700. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  46701. elem.type = elem.type.slice( 5 );
  46702. } else {
  46703. elem.removeAttribute( "type" );
  46704. }
  46705. return elem;
  46706. }
  46707. function cloneCopyEvent( src, dest ) {
  46708. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  46709. if ( dest.nodeType !== 1 ) {
  46710. return;
  46711. }
  46712. // 1. Copy private data: events, handlers, etc.
  46713. if ( dataPriv.hasData( src ) ) {
  46714. pdataOld = dataPriv.access( src );
  46715. pdataCur = dataPriv.set( dest, pdataOld );
  46716. events = pdataOld.events;
  46717. if ( events ) {
  46718. delete pdataCur.handle;
  46719. pdataCur.events = {};
  46720. for ( type in events ) {
  46721. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  46722. jQuery.event.add( dest, type, events[ type ][ i ] );
  46723. }
  46724. }
  46725. }
  46726. }
  46727. // 2. Copy user data
  46728. if ( dataUser.hasData( src ) ) {
  46729. udataOld = dataUser.access( src );
  46730. udataCur = jQuery.extend( {}, udataOld );
  46731. dataUser.set( dest, udataCur );
  46732. }
  46733. }
  46734. // Fix IE bugs, see support tests
  46735. function fixInput( src, dest ) {
  46736. var nodeName = dest.nodeName.toLowerCase();
  46737. // Fails to persist the checked state of a cloned checkbox or radio button.
  46738. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  46739. dest.checked = src.checked;
  46740. // Fails to return the selected option to the default selected state when cloning options
  46741. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  46742. dest.defaultValue = src.defaultValue;
  46743. }
  46744. }
  46745. function domManip( collection, args, callback, ignored ) {
  46746. // Flatten any nested arrays
  46747. args = concat.apply( [], args );
  46748. var fragment, first, scripts, hasScripts, node, doc,
  46749. i = 0,
  46750. l = collection.length,
  46751. iNoClone = l - 1,
  46752. value = args[ 0 ],
  46753. valueIsFunction = isFunction( value );
  46754. // We can't cloneNode fragments that contain checked, in WebKit
  46755. if ( valueIsFunction ||
  46756. ( l > 1 && typeof value === "string" &&
  46757. !support.checkClone && rchecked.test( value ) ) ) {
  46758. return collection.each( function( index ) {
  46759. var self = collection.eq( index );
  46760. if ( valueIsFunction ) {
  46761. args[ 0 ] = value.call( this, index, self.html() );
  46762. }
  46763. domManip( self, args, callback, ignored );
  46764. } );
  46765. }
  46766. if ( l ) {
  46767. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  46768. first = fragment.firstChild;
  46769. if ( fragment.childNodes.length === 1 ) {
  46770. fragment = first;
  46771. }
  46772. // Require either new content or an interest in ignored elements to invoke the callback
  46773. if ( first || ignored ) {
  46774. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  46775. hasScripts = scripts.length;
  46776. // Use the original fragment for the last item
  46777. // instead of the first because it can end up
  46778. // being emptied incorrectly in certain situations (#8070).
  46779. for ( ; i < l; i++ ) {
  46780. node = fragment;
  46781. if ( i !== iNoClone ) {
  46782. node = jQuery.clone( node, true, true );
  46783. // Keep references to cloned scripts for later restoration
  46784. if ( hasScripts ) {
  46785. // Support: Android <=4.0 only, PhantomJS 1 only
  46786. // push.apply(_, arraylike) throws on ancient WebKit
  46787. jQuery.merge( scripts, getAll( node, "script" ) );
  46788. }
  46789. }
  46790. callback.call( collection[ i ], node, i );
  46791. }
  46792. if ( hasScripts ) {
  46793. doc = scripts[ scripts.length - 1 ].ownerDocument;
  46794. // Reenable scripts
  46795. jQuery.map( scripts, restoreScript );
  46796. // Evaluate executable scripts on first document insertion
  46797. for ( i = 0; i < hasScripts; i++ ) {
  46798. node = scripts[ i ];
  46799. if ( rscriptType.test( node.type || "" ) &&
  46800. !dataPriv.access( node, "globalEval" ) &&
  46801. jQuery.contains( doc, node ) ) {
  46802. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  46803. // Optional AJAX dependency, but won't run scripts if not present
  46804. if ( jQuery._evalUrl ) {
  46805. jQuery._evalUrl( node.src );
  46806. }
  46807. } else {
  46808. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  46809. }
  46810. }
  46811. }
  46812. }
  46813. }
  46814. }
  46815. return collection;
  46816. }
  46817. function remove( elem, selector, keepData ) {
  46818. var node,
  46819. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  46820. i = 0;
  46821. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  46822. if ( !keepData && node.nodeType === 1 ) {
  46823. jQuery.cleanData( getAll( node ) );
  46824. }
  46825. if ( node.parentNode ) {
  46826. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  46827. setGlobalEval( getAll( node, "script" ) );
  46828. }
  46829. node.parentNode.removeChild( node );
  46830. }
  46831. }
  46832. return elem;
  46833. }
  46834. jQuery.extend( {
  46835. htmlPrefilter: function( html ) {
  46836. return html.replace( rxhtmlTag, "<$1></$2>" );
  46837. },
  46838. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  46839. var i, l, srcElements, destElements,
  46840. clone = elem.cloneNode( true ),
  46841. inPage = jQuery.contains( elem.ownerDocument, elem );
  46842. // Fix IE cloning issues
  46843. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  46844. !jQuery.isXMLDoc( elem ) ) {
  46845. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  46846. destElements = getAll( clone );
  46847. srcElements = getAll( elem );
  46848. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  46849. fixInput( srcElements[ i ], destElements[ i ] );
  46850. }
  46851. }
  46852. // Copy the events from the original to the clone
  46853. if ( dataAndEvents ) {
  46854. if ( deepDataAndEvents ) {
  46855. srcElements = srcElements || getAll( elem );
  46856. destElements = destElements || getAll( clone );
  46857. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  46858. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  46859. }
  46860. } else {
  46861. cloneCopyEvent( elem, clone );
  46862. }
  46863. }
  46864. // Preserve script evaluation history
  46865. destElements = getAll( clone, "script" );
  46866. if ( destElements.length > 0 ) {
  46867. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  46868. }
  46869. // Return the cloned set
  46870. return clone;
  46871. },
  46872. cleanData: function( elems ) {
  46873. var data, elem, type,
  46874. special = jQuery.event.special,
  46875. i = 0;
  46876. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  46877. if ( acceptData( elem ) ) {
  46878. if ( ( data = elem[ dataPriv.expando ] ) ) {
  46879. if ( data.events ) {
  46880. for ( type in data.events ) {
  46881. if ( special[ type ] ) {
  46882. jQuery.event.remove( elem, type );
  46883. // This is a shortcut to avoid jQuery.event.remove's overhead
  46884. } else {
  46885. jQuery.removeEvent( elem, type, data.handle );
  46886. }
  46887. }
  46888. }
  46889. // Support: Chrome <=35 - 45+
  46890. // Assign undefined instead of using delete, see Data#remove
  46891. elem[ dataPriv.expando ] = undefined;
  46892. }
  46893. if ( elem[ dataUser.expando ] ) {
  46894. // Support: Chrome <=35 - 45+
  46895. // Assign undefined instead of using delete, see Data#remove
  46896. elem[ dataUser.expando ] = undefined;
  46897. }
  46898. }
  46899. }
  46900. }
  46901. } );
  46902. jQuery.fn.extend( {
  46903. detach: function( selector ) {
  46904. return remove( this, selector, true );
  46905. },
  46906. remove: function( selector ) {
  46907. return remove( this, selector );
  46908. },
  46909. text: function( value ) {
  46910. return access( this, function( value ) {
  46911. return value === undefined ?
  46912. jQuery.text( this ) :
  46913. this.empty().each( function() {
  46914. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  46915. this.textContent = value;
  46916. }
  46917. } );
  46918. }, null, value, arguments.length );
  46919. },
  46920. append: function() {
  46921. return domManip( this, arguments, function( elem ) {
  46922. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  46923. var target = manipulationTarget( this, elem );
  46924. target.appendChild( elem );
  46925. }
  46926. } );
  46927. },
  46928. prepend: function() {
  46929. return domManip( this, arguments, function( elem ) {
  46930. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  46931. var target = manipulationTarget( this, elem );
  46932. target.insertBefore( elem, target.firstChild );
  46933. }
  46934. } );
  46935. },
  46936. before: function() {
  46937. return domManip( this, arguments, function( elem ) {
  46938. if ( this.parentNode ) {
  46939. this.parentNode.insertBefore( elem, this );
  46940. }
  46941. } );
  46942. },
  46943. after: function() {
  46944. return domManip( this, arguments, function( elem ) {
  46945. if ( this.parentNode ) {
  46946. this.parentNode.insertBefore( elem, this.nextSibling );
  46947. }
  46948. } );
  46949. },
  46950. empty: function() {
  46951. var elem,
  46952. i = 0;
  46953. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  46954. if ( elem.nodeType === 1 ) {
  46955. // Prevent memory leaks
  46956. jQuery.cleanData( getAll( elem, false ) );
  46957. // Remove any remaining nodes
  46958. elem.textContent = "";
  46959. }
  46960. }
  46961. return this;
  46962. },
  46963. clone: function( dataAndEvents, deepDataAndEvents ) {
  46964. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  46965. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  46966. return this.map( function() {
  46967. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  46968. } );
  46969. },
  46970. html: function( value ) {
  46971. return access( this, function( value ) {
  46972. var elem = this[ 0 ] || {},
  46973. i = 0,
  46974. l = this.length;
  46975. if ( value === undefined && elem.nodeType === 1 ) {
  46976. return elem.innerHTML;
  46977. }
  46978. // See if we can take a shortcut and just use innerHTML
  46979. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  46980. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  46981. value = jQuery.htmlPrefilter( value );
  46982. try {
  46983. for ( ; i < l; i++ ) {
  46984. elem = this[ i ] || {};
  46985. // Remove element nodes and prevent memory leaks
  46986. if ( elem.nodeType === 1 ) {
  46987. jQuery.cleanData( getAll( elem, false ) );
  46988. elem.innerHTML = value;
  46989. }
  46990. }
  46991. elem = 0;
  46992. // If using innerHTML throws an exception, use the fallback method
  46993. } catch ( e ) {}
  46994. }
  46995. if ( elem ) {
  46996. this.empty().append( value );
  46997. }
  46998. }, null, value, arguments.length );
  46999. },
  47000. replaceWith: function() {
  47001. var ignored = [];
  47002. // Make the changes, replacing each non-ignored context element with the new content
  47003. return domManip( this, arguments, function( elem ) {
  47004. var parent = this.parentNode;
  47005. if ( jQuery.inArray( this, ignored ) < 0 ) {
  47006. jQuery.cleanData( getAll( this ) );
  47007. if ( parent ) {
  47008. parent.replaceChild( elem, this );
  47009. }
  47010. }
  47011. // Force callback invocation
  47012. }, ignored );
  47013. }
  47014. } );
  47015. jQuery.each( {
  47016. appendTo: "append",
  47017. prependTo: "prepend",
  47018. insertBefore: "before",
  47019. insertAfter: "after",
  47020. replaceAll: "replaceWith"
  47021. }, function( name, original ) {
  47022. jQuery.fn[ name ] = function( selector ) {
  47023. var elems,
  47024. ret = [],
  47025. insert = jQuery( selector ),
  47026. last = insert.length - 1,
  47027. i = 0;
  47028. for ( ; i <= last; i++ ) {
  47029. elems = i === last ? this : this.clone( true );
  47030. jQuery( insert[ i ] )[ original ]( elems );
  47031. // Support: Android <=4.0 only, PhantomJS 1 only
  47032. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  47033. push.apply( ret, elems.get() );
  47034. }
  47035. return this.pushStack( ret );
  47036. };
  47037. } );
  47038. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  47039. var getStyles = function( elem ) {
  47040. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  47041. // IE throws on elements created in popups
  47042. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  47043. var view = elem.ownerDocument.defaultView;
  47044. if ( !view || !view.opener ) {
  47045. view = window;
  47046. }
  47047. return view.getComputedStyle( elem );
  47048. };
  47049. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  47050. ( function() {
  47051. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  47052. // so they're executed at the same time to save the second computation.
  47053. function computeStyleTests() {
  47054. // This is a singleton, we need to execute it only once
  47055. if ( !div ) {
  47056. return;
  47057. }
  47058. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  47059. "margin-top:1px;padding:0;border:0";
  47060. div.style.cssText =
  47061. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  47062. "margin:auto;border:1px;padding:1px;" +
  47063. "width:60%;top:1%";
  47064. documentElement.appendChild( container ).appendChild( div );
  47065. var divStyle = window.getComputedStyle( div );
  47066. pixelPositionVal = divStyle.top !== "1%";
  47067. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  47068. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  47069. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  47070. // Some styles come back with percentage values, even though they shouldn't
  47071. div.style.right = "60%";
  47072. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  47073. // Support: IE 9 - 11 only
  47074. // Detect misreporting of content dimensions for box-sizing:border-box elements
  47075. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  47076. // Support: IE 9 only
  47077. // Detect overflow:scroll screwiness (gh-3699)
  47078. div.style.position = "absolute";
  47079. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  47080. documentElement.removeChild( container );
  47081. // Nullify the div so it wouldn't be stored in the memory and
  47082. // it will also be a sign that checks already performed
  47083. div = null;
  47084. }
  47085. function roundPixelMeasures( measure ) {
  47086. return Math.round( parseFloat( measure ) );
  47087. }
  47088. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  47089. reliableMarginLeftVal,
  47090. container = document.createElement( "div" ),
  47091. div = document.createElement( "div" );
  47092. // Finish early in limited (non-browser) environments
  47093. if ( !div.style ) {
  47094. return;
  47095. }
  47096. // Support: IE <=9 - 11 only
  47097. // Style of cloned element affects source element cloned (#8908)
  47098. div.style.backgroundClip = "content-box";
  47099. div.cloneNode( true ).style.backgroundClip = "";
  47100. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  47101. jQuery.extend( support, {
  47102. boxSizingReliable: function() {
  47103. computeStyleTests();
  47104. return boxSizingReliableVal;
  47105. },
  47106. pixelBoxStyles: function() {
  47107. computeStyleTests();
  47108. return pixelBoxStylesVal;
  47109. },
  47110. pixelPosition: function() {
  47111. computeStyleTests();
  47112. return pixelPositionVal;
  47113. },
  47114. reliableMarginLeft: function() {
  47115. computeStyleTests();
  47116. return reliableMarginLeftVal;
  47117. },
  47118. scrollboxSize: function() {
  47119. computeStyleTests();
  47120. return scrollboxSizeVal;
  47121. }
  47122. } );
  47123. } )();
  47124. function curCSS( elem, name, computed ) {
  47125. var width, minWidth, maxWidth, ret,
  47126. // Support: Firefox 51+
  47127. // Retrieving style before computed somehow
  47128. // fixes an issue with getting wrong values
  47129. // on detached elements
  47130. style = elem.style;
  47131. computed = computed || getStyles( elem );
  47132. // getPropertyValue is needed for:
  47133. // .css('filter') (IE 9 only, #12537)
  47134. // .css('--customProperty) (#3144)
  47135. if ( computed ) {
  47136. ret = computed.getPropertyValue( name ) || computed[ name ];
  47137. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  47138. ret = jQuery.style( elem, name );
  47139. }
  47140. // A tribute to the "awesome hack by Dean Edwards"
  47141. // Android Browser returns percentage for some values,
  47142. // but width seems to be reliably pixels.
  47143. // This is against the CSSOM draft spec:
  47144. // https://drafts.csswg.org/cssom/#resolved-values
  47145. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  47146. // Remember the original values
  47147. width = style.width;
  47148. minWidth = style.minWidth;
  47149. maxWidth = style.maxWidth;
  47150. // Put in the new values to get a computed value out
  47151. style.minWidth = style.maxWidth = style.width = ret;
  47152. ret = computed.width;
  47153. // Revert the changed values
  47154. style.width = width;
  47155. style.minWidth = minWidth;
  47156. style.maxWidth = maxWidth;
  47157. }
  47158. }
  47159. return ret !== undefined ?
  47160. // Support: IE <=9 - 11 only
  47161. // IE returns zIndex value as an integer.
  47162. ret + "" :
  47163. ret;
  47164. }
  47165. function addGetHookIf( conditionFn, hookFn ) {
  47166. // Define the hook, we'll check on the first run if it's really needed.
  47167. return {
  47168. get: function() {
  47169. if ( conditionFn() ) {
  47170. // Hook not needed (or it's not possible to use it due
  47171. // to missing dependency), remove it.
  47172. delete this.get;
  47173. return;
  47174. }
  47175. // Hook needed; redefine it so that the support test is not executed again.
  47176. return ( this.get = hookFn ).apply( this, arguments );
  47177. }
  47178. };
  47179. }
  47180. var
  47181. // Swappable if display is none or starts with table
  47182. // except "table", "table-cell", or "table-caption"
  47183. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  47184. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  47185. rcustomProp = /^--/,
  47186. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  47187. cssNormalTransform = {
  47188. letterSpacing: "0",
  47189. fontWeight: "400"
  47190. },
  47191. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  47192. emptyStyle = document.createElement( "div" ).style;
  47193. // Return a css property mapped to a potentially vendor prefixed property
  47194. function vendorPropName( name ) {
  47195. // Shortcut for names that are not vendor prefixed
  47196. if ( name in emptyStyle ) {
  47197. return name;
  47198. }
  47199. // Check for vendor prefixed names
  47200. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  47201. i = cssPrefixes.length;
  47202. while ( i-- ) {
  47203. name = cssPrefixes[ i ] + capName;
  47204. if ( name in emptyStyle ) {
  47205. return name;
  47206. }
  47207. }
  47208. }
  47209. // Return a property mapped along what jQuery.cssProps suggests or to
  47210. // a vendor prefixed property.
  47211. function finalPropName( name ) {
  47212. var ret = jQuery.cssProps[ name ];
  47213. if ( !ret ) {
  47214. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  47215. }
  47216. return ret;
  47217. }
  47218. function setPositiveNumber( elem, value, subtract ) {
  47219. // Any relative (+/-) values have already been
  47220. // normalized at this point
  47221. var matches = rcssNum.exec( value );
  47222. return matches ?
  47223. // Guard against undefined "subtract", e.g., when used as in cssHooks
  47224. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  47225. value;
  47226. }
  47227. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  47228. var i = dimension === "width" ? 1 : 0,
  47229. extra = 0,
  47230. delta = 0;
  47231. // Adjustment may not be necessary
  47232. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  47233. return 0;
  47234. }
  47235. for ( ; i < 4; i += 2 ) {
  47236. // Both box models exclude margin
  47237. if ( box === "margin" ) {
  47238. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  47239. }
  47240. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  47241. if ( !isBorderBox ) {
  47242. // Add padding
  47243. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  47244. // For "border" or "margin", add border
  47245. if ( box !== "padding" ) {
  47246. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47247. // But still keep track of it otherwise
  47248. } else {
  47249. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47250. }
  47251. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  47252. // "padding" or "margin"
  47253. } else {
  47254. // For "content", subtract padding
  47255. if ( box === "content" ) {
  47256. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  47257. }
  47258. // For "content" or "padding", subtract border
  47259. if ( box !== "margin" ) {
  47260. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47261. }
  47262. }
  47263. }
  47264. // Account for positive content-box scroll gutter when requested by providing computedVal
  47265. if ( !isBorderBox && computedVal >= 0 ) {
  47266. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  47267. // Assuming integer scroll gutter, subtract the rest and round down
  47268. delta += Math.max( 0, Math.ceil(
  47269. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  47270. computedVal -
  47271. delta -
  47272. extra -
  47273. 0.5
  47274. ) );
  47275. }
  47276. return delta;
  47277. }
  47278. function getWidthOrHeight( elem, dimension, extra ) {
  47279. // Start with computed style
  47280. var styles = getStyles( elem ),
  47281. val = curCSS( elem, dimension, styles ),
  47282. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  47283. valueIsBorderBox = isBorderBox;
  47284. // Support: Firefox <=54
  47285. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  47286. if ( rnumnonpx.test( val ) ) {
  47287. if ( !extra ) {
  47288. return val;
  47289. }
  47290. val = "auto";
  47291. }
  47292. // Check for style in case a browser which returns unreliable values
  47293. // for getComputedStyle silently falls back to the reliable elem.style
  47294. valueIsBorderBox = valueIsBorderBox &&
  47295. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  47296. // Fall back to offsetWidth/offsetHeight when value is "auto"
  47297. // This happens for inline elements with no explicit setting (gh-3571)
  47298. // Support: Android <=4.1 - 4.3 only
  47299. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  47300. if ( val === "auto" ||
  47301. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  47302. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  47303. // offsetWidth/offsetHeight provide border-box values
  47304. valueIsBorderBox = true;
  47305. }
  47306. // Normalize "" and auto
  47307. val = parseFloat( val ) || 0;
  47308. // Adjust for the element's box model
  47309. return ( val +
  47310. boxModelAdjustment(
  47311. elem,
  47312. dimension,
  47313. extra || ( isBorderBox ? "border" : "content" ),
  47314. valueIsBorderBox,
  47315. styles,
  47316. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  47317. val
  47318. )
  47319. ) + "px";
  47320. }
  47321. jQuery.extend( {
  47322. // Add in style property hooks for overriding the default
  47323. // behavior of getting and setting a style property
  47324. cssHooks: {
  47325. opacity: {
  47326. get: function( elem, computed ) {
  47327. if ( computed ) {
  47328. // We should always get a number back from opacity
  47329. var ret = curCSS( elem, "opacity" );
  47330. return ret === "" ? "1" : ret;
  47331. }
  47332. }
  47333. }
  47334. },
  47335. // Don't automatically add "px" to these possibly-unitless properties
  47336. cssNumber: {
  47337. "animationIterationCount": true,
  47338. "columnCount": true,
  47339. "fillOpacity": true,
  47340. "flexGrow": true,
  47341. "flexShrink": true,
  47342. "fontWeight": true,
  47343. "lineHeight": true,
  47344. "opacity": true,
  47345. "order": true,
  47346. "orphans": true,
  47347. "widows": true,
  47348. "zIndex": true,
  47349. "zoom": true
  47350. },
  47351. // Add in properties whose names you wish to fix before
  47352. // setting or getting the value
  47353. cssProps: {},
  47354. // Get and set the style property on a DOM Node
  47355. style: function( elem, name, value, extra ) {
  47356. // Don't set styles on text and comment nodes
  47357. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  47358. return;
  47359. }
  47360. // Make sure that we're working with the right name
  47361. var ret, type, hooks,
  47362. origName = camelCase( name ),
  47363. isCustomProp = rcustomProp.test( name ),
  47364. style = elem.style;
  47365. // Make sure that we're working with the right name. We don't
  47366. // want to query the value if it is a CSS custom property
  47367. // since they are user-defined.
  47368. if ( !isCustomProp ) {
  47369. name = finalPropName( origName );
  47370. }
  47371. // Gets hook for the prefixed version, then unprefixed version
  47372. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  47373. // Check if we're setting a value
  47374. if ( value !== undefined ) {
  47375. type = typeof value;
  47376. // Convert "+=" or "-=" to relative numbers (#7345)
  47377. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  47378. value = adjustCSS( elem, name, ret );
  47379. // Fixes bug #9237
  47380. type = "number";
  47381. }
  47382. // Make sure that null and NaN values aren't set (#7116)
  47383. if ( value == null || value !== value ) {
  47384. return;
  47385. }
  47386. // If a number was passed in, add the unit (except for certain CSS properties)
  47387. if ( type === "number" ) {
  47388. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  47389. }
  47390. // background-* props affect original clone's values
  47391. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  47392. style[ name ] = "inherit";
  47393. }
  47394. // If a hook was provided, use that value, otherwise just set the specified value
  47395. if ( !hooks || !( "set" in hooks ) ||
  47396. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  47397. if ( isCustomProp ) {
  47398. style.setProperty( name, value );
  47399. } else {
  47400. style[ name ] = value;
  47401. }
  47402. }
  47403. } else {
  47404. // If a hook was provided get the non-computed value from there
  47405. if ( hooks && "get" in hooks &&
  47406. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  47407. return ret;
  47408. }
  47409. // Otherwise just get the value from the style object
  47410. return style[ name ];
  47411. }
  47412. },
  47413. css: function( elem, name, extra, styles ) {
  47414. var val, num, hooks,
  47415. origName = camelCase( name ),
  47416. isCustomProp = rcustomProp.test( name );
  47417. // Make sure that we're working with the right name. We don't
  47418. // want to modify the value if it is a CSS custom property
  47419. // since they are user-defined.
  47420. if ( !isCustomProp ) {
  47421. name = finalPropName( origName );
  47422. }
  47423. // Try prefixed name followed by the unprefixed name
  47424. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  47425. // If a hook was provided get the computed value from there
  47426. if ( hooks && "get" in hooks ) {
  47427. val = hooks.get( elem, true, extra );
  47428. }
  47429. // Otherwise, if a way to get the computed value exists, use that
  47430. if ( val === undefined ) {
  47431. val = curCSS( elem, name, styles );
  47432. }
  47433. // Convert "normal" to computed value
  47434. if ( val === "normal" && name in cssNormalTransform ) {
  47435. val = cssNormalTransform[ name ];
  47436. }
  47437. // Make numeric if forced or a qualifier was provided and val looks numeric
  47438. if ( extra === "" || extra ) {
  47439. num = parseFloat( val );
  47440. return extra === true || isFinite( num ) ? num || 0 : val;
  47441. }
  47442. return val;
  47443. }
  47444. } );
  47445. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  47446. jQuery.cssHooks[ dimension ] = {
  47447. get: function( elem, computed, extra ) {
  47448. if ( computed ) {
  47449. // Certain elements can have dimension info if we invisibly show them
  47450. // but it must have a current display style that would benefit
  47451. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  47452. // Support: Safari 8+
  47453. // Table columns in Safari have non-zero offsetWidth & zero
  47454. // getBoundingClientRect().width unless display is changed.
  47455. // Support: IE <=11 only
  47456. // Running getBoundingClientRect on a disconnected node
  47457. // in IE throws an error.
  47458. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  47459. swap( elem, cssShow, function() {
  47460. return getWidthOrHeight( elem, dimension, extra );
  47461. } ) :
  47462. getWidthOrHeight( elem, dimension, extra );
  47463. }
  47464. },
  47465. set: function( elem, value, extra ) {
  47466. var matches,
  47467. styles = getStyles( elem ),
  47468. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  47469. subtract = extra && boxModelAdjustment(
  47470. elem,
  47471. dimension,
  47472. extra,
  47473. isBorderBox,
  47474. styles
  47475. );
  47476. // Account for unreliable border-box dimensions by comparing offset* to computed and
  47477. // faking a content-box to get border and padding (gh-3699)
  47478. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  47479. subtract -= Math.ceil(
  47480. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  47481. parseFloat( styles[ dimension ] ) -
  47482. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  47483. 0.5
  47484. );
  47485. }
  47486. // Convert to pixels if value adjustment is needed
  47487. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  47488. ( matches[ 3 ] || "px" ) !== "px" ) {
  47489. elem.style[ dimension ] = value;
  47490. value = jQuery.css( elem, dimension );
  47491. }
  47492. return setPositiveNumber( elem, value, subtract );
  47493. }
  47494. };
  47495. } );
  47496. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  47497. function( elem, computed ) {
  47498. if ( computed ) {
  47499. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  47500. elem.getBoundingClientRect().left -
  47501. swap( elem, { marginLeft: 0 }, function() {
  47502. return elem.getBoundingClientRect().left;
  47503. } )
  47504. ) + "px";
  47505. }
  47506. }
  47507. );
  47508. // These hooks are used by animate to expand properties
  47509. jQuery.each( {
  47510. margin: "",
  47511. padding: "",
  47512. border: "Width"
  47513. }, function( prefix, suffix ) {
  47514. jQuery.cssHooks[ prefix + suffix ] = {
  47515. expand: function( value ) {
  47516. var i = 0,
  47517. expanded = {},
  47518. // Assumes a single number if not a string
  47519. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  47520. for ( ; i < 4; i++ ) {
  47521. expanded[ prefix + cssExpand[ i ] + suffix ] =
  47522. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  47523. }
  47524. return expanded;
  47525. }
  47526. };
  47527. if ( prefix !== "margin" ) {
  47528. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  47529. }
  47530. } );
  47531. jQuery.fn.extend( {
  47532. css: function( name, value ) {
  47533. return access( this, function( elem, name, value ) {
  47534. var styles, len,
  47535. map = {},
  47536. i = 0;
  47537. if ( Array.isArray( name ) ) {
  47538. styles = getStyles( elem );
  47539. len = name.length;
  47540. for ( ; i < len; i++ ) {
  47541. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  47542. }
  47543. return map;
  47544. }
  47545. return value !== undefined ?
  47546. jQuery.style( elem, name, value ) :
  47547. jQuery.css( elem, name );
  47548. }, name, value, arguments.length > 1 );
  47549. }
  47550. } );
  47551. function Tween( elem, options, prop, end, easing ) {
  47552. return new Tween.prototype.init( elem, options, prop, end, easing );
  47553. }
  47554. jQuery.Tween = Tween;
  47555. Tween.prototype = {
  47556. constructor: Tween,
  47557. init: function( elem, options, prop, end, easing, unit ) {
  47558. this.elem = elem;
  47559. this.prop = prop;
  47560. this.easing = easing || jQuery.easing._default;
  47561. this.options = options;
  47562. this.start = this.now = this.cur();
  47563. this.end = end;
  47564. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  47565. },
  47566. cur: function() {
  47567. var hooks = Tween.propHooks[ this.prop ];
  47568. return hooks && hooks.get ?
  47569. hooks.get( this ) :
  47570. Tween.propHooks._default.get( this );
  47571. },
  47572. run: function( percent ) {
  47573. var eased,
  47574. hooks = Tween.propHooks[ this.prop ];
  47575. if ( this.options.duration ) {
  47576. this.pos = eased = jQuery.easing[ this.easing ](
  47577. percent, this.options.duration * percent, 0, 1, this.options.duration
  47578. );
  47579. } else {
  47580. this.pos = eased = percent;
  47581. }
  47582. this.now = ( this.end - this.start ) * eased + this.start;
  47583. if ( this.options.step ) {
  47584. this.options.step.call( this.elem, this.now, this );
  47585. }
  47586. if ( hooks && hooks.set ) {
  47587. hooks.set( this );
  47588. } else {
  47589. Tween.propHooks._default.set( this );
  47590. }
  47591. return this;
  47592. }
  47593. };
  47594. Tween.prototype.init.prototype = Tween.prototype;
  47595. Tween.propHooks = {
  47596. _default: {
  47597. get: function( tween ) {
  47598. var result;
  47599. // Use a property on the element directly when it is not a DOM element,
  47600. // or when there is no matching style property that exists.
  47601. if ( tween.elem.nodeType !== 1 ||
  47602. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  47603. return tween.elem[ tween.prop ];
  47604. }
  47605. // Passing an empty string as a 3rd parameter to .css will automatically
  47606. // attempt a parseFloat and fallback to a string if the parse fails.
  47607. // Simple values such as "10px" are parsed to Float;
  47608. // complex values such as "rotate(1rad)" are returned as-is.
  47609. result = jQuery.css( tween.elem, tween.prop, "" );
  47610. // Empty strings, null, undefined and "auto" are converted to 0.
  47611. return !result || result === "auto" ? 0 : result;
  47612. },
  47613. set: function( tween ) {
  47614. // Use step hook for back compat.
  47615. // Use cssHook if its there.
  47616. // Use .style if available and use plain properties where available.
  47617. if ( jQuery.fx.step[ tween.prop ] ) {
  47618. jQuery.fx.step[ tween.prop ]( tween );
  47619. } else if ( tween.elem.nodeType === 1 &&
  47620. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  47621. jQuery.cssHooks[ tween.prop ] ) ) {
  47622. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  47623. } else {
  47624. tween.elem[ tween.prop ] = tween.now;
  47625. }
  47626. }
  47627. }
  47628. };
  47629. // Support: IE <=9 only
  47630. // Panic based approach to setting things on disconnected nodes
  47631. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  47632. set: function( tween ) {
  47633. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  47634. tween.elem[ tween.prop ] = tween.now;
  47635. }
  47636. }
  47637. };
  47638. jQuery.easing = {
  47639. linear: function( p ) {
  47640. return p;
  47641. },
  47642. swing: function( p ) {
  47643. return 0.5 - Math.cos( p * Math.PI ) / 2;
  47644. },
  47645. _default: "swing"
  47646. };
  47647. jQuery.fx = Tween.prototype.init;
  47648. // Back compat <1.8 extension point
  47649. jQuery.fx.step = {};
  47650. var
  47651. fxNow, inProgress,
  47652. rfxtypes = /^(?:toggle|show|hide)$/,
  47653. rrun = /queueHooks$/;
  47654. function schedule() {
  47655. if ( inProgress ) {
  47656. if ( document.hidden === false && window.requestAnimationFrame ) {
  47657. window.requestAnimationFrame( schedule );
  47658. } else {
  47659. window.setTimeout( schedule, jQuery.fx.interval );
  47660. }
  47661. jQuery.fx.tick();
  47662. }
  47663. }
  47664. // Animations created synchronously will run synchronously
  47665. function createFxNow() {
  47666. window.setTimeout( function() {
  47667. fxNow = undefined;
  47668. } );
  47669. return ( fxNow = Date.now() );
  47670. }
  47671. // Generate parameters to create a standard animation
  47672. function genFx( type, includeWidth ) {
  47673. var which,
  47674. i = 0,
  47675. attrs = { height: type };
  47676. // If we include width, step value is 1 to do all cssExpand values,
  47677. // otherwise step value is 2 to skip over Left and Right
  47678. includeWidth = includeWidth ? 1 : 0;
  47679. for ( ; i < 4; i += 2 - includeWidth ) {
  47680. which = cssExpand[ i ];
  47681. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  47682. }
  47683. if ( includeWidth ) {
  47684. attrs.opacity = attrs.width = type;
  47685. }
  47686. return attrs;
  47687. }
  47688. function createTween( value, prop, animation ) {
  47689. var tween,
  47690. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  47691. index = 0,
  47692. length = collection.length;
  47693. for ( ; index < length; index++ ) {
  47694. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  47695. // We're done with this property
  47696. return tween;
  47697. }
  47698. }
  47699. }
  47700. function defaultPrefilter( elem, props, opts ) {
  47701. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  47702. isBox = "width" in props || "height" in props,
  47703. anim = this,
  47704. orig = {},
  47705. style = elem.style,
  47706. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  47707. dataShow = dataPriv.get( elem, "fxshow" );
  47708. // Queue-skipping animations hijack the fx hooks
  47709. if ( !opts.queue ) {
  47710. hooks = jQuery._queueHooks( elem, "fx" );
  47711. if ( hooks.unqueued == null ) {
  47712. hooks.unqueued = 0;
  47713. oldfire = hooks.empty.fire;
  47714. hooks.empty.fire = function() {
  47715. if ( !hooks.unqueued ) {
  47716. oldfire();
  47717. }
  47718. };
  47719. }
  47720. hooks.unqueued++;
  47721. anim.always( function() {
  47722. // Ensure the complete handler is called before this completes
  47723. anim.always( function() {
  47724. hooks.unqueued--;
  47725. if ( !jQuery.queue( elem, "fx" ).length ) {
  47726. hooks.empty.fire();
  47727. }
  47728. } );
  47729. } );
  47730. }
  47731. // Detect show/hide animations
  47732. for ( prop in props ) {
  47733. value = props[ prop ];
  47734. if ( rfxtypes.test( value ) ) {
  47735. delete props[ prop ];
  47736. toggle = toggle || value === "toggle";
  47737. if ( value === ( hidden ? "hide" : "show" ) ) {
  47738. // Pretend to be hidden if this is a "show" and
  47739. // there is still data from a stopped show/hide
  47740. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  47741. hidden = true;
  47742. // Ignore all other no-op show/hide data
  47743. } else {
  47744. continue;
  47745. }
  47746. }
  47747. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  47748. }
  47749. }
  47750. // Bail out if this is a no-op like .hide().hide()
  47751. propTween = !jQuery.isEmptyObject( props );
  47752. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  47753. return;
  47754. }
  47755. // Restrict "overflow" and "display" styles during box animations
  47756. if ( isBox && elem.nodeType === 1 ) {
  47757. // Support: IE <=9 - 11, Edge 12 - 15
  47758. // Record all 3 overflow attributes because IE does not infer the shorthand
  47759. // from identically-valued overflowX and overflowY and Edge just mirrors
  47760. // the overflowX value there.
  47761. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  47762. // Identify a display type, preferring old show/hide data over the CSS cascade
  47763. restoreDisplay = dataShow && dataShow.display;
  47764. if ( restoreDisplay == null ) {
  47765. restoreDisplay = dataPriv.get( elem, "display" );
  47766. }
  47767. display = jQuery.css( elem, "display" );
  47768. if ( display === "none" ) {
  47769. if ( restoreDisplay ) {
  47770. display = restoreDisplay;
  47771. } else {
  47772. // Get nonempty value(s) by temporarily forcing visibility
  47773. showHide( [ elem ], true );
  47774. restoreDisplay = elem.style.display || restoreDisplay;
  47775. display = jQuery.css( elem, "display" );
  47776. showHide( [ elem ] );
  47777. }
  47778. }
  47779. // Animate inline elements as inline-block
  47780. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  47781. if ( jQuery.css( elem, "float" ) === "none" ) {
  47782. // Restore the original display value at the end of pure show/hide animations
  47783. if ( !propTween ) {
  47784. anim.done( function() {
  47785. style.display = restoreDisplay;
  47786. } );
  47787. if ( restoreDisplay == null ) {
  47788. display = style.display;
  47789. restoreDisplay = display === "none" ? "" : display;
  47790. }
  47791. }
  47792. style.display = "inline-block";
  47793. }
  47794. }
  47795. }
  47796. if ( opts.overflow ) {
  47797. style.overflow = "hidden";
  47798. anim.always( function() {
  47799. style.overflow = opts.overflow[ 0 ];
  47800. style.overflowX = opts.overflow[ 1 ];
  47801. style.overflowY = opts.overflow[ 2 ];
  47802. } );
  47803. }
  47804. // Implement show/hide animations
  47805. propTween = false;
  47806. for ( prop in orig ) {
  47807. // General show/hide setup for this element animation
  47808. if ( !propTween ) {
  47809. if ( dataShow ) {
  47810. if ( "hidden" in dataShow ) {
  47811. hidden = dataShow.hidden;
  47812. }
  47813. } else {
  47814. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  47815. }
  47816. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  47817. if ( toggle ) {
  47818. dataShow.hidden = !hidden;
  47819. }
  47820. // Show elements before animating them
  47821. if ( hidden ) {
  47822. showHide( [ elem ], true );
  47823. }
  47824. /* eslint-disable no-loop-func */
  47825. anim.done( function() {
  47826. /* eslint-enable no-loop-func */
  47827. // The final step of a "hide" animation is actually hiding the element
  47828. if ( !hidden ) {
  47829. showHide( [ elem ] );
  47830. }
  47831. dataPriv.remove( elem, "fxshow" );
  47832. for ( prop in orig ) {
  47833. jQuery.style( elem, prop, orig[ prop ] );
  47834. }
  47835. } );
  47836. }
  47837. // Per-property setup
  47838. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  47839. if ( !( prop in dataShow ) ) {
  47840. dataShow[ prop ] = propTween.start;
  47841. if ( hidden ) {
  47842. propTween.end = propTween.start;
  47843. propTween.start = 0;
  47844. }
  47845. }
  47846. }
  47847. }
  47848. function propFilter( props, specialEasing ) {
  47849. var index, name, easing, value, hooks;
  47850. // camelCase, specialEasing and expand cssHook pass
  47851. for ( index in props ) {
  47852. name = camelCase( index );
  47853. easing = specialEasing[ name ];
  47854. value = props[ index ];
  47855. if ( Array.isArray( value ) ) {
  47856. easing = value[ 1 ];
  47857. value = props[ index ] = value[ 0 ];
  47858. }
  47859. if ( index !== name ) {
  47860. props[ name ] = value;
  47861. delete props[ index ];
  47862. }
  47863. hooks = jQuery.cssHooks[ name ];
  47864. if ( hooks && "expand" in hooks ) {
  47865. value = hooks.expand( value );
  47866. delete props[ name ];
  47867. // Not quite $.extend, this won't overwrite existing keys.
  47868. // Reusing 'index' because we have the correct "name"
  47869. for ( index in value ) {
  47870. if ( !( index in props ) ) {
  47871. props[ index ] = value[ index ];
  47872. specialEasing[ index ] = easing;
  47873. }
  47874. }
  47875. } else {
  47876. specialEasing[ name ] = easing;
  47877. }
  47878. }
  47879. }
  47880. function Animation( elem, properties, options ) {
  47881. var result,
  47882. stopped,
  47883. index = 0,
  47884. length = Animation.prefilters.length,
  47885. deferred = jQuery.Deferred().always( function() {
  47886. // Don't match elem in the :animated selector
  47887. delete tick.elem;
  47888. } ),
  47889. tick = function() {
  47890. if ( stopped ) {
  47891. return false;
  47892. }
  47893. var currentTime = fxNow || createFxNow(),
  47894. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  47895. // Support: Android 2.3 only
  47896. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  47897. temp = remaining / animation.duration || 0,
  47898. percent = 1 - temp,
  47899. index = 0,
  47900. length = animation.tweens.length;
  47901. for ( ; index < length; index++ ) {
  47902. animation.tweens[ index ].run( percent );
  47903. }
  47904. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  47905. // If there's more to do, yield
  47906. if ( percent < 1 && length ) {
  47907. return remaining;
  47908. }
  47909. // If this was an empty animation, synthesize a final progress notification
  47910. if ( !length ) {
  47911. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  47912. }
  47913. // Resolve the animation and report its conclusion
  47914. deferred.resolveWith( elem, [ animation ] );
  47915. return false;
  47916. },
  47917. animation = deferred.promise( {
  47918. elem: elem,
  47919. props: jQuery.extend( {}, properties ),
  47920. opts: jQuery.extend( true, {
  47921. specialEasing: {},
  47922. easing: jQuery.easing._default
  47923. }, options ),
  47924. originalProperties: properties,
  47925. originalOptions: options,
  47926. startTime: fxNow || createFxNow(),
  47927. duration: options.duration,
  47928. tweens: [],
  47929. createTween: function( prop, end ) {
  47930. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  47931. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  47932. animation.tweens.push( tween );
  47933. return tween;
  47934. },
  47935. stop: function( gotoEnd ) {
  47936. var index = 0,
  47937. // If we are going to the end, we want to run all the tweens
  47938. // otherwise we skip this part
  47939. length = gotoEnd ? animation.tweens.length : 0;
  47940. if ( stopped ) {
  47941. return this;
  47942. }
  47943. stopped = true;
  47944. for ( ; index < length; index++ ) {
  47945. animation.tweens[ index ].run( 1 );
  47946. }
  47947. // Resolve when we played the last frame; otherwise, reject
  47948. if ( gotoEnd ) {
  47949. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  47950. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  47951. } else {
  47952. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  47953. }
  47954. return this;
  47955. }
  47956. } ),
  47957. props = animation.props;
  47958. propFilter( props, animation.opts.specialEasing );
  47959. for ( ; index < length; index++ ) {
  47960. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  47961. if ( result ) {
  47962. if ( isFunction( result.stop ) ) {
  47963. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  47964. result.stop.bind( result );
  47965. }
  47966. return result;
  47967. }
  47968. }
  47969. jQuery.map( props, createTween, animation );
  47970. if ( isFunction( animation.opts.start ) ) {
  47971. animation.opts.start.call( elem, animation );
  47972. }
  47973. // Attach callbacks from options
  47974. animation
  47975. .progress( animation.opts.progress )
  47976. .done( animation.opts.done, animation.opts.complete )
  47977. .fail( animation.opts.fail )
  47978. .always( animation.opts.always );
  47979. jQuery.fx.timer(
  47980. jQuery.extend( tick, {
  47981. elem: elem,
  47982. anim: animation,
  47983. queue: animation.opts.queue
  47984. } )
  47985. );
  47986. return animation;
  47987. }
  47988. jQuery.Animation = jQuery.extend( Animation, {
  47989. tweeners: {
  47990. "*": [ function( prop, value ) {
  47991. var tween = this.createTween( prop, value );
  47992. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  47993. return tween;
  47994. } ]
  47995. },
  47996. tweener: function( props, callback ) {
  47997. if ( isFunction( props ) ) {
  47998. callback = props;
  47999. props = [ "*" ];
  48000. } else {
  48001. props = props.match( rnothtmlwhite );
  48002. }
  48003. var prop,
  48004. index = 0,
  48005. length = props.length;
  48006. for ( ; index < length; index++ ) {
  48007. prop = props[ index ];
  48008. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  48009. Animation.tweeners[ prop ].unshift( callback );
  48010. }
  48011. },
  48012. prefilters: [ defaultPrefilter ],
  48013. prefilter: function( callback, prepend ) {
  48014. if ( prepend ) {
  48015. Animation.prefilters.unshift( callback );
  48016. } else {
  48017. Animation.prefilters.push( callback );
  48018. }
  48019. }
  48020. } );
  48021. jQuery.speed = function( speed, easing, fn ) {
  48022. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  48023. complete: fn || !fn && easing ||
  48024. isFunction( speed ) && speed,
  48025. duration: speed,
  48026. easing: fn && easing || easing && !isFunction( easing ) && easing
  48027. };
  48028. // Go to the end state if fx are off
  48029. if ( jQuery.fx.off ) {
  48030. opt.duration = 0;
  48031. } else {
  48032. if ( typeof opt.duration !== "number" ) {
  48033. if ( opt.duration in jQuery.fx.speeds ) {
  48034. opt.duration = jQuery.fx.speeds[ opt.duration ];
  48035. } else {
  48036. opt.duration = jQuery.fx.speeds._default;
  48037. }
  48038. }
  48039. }
  48040. // Normalize opt.queue - true/undefined/null -> "fx"
  48041. if ( opt.queue == null || opt.queue === true ) {
  48042. opt.queue = "fx";
  48043. }
  48044. // Queueing
  48045. opt.old = opt.complete;
  48046. opt.complete = function() {
  48047. if ( isFunction( opt.old ) ) {
  48048. opt.old.call( this );
  48049. }
  48050. if ( opt.queue ) {
  48051. jQuery.dequeue( this, opt.queue );
  48052. }
  48053. };
  48054. return opt;
  48055. };
  48056. jQuery.fn.extend( {
  48057. fadeTo: function( speed, to, easing, callback ) {
  48058. // Show any hidden elements after setting opacity to 0
  48059. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  48060. // Animate to the value specified
  48061. .end().animate( { opacity: to }, speed, easing, callback );
  48062. },
  48063. animate: function( prop, speed, easing, callback ) {
  48064. var empty = jQuery.isEmptyObject( prop ),
  48065. optall = jQuery.speed( speed, easing, callback ),
  48066. doAnimation = function() {
  48067. // Operate on a copy of prop so per-property easing won't be lost
  48068. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  48069. // Empty animations, or finishing resolves immediately
  48070. if ( empty || dataPriv.get( this, "finish" ) ) {
  48071. anim.stop( true );
  48072. }
  48073. };
  48074. doAnimation.finish = doAnimation;
  48075. return empty || optall.queue === false ?
  48076. this.each( doAnimation ) :
  48077. this.queue( optall.queue, doAnimation );
  48078. },
  48079. stop: function( type, clearQueue, gotoEnd ) {
  48080. var stopQueue = function( hooks ) {
  48081. var stop = hooks.stop;
  48082. delete hooks.stop;
  48083. stop( gotoEnd );
  48084. };
  48085. if ( typeof type !== "string" ) {
  48086. gotoEnd = clearQueue;
  48087. clearQueue = type;
  48088. type = undefined;
  48089. }
  48090. if ( clearQueue && type !== false ) {
  48091. this.queue( type || "fx", [] );
  48092. }
  48093. return this.each( function() {
  48094. var dequeue = true,
  48095. index = type != null && type + "queueHooks",
  48096. timers = jQuery.timers,
  48097. data = dataPriv.get( this );
  48098. if ( index ) {
  48099. if ( data[ index ] && data[ index ].stop ) {
  48100. stopQueue( data[ index ] );
  48101. }
  48102. } else {
  48103. for ( index in data ) {
  48104. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  48105. stopQueue( data[ index ] );
  48106. }
  48107. }
  48108. }
  48109. for ( index = timers.length; index--; ) {
  48110. if ( timers[ index ].elem === this &&
  48111. ( type == null || timers[ index ].queue === type ) ) {
  48112. timers[ index ].anim.stop( gotoEnd );
  48113. dequeue = false;
  48114. timers.splice( index, 1 );
  48115. }
  48116. }
  48117. // Start the next in the queue if the last step wasn't forced.
  48118. // Timers currently will call their complete callbacks, which
  48119. // will dequeue but only if they were gotoEnd.
  48120. if ( dequeue || !gotoEnd ) {
  48121. jQuery.dequeue( this, type );
  48122. }
  48123. } );
  48124. },
  48125. finish: function( type ) {
  48126. if ( type !== false ) {
  48127. type = type || "fx";
  48128. }
  48129. return this.each( function() {
  48130. var index,
  48131. data = dataPriv.get( this ),
  48132. queue = data[ type + "queue" ],
  48133. hooks = data[ type + "queueHooks" ],
  48134. timers = jQuery.timers,
  48135. length = queue ? queue.length : 0;
  48136. // Enable finishing flag on private data
  48137. data.finish = true;
  48138. // Empty the queue first
  48139. jQuery.queue( this, type, [] );
  48140. if ( hooks && hooks.stop ) {
  48141. hooks.stop.call( this, true );
  48142. }
  48143. // Look for any active animations, and finish them
  48144. for ( index = timers.length; index--; ) {
  48145. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  48146. timers[ index ].anim.stop( true );
  48147. timers.splice( index, 1 );
  48148. }
  48149. }
  48150. // Look for any animations in the old queue and finish them
  48151. for ( index = 0; index < length; index++ ) {
  48152. if ( queue[ index ] && queue[ index ].finish ) {
  48153. queue[ index ].finish.call( this );
  48154. }
  48155. }
  48156. // Turn off finishing flag
  48157. delete data.finish;
  48158. } );
  48159. }
  48160. } );
  48161. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  48162. var cssFn = jQuery.fn[ name ];
  48163. jQuery.fn[ name ] = function( speed, easing, callback ) {
  48164. return speed == null || typeof speed === "boolean" ?
  48165. cssFn.apply( this, arguments ) :
  48166. this.animate( genFx( name, true ), speed, easing, callback );
  48167. };
  48168. } );
  48169. // Generate shortcuts for custom animations
  48170. jQuery.each( {
  48171. slideDown: genFx( "show" ),
  48172. slideUp: genFx( "hide" ),
  48173. slideToggle: genFx( "toggle" ),
  48174. fadeIn: { opacity: "show" },
  48175. fadeOut: { opacity: "hide" },
  48176. fadeToggle: { opacity: "toggle" }
  48177. }, function( name, props ) {
  48178. jQuery.fn[ name ] = function( speed, easing, callback ) {
  48179. return this.animate( props, speed, easing, callback );
  48180. };
  48181. } );
  48182. jQuery.timers = [];
  48183. jQuery.fx.tick = function() {
  48184. var timer,
  48185. i = 0,
  48186. timers = jQuery.timers;
  48187. fxNow = Date.now();
  48188. for ( ; i < timers.length; i++ ) {
  48189. timer = timers[ i ];
  48190. // Run the timer and safely remove it when done (allowing for external removal)
  48191. if ( !timer() && timers[ i ] === timer ) {
  48192. timers.splice( i--, 1 );
  48193. }
  48194. }
  48195. if ( !timers.length ) {
  48196. jQuery.fx.stop();
  48197. }
  48198. fxNow = undefined;
  48199. };
  48200. jQuery.fx.timer = function( timer ) {
  48201. jQuery.timers.push( timer );
  48202. jQuery.fx.start();
  48203. };
  48204. jQuery.fx.interval = 13;
  48205. jQuery.fx.start = function() {
  48206. if ( inProgress ) {
  48207. return;
  48208. }
  48209. inProgress = true;
  48210. schedule();
  48211. };
  48212. jQuery.fx.stop = function() {
  48213. inProgress = null;
  48214. };
  48215. jQuery.fx.speeds = {
  48216. slow: 600,
  48217. fast: 200,
  48218. // Default speed
  48219. _default: 400
  48220. };
  48221. // Based off of the plugin by Clint Helfers, with permission.
  48222. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  48223. jQuery.fn.delay = function( time, type ) {
  48224. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  48225. type = type || "fx";
  48226. return this.queue( type, function( next, hooks ) {
  48227. var timeout = window.setTimeout( next, time );
  48228. hooks.stop = function() {
  48229. window.clearTimeout( timeout );
  48230. };
  48231. } );
  48232. };
  48233. ( function() {
  48234. var input = document.createElement( "input" ),
  48235. select = document.createElement( "select" ),
  48236. opt = select.appendChild( document.createElement( "option" ) );
  48237. input.type = "checkbox";
  48238. // Support: Android <=4.3 only
  48239. // Default value for a checkbox should be "on"
  48240. support.checkOn = input.value !== "";
  48241. // Support: IE <=11 only
  48242. // Must access selectedIndex to make default options select
  48243. support.optSelected = opt.selected;
  48244. // Support: IE <=11 only
  48245. // An input loses its value after becoming a radio
  48246. input = document.createElement( "input" );
  48247. input.value = "t";
  48248. input.type = "radio";
  48249. support.radioValue = input.value === "t";
  48250. } )();
  48251. var boolHook,
  48252. attrHandle = jQuery.expr.attrHandle;
  48253. jQuery.fn.extend( {
  48254. attr: function( name, value ) {
  48255. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  48256. },
  48257. removeAttr: function( name ) {
  48258. return this.each( function() {
  48259. jQuery.removeAttr( this, name );
  48260. } );
  48261. }
  48262. } );
  48263. jQuery.extend( {
  48264. attr: function( elem, name, value ) {
  48265. var ret, hooks,
  48266. nType = elem.nodeType;
  48267. // Don't get/set attributes on text, comment and attribute nodes
  48268. if ( nType === 3 || nType === 8 || nType === 2 ) {
  48269. return;
  48270. }
  48271. // Fallback to prop when attributes are not supported
  48272. if ( typeof elem.getAttribute === "undefined" ) {
  48273. return jQuery.prop( elem, name, value );
  48274. }
  48275. // Attribute hooks are determined by the lowercase version
  48276. // Grab necessary hook if one is defined
  48277. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  48278. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  48279. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  48280. }
  48281. if ( value !== undefined ) {
  48282. if ( value === null ) {
  48283. jQuery.removeAttr( elem, name );
  48284. return;
  48285. }
  48286. if ( hooks && "set" in hooks &&
  48287. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  48288. return ret;
  48289. }
  48290. elem.setAttribute( name, value + "" );
  48291. return value;
  48292. }
  48293. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  48294. return ret;
  48295. }
  48296. ret = jQuery.find.attr( elem, name );
  48297. // Non-existent attributes return null, we normalize to undefined
  48298. return ret == null ? undefined : ret;
  48299. },
  48300. attrHooks: {
  48301. type: {
  48302. set: function( elem, value ) {
  48303. if ( !support.radioValue && value === "radio" &&
  48304. nodeName( elem, "input" ) ) {
  48305. var val = elem.value;
  48306. elem.setAttribute( "type", value );
  48307. if ( val ) {
  48308. elem.value = val;
  48309. }
  48310. return value;
  48311. }
  48312. }
  48313. }
  48314. },
  48315. removeAttr: function( elem, value ) {
  48316. var name,
  48317. i = 0,
  48318. // Attribute names can contain non-HTML whitespace characters
  48319. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  48320. attrNames = value && value.match( rnothtmlwhite );
  48321. if ( attrNames && elem.nodeType === 1 ) {
  48322. while ( ( name = attrNames[ i++ ] ) ) {
  48323. elem.removeAttribute( name );
  48324. }
  48325. }
  48326. }
  48327. } );
  48328. // Hooks for boolean attributes
  48329. boolHook = {
  48330. set: function( elem, value, name ) {
  48331. if ( value === false ) {
  48332. // Remove boolean attributes when set to false
  48333. jQuery.removeAttr( elem, name );
  48334. } else {
  48335. elem.setAttribute( name, name );
  48336. }
  48337. return name;
  48338. }
  48339. };
  48340. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  48341. var getter = attrHandle[ name ] || jQuery.find.attr;
  48342. attrHandle[ name ] = function( elem, name, isXML ) {
  48343. var ret, handle,
  48344. lowercaseName = name.toLowerCase();
  48345. if ( !isXML ) {
  48346. // Avoid an infinite loop by temporarily removing this function from the getter
  48347. handle = attrHandle[ lowercaseName ];
  48348. attrHandle[ lowercaseName ] = ret;
  48349. ret = getter( elem, name, isXML ) != null ?
  48350. lowercaseName :
  48351. null;
  48352. attrHandle[ lowercaseName ] = handle;
  48353. }
  48354. return ret;
  48355. };
  48356. } );
  48357. var rfocusable = /^(?:input|select|textarea|button)$/i,
  48358. rclickable = /^(?:a|area)$/i;
  48359. jQuery.fn.extend( {
  48360. prop: function( name, value ) {
  48361. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  48362. },
  48363. removeProp: function( name ) {
  48364. return this.each( function() {
  48365. delete this[ jQuery.propFix[ name ] || name ];
  48366. } );
  48367. }
  48368. } );
  48369. jQuery.extend( {
  48370. prop: function( elem, name, value ) {
  48371. var ret, hooks,
  48372. nType = elem.nodeType;
  48373. // Don't get/set properties on text, comment and attribute nodes
  48374. if ( nType === 3 || nType === 8 || nType === 2 ) {
  48375. return;
  48376. }
  48377. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  48378. // Fix name and attach hooks
  48379. name = jQuery.propFix[ name ] || name;
  48380. hooks = jQuery.propHooks[ name ];
  48381. }
  48382. if ( value !== undefined ) {
  48383. if ( hooks && "set" in hooks &&
  48384. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  48385. return ret;
  48386. }
  48387. return ( elem[ name ] = value );
  48388. }
  48389. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  48390. return ret;
  48391. }
  48392. return elem[ name ];
  48393. },
  48394. propHooks: {
  48395. tabIndex: {
  48396. get: function( elem ) {
  48397. // Support: IE <=9 - 11 only
  48398. // elem.tabIndex doesn't always return the
  48399. // correct value when it hasn't been explicitly set
  48400. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  48401. // Use proper attribute retrieval(#12072)
  48402. var tabindex = jQuery.find.attr( elem, "tabindex" );
  48403. if ( tabindex ) {
  48404. return parseInt( tabindex, 10 );
  48405. }
  48406. if (
  48407. rfocusable.test( elem.nodeName ) ||
  48408. rclickable.test( elem.nodeName ) &&
  48409. elem.href
  48410. ) {
  48411. return 0;
  48412. }
  48413. return -1;
  48414. }
  48415. }
  48416. },
  48417. propFix: {
  48418. "for": "htmlFor",
  48419. "class": "className"
  48420. }
  48421. } );
  48422. // Support: IE <=11 only
  48423. // Accessing the selectedIndex property
  48424. // forces the browser to respect setting selected
  48425. // on the option
  48426. // The getter ensures a default option is selected
  48427. // when in an optgroup
  48428. // eslint rule "no-unused-expressions" is disabled for this code
  48429. // since it considers such accessions noop
  48430. if ( !support.optSelected ) {
  48431. jQuery.propHooks.selected = {
  48432. get: function( elem ) {
  48433. /* eslint no-unused-expressions: "off" */
  48434. var parent = elem.parentNode;
  48435. if ( parent && parent.parentNode ) {
  48436. parent.parentNode.selectedIndex;
  48437. }
  48438. return null;
  48439. },
  48440. set: function( elem ) {
  48441. /* eslint no-unused-expressions: "off" */
  48442. var parent = elem.parentNode;
  48443. if ( parent ) {
  48444. parent.selectedIndex;
  48445. if ( parent.parentNode ) {
  48446. parent.parentNode.selectedIndex;
  48447. }
  48448. }
  48449. }
  48450. };
  48451. }
  48452. jQuery.each( [
  48453. "tabIndex",
  48454. "readOnly",
  48455. "maxLength",
  48456. "cellSpacing",
  48457. "cellPadding",
  48458. "rowSpan",
  48459. "colSpan",
  48460. "useMap",
  48461. "frameBorder",
  48462. "contentEditable"
  48463. ], function() {
  48464. jQuery.propFix[ this.toLowerCase() ] = this;
  48465. } );
  48466. // Strip and collapse whitespace according to HTML spec
  48467. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  48468. function stripAndCollapse( value ) {
  48469. var tokens = value.match( rnothtmlwhite ) || [];
  48470. return tokens.join( " " );
  48471. }
  48472. function getClass( elem ) {
  48473. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  48474. }
  48475. function classesToArray( value ) {
  48476. if ( Array.isArray( value ) ) {
  48477. return value;
  48478. }
  48479. if ( typeof value === "string" ) {
  48480. return value.match( rnothtmlwhite ) || [];
  48481. }
  48482. return [];
  48483. }
  48484. jQuery.fn.extend( {
  48485. addClass: function( value ) {
  48486. var classes, elem, cur, curValue, clazz, j, finalValue,
  48487. i = 0;
  48488. if ( isFunction( value ) ) {
  48489. return this.each( function( j ) {
  48490. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  48491. } );
  48492. }
  48493. classes = classesToArray( value );
  48494. if ( classes.length ) {
  48495. while ( ( elem = this[ i++ ] ) ) {
  48496. curValue = getClass( elem );
  48497. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  48498. if ( cur ) {
  48499. j = 0;
  48500. while ( ( clazz = classes[ j++ ] ) ) {
  48501. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  48502. cur += clazz + " ";
  48503. }
  48504. }
  48505. // Only assign if different to avoid unneeded rendering.
  48506. finalValue = stripAndCollapse( cur );
  48507. if ( curValue !== finalValue ) {
  48508. elem.setAttribute( "class", finalValue );
  48509. }
  48510. }
  48511. }
  48512. }
  48513. return this;
  48514. },
  48515. removeClass: function( value ) {
  48516. var classes, elem, cur, curValue, clazz, j, finalValue,
  48517. i = 0;
  48518. if ( isFunction( value ) ) {
  48519. return this.each( function( j ) {
  48520. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  48521. } );
  48522. }
  48523. if ( !arguments.length ) {
  48524. return this.attr( "class", "" );
  48525. }
  48526. classes = classesToArray( value );
  48527. if ( classes.length ) {
  48528. while ( ( elem = this[ i++ ] ) ) {
  48529. curValue = getClass( elem );
  48530. // This expression is here for better compressibility (see addClass)
  48531. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  48532. if ( cur ) {
  48533. j = 0;
  48534. while ( ( clazz = classes[ j++ ] ) ) {
  48535. // Remove *all* instances
  48536. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  48537. cur = cur.replace( " " + clazz + " ", " " );
  48538. }
  48539. }
  48540. // Only assign if different to avoid unneeded rendering.
  48541. finalValue = stripAndCollapse( cur );
  48542. if ( curValue !== finalValue ) {
  48543. elem.setAttribute( "class", finalValue );
  48544. }
  48545. }
  48546. }
  48547. }
  48548. return this;
  48549. },
  48550. toggleClass: function( value, stateVal ) {
  48551. var type = typeof value,
  48552. isValidValue = type === "string" || Array.isArray( value );
  48553. if ( typeof stateVal === "boolean" && isValidValue ) {
  48554. return stateVal ? this.addClass( value ) : this.removeClass( value );
  48555. }
  48556. if ( isFunction( value ) ) {
  48557. return this.each( function( i ) {
  48558. jQuery( this ).toggleClass(
  48559. value.call( this, i, getClass( this ), stateVal ),
  48560. stateVal
  48561. );
  48562. } );
  48563. }
  48564. return this.each( function() {
  48565. var className, i, self, classNames;
  48566. if ( isValidValue ) {
  48567. // Toggle individual class names
  48568. i = 0;
  48569. self = jQuery( this );
  48570. classNames = classesToArray( value );
  48571. while ( ( className = classNames[ i++ ] ) ) {
  48572. // Check each className given, space separated list
  48573. if ( self.hasClass( className ) ) {
  48574. self.removeClass( className );
  48575. } else {
  48576. self.addClass( className );
  48577. }
  48578. }
  48579. // Toggle whole class name
  48580. } else if ( value === undefined || type === "boolean" ) {
  48581. className = getClass( this );
  48582. if ( className ) {
  48583. // Store className if set
  48584. dataPriv.set( this, "__className__", className );
  48585. }
  48586. // If the element has a class name or if we're passed `false`,
  48587. // then remove the whole classname (if there was one, the above saved it).
  48588. // Otherwise bring back whatever was previously saved (if anything),
  48589. // falling back to the empty string if nothing was stored.
  48590. if ( this.setAttribute ) {
  48591. this.setAttribute( "class",
  48592. className || value === false ?
  48593. "" :
  48594. dataPriv.get( this, "__className__" ) || ""
  48595. );
  48596. }
  48597. }
  48598. } );
  48599. },
  48600. hasClass: function( selector ) {
  48601. var className, elem,
  48602. i = 0;
  48603. className = " " + selector + " ";
  48604. while ( ( elem = this[ i++ ] ) ) {
  48605. if ( elem.nodeType === 1 &&
  48606. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  48607. return true;
  48608. }
  48609. }
  48610. return false;
  48611. }
  48612. } );
  48613. var rreturn = /\r/g;
  48614. jQuery.fn.extend( {
  48615. val: function( value ) {
  48616. var hooks, ret, valueIsFunction,
  48617. elem = this[ 0 ];
  48618. if ( !arguments.length ) {
  48619. if ( elem ) {
  48620. hooks = jQuery.valHooks[ elem.type ] ||
  48621. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  48622. if ( hooks &&
  48623. "get" in hooks &&
  48624. ( ret = hooks.get( elem, "value" ) ) !== undefined
  48625. ) {
  48626. return ret;
  48627. }
  48628. ret = elem.value;
  48629. // Handle most common string cases
  48630. if ( typeof ret === "string" ) {
  48631. return ret.replace( rreturn, "" );
  48632. }
  48633. // Handle cases where value is null/undef or number
  48634. return ret == null ? "" : ret;
  48635. }
  48636. return;
  48637. }
  48638. valueIsFunction = isFunction( value );
  48639. return this.each( function( i ) {
  48640. var val;
  48641. if ( this.nodeType !== 1 ) {
  48642. return;
  48643. }
  48644. if ( valueIsFunction ) {
  48645. val = value.call( this, i, jQuery( this ).val() );
  48646. } else {
  48647. val = value;
  48648. }
  48649. // Treat null/undefined as ""; convert numbers to string
  48650. if ( val == null ) {
  48651. val = "";
  48652. } else if ( typeof val === "number" ) {
  48653. val += "";
  48654. } else if ( Array.isArray( val ) ) {
  48655. val = jQuery.map( val, function( value ) {
  48656. return value == null ? "" : value + "";
  48657. } );
  48658. }
  48659. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  48660. // If set returns undefined, fall back to normal setting
  48661. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  48662. this.value = val;
  48663. }
  48664. } );
  48665. }
  48666. } );
  48667. jQuery.extend( {
  48668. valHooks: {
  48669. option: {
  48670. get: function( elem ) {
  48671. var val = jQuery.find.attr( elem, "value" );
  48672. return val != null ?
  48673. val :
  48674. // Support: IE <=10 - 11 only
  48675. // option.text throws exceptions (#14686, #14858)
  48676. // Strip and collapse whitespace
  48677. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  48678. stripAndCollapse( jQuery.text( elem ) );
  48679. }
  48680. },
  48681. select: {
  48682. get: function( elem ) {
  48683. var value, option, i,
  48684. options = elem.options,
  48685. index = elem.selectedIndex,
  48686. one = elem.type === "select-one",
  48687. values = one ? null : [],
  48688. max = one ? index + 1 : options.length;
  48689. if ( index < 0 ) {
  48690. i = max;
  48691. } else {
  48692. i = one ? index : 0;
  48693. }
  48694. // Loop through all the selected options
  48695. for ( ; i < max; i++ ) {
  48696. option = options[ i ];
  48697. // Support: IE <=9 only
  48698. // IE8-9 doesn't update selected after form reset (#2551)
  48699. if ( ( option.selected || i === index ) &&
  48700. // Don't return options that are disabled or in a disabled optgroup
  48701. !option.disabled &&
  48702. ( !option.parentNode.disabled ||
  48703. !nodeName( option.parentNode, "optgroup" ) ) ) {
  48704. // Get the specific value for the option
  48705. value = jQuery( option ).val();
  48706. // We don't need an array for one selects
  48707. if ( one ) {
  48708. return value;
  48709. }
  48710. // Multi-Selects return an array
  48711. values.push( value );
  48712. }
  48713. }
  48714. return values;
  48715. },
  48716. set: function( elem, value ) {
  48717. var optionSet, option,
  48718. options = elem.options,
  48719. values = jQuery.makeArray( value ),
  48720. i = options.length;
  48721. while ( i-- ) {
  48722. option = options[ i ];
  48723. /* eslint-disable no-cond-assign */
  48724. if ( option.selected =
  48725. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  48726. ) {
  48727. optionSet = true;
  48728. }
  48729. /* eslint-enable no-cond-assign */
  48730. }
  48731. // Force browsers to behave consistently when non-matching value is set
  48732. if ( !optionSet ) {
  48733. elem.selectedIndex = -1;
  48734. }
  48735. return values;
  48736. }
  48737. }
  48738. }
  48739. } );
  48740. // Radios and checkboxes getter/setter
  48741. jQuery.each( [ "radio", "checkbox" ], function() {
  48742. jQuery.valHooks[ this ] = {
  48743. set: function( elem, value ) {
  48744. if ( Array.isArray( value ) ) {
  48745. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  48746. }
  48747. }
  48748. };
  48749. if ( !support.checkOn ) {
  48750. jQuery.valHooks[ this ].get = function( elem ) {
  48751. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  48752. };
  48753. }
  48754. } );
  48755. // Return jQuery for attributes-only inclusion
  48756. support.focusin = "onfocusin" in window;
  48757. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  48758. stopPropagationCallback = function( e ) {
  48759. e.stopPropagation();
  48760. };
  48761. jQuery.extend( jQuery.event, {
  48762. trigger: function( event, data, elem, onlyHandlers ) {
  48763. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  48764. eventPath = [ elem || document ],
  48765. type = hasOwn.call( event, "type" ) ? event.type : event,
  48766. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  48767. cur = lastElement = tmp = elem = elem || document;
  48768. // Don't do events on text and comment nodes
  48769. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  48770. return;
  48771. }
  48772. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  48773. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  48774. return;
  48775. }
  48776. if ( type.indexOf( "." ) > -1 ) {
  48777. // Namespaced trigger; create a regexp to match event type in handle()
  48778. namespaces = type.split( "." );
  48779. type = namespaces.shift();
  48780. namespaces.sort();
  48781. }
  48782. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  48783. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  48784. event = event[ jQuery.expando ] ?
  48785. event :
  48786. new jQuery.Event( type, typeof event === "object" && event );
  48787. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  48788. event.isTrigger = onlyHandlers ? 2 : 3;
  48789. event.namespace = namespaces.join( "." );
  48790. event.rnamespace = event.namespace ?
  48791. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  48792. null;
  48793. // Clean up the event in case it is being reused
  48794. event.result = undefined;
  48795. if ( !event.target ) {
  48796. event.target = elem;
  48797. }
  48798. // Clone any incoming data and prepend the event, creating the handler arg list
  48799. data = data == null ?
  48800. [ event ] :
  48801. jQuery.makeArray( data, [ event ] );
  48802. // Allow special events to draw outside the lines
  48803. special = jQuery.event.special[ type ] || {};
  48804. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  48805. return;
  48806. }
  48807. // Determine event propagation path in advance, per W3C events spec (#9951)
  48808. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  48809. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  48810. bubbleType = special.delegateType || type;
  48811. if ( !rfocusMorph.test( bubbleType + type ) ) {
  48812. cur = cur.parentNode;
  48813. }
  48814. for ( ; cur; cur = cur.parentNode ) {
  48815. eventPath.push( cur );
  48816. tmp = cur;
  48817. }
  48818. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  48819. if ( tmp === ( elem.ownerDocument || document ) ) {
  48820. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  48821. }
  48822. }
  48823. // Fire handlers on the event path
  48824. i = 0;
  48825. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  48826. lastElement = cur;
  48827. event.type = i > 1 ?
  48828. bubbleType :
  48829. special.bindType || type;
  48830. // jQuery handler
  48831. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  48832. dataPriv.get( cur, "handle" );
  48833. if ( handle ) {
  48834. handle.apply( cur, data );
  48835. }
  48836. // Native handler
  48837. handle = ontype && cur[ ontype ];
  48838. if ( handle && handle.apply && acceptData( cur ) ) {
  48839. event.result = handle.apply( cur, data );
  48840. if ( event.result === false ) {
  48841. event.preventDefault();
  48842. }
  48843. }
  48844. }
  48845. event.type = type;
  48846. // If nobody prevented the default action, do it now
  48847. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  48848. if ( ( !special._default ||
  48849. special._default.apply( eventPath.pop(), data ) === false ) &&
  48850. acceptData( elem ) ) {
  48851. // Call a native DOM method on the target with the same name as the event.
  48852. // Don't do default actions on window, that's where global variables be (#6170)
  48853. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  48854. // Don't re-trigger an onFOO event when we call its FOO() method
  48855. tmp = elem[ ontype ];
  48856. if ( tmp ) {
  48857. elem[ ontype ] = null;
  48858. }
  48859. // Prevent re-triggering of the same event, since we already bubbled it above
  48860. jQuery.event.triggered = type;
  48861. if ( event.isPropagationStopped() ) {
  48862. lastElement.addEventListener( type, stopPropagationCallback );
  48863. }
  48864. elem[ type ]();
  48865. if ( event.isPropagationStopped() ) {
  48866. lastElement.removeEventListener( type, stopPropagationCallback );
  48867. }
  48868. jQuery.event.triggered = undefined;
  48869. if ( tmp ) {
  48870. elem[ ontype ] = tmp;
  48871. }
  48872. }
  48873. }
  48874. }
  48875. return event.result;
  48876. },
  48877. // Piggyback on a donor event to simulate a different one
  48878. // Used only for `focus(in | out)` events
  48879. simulate: function( type, elem, event ) {
  48880. var e = jQuery.extend(
  48881. new jQuery.Event(),
  48882. event,
  48883. {
  48884. type: type,
  48885. isSimulated: true
  48886. }
  48887. );
  48888. jQuery.event.trigger( e, null, elem );
  48889. }
  48890. } );
  48891. jQuery.fn.extend( {
  48892. trigger: function( type, data ) {
  48893. return this.each( function() {
  48894. jQuery.event.trigger( type, data, this );
  48895. } );
  48896. },
  48897. triggerHandler: function( type, data ) {
  48898. var elem = this[ 0 ];
  48899. if ( elem ) {
  48900. return jQuery.event.trigger( type, data, elem, true );
  48901. }
  48902. }
  48903. } );
  48904. // Support: Firefox <=44
  48905. // Firefox doesn't have focus(in | out) events
  48906. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  48907. //
  48908. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  48909. // focus(in | out) events fire after focus & blur events,
  48910. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  48911. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  48912. if ( !support.focusin ) {
  48913. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  48914. // Attach a single capturing handler on the document while someone wants focusin/focusout
  48915. var handler = function( event ) {
  48916. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  48917. };
  48918. jQuery.event.special[ fix ] = {
  48919. setup: function() {
  48920. var doc = this.ownerDocument || this,
  48921. attaches = dataPriv.access( doc, fix );
  48922. if ( !attaches ) {
  48923. doc.addEventListener( orig, handler, true );
  48924. }
  48925. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  48926. },
  48927. teardown: function() {
  48928. var doc = this.ownerDocument || this,
  48929. attaches = dataPriv.access( doc, fix ) - 1;
  48930. if ( !attaches ) {
  48931. doc.removeEventListener( orig, handler, true );
  48932. dataPriv.remove( doc, fix );
  48933. } else {
  48934. dataPriv.access( doc, fix, attaches );
  48935. }
  48936. }
  48937. };
  48938. } );
  48939. }
  48940. var location = window.location;
  48941. var nonce = Date.now();
  48942. var rquery = ( /\?/ );
  48943. // Cross-browser xml parsing
  48944. jQuery.parseXML = function( data ) {
  48945. var xml;
  48946. if ( !data || typeof data !== "string" ) {
  48947. return null;
  48948. }
  48949. // Support: IE 9 - 11 only
  48950. // IE throws on parseFromString with invalid input.
  48951. try {
  48952. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  48953. } catch ( e ) {
  48954. xml = undefined;
  48955. }
  48956. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  48957. jQuery.error( "Invalid XML: " + data );
  48958. }
  48959. return xml;
  48960. };
  48961. var
  48962. rbracket = /\[\]$/,
  48963. rCRLF = /\r?\n/g,
  48964. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  48965. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  48966. function buildParams( prefix, obj, traditional, add ) {
  48967. var name;
  48968. if ( Array.isArray( obj ) ) {
  48969. // Serialize array item.
  48970. jQuery.each( obj, function( i, v ) {
  48971. if ( traditional || rbracket.test( prefix ) ) {
  48972. // Treat each array item as a scalar.
  48973. add( prefix, v );
  48974. } else {
  48975. // Item is non-scalar (array or object), encode its numeric index.
  48976. buildParams(
  48977. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  48978. v,
  48979. traditional,
  48980. add
  48981. );
  48982. }
  48983. } );
  48984. } else if ( !traditional && toType( obj ) === "object" ) {
  48985. // Serialize object item.
  48986. for ( name in obj ) {
  48987. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  48988. }
  48989. } else {
  48990. // Serialize scalar item.
  48991. add( prefix, obj );
  48992. }
  48993. }
  48994. // Serialize an array of form elements or a set of
  48995. // key/values into a query string
  48996. jQuery.param = function( a, traditional ) {
  48997. var prefix,
  48998. s = [],
  48999. add = function( key, valueOrFunction ) {
  49000. // If value is a function, invoke it and use its return value
  49001. var value = isFunction( valueOrFunction ) ?
  49002. valueOrFunction() :
  49003. valueOrFunction;
  49004. s[ s.length ] = encodeURIComponent( key ) + "=" +
  49005. encodeURIComponent( value == null ? "" : value );
  49006. };
  49007. // If an array was passed in, assume that it is an array of form elements.
  49008. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  49009. // Serialize the form elements
  49010. jQuery.each( a, function() {
  49011. add( this.name, this.value );
  49012. } );
  49013. } else {
  49014. // If traditional, encode the "old" way (the way 1.3.2 or older
  49015. // did it), otherwise encode params recursively.
  49016. for ( prefix in a ) {
  49017. buildParams( prefix, a[ prefix ], traditional, add );
  49018. }
  49019. }
  49020. // Return the resulting serialization
  49021. return s.join( "&" );
  49022. };
  49023. jQuery.fn.extend( {
  49024. serialize: function() {
  49025. return jQuery.param( this.serializeArray() );
  49026. },
  49027. serializeArray: function() {
  49028. return this.map( function() {
  49029. // Can add propHook for "elements" to filter or add form elements
  49030. var elements = jQuery.prop( this, "elements" );
  49031. return elements ? jQuery.makeArray( elements ) : this;
  49032. } )
  49033. .filter( function() {
  49034. var type = this.type;
  49035. // Use .is( ":disabled" ) so that fieldset[disabled] works
  49036. return this.name && !jQuery( this ).is( ":disabled" ) &&
  49037. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  49038. ( this.checked || !rcheckableType.test( type ) );
  49039. } )
  49040. .map( function( i, elem ) {
  49041. var val = jQuery( this ).val();
  49042. if ( val == null ) {
  49043. return null;
  49044. }
  49045. if ( Array.isArray( val ) ) {
  49046. return jQuery.map( val, function( val ) {
  49047. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  49048. } );
  49049. }
  49050. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  49051. } ).get();
  49052. }
  49053. } );
  49054. var
  49055. r20 = /%20/g,
  49056. rhash = /#.*$/,
  49057. rantiCache = /([?&])_=[^&]*/,
  49058. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  49059. // #7653, #8125, #8152: local protocol detection
  49060. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  49061. rnoContent = /^(?:GET|HEAD)$/,
  49062. rprotocol = /^\/\//,
  49063. /* Prefilters
  49064. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  49065. * 2) These are called:
  49066. * - BEFORE asking for a transport
  49067. * - AFTER param serialization (s.data is a string if s.processData is true)
  49068. * 3) key is the dataType
  49069. * 4) the catchall symbol "*" can be used
  49070. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  49071. */
  49072. prefilters = {},
  49073. /* Transports bindings
  49074. * 1) key is the dataType
  49075. * 2) the catchall symbol "*" can be used
  49076. * 3) selection will start with transport dataType and THEN go to "*" if needed
  49077. */
  49078. transports = {},
  49079. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  49080. allTypes = "*/".concat( "*" ),
  49081. // Anchor tag for parsing the document origin
  49082. originAnchor = document.createElement( "a" );
  49083. originAnchor.href = location.href;
  49084. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  49085. function addToPrefiltersOrTransports( structure ) {
  49086. // dataTypeExpression is optional and defaults to "*"
  49087. return function( dataTypeExpression, func ) {
  49088. if ( typeof dataTypeExpression !== "string" ) {
  49089. func = dataTypeExpression;
  49090. dataTypeExpression = "*";
  49091. }
  49092. var dataType,
  49093. i = 0,
  49094. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  49095. if ( isFunction( func ) ) {
  49096. // For each dataType in the dataTypeExpression
  49097. while ( ( dataType = dataTypes[ i++ ] ) ) {
  49098. // Prepend if requested
  49099. if ( dataType[ 0 ] === "+" ) {
  49100. dataType = dataType.slice( 1 ) || "*";
  49101. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  49102. // Otherwise append
  49103. } else {
  49104. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  49105. }
  49106. }
  49107. }
  49108. };
  49109. }
  49110. // Base inspection function for prefilters and transports
  49111. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  49112. var inspected = {},
  49113. seekingTransport = ( structure === transports );
  49114. function inspect( dataType ) {
  49115. var selected;
  49116. inspected[ dataType ] = true;
  49117. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  49118. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  49119. if ( typeof dataTypeOrTransport === "string" &&
  49120. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  49121. options.dataTypes.unshift( dataTypeOrTransport );
  49122. inspect( dataTypeOrTransport );
  49123. return false;
  49124. } else if ( seekingTransport ) {
  49125. return !( selected = dataTypeOrTransport );
  49126. }
  49127. } );
  49128. return selected;
  49129. }
  49130. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  49131. }
  49132. // A special extend for ajax options
  49133. // that takes "flat" options (not to be deep extended)
  49134. // Fixes #9887
  49135. function ajaxExtend( target, src ) {
  49136. var key, deep,
  49137. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  49138. for ( key in src ) {
  49139. if ( src[ key ] !== undefined ) {
  49140. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  49141. }
  49142. }
  49143. if ( deep ) {
  49144. jQuery.extend( true, target, deep );
  49145. }
  49146. return target;
  49147. }
  49148. /* Handles responses to an ajax request:
  49149. * - finds the right dataType (mediates between content-type and expected dataType)
  49150. * - returns the corresponding response
  49151. */
  49152. function ajaxHandleResponses( s, jqXHR, responses ) {
  49153. var ct, type, finalDataType, firstDataType,
  49154. contents = s.contents,
  49155. dataTypes = s.dataTypes;
  49156. // Remove auto dataType and get content-type in the process
  49157. while ( dataTypes[ 0 ] === "*" ) {
  49158. dataTypes.shift();
  49159. if ( ct === undefined ) {
  49160. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  49161. }
  49162. }
  49163. // Check if we're dealing with a known content-type
  49164. if ( ct ) {
  49165. for ( type in contents ) {
  49166. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  49167. dataTypes.unshift( type );
  49168. break;
  49169. }
  49170. }
  49171. }
  49172. // Check to see if we have a response for the expected dataType
  49173. if ( dataTypes[ 0 ] in responses ) {
  49174. finalDataType = dataTypes[ 0 ];
  49175. } else {
  49176. // Try convertible dataTypes
  49177. for ( type in responses ) {
  49178. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  49179. finalDataType = type;
  49180. break;
  49181. }
  49182. if ( !firstDataType ) {
  49183. firstDataType = type;
  49184. }
  49185. }
  49186. // Or just use first one
  49187. finalDataType = finalDataType || firstDataType;
  49188. }
  49189. // If we found a dataType
  49190. // We add the dataType to the list if needed
  49191. // and return the corresponding response
  49192. if ( finalDataType ) {
  49193. if ( finalDataType !== dataTypes[ 0 ] ) {
  49194. dataTypes.unshift( finalDataType );
  49195. }
  49196. return responses[ finalDataType ];
  49197. }
  49198. }
  49199. /* Chain conversions given the request and the original response
  49200. * Also sets the responseXXX fields on the jqXHR instance
  49201. */
  49202. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  49203. var conv2, current, conv, tmp, prev,
  49204. converters = {},
  49205. // Work with a copy of dataTypes in case we need to modify it for conversion
  49206. dataTypes = s.dataTypes.slice();
  49207. // Create converters map with lowercased keys
  49208. if ( dataTypes[ 1 ] ) {
  49209. for ( conv in s.converters ) {
  49210. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  49211. }
  49212. }
  49213. current = dataTypes.shift();
  49214. // Convert to each sequential dataType
  49215. while ( current ) {
  49216. if ( s.responseFields[ current ] ) {
  49217. jqXHR[ s.responseFields[ current ] ] = response;
  49218. }
  49219. // Apply the dataFilter if provided
  49220. if ( !prev && isSuccess && s.dataFilter ) {
  49221. response = s.dataFilter( response, s.dataType );
  49222. }
  49223. prev = current;
  49224. current = dataTypes.shift();
  49225. if ( current ) {
  49226. // There's only work to do if current dataType is non-auto
  49227. if ( current === "*" ) {
  49228. current = prev;
  49229. // Convert response if prev dataType is non-auto and differs from current
  49230. } else if ( prev !== "*" && prev !== current ) {
  49231. // Seek a direct converter
  49232. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  49233. // If none found, seek a pair
  49234. if ( !conv ) {
  49235. for ( conv2 in converters ) {
  49236. // If conv2 outputs current
  49237. tmp = conv2.split( " " );
  49238. if ( tmp[ 1 ] === current ) {
  49239. // If prev can be converted to accepted input
  49240. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  49241. converters[ "* " + tmp[ 0 ] ];
  49242. if ( conv ) {
  49243. // Condense equivalence converters
  49244. if ( conv === true ) {
  49245. conv = converters[ conv2 ];
  49246. // Otherwise, insert the intermediate dataType
  49247. } else if ( converters[ conv2 ] !== true ) {
  49248. current = tmp[ 0 ];
  49249. dataTypes.unshift( tmp[ 1 ] );
  49250. }
  49251. break;
  49252. }
  49253. }
  49254. }
  49255. }
  49256. // Apply converter (if not an equivalence)
  49257. if ( conv !== true ) {
  49258. // Unless errors are allowed to bubble, catch and return them
  49259. if ( conv && s.throws ) {
  49260. response = conv( response );
  49261. } else {
  49262. try {
  49263. response = conv( response );
  49264. } catch ( e ) {
  49265. return {
  49266. state: "parsererror",
  49267. error: conv ? e : "No conversion from " + prev + " to " + current
  49268. };
  49269. }
  49270. }
  49271. }
  49272. }
  49273. }
  49274. }
  49275. return { state: "success", data: response };
  49276. }
  49277. jQuery.extend( {
  49278. // Counter for holding the number of active queries
  49279. active: 0,
  49280. // Last-Modified header cache for next request
  49281. lastModified: {},
  49282. etag: {},
  49283. ajaxSettings: {
  49284. url: location.href,
  49285. type: "GET",
  49286. isLocal: rlocalProtocol.test( location.protocol ),
  49287. global: true,
  49288. processData: true,
  49289. async: true,
  49290. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  49291. /*
  49292. timeout: 0,
  49293. data: null,
  49294. dataType: null,
  49295. username: null,
  49296. password: null,
  49297. cache: null,
  49298. throws: false,
  49299. traditional: false,
  49300. headers: {},
  49301. */
  49302. accepts: {
  49303. "*": allTypes,
  49304. text: "text/plain",
  49305. html: "text/html",
  49306. xml: "application/xml, text/xml",
  49307. json: "application/json, text/javascript"
  49308. },
  49309. contents: {
  49310. xml: /\bxml\b/,
  49311. html: /\bhtml/,
  49312. json: /\bjson\b/
  49313. },
  49314. responseFields: {
  49315. xml: "responseXML",
  49316. text: "responseText",
  49317. json: "responseJSON"
  49318. },
  49319. // Data converters
  49320. // Keys separate source (or catchall "*") and destination types with a single space
  49321. converters: {
  49322. // Convert anything to text
  49323. "* text": String,
  49324. // Text to html (true = no transformation)
  49325. "text html": true,
  49326. // Evaluate text as a json expression
  49327. "text json": JSON.parse,
  49328. // Parse text as xml
  49329. "text xml": jQuery.parseXML
  49330. },
  49331. // For options that shouldn't be deep extended:
  49332. // you can add your own custom options here if
  49333. // and when you create one that shouldn't be
  49334. // deep extended (see ajaxExtend)
  49335. flatOptions: {
  49336. url: true,
  49337. context: true
  49338. }
  49339. },
  49340. // Creates a full fledged settings object into target
  49341. // with both ajaxSettings and settings fields.
  49342. // If target is omitted, writes into ajaxSettings.
  49343. ajaxSetup: function( target, settings ) {
  49344. return settings ?
  49345. // Building a settings object
  49346. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  49347. // Extending ajaxSettings
  49348. ajaxExtend( jQuery.ajaxSettings, target );
  49349. },
  49350. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  49351. ajaxTransport: addToPrefiltersOrTransports( transports ),
  49352. // Main method
  49353. ajax: function( url, options ) {
  49354. // If url is an object, simulate pre-1.5 signature
  49355. if ( typeof url === "object" ) {
  49356. options = url;
  49357. url = undefined;
  49358. }
  49359. // Force options to be an object
  49360. options = options || {};
  49361. var transport,
  49362. // URL without anti-cache param
  49363. cacheURL,
  49364. // Response headers
  49365. responseHeadersString,
  49366. responseHeaders,
  49367. // timeout handle
  49368. timeoutTimer,
  49369. // Url cleanup var
  49370. urlAnchor,
  49371. // Request state (becomes false upon send and true upon completion)
  49372. completed,
  49373. // To know if global events are to be dispatched
  49374. fireGlobals,
  49375. // Loop variable
  49376. i,
  49377. // uncached part of the url
  49378. uncached,
  49379. // Create the final options object
  49380. s = jQuery.ajaxSetup( {}, options ),
  49381. // Callbacks context
  49382. callbackContext = s.context || s,
  49383. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  49384. globalEventContext = s.context &&
  49385. ( callbackContext.nodeType || callbackContext.jquery ) ?
  49386. jQuery( callbackContext ) :
  49387. jQuery.event,
  49388. // Deferreds
  49389. deferred = jQuery.Deferred(),
  49390. completeDeferred = jQuery.Callbacks( "once memory" ),
  49391. // Status-dependent callbacks
  49392. statusCode = s.statusCode || {},
  49393. // Headers (they are sent all at once)
  49394. requestHeaders = {},
  49395. requestHeadersNames = {},
  49396. // Default abort message
  49397. strAbort = "canceled",
  49398. // Fake xhr
  49399. jqXHR = {
  49400. readyState: 0,
  49401. // Builds headers hashtable if needed
  49402. getResponseHeader: function( key ) {
  49403. var match;
  49404. if ( completed ) {
  49405. if ( !responseHeaders ) {
  49406. responseHeaders = {};
  49407. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  49408. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  49409. }
  49410. }
  49411. match = responseHeaders[ key.toLowerCase() ];
  49412. }
  49413. return match == null ? null : match;
  49414. },
  49415. // Raw string
  49416. getAllResponseHeaders: function() {
  49417. return completed ? responseHeadersString : null;
  49418. },
  49419. // Caches the header
  49420. setRequestHeader: function( name, value ) {
  49421. if ( completed == null ) {
  49422. name = requestHeadersNames[ name.toLowerCase() ] =
  49423. requestHeadersNames[ name.toLowerCase() ] || name;
  49424. requestHeaders[ name ] = value;
  49425. }
  49426. return this;
  49427. },
  49428. // Overrides response content-type header
  49429. overrideMimeType: function( type ) {
  49430. if ( completed == null ) {
  49431. s.mimeType = type;
  49432. }
  49433. return this;
  49434. },
  49435. // Status-dependent callbacks
  49436. statusCode: function( map ) {
  49437. var code;
  49438. if ( map ) {
  49439. if ( completed ) {
  49440. // Execute the appropriate callbacks
  49441. jqXHR.always( map[ jqXHR.status ] );
  49442. } else {
  49443. // Lazy-add the new callbacks in a way that preserves old ones
  49444. for ( code in map ) {
  49445. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  49446. }
  49447. }
  49448. }
  49449. return this;
  49450. },
  49451. // Cancel the request
  49452. abort: function( statusText ) {
  49453. var finalText = statusText || strAbort;
  49454. if ( transport ) {
  49455. transport.abort( finalText );
  49456. }
  49457. done( 0, finalText );
  49458. return this;
  49459. }
  49460. };
  49461. // Attach deferreds
  49462. deferred.promise( jqXHR );
  49463. // Add protocol if not provided (prefilters might expect it)
  49464. // Handle falsy url in the settings object (#10093: consistency with old signature)
  49465. // We also use the url parameter if available
  49466. s.url = ( ( url || s.url || location.href ) + "" )
  49467. .replace( rprotocol, location.protocol + "//" );
  49468. // Alias method option to type as per ticket #12004
  49469. s.type = options.method || options.type || s.method || s.type;
  49470. // Extract dataTypes list
  49471. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  49472. // A cross-domain request is in order when the origin doesn't match the current origin.
  49473. if ( s.crossDomain == null ) {
  49474. urlAnchor = document.createElement( "a" );
  49475. // Support: IE <=8 - 11, Edge 12 - 15
  49476. // IE throws exception on accessing the href property if url is malformed,
  49477. // e.g. http://example.com:80x/
  49478. try {
  49479. urlAnchor.href = s.url;
  49480. // Support: IE <=8 - 11 only
  49481. // Anchor's host property isn't correctly set when s.url is relative
  49482. urlAnchor.href = urlAnchor.href;
  49483. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  49484. urlAnchor.protocol + "//" + urlAnchor.host;
  49485. } catch ( e ) {
  49486. // If there is an error parsing the URL, assume it is crossDomain,
  49487. // it can be rejected by the transport if it is invalid
  49488. s.crossDomain = true;
  49489. }
  49490. }
  49491. // Convert data if not already a string
  49492. if ( s.data && s.processData && typeof s.data !== "string" ) {
  49493. s.data = jQuery.param( s.data, s.traditional );
  49494. }
  49495. // Apply prefilters
  49496. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  49497. // If request was aborted inside a prefilter, stop there
  49498. if ( completed ) {
  49499. return jqXHR;
  49500. }
  49501. // We can fire global events as of now if asked to
  49502. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  49503. fireGlobals = jQuery.event && s.global;
  49504. // Watch for a new set of requests
  49505. if ( fireGlobals && jQuery.active++ === 0 ) {
  49506. jQuery.event.trigger( "ajaxStart" );
  49507. }
  49508. // Uppercase the type
  49509. s.type = s.type.toUpperCase();
  49510. // Determine if request has content
  49511. s.hasContent = !rnoContent.test( s.type );
  49512. // Save the URL in case we're toying with the If-Modified-Since
  49513. // and/or If-None-Match header later on
  49514. // Remove hash to simplify url manipulation
  49515. cacheURL = s.url.replace( rhash, "" );
  49516. // More options handling for requests with no content
  49517. if ( !s.hasContent ) {
  49518. // Remember the hash so we can put it back
  49519. uncached = s.url.slice( cacheURL.length );
  49520. // If data is available and should be processed, append data to url
  49521. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  49522. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  49523. // #9682: remove data so that it's not used in an eventual retry
  49524. delete s.data;
  49525. }
  49526. // Add or update anti-cache param if needed
  49527. if ( s.cache === false ) {
  49528. cacheURL = cacheURL.replace( rantiCache, "$1" );
  49529. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  49530. }
  49531. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  49532. s.url = cacheURL + uncached;
  49533. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  49534. } else if ( s.data && s.processData &&
  49535. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  49536. s.data = s.data.replace( r20, "+" );
  49537. }
  49538. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  49539. if ( s.ifModified ) {
  49540. if ( jQuery.lastModified[ cacheURL ] ) {
  49541. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  49542. }
  49543. if ( jQuery.etag[ cacheURL ] ) {
  49544. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  49545. }
  49546. }
  49547. // Set the correct header, if data is being sent
  49548. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  49549. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  49550. }
  49551. // Set the Accepts header for the server, depending on the dataType
  49552. jqXHR.setRequestHeader(
  49553. "Accept",
  49554. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  49555. s.accepts[ s.dataTypes[ 0 ] ] +
  49556. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  49557. s.accepts[ "*" ]
  49558. );
  49559. // Check for headers option
  49560. for ( i in s.headers ) {
  49561. jqXHR.setRequestHeader( i, s.headers[ i ] );
  49562. }
  49563. // Allow custom headers/mimetypes and early abort
  49564. if ( s.beforeSend &&
  49565. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  49566. // Abort if not done already and return
  49567. return jqXHR.abort();
  49568. }
  49569. // Aborting is no longer a cancellation
  49570. strAbort = "abort";
  49571. // Install callbacks on deferreds
  49572. completeDeferred.add( s.complete );
  49573. jqXHR.done( s.success );
  49574. jqXHR.fail( s.error );
  49575. // Get transport
  49576. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  49577. // If no transport, we auto-abort
  49578. if ( !transport ) {
  49579. done( -1, "No Transport" );
  49580. } else {
  49581. jqXHR.readyState = 1;
  49582. // Send global event
  49583. if ( fireGlobals ) {
  49584. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  49585. }
  49586. // If request was aborted inside ajaxSend, stop there
  49587. if ( completed ) {
  49588. return jqXHR;
  49589. }
  49590. // Timeout
  49591. if ( s.async && s.timeout > 0 ) {
  49592. timeoutTimer = window.setTimeout( function() {
  49593. jqXHR.abort( "timeout" );
  49594. }, s.timeout );
  49595. }
  49596. try {
  49597. completed = false;
  49598. transport.send( requestHeaders, done );
  49599. } catch ( e ) {
  49600. // Rethrow post-completion exceptions
  49601. if ( completed ) {
  49602. throw e;
  49603. }
  49604. // Propagate others as results
  49605. done( -1, e );
  49606. }
  49607. }
  49608. // Callback for when everything is done
  49609. function done( status, nativeStatusText, responses, headers ) {
  49610. var isSuccess, success, error, response, modified,
  49611. statusText = nativeStatusText;
  49612. // Ignore repeat invocations
  49613. if ( completed ) {
  49614. return;
  49615. }
  49616. completed = true;
  49617. // Clear timeout if it exists
  49618. if ( timeoutTimer ) {
  49619. window.clearTimeout( timeoutTimer );
  49620. }
  49621. // Dereference transport for early garbage collection
  49622. // (no matter how long the jqXHR object will be used)
  49623. transport = undefined;
  49624. // Cache response headers
  49625. responseHeadersString = headers || "";
  49626. // Set readyState
  49627. jqXHR.readyState = status > 0 ? 4 : 0;
  49628. // Determine if successful
  49629. isSuccess = status >= 200 && status < 300 || status === 304;
  49630. // Get response data
  49631. if ( responses ) {
  49632. response = ajaxHandleResponses( s, jqXHR, responses );
  49633. }
  49634. // Convert no matter what (that way responseXXX fields are always set)
  49635. response = ajaxConvert( s, response, jqXHR, isSuccess );
  49636. // If successful, handle type chaining
  49637. if ( isSuccess ) {
  49638. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  49639. if ( s.ifModified ) {
  49640. modified = jqXHR.getResponseHeader( "Last-Modified" );
  49641. if ( modified ) {
  49642. jQuery.lastModified[ cacheURL ] = modified;
  49643. }
  49644. modified = jqXHR.getResponseHeader( "etag" );
  49645. if ( modified ) {
  49646. jQuery.etag[ cacheURL ] = modified;
  49647. }
  49648. }
  49649. // if no content
  49650. if ( status === 204 || s.type === "HEAD" ) {
  49651. statusText = "nocontent";
  49652. // if not modified
  49653. } else if ( status === 304 ) {
  49654. statusText = "notmodified";
  49655. // If we have data, let's convert it
  49656. } else {
  49657. statusText = response.state;
  49658. success = response.data;
  49659. error = response.error;
  49660. isSuccess = !error;
  49661. }
  49662. } else {
  49663. // Extract error from statusText and normalize for non-aborts
  49664. error = statusText;
  49665. if ( status || !statusText ) {
  49666. statusText = "error";
  49667. if ( status < 0 ) {
  49668. status = 0;
  49669. }
  49670. }
  49671. }
  49672. // Set data for the fake xhr object
  49673. jqXHR.status = status;
  49674. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  49675. // Success/Error
  49676. if ( isSuccess ) {
  49677. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  49678. } else {
  49679. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  49680. }
  49681. // Status-dependent callbacks
  49682. jqXHR.statusCode( statusCode );
  49683. statusCode = undefined;
  49684. if ( fireGlobals ) {
  49685. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  49686. [ jqXHR, s, isSuccess ? success : error ] );
  49687. }
  49688. // Complete
  49689. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  49690. if ( fireGlobals ) {
  49691. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  49692. // Handle the global AJAX counter
  49693. if ( !( --jQuery.active ) ) {
  49694. jQuery.event.trigger( "ajaxStop" );
  49695. }
  49696. }
  49697. }
  49698. return jqXHR;
  49699. },
  49700. getJSON: function( url, data, callback ) {
  49701. return jQuery.get( url, data, callback, "json" );
  49702. },
  49703. getScript: function( url, callback ) {
  49704. return jQuery.get( url, undefined, callback, "script" );
  49705. }
  49706. } );
  49707. jQuery.each( [ "get", "post" ], function( i, method ) {
  49708. jQuery[ method ] = function( url, data, callback, type ) {
  49709. // Shift arguments if data argument was omitted
  49710. if ( isFunction( data ) ) {
  49711. type = type || callback;
  49712. callback = data;
  49713. data = undefined;
  49714. }
  49715. // The url can be an options object (which then must have .url)
  49716. return jQuery.ajax( jQuery.extend( {
  49717. url: url,
  49718. type: method,
  49719. dataType: type,
  49720. data: data,
  49721. success: callback
  49722. }, jQuery.isPlainObject( url ) && url ) );
  49723. };
  49724. } );
  49725. jQuery._evalUrl = function( url ) {
  49726. return jQuery.ajax( {
  49727. url: url,
  49728. // Make this explicit, since user can override this through ajaxSetup (#11264)
  49729. type: "GET",
  49730. dataType: "script",
  49731. cache: true,
  49732. async: false,
  49733. global: false,
  49734. "throws": true
  49735. } );
  49736. };
  49737. jQuery.fn.extend( {
  49738. wrapAll: function( html ) {
  49739. var wrap;
  49740. if ( this[ 0 ] ) {
  49741. if ( isFunction( html ) ) {
  49742. html = html.call( this[ 0 ] );
  49743. }
  49744. // The elements to wrap the target around
  49745. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  49746. if ( this[ 0 ].parentNode ) {
  49747. wrap.insertBefore( this[ 0 ] );
  49748. }
  49749. wrap.map( function() {
  49750. var elem = this;
  49751. while ( elem.firstElementChild ) {
  49752. elem = elem.firstElementChild;
  49753. }
  49754. return elem;
  49755. } ).append( this );
  49756. }
  49757. return this;
  49758. },
  49759. wrapInner: function( html ) {
  49760. if ( isFunction( html ) ) {
  49761. return this.each( function( i ) {
  49762. jQuery( this ).wrapInner( html.call( this, i ) );
  49763. } );
  49764. }
  49765. return this.each( function() {
  49766. var self = jQuery( this ),
  49767. contents = self.contents();
  49768. if ( contents.length ) {
  49769. contents.wrapAll( html );
  49770. } else {
  49771. self.append( html );
  49772. }
  49773. } );
  49774. },
  49775. wrap: function( html ) {
  49776. var htmlIsFunction = isFunction( html );
  49777. return this.each( function( i ) {
  49778. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  49779. } );
  49780. },
  49781. unwrap: function( selector ) {
  49782. this.parent( selector ).not( "body" ).each( function() {
  49783. jQuery( this ).replaceWith( this.childNodes );
  49784. } );
  49785. return this;
  49786. }
  49787. } );
  49788. jQuery.expr.pseudos.hidden = function( elem ) {
  49789. return !jQuery.expr.pseudos.visible( elem );
  49790. };
  49791. jQuery.expr.pseudos.visible = function( elem ) {
  49792. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  49793. };
  49794. jQuery.ajaxSettings.xhr = function() {
  49795. try {
  49796. return new window.XMLHttpRequest();
  49797. } catch ( e ) {}
  49798. };
  49799. var xhrSuccessStatus = {
  49800. // File protocol always yields status code 0, assume 200
  49801. 0: 200,
  49802. // Support: IE <=9 only
  49803. // #1450: sometimes IE returns 1223 when it should be 204
  49804. 1223: 204
  49805. },
  49806. xhrSupported = jQuery.ajaxSettings.xhr();
  49807. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  49808. support.ajax = xhrSupported = !!xhrSupported;
  49809. jQuery.ajaxTransport( function( options ) {
  49810. var callback, errorCallback;
  49811. // Cross domain only allowed if supported through XMLHttpRequest
  49812. if ( support.cors || xhrSupported && !options.crossDomain ) {
  49813. return {
  49814. send: function( headers, complete ) {
  49815. var i,
  49816. xhr = options.xhr();
  49817. xhr.open(
  49818. options.type,
  49819. options.url,
  49820. options.async,
  49821. options.username,
  49822. options.password
  49823. );
  49824. // Apply custom fields if provided
  49825. if ( options.xhrFields ) {
  49826. for ( i in options.xhrFields ) {
  49827. xhr[ i ] = options.xhrFields[ i ];
  49828. }
  49829. }
  49830. // Override mime type if needed
  49831. if ( options.mimeType && xhr.overrideMimeType ) {
  49832. xhr.overrideMimeType( options.mimeType );
  49833. }
  49834. // X-Requested-With header
  49835. // For cross-domain requests, seeing as conditions for a preflight are
  49836. // akin to a jigsaw puzzle, we simply never set it to be sure.
  49837. // (it can always be set on a per-request basis or even using ajaxSetup)
  49838. // For same-domain requests, won't change header if already provided.
  49839. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  49840. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  49841. }
  49842. // Set headers
  49843. for ( i in headers ) {
  49844. xhr.setRequestHeader( i, headers[ i ] );
  49845. }
  49846. // Callback
  49847. callback = function( type ) {
  49848. return function() {
  49849. if ( callback ) {
  49850. callback = errorCallback = xhr.onload =
  49851. xhr.onerror = xhr.onabort = xhr.ontimeout =
  49852. xhr.onreadystatechange = null;
  49853. if ( type === "abort" ) {
  49854. xhr.abort();
  49855. } else if ( type === "error" ) {
  49856. // Support: IE <=9 only
  49857. // On a manual native abort, IE9 throws
  49858. // errors on any property access that is not readyState
  49859. if ( typeof xhr.status !== "number" ) {
  49860. complete( 0, "error" );
  49861. } else {
  49862. complete(
  49863. // File: protocol always yields status 0; see #8605, #14207
  49864. xhr.status,
  49865. xhr.statusText
  49866. );
  49867. }
  49868. } else {
  49869. complete(
  49870. xhrSuccessStatus[ xhr.status ] || xhr.status,
  49871. xhr.statusText,
  49872. // Support: IE <=9 only
  49873. // IE9 has no XHR2 but throws on binary (trac-11426)
  49874. // For XHR2 non-text, let the caller handle it (gh-2498)
  49875. ( xhr.responseType || "text" ) !== "text" ||
  49876. typeof xhr.responseText !== "string" ?
  49877. { binary: xhr.response } :
  49878. { text: xhr.responseText },
  49879. xhr.getAllResponseHeaders()
  49880. );
  49881. }
  49882. }
  49883. };
  49884. };
  49885. // Listen to events
  49886. xhr.onload = callback();
  49887. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  49888. // Support: IE 9 only
  49889. // Use onreadystatechange to replace onabort
  49890. // to handle uncaught aborts
  49891. if ( xhr.onabort !== undefined ) {
  49892. xhr.onabort = errorCallback;
  49893. } else {
  49894. xhr.onreadystatechange = function() {
  49895. // Check readyState before timeout as it changes
  49896. if ( xhr.readyState === 4 ) {
  49897. // Allow onerror to be called first,
  49898. // but that will not handle a native abort
  49899. // Also, save errorCallback to a variable
  49900. // as xhr.onerror cannot be accessed
  49901. window.setTimeout( function() {
  49902. if ( callback ) {
  49903. errorCallback();
  49904. }
  49905. } );
  49906. }
  49907. };
  49908. }
  49909. // Create the abort callback
  49910. callback = callback( "abort" );
  49911. try {
  49912. // Do send the request (this may raise an exception)
  49913. xhr.send( options.hasContent && options.data || null );
  49914. } catch ( e ) {
  49915. // #14683: Only rethrow if this hasn't been notified as an error yet
  49916. if ( callback ) {
  49917. throw e;
  49918. }
  49919. }
  49920. },
  49921. abort: function() {
  49922. if ( callback ) {
  49923. callback();
  49924. }
  49925. }
  49926. };
  49927. }
  49928. } );
  49929. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  49930. jQuery.ajaxPrefilter( function( s ) {
  49931. if ( s.crossDomain ) {
  49932. s.contents.script = false;
  49933. }
  49934. } );
  49935. // Install script dataType
  49936. jQuery.ajaxSetup( {
  49937. accepts: {
  49938. script: "text/javascript, application/javascript, " +
  49939. "application/ecmascript, application/x-ecmascript"
  49940. },
  49941. contents: {
  49942. script: /\b(?:java|ecma)script\b/
  49943. },
  49944. converters: {
  49945. "text script": function( text ) {
  49946. jQuery.globalEval( text );
  49947. return text;
  49948. }
  49949. }
  49950. } );
  49951. // Handle cache's special case and crossDomain
  49952. jQuery.ajaxPrefilter( "script", function( s ) {
  49953. if ( s.cache === undefined ) {
  49954. s.cache = false;
  49955. }
  49956. if ( s.crossDomain ) {
  49957. s.type = "GET";
  49958. }
  49959. } );
  49960. // Bind script tag hack transport
  49961. jQuery.ajaxTransport( "script", function( s ) {
  49962. // This transport only deals with cross domain requests
  49963. if ( s.crossDomain ) {
  49964. var script, callback;
  49965. return {
  49966. send: function( _, complete ) {
  49967. script = jQuery( "<script>" ).prop( {
  49968. charset: s.scriptCharset,
  49969. src: s.url
  49970. } ).on(
  49971. "load error",
  49972. callback = function( evt ) {
  49973. script.remove();
  49974. callback = null;
  49975. if ( evt ) {
  49976. complete( evt.type === "error" ? 404 : 200, evt.type );
  49977. }
  49978. }
  49979. );
  49980. // Use native DOM manipulation to avoid our domManip AJAX trickery
  49981. document.head.appendChild( script[ 0 ] );
  49982. },
  49983. abort: function() {
  49984. if ( callback ) {
  49985. callback();
  49986. }
  49987. }
  49988. };
  49989. }
  49990. } );
  49991. var oldCallbacks = [],
  49992. rjsonp = /(=)\?(?=&|$)|\?\?/;
  49993. // Default jsonp settings
  49994. jQuery.ajaxSetup( {
  49995. jsonp: "callback",
  49996. jsonpCallback: function() {
  49997. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  49998. this[ callback ] = true;
  49999. return callback;
  50000. }
  50001. } );
  50002. // Detect, normalize options and install callbacks for jsonp requests
  50003. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  50004. var callbackName, overwritten, responseContainer,
  50005. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  50006. "url" :
  50007. typeof s.data === "string" &&
  50008. ( s.contentType || "" )
  50009. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  50010. rjsonp.test( s.data ) && "data"
  50011. );
  50012. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  50013. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  50014. // Get callback name, remembering preexisting value associated with it
  50015. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  50016. s.jsonpCallback() :
  50017. s.jsonpCallback;
  50018. // Insert callback into url or form data
  50019. if ( jsonProp ) {
  50020. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  50021. } else if ( s.jsonp !== false ) {
  50022. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  50023. }
  50024. // Use data converter to retrieve json after script execution
  50025. s.converters[ "script json" ] = function() {
  50026. if ( !responseContainer ) {
  50027. jQuery.error( callbackName + " was not called" );
  50028. }
  50029. return responseContainer[ 0 ];
  50030. };
  50031. // Force json dataType
  50032. s.dataTypes[ 0 ] = "json";
  50033. // Install callback
  50034. overwritten = window[ callbackName ];
  50035. window[ callbackName ] = function() {
  50036. responseContainer = arguments;
  50037. };
  50038. // Clean-up function (fires after converters)
  50039. jqXHR.always( function() {
  50040. // If previous value didn't exist - remove it
  50041. if ( overwritten === undefined ) {
  50042. jQuery( window ).removeProp( callbackName );
  50043. // Otherwise restore preexisting value
  50044. } else {
  50045. window[ callbackName ] = overwritten;
  50046. }
  50047. // Save back as free
  50048. if ( s[ callbackName ] ) {
  50049. // Make sure that re-using the options doesn't screw things around
  50050. s.jsonpCallback = originalSettings.jsonpCallback;
  50051. // Save the callback name for future use
  50052. oldCallbacks.push( callbackName );
  50053. }
  50054. // Call if it was a function and we have a response
  50055. if ( responseContainer && isFunction( overwritten ) ) {
  50056. overwritten( responseContainer[ 0 ] );
  50057. }
  50058. responseContainer = overwritten = undefined;
  50059. } );
  50060. // Delegate to script
  50061. return "script";
  50062. }
  50063. } );
  50064. // Support: Safari 8 only
  50065. // In Safari 8 documents created via document.implementation.createHTMLDocument
  50066. // collapse sibling forms: the second one becomes a child of the first one.
  50067. // Because of that, this security measure has to be disabled in Safari 8.
  50068. // https://bugs.webkit.org/show_bug.cgi?id=137337
  50069. support.createHTMLDocument = ( function() {
  50070. var body = document.implementation.createHTMLDocument( "" ).body;
  50071. body.innerHTML = "<form></form><form></form>";
  50072. return body.childNodes.length === 2;
  50073. } )();
  50074. // Argument "data" should be string of html
  50075. // context (optional): If specified, the fragment will be created in this context,
  50076. // defaults to document
  50077. // keepScripts (optional): If true, will include scripts passed in the html string
  50078. jQuery.parseHTML = function( data, context, keepScripts ) {
  50079. if ( typeof data !== "string" ) {
  50080. return [];
  50081. }
  50082. if ( typeof context === "boolean" ) {
  50083. keepScripts = context;
  50084. context = false;
  50085. }
  50086. var base, parsed, scripts;
  50087. if ( !context ) {
  50088. // Stop scripts or inline event handlers from being executed immediately
  50089. // by using document.implementation
  50090. if ( support.createHTMLDocument ) {
  50091. context = document.implementation.createHTMLDocument( "" );
  50092. // Set the base href for the created document
  50093. // so any parsed elements with URLs
  50094. // are based on the document's URL (gh-2965)
  50095. base = context.createElement( "base" );
  50096. base.href = document.location.href;
  50097. context.head.appendChild( base );
  50098. } else {
  50099. context = document;
  50100. }
  50101. }
  50102. parsed = rsingleTag.exec( data );
  50103. scripts = !keepScripts && [];
  50104. // Single tag
  50105. if ( parsed ) {
  50106. return [ context.createElement( parsed[ 1 ] ) ];
  50107. }
  50108. parsed = buildFragment( [ data ], context, scripts );
  50109. if ( scripts && scripts.length ) {
  50110. jQuery( scripts ).remove();
  50111. }
  50112. return jQuery.merge( [], parsed.childNodes );
  50113. };
  50114. /**
  50115. * Load a url into a page
  50116. */
  50117. jQuery.fn.load = function( url, params, callback ) {
  50118. var selector, type, response,
  50119. self = this,
  50120. off = url.indexOf( " " );
  50121. if ( off > -1 ) {
  50122. selector = stripAndCollapse( url.slice( off ) );
  50123. url = url.slice( 0, off );
  50124. }
  50125. // If it's a function
  50126. if ( isFunction( params ) ) {
  50127. // We assume that it's the callback
  50128. callback = params;
  50129. params = undefined;
  50130. // Otherwise, build a param string
  50131. } else if ( params && typeof params === "object" ) {
  50132. type = "POST";
  50133. }
  50134. // If we have elements to modify, make the request
  50135. if ( self.length > 0 ) {
  50136. jQuery.ajax( {
  50137. url: url,
  50138. // If "type" variable is undefined, then "GET" method will be used.
  50139. // Make value of this field explicit since
  50140. // user can override it through ajaxSetup method
  50141. type: type || "GET",
  50142. dataType: "html",
  50143. data: params
  50144. } ).done( function( responseText ) {
  50145. // Save response for use in complete callback
  50146. response = arguments;
  50147. self.html( selector ?
  50148. // If a selector was specified, locate the right elements in a dummy div
  50149. // Exclude scripts to avoid IE 'Permission Denied' errors
  50150. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  50151. // Otherwise use the full result
  50152. responseText );
  50153. // If the request succeeds, this function gets "data", "status", "jqXHR"
  50154. // but they are ignored because response was set above.
  50155. // If it fails, this function gets "jqXHR", "status", "error"
  50156. } ).always( callback && function( jqXHR, status ) {
  50157. self.each( function() {
  50158. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  50159. } );
  50160. } );
  50161. }
  50162. return this;
  50163. };
  50164. // Attach a bunch of functions for handling common AJAX events
  50165. jQuery.each( [
  50166. "ajaxStart",
  50167. "ajaxStop",
  50168. "ajaxComplete",
  50169. "ajaxError",
  50170. "ajaxSuccess",
  50171. "ajaxSend"
  50172. ], function( i, type ) {
  50173. jQuery.fn[ type ] = function( fn ) {
  50174. return this.on( type, fn );
  50175. };
  50176. } );
  50177. jQuery.expr.pseudos.animated = function( elem ) {
  50178. return jQuery.grep( jQuery.timers, function( fn ) {
  50179. return elem === fn.elem;
  50180. } ).length;
  50181. };
  50182. jQuery.offset = {
  50183. setOffset: function( elem, options, i ) {
  50184. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  50185. position = jQuery.css( elem, "position" ),
  50186. curElem = jQuery( elem ),
  50187. props = {};
  50188. // Set position first, in-case top/left are set even on static elem
  50189. if ( position === "static" ) {
  50190. elem.style.position = "relative";
  50191. }
  50192. curOffset = curElem.offset();
  50193. curCSSTop = jQuery.css( elem, "top" );
  50194. curCSSLeft = jQuery.css( elem, "left" );
  50195. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  50196. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  50197. // Need to be able to calculate position if either
  50198. // top or left is auto and position is either absolute or fixed
  50199. if ( calculatePosition ) {
  50200. curPosition = curElem.position();
  50201. curTop = curPosition.top;
  50202. curLeft = curPosition.left;
  50203. } else {
  50204. curTop = parseFloat( curCSSTop ) || 0;
  50205. curLeft = parseFloat( curCSSLeft ) || 0;
  50206. }
  50207. if ( isFunction( options ) ) {
  50208. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  50209. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  50210. }
  50211. if ( options.top != null ) {
  50212. props.top = ( options.top - curOffset.top ) + curTop;
  50213. }
  50214. if ( options.left != null ) {
  50215. props.left = ( options.left - curOffset.left ) + curLeft;
  50216. }
  50217. if ( "using" in options ) {
  50218. options.using.call( elem, props );
  50219. } else {
  50220. curElem.css( props );
  50221. }
  50222. }
  50223. };
  50224. jQuery.fn.extend( {
  50225. // offset() relates an element's border box to the document origin
  50226. offset: function( options ) {
  50227. // Preserve chaining for setter
  50228. if ( arguments.length ) {
  50229. return options === undefined ?
  50230. this :
  50231. this.each( function( i ) {
  50232. jQuery.offset.setOffset( this, options, i );
  50233. } );
  50234. }
  50235. var rect, win,
  50236. elem = this[ 0 ];
  50237. if ( !elem ) {
  50238. return;
  50239. }
  50240. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  50241. // Support: IE <=11 only
  50242. // Running getBoundingClientRect on a
  50243. // disconnected node in IE throws an error
  50244. if ( !elem.getClientRects().length ) {
  50245. return { top: 0, left: 0 };
  50246. }
  50247. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  50248. rect = elem.getBoundingClientRect();
  50249. win = elem.ownerDocument.defaultView;
  50250. return {
  50251. top: rect.top + win.pageYOffset,
  50252. left: rect.left + win.pageXOffset
  50253. };
  50254. },
  50255. // position() relates an element's margin box to its offset parent's padding box
  50256. // This corresponds to the behavior of CSS absolute positioning
  50257. position: function() {
  50258. if ( !this[ 0 ] ) {
  50259. return;
  50260. }
  50261. var offsetParent, offset, doc,
  50262. elem = this[ 0 ],
  50263. parentOffset = { top: 0, left: 0 };
  50264. // position:fixed elements are offset from the viewport, which itself always has zero offset
  50265. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  50266. // Assume position:fixed implies availability of getBoundingClientRect
  50267. offset = elem.getBoundingClientRect();
  50268. } else {
  50269. offset = this.offset();
  50270. // Account for the *real* offset parent, which can be the document or its root element
  50271. // when a statically positioned element is identified
  50272. doc = elem.ownerDocument;
  50273. offsetParent = elem.offsetParent || doc.documentElement;
  50274. while ( offsetParent &&
  50275. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  50276. jQuery.css( offsetParent, "position" ) === "static" ) {
  50277. offsetParent = offsetParent.parentNode;
  50278. }
  50279. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  50280. // Incorporate borders into its offset, since they are outside its content origin
  50281. parentOffset = jQuery( offsetParent ).offset();
  50282. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  50283. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  50284. }
  50285. }
  50286. // Subtract parent offsets and element margins
  50287. return {
  50288. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  50289. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  50290. };
  50291. },
  50292. // This method will return documentElement in the following cases:
  50293. // 1) For the element inside the iframe without offsetParent, this method will return
  50294. // documentElement of the parent window
  50295. // 2) For the hidden or detached element
  50296. // 3) For body or html element, i.e. in case of the html node - it will return itself
  50297. //
  50298. // but those exceptions were never presented as a real life use-cases
  50299. // and might be considered as more preferable results.
  50300. //
  50301. // This logic, however, is not guaranteed and can change at any point in the future
  50302. offsetParent: function() {
  50303. return this.map( function() {
  50304. var offsetParent = this.offsetParent;
  50305. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  50306. offsetParent = offsetParent.offsetParent;
  50307. }
  50308. return offsetParent || documentElement;
  50309. } );
  50310. }
  50311. } );
  50312. // Create scrollLeft and scrollTop methods
  50313. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  50314. var top = "pageYOffset" === prop;
  50315. jQuery.fn[ method ] = function( val ) {
  50316. return access( this, function( elem, method, val ) {
  50317. // Coalesce documents and windows
  50318. var win;
  50319. if ( isWindow( elem ) ) {
  50320. win = elem;
  50321. } else if ( elem.nodeType === 9 ) {
  50322. win = elem.defaultView;
  50323. }
  50324. if ( val === undefined ) {
  50325. return win ? win[ prop ] : elem[ method ];
  50326. }
  50327. if ( win ) {
  50328. win.scrollTo(
  50329. !top ? val : win.pageXOffset,
  50330. top ? val : win.pageYOffset
  50331. );
  50332. } else {
  50333. elem[ method ] = val;
  50334. }
  50335. }, method, val, arguments.length );
  50336. };
  50337. } );
  50338. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  50339. // Add the top/left cssHooks using jQuery.fn.position
  50340. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  50341. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  50342. // getComputedStyle returns percent when specified for top/left/bottom/right;
  50343. // rather than make the css module depend on the offset module, just check for it here
  50344. jQuery.each( [ "top", "left" ], function( i, prop ) {
  50345. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  50346. function( elem, computed ) {
  50347. if ( computed ) {
  50348. computed = curCSS( elem, prop );
  50349. // If curCSS returns percentage, fallback to offset
  50350. return rnumnonpx.test( computed ) ?
  50351. jQuery( elem ).position()[ prop ] + "px" :
  50352. computed;
  50353. }
  50354. }
  50355. );
  50356. } );
  50357. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  50358. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  50359. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  50360. function( defaultExtra, funcName ) {
  50361. // Margin is only for outerHeight, outerWidth
  50362. jQuery.fn[ funcName ] = function( margin, value ) {
  50363. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  50364. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  50365. return access( this, function( elem, type, value ) {
  50366. var doc;
  50367. if ( isWindow( elem ) ) {
  50368. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  50369. return funcName.indexOf( "outer" ) === 0 ?
  50370. elem[ "inner" + name ] :
  50371. elem.document.documentElement[ "client" + name ];
  50372. }
  50373. // Get document width or height
  50374. if ( elem.nodeType === 9 ) {
  50375. doc = elem.documentElement;
  50376. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  50377. // whichever is greatest
  50378. return Math.max(
  50379. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  50380. elem.body[ "offset" + name ], doc[ "offset" + name ],
  50381. doc[ "client" + name ]
  50382. );
  50383. }
  50384. return value === undefined ?
  50385. // Get width or height on the element, requesting but not forcing parseFloat
  50386. jQuery.css( elem, type, extra ) :
  50387. // Set width or height on the element
  50388. jQuery.style( elem, type, value, extra );
  50389. }, type, chainable ? margin : undefined, chainable );
  50390. };
  50391. } );
  50392. } );
  50393. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  50394. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  50395. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  50396. function( i, name ) {
  50397. // Handle event binding
  50398. jQuery.fn[ name ] = function( data, fn ) {
  50399. return arguments.length > 0 ?
  50400. this.on( name, null, data, fn ) :
  50401. this.trigger( name );
  50402. };
  50403. } );
  50404. jQuery.fn.extend( {
  50405. hover: function( fnOver, fnOut ) {
  50406. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  50407. }
  50408. } );
  50409. jQuery.fn.extend( {
  50410. bind: function( types, data, fn ) {
  50411. return this.on( types, null, data, fn );
  50412. },
  50413. unbind: function( types, fn ) {
  50414. return this.off( types, null, fn );
  50415. },
  50416. delegate: function( selector, types, data, fn ) {
  50417. return this.on( types, selector, data, fn );
  50418. },
  50419. undelegate: function( selector, types, fn ) {
  50420. // ( namespace ) or ( selector, types [, fn] )
  50421. return arguments.length === 1 ?
  50422. this.off( selector, "**" ) :
  50423. this.off( types, selector || "**", fn );
  50424. }
  50425. } );
  50426. // Bind a function to a context, optionally partially applying any
  50427. // arguments.
  50428. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  50429. // However, it is not slated for removal any time soon
  50430. jQuery.proxy = function( fn, context ) {
  50431. var tmp, args, proxy;
  50432. if ( typeof context === "string" ) {
  50433. tmp = fn[ context ];
  50434. context = fn;
  50435. fn = tmp;
  50436. }
  50437. // Quick check to determine if target is callable, in the spec
  50438. // this throws a TypeError, but we will just return undefined.
  50439. if ( !isFunction( fn ) ) {
  50440. return undefined;
  50441. }
  50442. // Simulated bind
  50443. args = slice.call( arguments, 2 );
  50444. proxy = function() {
  50445. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  50446. };
  50447. // Set the guid of unique handler to the same of original handler, so it can be removed
  50448. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  50449. return proxy;
  50450. };
  50451. jQuery.holdReady = function( hold ) {
  50452. if ( hold ) {
  50453. jQuery.readyWait++;
  50454. } else {
  50455. jQuery.ready( true );
  50456. }
  50457. };
  50458. jQuery.isArray = Array.isArray;
  50459. jQuery.parseJSON = JSON.parse;
  50460. jQuery.nodeName = nodeName;
  50461. jQuery.isFunction = isFunction;
  50462. jQuery.isWindow = isWindow;
  50463. jQuery.camelCase = camelCase;
  50464. jQuery.type = toType;
  50465. jQuery.now = Date.now;
  50466. jQuery.isNumeric = function( obj ) {
  50467. // As of jQuery 3.0, isNumeric is limited to
  50468. // strings and numbers (primitives or objects)
  50469. // that can be coerced to finite numbers (gh-2662)
  50470. var type = jQuery.type( obj );
  50471. return ( type === "number" || type === "string" ) &&
  50472. // parseFloat NaNs numeric-cast false positives ("")
  50473. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  50474. // subtraction forces infinities to NaN
  50475. !isNaN( obj - parseFloat( obj ) );
  50476. };
  50477. // Register as a named AMD module, since jQuery can be concatenated with other
  50478. // files that may use define, but not via a proper concatenation script that
  50479. // understands anonymous AMD modules. A named AMD is safest and most robust
  50480. // way to register. Lowercase jquery is used because AMD module names are
  50481. // derived from file names, and jQuery is normally delivered in a lowercase
  50482. // file name. Do this after creating the global so that if an AMD module wants
  50483. // to call noConflict to hide this version of jQuery, it will work.
  50484. // Note that for maximum portability, libraries that are not jQuery should
  50485. // declare themselves as anonymous modules, and avoid setting a global if an
  50486. // AMD loader is present. jQuery is a special case. For more information, see
  50487. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  50488. if ( true ) {
  50489. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  50490. return jQuery;
  50491. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  50492. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  50493. }
  50494. var
  50495. // Map over jQuery in case of overwrite
  50496. _jQuery = window.jQuery,
  50497. // Map over the $ in case of overwrite
  50498. _$ = window.$;
  50499. jQuery.noConflict = function( deep ) {
  50500. if ( window.$ === jQuery ) {
  50501. window.$ = _$;
  50502. }
  50503. if ( deep && window.jQuery === jQuery ) {
  50504. window.jQuery = _jQuery;
  50505. }
  50506. return jQuery;
  50507. };
  50508. // Expose jQuery and $ identifiers, even in AMD
  50509. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  50510. // and CommonJS for browser emulators (#13566)
  50511. if ( !noGlobal ) {
  50512. window.jQuery = window.$ = jQuery;
  50513. }
  50514. return jQuery;
  50515. } );
  50516. /***/ }),
  50517. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  50518. /*!********************************************************!*\
  50519. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  50520. \********************************************************/
  50521. /*! exports provided: LanguageService */
  50522. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50523. "use strict";
  50524. __webpack_require__.r(__webpack_exports__);
  50525. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageService", function() { return LanguageService; });
  50526. var LanguageService = /** @class */ (function () {
  50527. function LanguageService(lsKey, defaultLang) {
  50528. if (defaultLang === void 0) { defaultLang = 'pt'; }
  50529. this.lsKey = lsKey;
  50530. this.defaultLang = defaultLang;
  50531. this.listeners = [];
  50532. this.document = document;
  50533. this.setupListener();
  50534. }
  50535. LanguageService.prototype.setupListener = function () {
  50536. var _this = this;
  50537. if (this.document !== null) {
  50538. this.document.addEventListener("storage", (function (event) {
  50539. var e = event;
  50540. if (e.key === _this.lsKey) {
  50541. _this.listeners.forEach(function (l) { return l(); });
  50542. }
  50543. }));
  50544. }
  50545. };
  50546. LanguageService.prototype.getLang = function () {
  50547. var lang = localStorage.getItem(this.lsKey);
  50548. if (lang === null || lang === undefined) {
  50549. console.warn("Internal Error: User language information has not been set. Returning default...");
  50550. return this.getDefaultLang();
  50551. }
  50552. return lang;
  50553. };
  50554. LanguageService.prototype.getDefaultLang = function () {
  50555. return this.defaultLang;
  50556. };
  50557. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  50558. this.listeners.push(listener);
  50559. };
  50560. return LanguageService;
  50561. }());
  50562. /***/ }),
  50563. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  50564. /*!************************************************************!*\
  50565. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  50566. \************************************************************/
  50567. /*! exports provided: LanguageServiceNoLS */
  50568. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50569. "use strict";
  50570. __webpack_require__.r(__webpack_exports__);
  50571. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageServiceNoLS", function() { return LanguageServiceNoLS; });
  50572. var LanguageServiceNoLS = /** @class */ (function () {
  50573. function LanguageServiceNoLS(lang) {
  50574. this.lang = lang;
  50575. this.listeners = [];
  50576. }
  50577. LanguageServiceNoLS.prototype.setupListener = function () { };
  50578. LanguageServiceNoLS.prototype.notifyChange = function () {
  50579. this.listeners.forEach(function (l) { return l(); });
  50580. };
  50581. LanguageServiceNoLS.prototype.setLang = function (lang) {
  50582. this.lang = lang;
  50583. this.notifyChange();
  50584. };
  50585. LanguageServiceNoLS.prototype.getLang = function () {
  50586. return this.lang;
  50587. };
  50588. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  50589. return this.lang;
  50590. };
  50591. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  50592. this.listeners.push(listener);
  50593. };
  50594. return LanguageServiceNoLS;
  50595. }());
  50596. /***/ }),
  50597. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  50598. /*!*********************************************************!*\
  50599. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  50600. \*********************************************************/
  50601. /*! exports provided: LocalizedStrings */
  50602. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50603. "use strict";
  50604. __webpack_require__.r(__webpack_exports__);
  50605. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  50606. /* harmony import */ var _StringTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  50607. var LocalizedStrings = /** @class */ (function () {
  50608. function LocalizedStrings(service, i18nData, listenToChange) {
  50609. if (listenToChange === void 0) { listenToChange = false; }
  50610. var _this = this;
  50611. this.service = service;
  50612. this.i18nData = i18nData;
  50613. this.listenToChange = listenToChange;
  50614. this.document = document;
  50615. if (this.listenToChange) {
  50616. service.registerLanguageChangeListener(function () {
  50617. _this.updateTagText();
  50618. });
  50619. }
  50620. }
  50621. LocalizedStrings.prototype.getString = function (id, type) {
  50622. var i18nObj = this.i18nData[this.service.getLang()];
  50623. if (!!!i18nObj) {
  50624. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  50625. i18nObj = this.i18nData[this.service.getDefaultLang()];
  50626. }
  50627. if (!!!i18nObj[type]) {
  50628. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  50629. }
  50630. else if (!!!i18nObj[type][id]) {
  50631. return "{MISSING_I18N_IDENTIFIER}";
  50632. }
  50633. else {
  50634. return i18nObj[type][id];
  50635. }
  50636. };
  50637. LocalizedStrings.prototype.getOR = function () {
  50638. return this.getUI('join_or');
  50639. };
  50640. LocalizedStrings.prototype.getError = function (id, context) {
  50641. if (context === void 0) { context = []; }
  50642. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].ERROR);
  50643. return this.processString(text, context);
  50644. };
  50645. LocalizedStrings.prototype.getMessage = function (id, context) {
  50646. if (context === void 0) { context = []; }
  50647. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].MESSAGE);
  50648. return this.processString(text, context);
  50649. };
  50650. LocalizedStrings.prototype.getUI = function (id, context) {
  50651. if (context === void 0) { context = []; }
  50652. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].UI);
  50653. return this.processString(text, context);
  50654. };
  50655. LocalizedStrings.prototype.processString = function (text, context) {
  50656. for (var i = 0; i < context.length; i++) {
  50657. var v = context[i];
  50658. text = text.replace('\$' + i, v);
  50659. }
  50660. return text;
  50661. };
  50662. LocalizedStrings.prototype.updateTagText = function (func) {
  50663. var _this = this;
  50664. if (func === void 0) { func = null; }
  50665. if (this.document !== null) {
  50666. var list = this.document.querySelectorAll("data.i18n");
  50667. list.forEach(function (node) {
  50668. if (func === null) {
  50669. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  50670. }
  50671. else {
  50672. node.innerHTML = func(node.getAttribute("value"));
  50673. }
  50674. });
  50675. }
  50676. };
  50677. LocalizedStrings.prototype.processTagTex = function (text) {
  50678. if (text === null) {
  50679. return "<Invalid i18n identifier>";
  50680. }
  50681. var opts = text.split(':');
  50682. var type = opts[0].toLowerCase();
  50683. var id = opts[1];
  50684. if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].ERROR === type) {
  50685. return this.getError(id);
  50686. }
  50687. else if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].MESSAGE === type) {
  50688. return this.getMessage(id);
  50689. }
  50690. else if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].UI === type) {
  50691. return this.getUI(id);
  50692. }
  50693. else {
  50694. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  50695. return this.getString(id, type);
  50696. }
  50697. };
  50698. return LocalizedStrings;
  50699. }());
  50700. /***/ }),
  50701. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  50702. /*!****************************************************!*\
  50703. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  50704. \****************************************************/
  50705. /*! exports provided: StringTypes */
  50706. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50707. "use strict";
  50708. __webpack_require__.r(__webpack_exports__);
  50709. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringTypes", function() { return StringTypes; });
  50710. var StringTypes;
  50711. (function (StringTypes) {
  50712. StringTypes["ERROR"] = "error";
  50713. StringTypes["MESSAGE"] = "message";
  50714. StringTypes["UI"] = "ui";
  50715. })(StringTypes || (StringTypes = {}));
  50716. /***/ }),
  50717. /***/ "./node_modules/line-i18n/dist/index.js":
  50718. /*!**********************************************!*\
  50719. !*** ./node_modules/line-i18n/dist/index.js ***!
  50720. \**********************************************/
  50721. /*! exports provided: default */
  50722. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  50723. "use strict";
  50724. __webpack_require__.r(__webpack_exports__);
  50725. /* harmony import */ var _LanguageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  50726. /* harmony import */ var _LocalizedStrings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  50727. /* harmony import */ var _StringTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  50728. /* harmony import */ var _LanguageServiceNoLS__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  50729. /* harmony default export */ __webpack_exports__["default"] = ({
  50730. LanguageService: _LanguageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"],
  50731. LanguageServiceNoLS: _LanguageServiceNoLS__WEBPACK_IMPORTED_MODULE_3__["LanguageServiceNoLS"],
  50732. LocalizedStrings: _LocalizedStrings__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"],
  50733. StringTypes: _StringTypes__WEBPACK_IMPORTED_MODULE_2__["StringTypes"]
  50734. });
  50735. /***/ }),
  50736. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  50737. /*!***************************************************!*\
  50738. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  50739. \***************************************************/
  50740. /*! no static exports found */
  50741. /***/ (function(module, exports, __webpack_require__) {
  50742. "use strict";
  50743. /**
  50744. * DEVELOPED BY
  50745. * GIL LOPES BUENO
  50746. * gilbueno.mail@gmail.com
  50747. *
  50748. * WORKS WITH:
  50749. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  50750. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  50751. *
  50752. * FORK:
  50753. * https://github.com/melanke/Watch.JS
  50754. *
  50755. * LICENSE: MIT
  50756. */
  50757. (function (factory) {
  50758. if (true) {
  50759. // Node. Does not work with strict CommonJS, but
  50760. // only CommonJS-like enviroments that support module.exports,
  50761. // like Node.
  50762. module.exports = factory();
  50763. } else {}
  50764. }(function () {
  50765. var WatchJS = {
  50766. noMore: false, // use WatchJS.suspend(obj) instead
  50767. useDirtyCheck: false, // use only dirty checking to track changes.
  50768. preserveExistingSetters: false
  50769. },
  50770. lengthsubjects = [];
  50771. var dirtyChecklist = [];
  50772. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  50773. var supportDefineProperty = false;
  50774. try {
  50775. supportDefineProperty = Object.defineProperty && Object.defineProperty({},'x', {});
  50776. } catch(ex) { /* not supported */ }
  50777. var isFunction = function (functionToCheck) {
  50778. var getType = {};
  50779. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  50780. };
  50781. var isInt = function (x) {
  50782. return x % 1 === 0;
  50783. };
  50784. var isArray = function(obj) {
  50785. return Object.prototype.toString.call(obj) === '[object Array]';
  50786. };
  50787. var isObject = function(obj) {
  50788. return {}.toString.apply(obj) === '[object Object]';
  50789. };
  50790. var getObjDiff = function(a, b){
  50791. var aplus = [],
  50792. bplus = [];
  50793. if(!(typeof a == "string") && !(typeof b == "string")){
  50794. if (isArray(a) && b) {
  50795. for (var i=0; i<a.length; i++) {
  50796. if (b[i] === undefined) aplus.push(i);
  50797. }
  50798. } else {
  50799. for(var i in a){
  50800. if (a.hasOwnProperty(i)) {
  50801. if(b && !b.hasOwnProperty(i)) {
  50802. aplus.push(i);
  50803. }
  50804. }
  50805. }
  50806. }
  50807. if (isArray(b) && a) {
  50808. for (var j=0; j<b.length; j++) {
  50809. if (a[j] === undefined) bplus.push(j);
  50810. }
  50811. } else {
  50812. for(var j in b){
  50813. if (b.hasOwnProperty(j)) {
  50814. if(a && !a.hasOwnProperty(j)) {
  50815. bplus.push(j);
  50816. }
  50817. }
  50818. }
  50819. }
  50820. }
  50821. return {
  50822. added: aplus,
  50823. removed: bplus
  50824. }
  50825. };
  50826. var clone = function(obj){
  50827. if (null == obj || "object" != typeof obj) {
  50828. return obj;
  50829. }
  50830. var copy = obj.constructor();
  50831. for (var attr in obj) {
  50832. copy[attr] = obj[attr];
  50833. }
  50834. return copy;
  50835. }
  50836. var getExistingSetter = function (obj, propName) {
  50837. if (WatchJS.preserveExistingSetters) {
  50838. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  50839. return existing.set;
  50840. }
  50841. return undefined;
  50842. }
  50843. var defineGetAndSet = function (obj, propName, getter, setter) {
  50844. try {
  50845. var existingSetter = getExistingSetter(obj, propName);
  50846. Object.defineProperty(obj, propName, {
  50847. get: getter,
  50848. set: function(value) {
  50849. setter.call(this, value, true); // coalesce changes
  50850. if (existingSetter) {
  50851. existingSetter(value);
  50852. }
  50853. },
  50854. enumerable: true,
  50855. configurable: true
  50856. });
  50857. }
  50858. catch(e1) {
  50859. try{
  50860. Object.prototype.__defineGetter__.call(obj, propName, getter);
  50861. Object.prototype.__defineSetter__.call(obj, propName, function(value) {
  50862. setter.call(this,value,true); // coalesce changes
  50863. });
  50864. }
  50865. catch(e2) {
  50866. observeDirtyChanges(obj,propName,setter);
  50867. //throw new Error("watchJS error: browser not supported :/")
  50868. }
  50869. }
  50870. };
  50871. var defineProp = function (obj, propName, value) {
  50872. try {
  50873. Object.defineProperty(obj, propName, {
  50874. enumerable: false,
  50875. configurable: true,
  50876. writable: false,
  50877. value: value
  50878. });
  50879. } catch(error) {
  50880. obj[propName] = value;
  50881. }
  50882. };
  50883. var observeDirtyChanges = function(obj,propName,setter) {
  50884. dirtyChecklist[dirtyChecklist.length] = {
  50885. prop: propName,
  50886. object: obj,
  50887. orig: clone(obj[propName]),
  50888. callback: setter
  50889. }
  50890. }
  50891. var watch = function () {
  50892. if (isFunction(arguments[1])) {
  50893. watchAll.apply(this, arguments);
  50894. } else if (isArray(arguments[1])) {
  50895. watchMany.apply(this, arguments);
  50896. } else {
  50897. watchOne.apply(this, arguments);
  50898. }
  50899. };
  50900. var watchAll = function (obj, watcher, level, addNRemove) {
  50901. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50902. return;
  50903. }
  50904. if(isArray(obj)) {
  50905. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  50906. if (level===undefined||level > 0) {
  50907. for (var prop = 0; prop < obj.length; prop++) { // watch objects in array
  50908. watchAll(obj[prop],watcher,level, addNRemove);
  50909. }
  50910. }
  50911. }
  50912. else {
  50913. var prop,props = [];
  50914. for (prop in obj) { //for each attribute if obj is an object
  50915. if (prop == "$val" || (!supportDefineProperty && prop === 'watchers')) {
  50916. continue;
  50917. }
  50918. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  50919. props.push(prop); //put in the props
  50920. }
  50921. }
  50922. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  50923. }
  50924. if (addNRemove) {
  50925. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  50926. }
  50927. };
  50928. var watchMany = function (obj, props, watcher, level, addNRemove) {
  50929. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50930. return;
  50931. }
  50932. for (var i=0; i<props.length; i++) { //watch each property
  50933. var prop = props[i];
  50934. watchOne(obj, prop, watcher, level, addNRemove);
  50935. }
  50936. };
  50937. var watchOne = function (obj, prop, watcher, level, addNRemove) {
  50938. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50939. return;
  50940. }
  50941. if(isFunction(obj[prop])) { //dont watch if it is a function
  50942. return;
  50943. }
  50944. if(obj[prop] != null && (level === undefined || level > 0)){
  50945. watchAll(obj[prop], watcher, level!==undefined? level-1 : level); //recursively watch all attributes of this
  50946. }
  50947. defineWatcher(obj, prop, watcher, level);
  50948. if(addNRemove && (level === undefined || level > 0)){
  50949. pushToLengthSubjects(obj, prop, watcher, level);
  50950. }
  50951. };
  50952. var unwatch = function () {
  50953. if (isFunction(arguments[1])) {
  50954. unwatchAll.apply(this, arguments);
  50955. } else if (isArray(arguments[1])) {
  50956. unwatchMany.apply(this, arguments);
  50957. } else {
  50958. unwatchOne.apply(this, arguments);
  50959. }
  50960. };
  50961. var unwatchAll = function (obj, watcher) {
  50962. if (obj instanceof String || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  50963. return;
  50964. }
  50965. if (isArray(obj)) {
  50966. var props = ['__watchall__'];
  50967. for (var prop = 0; prop < obj.length; prop++) { //for each item if obj is an array
  50968. props.push(prop); //put in the props
  50969. }
  50970. unwatchMany(obj, props, watcher); //watch all itens of the props
  50971. } else {
  50972. var unwatchPropsInObject = function (obj2) {
  50973. var props = [];
  50974. for (var prop2 in obj2) { //for each attribute if obj is an object
  50975. if (obj2.hasOwnProperty(prop2)) {
  50976. if (obj2[prop2] instanceof Object) {
  50977. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  50978. } else {
  50979. props.push(prop2); //put in the props
  50980. }
  50981. }
  50982. }
  50983. unwatchMany(obj2, props, watcher); //unwatch all of the props
  50984. };
  50985. unwatchPropsInObject(obj);
  50986. }
  50987. };
  50988. var unwatchMany = function (obj, props, watcher) {
  50989. for (var prop2 in props) { //watch each attribute of "props" if is an object
  50990. if (props.hasOwnProperty(prop2)) {
  50991. unwatchOne(obj, props[prop2], watcher);
  50992. }
  50993. }
  50994. };
  50995. var timeouts = [],
  50996. timerID = null;
  50997. function clearTimerID() {
  50998. timerID = null;
  50999. for(var i=0; i< timeouts.length; i++) {
  51000. timeouts[i]();
  51001. }
  51002. timeouts.length = 0;
  51003. }
  51004. var getTimerID= function () {
  51005. if (!timerID) {
  51006. timerID = setTimeout(clearTimerID);
  51007. }
  51008. return timerID;
  51009. }
  51010. var registerTimeout = function(fn) { // register function to be called on timeout
  51011. if (timerID==null) getTimerID();
  51012. timeouts[timeouts.length] = fn;
  51013. }
  51014. // Track changes made to an array, object or an object's property
  51015. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  51016. // Syntax:
  51017. // trackChange(obj, callback, recursive, addNRemove)
  51018. // trackChange(obj, prop, callback, recursive, addNRemove)
  51019. var trackChange = function() {
  51020. var fn = (isFunction(arguments[2])) ? trackProperty : trackObject ;
  51021. fn.apply(this,arguments);
  51022. }
  51023. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  51024. var trackObject= function(obj, callback, recursive, addNRemove) {
  51025. var change = null,lastTimerID = -1;
  51026. var isArr = isArray(obj);
  51027. var level,fn = function(prop, action, newValue, oldValue) {
  51028. var timerID = getTimerID();
  51029. if (lastTimerID!==timerID) { // check if timer has changed since last update
  51030. lastTimerID = timerID;
  51031. change = {
  51032. type: 'update'
  51033. }
  51034. change['value'] = obj;
  51035. change['splices'] = null;
  51036. registerTimeout(function() {
  51037. callback.call(this,change);
  51038. change = null;
  51039. });
  51040. }
  51041. // create splices for array changes
  51042. if (isArr && obj === this && change !== null) {
  51043. if (action==='pop'||action==='shift') {
  51044. newValue = [];
  51045. oldValue = [oldValue];
  51046. }
  51047. else if (action==='push'||action==='unshift') {
  51048. newValue = [newValue];
  51049. oldValue = [];
  51050. }
  51051. else if (action!=='splice') {
  51052. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  51053. }
  51054. if (!change.splices) change.splices = [];
  51055. change.splices[change.splices.length] = {
  51056. index: prop,
  51057. deleteCount: oldValue ? oldValue.length : 0,
  51058. addedCount: newValue ? newValue.length : 0,
  51059. added: newValue,
  51060. deleted: oldValue
  51061. };
  51062. }
  51063. }
  51064. level = (recursive==true) ? undefined : 0;
  51065. watchAll(obj,fn, level, addNRemove);
  51066. }
  51067. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  51068. var trackProperty = function(obj,prop,callback,recursive, addNRemove) {
  51069. if (obj && prop) {
  51070. watchOne(obj,prop,function(prop, action, newvalue, oldvalue) {
  51071. var change = {
  51072. type: 'update'
  51073. }
  51074. change['value'] = newvalue;
  51075. change['oldvalue'] = oldvalue;
  51076. if (recursive && isObject(newvalue)||isArray(newvalue)) {
  51077. trackObject(newvalue,callback,recursive, addNRemove);
  51078. }
  51079. callback.call(this,change);
  51080. },0)
  51081. if (recursive && isObject(obj[prop])||isArray(obj[prop])) {
  51082. trackObject(obj[prop],callback,recursive, addNRemove);
  51083. }
  51084. }
  51085. }
  51086. var defineWatcher = function (obj, prop, watcher, level) {
  51087. var newWatcher = false;
  51088. var isArr = isArray(obj);
  51089. if (!obj.watchers) {
  51090. defineProp(obj, "watchers", {});
  51091. if (isArr) {
  51092. // watch array functions
  51093. watchFunctions(obj, function(index,action,newValue, oldValue) {
  51094. addPendingChange(obj, index, action,newValue, oldValue);
  51095. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  51096. var i,n, ln, wAll, watchList = obj.watchers[prop];
  51097. if ((wAll = obj.watchers['__watchall__'])) {
  51098. watchList = watchList ? watchList.concat(wAll) : wAll;
  51099. }
  51100. ln = watchList ? watchList.length : 0;
  51101. for (i = 0; i<ln; i++) {
  51102. if (action!=='splice') {
  51103. watchAll(newValue, watchList[i], (level===undefined)?level:level-1);
  51104. }
  51105. else {
  51106. // watch spliced values
  51107. for(n=0; n < newValue.length; n++) {
  51108. watchAll(newValue[n], watchList[i], (level===undefined)?level:level-1);
  51109. }
  51110. }
  51111. }
  51112. }
  51113. });
  51114. }
  51115. }
  51116. if (!obj.watchers[prop]) {
  51117. obj.watchers[prop] = [];
  51118. if (!isArr) newWatcher = true;
  51119. }
  51120. for (var i=0; i<obj.watchers[prop].length; i++) {
  51121. if(obj.watchers[prop][i] === watcher){
  51122. return;
  51123. }
  51124. }
  51125. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  51126. if (newWatcher) {
  51127. var val = obj[prop];
  51128. var getter = function () {
  51129. return val;
  51130. };
  51131. var setter = function (newval, delayWatcher) {
  51132. var oldval = val;
  51133. val = newval;
  51134. if (level !== 0
  51135. && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop]))
  51136. && !obj[prop].watchers) {
  51137. // watch sub properties
  51138. var i,ln = obj.watchers[prop].length;
  51139. for(i=0; i<ln; i++) {
  51140. watchAll(obj[prop], obj.watchers[prop][i], (level===undefined)?level:level-1);
  51141. }
  51142. }
  51143. //watchFunctions(obj, prop);
  51144. if (isSuspended(obj, prop)) {
  51145. resume(obj, prop);
  51146. return;
  51147. }
  51148. if (!WatchJS.noMore){ // this does not work with Object.observe
  51149. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  51150. if (oldval !== newval) {
  51151. if (!delayWatcher) {
  51152. callWatchers(obj, prop, "set", newval, oldval);
  51153. }
  51154. else {
  51155. addPendingChange(obj, prop, "set", newval, oldval);
  51156. }
  51157. WatchJS.noMore = false;
  51158. }
  51159. }
  51160. };
  51161. if (WatchJS.useDirtyCheck) {
  51162. observeDirtyChanges(obj,prop,setter);
  51163. }
  51164. else {
  51165. defineGetAndSet(obj, prop, getter, setter);
  51166. }
  51167. }
  51168. };
  51169. var callWatchers = function (obj, prop, action, newval, oldval) {
  51170. if (prop !== undefined) {
  51171. var ln, wl, watchList = obj.watchers[prop];
  51172. if ((wl = obj.watchers['__watchall__'])) {
  51173. watchList = watchList ? watchList.concat(wl) : wl;
  51174. }
  51175. ln = watchList ? watchList.length : 0;
  51176. for (var wr=0; wr< ln; wr++) {
  51177. watchList[wr].call(obj, prop, action, newval, oldval);
  51178. }
  51179. } else {
  51180. for (var prop in obj) {//call all
  51181. if (obj.hasOwnProperty(prop)) {
  51182. callWatchers(obj, prop, action, newval, oldval);
  51183. }
  51184. }
  51185. }
  51186. };
  51187. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  51188. var defineArrayMethodWatcher = function (obj, original, methodName, callback) {
  51189. defineProp(obj, methodName, function () {
  51190. var index = 0;
  51191. var i,newValue, oldValue, response;
  51192. // get values before splicing array
  51193. if (methodName === 'splice') {
  51194. var start = arguments[0];
  51195. var end = start + arguments[1];
  51196. oldValue = obj.slice(start,end);
  51197. newValue = [];
  51198. for(i=2;i<arguments.length;i++) {
  51199. newValue[i-2] = arguments[i];
  51200. }
  51201. index = start;
  51202. }
  51203. else {
  51204. newValue = arguments.length > 0 ? arguments[0] : undefined;
  51205. }
  51206. response = original.apply(obj, arguments);
  51207. if (methodName !== 'slice') {
  51208. if (methodName === 'pop') {
  51209. oldValue = response;
  51210. index = obj.length;
  51211. }
  51212. else if (methodName === 'push') {
  51213. index = obj.length-1;
  51214. }
  51215. else if (methodName === 'shift') {
  51216. oldValue = response;
  51217. }
  51218. else if (methodName !== 'unshift' && newValue===undefined) {
  51219. newValue = response;
  51220. }
  51221. callback.call(obj, index, methodName,newValue, oldValue)
  51222. }
  51223. return response;
  51224. });
  51225. };
  51226. var watchFunctions = function(obj, callback) {
  51227. if (!isFunction(callback) || !obj || (obj instanceof String) || (!isArray(obj))) {
  51228. return;
  51229. }
  51230. for (var i = methodNames.length, methodName; i--;) {
  51231. methodName = methodNames[i];
  51232. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  51233. }
  51234. };
  51235. var unwatchOne = function (obj, prop, watcher) {
  51236. if (prop) {
  51237. if (obj.watchers && obj.watchers[prop]) {
  51238. if (watcher === undefined) {
  51239. delete obj.watchers[prop]; // remove all property watchers
  51240. }
  51241. else {
  51242. for (var i = 0; i < obj.watchers[prop].length; i++) {
  51243. var w = obj.watchers[prop][i];
  51244. if (w == watcher) {
  51245. obj.watchers[prop].splice(i, 1);
  51246. }
  51247. }
  51248. }
  51249. }
  51250. } else {
  51251. delete obj.watchers;
  51252. }
  51253. removeFromLengthSubjects(obj, prop, watcher);
  51254. removeFromDirtyChecklist(obj, prop);
  51255. };
  51256. // suspend watchers until next update cycle
  51257. var suspend = function(obj, prop) {
  51258. if (obj.watchers) {
  51259. var name = '__wjs_suspend__'+(prop!==undefined ? prop : '');
  51260. obj.watchers[name] = true;
  51261. }
  51262. }
  51263. var isSuspended = function(obj, prop) {
  51264. return obj.watchers
  51265. && (obj.watchers['__wjs_suspend__'] ||
  51266. obj.watchers['__wjs_suspend__'+prop]);
  51267. }
  51268. // resumes preivously suspended watchers
  51269. var resume = function(obj, prop) {
  51270. registerTimeout(function() {
  51271. delete obj.watchers['__wjs_suspend__'];
  51272. delete obj.watchers['__wjs_suspend__'+prop];
  51273. })
  51274. }
  51275. var pendingTimerID = null;
  51276. var addPendingChange = function(obj,prop, mode, newval, oldval) {
  51277. pendingChanges[pendingChanges.length] = {
  51278. obj:obj,
  51279. prop: prop,
  51280. mode: mode,
  51281. newval: newval,
  51282. oldval: oldval
  51283. };
  51284. if (pendingTimerID===null) {
  51285. pendingTimerID = setTimeout(applyPendingChanges);
  51286. }
  51287. };
  51288. var applyPendingChanges = function() {
  51289. // apply pending changes
  51290. var change = null;
  51291. pendingTimerID = null;
  51292. for(var i=0;i < pendingChanges.length;i++) {
  51293. change = pendingChanges[i];
  51294. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  51295. }
  51296. if (change) {
  51297. pendingChanges = [];
  51298. change = null;
  51299. }
  51300. }
  51301. var loop = function(){
  51302. // check for new or deleted props
  51303. for(var i=0; i<lengthsubjects.length; i++) {
  51304. var subj = lengthsubjects[i];
  51305. if (subj.prop === "$$watchlengthsubjectroot") {
  51306. var difference = getObjDiff(subj.obj, subj.actual);
  51307. if(difference.added.length || difference.removed.length){
  51308. if(difference.added.length){
  51309. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  51310. }
  51311. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  51312. }
  51313. subj.actual = clone(subj.obj);
  51314. } else {
  51315. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  51316. if(difference.added.length || difference.removed.length){
  51317. if(difference.added.length){
  51318. for (var j=0; j<subj.obj.watchers[subj.prop].length; j++) {
  51319. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  51320. }
  51321. }
  51322. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  51323. }
  51324. subj.actual = clone(subj.obj[subj.prop]);
  51325. }
  51326. }
  51327. // start dirty check
  51328. var n, value;
  51329. if (dirtyChecklist.length > 0) {
  51330. for (var i = 0; i < dirtyChecklist.length; i++) {
  51331. n = dirtyChecklist[i];
  51332. value = n.object[n.prop];
  51333. if (!compareValues(n.orig, value)) {
  51334. n.orig = clone(value);
  51335. n.callback(value);
  51336. }
  51337. }
  51338. }
  51339. };
  51340. var compareValues = function(a,b) {
  51341. var i, state = true;
  51342. if (a!==b) {
  51343. if (isObject(a)) {
  51344. for(i in a) {
  51345. if (!supportDefineProperty && i==='watchers') continue;
  51346. if (a[i]!==b[i]) {
  51347. state = false;
  51348. break;
  51349. };
  51350. }
  51351. }
  51352. else {
  51353. state = false;
  51354. }
  51355. }
  51356. return state;
  51357. }
  51358. var pushToLengthSubjects = function(obj, prop, watcher, level){
  51359. var actual;
  51360. if (prop === "$$watchlengthsubjectroot") {
  51361. actual = clone(obj);
  51362. } else {
  51363. actual = clone(obj[prop]);
  51364. }
  51365. lengthsubjects.push({
  51366. obj: obj,
  51367. prop: prop,
  51368. actual: actual,
  51369. watcher: watcher,
  51370. level: level
  51371. });
  51372. };
  51373. var removeFromLengthSubjects = function(obj, prop, watcher){
  51374. for (var i=0; i<lengthsubjects.length; i++) {
  51375. var subj = lengthsubjects[i];
  51376. if (subj.obj == obj) {
  51377. if (!prop || subj.prop == prop) {
  51378. if (!watcher || subj.watcher == watcher) {
  51379. // if we splice off one item at position i
  51380. // we need to decrement i as the array is one item shorter
  51381. // so when we increment i in the loop statement we
  51382. // will land at the correct index.
  51383. // if it's not decremented, you won't delete all length subjects
  51384. lengthsubjects.splice(i--, 1);
  51385. }
  51386. }
  51387. }
  51388. }
  51389. };
  51390. var removeFromDirtyChecklist = function(obj, prop){
  51391. var notInUse;
  51392. for (var i=0; i<dirtyChecklist.length; i++) {
  51393. var n = dirtyChecklist[i];
  51394. var watchers = n.object.watchers;
  51395. notInUse = (
  51396. n.object == obj
  51397. && (!prop || n.prop == prop)
  51398. && watchers
  51399. && (!prop || !watchers[prop] || watchers[prop].length == 0 )
  51400. );
  51401. if (notInUse) {
  51402. // we use the same syntax as in removeFromLengthSubjects
  51403. dirtyChecklist.splice(i--, 1);
  51404. }
  51405. }
  51406. };
  51407. setInterval(loop, 50);
  51408. WatchJS.watch = watch;
  51409. WatchJS.unwatch = unwatch;
  51410. WatchJS.callWatchers = callWatchers;
  51411. WatchJS.suspend = suspend; // suspend watchers
  51412. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  51413. return WatchJS;
  51414. }));
  51415. /***/ }),
  51416. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  51417. /*!******************************************************!*\
  51418. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  51419. \******************************************************/
  51420. /*! no static exports found */
  51421. /***/ (function(module, exports) {
  51422. /***/ })
  51423. /******/ });
  51424. });
  51425. //# sourceMappingURL=ivprog.bundle.js.map