ivprog.bundle.js 2.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120
  1. var ivprogCore =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = "./js/main-sidebar.js");
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ "./grammar/en/ivprog.g4":
  90. /*!******************************!*\
  91. !*** ./grammar/en/ivprog.g4 ***!
  92. \******************************/
  93. /*! no static exports found */
  94. /***/ (function(module, exports, __webpack_require__) {
  95. module.exports =
  96. /******/ (function(modules) { // webpackBootstrap
  97. /******/ // The module cache
  98. /******/ var installedModules = {};
  99. /******/
  100. /******/ // The require function
  101. /******/ function __webpack_require__(moduleId) {
  102. /******/
  103. /******/ // Check if module is in cache
  104. /******/ if(installedModules[moduleId]) {
  105. /******/ return installedModules[moduleId].exports;
  106. /******/ }
  107. /******/ // Create a new module (and put it into the cache)
  108. /******/ var module = installedModules[moduleId] = {
  109. /******/ i: moduleId,
  110. /******/ l: false,
  111. /******/ exports: {}
  112. /******/ };
  113. /******/
  114. /******/ // Execute the module function
  115. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  116. /******/
  117. /******/ // Flag the module as loaded
  118. /******/ module.l = true;
  119. /******/
  120. /******/ // Return the exports of the module
  121. /******/ return module.exports;
  122. /******/ }
  123. /******/
  124. /******/
  125. /******/ // expose the modules object (__webpack_modules__)
  126. /******/ __webpack_require__.m = modules;
  127. /******/
  128. /******/ // expose the module cache
  129. /******/ __webpack_require__.c = installedModules;
  130. /******/
  131. /******/ // identity function for calling harmony imports with the correct context
  132. /******/ __webpack_require__.i = function(value) { return value; };
  133. /******/
  134. /******/ // define getter function for harmony exports
  135. /******/ __webpack_require__.d = function(exports, name, getter) {
  136. /******/ if(!__webpack_require__.o(exports, name)) {
  137. /******/ Object.defineProperty(exports, name, {
  138. /******/ configurable: false,
  139. /******/ enumerable: true,
  140. /******/ get: getter
  141. /******/ });
  142. /******/ }
  143. /******/ };
  144. /******/
  145. /******/ // getDefaultExport function for compatibility with non-harmony modules
  146. /******/ __webpack_require__.n = function(module) {
  147. /******/ var getter = module && module.__esModule ?
  148. /******/ function getDefault() { return module['default']; } :
  149. /******/ function getModuleExports() { return module; };
  150. /******/ __webpack_require__.d(getter, 'a', getter);
  151. /******/ return getter;
  152. /******/ };
  153. /******/
  154. /******/ // Object.prototype.hasOwnProperty.call
  155. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  156. /******/
  157. /******/ // __webpack_public_path__
  158. /******/ __webpack_require__.p = "";
  159. /******/
  160. /******/ // Load entry module and return exports
  161. /******/ return __webpack_require__(__webpack_require__.s = 1);
  162. /******/ })
  163. /************************************************************************/
  164. /******/ ([
  165. /* 0 */
  166. /***/ (function(module, exports, __webpack_require__) {
  167. // Generated from /tmp/tmp-1465KNrg9HFykZTE/ivprog.g4 by ANTLR 4.7
  168. // jshint ignore: start
  169. var antlr4 = __webpack_require__(2);
  170. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  171. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  172. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  173. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  174. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  175. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  176. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  177. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  178. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  179. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  180. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  181. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  182. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  183. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  184. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  185. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  186. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  187. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  188. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  189. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  190. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  191. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  192. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  193. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  194. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  195. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  196. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  197. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  198. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  199. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  200. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  201. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  202. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  203. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  204. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  205. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  206. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  207. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  208. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  209. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  210. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  211. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  212. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  213. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  214. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  215. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  216. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  217. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  218. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  219. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  220. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  221. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  222. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  223. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  224. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  225. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  226. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  227. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  228. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  229. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  230. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  231. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  232. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  233. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  234. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  235. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  236. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  237. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  238. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  239. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  240. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  241. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  242. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  243. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  244. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  245. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  246. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  247. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  248. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  249. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  250. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  251. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  252. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  253. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  254. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  255. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  256. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  257. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  258. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  259. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  260. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  261. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  262. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  263. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  264. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  265. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  266. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  267. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  268. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  269. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  270. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  271. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  272. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  273. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  274. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  275. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  276. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  277. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  278. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  279. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  280. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  281. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  282. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  283. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  284. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  285. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  286. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  287. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  288. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  289. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  290. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  291. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  292. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  293. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  294. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  295. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  296. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  297. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  298. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  299. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  300. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  301. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  302. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  303. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  304. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  305. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  306. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  307. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  308. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  309. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  310. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  311. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  312. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  313. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  314. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  315. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  316. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  317. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  318. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  319. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  320. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  321. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  322. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  323. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  324. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  325. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  326. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  327. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  328. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  329. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  330. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  331. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  332. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  333. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  334. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  335. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  336. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  337. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  338. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  339. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  340. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  341. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  342. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  343. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  344. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  345. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  346. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  347. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  348. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  349. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  350. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  351. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  352. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  353. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  354. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  355. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  356. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  357. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  358. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  359. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  360. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  361. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  362. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  363. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  364. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  365. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  366. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  367. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  368. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  369. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  370. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  371. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  372. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  373. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  374. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  375. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  376. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  377. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  378. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  379. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  380. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  381. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  382. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  383. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  384. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  385. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  386. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  387. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  388. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  389. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  390. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  391. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  392. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  393. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  394. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  395. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  396. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  397. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  398. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  399. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  400. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  401. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  402. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  403. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  404. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  405. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  406. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  407. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  408. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  409. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  410. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  411. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  412. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  413. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  414. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  415. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  416. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  417. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  418. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  419. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  420. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  421. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  422. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  423. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  424. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  425. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  426. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  427. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  428. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  429. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  430. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  431. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  432. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  433. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  434. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  435. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  436. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  437. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  438. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  439. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  440. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  441. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  442. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  443. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  444. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  445. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  446. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  447. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  448. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  449. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  450. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  451. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  452. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  453. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  454. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  455. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  456. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  457. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  458. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  459. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  460. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  461. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  462. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  463. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  464. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  465. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  466. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  467. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  468. function ivprog(input) {
  469. antlr4.Lexer.call(this, input);
  470. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  471. return this;
  472. }
  473. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  474. ivprog.prototype.constructor = ivprog;
  475. ivprog.EOF = antlr4.Token.EOF;
  476. ivprog.RK_PROGRAM = 1;
  477. ivprog.RK_REAL = 2;
  478. ivprog.RK_VOID = 3;
  479. ivprog.RK_BOOLEAN = 4;
  480. ivprog.RK_STRING = 5;
  481. ivprog.RK_INTEGER = 6;
  482. ivprog.RK_CHARACTER = 7;
  483. ivprog.RK_SWITCH = 8;
  484. ivprog.RK_CASE = 9;
  485. ivprog.RK_DEFAULT = 10;
  486. ivprog.RK_CONST = 11;
  487. ivprog.RK_FUNCTION = 12;
  488. ivprog.RK_RETURN = 13;
  489. ivprog.RK_FOR = 14;
  490. ivprog.RK_BREAK = 15;
  491. ivprog.RK_DO = 16;
  492. ivprog.RK_WHILE = 17;
  493. ivprog.RK_IF = 18;
  494. ivprog.RK_ELSE = 19;
  495. ivprog.RK_FALSE = 20;
  496. ivprog.RK_TRUE = 21;
  497. ivprog.OPEN_PARENTHESIS = 22;
  498. ivprog.CLOSE_PARENTHESIS = 23;
  499. ivprog.OPEN_BRACE = 24;
  500. ivprog.CLOSE_BRACE = 25;
  501. ivprog.OPEN_CURLY = 26;
  502. ivprog.CLOSE_CURLY = 27;
  503. ivprog.COMMA = 28;
  504. ivprog.EQUAL = 29;
  505. ivprog.SUM_OP = 30;
  506. ivprog.MULTI_OP = 31;
  507. ivprog.AND_OPERATOR = 32;
  508. ivprog.OR_OPERATOR = 33;
  509. ivprog.RELATIONAL_OPERATOR = 34;
  510. ivprog.COLON = 35;
  511. ivprog.NOT_OPERATOR = 36;
  512. ivprog.ID = 37;
  513. ivprog.LIB_ID = 38;
  514. ivprog.INTEGER = 39;
  515. ivprog.REAL = 40;
  516. ivprog.STRING = 41;
  517. ivprog.CHARACTER = 42;
  518. ivprog.WHITESPACE = 43;
  519. ivprog.EOS = 44;
  520. ivprog.COMMENTS = 45;
  521. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  522. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  523. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  524. "'boolean'", "'string'", "'integer'",
  525. "'character'", "'switch'", "'case'", "'otherwise'",
  526. "'const'", "'function'", "'return'", "'for'",
  527. "'break'", "'do'", "'while'", "'if'",
  528. "'else'", "'false'", "'true'", "'('",
  529. "')'", "'['", "']'", "'{'", "'}'", "','",
  530. "'='", null, null, null, null, null, "':'" ];
  531. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  532. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  533. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  534. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  535. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  536. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  537. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  538. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  539. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  540. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  541. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  542. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  543. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  544. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  545. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  546. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  547. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  548. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  549. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  550. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  551. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  552. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  553. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  554. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  555. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  556. "STRING", "STRING_CHARACTER", "CHARACTER",
  557. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  558. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  559. "COMMENTS" ];
  560. ivprog.prototype.grammarFileName = "ivprog.g4";
  561. exports.ivprog = ivprog;
  562. /***/ }),
  563. /* 1 */
  564. /***/ (function(module, exports, __webpack_require__) {
  565. module.exports = {
  566. ivprog: __webpack_require__(0).ivprog
  567. };
  568. /***/ }),
  569. /* 2 */
  570. /***/ (function(module, exports) {
  571. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  572. /***/ })
  573. /******/ ]);
  574. /***/ }),
  575. /***/ "./grammar/en/langFunctions.js":
  576. /*!*************************************!*\
  577. !*** ./grammar/en/langFunctions.js ***!
  578. \*************************************/
  579. /*! no static exports found */
  580. /***/ (function(module, exports, __webpack_require__) {
  581. "use strict";
  582. Object.defineProperty(exports, "__esModule", {
  583. value: true
  584. });
  585. /* This is a dictionary of the language defined functions
  586. **/
  587. exports.default = {
  588. main_function: "start",
  589. $read: "read",
  590. $write: "write",
  591. $numElements: "total_of_elements",
  592. $matrixLines: "total_of_lines",
  593. $matrixColumns: "total_of_columns",
  594. $substring: "subcadeia",
  595. $length: "comprimento",
  596. $uppercase: "caixa_alta",
  597. $lowercase: "caixa_baixa",
  598. $charAt: "char_at",
  599. $isReal: "is_real",
  600. $isInt: "is_integer",
  601. $isBool: "is_logic",
  602. $castReal: "to_real",
  603. $castInt: "to_integer",
  604. $castBool: "to_logic",
  605. $castString: "to_string",
  606. $sin: "sin",
  607. $cos: "cos",
  608. $tan: "tan",
  609. $sqrt: "sqrt",
  610. $pow: "pow",
  611. $log: "log",
  612. $abs: "abs",
  613. $negate: "negate",
  614. $invert: "invert",
  615. $max: "maximum",
  616. $min: "minimum"
  617. };
  618. /***/ }),
  619. /***/ "./grammar/en/langLibs.js":
  620. /*!********************************!*\
  621. !*** ./grammar/en/langLibs.js ***!
  622. \********************************/
  623. /*! no static exports found */
  624. /***/ (function(module, exports, __webpack_require__) {
  625. "use strict";
  626. Object.defineProperty(exports, "__esModule", {
  627. value: true
  628. });
  629. /**
  630. * This is the dictionary of the language defined libraries
  631. */
  632. exports.default = {
  633. $mathLib: "Mathematic",
  634. $ioLib: "ES",
  635. $strLib: "Texto",
  636. $arrayLib: "Arranjo",
  637. $langLib: "Conversion"
  638. };
  639. /***/ }),
  640. /***/ "./grammar/es/ivprog.g4":
  641. /*!******************************!*\
  642. !*** ./grammar/es/ivprog.g4 ***!
  643. \******************************/
  644. /*! no static exports found */
  645. /***/ (function(module, exports, __webpack_require__) {
  646. module.exports =
  647. /******/ (function(modules) { // webpackBootstrap
  648. /******/ // The module cache
  649. /******/ var installedModules = {};
  650. /******/
  651. /******/ // The require function
  652. /******/ function __webpack_require__(moduleId) {
  653. /******/
  654. /******/ // Check if module is in cache
  655. /******/ if(installedModules[moduleId]) {
  656. /******/ return installedModules[moduleId].exports;
  657. /******/ }
  658. /******/ // Create a new module (and put it into the cache)
  659. /******/ var module = installedModules[moduleId] = {
  660. /******/ i: moduleId,
  661. /******/ l: false,
  662. /******/ exports: {}
  663. /******/ };
  664. /******/
  665. /******/ // Execute the module function
  666. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  667. /******/
  668. /******/ // Flag the module as loaded
  669. /******/ module.l = true;
  670. /******/
  671. /******/ // Return the exports of the module
  672. /******/ return module.exports;
  673. /******/ }
  674. /******/
  675. /******/
  676. /******/ // expose the modules object (__webpack_modules__)
  677. /******/ __webpack_require__.m = modules;
  678. /******/
  679. /******/ // expose the module cache
  680. /******/ __webpack_require__.c = installedModules;
  681. /******/
  682. /******/ // identity function for calling harmony imports with the correct context
  683. /******/ __webpack_require__.i = function(value) { return value; };
  684. /******/
  685. /******/ // define getter function for harmony exports
  686. /******/ __webpack_require__.d = function(exports, name, getter) {
  687. /******/ if(!__webpack_require__.o(exports, name)) {
  688. /******/ Object.defineProperty(exports, name, {
  689. /******/ configurable: false,
  690. /******/ enumerable: true,
  691. /******/ get: getter
  692. /******/ });
  693. /******/ }
  694. /******/ };
  695. /******/
  696. /******/ // getDefaultExport function for compatibility with non-harmony modules
  697. /******/ __webpack_require__.n = function(module) {
  698. /******/ var getter = module && module.__esModule ?
  699. /******/ function getDefault() { return module['default']; } :
  700. /******/ function getModuleExports() { return module; };
  701. /******/ __webpack_require__.d(getter, 'a', getter);
  702. /******/ return getter;
  703. /******/ };
  704. /******/
  705. /******/ // Object.prototype.hasOwnProperty.call
  706. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  707. /******/
  708. /******/ // __webpack_public_path__
  709. /******/ __webpack_require__.p = "";
  710. /******/
  711. /******/ // Load entry module and return exports
  712. /******/ return __webpack_require__(__webpack_require__.s = 1);
  713. /******/ })
  714. /************************************************************************/
  715. /******/ ([
  716. /* 0 */
  717. /***/ (function(module, exports, __webpack_require__) {
  718. // Generated from /tmp/tmp-1465XQfIrrl8N0nK/ivprog.g4 by ANTLR 4.7
  719. // jshint ignore: start
  720. var antlr4 = __webpack_require__(2);
  721. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  722. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  723. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  724. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  725. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  726. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  727. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  728. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  729. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  730. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  731. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  732. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  733. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  734. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  735. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  736. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  737. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  738. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  739. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  740. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  741. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  742. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  743. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  744. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  745. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  746. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  747. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  748. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  749. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  750. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  751. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  752. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  753. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  754. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  755. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  756. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  757. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  758. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  759. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  760. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  761. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  762. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  763. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  764. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  765. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  766. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  767. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  768. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  769. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  770. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  771. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  772. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  773. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  774. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  775. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  776. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  777. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  778. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  779. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  780. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  781. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  782. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  783. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  784. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  785. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  786. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  787. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  788. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  789. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  790. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  791. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  792. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  793. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  794. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  795. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  796. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  797. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  798. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  799. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  800. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  801. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  802. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  803. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  804. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  805. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  806. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  807. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  808. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  809. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  810. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  811. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  812. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  813. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  814. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  815. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  816. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  817. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  818. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  819. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  820. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  821. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  822. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  823. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  824. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  825. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  826. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  827. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  828. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  829. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  830. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  831. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  832. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  833. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  834. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  835. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  836. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  837. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  838. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  839. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  840. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  841. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  842. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  843. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  844. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  845. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  846. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  847. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  848. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  849. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  850. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  851. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  852. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  853. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  854. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  855. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  856. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  857. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  858. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  859. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  860. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  861. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  862. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  863. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  864. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  865. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  866. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  867. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  868. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  869. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  870. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  871. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  872. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  873. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  874. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  875. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  876. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  877. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  878. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  879. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  880. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  881. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  882. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  883. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  884. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  885. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  886. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  887. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  888. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  889. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  890. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  891. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  892. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  893. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  894. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  895. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  896. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  897. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  898. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  899. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  900. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  901. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  902. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  903. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  904. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  905. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  906. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  907. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  908. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  909. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  910. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  911. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  912. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  913. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  914. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  915. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  916. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  917. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  918. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  919. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  920. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  921. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  922. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  923. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  924. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  925. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  926. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  927. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  928. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  929. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  930. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  931. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  932. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  933. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  934. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  935. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  936. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  937. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  938. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  939. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  940. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  941. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  942. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  943. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  944. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  945. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  946. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  947. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  948. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  949. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  950. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  951. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  952. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  953. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  954. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  955. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  956. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  957. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  958. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  959. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  960. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  961. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  962. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  963. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  964. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  965. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  966. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  967. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  968. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  969. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  970. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  971. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  972. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  973. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  974. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  975. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  976. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  977. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  978. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  979. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  980. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  981. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  982. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  983. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  984. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  985. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  986. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  987. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  988. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  989. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  990. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  991. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  992. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  993. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  994. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  995. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  996. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  997. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  998. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  999. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1000. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1001. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1002. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1003. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1004. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1005. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1006. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1007. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1008. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1009. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1010. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1011. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1012. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1013. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1014. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1015. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1016. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1017. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1018. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1019. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1020. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1021. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1022. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1023. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1024. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1025. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1026. function ivprog(input) {
  1027. antlr4.Lexer.call(this, input);
  1028. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1029. return this;
  1030. }
  1031. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1032. ivprog.prototype.constructor = ivprog;
  1033. ivprog.EOF = antlr4.Token.EOF;
  1034. ivprog.RK_PROGRAM = 1;
  1035. ivprog.RK_REAL = 2;
  1036. ivprog.RK_VOID = 3;
  1037. ivprog.RK_BOOLEAN = 4;
  1038. ivprog.RK_STRING = 5;
  1039. ivprog.RK_INTEGER = 6;
  1040. ivprog.RK_CHARACTER = 7;
  1041. ivprog.RK_SWITCH = 8;
  1042. ivprog.RK_CASE = 9;
  1043. ivprog.RK_DEFAULT = 10;
  1044. ivprog.RK_CONST = 11;
  1045. ivprog.RK_FUNCTION = 12;
  1046. ivprog.RK_RETURN = 13;
  1047. ivprog.RK_FOR = 14;
  1048. ivprog.RK_BREAK = 15;
  1049. ivprog.RK_DO = 16;
  1050. ivprog.RK_WHILE = 17;
  1051. ivprog.RK_IF = 18;
  1052. ivprog.RK_ELSE = 19;
  1053. ivprog.RK_FALSE = 20;
  1054. ivprog.RK_TRUE = 21;
  1055. ivprog.OPEN_PARENTHESIS = 22;
  1056. ivprog.CLOSE_PARENTHESIS = 23;
  1057. ivprog.OPEN_BRACE = 24;
  1058. ivprog.CLOSE_BRACE = 25;
  1059. ivprog.OPEN_CURLY = 26;
  1060. ivprog.CLOSE_CURLY = 27;
  1061. ivprog.COMMA = 28;
  1062. ivprog.EQUAL = 29;
  1063. ivprog.SUM_OP = 30;
  1064. ivprog.MULTI_OP = 31;
  1065. ivprog.AND_OPERATOR = 32;
  1066. ivprog.OR_OPERATOR = 33;
  1067. ivprog.RELATIONAL_OPERATOR = 34;
  1068. ivprog.COLON = 35;
  1069. ivprog.NOT_OPERATOR = 36;
  1070. ivprog.ID = 37;
  1071. ivprog.LIB_ID = 38;
  1072. ivprog.INTEGER = 39;
  1073. ivprog.REAL = 40;
  1074. ivprog.STRING = 41;
  1075. ivprog.CHARACTER = 42;
  1076. ivprog.WHITESPACE = 43;
  1077. ivprog.EOS = 44;
  1078. ivprog.COMMENTS = 45;
  1079. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1080. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1081. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1082. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1083. "'escolha'", "'caso'", "'contrario'",
  1084. "'const'", "'funcao'", "'retorne'", "'para'",
  1085. "'pare'", "'faca'", "'enquanto'", "'se'",
  1086. "'senao'", "'falso'", "'verdadeiro'",
  1087. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1088. "','", "'='", null, null, null, null,
  1089. null, "':'" ];
  1090. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1091. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1092. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1093. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1094. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1095. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1096. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1097. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1098. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1099. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1100. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1101. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1102. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1103. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1104. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1105. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1106. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1107. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1108. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1109. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1110. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1111. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1112. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1113. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1114. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1115. "STRING", "STRING_CHARACTER", "CHARACTER",
  1116. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1117. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1118. "COMMENTS" ];
  1119. ivprog.prototype.grammarFileName = "ivprog.g4";
  1120. exports.ivprog = ivprog;
  1121. /***/ }),
  1122. /* 1 */
  1123. /***/ (function(module, exports, __webpack_require__) {
  1124. module.exports = {
  1125. ivprog: __webpack_require__(0).ivprog
  1126. };
  1127. /***/ }),
  1128. /* 2 */
  1129. /***/ (function(module, exports) {
  1130. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1131. /***/ })
  1132. /******/ ]);
  1133. /***/ }),
  1134. /***/ "./grammar/es/langFunctions.js":
  1135. /*!*************************************!*\
  1136. !*** ./grammar/es/langFunctions.js ***!
  1137. \*************************************/
  1138. /*! no static exports found */
  1139. /***/ (function(module, exports, __webpack_require__) {
  1140. "use strict";
  1141. Object.defineProperty(exports, "__esModule", {
  1142. value: true
  1143. });
  1144. /* This is a dictionary of the language defined functions
  1145. **/
  1146. exports.default = {
  1147. main_function: "inicio",
  1148. $read: "leia",
  1149. $write: "escreva",
  1150. $numElements: "total_of_elements",
  1151. $matrixLines: "total_of_lines",
  1152. $matrixColumns: "total_of_columns",
  1153. $substring: "subcadeia",
  1154. $length: "comprimento",
  1155. $uppercase: "caixa_alta",
  1156. $lowercase: "caixa_baixa",
  1157. $charAt: "char_at",
  1158. $isReal: "is_real",
  1159. $isInt: "is_integer",
  1160. $isBool: "is_logic",
  1161. $castReal: "to_real",
  1162. $castInt: "to_integer",
  1163. $castBool: "to_logic",
  1164. $castString: "to_string",
  1165. $sin: "sin",
  1166. $cos: "cos",
  1167. $tan: "tan",
  1168. $sqrt: "sqrt",
  1169. $pow: "pow",
  1170. $log: "log",
  1171. $abs: "abs",
  1172. $negate: "negate",
  1173. $invert: "invert",
  1174. $max: "maximum",
  1175. $min: "minimum"
  1176. };
  1177. /***/ }),
  1178. /***/ "./grammar/es/langLibs.js":
  1179. /*!********************************!*\
  1180. !*** ./grammar/es/langLibs.js ***!
  1181. \********************************/
  1182. /*! no static exports found */
  1183. /***/ (function(module, exports, __webpack_require__) {
  1184. "use strict";
  1185. Object.defineProperty(exports, "__esModule", {
  1186. value: true
  1187. });
  1188. /**
  1189. * This is the dictionary of the language defined libraries
  1190. */
  1191. exports.default = {
  1192. $mathLib: "Mathematic",
  1193. $ioLib: "ES",
  1194. $strLib: "Texto",
  1195. $arrayLib: "Arranjo",
  1196. $langLib: "Conversion"
  1197. };
  1198. /***/ }),
  1199. /***/ "./grammar/index.js":
  1200. /*!**************************!*\
  1201. !*** ./grammar/index.js ***!
  1202. \**************************/
  1203. /*! no static exports found */
  1204. /***/ (function(module, exports, __webpack_require__) {
  1205. "use strict";
  1206. var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1207. var PT = _interopRequireWildcard(_ivprog);
  1208. var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1209. var _langFunctions2 = _interopRequireDefault(_langFunctions);
  1210. var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1211. var _langLibs2 = _interopRequireDefault(_langLibs);
  1212. var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1213. var EN = _interopRequireWildcard(_ivprog2);
  1214. var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1215. var _langFunctions4 = _interopRequireDefault(_langFunctions3);
  1216. var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1217. var _langLibs4 = _interopRequireDefault(_langLibs3);
  1218. var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1219. var ES = _interopRequireWildcard(_ivprog3);
  1220. var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1221. var _langFunctions6 = _interopRequireDefault(_langFunctions5);
  1222. var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1223. var _langLibs6 = _interopRequireDefault(_langLibs5);
  1224. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1225. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1226. exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default };
  1227. exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default };
  1228. exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default };
  1229. /***/ }),
  1230. /***/ "./grammar/pt/ivprog.g4":
  1231. /*!******************************!*\
  1232. !*** ./grammar/pt/ivprog.g4 ***!
  1233. \******************************/
  1234. /*! no static exports found */
  1235. /***/ (function(module, exports, __webpack_require__) {
  1236. module.exports =
  1237. /******/ (function(modules) { // webpackBootstrap
  1238. /******/ // The module cache
  1239. /******/ var installedModules = {};
  1240. /******/
  1241. /******/ // The require function
  1242. /******/ function __webpack_require__(moduleId) {
  1243. /******/
  1244. /******/ // Check if module is in cache
  1245. /******/ if(installedModules[moduleId]) {
  1246. /******/ return installedModules[moduleId].exports;
  1247. /******/ }
  1248. /******/ // Create a new module (and put it into the cache)
  1249. /******/ var module = installedModules[moduleId] = {
  1250. /******/ i: moduleId,
  1251. /******/ l: false,
  1252. /******/ exports: {}
  1253. /******/ };
  1254. /******/
  1255. /******/ // Execute the module function
  1256. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1257. /******/
  1258. /******/ // Flag the module as loaded
  1259. /******/ module.l = true;
  1260. /******/
  1261. /******/ // Return the exports of the module
  1262. /******/ return module.exports;
  1263. /******/ }
  1264. /******/
  1265. /******/
  1266. /******/ // expose the modules object (__webpack_modules__)
  1267. /******/ __webpack_require__.m = modules;
  1268. /******/
  1269. /******/ // expose the module cache
  1270. /******/ __webpack_require__.c = installedModules;
  1271. /******/
  1272. /******/ // identity function for calling harmony imports with the correct context
  1273. /******/ __webpack_require__.i = function(value) { return value; };
  1274. /******/
  1275. /******/ // define getter function for harmony exports
  1276. /******/ __webpack_require__.d = function(exports, name, getter) {
  1277. /******/ if(!__webpack_require__.o(exports, name)) {
  1278. /******/ Object.defineProperty(exports, name, {
  1279. /******/ configurable: false,
  1280. /******/ enumerable: true,
  1281. /******/ get: getter
  1282. /******/ });
  1283. /******/ }
  1284. /******/ };
  1285. /******/
  1286. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1287. /******/ __webpack_require__.n = function(module) {
  1288. /******/ var getter = module && module.__esModule ?
  1289. /******/ function getDefault() { return module['default']; } :
  1290. /******/ function getModuleExports() { return module; };
  1291. /******/ __webpack_require__.d(getter, 'a', getter);
  1292. /******/ return getter;
  1293. /******/ };
  1294. /******/
  1295. /******/ // Object.prototype.hasOwnProperty.call
  1296. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1297. /******/
  1298. /******/ // __webpack_public_path__
  1299. /******/ __webpack_require__.p = "";
  1300. /******/
  1301. /******/ // Load entry module and return exports
  1302. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1303. /******/ })
  1304. /************************************************************************/
  1305. /******/ ([
  1306. /* 0 */
  1307. /***/ (function(module, exports, __webpack_require__) {
  1308. // Generated from /tmp/tmp-1465XUiBC5WZWhuH/ivprog.g4 by ANTLR 4.7
  1309. // jshint ignore: start
  1310. var antlr4 = __webpack_require__(2);
  1311. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1312. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1313. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1314. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1315. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1316. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1317. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1318. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1319. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1320. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1321. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1322. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1323. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1324. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1325. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1326. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1327. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1328. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1329. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1330. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1331. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1332. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1333. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1334. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1335. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1336. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1337. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1338. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1339. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1340. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1341. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1342. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1343. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1344. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1345. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1346. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1347. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1348. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1349. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1350. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1351. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1352. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1353. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1354. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1355. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1356. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1357. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1358. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1359. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1360. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1361. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1362. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1363. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1364. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1365. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1366. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1367. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1368. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1369. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1370. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1371. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1372. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1373. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1374. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1375. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1376. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1377. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1378. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1379. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1380. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1381. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1382. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1383. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1384. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1385. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1386. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1387. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1388. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1389. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1390. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1391. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1392. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1393. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1394. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1395. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1396. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1397. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1398. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1399. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1400. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1401. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1402. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1403. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1404. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1405. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1406. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1407. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1408. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1409. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1410. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1411. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1412. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1413. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1414. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1415. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1416. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1417. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1418. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1419. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1420. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1421. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1422. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1423. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1424. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1425. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1426. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1427. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1428. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1429. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1430. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1431. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1432. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1433. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1434. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1435. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1436. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1437. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1438. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1439. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1440. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1441. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1442. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1443. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1444. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1445. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1446. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1447. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1448. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1449. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1450. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1451. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1452. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1453. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1454. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1455. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1456. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1457. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1458. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1459. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1460. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1461. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1462. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1463. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1464. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1465. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1466. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1467. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1468. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1469. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1470. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1471. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1472. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1473. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1474. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1475. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1476. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1477. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1478. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1479. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1480. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1481. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1482. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1483. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1484. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1485. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1486. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1487. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1488. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1489. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1490. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1491. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1492. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1493. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1494. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1495. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1496. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1497. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1498. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1499. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1500. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1501. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1502. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1503. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1504. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1505. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1506. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1507. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1508. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1509. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1510. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1511. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1512. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1513. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1514. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1515. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1516. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1517. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1518. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1519. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1520. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1521. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1522. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1523. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1524. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1525. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1526. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1527. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1528. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1529. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1530. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1531. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1532. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1533. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1534. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1535. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1536. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1537. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1538. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1539. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1540. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1541. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1542. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1543. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1544. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1545. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1546. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1547. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1548. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1549. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1550. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1551. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1552. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1553. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1554. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1555. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1556. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1557. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1558. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1559. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1560. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1561. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1562. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1563. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1564. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1565. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1566. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1567. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1568. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1569. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1570. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1571. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1572. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1573. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1574. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1575. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1576. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1577. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1578. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1579. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1580. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1581. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1582. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1583. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1584. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1585. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1586. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1587. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1588. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1589. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1590. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1591. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1592. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1593. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1594. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1595. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1596. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1597. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1598. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1599. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1600. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1601. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1602. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1603. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1604. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1605. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1606. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1607. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1608. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1609. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1610. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1611. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1612. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1613. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1614. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1615. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1616. function ivprog(input) {
  1617. antlr4.Lexer.call(this, input);
  1618. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1619. return this;
  1620. }
  1621. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1622. ivprog.prototype.constructor = ivprog;
  1623. ivprog.EOF = antlr4.Token.EOF;
  1624. ivprog.RK_PROGRAM = 1;
  1625. ivprog.RK_REAL = 2;
  1626. ivprog.RK_VOID = 3;
  1627. ivprog.RK_BOOLEAN = 4;
  1628. ivprog.RK_STRING = 5;
  1629. ivprog.RK_INTEGER = 6;
  1630. ivprog.RK_CHARACTER = 7;
  1631. ivprog.RK_SWITCH = 8;
  1632. ivprog.RK_CASE = 9;
  1633. ivprog.RK_DEFAULT = 10;
  1634. ivprog.RK_CONST = 11;
  1635. ivprog.RK_FUNCTION = 12;
  1636. ivprog.RK_RETURN = 13;
  1637. ivprog.RK_FOR = 14;
  1638. ivprog.RK_BREAK = 15;
  1639. ivprog.RK_DO = 16;
  1640. ivprog.RK_WHILE = 17;
  1641. ivprog.RK_IF = 18;
  1642. ivprog.RK_ELSE = 19;
  1643. ivprog.RK_FALSE = 20;
  1644. ivprog.RK_TRUE = 21;
  1645. ivprog.OPEN_PARENTHESIS = 22;
  1646. ivprog.CLOSE_PARENTHESIS = 23;
  1647. ivprog.OPEN_BRACE = 24;
  1648. ivprog.CLOSE_BRACE = 25;
  1649. ivprog.OPEN_CURLY = 26;
  1650. ivprog.CLOSE_CURLY = 27;
  1651. ivprog.COMMA = 28;
  1652. ivprog.EQUAL = 29;
  1653. ivprog.SUM_OP = 30;
  1654. ivprog.MULTI_OP = 31;
  1655. ivprog.AND_OPERATOR = 32;
  1656. ivprog.OR_OPERATOR = 33;
  1657. ivprog.RELATIONAL_OPERATOR = 34;
  1658. ivprog.COLON = 35;
  1659. ivprog.NOT_OPERATOR = 36;
  1660. ivprog.ID = 37;
  1661. ivprog.LIB_ID = 38;
  1662. ivprog.INTEGER = 39;
  1663. ivprog.REAL = 40;
  1664. ivprog.STRING = 41;
  1665. ivprog.CHARACTER = 42;
  1666. ivprog.WHITESPACE = 43;
  1667. ivprog.EOS = 44;
  1668. ivprog.COMMENTS = 45;
  1669. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1670. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1671. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1672. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1673. "'escolha'", "'caso'", "'contrario'",
  1674. "'const'", "'funcao'", "'retorne'", "'para'",
  1675. "'pare'", "'faca'", "'enquanto'", "'se'",
  1676. "'senao'", "'falso'", "'verdadeiro'",
  1677. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1678. "','", "'='", null, null, null, null,
  1679. null, "':'" ];
  1680. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1681. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1682. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1683. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1684. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1685. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1686. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1687. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1688. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1689. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1690. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1691. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1692. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1693. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1694. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1695. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1696. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1697. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1698. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1699. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1700. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1701. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1702. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1703. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1704. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1705. "STRING", "STRING_CHARACTER", "CHARACTER",
  1706. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1707. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1708. "COMMENTS" ];
  1709. ivprog.prototype.grammarFileName = "ivprog.g4";
  1710. exports.ivprog = ivprog;
  1711. /***/ }),
  1712. /* 1 */
  1713. /***/ (function(module, exports, __webpack_require__) {
  1714. module.exports = {
  1715. ivprog: __webpack_require__(0).ivprog
  1716. };
  1717. /***/ }),
  1718. /* 2 */
  1719. /***/ (function(module, exports) {
  1720. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1721. /***/ })
  1722. /******/ ]);
  1723. /***/ }),
  1724. /***/ "./grammar/pt/langFunctions.js":
  1725. /*!*************************************!*\
  1726. !*** ./grammar/pt/langFunctions.js ***!
  1727. \*************************************/
  1728. /*! no static exports found */
  1729. /***/ (function(module, exports, __webpack_require__) {
  1730. "use strict";
  1731. Object.defineProperty(exports, "__esModule", {
  1732. value: true
  1733. });
  1734. /* This is a dictionary of the language defined functions
  1735. **/
  1736. exports.default = {
  1737. main_function: "inicio",
  1738. $read: "leia",
  1739. $write: "escreva",
  1740. $numElements: "total_de_elementos",
  1741. $matrixLines: "total_de_linhas",
  1742. $matrixColumns: "total_de_colunas",
  1743. $substring: "subcadeia",
  1744. $length: "comprimento",
  1745. $uppercase: "caixa_alta",
  1746. $lowercase: "caixa_baixa",
  1747. $charAt: "char_at",
  1748. $isReal: "e_real",
  1749. $isInt: "e_inteiro",
  1750. $isBool: "e_logico",
  1751. $castReal: "como_real",
  1752. $castInt: "como_inteiro",
  1753. $castBool: "como_logico",
  1754. $castString: "como_cadeia",
  1755. $sin: "seno",
  1756. $cos: "cosseno",
  1757. $tan: "tangente",
  1758. $sqrt: "raiz_quadrada",
  1759. $pow: "potencia",
  1760. $log: "logaritmo",
  1761. $abs: "modulo",
  1762. $negate: "trocar_sinal",
  1763. $invert: "inverter_valor",
  1764. $max: "maximo",
  1765. $min: "minimo"
  1766. };
  1767. /***/ }),
  1768. /***/ "./grammar/pt/langLibs.js":
  1769. /*!********************************!*\
  1770. !*** ./grammar/pt/langLibs.js ***!
  1771. \********************************/
  1772. /*! no static exports found */
  1773. /***/ (function(module, exports, __webpack_require__) {
  1774. "use strict";
  1775. Object.defineProperty(exports, "__esModule", {
  1776. value: true
  1777. });
  1778. /**
  1779. * This is the dictionary of the language defined libraries
  1780. */
  1781. exports.default = {
  1782. $mathLib: "Matematica",
  1783. $ioLib: "ES",
  1784. $strLib: "Texto",
  1785. $arrayLib: "Arranjo",
  1786. $langLib: "Conversao"
  1787. };
  1788. /***/ }),
  1789. /***/ "./i18n/en/error.json":
  1790. /*!****************************!*\
  1791. !*** ./i18n/en/error.json ***!
  1792. \****************************/
  1793. /*! 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, id_missing, main_missing, invalid_global_var, not_implemented, function_missing, invalid_parameters_size, invalid_ref, invalid_parameter_type, unknown_command, loop_condition_type, if_condition_type, invalid_return_type, unexpected_break_command, invalid_dimension, void_in_expression, invalid_array, invalid_array_access, column_outbounds, line_outbounds, invalid_infix_op, invalid_unary_op, unknown_op, default */
  1794. /***/ (function(module) {
  1795. 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.","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","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","invalid_parameters_size":"A quantidade de parâmetros fornecidos está incorreta. Esperava-se $0, encontrou-se $1","invalid_ref":"Você deve fornecer apenas um identificador como parâmetro","invalid_parameter_type":"O valor fornecido como parâmetro é do tipo $0, mas o tipo esperado é $1","unknown_command":"Erro interno crítico: Comando desconhecido encontrado","loop_condition_type":"A condição dos laços de repetição deve ser do tipo lógico","if_condition_type":"A condição de um comando se...senao deve ser do tipo lógico","invalid_return_type":"A função $0 deve retornar um tipo $1, ao invés de $1","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":"A função $0 não pode ser utilizada aqui pois seu tipo de retorno é vazio","invalid_array":"Expressão literal de Vetor/Mariz inválida","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","line_outbounds":"Número de linhas $0 é invaálido para a matriz $1 que possui $2 linhas","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $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"};
  1796. /***/ }),
  1797. /***/ "./i18n/en/index.js":
  1798. /*!**************************!*\
  1799. !*** ./i18n/en/index.js ***!
  1800. \**************************/
  1801. /*! no static exports found */
  1802. /***/ (function(module, exports, __webpack_require__) {
  1803. "use strict";
  1804. Object.defineProperty(exports, "__esModule", {
  1805. value: true
  1806. });
  1807. var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1808. var _error2 = _interopRequireDefault(_error);
  1809. var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1810. var _message2 = _interopRequireDefault(_message);
  1811. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1812. var _ui2 = _interopRequireDefault(_ui);
  1813. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1814. exports.default = {
  1815. 'message': _message2.default,
  1816. 'error': _error2.default,
  1817. 'ui': _ui2.default
  1818. };
  1819. /***/ }),
  1820. /***/ "./i18n/en/message.json":
  1821. /*!******************************!*\
  1822. !*** ./i18n/en/message.json ***!
  1823. \******************************/
  1824. /*! exports provided: default */
  1825. /***/ (function(module) {
  1826. module.exports = {};
  1827. /***/ }),
  1828. /***/ "./i18n/en/ui.json":
  1829. /*!*************************!*\
  1830. !*** ./i18n/en/ui.json ***!
  1831. \*************************/
  1832. /*! 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 */
  1833. /***/ (function(module) {
  1834. 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 2018_12_19 Build 13_18"};
  1835. /***/ }),
  1836. /***/ "./i18n/es/error.json":
  1837. /*!****************************!*\
  1838. !*** ./i18n/es/error.json ***!
  1839. \****************************/
  1840. /*! exports provided: default */
  1841. /***/ (function(module) {
  1842. module.exports = {};
  1843. /***/ }),
  1844. /***/ "./i18n/es/index.js":
  1845. /*!**************************!*\
  1846. !*** ./i18n/es/index.js ***!
  1847. \**************************/
  1848. /*! no static exports found */
  1849. /***/ (function(module, exports, __webpack_require__) {
  1850. "use strict";
  1851. Object.defineProperty(exports, "__esModule", {
  1852. value: true
  1853. });
  1854. var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1855. var _error2 = _interopRequireDefault(_error);
  1856. var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1857. var _message2 = _interopRequireDefault(_message);
  1858. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1859. var _ui2 = _interopRequireDefault(_ui);
  1860. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1861. exports.default = {
  1862. 'message': _message2.default,
  1863. 'error': _error2.default,
  1864. 'ui': _ui2.default
  1865. };
  1866. /***/ }),
  1867. /***/ "./i18n/es/message.json":
  1868. /*!******************************!*\
  1869. !*** ./i18n/es/message.json ***!
  1870. \******************************/
  1871. /*! exports provided: default */
  1872. /***/ (function(module) {
  1873. module.exports = {};
  1874. /***/ }),
  1875. /***/ "./i18n/es/ui.json":
  1876. /*!*************************!*\
  1877. !*** ./i18n/es/ui.json ***!
  1878. \*************************/
  1879. /*! 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_break, text_else, text_return, text_btn_return, 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, $sin, math, arrangement, conversion, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, text_t, $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 */
  1880. /***/ (function(module) {
  1881. 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":"Text","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_break":"break","text_else":"else","text_return":"return","text_btn_return":"Return","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_repeatNtimes":"Repeat N times","text_receives":"receives","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":"Mathematics","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","$sin":"sin","math":"Mathematic","arrangement":"Arrangement","conversion":"Conversion","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.","text_t":"Text","$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 2018_12_19 Build 13_18"};
  1882. /***/ }),
  1883. /***/ "./i18n/index.js":
  1884. /*!***********************!*\
  1885. !*** ./i18n/index.js ***!
  1886. \***********************/
  1887. /*! no static exports found */
  1888. /***/ (function(module, exports, __webpack_require__) {
  1889. "use strict";
  1890. Object.defineProperty(exports, "__esModule", {
  1891. value: true
  1892. });
  1893. var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1894. var _en2 = _interopRequireDefault(_en);
  1895. var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1896. var _pt2 = _interopRequireDefault(_pt);
  1897. var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1898. var _es2 = _interopRequireDefault(_es);
  1899. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1900. exports.default = {
  1901. 'en': _en2.default,
  1902. 'pt': _pt2.default,
  1903. 'es': _es2.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, 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 dos laços de repetição deve ser do tipo lógico","loop_condition_type":"A condição dos laços 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 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição de um comando se...senao deve ser do tipo lógico","if_condition_type":"A condição de um 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."};
  1913. /***/ }),
  1914. /***/ "./i18n/pt/index.js":
  1915. /*!**************************!*\
  1916. !*** ./i18n/pt/index.js ***!
  1917. \**************************/
  1918. /*! no static exports found */
  1919. /***/ (function(module, exports, __webpack_require__) {
  1920. "use strict";
  1921. Object.defineProperty(exports, "__esModule", {
  1922. value: true
  1923. });
  1924. var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1925. var _error2 = _interopRequireDefault(_error);
  1926. var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1927. var _message2 = _interopRequireDefault(_message);
  1928. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1929. var _ui2 = _interopRequireDefault(_ui);
  1930. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1931. exports.default = {
  1932. 'message': _message2.default,
  1933. 'error': _error2.default,
  1934. 'ui': _ui2.default
  1935. };
  1936. /***/ }),
  1937. /***/ "./i18n/pt/message.json":
  1938. /*!******************************!*\
  1939. !*** ./i18n/pt/message.json ***!
  1940. \******************************/
  1941. /*! exports provided: default */
  1942. /***/ (function(module) {
  1943. module.exports = {};
  1944. /***/ }),
  1945. /***/ "./i18n/pt/ui.json":
  1946. /*!*************************!*\
  1947. !*** ./i18n/pt/ui.json ***!
  1948. \*************************/
  1949. /*! 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, $sin, 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, $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 */
  1950. /***/ (function(module) {
  1951. 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","$sin":"seno","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","$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 2018_12_19 Build 13_18"};
  1952. /***/ }),
  1953. /***/ "./js/Sortable.js":
  1954. /*!************************!*\
  1955. !*** ./js/Sortable.js ***!
  1956. \************************/
  1957. /*! no static exports found */
  1958. /***/ (function(module, exports, __webpack_require__) {
  1959. "use strict";
  1960. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  1961. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  1962. /**!
  1963. * Sortable
  1964. * @author RubaXa <trash@rubaxa.org>
  1965. * @license MIT
  1966. */
  1967. (function sortableModule(factory) {
  1968. "use strict";
  1969. if (true) {
  1970. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1971. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1972. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1973. __WEBPACK_AMD_DEFINE_FACTORY__),
  1974. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1975. } else {}
  1976. })(function sortableFactory() {
  1977. "use strict";
  1978. if (typeof window == "undefined" || !window.document) {
  1979. return function sortableError() {
  1980. throw new Error("Sortable.js requires a window with a document");
  1981. };
  1982. }
  1983. var dragEl,
  1984. parentEl,
  1985. ghostEl,
  1986. cloneEl,
  1987. rootEl,
  1988. nextEl,
  1989. lastDownEl,
  1990. scrollEl,
  1991. scrollParentEl,
  1992. scrollCustomFn,
  1993. lastEl,
  1994. lastCSS,
  1995. lastParentCSS,
  1996. oldIndex,
  1997. newIndex,
  1998. activeGroup,
  1999. putSortable,
  2000. autoScroll = {},
  2001. tapEvt,
  2002. touchEvt,
  2003. moved,
  2004. /** @const */
  2005. R_SPACE = /\s+/g,
  2006. R_FLOAT = /left|right|inline/,
  2007. expando = 'Sortable' + new Date().getTime(),
  2008. win = window,
  2009. document = win.document,
  2010. parseInt = win.parseInt,
  2011. $ = win.jQuery || win.Zepto,
  2012. Polymer = win.Polymer,
  2013. captureMode = false,
  2014. supportDraggable = !!('draggable' in document.createElement('div')),
  2015. supportCssPointerEvents = function (el) {
  2016. // false when IE11
  2017. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2018. return false;
  2019. }
  2020. el = document.createElement('x');
  2021. el.style.cssText = 'pointer-events:auto';
  2022. return el.style.pointerEvents === 'auto';
  2023. }(),
  2024. _silent = false,
  2025. abs = Math.abs,
  2026. min = Math.min,
  2027. savedInputChecked = [],
  2028. touchDragOverListeners = [],
  2029. _autoScroll = _throttle(function ( /**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  2030. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2031. if (rootEl && options.scroll) {
  2032. var _this = rootEl[expando],
  2033. el,
  2034. rect,
  2035. sens = options.scrollSensitivity,
  2036. speed = options.scrollSpeed,
  2037. x = evt.clientX,
  2038. y = evt.clientY,
  2039. winWidth = window.innerWidth,
  2040. winHeight = window.innerHeight,
  2041. vx,
  2042. vy,
  2043. scrollOffsetX,
  2044. scrollOffsetY;
  2045. // 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 === "undefined" ? "undefined" : _typeof(originalGroup)) != 'object') {
  2112. originalGroup = { name: originalGroup };
  2113. }
  2114. group.name = originalGroup.name;
  2115. group.checkPull = toFn(originalGroup.pull, true);
  2116. group.checkPut = toFn(originalGroup.put);
  2117. group.revertClone = originalGroup.revertClone;
  2118. options.group = group;
  2119. };
  2120. /**
  2121. * @class Sortable
  2122. * @param {HTMLElement} el
  2123. * @param {Object} [options]
  2124. */
  2125. function Sortable(el, options) {
  2126. if (!(el && el.nodeType && el.nodeType === 1)) {
  2127. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2128. }
  2129. this.el = el; // root element
  2130. this.options = options = _extend({}, options);
  2131. // Export instance
  2132. el[expando] = this;
  2133. // 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: { x: 0, y: 0 }
  2163. };
  2164. // Set default options
  2165. for (var name in defaults) {
  2166. !(name in options) && (options[name] = defaults[name]);
  2167. }
  2168. _prepareGroup(options);
  2169. // Bind all private methods
  2170. for (var fn in this) {
  2171. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2172. this[fn] = this[fn].bind(this);
  2173. }
  2174. }
  2175. // Setup drag mode
  2176. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  2177. // Bind events
  2178. _on(el, 'mousedown', this._onTapStart);
  2179. _on(el, 'touchstart', this._onTapStart);
  2180. _on(el, 'pointerdown', this._onTapStart);
  2181. if (this.nativeDraggable) {
  2182. _on(el, 'dragover', this);
  2183. _on(el, 'dragenter', this);
  2184. }
  2185. touchDragOverListeners.push(this._onDragOver);
  2186. // Restore sorting
  2187. options.store && this.sort(options.store.get(this));
  2188. }
  2189. Sortable.prototype = /** @lends Sortable.prototype */{
  2190. constructor: Sortable,
  2191. _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
  2192. var _this = this,
  2193. el = this.el,
  2194. options = this.options,
  2195. preventOnFilter = options.preventOnFilter,
  2196. type = evt.type,
  2197. touch = evt.touches && evt.touches[0],
  2198. target = (touch || evt).target,
  2199. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2200. filter = options.filter,
  2201. startIndex;
  2202. _saveInputCheckedState(el);
  2203. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2204. if (dragEl) {
  2205. return;
  2206. }
  2207. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2208. return; // only left button or enabled
  2209. }
  2210. target = _closest(target, options.draggable, el);
  2211. if (!target) {
  2212. return;
  2213. }
  2214. if (lastDownEl === target) {
  2215. // Ignoring duplicate `down`
  2216. return;
  2217. }
  2218. // Get the index of the dragged element within its parent
  2219. startIndex = _index(target, options.draggable);
  2220. // Check filter
  2221. if (typeof filter === 'function') {
  2222. if (filter.call(this, evt, target, this)) {
  2223. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2224. preventOnFilter && evt.preventDefault();
  2225. return; // cancel dnd
  2226. }
  2227. } else if (filter) {
  2228. filter = filter.split(',').some(function (criteria) {
  2229. criteria = _closest(originalTarget, criteria.trim(), el);
  2230. if (criteria) {
  2231. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2232. return true;
  2233. }
  2234. });
  2235. if (filter) {
  2236. preventOnFilter && evt.preventDefault();
  2237. return; // cancel dnd
  2238. }
  2239. }
  2240. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2241. return;
  2242. }
  2243. // Prepare `dragstart`
  2244. this._prepareDragStart(evt, touch, target, startIndex);
  2245. },
  2246. _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  2247. var _this = this,
  2248. el = _this.el,
  2249. options = _this.options,
  2250. ownerDocument = el.ownerDocument,
  2251. dragStartFn;
  2252. if (target && !dragEl && target.parentNode === el) {
  2253. tapEvt = evt;
  2254. rootEl = el;
  2255. dragEl = target;
  2256. parentEl = dragEl.parentNode;
  2257. nextEl = dragEl.nextSibling;
  2258. lastDownEl = target;
  2259. activeGroup = options.group;
  2260. oldIndex = startIndex;
  2261. this._lastX = (touch || evt).clientX;
  2262. this._lastY = (touch || evt).clientY;
  2263. dragEl.style['will-change'] = 'transform';
  2264. dragStartFn = function dragStartFn() {
  2265. // Delayed drag has been triggered
  2266. // we can re-enable the events: touchmove/mousemove
  2267. _this._disableDelayedDrag();
  2268. // Make the element draggable
  2269. dragEl.draggable = _this.nativeDraggable;
  2270. // Chosen item
  2271. _toggleClass(dragEl, options.chosenClass, true);
  2272. // Bind the events: dragstart/dragend
  2273. _this._triggerDragStart(evt, touch);
  2274. // Drag start event
  2275. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2276. };
  2277. // Disable "draggable"
  2278. options.ignore.split(',').forEach(function (criteria) {
  2279. _find(dragEl, criteria.trim(), _disableDraggable);
  2280. });
  2281. _on(ownerDocument, 'mouseup', _this._onDrop);
  2282. _on(ownerDocument, 'touchend', _this._onDrop);
  2283. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2284. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2285. _on(ownerDocument, 'selectstart', _this);
  2286. if (options.delay) {
  2287. // If the user moves the pointer or let go the click or touch
  2288. // before the delay has been reached:
  2289. // disable the delayed drag
  2290. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2291. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2292. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2293. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2294. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2295. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2296. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2297. } else {
  2298. dragStartFn();
  2299. }
  2300. }
  2301. },
  2302. _disableDelayedDrag: function _disableDelayedDrag() {
  2303. var ownerDocument = this.el.ownerDocument;
  2304. clearTimeout(this._dragStartTimer);
  2305. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2306. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2307. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2308. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2309. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2310. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2311. },
  2312. _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
  2313. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2314. if (touch) {
  2315. // Touch device support
  2316. tapEvt = {
  2317. target: dragEl,
  2318. clientX: touch.clientX,
  2319. clientY: touch.clientY
  2320. };
  2321. this._onDragStart(tapEvt, 'touch');
  2322. } else if (!this.nativeDraggable) {
  2323. this._onDragStart(tapEvt, true);
  2324. } else {
  2325. _on(dragEl, 'dragend', this);
  2326. _on(rootEl, 'dragstart', this._onDragStart);
  2327. }
  2328. try {
  2329. if (document.selection) {
  2330. // Timeout neccessary for IE9
  2331. setTimeout(function () {
  2332. document.selection.empty();
  2333. });
  2334. } else {
  2335. window.getSelection().removeAllRanges();
  2336. }
  2337. } catch (err) {}
  2338. },
  2339. _dragStarted: function _dragStarted() {
  2340. if (rootEl && dragEl) {
  2341. var options = this.options;
  2342. // Apply effect
  2343. _toggleClass(dragEl, options.ghostClass, true);
  2344. _toggleClass(dragEl, options.dragClass, false);
  2345. Sortable.active = this;
  2346. // Drag start event
  2347. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2348. } else {
  2349. this._nulling();
  2350. }
  2351. },
  2352. _emulateDragOver: function _emulateDragOver() {
  2353. if (touchEvt) {
  2354. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2355. return;
  2356. }
  2357. this._lastX = touchEvt.clientX;
  2358. this._lastY = touchEvt.clientY;
  2359. if (!supportCssPointerEvents) {
  2360. _css(ghostEl, 'display', 'none');
  2361. }
  2362. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2363. parent = target,
  2364. i = touchDragOverListeners.length;
  2365. if (parent) {
  2366. do {
  2367. if (parent[expando]) {
  2368. while (i--) {
  2369. touchDragOverListeners[i]({
  2370. clientX: touchEvt.clientX,
  2371. clientY: touchEvt.clientY,
  2372. target: target,
  2373. rootEl: parent
  2374. });
  2375. }
  2376. break;
  2377. }
  2378. target = parent; // store last element
  2379. }
  2380. /* jshint boss:true */
  2381. while (parent = parent.parentNode);
  2382. }
  2383. if (!supportCssPointerEvents) {
  2384. _css(ghostEl, 'display', '');
  2385. }
  2386. }
  2387. },
  2388. _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
  2389. if (tapEvt) {
  2390. var options = this.options,
  2391. fallbackTolerance = options.fallbackTolerance,
  2392. fallbackOffset = options.fallbackOffset,
  2393. touch = evt.touches ? evt.touches[0] : evt,
  2394. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2395. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2396. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  2397. // only set the status to dragging, when we are actually dragging
  2398. if (!Sortable.active) {
  2399. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2400. return;
  2401. }
  2402. this._dragStarted();
  2403. }
  2404. // as well as creating the ghost element on the document body
  2405. this._appendGhost();
  2406. moved = true;
  2407. touchEvt = touch;
  2408. _css(ghostEl, 'webkitTransform', translate3d);
  2409. _css(ghostEl, 'mozTransform', translate3d);
  2410. _css(ghostEl, 'msTransform', translate3d);
  2411. _css(ghostEl, 'transform', translate3d);
  2412. evt.preventDefault();
  2413. }
  2414. },
  2415. _appendGhost: function _appendGhost() {
  2416. if (!ghostEl) {
  2417. var rect = dragEl.getBoundingClientRect(),
  2418. css = _css(dragEl),
  2419. options = this.options,
  2420. ghostRect;
  2421. ghostEl = dragEl.cloneNode(true);
  2422. _toggleClass(ghostEl, options.ghostClass, false);
  2423. _toggleClass(ghostEl, options.fallbackClass, true);
  2424. _toggleClass(ghostEl, options.dragClass, true);
  2425. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2426. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2427. _css(ghostEl, 'width', rect.width);
  2428. _css(ghostEl, 'height', rect.height);
  2429. _css(ghostEl, 'opacity', '0.8');
  2430. _css(ghostEl, 'position', 'fixed');
  2431. _css(ghostEl, 'zIndex', '100000');
  2432. _css(ghostEl, 'pointerEvents', 'none');
  2433. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  2434. // Fixing dimensions.
  2435. ghostRect = ghostEl.getBoundingClientRect();
  2436. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2437. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2438. }
  2439. },
  2440. _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/useFallback) {
  2441. var dataTransfer = evt.dataTransfer,
  2442. options = this.options;
  2443. this._offUpEvents();
  2444. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2445. cloneEl = _clone(dragEl);
  2446. cloneEl.draggable = false;
  2447. cloneEl.style['will-change'] = '';
  2448. _css(cloneEl, 'display', 'none');
  2449. _toggleClass(cloneEl, this.options.chosenClass, false);
  2450. rootEl.insertBefore(cloneEl, dragEl);
  2451. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2452. }
  2453. _toggleClass(dragEl, options.dragClass, true);
  2454. if (useFallback) {
  2455. if (useFallback === 'touch') {
  2456. // Bind touch events
  2457. _on(document, 'touchmove', this._onTouchMove);
  2458. _on(document, 'touchend', this._onDrop);
  2459. _on(document, 'touchcancel', this._onDrop);
  2460. _on(document, 'pointermove', this._onTouchMove);
  2461. _on(document, 'pointerup', this._onDrop);
  2462. } else {
  2463. // Old brwoser
  2464. _on(document, 'mousemove', this._onTouchMove);
  2465. _on(document, 'mouseup', this._onDrop);
  2466. }
  2467. this._loopId = setInterval(this._emulateDragOver, 50);
  2468. } else {
  2469. if (dataTransfer) {
  2470. dataTransfer.effectAllowed = 'move';
  2471. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2472. }
  2473. _on(document, 'drop', this);
  2474. setTimeout(this._dragStarted, 0);
  2475. }
  2476. },
  2477. _onDragOver: function _onDragOver( /**Event*/evt) {
  2478. var el = this.el,
  2479. target,
  2480. dragRect,
  2481. targetRect,
  2482. revert,
  2483. options = this.options,
  2484. group = options.group,
  2485. activeSortable = Sortable.active,
  2486. isOwner = activeGroup === group,
  2487. isMovingBetweenSortable = false,
  2488. canSort = options.sort;
  2489. if (evt.preventDefault !== void 0) {
  2490. evt.preventDefault();
  2491. !options.dragoverBubble && evt.stopPropagation();
  2492. }
  2493. if (dragEl.animated) {
  2494. return;
  2495. }
  2496. moved = true;
  2497. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2498. : 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
  2499. ) {
  2500. // Smart auto-scrolling
  2501. _autoScroll(evt, options, this.el);
  2502. if (_silent) {
  2503. return;
  2504. }
  2505. target = _closest(evt.target, options.draggable, el);
  2506. dragRect = dragEl.getBoundingClientRect();
  2507. if (putSortable !== this) {
  2508. putSortable = this;
  2509. isMovingBetweenSortable = true;
  2510. }
  2511. if (revert) {
  2512. _cloneHide(activeSortable, true);
  2513. parentEl = rootEl; // actualization
  2514. if (cloneEl || nextEl) {
  2515. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2516. } else if (!canSort) {
  2517. rootEl.appendChild(dragEl);
  2518. }
  2519. return;
  2520. }
  2521. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2522. //assign target only if condition is true
  2523. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2524. target = el.lastElementChild;
  2525. }
  2526. if (target) {
  2527. if (target.animated) {
  2528. return;
  2529. }
  2530. targetRect = target.getBoundingClientRect();
  2531. }
  2532. _cloneHide(activeSortable, isOwner);
  2533. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2534. if (!dragEl.contains(el)) {
  2535. el.appendChild(dragEl);
  2536. parentEl = el; // actualization
  2537. }
  2538. this._animate(dragRect, dragEl);
  2539. target && this._animate(targetRect, target);
  2540. }
  2541. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2542. if (lastEl !== target) {
  2543. lastEl = target;
  2544. lastCSS = _css(target);
  2545. lastParentCSS = _css(target.parentNode);
  2546. }
  2547. targetRect = target.getBoundingClientRect();
  2548. var width = targetRect.right - targetRect.left,
  2549. height = targetRect.bottom - targetRect.top,
  2550. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2551. isWide = target.offsetWidth > dragEl.offsetWidth,
  2552. isLong = target.offsetHeight > dragEl.offsetHeight,
  2553. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2554. nextSibling = target.nextElementSibling,
  2555. after = false;
  2556. if (floating) {
  2557. var elTop = dragEl.offsetTop,
  2558. tgTop = target.offsetTop;
  2559. if (elTop === tgTop) {
  2560. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2561. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2562. after = (evt.clientY - targetRect.top) / height > 0.5;
  2563. } else {
  2564. after = tgTop > elTop;
  2565. }
  2566. } else if (!isMovingBetweenSortable) {
  2567. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2568. }
  2569. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2570. if (moveVector !== false) {
  2571. if (moveVector === 1 || moveVector === -1) {
  2572. after = moveVector === 1;
  2573. }
  2574. _silent = true;
  2575. setTimeout(_unsilent, 30);
  2576. _cloneHide(activeSortable, isOwner);
  2577. if (!dragEl.contains(el)) {
  2578. if (after && !nextSibling) {
  2579. el.appendChild(dragEl);
  2580. } else {
  2581. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2582. }
  2583. }
  2584. parentEl = dragEl.parentNode; // actualization
  2585. this._animate(dragRect, dragEl);
  2586. this._animate(targetRect, target);
  2587. }
  2588. }
  2589. }
  2590. },
  2591. _animate: function _animate(prevRect, target) {
  2592. var ms = this.options.animation;
  2593. if (ms) {
  2594. var currentRect = target.getBoundingClientRect();
  2595. if (prevRect.nodeType === 1) {
  2596. prevRect = prevRect.getBoundingClientRect();
  2597. }
  2598. _css(target, 'transition', 'none');
  2599. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2600. target.offsetWidth; // repaint
  2601. _css(target, 'transition', 'all ' + ms + 'ms');
  2602. _css(target, 'transform', 'translate3d(0,0,0)');
  2603. clearTimeout(target.animated);
  2604. target.animated = setTimeout(function () {
  2605. _css(target, 'transition', '');
  2606. _css(target, 'transform', '');
  2607. target.animated = false;
  2608. }, ms);
  2609. }
  2610. },
  2611. _offUpEvents: function _offUpEvents() {
  2612. var ownerDocument = this.el.ownerDocument;
  2613. _off(document, 'touchmove', this._onTouchMove);
  2614. _off(document, 'pointermove', this._onTouchMove);
  2615. _off(ownerDocument, 'mouseup', this._onDrop);
  2616. _off(ownerDocument, 'touchend', this._onDrop);
  2617. _off(ownerDocument, 'pointerup', this._onDrop);
  2618. _off(ownerDocument, 'touchcancel', this._onDrop);
  2619. _off(ownerDocument, 'pointercancel', this._onDrop);
  2620. _off(ownerDocument, 'selectstart', this);
  2621. },
  2622. _onDrop: function _onDrop( /**Event*/evt) {
  2623. var el = this.el,
  2624. options = this.options;
  2625. clearInterval(this._loopId);
  2626. clearInterval(autoScroll.pid);
  2627. clearTimeout(this._dragStartTimer);
  2628. // Unbind events
  2629. _off(document, 'mousemove', this._onTouchMove);
  2630. if (this.nativeDraggable) {
  2631. _off(document, 'drop', this);
  2632. _off(el, 'dragstart', this._onDragStart);
  2633. }
  2634. this._offUpEvents();
  2635. if (evt) {
  2636. if (moved) {
  2637. evt.preventDefault();
  2638. !options.dropBubble && evt.stopPropagation();
  2639. }
  2640. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  2641. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  2642. // Remove clone
  2643. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  2644. }
  2645. if (dragEl) {
  2646. if (this.nativeDraggable) {
  2647. _off(dragEl, 'dragend', this);
  2648. }
  2649. _disableDraggable(dragEl);
  2650. dragEl.style['will-change'] = '';
  2651. // Remove class's
  2652. _toggleClass(dragEl, this.options.ghostClass, false);
  2653. _toggleClass(dragEl, this.options.chosenClass, false);
  2654. // Drag stop event
  2655. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2656. if (rootEl !== parentEl) {
  2657. newIndex = _index(dragEl, options.draggable);
  2658. if (newIndex >= 0) {
  2659. // Add event
  2660. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  2661. // Remove event
  2662. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  2663. // drag from one list and drop into another
  2664. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2665. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2666. }
  2667. } else {
  2668. if (dragEl.nextSibling !== nextEl) {
  2669. // Get the index of the dragged element within its parent
  2670. newIndex = _index(dragEl, options.draggable);
  2671. if (newIndex >= 0) {
  2672. // drag & drop within the same list
  2673. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2674. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2675. }
  2676. }
  2677. }
  2678. if (Sortable.active) {
  2679. /* jshint eqnull:true */
  2680. if (newIndex == null || newIndex === -1) {
  2681. newIndex = oldIndex;
  2682. }
  2683. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  2684. // Save sorting
  2685. this.save();
  2686. }
  2687. }
  2688. }
  2689. this._nulling();
  2690. },
  2691. _nulling: function _nulling() {
  2692. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2693. savedInputChecked.forEach(function (el) {
  2694. el.checked = true;
  2695. });
  2696. savedInputChecked.length = 0;
  2697. },
  2698. handleEvent: function handleEvent( /**Event*/evt) {
  2699. switch (evt.type) {
  2700. case 'drop':
  2701. case 'dragend':
  2702. this._onDrop(evt);
  2703. break;
  2704. case 'dragover':
  2705. case 'dragenter':
  2706. if (dragEl) {
  2707. this._onDragOver(evt);
  2708. _globalDragOver(evt);
  2709. }
  2710. break;
  2711. case 'selectstart':
  2712. evt.preventDefault();
  2713. break;
  2714. }
  2715. },
  2716. /**
  2717. * Serializes the item into an array of string.
  2718. * @returns {String[]}
  2719. */
  2720. toArray: function toArray() {
  2721. var order = [],
  2722. el,
  2723. children = this.el.children,
  2724. i = 0,
  2725. n = children.length,
  2726. options = this.options;
  2727. for (; i < n; i++) {
  2728. el = children[i];
  2729. if (_closest(el, options.draggable, this.el)) {
  2730. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2731. }
  2732. }
  2733. return order;
  2734. },
  2735. /**
  2736. * Sorts the elements according to the array.
  2737. * @param {String[]} order order of the items
  2738. */
  2739. sort: function sort(order) {
  2740. var items = {},
  2741. rootEl = this.el;
  2742. this.toArray().forEach(function (id, i) {
  2743. var el = rootEl.children[i];
  2744. if (_closest(el, this.options.draggable, rootEl)) {
  2745. items[id] = el;
  2746. }
  2747. }, this);
  2748. order.forEach(function (id) {
  2749. if (items[id]) {
  2750. rootEl.removeChild(items[id]);
  2751. rootEl.appendChild(items[id]);
  2752. }
  2753. });
  2754. },
  2755. /**
  2756. * Save the current sorting
  2757. */
  2758. save: function save() {
  2759. var store = this.options.store;
  2760. store && store.set(this);
  2761. },
  2762. /**
  2763. * 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.
  2764. * @param {HTMLElement} el
  2765. * @param {String} [selector] default: `options.draggable`
  2766. * @returns {HTMLElement|null}
  2767. */
  2768. closest: function closest(el, selector) {
  2769. return _closest(el, selector || this.options.draggable, this.el);
  2770. },
  2771. /**
  2772. * Set/get option
  2773. * @param {string} name
  2774. * @param {*} [value]
  2775. * @returns {*}
  2776. */
  2777. option: function option(name, value) {
  2778. var options = this.options;
  2779. if (value === void 0) {
  2780. return options[name];
  2781. } else {
  2782. options[name] = value;
  2783. if (name === 'group') {
  2784. _prepareGroup(options);
  2785. }
  2786. }
  2787. },
  2788. /**
  2789. * Destroy
  2790. */
  2791. destroy: function destroy() {
  2792. var el = this.el;
  2793. el[expando] = null;
  2794. _off(el, 'mousedown', this._onTapStart);
  2795. _off(el, 'touchstart', this._onTapStart);
  2796. _off(el, 'pointerdown', this._onTapStart);
  2797. if (this.nativeDraggable) {
  2798. _off(el, 'dragover', this);
  2799. _off(el, 'dragenter', this);
  2800. }
  2801. // Remove draggable attributes
  2802. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2803. el.removeAttribute('draggable');
  2804. });
  2805. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2806. this._onDrop();
  2807. this.el = el = null;
  2808. }
  2809. };
  2810. function _cloneHide(sortable, state) {
  2811. if (sortable.lastPullMode !== 'clone') {
  2812. state = true;
  2813. }
  2814. if (cloneEl && cloneEl.state !== state) {
  2815. _css(cloneEl, 'display', state ? 'none' : '');
  2816. if (!state) {
  2817. if (cloneEl.state) {
  2818. if (sortable.options.group.revertClone) {
  2819. rootEl.insertBefore(cloneEl, nextEl);
  2820. sortable._animate(dragEl, cloneEl);
  2821. } else {
  2822. rootEl.insertBefore(cloneEl, dragEl);
  2823. }
  2824. }
  2825. }
  2826. cloneEl.state = state;
  2827. }
  2828. }
  2829. function _closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  2830. if (el) {
  2831. ctx = ctx || document;
  2832. do {
  2833. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2834. return el;
  2835. }
  2836. /* jshint boss:true */
  2837. } while (el = _getParentOrHost(el));
  2838. }
  2839. return null;
  2840. }
  2841. function _getParentOrHost(el) {
  2842. var parent = el.host;
  2843. return parent && parent.nodeType ? parent : el.parentNode;
  2844. }
  2845. function _globalDragOver( /**Event*/evt) {
  2846. if (evt.dataTransfer) {
  2847. evt.dataTransfer.dropEffect = 'move';
  2848. }
  2849. evt.preventDefault();
  2850. }
  2851. function _on(el, event, fn) {
  2852. el.addEventListener(event, fn, captureMode);
  2853. }
  2854. function _off(el, event, fn) {
  2855. el.removeEventListener(event, fn, captureMode);
  2856. }
  2857. function _toggleClass(el, name, state) {
  2858. if (el) {
  2859. if (el.classList) {
  2860. el.classList[state ? 'add' : 'remove'](name);
  2861. } else {
  2862. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2863. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2864. }
  2865. }
  2866. }
  2867. function _css(el, prop, val) {
  2868. var style = el && el.style;
  2869. if (style) {
  2870. if (val === void 0) {
  2871. if (document.defaultView && document.defaultView.getComputedStyle) {
  2872. val = document.defaultView.getComputedStyle(el, '');
  2873. } else if (el.currentStyle) {
  2874. val = el.currentStyle;
  2875. }
  2876. return prop === void 0 ? val : val[prop];
  2877. } else {
  2878. if (!(prop in style)) {
  2879. prop = '-webkit-' + prop;
  2880. }
  2881. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2882. }
  2883. }
  2884. }
  2885. function _find(ctx, tagName, iterator) {
  2886. if (ctx) {
  2887. var list = ctx.getElementsByTagName(tagName),
  2888. i = 0,
  2889. n = list.length;
  2890. if (iterator) {
  2891. for (; i < n; i++) {
  2892. iterator(list[i], i);
  2893. }
  2894. }
  2895. return list;
  2896. }
  2897. return [];
  2898. }
  2899. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2900. sortable = sortable || rootEl[expando];
  2901. var evt = document.createEvent('Event'),
  2902. options = sortable.options,
  2903. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2904. evt.initEvent(name, true, true);
  2905. evt.to = rootEl;
  2906. evt.from = fromEl || rootEl;
  2907. evt.item = targetEl || rootEl;
  2908. evt.clone = cloneEl;
  2909. evt.oldIndex = startIndex;
  2910. evt.newIndex = newIndex;
  2911. rootEl.dispatchEvent(evt);
  2912. if (options[onName]) {
  2913. options[onName].call(sortable, evt);
  2914. }
  2915. }
  2916. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2917. var evt,
  2918. sortable = fromEl[expando],
  2919. onMoveFn = sortable.options.onMove,
  2920. retVal;
  2921. evt = document.createEvent('Event');
  2922. evt.initEvent('move', true, true);
  2923. evt.to = toEl;
  2924. evt.from = fromEl;
  2925. evt.dragged = dragEl;
  2926. evt.draggedRect = dragRect;
  2927. evt.related = targetEl || toEl;
  2928. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2929. evt.willInsertAfter = willInsertAfter;
  2930. fromEl.dispatchEvent(evt);
  2931. if (onMoveFn) {
  2932. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2933. }
  2934. return retVal;
  2935. }
  2936. function _disableDraggable(el) {
  2937. el.draggable = false;
  2938. }
  2939. function _unsilent() {
  2940. _silent = false;
  2941. }
  2942. /** @returns {HTMLElement|false} */
  2943. function _ghostIsLast(el, evt) {
  2944. var lastEl = el.lastElementChild,
  2945. rect = lastEl.getBoundingClientRect();
  2946. // 5 — min delta
  2947. // abs — нельзя добавлять, а то глюки при наведении сверху
  2948. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2949. }
  2950. /**
  2951. * Generate id
  2952. * @param {HTMLElement} el
  2953. * @returns {String}
  2954. * @private
  2955. */
  2956. function _generateId(el) {
  2957. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2958. i = str.length,
  2959. sum = 0;
  2960. while (i--) {
  2961. sum += str.charCodeAt(i);
  2962. }
  2963. return sum.toString(36);
  2964. }
  2965. /**
  2966. * Returns the index of an element within its parent for a selected set of
  2967. * elements
  2968. * @param {HTMLElement} el
  2969. * @param {selector} selector
  2970. * @return {number}
  2971. */
  2972. function _index(el, selector) {
  2973. var index = 0;
  2974. if (!el || !el.parentNode) {
  2975. return -1;
  2976. }
  2977. while (el && (el = el.previousElementSibling)) {
  2978. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2979. index++;
  2980. }
  2981. }
  2982. return index;
  2983. }
  2984. function _matches( /**HTMLElement*/el, /**String*/selector) {
  2985. if (el) {
  2986. selector = selector.split('.');
  2987. var tag = selector.shift().toUpperCase(),
  2988. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  2989. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  2990. }
  2991. return false;
  2992. }
  2993. function _throttle(callback, ms) {
  2994. var args, _this;
  2995. return function () {
  2996. if (args === void 0) {
  2997. args = arguments;
  2998. _this = this;
  2999. setTimeout(function () {
  3000. if (args.length === 1) {
  3001. callback.call(_this, args[0]);
  3002. } else {
  3003. callback.apply(_this, args);
  3004. }
  3005. args = void 0;
  3006. }, ms);
  3007. }
  3008. };
  3009. }
  3010. function _extend(dst, src) {
  3011. if (dst && src) {
  3012. for (var key in src) {
  3013. if (src.hasOwnProperty(key)) {
  3014. dst[key] = src[key];
  3015. }
  3016. }
  3017. }
  3018. return dst;
  3019. }
  3020. function _clone(el) {
  3021. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3022. }
  3023. function _saveInputCheckedState(root) {
  3024. var inputs = root.getElementsByTagName('input');
  3025. var idx = inputs.length;
  3026. while (idx--) {
  3027. var el = inputs[idx];
  3028. el.checked && savedInputChecked.push(el);
  3029. }
  3030. }
  3031. // Fixed #973:
  3032. _on(document, 'touchmove', function (evt) {
  3033. if (Sortable.active) {
  3034. evt.preventDefault();
  3035. }
  3036. });
  3037. try {
  3038. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3039. get: function get() {
  3040. captureMode = {
  3041. capture: false,
  3042. passive: false
  3043. };
  3044. }
  3045. }));
  3046. } catch (err) {}
  3047. // Export utils
  3048. Sortable.utils = {
  3049. on: _on,
  3050. off: _off,
  3051. css: _css,
  3052. find: _find,
  3053. is: function is(el, selector) {
  3054. return !!_closest(el, selector, el);
  3055. },
  3056. extend: _extend,
  3057. throttle: _throttle,
  3058. closest: _closest,
  3059. toggleClass: _toggleClass,
  3060. clone: _clone,
  3061. index: _index
  3062. };
  3063. /**
  3064. * Create sortable instance
  3065. * @param {HTMLElement} el
  3066. * @param {Object} [options]
  3067. */
  3068. Sortable.create = function (el, options) {
  3069. return new Sortable(el, options);
  3070. };
  3071. // Export
  3072. Sortable.version = '1.6.1';
  3073. return Sortable;
  3074. });
  3075. /***/ }),
  3076. /***/ "./js/assessment/ivprogAssessment.js":
  3077. /*!*******************************************!*\
  3078. !*** ./js/assessment/ivprogAssessment.js ***!
  3079. \*******************************************/
  3080. /*! no static exports found */
  3081. /***/ (function(module, exports, __webpack_require__) {
  3082. "use strict";
  3083. Object.defineProperty(exports, "__esModule", {
  3084. value: true
  3085. });
  3086. exports.IVProgAssessment = undefined;
  3087. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3088. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  3089. var _semanticAnalyser = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3090. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3091. var _inputTest = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3092. var _outputTest = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3093. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3094. var IVProgAssessment = exports.IVProgAssessment = function () {
  3095. function IVProgAssessment(textCode, testCases, domConsole) {
  3096. _classCallCheck(this, IVProgAssessment);
  3097. this.textCode = textCode;
  3098. this.testCases = testCases;
  3099. this.domConsole = domConsole;
  3100. }
  3101. _createClass(IVProgAssessment, [{
  3102. key: "runTest",
  3103. value: function runTest() {
  3104. var _this = this;
  3105. try {
  3106. // try and show error messages through domconsole
  3107. var parser = _ivprogParser.IVProgParser.createParser(this.textCode);
  3108. var semantic = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  3109. var validTree = semantic.analyseTree();
  3110. // loop test cases and show messages through domconsole
  3111. var partialTests = this.testCases.map(function (t, name) {
  3112. return _this.partialEvaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name);
  3113. });
  3114. var testResult = partialTests.reduce(function (acc, curr) {
  3115. return acc.then(curr);
  3116. }, Promise.resolve(0));
  3117. return testResult.then(function (total) {
  3118. return Promise.resolve(total / _this.testCases.length);
  3119. }).catch(function (err) {
  3120. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3121. _this.domConsole.err(err.message);
  3122. return Promise.resolve(0);
  3123. });
  3124. } catch (error) {
  3125. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3126. this.domConsole.err(error.message);
  3127. return Promise.resolve(0);
  3128. }
  3129. }
  3130. }, {
  3131. key: "evaluateTestCase",
  3132. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3133. var outerThis = this;
  3134. var input = new _inputTest.InputTest(inputList);
  3135. var output = new _outputTest.OutputTest();
  3136. prog.registerInput(input);
  3137. prog.registerOutput(output);
  3138. var startTime = Date.now();
  3139. return prog.interpretAST().then(function (_) {
  3140. var millis = Date.now() - startTime;
  3141. if (input.inputList.length !== input.index) {
  3142. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou, ainda restam entradas!");
  3143. outerThis.domConsole.info("Levou " + millis + "ms");
  3144. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3145. } else if (output.list.length < outputList.length) {
  3146. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3147. outerThis.domConsole.info("Levou " + millis + "ms");
  3148. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3149. } else if (output.list.length > outputList.length) {
  3150. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3151. outerThis.domConsole.info("Levou " + millis + "ms");
  3152. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3153. } else {
  3154. var isOk = outerThis.checkOutput(output.list, outputList);
  3155. if (!isOk) {
  3156. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3157. outerThis.domConsole.info("Levou " + millis + "ms");
  3158. return Promise.resolve(accumulator);
  3159. } else {
  3160. outerThis.domConsole.info("Caso de teste " + (name + 1) + ": OK!");
  3161. outerThis.domConsole.info("Levou " + millis + "ms");
  3162. return Promise.resolve(accumulator + 1);
  3163. }
  3164. }
  3165. }).catch(function (_) {
  3166. return Promise.resolve(accumulator);
  3167. });
  3168. }
  3169. }, {
  3170. key: "partialEvaluateTestCase",
  3171. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3172. var _this2 = this;
  3173. var partial = function partial(accumulator) {
  3174. return _this2.evaluateTestCase(prog, inputList, outputList, name, accumulator);
  3175. };
  3176. partial = partial.bind(this);
  3177. return partial;
  3178. }
  3179. }, {
  3180. key: "checkOutput",
  3181. value: function checkOutput(aList, bList) {
  3182. for (var i = 0; i < aList.length; i++) {
  3183. var outValue = aList[i];
  3184. if (outValue != bList[i]) {
  3185. return false;
  3186. }
  3187. }
  3188. return true;
  3189. }
  3190. }]);
  3191. return IVProgAssessment;
  3192. }();
  3193. /***/ }),
  3194. /***/ "./js/ast/commands/arrayAssign.js":
  3195. /*!****************************************!*\
  3196. !*** ./js/ast/commands/arrayAssign.js ***!
  3197. \****************************************/
  3198. /*! no static exports found */
  3199. /***/ (function(module, exports, __webpack_require__) {
  3200. "use strict";
  3201. Object.defineProperty(exports, "__esModule", {
  3202. value: true
  3203. });
  3204. exports.ArrayIndexAssign = undefined;
  3205. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3206. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3207. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3208. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3209. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  3210. _inherits(ArrayIndexAssign, _Assign);
  3211. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3212. _classCallCheck(this, ArrayIndexAssign);
  3213. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  3214. _this.line = lineExpression;
  3215. _this.column = columnExpression;
  3216. return _this;
  3217. }
  3218. return ArrayIndexAssign;
  3219. }(_assign.Assign);
  3220. /***/ }),
  3221. /***/ "./js/ast/commands/arrayDeclaration.js":
  3222. /*!*********************************************!*\
  3223. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3224. \*********************************************/
  3225. /*! no static exports found */
  3226. /***/ (function(module, exports, __webpack_require__) {
  3227. "use strict";
  3228. Object.defineProperty(exports, "__esModule", {
  3229. value: true
  3230. });
  3231. exports.ArrayDeclaration = undefined;
  3232. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3233. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3234. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3235. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3236. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  3237. _inherits(ArrayDeclaration, _Declaration);
  3238. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3239. _classCallCheck(this, ArrayDeclaration);
  3240. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  3241. _this.lines = lines;
  3242. _this.columns = columns;
  3243. return _this;
  3244. }
  3245. return ArrayDeclaration;
  3246. }(_declaration.Declaration);
  3247. /***/ }),
  3248. /***/ "./js/ast/commands/assign.js":
  3249. /*!***********************************!*\
  3250. !*** ./js/ast/commands/assign.js ***!
  3251. \***********************************/
  3252. /*! no static exports found */
  3253. /***/ (function(module, exports, __webpack_require__) {
  3254. "use strict";
  3255. Object.defineProperty(exports, "__esModule", {
  3256. value: true
  3257. });
  3258. exports.Assign = undefined;
  3259. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3260. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3261. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3262. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3263. var Assign = exports.Assign = function (_Command) {
  3264. _inherits(Assign, _Command);
  3265. function Assign(id, expression) {
  3266. _classCallCheck(this, Assign);
  3267. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  3268. _this.id = id;
  3269. _this.expression = expression;
  3270. return _this;
  3271. }
  3272. return Assign;
  3273. }(_command.Command);
  3274. /***/ }),
  3275. /***/ "./js/ast/commands/break.js":
  3276. /*!**********************************!*\
  3277. !*** ./js/ast/commands/break.js ***!
  3278. \**********************************/
  3279. /*! no static exports found */
  3280. /***/ (function(module, exports, __webpack_require__) {
  3281. "use strict";
  3282. Object.defineProperty(exports, "__esModule", {
  3283. value: true
  3284. });
  3285. exports.Break = undefined;
  3286. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3287. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3288. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3289. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3290. var Break = exports.Break = function (_Command) {
  3291. _inherits(Break, _Command);
  3292. function Break() {
  3293. _classCallCheck(this, Break);
  3294. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  3295. }
  3296. return Break;
  3297. }(_command.Command);
  3298. /***/ }),
  3299. /***/ "./js/ast/commands/case.js":
  3300. /*!*********************************!*\
  3301. !*** ./js/ast/commands/case.js ***!
  3302. \*********************************/
  3303. /*! no static exports found */
  3304. /***/ (function(module, exports, __webpack_require__) {
  3305. "use strict";
  3306. Object.defineProperty(exports, "__esModule", {
  3307. value: true
  3308. });
  3309. exports.Case = undefined;
  3310. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3311. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3312. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3313. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3314. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3315. var Case = exports.Case = function (_Command) {
  3316. _inherits(Case, _Command);
  3317. function Case(expression) {
  3318. _classCallCheck(this, Case);
  3319. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  3320. _this.expression = expression;
  3321. _this.commands = [];
  3322. return _this;
  3323. }
  3324. _createClass(Case, [{
  3325. key: 'setCommands',
  3326. value: function setCommands(commands) {
  3327. this.commands = commands;
  3328. }
  3329. }, {
  3330. key: 'isDefault',
  3331. get: function get() {
  3332. return this.expression === null;
  3333. }
  3334. }]);
  3335. return Case;
  3336. }(_command.Command);
  3337. /***/ }),
  3338. /***/ "./js/ast/commands/command.js":
  3339. /*!************************************!*\
  3340. !*** ./js/ast/commands/command.js ***!
  3341. \************************************/
  3342. /*! no static exports found */
  3343. /***/ (function(module, exports, __webpack_require__) {
  3344. "use strict";
  3345. Object.defineProperty(exports, "__esModule", {
  3346. value: true
  3347. });
  3348. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3349. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3350. var Command = exports.Command = function () {
  3351. function Command() {
  3352. _classCallCheck(this, Command);
  3353. this._sourceInfo = null;
  3354. }
  3355. _createClass(Command, [{
  3356. key: "sourceInfo",
  3357. set: function set(sourceInfo) {
  3358. this._sourceInfo = sourceInfo;
  3359. },
  3360. get: function get() {
  3361. return this._sourceInfo;
  3362. }
  3363. }]);
  3364. return Command;
  3365. }();
  3366. /***/ }),
  3367. /***/ "./js/ast/commands/commandBlock.js":
  3368. /*!*****************************************!*\
  3369. !*** ./js/ast/commands/commandBlock.js ***!
  3370. \*****************************************/
  3371. /*! no static exports found */
  3372. /***/ (function(module, exports, __webpack_require__) {
  3373. "use strict";
  3374. Object.defineProperty(exports, "__esModule", {
  3375. value: true
  3376. });
  3377. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3378. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3379. var CommandBlock = exports.CommandBlock = function () {
  3380. function CommandBlock(variables, commands) {
  3381. _classCallCheck(this, CommandBlock);
  3382. this.variables = variables;
  3383. this.commands = commands;
  3384. this._sourceInfo = null;
  3385. }
  3386. _createClass(CommandBlock, [{
  3387. key: "sourceInfo",
  3388. set: function set(sourceInfo) {
  3389. this._sourceInfo = sourceInfo;
  3390. },
  3391. get: function get() {
  3392. return this._sourceInfo;
  3393. }
  3394. }]);
  3395. return CommandBlock;
  3396. }();
  3397. /***/ }),
  3398. /***/ "./js/ast/commands/declaration.js":
  3399. /*!****************************************!*\
  3400. !*** ./js/ast/commands/declaration.js ***!
  3401. \****************************************/
  3402. /*! no static exports found */
  3403. /***/ (function(module, exports, __webpack_require__) {
  3404. "use strict";
  3405. Object.defineProperty(exports, "__esModule", {
  3406. value: true
  3407. });
  3408. exports.Declaration = undefined;
  3409. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3410. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3411. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3412. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3413. var Declaration = exports.Declaration = function (_Command) {
  3414. _inherits(Declaration, _Command);
  3415. function Declaration(id, type, initial, isConst) {
  3416. _classCallCheck(this, Declaration);
  3417. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  3418. _this.id = id;
  3419. _this.type = type;
  3420. _this.initial = initial;
  3421. _this.isConst = isConst;
  3422. return _this;
  3423. }
  3424. return Declaration;
  3425. }(_command.Command);
  3426. /***/ }),
  3427. /***/ "./js/ast/commands/doWhile.js":
  3428. /*!************************************!*\
  3429. !*** ./js/ast/commands/doWhile.js ***!
  3430. \************************************/
  3431. /*! no static exports found */
  3432. /***/ (function(module, exports, __webpack_require__) {
  3433. "use strict";
  3434. Object.defineProperty(exports, "__esModule", {
  3435. value: true
  3436. });
  3437. exports.DoWhile = undefined;
  3438. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3439. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3440. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3441. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3442. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3443. var DoWhile = exports.DoWhile = function (_While) {
  3444. _inherits(DoWhile, _While);
  3445. function DoWhile(condition, commandBlock) {
  3446. _classCallCheck(this, DoWhile);
  3447. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  3448. }
  3449. _createClass(DoWhile, [{
  3450. key: 'testFirst',
  3451. get: function get() {
  3452. return false;
  3453. }
  3454. }]);
  3455. return DoWhile;
  3456. }(_while.While);
  3457. /***/ }),
  3458. /***/ "./js/ast/commands/for.js":
  3459. /*!********************************!*\
  3460. !*** ./js/ast/commands/for.js ***!
  3461. \********************************/
  3462. /*! no static exports found */
  3463. /***/ (function(module, exports, __webpack_require__) {
  3464. "use strict";
  3465. Object.defineProperty(exports, "__esModule", {
  3466. value: true
  3467. });
  3468. exports.For = undefined;
  3469. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3470. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3471. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3472. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3473. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3474. var For = exports.For = function (_Command) {
  3475. _inherits(For, _Command);
  3476. function For(assignment, condition, increment, commandBlock) {
  3477. _classCallCheck(this, For);
  3478. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  3479. _this.assignment = assignment;
  3480. _this.condition = condition;
  3481. _this.increment = increment;
  3482. _this.commandBlock = commandBlock;
  3483. return _this;
  3484. }
  3485. _createClass(For, [{
  3486. key: 'commands',
  3487. get: function get() {
  3488. return this.commandBlock.commands;
  3489. }
  3490. }]);
  3491. return For;
  3492. }(_command.Command);
  3493. /***/ }),
  3494. /***/ "./js/ast/commands/formalParameter.js":
  3495. /*!********************************************!*\
  3496. !*** ./js/ast/commands/formalParameter.js ***!
  3497. \********************************************/
  3498. /*! no static exports found */
  3499. /***/ (function(module, exports, __webpack_require__) {
  3500. "use strict";
  3501. Object.defineProperty(exports, "__esModule", {
  3502. value: true
  3503. });
  3504. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3505. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3506. var FormalParameter = exports.FormalParameter = function () {
  3507. function FormalParameter(type, id) {
  3508. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3509. _classCallCheck(this, FormalParameter);
  3510. this.type = type;
  3511. this.id = id;
  3512. this.byRef = byRef;
  3513. this._sourceInfo = null;
  3514. }
  3515. _createClass(FormalParameter, [{
  3516. key: "sourceInfo",
  3517. set: function set(sourceInfo) {
  3518. this._sourceInfo = sourceInfo;
  3519. },
  3520. get: function get() {
  3521. return this._sourceInfo;
  3522. }
  3523. }]);
  3524. return FormalParameter;
  3525. }();
  3526. /***/ }),
  3527. /***/ "./js/ast/commands/function.js":
  3528. /*!*************************************!*\
  3529. !*** ./js/ast/commands/function.js ***!
  3530. \*************************************/
  3531. /*! no static exports found */
  3532. /***/ (function(module, exports, __webpack_require__) {
  3533. "use strict";
  3534. Object.defineProperty(exports, "__esModule", {
  3535. value: true
  3536. });
  3537. exports.Function = undefined;
  3538. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3539. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3540. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3541. var Function = exports.Function = function () {
  3542. function Function(name, returnType, formalParameters, commandBlock) {
  3543. _classCallCheck(this, Function);
  3544. this.name = name;
  3545. this.returnType = returnType;
  3546. this.formalParameters = formalParameters;
  3547. this.commandBlock = commandBlock;
  3548. this._sourceInfo = null;
  3549. }
  3550. _createClass(Function, [{
  3551. key: 'isMain',
  3552. get: function get() {
  3553. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  3554. }
  3555. }, {
  3556. key: 'commands',
  3557. get: function get() {
  3558. return this.commandBlock.commands;
  3559. }
  3560. }, {
  3561. key: 'variablesDeclarations',
  3562. get: function get() {
  3563. return this.commandBlock.variables;
  3564. }
  3565. }, {
  3566. key: 'sourceInfo',
  3567. set: function set(sourceInfo) {
  3568. this._sourceInfo = sourceInfo;
  3569. },
  3570. get: function get() {
  3571. return this._sourceInfo;
  3572. }
  3573. }]);
  3574. return Function;
  3575. }();
  3576. /***/ }),
  3577. /***/ "./js/ast/commands/ifThenElse.js":
  3578. /*!***************************************!*\
  3579. !*** ./js/ast/commands/ifThenElse.js ***!
  3580. \***************************************/
  3581. /*! no static exports found */
  3582. /***/ (function(module, exports, __webpack_require__) {
  3583. "use strict";
  3584. Object.defineProperty(exports, "__esModule", {
  3585. value: true
  3586. });
  3587. exports.IfThenElse = undefined;
  3588. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3589. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3590. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3591. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3592. var IfThenElse = exports.IfThenElse = function (_Command) {
  3593. _inherits(IfThenElse, _Command);
  3594. function IfThenElse(condition, ifTrue, ifFalse) {
  3595. _classCallCheck(this, IfThenElse);
  3596. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  3597. _this.condition = condition;
  3598. _this.ifTrue = ifTrue;
  3599. _this.ifFalse = ifFalse;
  3600. return _this;
  3601. }
  3602. return IfThenElse;
  3603. }(_command.Command);
  3604. /***/ }),
  3605. /***/ "./js/ast/commands/index.js":
  3606. /*!**********************************!*\
  3607. !*** ./js/ast/commands/index.js ***!
  3608. \**********************************/
  3609. /*! no static exports found */
  3610. /***/ (function(module, exports, __webpack_require__) {
  3611. "use strict";
  3612. Object.defineProperty(exports, "__esModule", {
  3613. value: true
  3614. });
  3615. exports.FunctionCall = exports.FormalParameter = exports.SysCall = exports.Case = exports.Switch = exports.DoWhile = exports.CommandBlock = exports.IfThenElse = exports.Function = exports.For = exports.While = exports.ArrayDeclaration = exports.Declaration = exports.ArrayIndexAssign = exports.Assign = exports.Return = exports.Break = undefined;
  3616. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3617. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3618. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3619. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3620. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3621. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3622. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3623. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3624. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3625. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3626. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3627. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3628. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3629. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3630. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3631. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3632. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3633. //Proxy to expression since they do exatcly the same thing
  3634. exports.Break = _break.Break;
  3635. exports.Return = _return.Return;
  3636. exports.Assign = _assign.Assign;
  3637. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  3638. exports.Declaration = _declaration.Declaration;
  3639. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  3640. exports.While = _while.While;
  3641. exports.For = _for.For;
  3642. exports.Function = _function.Function;
  3643. exports.IfThenElse = _ifThenElse.IfThenElse;
  3644. exports.CommandBlock = _commandBlock.CommandBlock;
  3645. exports.DoWhile = _doWhile.DoWhile;
  3646. exports.Switch = _switch.Switch;
  3647. exports.Case = _case.Case;
  3648. exports.SysCall = _sysCall.SysCall;
  3649. exports.FormalParameter = _formalParameter.FormalParameter;
  3650. exports.FunctionCall = _functionCall.FunctionCall;
  3651. /***/ }),
  3652. /***/ "./js/ast/commands/return.js":
  3653. /*!***********************************!*\
  3654. !*** ./js/ast/commands/return.js ***!
  3655. \***********************************/
  3656. /*! no static exports found */
  3657. /***/ (function(module, exports, __webpack_require__) {
  3658. "use strict";
  3659. Object.defineProperty(exports, "__esModule", {
  3660. value: true
  3661. });
  3662. exports.Return = undefined;
  3663. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3664. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3665. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3666. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3667. var Return = exports.Return = function (_Command) {
  3668. _inherits(Return, _Command);
  3669. function Return(expression) {
  3670. _classCallCheck(this, Return);
  3671. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  3672. _this.expression = expression;
  3673. return _this;
  3674. }
  3675. return Return;
  3676. }(_command.Command);
  3677. /***/ }),
  3678. /***/ "./js/ast/commands/switch.js":
  3679. /*!***********************************!*\
  3680. !*** ./js/ast/commands/switch.js ***!
  3681. \***********************************/
  3682. /*! no static exports found */
  3683. /***/ (function(module, exports, __webpack_require__) {
  3684. "use strict";
  3685. Object.defineProperty(exports, "__esModule", {
  3686. value: true
  3687. });
  3688. exports.Switch = undefined;
  3689. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3690. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3691. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3692. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3693. var Switch = exports.Switch = function (_Command) {
  3694. _inherits(Switch, _Command);
  3695. function Switch(expression, cases) {
  3696. _classCallCheck(this, Switch);
  3697. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  3698. _this.expression = expression;
  3699. _this.cases = cases;
  3700. return _this;
  3701. }
  3702. return Switch;
  3703. }(_command.Command);
  3704. /***/ }),
  3705. /***/ "./js/ast/commands/sysCall.js":
  3706. /*!************************************!*\
  3707. !*** ./js/ast/commands/sysCall.js ***!
  3708. \************************************/
  3709. /*! no static exports found */
  3710. /***/ (function(module, exports, __webpack_require__) {
  3711. "use strict";
  3712. Object.defineProperty(exports, "__esModule", {
  3713. value: true
  3714. });
  3715. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3716. /**
  3717. * This class represents all the language defined functions.
  3718. * The language processor uses the id provided here to properly execute the desired function.
  3719. * The function is actually implemented inside the language processor.
  3720. * All the functions can be found at: js/processor/definedFunctions.js
  3721. */
  3722. var SysCall = exports.SysCall = function SysCall(langFunc) {
  3723. _classCallCheck(this, SysCall);
  3724. this.langFunc = langFunc;
  3725. };
  3726. /***/ }),
  3727. /***/ "./js/ast/commands/while.js":
  3728. /*!**********************************!*\
  3729. !*** ./js/ast/commands/while.js ***!
  3730. \**********************************/
  3731. /*! no static exports found */
  3732. /***/ (function(module, exports, __webpack_require__) {
  3733. "use strict";
  3734. Object.defineProperty(exports, "__esModule", {
  3735. value: true
  3736. });
  3737. exports.While = undefined;
  3738. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3739. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3740. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3741. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3742. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3743. var While = exports.While = function (_Command) {
  3744. _inherits(While, _Command);
  3745. function While(expression, commandBlock) {
  3746. _classCallCheck(this, While);
  3747. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  3748. _this.expression = expression;
  3749. _this.commandBlock = commandBlock;
  3750. return _this;
  3751. }
  3752. _createClass(While, [{
  3753. key: 'commands',
  3754. get: function get() {
  3755. return this.commandBlock.commands;
  3756. }
  3757. }, {
  3758. key: 'testFirst',
  3759. get: function get() {
  3760. return true;
  3761. }
  3762. }]);
  3763. return While;
  3764. }(_command.Command);
  3765. /***/ }),
  3766. /***/ "./js/ast/error/syntaxError.js":
  3767. /*!*************************************!*\
  3768. !*** ./js/ast/error/syntaxError.js ***!
  3769. \*************************************/
  3770. /*! no static exports found */
  3771. /***/ (function(module, exports, __webpack_require__) {
  3772. "use strict";
  3773. Object.defineProperty(exports, "__esModule", {
  3774. value: true
  3775. });
  3776. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3777. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3778. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3779. var SyntaxError = exports.SyntaxError = function (_Error) {
  3780. _inherits(SyntaxError, _Error);
  3781. function SyntaxError() {
  3782. var _ref;
  3783. _classCallCheck(this, SyntaxError);
  3784. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  3785. msg[_key] = arguments[_key];
  3786. }
  3787. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  3788. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  3789. return _this;
  3790. }
  3791. return SyntaxError;
  3792. }(Error);
  3793. /***/ }),
  3794. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3795. /*!********************************************!*\
  3796. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3797. \********************************************/
  3798. /*! no static exports found */
  3799. /***/ (function(module, exports, __webpack_require__) {
  3800. "use strict";
  3801. Object.defineProperty(exports, "__esModule", {
  3802. value: true
  3803. });
  3804. exports.SyntaxErrorFactory = undefined;
  3805. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3806. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3807. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  3808. extra_lines: function extra_lines() {
  3809. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  3810. },
  3811. token_missing_one: function token_missing_one(expected, token) {
  3812. var context = [expected, token.text, token.line, token.column];
  3813. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  3814. },
  3815. token_missing_list: function token_missing_list(expectedList, token) {
  3816. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  3817. return SyntaxErrorFactory.token_missing_one(line, token);
  3818. },
  3819. id_missing: function id_missing(token) {
  3820. var context = [token.text, token.line, token.column];
  3821. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  3822. },
  3823. eos_missing: function eos_missing(token) {
  3824. var context = [token.line, token.column];
  3825. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  3826. },
  3827. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3828. var context = [token.line, token.column, typeName];
  3829. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  3830. },
  3831. invalid_array_size: function invalid_array_size(token) {
  3832. var context = [token.line];
  3833. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  3834. },
  3835. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3836. var context = [name, typeName, token.line];
  3837. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  3838. },
  3839. invalid_var_declaration: function invalid_var_declaration(token) {
  3840. var context = [token.line];
  3841. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  3842. },
  3843. invalid_break_command: function invalid_break_command(cmdName, token) {
  3844. var context = [token.line, cmdName];
  3845. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  3846. },
  3847. invalid_terminal: function invalid_terminal(token) {
  3848. var context = [token.text, token.line, token.column];
  3849. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  3850. },
  3851. invalid_type: function invalid_type(list, token) {
  3852. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  3853. var context = [token.text, token.line, token.column, line];
  3854. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  3855. },
  3856. const_not_init: function const_not_init(token) {
  3857. var context = [token.line, token.column];
  3858. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  3859. },
  3860. invalid_id_format: function invalid_id_format(token) {
  3861. var context = [token.text, token.line, token.column];
  3862. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  3863. },
  3864. duplicate_function: function duplicate_function(token) {
  3865. var context = [token.text, token.line, token.column];
  3866. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_function", context));
  3867. },
  3868. main_parameters: function main_parameters() {
  3869. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("main_parameters"));
  3870. },
  3871. duplicate_variable: function duplicate_variable(token) {
  3872. var context = [token.text, token.line, token.column];
  3873. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_variable", context));
  3874. }
  3875. });
  3876. /***/ }),
  3877. /***/ "./js/ast/expressions/arrayAccess.js":
  3878. /*!*******************************************!*\
  3879. !*** ./js/ast/expressions/arrayAccess.js ***!
  3880. \*******************************************/
  3881. /*! no static exports found */
  3882. /***/ (function(module, exports, __webpack_require__) {
  3883. "use strict";
  3884. Object.defineProperty(exports, "__esModule", {
  3885. value: true
  3886. });
  3887. exports.ArrayAccess = undefined;
  3888. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3889. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3890. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3891. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3892. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3893. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  3894. _inherits(ArrayAccess, _Expression);
  3895. function ArrayAccess(id, line, column) {
  3896. _classCallCheck(this, ArrayAccess);
  3897. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  3898. _this.id = id;
  3899. _this.line = line;
  3900. _this.column = column;
  3901. return _this;
  3902. }
  3903. _createClass(ArrayAccess, [{
  3904. key: 'toString',
  3905. value: function toString() {
  3906. var strLine = this.line.toString();
  3907. var strColumn = null;
  3908. if (this.column) {
  3909. strColumn = this.column.toString();
  3910. }
  3911. if (strColumn) {
  3912. return this.id + '[' + strLine + '][' + strColumn + ']';
  3913. } else {
  3914. return this.id + '[' + strLine + ']';
  3915. }
  3916. }
  3917. }]);
  3918. return ArrayAccess;
  3919. }(_expression.Expression);
  3920. /***/ }),
  3921. /***/ "./js/ast/expressions/arrayLiteral.js":
  3922. /*!********************************************!*\
  3923. !*** ./js/ast/expressions/arrayLiteral.js ***!
  3924. \********************************************/
  3925. /*! no static exports found */
  3926. /***/ (function(module, exports, __webpack_require__) {
  3927. "use strict";
  3928. Object.defineProperty(exports, "__esModule", {
  3929. value: true
  3930. });
  3931. exports.ArrayLiteral = undefined;
  3932. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3933. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3934. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3935. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3936. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3937. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  3938. _inherits(ArrayLiteral, _Literal);
  3939. function ArrayLiteral(type, value) {
  3940. _classCallCheck(this, ArrayLiteral);
  3941. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  3942. _this.value = value;
  3943. return _this;
  3944. }
  3945. _createClass(ArrayLiteral, [{
  3946. key: 'validateType',
  3947. value: function validateType() {
  3948. // let valid = true;
  3949. // if(this.columns !== null) {
  3950. // const len = this.columns;
  3951. // const len2 = this.lines;
  3952. // for (let i = len - 1; i >= 0; i--) {
  3953. // for (let j = len2 - 1; j >= 0; j--) {
  3954. // if(this.value[i].value[j].type !== this.subtype) {
  3955. // valid = false;
  3956. // break;
  3957. // }
  3958. // }
  3959. // }
  3960. // } else {
  3961. // const len = this.lines;
  3962. // for (var i = len - 1; i >= 0; i--) {
  3963. // if(this.value[i].type !== this.subtype) {
  3964. // valid = false;
  3965. // break;
  3966. // }
  3967. // }
  3968. // }
  3969. return true; //valid;
  3970. }
  3971. }, {
  3972. key: 'validateSize',
  3973. value: function validateSize() {
  3974. var valid = true;
  3975. if (this.columns !== null) {
  3976. var equalityTest = data.value.map(function (v) {
  3977. return v.length;
  3978. }).reduce(function (old, next) {
  3979. if (old === null) {
  3980. return next;
  3981. } else if (old === next) {
  3982. return old;
  3983. } else {
  3984. return -1;
  3985. }
  3986. }, null);
  3987. valid = equalityTest !== -1;
  3988. }
  3989. return valid;
  3990. }
  3991. }, {
  3992. key: 'toString',
  3993. value: function toString() {
  3994. var strList = this.value.map(function (arrayLiteral) {
  3995. return arrayLiteral.toString();
  3996. });
  3997. return "{" + strList.join(',') + "}";
  3998. }
  3999. }, {
  4000. key: 'subtype',
  4001. get: function get() {
  4002. var element = this.value[0];
  4003. if (element instanceof ArrayLiteral) {
  4004. return element.value[0].type;
  4005. } else {
  4006. return element.type;
  4007. }
  4008. }
  4009. }, {
  4010. key: 'lines',
  4011. get: function get() {
  4012. return this.value.length;
  4013. }
  4014. }, {
  4015. key: 'columns',
  4016. get: function get() {
  4017. var element = this.value[0];
  4018. if (!(element instanceof ArrayLiteral)) {
  4019. return null;
  4020. } else {
  4021. return element.value[0].length;
  4022. }
  4023. }
  4024. }, {
  4025. key: 'isVector',
  4026. get: function get() {
  4027. return this.columns === null;
  4028. }
  4029. }, {
  4030. key: 'isValid',
  4031. get: function get() {
  4032. return true; //this.validateType() && this.validateSize();
  4033. }
  4034. }]);
  4035. return ArrayLiteral;
  4036. }(_literal.Literal);
  4037. /***/ }),
  4038. /***/ "./js/ast/expressions/boolLiteral.js":
  4039. /*!*******************************************!*\
  4040. !*** ./js/ast/expressions/boolLiteral.js ***!
  4041. \*******************************************/
  4042. /*! no static exports found */
  4043. /***/ (function(module, exports, __webpack_require__) {
  4044. "use strict";
  4045. Object.defineProperty(exports, "__esModule", {
  4046. value: true
  4047. });
  4048. exports.BoolLiteral = undefined;
  4049. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4050. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4051. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4052. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4053. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4054. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4055. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4056. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  4057. _inherits(BoolLiteral, _Literal);
  4058. function BoolLiteral(value) {
  4059. _classCallCheck(this, BoolLiteral);
  4060. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  4061. _this.value = value;
  4062. return _this;
  4063. }
  4064. _createClass(BoolLiteral, [{
  4065. key: 'toString',
  4066. value: function toString() {
  4067. return (0, _parsers.convertBoolToString)(this.value);
  4068. }
  4069. }]);
  4070. return BoolLiteral;
  4071. }(_literal.Literal);
  4072. /***/ }),
  4073. /***/ "./js/ast/expressions/expression.js":
  4074. /*!******************************************!*\
  4075. !*** ./js/ast/expressions/expression.js ***!
  4076. \******************************************/
  4077. /*! no static exports found */
  4078. /***/ (function(module, exports, __webpack_require__) {
  4079. "use strict";
  4080. Object.defineProperty(exports, "__esModule", {
  4081. value: true
  4082. });
  4083. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4084. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4085. var Expression = exports.Expression = function () {
  4086. function Expression() {
  4087. _classCallCheck(this, Expression);
  4088. this._sourceInfo = null;
  4089. }
  4090. _createClass(Expression, [{
  4091. key: "sourceInfo",
  4092. set: function set(sourceInfo) {
  4093. this._sourceInfo = sourceInfo;
  4094. },
  4095. get: function get() {
  4096. return this._sourceInfo;
  4097. }
  4098. }]);
  4099. return Expression;
  4100. }();
  4101. /***/ }),
  4102. /***/ "./js/ast/expressions/functionCall.js":
  4103. /*!********************************************!*\
  4104. !*** ./js/ast/expressions/functionCall.js ***!
  4105. \********************************************/
  4106. /*! no static exports found */
  4107. /***/ (function(module, exports, __webpack_require__) {
  4108. "use strict";
  4109. Object.defineProperty(exports, "__esModule", {
  4110. value: true
  4111. });
  4112. exports.FunctionCall = undefined;
  4113. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4114. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4115. var _definedFunctions = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4116. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4117. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4118. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4119. var FunctionCall = exports.FunctionCall = function (_Expression) {
  4120. _inherits(FunctionCall, _Expression);
  4121. function FunctionCall(id, actualParameters) {
  4122. _classCallCheck(this, FunctionCall);
  4123. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  4124. _this.id = id;
  4125. _this.actualParameters = actualParameters;
  4126. return _this;
  4127. }
  4128. _createClass(FunctionCall, [{
  4129. key: 'toString',
  4130. value: function toString() {
  4131. var name = null;
  4132. if (this.isMainCall) {
  4133. name = _definedFunctions.LanguageDefinedFunction.getMainFunctionName();
  4134. } else {
  4135. name = _definedFunctions.LanguageDefinedFunction.getLocalName(this.id);
  4136. }
  4137. var params = null;
  4138. if (this.actualParameters.length == 0) {
  4139. params = "()";
  4140. } else {
  4141. var strParams = this.actualParameters.map(function (v) {
  4142. return v.toString();
  4143. });
  4144. params = "(" + strParams.join(",") + ")";
  4145. }
  4146. return name + params;
  4147. }
  4148. }, {
  4149. key: 'isMainCall',
  4150. get: function get() {
  4151. return this.id === null;
  4152. }
  4153. }, {
  4154. key: 'parametersSize',
  4155. get: function get() {
  4156. return this.actualParameters.length;
  4157. }
  4158. }]);
  4159. return FunctionCall;
  4160. }(_expression.Expression);
  4161. /***/ }),
  4162. /***/ "./js/ast/expressions/index.js":
  4163. /*!*************************************!*\
  4164. !*** ./js/ast/expressions/index.js ***!
  4165. \*************************************/
  4166. /*! no static exports found */
  4167. /***/ (function(module, exports, __webpack_require__) {
  4168. "use strict";
  4169. Object.defineProperty(exports, "__esModule", {
  4170. value: true
  4171. });
  4172. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  4173. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4174. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4175. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4176. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4177. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4178. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4179. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4180. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4181. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4182. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4183. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  4184. exports.FunctionCall = _functionCall.FunctionCall;
  4185. exports.IntLiteral = _intLiteral.IntLiteral;
  4186. exports.RealLiteral = _realLiteral.RealLiteral;
  4187. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  4188. exports.StringLiteral = _stringLiteral.StringLiteral;
  4189. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  4190. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  4191. exports.InfixApp = _infixApp.InfixApp;
  4192. exports.UnaryApp = _unaryApp.UnaryApp;
  4193. /***/ }),
  4194. /***/ "./js/ast/expressions/infixApp.js":
  4195. /*!****************************************!*\
  4196. !*** ./js/ast/expressions/infixApp.js ***!
  4197. \****************************************/
  4198. /*! no static exports found */
  4199. /***/ (function(module, exports, __webpack_require__) {
  4200. "use strict";
  4201. Object.defineProperty(exports, "__esModule", {
  4202. value: true
  4203. });
  4204. exports.InfixApp = undefined;
  4205. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4206. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4207. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4208. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4209. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4210. var InfixApp = exports.InfixApp = function (_Expression) {
  4211. _inherits(InfixApp, _Expression);
  4212. function InfixApp(op, left, right) {
  4213. _classCallCheck(this, InfixApp);
  4214. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  4215. _this.op = op;
  4216. _this.left = left;
  4217. _this.right = right;
  4218. return _this;
  4219. }
  4220. _createClass(InfixApp, [{
  4221. key: 'toString',
  4222. value: function toString() {
  4223. var l = this.left.toString();
  4224. var op = this.op.value;
  4225. var r = this.right.toString();
  4226. return l + op + r;
  4227. }
  4228. }]);
  4229. return InfixApp;
  4230. }(_expression.Expression);
  4231. /***/ }),
  4232. /***/ "./js/ast/expressions/intLiteral.js":
  4233. /*!******************************************!*\
  4234. !*** ./js/ast/expressions/intLiteral.js ***!
  4235. \******************************************/
  4236. /*! no static exports found */
  4237. /***/ (function(module, exports, __webpack_require__) {
  4238. "use strict";
  4239. Object.defineProperty(exports, "__esModule", {
  4240. value: true
  4241. });
  4242. exports.IntLiteral = undefined;
  4243. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4244. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4245. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4246. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4247. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4248. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4249. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4250. var IntLiteral = exports.IntLiteral = function (_Literal) {
  4251. _inherits(IntLiteral, _Literal);
  4252. function IntLiteral(value) {
  4253. _classCallCheck(this, IntLiteral);
  4254. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  4255. _this.value = value;
  4256. return _this;
  4257. }
  4258. _createClass(IntLiteral, [{
  4259. key: 'toString',
  4260. value: function toString() {
  4261. return (0, _parsers.convertToString)(this.value, this.type);
  4262. }
  4263. }]);
  4264. return IntLiteral;
  4265. }(_literal.Literal);
  4266. /***/ }),
  4267. /***/ "./js/ast/expressions/literal.js":
  4268. /*!***************************************!*\
  4269. !*** ./js/ast/expressions/literal.js ***!
  4270. \***************************************/
  4271. /*! no static exports found */
  4272. /***/ (function(module, exports, __webpack_require__) {
  4273. "use strict";
  4274. Object.defineProperty(exports, "__esModule", {
  4275. value: true
  4276. });
  4277. exports.Literal = undefined;
  4278. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4279. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4280. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4281. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4282. var Literal = exports.Literal = function (_Expression) {
  4283. _inherits(Literal, _Expression);
  4284. function Literal(type) {
  4285. _classCallCheck(this, Literal);
  4286. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  4287. _this.type = type;
  4288. return _this;
  4289. }
  4290. return Literal;
  4291. }(_expression.Expression);
  4292. /***/ }),
  4293. /***/ "./js/ast/expressions/realLiteral.js":
  4294. /*!*******************************************!*\
  4295. !*** ./js/ast/expressions/realLiteral.js ***!
  4296. \*******************************************/
  4297. /*! no static exports found */
  4298. /***/ (function(module, exports, __webpack_require__) {
  4299. "use strict";
  4300. Object.defineProperty(exports, "__esModule", {
  4301. value: true
  4302. });
  4303. exports.RealLiteral = undefined;
  4304. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4305. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4306. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4307. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4308. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4309. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4310. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4311. var RealLiteral = exports.RealLiteral = function (_Literal) {
  4312. _inherits(RealLiteral, _Literal);
  4313. function RealLiteral(value) {
  4314. _classCallCheck(this, RealLiteral);
  4315. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  4316. _this.value = value;
  4317. return _this;
  4318. }
  4319. _createClass(RealLiteral, [{
  4320. key: 'toString',
  4321. value: function toString() {
  4322. return (0, _parsers.convertToString)(this.value, this.type);
  4323. }
  4324. }]);
  4325. return RealLiteral;
  4326. }(_literal.Literal);
  4327. /***/ }),
  4328. /***/ "./js/ast/expressions/stringLiteral.js":
  4329. /*!*********************************************!*\
  4330. !*** ./js/ast/expressions/stringLiteral.js ***!
  4331. \*********************************************/
  4332. /*! no static exports found */
  4333. /***/ (function(module, exports, __webpack_require__) {
  4334. "use strict";
  4335. Object.defineProperty(exports, "__esModule", {
  4336. value: true
  4337. });
  4338. exports.StringLiteral = undefined;
  4339. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4340. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4341. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4342. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4343. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4344. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4345. var StringLiteral = exports.StringLiteral = function (_Literal) {
  4346. _inherits(StringLiteral, _Literal);
  4347. function StringLiteral(value) {
  4348. _classCallCheck(this, StringLiteral);
  4349. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  4350. _this.value = value;
  4351. return _this;
  4352. }
  4353. _createClass(StringLiteral, [{
  4354. key: 'toString',
  4355. value: function toString() {
  4356. return this.value;
  4357. }
  4358. }]);
  4359. return StringLiteral;
  4360. }(_literal.Literal);
  4361. /***/ }),
  4362. /***/ "./js/ast/expressions/unaryApp.js":
  4363. /*!****************************************!*\
  4364. !*** ./js/ast/expressions/unaryApp.js ***!
  4365. \****************************************/
  4366. /*! no static exports found */
  4367. /***/ (function(module, exports, __webpack_require__) {
  4368. "use strict";
  4369. Object.defineProperty(exports, "__esModule", {
  4370. value: true
  4371. });
  4372. exports.UnaryApp = undefined;
  4373. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4374. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4375. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4376. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4377. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4378. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  4379. _inherits(UnaryApp, _InfixApp);
  4380. function UnaryApp(op, left) {
  4381. _classCallCheck(this, UnaryApp);
  4382. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  4383. }
  4384. _createClass(UnaryApp, [{
  4385. key: 'toString',
  4386. value: function toString() {
  4387. var l = this.left.toString();
  4388. var op = this.op.value;
  4389. return op + l;
  4390. }
  4391. }]);
  4392. return UnaryApp;
  4393. }(_infixApp.InfixApp);
  4394. /***/ }),
  4395. /***/ "./js/ast/expressions/variableLiteral.js":
  4396. /*!***********************************************!*\
  4397. !*** ./js/ast/expressions/variableLiteral.js ***!
  4398. \***********************************************/
  4399. /*! no static exports found */
  4400. /***/ (function(module, exports, __webpack_require__) {
  4401. "use strict";
  4402. Object.defineProperty(exports, "__esModule", {
  4403. value: true
  4404. });
  4405. exports.VariableLiteral = undefined;
  4406. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4407. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4408. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4409. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4410. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4411. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4412. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  4413. _inherits(VariableLiteral, _Literal);
  4414. function VariableLiteral(id) {
  4415. _classCallCheck(this, VariableLiteral);
  4416. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  4417. _this.id = id;
  4418. return _this;
  4419. }
  4420. _createClass(VariableLiteral, [{
  4421. key: 'toString',
  4422. value: function toString() {
  4423. return this.id;
  4424. }
  4425. }]);
  4426. return VariableLiteral;
  4427. }(_literal.Literal);
  4428. /***/ }),
  4429. /***/ "./js/ast/ivprogParser.js":
  4430. /*!********************************!*\
  4431. !*** ./js/ast/ivprogParser.js ***!
  4432. \********************************/
  4433. /*! no static exports found */
  4434. /***/ (function(module, exports, __webpack_require__) {
  4435. "use strict";
  4436. Object.defineProperty(exports, "__esModule", {
  4437. value: true
  4438. });
  4439. exports.IVProgParser = undefined;
  4440. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4441. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4442. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4443. var Expressions = _interopRequireWildcard(_expressions);
  4444. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4445. var Commands = _interopRequireWildcard(_commands);
  4446. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4447. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4448. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4449. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4450. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4451. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4452. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4453. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4454. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  4455. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4456. var IVProgParser = exports.IVProgParser = function () {
  4457. _createClass(IVProgParser, null, [{
  4458. key: 'createParser',
  4459. value: function createParser(input) {
  4460. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  4461. return new IVProgParser(input, lexerClass);
  4462. }
  4463. // <BEGIN scope consts>
  4464. }, {
  4465. key: 'BASE',
  4466. get: function get() {
  4467. return 0;
  4468. }
  4469. }, {
  4470. key: 'FUNCTION',
  4471. get: function get() {
  4472. return 1;
  4473. }
  4474. }, {
  4475. key: 'COMMAND',
  4476. get: function get() {
  4477. return 2;
  4478. }
  4479. }, {
  4480. key: 'BREAKABLE',
  4481. get: function get() {
  4482. return 4;
  4483. }
  4484. // </ END scope consts>
  4485. }]);
  4486. function IVProgParser(input, lexerClass) {
  4487. _classCallCheck(this, IVProgParser);
  4488. this.lexerClass = lexerClass;
  4489. this.lexer = new lexerClass(new _index.InputStream(input));
  4490. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  4491. this.tokenStream.fill();
  4492. this.pos = 1;
  4493. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4494. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4495. this.parsingArrayDimension = 0;
  4496. this.scope = [];
  4497. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  4498. this.definedFuncsNameList = [];
  4499. this.definedVariablesStack = [];
  4500. }
  4501. _createClass(IVProgParser, [{
  4502. key: 'parseTree',
  4503. value: function parseTree() {
  4504. return this.parseProgram();
  4505. }
  4506. }, {
  4507. key: 'getToken',
  4508. value: function getToken() {
  4509. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4510. // if(index === null)
  4511. // index = this.pos;
  4512. return this.tokenStream.LT(index);
  4513. }
  4514. }, {
  4515. key: 'insideScope',
  4516. value: function insideScope(scope) {
  4517. if (this.scope.length <= 0) {
  4518. return IVProgParser.BASE === scope;
  4519. } else {
  4520. return this.scope[this.scope.length - 1] === scope;
  4521. }
  4522. }
  4523. }, {
  4524. key: 'pushScope',
  4525. value: function pushScope(scope) {
  4526. this.scope.push(scope);
  4527. }
  4528. }, {
  4529. key: 'pushVariableStack',
  4530. value: function pushVariableStack() {
  4531. this.definedVariablesStack.push([]);
  4532. }
  4533. }, {
  4534. key: 'popScope',
  4535. value: function popScope() {
  4536. return this.scope.pop();
  4537. }
  4538. }, {
  4539. key: 'popVariableStack',
  4540. value: function popVariableStack() {
  4541. return this.definedVariablesStack.pop();
  4542. }
  4543. }, {
  4544. key: 'getCurrentVariableStack',
  4545. value: function getCurrentVariableStack() {
  4546. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4547. }
  4548. }, {
  4549. key: 'isEOF',
  4550. value: function isEOF() {
  4551. this.getToken(this.pos);
  4552. return this.tokenStream.fetchedEOF;
  4553. }
  4554. }, {
  4555. key: 'parseProgram',
  4556. value: function parseProgram() {
  4557. var token = this.getToken();
  4558. var globalVars = [];
  4559. var functions = [];
  4560. if (this.lexerClass.RK_PROGRAM === token.type) {
  4561. this.pos++;
  4562. this.consumeNewLines();
  4563. this.checkOpenCurly();
  4564. this.pos++;
  4565. this.pushVariableStack();
  4566. while (true) {
  4567. this.consumeNewLines();
  4568. var _token = this.getToken();
  4569. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4570. globalVars = globalVars.concat(this.parseGlobalVariables());
  4571. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4572. this.pushVariableStack();
  4573. functions = functions.concat(this.parseFunction());
  4574. this.popVariableStack();
  4575. } else {
  4576. break;
  4577. }
  4578. }
  4579. this.consumeNewLines();
  4580. this.checkCloseCurly();
  4581. this.pos++;
  4582. this.consumeNewLines();
  4583. if (!this.isEOF()) {
  4584. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  4585. }
  4586. this.popVariableStack();
  4587. return { global: globalVars, functions: functions };
  4588. } else {
  4589. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4590. }
  4591. }
  4592. }, {
  4593. key: 'checkOpenCurly',
  4594. value: function checkOpenCurly() {
  4595. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4596. var token = this.getToken();
  4597. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4598. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  4599. }
  4600. return true;
  4601. }
  4602. }, {
  4603. key: 'checkCloseCurly',
  4604. value: function checkCloseCurly() {
  4605. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4606. var token = this.getToken();
  4607. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4608. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  4609. }
  4610. return true;
  4611. }
  4612. /* It checks if the current token at position pos is a ']'.
  4613. * As a check function it doesn't increment pos.
  4614. *
  4615. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4616. *
  4617. * @returns true if the attempt is true and current token is '[',
  4618. * false is attempt is true and current token is not '['
  4619. **/
  4620. }, {
  4621. key: 'checkOpenBrace',
  4622. value: function checkOpenBrace() {
  4623. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4624. var token = this.getToken();
  4625. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4626. if (!attempt) {
  4627. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  4628. } else {
  4629. return false;
  4630. }
  4631. }
  4632. return true;
  4633. }
  4634. }, {
  4635. key: 'checkCloseBrace',
  4636. value: function checkCloseBrace() {
  4637. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4638. var token = this.getToken();
  4639. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4640. if (!attempt) {
  4641. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  4642. } else {
  4643. return false;
  4644. }
  4645. }
  4646. return true;
  4647. }
  4648. }, {
  4649. key: 'checkOpenParenthesis',
  4650. value: function checkOpenParenthesis() {
  4651. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4652. var token = this.getToken();
  4653. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4654. if (!attempt) {
  4655. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  4656. } else {
  4657. return false;
  4658. }
  4659. }
  4660. return true;
  4661. }
  4662. }, {
  4663. key: 'checkCloseParenthesis',
  4664. value: function checkCloseParenthesis() {
  4665. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4666. var token = this.getToken();
  4667. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4668. if (!attempt) {
  4669. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  4670. } else {
  4671. return false;
  4672. }
  4673. }
  4674. return true;
  4675. }
  4676. }, {
  4677. key: 'checkEOS',
  4678. value: function checkEOS() {
  4679. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4680. var eosToken = this.getToken();
  4681. if (eosToken.type !== this.lexerClass.EOS) {
  4682. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  4683. }
  4684. return true;
  4685. }
  4686. }, {
  4687. key: 'checkFunctionDuplicate',
  4688. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4689. var id = functionID === null ? "$main" : functionID;
  4690. var index = this.definedFuncsNameList.indexOf(id);
  4691. if (index !== -1) {
  4692. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_function(funcIDToken);
  4693. }
  4694. this.definedFuncsNameList.push(id);
  4695. }
  4696. }, {
  4697. key: 'checkVariableDuplicate',
  4698. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4699. var index = this.getCurrentVariableStack().indexOf(variableID);
  4700. if (index !== -1) {
  4701. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_variable(variableIDToken);
  4702. }
  4703. this.getCurrentVariableStack().push(variableID);
  4704. }
  4705. }, {
  4706. key: 'consumeForSemiColon',
  4707. value: function consumeForSemiColon() {
  4708. var eosToken = this.getToken();
  4709. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4710. this.pos++;
  4711. return;
  4712. }
  4713. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  4714. }
  4715. }, {
  4716. key: 'parseGlobalVariables',
  4717. value: function parseGlobalVariables() {
  4718. var decl = this.parseMaybeConst();
  4719. this.checkEOS();
  4720. this.pos++;
  4721. return decl;
  4722. }
  4723. /*
  4724. * Checks if the next token is PR_CONST. It's only available
  4725. * at global variables declaration level
  4726. * @returns Declararion(const, type, id, initVal?)
  4727. **/
  4728. }, {
  4729. key: 'parseMaybeConst',
  4730. value: function parseMaybeConst() {
  4731. var constToken = this.getToken();
  4732. if (constToken.type === this.lexerClass.RK_CONST) {
  4733. this.pos++;
  4734. var typeString = this.parseType();
  4735. return this.parseDeclaration(typeString, true);
  4736. } else if (this.isVariableType(constToken)) {
  4737. var _typeString = this.parseType();
  4738. return this.parseDeclaration(_typeString);
  4739. } else {
  4740. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4741. }
  4742. }
  4743. /*
  4744. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4745. * @returns a list of Declararion(const, type, id, initVal?)
  4746. **/
  4747. }, {
  4748. key: 'parseDeclaration',
  4749. value: function parseDeclaration(typeString) {
  4750. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4751. var initial = null;
  4752. var dim1 = null;
  4753. var dim2 = null;
  4754. var idToken = this.getToken();
  4755. var idString = this.parseID();
  4756. this.checkVariableDuplicate(idString, idToken);
  4757. // Check for array or vector
  4758. // ID[int/IDi][int/IDj]
  4759. if (this.checkOpenBrace(true)) {
  4760. this.pos++;
  4761. this.consumeNewLines();
  4762. dim1 = this.parseArrayDimension();
  4763. this.consumeNewLines();
  4764. this.checkCloseBrace();
  4765. this.pos++;
  4766. if (this.checkOpenBrace(true)) {
  4767. this.pos++;
  4768. this.consumeNewLines();
  4769. dim2 = this.parseArrayDimension();
  4770. this.consumeNewLines();
  4771. this.checkCloseBrace();
  4772. this.pos++;
  4773. }
  4774. }
  4775. var equalsToken = this.getToken();
  4776. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4777. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  4778. }
  4779. if (equalsToken.type === this.lexerClass.EQUAL) {
  4780. this.pos++;
  4781. initial = this.parseExpressionOR();
  4782. }
  4783. var declaration = null;
  4784. var dimensions = 0;
  4785. if (dim1 !== null) {
  4786. dimensions++;
  4787. if (dim2 !== null) {
  4788. dimensions++;
  4789. }
  4790. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  4791. } else {
  4792. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  4793. }
  4794. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  4795. var commaToken = this.getToken();
  4796. if (commaToken.type === this.lexerClass.COMMA) {
  4797. this.pos++;
  4798. this.consumeNewLines();
  4799. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4800. } else {
  4801. return [declaration];
  4802. }
  4803. }
  4804. }, {
  4805. key: 'consumeNewLines',
  4806. value: function consumeNewLines() {
  4807. var token = this.getToken();
  4808. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4809. this.pos++;
  4810. token = this.getToken();
  4811. }
  4812. }
  4813. }, {
  4814. key: 'isVariableType',
  4815. value: function isVariableType(token) {
  4816. return this.variableTypes.find(function (v) {
  4817. return v === token.type;
  4818. });
  4819. }
  4820. /*
  4821. * Reads the next token of the stream to check if it is a Integer or an ID.
  4822. * @returns Integer | ID
  4823. **/
  4824. }, {
  4825. key: 'parseArrayDimension',
  4826. value: function parseArrayDimension() {
  4827. var dimToken = this.getToken();
  4828. if (dimToken.type === this.lexerClass.INTEGER) {
  4829. //parse as int literal
  4830. this.pos++;
  4831. return this.getIntLiteral(dimToken);
  4832. } else if (dimToken.type === this.lexerClass.ID) {
  4833. //parse as variable
  4834. this.pos++;
  4835. return this.parseVariable(dimToken);
  4836. } else {
  4837. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  4838. }
  4839. }
  4840. /*
  4841. * Returns an object {type: 'int', value: value}.
  4842. * It checks for binary and hexadecimal integers.
  4843. * @returns object with fields type and value
  4844. **/
  4845. }, {
  4846. key: 'getIntLiteral',
  4847. value: function getIntLiteral(token) {
  4848. var text = token.text;
  4849. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4850. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  4851. exp.sourceInfo = sourceInfo;
  4852. return exp;
  4853. }
  4854. }, {
  4855. key: 'getRealLiteral',
  4856. value: function getRealLiteral(token) {
  4857. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4858. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  4859. exp.sourceInfo = sourceInfo;
  4860. return exp;
  4861. }
  4862. }, {
  4863. key: 'getStringLiteral',
  4864. value: function getStringLiteral(token) {
  4865. var text = token.text;
  4866. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4867. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  4868. exp.sourceInfo = sourceInfo;
  4869. return exp;
  4870. }
  4871. }, {
  4872. key: 'getBoolLiteral',
  4873. value: function getBoolLiteral(token) {
  4874. var val = (0, _parsers.toBool)(token.text);
  4875. var exp = new Expressions.BoolLiteral(val);
  4876. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  4877. return exp;
  4878. }
  4879. }, {
  4880. key: 'parseArrayLiteral',
  4881. value: function parseArrayLiteral() {
  4882. this.checkOpenCurly();
  4883. var beginArray = this.getToken();
  4884. if (this.parsingArrayDimension >= 2) {
  4885. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  4886. }
  4887. this.pos++;
  4888. this.parsingArrayDimension++;
  4889. this.consumeNewLines();
  4890. var data = this.parseExpressionList();
  4891. this.consumeNewLines();
  4892. this.checkCloseCurly();
  4893. var endArray = this.getToken();
  4894. this.pos++;
  4895. this.parsingArrayDimension--;
  4896. if (this.parsingArrayDimension === 0) {
  4897. // if (!data.isValid) {
  4898. // // TODO: better error message
  4899. // console.log('invalid array');
  4900. // throw new Error(`Invalid array at line ${beginArray.line}`);
  4901. // }
  4902. }
  4903. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  4904. var dataDim = 1;
  4905. if (data[0] instanceof Expressions.ArrayLiteral) {
  4906. dataDim++;
  4907. }
  4908. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  4909. var exp = new Expressions.ArrayLiteral(type, data);
  4910. exp.sourceInfo = sourceInfo;
  4911. return exp;
  4912. }
  4913. /*
  4914. * Returns an object {type: 'variable', value: value}.
  4915. * @returns object with fields type and value
  4916. **/
  4917. }, {
  4918. key: 'parseVariable',
  4919. value: function parseVariable(token) {
  4920. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4921. var exp = new Expressions.VariableLiteral(token.text);
  4922. exp.sourceInfo = sourceInfo;
  4923. return exp;
  4924. }
  4925. /*
  4926. * Returns an object representing a function. It has
  4927. * four attributes: returnType, id, formalParams and block.
  4928. * The block object has two attributes: declarations and commands
  4929. **/
  4930. }, {
  4931. key: 'parseFunction',
  4932. value: function parseFunction() {
  4933. this.pushScope(IVProgParser.FUNCTION);
  4934. var formalParams = [];
  4935. var token = this.getToken();
  4936. if (token.type !== this.lexerClass.RK_FUNCTION) {
  4937. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  4938. return null;
  4939. }
  4940. this.pos++;
  4941. var funType = this.parseType();
  4942. var dimensions = 0;
  4943. if (this.checkOpenBrace(true)) {
  4944. this.pos++;
  4945. this.checkCloseBrace();
  4946. this.pos++;
  4947. dimensions++;
  4948. if (this.checkOpenBrace(true)) {
  4949. this.pos++;
  4950. this.checkCloseBrace();
  4951. this.pos++;
  4952. dimensions++;
  4953. }
  4954. }
  4955. var funcIDToken = this.getToken();
  4956. var functionID = this.parseID();
  4957. this.checkFunctionDuplicate(functionID, funcIDToken);
  4958. this.checkOpenParenthesis();
  4959. this.pos++;
  4960. this.consumeNewLines();
  4961. if (!this.checkCloseParenthesis(true)) {
  4962. formalParams = this.parseFormalParameters(); // formal parameters
  4963. this.consumeNewLines();
  4964. this.checkCloseParenthesis();
  4965. this.pos++;
  4966. } else {
  4967. this.pos++;
  4968. }
  4969. this.consumeNewLines();
  4970. var commandsBlock = this.parseCommandBlock();
  4971. var returnType = funType;
  4972. if (dimensions > 0) {
  4973. returnType = new _compoundType.CompoundType(funType, dimensions);
  4974. }
  4975. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  4976. if (functionID === null && !func.isMain) {
  4977. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  4978. } else if (func.isMain && formalParams.length !== 0) {
  4979. throw _syntaxErrorFactory.SyntaxErrorFactory.main_parameters();
  4980. }
  4981. this.popScope();
  4982. return func;
  4983. }
  4984. /*
  4985. * Parse the formal parameters of a function.
  4986. * @returns a list of objects with the following attributes: type, id and dimensions.
  4987. **/
  4988. }, {
  4989. key: 'parseFormalParameters',
  4990. value: function parseFormalParameters() {
  4991. var list = [];
  4992. while (true) {
  4993. var dimensions = 0;
  4994. var typeString = this.parseType();
  4995. var idToken = this.getToken();
  4996. var idString = this.parseID();
  4997. this.checkVariableDuplicate(idString, idToken);
  4998. if (this.checkOpenBrace(true)) {
  4999. this.pos++;
  5000. dimensions++;
  5001. this.checkCloseBrace();
  5002. this.pos++;
  5003. if (this.checkOpenBrace(true)) {
  5004. this.pos++;
  5005. dimensions++;
  5006. this.checkCloseBrace();
  5007. this.pos++;
  5008. }
  5009. }
  5010. var type = null;
  5011. if (dimensions > 0) {
  5012. type = new _compoundType.CompoundType(typeString, dimensions);
  5013. } else {
  5014. type = typeString;
  5015. }
  5016. list.push(new Commands.FormalParameter(type, idString));
  5017. var commaToken = this.getToken();
  5018. if (commaToken.type !== this.lexerClass.COMMA) break;
  5019. this.pos++;
  5020. this.consumeNewLines();
  5021. }
  5022. return list;
  5023. }
  5024. }, {
  5025. key: 'parseID',
  5026. value: function parseID() {
  5027. var token = this.getToken();
  5028. if (token.type !== this.lexerClass.ID) {
  5029. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5030. }
  5031. this.pos++;
  5032. if (this.insideScope(IVProgParser.FUNCTION)) {
  5033. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5034. return null;
  5035. }
  5036. }
  5037. return token.text;
  5038. }
  5039. }, {
  5040. key: 'parseMaybeLibID',
  5041. value: function parseMaybeLibID() {
  5042. var token = this.getToken();
  5043. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5044. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5045. }
  5046. this.pos++;
  5047. return token.text;
  5048. }
  5049. }, {
  5050. key: 'parseType',
  5051. value: function parseType() {
  5052. var token = this.getToken();
  5053. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5054. return _types.Types.VOID;
  5055. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5056. this.pos++;
  5057. return _types.Types.VOID;
  5058. } else if (this.isVariableType(token)) {
  5059. this.pos++;
  5060. switch (token.type) {
  5061. case this.lexerClass.RK_INTEGER:
  5062. return _types.Types.INTEGER;
  5063. case this.lexerClass.RK_BOOLEAN:
  5064. return _types.Types.BOOLEAN;
  5065. case this.lexerClass.RK_REAL:
  5066. return _types.Types.REAL;
  5067. case this.lexerClass.RK_STRING:
  5068. return _types.Types.STRING;
  5069. default:
  5070. break;
  5071. }
  5072. }
  5073. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  5074. }
  5075. }, {
  5076. key: 'parseCommandBlock',
  5077. value: function parseCommandBlock() {
  5078. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5079. var variablesDecl = [];
  5080. var commands = [];
  5081. var hasOpen = false;
  5082. if (this.checkOpenCurly(optionalCurly)) {
  5083. this.pos++;
  5084. hasOpen = true;
  5085. }
  5086. this.consumeNewLines();
  5087. while (true) {
  5088. var cmd = this.parseCommand();
  5089. if (cmd === null) break;
  5090. if (cmd !== -1) {
  5091. if (cmd instanceof Array) {
  5092. variablesDecl = variablesDecl.concat(cmd);
  5093. } else {
  5094. commands.push(cmd);
  5095. }
  5096. }
  5097. }
  5098. this.consumeNewLines();
  5099. if (hasOpen) {
  5100. this.checkCloseCurly();
  5101. this.pos++;
  5102. this.consumeNewLines();
  5103. }
  5104. return new Commands.CommandBlock(variablesDecl, commands);
  5105. }
  5106. }, {
  5107. key: 'parseCommand',
  5108. value: function parseCommand() {
  5109. var token = this.getToken();
  5110. if (this.isVariableType(token)) {
  5111. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5112. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  5113. }
  5114. this.pushScope(IVProgParser.BASE);
  5115. var varType = this.parseType();
  5116. this.popScope();
  5117. var cmd = this.parseDeclaration(varType);
  5118. this.checkEOS();
  5119. this.pos++;
  5120. return cmd;
  5121. } else if (token.type === this.lexerClass.ID) {
  5122. return this.parseIDCommand();
  5123. } else if (token.type === this.lexerClass.LIB_ID) {
  5124. return this.parseIDCommand();
  5125. } else if (token.type === this.lexerClass.RK_RETURN) {
  5126. return this.parseReturn();
  5127. } else if (token.type === this.lexerClass.RK_WHILE) {
  5128. return this.parseWhile();
  5129. } else if (token.type === this.lexerClass.RK_FOR) {
  5130. return this.parseFor();
  5131. } else if (token.type === this.lexerClass.RK_BREAK) {
  5132. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5133. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5134. }
  5135. return this.parseBreak();
  5136. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5137. return this.parseSwitchCase();
  5138. } else if (token.type === this.lexerClass.RK_DO) {
  5139. return this.parseDoWhile();
  5140. } else if (token.type === this.lexerClass.RK_IF) {
  5141. return this.parseIfThenElse();
  5142. } else if (this.checkEOS(true)) {
  5143. this.pos++;
  5144. return -1;
  5145. } else {
  5146. return null;
  5147. }
  5148. }
  5149. }, {
  5150. key: 'parseSwitchCase',
  5151. value: function parseSwitchCase() {
  5152. this.pushScope(IVProgParser.BREAKABLE);
  5153. this.pos++;
  5154. this.checkOpenParenthesis();
  5155. this.pos++;
  5156. this.consumeNewLines();
  5157. var exp = this.parseExpressionOR();
  5158. this.consumeNewLines();
  5159. this.checkCloseParenthesis();
  5160. this.pos++;
  5161. this.consumeNewLines();
  5162. this.checkOpenCurly();
  5163. this.pos++;
  5164. this.consumeNewLines();
  5165. var casesList = this.parseCases();
  5166. this.consumeNewLines();
  5167. this.checkCloseCurly();
  5168. this.pos++;
  5169. this.consumeNewLines();
  5170. this.popScope();
  5171. return new Commands.Switch(exp, casesList);
  5172. }
  5173. }, {
  5174. key: 'parseDoWhile',
  5175. value: function parseDoWhile() {
  5176. this.pos++;
  5177. this.consumeNewLines();
  5178. this.pushScope(IVProgParser.BREAKABLE);
  5179. var commandsBlock = this.parseCommandBlock();
  5180. this.consumeNewLines(); //Maybe not...
  5181. var whileToken = this.getToken();
  5182. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5183. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5184. }
  5185. this.pos++;
  5186. this.checkOpenParenthesis();
  5187. this.pos++;
  5188. this.consumeNewLines();
  5189. var condition = this.parseExpressionOR();
  5190. this.consumeNewLines();
  5191. this.checkCloseParenthesis();
  5192. this.pos++;
  5193. this.checkEOS();
  5194. this.popScope();
  5195. return new Commands.DoWhile(condition, commandsBlock);
  5196. }
  5197. }, {
  5198. key: 'parseIfThenElse',
  5199. value: function parseIfThenElse() {
  5200. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5201. this.pushScope(IVProgParser.BREAKABLE);
  5202. } else {
  5203. this.pushScope(IVProgParser.COMMAND);
  5204. }
  5205. this.pos++;
  5206. this.checkOpenParenthesis();
  5207. this.pos++;
  5208. this.consumeNewLines();
  5209. var logicalExpression = this.parseExpressionOR();
  5210. this.consumeNewLines();
  5211. this.checkCloseParenthesis();
  5212. this.pos++;
  5213. this.consumeNewLines();
  5214. var cmdBlocks = this.parseCommandBlock();
  5215. var maybeElse = this.getToken();
  5216. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5217. this.pos++;
  5218. this.consumeNewLines();
  5219. var maybeIf = this.getToken();
  5220. var elseBlock = null;
  5221. if (this.checkOpenCurly(true)) {
  5222. elseBlock = this.parseCommandBlock();
  5223. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5224. elseBlock = this.parseIfThenElse();
  5225. } else {
  5226. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5227. }
  5228. return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  5229. }
  5230. this.popScope();
  5231. return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  5232. }
  5233. }, {
  5234. key: 'parseFor',
  5235. value: function parseFor() {
  5236. this.pushScope(IVProgParser.BREAKABLE);
  5237. this.pos++;
  5238. this.checkOpenParenthesis();
  5239. this.pos++;
  5240. this.consumeNewLines();
  5241. var attribution = this.parseForAssign();
  5242. this.consumeNewLines();
  5243. var condition = this.parseExpressionOR();
  5244. this.consumeForSemiColon();
  5245. var increment = this.parseForAssign(true);
  5246. this.checkCloseParenthesis();
  5247. this.pos++;
  5248. this.consumeNewLines();
  5249. var commandsBlock = this.parseCommandBlock();
  5250. this.popScope();
  5251. return new Commands.For(attribution, condition, increment, commandsBlock);
  5252. }
  5253. }, {
  5254. key: 'parseWhile',
  5255. value: function parseWhile() {
  5256. this.pushScope(IVProgParser.BREAKABLE);
  5257. this.pos++;
  5258. this.checkOpenParenthesis();
  5259. this.pos++;
  5260. this.consumeNewLines();
  5261. var logicalExpression = this.parseExpressionOR();
  5262. this.consumeNewLines();
  5263. this.checkCloseParenthesis();
  5264. this.pos++;
  5265. this.consumeNewLines();
  5266. var cmdBlocks = this.parseCommandBlock();
  5267. this.popScope();
  5268. return new Commands.While(logicalExpression, cmdBlocks);
  5269. }
  5270. }, {
  5271. key: 'parseBreak',
  5272. value: function parseBreak() {
  5273. this.pos++;
  5274. this.checkEOS();
  5275. this.pos++;
  5276. return new Commands.Break();
  5277. }
  5278. }, {
  5279. key: 'parseReturn',
  5280. value: function parseReturn() {
  5281. this.pos++;
  5282. var exp = null;
  5283. if (!this.checkEOS(true)) {
  5284. exp = this.parseExpressionOR();
  5285. this.checkEOS();
  5286. }
  5287. this.pos++;
  5288. return new Commands.Return(exp);
  5289. }
  5290. }, {
  5291. key: 'parseIDCommand',
  5292. value: function parseIDCommand() {
  5293. var refToken = this.getToken();
  5294. var isID = refToken.type === this.lexerClass.ID;
  5295. var id = this.parseMaybeLibID();
  5296. if (this.checkOpenBrace(true)) {
  5297. this.pos++;
  5298. var lineExpression = null;
  5299. var columnExpression = null;
  5300. this.consumeNewLines();
  5301. lineExpression = this.parseExpression();
  5302. this.consumeNewLines();
  5303. this.checkCloseBrace();
  5304. this.pos++;
  5305. if (this.checkOpenBrace(true)) {
  5306. this.pos++;
  5307. this.consumeNewLines();
  5308. columnExpression = this.parseExpression();
  5309. this.consumeNewLines();
  5310. this.checkCloseBrace();
  5311. this.pos++;
  5312. }
  5313. var equalToken = this.getToken();
  5314. if (equalToken.type !== this.lexerClass.EQUAL) {
  5315. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  5316. }
  5317. this.pos++;
  5318. var exp = this.parseExpressionOR();
  5319. this.checkEOS();
  5320. this.pos++;
  5321. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  5322. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  5323. return cmd;
  5324. }
  5325. var equalOrParenthesis = this.getToken();
  5326. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5327. this.pos++;
  5328. var _exp = this.parseExpressionOR();
  5329. this.checkEOS();
  5330. this.pos++;
  5331. var _cmd = new Commands.Assign(id, _exp);
  5332. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  5333. return _cmd;
  5334. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5335. var funcCall = this.parseFunctionCallCommand(id);
  5336. this.checkEOS();
  5337. this.pos++;
  5338. return funcCall;
  5339. } else if (isID) {
  5340. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  5341. } else {
  5342. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  5343. }
  5344. }
  5345. }, {
  5346. key: 'parseForAssign',
  5347. value: function parseForAssign() {
  5348. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5349. if (!isLast) this.consumeNewLines();
  5350. if (this.checkEOS(true)) {
  5351. return null;
  5352. }
  5353. var id = this.parseID();
  5354. var equal = this.getToken();
  5355. if (equal.type !== this.lexerClass.EQUAL) {
  5356. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  5357. }
  5358. this.pos++;
  5359. var exp = this.parseExpressionOR();
  5360. if (!isLast) {
  5361. this.consumeForSemiColon();
  5362. }
  5363. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  5364. var cmd = new Commands.Assign(id, exp);
  5365. cmd.sourceInfo = sourceInfo;
  5366. return cmd;
  5367. }
  5368. }, {
  5369. key: 'parseCases',
  5370. value: function parseCases() {
  5371. var token = this.getToken();
  5372. if (token.type !== this.lexerClass.RK_CASE) {
  5373. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5374. }
  5375. this.pos++;
  5376. var nextToken = this.getToken();
  5377. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5378. this.pos++;
  5379. var colonToken = this.getToken();
  5380. if (colonToken.type !== this.lexerClass.COLON) {
  5381. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  5382. }
  5383. this.pos++;
  5384. this.consumeNewLines();
  5385. var block = this.parseCommandBlock(true);
  5386. var defaultCase = new Commands.Case(null);
  5387. defaultCase.setCommands(block.commands);
  5388. return [defaultCase];
  5389. } else {
  5390. var exp = this.parseExpressionOR();
  5391. var _colonToken = this.getToken();
  5392. if (_colonToken.type !== this.lexerClass.COLON) {
  5393. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  5394. }
  5395. this.pos++;
  5396. this.consumeNewLines();
  5397. var _block = this.parseCommandBlock(true);
  5398. var aCase = new Commands.Case(exp);
  5399. aCase.setCommands(_block.commands);
  5400. var caseToken = this.getToken();
  5401. if (caseToken.type === this.lexerClass.RK_CASE) {
  5402. return [aCase].concat(this.parseCases());
  5403. } else {
  5404. return [aCase];
  5405. }
  5406. }
  5407. }
  5408. /*
  5409. * Parses an Expression following the structure:
  5410. *
  5411. * EOR => EAnd ( 'or' EOR)? #expression and
  5412. *
  5413. * EOR => ENot ('and' EOR)? #expression or
  5414. *
  5415. * ENot => 'not'? ER #expression not
  5416. *
  5417. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5418. *
  5419. * E => factor ((+, -) E)? #expression
  5420. *
  5421. * factor=> term ((*, /, %) factor)?
  5422. *
  5423. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5424. **/
  5425. }, {
  5426. key: 'parseExpressionOR',
  5427. value: function parseExpressionOR() {
  5428. var exp1 = this.parseExpressionAND();
  5429. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5430. var opToken = this.getToken();
  5431. this.pos++;
  5432. var or = (0, _operators.convertFromString)('or');
  5433. this.consumeNewLines();
  5434. var exp2 = this.parseExpressionAND();
  5435. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  5436. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5437. exp1 = _finalExp;
  5438. }
  5439. return exp1;
  5440. }
  5441. }, {
  5442. key: 'parseExpressionAND',
  5443. value: function parseExpressionAND() {
  5444. var exp1 = this.parseExpressionNot();
  5445. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5446. var opToken = this.getToken();
  5447. this.pos++;
  5448. var and = (0, _operators.convertFromString)('and');
  5449. this.consumeNewLines();
  5450. var exp2 = this.parseExpressionNot();
  5451. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  5452. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5453. exp1 = _finalExp2;
  5454. }
  5455. return exp1;
  5456. }
  5457. }, {
  5458. key: 'parseExpressionNot',
  5459. value: function parseExpressionNot() {
  5460. var maybeNotToken = this.getToken();
  5461. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5462. var opToken = this.getToken();
  5463. this.pos++;
  5464. var not = (0, _operators.convertFromString)('not');
  5465. var exp1 = this.parseExpressionRel();
  5466. finalExp = new Expressions.UnaryApp(not, exp1);
  5467. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5468. return finalExp;
  5469. } else {
  5470. return this.parseExpressionRel();
  5471. }
  5472. }
  5473. }, {
  5474. key: 'parseExpressionRel',
  5475. value: function parseExpressionRel() {
  5476. var exp1 = this.parseExpression();
  5477. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5478. var relToken = this.getToken();
  5479. this.pos++;
  5480. var rel = (0, _operators.convertFromString)(relToken.text);
  5481. var exp2 = this.parseExpression();
  5482. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  5483. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  5484. exp1 = _finalExp3;
  5485. }
  5486. return exp1;
  5487. }
  5488. }, {
  5489. key: 'parseExpression',
  5490. value: function parseExpression() {
  5491. var factor = this.parseFactor();
  5492. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5493. var sumOpToken = this.getToken();
  5494. this.pos++;
  5495. var op = (0, _operators.convertFromString)(sumOpToken.text);
  5496. var factor2 = this.parseFactor();
  5497. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  5498. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  5499. factor = _finalExp4;
  5500. }
  5501. return factor;
  5502. }
  5503. }, {
  5504. key: 'parseFactor',
  5505. value: function parseFactor() {
  5506. var term = this.parseTerm();
  5507. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5508. var multOpToken = this.getToken();
  5509. this.pos++;
  5510. var op = (0, _operators.convertFromString)(multOpToken.text);
  5511. var term2 = this.parseTerm();
  5512. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  5513. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  5514. term = _finalExp5;
  5515. }
  5516. return term;
  5517. }
  5518. }, {
  5519. key: 'parseTerm',
  5520. value: function parseTerm() {
  5521. var token = this.getToken();
  5522. var sourceInfo = null;
  5523. switch (token.type) {
  5524. case this.lexerClass.SUM_OP:
  5525. this.pos++;
  5526. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5527. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  5528. exp.sourceInfo = sourceInfo;
  5529. return exp;
  5530. case this.lexerClass.INTEGER:
  5531. this.pos++;
  5532. return this.getIntLiteral(token);
  5533. case this.lexerClass.REAL:
  5534. this.pos++;
  5535. return this.getRealLiteral(token);
  5536. case this.lexerClass.STRING:
  5537. this.pos++;
  5538. return this.getStringLiteral(token);
  5539. case this.lexerClass.RK_TRUE:
  5540. case this.lexerClass.RK_FALSE:
  5541. this.pos++;
  5542. return this.getBoolLiteral(token);
  5543. case this.lexerClass.OPEN_CURLY:
  5544. return this.parseArrayLiteral();
  5545. case this.lexerClass.ID:
  5546. case this.lexerClass.LIB_ID:
  5547. return this.parseIDTerm();
  5548. case this.lexerClass.OPEN_PARENTHESIS:
  5549. return this.parseParenthesisExp();
  5550. default:
  5551. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  5552. }
  5553. }
  5554. }, {
  5555. key: 'parseIDTerm',
  5556. value: function parseIDTerm() {
  5557. var tokenA = this.getToken();
  5558. var id = this.parseMaybeLibID();
  5559. var isID = tokenA.type === this.lexerClass.ID;
  5560. if (isID && this.checkOpenBrace(true)) {
  5561. var tokenB = null;
  5562. this.pos++;
  5563. var firstIndex = this.parseExpression();
  5564. var secondIndex = null;
  5565. this.consumeNewLines();
  5566. this.checkCloseBrace();
  5567. tokenB = this.getToken();
  5568. this.pos++;
  5569. if (this.checkOpenBrace(true)) {
  5570. this.pos++;
  5571. secondIndex = this.parseExpression();
  5572. this.consumeNewLines();
  5573. this.checkCloseBrace();
  5574. tokenB = this.getToken();
  5575. this.pos++;
  5576. }
  5577. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5578. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  5579. exp.sourceInfo = sourceInfo;
  5580. return exp;
  5581. } else if (this.checkOpenParenthesis(true)) {
  5582. return this.parseFunctionCallExpression(id);
  5583. } else if (isID) {
  5584. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  5585. var _exp2 = new Expressions.VariableLiteral(id);
  5586. _exp2.sourceInfo = _sourceInfo;
  5587. return _exp2;
  5588. } else {
  5589. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  5590. }
  5591. }
  5592. }, {
  5593. key: 'getFunctionName',
  5594. value: function getFunctionName(id) {
  5595. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  5596. if (name === null) {
  5597. if (id === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5598. return null;
  5599. }
  5600. return id;
  5601. } else {
  5602. return name;
  5603. }
  5604. }
  5605. }, {
  5606. key: 'parseFunctionCallExpression',
  5607. value: function parseFunctionCallExpression(id) {
  5608. var tokenA = this.getToken(this.pos - 1);
  5609. var actualParameters = this.parseActualParameters();
  5610. var tokenB = this.getToken(this.pos - 1);
  5611. var funcName = this.getFunctionName(id);
  5612. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5613. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  5614. cmd.sourceInfo = sourceInfo;
  5615. return cmd;
  5616. }
  5617. }, {
  5618. key: 'parseFunctionCallCommand',
  5619. value: function parseFunctionCallCommand(id) {
  5620. return this.parseFunctionCallExpression(id);
  5621. }
  5622. }, {
  5623. key: 'parseParenthesisExp',
  5624. value: function parseParenthesisExp() {
  5625. this.checkOpenParenthesis();
  5626. var tokenA = this.getToken();
  5627. this.pos++;
  5628. this.consumeNewLines();
  5629. var exp = this.parseExpressionOR();
  5630. this.consumeNewLines();
  5631. this.checkCloseParenthesis();
  5632. var tokenB = this.getToken();
  5633. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5634. this.pos++;
  5635. exp.sourceInfo = sourceInfo;
  5636. return exp;
  5637. }
  5638. }, {
  5639. key: 'parseActualParameters',
  5640. value: function parseActualParameters() {
  5641. this.checkOpenParenthesis();
  5642. this.pos++;
  5643. if (this.checkCloseParenthesis(true)) {
  5644. this.pos++;
  5645. return [];
  5646. }
  5647. this.consumeNewLines();
  5648. var list = this.parseExpressionList();
  5649. this.consumeNewLines();
  5650. this.checkCloseParenthesis();
  5651. this.pos++;
  5652. return list;
  5653. }
  5654. }, {
  5655. key: 'parseExpressionList',
  5656. value: function parseExpressionList() {
  5657. var list = [];
  5658. while (true) {
  5659. var exp = this.parseExpressionOR();
  5660. list.push(exp);
  5661. var maybeToken = this.getToken();
  5662. if (maybeToken.type !== this.lexerClass.COMMA) {
  5663. break;
  5664. } else {
  5665. this.pos++;
  5666. this.consumeNewLines();
  5667. }
  5668. }
  5669. return list;
  5670. }
  5671. }, {
  5672. key: 'getTypeArray',
  5673. value: function getTypeArray() {
  5674. var _this = this;
  5675. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5676. return types.map(function (x) {
  5677. return _this.lexer.literalNames[x];
  5678. });
  5679. }
  5680. }]);
  5681. return IVProgParser;
  5682. }();
  5683. /***/ }),
  5684. /***/ "./js/ast/operators.js":
  5685. /*!*****************************!*\
  5686. !*** ./js/ast/operators.js ***!
  5687. \*****************************/
  5688. /*! no static exports found */
  5689. /***/ (function(module, exports, __webpack_require__) {
  5690. "use strict";
  5691. Object.defineProperty(exports, "__esModule", {
  5692. value: true
  5693. });
  5694. exports.convertFromString = convertFromString;
  5695. var Operators = exports.Operators = Object.freeze({
  5696. ADD: { ord: 0, value: "+" },
  5697. SUB: { ord: 1, value: "-" },
  5698. MULT: { ord: 2, value: '*' },
  5699. DIV: { ord: 3, value: '/' },
  5700. MOD: { ord: 4, value: '%' },
  5701. GT: { ord: 5, value: '>' },
  5702. GE: { ord: 6, value: '>=' },
  5703. LT: { ord: 7, value: '<' },
  5704. LE: { ord: 8, value: '<=' },
  5705. EQ: { ord: 9, value: '==' },
  5706. NEQ: { ord: 10, value: '!=' },
  5707. AND: { ord: 11, value: 'and' },
  5708. OR: { ord: 12, value: 'or' },
  5709. NOT: { ord: 13, value: 'not' }
  5710. });
  5711. function convertFromString(op) {
  5712. switch (op) {
  5713. case '+':
  5714. return Operators.ADD;
  5715. case '-':
  5716. return Operators.SUB;
  5717. case '*':
  5718. return Operators.MULT;
  5719. case '/':
  5720. return Operators.DIV;
  5721. case '%':
  5722. return Operators.MOD;
  5723. case '>':
  5724. return Operators.GT;
  5725. case '>=':
  5726. return Operators.GE;
  5727. case '<':
  5728. return Operators.LT;
  5729. case '<=':
  5730. return Operators.LE;
  5731. case '==':
  5732. return Operators.EQ;
  5733. case '!=':
  5734. return Operators.NEQ;
  5735. case 'and':
  5736. return Operators.AND;
  5737. case 'or':
  5738. return Operators.OR;
  5739. case 'not':
  5740. return Operators.NOT;
  5741. }
  5742. }
  5743. /***/ }),
  5744. /***/ "./js/ast/sourceInfo.js":
  5745. /*!******************************!*\
  5746. !*** ./js/ast/sourceInfo.js ***!
  5747. \******************************/
  5748. /*! no static exports found */
  5749. /***/ (function(module, exports, __webpack_require__) {
  5750. "use strict";
  5751. Object.defineProperty(exports, "__esModule", {
  5752. value: true
  5753. });
  5754. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5755. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5756. var SourceInfo = exports.SourceInfo = function () {
  5757. _createClass(SourceInfo, null, [{
  5758. key: "createSourceInfo",
  5759. value: function createSourceInfo(token) {
  5760. return new SourceInfo(token.line, token.column, token.text.length);
  5761. }
  5762. }, {
  5763. key: "createSourceInfoFromList",
  5764. value: function createSourceInfoFromList(tokenA, tokenB) {
  5765. var line = tokenA.line;
  5766. var column = tokenA.column;
  5767. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  5768. // No idea why...
  5769. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  5770. return new SourceInfo(line, column, size);
  5771. }
  5772. }]);
  5773. function SourceInfo(line, column, size) {
  5774. _classCallCheck(this, SourceInfo);
  5775. this.line = line;
  5776. this.column = column;
  5777. this.size = size;
  5778. }
  5779. return SourceInfo;
  5780. }();
  5781. /***/ }),
  5782. /***/ "./js/io/domConsole.js":
  5783. /*!*****************************!*\
  5784. !*** ./js/io/domConsole.js ***!
  5785. \*****************************/
  5786. /*! no static exports found */
  5787. /***/ (function(module, exports, __webpack_require__) {
  5788. "use strict";
  5789. Object.defineProperty(exports, "__esModule", {
  5790. value: true
  5791. });
  5792. exports.DOMConsole = undefined;
  5793. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5794. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  5795. var _jquery2 = _interopRequireDefault(_jquery);
  5796. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5797. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5798. var DOMConsole = exports.DOMConsole = function () {
  5799. _createClass(DOMConsole, null, [{
  5800. key: 'USER',
  5801. get: function get() {
  5802. return 0;
  5803. }
  5804. }, {
  5805. key: 'INFO',
  5806. get: function get() {
  5807. return 1;
  5808. }
  5809. }, {
  5810. key: 'ERR',
  5811. get: function get() {
  5812. return 2;
  5813. }
  5814. }]);
  5815. function DOMConsole(elementID) {
  5816. _classCallCheck(this, DOMConsole);
  5817. this.input = null;
  5818. this.needInput = false;
  5819. this.termDiv = null;
  5820. this.anyKey = false;
  5821. this.parent = (0, _jquery2.default)(elementID);
  5822. this.setup();
  5823. this.inputListeners = [];
  5824. }
  5825. _createClass(DOMConsole, [{
  5826. key: 'setup',
  5827. value: function setup() {
  5828. this._setupDom();
  5829. this._setupEvents();
  5830. }
  5831. }, {
  5832. key: '_setupEvents',
  5833. value: function _setupEvents() {
  5834. var _this = this;
  5835. this.input.on("keydown", function (event) {
  5836. if (!_this.needInput) {
  5837. event.preventDefault();
  5838. return;
  5839. }
  5840. var keyCode = event.which;
  5841. if (keyCode === 13 || _this.anyKey) {
  5842. var text = _this.input.val();
  5843. text = text.replace('[\n\r]+', '');
  5844. _this.notifyListeners(text);
  5845. _this.write(text);
  5846. _this.input.val("");
  5847. }
  5848. });
  5849. }
  5850. }, {
  5851. key: '_setupDom',
  5852. value: function _setupDom() {
  5853. this.termDiv = (0, _jquery2.default)("<div></div>");
  5854. this.termDiv.addClass("ivprog-term-div");
  5855. this.input = (0, _jquery2.default)('<input text="type">');
  5856. this.input.addClass("ivprog-term-input");
  5857. this.termDiv.append(this.input);
  5858. this.parent.append(this.termDiv);
  5859. }
  5860. }, {
  5861. key: 'notifyListeners',
  5862. value: function notifyListeners(text) {
  5863. this.inputListeners.forEach(function (resolve) {
  5864. return resolve(text);
  5865. });
  5866. this.inputListeners.splice(0, this.inputListeners.length);
  5867. this.hideInput();
  5868. this.anyKey = false;
  5869. }
  5870. }, {
  5871. key: 'write',
  5872. value: function write(text) {
  5873. this._appendText(text, DOMConsole.USER);
  5874. }
  5875. }, {
  5876. key: 'info',
  5877. value: function info(text) {
  5878. this._appendText(text, DOMConsole.INFO);
  5879. }
  5880. }, {
  5881. key: 'err',
  5882. value: function err(text) {
  5883. this._appendText(text, DOMConsole.ERR);
  5884. }
  5885. }, {
  5886. key: '_appendText',
  5887. value: function _appendText(text, type) {
  5888. var divClass = this.getClassForType(type);
  5889. var textDiv = (0, _jquery2.default)("<div></div>");
  5890. textDiv.addClass(divClass);
  5891. textDiv.append(text);
  5892. textDiv.insertBefore(this.input);
  5893. this.scrollTerm();
  5894. }
  5895. }, {
  5896. key: 'scrollTerm',
  5897. value: function scrollTerm() {
  5898. this.termDiv.animate({
  5899. scrollTop: this.termDiv.prop('scrollHeight')
  5900. }, 0);
  5901. }
  5902. }, {
  5903. key: 'getClassForType',
  5904. value: function getClassForType(type) {
  5905. switch (type) {
  5906. case DOMConsole.USER:
  5907. return "ivprog-term-userText";
  5908. case DOMConsole.INFO:
  5909. return "ivprog-term-info";
  5910. case DOMConsole.ERR:
  5911. return "ivprog-term-error";
  5912. }
  5913. }
  5914. }, {
  5915. key: 'dispose',
  5916. value: function dispose() {
  5917. this.parent.off();
  5918. this.input.off();
  5919. this.input = null;
  5920. this.parent.empty();
  5921. }
  5922. }, {
  5923. key: 'showInput',
  5924. value: function showInput() {
  5925. this.needInput = true;
  5926. this.input.show();
  5927. this.input.focus();
  5928. }
  5929. }, {
  5930. key: 'hideInput',
  5931. value: function hideInput() {
  5932. this.needInput = false;
  5933. this.input.hide();
  5934. }
  5935. }, {
  5936. key: 'requestInput',
  5937. value: function requestInput(callback) {
  5938. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5939. this.inputListeners.push(callback);
  5940. this.anyKey = anyKey;
  5941. this.showInput();
  5942. }
  5943. }, {
  5944. key: 'sendOutput',
  5945. value: function sendOutput(text) {
  5946. var _this2 = this;
  5947. text.split("\n").forEach(function (t) {
  5948. t = t.replace(/\t/g, '&#9;');
  5949. _this2.write(t);
  5950. });
  5951. }
  5952. }, {
  5953. key: 'clear',
  5954. value: function clear() {
  5955. this.input.parent().children().not(this.input).remove();
  5956. this.input.val("");
  5957. }
  5958. }]);
  5959. return DOMConsole;
  5960. }();
  5961. /***/ }),
  5962. /***/ "./js/io/input.js":
  5963. /*!************************!*\
  5964. !*** ./js/io/input.js ***!
  5965. \************************/
  5966. /*! no static exports found */
  5967. /***/ (function(module, exports, __webpack_require__) {
  5968. "use strict";
  5969. Object.defineProperty(exports, "__esModule", {
  5970. value: true
  5971. });
  5972. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5973. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5974. var Input = exports.Input = function () {
  5975. function Input() {
  5976. _classCallCheck(this, Input);
  5977. }
  5978. _createClass(Input, [{
  5979. key: "requestInput",
  5980. value: function requestInput(callback) {
  5981. throw new Error("Must be implemented");
  5982. }
  5983. }]);
  5984. return Input;
  5985. }();
  5986. /***/ }),
  5987. /***/ "./js/io/output.js":
  5988. /*!*************************!*\
  5989. !*** ./js/io/output.js ***!
  5990. \*************************/
  5991. /*! no static exports found */
  5992. /***/ (function(module, exports, __webpack_require__) {
  5993. "use strict";
  5994. Object.defineProperty(exports, "__esModule", {
  5995. value: true
  5996. });
  5997. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5998. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5999. var Output = exports.Output = function () {
  6000. function Output() {
  6001. _classCallCheck(this, Output);
  6002. }
  6003. _createClass(Output, [{
  6004. key: "sendOutput",
  6005. value: function sendOutput(text) {
  6006. throw new Error("Must be implemented");
  6007. }
  6008. }]);
  6009. return Output;
  6010. }();
  6011. /***/ }),
  6012. /***/ "./js/main-sidebar.js":
  6013. /*!****************************!*\
  6014. !*** ./js/main-sidebar.js ***!
  6015. \****************************/
  6016. /*! no static exports found */
  6017. /***/ (function(module, exports, __webpack_require__) {
  6018. "use strict";
  6019. Object.defineProperty(exports, "__esModule", {
  6020. value: true
  6021. });
  6022. exports.StringTypes = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined;
  6023. var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6024. var _functions_sidebar = __webpack_require__(/*! ./visualUI/functions_sidebar */ "./js/visualUI/functions_sidebar.js");
  6025. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6026. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  6027. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  6028. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6029. var StringTypes = _lineI18n2.default.StringTypes;
  6030. exports.runner = _runner.runner;
  6031. exports.initVisualUI = _functions_sidebar.initVisualUI;
  6032. exports.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  6033. exports.StringTypes = StringTypes;
  6034. /***/ }),
  6035. /***/ "./js/processor/compatibilityTable.js":
  6036. /*!********************************************!*\
  6037. !*** ./js/processor/compatibilityTable.js ***!
  6038. \********************************************/
  6039. /*! no static exports found */
  6040. /***/ (function(module, exports, __webpack_require__) {
  6041. "use strict";
  6042. Object.defineProperty(exports, "__esModule", {
  6043. value: true
  6044. });
  6045. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  6046. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  6047. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6048. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6049. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6050. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6051. function buildInfixAddTable() {
  6052. var table = [[], [], [], []];
  6053. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6054. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6055. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6056. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6057. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6058. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6059. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  6060. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  6061. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6062. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  6063. return table;
  6064. }
  6065. function buildInfixMultiDivSubTable() {
  6066. var table = [[], [], [], []];
  6067. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6068. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6069. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6070. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6071. return table;
  6072. }
  6073. function buildInfixEqualityInequalityTable() {
  6074. var table = [[], [], [], []];
  6075. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6076. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6077. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6078. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6079. return table;
  6080. }
  6081. function buildInfixRelationalTable() {
  6082. var table = [[], [], [], []];
  6083. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6084. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6085. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6086. return table;
  6087. }
  6088. function buildInfixAndOrTable() {
  6089. var table = [[], [], [], []];
  6090. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6091. return table;
  6092. }
  6093. function buildInfixModTable() {
  6094. var table = [[], [], [], []];
  6095. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6096. return table;
  6097. }
  6098. function buildUnarySumSubList() {
  6099. var list = [];
  6100. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6101. list[_types.Types.REAL.ord] = _types.Types.REAL;
  6102. return list;
  6103. }
  6104. function buildUnaryNegList() {
  6105. var list = [];
  6106. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6107. return list;
  6108. }
  6109. function buildInfixCompatibilityTable() {
  6110. var compatibilityMap = new WeakMap();
  6111. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  6112. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  6113. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  6114. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  6115. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  6116. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  6117. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  6118. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  6119. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  6120. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  6121. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  6122. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  6123. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  6124. return compatibilityMap;
  6125. }
  6126. function buildUnaryCompatibilityTable() {
  6127. var compatibilityMap = new WeakMap();
  6128. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  6129. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  6130. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  6131. return compatibilityMap;
  6132. }
  6133. var infixMap = buildInfixCompatibilityTable();
  6134. var unaryMap = buildUnaryCompatibilityTable();
  6135. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6136. try {
  6137. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  6138. var newMulti = [];
  6139. for (var i = 0; i < leftExpressionType.types.length; i++) {
  6140. var element = leftExpressionType.types[i];
  6141. if (rightExpressionType.types.indexOf(element) !== -1) {
  6142. newMulti.push(element);
  6143. }
  6144. }
  6145. if (newMulti.length <= 0) {
  6146. if (_config.Config.enable_type_casting) {
  6147. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6148. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6149. return new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]);
  6150. }
  6151. }
  6152. }
  6153. return _types.Types.UNDEFINED;
  6154. } else {
  6155. return new _multiType.MultiType(newMulti);
  6156. }
  6157. } else if (leftExpressionType instanceof _multiType.MultiType) {
  6158. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6159. return rightExpressionType;
  6160. } else {
  6161. if (_config.Config.enable_type_casting) {
  6162. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6163. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6164. return rightExpressionType;
  6165. }
  6166. }
  6167. }
  6168. return _types.Types.UNDEFINED;
  6169. }
  6170. } else if (rightExpressionType instanceof _multiType.MultiType) {
  6171. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6172. return leftExpressionType;
  6173. } else {
  6174. if (_config.Config.enable_type_casting) {
  6175. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6176. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6177. return leftExpressionType;
  6178. }
  6179. }
  6180. }
  6181. return _types.Types.UNDEFINED;
  6182. }
  6183. }
  6184. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6185. if (resultType === null || resultType === undefined) {
  6186. if (_config.Config.enable_type_casting) {
  6187. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6188. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6189. if (operator === _operators.Operators.MOD) {
  6190. return _types.Types.INTEGER;
  6191. } else if (operator.ord >= 5 && operator.ord <= 10) {
  6192. return _types.Types.BOOLEAN;
  6193. }
  6194. }
  6195. }
  6196. }
  6197. return _types.Types.UNDEFINED;
  6198. }
  6199. return resultType;
  6200. } catch (e) {
  6201. if (e instanceof TypeError) {
  6202. return _types.Types.UNDEFINED;
  6203. } else {
  6204. throw e;
  6205. }
  6206. }
  6207. }
  6208. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6209. try {
  6210. if (leftExpressionType instanceof _multiType.MultiType) {
  6211. return leftExpressionType;
  6212. }
  6213. return unaryMap.get(operator)[leftExpressionType.ord];
  6214. } catch (e) {
  6215. if (e instanceof TypeError) {
  6216. return _types.Types.UNDEFINED;
  6217. } else {
  6218. throw e;
  6219. }
  6220. }
  6221. }
  6222. /***/ }),
  6223. /***/ "./js/processor/context.js":
  6224. /*!*********************************!*\
  6225. !*** ./js/processor/context.js ***!
  6226. \*********************************/
  6227. /*! no static exports found */
  6228. /***/ (function(module, exports, __webpack_require__) {
  6229. "use strict";
  6230. Object.defineProperty(exports, "__esModule", {
  6231. value: true
  6232. });
  6233. var Context = exports.Context = Object.freeze({
  6234. BASE: Symbol('context:base'),
  6235. BREAKABLE: Symbol('context:breakable'),
  6236. FUNCTION: Symbol('context:function')
  6237. });
  6238. /***/ }),
  6239. /***/ "./js/processor/definedFunctions.js":
  6240. /*!******************************************!*\
  6241. !*** ./js/processor/definedFunctions.js ***!
  6242. \******************************************/
  6243. /*! no static exports found */
  6244. /***/ (function(module, exports, __webpack_require__) {
  6245. "use strict";
  6246. Object.defineProperty(exports, "__esModule", {
  6247. value: true
  6248. });
  6249. exports.LanguageDefinedFunction = undefined;
  6250. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6251. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6252. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6253. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6254. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6255. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6256. function valueToKey(value, object) {
  6257. for (var key in object) {
  6258. if (object.hasOwnProperty(key)) {
  6259. if (object[key] === value) {
  6260. return key;
  6261. }
  6262. }
  6263. }
  6264. return null;
  6265. }
  6266. function concatObjects() {
  6267. var result = {};
  6268. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  6269. objs[_key] = arguments[_key];
  6270. }
  6271. for (var i = 0; i < objs.length; i++) {
  6272. var obj = objs[i];
  6273. for (var key in obj) {
  6274. if (obj.hasOwnProperty(key)) {
  6275. result[key] = obj[key];
  6276. }
  6277. }
  6278. }
  6279. return result;
  6280. }
  6281. var libsObject = {
  6282. $mathLib: {
  6283. $sin: (0, _math.createSinFun)(),
  6284. $cos: (0, _math.createCosFun)(),
  6285. $tan: (0, _math.createTanFun)(),
  6286. $sqrt: (0, _math.createSqrtFun)(),
  6287. $pow: (0, _math.createPowFun)(),
  6288. $log: (0, _math.createLogFun)(),
  6289. $abs: (0, _math.createAbsFun)(),
  6290. $negate: (0, _math.createNegateFun)(),
  6291. $invert: (0, _math.createInvertFun)(),
  6292. $max: (0, _math.createMaxFun)(),
  6293. $min: (0, _math.createMinFun)()
  6294. },
  6295. $ioLib: {
  6296. $read: (0, _io.createInputFun)(),
  6297. $write: (0, _io.createOutputFun)()
  6298. },
  6299. $strLib: {
  6300. $substring: (0, _strings.createSubstringFun)(),
  6301. $length: (0, _strings.createLengthFun)(),
  6302. $uppercase: (0, _strings.createUppercaseFun)(),
  6303. $lowercase: (0, _strings.createLowercaseFun)(),
  6304. $charAt: (0, _strings.createrCharAtFun)()
  6305. },
  6306. $arrayLib: {
  6307. $numElements: (0, _arrays.createNumElementsFun)(),
  6308. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  6309. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  6310. },
  6311. $langLib: {
  6312. $isReal: (0, _lang.createIsRealFun)(),
  6313. $isInt: (0, _lang.createIsIntFun)(),
  6314. $isBool: (0, _lang.createIsBoolFun)(),
  6315. $castReal: (0, _lang.createCastRealFun)(),
  6316. $castInt: (0, _lang.createCastIntFun)(),
  6317. $castBool: (0, _lang.createCastBoolFun)(),
  6318. $castString: (0, _lang.createCastStringFun)()
  6319. }
  6320. };
  6321. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6322. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  6323. getMainFunctionName: function getMainFunctionName() {
  6324. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  6325. },
  6326. getInternalName: function getInternalName(localName) {
  6327. if (localName.indexOf(".") !== -1) {
  6328. var names = localName.split(".");
  6329. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  6330. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  6331. if (lib === null || internalName === null) {
  6332. return null;
  6333. }
  6334. return lib + "." + internalName;
  6335. }
  6336. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  6337. if (funcName !== null) {
  6338. if (funcsObject[funcName]) {
  6339. return funcName;
  6340. }
  6341. }
  6342. return null;
  6343. },
  6344. getFunction: function getFunction(internalName) {
  6345. if (internalName.indexOf(".") !== -1) {
  6346. var names = internalName.split(".");
  6347. var libName = names[0];
  6348. var funName = names[1];
  6349. return libsObject[libName][funName];
  6350. }
  6351. return funcsObject[internalName];
  6352. },
  6353. getLocalName: function getLocalName(internalName) {
  6354. if (internalName.indexOf(".") !== -1) {
  6355. var names = internalName.split(".");
  6356. var libName = _languageService.LanguageService.getCurrentLangLibs()[names[0]];
  6357. var funName = _languageService.LanguageService.getCurrentLangFuncs()[names[1]];
  6358. return libName + '.' + funName;
  6359. } else if (_languageService.LanguageService.getCurrentLangFuncs()[internalName]) {
  6360. return _languageService.LanguageService.getCurrentLangFuncs()[internalName];
  6361. } else {
  6362. return internalName;
  6363. }
  6364. }
  6365. });
  6366. /***/ }),
  6367. /***/ "./js/processor/error/processorErrorFactory.js":
  6368. /*!*****************************************************!*\
  6369. !*** ./js/processor/error/processorErrorFactory.js ***!
  6370. \*****************************************************/
  6371. /*! no static exports found */
  6372. /***/ (function(module, exports, __webpack_require__) {
  6373. "use strict";
  6374. Object.defineProperty(exports, "__esModule", {
  6375. value: true
  6376. });
  6377. exports.ProcessorErrorFactory = undefined;
  6378. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6379. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6380. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6381. var _operators = __webpack_require__(/*! ../../ast/operators */ "./js/ast/operators.js");
  6382. function translateType(type, dim) {
  6383. switch (dim) {
  6384. case 0:
  6385. return _localizedStringsService.LocalizedStrings.getUI(type);
  6386. default:
  6387. var transType = _localizedStringsService.LocalizedStrings.getUI(type);
  6388. if (dim === 1) return _localizedStringsService.LocalizedStrings.getUI("vector_string", [transType]);else return _localizedStringsService.LocalizedStrings.getUI("matrix_string", [transType]);
  6389. }
  6390. }
  6391. function translateOp(op) {
  6392. switch (op.ord) {
  6393. case _operators.Operators.AND.ord:
  6394. case _operators.Operators.OR.ord:
  6395. case _operators.Operators.NOT.ord:
  6396. return _localizedStringsService.LocalizedStrings.getUI(op.value);
  6397. default:
  6398. return op.value;
  6399. }
  6400. }
  6401. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({
  6402. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6403. if (sourceInfo) {
  6404. var context = [id, sourceInfo.line, sourceInfo.column];
  6405. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found_full", context));
  6406. } else {
  6407. return ProcessorErrorFactory.symbol_not_found(id);
  6408. }
  6409. },
  6410. symbol_not_found: function symbol_not_found(id) {
  6411. var context = [id];
  6412. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found", context));
  6413. },
  6414. function_missing_full: function function_missing_full(id, sourceInfo) {
  6415. if (sourceInfo) {
  6416. var context = [id, sourceInfo.line, sourceInfo.column];
  6417. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing_full", context));
  6418. } else {
  6419. return ProcessorErrorFactory.function_missing(id);
  6420. }
  6421. },
  6422. function_missing: function function_missing(id) {
  6423. var context = [id];
  6424. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing", context));
  6425. },
  6426. main_missing: function main_missing() {
  6427. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("main_missing"));
  6428. }, // TODO: better urgent error message
  6429. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6430. if (sourceInfo) {
  6431. var context = [sourceInfo.line];
  6432. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int_full", context));
  6433. } else {
  6434. return ProcessorErrorFactory.array_dimension_not_int();
  6435. }
  6436. },
  6437. array_dimension_not_int: function array_dimension_not_int() {
  6438. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int"));
  6439. },
  6440. unknown_command_full: function unknown_command_full(sourceInfo) {
  6441. if (sourceInfo) {
  6442. var context = [sourceInfo.line];
  6443. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command_full", context));
  6444. } else {
  6445. return ProcessorErrorFactory.unknown_command();
  6446. }
  6447. },
  6448. unknown_command: function unknown_command() {
  6449. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command"));
  6450. },
  6451. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6452. if (sourceInfo) {
  6453. var context = [translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6454. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_full", context));
  6455. } else {
  6456. return ProcessorErrorFactory.incompatible_types(type, dim);
  6457. }
  6458. },
  6459. incompatible_types: function incompatible_types(type, dim) {
  6460. var context = [translateType(type, dim)];
  6461. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types", context));
  6462. },
  6463. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6464. if (sourceInfo) {
  6465. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6466. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array_full", context));
  6467. } else {
  6468. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6469. }
  6470. },
  6471. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6472. var context = [exp, translateType(type, dim)];
  6473. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array", context));
  6474. },
  6475. loop_condition_type_full: function loop_condition_type_full(sourceInfo) {
  6476. if (sourceInfo) {
  6477. var context = [sourceInfo.line, sourceInfo.column];
  6478. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type_full", context));
  6479. } else {
  6480. return ProcessorErrorFactory.loop_condition_type();
  6481. }
  6482. },
  6483. loop_condition_type: function loop_condition_type() {
  6484. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type"));
  6485. },
  6486. endless_loop_full: function endless_loop_full(sourceInfo) {
  6487. if (sourceInfo) {
  6488. var context = [sourceInfo.line];
  6489. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop_full", context));
  6490. } else {
  6491. return ProcessorErrorFactory.endless_loop();
  6492. }
  6493. },
  6494. endless_loop: function endless_loop() {
  6495. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop"));
  6496. },
  6497. for_condition_type_full: function for_condition_type_full(sourceInfo) {
  6498. if (sourceInfo) {
  6499. var context = [sourceInfo.line, sourceInfo.column];
  6500. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type_full", context));
  6501. } else {
  6502. return ProcessorErrorFactory.for_condition_type();
  6503. }
  6504. },
  6505. for_condition_type: function for_condition_type() {
  6506. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type"));
  6507. },
  6508. if_condition_type_full: function if_condition_type_full(sourceInfo) {
  6509. if (sourceInfo) {
  6510. var context = [sourceInfo.line, sourceInfo.column];
  6511. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type_full", context));
  6512. } else {
  6513. return ProcessorErrorFactory.if_condition_type();
  6514. }
  6515. },
  6516. if_condition_type: function if_condition_type() {
  6517. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type"));
  6518. },
  6519. invalid_global_var: function invalid_global_var() {
  6520. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_global_var"));
  6521. },
  6522. not_implemented: function not_implemented(id) {
  6523. var context = [id];
  6524. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("not_implemented", context));
  6525. },
  6526. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6527. if (sourceInfo) {
  6528. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6529. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type_full", context));
  6530. } else {
  6531. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6532. }
  6533. },
  6534. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6535. var context = [exp, translateType(type, dim)];
  6536. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type", context));
  6537. },
  6538. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6539. if (sourceInfo) {
  6540. var context = [sourceInfo.line, sourceInfo.column, id];
  6541. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression_full", context));
  6542. } else {
  6543. return ProcessorErrorFactory.void_in_expression(id);
  6544. }
  6545. },
  6546. void_in_expression: function void_in_expression(id) {
  6547. var context = [id];
  6548. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression", context));
  6549. },
  6550. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6551. if (sourceInfo) {
  6552. var context = [id, sourceInfo.line, sourceInfo.column];
  6553. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access_full", context));
  6554. } else {
  6555. return ProcessorErrorFactory.invalid_array_access(id);
  6556. }
  6557. },
  6558. invalid_array_access: function invalid_array_access(id) {
  6559. var context = [id];
  6560. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access", context));
  6561. },
  6562. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6563. if (sourceInfo) {
  6564. var context = [id, sourceInfo.line, sourceInfo.column];
  6565. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access_full", context));
  6566. } else {
  6567. return ProcessorErrorFactory.invalid_matrix_access(id);
  6568. }
  6569. },
  6570. invalid_matrix_access: function invalid_matrix_access(id) {
  6571. var context = [id];
  6572. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access", context));
  6573. },
  6574. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6575. if (sourceInfo) {
  6576. var context = [sourceInfo.line, value, id, columns];
  6577. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6578. } else {
  6579. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6580. }
  6581. },
  6582. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6583. var context = [value, id, columns];
  6584. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds", context));
  6585. },
  6586. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6587. if (sourceInfo) {
  6588. var context = [sourceInfo.line, value, id, lines];
  6589. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6590. } else {
  6591. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6592. }
  6593. },
  6594. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6595. var context = [value, id, lines];
  6596. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds", context));
  6597. },
  6598. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6599. if (sourceInfo) {
  6600. var context = [sourceInfo.line, value, id, lines];
  6601. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds_full", context));
  6602. } else {
  6603. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6604. }
  6605. },
  6606. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6607. var context = [value, id, lines];
  6608. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds", context));
  6609. },
  6610. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6611. if (sourceInfo) {
  6612. var context = [sourceInfo.line, id];
  6613. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix_full", context));
  6614. } else {
  6615. return ProcessorErrorFactory.vector_not_matrix(id);
  6616. }
  6617. },
  6618. vector_not_matrix: function vector_not_matrix(id) {
  6619. var context = [id];
  6620. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix", context));
  6621. },
  6622. function_no_return: function function_no_return(id) {
  6623. var context = [id];
  6624. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_no_return", context));
  6625. },
  6626. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6627. if (sourceInfo) {
  6628. var context = [sourceInfo.line, id, translateType(type, dim)];
  6629. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6630. } else {
  6631. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6632. }
  6633. },
  6634. invalid_void_return: function invalid_void_return(id, type, dim) {
  6635. var context = [id, translateType(type, dim)];
  6636. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6637. },
  6638. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6639. if (sourceInfo) {
  6640. var context = [sourceInfo.line, id, translateType(type, dim)];
  6641. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type_full", context));
  6642. } else {
  6643. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6644. }
  6645. },
  6646. invalid_return_type: function invalid_return_type(id, type, dim) {
  6647. var context = [id, translateType(type, dim)];
  6648. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type", context));
  6649. },
  6650. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6651. if (sourceInfo) {
  6652. var context = [sourceInfo.line, id, expected, actual];
  6653. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size_full", context));
  6654. } else {
  6655. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6656. }
  6657. },
  6658. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6659. var context = [id, expected, actual];
  6660. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size", context));
  6661. },
  6662. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6663. if (sourceInfo) {
  6664. var context = [exp, id, sourceInfo.line];
  6665. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6666. } else {
  6667. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6668. }
  6669. },
  6670. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6671. var context = [exp, id];
  6672. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6673. },
  6674. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6675. if (sourceInfo) {
  6676. var context = [exp, id, sourceInfo.line];
  6677. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref_full", context));
  6678. } else {
  6679. return ProcessorErrorFactory.invalid_ref(id, exp);
  6680. }
  6681. },
  6682. invalid_ref: function invalid_ref(id, exp) {
  6683. var context = [exp, id];
  6684. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref", context));
  6685. },
  6686. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6687. if (sourceInfo) {
  6688. var context = [sourceInfo.line];
  6689. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command_full", context));
  6690. } else {
  6691. return ProcessorErrorFactory.unexpected_break_command();
  6692. }
  6693. },
  6694. unexpected_break_command: function unexpected_break_command() {
  6695. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command"));
  6696. },
  6697. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6698. if (sourceInfo) {
  6699. var context = [sourceInfo.line, exp];
  6700. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6701. } else {
  6702. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6703. }
  6704. },
  6705. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6706. var context = [exp];
  6707. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type", context));
  6708. },
  6709. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6710. if (sourceInfo) {
  6711. var context = [sourceInfo.line, expected, actual];
  6712. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6713. } else {
  6714. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6715. }
  6716. },
  6717. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6718. var context = [expected, actual];
  6719. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line", context));
  6720. },
  6721. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6722. if (sourceInfo) {
  6723. var context = [sourceInfo.line, expected, actual];
  6724. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6725. } else {
  6726. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6727. }
  6728. },
  6729. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6730. var context = [expected, actual];
  6731. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column", context));
  6732. },
  6733. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6734. if (sourceInfo) {
  6735. var context = [sourceInfo.line, translateOp(opName), translateType(type, dim)];
  6736. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op_full", context));
  6737. } else {
  6738. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6739. }
  6740. },
  6741. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6742. var context = [translateOp(opName), translateType(type, dim)];
  6743. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op", context));
  6744. },
  6745. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6746. if (sourceInfo) {
  6747. var context = [sourceInfo.line, translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6748. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op_full", context));
  6749. } else {
  6750. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6751. }
  6752. },
  6753. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6754. var context = [translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6755. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op", context));
  6756. },
  6757. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6758. if (sourceInfo) {
  6759. var context = [sourceInfo.line];
  6760. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6761. } else {
  6762. return ProcessorErrorFactory.array_dimension_not_positive();
  6763. }
  6764. },
  6765. array_dimension_not_positive: function array_dimension_not_positive() {
  6766. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive"));
  6767. }
  6768. });
  6769. /***/ }),
  6770. /***/ "./js/processor/error/runtimeError.js":
  6771. /*!********************************************!*\
  6772. !*** ./js/processor/error/runtimeError.js ***!
  6773. \********************************************/
  6774. /*! no static exports found */
  6775. /***/ (function(module, exports, __webpack_require__) {
  6776. "use strict";
  6777. Object.defineProperty(exports, "__esModule", {
  6778. value: true
  6779. });
  6780. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6781. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6782. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6783. var RuntimeError = exports.RuntimeError = function (_Error) {
  6784. _inherits(RuntimeError, _Error);
  6785. function RuntimeError() {
  6786. var _ref;
  6787. _classCallCheck(this, RuntimeError);
  6788. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6789. msg[_key] = arguments[_key];
  6790. }
  6791. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  6792. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  6793. return _this;
  6794. }
  6795. return RuntimeError;
  6796. }(Error);
  6797. /***/ }),
  6798. /***/ "./js/processor/error/semanticError.js":
  6799. /*!*********************************************!*\
  6800. !*** ./js/processor/error/semanticError.js ***!
  6801. \*********************************************/
  6802. /*! no static exports found */
  6803. /***/ (function(module, exports, __webpack_require__) {
  6804. "use strict";
  6805. Object.defineProperty(exports, "__esModule", {
  6806. value: true
  6807. });
  6808. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6809. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  6810. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  6811. var SemanticError = exports.SemanticError = function (_Error) {
  6812. _inherits(SemanticError, _Error);
  6813. function SemanticError() {
  6814. var _ref;
  6815. _classCallCheck(this, SemanticError);
  6816. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6817. msg[_key] = arguments[_key];
  6818. }
  6819. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  6820. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  6821. return _this;
  6822. }
  6823. return SemanticError;
  6824. }(Error);
  6825. /***/ }),
  6826. /***/ "./js/processor/ivprogProcessor.js":
  6827. /*!*****************************************!*\
  6828. !*** ./js/processor/ivprogProcessor.js ***!
  6829. \*****************************************/
  6830. /*! no static exports found */
  6831. /***/ (function(module, exports, __webpack_require__) {
  6832. "use strict";
  6833. Object.defineProperty(exports, "__esModule", {
  6834. value: true
  6835. });
  6836. exports.IVProgProcessor = undefined;
  6837. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  6838. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  6839. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  6840. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  6841. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  6842. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  6843. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  6844. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6845. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6846. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  6847. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  6848. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  6849. var Commands = _interopRequireWildcard(_commands);
  6850. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  6851. var Expressions = _interopRequireWildcard(_expressions);
  6852. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  6853. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  6854. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6855. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6856. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6857. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6858. var _decimal2 = _interopRequireDefault(_decimal);
  6859. var _processorErrorFactory = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  6860. var _runtimeError = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  6861. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6862. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6863. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6864. var IVProgProcessor = exports.IVProgProcessor = function () {
  6865. _createClass(IVProgProcessor, null, [{
  6866. key: 'LOOP_TIMEOUT',
  6867. get: function get() {
  6868. return _config.Config.loopTimeout;
  6869. },
  6870. set: function set(ms) {
  6871. _config.Config.setConfig({ loopTimeout: ms });
  6872. }
  6873. }, {
  6874. key: 'MAIN_INTERNAL_ID',
  6875. get: function get() {
  6876. return "$main";
  6877. }
  6878. }]);
  6879. function IVProgProcessor(ast) {
  6880. _classCallCheck(this, IVProgProcessor);
  6881. this.ast = ast;
  6882. this.globalStore = new _store.Store("$global");
  6883. this.stores = [this.globalStore];
  6884. this.context = [_context.Context.BASE];
  6885. this.input = null;
  6886. this.forceKill = false;
  6887. this.loopTimers = [];
  6888. this.output = null;
  6889. }
  6890. _createClass(IVProgProcessor, [{
  6891. key: 'registerInput',
  6892. value: function registerInput(input) {
  6893. if (this.input !== null) this.input = null;
  6894. this.input = input;
  6895. }
  6896. }, {
  6897. key: 'registerOutput',
  6898. value: function registerOutput(output) {
  6899. if (this.output !== null) this.output = null;
  6900. this.output = output;
  6901. }
  6902. }, {
  6903. key: 'checkContext',
  6904. value: function checkContext(context) {
  6905. return this.context[this.context.length - 1] === context;
  6906. }
  6907. }, {
  6908. key: 'ignoreSwitchCases',
  6909. value: function ignoreSwitchCases(store) {
  6910. if (store.mode === _modes.Modes.RETURN) {
  6911. return true;
  6912. } else if (store.mode === _modes.Modes.BREAK) {
  6913. return true;
  6914. } else {
  6915. return false;
  6916. }
  6917. }
  6918. }, {
  6919. key: 'prepareState',
  6920. value: function prepareState() {
  6921. if (this.stores !== null) {
  6922. for (var i = 0; i < this.stores.length; i++) {
  6923. delete this.stores[i];
  6924. }
  6925. this.stores = null;
  6926. }
  6927. if (this.globalStore !== null) this.globalStore = null;
  6928. this.globalStore = new _store.Store("$global");
  6929. this.stores = [this.globalStore];
  6930. this.context = [_context.Context.BASE];
  6931. }
  6932. }, {
  6933. key: 'interpretAST',
  6934. value: function interpretAST() {
  6935. var _this = this;
  6936. this.prepareState();
  6937. return this.initGlobal().then(function (_) {
  6938. var mainFunc = _this.findMainFunction();
  6939. if (mainFunc === null) {
  6940. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  6941. }
  6942. return _this.runFunction(mainFunc, [], _this.globalStore);
  6943. });
  6944. }
  6945. }, {
  6946. key: 'initGlobal',
  6947. value: function initGlobal() {
  6948. if (!this.checkContext(_context.Context.BASE)) {
  6949. throw _processorErrorFactory.ProcessorErrorFactory.invalid_global_var();
  6950. }
  6951. return this.executeCommands(this.globalStore, this.ast.global);
  6952. }
  6953. }, {
  6954. key: 'findMainFunction',
  6955. value: function findMainFunction() {
  6956. return this.ast.functions.find(function (v) {
  6957. return v.isMain;
  6958. });
  6959. }
  6960. }, {
  6961. key: 'findFunction',
  6962. value: function findFunction(name) {
  6963. if (name.match(/^\$.+$/)) {
  6964. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  6965. if (!!!fun) {
  6966. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  6967. }
  6968. return fun;
  6969. } else {
  6970. var val = this.ast.functions.find(function (v) {
  6971. return v.name === name;
  6972. });
  6973. if (!!!val) {
  6974. // TODO: better error message;
  6975. throw _processorErrorFactory.ProcessorErrorFactory.function_missing(name);
  6976. }
  6977. return val;
  6978. }
  6979. }
  6980. }, {
  6981. key: 'runFunction',
  6982. value: function runFunction(func, actualParameters, store) {
  6983. var _this2 = this;
  6984. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  6985. var funcStore = new _store.Store(funcName);
  6986. funcStore.extendStore(this.globalStore);
  6987. var returnStoreObject = null;
  6988. if (func.returnType instanceof _compoundType.CompoundType) {
  6989. if (func.returnType.dimensions > 1) {
  6990. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  6991. } else {
  6992. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  6993. }
  6994. } else {
  6995. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  6996. }
  6997. funcStore.insertStore('$', returnStoreObject);
  6998. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  6999. return newFuncStore$.then(function (sto) {
  7000. _this2.context.push(_context.Context.FUNCTION);
  7001. _this2.stores.push(sto);
  7002. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  7003. return _this2.executeCommands(stoWithVars, func.commands);
  7004. }).then(function (finalSto) {
  7005. _this2.stores.pop();
  7006. _this2.context.pop();
  7007. return finalSto;
  7008. });
  7009. });
  7010. }
  7011. }, {
  7012. key: 'associateParameters',
  7013. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  7014. var _this3 = this;
  7015. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : calleeStore.name;
  7016. if (formalList.length != actualList.length) {
  7017. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size(funcName, formalList.length, actualList.length);
  7018. }
  7019. var promises$ = actualList.map(function (actualParameter) {
  7020. return _this3.evaluateExpression(callerStore, actualParameter);
  7021. });
  7022. return Promise.all(promises$).then(function (values) {
  7023. for (var i = 0; i < values.length; i++) {
  7024. var stoObj = values[i];
  7025. var exp = actualList[i];
  7026. var shouldTypeCast = false;
  7027. var formalParameter = formalList[i];
  7028. if (!formalParameter.type.isCompatible(stoObj.type)) {
  7029. if (_config.Config.enable_type_casting && !formalParameter.byRef && _store.Store.canImplicitTypeCast(formalParameter.type, stoObj.type)) {
  7030. shouldTypeCast = true;
  7031. } else {
  7032. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type(funcName, exp.toString());
  7033. }
  7034. }
  7035. if (formalParameter.byRef && !stoObj.inStore) {
  7036. throw _processorErrorFactory.ProcessorErrorFactory.invalid_ref(funcName, exp.toString());
  7037. }
  7038. if (formalParameter.byRef) {
  7039. var ref = null;
  7040. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7041. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  7042. } else {
  7043. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  7044. }
  7045. calleeStore.insertStore(formalParameter.id, ref);
  7046. } else {
  7047. var realValue = _this3.parseStoreObjectValue(stoObj);
  7048. if (shouldTypeCast) {
  7049. realValue = _store.Store.doImplicitCasting(formalParameter.type, realValue);
  7050. }
  7051. calleeStore.insertStore(formalParameter.id, realValue);
  7052. }
  7053. }
  7054. return calleeStore;
  7055. });
  7056. }
  7057. }, {
  7058. key: 'executeCommands',
  7059. value: function executeCommands(store, cmds) {
  7060. // helper to partially apply a function, in this case executeCommand
  7061. var outerRef = this;
  7062. var partial = function partial(fun, cmd) {
  7063. return function (sto) {
  7064. return fun(sto, cmd);
  7065. };
  7066. };
  7067. return cmds.reduce(function (lastCommand, next) {
  7068. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7069. return lastCommand.then(nextCommand);
  7070. }, Promise.resolve(store));
  7071. }
  7072. }, {
  7073. key: 'executeCommand',
  7074. value: function executeCommand(store, cmd) {
  7075. if (this.forceKill) {
  7076. return Promise.reject("FORCED_KILL!");
  7077. } else if (store.mode === _modes.Modes.PAUSE) {
  7078. return Promise.resolve(this.executeCommand(store, cmd));
  7079. } else if (store.mode === _modes.Modes.RETURN) {
  7080. return Promise.resolve(store);
  7081. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  7082. return Promise.resolve(store);
  7083. }
  7084. if (cmd instanceof Commands.Declaration) {
  7085. return this.executeDeclaration(store, cmd);
  7086. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  7087. return this.executeArrayIndexAssign(store, cmd);
  7088. } else if (cmd instanceof Commands.Assign) {
  7089. return this.executeAssign(store, cmd);
  7090. } else if (cmd instanceof Commands.Break) {
  7091. return this.executeBreak(store, cmd);
  7092. } else if (cmd instanceof Commands.Return) {
  7093. return this.executeReturn(store, cmd);
  7094. } else if (cmd instanceof Commands.IfThenElse) {
  7095. return this.executeIfThenElse(store, cmd);
  7096. } else if (cmd instanceof Commands.While) {
  7097. return this.executeWhile(store, cmd);
  7098. } else if (cmd instanceof Commands.DoWhile) {
  7099. return this.executeDoWhile(store, cmd);
  7100. } else if (cmd instanceof Commands.For) {
  7101. return this.executeFor(store, cmd);
  7102. } else if (cmd instanceof Commands.Switch) {
  7103. return this.executeSwitch(store, cmd);
  7104. } else if (cmd instanceof Expressions.FunctionCall) {
  7105. return this.executeFunctionCall(store, cmd);
  7106. } else if (cmd instanceof Commands.SysCall) {
  7107. return this.executeSysCall(store, cmd);
  7108. } else {
  7109. throw _processorErrorFactory.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
  7110. }
  7111. }
  7112. }, {
  7113. key: 'executeSysCall',
  7114. value: function executeSysCall(store, cmd) {
  7115. var func = cmd.langFunc.bind(this);
  7116. return func(store, cmd);
  7117. }
  7118. }, {
  7119. key: 'executeFunctionCall',
  7120. value: function executeFunctionCall(store, cmd) {
  7121. var func = null;
  7122. if (cmd.isMainCall) {
  7123. func = this.findMainFunction();
  7124. } else {
  7125. func = this.findFunction(cmd.id);
  7126. }
  7127. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7128. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  7129. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : func.name;
  7130. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.function_no_return(funcName));
  7131. } else {
  7132. return store;
  7133. }
  7134. });
  7135. }
  7136. }, {
  7137. key: 'executeSwitch',
  7138. value: function executeSwitch(store, cmd) {
  7139. var _this4 = this;
  7140. this.context.push(_context.Context.BREAKABLE);
  7141. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7142. return promise.then(function (result) {
  7143. var sto = result.sto;
  7144. if (_this4.ignoreSwitchCases(sto)) {
  7145. return Promise.resolve(result);
  7146. } else if (result.wasTrue || aCase.isDefault) {
  7147. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7148. return $newSto.then(function (nSto) {
  7149. return Promise.resolve({ wasTrue: true, sto: nSto });
  7150. });
  7151. } else {
  7152. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  7153. return $value.then(function (vl) {
  7154. if (vl.value) {
  7155. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7156. return _$newSto.then(function (nSto) {
  7157. return Promise.resolve({ wasTrue: true, sto: nSto });
  7158. });
  7159. } else {
  7160. return Promise.resolve({ wasTrue: false, sto: sto });
  7161. }
  7162. });
  7163. }
  7164. });
  7165. };
  7166. try {
  7167. var breakLoop = false;
  7168. var $result = Promise.resolve({ wasTrue: false, sto: store });
  7169. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7170. var aCase = cmd.cases[index];
  7171. $result = auxCaseFun($result, cmd.expression, aCase);
  7172. $result.then(function (r) {
  7173. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7174. });
  7175. }
  7176. return $result.then(function (r) {
  7177. _this4.context.pop();
  7178. if (r.sto.mode === _modes.Modes.BREAK) {
  7179. r.sto.mode = _modes.Modes.RUN;
  7180. }
  7181. return r.sto;
  7182. });
  7183. } catch (error) {
  7184. return Promise.reject(error);
  7185. }
  7186. }
  7187. }, {
  7188. key: 'executeFor',
  7189. value: function executeFor(store, cmd) {
  7190. try {
  7191. //BEGIN for -> while rewrite
  7192. var initCmd = cmd.assignment;
  7193. var condition = cmd.condition;
  7194. var increment = cmd.increment;
  7195. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  7196. var forAsWhile = new Commands.While(condition, whileBlock);
  7197. forAsWhile.sourceInfo = cmd.sourceInfo;
  7198. //END for -> while rewrite
  7199. var newCmdList = [initCmd, forAsWhile];
  7200. return this.executeCommands(store, newCmdList);
  7201. } catch (error) {
  7202. return Promise.reject(error);
  7203. }
  7204. }
  7205. }, {
  7206. key: 'executeDoWhile',
  7207. value: function executeDoWhile(store, cmd) {
  7208. var outerRef = this;
  7209. try {
  7210. outerRef.loopTimers.push(Date.now());
  7211. outerRef.context.push(_context.Context.BREAKABLE);
  7212. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7213. return $newStore.then(function (sto) {
  7214. if (sto.mode === _modes.Modes.BREAK) {
  7215. outerRef.context.pop();
  7216. sto.mode = _modes.Modes.RUN;
  7217. outerRef.loopTimers.pop();
  7218. return sto;
  7219. }
  7220. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7221. return $value.then(function (vl) {
  7222. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7223. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7224. }
  7225. if (vl.value) {
  7226. outerRef.context.pop();
  7227. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7228. var time = outerRef.loopTimers[i];
  7229. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7230. outerRef.forceKill = true;
  7231. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7232. }
  7233. }
  7234. return outerRef.executeCommand(sto, cmd);
  7235. } else {
  7236. outerRef.context.pop();
  7237. outerRef.loopTimers.pop();
  7238. return sto;
  7239. }
  7240. });
  7241. });
  7242. } catch (error) {
  7243. return Promise.reject(error);
  7244. }
  7245. }
  7246. }, {
  7247. key: 'executeWhile',
  7248. value: function executeWhile(store, cmd) {
  7249. var outerRef = this;
  7250. try {
  7251. outerRef.loopTimers.push(Date.now());
  7252. outerRef.context.push(_context.Context.BREAKABLE);
  7253. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7254. return $value.then(function (vl) {
  7255. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7256. if (vl.value) {
  7257. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7258. return $newStore.then(function (sto) {
  7259. outerRef.context.pop();
  7260. if (sto.mode === _modes.Modes.BREAK) {
  7261. outerRef.loopTimers.pop();
  7262. sto.mode = _modes.Modes.RUN;
  7263. return sto;
  7264. }
  7265. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7266. var time = outerRef.loopTimers[i];
  7267. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7268. outerRef.forceKill = true;
  7269. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7270. }
  7271. }
  7272. return outerRef.executeCommand(sto, cmd);
  7273. });
  7274. } else {
  7275. outerRef.context.pop();
  7276. outerRef.loopTimers.pop();
  7277. return store;
  7278. }
  7279. } else {
  7280. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7281. }
  7282. });
  7283. } catch (error) {
  7284. return Promise.reject(error);
  7285. }
  7286. }
  7287. }, {
  7288. key: 'executeIfThenElse',
  7289. value: function executeIfThenElse(store, cmd) {
  7290. var _this5 = this;
  7291. try {
  7292. var $value = this.evaluateExpression(store, cmd.condition);
  7293. return $value.then(function (vl) {
  7294. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7295. if (vl.value) {
  7296. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7297. } else if (cmd.ifFalse !== null) {
  7298. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  7299. return _this5.executeCommand(store, cmd.ifFalse);
  7300. } else {
  7301. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7302. }
  7303. } else {
  7304. return Promise.resolve(store);
  7305. }
  7306. } else {
  7307. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo));
  7308. }
  7309. });
  7310. } catch (error) {
  7311. return Promise.reject(error);
  7312. }
  7313. }
  7314. }, {
  7315. key: 'executeReturn',
  7316. value: function executeReturn(store, cmd) {
  7317. var _this6 = this;
  7318. try {
  7319. var funcType = store.applyStore('$').type;
  7320. var $value = this.evaluateExpression(store, cmd.expression);
  7321. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : store.name;
  7322. return $value.then(function (vl) {
  7323. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  7324. return Promise.resolve(store);
  7325. }
  7326. if (vl === null || !funcType.isCompatible(vl.type)) {
  7327. var stringInfo = funcType.stringInfo();
  7328. var info = stringInfo[0];
  7329. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7330. } else {
  7331. var realValue = _this6.parseStoreObjectValue(vl);
  7332. store.updateStore('$', realValue);
  7333. store.mode = _modes.Modes.RETURN;
  7334. return Promise.resolve(store);
  7335. }
  7336. });
  7337. } catch (error) {
  7338. return Promise.reject(error);
  7339. }
  7340. }
  7341. }, {
  7342. key: 'executeBreak',
  7343. value: function executeBreak(store, cmd) {
  7344. if (this.checkContext(_context.Context.BREAKABLE)) {
  7345. store.mode = _modes.Modes.BREAK;
  7346. return Promise.resolve(store);
  7347. } else {
  7348. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo));
  7349. }
  7350. }
  7351. }, {
  7352. key: 'executeAssign',
  7353. value: function executeAssign(store, cmd) {
  7354. var _this7 = this;
  7355. try {
  7356. var inStore = store.applyStore(cmd.id);
  7357. var $value = this.evaluateExpression(store, cmd.expression);
  7358. return $value.then(function (vl) {
  7359. var realValue = _this7.parseStoreObjectValue(vl);
  7360. if (!inStore.type.isCompatible(realValue.type)) {
  7361. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(inStore.type, vl.type)) {
  7362. realValue = _store.Store.doImplicitCasting(inStore.type, realValue);
  7363. } else {
  7364. var stringInfo = inStore.type.stringInfo();
  7365. var info = stringInfo[0];
  7366. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7367. }
  7368. }
  7369. store.updateStore(cmd.id, realValue);
  7370. return store;
  7371. });
  7372. } catch (error) {
  7373. return Promise.reject(error);
  7374. }
  7375. }
  7376. }, {
  7377. key: 'executeArrayIndexAssign',
  7378. value: function executeArrayIndexAssign(store, cmd) {
  7379. var _this8 = this;
  7380. var mustBeArray = store.applyStore(cmd.id);
  7381. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7382. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7383. }
  7384. var line$ = this.evaluateExpression(store, cmd.line);
  7385. var column$ = this.evaluateExpression(store, cmd.column);
  7386. var value$ = this.evaluateExpression(store, cmd.expression);
  7387. return Promise.all([line$, column$, value$]).then(function (results) {
  7388. var lineSO = results[0];
  7389. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7390. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7391. }
  7392. var line = lineSO.number;
  7393. var columnSO = results[1];
  7394. var column = null;
  7395. if (columnSO !== null) {
  7396. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7397. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7398. }
  7399. column = columnSO.number;
  7400. }
  7401. var value = _this8.parseStoreObjectValue(results[2]);
  7402. if (line >= mustBeArray.lines) {
  7403. if (mustBeArray.isVector) {
  7404. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7405. } else {
  7406. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7407. }
  7408. } else if (line < 0) {
  7409. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7410. }
  7411. if (column !== null && mustBeArray.columns === null) {
  7412. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7413. }
  7414. if (column !== null) {
  7415. if (column >= mustBeArray.columns) {
  7416. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7417. } else if (column < 0) {
  7418. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7419. }
  7420. }
  7421. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  7422. if (column !== null) {
  7423. if (value.type instanceof _compoundType.CompoundType || !newArray.type.canAccept(value.type)) {
  7424. var type = mustBeArray.type.innerType;
  7425. var stringInfo = type.stringInfo();
  7426. var info = stringInfo[0];
  7427. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7428. }
  7429. newArray.value[line].value[column] = value;
  7430. store.updateStore(cmd.id, newArray);
  7431. } else {
  7432. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType || !newArray.type.canAccept(value.type)) {
  7433. var _type = mustBeArray.type;
  7434. var _stringInfo = _type.stringInfo();
  7435. var _info = _stringInfo[0];
  7436. var exp = cmd.expression.toString();
  7437. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7438. }
  7439. newArray.value[line] = value;
  7440. store.updateStore(cmd.id, newArray);
  7441. }
  7442. return store;
  7443. });
  7444. }
  7445. }, {
  7446. key: 'executeDeclaration',
  7447. value: function executeDeclaration(store, cmd) {
  7448. try {
  7449. var $value = this.evaluateExpression(store, cmd.initial);
  7450. if (cmd instanceof Commands.ArrayDeclaration) {
  7451. var $lines = this.evaluateExpression(store, cmd.lines);
  7452. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7453. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7454. var lineSO = values[0];
  7455. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7456. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7457. }
  7458. var line = lineSO.number;
  7459. if (line < 0) {
  7460. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7461. }
  7462. var columnSO = values[1];
  7463. var column = null;
  7464. if (columnSO !== null) {
  7465. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7466. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7467. }
  7468. column = columnSO.number;
  7469. if (column < 0) {
  7470. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7471. }
  7472. }
  7473. var value = values[2];
  7474. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  7475. store.insertStore(cmd.id, temp);
  7476. var realValue = value;
  7477. if (value !== null) {
  7478. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7479. if (value.type instanceof _compoundType.CompoundType) {
  7480. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  7481. } else {
  7482. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  7483. }
  7484. }
  7485. } else {
  7486. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  7487. if (column !== null) {
  7488. for (var i = 0; i < line; i++) {
  7489. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  7490. }
  7491. }
  7492. }
  7493. realValue.readOnly = cmd.isConst;
  7494. store.updateStore(cmd.id, realValue);
  7495. return store;
  7496. });
  7497. } else {
  7498. var temp = new _storeObject.StoreObject(cmd.type, null);
  7499. store.insertStore(cmd.id, temp);
  7500. return $value.then(function (vl) {
  7501. var realValue = vl;
  7502. if (vl !== null) {
  7503. if (!vl.type.isCompatible(cmd.type)) {
  7504. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(cmd.type, vl.type)) {
  7505. realValue = _store.Store.doImplicitCasting(cmd.type, realValue);
  7506. } else {
  7507. var stringInfo = typeInfo.type.stringInfo();
  7508. var info = stringInfo[0];
  7509. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7510. }
  7511. }
  7512. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7513. if (vl.type instanceof _compoundType.CompoundType) {
  7514. return Promise.reject(new Error("!!!Critical Error: Compatibility check failed, a Type accepts a CompoundType"));
  7515. } else {
  7516. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  7517. }
  7518. }
  7519. } else {
  7520. realValue = new _storeObject.StoreObject(cmd.type, 0);
  7521. }
  7522. realValue.readOnly = cmd.isConst;
  7523. store.updateStore(cmd.id, realValue);
  7524. return store;
  7525. });
  7526. }
  7527. } catch (e) {
  7528. return Promise.reject(e);
  7529. }
  7530. }
  7531. }, {
  7532. key: 'evaluateExpression',
  7533. value: function evaluateExpression(store, exp) {
  7534. if (exp instanceof Expressions.UnaryApp) {
  7535. return this.evaluateUnaryApp(store, exp);
  7536. } else if (exp instanceof Expressions.InfixApp) {
  7537. return this.evaluateInfixApp(store, exp);
  7538. } else if (exp instanceof Expressions.ArrayAccess) {
  7539. return this.evaluateArrayAccess(store, exp);
  7540. } else if (exp instanceof Expressions.VariableLiteral) {
  7541. return this.evaluateVariableLiteral(store, exp);
  7542. } else if (exp instanceof Expressions.IntLiteral) {
  7543. return this.evaluateLiteral(store, exp);
  7544. } else if (exp instanceof Expressions.RealLiteral) {
  7545. return this.evaluateLiteral(store, exp);
  7546. } else if (exp instanceof Expressions.BoolLiteral) {
  7547. return this.evaluateLiteral(store, exp);
  7548. } else if (exp instanceof Expressions.StringLiteral) {
  7549. return this.evaluateLiteral(store, exp);
  7550. } else if (exp instanceof Expressions.ArrayLiteral) {
  7551. return this.evaluateArrayLiteral(store, exp);
  7552. } else if (exp instanceof Expressions.FunctionCall) {
  7553. return this.evaluateFunctionCall(store, exp);
  7554. }
  7555. return Promise.resolve(null);
  7556. }
  7557. }, {
  7558. key: 'evaluateFunctionCall',
  7559. value: function evaluateFunctionCall(store, exp) {
  7560. if (exp.isMainCall) {
  7561. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo));
  7562. }
  7563. var func = this.findFunction(exp.id);
  7564. if (_types.Types.VOID.isCompatible(func.returnType)) {
  7565. // TODO: better error message
  7566. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo));
  7567. }
  7568. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7569. return $newStore.then(function (sto) {
  7570. if (sto.mode !== _modes.Modes.RETURN) {
  7571. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7572. }
  7573. var val = sto.applyStore('$');
  7574. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7575. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  7576. } else {
  7577. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7578. }
  7579. });
  7580. }
  7581. }, {
  7582. key: 'evaluateArrayLiteral',
  7583. value: function evaluateArrayLiteral(store, exp) {
  7584. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7585. var errorCode = validationResult[0];
  7586. switch (errorCode) {
  7587. case _storeObjectArray.StoreObjectArray.WRONG_COLUMN_NUMBER:
  7588. {
  7589. var columnValue = validationResult[1];
  7590. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7591. }
  7592. case _storeObjectArray.StoreObjectArray.WRONG_LINE_NUMBER:
  7593. {
  7594. var lineValue = validationResult[1];
  7595. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7596. }
  7597. case _storeObjectArray.StoreObjectArray.WRONG_TYPE:
  7598. {
  7599. var line = null;
  7600. var strExp = null;
  7601. if (validationResult.length > 2) {
  7602. line = validationResult[1];
  7603. var column = validationResult[2];
  7604. strExp = exp.value[line].value[column].toString();
  7605. } else {
  7606. line = validationResult[1];
  7607. strExp = exp.value[line].toString();
  7608. }
  7609. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7610. }
  7611. }
  7612. };
  7613. if (!exp.isVector) {
  7614. var $matrix = this.evaluateMatrix(store, exp.value);
  7615. return $matrix.then(function (list) {
  7616. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  7617. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  7618. var checkResult = arr.isValid;
  7619. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7620. return errorHelperFunction(checkResult, exp);
  7621. }
  7622. });
  7623. } else {
  7624. return this.evaluateVector(store, exp.value).then(function (list) {
  7625. var type = new _compoundType.CompoundType(list[0].type, 1);
  7626. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7627. var checkResult = stoArray.isValid;
  7628. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7629. return errorHelperFunction(checkResult, exp);
  7630. }
  7631. });
  7632. }
  7633. }
  7634. }, {
  7635. key: 'evaluateVector',
  7636. value: function evaluateVector(store, exps) {
  7637. var _this9 = this;
  7638. return Promise.all(exps.map(function (exp) {
  7639. return _this9.evaluateExpression(store, exp);
  7640. }));
  7641. }
  7642. }, {
  7643. key: 'evaluateMatrix',
  7644. value: function evaluateMatrix(store, exps) {
  7645. var _this10 = this;
  7646. return Promise.all(exps.map(function (vector) {
  7647. var $vector = _this10.evaluateVector(store, vector.value);
  7648. return $vector.then(function (list) {
  7649. var type = new _compoundType.CompoundType(list[0].type, 1);
  7650. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7651. });
  7652. }));
  7653. }
  7654. }, {
  7655. key: 'evaluateLiteral',
  7656. value: function evaluateLiteral(_, exp) {
  7657. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  7658. }
  7659. }, {
  7660. key: 'evaluateVariableLiteral',
  7661. value: function evaluateVariableLiteral(store, exp) {
  7662. try {
  7663. var val = store.applyStore(exp.id);
  7664. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7665. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  7666. } else {
  7667. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7668. }
  7669. } catch (error) {
  7670. return Promise.reject(error);
  7671. }
  7672. }
  7673. }, {
  7674. key: 'evaluateArrayAccess',
  7675. value: function evaluateArrayAccess(store, exp) {
  7676. var mustBeArray = store.applyStore(exp.id);
  7677. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7678. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo));
  7679. }
  7680. var $line = this.evaluateExpression(store, exp.line);
  7681. var $column = this.evaluateExpression(store, exp.column);
  7682. return Promise.all([$line, $column]).then(function (values) {
  7683. var lineSO = values[0];
  7684. var columnSO = values[1];
  7685. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7686. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7687. }
  7688. var line = lineSO.number;
  7689. var column = null;
  7690. if (columnSO !== null) {
  7691. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7692. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7693. }
  7694. column = columnSO.number;
  7695. }
  7696. if (line >= mustBeArray.lines) {
  7697. if (mustBeArray.isVector) {
  7698. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7699. } else {
  7700. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7701. }
  7702. } else if (line < 0) {
  7703. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7704. }
  7705. if (column !== null && mustBeArray.columns === null) {
  7706. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo));
  7707. }
  7708. if (column !== null) {
  7709. if (column >= mustBeArray.columns) {
  7710. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7711. } else if (column < 0) {
  7712. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7713. }
  7714. }
  7715. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  7716. });
  7717. }
  7718. }, {
  7719. key: 'evaluateUnaryApp',
  7720. value: function evaluateUnaryApp(store, unaryApp) {
  7721. var $left = this.evaluateExpression(store, unaryApp.left);
  7722. return $left.then(function (left) {
  7723. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  7724. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7725. var stringInfo = left.type.stringInfo();
  7726. var info = stringInfo[0];
  7727. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7728. }
  7729. switch (unaryApp.op.ord) {
  7730. case _operators.Operators.ADD.ord:
  7731. return new _storeObject.StoreObject(resultType, left.value);
  7732. case _operators.Operators.SUB.ord:
  7733. return new _storeObject.StoreObject(resultType, left.value.negated());
  7734. case _operators.Operators.NOT.ord:
  7735. return new _storeObject.StoreObject(resultType, !left.value);
  7736. default:
  7737. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7738. }
  7739. });
  7740. }
  7741. }, {
  7742. key: 'evaluateInfixApp',
  7743. value: function evaluateInfixApp(store, infixApp) {
  7744. var $left = this.evaluateExpression(store, infixApp.left);
  7745. var $right = this.evaluateExpression(store, infixApp.right);
  7746. return Promise.all([$left, $right]).then(function (values) {
  7747. var shouldImplicitCast = false;
  7748. var left = values[0];
  7749. var right = values[1];
  7750. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  7751. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7752. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(left.type, right.type)) {
  7753. shouldImplicitCast = true;
  7754. } else {
  7755. var stringInfoLeft = left.type.stringInfo();
  7756. var infoLeft = stringInfoLeft[0];
  7757. var stringInfoRight = right.type.stringInfo();
  7758. var infoRight = stringInfoRight[0];
  7759. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  7760. }
  7761. }
  7762. var result = null;
  7763. switch (infixApp.op.ord) {
  7764. case _operators.Operators.ADD.ord:
  7765. {
  7766. if (_types.Types.STRING.isCompatible(left.type)) {
  7767. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  7768. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  7769. } else if (_types.Types.STRING.isCompatible(right.type)) {
  7770. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  7771. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  7772. } else {
  7773. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  7774. }
  7775. }
  7776. case _operators.Operators.SUB.ord:
  7777. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  7778. case _operators.Operators.MULT.ord:
  7779. {
  7780. result = left.value.times(right.value);
  7781. if (result.dp() > _config.Config.decimalPlaces) {
  7782. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7783. }
  7784. return new _storeObject.StoreObject(resultType, result);
  7785. }
  7786. case _operators.Operators.DIV.ord:
  7787. {
  7788. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  7789. if (result.dp() > _config.Config.decimalPlaces) {
  7790. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7791. }
  7792. return new _storeObject.StoreObject(resultType, result);
  7793. }
  7794. case _operators.Operators.MOD.ord:
  7795. {
  7796. var leftValue = left.value;
  7797. var rightValue = right.value;
  7798. if (shouldImplicitCast) {
  7799. resultType = _types.Types.INTEGER;
  7800. leftValue = leftValue.trunc();
  7801. rightValue = rightValue.trunc();
  7802. }
  7803. result = leftValue.modulo(rightValue);
  7804. if (result.dp() > _config.Config.decimalPlaces) {
  7805. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7806. }
  7807. return new _storeObject.StoreObject(resultType, result);
  7808. }
  7809. case _operators.Operators.GT.ord:
  7810. {
  7811. var _leftValue = left.value;
  7812. var _rightValue = right.value;
  7813. if (_types.Types.STRING.isCompatible(left.type)) {
  7814. result = left.value.length > right.value.length;
  7815. } else {
  7816. if (shouldImplicitCast) {
  7817. resultType = _types.Types.BOOLEAN;
  7818. _leftValue = _leftValue.trunc();
  7819. _rightValue = _rightValue.trunc();
  7820. }
  7821. result = _leftValue.gt(_rightValue);
  7822. }
  7823. return new _storeObject.StoreObject(resultType, result);
  7824. }
  7825. case _operators.Operators.GE.ord:
  7826. {
  7827. var _leftValue2 = left.value;
  7828. var _rightValue2 = right.value;
  7829. if (_types.Types.STRING.isCompatible(left.type)) {
  7830. result = left.value.length >= right.value.length;
  7831. } else {
  7832. if (shouldImplicitCast) {
  7833. resultType = _types.Types.BOOLEAN;
  7834. _leftValue2 = _leftValue2.trunc();
  7835. _rightValue2 = _rightValue2.trunc();
  7836. }
  7837. result = _leftValue2.gte(_rightValue2);
  7838. }
  7839. return new _storeObject.StoreObject(resultType, result);
  7840. }
  7841. case _operators.Operators.LT.ord:
  7842. {
  7843. var _leftValue3 = left.value;
  7844. var _rightValue3 = right.value;
  7845. if (_types.Types.STRING.isCompatible(left.type)) {
  7846. result = left.value.length < right.value.length;
  7847. } else {
  7848. if (shouldImplicitCast) {
  7849. resultType = _types.Types.BOOLEAN;
  7850. _leftValue3 = _leftValue3.trunc();
  7851. _rightValue3 = _rightValue3.trunc();
  7852. }
  7853. result = _leftValue3.lt(_rightValue3);
  7854. }
  7855. return new _storeObject.StoreObject(resultType, result);
  7856. }
  7857. case _operators.Operators.LE.ord:
  7858. {
  7859. var _leftValue4 = left.value;
  7860. var _rightValue4 = right.value;
  7861. if (_types.Types.STRING.isCompatible(left.type)) {
  7862. result = left.value.length <= right.value.length;
  7863. } else {
  7864. if (shouldImplicitCast) {
  7865. resultType = _types.Types.BOOLEAN;
  7866. _leftValue4 = _leftValue4.trunc();
  7867. _rightValue4 = _rightValue4.trunc();
  7868. }
  7869. result = _leftValue4.lte(_rightValue4);
  7870. }
  7871. return new _storeObject.StoreObject(resultType, result);
  7872. }
  7873. case _operators.Operators.EQ.ord:
  7874. {
  7875. var _leftValue5 = left.value;
  7876. var _rightValue5 = right.value;
  7877. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7878. if (shouldImplicitCast) {
  7879. resultType = _types.Types.BOOLEAN;
  7880. _leftValue5 = _leftValue5.trunc();
  7881. _rightValue5 = _rightValue5.trunc();
  7882. }
  7883. result = _leftValue5.eq(_rightValue5);
  7884. } else {
  7885. result = left.value === right.value;
  7886. }
  7887. return new _storeObject.StoreObject(resultType, result);
  7888. }
  7889. case _operators.Operators.NEQ.ord:
  7890. {
  7891. var _leftValue6 = left.value;
  7892. var _rightValue6 = right.value;
  7893. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7894. if (shouldImplicitCast) {
  7895. resultType = _types.Types.BOOLEAN;
  7896. _leftValue6 = _leftValue6.trunc();
  7897. _rightValue6 = _rightValue6.trunc();
  7898. }
  7899. result = !_leftValue6.eq(_rightValue6);
  7900. } else {
  7901. result = left.value !== right.value;
  7902. }
  7903. return new _storeObject.StoreObject(resultType, result);
  7904. }
  7905. case _operators.Operators.AND.ord:
  7906. return new _storeObject.StoreObject(resultType, left.value && right.value);
  7907. case _operators.Operators.OR.ord:
  7908. return new _storeObject.StoreObject(resultType, left.value || right.value);
  7909. default:
  7910. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid InfixApp ' + infixApp.op));
  7911. }
  7912. });
  7913. }
  7914. }, {
  7915. key: 'parseStoreObjectValue',
  7916. value: function parseStoreObjectValue(vl) {
  7917. var realValue = vl;
  7918. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7919. if (vl.type instanceof _compoundType.CompoundType) {
  7920. switch (vl.type.dimensions) {
  7921. case 1:
  7922. {
  7923. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  7924. break;
  7925. }
  7926. default:
  7927. {
  7928. throw new _runtimeError.RuntimeError("Three dimensional array address...");
  7929. }
  7930. }
  7931. } else {
  7932. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  7933. }
  7934. }
  7935. return realValue;
  7936. }
  7937. }]);
  7938. return IVProgProcessor;
  7939. }();
  7940. /***/ }),
  7941. /***/ "./js/processor/lib/arrays.js":
  7942. /*!************************************!*\
  7943. !*** ./js/processor/lib/arrays.js ***!
  7944. \************************************/
  7945. /*! no static exports found */
  7946. /***/ (function(module, exports, __webpack_require__) {
  7947. "use strict";
  7948. Object.defineProperty(exports, "__esModule", {
  7949. value: true
  7950. });
  7951. exports.createNumElementsFun = createNumElementsFun;
  7952. exports.createMatrixLinesFun = createMatrixLinesFun;
  7953. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  7954. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7955. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7956. var Commands = _interopRequireWildcard(_commands);
  7957. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7958. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7959. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7960. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7961. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7962. /**
  7963. * num_elements
  7964. * matrix_lines
  7965. * matrix_columns
  7966. */
  7967. function createNumElementsFun() {
  7968. var numElementsFun = function numElementsFun(sto, _) {
  7969. var vector = sto.applyStore("vector");
  7970. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  7971. sto.mode = _modes.Modes.RETURN;
  7972. return Promise.resolve(sto.updateStore("$", temp));
  7973. };
  7974. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  7975. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  7976. return func;
  7977. }
  7978. function createMatrixLinesFun() {
  7979. var matrixLinesFun = function matrixLinesFun(sto, _) {
  7980. var matrix = sto.applyStore("matrix");
  7981. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  7982. sto.mode = _modes.Modes.RETURN;
  7983. return Promise.resolve(sto.updateStore("$", temp));
  7984. };
  7985. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  7986. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7987. return func;
  7988. }
  7989. function createMatrixColumnsFun() {
  7990. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  7991. var matrix = sto.applyStore("matrix");
  7992. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  7993. sto.mode = _modes.Modes.RETURN;
  7994. return Promise.resolve(sto.updateStore("$", temp));
  7995. };
  7996. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  7997. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7998. return func;
  7999. }
  8000. /***/ }),
  8001. /***/ "./js/processor/lib/io.js":
  8002. /*!********************************!*\
  8003. !*** ./js/processor/lib/io.js ***!
  8004. \********************************/
  8005. /*! no static exports found */
  8006. /***/ (function(module, exports, __webpack_require__) {
  8007. "use strict";
  8008. Object.defineProperty(exports, "__esModule", {
  8009. value: true
  8010. });
  8011. exports.createOutputFun = createOutputFun;
  8012. exports.createInputFun = createInputFun;
  8013. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  8014. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8015. var Commands = _interopRequireWildcard(_commands);
  8016. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8017. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8018. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8019. function createOutputFun() {
  8020. var writeFunction = function writeFunction(store, _) {
  8021. var val = store.applyStore('p1');
  8022. this.output.sendOutput((0, _parsers.convertToString)(val.value, val.type));
  8023. return Promise.resolve(store);
  8024. };
  8025. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  8026. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  8027. return func;
  8028. }
  8029. function createInputFun() {
  8030. var readFunction = function readFunction(store, _) {
  8031. var _this = this;
  8032. var request = new Promise(function (resolve, _) {
  8033. _this.input.requestInput(resolve);
  8034. });
  8035. return request.then(function (text) {
  8036. var typeToConvert = store.applyStore('p1').type;
  8037. var stoObj = null;
  8038. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  8039. var val = (0, _parsers.toInt)(text);
  8040. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val);
  8041. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  8042. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  8043. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  8044. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  8045. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  8046. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  8047. }
  8048. _this.loopTimers.splice(0, _this.loopTimers.length);
  8049. store.updateStore('p1', stoObj);
  8050. return Promise.resolve(store);
  8051. });
  8052. };
  8053. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  8054. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  8055. return func;
  8056. }
  8057. /***/ }),
  8058. /***/ "./js/processor/lib/lang.js":
  8059. /*!**********************************!*\
  8060. !*** ./js/processor/lib/lang.js ***!
  8061. \**********************************/
  8062. /*! no static exports found */
  8063. /***/ (function(module, exports, __webpack_require__) {
  8064. "use strict";
  8065. Object.defineProperty(exports, "__esModule", {
  8066. value: true
  8067. });
  8068. exports.createIsRealFun = createIsRealFun;
  8069. exports.createIsIntFun = createIsIntFun;
  8070. exports.createIsBoolFun = createIsBoolFun;
  8071. exports.createCastRealFun = createCastRealFun;
  8072. exports.createCastIntFun = createCastIntFun;
  8073. exports.createCastBoolFun = createCastBoolFun;
  8074. exports.createCastStringFun = createCastStringFun;
  8075. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8076. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8077. var Commands = _interopRequireWildcard(_commands);
  8078. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8079. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8080. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  8081. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8082. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8083. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8084. /**
  8085. *
  8086. * is_real
  8087. * is_int
  8088. * is_bool
  8089. * cast_real
  8090. * cast_int
  8091. * cast_bool
  8092. * cast_string
  8093. */
  8094. function createIsRealFun() {
  8095. var isRealFun = function isRealFun(sto, _) {
  8096. var str = sto.applyStore("str");
  8097. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8098. var result = false;
  8099. try {
  8100. var val = parser.parseTerm();
  8101. if (val instanceof _expressions.RealLiteral) {
  8102. result = true;
  8103. }
  8104. } catch (error) {}
  8105. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8106. sto.mode = _modes.Modes.RETURN;
  8107. return Promise.resolve(sto.updateStore("$", temp));
  8108. };
  8109. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  8110. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8111. return func;
  8112. }
  8113. function createIsIntFun() {
  8114. var isIntFun = function isIntFun(sto, _) {
  8115. var str = sto.applyStore("str");
  8116. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8117. var result = false;
  8118. try {
  8119. var val = parser.parseTerm();
  8120. if (val instanceof _expressions.IntLiteral) {
  8121. result = true;
  8122. }
  8123. } catch (error) {}
  8124. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8125. sto.mode = _modes.Modes.RETURN;
  8126. return Promise.resolve(sto.updateStore("$", temp));
  8127. };
  8128. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  8129. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8130. return func;
  8131. }
  8132. function createIsBoolFun() {
  8133. var isBoolFun = function isBoolFun(sto, _) {
  8134. var str = sto.applyStore("str");
  8135. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8136. var result = false;
  8137. try {
  8138. var val = parser.parseTerm();
  8139. if (val instanceof _expressions.BoolLiteral) {
  8140. result = true;
  8141. }
  8142. } catch (error) {}
  8143. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8144. sto.mode = _modes.Modes.RETURN;
  8145. return Promise.resolve(sto.updateStore("$", temp));
  8146. };
  8147. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  8148. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8149. return func;
  8150. }
  8151. function createCastRealFun() {
  8152. var castRealFun = function castRealFun(sto, _) {
  8153. var val = sto.applyStore("val");
  8154. switch (val.type.ord) {
  8155. case _types.Types.INTEGER.ord:
  8156. {
  8157. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  8158. sto.mode = _modes.Modes.RETURN;
  8159. return Promise.resolve(sto.updateStore("$", temp));
  8160. }
  8161. case _types.Types.STRING.ord:
  8162. {
  8163. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8164. try {
  8165. var result = parser.parseTerm();
  8166. if (result instanceof _expressions.RealLiteral) {
  8167. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  8168. sto.mode = _modes.Modes.RETURN;
  8169. return Promise.resolve(sto.updateStore("$", _temp));
  8170. }
  8171. } catch (error) {
  8172. return Promise.reject("cannot convert string to real");
  8173. }
  8174. }
  8175. }
  8176. };
  8177. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  8178. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8179. return func;
  8180. }
  8181. function createCastIntFun() {
  8182. var castIntFun = function castIntFun(sto, _) {
  8183. var val = sto.applyStore("val");
  8184. switch (val.type.ord) {
  8185. case _types.Types.REAL.ord:
  8186. {
  8187. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  8188. sto.mode = _modes.Modes.RETURN;
  8189. return Promise.resolve(sto.updateStore("$", temp));
  8190. }
  8191. case _types.Types.STRING.ord:
  8192. {
  8193. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8194. try {
  8195. var result = parser.parseTerm();
  8196. if (result instanceof _expressions.IntLiteral) {
  8197. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  8198. sto.mode = _modes.Modes.RETURN;
  8199. return Promise.resolve(sto.updateStore("$", _temp2));
  8200. }
  8201. } catch (error) {
  8202. return Promise.reject("cannot convert string to real");
  8203. }
  8204. }
  8205. }
  8206. };
  8207. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  8208. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8209. return func;
  8210. }
  8211. function createCastBoolFun() {
  8212. var castBoolFun = function castBoolFun(sto, _) {
  8213. var str = sto.applyStore("str");
  8214. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8215. try {
  8216. var val = parser.parseTerm();
  8217. if (val instanceof _expressions.BoolLiteral) {
  8218. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  8219. sto.mode = _modes.Modes.RETURN;
  8220. return Promise.resolve(sto.updateStore("$", temp));
  8221. }
  8222. } catch (error) {}
  8223. return Promise.reject("cannot convert " + str.value + " to boolean");
  8224. };
  8225. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  8226. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8227. return func;
  8228. }
  8229. function createCastStringFun() {
  8230. var castStringFun = function castStringFun(store, _) {
  8231. var val = store.applyStore('str');
  8232. var result = (0, _parsers.convertToString)(val);
  8233. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8234. sto.mode = _modes.Modes.RETURN;
  8235. return Promise.resolve(sto.updateStore("$", temp));
  8236. };
  8237. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  8238. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  8239. return func;
  8240. }
  8241. /***/ }),
  8242. /***/ "./js/processor/lib/math.js":
  8243. /*!**********************************!*\
  8244. !*** ./js/processor/lib/math.js ***!
  8245. \**********************************/
  8246. /*! no static exports found */
  8247. /***/ (function(module, exports, __webpack_require__) {
  8248. "use strict";
  8249. Object.defineProperty(exports, "__esModule", {
  8250. value: true
  8251. });
  8252. exports.createSinFun = createSinFun;
  8253. exports.createCosFun = createCosFun;
  8254. exports.createTanFun = createTanFun;
  8255. exports.createSqrtFun = createSqrtFun;
  8256. exports.createPowFun = createPowFun;
  8257. exports.createLogFun = createLogFun;
  8258. exports.createAbsFun = createAbsFun;
  8259. exports.createNegateFun = createNegateFun;
  8260. exports.createInvertFun = createInvertFun;
  8261. exports.createMaxFun = createMaxFun;
  8262. exports.createMinFun = createMinFun;
  8263. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8264. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8265. var Commands = _interopRequireWildcard(_commands);
  8266. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8267. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8268. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8269. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8270. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8271. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8272. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8273. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8274. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  8275. /**
  8276. * sin
  8277. * cos
  8278. * tan
  8279. * sqrt
  8280. * pow
  8281. * log
  8282. * abs
  8283. * negate
  8284. * invert
  8285. * max
  8286. * min
  8287. */
  8288. function convertToRadians(degrees) {
  8289. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  8290. }
  8291. function createSinFun() {
  8292. var sinFun = function sinFun(sto, _) {
  8293. var x = sto.applyStore('x');
  8294. var angle = x.value.mod(360);
  8295. var result = null;
  8296. if (angle.eq(90)) {
  8297. result = new _decimal.Decimal(1);
  8298. } else if (angle.eq(180)) {
  8299. result = new _decimal.Decimal(0);
  8300. } else if (angle.eq(270)) {
  8301. result = new _decimal.Decimal(-1);
  8302. } else {
  8303. result = _decimal.Decimal.sin(convertToRadians(angle));
  8304. }
  8305. if (result.dp() > _config.Config.decimalPlaces) {
  8306. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8307. }
  8308. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8309. sto.mode = _modes.Modes.RETURN;
  8310. return Promise.resolve(sto.updateStore('$', temp));
  8311. };
  8312. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  8313. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8314. return func;
  8315. }
  8316. function createCosFun() {
  8317. var cosFun = function cosFun(sto, _) {
  8318. var x = sto.applyStore('x');
  8319. var angle = x.value.mod(360);
  8320. var result = null;
  8321. if (angle.eq(90)) {
  8322. result = new _decimal.Decimal(0);
  8323. } else if (angle.eq(180)) {
  8324. result = new _decimal.Decimal(-1);
  8325. } else if (angle.eq(270)) {
  8326. result = new _decimal.Decimal(0);
  8327. }
  8328. result = _decimal.Decimal.cos(convertToRadians(angle));
  8329. if (result.dp() > _config.Config.decimalPlaces) {
  8330. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8331. }
  8332. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8333. sto.mode = _modes.Modes.RETURN;
  8334. return Promise.resolve(sto.updateStore('$', temp));
  8335. };
  8336. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  8337. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8338. return func;
  8339. }
  8340. function createTanFun() {
  8341. var tanFun = function tanFun(sto, _) {
  8342. var x = sto.applyStore('x');
  8343. var angle = x.value.mod(360);
  8344. if (angle.eq(90) || angle.eq(270)) {
  8345. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8346. }
  8347. var result = _decimal.Decimal.tan(convertToRadians(angle));
  8348. if (result.dp() > _config.Config.decimalPlaces) {
  8349. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8350. }
  8351. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8352. sto.mode = _modes.Modes.RETURN;
  8353. return Promise.resolve(sto.updateStore('$', temp));
  8354. };
  8355. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  8356. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8357. return func;
  8358. }
  8359. function createSqrtFun() {
  8360. var sqrtFun = function sqrtFun(sto, _) {
  8361. var x = sto.applyStore('x');
  8362. var result = x.value.sqrt();
  8363. if (result.dp() > _config.Config.decimalPlaces) {
  8364. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8365. }
  8366. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8367. sto.mode = _modes.Modes.RETURN;
  8368. return Promise.resolve(sto.updateStore('$', temp));
  8369. };
  8370. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  8371. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8372. return func;
  8373. }
  8374. function createPowFun() {
  8375. var powFun = function powFun(sto, _) {
  8376. var x = sto.applyStore('x');
  8377. var y = sto.applyStore('y');
  8378. var result = x.value.pow(y.value);
  8379. if (result.dp() > _config.Config.decimalPlaces) {
  8380. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8381. }
  8382. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8383. sto.mode = _modes.Modes.RETURN;
  8384. return Promise.resolve(sto.updateStore('$', temp));
  8385. };
  8386. var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]);
  8387. var func = new Commands.Function('$pow', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false), new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'y', false)], block);
  8388. return func;
  8389. }
  8390. function createLogFun() {
  8391. var logFun = function logFun(sto, _) {
  8392. var x = sto.applyStore('x');
  8393. if (x.value.isNegative()) {
  8394. return Promise.reject("the value passed to log function cannot be negative");
  8395. }
  8396. var result = _decimal.Decimal.log10(x.value);
  8397. if (result.dp() > _config.Config.decimalPlaces) {
  8398. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8399. }
  8400. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8401. sto.mode = _modes.Modes.RETURN;
  8402. return Promise.resolve(sto.updateStore('$', temp));
  8403. };
  8404. var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]);
  8405. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8406. return func;
  8407. }
  8408. function createAbsFun() {
  8409. var absFun = function absFun(sto, _) {
  8410. var x = sto.applyStore('x');
  8411. var result = x.value.abs();
  8412. var temp = new _storeObject.StoreObject(x.type, result);
  8413. sto.mode = _modes.Modes.RETURN;
  8414. return Promise.resolve(sto.updateStore('$', temp));
  8415. };
  8416. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  8417. var func = new Commands.Function('$abs', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8418. return func;
  8419. }
  8420. function createNegateFun() {
  8421. var negateFun = function negateFun(sto, _) {
  8422. var x = sto.applyStore('x');
  8423. var result = x.value.negated();
  8424. var temp = new _storeObject.StoreObject(x.type, result);
  8425. sto.mode = _modes.Modes.RETURN;
  8426. return Promise.resolve(sto.updateStore('$', temp));
  8427. };
  8428. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  8429. var func = new Commands.Function('$negate', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8430. return func;
  8431. }
  8432. function createInvertFun() {
  8433. var invertFun = function invertFun(sto, _) {
  8434. var x = sto.applyStore('x');
  8435. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  8436. if (result.dp() > _config.Config.decimalPlaces) {
  8437. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8438. }
  8439. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8440. sto.mode = _modes.Modes.RETURN;
  8441. return Promise.resolve(sto.updateStore('$', temp));
  8442. };
  8443. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  8444. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8445. return func;
  8446. }
  8447. function createMaxFun() {
  8448. var maxFun = function maxFun(sto, _) {
  8449. var x = sto.applyStore('x');
  8450. var numbers = x.value.map(function (stoObj) {
  8451. return stoObj.value;
  8452. });
  8453. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8454. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8455. sto.mode = _modes.Modes.RETURN;
  8456. return Promise.resolve(sto.updateStore('$', temp));
  8457. };
  8458. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8459. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  8460. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8461. return func;
  8462. }
  8463. function createMinFun() {
  8464. var minFun = function minFun(sto, _) {
  8465. var x = sto.applyStore('x');
  8466. var numbers = x.value.map(function (stoObj) {
  8467. return stoObj.value;
  8468. });
  8469. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8470. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8471. sto.mode = _modes.Modes.RETURN;
  8472. return Promise.resolve(sto.updateStore('$', temp));
  8473. };
  8474. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8475. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  8476. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8477. return func;
  8478. }
  8479. /***/ }),
  8480. /***/ "./js/processor/lib/strings.js":
  8481. /*!*************************************!*\
  8482. !*** ./js/processor/lib/strings.js ***!
  8483. \*************************************/
  8484. /*! no static exports found */
  8485. /***/ (function(module, exports, __webpack_require__) {
  8486. "use strict";
  8487. Object.defineProperty(exports, "__esModule", {
  8488. value: true
  8489. });
  8490. exports.createSubstringFun = createSubstringFun;
  8491. exports.createLengthFun = createLengthFun;
  8492. exports.createUppercaseFun = createUppercaseFun;
  8493. exports.createLowercaseFun = createLowercaseFun;
  8494. exports.createrCharAtFun = createrCharAtFun;
  8495. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8496. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8497. var Commands = _interopRequireWildcard(_commands);
  8498. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8499. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8500. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8501. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8502. /*
  8503. * substring
  8504. * length
  8505. * uppercase
  8506. * lowercase
  8507. * charAt
  8508. **/
  8509. function createSubstringFun() {
  8510. var substringFun = function substringFun(sto, _) {
  8511. var str = sto.applyStore("str");
  8512. var start = sto.applyStore("start");
  8513. var end = sto.applyStore("end");
  8514. var result = str.value.substring(start.value, end.value);
  8515. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8516. sto.mode = _modes.Modes.RETURN;
  8517. return Promise.resolve(sto.updateStore("$", temp));
  8518. };
  8519. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  8520. var func = new Commands.Function('$substring', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'start', false), new Commands.FormalParameter(_types.Types.INTEGER, 'end', false)], block);
  8521. return func;
  8522. }
  8523. function createLengthFun() {
  8524. var lengthFun = function lengthFun(sto, _) {
  8525. var str = sto.applyStore("str");
  8526. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  8527. sto.mode = _modes.Modes.RETURN;
  8528. return Promise.resolve(sto.updateStore("$", temp));
  8529. };
  8530. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  8531. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8532. return func;
  8533. }
  8534. function createUppercaseFun() {
  8535. var uppercaseFun = function uppercaseFun(sto, _) {
  8536. var str = sto.applyStore("str");
  8537. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  8538. sto.mode = _modes.Modes.RETURN;
  8539. return Promise.resolve(sto.updateStore("$", temp));
  8540. };
  8541. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  8542. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8543. return func;
  8544. }
  8545. function createLowercaseFun() {
  8546. var lowercaseFun = function lowercaseFun(sto, _) {
  8547. var str = sto.applyStore("str");
  8548. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  8549. sto.mode = _modes.Modes.RETURN;
  8550. return Promise.resolve(sto.updateStore("$", temp));
  8551. };
  8552. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  8553. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8554. return func;
  8555. }
  8556. function createrCharAtFun() {
  8557. var charAtFun = function charAtFun(sto, _) {
  8558. var str = sto.applyStore("str");
  8559. var idx = sto.applyStore("index");
  8560. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8561. return Promise.reject(new Error("invalid string position"));
  8562. }
  8563. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  8564. sto.mode = _modes.Modes.RETURN;
  8565. return Promise.resolve(sto.updateStore("$", temp));
  8566. };
  8567. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  8568. var func = new Commands.Function('$charAt', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false), new Commands.FormalParameter(_types.Types.INTEGER, 'index', false)], block);
  8569. return func;
  8570. }
  8571. /***/ }),
  8572. /***/ "./js/processor/modes.js":
  8573. /*!*******************************!*\
  8574. !*** ./js/processor/modes.js ***!
  8575. \*******************************/
  8576. /*! no static exports found */
  8577. /***/ (function(module, exports, __webpack_require__) {
  8578. "use strict";
  8579. Object.defineProperty(exports, "__esModule", {
  8580. value: true
  8581. });
  8582. var Modes = exports.Modes = Object.freeze({
  8583. RETURN: Symbol('mode:return'),
  8584. BREAK: Symbol('mode:break'),
  8585. PAUSE: Symbol('mode:pause'),
  8586. RUN: Symbol('mode:run')
  8587. });
  8588. /***/ }),
  8589. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8590. /*!***************************************************!*\
  8591. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8592. \***************************************************/
  8593. /*! no static exports found */
  8594. /***/ (function(module, exports, __webpack_require__) {
  8595. "use strict";
  8596. Object.defineProperty(exports, "__esModule", {
  8597. value: true
  8598. });
  8599. exports.SemanticAnalyser = undefined;
  8600. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8601. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8602. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8603. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8604. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8605. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8606. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8607. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8608. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8609. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8610. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8611. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8612. var _store = __webpack_require__(/*! ../store/store */ "./js/processor/store/store.js");
  8613. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8614. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  8615. function SemanticAnalyser(ast) {
  8616. _classCallCheck(this, SemanticAnalyser);
  8617. this.ast = ast;
  8618. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  8619. var lexer = new this.lexerClass(null);
  8620. this.literalNames = lexer.literalNames;
  8621. this.symbolMap = null;
  8622. this.currentFunction = null;
  8623. }
  8624. _createClass(SemanticAnalyser, [{
  8625. key: 'pushMap',
  8626. value: function pushMap() {
  8627. if (this.symbolMap === null) {
  8628. this.symbolMap = { map: {}, next: null };
  8629. } else {
  8630. var n = { map: {}, next: this.symbolMap };
  8631. this.symbolMap = n;
  8632. }
  8633. }
  8634. }, {
  8635. key: 'popMap',
  8636. value: function popMap() {
  8637. if (this.symbolMap !== null) {
  8638. this.symbolMap = this.symbolMap.next;
  8639. }
  8640. }
  8641. }, {
  8642. key: 'insertSymbol',
  8643. value: function insertSymbol(id, typeInfo) {
  8644. this.symbolMap.map[id] = typeInfo;
  8645. }
  8646. }, {
  8647. key: 'findSymbol',
  8648. value: function findSymbol(id, symMap) {
  8649. if (!symMap.map[id]) {
  8650. if (symMap.next) {
  8651. return this.findSymbol(id, symMap.next);
  8652. }
  8653. return null;
  8654. } else {
  8655. return symMap.map[id];
  8656. }
  8657. }
  8658. }, {
  8659. key: 'getMainFunction',
  8660. value: function getMainFunction() {
  8661. return this.ast.functions.find(function (v) {
  8662. return v.isMain;
  8663. });
  8664. }
  8665. }, {
  8666. key: 'findFunction',
  8667. value: function findFunction(name) {
  8668. console.log(name);
  8669. if (name.match(/^\$.+$/)) {
  8670. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  8671. if (!!!fun) {
  8672. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  8673. }
  8674. return fun;
  8675. } else {
  8676. var val = this.ast.functions.find(function (v) {
  8677. return v.name === name;
  8678. });
  8679. if (!!!val) {
  8680. return null;
  8681. }
  8682. return val;
  8683. }
  8684. }
  8685. }, {
  8686. key: 'analyseTree',
  8687. value: function analyseTree() {
  8688. var globalVars = this.ast.global;
  8689. this.pushMap();
  8690. this.assertDeclarations(globalVars);
  8691. var functions = this.ast.functions;
  8692. var mainFunc = functions.filter(function (f) {
  8693. return f.name === null;
  8694. });
  8695. if (mainFunc.length <= 0) {
  8696. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  8697. }
  8698. for (var i = 0; i < functions.length; i++) {
  8699. var fun = functions[i];
  8700. this.assertFunction(fun);
  8701. }
  8702. return this.ast;
  8703. }
  8704. }, {
  8705. key: 'assertDeclarations',
  8706. value: function assertDeclarations(list) {
  8707. for (var i = 0; i < list.length; i++) {
  8708. this.assertDeclaration(list[i]);
  8709. }
  8710. }
  8711. }, {
  8712. key: 'assertDeclaration',
  8713. value: function assertDeclaration(declaration) {
  8714. if (declaration instanceof _commands.ArrayDeclaration) {
  8715. if (declaration.initial === null) {
  8716. var lineType = this.evaluateExpressionType(declaration.lines);
  8717. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8718. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8719. }
  8720. if (declaration.columns !== null) {
  8721. var columnType = this.evaluateExpressionType(declaration.columns);
  8722. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8723. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8724. }
  8725. }
  8726. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8727. return;
  8728. }
  8729. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8730. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8731. } else {
  8732. if (declaration.initial === null) {
  8733. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8734. return;
  8735. }
  8736. var resultType = this.evaluateExpressionType(declaration.initial);
  8737. if (resultType instanceof _multiType.MultiType) {
  8738. if (!resultType.isCompatible(declaration.type)) {
  8739. var stringInfo = declaration.type.stringInfo();
  8740. var info = stringInfo[0];
  8741. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  8742. }
  8743. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8744. } else if (!declaration.type.isCompatible(resultType) && !_config.Config.enable_type_casting || !declaration.type.isCompatible(resultType) && _config.Config.enable_type_casting && !_store.Store.canImplicitTypeCast(declaration.type, resultType)) {
  8745. var _stringInfo = declaration.type.stringInfo();
  8746. var _info = _stringInfo[0];
  8747. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  8748. } else {
  8749. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8750. }
  8751. }
  8752. }
  8753. }, {
  8754. key: 'evaluateExpressionType',
  8755. value: function evaluateExpressionType(expression) {
  8756. if (expression instanceof _expressions.UnaryApp) {
  8757. var op = expression.op;
  8758. var resultType = this.evaluateExpressionType(expression.left);
  8759. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  8760. } else if (expression instanceof _expressions.InfixApp) {
  8761. var _op = expression.op;
  8762. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  8763. var resultTypeRight = this.evaluateExpressionType(expression.right);
  8764. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  8765. } else if (expression instanceof _literal.Literal) {
  8766. return this.evaluateLiteralType(expression);
  8767. } else if (expression instanceof _expressions.FunctionCall) {
  8768. if (expression.isMainCall) {
  8769. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
  8770. }
  8771. var fun = this.findFunction(expression.id);
  8772. if (fun === null) {
  8773. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
  8774. }
  8775. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  8776. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
  8777. }
  8778. this.assertParameters(fun, expression.actualParameters);
  8779. return fun.returnType;
  8780. } else if (expression instanceof _expressions.ArrayAccess) {
  8781. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  8782. if (arrayTypeInfo === null) {
  8783. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
  8784. }
  8785. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  8786. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
  8787. }
  8788. var lineType = this.evaluateExpressionType(expression.line);
  8789. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8790. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8791. }
  8792. if (expression.column !== null) {
  8793. if (arrayTypeInfo.columns === null) {
  8794. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
  8795. }
  8796. var columnType = this.evaluateExpressionType(expression.column);
  8797. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8798. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8799. }
  8800. }
  8801. var arrType = arrayTypeInfo.type;
  8802. if (expression.column !== null) {
  8803. // indexing matrix
  8804. return arrType.innerType;
  8805. } else {
  8806. if (arrayTypeInfo.columns === null) {
  8807. return arrType.innerType;
  8808. }
  8809. return new _compoundType.CompoundType(arrType.innerType, 1);
  8810. }
  8811. }
  8812. }
  8813. }, {
  8814. key: 'evaluateLiteralType',
  8815. value: function evaluateLiteralType(literal) {
  8816. if (literal instanceof _expressions.IntLiteral) {
  8817. return literal.type;
  8818. } else if (literal instanceof _expressions.RealLiteral) {
  8819. return literal.type;
  8820. } else if (literal instanceof _expressions.StringLiteral) {
  8821. return literal.type;
  8822. } else if (literal instanceof _expressions.BoolLiteral) {
  8823. return literal.type;
  8824. } else if (literal instanceof _expressions.VariableLiteral) {
  8825. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  8826. if (typeInfo === null) {
  8827. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
  8828. }
  8829. if (typeInfo.type instanceof _compoundType.CompoundType) {
  8830. return typeInfo.type;
  8831. }
  8832. return typeInfo.type;
  8833. } else {
  8834. console.warn("Evaluating type only for an array literal...");
  8835. var last = null;
  8836. if (literal.value.length === 1) {
  8837. last = this.evaluateExpressionType(literal.value[0]);
  8838. } else {
  8839. for (var i = 0; i < literal.value.length; i++) {
  8840. var e = this.evaluateExpressionType(literal.value[i]);
  8841. if (last === null) {
  8842. last = e;
  8843. } else if (!last.isCompatible(e)) {
  8844. var strInfo = last.stringInfo();
  8845. var info = strInfo[0];
  8846. var strExp = literal.toString();
  8847. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8848. }
  8849. }
  8850. }
  8851. if (last instanceof _compoundType.CompoundType) {
  8852. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  8853. }
  8854. return new _compoundType.CompoundType(last, 1);
  8855. }
  8856. }
  8857. }, {
  8858. key: 'evaluateArrayLiteral',
  8859. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  8860. /* if (literal instanceof ArrayLiteral) {
  8861. const dimType = this.evaluateExpressionType(lines);
  8862. if (!dimType.isCompatible(Types.INTEGER)) {
  8863. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8864. }
  8865. if ((lines instanceof IntLiteral)) {
  8866. if (!lines.value.eq(literal.value.length)) {
  8867. if(type.dimensions > 1) {
  8868. throw ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  8869. } else {
  8870. throw ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  8871. }
  8872. } else if (lines.value.isNeg()) {
  8873. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8874. }
  8875. }
  8876. if (columns === null) {
  8877. // it's a vector...
  8878. literal.value.reduce((last, next) => {
  8879. const eType = this.evaluateExpressionType(next);
  8880. if (!last.canAccept(eType)) {
  8881. const strInfo = last.stringInfo();
  8882. const info = strInfo[0];
  8883. const strExp = literal.toString();
  8884. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8885. }
  8886. return last;
  8887. }, type);
  8888. return true;
  8889. } else {
  8890. const dimType = this.evaluateExpressionType(columns);
  8891. if (!dimType.isCompatible(Types.INTEGER)) {
  8892. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8893. }
  8894. if ((columns instanceof IntLiteral)) {
  8895. const columnValue = literal.value[0].value.length;
  8896. if (!columns.value.eq(columnValue)) {
  8897. if(type.dimensions > 1) {
  8898. throw ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.value.toNumber(), literal.sourceInfo)
  8899. } else {
  8900. throw ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  8901. }
  8902. } else if (columns.value.isNeg()) {
  8903. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8904. }
  8905. for (let i = 0; i < columns; i++) {
  8906. const anotherArray = literal.value[i];
  8907. this.evaluateArrayLiteral(id, columns, null, type, anotherArray)
  8908. }
  8909. }
  8910. }
  8911. } else {
  8912. const resultType = this.evaluateExpressionType(literal);
  8913. if (!(resultType instanceof CompoundType)) {
  8914. const strInfo = type.stringInfo();
  8915. const info = strInfo[0];
  8916. const strExp = literal.toString();
  8917. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8918. }
  8919. if (!type.isCompatible(resultType)) {
  8920. const strInfo = type.stringInfo();
  8921. const info = strInfo[0];
  8922. const strExp = literal.toString();
  8923. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8924. }
  8925. return true;
  8926. } */
  8927. return true;
  8928. }
  8929. }, {
  8930. key: 'assertFunction',
  8931. value: function assertFunction(fun) {
  8932. var _this = this;
  8933. this.pushMap();
  8934. this.currentFunction = fun;
  8935. fun.formalParameters.forEach(function (formalParam) {
  8936. if (formalParam.type instanceof _compoundType.CompoundType) {
  8937. if (formalParam.type.dimensions > 1) {
  8938. _this.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  8939. } else {
  8940. _this.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  8941. }
  8942. } else {
  8943. _this.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  8944. }
  8945. });
  8946. this.assertDeclarations(fun.variablesDeclarations);
  8947. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  8948. var valid = this.assertReturn(fun, optional);
  8949. if (!valid) {
  8950. throw _processorErrorFactory.ProcessorErrorFactory.function_no_return(fun.name);
  8951. }
  8952. this.popMap();
  8953. }
  8954. }, {
  8955. key: 'assertReturn',
  8956. value: function assertReturn(fun, optional) {
  8957. var _this2 = this;
  8958. return fun.commands.reduce(function (last, next) {
  8959. return _this2.checkCommand(fun.returnType, next, optional) || last;
  8960. }, optional);
  8961. }
  8962. }, {
  8963. key: 'checkCommand',
  8964. value: function checkCommand(type, cmd, optional) {
  8965. if (cmd instanceof _commands.While) {
  8966. var resultType = this.evaluateExpressionType(cmd.expression);
  8967. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  8968. throw _processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
  8969. }
  8970. this.checkCommands(type, cmd.commands, optional);
  8971. return false;
  8972. } else if (cmd instanceof _commands.For) {
  8973. this.checkCommand(type, cmd.assignment, optional);
  8974. var _resultType = this.evaluateExpressionType(cmd.condition);
  8975. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  8976. throw _processorErrorFactory.ProcessorErrorFactory.for_condition_type_full(cmd.sourceInfo);
  8977. }
  8978. this.checkCommand(type, cmd.increment, optional);
  8979. this.checkCommands(type, cmd.commands, optional);
  8980. return false;
  8981. } else if (cmd instanceof _commands.Switch) {
  8982. var sType = this.evaluateExpressionType(cmd.expression);
  8983. var result = optional;
  8984. var hasDefault = false;
  8985. for (var i = 0; i < cmd.cases.length; i++) {
  8986. var aCase = cmd.cases[i];
  8987. if (aCase.expression !== null) {
  8988. var caseType = this.evaluateExpressionType(aCase.expression);
  8989. if (!sType.isCompatible(caseType)) {
  8990. var strInfo = sType.stringInfo();
  8991. var info = strInfo[0];
  8992. var strExp = aCase.expression.toString();
  8993. throw _processorErrorFactory.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  8994. }
  8995. } else {
  8996. hasDefault = true;
  8997. }
  8998. result = result && this.checkCommands(type, aCase.commands, result);
  8999. }
  9000. return result && hasDefault;
  9001. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  9002. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9003. if (typeInfo === null) {
  9004. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9005. }
  9006. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  9007. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  9008. }
  9009. var exp = cmd.expression;
  9010. var lineExp = cmd.line;
  9011. var lineType = this.evaluateExpressionType(lineExp);
  9012. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  9013. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  9014. }
  9015. var columnExp = cmd.column;
  9016. if (typeInfo.columns === null && columnExp !== null) {
  9017. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  9018. } else if (columnExp !== null) {
  9019. var columnType = this.evaluateExpressionType(columnExp);
  9020. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  9021. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  9022. }
  9023. }
  9024. // exp can be a arrayLiteral, a single value exp or an array access
  9025. if (exp instanceof _expressions.ArrayLiteral) {
  9026. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  9027. } else {
  9028. // cannot properly evaluate since type system is poorly constructed
  9029. }
  9030. return optional;
  9031. } else if (cmd instanceof _commands.Assign) {
  9032. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9033. if (_typeInfo === null) {
  9034. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9035. }
  9036. var _exp = cmd.expression;
  9037. if (_exp instanceof _expressions.ArrayLiteral) {
  9038. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  9039. var stringInfo = _typeInfo.type.stringInfo();
  9040. var _info2 = stringInfo[0];
  9041. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info2.type, _info2.dim, cmd.sourceInfo);
  9042. }
  9043. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  9044. } else {
  9045. var _resultType2 = this.evaluateExpressionType(_exp);
  9046. if (!_resultType2.isCompatible(_typeInfo.type) && !_config.Config.enable_type_casting || !_resultType2.isCompatible(_typeInfo.type) && _config.Config.enable_type_casting && !_store.Store.canImplicitTypeCast(_typeInfo.type, _resultType2)) {
  9047. var _stringInfo2 = _typeInfo.type.stringInfo();
  9048. var _info3 = _stringInfo2[0];
  9049. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  9050. }
  9051. }
  9052. return optional;
  9053. } else if (cmd instanceof _commands.Break) {
  9054. return optional;
  9055. } else if (cmd instanceof _commands.IfThenElse) {
  9056. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  9057. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  9058. throw _processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo);
  9059. }
  9060. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  9061. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  9062. } else {
  9063. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  9064. }
  9065. } else if (cmd instanceof _expressions.FunctionCall) {
  9066. var fun = null;
  9067. if (cmd.isMainCall) {
  9068. fun = this.getMainFunction();
  9069. } else {
  9070. fun = this.findFunction(cmd.id);
  9071. }
  9072. if (fun === null) {
  9073. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
  9074. }
  9075. this.assertParameters(fun, cmd.actualParameters);
  9076. return optional;
  9077. } else if (cmd instanceof _commands.Return) {
  9078. var funcName = this.currentFunction.isMain ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
  9079. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  9080. var _stringInfo3 = type.stringInfo();
  9081. var _info4 = _stringInfo3[0];
  9082. throw _processorErrorFactory.ProcessorErrorFactory.invalid_void_return_full(funcName, _info4.type, _info4.dim, cmd.sourceInfo);
  9083. } else if (cmd.expression !== null) {
  9084. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  9085. if (!type.isCompatible(_resultType4)) {
  9086. var _stringInfo4 = type.stringInfo();
  9087. var _info5 = _stringInfo4[0];
  9088. throw _processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  9089. } else {
  9090. return true;
  9091. }
  9092. } else {
  9093. return true;
  9094. }
  9095. }
  9096. }
  9097. }, {
  9098. key: 'checkCommands',
  9099. value: function checkCommands(type, cmds, optional) {
  9100. var _this3 = this;
  9101. return cmds.reduce(function (last, next) {
  9102. return _this3.checkCommand(type, next, optional) || last;
  9103. }, optional);
  9104. }
  9105. }, {
  9106. key: 'assertParameters',
  9107. value: function assertParameters(fun, actualParametersList) {
  9108. if (fun.formalParameters.length !== actualParametersList.length) {
  9109. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9110. }
  9111. for (var i = 0; i < actualParametersList.length; i++) {
  9112. var param = actualParametersList[i];
  9113. var formalParam = fun.formalParameters[i];
  9114. var id = formalParam.id;
  9115. if (formalParam.byRef) {
  9116. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  9117. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9118. }
  9119. }
  9120. var resultType = this.evaluateExpressionType(param);
  9121. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  9122. var shared = 0;
  9123. for (var j = 0; j < resultType.types.length; j++) {
  9124. var element = resultType.types[j];
  9125. if (formalParam.type.types.indexOf(element) !== -1) {
  9126. shared++;
  9127. }
  9128. }
  9129. if (shared <= 0) {
  9130. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9131. if (resultType.isCompatible(_types.Types.INTEGER) || resultType.isCompatible(_types.Types.REAL)) {
  9132. if (formalParam.type.isCompatible(_types.Types.INTEGER) || formalParam.type.isCompatible(_types.Types.REAL)) {
  9133. continue;
  9134. }
  9135. }
  9136. }
  9137. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9138. }
  9139. } else if (resultType instanceof _multiType.MultiType) {
  9140. if (!resultType.isCompatible(formalParam.type)) {
  9141. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9142. if (resultType.isCompatible(_types.Types.INTEGER) || resultType.isCompatible(_types.Types.REAL)) {
  9143. if (formalParam.type.isCompatible(_types.Types.INTEGER) || formalParam.type.isCompatible(_types.Types.REAL)) {
  9144. continue;
  9145. }
  9146. }
  9147. }
  9148. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9149. }
  9150. } else if (!formalParam.type.isCompatible(resultType)) {
  9151. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9152. if (_store.Store.canImplicitTypeCast(formalParam.type, resultType)) {
  9153. continue;
  9154. }
  9155. }
  9156. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9157. }
  9158. }
  9159. }
  9160. }]);
  9161. return SemanticAnalyser;
  9162. }();
  9163. /***/ }),
  9164. /***/ "./js/processor/store/store.js":
  9165. /*!*************************************!*\
  9166. !*** ./js/processor/store/store.js ***!
  9167. \*************************************/
  9168. /*! no static exports found */
  9169. /***/ (function(module, exports, __webpack_require__) {
  9170. "use strict";
  9171. Object.defineProperty(exports, "__esModule", {
  9172. value: true
  9173. });
  9174. exports.Store = undefined;
  9175. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9176. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9177. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  9178. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9179. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9180. var Store = exports.Store = function () {
  9181. _createClass(Store, null, [{
  9182. key: 'canImplicitTypeCast',
  9183. value: function canImplicitTypeCast(castType, sourceType) {
  9184. if (castType.isCompatible(_types.Types.INTEGER) || castType.isCompatible(_types.Types.REAL)) {
  9185. if (sourceType.isCompatible(_types.Types.INTEGER) || sourceType.isCompatible(_types.Types.REAL)) {
  9186. return true;
  9187. }
  9188. }
  9189. return false;
  9190. }
  9191. }, {
  9192. key: 'doImplicitCasting',
  9193. value: function doImplicitCasting(castType, stoObj) {
  9194. if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
  9195. throw new Error("!!!Critical error: attempted to type cast invalid types");
  9196. }
  9197. if (_types.Types.INTEGER.isCompatible(castType)) {
  9198. return new _storeObject.StoreObject(castType, stoObj.value.trunc());
  9199. } else {
  9200. return new _storeObject.StoreObject(castType, stoObj.value);
  9201. }
  9202. }
  9203. }]);
  9204. function Store(name) {
  9205. _classCallCheck(this, Store);
  9206. this.name = name;
  9207. this.store = {};
  9208. this.nextStore = null;
  9209. this.mode = _modes.Modes.RUN;
  9210. }
  9211. _createClass(Store, [{
  9212. key: 'extendStore',
  9213. value: function extendStore(nextStore) {
  9214. this.nextStore = nextStore;
  9215. }
  9216. }, {
  9217. key: 'applyStore',
  9218. value: function applyStore(id) {
  9219. if (!this.store[id]) {
  9220. if (this.nextStore !== null) {
  9221. return this.nextStore.applyStore(id);
  9222. } else {
  9223. throw new Error('Variable ' + id + ' not found.');
  9224. }
  9225. }
  9226. var val = this.store[id];
  9227. if (val.isRef) {
  9228. return val.getRefObj();
  9229. }
  9230. return this.store[id];
  9231. }
  9232. }, {
  9233. key: 'updateStore',
  9234. value: function updateStore(id, stoObj) {
  9235. if (!this.store[id]) {
  9236. if (this.nextStore !== null) {
  9237. this.nextStore.updateStore(id, stoObj);
  9238. return this;
  9239. } else {
  9240. // TODO: better error message
  9241. throw new Error('Variable ' + id + ' not found.');
  9242. }
  9243. } else {
  9244. var oldObj = this.store[id];
  9245. if (oldObj.readOnly) {
  9246. // TODO: better error message
  9247. throw new Error("Cannot change value of a read only variable: " + id);
  9248. }
  9249. if (oldObj.isRef) {
  9250. oldObj.updateRef(stoObj);
  9251. return this;
  9252. } else if (oldObj.isCompatible(stoObj)) {
  9253. stoObj.setID(id);
  9254. this.store[id] = Object.freeze(stoObj);
  9255. return this;
  9256. } else {
  9257. var oldType = oldObj.type;
  9258. var stoType = stoObj.type;
  9259. // TODO: better error message
  9260. throw new Error(oldType + ' is not compatible with type ' + stoType + ' given');
  9261. }
  9262. }
  9263. }
  9264. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9265. // and no the StoreObject refferenced by it
  9266. // updateStoreRef(id, stoObjAddress) {...}
  9267. }, {
  9268. key: 'insertStore',
  9269. value: function insertStore(id, stoObj) {
  9270. if (this.store[id]) {
  9271. // TODO: better error message
  9272. throw new Error(id + ' is already defined');
  9273. }
  9274. stoObj.setID(id);
  9275. this.store[id] = Object.freeze(stoObj);
  9276. return this;
  9277. }
  9278. }]);
  9279. return Store;
  9280. }();
  9281. /***/ }),
  9282. /***/ "./js/processor/store/storeObject.js":
  9283. /*!*******************************************!*\
  9284. !*** ./js/processor/store/storeObject.js ***!
  9285. \*******************************************/
  9286. /*! no static exports found */
  9287. /***/ (function(module, exports, __webpack_require__) {
  9288. "use strict";
  9289. Object.defineProperty(exports, "__esModule", {
  9290. value: true
  9291. });
  9292. exports.StoreObject = undefined;
  9293. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9294. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9295. var _decimal2 = _interopRequireDefault(_decimal);
  9296. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9297. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9298. var StoreObject = exports.StoreObject = function () {
  9299. function StoreObject(type, value) {
  9300. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9301. _classCallCheck(this, StoreObject);
  9302. this._type = type;
  9303. this._value = value;
  9304. this._readOnly = readOnly;
  9305. this._id = null;
  9306. }
  9307. _createClass(StoreObject, [{
  9308. key: 'setID',
  9309. value: function setID(id) {
  9310. this._id = id;
  9311. }
  9312. }, {
  9313. key: 'isCompatible',
  9314. value: function isCompatible(another) {
  9315. if (another instanceof StoreObject) {
  9316. return this.type.isCompatible(another.type);
  9317. }
  9318. return false;
  9319. }
  9320. }, {
  9321. key: 'id',
  9322. get: function get() {
  9323. return this._id;
  9324. }
  9325. }, {
  9326. key: 'inStore',
  9327. get: function get() {
  9328. return this.id !== null;
  9329. }
  9330. }, {
  9331. key: 'type',
  9332. get: function get() {
  9333. return this._type;
  9334. }
  9335. }, {
  9336. key: 'value',
  9337. get: function get() {
  9338. return this._value;
  9339. }
  9340. }, {
  9341. key: 'number',
  9342. get: function get() {
  9343. if (this._value instanceof _decimal2.default) {
  9344. return this._value.toNumber();
  9345. } else {
  9346. return null;
  9347. }
  9348. }
  9349. }, {
  9350. key: 'readOnly',
  9351. get: function get() {
  9352. return this._readOnly;
  9353. },
  9354. set: function set(value) {
  9355. this._readOnly = value;
  9356. }
  9357. }]);
  9358. return StoreObject;
  9359. }();
  9360. /***/ }),
  9361. /***/ "./js/processor/store/storeObjectArray.js":
  9362. /*!************************************************!*\
  9363. !*** ./js/processor/store/storeObjectArray.js ***!
  9364. \************************************************/
  9365. /*! no static exports found */
  9366. /***/ (function(module, exports, __webpack_require__) {
  9367. "use strict";
  9368. Object.defineProperty(exports, "__esModule", {
  9369. value: true
  9370. });
  9371. exports.StoreObjectArray = undefined;
  9372. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9373. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9374. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9375. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9376. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9377. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9378. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  9379. _inherits(StoreObjectArray, _StoreObject);
  9380. _createClass(StoreObjectArray, null, [{
  9381. key: 'WRONG_LINE_NUMBER',
  9382. get: function get() {
  9383. return 1;
  9384. }
  9385. }, {
  9386. key: 'WRONG_TYPE',
  9387. get: function get() {
  9388. return 2;
  9389. }
  9390. }, {
  9391. key: 'WRONG_COLUMN_NUMBER',
  9392. get: function get() {
  9393. return 3;
  9394. }
  9395. }]);
  9396. function StoreObjectArray(type, lines, columns) {
  9397. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9398. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9399. _classCallCheck(this, StoreObjectArray);
  9400. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  9401. _this._lines = lines;
  9402. _this._columns = columns;
  9403. return _this;
  9404. }
  9405. _createClass(StoreObjectArray, [{
  9406. key: 'isCompatible',
  9407. value: function isCompatible(another) {
  9408. if (another instanceof _storeObject.StoreObject) {
  9409. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9410. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9411. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  9412. }
  9413. }
  9414. }
  9415. return false;
  9416. }
  9417. }, {
  9418. key: 'lines',
  9419. get: function get() {
  9420. return this._lines;
  9421. }
  9422. }, {
  9423. key: 'columns',
  9424. get: function get() {
  9425. return this._columns;
  9426. }
  9427. }, {
  9428. key: 'isVector',
  9429. get: function get() {
  9430. return this.type.dimensions === 1;
  9431. }
  9432. }, {
  9433. key: 'isValid',
  9434. get: function get() {
  9435. var _this2 = this;
  9436. if (this.value !== null) {
  9437. if (this.isVector) {
  9438. if (this.value.length !== this.lines) {
  9439. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];;
  9440. }
  9441. var mustBeNull = this.value.find(function (v) {
  9442. return !_this2.type.canAccept(v.type);
  9443. });
  9444. if (!!mustBeNull) {
  9445. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];;
  9446. }
  9447. }
  9448. return [];
  9449. } else {
  9450. if (this.lines !== this.value.length) {
  9451. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9452. }
  9453. for (var i = 0; i < this.lines; i++) {
  9454. for (var j = 0; j < this.columns; j++) {
  9455. var arr = this.value[i];
  9456. if (arr.length !== this.columns) {
  9457. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9458. }
  9459. var _mustBeNull = arr.find(function (v) {
  9460. return !_this2.type.canAccept(v.type);
  9461. });
  9462. if (!!_mustBeNull) {
  9463. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9464. }
  9465. }
  9466. }
  9467. return [];
  9468. }
  9469. }
  9470. }]);
  9471. return StoreObjectArray;
  9472. }(_storeObject.StoreObject);
  9473. /***/ }),
  9474. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9475. /*!*******************************************************!*\
  9476. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9477. \*******************************************************/
  9478. /*! no static exports found */
  9479. /***/ (function(module, exports, __webpack_require__) {
  9480. "use strict";
  9481. Object.defineProperty(exports, "__esModule", {
  9482. value: true
  9483. });
  9484. exports.StoreObjectArrayAddress = undefined;
  9485. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9486. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9487. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9488. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9489. var _processorErrorFactory = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9490. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9491. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9492. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9493. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  9494. _inherits(StoreObjectArrayAddress, _StoreObject);
  9495. function StoreObjectArrayAddress(refID, line, column, store) {
  9496. _classCallCheck(this, StoreObjectArrayAddress);
  9497. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  9498. _this.refID = refID;
  9499. _this.store = store;
  9500. _this.line = line;
  9501. _this.column = column;
  9502. return _this;
  9503. }
  9504. _createClass(StoreObjectArrayAddress, [{
  9505. key: 'getArrayObject',
  9506. value: function getArrayObject() {
  9507. return this.store.applyStore(this.refID);
  9508. }
  9509. }, {
  9510. key: 'updateArrayObject',
  9511. value: function updateArrayObject(stoObj) {
  9512. var anArray = this.getArrayObject();
  9513. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  9514. if (!stoObj.type.isCompatible(this.type)) {
  9515. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9516. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  9517. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9518. }
  9519. if (this.column !== null) {
  9520. newArray.value[this.line].value[this.column] = stoObj;
  9521. return newArray;
  9522. } else {
  9523. newArray.value[this.line] = stoObj;
  9524. return newArray;
  9525. }
  9526. }
  9527. }, {
  9528. key: 'isCompatible',
  9529. value: function isCompatible(another) {
  9530. if (this.type.isCompatible(another.type)) {
  9531. if (another.type instanceof _compoundType.CompoundType) {
  9532. return this.lines === another.lines && this.columns === another.columns;
  9533. } else {
  9534. this.refValue.isCompatible(another);
  9535. }
  9536. }
  9537. }
  9538. }, {
  9539. key: 'isRef',
  9540. get: function get() {
  9541. return false;
  9542. }
  9543. }, {
  9544. key: 'inStore',
  9545. get: function get() {
  9546. return true;
  9547. }
  9548. }, {
  9549. key: 'refValue',
  9550. get: function get() {
  9551. var refLine = this.store.applyStore(this.refID).value[this.line];
  9552. if (!refLine) {
  9553. if (this.getArrayObject().isVector) {
  9554. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9555. } else {
  9556. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9557. }
  9558. }
  9559. if (this.column !== null) {
  9560. var refColumn = refLine.value[this.column];
  9561. if (!refColumn) {
  9562. if (this.getArrayObject().isVector) {
  9563. throw _processorErrorFactory.ProcessorErrorFactory.vector_not_matrix(this.refID);
  9564. } else {
  9565. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9566. }
  9567. }
  9568. return refColumn;
  9569. }
  9570. return refLine;
  9571. }
  9572. }, {
  9573. key: 'value',
  9574. get: function get() {
  9575. return this.refValue.value;
  9576. }
  9577. }, {
  9578. key: 'type',
  9579. get: function get() {
  9580. return this.refValue.type;
  9581. }
  9582. }, {
  9583. key: 'lines',
  9584. get: function get() {
  9585. if (!(this.type instanceof _compoundType.CompoundType)) {
  9586. return null;
  9587. }
  9588. return this.refValue.value.length;
  9589. }
  9590. }, {
  9591. key: 'columns',
  9592. get: function get() {
  9593. switch (this.type.dimensions) {
  9594. case 2:
  9595. return this.refValue.value[0].value.length;
  9596. default:
  9597. return null;
  9598. }
  9599. }
  9600. }]);
  9601. return StoreObjectArrayAddress;
  9602. }(_storeObject.StoreObject);
  9603. /***/ }),
  9604. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9605. /*!**********************************************************!*\
  9606. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9607. \**********************************************************/
  9608. /*! no static exports found */
  9609. /***/ (function(module, exports, __webpack_require__) {
  9610. "use strict";
  9611. Object.defineProperty(exports, "__esModule", {
  9612. value: true
  9613. });
  9614. exports.StoreObjectArrayAddressRef = undefined;
  9615. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9616. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9617. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9618. var _decimal2 = _interopRequireDefault(_decimal);
  9619. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9620. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9621. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9622. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9623. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  9624. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9625. function StoreObjectArrayAddressRef(address) {
  9626. _classCallCheck(this, StoreObjectArrayAddressRef);
  9627. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  9628. _this.address = address;
  9629. return _this;
  9630. }
  9631. _createClass(StoreObjectArrayAddressRef, [{
  9632. key: 'getRefObj',
  9633. value: function getRefObj() {
  9634. return this.address.refValue;
  9635. }
  9636. }, {
  9637. key: 'updateRef',
  9638. value: function updateRef(stoObj) {
  9639. var newArray = this.address.updateArrayObject(stoObj);
  9640. this.address.store.updateStore(this.address.refID, newArray);
  9641. }
  9642. }, {
  9643. key: 'isCompatible',
  9644. value: function isCompatible(another) {
  9645. return this.address.isCompatible(another);
  9646. }
  9647. }, {
  9648. key: 'isRef',
  9649. get: function get() {
  9650. return true;
  9651. }
  9652. }, {
  9653. key: 'type',
  9654. get: function get() {
  9655. return this.address.type;
  9656. }
  9657. }, {
  9658. key: 'value',
  9659. get: function get() {
  9660. return this.address.value;
  9661. }
  9662. }, {
  9663. key: 'number',
  9664. get: function get() {
  9665. if (this.value instanceof _decimal2.default) {
  9666. return this.value.toNumber();
  9667. } else {
  9668. return null;
  9669. }
  9670. }
  9671. }]);
  9672. return StoreObjectArrayAddressRef;
  9673. }(_storeObject.StoreObject);
  9674. /***/ }),
  9675. /***/ "./js/processor/store/storeObjectRef.js":
  9676. /*!**********************************************!*\
  9677. !*** ./js/processor/store/storeObjectRef.js ***!
  9678. \**********************************************/
  9679. /*! no static exports found */
  9680. /***/ (function(module, exports, __webpack_require__) {
  9681. "use strict";
  9682. Object.defineProperty(exports, "__esModule", {
  9683. value: true
  9684. });
  9685. exports.StoreObjectRef = undefined;
  9686. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9687. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9688. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9689. var _decimal2 = _interopRequireDefault(_decimal);
  9690. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9691. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9692. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9693. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9694. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  9695. _inherits(StoreObjectRef, _StoreObject);
  9696. function StoreObjectRef(refID, store) {
  9697. _classCallCheck(this, StoreObjectRef);
  9698. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  9699. _this.refID = refID;
  9700. _this.store = store;
  9701. return _this;
  9702. }
  9703. _createClass(StoreObjectRef, [{
  9704. key: 'getRefObj',
  9705. value: function getRefObj() {
  9706. return this.store.applyStore(this.refID);
  9707. }
  9708. }, {
  9709. key: 'updateRef',
  9710. value: function updateRef(stoObj) {
  9711. this.store.updateStore(this.refID, stoObj);
  9712. }
  9713. }, {
  9714. key: 'isCompatible',
  9715. value: function isCompatible(another) {
  9716. return this.store.applyStore(this.refID).isCompatible(another);
  9717. }
  9718. }, {
  9719. key: 'isRef',
  9720. get: function get() {
  9721. return true;
  9722. }
  9723. }, {
  9724. key: 'type',
  9725. get: function get() {
  9726. return this.store.applyStore(this.refID).type;
  9727. }
  9728. }, {
  9729. key: 'value',
  9730. get: function get() {
  9731. return this.store.applyStore(this.refID).value;
  9732. }
  9733. }, {
  9734. key: 'number',
  9735. get: function get() {
  9736. if (this.value instanceof _decimal2.default) {
  9737. return this.value.toNumber();
  9738. } else {
  9739. return null;
  9740. }
  9741. }
  9742. }]);
  9743. return StoreObjectRef;
  9744. }(_storeObject.StoreObject);
  9745. /***/ }),
  9746. /***/ "./js/runner.js":
  9747. /*!**********************!*\
  9748. !*** ./js/runner.js ***!
  9749. \**********************/
  9750. /*! no static exports found */
  9751. /***/ (function(module, exports, __webpack_require__) {
  9752. "use strict";
  9753. Object.defineProperty(exports, "__esModule", {
  9754. value: true
  9755. });
  9756. exports.runner = runner;
  9757. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  9758. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  9759. var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  9760. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  9761. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  9762. function runner() {
  9763. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  9764. // const lexer = new ivprogLexer(new InputStream(input));
  9765. // const stream = new CommonTokenStream(lexer);
  9766. // stream.fill();
  9767. // let i = 1;
  9768. // let token = null;
  9769. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  9770. // console.log(`${token.type}-${token.text}`);
  9771. // console.log('\n')
  9772. // i++;
  9773. // }
  9774. // const anaSin = new IVProgParser(input, ivprogLexer);
  9775. var editor = new JsonEditor('#json-renderer', {});
  9776. var domConsole = new _domConsole.DOMConsole("#console");
  9777. // proc.interpretAST().then( sto => {
  9778. // console.log(sto.applyStore('a'));
  9779. // }).catch(e => console.log(e));
  9780. try {
  9781. $('#btn').click(function () {
  9782. var input = $('#input').val();
  9783. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  9784. try {
  9785. var data = analiser.parseTree();
  9786. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  9787. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  9788. proc.registerInput(domConsole);
  9789. domConsole.clear();
  9790. proc.registerOutput(domConsole);
  9791. proc.interpretAST().then(function (sto) {
  9792. return editor.load(sto.store);
  9793. }).catch(function (e) {
  9794. alert(e);console.log(e);
  9795. });
  9796. } catch (error) {
  9797. alert(error);
  9798. console.log(error);
  9799. }
  9800. });
  9801. } catch (a) {
  9802. console.log(a);
  9803. }
  9804. }
  9805. /***/ }),
  9806. /***/ "./js/semantic/semantic.min.js":
  9807. /*!*************************************!*\
  9808. !*** ./js/semantic/semantic.min.js ***!
  9809. \*************************************/
  9810. /*! no static exports found */
  9811. /***/ (function(module, exports, __webpack_require__) {
  9812. "use strict";
  9813. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  9814. /*
  9815. * # Semantic UI - 2.3.3
  9816. * https://github.com/Semantic-Org/Semantic-UI
  9817. * http://www.semantic-ui.com/
  9818. *
  9819. * Copyright 2014 Contributors
  9820. * Released under the MIT license
  9821. * http://opensource.org/licenses/MIT
  9822. *
  9823. */
  9824. !function (e, t, n, i) {
  9825. e.site = e.fn.site = function (o) {
  9826. var a,
  9827. r,
  9828. s = new Date().getTime(),
  9829. l = [],
  9830. c = arguments[0],
  9831. u = "string" == typeof c,
  9832. d = [].slice.call(arguments, 1),
  9833. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  9834. m = f.namespace,
  9835. g = f.error,
  9836. p = "module-" + m,
  9837. h = e(n),
  9838. v = this,
  9839. b = h.data(p);return a = { initialize: function initialize() {
  9840. a.instantiate();
  9841. }, instantiate: function instantiate() {
  9842. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  9843. }, normalize: function normalize() {
  9844. a.fix.console(), a.fix.requestAnimationFrame();
  9845. }, fix: { console: function (_console) {
  9846. function console() {
  9847. return _console.apply(this, arguments);
  9848. }
  9849. console.toString = function () {
  9850. return _console.toString();
  9851. };
  9852. return console;
  9853. }(function () {
  9854. 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 () {});
  9855. }), consoleClear: function consoleClear() {
  9856. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  9857. }, requestAnimationFrame: function requestAnimationFrame() {
  9858. 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) {
  9859. setTimeout(e, 0);
  9860. });
  9861. } }, moduleExists: function moduleExists(t) {
  9862. return e.fn[t] !== i && e.fn[t].settings !== i;
  9863. }, enabled: { modules: function modules(t) {
  9864. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9865. a.moduleExists(t) && n.push(t);
  9866. }), n;
  9867. } }, disabled: { modules: function modules(t) {
  9868. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9869. a.moduleExists(t) || n.push(t);
  9870. }), n;
  9871. } }, change: { setting: function setting(t, n, o, r) {
  9872. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  9873. var s,
  9874. l = !a.moduleExists(o) || e.fn[o].settings.namespace || !1;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)));
  9875. });
  9876. }, settings: function settings(t, n, o) {
  9877. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  9878. var r;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)));
  9879. });
  9880. } }, enable: { console: function console() {
  9881. a.console(!0);
  9882. }, debug: function debug(e, t) {
  9883. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  9884. }, verbose: function verbose(e, t) {
  9885. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  9886. } }, disable: { console: function console() {
  9887. a.console(!1);
  9888. }, debug: function debug(e, t) {
  9889. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  9890. }, verbose: function verbose(e, t) {
  9891. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  9892. } }, console: function console(e) {
  9893. if (e) {
  9894. if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console;
  9895. } else a.debug("Disabling console function"), b.cache.console = t.console, t.console = { clear: function clear() {}, error: function error() {}, group: function group() {}, groupCollapsed: function groupCollapsed() {}, groupEnd: function groupEnd() {}, info: function info() {}, log: function log() {}, markTimeline: function markTimeline() {}, warn: function warn() {} };
  9896. }, destroy: function destroy() {
  9897. a.verbose("Destroying previous site for", h), h.removeData(p);
  9898. }, cache: {}, setting: function setting(t, n) {
  9899. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  9900. if (n === i) return f[t];f[t] = n;
  9901. }
  9902. }, internal: function internal(t, n) {
  9903. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  9904. if (n === i) return a[t];a[t] = n;
  9905. }
  9906. }, debug: function debug() {
  9907. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  9908. }, verbose: function verbose() {
  9909. 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)));
  9910. }, error: function error() {
  9911. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  9912. }, performance: { log: function log(e) {
  9913. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Element: v, Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  9914. }, display: function display() {
  9915. var t = f.name + ":",
  9916. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  9917. n += t["Execution Time"];
  9918. }), 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) {
  9919. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9920. }), console.groupEnd()), l = [];
  9921. } }, invoke: function invoke(t, n, o) {
  9922. var s,
  9923. l,
  9924. c,
  9925. u = b;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) {
  9926. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  9927. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o];
  9928. }
  9929. })), 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;
  9930. } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  9931. }, e.site.settings = { name: "Site", namespace: "site", error: { console: "Console cannot be restored, most likely it was overwritten outside of module", method: "The method you called is not defined." }, debug: !1, verbose: !1, performance: !0, modules: ["accordion", "api", "checkbox", "dimmer", "dropdown", "embed", "form", "modal", "nag", "popup", "rating", "shape", "sidebar", "state", "sticky", "tab", "transition", "visit", "visibility"], siteNamespace: "site", namespaceStub: { cache: {}, config: {}, sections: {}, section: {}, utilities: {} } }, e.extend(e.expr[":"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {
  9932. return function (n) {
  9933. return !!e.data(n, t);
  9934. };
  9935. }) : function (t, n, i) {
  9936. return !!e.data(t, i[3]);
  9937. } });
  9938. }(jQuery, window, document), function (e, t, n, i) {
  9939. "use strict";
  9940. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  9941. var o,
  9942. a = e(this),
  9943. r = a.selector || "",
  9944. s = new Date().getTime(),
  9945. l = [],
  9946. c = arguments[0],
  9947. u = arguments[1],
  9948. d = "string" == typeof c,
  9949. f = [].slice.call(arguments, 1);return a.each(function () {
  9950. var m,
  9951. g,
  9952. p,
  9953. h,
  9954. v,
  9955. b,
  9956. y,
  9957. x,
  9958. C,
  9959. w,
  9960. S,
  9961. k,
  9962. T,
  9963. A,
  9964. R,
  9965. P,
  9966. E = e(this),
  9967. F = this,
  9968. O = [],
  9969. D = !1;(P = { initialize: function initialize() {
  9970. 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());
  9971. }, instantiate: function instantiate() {
  9972. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  9973. }, destroy: function destroy() {
  9974. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  9975. }, refresh: function refresh() {
  9976. 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);
  9977. }, submit: function submit() {
  9978. P.verbose("Submitting form", E), E.submit();
  9979. }, attachEvents: function attachEvents(t, n) {
  9980. n = n || "submit", e(t).on("click" + A, function (e) {
  9981. P[n](), e.preventDefault();
  9982. });
  9983. }, bindEvents: function bindEvents() {
  9984. 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 () {
  9985. var t = e(this),
  9986. n = t.prop("type"),
  9987. i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change);
  9988. });
  9989. }, clear: function clear() {
  9990. m.each(function () {
  9991. var t = e(this),
  9992. n = t.parent(),
  9993. i = t.closest(g),
  9994. o = i.find(x.prompt),
  9995. a = t.data(y.defaultValue) || "",
  9996. r = n.is(x.uiCheckbox),
  9997. s = n.is(x.uiDropdown);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(""));
  9998. });
  9999. }, reset: function reset() {
  10000. m.each(function () {
  10001. var t = e(this),
  10002. n = t.parent(),
  10003. o = t.closest(g),
  10004. a = o.find(x.prompt),
  10005. r = t.data(y.defaultValue),
  10006. s = n.is(x.uiCheckbox),
  10007. l = n.is(x.uiDropdown),
  10008. c = o.hasClass(C.error);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)));
  10009. });
  10010. }, determine: { isValid: function isValid() {
  10011. var t = !0;return e.each(b, function (e, n) {
  10012. P.validate.field(n, e, !0) || (t = !1);
  10013. }), t;
  10014. } }, is: { bracketedRule: function bracketedRule(e) {
  10015. return e.type && e.type.match(v.regExp.bracket);
  10016. }, shorthandFields: function shorthandFields(e) {
  10017. var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t);
  10018. }, shorthandRules: function shorthandRules(t) {
  10019. return "string" == typeof t || e.isArray(t);
  10020. }, empty: function empty(e) {
  10021. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  10022. }, blank: function blank(t) {
  10023. return "" === e.trim(t.val());
  10024. }, valid: function valid(t) {
  10025. var n = !0;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) {
  10026. P.is.valid(e) || (n = !1);
  10027. }), n);
  10028. } }, removeEvents: function removeEvents() {
  10029. E.off(A), m.off(A), h.off(A), m.off(A);
  10030. }, event: { field: { keydown: function keydown(t) {
  10031. var n = e(this),
  10032. i = t.which,
  10033. o = n.is(x.input),
  10034. a = n.is(x.checkbox),
  10035. r = n.closest(x.uiDropdown).length > 0,
  10036. s = 13;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);
  10037. }, keyup: function keyup() {
  10038. D = !1;
  10039. }, blur: function blur(t) {
  10040. var n = e(this),
  10041. i = n.closest(g),
  10042. o = P.get.validation(n);i.hasClass(C.error) ? (P.debug("Revalidating field", n, o), o && P.validate.field(o)) : "blur" == v.on && o && P.validate.field(o);
  10043. }, change: function change(t) {
  10044. var n = e(this),
  10045. i = n.closest(g),
  10046. o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  10047. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  10048. }, v.delay));
  10049. } } }, get: { ancillaryValue: function ancillaryValue(e) {
  10050. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  10051. }, ruleName: function ruleName(e) {
  10052. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  10053. }, changeEvent: function changeEvent(e, t) {
  10054. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  10055. }, inputEvent: function inputEvent() {
  10056. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  10057. }, fieldsFromShorthand: function fieldsFromShorthand(t) {
  10058. var n = {};return e.each(t, function (t, i) {
  10059. "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) {
  10060. n[t].rules.push({ type: i });
  10061. });
  10062. }), n;
  10063. }, prompt: function prompt(t, n) {
  10064. var i,
  10065. o,
  10066. a = P.get.ruleName(t),
  10067. r = P.get.ancillaryValue(t),
  10068. s = P.get.field(n.identifier),
  10069. l = s.val(),
  10070. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  10071. u = -1 !== c.search("{value}"),
  10072. d = -1 !== c.search("{name}");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;
  10073. }, settings: function settings() {
  10074. if (e.isPlainObject(t)) {
  10075. var n = Object.keys(t);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));
  10076. } else v = e.fn.form.settings, b = e.fn.form.settings.defaults, P.verbose("Using default form validation", b, v);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();
  10077. }, field: function field(t) {
  10078. 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/>");
  10079. }, fields: function fields(t) {
  10080. var n = e();return e.each(t, function (e, t) {
  10081. n = n.add(P.get.field(t));
  10082. }), n;
  10083. }, validation: function validation(t) {
  10084. var n, i;return !!b && (e.each(b, function (e, o) {
  10085. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  10086. }), n || !1);
  10087. }, value: function value(e) {
  10088. var t = [];return t.push(e), P.get.values.call(F, t)[e];
  10089. }, values: function values(t) {
  10090. var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  10091. var a = e(o),
  10092. r = (a.prop("type"), a.prop("name")),
  10093. s = a.val(),
  10094. l = a.is(x.checkbox),
  10095. c = a.is(x.radio),
  10096. u = -1 !== r.indexOf("[]"),
  10097. d = !!l && a.is(":checked");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);
  10098. }), n;
  10099. } }, has: { field: function field(e) {
  10100. 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;
  10101. } }, escape: { string: function string(e) {
  10102. return (e = String(e)).replace(w.escape, "\\$&");
  10103. } }, add: { rule: function rule(e, t) {
  10104. P.add.field(e, t);
  10105. }, field: function field(t, n) {
  10106. var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) {
  10107. i[t].rules.push({ type: n });
  10108. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  10109. }, fields: function fields(t) {
  10110. var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  10111. }, prompt: function prompt(t, n) {
  10112. var o = P.get.field(t).closest(g),
  10113. a = o.children(x.prompt),
  10114. r = 0 !== a.length;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)));
  10115. }, errors: function errors(e) {
  10116. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  10117. } }, remove: { rule: function rule(t, n) {
  10118. var o = e.isArray(n) ? n : [n];if (n == i) return P.debug("Removed all rules"), void (b[t].rules = []);b[t] != i && e.isArray(b[t].rules) && e.each(b[t].rules, function (e, n) {
  10119. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  10120. });
  10121. }, field: function field(t) {
  10122. var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) {
  10123. P.remove.rule(t);
  10124. });
  10125. }, rules: function rules(t, n) {
  10126. e.isArray(t) ? e.each(fields, function (e, t) {
  10127. P.remove.rule(t, n);
  10128. }) : P.remove.rule(t, n);
  10129. }, fields: function fields(e) {
  10130. P.remove.field(e);
  10131. }, prompt: function prompt(t) {
  10132. var n = P.get.field(t).closest(g),
  10133. o = n.children(x.prompt);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 () {
  10134. o.remove();
  10135. }) : o.fadeOut(v.duration, function () {
  10136. o.remove();
  10137. }));
  10138. } }, set: { success: function success() {
  10139. E.removeClass(C.error).addClass(C.success);
  10140. }, defaults: function defaults() {
  10141. m.each(function () {
  10142. var t = e(this),
  10143. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n);
  10144. });
  10145. }, error: function error() {
  10146. E.removeClass(C.success).addClass(C.error);
  10147. }, value: function value(e, t) {
  10148. var n = {};return n[e] = t, P.set.values.call(F, n);
  10149. }, values: function values(t) {
  10150. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10151. var i,
  10152. o = P.get.field(t),
  10153. a = o.parent(),
  10154. r = e.isArray(n),
  10155. s = a.is(x.uiCheckbox),
  10156. l = a.is(x.uiDropdown),
  10157. c = o.is(x.radio) && s;o.length > 0 && (r && s ? (P.verbose("Selecting multiple", n, o), a.checkbox("uncheck"), e.each(n, function (e, t) {
  10158. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10159. })) : 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)));
  10160. });
  10161. } }, validate: { form: function form(e, t) {
  10162. var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) {
  10163. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10164. } 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);
  10165. }, field: function field(t, n, o) {
  10166. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n,
  10167. r = P.get.field(a),
  10168. s = !!t.depends && P.get.field(t.depends),
  10169. l = !0,
  10170. c = [];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) {
  10171. 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);
  10172. }), 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);
  10173. }, rule: function rule(t, n) {
  10174. var o = P.get.field(t.identifier),
  10175. a = (n.type, o.val()),
  10176. r = P.get.ancillaryValue(n),
  10177. s = P.get.ruleName(n),
  10178. l = v.rules[s];if (e.isFunction(l)) return a = a === i || "" === a || null === a ? "" : e.trim(a + ""), l.call(o, a, r);P.error(S.noRule, s);
  10179. } }, setting: function setting(t, n) {
  10180. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10181. if (n === i) return v[t];v[t] = n;
  10182. }
  10183. }, internal: function internal(t, n) {
  10184. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10185. if (n === i) return P[t];P[t] = n;
  10186. }
  10187. }, debug: function debug() {
  10188. !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)));
  10189. }, verbose: function verbose() {
  10190. !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)));
  10191. }, error: function error() {
  10192. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10193. }, performance: { log: function log(e) {
  10194. var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(P.performance.timer), P.performance.timer = setTimeout(P.performance.display, 500);
  10195. }, display: function display() {
  10196. var t = v.name + ":",
  10197. n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10198. n += t["Execution Time"];
  10199. }), 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) {
  10200. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10201. }), console.groupEnd()), l = [];
  10202. } }, invoke: function invoke(t, n, a) {
  10203. var r,
  10204. s,
  10205. l,
  10206. c = R;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) {
  10207. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10208. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  10209. }
  10210. })), 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;
  10211. } }).initialize();
  10212. }), o !== i ? o : this;
  10213. }, e.fn.form.settings = { name: "Form", namespace: "form", debug: !1, verbose: !1, performance: !0, fields: !1, keyboardShortcuts: !0, on: "submit", inline: !1, delay: 200, revalidate: !0, transition: "scale", duration: 200, onValid: function onValid() {}, onInvalid: function onInvalid() {}, onSuccess: function onSuccess() {
  10214. return !0;
  10215. }, onFailure: function onFailure() {
  10216. return !1;
  10217. }, metadata: { defaultValue: "default", validate: "validate" }, regExp: { htmlID: /^[a-zA-Z][\w:.-]*$/g, bracket: /\[(.*)\]/i, decimal: /^\d+\.?\d*$/, email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i, escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, flags: /^\/(.*)\/(.*)?/, integer: /^\-?\d+$/, number: /^\-?\d*(\.\d+)?$/, url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i }, text: { unspecifiedRule: "Please enter a valid value", unspecifiedField: "This field" }, prompt: { empty: "{name} must have a value", checked: "{name} must be checked", email: "{name} must be a valid e-mail", url: "{name} must be a valid url", regExp: "{name} is not formatted correctly", integer: "{name} must be an integer", decimal: "{name} must be a decimal number", number: "{name} must be set to a number", is: '{name} must be "{ruleValue}"', isExactly: '{name} must be exactly "{ruleValue}"', not: '{name} cannot be set to "{ruleValue}"', notExactly: '{name} cannot be set to exactly "{ruleValue}"', contain: '{name} must contain "{ruleValue}"', containExactly: '{name} must contain exactly "{ruleValue}"', doesntContain: '{name} cannot contain "{ruleValue}"', doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"', minLength: "{name} must be at least {ruleValue} characters", length: "{name} must be at least {ruleValue} characters", exactLength: "{name} must be exactly {ruleValue} characters", maxLength: "{name} cannot be longer than {ruleValue} characters", match: "{name} must match {ruleValue} field", different: "{name} must have a different value than {ruleValue} field", creditCard: "{name} must be a valid credit card number", minCount: "{name} must have at least {ruleValue} choices", exactCount: "{name} must have exactly {ruleValue} choices", maxCount: "{name} must have {ruleValue} or less choices" }, selector: { checkbox: 'input[type="checkbox"], input[type="radio"]', clear: ".clear", field: "input, textarea, select", group: ".field", input: "input", message: ".error.message", prompt: ".prompt.label", radio: 'input[type="radio"]', reset: '.reset:not([type="reset"])', submit: '.submit:not([type="submit"])', uiCheckbox: ".ui.checkbox", uiDropdown: ".ui.dropdown" }, className: { error: "error", label: "ui prompt label", pressed: "down", success: "success" }, error: { identifier: "You must specify a string identifier for each field", method: "The method you called is not defined.", noRule: "There is no rule matching the one you specified", oldSyntax: "Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically." }, templates: { error: function error(t) {
  10218. var n = '<ul class="list">';return e.each(t, function (e, t) {
  10219. n += "<li>" + t + "</li>";
  10220. }), e(n += "</ul>");
  10221. }, prompt: function prompt(t) {
  10222. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10223. } }, rules: { empty: function empty(t) {
  10224. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10225. }, checked: function checked() {
  10226. return e(this).filter(":checked").length > 0;
  10227. }, email: function email(t) {
  10228. return e.fn.form.settings.regExp.email.test(t);
  10229. }, url: function url(t) {
  10230. return e.fn.form.settings.regExp.url.test(t);
  10231. }, regExp: function regExp(t, n) {
  10232. if (n instanceof RegExp) return t.match(n);var i,
  10233. o = n.match(e.fn.form.settings.regExp.flags);return o && (n = o.length >= 2 ? o[1] : n, i = o.length >= 3 ? o[2] : ""), t.match(new RegExp(n, i));
  10234. }, integer: function integer(t, n) {
  10235. var o,
  10236. a,
  10237. r,
  10238. s = e.fn.form.settings.regExp.integer;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);
  10239. }, decimal: function decimal(t) {
  10240. return e.fn.form.settings.regExp.decimal.test(t);
  10241. }, number: function number(t) {
  10242. return e.fn.form.settings.regExp.number.test(t);
  10243. }, is: function is(e, t) {
  10244. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10245. }, isExactly: function isExactly(e, t) {
  10246. return e == t;
  10247. }, not: function not(e, t) {
  10248. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10249. }, notExactly: function notExactly(e, t) {
  10250. return e != t;
  10251. }, contains: function contains(t, n) {
  10252. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10253. }, containsExactly: function containsExactly(t, n) {
  10254. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10255. }, doesntContain: function doesntContain(t, n) {
  10256. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10257. }, doesntContainExactly: function doesntContainExactly(t, n) {
  10258. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10259. }, minLength: function minLength(e, t) {
  10260. return e !== i && e.length >= t;
  10261. }, length: function length(e, t) {
  10262. return e !== i && e.length >= t;
  10263. }, exactLength: function exactLength(e, t) {
  10264. return e !== i && e.length == t;
  10265. }, maxLength: function maxLength(e, t) {
  10266. return e !== i && e.length <= t;
  10267. }, match: function match(t, n) {
  10268. var o;e(this);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();
  10269. }, different: function different(t, n) {
  10270. var o;e(this);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();
  10271. }, creditCard: function creditCard(t, n) {
  10272. var i,
  10273. o,
  10274. a = { visa: { pattern: /^4/, length: [16] }, amex: { pattern: /^3[47]/, length: [15] }, mastercard: { pattern: /^5[1-5]/, length: [16] }, discover: { 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)/, length: [16] }, unionPay: { pattern: /^(62|88)/, length: [16, 17, 18, 19] }, jcb: { pattern: /^35(2[89]|[3-8][0-9])/, length: [16] }, maestro: { pattern: /^(5018|5020|5038|6304|6759|676[1-3])/, length: [12, 13, 14, 15, 16, 17, 18, 19] }, dinersClub: { pattern: /^(30[0-5]|^36)/, length: [14] }, laser: { pattern: /^(6304|670[69]|6771)/, length: [16, 17, 18, 19] }, visaElectron: { pattern: /^(4026|417500|4508|4844|491(3|7))/, length: [16] } },
  10275. r = {},
  10276. s = !1,
  10277. l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) {
  10278. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10279. (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0);
  10280. }), !s)) return !1;if ((i = { number: -1 !== e.inArray(t.length, a.unionPay.length), pattern: -1 !== t.search(a.unionPay.pattern) }).number && i.pattern) return !0;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--;) {
  10281. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  10282. }return f % 10 == 0 && f > 0;
  10283. }
  10284. }, minCount: function minCount(e, t) {
  10285. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  10286. }, exactCount: function exactCount(e, t) {
  10287. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  10288. }, maxCount: function maxCount(e, t) {
  10289. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  10290. } } };
  10291. }(jQuery, window, document), function (e, t, n, i) {
  10292. "use strict";
  10293. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  10294. var o,
  10295. a = e(this),
  10296. r = new Date().getTime(),
  10297. s = [],
  10298. l = arguments[0],
  10299. c = "string" == typeof l,
  10300. u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () {
  10301. var d,
  10302. f,
  10303. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  10304. g = m.className,
  10305. p = m.namespace,
  10306. h = m.selector,
  10307. v = m.error,
  10308. b = "." + p,
  10309. y = "module-" + p,
  10310. x = a.selector || "",
  10311. C = e(this),
  10312. w = C.find(h.title),
  10313. S = C.find(h.content),
  10314. k = this,
  10315. T = C.data(y);f = { initialize: function initialize() {
  10316. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  10317. }, instantiate: function instantiate() {
  10318. T = f, C.data(y, f);
  10319. }, destroy: function destroy() {
  10320. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  10321. }, refresh: function refresh() {
  10322. w = C.find(h.title), S = C.find(h.content);
  10323. }, observeChanges: function observeChanges() {
  10324. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  10325. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  10326. })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d));
  10327. }, bind: { events: function events() {
  10328. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  10329. } }, event: { click: function click() {
  10330. f.toggle.call(this);
  10331. } }, toggle: function toggle(t) {
  10332. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10333. o = n.next(S),
  10334. a = o.hasClass(g.animating),
  10335. r = o.hasClass(g.active),
  10336. s = r && !a,
  10337. l = !r && a;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);
  10338. }, open: function open(t) {
  10339. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10340. o = n.next(S),
  10341. a = o.hasClass(g.animating);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({ animation: "fade in", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 1 }, m.duration, f.resetOpacity)), o.slideDown(m.duration, m.easing, function () {
  10342. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  10343. }));
  10344. }, close: function close(t) {
  10345. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10346. o = n.next(S),
  10347. a = o.hasClass(g.animating),
  10348. r = o.hasClass(g.active);!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({ animation: "fade out", queue: !1, useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : o.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), o.slideUp(m.duration, m.easing, function () {
  10349. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  10350. }));
  10351. }, closeOthers: function closeOthers(t) {
  10352. var n,
  10353. o,
  10354. a,
  10355. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  10356. s = r.parents(h.content).prev(h.title),
  10357. l = r.closest(h.accordion),
  10358. c = h.title + "." + g.active + ":visible",
  10359. u = h.content + "." + g.active + ":visible";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({ animation: "fade out", useFailSafe: !0, debug: m.debug, verbose: m.verbose, duration: m.duration }) : a.children().stop(!0, !0).animate({ opacity: 0 }, m.duration, f.resetOpacity)), a.slideUp(m.duration, m.easing, function () {
  10360. e(this).removeClass(g.active), f.reset.display.call(this);
  10361. }));
  10362. }, reset: { display: function display() {
  10363. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10364. }, opacity: function opacity() {
  10365. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10366. } }, setting: function setting(t, n) {
  10367. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  10368. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  10369. }
  10370. }, internal: function internal(t, n) {
  10371. if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  10372. }, debug: function debug() {
  10373. !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)));
  10374. }, verbose: function verbose() {
  10375. !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)));
  10376. }, error: function error() {
  10377. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  10378. }, performance: { log: function log(e) {
  10379. var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  10380. }, display: function display() {
  10381. var t = m.name + ":",
  10382. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  10383. n += t["Execution Time"];
  10384. }), 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) {
  10385. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10386. }), console.groupEnd()), s = [];
  10387. } }, invoke: function invoke(t, n, a) {
  10388. var r,
  10389. s,
  10390. l,
  10391. c = T;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) {
  10392. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10393. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o];
  10394. }
  10395. })), 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;
  10396. } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  10397. }), o !== i ? o : this;
  10398. }, e.fn.accordion.settings = { name: "Accordion", namespace: "accordion", silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", observeChanges: !0, exclusive: !0, collapsible: !0, closeNested: !1, animateChildren: !0, duration: 350, easing: "easeOutQuad", onOpening: function onOpening() {}, onClosing: function onClosing() {}, onChanging: function onChanging() {}, onOpen: function onOpen() {}, onClose: function onClose() {}, onChange: function onChange() {}, error: { method: "The method you called is not defined" }, className: { active: "active", animating: "animating" }, selector: { accordion: ".accordion", title: ".title", trigger: ".title", content: ".content" } }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  10399. return -i * (t /= o) * (t - 2) + n;
  10400. } });
  10401. }(jQuery, window, document), function (e, t, n, i) {
  10402. "use strict";
  10403. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  10404. var a,
  10405. r = e(this),
  10406. s = r.selector || "",
  10407. l = new Date().getTime(),
  10408. c = [],
  10409. u = arguments[0],
  10410. d = "string" == typeof u,
  10411. f = [].slice.call(arguments, 1);return r.each(function () {
  10412. var r,
  10413. m,
  10414. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  10415. p = g.className,
  10416. h = g.namespace,
  10417. v = g.selector,
  10418. b = g.error,
  10419. y = "." + h,
  10420. x = "module-" + h,
  10421. C = e(this),
  10422. w = e(this).children(v.label),
  10423. S = e(this).children(v.input),
  10424. k = S[0],
  10425. T = !1,
  10426. A = !1,
  10427. R = C.data(x),
  10428. P = this;m = { initialize: function initialize() {
  10429. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  10430. }, instantiate: function instantiate() {
  10431. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  10432. }, destroy: function destroy() {
  10433. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  10434. }, fix: { reference: function reference() {
  10435. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  10436. } }, setup: function setup() {
  10437. 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();
  10438. }, refresh: function refresh() {
  10439. w = C.children(v.label), S = C.children(v.input), k = S[0];
  10440. }, hide: { input: function input() {
  10441. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  10442. } }, show: { input: function input() {
  10443. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  10444. } }, observeChanges: function observeChanges() {
  10445. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  10446. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  10447. })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r));
  10448. }, attachEvents: function attachEvents(t, n) {
  10449. var i = e(t);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);
  10450. }, event: { click: function click(t) {
  10451. var n = e(t.target);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());
  10452. }, keydown: function keydown(e) {
  10453. var t = e.which,
  10454. n = 13,
  10455. i = 32;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);
  10456. }, keyup: function keyup(e) {
  10457. A && e.preventDefault();
  10458. } }, check: function check() {
  10459. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  10460. }, uncheck: function uncheck() {
  10461. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  10462. }, indeterminate: function indeterminate() {
  10463. 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)));
  10464. }, determinate: function determinate() {
  10465. 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)));
  10466. }, enable: function enable() {
  10467. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  10468. }, disable: function disable() {
  10469. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  10470. }, get: { radios: function radios() {
  10471. var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox);
  10472. }, otherRadios: function otherRadios() {
  10473. return m.get.radios().not(C);
  10474. }, name: function name() {
  10475. return S.attr("name");
  10476. } }, is: { initialLoad: function initialLoad() {
  10477. return T;
  10478. }, radio: function radio() {
  10479. return S.hasClass(p.radio) || "radio" == S.attr("type");
  10480. }, indeterminate: function indeterminate() {
  10481. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  10482. }, checked: function checked() {
  10483. return S.prop("checked") !== i && S.prop("checked");
  10484. }, disabled: function disabled() {
  10485. return S.prop("disabled") !== i && S.prop("disabled");
  10486. }, enabled: function enabled() {
  10487. return !m.is.disabled();
  10488. }, determinate: function determinate() {
  10489. return !m.is.indeterminate();
  10490. }, unchecked: function unchecked() {
  10491. return !m.is.checked();
  10492. } }, should: { allowCheck: function allowCheck() {
  10493. 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);
  10494. }, allowUncheck: function allowUncheck() {
  10495. 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);
  10496. }, allowIndeterminate: function allowIndeterminate() {
  10497. 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);
  10498. }, allowDeterminate: function allowDeterminate() {
  10499. 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);
  10500. }, forceCallbacks: function forceCallbacks() {
  10501. return m.is.initialLoad() && g.fireOnInit;
  10502. }, ignoreCallbacks: function ignoreCallbacks() {
  10503. return T && !g.fireOnInit;
  10504. } }, can: { change: function change() {
  10505. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  10506. }, uncheck: function uncheck() {
  10507. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  10508. } }, set: { initialLoad: function initialLoad() {
  10509. T = !0;
  10510. }, checked: function checked() {
  10511. 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");
  10512. }, unchecked: function unchecked() {
  10513. 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");
  10514. }, indeterminate: function indeterminate() {
  10515. 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());
  10516. }, determinate: function determinate() {
  10517. 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));
  10518. }, disabled: function disabled() {
  10519. 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());
  10520. }, enabled: function enabled() {
  10521. 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());
  10522. }, tabbable: function tabbable() {
  10523. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  10524. } }, remove: { initialLoad: function initialLoad() {
  10525. T = !1;
  10526. } }, trigger: { change: function change() {
  10527. var e = n.createEvent("HTMLEvents"),
  10528. t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10529. } }, create: { label: function label() {
  10530. 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));
  10531. } }, has: { label: function label() {
  10532. return w.length > 0;
  10533. } }, bind: { events: function events() {
  10534. 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);
  10535. } }, unbind: { events: function events() {
  10536. m.debug("Removing events"), C.off(y);
  10537. } }, uncheckOthers: function uncheckOthers() {
  10538. var e = m.get.otherRadios();m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  10539. }, toggle: function toggle() {
  10540. 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");
  10541. }, setting: function setting(t, n) {
  10542. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10543. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10544. }
  10545. }, internal: function internal(t, n) {
  10546. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10547. if (n === i) return m[t];m[t] = n;
  10548. }
  10549. }, debug: function debug() {
  10550. !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)));
  10551. }, verbose: function verbose() {
  10552. !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)));
  10553. }, error: function error() {
  10554. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10555. }, performance: { log: function log(e) {
  10556. var t, n;g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: P, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  10557. }, display: function display() {
  10558. var t = g.name + ":",
  10559. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  10560. n += t["Execution Time"];
  10561. }), 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) {
  10562. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10563. }), console.groupEnd()), c = [];
  10564. } }, invoke: function invoke(t, n, o) {
  10565. var r,
  10566. s,
  10567. l,
  10568. c = R;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) {
  10569. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10570. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);c = c[o];
  10571. }
  10572. })), 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;
  10573. } }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  10574. }), a !== i ? a : this;
  10575. }, e.fn.checkbox.settings = { name: "Checkbox", namespace: "checkbox", silent: !1, debug: !1, verbose: !0, performance: !0, uncheckable: "auto", fireOnInit: !1, onChange: function onChange() {}, beforeChecked: function beforeChecked() {}, beforeUnchecked: function beforeUnchecked() {}, beforeDeterminate: function beforeDeterminate() {}, beforeIndeterminate: function beforeIndeterminate() {}, onChecked: function onChecked() {}, onUnchecked: function onUnchecked() {}, onDeterminate: function onDeterminate() {}, onIndeterminate: function onIndeterminate() {}, onEnable: function onEnable() {}, onDisable: function onDisable() {}, onEnabled: function onEnabled() {}, onDisabled: function onDisabled() {}, className: { checked: "checked", indeterminate: "indeterminate", disabled: "disabled", hidden: "hidden", radio: "radio", readOnly: "read-only" }, error: { method: "The method you called is not defined" }, selector: { checkbox: ".ui.checkbox", label: "label, .box", input: 'input[type="checkbox"], input[type="radio"]', link: "a[href]" } };
  10576. }(jQuery, window, document), function (e, t, n, i) {
  10577. "use strict";
  10578. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  10579. var o,
  10580. a = e(this),
  10581. r = new Date().getTime(),
  10582. s = [],
  10583. l = arguments[0],
  10584. c = "string" == typeof l,
  10585. u = [].slice.call(arguments, 1);return a.each(function () {
  10586. var d,
  10587. f,
  10588. m,
  10589. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  10590. p = g.selector,
  10591. h = g.namespace,
  10592. v = g.className,
  10593. b = g.error,
  10594. y = "." + h,
  10595. x = "module-" + h,
  10596. C = a.selector || "",
  10597. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  10598. S = e(this),
  10599. k = this,
  10600. T = S.data(x);(m = { preinitialize: function preinitialize() {
  10601. 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());
  10602. }, initialize: function initialize() {
  10603. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  10604. }, instantiate: function instantiate() {
  10605. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  10606. }, destroy: function destroy() {
  10607. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  10608. }, bind: { events: function events() {
  10609. m.is.page() && f.get(0).addEventListener("touchmove", m.event.preventScroll, { passive: !1 }), "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));
  10610. } }, unbind: { events: function events() {
  10611. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, { passive: !1 }), S.removeData(x), f.off(y);
  10612. } }, event: { click: function click(t) {
  10613. 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());
  10614. }, preventScroll: function preventScroll(e) {
  10615. e.preventDefault();
  10616. } }, addContent: function addContent(t) {
  10617. var n = e(t);m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  10618. }, create: function create() {
  10619. var t = e(g.template.dimmer());return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  10620. }, show: function show(t) {
  10621. 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));
  10622. }, hide: function hide(t) {
  10623. 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");
  10624. }, toggle: function toggle() {
  10625. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  10626. }, animate: { show: function show(t) {
  10627. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? ("auto" !== g.opacity && m.set.opacity(), d.transition({ displayType: "flex", animation: g.transition + " in", queue: !1, duration: m.get.duration(), useFailSafe: !0, onStart: function onStart() {
  10628. m.set.dimmed();
  10629. }, onComplete: function onComplete() {
  10630. m.set.active(), t();
  10631. } })) : (m.verbose("Showing dimmer animation with javascript"), m.set.dimmed(), "auto" == g.opacity && (g.opacity = .8), d.stop().css({ opacity: 0, width: "100%", height: "100%" }).fadeTo(m.get.duration(), g.opacity, function () {
  10632. d.removeAttr("style"), m.set.active(), t();
  10633. }));
  10634. }, hide: function hide(t) {
  10635. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? (m.verbose("Hiding dimmer with css"), d.transition({ displayType: "flex", animation: g.transition + " out", queue: !1, duration: m.get.duration(), useFailSafe: !0, onStart: function onStart() {
  10636. m.remove.dimmed();
  10637. }, onComplete: function onComplete() {
  10638. m.remove.active(), t();
  10639. } })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  10640. m.remove.active(), d.removeAttr("style"), t();
  10641. }));
  10642. } }, get: { dimmer: function dimmer() {
  10643. return d;
  10644. }, duration: function duration() {
  10645. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  10646. } }, has: { dimmer: function dimmer() {
  10647. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  10648. } }, is: { active: function active() {
  10649. return d.hasClass(v.active);
  10650. }, animating: function animating() {
  10651. return d.is(":animated") || d.hasClass(v.animating);
  10652. }, closable: function closable() {
  10653. return "auto" == g.closable ? "hover" != g.on : g.closable;
  10654. }, dimmer: function dimmer() {
  10655. return S.hasClass(v.dimmer);
  10656. }, dimmable: function dimmable() {
  10657. return S.hasClass(v.dimmable);
  10658. }, dimmed: function dimmed() {
  10659. return f.hasClass(v.dimmed);
  10660. }, disabled: function disabled() {
  10661. return f.hasClass(v.disabled);
  10662. }, enabled: function enabled() {
  10663. return !m.is.disabled();
  10664. }, page: function page() {
  10665. return f.is("body");
  10666. }, pageDimmer: function pageDimmer() {
  10667. return d.hasClass(v.pageDimmer);
  10668. } }, can: { show: function show() {
  10669. return !d.hasClass(v.disabled);
  10670. } }, set: { opacity: function opacity(e) {
  10671. var t = d.css("background-color"),
  10672. n = t.split(","),
  10673. i = n && 3 == n.length,
  10674. o = n && 4 == n.length;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);
  10675. }, active: function active() {
  10676. d.addClass(v.active);
  10677. }, dimmable: function dimmable() {
  10678. f.addClass(v.dimmable);
  10679. }, dimmed: function dimmed() {
  10680. f.addClass(v.dimmed);
  10681. }, pageDimmer: function pageDimmer() {
  10682. d.addClass(v.pageDimmer);
  10683. }, disabled: function disabled() {
  10684. d.addClass(v.disabled);
  10685. }, variation: function variation(e) {
  10686. (e = e || g.variation) && d.addClass(e);
  10687. } }, remove: { active: function active() {
  10688. d.removeClass(v.active);
  10689. }, dimmed: function dimmed() {
  10690. f.removeClass(v.dimmed);
  10691. }, disabled: function disabled() {
  10692. d.removeClass(v.disabled);
  10693. }, variation: function variation(e) {
  10694. (e = e || g.variation) && d.removeClass(e);
  10695. } }, setting: function setting(t, n) {
  10696. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10697. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10698. }
  10699. }, internal: function internal(t, n) {
  10700. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10701. if (n === i) return m[t];m[t] = n;
  10702. }
  10703. }, debug: function debug() {
  10704. !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)));
  10705. }, verbose: function verbose() {
  10706. !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)));
  10707. }, error: function error() {
  10708. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10709. }, performance: { log: function log(e) {
  10710. var t, n;g.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  10711. }, display: function display() {
  10712. var t = g.name + ":",
  10713. n = 0;r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  10714. n += t["Execution Time"];
  10715. }), 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) {
  10716. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10717. }), console.groupEnd()), s = [];
  10718. } }, invoke: function invoke(t, n, a) {
  10719. var r,
  10720. s,
  10721. l,
  10722. c = T;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) {
  10723. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10724. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);c = c[o];
  10725. }
  10726. })), 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;
  10727. } }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  10728. }), o !== i ? o : this;
  10729. }, e.fn.dimmer.settings = { name: "Dimmer", namespace: "dimmer", silent: !1, debug: !1, verbose: !1, performance: !0, dimmerName: !1, variation: !1, closable: "auto", useCSS: !0, transition: "fade", on: !1, opacity: "auto", duration: { show: 500, hide: 500 }, onChange: function onChange() {}, onShow: function onShow() {}, onHide: function onHide() {}, error: { method: "The method you called is not defined." }, className: { active: "active", animating: "animating", dimmable: "dimmable", dimmed: "dimmed", dimmer: "dimmer", disabled: "disabled", hide: "hide", pageDimmer: "page", show: "show" }, selector: { dimmer: "> .ui.dimmer", content: ".ui.dimmer > .content, .ui.dimmer > .content > .center" }, template: { dimmer: function dimmer() {
  10730. return e("<div />").attr("class", "ui dimmer");
  10731. } } };
  10732. }(jQuery, window, document), function (e, t, n, i) {
  10733. "use strict";
  10734. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  10735. var a,
  10736. r = e(this),
  10737. s = e(n),
  10738. l = r.selector || "",
  10739. c = "ontouchstart" in n.documentElement,
  10740. u = new Date().getTime(),
  10741. d = [],
  10742. f = arguments[0],
  10743. m = "string" == typeof f,
  10744. g = [].slice.call(arguments, 1);return r.each(function (p) {
  10745. var h,
  10746. v,
  10747. b,
  10748. y,
  10749. x,
  10750. C,
  10751. w,
  10752. S,
  10753. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  10754. T = k.className,
  10755. A = k.message,
  10756. R = k.fields,
  10757. P = k.keys,
  10758. E = k.metadata,
  10759. F = k.namespace,
  10760. O = k.regExp,
  10761. D = k.selector,
  10762. q = k.error,
  10763. j = k.templates,
  10764. z = "." + F,
  10765. I = "module-" + F,
  10766. M = e(this),
  10767. L = e(k.context),
  10768. V = M.find(D.text),
  10769. N = M.find(D.search),
  10770. H = M.find(D.sizer),
  10771. U = M.find(D.input),
  10772. W = M.find(D.icon),
  10773. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  10774. Q = M.children(D.menu),
  10775. X = Q.find(D.item),
  10776. $ = !1,
  10777. Y = !1,
  10778. Z = !1,
  10779. K = this,
  10780. J = M.data(I);S = { initialize: function initialize() {
  10781. 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());
  10782. }, instantiate: function instantiate() {
  10783. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  10784. }, destroy: function destroy() {
  10785. 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();
  10786. }, observeChanges: function observeChanges() {
  10787. "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());
  10788. }, disconnect: { menuObserver: function menuObserver() {
  10789. w && w.disconnect();
  10790. }, selectObserver: function selectObserver() {
  10791. C && C.disconnect();
  10792. } }, observe: { select: function select() {
  10793. S.has.input() && C.observe(M[0], { childList: !0, subtree: !0 });
  10794. }, menu: function menu() {
  10795. S.has.menu() && w.observe(Q[0], { childList: !0, subtree: !0 });
  10796. } }, create: { id: function id() {
  10797. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  10798. }, userChoice: function userChoice(t) {
  10799. var n, o, a;return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  10800. !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));
  10801. }), n);
  10802. }, userLabels: function userLabels(t) {
  10803. var n = S.get.userValues();n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  10804. S.verbose("Adding custom user value"), S.add.label(t, t);
  10805. }));
  10806. }, menu: function menu() {
  10807. Q = e("<div />").addClass(T.menu).appendTo(M);
  10808. }, sizer: function sizer() {
  10809. H = e("<span />").addClass(T.sizer).insertAfter(N);
  10810. } }, search: function search(e) {
  10811. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  10812. }, select: { firstUnfiltered: function firstUnfiltered() {
  10813. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  10814. }, nextAvailable: function nextAvailable(e) {
  10815. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  10816. n = e.prevAll(D.item).not(D.unselectable).eq(0);t.length > 0 ? (S.verbose("Moving selection to", t), t.addClass(T.selected)) : (S.verbose("Moving selection to", n), n.addClass(T.selected));
  10817. } }, setup: { api: function api() {
  10818. var e = { debug: k.debug, urlData: { value: S.get.value(), query: S.get.query() }, on: !1 };S.verbose("First request, initializing API"), M.api(e);
  10819. }, layout: function layout() {
  10820. 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();
  10821. }, select: function select() {
  10822. var t = S.get.selectValues();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();
  10823. }, menu: function menu(e) {
  10824. Q.html(j.menu(e, R)), X = Q.find(D.item);
  10825. }, reference: function reference() {
  10826. 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();
  10827. }, returnedObject: function returnedObject() {
  10828. var e = r.slice(0, p),
  10829. t = r.slice(p + 1);r = e.add(M).add(t);
  10830. } }, refresh: function refresh() {
  10831. S.refreshSelectors(), S.refreshData();
  10832. }, refreshItems: function refreshItems() {
  10833. X = Q.find(D.item);
  10834. }, refreshSelectors: function refreshSelectors() {
  10835. 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);
  10836. }, refreshData: function refreshData() {
  10837. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  10838. }, clearData: function clearData() {
  10839. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  10840. }, toggle: function toggle() {
  10841. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  10842. }, show: function show(t) {
  10843. 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()) {
  10844. if (S.debug("Showing dropdown"), !S.has.message() || S.has.maxSelections() || S.has.allResultsFiltered() || S.remove.message(), S.is.allFiltered()) return !0;!1 !== k.onShow.call(K) && S.animate.show(function () {
  10845. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  10846. });
  10847. }
  10848. }, hide: function hide(t) {
  10849. 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 () {
  10850. S.remove.visible(), t.call(K);
  10851. }));
  10852. }, hideOthers: function hideOthers() {
  10853. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  10854. }, hideMenu: function hideMenu() {
  10855. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  10856. }, hideSubMenus: function hideSubMenus() {
  10857. var e = Q.children(D.item).find(D.menu);S.verbose("Hiding sub menus", e), e.transition("hide");
  10858. }, bind: { events: function events() {
  10859. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  10860. }, touchEvents: function touchEvents() {
  10861. 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);
  10862. }, keyboardEvents: function keyboardEvents() {
  10863. 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);
  10864. }, inputEvents: function inputEvents() {
  10865. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  10866. }, mouseEvents: function mouseEvents() {
  10867. 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);
  10868. }, intent: function intent() {
  10869. 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);
  10870. } }, unbind: { intent: function intent() {
  10871. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  10872. } }, filter: function filter(e) {
  10873. var t = e !== i ? e : S.get.query(),
  10874. n = function n() {
  10875. 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();
  10876. };k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  10877. k.filterRemoteData && S.filterItems(t), n();
  10878. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  10879. }, queryRemote: function queryRemote(t, n) {
  10880. var i = { errorDuration: !1, cache: "local", throttle: k.throttle, urlData: { query: t }, onError: function onError() {
  10881. S.add.message(A.serverError), n();
  10882. }, onFailure: function onFailure() {
  10883. S.add.message(A.serverError), n();
  10884. }, onSuccess: function onSuccess(t) {
  10885. var i = t[R.remoteValues];e.isArray(i) && i.length > 0 ? (S.remove.message(), S.setup.menu({ values: t[R.remoteValues] })) : S.add.message(A.noResults), n();
  10886. } };M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  10887. }, filterItems: function filterItems(t) {
  10888. var n = t !== i ? t : S.get.query(),
  10889. o = null,
  10890. a = S.escape.string(n),
  10891. r = new RegExp("^" + a, "igm");S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  10892. var t,
  10893. i,
  10894. a = e(this);if ("both" == k.match || "text" == k.match) {
  10895. if (-1 !== (t = String(S.get.choiceText(a, !1))).search(r)) return o.push(this), !0;if ("exact" === k.fullTextSearch && S.exactSearch(n, t)) return o.push(this), !0;if (!0 === k.fullTextSearch && S.fuzzySearch(n, t)) return o.push(this), !0;
  10896. }if ("both" == k.match || "value" == k.match) {
  10897. if (-1 !== (i = String(S.get.choiceValue(a, t))).search(r)) return o.push(this), !0;if ("exact" === k.fullTextSearch && S.exactSearch(n, i)) return o.push(this), !0;if (!0 === k.fullTextSearch && S.fuzzySearch(n, i)) return o.push(this), !0;
  10898. }
  10899. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  10900. }, fuzzySearch: function fuzzySearch(e, t) {
  10901. var n = t.length,
  10902. i = e.length;if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;if (i === n) return e === t;e: for (var o = 0, a = 0; o < i; o++) {
  10903. for (var r = e.charCodeAt(o); a < n;) {
  10904. if (t.charCodeAt(a++) === r) continue e;
  10905. }return !1;
  10906. }return !0;
  10907. }, exactSearch: function exactSearch(e, t) {
  10908. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  10909. }, filterActive: function filterActive() {
  10910. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  10911. }, focusSearch: function focusSearch(e) {
  10912. 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());
  10913. }, forceSelection: function forceSelection() {
  10914. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  10915. t = X.not(T.filtered).filter("." + T.active).eq(0),
  10916. n = e.length > 0 ? e : t;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);k.allowAdditions ? (S.set.selected(S.get.query()), S.remove.searchTerm()) : S.remove.searchTerm();
  10917. }, change: { values: function values(t) {
  10918. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({ values: t }), e.each(t, function (e, t) {
  10919. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  10920. });
  10921. } }, event: { change: function change() {
  10922. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  10923. }, focus: function focus() {
  10924. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  10925. }, blur: function blur(e) {
  10926. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  10927. }, mousedown: function mousedown() {
  10928. S.is.searchSelection() ? b = !0 : $ = !0;
  10929. }, mouseup: function mouseup() {
  10930. S.is.searchSelection() ? b = !1 : $ = !1;
  10931. }, click: function click(t) {
  10932. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  10933. }, search: { focus: function focus() {
  10934. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  10935. }, blur: function blur(e) {
  10936. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  10937. } }, icon: { click: function click(e) {
  10938. S.toggle();
  10939. } }, text: { focus: function focus(e) {
  10940. $ = !0, S.focusSearch();
  10941. } }, input: function input(e) {
  10942. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  10943. }, label: { click: function click(t) {
  10944. var n = e(this),
  10945. i = M.find(D.label),
  10946. o = i.filter("." + T.active),
  10947. a = n.nextAll("." + T.active),
  10948. r = n.prevAll("." + T.active),
  10949. s = a.length > 0 ? n.nextUntil(a).add(o).add(n) : n.prevUntil(r).add(o).add(n);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));
  10950. } }, remove: { click: function click() {
  10951. var t = e(this).parent();t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  10952. } }, test: { toggle: function toggle(e) {
  10953. var t = S.is.multiple() ? S.show : S.toggle;S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  10954. }, touch: function touch(e) {
  10955. S.determine.eventOnElement(e, function () {
  10956. "touchstart" == e.type ? S.timer = setTimeout(function () {
  10957. S.hide();
  10958. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  10959. }), e.stopPropagation();
  10960. }, hide: function hide(e) {
  10961. S.determine.eventInModule(e, S.hide);
  10962. } }, select: { mutation: function mutation(t) {
  10963. S.debug("<select> modified, recreating menu");var n = !1;e.each(t, function (t, i) {
  10964. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  10965. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  10966. } }, menu: { mutation: function mutation(t) {
  10967. var n = t[0],
  10968. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  10969. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  10970. a = i.add(o),
  10971. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  10972. s = a.is(D.message) || a.closest(D.message).length > 0;r || s ? (S.debug("Updating item selector cache"), S.refreshItems()) : (S.debug("Menu modified, updating selector cache"), S.refresh());
  10973. }, mousedown: function mousedown() {
  10974. Y = !0;
  10975. }, mouseup: function mouseup() {
  10976. Y = !1;
  10977. } }, item: { mouseenter: function mouseenter(t) {
  10978. var n = e(t.target),
  10979. i = e(this),
  10980. o = i.children(D.menu),
  10981. a = i.siblings(D.item).children(D.menu),
  10982. r = o.length > 0;!(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10983. S.verbose("Showing sub-menu", o), e.each(a, function () {
  10984. S.animate.hide(!1, e(this));
  10985. }), S.animate.show(!1, o);
  10986. }, k.delay.show), t.preventDefault());
  10987. }, mouseleave: function mouseleave(t) {
  10988. var n = e(this).children(D.menu);n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10989. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  10990. }, k.delay.hide));
  10991. }, click: function click(t, i) {
  10992. var o = e(this),
  10993. a = e(t ? t.target : ""),
  10994. r = o.find(D.menu),
  10995. s = S.get.choiceText(o),
  10996. l = S.get.choiceValue(o, s),
  10997. c = r.length > 0,
  10998. u = r.find(a).length > 0;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));
  10999. } }, document: { keydown: function keydown(e) {
  11000. var t = e.which;if (S.is.inObject(t, P)) {
  11001. var n = M.find(D.label),
  11002. i = n.filter("." + T.active),
  11003. o = (i.data(E.value), n.index(i)),
  11004. a = n.length,
  11005. r = i.length > 0,
  11006. s = i.length > 1,
  11007. l = 0 === o,
  11008. c = o + 1 == a,
  11009. u = S.is.searchSelection(),
  11010. d = S.is.focusedOnSearch(),
  11011. f = S.is.focused(),
  11012. m = d && 0 === S.get.caretPosition();if (u && !r && !d) return;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);
  11013. }
  11014. } }, keydown: function keydown(e) {
  11015. var t = e.which;if (S.is.inObject(t, P)) {
  11016. var n,
  11017. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  11018. o = Q.children("." + T.active).eq(0),
  11019. a = i.length > 0 ? i : o,
  11020. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  11021. s = a.children(D.menu),
  11022. l = a.closest(D.menu),
  11023. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  11024. u = s.length > 0,
  11025. d = a.length > 0,
  11026. f = a.not(D.unselectable).length > 0,
  11027. m = t == P.delimiter && k.allowAdditions && S.is.multiple();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()) {
  11028. 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) {
  11029. 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();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();
  11030. }if (t == P.downArrow) {
  11031. 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();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();
  11032. }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());
  11033. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  11034. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  11035. } }, trigger: { change: function change() {
  11036. var e = n.createEvent("HTMLEvents"),
  11037. t = U[0];t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  11038. } }, determine: { selectAction: function selectAction(t, n) {
  11039. 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);
  11040. }, eventInModule: function eventInModule(t, i) {
  11041. var o = e(t.target),
  11042. a = o.closest(n.documentElement).length > 0,
  11043. r = o.closest(M).length > 0;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);
  11044. }, eventOnElement: function eventOnElement(t, i) {
  11045. var o = e(t.target),
  11046. a = o.closest(D.siblingLabel),
  11047. r = n.body.contains(t.target),
  11048. s = 0 === M.find(a).length,
  11049. l = 0 === o.closest(Q).length;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);
  11050. } }, action: { nothing: function nothing() {}, activate: function activate(t, n, o) {
  11051. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  11052. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  11053. }
  11054. }, select: function select(t, n, o) {
  11055. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  11056. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  11057. }
  11058. }, combo: function combo(t, n, o) {
  11059. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  11060. }, hide: function hide(e, t, n) {
  11061. S.set.value(t, e), S.hideAndClear();
  11062. } }, get: { id: function id() {
  11063. return x;
  11064. }, defaultText: function defaultText() {
  11065. return M.data(E.defaultText);
  11066. }, defaultValue: function defaultValue() {
  11067. return M.data(E.defaultValue);
  11068. }, placeholderText: function placeholderText() {
  11069. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  11070. }, text: function text() {
  11071. return V.text();
  11072. }, query: function query() {
  11073. return e.trim(N.val());
  11074. }, searchWidth: function searchWidth(e) {
  11075. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  11076. }, selectionCount: function selectionCount() {
  11077. var t = S.get.values();return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  11078. }, transition: function transition(e) {
  11079. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  11080. }, userValues: function userValues() {
  11081. var t = S.get.values();return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  11082. return !1 === S.get.item(e);
  11083. }));
  11084. }, uniqueArray: function uniqueArray(t) {
  11085. return e.grep(t, function (n, i) {
  11086. return e.inArray(n, t) === i;
  11087. });
  11088. }, caretPosition: function caretPosition() {
  11089. var e,
  11090. t,
  11091. i = N.get(0);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;
  11092. }, value: function value() {
  11093. var t = U.length > 0 ? U.val() : M.data(E.value),
  11094. n = e.isArray(t) && 1 === t.length && "" === t[0];return t === i || n ? "" : t;
  11095. }, values: function values() {
  11096. var e = S.get.value();return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  11097. }, remoteValues: function remoteValues() {
  11098. var t = S.get.values(),
  11099. n = !1;return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  11100. var i = S.read.remoteData(t);S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  11101. })), n;
  11102. }, choiceText: function choiceText(t, n) {
  11103. 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());
  11104. }, choiceValue: function choiceValue(t, n) {
  11105. 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));
  11106. }, inputEvent: function inputEvent() {
  11107. var e = N[0];return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  11108. }, selectValues: function selectValues() {
  11109. var t = { values: [] };return M.find("option").each(function () {
  11110. var n = e(this),
  11111. o = n.html(),
  11112. a = n.attr("disabled"),
  11113. r = n.attr("value") !== i ? n.attr("value") : o;"auto" === k.placeholder && "" === r ? t.placeholder = o : t.values.push({ name: o, value: r, disabled: a });
  11114. }), 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) {
  11115. return e.name > t.name ? 1 : -1;
  11116. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  11117. }, activeItem: function activeItem() {
  11118. return X.filter("." + T.active);
  11119. }, selectedItem: function selectedItem() {
  11120. var e = X.not(D.unselectable).filter("." + T.selected);return e.length > 0 ? e : X.eq(0);
  11121. }, itemWithAdditions: function itemWithAdditions(e) {
  11122. var t = S.get.item(e),
  11123. n = S.create.userChoice(e);return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  11124. }, item: function item(t, n) {
  11125. var o,
  11126. a,
  11127. r = !1;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 () {
  11128. var o = e(this),
  11129. s = S.get.choiceText(o),
  11130. l = S.get.choiceValue(o, s);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) {
  11131. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  11132. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  11133. }), r;
  11134. } }, check: { maxSelections: function maxSelections(e) {
  11135. 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));
  11136. } }, restore: { defaults: function defaults() {
  11137. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  11138. }, defaultText: function defaultText() {
  11139. var e = S.get.defaultText();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));
  11140. }, placeholderText: function placeholderText() {
  11141. S.set.placeholderText();
  11142. }, defaultValue: function defaultValue() {
  11143. var e = S.get.defaultValue();e !== i && (S.debug("Restoring default value", e), "" !== e ? (S.set.value(e), S.set.selected()) : (S.remove.activeItem(), S.remove.selectedItem()));
  11144. }, labels: function labels() {
  11145. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  11146. }, selected: function selected() {
  11147. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  11148. }, values: function values() {
  11149. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  11150. }, remoteValues: function remoteValues() {
  11151. var t = S.get.remoteValues();S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  11152. S.set.text(t);
  11153. }) : e.each(t, function (e, t) {
  11154. S.add.label(e, t);
  11155. }));
  11156. } }, read: { remoteData: function remoteData(e) {
  11157. var n;if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;S.error(q.noStorage);
  11158. } }, save: { defaults: function defaults() {
  11159. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  11160. }, defaultValue: function defaultValue() {
  11161. var e = S.get.value();S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  11162. }, defaultText: function defaultText() {
  11163. var e = S.get.text();S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  11164. }, placeholderText: function placeholderText() {
  11165. var e;!1 !== k.placeholder && V.hasClass(T.placeholder) && (e = S.get.text(), S.verbose("Saving placeholder text as", e), M.data(E.placeholderText, e));
  11166. }, remoteData: function remoteData(e, n) {
  11167. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  11168. } }, clear: function clear() {
  11169. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  11170. }, clearValue: function clearValue() {
  11171. S.set.value("");
  11172. }, scrollPage: function scrollPage(e, t) {
  11173. var n,
  11174. i,
  11175. o = t || S.get.selectedItem(),
  11176. a = o.closest(D.menu),
  11177. r = a.outerHeight(),
  11178. s = a.scrollTop(),
  11179. l = X.eq(0).outerHeight(),
  11180. c = Math.floor(r / l),
  11181. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  11182. d = X.not(D.unselectable);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));
  11183. }, set: { filtered: function filtered() {
  11184. var e = S.is.multiple(),
  11185. t = S.is.searchSelection(),
  11186. n = e && t,
  11187. i = t ? S.get.query() : "",
  11188. o = "string" == typeof i && i.length > 0,
  11189. a = S.get.searchWidth(),
  11190. r = "" !== i;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));
  11191. }, empty: function empty() {
  11192. M.addClass(T.empty);
  11193. }, loading: function loading() {
  11194. M.addClass(T.loading);
  11195. }, placeholderText: function placeholderText(e) {
  11196. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  11197. }, tabbable: function tabbable() {
  11198. 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)));
  11199. }, initialLoad: function initialLoad() {
  11200. S.verbose("Setting initial load"), h = !0;
  11201. }, activeItem: function activeItem(e) {
  11202. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  11203. }, partialSearch: function partialSearch(e) {
  11204. var t = S.get.query().length;N.val(e.substr(0, t));
  11205. }, scrollPosition: function scrollPosition(e, t) {
  11206. var n, o, a, r, s, l;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));
  11207. }, text: function text(e) {
  11208. "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)));
  11209. }, selectedItem: function selectedItem(e) {
  11210. var t = S.get.choiceValue(e),
  11211. n = S.get.choiceText(e, !1),
  11212. i = S.get.choiceText(e, !0);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);
  11213. }, selectedLetter: function selectedLetter(t) {
  11214. var n,
  11215. i = X.filter("." + T.selected),
  11216. o = !1;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 () {
  11217. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  11218. }), 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));
  11219. }, direction: function direction(e) {
  11220. "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);
  11221. }, upward: function upward(e) {
  11222. (e || M).addClass(T.upward);
  11223. }, leftward: function leftward(e) {
  11224. (e || Q).addClass(T.leftward);
  11225. }, value: function value(e, t, n) {
  11226. var o = S.escape.value(e),
  11227. a = U.length > 0,
  11228. r = S.get.values(),
  11229. s = e !== i ? String(e) : e;if (a) {
  11230. if (!k.allowReselection && s == r && (S.verbose("Skipping value update already same value", e, r), !S.is.initialLoad())) return;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;
  11231. } else S.verbose("Storing value in metadata", o, U), o !== r && M.data(E.value, s);!1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onChange) : k.onChange.call(K, e, t, n);
  11232. }, active: function active() {
  11233. M.addClass(T.active);
  11234. }, multiple: function multiple() {
  11235. M.addClass(T.multiple);
  11236. }, visible: function visible() {
  11237. M.addClass(T.visible);
  11238. }, exactly: function exactly(e, t) {
  11239. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  11240. }, selected: function selected(t, n) {
  11241. var i = S.is.multiple();(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 () {
  11242. var t = e(this),
  11243. o = S.get.choiceText(t),
  11244. a = S.get.choiceValue(t, o),
  11245. r = t.hasClass(T.filtered),
  11246. s = t.hasClass(T.active),
  11247. l = t.hasClass(T.addition),
  11248. c = i && 1 == n.length;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));
  11249. }));
  11250. } }, add: { label: function label(t, n, i) {
  11251. var o,
  11252. a = S.is.searchSelection() ? N : V,
  11253. r = S.escape.value(t);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)));
  11254. }, message: function message(t) {
  11255. var n = Q.children(D.message),
  11256. i = k.templates.message(S.add.variables(t));n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  11257. }, optionValue: function optionValue(t) {
  11258. var n = S.escape.value(t);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());
  11259. }, userSuggestion: function userSuggestion(e) {
  11260. var t,
  11261. n = Q.children(D.addition),
  11262. i = S.get.item(e),
  11263. o = i && i.not(D.addition).length,
  11264. a = n.length > 0;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()));
  11265. }, variables: function variables(e, t) {
  11266. var n,
  11267. i,
  11268. o = -1 !== e.search("{count}"),
  11269. a = -1 !== e.search("{maxCount}"),
  11270. r = -1 !== e.search("{term}");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;
  11271. }, value: function value(t, n, i) {
  11272. var o,
  11273. a = S.get.values();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");
  11274. } }, remove: { active: function active() {
  11275. M.removeClass(T.active);
  11276. }, activeLabel: function activeLabel() {
  11277. M.find(D.label).removeClass(T.active);
  11278. }, empty: function empty() {
  11279. M.removeClass(T.empty);
  11280. }, loading: function loading() {
  11281. M.removeClass(T.loading);
  11282. }, initialLoad: function initialLoad() {
  11283. h = !1;
  11284. }, upward: function upward(e) {
  11285. (e || M).removeClass(T.upward);
  11286. }, leftward: function leftward(e) {
  11287. (e || Q).removeClass(T.leftward);
  11288. }, visible: function visible() {
  11289. M.removeClass(T.visible);
  11290. }, activeItem: function activeItem() {
  11291. X.removeClass(T.active);
  11292. }, filteredItem: function filteredItem() {
  11293. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  11294. }, optionValue: function optionValue(e) {
  11295. var t = S.escape.value(e),
  11296. n = U.find('option[value="' + S.escape.string(t) + '"]');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], { childList: !0, subtree: !0 }));
  11297. }, message: function message() {
  11298. Q.children(D.message).remove();
  11299. }, searchWidth: function searchWidth() {
  11300. N.css("width", "");
  11301. }, searchTerm: function searchTerm() {
  11302. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  11303. }, userAddition: function userAddition() {
  11304. X.filter(D.addition).remove();
  11305. }, selected: function selected(t, n) {
  11306. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;n.each(function () {
  11307. var t = e(this),
  11308. n = S.get.choiceText(t),
  11309. i = S.get.choiceValue(t, n);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);
  11310. });
  11311. }, selectedItem: function selectedItem() {
  11312. X.removeClass(T.selected);
  11313. }, value: function value(e, t, n) {
  11314. var i,
  11315. o = S.get.values();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();
  11316. }, arrayValue: function arrayValue(t, n) {
  11317. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  11318. return t != e;
  11319. }), S.verbose("Removed value from delimited string", t, n), n;
  11320. }, label: function label(e, t) {
  11321. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');S.verbose("Removing label", n), n.remove();
  11322. }, activeLabels: function activeLabels(e) {
  11323. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  11324. }, labels: function labels(t) {
  11325. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  11326. var t = e(this),
  11327. n = t.data(E.value),
  11328. o = n !== i ? String(n) : n,
  11329. a = S.is.userValue(o);!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");
  11330. });
  11331. }, tabbable: function tabbable() {
  11332. 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"));
  11333. } }, has: { menuSearch: function menuSearch() {
  11334. return S.has.search() && N.closest(Q).length > 0;
  11335. }, search: function search() {
  11336. return N.length > 0;
  11337. }, sizer: function sizer() {
  11338. return H.length > 0;
  11339. }, selectInput: function selectInput() {
  11340. return U.is("select");
  11341. }, minCharacters: function minCharacters(e) {
  11342. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  11343. }, firstLetter: function firstLetter(e, t) {
  11344. var n;return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  11345. }, input: function input() {
  11346. return U.length > 0;
  11347. }, items: function items() {
  11348. return X.length > 0;
  11349. }, menu: function menu() {
  11350. return Q.length > 0;
  11351. }, message: function message() {
  11352. return 0 !== Q.children(D.message).length;
  11353. }, label: function label(e) {
  11354. var t = S.escape.value(e),
  11355. n = M.find(D.label);return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  11356. }, maxSelections: function maxSelections() {
  11357. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  11358. }, allResultsFiltered: function allResultsFiltered() {
  11359. var e = X.not(D.addition);return e.filter(D.unselectable).length === e.length;
  11360. }, userSuggestion: function userSuggestion() {
  11361. return Q.children(D.addition).length > 0;
  11362. }, query: function query() {
  11363. return "" !== S.get.query();
  11364. }, value: function value(e) {
  11365. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  11366. }, valueMatchingCase: function valueMatchingCase(t) {
  11367. var n = S.get.values();return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  11368. }, valueIgnoringCase: function valueIgnoringCase(t) {
  11369. var n = S.get.values(),
  11370. i = !1;return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  11371. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  11372. }), i;
  11373. } }, is: { active: function active() {
  11374. return M.hasClass(T.active);
  11375. }, animatingInward: function animatingInward() {
  11376. return Q.transition("is inward");
  11377. }, animatingOutward: function animatingOutward() {
  11378. return Q.transition("is outward");
  11379. }, bubbledLabelClick: function bubbledLabelClick(t) {
  11380. return e(t.target).is("select, input") && M.closest("label").length > 0;
  11381. }, bubbledIconClick: function bubbledIconClick(t) {
  11382. return e(t.target).closest(W).length > 0;
  11383. }, alreadySetup: function alreadySetup() {
  11384. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  11385. }, animating: function animating(e) {
  11386. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  11387. }, leftward: function leftward(e) {
  11388. return (e || Q).hasClass(T.leftward);
  11389. }, disabled: function disabled() {
  11390. return M.hasClass(T.disabled);
  11391. }, focused: function focused() {
  11392. return n.activeElement === M[0];
  11393. }, focusedOnSearch: function focusedOnSearch() {
  11394. return n.activeElement === N[0];
  11395. }, allFiltered: function allFiltered() {
  11396. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  11397. }, hidden: function hidden(e) {
  11398. return !S.is.visible(e);
  11399. }, initialLoad: function initialLoad() {
  11400. return h;
  11401. }, inObject: function inObject(t, n) {
  11402. var i = !1;return e.each(n, function (e, n) {
  11403. if (n == t) return i = !0, !0;
  11404. }), i;
  11405. }, multiple: function multiple() {
  11406. return M.hasClass(T.multiple);
  11407. }, remote: function remote() {
  11408. return k.apiSettings && S.can.useAPI();
  11409. }, single: function single() {
  11410. return !S.is.multiple();
  11411. }, selectMutation: function selectMutation(t) {
  11412. var n = !1;return e.each(t, function (t, i) {
  11413. if (i.target && e(i.target).is("select")) return n = !0, !0;
  11414. }), n;
  11415. }, search: function search() {
  11416. return M.hasClass(T.search);
  11417. }, searchSelection: function searchSelection() {
  11418. return S.has.search() && 1 === N.parent(D.dropdown).length;
  11419. }, selection: function selection() {
  11420. return M.hasClass(T.selection);
  11421. }, userValue: function userValue(t) {
  11422. return -1 !== e.inArray(t, S.get.userValues());
  11423. }, upward: function upward(e) {
  11424. return (e || M).hasClass(T.upward);
  11425. }, visible: function visible(e) {
  11426. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  11427. }, verticallyScrollableContext: function verticallyScrollableContext() {
  11428. var e = L.get(0) !== t && L.css("overflow-y");return "auto" == e || "scroll" == e;
  11429. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  11430. var e = L.get(0) !== t && L.css("overflow-X");return "auto" == e || "scroll" == e;
  11431. } }, can: { activate: function activate(e) {
  11432. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  11433. }, openDownward: function openDownward(e) {
  11434. var n,
  11435. i,
  11436. o = e || Q,
  11437. a = !0;return o.addClass(T.loading), i = { context: { offset: L.get(0) === t ? { top: 0, left: 0 } : L.offset(), scrollTop: L.scrollTop(), height: L.outerHeight() }, menu: { offset: o.offset(), height: o.outerHeight() } }, S.is.verticallyScrollableContext() && (i.menu.offset.top += i.context.scrollTop), (n = { above: i.context.scrollTop <= i.menu.offset.top - i.context.offset.top - i.menu.height, below: i.context.scrollTop + i.context.height >= i.menu.offset.top - i.context.offset.top + i.menu.height }).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;
  11438. }, openRightward: function openRightward(e) {
  11439. var n,
  11440. i,
  11441. o = e || Q,
  11442. a = !0;return o.addClass(T.loading), i = { context: { offset: L.get(0) === t ? { top: 0, left: 0 } : L.offset(), scrollLeft: L.scrollLeft(), width: L.outerWidth() }, menu: { offset: o.offset(), width: o.outerWidth() } }, 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;
  11443. }, click: function click() {
  11444. return c || "click" == k.on;
  11445. }, extendSelect: function extendSelect() {
  11446. return k.allowAdditions || k.apiSettings;
  11447. }, show: function show() {
  11448. return !S.is.disabled() && (S.has.items() || S.has.message());
  11449. }, useAPI: function useAPI() {
  11450. return e.fn.api !== i;
  11451. } }, animate: { show: function show(t, n) {
  11452. var o,
  11453. a = n || Q,
  11454. r = n ? function () {} : function () {
  11455. S.hideSubMenus(), S.hideOthers(), S.set.active();
  11456. };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({ animation: o + " in", debug: k.debug, verbose: k.verbose, duration: k.duration, queue: !0, onStart: r, onComplete: function onComplete() {
  11457. t.call(K);
  11458. } }) : S.error(q.noTransition, o));
  11459. }, hide: function hide(t, n) {
  11460. var o = n || Q,
  11461. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  11462. S.can.click() && S.unbind.intent(), S.remove.active();
  11463. }),
  11464. r = S.get.transition(n);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({ animation: r + " out", duration: k.duration, debug: k.debug, verbose: k.verbose, queue: !1, onStart: a, onComplete: function onComplete() {
  11465. t.call(K);
  11466. } }) : S.error(q.transition));
  11467. } }, hideAndClear: function hideAndClear() {
  11468. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  11469. S.remove.filteredItem();
  11470. }) : S.hide());
  11471. }, delay: { show: function show() {
  11472. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  11473. }, hide: function hide() {
  11474. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  11475. } }, escape: { value: function value(t) {
  11476. var n = e.isArray(t),
  11477. i = "string" == typeof t,
  11478. o = !i && !n,
  11479. a = i && -1 !== t.search(O.quote),
  11480. r = [];return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  11481. r.push(t.replace(O.quote, "&quot;"));
  11482. }), r) : t.replace(O.quote, "&quot;"));
  11483. }, string: function string(e) {
  11484. return (e = String(e)).replace(O.escape, "\\$&");
  11485. } }, setting: function setting(t, n) {
  11486. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  11487. if (n === i) return k[t];e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  11488. }
  11489. }, internal: function internal(t, n) {
  11490. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  11491. if (n === i) return S[t];S[t] = n;
  11492. }
  11493. }, debug: function debug() {
  11494. !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)));
  11495. }, verbose: function verbose() {
  11496. !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)));
  11497. }, error: function error() {
  11498. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  11499. }, performance: { log: function log(e) {
  11500. var t, n;k.performance && (n = (t = new Date().getTime()) - (u || t), u = t, d.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: K, "Execution Time": n })), clearTimeout(S.performance.timer), S.performance.timer = setTimeout(S.performance.display, 500);
  11501. }, display: function display() {
  11502. var t = k.name + ":",
  11503. n = 0;u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  11504. n += t["Execution Time"];
  11505. }), 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) {
  11506. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11507. }), console.groupEnd()), d = [];
  11508. } }, invoke: function invoke(t, n, o) {
  11509. var r,
  11510. s,
  11511. l,
  11512. c = J;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) {
  11513. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11514. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (S.error(q.method, t), !1);c = c[o];
  11515. }
  11516. })), 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;
  11517. } }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  11518. }), a !== i ? a : r;
  11519. }, e.fn.dropdown.settings = { silent: !1, debug: !1, verbose: !1, performance: !0, on: "click", action: "activate", values: !1, apiSettings: !1, selectOnKeydown: !0, minCharacters: 0, filterRemoteData: !1, saveRemoteData: !0, throttle: 200, context: t, direction: "auto", keepOnScreen: !0, match: "both", fullTextSearch: !1, placeholder: "auto", preserveHTML: !0, sortSelect: !1, forceSelection: !0, allowAdditions: !1, ignoreCase: !1, hideAdditions: !0, maxSelections: !1, useLabels: !0, delimiter: ",", showOnFocus: !0, allowReselection: !1, allowTab: !0, allowCategorySelection: !1, fireOnInit: !1, transition: "auto", duration: 200, glyphWidth: 1.037, label: { transition: "scale", duration: 200, variation: !1 }, delay: { hide: 300, show: 200, search: 20, touch: 50 }, onChange: function onChange(e, t, n) {}, onAdd: function onAdd(e, t, n) {}, onRemove: function onRemove(e, t, n) {}, onLabelSelect: function onLabelSelect(e) {}, onLabelCreate: function onLabelCreate(t, n) {
  11520. return e(this);
  11521. }, onLabelRemove: function onLabelRemove(e) {
  11522. return !0;
  11523. }, onNoResults: function onNoResults(e) {
  11524. return !0;
  11525. }, onShow: function onShow() {}, onHide: function onHide() {}, name: "Dropdown", namespace: "dropdown", message: { addResult: "Add <b>{term}</b>", count: "{count} selected", maxSelections: "Max {maxCount} selections", noResults: "No results found.", serverError: "There was an error contacting the server" }, error: { action: "You called a dropdown action that was not defined", alreadySetup: "Once a select has been initialized behaviors must be called on the created ui dropdown", labels: "Allowing user additions currently requires the use of labels.", missingMultiple: "<select> requires multiple property to be set to correctly preserve multiple values", method: "The method you called is not defined.", noAPI: "The API module is required to load resources remotely", noStorage: "Saving remote data requires session storage", noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>" }, regExp: { escape: /[-[\]{}()*+?.,\\^$|#\s]/g, quote: /"/g }, metadata: { defaultText: "defaultText", defaultValue: "defaultValue", placeholderText: "placeholder", text: "text", value: "value" }, fields: { remoteValues: "results", values: "values", disabled: "disabled", name: "name", value: "value", text: "text" }, keys: { backspace: 8, delimiter: 188, deleteKey: 46, enter: 13, escape: 27, pageUp: 33, pageDown: 34, leftArrow: 37, upArrow: 38, rightArrow: 39, downArrow: 40 }, selector: { addition: ".addition", dropdown: ".ui.dropdown", hidden: ".hidden", icon: "> .dropdown.icon", input: '> input[type="hidden"], > select', item: ".item", label: "> .label", remove: "> .label > .delete.icon", siblingLabel: ".label", menu: ".menu", message: ".message", menuIcon: ".dropdown.icon", search: "input.search, .menu > .search > input, .menu input.search", sizer: "> input.sizer", text: "> .text:not(.icon)", unselectable: ".disabled, .filtered" }, className: { active: "active", addition: "addition", animating: "animating", disabled: "disabled", empty: "empty", dropdown: "ui dropdown", filtered: "filtered", hidden: "hidden transition", item: "item", label: "ui label", loading: "loading", menu: "menu", message: "message", multiple: "multiple", placeholder: "default", sizer: "sizer", search: "search", selected: "selected", selection: "selection", upward: "upward", leftward: "left", visible: "visible" } }, e.fn.dropdown.settings.templates = { dropdown: function dropdown(t) {
  11526. var n = t.placeholder || !1,
  11527. i = (t.values, "");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) {
  11528. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  11529. }), i += "</div>";
  11530. }, menu: function menu(t, n) {
  11531. var i = t[n.values] || {},
  11532. o = "";return e.each(i, function (e, t) {
  11533. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  11534. a = t[n.disabled] ? "disabled " : "";o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  11535. }), o;
  11536. }, label: function label(e, t) {
  11537. return t + '<i class="delete icon"></i>';
  11538. }, message: function message(e) {
  11539. return e;
  11540. }, addition: function addition(e) {
  11541. return e;
  11542. } };
  11543. }(jQuery, window, document), function (e, t, n, i) {
  11544. "use strict";
  11545. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  11546. var o,
  11547. a = e(this),
  11548. r = a.selector || "",
  11549. s = new Date().getTime(),
  11550. l = [],
  11551. c = arguments[0],
  11552. u = "string" == typeof c,
  11553. d = [].slice.call(arguments, 1);return a.each(function () {
  11554. var f,
  11555. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  11556. g = m.selector,
  11557. p = m.className,
  11558. h = m.sources,
  11559. v = m.error,
  11560. b = m.metadata,
  11561. y = m.namespace,
  11562. x = m.templates,
  11563. C = "." + y,
  11564. w = "module-" + y,
  11565. S = (e(t), e(this)),
  11566. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  11567. T = this,
  11568. A = S.data(w);f = { initialize: function initialize() {
  11569. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  11570. }, instantiate: function instantiate() {
  11571. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  11572. }, destroy: function destroy() {
  11573. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  11574. }, refresh: function refresh() {
  11575. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  11576. }, bind: { events: function events() {
  11577. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  11578. } }, create: function create() {
  11579. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  11580. }, createPlaceholder: function createPlaceholder(e) {
  11581. var t = f.get.icon(),
  11582. n = f.get.url();f.generate.embed(n);e = e || f.get.placeholder(), S.html(x.placeholder(e, t)), f.debug("Creating placeholder for embed", e, t);
  11583. }, createEmbed: function createEmbed(t) {
  11584. 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);
  11585. }, changeEmbed: function changeEmbed(e) {
  11586. k.html(f.generate.embed(e));
  11587. }, createAndShow: function createAndShow() {
  11588. f.createEmbed(), f.show();
  11589. }, change: function change(e, t, n) {
  11590. 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();
  11591. }, reset: function reset() {
  11592. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  11593. }, show: function show() {
  11594. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  11595. }, hide: function hide() {
  11596. f.debug("Hiding embed"), f.showPlaceholder();
  11597. }, showPlaceholder: function showPlaceholder() {
  11598. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  11599. }, get: { id: function id() {
  11600. return m.id || S.data(b.id);
  11601. }, placeholder: function placeholder() {
  11602. return m.placeholder || S.data(b.placeholder);
  11603. }, icon: function icon() {
  11604. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  11605. }, source: function source(e) {
  11606. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  11607. }, type: function type() {
  11608. var e = f.get.source();return h[e] !== i && h[e].type;
  11609. }, url: function url() {
  11610. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  11611. } }, determine: { autoplay: function autoplay() {
  11612. f.should.autoplay() && (m.autoplay = !0);
  11613. }, source: function source(t) {
  11614. var n = !1;return (t = t || f.get.url()) && e.each(h, function (e, i) {
  11615. if (-1 !== t.search(i.domain)) return n = e, !1;
  11616. }), n;
  11617. }, icon: function icon() {
  11618. var e = f.get.source();return h[e] !== i && h[e].icon;
  11619. }, url: function url() {
  11620. var e,
  11621. t = m.id || S.data(b.id),
  11622. n = m.source || S.data(b.source);return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  11623. } }, set: { active: function active() {
  11624. S.addClass(p.active);
  11625. } }, remove: { active: function active() {
  11626. S.removeClass(p.active);
  11627. }, embed: function embed() {
  11628. k.empty();
  11629. } }, encode: { parameters: function parameters(e) {
  11630. var t,
  11631. n = [];for (t in e) {
  11632. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  11633. }return n.join("&amp;");
  11634. } }, generate: { embed: function embed(e) {
  11635. f.debug("Generating embed html");var t,
  11636. n,
  11637. i = f.get.source();return (e = f.get.url(e)) ? (n = f.generate.parameters(i), t = x.iframe(e, n)) : f.error(v.noURL, S), t;
  11638. }, parameters: function parameters(t, n) {
  11639. var o = h[t] && h[t].parameters !== i ? h[t].parameters(m) : {};return (n = n || m.parameters) && (o = e.extend({}, o, n)), o = m.onEmbed(o), f.encode.parameters(o);
  11640. } }, has: { embed: function embed() {
  11641. return k.length > 0;
  11642. }, placeholder: function placeholder() {
  11643. return m.placeholder || S.data(b.placeholder);
  11644. } }, should: { autoplay: function autoplay() {
  11645. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  11646. } }, is: { video: function video() {
  11647. return "video" == f.get.type();
  11648. } }, setting: function setting(t, n) {
  11649. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11650. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11651. }
  11652. }, internal: function internal(t, n) {
  11653. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  11654. if (n === i) return f[t];f[t] = n;
  11655. }
  11656. }, debug: function debug() {
  11657. !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)));
  11658. }, verbose: function verbose() {
  11659. !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)));
  11660. }, error: function error() {
  11661. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11662. }, performance: { log: function log(e) {
  11663. var t, n;m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: T, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  11664. }, display: function display() {
  11665. var t = m.name + ":",
  11666. n = 0;s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  11667. n += t["Execution Time"];
  11668. }), 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) {
  11669. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11670. }), console.groupEnd()), l = [];
  11671. } }, invoke: function invoke(t, n, a) {
  11672. var r,
  11673. s,
  11674. l,
  11675. c = A;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) {
  11676. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11677. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);c = c[o];
  11678. }
  11679. })), 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;
  11680. } }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  11681. }), o !== i ? o : this;
  11682. }, e.fn.embed.settings = { name: "Embed", namespace: "embed", silent: !1, debug: !1, verbose: !1, performance: !0, icon: !1, source: !1, url: !1, id: !1, autoplay: "auto", color: "#444444", hd: !0, brandedUI: !1, parameters: !1, onDisplay: function onDisplay() {}, onPlaceholderDisplay: function onPlaceholderDisplay() {}, onReset: function onReset() {}, onCreate: function onCreate(e) {}, onEmbed: function onEmbed(e) {
  11683. return e;
  11684. }, metadata: { id: "id", icon: "icon", placeholder: "placeholder", source: "source", url: "url" }, error: { noURL: "No URL specified", method: "The method you called is not defined" }, className: { active: "active", embed: "embed" }, selector: { embed: ".embed", placeholder: ".placeholder", icon: ".icon" }, sources: { youtube: { name: "youtube", type: "video", icon: "video play", domain: "youtube.com", url: "//www.youtube.com/embed/{id}", parameters: function parameters(e) {
  11685. return { autohide: !e.brandedUI, autoplay: e.autoplay, color: e.color || i, hq: e.hd, jsapi: e.api, modestbranding: !e.brandedUI };
  11686. } }, vimeo: { name: "vimeo", type: "video", icon: "video play", domain: "vimeo.com", url: "//player.vimeo.com/video/{id}", parameters: function parameters(e) {
  11687. return { api: e.api, autoplay: e.autoplay, byline: e.brandedUI, color: e.color || i, portrait: e.brandedUI, title: e.brandedUI };
  11688. } } }, templates: { iframe: function iframe(e, t) {
  11689. var n = e;return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  11690. }, placeholder: function placeholder(e, t) {
  11691. var n = "";return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  11692. } }, api: !1, onPause: function onPause() {}, onPlay: function onPlay() {}, onStop: function onStop() {} };
  11693. }(jQuery, window, document), function (e, t, n, i) {
  11694. "use strict";
  11695. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  11696. var a,
  11697. r = e(this),
  11698. s = e(t),
  11699. l = e(n),
  11700. c = e("body"),
  11701. u = r.selector || "",
  11702. d = new Date().getTime(),
  11703. f = [],
  11704. m = arguments[0],
  11705. g = "string" == typeof m,
  11706. p = [].slice.call(arguments, 1),
  11707. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11708. setTimeout(e, 0);
  11709. };return r.each(function () {
  11710. var r,
  11711. v,
  11712. b,
  11713. y,
  11714. x,
  11715. C,
  11716. w,
  11717. S,
  11718. k,
  11719. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  11720. A = T.selector,
  11721. R = T.className,
  11722. P = T.namespace,
  11723. E = T.error,
  11724. F = "." + P,
  11725. O = "module-" + P,
  11726. D = e(this),
  11727. q = e(T.context),
  11728. j = D.find(A.close),
  11729. z = this,
  11730. I = D.data(O),
  11731. M = !1;k = { initialize: function initialize() {
  11732. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  11733. }, instantiate: function instantiate() {
  11734. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  11735. }, create: { dimmer: function dimmer() {
  11736. var t = { debug: T.debug, variation: !T.centered && "top aligned", dimmerName: "modals" },
  11737. n = e.extend(!0, t, T.dimmerSettings);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);
  11738. }, id: function id() {
  11739. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  11740. } }, destroy: function destroy() {
  11741. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  11742. }, observeChanges: function observeChanges() {
  11743. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  11744. k.debug("DOM tree modified, refreshing"), k.refresh();
  11745. })).observe(z, { childList: !0, subtree: !0 }), k.debug("Setting up mutation observer", S));
  11746. }, refresh: function refresh() {
  11747. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  11748. }, refreshModals: function refreshModals() {
  11749. v = D.siblings(A.modal), r = v.add(D);
  11750. }, attachEvents: function attachEvents(t, n) {
  11751. var i = e(t);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);
  11752. }, bind: { events: function events() {
  11753. 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);
  11754. } }, get: { id: function id() {
  11755. return (Math.random().toString(16) + "000000000").substr(2, 8);
  11756. } }, event: { approve: function approve() {
  11757. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11758. M = !1;
  11759. }));
  11760. }, deny: function deny() {
  11761. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11762. M = !1;
  11763. }));
  11764. }, close: function close() {
  11765. k.hide();
  11766. }, click: function click(t) {
  11767. if (T.closable) {
  11768. var i = e(t.target).closest(A.modal).length > 0,
  11769. o = e.contains(n.documentElement, t.target);!i && o && k.is.active() && (k.debug("Dimmer clicked, hiding all modals"), k.remove.clickaway(), T.allowMultiple ? k.hide() : k.hideAll());
  11770. } else k.verbose("Dimmer clicked but closable setting is disabled");
  11771. }, debounce: function debounce(e, t) {
  11772. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  11773. }, keyboard: function keyboard(e) {
  11774. 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());
  11775. }, resize: function resize() {
  11776. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  11777. } }, toggle: function toggle() {
  11778. k.is.active() || k.is.animating() ? k.hide() : k.show();
  11779. }, show: function show(t) {
  11780. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  11781. }, hide: function hide(t) {
  11782. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  11783. }, showModal: function showModal(t) {
  11784. 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({ debug: T.debug, animation: T.transition + " in", queue: T.queue, duration: T.duration, useFailSafe: !0, onComplete: function onComplete() {
  11785. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  11786. } })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  11787. }, hideModal: function hideModal(t, n) {
  11788. 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({ debug: T.debug, animation: T.transition + " out", queue: T.queue, duration: T.duration, useFailSafe: !0, onStart: function onStart() {
  11789. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  11790. }, onComplete: function onComplete() {
  11791. T.onHidden.call(z), k.restore.focus(), t();
  11792. } })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  11793. }, showDimmer: function showDimmer() {
  11794. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  11795. }, hideDimmer: function hideDimmer() {
  11796. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  11797. k.remove.clickaway(), k.remove.screenHeight();
  11798. }) : k.debug("Dimmer is not visible cannot hide");
  11799. }, hideAll: function hideAll(t) {
  11800. var n = r.filter("." + R.active + ", ." + R.animating);t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding all visible modals"), k.hideDimmer(), n.modal("hide modal", t));
  11801. }, hideOthers: function hideOthers(t) {
  11802. var n = v.filter("." + R.active + ", ." + R.animating);t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding other modals", v), n.modal("hide modal", t, !0));
  11803. }, others: { active: function active() {
  11804. return v.filter("." + R.active).length > 0;
  11805. }, animating: function animating() {
  11806. return v.filter("." + R.animating).length > 0;
  11807. } }, add: { keyboardShortcuts: function keyboardShortcuts() {
  11808. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  11809. } }, save: { focus: function focus() {
  11810. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  11811. } }, restore: { focus: function focus() {
  11812. b && b.length > 0 && b.focus();
  11813. } }, remove: { active: function active() {
  11814. D.removeClass(R.active);
  11815. }, clickaway: function clickaway() {
  11816. x.off("click" + C);
  11817. }, bodyStyle: function bodyStyle() {
  11818. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  11819. }, screenHeight: function screenHeight() {
  11820. k.debug("Removing page height"), c.css("height", "");
  11821. }, keyboardShortcuts: function keyboardShortcuts() {
  11822. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  11823. }, scrolling: function scrolling() {
  11824. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  11825. } }, cacheSizes: function cacheSizes() {
  11826. D.addClass(R.loading);var o = D.prop("scrollHeight"),
  11827. a = D.outerHeight();k.cache !== i && 0 === a || (k.cache = { pageHeight: e(n).outerHeight(), height: a + T.offset, scrollHeight: o + T.offset, contextHeight: "body" == T.context ? e(t).height() : y.height() }, k.cache.topOffset = -k.cache.height / 2), D.removeClass(R.loading), k.debug("Caching modal and container sizes", k.cache);
  11828. }, can: { fit: function fit() {
  11829. var e = k.cache.contextHeight,
  11830. t = k.cache.contextHeight / 2,
  11831. n = k.cache.topOffset,
  11832. i = k.cache.scrollHeight,
  11833. o = k.cache.height,
  11834. a = T.padding;return i > o ? t + n + i + a < e : o + 2 * a < e;
  11835. } }, is: { active: function active() {
  11836. return D.hasClass(R.active);
  11837. }, animating: function animating() {
  11838. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  11839. }, scrolling: function scrolling() {
  11840. return y.hasClass(R.scrolling);
  11841. }, modernBrowser: function modernBrowser() {
  11842. return !(t.ActiveXObject || "ActiveXObject" in t);
  11843. } }, set: { autofocus: function autofocus() {
  11844. var e = D.find("[tabindex], :input").filter(":visible"),
  11845. t = e.filter("[autofocus]"),
  11846. n = t.length > 0 ? t.first() : e.first();n.length > 0 && n.focus();
  11847. }, clickaway: function clickaway() {
  11848. x.on("click" + C, k.event.click);
  11849. }, dimmerSettings: function dimmerSettings() {
  11850. if (e.fn.dimmer !== i) {
  11851. var t = { debug: T.debug, dimmerName: "modals", closable: "auto", variation: !T.centered && "top aligned", duration: { show: T.duration, hide: T.duration } },
  11852. n = e.extend(!0, t, T.dimmerSettings);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);
  11853. } else k.error(E.dimmer);
  11854. }, screenHeight: function screenHeight() {
  11855. 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));
  11856. }, active: function active() {
  11857. D.addClass(R.active);
  11858. }, scrolling: function scrolling() {
  11859. y.addClass(R.scrolling), D.addClass(R.scrolling);
  11860. }, type: function type() {
  11861. 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());
  11862. }, undetached: function undetached() {
  11863. y.addClass(R.undetached);
  11864. } }, setting: function setting(t, n) {
  11865. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  11866. if (n === i) return T[t];e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  11867. }
  11868. }, internal: function internal(t, n) {
  11869. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  11870. if (n === i) return k[t];k[t] = n;
  11871. }
  11872. }, debug: function debug() {
  11873. !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)));
  11874. }, verbose: function verbose() {
  11875. !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)));
  11876. }, error: function error() {
  11877. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  11878. }, performance: { log: function log(e) {
  11879. var t, n;T.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: z, "Execution Time": n })), clearTimeout(k.performance.timer), k.performance.timer = setTimeout(k.performance.display, 500);
  11880. }, display: function display() {
  11881. var t = T.name + ":",
  11882. n = 0;d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  11883. n += t["Execution Time"];
  11884. }), 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) {
  11885. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11886. }), console.groupEnd()), f = [];
  11887. } }, invoke: function invoke(t, n, o) {
  11888. var r,
  11889. s,
  11890. l,
  11891. c = I;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) {
  11892. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11893. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  11894. }
  11895. })), 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;
  11896. } }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  11897. }), a !== i ? a : this;
  11898. }, e.fn.modal.settings = { name: "Modal", namespace: "modal", silent: !1, debug: !1, verbose: !1, performance: !0, observeChanges: !1, allowMultiple: !1, detachable: !0, closable: !0, autofocus: !0, inverted: !1, blurring: !1, centered: !0, dimmerSettings: { closable: !1, useCSS: !0 }, keyboardShortcuts: !0, context: "body", queue: !1, duration: 500, offset: 0, transition: "scale", padding: 50, onShow: function onShow() {}, onVisible: function onVisible() {}, onHide: function onHide() {
  11899. return !0;
  11900. }, onHidden: function onHidden() {}, onApprove: function onApprove() {
  11901. return !0;
  11902. }, onDeny: function onDeny() {
  11903. return !0;
  11904. }, selector: { close: "> .close", approve: ".actions .positive, .actions .approve, .actions .ok", deny: ".actions .negative, .actions .deny, .actions .cancel", modal: ".ui.modal" }, error: { dimmer: "UI Dimmer, a required component is not included in this page", method: "The method you called is not defined.", notFound: "The element you specified could not be found" }, className: { active: "active", animating: "animating", blurring: "blurring", inverted: "inverted", loading: "loading", scrolling: "scrolling", undetached: "undetached" } };
  11905. }(jQuery, window, document), function (e, t, n, i) {
  11906. "use strict";
  11907. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  11908. var o,
  11909. a = e(this),
  11910. r = a.selector || "",
  11911. s = new Date().getTime(),
  11912. l = [],
  11913. c = arguments[0],
  11914. u = "string" == typeof c,
  11915. d = [].slice.call(arguments, 1);return a.each(function () {
  11916. var a,
  11917. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  11918. m = (f.className, f.selector),
  11919. g = f.error,
  11920. p = f.namespace,
  11921. h = "." + p,
  11922. v = p + "-module",
  11923. b = e(this),
  11924. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  11925. x = this,
  11926. C = b.data(v);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;a = { initialize: function initialize() {
  11927. 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();
  11928. }, destroy: function destroy() {
  11929. a.verbose("Destroying instance"), b.removeData(v).off(h);
  11930. }, show: function show() {
  11931. 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));
  11932. }, hide: function hide() {
  11933. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  11934. }, onHide: function onHide() {
  11935. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  11936. }, dismiss: function dismiss(e) {
  11937. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  11938. }, should: { show: function show() {
  11939. 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);
  11940. } }, get: { storageOptions: function storageOptions() {
  11941. var e = {};return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  11942. } }, clear: function clear() {
  11943. a.storage.remove(f.key);
  11944. }, storage: { set: function set(n, o) {
  11945. var r = a.get.storageOptions();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 {
  11946. if (e.cookie === i) return void a.error(g.noCookieStorage);e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  11947. }
  11948. }, get: function get(n, o) {
  11949. var r;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;
  11950. }, remove: function remove(n) {
  11951. var o = a.get.storageOptions();"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);
  11952. } }, setting: function setting(t, n) {
  11953. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  11954. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  11955. }
  11956. }, internal: function internal(t, n) {
  11957. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  11958. if (n === i) return a[t];a[t] = n;
  11959. }
  11960. }, debug: function debug() {
  11961. !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)));
  11962. }, verbose: function verbose() {
  11963. !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)));
  11964. }, error: function error() {
  11965. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  11966. }, performance: { log: function log(e) {
  11967. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: x, "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  11968. }, display: function display() {
  11969. var t = f.name + ":",
  11970. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  11971. n += t["Execution Time"];
  11972. }), 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) {
  11973. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11974. }), console.groupEnd()), l = [];
  11975. } }, invoke: function invoke(t, n, r) {
  11976. var s,
  11977. l,
  11978. c,
  11979. u = C;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) {
  11980. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  11981. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);u = u[o];
  11982. }
  11983. })), 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;
  11984. } }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  11985. }), o !== i ? o : this;
  11986. }, e.fn.nag.settings = { name: "Nag", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "Nag", persist: !1, displayTime: 0, animation: { show: "slide", hide: "slide" }, context: !1, detachable: !1, expires: 30, domain: !1, path: "/", storageMethod: "cookie", key: "nag", value: "dismiss", error: { noCookieStorage: "$.cookie is not included. A storage solution is required.", noStorage: "Neither $.cookie or store is defined. A storage solution is required for storing state", method: "The method you called is not defined." }, className: { bottom: "bottom", fixed: "fixed" }, selector: { close: ".close.icon" }, speed: 500, easing: "easeOutQuad", onHide: function onHide() {} }, e.extend(e.easing, { easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  11987. return -i * (t /= o) * (t - 2) + n;
  11988. } });
  11989. }(jQuery, window, document), function (e, t, n, i) {
  11990. "use strict";
  11991. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  11992. var a,
  11993. r = e(this),
  11994. s = e(n),
  11995. l = e(t),
  11996. c = e("body"),
  11997. u = r.selector || "",
  11998. d = new Date().getTime(),
  11999. f = [],
  12000. m = arguments[0],
  12001. g = "string" == typeof m,
  12002. p = [].slice.call(arguments, 1);return r.each(function () {
  12003. var r,
  12004. h,
  12005. v,
  12006. b,
  12007. y,
  12008. x,
  12009. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  12010. w = C.selector,
  12011. S = C.className,
  12012. k = C.error,
  12013. T = C.metadata,
  12014. A = C.namespace,
  12015. R = "." + C.namespace,
  12016. P = "module-" + A,
  12017. E = e(this),
  12018. F = e(C.context),
  12019. O = e(C.scrollContext),
  12020. D = e(C.boundary),
  12021. q = C.target ? e(C.target) : E,
  12022. j = 0,
  12023. z = !1,
  12024. I = !1,
  12025. M = this,
  12026. L = E.data(P);x = { initialize: function initialize() {
  12027. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  12028. }, instantiate: function instantiate() {
  12029. x.verbose("Storing instance", x), L = x, E.data(P, L);
  12030. }, observeChanges: function observeChanges() {
  12031. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, { childList: !0, subtree: !0 }), x.debug("Setting up mutation observer", v));
  12032. }, refresh: function refresh() {
  12033. 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();
  12034. }, reposition: function reposition() {
  12035. x.refresh(), x.set.position();
  12036. }, destroy: function destroy() {
  12037. 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);
  12038. }, event: { start: function start(t) {
  12039. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  12040. }, end: function end() {
  12041. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  12042. }, touchstart: function touchstart(e) {
  12043. I = !0, x.show();
  12044. }, resize: function resize() {
  12045. x.is.visible() && x.set.position();
  12046. }, documentChanged: function documentChanged(t) {
  12047. [].forEach.call(t, function (t) {
  12048. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  12049. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  12050. });
  12051. });
  12052. }, hideGracefully: function hideGracefully(t) {
  12053. var i = e(t.target),
  12054. o = e.contains(n.documentElement, t.target),
  12055. a = i.closest(w.popup).length > 0;t && !a && o ? (x.debug("Click occurred outside popup hiding popup"), x.hide()) : x.debug("Click was inside popup, keeping popup open");
  12056. } }, create: function create() {
  12057. var t = x.get.html(),
  12058. n = x.get.title(),
  12059. i = x.get.content();t || i || n ? (x.debug("Creating pop-up html"), t || (t = C.templates.popup({ title: n, content: i })), 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);
  12060. }, createID: function createID() {
  12061. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  12062. }, toggle: function toggle() {
  12063. 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());
  12064. }, show: function show(e) {
  12065. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  12066. if (x.exists() || x.create(), !1 === C.onShow.call(r, M)) return void x.debug("onShow callback returned false, cancelling popup animation");C.preserve || C.popup || x.refresh(), r && x.set.position() && (x.save.conditions(), C.exclusive && x.hideAll(), x.animate.show(e));
  12067. }
  12068. }, hide: function hide(e) {
  12069. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  12070. if (!1 === C.onHide.call(r, M)) return void x.debug("onHide callback returned false, cancelling popup animation");x.remove.visible(), x.unbind.close(), x.restore.conditions(), x.animate.hide(e);
  12071. }
  12072. }, hideAll: function hideAll() {
  12073. e(w.popup).filter("." + S.popupVisible).each(function () {
  12074. e(this).data(T.activator).popup("hide");
  12075. });
  12076. }, exists: function exists() {
  12077. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  12078. }, removePopup: function removePopup() {
  12079. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  12080. }, save: { conditions: function conditions() {
  12081. x.cache = { title: E.attr("title") }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  12082. } }, restore: { conditions: function conditions() {
  12083. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  12084. } }, supports: { svg: function svg() {
  12085. return "undefined" == typeof SVGGraphicsElement;
  12086. } }, animate: { show: function show(t) {
  12087. t = e.isFunction(t) ? t : function () {}, C.transition && e.fn.transition !== i && E.transition("is supported") ? (x.set.visible(), r.transition({ animation: C.transition + " in", queue: !1, debug: C.debug, verbose: C.verbose, duration: C.duration, onComplete: function onComplete() {
  12088. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  12089. } })) : x.error(k.noTransition);
  12090. }, hide: function hide(t) {
  12091. 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({ animation: C.transition + " out", queue: !1, duration: C.duration, debug: C.debug, verbose: C.verbose, onComplete: function onComplete() {
  12092. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  12093. } }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  12094. } }, change: { content: function content(e) {
  12095. r.html(e);
  12096. } }, get: { html: function html() {
  12097. return E.removeData(T.html), E.data(T.html) || C.html;
  12098. }, title: function title() {
  12099. return E.removeData(T.title), E.data(T.title) || C.title;
  12100. }, content: function content() {
  12101. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  12102. }, variation: function variation() {
  12103. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  12104. }, popup: function popup() {
  12105. return r;
  12106. }, popupOffset: function popupOffset() {
  12107. return r.offset();
  12108. }, calculations: function calculations() {
  12109. var e,
  12110. n = x.get.offsetParent(r),
  12111. i = q[0],
  12112. o = D[0] == t,
  12113. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  12114. s = o ? { top: 0, left: 0 } : D.offset(),
  12115. c = {},
  12116. u = o ? { top: l.scrollTop(), left: l.scrollLeft() } : { top: 0, left: 0 };if (c = { target: { element: q[0], width: q.outerWidth(), height: q.outerHeight(), top: a.top, left: a.left, margin: {} }, popup: { width: r.outerWidth(), height: r.outerHeight() }, parent: { width: h.outerWidth(), height: h.outerHeight() }, screen: { top: s.top, left: s.left, scroll: { top: u.top, left: u.left }, width: D.width(), height: D.height() } }, n.get(0) !== h.get(0)) {
  12117. var d = n.offset();c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  12118. }return C.setFluidWidth && x.is.fluid() && (c.container = { width: r.parent().outerWidth() }, 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 = { top: e.top + e.scroll.top, bottom: e.top + e.scroll.top + e.height, left: e.left + e.scroll.left, right: e.left + e.scroll.left + e.width }, c;
  12119. }, id: function id() {
  12120. return y;
  12121. }, startEvent: function startEvent() {
  12122. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  12123. }, scrollEvent: function scrollEvent() {
  12124. return "scroll";
  12125. }, endEvent: function endEvent() {
  12126. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  12127. }, distanceFromBoundary: function distanceFromBoundary(e, t) {
  12128. var n,
  12129. i,
  12130. o = {};return n = (t = t || x.get.calculations()).popup, i = t.boundary, e && (o = { top: e.top - i.top, left: e.left - i.left, right: i.right - (e.left + n.width), bottom: i.bottom - (e.top + n.height) }, x.verbose("Distance from boundaries determined", e, o)), o;
  12131. }, offsetParent: function offsetParent(t) {
  12132. var n = (t !== i ? t[0] : q[0]).parentNode,
  12133. o = e(n);if (n) for (var a = "none" === o.css("transform"), r = "static" === o.css("position"), s = o.is("body"); n && !s && r && a;) {
  12134. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  12135. }return o && o.length > 0 ? o : e();
  12136. }, positions: function positions() {
  12137. return { "top left": !1, "top center": !1, "top right": !1, "bottom left": !1, "bottom center": !1, "bottom right": !1, "left center": !1, "right center": !1 };
  12138. }, nextPosition: function nextPosition(e) {
  12139. var t = e.split(" "),
  12140. n = t[0],
  12141. i = t[1],
  12142. o = "top" == n || "bottom" == n,
  12143. a = !1,
  12144. r = !1,
  12145. s = !1;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 = [{ top: "bottom", bottom: "top", left: "right", right: "left" }[n], i]).join(" "), a = !0 === z[s], x.debug("Trying opposite strategy", s)), "adjacent" === C.prefer && o && (s = (s = [n, { left: "center", center: "right", right: "left" }[i]]).join(" "), r = !0 === z[s], x.debug("Trying adjacent strategy", s)), (r || a) && (x.debug("Using backup position", s), s = { "top left": "top center", "top center": "top right", "top right": "right center", "right center": "bottom right", "bottom right": "bottom center", "bottom center": "bottom left", "bottom left": "left center", "left center": "top left" }[e]), s;
  12146. } }, set: { position: function position(e, t) {
  12147. if (0 !== q.length && 0 !== r.length) {
  12148. var n, o, a, s, l, c, u, d;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;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) {
  12149. return "left" == e ? "right" : "left";
  12150. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {case "top left":
  12151. c = { top: "auto", bottom: l.height - a.top + o, left: a.left + n, right: "auto" };break;case "top center":
  12152. c = { bottom: l.height - a.top + o, left: a.left + a.width / 2 - s.width / 2 + n, top: "auto", right: "auto" };break;case "top right":
  12153. c = { bottom: l.height - a.top + o, right: l.width - a.left - a.width - n, top: "auto", left: "auto" };break;case "left center":
  12154. c = { top: a.top + a.height / 2 - s.height / 2 + n, right: l.width - a.left + o, left: "auto", bottom: "auto" };break;case "right center":
  12155. c = { top: a.top + a.height / 2 - s.height / 2 + n, left: a.left + a.width + o, bottom: "auto", right: "auto" };break;case "bottom left":
  12156. c = { top: a.top + a.height + o, left: a.left + n, bottom: "auto", right: "auto" };break;case "bottom center":
  12157. c = { top: a.top + a.height + o, left: a.left + a.width / 2 - s.width / 2 + n, bottom: "auto", right: "auto" };break;case "bottom right":
  12158. c = { top: a.top + a.height + o, right: l.width - a.left - a.width - n, left: "auto", bottom: "auto" };}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)) {
  12159. 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);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;x.debug("No position found, showing with last position");
  12160. }return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  12161. }x.error(k.notFound);
  12162. }, fluidWidth: function fluidWidth(e) {
  12163. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  12164. }, variation: function variation(e) {
  12165. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  12166. }, visible: function visible() {
  12167. E.addClass(S.visible);
  12168. } }, remove: { loading: function loading() {
  12169. r.removeClass(S.loading);
  12170. }, variation: function variation(e) {
  12171. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  12172. }, visible: function visible() {
  12173. E.removeClass(S.visible);
  12174. }, attempts: function attempts() {
  12175. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  12176. } }, bind: { events: function events() {
  12177. 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);
  12178. }, popup: function popup() {
  12179. 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);
  12180. }, close: function close() {
  12181. (!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();
  12182. }, closeOnScroll: function closeOnScroll() {
  12183. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  12184. }, touchClose: function touchClose() {
  12185. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  12186. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  12187. });
  12188. }, clickaway: function clickaway() {
  12189. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  12190. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  12191. });
  12192. } }, unbind: { events: function events() {
  12193. l.off(b), E.off(R);
  12194. }, close: function close() {
  12195. s.off(b), O.off(b);
  12196. } }, has: { popup: function popup() {
  12197. return r && r.length > 0;
  12198. } }, should: { centerArrow: function centerArrow(e) {
  12199. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  12200. } }, is: { offstage: function offstage(t, n) {
  12201. var i = [];return e.each(t, function (e, t) {
  12202. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  12203. }), i.length > 0;
  12204. }, svg: function svg(e) {
  12205. return x.supports.svg() && e instanceof SVGGraphicsElement;
  12206. }, basic: function basic() {
  12207. return E.hasClass(S.basic);
  12208. }, active: function active() {
  12209. return E.hasClass(S.active);
  12210. }, animating: function animating() {
  12211. return r !== i && r.hasClass(S.animating);
  12212. }, fluid: function fluid() {
  12213. return r !== i && r.hasClass(S.fluid);
  12214. }, visible: function visible() {
  12215. return r !== i && r.hasClass(S.popupVisible);
  12216. }, dropdown: function dropdown() {
  12217. return E.hasClass(S.dropdown);
  12218. }, hidden: function hidden() {
  12219. return !x.is.visible();
  12220. }, rtl: function rtl() {
  12221. return "rtl" == E.css("direction");
  12222. } }, reset: function reset() {
  12223. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  12224. }, setting: function setting(t, n) {
  12225. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  12226. if (n === i) return C[t];C[t] = n;
  12227. }
  12228. }, internal: function internal(t, n) {
  12229. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  12230. if (n === i) return x[t];x[t] = n;
  12231. }
  12232. }, debug: function debug() {
  12233. !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)));
  12234. }, verbose: function verbose() {
  12235. !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)));
  12236. }, error: function error() {
  12237. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  12238. }, performance: { log: function log(e) {
  12239. var t, n;C.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: M, "Execution Time": n })), clearTimeout(x.performance.timer), x.performance.timer = setTimeout(x.performance.display, 500);
  12240. }, display: function display() {
  12241. var t = C.name + ":",
  12242. n = 0;d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  12243. n += t["Execution Time"];
  12244. }), 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) {
  12245. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12246. }), console.groupEnd()), f = [];
  12247. } }, invoke: function invoke(t, n, o) {
  12248. var r,
  12249. s,
  12250. l,
  12251. c = L;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) {
  12252. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12253. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12254. }
  12255. })), 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;
  12256. } }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  12257. }), a !== i ? a : this;
  12258. }, e.fn.popup.settings = { name: "Popup", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "popup", observeChanges: !0, onCreate: function onCreate() {}, onRemove: function onRemove() {}, onShow: function onShow() {}, onVisible: function onVisible() {}, onHide: function onHide() {}, onUnplaceable: function onUnplaceable() {}, onHidden: function onHidden() {}, on: "hover", boundary: t, addTouchEvents: !0, position: "top left", variation: "", movePopup: !0, target: !1, popup: !1, inline: !1, preserve: !1, hoverable: !1, content: !1, html: !1, title: !1, closable: !0, hideOnScroll: "auto", exclusive: !1, context: "body", scrollContext: t, prefer: "opposite", lastResort: !1, arrowPixelsFromEdge: 20, delay: { show: 50, hide: 70 }, setFluidWidth: !0, duration: 200, transition: "scale", distanceAway: 0, jitter: 2, offset: 0, maxSearchDepth: 15, error: { invalidPosition: "The position you specified is not a valid position", cannotPlace: "Popup does not fit within the boundaries of the viewport", method: "The method you called is not defined.", noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>", notFound: "The target or popup you specified does not exist on the page" }, metadata: { activator: "activator", content: "content", html: "html", offset: "offset", position: "position", title: "title", variation: "variation" }, className: { active: "active", basic: "basic", animating: "animating", dropdown: "dropdown", fluid: "fluid", loading: "loading", popup: "ui popup", position: "top left center bottom right", visible: "visible", popupVisible: "visible" }, selector: { popup: ".ui.popup" }, templates: { escape: function escape(e) {
  12259. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12260. return t[e];
  12261. }) : e
  12262. );
  12263. }, popup: function popup(t) {
  12264. var n = "",
  12265. o = e.fn.popup.settings.templates.escape;return (typeof t === "undefined" ? "undefined" : _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;
  12266. } } };
  12267. }(jQuery, window, document), function (e, t, n, i) {
  12268. "use strict";
  12269. 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")());e.fn.progress = function (t) {
  12270. var o,
  12271. a = e(this),
  12272. r = a.selector || "",
  12273. s = new Date().getTime(),
  12274. l = [],
  12275. c = arguments[0],
  12276. u = "string" == typeof c,
  12277. d = [].slice.call(arguments, 1);return a.each(function () {
  12278. var a,
  12279. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  12280. m = f.className,
  12281. g = f.metadata,
  12282. p = f.namespace,
  12283. h = f.selector,
  12284. v = f.error,
  12285. b = "." + p,
  12286. y = "module-" + p,
  12287. x = e(this),
  12288. C = e(this).find(h.bar),
  12289. w = e(this).find(h.progress),
  12290. S = e(this).find(h.label),
  12291. k = this,
  12292. T = x.data(y),
  12293. A = !1;a = { initialize: function initialize() {
  12294. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  12295. }, instantiate: function instantiate() {
  12296. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  12297. }, destroy: function destroy() {
  12298. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  12299. }, reset: function reset() {
  12300. a.remove.nextValue(), a.update.progress(0);
  12301. }, complete: function complete() {
  12302. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  12303. }, read: { metadata: function metadata() {
  12304. var e = { percent: x.data(g.percent), total: x.data(g.total), value: x.data(g.value) };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));
  12305. }, settings: function settings() {
  12306. !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));
  12307. } }, bind: { transitionEnd: function transitionEnd(e) {
  12308. var t = a.get.transitionEnd();C.one(t + b, function (t) {
  12309. clearTimeout(a.failSafeTimer), e.call(this, t);
  12310. }), a.failSafeTimer = setTimeout(function () {
  12311. C.triggerHandler(t);
  12312. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  12313. } }, increment: function increment(e) {
  12314. var t, n;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);
  12315. }, decrement: function decrement(e) {
  12316. var t, n;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);
  12317. }, has: { progressPoll: function progressPoll() {
  12318. return a.progressPoll;
  12319. }, total: function total() {
  12320. return !1 !== a.get.total();
  12321. } }, get: { text: function text(e) {
  12322. var t = a.value || 0,
  12323. n = a.total || 0,
  12324. i = A ? a.get.displayPercent() : a.percent || 0,
  12325. o = a.total > 0 ? n - t : 100 - i;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;
  12326. }, normalizedValue: function normalizedValue(e) {
  12327. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;if (a.has.total()) {
  12328. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  12329. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;return e;
  12330. }, updateInterval: function updateInterval() {
  12331. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  12332. }, randomValue: function randomValue() {
  12333. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  12334. }, numericValue: function numericValue(e) {
  12335. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  12336. }, transitionEnd: function transitionEnd() {
  12337. var e,
  12338. t = n.createElement("element"),
  12339. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12340. if (t.style[e] !== i) return o[e];
  12341. }
  12342. }, displayPercent: function displayPercent() {
  12343. var e = C.width(),
  12344. t = x.width(),
  12345. n = e > parseInt(C.css("min-width"), 10) ? e / t * 100 : a.percent;return f.precision > 0 ? Math.round(n * (10 * f.precision)) / (10 * f.precision) : Math.round(n);
  12346. }, percent: function percent() {
  12347. return a.percent || 0;
  12348. }, value: function value() {
  12349. return a.nextValue || a.value || 0;
  12350. }, total: function total() {
  12351. return a.total || !1;
  12352. } }, create: { progressPoll: function progressPoll() {
  12353. a.progressPoll = setTimeout(function () {
  12354. a.update.toNextValue(), a.remove.progressPoll();
  12355. }, a.get.updateInterval());
  12356. } }, is: { complete: function complete() {
  12357. return a.is.success() || a.is.warning() || a.is.error();
  12358. }, success: function success() {
  12359. return x.hasClass(m.success);
  12360. }, warning: function warning() {
  12361. return x.hasClass(m.warning);
  12362. }, error: function error() {
  12363. return x.hasClass(m.error);
  12364. }, active: function active() {
  12365. return x.hasClass(m.active);
  12366. }, visible: function visible() {
  12367. return x.is(":visible");
  12368. } }, remove: { progressPoll: function progressPoll() {
  12369. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  12370. }, nextValue: function nextValue() {
  12371. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  12372. }, state: function state() {
  12373. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  12374. }, active: function active() {
  12375. a.verbose("Removing active state"), x.removeClass(m.active);
  12376. }, success: function success() {
  12377. a.verbose("Removing success state"), x.removeClass(m.success);
  12378. }, warning: function warning() {
  12379. a.verbose("Removing warning state"), x.removeClass(m.warning);
  12380. }, error: function error() {
  12381. a.verbose("Removing error state"), x.removeClass(m.error);
  12382. } }, set: { barWidth: function barWidth(e) {
  12383. 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)));
  12384. }, duration: function duration(e) {
  12385. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({ "transition-duration": e });
  12386. }, percent: function percent(e) {
  12387. 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);
  12388. }, labelInterval: function labelInterval() {
  12389. clearInterval(a.interval), a.bind.transitionEnd(function () {
  12390. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  12391. }), A = !0, a.interval = setInterval(function () {
  12392. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  12393. }, f.framerate);
  12394. }, labels: function labels() {
  12395. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  12396. }, label: function label(e) {
  12397. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  12398. }, state: function state(e) {
  12399. 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));
  12400. }, barLabel: function barLabel(e) {
  12401. 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)));
  12402. }, active: function active(e) {
  12403. 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 () {
  12404. f.onActive.call(k, a.value, a.total);
  12405. });
  12406. }, success: function success(e) {
  12407. 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 () {
  12408. f.onSuccess.call(k, a.total);
  12409. });
  12410. }, warning: function warning(e) {
  12411. 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 () {
  12412. f.onWarning.call(k, a.value, a.total);
  12413. });
  12414. }, error: function error(e) {
  12415. 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 () {
  12416. f.onError.call(k, a.value, a.total);
  12417. });
  12418. }, transitionEvent: function transitionEvent() {
  12419. a.get.transitionEnd();
  12420. }, total: function total(e) {
  12421. a.total = e;
  12422. }, value: function value(e) {
  12423. a.value = e;
  12424. }, progress: function progress(e) {
  12425. 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());
  12426. }, nextValue: function nextValue(e) {
  12427. a.nextValue = e;
  12428. } }, update: { toNextValue: function toNextValue() {
  12429. var e = a.nextValue;e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  12430. }, progress: function progress(e) {
  12431. var t;!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));
  12432. } }, setting: function setting(t, n) {
  12433. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  12434. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  12435. }
  12436. }, internal: function internal(t, n) {
  12437. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  12438. if (n === i) return a[t];a[t] = n;
  12439. }
  12440. }, debug: function debug() {
  12441. !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)));
  12442. }, verbose: function verbose() {
  12443. !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)));
  12444. }, error: function error() {
  12445. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  12446. }, performance: { log: function log(e) {
  12447. var t, n;f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: k, "Execution Time": n })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  12448. }, display: function display() {
  12449. var t = f.name + ":",
  12450. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  12451. n += t["Execution Time"];
  12452. }), 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) {
  12453. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12454. }), console.groupEnd()), l = [];
  12455. } }, invoke: function invoke(t, n, r) {
  12456. var s,
  12457. l,
  12458. c,
  12459. u = T;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) {
  12460. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  12461. if (u[r] !== i) return l = u[r], !1;if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(v.method, t), !1);u = u[o];
  12462. }
  12463. })), 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;
  12464. } }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  12465. }), o !== i ? o : this;
  12466. }, e.fn.progress.settings = { name: "Progress", namespace: "progress", silent: !1, debug: !1, verbose: !1, performance: !0, random: { min: 2, max: 5 }, duration: 300, updateInterval: "auto", autoSuccess: !0, showActivity: !0, limitValues: !0, label: "percent", precision: 0, framerate: 1e3 / 30, percent: !1, total: !1, value: !1, failSafeDelay: 100, onLabelUpdate: function onLabelUpdate(e, t, n, i) {
  12467. return t;
  12468. }, onChange: function onChange(e, t, n) {}, onSuccess: function onSuccess(e) {}, onActive: function onActive(e, t) {}, onError: function onError(e, t) {}, onWarning: function onWarning(e, t) {}, error: { method: "The method you called is not defined.", nonNumeric: "Progress value is non numeric", tooHigh: "Value specified is above 100%", tooLow: "Value specified is below 0%" }, regExp: { variable: /\{\$*[A-z0-9]+\}/g }, metadata: { percent: "percent", total: "total", value: "value" }, selector: { bar: "> .bar", label: "> .label", progress: ".bar > .progress" }, text: { active: !1, error: !1, success: !1, warning: !1, percent: "{percent}%", ratio: "{value} of {total}" }, className: { active: "active", error: "error", success: "success", warning: "warning" } };
  12469. }(jQuery, window, document), function (e, t, n, i) {
  12470. "use strict";
  12471. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  12472. var n,
  12473. o = e(this),
  12474. a = o.selector || "",
  12475. r = new Date().getTime(),
  12476. s = [],
  12477. l = arguments[0],
  12478. c = "string" == typeof l,
  12479. u = [].slice.call(arguments, 1);return o.each(function () {
  12480. var d,
  12481. f,
  12482. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  12483. g = m.namespace,
  12484. p = m.className,
  12485. h = m.metadata,
  12486. v = m.selector,
  12487. b = (m.error, "." + g),
  12488. y = "module-" + g,
  12489. x = this,
  12490. C = e(this).data(y),
  12491. w = e(this),
  12492. S = w.find(v.icon);f = { initialize: function initialize() {
  12493. 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();
  12494. }, instantiate: function instantiate() {
  12495. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  12496. }, destroy: function destroy() {
  12497. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  12498. }, refresh: function refresh() {
  12499. S = w.find(v.icon);
  12500. }, setup: { layout: function layout() {
  12501. var t = f.get.maxRating(),
  12502. n = e.fn.rating.settings.templates.icon(t);f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  12503. } }, event: { mouseenter: function mouseenter() {
  12504. var t = e(this);t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  12505. }, mouseleave: function mouseleave() {
  12506. w.removeClass(p.selected), S.removeClass(p.selected);
  12507. }, click: function click() {
  12508. var t = e(this),
  12509. n = f.get.rating(),
  12510. i = S.index(t) + 1;("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  12511. } }, clearRating: function clearRating() {
  12512. f.debug("Clearing current rating"), f.set.rating(0);
  12513. }, bind: { events: function events() {
  12514. 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);
  12515. } }, remove: { events: function events() {
  12516. f.verbose("Removing events"), w.off(b);
  12517. }, initialLoad: function initialLoad() {
  12518. d = !1;
  12519. } }, enable: function enable() {
  12520. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  12521. }, disable: function disable() {
  12522. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  12523. }, is: { initialLoad: function initialLoad() {
  12524. return d;
  12525. } }, get: { initialRating: function initialRating() {
  12526. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  12527. }, maxRating: function maxRating() {
  12528. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  12529. }, rating: function rating() {
  12530. var e = S.filter("." + p.active).length;return f.verbose("Current rating retrieved", e), e;
  12531. } }, set: { rating: function rating(e) {
  12532. var t = e - 1 >= 0 ? e - 1 : 0,
  12533. n = S.eq(t);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);
  12534. }, initialLoad: function initialLoad() {
  12535. d = !0;
  12536. } }, setting: function setting(t, n) {
  12537. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  12538. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  12539. }
  12540. }, internal: function internal(t, n) {
  12541. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  12542. if (n === i) return f[t];f[t] = n;
  12543. }
  12544. }, debug: function debug() {
  12545. !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)));
  12546. }, verbose: function verbose() {
  12547. !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)));
  12548. }, error: function error() {
  12549. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  12550. }, performance: { log: function log(e) {
  12551. var t, n;m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: x, "Execution Time": n })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  12552. }, display: function display() {
  12553. var t = m.name + ":",
  12554. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  12555. n += t["Execution Time"];
  12556. }), 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) {
  12557. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12558. }), console.groupEnd()), s = [];
  12559. } }, invoke: function invoke(t, o, a) {
  12560. var r,
  12561. s,
  12562. l,
  12563. c = C;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) {
  12564. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12565. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12566. }
  12567. })), 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;
  12568. } }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  12569. }), n !== i ? n : this;
  12570. }, e.fn.rating.settings = { name: "Rating", namespace: "rating", slent: !1, debug: !1, verbose: !1, performance: !0, initialRating: 0, interactive: !0, maxRating: 4, clearable: "auto", fireOnInit: !1, onRate: function onRate(e) {}, error: { method: "The method you called is not defined", noMaximum: "No maximum rating specified. Cannot generate HTML automatically" }, metadata: { rating: "rating", maxRating: "maxRating" }, className: { active: "active", disabled: "disabled", selected: "selected", loading: "loading" }, selector: { icon: ".icon" }, templates: { icon: function icon(e) {
  12571. for (var t = 1, n = ""; t <= e;) {
  12572. n += '<i class="icon"></i>', t++;
  12573. }return n;
  12574. } } };
  12575. }(jQuery, window, document), function (e, t, n, i) {
  12576. "use strict";
  12577. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  12578. var a,
  12579. r = e(this),
  12580. s = r.selector || "",
  12581. l = new Date().getTime(),
  12582. c = [],
  12583. u = arguments[0],
  12584. d = "string" == typeof u,
  12585. f = [].slice.call(arguments, 1);return e(this).each(function () {
  12586. var m,
  12587. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  12588. p = g.className,
  12589. h = g.metadata,
  12590. v = g.regExp,
  12591. b = g.fields,
  12592. y = g.selector,
  12593. x = g.error,
  12594. C = g.namespace,
  12595. w = "." + C,
  12596. S = C + "-module",
  12597. k = e(this),
  12598. T = k.find(y.prompt),
  12599. A = k.find(y.searchButton),
  12600. R = k.find(y.results),
  12601. P = k.find(y.result),
  12602. E = (k.find(y.category), this),
  12603. F = k.data(S),
  12604. O = !1,
  12605. D = !1;m = { initialize: function initialize() {
  12606. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  12607. }, instantiate: function instantiate() {
  12608. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  12609. }, destroy: function destroy() {
  12610. m.verbose("Destroying instance"), k.off(w).removeData(S);
  12611. }, refresh: function refresh() {
  12612. 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);
  12613. }, refreshResults: function refreshResults() {
  12614. R = k.find(y.results), P = k.find(y.result);
  12615. }, bind: { events: function events() {
  12616. 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);
  12617. } }, determine: { searchFields: function searchFields() {
  12618. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  12619. } }, event: { input: function input() {
  12620. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  12621. m.is.focused() && m.query();
  12622. }, g.searchDelay)) : m.query();
  12623. }, focus: function focus() {
  12624. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  12625. m.can.show() && m.showResults();
  12626. });
  12627. }, blur: function blur(e) {
  12628. var t = function t() {
  12629. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  12630. };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) {
  12631. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  12632. })) : (m.debug("Input blurred without user action, closing results"), t()));
  12633. }, result: { mousedown: function mousedown() {
  12634. m.resultsClicked = !0;
  12635. }, mouseup: function mouseup() {
  12636. m.resultsClicked = !1;
  12637. }, click: function click(n) {
  12638. m.debug("Search result selected");var i = e(this),
  12639. o = i.find(y.title).eq(0),
  12640. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  12641. r = a.attr("href") || !1,
  12642. s = a.attr("target") || !1,
  12643. l = (o.html(), o.length > 0 && o.text()),
  12644. c = m.get.results(),
  12645. u = i.data(h.result) || m.get.result(l, c);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);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);
  12646. } } }, handleKeyboard: function handleKeyboard(e) {
  12647. var t,
  12648. n = k.find(y.result),
  12649. i = k.find(y.category),
  12650. o = n.filter("." + p.active),
  12651. a = n.index(o),
  12652. r = n.length,
  12653. s = o.length > 0,
  12654. l = e.which,
  12655. c = 13,
  12656. u = 38,
  12657. d = 40;if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  12658. if (l == c) {
  12659. 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;
  12660. } 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());
  12661. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  12662. }, setup: { api: function api(t, n) {
  12663. var i = { debug: g.debug, on: !1, cache: g.cache, action: "search", urlData: { query: t }, onSuccess: function onSuccess(e) {
  12664. m.parse.response.call(E, e, t), n();
  12665. }, onFailure: function onFailure() {
  12666. m.displayMessage(x.serverError), n();
  12667. }, onAbort: function onAbort(e) {}, onError: m.error };e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  12668. } }, can: { useAPI: function useAPI() {
  12669. return e.fn.api !== i;
  12670. }, show: function show() {
  12671. return m.is.focused() && !m.is.visible() && !m.is.empty();
  12672. }, transition: function transition() {
  12673. return g.transition && e.fn.transition !== i && k.transition("is supported");
  12674. } }, is: { animating: function animating() {
  12675. return R.hasClass(p.animating);
  12676. }, hidden: function hidden() {
  12677. return R.hasClass(p.hidden);
  12678. }, inMessage: function inMessage(t) {
  12679. if (t.target) {
  12680. var i = e(t.target);return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  12681. }
  12682. }, empty: function empty() {
  12683. return "" === R.html();
  12684. }, visible: function visible() {
  12685. return R.filter(":visible").length > 0;
  12686. }, focused: function focused() {
  12687. return T.filter(":focus").length > 0;
  12688. } }, get: { settings: function settings() {
  12689. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  12690. }, inputEvent: function inputEvent() {
  12691. var e = T[0];return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  12692. }, value: function value() {
  12693. return T.val();
  12694. }, results: function results() {
  12695. return k.data(h.results);
  12696. }, result: function result(t, n) {
  12697. var o = ["title", "id"],
  12698. a = !1;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) {
  12699. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  12700. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  12701. } }, select: { firstResult: function firstResult() {
  12702. m.verbose("Selecting first result"), P.first().addClass(p.active);
  12703. } }, set: { focus: function focus() {
  12704. k.addClass(p.focus);
  12705. }, loading: function loading() {
  12706. k.addClass(p.loading);
  12707. }, value: function value(e) {
  12708. m.verbose("Setting search input value", e), T.val(e);
  12709. }, type: function type(e) {
  12710. e = e || g.type, "category" == g.type && k.addClass(g.type);
  12711. }, buttonPressed: function buttonPressed() {
  12712. A.addClass(p.pressed);
  12713. } }, remove: { loading: function loading() {
  12714. k.removeClass(p.loading);
  12715. }, focus: function focus() {
  12716. k.removeClass(p.focus);
  12717. }, buttonPressed: function buttonPressed() {
  12718. A.removeClass(p.pressed);
  12719. } }, query: function query(t) {
  12720. t = e.isFunction(t) ? t : function () {};var n = m.get.value(),
  12721. i = m.read.cache(n);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();
  12722. }, search: { local: function local(e) {
  12723. var t,
  12724. n = m.search.object(e, g.content);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({ results: n }), m.remove.loading(), m.addResults(t), m.inject.id(n), m.write.cache(e, { html: t, results: n });
  12725. }, remote: function remote(t, n) {
  12726. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  12727. }, object: function object(t, n, o) {
  12728. var a = [],
  12729. r = [],
  12730. s = [],
  12731. l = t.toString().replace(v.escape, "\\$&"),
  12732. c = new RegExp(v.beginsWith + l, "i"),
  12733. u = function u(t, n) {
  12734. var i = -1 == e.inArray(n, a),
  12735. o = -1 == e.inArray(n, s),
  12736. l = -1 == e.inArray(n, r);i && o && l && t.push(n);
  12737. };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) {
  12738. e.each(n, function (e, n) {
  12739. "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));
  12740. });
  12741. }), e.merge(r, s), e.merge(a, r), a);
  12742. } }, exactSearch: function exactSearch(e, t) {
  12743. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12744. }, fuzzySearch: function fuzzySearch(e, t) {
  12745. var n = t.length,
  12746. i = e.length;if ("string" != typeof e) return !1;if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;if (i === n) return e === t;e: for (var o = 0, a = 0; o < i; o++) {
  12747. for (var r = e.charCodeAt(o); a < n;) {
  12748. if (t.charCodeAt(a++) === r) continue e;
  12749. }return !1;
  12750. }return !0;
  12751. }, parse: { response: function response(e, t) {
  12752. var n = m.generateResults(e);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, { html: n, results: e[b.results] }), m.save.results(e[b.results]));
  12753. } }, cancel: { query: function query() {
  12754. m.can.useAPI() && k.api("abort");
  12755. } }, has: { minimumCharacters: function minimumCharacters() {
  12756. return m.get.value().length >= g.minCharacters;
  12757. }, results: function results() {
  12758. return 0 !== R.length && "" != R.html();
  12759. } }, clear: { cache: function cache(e) {
  12760. var t = k.data(h.cache);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));
  12761. } }, read: { cache: function cache(e) {
  12762. var t = k.data(h.cache);return !!g.cache && (m.verbose("Checking cache for generated html for query", e), "object" == (typeof t === "undefined" ? "undefined" : _typeof(t)) && t[e] !== i && t[e]);
  12763. } }, create: { categoryResults: function categoryResults(t) {
  12764. var n = {};return e.each(t, function (e, t) {
  12765. t.category && (n[t.category] === i ? (m.verbose("Creating new category of results", t.category), n[t.category] = { name: t.category, results: [t] }) : n[t.category].results.push(t));
  12766. }), n;
  12767. }, id: function id(e, t) {
  12768. var n,
  12769. o = e + 1;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;
  12770. }, results: function results() {
  12771. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  12772. } }, inject: { result: function result(e, t, n) {
  12773. m.verbose("Injecting result into results");var o = n !== i ? R.children().eq(n).children(y.results).first().children(y.result).eq(t) : R.children(y.result).eq(t);m.verbose("Injecting results metadata", o), o.data(h.result, e);
  12774. }, id: function id(t) {
  12775. m.debug("Injecting unique ids into results");var n = 0,
  12776. o = 0;return "category" === g.type ? e.each(t, function (t, a) {
  12777. o = 0, e.each(a.results, function (e, t) {
  12778. var r = a.results[e];r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  12779. }), n++;
  12780. }) : e.each(t, function (e, n) {
  12781. var a = t[e];a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  12782. }), t;
  12783. } }, save: { results: function results(e) {
  12784. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  12785. } }, write: { cache: function cache(e, t) {
  12786. var n = k.data(h.cache) !== i ? k.data(h.cache) : {};g.cache && (m.verbose("Writing generated html to cache", e, t), n[e] = t, k.data(h.cache, n));
  12787. } }, addResults: function addResults(t) {
  12788. if (e.isFunction(g.onResultsAdd) && !1 === g.onResultsAdd.call(R, t)) return m.debug("onResultsAdd callback cancelled default action"), !1;t ? (R.html(t), m.refreshResults(), g.selectFirstResult && m.select.firstResult(), m.showResults()) : m.hideResults(function () {
  12789. R.empty();
  12790. });
  12791. }, showResults: function showResults(t) {
  12792. 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({ animation: g.transition + " in", debug: g.debug, verbose: g.verbose, duration: g.duration, onComplete: function onComplete() {
  12793. t();
  12794. }, queue: !0 })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  12795. }, hideResults: function hideResults(t) {
  12796. t = e.isFunction(t) ? t : function () {}, m.is.visible() && (m.can.transition() ? (m.debug("Hiding results with css animations"), R.transition({ animation: g.transition + " out", debug: g.debug, verbose: g.verbose, duration: g.duration, onComplete: function onComplete() {
  12797. t();
  12798. }, queue: !0 })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  12799. }, generateResults: function generateResults(t) {
  12800. m.debug("Generating html from response", t);var n = g.templates[g.type],
  12801. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  12802. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  12803. a = "";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;
  12804. }, displayMessage: function displayMessage(e, t) {
  12805. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  12806. }, setting: function setting(t, n) {
  12807. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12808. if (n === i) return g[t];g[t] = n;
  12809. }
  12810. }, internal: function internal(t, n) {
  12811. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  12812. if (n === i) return m[t];m[t] = n;
  12813. }
  12814. }, debug: function debug() {
  12815. !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)));
  12816. }, verbose: function verbose() {
  12817. !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)));
  12818. }, error: function error() {
  12819. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  12820. }, performance: { log: function log(e) {
  12821. var t, n;g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: E, "Execution Time": n })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  12822. }, display: function display() {
  12823. var t = g.name + ":",
  12824. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  12825. n += t["Execution Time"];
  12826. }), 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) {
  12827. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12828. }), console.groupEnd()), c = [];
  12829. } }, invoke: function invoke(t, n, o) {
  12830. var r,
  12831. s,
  12832. l,
  12833. c = F;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) {
  12834. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  12835. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  12836. }
  12837. })), 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;
  12838. } }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  12839. }), a !== i ? a : this;
  12840. }, e.fn.search.settings = { name: "Search", namespace: "search", silent: !1, debug: !1, verbose: !1, performance: !0, type: "standard", minCharacters: 1, selectFirstResult: !1, apiSettings: !1, source: !1, searchOnFocus: !0, searchFields: ["title", "description"], displayField: "", fullTextSearch: "exact", automatic: !0, hideDelay: 0, searchDelay: 200, maxResults: 7, cache: !0, showNoResults: !0, transition: "scale", duration: 200, easing: "easeOutExpo", onSelect: !1, onResultsAdd: !1, onSearchQuery: function onSearchQuery(e) {}, onResults: function onResults(e) {}, onResultsOpen: function onResultsOpen() {}, onResultsClose: function onResultsClose() {}, className: { animating: "animating", active: "active", empty: "empty", focus: "focus", hidden: "hidden", loading: "loading", results: "results", pressed: "down" }, error: { source: "Cannot search. No source used, and Semantic API module was not included", noResults: "Your search returned no results", logging: "Error in debug logging, exiting.", noEndpoint: "No search endpoint was specified", noTemplate: "A valid template name was not specified.", oldSearchSyntax: "searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.", serverError: "There was an issue querying the server.", maxResults: "Results must be an array to use maxResults setting", method: "The method you called is not defined." }, metadata: { cache: "cache", results: "results", result: "result" }, regExp: { escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, beginsWith: "(?:s|^)" }, fields: { categories: "results", categoryName: "name", categoryResults: "results", description: "description", image: "image", price: "price", results: "results", title: "title", url: "url", action: "action", actionText: "text", actionURL: "url" }, selector: { prompt: ".prompt", searchButton: ".search.button", results: ".results", message: ".results > .message", category: ".category", result: ".result", title: ".title, .name" }, templates: { escape: function escape(e) {
  12841. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12842. return t[e];
  12843. }) : e
  12844. );
  12845. }, message: function message(e, t) {
  12846. var n = "";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;
  12847. }, category: function category(t, n) {
  12848. var o = "";e.fn.search.settings.templates.escape;return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  12849. 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) {
  12850. 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>";
  12851. }), o += "</div>", o += "</div>");
  12852. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12853. }, standard: function standard(t, n) {
  12854. var o = "";return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  12855. 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>";
  12856. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12857. } } };
  12858. }(jQuery, window, document), function (e, t, n, i) {
  12859. "use strict";
  12860. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  12861. var a,
  12862. r = e(this),
  12863. s = (e("body"), new Date().getTime()),
  12864. l = [],
  12865. c = arguments[0],
  12866. u = "string" == typeof c,
  12867. d = [].slice.call(arguments, 1),
  12868. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12869. setTimeout(e, 0);
  12870. };return r.each(function () {
  12871. var t,
  12872. m,
  12873. g,
  12874. p = r.selector || "",
  12875. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  12876. v = h.namespace,
  12877. b = h.selector,
  12878. y = h.error,
  12879. x = h.className,
  12880. C = "." + v,
  12881. w = "module-" + v,
  12882. S = e(this),
  12883. k = S.find(b.sides),
  12884. T = S.find(b.side),
  12885. A = !1,
  12886. R = this,
  12887. P = S.data(w);g = { initialize: function initialize() {
  12888. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  12889. }, instantiate: function instantiate() {
  12890. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  12891. }, destroy: function destroy() {
  12892. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  12893. }, refresh: function refresh() {
  12894. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  12895. }, repaint: function repaint() {
  12896. g.verbose("Forcing repaint event");(k[0] || n.createElement("div")).offsetWidth;
  12897. }, animate: function animate(e, n) {
  12898. g.verbose("Animating box with properties", e), n = n || function (e) {
  12899. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  12900. }, 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 () {
  12901. S.addClass(x.animating), t.addClass(x.hidden);
  12902. })) : n();
  12903. }, queue: function queue(e) {
  12904. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  12905. g.debug("Executing queued animation"), setTimeout(function () {
  12906. S.shape(e);
  12907. }, 0);
  12908. });
  12909. }, reset: function reset() {
  12910. 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");
  12911. }, is: { complete: function complete() {
  12912. return T.filter("." + x.active)[0] == m[0];
  12913. }, animating: function animating() {
  12914. return S.hasClass(x.animating);
  12915. } }, set: { defaultSide: function defaultSide() {
  12916. 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);
  12917. }, duration: function duration(e) {
  12918. 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({ "-webkit-transition-duration": e, "-moz-transition-duration": e, "-ms-transition-duration": e, "-o-transition-duration": e, "transition-duration": e });
  12919. }, currentStageSize: function currentStageSize() {
  12920. var e = S.find("." + h.className.active),
  12921. t = e.outerWidth(!0),
  12922. n = e.outerHeight(!0);S.css({ width: t, height: n });
  12923. }, stageSize: function stageSize() {
  12924. var e = S.clone().addClass(x.loading),
  12925. t = e.find("." + h.className.active),
  12926. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  12927. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  12928. o = "next" == h.height ? n.outerHeight(!0) : "initial" == h.height ? S.height() : h.height;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));
  12929. }, nextSide: function nextSide(e) {
  12930. 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);
  12931. }, active: function active() {
  12932. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  12933. } }, flip: { up: function up() {
  12934. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12935. if (g.is.animating()) g.queue("flip up");else {
  12936. g.debug("Flipping up", m);var e = g.get.transform.up();g.set.stageSize(), g.stage.above(), g.animate(e);
  12937. }
  12938. } else g.debug("Side already visible", m);
  12939. }, down: function down() {
  12940. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12941. if (g.is.animating()) g.queue("flip down");else {
  12942. g.debug("Flipping down", m);var e = g.get.transform.down();g.set.stageSize(), g.stage.below(), g.animate(e);
  12943. }
  12944. } else g.debug("Side already visible", m);
  12945. }, left: function left() {
  12946. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12947. if (g.is.animating()) g.queue("flip left");else {
  12948. g.debug("Flipping left", m);var e = g.get.transform.left();g.set.stageSize(), g.stage.left(), g.animate(e);
  12949. }
  12950. } else g.debug("Side already visible", m);
  12951. }, right: function right() {
  12952. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12953. if (g.is.animating()) g.queue("flip right");else {
  12954. g.debug("Flipping right", m);var e = g.get.transform.right();g.set.stageSize(), g.stage.right(), g.animate(e);
  12955. }
  12956. } else g.debug("Side already visible", m);
  12957. }, over: function over() {
  12958. !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);
  12959. }, back: function back() {
  12960. !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);
  12961. } }, get: { transform: { up: function up() {
  12962. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)" };
  12963. }, down: function down() {
  12964. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)" };
  12965. }, left: function left() {
  12966. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)" };
  12967. }, right: function right() {
  12968. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)" };
  12969. }, over: function over() {
  12970. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)" };
  12971. }, back: function back() {
  12972. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)" };
  12973. } }, transitionEvent: function transitionEvent() {
  12974. var e,
  12975. t = n.createElement("element"),
  12976. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12977. if (t.style[e] !== i) return o[e];
  12978. }
  12979. }, nextSide: function nextSide() {
  12980. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  12981. } }, stage: { above: function above() {
  12982. var e = { origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2, depth: { active: m.outerHeight(!0) / 2, next: t.outerHeight(!0) / 2 } };g.verbose("Setting the initial animation position as above", m, e), k.css({ transform: "translateZ(-" + e.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)" }), m.addClass(x.animating).css({ top: e.origin + "px", transform: "rotateX(90deg) translateZ(" + e.depth.next + "px)" });
  12983. }, below: function below() {
  12984. var e = { origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2, depth: { active: m.outerHeight(!0) / 2, next: t.outerHeight(!0) / 2 } };g.verbose("Setting the initial animation position as below", m, e), k.css({ transform: "translateZ(-" + e.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)" }), m.addClass(x.animating).css({ top: e.origin + "px", transform: "rotateX(-90deg) translateZ(" + e.depth.next + "px)" });
  12985. }, left: function left() {
  12986. var e = t.outerWidth(!0),
  12987. n = m.outerWidth(!0),
  12988. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as left", m, i), k.css({ transform: "translateZ(-" + i.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(-90deg) translateZ(" + i.depth.next + "px)" });
  12989. }, right: function right() {
  12990. var e = t.outerWidth(!0),
  12991. n = m.outerWidth(!0),
  12992. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as left", m, i), k.css({ transform: "translateZ(-" + i.depth.active + "px)" }), t.css({ transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(90deg) translateZ(" + i.depth.next + "px)" });
  12993. }, behind: function behind() {
  12994. var e = t.outerWidth(!0),
  12995. n = m.outerWidth(!0),
  12996. i = { origin: (e - n) / 2, depth: { active: n / 2, next: e / 2 } };g.verbose("Setting the initial animation position as behind", m, i), t.css({ transform: "rotateY(0deg)" }), m.addClass(x.animating).css({ left: i.origin + "px", transform: "rotateY(-180deg)" });
  12997. } }, setting: function setting(t, n) {
  12998. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  12999. if (n === i) return h[t];e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  13000. }
  13001. }, internal: function internal(t, n) {
  13002. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  13003. if (n === i) return g[t];g[t] = n;
  13004. }
  13005. }, debug: function debug() {
  13006. !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)));
  13007. }, verbose: function verbose() {
  13008. !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)));
  13009. }, error: function error() {
  13010. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  13011. }, performance: { log: function log(e) {
  13012. var t, n;h.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: R, "Execution Time": n })), clearTimeout(g.performance.timer), g.performance.timer = setTimeout(g.performance.display, 500);
  13013. }, display: function display() {
  13014. var t = h.name + ":",
  13015. n = 0;s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  13016. n += t["Execution Time"];
  13017. }), 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) {
  13018. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13019. }), console.groupEnd()), l = [];
  13020. } }, invoke: function invoke(t, n, o) {
  13021. var r,
  13022. s,
  13023. l,
  13024. c = P;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) {
  13025. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13026. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  13027. }
  13028. })), 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;
  13029. } }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  13030. }), a !== i ? a : this;
  13031. }, e.fn.shape.settings = { name: "Shape", silent: !1, debug: !1, verbose: !1, jitter: 0, performance: !0, namespace: "shape", width: "initial", height: "initial", beforeChange: function beforeChange() {}, onChange: function onChange() {}, allowRepeats: !1, duration: !1, error: { side: "You tried to switch to a side that does not exist.", method: "The method you called is not defined" }, className: { animating: "animating", hidden: "hidden", loading: "loading", active: "active" }, selector: { sides: ".sides", side: ".side" } };
  13032. }(jQuery, window, document), function (e, t, n, i) {
  13033. "use strict";
  13034. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  13035. var a,
  13036. r = e(this),
  13037. s = e(t),
  13038. l = e(n),
  13039. c = e("html"),
  13040. u = e("head"),
  13041. d = r.selector || "",
  13042. f = new Date().getTime(),
  13043. m = [],
  13044. g = arguments[0],
  13045. p = "string" == typeof g,
  13046. h = [].slice.call(arguments, 1),
  13047. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13048. setTimeout(e, 0);
  13049. };return r.each(function () {
  13050. var r,
  13051. b,
  13052. y,
  13053. x,
  13054. C,
  13055. w,
  13056. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  13057. k = S.selector,
  13058. T = S.className,
  13059. A = S.namespace,
  13060. R = S.regExp,
  13061. P = S.error,
  13062. E = "." + A,
  13063. F = "module-" + A,
  13064. O = e(this),
  13065. D = e(S.context),
  13066. q = O.children(k.sidebar),
  13067. j = (D.children(k.fixed), D.children(k.pusher)),
  13068. z = this,
  13069. I = O.data(F);w = { initialize: function initialize() {
  13070. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  13071. w.setup.cache();
  13072. }), w.instantiate();
  13073. }, instantiate: function instantiate() {
  13074. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  13075. }, create: { id: function id() {
  13076. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  13077. } }, destroy: function destroy() {
  13078. 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);
  13079. }, event: { clickaway: function clickaway(e) {
  13080. var t = j.find(e.target).length > 0 || j.is(e.target),
  13081. n = D.is(e.target);t && (w.verbose("User clicked on dimmed page"), w.hide()), n && (w.verbose("User clicked on dimmable context (scaled out page)"), w.hide());
  13082. }, touch: function touch(e) {}, containScroll: function containScroll(e) {
  13083. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  13084. }, scroll: function scroll(t) {
  13085. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  13086. } }, bind: { clickaway: function clickaway() {
  13087. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  13088. }, scrollLock: function scrollLock() {
  13089. 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);
  13090. } }, unbind: { clickaway: function clickaway() {
  13091. w.verbose("Removing clickaway events from context", D), D.off(b);
  13092. }, scrollLock: function scrollLock() {
  13093. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  13094. } }, add: { inlineCSS: function inlineCSS() {
  13095. var t,
  13096. n = w.cache.width || O.outerWidth(),
  13097. i = w.cache.height || O.outerHeight(),
  13098. o = w.is.rtl(),
  13099. a = w.get.direction(),
  13100. s = { left: n, right: -n, top: i, bottom: -i };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);
  13101. } }, refresh: function refresh() {
  13102. 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();
  13103. }, refreshSidebars: function refreshSidebars() {
  13104. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  13105. }, repaint: function repaint() {
  13106. w.verbose("Forcing repaint event"), z.style.display = "none";z.offsetHeight;z.scrollTop = z.scrollTop, z.style.display = "";
  13107. }, setup: { cache: function cache() {
  13108. w.cache = { width: O.outerWidth(), height: O.outerHeight(), rtl: "rtl" == O.css("direction") };
  13109. }, layout: function layout() {
  13110. 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();
  13111. } }, attachEvents: function attachEvents(t, n) {
  13112. var i = e(t);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);
  13113. }, show: function show(t) {
  13114. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  13115. 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) {
  13116. if ("overlay" != S.transition) return void w.hideOthers(w.show);w.hideOthers();
  13117. } else S.transition = "overlay";w.pushPage(function () {
  13118. t.call(z), S.onShow.call(z);
  13119. }), S.onChange.call(z), S.onVisible.call(z);
  13120. } else w.debug("Sidebar is already visible");
  13121. }, hide: function hide(t) {
  13122. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  13123. t.call(z), S.onHidden.call(z);
  13124. }), S.onChange.call(z), S.onHide.call(z));
  13125. }, othersAnimating: function othersAnimating() {
  13126. return q.not(O).filter("." + T.animating).length > 0;
  13127. }, othersVisible: function othersVisible() {
  13128. return q.not(O).filter("." + T.visible).length > 0;
  13129. }, othersActive: function othersActive() {
  13130. return w.othersVisible() || w.othersAnimating();
  13131. }, hideOthers: function hideOthers(e) {
  13132. var t = q.not(O).filter("." + T.visible),
  13133. n = t.length,
  13134. i = 0;e = e || function () {}, t.sidebar("hide", function () {
  13135. ++i == n && e();
  13136. });
  13137. }, toggle: function toggle() {
  13138. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  13139. }, pushPage: function pushPage(t) {
  13140. var n,
  13141. i,
  13142. _o,
  13143. a = w.get.transition(),
  13144. r = "overlay" === a || w.othersActive() ? O : j;t = e.isFunction(t) ? t : function () {}, "scale down" == S.transition && w.scrollToTop(), w.set.transition(a), w.repaint(), n = function n() {
  13145. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  13146. }, i = function i() {
  13147. w.set.dimmed();
  13148. }, _o = function o(e) {
  13149. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  13150. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  13151. }, pullPage: function pullPage(t) {
  13152. var n,
  13153. _i,
  13154. o = w.get.transition(),
  13155. a = "overlay" == o || w.othersActive() ? O : j;t = e.isFunction(t) ? t : function () {}, w.verbose("Removing context push state", w.get.direction()), w.unbind.clickaway(), w.unbind.scrollLock(), n = function n() {
  13156. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  13157. }, _i = function i(e) {
  13158. 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));
  13159. }, a.off(C + b), a.on(C + b, _i), v(n);
  13160. }, scrollToTop: function scrollToTop() {
  13161. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  13162. }, scrollBack: function scrollBack() {
  13163. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  13164. }, clear: { cache: function cache() {
  13165. w.verbose("Clearing cached dimensions"), w.cache = {};
  13166. } }, set: { ios: function ios() {
  13167. c.addClass(T.ios);
  13168. }, pushed: function pushed() {
  13169. D.addClass(T.pushed);
  13170. }, pushable: function pushable() {
  13171. D.addClass(T.pushable);
  13172. }, dimmed: function dimmed() {
  13173. j.addClass(T.dimmed);
  13174. }, active: function active() {
  13175. O.addClass(T.active);
  13176. }, animating: function animating() {
  13177. O.addClass(T.animating);
  13178. }, transition: function transition(e) {
  13179. e = e || w.get.transition(), O.addClass(e);
  13180. }, direction: function direction(e) {
  13181. e = e || w.get.direction(), O.addClass(T[e]);
  13182. }, visible: function visible() {
  13183. O.addClass(T.visible);
  13184. }, overlay: function overlay() {
  13185. O.addClass(T.overlay);
  13186. } }, remove: { inlineCSS: function inlineCSS() {
  13187. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  13188. }, ios: function ios() {
  13189. c.removeClass(T.ios);
  13190. }, pushed: function pushed() {
  13191. D.removeClass(T.pushed);
  13192. }, pushable: function pushable() {
  13193. D.removeClass(T.pushable);
  13194. }, active: function active() {
  13195. O.removeClass(T.active);
  13196. }, animating: function animating() {
  13197. O.removeClass(T.animating);
  13198. }, transition: function transition(e) {
  13199. e = e || w.get.transition(), O.removeClass(e);
  13200. }, direction: function direction(e) {
  13201. e = e || w.get.direction(), O.removeClass(T[e]);
  13202. }, visible: function visible() {
  13203. O.removeClass(T.visible);
  13204. }, overlay: function overlay() {
  13205. O.removeClass(T.overlay);
  13206. } }, get: { direction: function direction() {
  13207. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  13208. }, transition: function transition() {
  13209. var e,
  13210. t = w.get.direction();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;
  13211. }, transitionEvent: function transitionEvent() {
  13212. var e,
  13213. t = n.createElement("element"),
  13214. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  13215. if (t.style[e] !== i) return o[e];
  13216. }
  13217. } }, is: { ie: function ie() {
  13218. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  13219. }, ios: function ios() {
  13220. var e = navigator.userAgent,
  13221. t = e.match(R.ios),
  13222. n = e.match(R.mobileChrome);return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  13223. }, mobile: function mobile() {
  13224. var e = navigator.userAgent;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);
  13225. }, hidden: function hidden() {
  13226. return !w.is.visible();
  13227. }, visible: function visible() {
  13228. return O.hasClass(T.visible);
  13229. }, open: function open() {
  13230. return w.is.visible();
  13231. }, closed: function closed() {
  13232. return w.is.hidden();
  13233. }, vertical: function vertical() {
  13234. return O.hasClass(T.top);
  13235. }, animating: function animating() {
  13236. return D.hasClass(T.animating);
  13237. }, rtl: function rtl() {
  13238. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  13239. } }, setting: function setting(t, n) {
  13240. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  13241. if (n === i) return S[t];e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  13242. }
  13243. }, internal: function internal(t, n) {
  13244. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  13245. if (n === i) return w[t];w[t] = n;
  13246. }
  13247. }, debug: function debug() {
  13248. !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)));
  13249. }, verbose: function verbose() {
  13250. !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)));
  13251. }, error: function error() {
  13252. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  13253. }, performance: { log: function log(e) {
  13254. var t, n;S.performance && (n = (t = new Date().getTime()) - (f || t), f = t, m.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: z, "Execution Time": n })), clearTimeout(w.performance.timer), w.performance.timer = setTimeout(w.performance.display, 500);
  13255. }, display: function display() {
  13256. var t = S.name + ":",
  13257. n = 0;f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  13258. n += t["Execution Time"];
  13259. }), 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) {
  13260. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13261. }), console.groupEnd()), m = [];
  13262. } }, invoke: function invoke(t, n, o) {
  13263. var r,
  13264. s,
  13265. l,
  13266. c = I;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) {
  13267. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13268. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (w.error(P.method, t), !1);c = c[o];
  13269. }
  13270. })), 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;
  13271. } }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  13272. }), a !== i ? a : this;
  13273. }, e.fn.sidebar.settings = { name: "Sidebar", namespace: "sidebar", silent: !1, debug: !1, verbose: !1, performance: !0, transition: "auto", mobileTransition: "auto", defaultTransition: { computer: { left: "uncover", right: "uncover", top: "overlay", bottom: "overlay" }, mobile: { left: "uncover", right: "uncover", top: "overlay", bottom: "overlay" } }, context: "body", exclusive: !1, closable: !0, dimPage: !0, scrollLock: !1, returnScroll: !1, delaySetup: !1, duration: 500, onChange: function onChange() {}, onShow: function onShow() {}, onHide: function onHide() {}, onHidden: function onHidden() {}, onVisible: function onVisible() {}, className: { active: "active", animating: "animating", dimmed: "dimmed", ios: "ios", pushable: "pushable", pushed: "pushed", right: "right", top: "top", left: "left", bottom: "bottom", visible: "visible" }, selector: { fixed: ".fixed", omitted: "script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed", pusher: ".pusher", sidebar: ".ui.sidebar" }, regExp: { ios: /(iPad|iPhone|iPod)/g, mobileChrome: /(CriOS)/g, 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 }, error: { method: "The method you called is not defined.", pusher: "Had to add pusher element. For optimal performance make sure body content is inside a pusher element", movedSidebar: "Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag", overlay: "The overlay setting is no longer supported, use animation: overlay", notFound: "There were no elements that matched the specified selector" } };
  13274. }(jQuery, window, document), function (e, t, n, i) {
  13275. "use strict";
  13276. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  13277. var a,
  13278. r = e(this),
  13279. s = r.selector || "",
  13280. l = new Date().getTime(),
  13281. c = [],
  13282. u = arguments[0],
  13283. d = "string" == typeof u,
  13284. f = [].slice.call(arguments, 1);return r.each(function () {
  13285. var r,
  13286. m,
  13287. g,
  13288. p,
  13289. h,
  13290. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  13291. b = v.className,
  13292. y = v.namespace,
  13293. x = v.error,
  13294. C = "." + y,
  13295. w = "module-" + y,
  13296. S = e(this),
  13297. k = e(t),
  13298. T = e(v.scrollContext),
  13299. A = (S.selector, S.data(w)),
  13300. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13301. setTimeout(e, 0);
  13302. },
  13303. P = this;h = { initialize: function initialize() {
  13304. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  13305. }, instantiate: function instantiate() {
  13306. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  13307. }, destroy: function destroy() {
  13308. 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);
  13309. }, observeChanges: function observeChanges() {
  13310. "MutationObserver" in t && (g = new MutationObserver(h.event.documentChanged), p = new MutationObserver(h.event.changed), g.observe(n, { childList: !0, subtree: !0 }), p.observe(P, { childList: !0, subtree: !0 }), p.observe(m[0], { childList: !0, subtree: !0 }), h.debug("Setting up mutation observer", p));
  13311. }, determineContainer: function determineContainer() {
  13312. r = v.container ? e(v.container) : S.offsetParent();
  13313. }, determineContext: function determineContext() {
  13314. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  13315. }, checkErrors: function checkErrors() {
  13316. 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);
  13317. }, bind: { events: function events() {
  13318. 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);
  13319. } }, event: { changed: function changed(e) {
  13320. clearTimeout(h.timer), h.timer = setTimeout(function () {
  13321. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  13322. }, 100);
  13323. }, documentChanged: function documentChanged(t) {
  13324. [].forEach.call(t, function (t) {
  13325. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13326. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  13327. });
  13328. });
  13329. }, load: function load() {
  13330. h.verbose("Page contents finished loading"), R(h.refresh);
  13331. }, resize: function resize() {
  13332. h.verbose("Window resized"), R(h.refresh);
  13333. }, scroll: function scroll() {
  13334. R(function () {
  13335. T.triggerHandler("scrollchange" + C, T.scrollTop());
  13336. });
  13337. }, scrollchange: function scrollchange(e, t) {
  13338. h.stick(t), v.onScroll.call(P);
  13339. } }, refresh: function refresh(e) {
  13340. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  13341. }, supports: { sticky: function sticky() {
  13342. var t = e("<div/>");t[0];return t.addClass(b.supported), t.css("position").match("sticky");
  13343. } }, save: { lastScroll: function lastScroll(e) {
  13344. h.lastScroll = e;
  13345. }, elementScroll: function elementScroll(e) {
  13346. h.elementScroll = e;
  13347. }, positions: function positions() {
  13348. var e = { height: T.height() },
  13349. t = { margin: { top: parseInt(S.css("margin-top"), 10), bottom: parseInt(S.css("margin-bottom"), 10) }, offset: S.offset(), width: S.outerWidth(), height: S.outerHeight() },
  13350. n = { offset: m.offset(), height: m.outerHeight() };r.outerHeight();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 = { fits: t.height + v.offset <= e.height, sameHeight: t.height == n.height, scrollContext: { height: e.height }, element: { margin: t.margin, top: t.offset.top - t.margin.top, left: t.offset.left, width: t.width, height: t.height, bottom: t.offset.top + t.height }, context: { top: n.offset.top, height: n.height, bottom: n.offset.top + n.height } }, h.set.containerSize(), h.stick(), h.debug("Caching element positions", h.cache);
  13351. } }, get: { direction: function direction(e) {
  13352. var t = "down";return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  13353. }, scrollChange: function scrollChange(e) {
  13354. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  13355. }, currentElementScroll: function currentElementScroll() {
  13356. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  13357. }, elementScroll: function elementScroll(e) {
  13358. e = e || T.scrollTop();var t = h.cache.element,
  13359. n = h.cache.scrollContext,
  13360. i = h.get.scrollChange(e),
  13361. o = t.height - n.height + v.offset,
  13362. a = h.get.currentElementScroll(),
  13363. r = a + i;return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  13364. } }, remove: { lastScroll: function lastScroll() {
  13365. delete h.lastScroll;
  13366. }, elementScroll: function elementScroll(e) {
  13367. delete h.elementScroll;
  13368. }, minimumSize: function minimumSize() {
  13369. r.css("min-height", "");
  13370. }, offset: function offset() {
  13371. S.css("margin-top", "");
  13372. } }, set: { offset: function offset() {
  13373. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  13374. }, containerSize: function containerSize() {
  13375. var e = r.get(0).tagName;"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({ height: h.cache.context.height }));
  13376. }, minimumSize: function minimumSize() {
  13377. var e = h.cache.element;r.css("min-height", e.height);
  13378. }, scroll: function scroll(e) {
  13379. 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));
  13380. }, size: function size() {
  13381. 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"));
  13382. } }, is: { standardScroll: function standardScroll() {
  13383. return T[0] == t;
  13384. }, top: function top() {
  13385. return S.hasClass(b.top);
  13386. }, bottom: function bottom() {
  13387. return S.hasClass(b.bottom);
  13388. }, initialPosition: function initialPosition() {
  13389. return !h.is.fixed() && !h.is.bound();
  13390. }, hidden: function hidden() {
  13391. return !S.is(":visible");
  13392. }, bound: function bound() {
  13393. return S.hasClass(b.bound);
  13394. }, fixed: function fixed() {
  13395. return S.hasClass(b.fixed);
  13396. } }, stick: function stick(e) {
  13397. var t = e || T.scrollTop(),
  13398. n = h.cache,
  13399. i = n.fits,
  13400. o = n.sameHeight,
  13401. a = n.element,
  13402. r = n.scrollContext,
  13403. s = n.context,
  13404. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  13405. c = (e = { top: t + l, bottom: t + l + r.height }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  13406. u = !i;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())));
  13407. }, bindTop: function bindTop() {
  13408. h.debug("Binding element to top of parent container"), h.remove.offset(), S.css({ left: "", top: "", marginBottom: "" }).removeClass(b.fixed).removeClass(b.bottom).addClass(b.bound).addClass(b.top), v.onTop.call(P), v.onUnstick.call(P);
  13409. }, bindBottom: function bindBottom() {
  13410. h.debug("Binding element to bottom of parent container"), h.remove.offset(), S.css({ left: "", top: "" }).removeClass(b.fixed).removeClass(b.top).addClass(b.bound).addClass(b.bottom), v.onBottom.call(P), v.onUnstick.call(P);
  13411. }, setInitialPosition: function setInitialPosition() {
  13412. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  13413. }, fixTop: function fixTop() {
  13414. h.debug("Fixing element to top of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({ left: h.cache.element.left, bottom: "", marginBottom: "" }).removeClass(b.bound).removeClass(b.bottom).addClass(b.fixed).addClass(b.top), v.onStick.call(P);
  13415. }, fixBottom: function fixBottom() {
  13416. h.debug("Sticking element to bottom of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({ left: h.cache.element.left, bottom: "", marginBottom: "" }).removeClass(b.bound).removeClass(b.top).addClass(b.fixed).addClass(b.bottom), v.onStick.call(P);
  13417. }, unbind: function unbind() {
  13418. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  13419. }, unfix: function unfix() {
  13420. 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));
  13421. }, reset: function reset() {
  13422. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  13423. }, resetCSS: function resetCSS() {
  13424. S.css({ width: "", height: "" }), r.css({ height: "" });
  13425. }, setting: function setting(t, n) {
  13426. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  13427. if (n === i) return v[t];v[t] = n;
  13428. }
  13429. }, internal: function internal(t, n) {
  13430. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13431. if (n === i) return h[t];h[t] = n;
  13432. }
  13433. }, debug: function debug() {
  13434. !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)));
  13435. }, verbose: function verbose() {
  13436. !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)));
  13437. }, error: function error() {
  13438. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13439. }, performance: { log: function log(e) {
  13440. var t, n;v.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: P, "Execution Time": n })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 0);
  13441. }, display: function display() {
  13442. var t = v.name + ":",
  13443. n = 0;l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  13444. n += t["Execution Time"];
  13445. }), 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) {
  13446. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13447. }), console.groupEnd()), c = [];
  13448. } }, invoke: function invoke(t, n, o) {
  13449. var r,
  13450. s,
  13451. l,
  13452. c = A;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) {
  13453. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13454. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  13455. }
  13456. })), 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;
  13457. } }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  13458. }), a !== i ? a : this;
  13459. }, e.fn.sticky.settings = { name: "Sticky", namespace: "sticky", silent: !1, debug: !1, verbose: !0, performance: !0, pushing: !1, context: !1, container: !1, scrollContext: t, offset: 0, bottomOffset: 0, jitter: 5, setSize: !0, observeChanges: !1, onReposition: function onReposition() {}, onScroll: function onScroll() {}, onStick: function onStick() {}, onUnstick: function onUnstick() {}, onTop: function onTop() {}, onBottom: function onBottom() {}, error: { container: "Sticky element must be inside a relative container", visible: "Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.", method: "The method you called is not defined.", invalidContext: "Context specified does not exist", elementSize: "Sticky element is larger than its container, cannot create sticky." }, className: { bound: "bound", fixed: "fixed", supported: "native", top: "top", bottom: "bottom" } };
  13460. }(jQuery, window, document), function (e, t, n, i) {
  13461. "use strict";
  13462. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  13463. var a,
  13464. r = e.isFunction(this) ? e(t) : e(this),
  13465. s = r.selector || "",
  13466. l = new Date().getTime(),
  13467. c = [],
  13468. u = arguments[0],
  13469. d = "string" == typeof u,
  13470. f = [].slice.call(arguments, 1),
  13471. m = !1;return r.each(function () {
  13472. var g,
  13473. p,
  13474. h,
  13475. v,
  13476. b,
  13477. y,
  13478. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  13479. C = x.className,
  13480. w = x.metadata,
  13481. S = x.selector,
  13482. k = x.error,
  13483. T = "." + x.namespace,
  13484. A = "module-" + x.namespace,
  13485. R = e(this),
  13486. P = {},
  13487. E = !0,
  13488. F = 0,
  13489. O = this,
  13490. D = R.data(A);b = { initialize: function initialize() {
  13491. 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();
  13492. }, instantiate: function instantiate() {
  13493. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  13494. }, destroy: function destroy() {
  13495. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  13496. }, bind: { events: function events() {
  13497. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  13498. } }, determineTabs: function determineTabs() {
  13499. var t;"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));
  13500. }, fix: { callbacks: function callbacks() {
  13501. 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));
  13502. } }, initializeHistory: function initializeHistory() {
  13503. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;if ("state" == x.historyType) {
  13504. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;e.address.history(!0).state(x.path);
  13505. }e.address.bind("change", b.event.history.change);
  13506. }, event: { click: function click(t) {
  13507. var n = e(this).data(w.tab);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");
  13508. }, history: { change: function change(t) {
  13509. var n = t.pathNames.join("/") || b.get.initialPath(),
  13510. o = x.templates.determineTitle(n) || !1;b.performance.display(), b.debug("History change event", n, t), y = t, n !== i && b.changeTab(n), o && e.address.title(o);
  13511. } } }, refresh: function refresh() {
  13512. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  13513. }, cache: { read: function read(e) {
  13514. return e !== i && P[e];
  13515. }, add: function add(e, t) {
  13516. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  13517. }, remove: function remove(e) {
  13518. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  13519. } }, set: { auto: function auto() {
  13520. var t = "string" == typeof x.path ? x.path.replace(/\/$/, "") + "/{$tab}" : "/{$tab}";b.verbose("Setting up automatic tab retrieval from server", t), e.isPlainObject(x.apiSettings) ? x.apiSettings.url = t : x.apiSettings = { url: t };
  13521. }, loading: function loading(e) {
  13522. var t = b.get.tabElement(e);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));
  13523. }, state: function state(t) {
  13524. e.address.value(t);
  13525. } }, changeTab: function changeTab(n) {
  13526. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  13527. o = x.auto || e.isPlainObject(x.apiSettings),
  13528. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  13529. var s,
  13530. l,
  13531. c,
  13532. u,
  13533. d = a.slice(0, t + 1),
  13534. f = b.utilities.arrayToPath(d),
  13535. m = b.is.tab(f),
  13536. p = t + 1 == a.length,
  13537. S = b.get.tabElement(f);if (b.verbose("Looking for tab", r), m) {
  13538. 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;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);
  13539. } else {
  13540. if (-1 != n.search("/") || "" === n) return b.error(k.missingTab, R, g, f), !1;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 () {
  13541. b.scrollTo(s);
  13542. }, 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;
  13543. }
  13544. });
  13545. }, scrollTo: function scrollTo(t) {
  13546. var i = !!(t && t.length > 0) && t.offset().top;!1 !== i && (b.debug("Forcing scroll to an in-page link in a hidden tab", i, t), e(n).scrollTop(i));
  13547. }, update: { content: function content(t, n, o) {
  13548. var a = b.get.tabElement(t),
  13549. r = a[0];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);
  13550. } }, fetch: { content: function content(t, n) {
  13551. var o,
  13552. a,
  13553. r = b.get.tabElement(t),
  13554. s = { dataType: "html", encodeParameters: !1, on: "now", cache: x.alwaysRefresh, headers: { "X-Remote": !0 }, onSuccess: function onSuccess(e) {
  13555. "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 () {
  13556. var e = r.children().clone(!0);e = e.not("script"), b.cache.add(n, e);
  13557. }, 0) : b.cache.add(n, r.html());
  13558. }, urlData: { tab: n } },
  13559. l = r.api("get request") || !1,
  13560. c = l && "pending" === l.state();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);
  13561. } }, activate: { all: function all(e) {
  13562. b.activate.tab(e), b.activate.navigation(e);
  13563. }, tab: function tab(e) {
  13564. var t = b.get.tabElement(e),
  13565. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  13566. i = t.hasClass(C.active);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));
  13567. }, navigation: function navigation(e) {
  13568. var t = b.get.navElement(e),
  13569. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  13570. i = t.hasClass(C.active);b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  13571. } }, deactivate: { all: function all() {
  13572. b.deactivate.navigation(), b.deactivate.tabs();
  13573. }, navigation: function navigation() {
  13574. r.removeClass(C.active);
  13575. }, tabs: function tabs() {
  13576. p.removeClass(C.active + " " + C.loading);
  13577. } }, is: { tab: function tab(e) {
  13578. return e !== i && b.get.tabElement(e).length > 0;
  13579. } }, get: { initialPath: function initialPath() {
  13580. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  13581. }, path: function path() {
  13582. return e.address.value();
  13583. }, defaultPathArray: function defaultPathArray(e) {
  13584. return b.utilities.pathToArray(b.get.defaultPath(e));
  13585. }, defaultPath: function defaultPath(e) {
  13586. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;if (t) {
  13587. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);b.error(k.recursion);
  13588. } else b.debug("No default tabs found for", e, p);return F = 0, e;
  13589. }, navElement: function navElement(e) {
  13590. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  13591. }, tabElement: function tabElement(e) {
  13592. var t, n, i, o;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;
  13593. }, tab: function tab() {
  13594. return h;
  13595. } }, utilities: { filterArray: function filterArray(t, n) {
  13596. return e.grep(t, function (t) {
  13597. return -1 == e.inArray(t, n);
  13598. });
  13599. }, last: function last(t) {
  13600. return !!e.isArray(t) && t[t.length - 1];
  13601. }, pathToArray: function pathToArray(e) {
  13602. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  13603. }, arrayToPath: function arrayToPath(t) {
  13604. return !!e.isArray(t) && t.join("/");
  13605. } }, setting: function setting(t, n) {
  13606. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  13607. if (n === i) return x[t];e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  13608. }
  13609. }, internal: function internal(t, n) {
  13610. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  13611. if (n === i) return b[t];b[t] = n;
  13612. }
  13613. }, debug: function debug() {
  13614. !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)));
  13615. }, verbose: function verbose() {
  13616. !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)));
  13617. }, error: function error() {
  13618. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  13619. }, performance: { log: function log(e) {
  13620. var t, n;x.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: O, "Execution Time": n })), clearTimeout(b.performance.timer), b.performance.timer = setTimeout(b.performance.display, 500);
  13621. }, display: function display() {
  13622. var t = x.name + ":",
  13623. n = 0;l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  13624. n += t["Execution Time"];
  13625. }), 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) {
  13626. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13627. }), console.groupEnd()), c = [];
  13628. } }, invoke: function invoke(t, n, o) {
  13629. var r,
  13630. s,
  13631. l,
  13632. c = D;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) {
  13633. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13634. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (b.error(k.method, t), !1);c = c[o];
  13635. }
  13636. })), 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;
  13637. } }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  13638. }), a !== i ? a : this;
  13639. }, e.tab = function () {
  13640. e(t).tab.apply(this, arguments);
  13641. }, e.fn.tab.settings = { name: "Tab", namespace: "tab", silent: !1, debug: !1, verbose: !1, performance: !0, auto: !1, history: !1, historyType: "hash", path: !1, context: !1, childrenOnly: !1, maxDepth: 25, deactivate: "siblings", alwaysRefresh: !1, cache: !0, loadOnce: !1, cacheType: "response", ignoreFirstLoad: !1, apiSettings: !1, evaluateScripts: "once", onFirstLoad: function onFirstLoad(e, t, n) {}, onLoad: function onLoad(e, t, n) {}, onVisible: function onVisible(e, t, n) {}, onRequest: function onRequest(e, t, n) {}, templates: { determineTitle: function determineTitle(e) {} }, error: { api: "You attempted to load content without API module", method: "The method you called is not defined", missingTab: "Activated tab cannot be found. Tabs are case-sensitive.", noContent: "The tab you specified is missing a content url.", path: "History enabled, but no path was specified", recursion: "Max recursive depth reached", legacyInit: "onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.", legacyLoad: "onTabLoad has been renamed to onLoad in 2.0. Please adjust your code", state: "History requires Asual's Address library <https://github.com/asual/jquery-address>" }, metadata: { tab: "tab", loaded: "loaded", promise: "promise" }, className: { loading: "loading", active: "active" }, selector: { tabs: ".ui.tab", ui: ".ui" } };
  13642. }(jQuery, window, document), function (e, t, n, i) {
  13643. "use strict";
  13644. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  13645. var o,
  13646. a = e(this),
  13647. r = a.selector || "",
  13648. s = new Date().getTime(),
  13649. l = [],
  13650. c = arguments,
  13651. u = c[0],
  13652. d = [].slice.call(arguments, 1),
  13653. f = "string" == typeof u;t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function (t) {
  13654. var m,
  13655. g,
  13656. p,
  13657. h,
  13658. v,
  13659. b,
  13660. y,
  13661. x,
  13662. C,
  13663. w = e(this),
  13664. S = this;(C = { initialize: function initialize() {
  13665. 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());
  13666. }, instantiate: function instantiate() {
  13667. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  13668. }, destroy: function destroy() {
  13669. C.verbose("Destroying previous module for", S), w.removeData(y);
  13670. }, refresh: function refresh() {
  13671. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  13672. }, forceRepaint: function forceRepaint() {
  13673. C.verbose("Forcing element repaint");var e = w.parent(),
  13674. t = w.next();0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  13675. }, repaint: function repaint() {
  13676. C.verbose("Repainting element");S.offsetWidth;
  13677. }, delay: function delay(e) {
  13678. var n,
  13679. o = C.get.animationDirection();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);
  13680. }, animate: function animate(e) {
  13681. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  13682. 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;if (!m.allowRepeats && C.is.occurring()) return C.debug("Animation is already occurring, will not execute repeated animation", m.animation), !1;C.debug("New animation started, completing previous early", m.animation), g.complete();
  13683. }C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  13684. }, reset: function reset() {
  13685. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  13686. }, queue: function queue(e) {
  13687. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  13688. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  13689. });
  13690. }, complete: function complete(e) {
  13691. 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)));
  13692. }, force: { visible: function visible() {
  13693. var e = w.attr("style"),
  13694. t = C.get.userStyle(),
  13695. n = C.get.displayType(),
  13696. o = t + "display: " + n + " !important;",
  13697. a = w.css("display"),
  13698. r = e === i || "" === e;a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  13699. }, hidden: function hidden() {
  13700. var e = w.attr("style"),
  13701. t = w.css("display"),
  13702. n = e === i || "" === e;"none" === t || C.is.hidden() ? n && w.removeAttr("style") : (C.verbose("Overriding default display to hide element"), w.css("display", "none"));
  13703. } }, has: { direction: function direction(t) {
  13704. var n = !1;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13705. t !== h.inward && t !== h.outward || (n = !0);
  13706. })), n;
  13707. }, inlineDisplay: function inlineDisplay() {
  13708. var t = w.attr("style") || "";return e.isArray(t.match(/display.*?;/, ""));
  13709. } }, set: { animating: function animating(e) {
  13710. var t;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);
  13711. }, duration: function duration(e, t) {
  13712. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({ "animation-duration": t }));
  13713. }, direction: function direction(e) {
  13714. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  13715. }, looping: function looping() {
  13716. C.debug("Transition set to loop"), w.addClass(h.looping);
  13717. }, hidden: function hidden() {
  13718. w.addClass(h.transition).addClass(h.hidden);
  13719. }, inward: function inward() {
  13720. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  13721. }, outward: function outward() {
  13722. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  13723. }, visible: function visible() {
  13724. w.addClass(h.transition).addClass(h.visible);
  13725. } }, start: { animation: function animation(e) {
  13726. 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);
  13727. } }, save: { animation: function animation(e) {
  13728. C.cache || (C.cache = {}), C.cache.animation = e;
  13729. }, displayType: function displayType(e) {
  13730. "none" !== e && w.data(v.displayType, e);
  13731. }, transitionExists: function transitionExists(t, n) {
  13732. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  13733. } }, restore: { conditions: function conditions() {
  13734. var e = C.get.currentAnimation();e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  13735. } }, add: { failSafe: function failSafe() {
  13736. var e = C.get.duration();C.timer = setTimeout(function () {
  13737. w.triggerHandler(b);
  13738. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  13739. } }, remove: { animating: function animating() {
  13740. w.removeClass(h.animating);
  13741. }, animationCallbacks: function animationCallbacks() {
  13742. C.remove.queueCallback(), C.remove.completeCallback();
  13743. }, queueCallback: function queueCallback() {
  13744. w.off(".queue" + x);
  13745. }, completeCallback: function completeCallback() {
  13746. w.off(".complete" + x);
  13747. }, display: function display() {
  13748. w.css("display", "");
  13749. }, direction: function direction() {
  13750. w.removeClass(h.inward).removeClass(h.outward);
  13751. }, duration: function duration() {
  13752. w.css("animation-duration", "");
  13753. }, failSafe: function failSafe() {
  13754. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  13755. }, hidden: function hidden() {
  13756. w.removeClass(h.hidden);
  13757. }, visible: function visible() {
  13758. w.removeClass(h.visible);
  13759. }, looping: function looping() {
  13760. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  13761. }, transition: function transition() {
  13762. w.removeClass(h.visible).removeClass(h.hidden);
  13763. } }, get: { settings: function settings(t, n, i) {
  13764. return "object" == (typeof t === "undefined" ? "undefined" : _typeof(t)) ? e.extend(!0, {}, e.fn.transition.settings, t) : "function" == typeof i ? e.extend({}, e.fn.transition.settings, { animation: t, onComplete: i, duration: n }) : "string" == typeof n || "number" == typeof n ? e.extend({}, e.fn.transition.settings, { animation: t, duration: n }) : "object" == (typeof n === "undefined" ? "undefined" : _typeof(n)) ? e.extend({}, e.fn.transition.settings, n, { animation: t }) : "function" == typeof n ? e.extend({}, e.fn.transition.settings, { animation: t, onComplete: n }) : e.extend({}, e.fn.transition.settings, { animation: t });
  13765. }, animationClass: function animationClass(e) {
  13766. var t = e || m.animation,
  13767. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";return h.animating + " " + h.transition + " " + n + t;
  13768. }, currentAnimation: function currentAnimation() {
  13769. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  13770. }, currentDirection: function currentDirection() {
  13771. return C.is.inward() ? h.inward : h.outward;
  13772. }, direction: function direction() {
  13773. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  13774. }, animationDirection: function animationDirection(t) {
  13775. var n;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13776. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  13777. })), n || !1;
  13778. }, duration: function duration(e) {
  13779. 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;
  13780. }, displayType: function displayType(e) {
  13781. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  13782. }, userStyle: function userStyle(e) {
  13783. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  13784. }, transitionExists: function transitionExists(t) {
  13785. return e.fn.transition.exists[t];
  13786. }, animationStartEvent: function animationStartEvent() {
  13787. var e,
  13788. t = n.createElement("div"),
  13789. o = { animation: "animationstart", OAnimation: "oAnimationStart", MozAnimation: "mozAnimationStart", WebkitAnimation: "webkitAnimationStart" };for (e in o) {
  13790. if (t.style[e] !== i) return o[e];
  13791. }return !1;
  13792. }, animationEndEvent: function animationEndEvent() {
  13793. var e,
  13794. t = n.createElement("div"),
  13795. o = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "mozAnimationEnd", WebkitAnimation: "webkitAnimationEnd" };for (e in o) {
  13796. if (t.style[e] !== i) return o[e];
  13797. }return !1;
  13798. } }, can: { transition: function transition(t) {
  13799. var n,
  13800. o,
  13801. a,
  13802. r,
  13803. s,
  13804. l,
  13805. c = m.animation,
  13806. u = C.get.transitionExists(c),
  13807. d = C.get.displayType(!1);if (u === i || t) {
  13808. 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 {
  13809. if ("none" == r || !r) return void C.debug("No animation defined in css", c);C.debug("Static animation found", c, d), l = !1;
  13810. }C.save.transitionExists(c, l);
  13811. }return u !== i ? u : l;
  13812. }, animate: function animate() {
  13813. return C.can.transition() !== i;
  13814. } }, is: { animating: function animating() {
  13815. return w.hasClass(h.animating);
  13816. }, inward: function inward() {
  13817. return w.hasClass(h.inward);
  13818. }, outward: function outward() {
  13819. return w.hasClass(h.outward);
  13820. }, looping: function looping() {
  13821. return w.hasClass(h.looping);
  13822. }, occurring: function occurring(e) {
  13823. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  13824. }, visible: function visible() {
  13825. return w.is(":visible");
  13826. }, hidden: function hidden() {
  13827. return "hidden" === w.css("visibility");
  13828. }, supported: function supported() {
  13829. return !1 !== b;
  13830. } }, hide: function hide() {
  13831. 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);
  13832. }, show: function show(e) {
  13833. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  13834. }, toggle: function toggle() {
  13835. C.is.visible() ? C.hide() : C.show();
  13836. }, stop: function stop() {
  13837. C.debug("Stopping current animation"), w.triggerHandler(b);
  13838. }, stopAll: function stopAll() {
  13839. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  13840. }, clear: { queue: function queue() {
  13841. C.debug("Clearing animation queue"), C.remove.queueCallback();
  13842. } }, enable: function enable() {
  13843. C.verbose("Starting animation"), w.removeClass(h.disabled);
  13844. }, disable: function disable() {
  13845. C.debug("Stopping animation"), w.addClass(h.disabled);
  13846. }, setting: function setting(t, n) {
  13847. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13848. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13849. }
  13850. }, internal: function internal(t, n) {
  13851. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  13852. if (n === i) return C[t];C[t] = n;
  13853. }
  13854. }, debug: function debug() {
  13855. !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)));
  13856. }, verbose: function verbose() {
  13857. !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)));
  13858. }, error: function error() {
  13859. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  13860. }, performance: { log: function log(e) {
  13861. var t, n;m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: S, "Execution Time": n })), clearTimeout(C.performance.timer), C.performance.timer = setTimeout(C.performance.display, 500);
  13862. }, display: function display() {
  13863. var t = m.name + ":",
  13864. n = 0;s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  13865. n += t["Execution Time"];
  13866. }), 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) {
  13867. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13868. }), console.groupEnd()), l = [];
  13869. } }, invoke: function invoke(t, n, a) {
  13870. var r,
  13871. s,
  13872. l,
  13873. c = g;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) {
  13874. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13875. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);c = c[o];
  13876. }
  13877. })), 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;
  13878. } }).initialize();
  13879. }), o !== i ? o : this;
  13880. }, e.fn.transition.exists = {}, e.fn.transition.settings = { name: "Transition", silent: !1, debug: !1, verbose: !1, performance: !0, namespace: "transition", interval: 0, reverse: "auto", onStart: function onStart() {}, onComplete: function onComplete() {}, onShow: function onShow() {}, onHide: function onHide() {}, useFailSafe: !0, failSafeDelay: 100, allowRepeats: !1, displayType: !1, animation: "fade", duration: !1, queue: !0, metadata: { displayType: "display" }, className: { animating: "animating", disabled: "disabled", hidden: "hidden", inward: "in", loading: "loading", looping: "looping", outward: "out", transition: "transition", visible: "visible" }, error: { noAnimation: "Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.", repeated: "That animation is already occurring, cancelling repeated animation", method: "The method you called is not defined", support: "This browser does not support CSS animations" } };
  13881. }(jQuery, window, document), function (e, t, n, i) {
  13882. "use strict";
  13883. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();e.api = e.fn.api = function (n) {
  13884. var o,
  13885. a = e.isFunction(this) ? e(t) : e(this),
  13886. r = a.selector || "",
  13887. s = new Date().getTime(),
  13888. l = [],
  13889. c = arguments[0],
  13890. u = "string" == typeof c,
  13891. d = [].slice.call(arguments, 1);return a.each(function () {
  13892. var a,
  13893. f,
  13894. m,
  13895. g,
  13896. p,
  13897. h,
  13898. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  13899. b = v.namespace,
  13900. y = v.metadata,
  13901. x = v.selector,
  13902. C = v.error,
  13903. w = v.className,
  13904. S = "." + b,
  13905. k = "module-" + b,
  13906. T = e(this),
  13907. A = T.closest(x.form),
  13908. R = v.stateContext ? e(v.stateContext) : T,
  13909. P = this,
  13910. E = R[0],
  13911. F = T.data(k);h = { initialize: function initialize() {
  13912. u || h.bind.events(), h.instantiate();
  13913. }, instantiate: function instantiate() {
  13914. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  13915. }, destroy: function destroy() {
  13916. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  13917. }, bind: { events: function events() {
  13918. var e = h.get.event();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());
  13919. } }, decode: { json: function json(e) {
  13920. if (e !== i && "string" == typeof e) try {
  13921. e = JSON.parse(e);
  13922. } catch (e) {}return e;
  13923. } }, read: { cachedResponse: function cachedResponse(e) {
  13924. var n;if (t.Storage !== i) return n = sessionStorage.getItem(e), h.debug("Using cached response", e, n), n = h.decode.json(n);h.error(C.noStorage);
  13925. } }, write: { cachedResponse: function cachedResponse(n, o) {
  13926. 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);
  13927. } }, query: function query() {
  13928. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  13929. if (h.is.loading()) {
  13930. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");h.debug("Interrupting previous request"), h.abort();
  13931. }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);if (h.cancelled = !1, (m = h.get.templatedURL()) || h.is.mocked()) {
  13932. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  13933. if (f.url = v.base + m, a = e.extend(!0, {}, v, { type: v.method || v.type, data: g, url: v.base + m, beforeSend: v.beforeXHR, success: function success() {}, failure: function failure() {}, complete: function complete() {} }), 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)]);v.throttle ? v.throttleFirstRequest || h.timer ? (h.debug("Throttling request", v.throttle), clearTimeout(h.timer), h.timer = setTimeout(function () {
  13934. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  13935. }, 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());
  13936. }
  13937. } else h.error(C.missingURL);
  13938. }
  13939. }, should: { removeError: function removeError() {
  13940. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  13941. } }, is: { disabled: function disabled() {
  13942. return T.filter(x.disabled).length > 0;
  13943. }, expectingJSON: function expectingJSON() {
  13944. return "json" === v.dataType || "jsonp" === v.dataType;
  13945. }, form: function form() {
  13946. return T.is("form") || R.is("form");
  13947. }, mocked: function mocked() {
  13948. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  13949. }, input: function input() {
  13950. return T.is("input");
  13951. }, loading: function loading() {
  13952. return !!h.request && "pending" == h.request.state();
  13953. }, abortedRequest: function abortedRequest(e) {
  13954. 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);
  13955. }, validResponse: function validResponse(t) {
  13956. 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);
  13957. } }, was: { cancelled: function cancelled() {
  13958. return h.cancelled || !1;
  13959. }, succesful: function succesful() {
  13960. return h.request && "resolved" == h.request.state();
  13961. }, failure: function failure() {
  13962. return h.request && "rejected" == h.request.state();
  13963. }, complete: function complete() {
  13964. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  13965. } }, add: { urlData: function urlData(t, n) {
  13966. var o, a;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) {
  13967. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  13968. 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];if (s === i) return h.error(C.requiredParameter, r, t), t = !1, !1;h.verbose("Found required variable", r, s), s = v.encodeParameters ? h.get.urlEncodedValue(s) : s, t = t.replace(a, s);
  13969. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  13970. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  13971. 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];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, ""));
  13972. }))), t;
  13973. }, formData: function formData(t) {
  13974. var n = e.fn.serializeObject !== i,
  13975. o = n ? A.serializeObject() : A.serialize();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;
  13976. } }, send: { request: function request() {
  13977. 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);
  13978. } }, event: { trigger: function trigger(e) {
  13979. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  13980. }, xhr: { always: function always() {}, done: function done(t, n, i) {
  13981. var o = this,
  13982. a = new Date().getTime() - p,
  13983. r = v.loadingDuration - a,
  13984. s = !!e.isFunction(v.onResponse) && (h.is.expectingJSON() ? v.onResponse.call(o, e.extend(!0, {}, t)) : v.onResponse.call(o, t));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 () {
  13985. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  13986. }, r);
  13987. }, fail: function fail(e, t, n) {
  13988. var i = this,
  13989. o = new Date().getTime() - p,
  13990. a = v.loadingDuration - o;(a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  13991. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  13992. }, a);
  13993. } }, request: { done: function done(e, t) {
  13994. 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);
  13995. }, complete: function complete(e, t) {
  13996. var n, i;h.was.succesful() ? (i = e, n = t) : (n = e, i = h.get.responseFromXHR(n)), h.remove.loading(), v.onComplete.call(E, i, T, n);
  13997. }, fail: function fail(e, t, n) {
  13998. var o = h.get.responseFromXHR(e),
  13999. r = h.get.errorFromRequest(o, t, n);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;"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);
  14000. } } }, create: { request: function request() {
  14001. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  14002. }, mockedXHR: function mockedXHR() {
  14003. var t,
  14004. n,
  14005. i,
  14006. o = v.mockResponse || v.response,
  14007. a = v.mockResponseAsync || v.responseAsync;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, { responseText: n }])) : e.isFunction(a) && (t = function t(e) {
  14008. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, { responseText: e }]) : i.rejectWith(E, [{ responseText: e }, !1, !1]);
  14009. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  14010. }, xhr: function xhr() {
  14011. var t;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;
  14012. } }, set: { error: function error() {
  14013. h.verbose("Adding error state to element", R), R.addClass(w.error);
  14014. }, loading: function loading() {
  14015. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  14016. } }, remove: { error: function error() {
  14017. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  14018. }, loading: function loading() {
  14019. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  14020. } }, get: { responseFromXHR: function responseFromXHR(t) {
  14021. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  14022. }, errorFromRequest: function errorFromRequest(t, n, o) {
  14023. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  14024. }, request: function request() {
  14025. return h.request || !1;
  14026. }, xhr: function xhr() {
  14027. return h.xhr || !1;
  14028. }, settings: function settings() {
  14029. var t;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);
  14030. }, urlEncodedValue: function urlEncodedValue(e) {
  14031. var n = t.decodeURIComponent(e),
  14032. i = t.encodeURIComponent(e);return n !== e ? (h.debug("URL value is already encoded, avoiding double encoding", e), e) : (h.verbose("Encoding value using encodeURIComponent", e, i), i);
  14033. }, defaultData: function defaultData() {
  14034. var t = {};return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  14035. }, event: function event() {
  14036. 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;
  14037. }, templatedURL: function templatedURL(e) {
  14038. 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;if (e) {
  14039. 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);m = v.api[e];
  14040. } else h.is.form() && (m = T.attr("action") || R.attr("action") || !1, h.debug("No url or action specified, defaulting to form action", m));return m;
  14041. } }, abort: function abort() {
  14042. var e = h.get.xhr();e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  14043. }, reset: function reset() {
  14044. h.remove.error(), h.remove.loading();
  14045. }, setting: function setting(t, n) {
  14046. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  14047. if (n === i) return v[t];e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  14048. }
  14049. }, internal: function internal(t, n) {
  14050. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  14051. if (n === i) return h[t];h[t] = n;
  14052. }
  14053. }, debug: function debug() {
  14054. !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)));
  14055. }, verbose: function verbose() {
  14056. !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)));
  14057. }, error: function error() {
  14058. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  14059. }, performance: { log: function log(e) {
  14060. var t, n;v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", "Execution Time": n })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 500);
  14061. }, display: function display() {
  14062. var t = v.name + ":",
  14063. n = 0;s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  14064. n += t["Execution Time"];
  14065. }), 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) {
  14066. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14067. }), console.groupEnd()), l = [];
  14068. } }, invoke: function invoke(t, n, a) {
  14069. var r,
  14070. s,
  14071. l,
  14072. c = F;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) {
  14073. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14074. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (h.error(C.method, t), !1);c = c[o];
  14075. }
  14076. })), 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;
  14077. } }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  14078. }), o !== i ? o : this;
  14079. }, e.api.settings = { name: "API", namespace: "api", debug: !1, verbose: !1, performance: !0, api: {}, cache: !0, interruptRequests: !0, on: "auto", stateContext: !1, loadingDuration: 0, hideError: "auto", errorDuration: 2e3, encodeParameters: !0, action: !1, url: !1, base: "", urlData: {}, defaultData: !0, serializeForm: !1, throttle: 0, throttleFirstRequest: !0, method: "get", data: {}, dataType: "json", mockResponse: !1, mockResponseAsync: !1, response: !1, responseAsync: !1, beforeSend: function beforeSend(e) {
  14080. return e;
  14081. }, beforeXHR: function beforeXHR(e) {}, onRequest: function onRequest(e, t) {}, onResponse: !1, onSuccess: function onSuccess(e, t) {}, onComplete: function onComplete(e, t) {}, onFailure: function onFailure(e, t) {}, onError: function onError(e, t) {}, onAbort: function onAbort(e, t) {}, successTest: !1, error: { beforeSend: "The before send function has aborted the request", error: "There was an error with your request", exitConditions: "API Request Aborted. Exit conditions met", JSONParse: "JSON could not be parsed during error handling", legacyParameters: "You are using legacy API success callback names", method: "The method you called is not defined", missingAction: "API action used but no url was defined", missingSerialize: "jquery-serialize-object is required to add form data to an existing data object", missingURL: "No URL specified for api event", noReturnedValue: "The beforeSend callback must return a settings object, beforeSend ignored.", noStorage: "Caching responses locally requires session storage", parseError: "There was an error parsing your request", requiredParameter: "Missing a required URL parameter: ", statusMessage: "Server gave an error: ", timeout: "Your request timed out" }, regExp: { required: /\{\$*[A-z0-9]+\}/g, optional: /\{\/\$*[A-z0-9]+\}/g }, className: { loading: "loading", error: "error" }, selector: { disabled: ".disabled", form: "form" }, metadata: { action: "action", url: "url" } };
  14082. }(jQuery, window, document), function (e, t, n, i) {
  14083. "use strict";
  14084. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  14085. var a,
  14086. r = e(this),
  14087. s = r.selector || "",
  14088. l = new Date().getTime(),
  14089. c = [],
  14090. u = arguments[0],
  14091. d = "string" == typeof u,
  14092. f = [].slice.call(arguments, 1),
  14093. m = r.length,
  14094. g = 0;return r.each(function () {
  14095. var r,
  14096. p,
  14097. h,
  14098. v,
  14099. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  14100. y = b.className,
  14101. x = b.namespace,
  14102. C = b.error,
  14103. w = b.metadata,
  14104. S = "." + x,
  14105. k = "module-" + x,
  14106. T = e(t),
  14107. A = e(this),
  14108. R = e(b.context),
  14109. P = (A.selector, A.data(k)),
  14110. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  14111. setTimeout(e, 0);
  14112. },
  14113. F = this,
  14114. O = !1;v = { initialize: function initialize() {
  14115. 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();
  14116. }, instantiate: function instantiate() {
  14117. v.debug("Storing instance", v), A.data(k, v), P = v;
  14118. }, destroy: function destroy() {
  14119. 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);
  14120. }, observeChanges: function observeChanges() {
  14121. "MutationObserver" in t && (p = new MutationObserver(v.event.contextChanged), h = new MutationObserver(v.event.changed), p.observe(n, { childList: !0, subtree: !0 }), h.observe(F, { childList: !0, subtree: !0 }), v.debug("Setting up mutation observer", h));
  14122. }, bind: { events: function events() {
  14123. 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);
  14124. } }, event: { changed: function changed(e) {
  14125. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  14126. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  14127. }, 100);
  14128. }, contextChanged: function contextChanged(t) {
  14129. [].forEach.call(t, function (t) {
  14130. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  14131. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  14132. });
  14133. });
  14134. }, resize: function resize() {
  14135. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  14136. }, load: function load() {
  14137. v.debug("Page finished loading"), E(v.refresh);
  14138. }, scroll: function scroll() {
  14139. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  14140. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14141. }, b.throttle)) : E(function () {
  14142. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14143. });
  14144. }, scrollchange: function scrollchange(e, t) {
  14145. v.checkVisibility(t);
  14146. } }, precache: function precache(t, i) {
  14147. t instanceof Array || (t = [t]);for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  14148. ++a >= t.length && e.isFunction(i) && i();
  14149. }; o--;) {
  14150. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  14151. }
  14152. }, enableCallbacks: function enableCallbacks() {
  14153. v.debug("Allowing callbacks to occur"), O = !1;
  14154. }, disableCallbacks: function disableCallbacks() {
  14155. v.debug("Disabling all callbacks temporarily"), O = !0;
  14156. }, should: { trackChanges: function trackChanges() {
  14157. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  14158. } }, setup: { cache: function cache() {
  14159. v.cache = { occurred: {}, screen: {}, element: {} };
  14160. }, image: function image() {
  14161. var e = A.data(w.src);e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  14162. v.debug("Image on screen", F), v.precache(e, function () {
  14163. v.set.image(e, function () {
  14164. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  14165. });
  14166. });
  14167. });
  14168. }, fixed: function fixed() {
  14169. 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 () {
  14170. 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);
  14171. }, b.onTopPassedReverse = function () {
  14172. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  14173. };
  14174. } }, create: { placeholder: function placeholder() {
  14175. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  14176. } }, show: { placeholder: function placeholder() {
  14177. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  14178. } }, hide: { placeholder: function placeholder() {
  14179. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  14180. } }, set: { fixed: function fixed() {
  14181. v.verbose("Setting element to fixed position"), A.addClass(y.fixed).css({ position: "fixed", top: b.offset + "px", left: "auto", zIndex: b.zIndex }), b.onFixed.call(F);
  14182. }, image: function image(t, n) {
  14183. if (A.attr("src", t), b.transition) {
  14184. if (e.fn.transition !== i) {
  14185. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");A.transition(b.transition, b.duration, n);
  14186. } else A.fadeIn(b.duration, n);
  14187. } else A.show();
  14188. } }, is: { onScreen: function onScreen() {
  14189. return v.get.elementCalculations().onScreen;
  14190. }, offScreen: function offScreen() {
  14191. return v.get.elementCalculations().offScreen;
  14192. }, visible: function visible() {
  14193. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  14194. }, verticallyScrollableContext: function verticallyScrollableContext() {
  14195. var e = R.get(0) !== t && R.css("overflow-y");return "auto" == e || "scroll" == e;
  14196. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  14197. var e = R.get(0) !== t && R.css("overflow-x");return "auto" == e || "scroll" == e;
  14198. } }, refresh: function refresh() {
  14199. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  14200. }, resetFixed: function resetFixed() {
  14201. v.remove.fixed(), v.remove.occurred();
  14202. }, reset: function reset() {
  14203. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  14204. }, checkVisibility: function checkVisibility(e) {
  14205. 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()));
  14206. }, passed: function passed(t, n) {
  14207. var o = v.get.elementCalculations();if (t && n) b.onPassed[t] = n;else {
  14208. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;o.passing && e.each(b.onPassed, function (e, t) {
  14209. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  14210. });
  14211. }
  14212. }, onScreen: function onScreen(e) {
  14213. var t = v.get.elementCalculations(),
  14214. n = e || b.onOnScreen,
  14215. o = "onScreen";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;
  14216. }, offScreen: function offScreen(e) {
  14217. var t = v.get.elementCalculations(),
  14218. n = e || b.onOffScreen,
  14219. o = "offScreen";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;
  14220. }, passing: function passing(e) {
  14221. var t = v.get.elementCalculations(),
  14222. n = e || b.onPassing,
  14223. o = "passing";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;
  14224. }, topVisible: function topVisible(e) {
  14225. var t = v.get.elementCalculations(),
  14226. n = e || b.onTopVisible,
  14227. o = "topVisible";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;
  14228. }, bottomVisible: function bottomVisible(e) {
  14229. var t = v.get.elementCalculations(),
  14230. n = e || b.onBottomVisible,
  14231. o = "bottomVisible";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;
  14232. }, topPassed: function topPassed(e) {
  14233. var t = v.get.elementCalculations(),
  14234. n = e || b.onTopPassed,
  14235. o = "topPassed";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;
  14236. }, bottomPassed: function bottomPassed(e) {
  14237. var t = v.get.elementCalculations(),
  14238. n = e || b.onBottomPassed,
  14239. o = "bottomPassed";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;
  14240. }, passingReverse: function passingReverse(e) {
  14241. var t = v.get.elementCalculations(),
  14242. n = e || b.onPassingReverse,
  14243. o = "passingReverse";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;
  14244. }, topVisibleReverse: function topVisibleReverse(e) {
  14245. var t = v.get.elementCalculations(),
  14246. n = e || b.onTopVisibleReverse,
  14247. o = "topVisibleReverse";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;
  14248. }, bottomVisibleReverse: function bottomVisibleReverse(e) {
  14249. var t = v.get.elementCalculations(),
  14250. n = e || b.onBottomVisibleReverse,
  14251. o = "bottomVisibleReverse";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;
  14252. }, topPassedReverse: function topPassedReverse(e) {
  14253. var t = v.get.elementCalculations(),
  14254. n = e || b.onTopPassedReverse,
  14255. o = "topPassedReverse";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;
  14256. }, bottomPassedReverse: function bottomPassedReverse(e) {
  14257. var t = v.get.elementCalculations(),
  14258. n = e || b.onBottomPassedReverse,
  14259. o = "bottomPassedReverse";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;
  14260. }, execute: function execute(e, t) {
  14261. var n = v.get.elementCalculations(),
  14262. i = v.get.screenCalculations();(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);
  14263. }, remove: { fixed: function fixed() {
  14264. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({ position: "", top: "", left: "", zIndex: "" }), b.onUnfixed.call(F);
  14265. }, placeholder: function placeholder() {
  14266. v.debug("Removing placeholder content"), r && r.remove();
  14267. }, occurred: function occurred(e) {
  14268. if (e) {
  14269. var t = v.cache.occurred;t[e] !== i && !0 === t[e] && (v.debug("Callback can now be called again", e), v.cache.occurred[e] = !1);
  14270. } else v.cache.occurred = {};
  14271. } }, save: { calculations: function calculations() {
  14272. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  14273. }, occurred: function occurred(e) {
  14274. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  14275. }, scroll: function scroll(e) {
  14276. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  14277. }, direction: function direction() {
  14278. var e,
  14279. t = v.get.scroll(),
  14280. n = v.get.lastScroll();return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  14281. }, elementPosition: function elementPosition() {
  14282. var e = v.cache.element,
  14283. t = v.get.screenSize();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;
  14284. }, elementCalculations: function elementCalculations() {
  14285. var e = v.get.screenCalculations(),
  14286. t = v.get.elementPosition();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;
  14287. }, screenCalculations: function screenCalculations() {
  14288. var e = v.get.scroll();return v.save.direction(), v.cache.screen.top = e, v.cache.screen.bottom = e + v.cache.screen.height, v.cache.screen;
  14289. }, screenSize: function screenSize() {
  14290. v.verbose("Saving window position"), v.cache.screen = { height: R.height() };
  14291. }, position: function position() {
  14292. v.save.screenSize(), v.save.elementPosition();
  14293. } }, get: { pixelsPassed: function pixelsPassed(e) {
  14294. var t = v.get.elementCalculations();return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  14295. }, occurred: function occurred(e) {
  14296. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  14297. }, direction: function direction() {
  14298. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  14299. }, elementPosition: function elementPosition() {
  14300. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  14301. }, elementCalculations: function elementCalculations() {
  14302. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  14303. }, screenCalculations: function screenCalculations() {
  14304. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  14305. }, screenSize: function screenSize() {
  14306. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  14307. }, scroll: function scroll() {
  14308. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  14309. }, lastScroll: function lastScroll() {
  14310. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  14311. } }, setting: function setting(t, n) {
  14312. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  14313. if (n === i) return b[t];b[t] = n;
  14314. }
  14315. }, internal: function internal(t, n) {
  14316. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  14317. if (n === i) return v[t];v[t] = n;
  14318. }
  14319. }, debug: function debug() {
  14320. !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)));
  14321. }, verbose: function verbose() {
  14322. !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)));
  14323. }, error: function error() {
  14324. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  14325. }, performance: { log: function log(e) {
  14326. var t, n;b.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({ Name: e[0], Arguments: [].slice.call(e, 1) || "", Element: F, "Execution Time": n })), clearTimeout(v.performance.timer), v.performance.timer = setTimeout(v.performance.display, 500);
  14327. }, display: function display() {
  14328. var t = b.name + ":",
  14329. n = 0;l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  14330. n += t["Execution Time"];
  14331. }), 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) {
  14332. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14333. }), console.groupEnd()), c = [];
  14334. } }, invoke: function invoke(t, n, o) {
  14335. var r,
  14336. s,
  14337. l,
  14338. c = P;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) {
  14339. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14340. if (c[a] !== i) return s = c[a], !1;if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (v.error(C.method, t), !1);c = c[o];
  14341. }
  14342. })), 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;
  14343. } }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  14344. }), a !== i ? a : this;
  14345. }, e.fn.visibility.settings = { name: "Visibility", namespace: "visibility", debug: !1, verbose: !1, performance: !0, observeChanges: !0, initialCheck: !0, refreshOnLoad: !0, refreshOnResize: !0, checkOnRefresh: !0, once: !0, continuous: !1, offset: 0, includeMargin: !1, context: t, throttle: !1, type: !1, zIndex: "10", transition: "fade in", duration: 1e3, onPassed: {}, onOnScreen: !1, onOffScreen: !1, onPassing: !1, onTopVisible: !1, onBottomVisible: !1, onTopPassed: !1, onBottomPassed: !1, onPassingReverse: !1, onTopVisibleReverse: !1, onBottomVisibleReverse: !1, onTopPassedReverse: !1, onBottomPassedReverse: !1, onLoad: function onLoad() {}, onAllLoaded: function onAllLoaded() {}, onFixed: function onFixed() {}, onUnfixed: function onUnfixed() {}, onUpdate: !1, onRefresh: function onRefresh() {}, metadata: { src: "src" }, className: { fixed: "fixed", placeholder: "placeholder", visible: "visible" }, error: { method: "The method you called is not defined.", visible: "Element is hidden, you must call refresh after element becomes visible" } };
  14346. }(jQuery, window, document);
  14347. /***/ }),
  14348. /***/ "./js/services/languageService.js":
  14349. /*!****************************************!*\
  14350. !*** ./js/services/languageService.js ***!
  14351. \****************************************/
  14352. /*! no static exports found */
  14353. /***/ (function(module, exports, __webpack_require__) {
  14354. "use strict";
  14355. Object.defineProperty(exports, "__esModule", {
  14356. value: true
  14357. });
  14358. exports.LanguageService = undefined;
  14359. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14360. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  14361. var _grammar2 = _interopRequireDefault(_grammar);
  14362. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14363. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14364. var _config = __webpack_require__(/*! ./../util/config */ "./js/util/config.js");
  14365. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14366. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14367. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14368. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14369. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  14370. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  14371. function LanguageServiceExtended() {
  14372. _classCallCheck(this, LanguageServiceExtended);
  14373. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, typeof iLMparameters === 'undefined' ? _config.Config.default_lang : iLMparameters.lang));
  14374. }
  14375. _createClass(LanguageServiceExtended, [{
  14376. key: 'getCurrentLexer',
  14377. value: function getCurrentLexer() {
  14378. var langInfo = _grammar2.default[this.getLang()];
  14379. if (langInfo === null || langInfo === undefined) {
  14380. return _grammar2.default[this.getDefaultLang()].lexer;
  14381. } else {
  14382. return langInfo.lexer;
  14383. }
  14384. }
  14385. }, {
  14386. key: 'getCurrentLangFuncs',
  14387. value: function getCurrentLangFuncs() {
  14388. var langInfo = _grammar2.default[this.getLang()];
  14389. if (langInfo === null || langInfo === undefined) {
  14390. return _grammar2.default[this.getDefaultLang()].langFuncs;
  14391. } else {
  14392. return langInfo.langFuncs;
  14393. }
  14394. }
  14395. }, {
  14396. key: 'getCurrentLangLibs',
  14397. value: function getCurrentLangLibs() {
  14398. var langInfo = _grammar2.default[this.getLang()];
  14399. if (langInfo === null || langInfo === undefined) {
  14400. return _grammar2.default[this.getDefaultLang()].langLibs;
  14401. }
  14402. return langInfo.langLibs;
  14403. }
  14404. }]);
  14405. return LanguageServiceExtended;
  14406. }(_lineI18n2.default.LanguageServiceNoLS);
  14407. var LanguageService = exports.LanguageService = new LanguageServiceExtended();
  14408. /***/ }),
  14409. /***/ "./js/services/localizedStringsService.js":
  14410. /*!************************************************!*\
  14411. !*** ./js/services/localizedStringsService.js ***!
  14412. \************************************************/
  14413. /*! no static exports found */
  14414. /***/ (function(module, exports, __webpack_require__) {
  14415. "use strict";
  14416. Object.defineProperty(exports, "__esModule", {
  14417. value: true
  14418. });
  14419. exports.LocalizedStrings = undefined;
  14420. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  14421. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14422. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14423. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  14424. var _i18n2 = _interopRequireDefault(_i18n);
  14425. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14426. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  14427. /***/ }),
  14428. /***/ "./js/typeSystem/baseTypes.js":
  14429. /*!************************************!*\
  14430. !*** ./js/typeSystem/baseTypes.js ***!
  14431. \************************************/
  14432. /*! no static exports found */
  14433. /***/ (function(module, exports, __webpack_require__) {
  14434. "use strict";
  14435. Object.defineProperty(exports, "__esModule", {
  14436. value: true
  14437. });
  14438. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14439. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14440. var BaseType = function () {
  14441. function BaseType(name, ord) {
  14442. _classCallCheck(this, BaseType);
  14443. this.name = name;
  14444. this.ord = ord;
  14445. }
  14446. _createClass(BaseType, [{
  14447. key: "isCompatible",
  14448. value: function isCompatible(another) {
  14449. if (another instanceof BaseType) {
  14450. return this.name === another.name && this.ord === another.ord;
  14451. }
  14452. return false;
  14453. }
  14454. }, {
  14455. key: "value",
  14456. get: function get() {
  14457. return this.name;
  14458. }
  14459. }]);
  14460. return BaseType;
  14461. }();
  14462. // Base types names are the same as i18n ui type keys
  14463. var BaseTypes = exports.BaseTypes = Object.freeze({
  14464. INTEGER: new BaseType("integer", 0),
  14465. REAL: new BaseType("real", 1),
  14466. STRING: new BaseType("text", 2),
  14467. BOOLEAN: new BaseType("boolean", 3),
  14468. VOID: new BaseType("void", 4),
  14469. UNDEFINED: new BaseType("undefined", 5)
  14470. });
  14471. /***/ }),
  14472. /***/ "./js/typeSystem/compoundType.js":
  14473. /*!***************************************!*\
  14474. !*** ./js/typeSystem/compoundType.js ***!
  14475. \***************************************/
  14476. /*! no static exports found */
  14477. /***/ (function(module, exports, __webpack_require__) {
  14478. "use strict";
  14479. Object.defineProperty(exports, "__esModule", {
  14480. value: true
  14481. });
  14482. exports.CompoundType = undefined;
  14483. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14484. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14485. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14486. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14487. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14488. var CompoundType = exports.CompoundType = function (_Type) {
  14489. _inherits(CompoundType, _Type);
  14490. function CompoundType(type, dimensions) {
  14491. _classCallCheck(this, CompoundType);
  14492. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  14493. _this.innerType = type;
  14494. _this.dimensions = dimensions;
  14495. return _this;
  14496. }
  14497. _createClass(CompoundType, [{
  14498. key: "isCompatible",
  14499. value: function isCompatible(another) {
  14500. if (another instanceof CompoundType) {
  14501. if (this.dimensions !== another.dimensions) {
  14502. return false;
  14503. }
  14504. return this.innerType.isCompatible(another.innerType);
  14505. }
  14506. return false;
  14507. }
  14508. }, {
  14509. key: "stringInfo",
  14510. value: function stringInfo() {
  14511. var _this2 = this;
  14512. var list = this.innerType.stringInfo();
  14513. list.forEach(function (v) {
  14514. v.dim = _this2.dimensions;
  14515. });
  14516. return list;
  14517. }
  14518. }, {
  14519. key: "canAccept",
  14520. value: function canAccept(another) {
  14521. if (another instanceof CompoundType) {
  14522. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  14523. } else {
  14524. return this.innerType.isCompatible(another);
  14525. }
  14526. }
  14527. }]);
  14528. return CompoundType;
  14529. }(_type.Type);
  14530. /***/ }),
  14531. /***/ "./js/typeSystem/multiType.js":
  14532. /*!************************************!*\
  14533. !*** ./js/typeSystem/multiType.js ***!
  14534. \************************************/
  14535. /*! no static exports found */
  14536. /***/ (function(module, exports, __webpack_require__) {
  14537. "use strict";
  14538. Object.defineProperty(exports, "__esModule", {
  14539. value: true
  14540. });
  14541. exports.MultiType = undefined;
  14542. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14543. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14544. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14545. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14546. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14547. var MultiType = exports.MultiType = function (_Type) {
  14548. _inherits(MultiType, _Type);
  14549. function MultiType(types) {
  14550. _classCallCheck(this, MultiType);
  14551. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  14552. _this.types = types;
  14553. return _this;
  14554. }
  14555. _createClass(MultiType, [{
  14556. key: "stringInfo",
  14557. value: function stringInfo() {
  14558. var list = [];
  14559. for (var i = 0; i < this.types.length; i++) {
  14560. var t = this.types[i];
  14561. list = list.concat(t.stringInfo());
  14562. }
  14563. return list;
  14564. }
  14565. }, {
  14566. key: "isCompatible",
  14567. value: function isCompatible(another) {
  14568. if (another instanceof _type.Type) {
  14569. for (var i = 0; i < this.types.length; i++) {
  14570. var t = this.types[i];
  14571. if (another.isCompatible(t)) {
  14572. return true;
  14573. }
  14574. }
  14575. }
  14576. return false;
  14577. }
  14578. }, {
  14579. key: "value",
  14580. get: function get() {
  14581. return null;
  14582. }
  14583. }, {
  14584. key: "ord",
  14585. get: function get() {
  14586. return null;
  14587. }
  14588. }]);
  14589. return MultiType;
  14590. }(_type.Type);
  14591. /***/ }),
  14592. /***/ "./js/typeSystem/parsers.js":
  14593. /*!**********************************!*\
  14594. !*** ./js/typeSystem/parsers.js ***!
  14595. \**********************************/
  14596. /*! no static exports found */
  14597. /***/ (function(module, exports, __webpack_require__) {
  14598. "use strict";
  14599. Object.defineProperty(exports, "__esModule", {
  14600. value: true
  14601. });
  14602. exports.toInt = toInt;
  14603. exports.toString = toString;
  14604. exports.toReal = toReal;
  14605. exports.toBool = toBool;
  14606. exports.convertToString = convertToString;
  14607. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14608. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  14609. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  14610. var _decimal2 = _interopRequireDefault(_decimal);
  14611. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14612. function toInt(str) {
  14613. return new _decimal2.default(str);
  14614. }
  14615. function toString(str) {
  14616. var value = str.replace(/^"/, '');
  14617. value = value.replace(/"$/, '');
  14618. value = value.replace(/\\b/g, "\b");
  14619. value = value.replace(/\\t/g, "\t");
  14620. value = value.replace(/\\n/g, "\n");
  14621. value = value.replace(/\\r/g, "\r");
  14622. value = value.replace(/\\\"/g, "\"");
  14623. value = value.replace(/\\\'/g, "\'");
  14624. value = value.replace(/\\\\/g, "\\");
  14625. return value;
  14626. }
  14627. function toReal(value) {
  14628. return new _decimal2.default(value);
  14629. }
  14630. function toBool(str) {
  14631. var val = "'" + str + "'";
  14632. var lexer = _languageService.LanguageService.getCurrentLexer();
  14633. var instance = new lexer(null);
  14634. if (instance.literalNames[lexer.RK_TRUE] === val) {
  14635. return true;
  14636. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  14637. return false;
  14638. } else {
  14639. // TODO: better error message
  14640. throw new Error(str + "not a valid boolean");
  14641. }
  14642. }
  14643. function convertBoolToString(bool) {
  14644. var lexer = _languageService.LanguageService.getCurrentLexer();
  14645. var instance = new lexer(null);
  14646. if (bool) {
  14647. return instance.literalNames[lexer.RK_TRUE];
  14648. } else {
  14649. return instance.literalNames[lexer.RK_FALSE];
  14650. }
  14651. }
  14652. function convertToString(value, type) {
  14653. switch (type.ord) {
  14654. case _types.Types.INTEGER.ord:
  14655. return value.toString();
  14656. case _types.Types.REAL.ord:
  14657. {
  14658. if (value.dp() <= 0) {
  14659. return value.toFixed(1);
  14660. } else {
  14661. return value.toNumber();
  14662. }
  14663. }
  14664. case _types.Types.BOOLEAN.ord:
  14665. return convertBoolToString(value);
  14666. default:
  14667. return value;
  14668. }
  14669. }
  14670. /***/ }),
  14671. /***/ "./js/typeSystem/type.js":
  14672. /*!*******************************!*\
  14673. !*** ./js/typeSystem/type.js ***!
  14674. \*******************************/
  14675. /*! no static exports found */
  14676. /***/ (function(module, exports, __webpack_require__) {
  14677. "use strict";
  14678. Object.defineProperty(exports, "__esModule", {
  14679. value: true
  14680. });
  14681. exports.Type = undefined;
  14682. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14683. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  14684. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14685. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14686. var Type = exports.Type = function () {
  14687. function Type(baseType) {
  14688. _classCallCheck(this, Type);
  14689. this.baseType = baseType;
  14690. }
  14691. _createClass(Type, [{
  14692. key: "stringInfo",
  14693. value: function stringInfo() {
  14694. return [{ type: this.baseType.name, dim: 0 }];
  14695. }
  14696. }, {
  14697. key: "isCompatible",
  14698. value: function isCompatible(another) {
  14699. if (another instanceof Type) {
  14700. return this.baseType.isCompatible(another.baseType);
  14701. }
  14702. return false;
  14703. }
  14704. }, {
  14705. key: "value",
  14706. get: function get() {
  14707. return this.baseType.value;
  14708. }
  14709. }, {
  14710. key: "ord",
  14711. get: function get() {
  14712. return this.baseType.ord;
  14713. }
  14714. }]);
  14715. return Type;
  14716. }();
  14717. /***/ }),
  14718. /***/ "./js/typeSystem/types.js":
  14719. /*!********************************!*\
  14720. !*** ./js/typeSystem/types.js ***!
  14721. \********************************/
  14722. /*! no static exports found */
  14723. /***/ (function(module, exports, __webpack_require__) {
  14724. "use strict";
  14725. Object.defineProperty(exports, "__esModule", {
  14726. value: true
  14727. });
  14728. exports.Types = undefined;
  14729. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14730. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14731. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  14732. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  14733. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  14734. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  14735. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  14736. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  14737. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  14738. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  14739. var Types = exports.Types = Object.freeze({
  14740. INTEGER: INTEGER,
  14741. REAL: REAL,
  14742. STRING: STRING,
  14743. BOOLEAN: BOOLEAN,
  14744. VOID: VOID,
  14745. UNDEFINED: UNDEFINED,
  14746. ALL: ALL
  14747. });
  14748. /***/ }),
  14749. /***/ "./js/util/config.js":
  14750. /*!***************************!*\
  14751. !*** ./js/util/config.js ***!
  14752. \***************************/
  14753. /*! no static exports found */
  14754. /***/ (function(module, exports, __webpack_require__) {
  14755. "use strict";
  14756. Object.defineProperty(exports, "__esModule", {
  14757. value: true
  14758. });
  14759. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14760. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14761. var ConfigObject = function () {
  14762. function ConfigObject() {
  14763. _classCallCheck(this, ConfigObject);
  14764. this.loopTimeout = 5000;
  14765. this.decimalPlaces = 5;
  14766. this.intConvertRoundMode = 2;
  14767. this.default_lang = 'pt';
  14768. this.enable_type_casting = true;
  14769. }
  14770. _createClass(ConfigObject, [{
  14771. key: 'setConfig',
  14772. value: function setConfig(opts) {
  14773. for (var key in opts) {
  14774. if (this.hasOwnProperty(key)) {
  14775. this[key] = opts[key];
  14776. }
  14777. }
  14778. }
  14779. }]);
  14780. return ConfigObject;
  14781. }();
  14782. var config = new ConfigObject();
  14783. var Config = exports.Config = config;
  14784. /***/ }),
  14785. /***/ "./js/util/inputTest.js":
  14786. /*!******************************!*\
  14787. !*** ./js/util/inputTest.js ***!
  14788. \******************************/
  14789. /*! no static exports found */
  14790. /***/ (function(module, exports, __webpack_require__) {
  14791. "use strict";
  14792. Object.defineProperty(exports, "__esModule", {
  14793. value: true
  14794. });
  14795. exports.InputTest = undefined;
  14796. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14797. var _input = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  14798. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14799. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14800. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14801. var InputTest = exports.InputTest = function (_Input) {
  14802. _inherits(InputTest, _Input);
  14803. function InputTest(inputList) {
  14804. _classCallCheck(this, InputTest);
  14805. var _this = _possibleConstructorReturn(this, (InputTest.__proto__ || Object.getPrototypeOf(InputTest)).call(this));
  14806. _this.index = 0;
  14807. _this.inputList = inputList;
  14808. return _this;
  14809. }
  14810. _createClass(InputTest, [{
  14811. key: 'requestInput',
  14812. value: function requestInput(callback) {
  14813. if (this.index < this.inputList.length) {
  14814. callback(this.inputList[this.index]);
  14815. this.index++;
  14816. } else {
  14817. throw new Error('The amount of requests exceeded the amount of available inputs');
  14818. }
  14819. }
  14820. }]);
  14821. return InputTest;
  14822. }(_input.Input);
  14823. /***/ }),
  14824. /***/ "./js/util/outputTest.js":
  14825. /*!*******************************!*\
  14826. !*** ./js/util/outputTest.js ***!
  14827. \*******************************/
  14828. /*! no static exports found */
  14829. /***/ (function(module, exports, __webpack_require__) {
  14830. "use strict";
  14831. Object.defineProperty(exports, "__esModule", {
  14832. value: true
  14833. });
  14834. exports.OutputTest = undefined;
  14835. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  14836. var _output = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  14837. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14838. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  14839. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  14840. var OutputTest = exports.OutputTest = function (_Output) {
  14841. _inherits(OutputTest, _Output);
  14842. function OutputTest() {
  14843. _classCallCheck(this, OutputTest);
  14844. var _this = _possibleConstructorReturn(this, (OutputTest.__proto__ || Object.getPrototypeOf(OutputTest)).call(this));
  14845. _this.list = [];
  14846. return _this;
  14847. }
  14848. _createClass(OutputTest, [{
  14849. key: 'sendOutput',
  14850. value: function sendOutput(text) {
  14851. this.list.push(text);
  14852. }
  14853. }]);
  14854. return OutputTest;
  14855. }(_output.Output);
  14856. /***/ }),
  14857. /***/ "./js/visualUI/algorithm_sidebar.js":
  14858. /*!******************************************!*\
  14859. !*** ./js/visualUI/algorithm_sidebar.js ***!
  14860. \******************************************/
  14861. /*! no static exports found */
  14862. /***/ (function(module, exports, __webpack_require__) {
  14863. "use strict";
  14864. Object.defineProperty(exports, "__esModule", {
  14865. value: true
  14866. });
  14867. exports.renderAlgorithm = renderAlgorithm;
  14868. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14869. var _jquery2 = _interopRequireDefault(_jquery);
  14870. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14871. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14872. var Models = _interopRequireWildcard(_ivprog_elements);
  14873. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14874. var _globals_sidebar = __webpack_require__(/*! ./globals_sidebar */ "./js/visualUI/globals_sidebar.js");
  14875. var GlobalsManagement = _interopRequireWildcard(_globals_sidebar);
  14876. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14877. var VariablesManagement = _interopRequireWildcard(_variables);
  14878. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14879. var CommandsManagement = _interopRequireWildcard(_commands);
  14880. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  14881. var CodeManagement = _interopRequireWildcard(_code_generator);
  14882. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14883. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14884. var _functions_sidebar = __webpack_require__(/*! ./functions_sidebar */ "./js/visualUI/functions_sidebar.js");
  14885. var FunctionsManagement = _interopRequireWildcard(_functions_sidebar);
  14886. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  14887. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  14888. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  14889. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14890. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14891. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14892. window.block_render = false;
  14893. function renderAlgorithm() {
  14894. if (window.block_render) {
  14895. return;
  14896. }
  14897. window.block_render = true;
  14898. (0, _jquery2.default)('.all_functions').children().off();
  14899. (0, _jquery2.default)('.all_functions').empty();
  14900. (0, _jquery2.default)('.functions_labels').children().off();
  14901. (0, _jquery2.default)('.functions_labels').empty();
  14902. (0, _jquery2.default)('.list_globals').children().off();
  14903. (0, _jquery2.default)('.list_globals').empty();
  14904. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14905. FunctionsManagement.renderFunction(window.program_obj.functions[i]);
  14906. }
  14907. for (var i = 0; i < window.program_obj.globals.length; i++) {
  14908. GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
  14909. }
  14910. setTimeout(function () {
  14911. block_render = false;
  14912. }, 500);
  14913. }
  14914. /***/ }),
  14915. /***/ "./js/visualUI/code_generator.js":
  14916. /*!***************************************!*\
  14917. !*** ./js/visualUI/code_generator.js ***!
  14918. \***************************************/
  14919. /*! no static exports found */
  14920. /***/ (function(module, exports, __webpack_require__) {
  14921. "use strict";
  14922. Object.defineProperty(exports, "__esModule", {
  14923. value: true
  14924. });
  14925. exports.generate = generate;
  14926. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14927. var _jquery2 = _interopRequireDefault(_jquery);
  14928. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14929. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14930. var Models = _interopRequireWildcard(_ivprog_elements);
  14931. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14932. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14933. var GlobalsManagement = _interopRequireWildcard(_globals);
  14934. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14935. var VariablesManagement = _interopRequireWildcard(_variables);
  14936. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14937. var CommandsManagement = _interopRequireWildcard(_commands);
  14938. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  14939. var Utils = _interopRequireWildcard(_utils);
  14940. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  14941. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14942. function generate() {
  14943. (0, _jquery2.default)('.ivprog_visual_panel').find('.error_icon').remove();
  14944. var code = _localizedStringsService.LocalizedStrings.getUI('program') + ' { ';
  14945. code += globalsCode();
  14946. code += '\n';
  14947. var has_error = false;
  14948. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14949. var n_code = functionsCode(window.program_obj.functions[i]);
  14950. if (n_code == null) {
  14951. has_error = true;
  14952. }
  14953. code += n_code;
  14954. code += '\n';
  14955. }
  14956. code += '\n}';
  14957. if (has_error) {
  14958. return null;
  14959. } else {
  14960. return code;
  14961. }
  14962. }
  14963. function functionsCode(function_obj) {
  14964. var ret = '\n\t' + _localizedStringsService.LocalizedStrings.getUI('function') + ' ';
  14965. var has_error = false;
  14966. switch (function_obj.return_type) {
  14967. case _types.Types.INTEGER:
  14968. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  14969. break;
  14970. case _types.Types.REAL:
  14971. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  14972. break;
  14973. case _types.Types.TEXT:
  14974. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  14975. break;
  14976. case _types.Types.BOOLEAN:
  14977. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  14978. break;
  14979. case _types.Types.VOID:
  14980. ret += _localizedStringsService.LocalizedStrings.getUI('void');
  14981. break;
  14982. }
  14983. ret += ' ';
  14984. if (function_obj.return_dimensions == 1) {
  14985. ret += '[] ';
  14986. } else if (function_obj.return_dimensions == 2) {
  14987. ret += '[][] ';
  14988. }
  14989. ret += function_obj.name + ' ( ';
  14990. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  14991. ret += parametersCode(function_obj.parameters_list[j]);
  14992. if (j + 1 < function_obj.parameters_list.length) {
  14993. ret += ',';
  14994. }
  14995. }
  14996. ret += ' ) {';
  14997. for (var j = 0; j < function_obj.variables_list.length; j++) {
  14998. ret += variablesCode(function_obj.variables_list[j]);
  14999. }
  15000. for (var j = 0; j < function_obj.commands.length; j++) {
  15001. try {
  15002. ret += commandsCode(function_obj.commands[j]);
  15003. } catch (err) {
  15004. has_error = true;
  15005. console.error(err.message);
  15006. var todos = (0, _jquery2.default)('body').find('.command_container');
  15007. for (var i = 0; i < todos.length; i++) {
  15008. if ((0, _jquery2.default)(todos[i]).data('command') == function_obj.commands[j]) {
  15009. (0, _jquery2.default)(todos[i]).prepend(' <i class="ui icon red exclamation triangle error_icon"></i> ');
  15010. break;
  15011. }
  15012. }
  15013. }
  15014. }
  15015. ret += '\n\t}';
  15016. if (has_error) {
  15017. return null;
  15018. } else {
  15019. return ret;
  15020. }
  15021. }
  15022. function commandsCode(command_obj) {
  15023. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  15024. switch (command_obj.type) {
  15025. case Models.COMMAND_TYPES.break:
  15026. return breaksCode(command_obj, indentation);
  15027. case Models.COMMAND_TYPES.comment:
  15028. return commentsCode(command_obj, indentation);
  15029. case Models.COMMAND_TYPES.reader:
  15030. return readersCode(command_obj, indentation);
  15031. case Models.COMMAND_TYPES.writer:
  15032. return writersCode(command_obj, indentation);
  15033. case Models.COMMAND_TYPES.functioncall:
  15034. return functioncallsCode(command_obj, indentation);
  15035. case Models.COMMAND_TYPES.attribution:
  15036. return attributionsCode(command_obj, indentation);
  15037. case Models.COMMAND_TYPES.whiletrue:
  15038. return whiletruesCode(command_obj, indentation);
  15039. case Models.COMMAND_TYPES.dowhiletrue:
  15040. return doWhilesCode(command_obj, indentation);
  15041. case Models.COMMAND_TYPES.iftrue:
  15042. return iftruesCode(command_obj, indentation);
  15043. case Models.COMMAND_TYPES.repeatNtimes:
  15044. return repeatNtimesCode(command_obj, indentation);
  15045. case Models.COMMAND_TYPES.switch:
  15046. return switchsCode(command_obj, indentation);
  15047. case Models.COMMAND_TYPES.return:
  15048. return returnsCode(command_obj, indentation);
  15049. }
  15050. }
  15051. function returnsCode(command_obj, indentation) {
  15052. var ret = '\n';
  15053. for (var i = 0; i < indentation; i++) {
  15054. ret += '\t';
  15055. }
  15056. ret += _localizedStringsService.LocalizedStrings.getUI('text_return');
  15057. if (command_obj.variable_value_menu) {
  15058. try {
  15059. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
  15060. } catch (err) {}
  15061. }
  15062. return ret;
  15063. }
  15064. function breaksCode(command_obj, indentation) {
  15065. var ret = '\n';
  15066. for (var i = 0; i < indentation; i++) {
  15067. ret += '\t';
  15068. }
  15069. ret += _localizedStringsService.LocalizedStrings.getUI('text_break');
  15070. return ret;
  15071. }
  15072. function switchsCode(command_obj, indentation) {
  15073. var ret = '\n';
  15074. for (var i = 0; i < indentation; i++) {
  15075. ret += '\t';
  15076. }
  15077. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( ';
  15078. ret += variableValueMenuCode(command_obj.variable);
  15079. ret += ' ) { ';
  15080. if (command_obj.cases) {
  15081. for (var i = 0; i < command_obj.cases.length; i++) {
  15082. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  15083. }
  15084. }
  15085. ret += '\n';
  15086. for (var i = 0; i < indentation; i++) {
  15087. ret += '\t';
  15088. }
  15089. ret += '} ';
  15090. return ret;
  15091. }
  15092. function switchcasesCode(switchcase, indentation) {
  15093. var ret = '\n';
  15094. for (var i = 0; i < indentation; i++) {
  15095. ret += '\t';
  15096. }
  15097. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' ';
  15098. ret += variableValueMenuCode(switchcase.variable_value_menu);
  15099. ret += ' :';
  15100. if (switchcase.commands_block) {
  15101. for (var i = 0; i < switchcase.commands_block.length; i++) {
  15102. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  15103. }
  15104. }
  15105. return ret;
  15106. }
  15107. function repeatNtimesCode(command_obj, indentation) {
  15108. var ret = '\n';
  15109. for (var i = 0; i < indentation; i++) {
  15110. ret += '\t';
  15111. }
  15112. ret += _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( ';
  15113. if (command_obj.var_attribution) {
  15114. ret += variableValueMenuCode(command_obj.var_attribution);
  15115. ret += ' = ';
  15116. ret += variableValueMenuCode(command_obj.expression1);
  15117. }
  15118. ret += ' ; ';
  15119. if (command_obj.expression2) {
  15120. switch (command_obj.expression2.expression.type) {
  15121. case Models.EXPRESSION_TYPES.exp_logic:
  15122. ret += logicExpressionCode(command_obj.expression2.expression);
  15123. break;
  15124. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15125. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  15126. break;
  15127. }
  15128. }
  15129. ret += ' ; ';
  15130. if (command_obj.var_incrementation) {
  15131. ret += variableValueMenuCode(command_obj.var_incrementation);
  15132. ret += ' = ';
  15133. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  15134. switch (command_obj.expression3.itens[1]) {
  15135. case Models.ARITHMETIC_TYPES.plus:
  15136. ret += ' + ';
  15137. break;
  15138. case Models.ARITHMETIC_TYPES.minus:
  15139. ret += ' - ';
  15140. break;
  15141. case Models.ARITHMETIC_TYPES.multiplication:
  15142. ret += ' * ';
  15143. break;
  15144. case Models.ARITHMETIC_TYPES.division:
  15145. ret += ' / ';
  15146. break;
  15147. case Models.ARITHMETIC_TYPES.module:
  15148. ret += ' % ';
  15149. break;
  15150. }
  15151. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  15152. }
  15153. ret += ' ) { ';
  15154. if (command_obj.commands_block) {
  15155. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15156. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15157. }
  15158. }
  15159. ret += '\n';
  15160. for (var i = 0; i < indentation; i++) {
  15161. ret += '\t';
  15162. }
  15163. ret += '}';
  15164. return ret;
  15165. }
  15166. function iftruesCode(command_obj, indentation) {
  15167. var ret = '\n';
  15168. for (var i = 0; i < indentation; i++) {
  15169. ret += '\t';
  15170. }
  15171. ret += _localizedStringsService.LocalizedStrings.getUI('text_if');
  15172. if (!command_obj.expression.expression) {
  15173. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15174. }
  15175. switch (command_obj.expression.expression.type) {
  15176. case Models.EXPRESSION_TYPES.exp_logic:
  15177. ret += logicExpressionCode(command_obj.expression.expression);
  15178. break;
  15179. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15180. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15181. break;
  15182. }
  15183. ret += ' { ';
  15184. if (command_obj.commands_block) {
  15185. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15186. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15187. }
  15188. }
  15189. ret += '\n';
  15190. for (var i = 0; i < indentation; i++) {
  15191. ret += '\t';
  15192. }
  15193. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' {';
  15194. if (command_obj.commands_else) {
  15195. for (var i = 0; i < command_obj.commands_else.length; i++) {
  15196. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  15197. }
  15198. }
  15199. ret += '\n';
  15200. for (var i = 0; i < indentation; i++) {
  15201. ret += '\t';
  15202. }
  15203. ret += '}';
  15204. return ret;
  15205. }
  15206. function doWhilesCode(command_obj, indentation) {
  15207. var ret = '\n';
  15208. for (var i = 0; i < indentation; i++) {
  15209. ret += '\t';
  15210. }
  15211. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' { ';
  15212. if (command_obj.commands_block) {
  15213. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15214. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15215. }
  15216. }
  15217. ret += '\n';
  15218. for (var i = 0; i < indentation; i++) {
  15219. ret += '\t';
  15220. }
  15221. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15222. if (!command_obj.expression.expression) {
  15223. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15224. }
  15225. switch (command_obj.expression.expression.type) {
  15226. case Models.EXPRESSION_TYPES.exp_logic:
  15227. ret += logicExpressionCode(command_obj.expression.expression);
  15228. break;
  15229. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15230. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15231. break;
  15232. }
  15233. return ret;
  15234. }
  15235. function whiletruesCode(command_obj, indentation) {
  15236. var ret = '\n';
  15237. for (var i = 0; i < indentation; i++) {
  15238. ret += '\t';
  15239. }
  15240. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15241. if (!command_obj.expression.expression) {
  15242. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15243. }
  15244. switch (command_obj.expression.expression.type) {
  15245. case Models.EXPRESSION_TYPES.exp_logic:
  15246. ret += logicExpressionCode(command_obj.expression.expression);
  15247. break;
  15248. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15249. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15250. break;
  15251. }
  15252. ret += ' { ';
  15253. if (command_obj.commands_block) {
  15254. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15255. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15256. }
  15257. }
  15258. ret += '\n';
  15259. for (var i = 0; i < indentation; i++) {
  15260. ret += '\t';
  15261. }
  15262. ret += '}';
  15263. return ret;
  15264. }
  15265. function logicExpressionCode(expression) {
  15266. var ret = ' ( ';
  15267. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15268. ret += logicExpressionCode(expression.first_operand);
  15269. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15270. ret += arithmeticExpressionCode(expression.first_operand);
  15271. } else {
  15272. ret += variableValueMenuCode(expression.first_operand);
  15273. }
  15274. if (expression.operator) {
  15275. switch (expression.operator) {
  15276. case Models.LOGIC_COMPARISON.equals_to:
  15277. ret += ' == ';
  15278. break;
  15279. case Models.LOGIC_COMPARISON.not_equals_to:
  15280. ret += ' != ';
  15281. break;
  15282. case Models.LOGIC_COMPARISON.and:
  15283. ret += ' && ';
  15284. break;
  15285. case Models.LOGIC_COMPARISON.or:
  15286. ret += ' || ';
  15287. break;
  15288. }
  15289. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15290. ret += logicExpressionCode(expression.second_operand);
  15291. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15292. ret += arithmeticExpressionCode(expression.second_operand);
  15293. } else {
  15294. ret += variableValueMenuCode(expression.second_operand);
  15295. }
  15296. }
  15297. ret += ' ) ';
  15298. return ret;
  15299. }
  15300. function arithmeticExpressionCode(expression) {
  15301. var ret = ' ( ';
  15302. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15303. ret += logicExpressionCode(expression.first_operand);
  15304. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15305. ret += arithmeticExpressionCode(expression.first_operand);
  15306. } else {
  15307. ret += variableValueMenuCode(expression.first_operand);
  15308. }
  15309. switch (expression.operator) {
  15310. case Models.ARITHMETIC_COMPARISON.greater_than:
  15311. ret += ' > ';
  15312. break;
  15313. case Models.ARITHMETIC_COMPARISON.less_than:
  15314. ret += ' < ';
  15315. break;
  15316. case Models.ARITHMETIC_COMPARISON.equals_to:
  15317. ret += ' == ';
  15318. break;
  15319. case Models.ARITHMETIC_COMPARISON.not_equals_to:
  15320. ret += ' != ';
  15321. break;
  15322. case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  15323. ret += ' >= ';
  15324. break;
  15325. case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  15326. ret += ' <= ';
  15327. break;
  15328. }
  15329. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15330. ret += logicExpressionCode(expression.second_operand);
  15331. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15332. ret += arithmeticExpressionCode(expression.second_operand);
  15333. } else {
  15334. ret += variableValueMenuCode(expression.second_operand);
  15335. }
  15336. ret += ' ) ';
  15337. return ret;
  15338. }
  15339. function attributionsCode(command_obj, indentation) {
  15340. var ret = '\n';
  15341. for (var i = 0; i < indentation; i++) {
  15342. ret += '\t';
  15343. }
  15344. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  15345. for (var i = 0; i < command_obj.expression.length; i++) {
  15346. ret += elementExpressionCode(command_obj.expression[i]);
  15347. }
  15348. return ret;
  15349. }
  15350. function elementExpressionCode(expression_obj) {
  15351. var ret = '';
  15352. for (var i = 0; i < expression_obj.itens.length; i++) {
  15353. if (expression_obj.itens[i].type) {
  15354. ret += variableValueMenuCode(expression_obj.itens[i]);
  15355. } else if (expression_obj.itens[i].type_exp) {
  15356. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15357. ret += ' ( ';
  15358. }
  15359. ret += elementExpressionCode(expression_obj.itens[i]);
  15360. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15361. ret += ' ) ';
  15362. }
  15363. } else {
  15364. switch (expression_obj.itens[i]) {
  15365. case Models.ARITHMETIC_TYPES.plus:
  15366. ret += ' + ';
  15367. break;
  15368. case Models.ARITHMETIC_TYPES.minus:
  15369. ret += ' - ';
  15370. break;
  15371. case Models.ARITHMETIC_TYPES.multiplication:
  15372. ret += ' * ';
  15373. break;
  15374. case Models.ARITHMETIC_TYPES.division:
  15375. ret += ' / ';
  15376. break;
  15377. case Models.ARITHMETIC_TYPES.module:
  15378. ret += ' % ';
  15379. break;
  15380. }
  15381. }
  15382. }
  15383. return ret;
  15384. }
  15385. function functioncallsCode(command_obj, indentation) {
  15386. var ret = '\n';
  15387. for (var i = 0; i < indentation; i++) {
  15388. ret += '\t';
  15389. }
  15390. ret += variableValueMenuCode(command_obj.function_called);
  15391. return ret;
  15392. }
  15393. function readersCode(command_obj, indentation) {
  15394. var ret = '\n';
  15395. for (var i = 0; i < indentation; i++) {
  15396. ret += '\t';
  15397. }
  15398. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( ';
  15399. ret += variableValueMenuCode(command_obj.variable_value_menu);
  15400. ret += ' ) ';
  15401. return ret;
  15402. }
  15403. function variableValueMenuCode(variable_obj) {
  15404. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  15405. var ret = '';
  15406. try {
  15407. if (variable_obj.function_called) {
  15408. if (variable_obj.function_called.name) {
  15409. ret += variable_obj.function_called.name + ' ( ';
  15410. } else {
  15411. ret += _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + ' ( ';
  15412. }
  15413. if (variable_obj.parameters_list) {
  15414. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  15415. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  15416. if (i + 1 < variable_obj.parameters_list.length) {
  15417. ret += ', ';
  15418. }
  15419. }
  15420. }
  15421. ret += ' )';
  15422. } else if (variable_obj.content.type) {
  15423. ret += variable_obj.content.name;
  15424. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  15425. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15426. }
  15427. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  15428. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  15429. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15430. }
  15431. } else {
  15432. if (isNaN(variable_obj.content)) {
  15433. ret += '"' + variable_obj.content + '"';
  15434. } else {
  15435. ret += variable_obj.content;
  15436. }
  15437. }
  15438. } catch (err) {
  15439. if (!is_return) {
  15440. Utils.renderErrorMessage(variable_obj.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_content'));
  15441. throw err;
  15442. }
  15443. }
  15444. return ret;
  15445. }
  15446. function writersCode(command_obj, indentation) {
  15447. var ret = '\n';
  15448. for (var i = 0; i < indentation; i++) {
  15449. ret += '\t';
  15450. }
  15451. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( ';
  15452. for (var i = 0; i < command_obj.content.length; i++) {
  15453. ret += variableValueMenuCode(command_obj.content[i]);
  15454. if (i + 1 < command_obj.content.length) {
  15455. ret += ' + ';
  15456. }
  15457. }
  15458. ret += ' ) ';
  15459. return ret;
  15460. }
  15461. function commentsCode(command_obj, indentation) {
  15462. var ret = '\n';
  15463. for (var i = 0; i < indentation; i++) {
  15464. ret += '\t';
  15465. }
  15466. ret += '// ';
  15467. ret += command_obj.comment_text.content;
  15468. return ret;
  15469. }
  15470. function parametersCode(parameter_obj) {
  15471. var ret = '';
  15472. switch (parameter_obj.type) {
  15473. case _types.Types.INTEGER:
  15474. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15475. break;
  15476. case _types.Types.REAL:
  15477. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15478. break;
  15479. case _types.Types.TEXT:
  15480. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15481. break;
  15482. case _types.Types.BOOLEAN:
  15483. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15484. break;
  15485. }
  15486. ret += parameter_obj.name + '';
  15487. if (parameter_obj.dimensions == 1) {
  15488. ret += ' []';
  15489. } else if (parameter_obj.dimensions == 2) {
  15490. ret += ' [][]';
  15491. }
  15492. return ret;
  15493. }
  15494. function variablesCode(variable_obj) {
  15495. var ret = '';
  15496. var temp = variable_obj;
  15497. ret += '\n\t\t';
  15498. if (temp.is_constant) {
  15499. ret += 'const ';
  15500. }
  15501. switch (temp.type) {
  15502. case _types.Types.INTEGER:
  15503. ret += _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15504. break;
  15505. case _types.Types.REAL:
  15506. ret += _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15507. break;
  15508. case _types.Types.TEXT:
  15509. ret += _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15510. break;
  15511. case _types.Types.BOOLEAN:
  15512. ret += _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15513. break;
  15514. }
  15515. ret += temp.name + ' ';
  15516. if (temp.dimensions == 1) {
  15517. ret += '[' + temp.columns + '] ';
  15518. switch (temp.type) {
  15519. case _types.Types.INTEGER:
  15520. ret += '= {' + temp.value + '}';
  15521. break;
  15522. case _types.Types.REAL:
  15523. ret += '= {' + temp.value.toFixed(2) + '}';
  15524. break;
  15525. case _types.Types.TEXT:
  15526. ret += '= {';
  15527. for (var j = 0; j < temp.value.length; j++) {
  15528. ret += '"' + temp.value[j] + '"';
  15529. if (j + 1 < temp.value.length) {
  15530. ret += ',';
  15531. }
  15532. }
  15533. ret += '}';
  15534. break;
  15535. case _types.Types.BOOLEAN:
  15536. ret += '= {';
  15537. for (var j = 0; j < temp.value.length; j++) {
  15538. if (temp.value[j]) {
  15539. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15540. } else {
  15541. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15542. }
  15543. if (j + 1 < temp.value.length) {
  15544. ret += ',';
  15545. }
  15546. }
  15547. ret += '}';
  15548. break;
  15549. }
  15550. } else if (temp.dimensions == 2) {
  15551. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15552. switch (temp.type) {
  15553. case _types.Types.INTEGER:
  15554. ret += '= {';
  15555. for (var j = 0; j < temp.rows; j++) {
  15556. ret += '{' + temp.value[j] + '}';
  15557. if (j + 1 < temp.rows) {
  15558. ret += ',';
  15559. }
  15560. }
  15561. ret += '}';
  15562. break;
  15563. case _types.Types.REAL:
  15564. ret += '= {';
  15565. for (var j = 0; j < temp.rows; j++) {
  15566. ret += '{' + temp.value[j].toFixed(2) + '}';
  15567. if (j + 1 < temp.rows) {
  15568. ret += ',';
  15569. }
  15570. }
  15571. ret += '}';
  15572. break;
  15573. case _types.Types.TEXT:
  15574. ret += '= {';
  15575. for (var j = 0; j < temp.rows; j++) {
  15576. ret += '{';
  15577. for (var k = 0; k < temp.columns; k++) {
  15578. ret += '"' + temp.value[j][k] + '"';
  15579. if (k + 1 < temp.columns) {
  15580. ret += ',';
  15581. }
  15582. }
  15583. ret += '}';
  15584. if (j + 1 < temp.rows) {
  15585. ret += ',';
  15586. }
  15587. }
  15588. ret += '}';
  15589. break;
  15590. case _types.Types.BOOLEAN:
  15591. ret += '= {';
  15592. for (var j = 0; j < temp.rows; j++) {
  15593. ret += '{';
  15594. for (var k = 0; k < temp.columns; k++) {
  15595. if (temp.value[j][k]) {
  15596. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15597. } else {
  15598. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15599. }
  15600. if (k + 1 < temp.columns) {
  15601. ret += ',';
  15602. }
  15603. }
  15604. ret += '}';
  15605. if (j + 1 < temp.rows) {
  15606. ret += ',';
  15607. }
  15608. }
  15609. ret += '}';
  15610. break;
  15611. }
  15612. } else {
  15613. switch (temp.type) {
  15614. case _types.Types.INTEGER:
  15615. ret += '= ' + temp.value;
  15616. break;
  15617. case _types.Types.REAL:
  15618. ret += '= ' + temp.value.toFixed(2);
  15619. break;
  15620. case _types.Types.TEXT:
  15621. ret += '= "' + temp.value + '"';
  15622. break;
  15623. case _types.Types.BOOLEAN:
  15624. ret += '= ';
  15625. if (temp.value) {
  15626. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15627. } else {
  15628. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15629. }
  15630. break;
  15631. }
  15632. }
  15633. return ret;
  15634. }
  15635. function globalsCode() {
  15636. var ret = '';
  15637. if (window.program_obj.globals) {
  15638. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15639. var temp = window.program_obj.globals[i];
  15640. ret += '\n\t';
  15641. if (temp.is_constant) {
  15642. ret += 'const ';
  15643. }
  15644. switch (temp.type) {
  15645. case _types.Types.INTEGER:
  15646. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15647. break;
  15648. case _types.Types.REAL:
  15649. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15650. break;
  15651. case _types.Types.TEXT:
  15652. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15653. break;
  15654. case _types.Types.BOOLEAN:
  15655. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15656. break;
  15657. }
  15658. ret += ' ' + temp.name + ' ';
  15659. if (temp.dimensions == 1) {
  15660. ret += '[' + temp.columns + '] ';
  15661. switch (temp.type) {
  15662. case _types.Types.INTEGER:
  15663. ret += '= {' + temp.value + '}';
  15664. break;
  15665. case _types.Types.REAL:
  15666. ret += '= {';
  15667. for (var j = 0; j < temp.value.length; j++) {
  15668. ret += temp.value[j].toFixed(2);
  15669. if (j + 1 < temp.value.length) {
  15670. ret += ',';
  15671. }
  15672. }
  15673. ret += '}';
  15674. break;
  15675. case _types.Types.TEXT:
  15676. ret += '= {';
  15677. for (var j = 0; j < temp.value.length; j++) {
  15678. ret += '"' + temp.value[j] + '"';
  15679. if (j + 1 < temp.value.length) {
  15680. ret += ',';
  15681. }
  15682. }
  15683. ret += '}';
  15684. break;
  15685. case _types.Types.BOOLEAN:
  15686. ret += '= {';
  15687. for (var j = 0; j < temp.value.length; j++) {
  15688. if (temp.value[j]) {
  15689. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15690. } else {
  15691. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15692. }
  15693. if (j + 1 < temp.value.length) {
  15694. ret += ',';
  15695. }
  15696. }
  15697. ret += '}';
  15698. break;
  15699. }
  15700. } else if (temp.dimensions == 2) {
  15701. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15702. switch (temp.type) {
  15703. case _types.Types.INTEGER:
  15704. ret += '= {';
  15705. for (var j = 0; j < temp.rows; j++) {
  15706. ret += '{' + temp.value[j] + '}';
  15707. if (j + 1 < temp.rows) {
  15708. ret += ',';
  15709. }
  15710. }
  15711. ret += '}';
  15712. break;
  15713. case _types.Types.REAL:
  15714. ret += '= {';
  15715. for (var j = 0; j < temp.rows; j++) {
  15716. ret += '{';
  15717. for (var k = 0; k < temp.columns; k++) {
  15718. ret += temp.value[j][k].toFixed(2);
  15719. if (k + 1 < temp.columns) {
  15720. ret += ',';
  15721. }
  15722. }
  15723. ret += '}';
  15724. if (j + 1 < temp.rows) {
  15725. ret += ',';
  15726. }
  15727. }
  15728. ret += '}';
  15729. break;
  15730. case _types.Types.TEXT:
  15731. ret += '= {';
  15732. for (var j = 0; j < temp.rows; j++) {
  15733. ret += '{';
  15734. for (var k = 0; k < temp.columns; k++) {
  15735. ret += '"' + temp.value[j][k] + '"';
  15736. if (k + 1 < temp.columns) {
  15737. ret += ',';
  15738. }
  15739. }
  15740. ret += '}';
  15741. if (j + 1 < temp.rows) {
  15742. ret += ',';
  15743. }
  15744. }
  15745. ret += '}';
  15746. break;
  15747. case _types.Types.BOOLEAN:
  15748. ret += '= {';
  15749. for (var j = 0; j < temp.rows; j++) {
  15750. ret += '{';
  15751. for (var k = 0; k < temp.columns; k++) {
  15752. if (temp.value[j][k]) {
  15753. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15754. } else {
  15755. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15756. }
  15757. if (k + 1 < temp.columns) {
  15758. ret += ',';
  15759. }
  15760. }
  15761. ret += '}';
  15762. if (j + 1 < temp.rows) {
  15763. ret += ',';
  15764. }
  15765. }
  15766. ret += '}';
  15767. break;
  15768. }
  15769. } else {
  15770. switch (temp.type) {
  15771. case _types.Types.INTEGER:
  15772. ret += '= ' + temp.value;
  15773. break;
  15774. case _types.Types.REAL:
  15775. ret += '= ' + temp.value.toFixed(2);
  15776. break;
  15777. case _types.Types.TEXT:
  15778. ret += '= "' + temp.value + '"';
  15779. break;
  15780. case _types.Types.BOOLEAN:
  15781. ret += '= ';
  15782. if (temp.value) {
  15783. ret += _localizedStringsService.LocalizedStrings.getUI("true");;
  15784. } else {
  15785. ret += _localizedStringsService.LocalizedStrings.getUI("false");;
  15786. }
  15787. break;
  15788. }
  15789. }
  15790. }
  15791. }
  15792. return ret;
  15793. }
  15794. /***/ }),
  15795. /***/ "./js/visualUI/commands.js":
  15796. /*!*********************************!*\
  15797. !*** ./js/visualUI/commands.js ***!
  15798. \*********************************/
  15799. /*! no static exports found */
  15800. /***/ (function(module, exports, __webpack_require__) {
  15801. "use strict";
  15802. Object.defineProperty(exports, "__esModule", {
  15803. value: true
  15804. });
  15805. exports.removeCommand = removeCommand;
  15806. exports.createFloatingCommand = createFloatingCommand;
  15807. exports.renderCommand = renderCommand;
  15808. exports.genericCreateCommand = genericCreateCommand;
  15809. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15810. var _jquery2 = _interopRequireDefault(_jquery);
  15811. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  15812. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15813. var Models = _interopRequireWildcard(_ivprog_elements);
  15814. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15815. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  15816. var GlobalsManagement = _interopRequireWildcard(_globals);
  15817. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  15818. var VariablesManagement = _interopRequireWildcard(_variables);
  15819. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  15820. var CommentsManagement = _interopRequireWildcard(_comment);
  15821. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  15822. var ReadersManagement = _interopRequireWildcard(_reader);
  15823. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  15824. var WritersManagement = _interopRequireWildcard(_writer);
  15825. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  15826. var AttributionsManagement = _interopRequireWildcard(_attribution);
  15827. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  15828. var IftruesManagement = _interopRequireWildcard(_iftrue);
  15829. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15830. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  15831. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  15832. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  15833. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  15834. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  15835. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  15836. var SwitchesManagement = _interopRequireWildcard(_switch);
  15837. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  15838. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  15839. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15840. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  15841. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  15842. var BreaksManagement = _interopRequireWildcard(_break);
  15843. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  15844. var ReturnsManagement = _interopRequireWildcard(_return);
  15845. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  15846. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15847. var has_element_created_draged = false;
  15848. var which_element_is_draged = null;
  15849. function removeCommand(command, function_obj, dom_obj) {
  15850. if (function_obj.commands.indexOf(command) > -1) {
  15851. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  15852. return true;
  15853. }
  15854. // Utilize dois parantNode, pois o primeiro é o div de comandos
  15855. try {
  15856. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  15857. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  15858. return true;
  15859. }
  15860. } catch (err) {}
  15861. try {
  15862. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  15863. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  15864. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  15865. return true;
  15866. }
  15867. }
  15868. } catch (err) {}
  15869. if (dom_obj.parent().data('switchcase')) {
  15870. console.log("o que encontrei: ");
  15871. console.log(dom_obj.parent().data('switchcase'));
  15872. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  15873. return true;
  15874. }
  15875. return false;
  15876. }
  15877. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  15878. var floatingObject;
  15879. switch (command_type) {
  15880. case Models.COMMAND_TYPES.break:
  15881. floatingObject = BreaksManagement.createFloatingCommand();
  15882. break;
  15883. case Models.COMMAND_TYPES.comment:
  15884. floatingObject = CommentsManagement.createFloatingCommand();
  15885. break;
  15886. case Models.COMMAND_TYPES.reader:
  15887. floatingObject = ReadersManagement.createFloatingCommand();
  15888. break;
  15889. case Models.COMMAND_TYPES.writer:
  15890. floatingObject = WritersManagement.createFloatingCommand();
  15891. break;
  15892. case Models.COMMAND_TYPES.attribution:
  15893. floatingObject = AttributionsManagement.createFloatingCommand();
  15894. break;
  15895. case Models.COMMAND_TYPES.iftrue:
  15896. floatingObject = IftruesManagement.createFloatingCommand();
  15897. break;
  15898. case Models.COMMAND_TYPES.repeatNtimes:
  15899. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  15900. break;
  15901. case Models.COMMAND_TYPES.whiletrue:
  15902. floatingObject = WhiletruesManagement.createFloatingCommand();
  15903. break;
  15904. case Models.COMMAND_TYPES.dowhiletrue:
  15905. floatingObject = DowhiletruesManagement.createFloatingCommand();
  15906. break;
  15907. case Models.COMMAND_TYPES.switch:
  15908. floatingObject = SwitchesManagement.createFloatingCommand();
  15909. break;
  15910. case Models.COMMAND_TYPES.functioncall:
  15911. floatingObject = FunctioncallsManagement.createFloatingCommand();
  15912. break;
  15913. case Models.COMMAND_TYPES.return:
  15914. floatingObject = ReturnsManagement.createFloatingCommand();
  15915. break;
  15916. }
  15917. floatingObject.draggable({
  15918. drag: function drag(evt) {
  15919. borderMouseDragCommand(function_obj, function_container, evt);
  15920. },
  15921. stop: function stop(evt) {
  15922. function_container.find('.over_command_drag').each(function (index) {
  15923. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15924. });
  15925. }
  15926. }).appendTo("body");
  15927. floatingObject.mouseup(function (evt) {
  15928. manageCommand(function_obj, function_container, evt, command_type);
  15929. });
  15930. floatingObject.css("position", "absolute");
  15931. mouse_event.type = "mousedown.draggable";
  15932. mouse_event.target = floatingObject[0];
  15933. floatingObject.css("left", mouse_event.pageX - 15);
  15934. floatingObject.css("top", mouse_event.pageY - 15);
  15935. floatingObject.trigger(mouse_event);
  15936. }
  15937. function borderMouseDragCommand(function_obj, function_container, evt) {
  15938. function_container.find('.over_command_drag').each(function (index) {
  15939. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15940. });
  15941. var prev = null;
  15942. function_container.find('.commands_list_div').each(function (index) {
  15943. prev = (0, _jquery2.default)(this);
  15944. if (prev) {
  15945. var objLeft = prev.offset().left;
  15946. var objTop = prev.offset().top;
  15947. var objRight = objLeft + prev.width();
  15948. var objBottom = objTop + prev.height();
  15949. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  15950. prev.addClass("over_command_drag");
  15951. }
  15952. }
  15953. });
  15954. function_container.find('.command_container').each(function (index) {
  15955. var obj = (0, _jquery2.default)(this);
  15956. var objLeft = obj.offset().left;
  15957. var objTop = obj.offset().top;
  15958. var objRight = objLeft + obj.width();
  15959. var objBottom = objTop + obj.height();
  15960. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  15961. if (prev) {
  15962. prev.removeClass('over_command_drag');
  15963. }
  15964. obj.addClass("over_command_drag");
  15965. return;
  15966. }
  15967. });
  15968. }
  15969. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  15970. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  15971. var createdElement;
  15972. switch (command.type) {
  15973. case Models.COMMAND_TYPES.comment:
  15974. createdElement = CommentsManagement.renderCommand(command, function_obj);
  15975. break;
  15976. case Models.COMMAND_TYPES.break:
  15977. createdElement = BreaksManagement.renderCommand(command, function_obj);
  15978. break;
  15979. case Models.COMMAND_TYPES.reader:
  15980. createdElement = ReadersManagement.renderCommand(command, function_obj);
  15981. break;
  15982. case Models.COMMAND_TYPES.writer:
  15983. createdElement = WritersManagement.renderCommand(command, function_obj);
  15984. break;
  15985. case Models.COMMAND_TYPES.attribution:
  15986. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  15987. break;
  15988. case Models.COMMAND_TYPES.functioncall:
  15989. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  15990. break;
  15991. case Models.COMMAND_TYPES.iftrue:
  15992. createdElement = IftruesManagement.renderCommand(command, function_obj);
  15993. break;
  15994. case Models.COMMAND_TYPES.repeatNtimes:
  15995. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  15996. break;
  15997. case Models.COMMAND_TYPES.whiletrue:
  15998. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  15999. break;
  16000. case Models.COMMAND_TYPES.dowhiletrue:
  16001. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  16002. break;
  16003. case Models.COMMAND_TYPES.switch:
  16004. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  16005. break;
  16006. case Models.COMMAND_TYPES.return:
  16007. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  16008. break;
  16009. }
  16010. switch (before_after_inside) {
  16011. case 1:
  16012. createdElement.insertBefore(element_reference);
  16013. break;
  16014. case 2:
  16015. createdElement.insertAfter(element_reference);
  16016. break;
  16017. case 3:
  16018. element_reference.append(createdElement);
  16019. break;
  16020. }
  16021. createdElement.find('.button_remove_command').mouseover(function () {
  16022. createdElement.css({ 'opacity': '.8' });
  16023. });
  16024. createdElement.find('.button_remove_command').mouseout(function () {
  16025. createdElement.css({ 'opacity': '1' });
  16026. });
  16027. }
  16028. function genericCreateCommand(command_type) {
  16029. switch (command_type) {
  16030. case Models.COMMAND_TYPES.break:
  16031. return new Models.Break();
  16032. case Models.COMMAND_TYPES.comment:
  16033. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  16034. case Models.COMMAND_TYPES.reader:
  16035. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  16036. case Models.COMMAND_TYPES.writer:
  16037. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16038. case Models.COMMAND_TYPES.attribution:
  16039. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  16040. case Models.COMMAND_TYPES.functioncall:
  16041. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  16042. case Models.COMMAND_TYPES.iftrue:
  16043. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  16044. case Models.COMMAND_TYPES.repeatNtimes:
  16045. return new Models.RepeatNTimes(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), null, new Models.ConditionalExpression(null), null, null);
  16046. case Models.COMMAND_TYPES.whiletrue:
  16047. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  16048. case Models.COMMAND_TYPES.dowhiletrue:
  16049. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  16050. case Models.COMMAND_TYPES.switch:
  16051. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  16052. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  16053. case Models.COMMAND_TYPES.return:
  16054. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16055. }
  16056. }
  16057. function dragTrash(event) {
  16058. var trash = (0, _jquery2.default)('<i class="ui icon trash alternate outline"></i>');
  16059. (0, _jquery2.default)('body').append(trash);
  16060. trash.css('position', 'absolute');
  16061. trash.css('top', event.clientY);
  16062. trash.css('left', event.clientX - 20);
  16063. trash.css('font-size', '3em');
  16064. trash.css('display', 'none');
  16065. trash.fadeIn(200, function () {
  16066. trash.fadeOut(200, function () {
  16067. trash.remove();
  16068. });
  16069. });
  16070. }
  16071. function manageCommand(function_obj, function_container, event, command_type) {
  16072. (0, _jquery2.default)(".created_element").each(function (index) {
  16073. (0, _jquery2.default)(this).remove();
  16074. });
  16075. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16076. console.log('soltou no: ');
  16077. console.log(el);
  16078. console.log(el.data('fun'));
  16079. // Primeiro verificar se ele soltou no espaço da função correta:
  16080. var hier = el.parentsUntil(".all_functions");
  16081. var esta_correto = false;
  16082. var esta_na_div_correta = false;
  16083. if (el.hasClass("commands_list_div")) {
  16084. esta_na_div_correta = true;
  16085. }
  16086. for (var i = 0; i < hier.length; i++) {
  16087. var temp = (0, _jquery2.default)(hier[i]);
  16088. if (temp.hasClass("commands_list_div")) {
  16089. esta_na_div_correta = true;
  16090. }
  16091. if (temp.data('fun') == function_obj) {
  16092. esta_correto = true;
  16093. break;
  16094. }
  16095. }
  16096. if (!esta_correto) {
  16097. has_element_created_draged = false;
  16098. which_element_is_draged = null;
  16099. dragTrash(event);
  16100. return;
  16101. } else {
  16102. if (!esta_na_div_correta) {
  16103. has_element_created_draged = false;
  16104. which_element_is_draged = null;
  16105. dragTrash(event);
  16106. return;
  16107. }
  16108. }
  16109. // Agora é descobrir qual o escopo para adicionar o comando:
  16110. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  16111. if (typeof el.data('fun') !== 'undefined') {
  16112. // Se a lista de comandos estiver vazia, então é o primeiro.
  16113. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  16114. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  16115. // pode adicionar
  16116. el.data('fun').commands = [];
  16117. var new_cmd = genericCreateCommand(command_type);
  16118. el.data('fun').commands.push(new_cmd);
  16119. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  16120. } else {
  16121. // Entra nesse else, caso já existam outros comandos no bloco:
  16122. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  16123. }
  16124. } else {
  16125. console.log("soltou em um comando");
  16126. // descobrir em qual comando ele soltou:
  16127. var hier_find = el.parentsUntil(".commands_list_div");
  16128. var hierarquia_bottom_up = [];
  16129. if (typeof el.data('command') !== 'undefined') {
  16130. hierarquia_bottom_up.push(el.data('command'));
  16131. }
  16132. for (var i = 0; i < hier_find.length; i++) {
  16133. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16134. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  16135. }
  16136. }
  16137. console.log("comando em que soltou: ");
  16138. console.log(hierarquia_bottom_up[0]);
  16139. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  16140. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  16141. console.log(hierarquia_bottom_up[i]);
  16142. }
  16143. // Se for do tipo break, verificar se está no contexto correto:
  16144. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  16145. var is_correct_context = false;
  16146. if (command_type == Models.COMMAND_TYPES.break) {
  16147. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  16148. if (hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.repeatNtimes || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.whiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.dowhiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.switch) {
  16149. is_correct_context = true;
  16150. break;
  16151. }
  16152. }
  16153. if (!is_correct_context) {
  16154. console.error("Context not allowed to insert BREAK COMMAND!");
  16155. return;
  16156. }
  16157. }
  16158. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  16159. if (hierarquia_bottom_up.length == 1) {
  16160. console.log('QQ1');
  16161. var sub_elemento = false;
  16162. for (var i = 0; i < hier_find.length; i++) {
  16163. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16164. console.log('QQ2');
  16165. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  16166. sub_elemento = true;
  16167. break;
  16168. }
  16169. }
  16170. if (!sub_elemento) {
  16171. console.log('QQ3');
  16172. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  16173. }
  16174. } else {
  16175. console.log('QQ4');
  16176. // caso exista mais de um elemento na hierarquia:
  16177. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  16178. console.log('QQ5');
  16179. console.log("PPP1");
  16180. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16181. } else {
  16182. console.log('QQ6');
  16183. var sub_elemento = false;
  16184. for (var i = 0; i < hier_find.length; i++) {
  16185. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16186. console.log('QQ7');
  16187. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16188. sub_elemento = true;
  16189. break;
  16190. }
  16191. }
  16192. }
  16193. }
  16194. }
  16195. has_element_created_draged = false;
  16196. which_element_is_draged = null;
  16197. }
  16198. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  16199. var el_jq = (0, _jquery2.default)(el);
  16200. var command_parent = el_jq.data('command');
  16201. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.switch) {
  16202. console.log('QQ17');
  16203. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  16204. console.log('QQ18');
  16205. // Se não tiver outro comando ainda no bloco, só adiciona:
  16206. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16207. command_parent.commands_block = [];
  16208. var recentComand = genericCreateCommand(command_type);
  16209. command_parent.commands_block.push(recentComand);
  16210. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16211. } else {
  16212. // Se já tem algum comando no bloco:
  16213. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  16214. }
  16215. } else {
  16216. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  16217. addCommandToSwitchCase(event, function_obj, command_type);
  16218. }
  16219. } else {
  16220. console.log('QQ19');
  16221. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  16222. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  16223. }
  16224. }
  16225. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  16226. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16227. var menor_distancia = 999999999;
  16228. var elemento_menor_distancia = null;
  16229. var antes = true;
  16230. var t_bot;
  16231. var t_top;
  16232. // Descobrindo o elemento mais próximo:
  16233. for (var i = 0; i < all_sub.length; i++) {
  16234. t_top = all_sub[i].getBoundingClientRect().top;
  16235. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16236. if (t_top - event.clientY < menor_distancia) {
  16237. menor_distancia = event.clientY - t_top;
  16238. elemento_menor_distancia = all_sub[i];
  16239. }
  16240. }
  16241. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16242. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16243. if (borda_inferior - event.clientY < menor_distancia) {
  16244. var recentComand = genericCreateCommand(command_type);
  16245. command_parent.commands_block.push(recentComand);
  16246. //
  16247. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16248. } else {
  16249. var recentComand = genericCreateCommand(command_type);
  16250. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16251. if (index > -1) {
  16252. command_parent.commands_block.splice(index, 0, recentComand);
  16253. }
  16254. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16255. }
  16256. }
  16257. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  16258. var el_jq = (0, _jquery2.default)(el);
  16259. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  16260. var command_target = el_jq.data('command');
  16261. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  16262. var is_in_else = false;
  16263. if (!command_parent) {
  16264. command_parent = el_jq.data('command');
  16265. temp_parent = el_jq;
  16266. var hier = el_jq.parentsUntil(".command_container");
  16267. for (var i = 0; i < hier.length; i++) {
  16268. var temp = (0, _jquery2.default)(hier[i]);
  16269. if (typeof temp.data('else') != 'undefined') {
  16270. is_in_else = true;
  16271. }
  16272. if (typeof temp.data('command') != 'undefined') {
  16273. command_parent = temp.data('command');
  16274. temp_parent = temp;
  16275. }
  16276. }
  16277. }
  16278. var hier = el_jq.parentsUntil(".command_container");
  16279. for (var i = 0; i < hier.length; i++) {
  16280. var temp = (0, _jquery2.default)(hier[i]);
  16281. if (typeof temp.data('else') != 'undefined') {
  16282. is_in_else = true;
  16283. }
  16284. }
  16285. if (command_parent == command_target) {
  16286. var hier = el_jq.parentsUntil(".command_container");
  16287. for (var i = 0; i < hier.length; i++) {
  16288. var temp = (0, _jquery2.default)(hier[i]);
  16289. if (typeof temp.data('else') !== 'undefined') {
  16290. is_in_else = true;
  16291. break;
  16292. }
  16293. }
  16294. }
  16295. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  16296. var hier = temp_parent.parentsUntil(".all_cases_div");
  16297. console.log("vou procurar!!");
  16298. for (var i = 0; i < hier.length; i++) {
  16299. console.log("estou vasculhando...");
  16300. var temp = (0, _jquery2.default)(hier[i]);
  16301. if (typeof temp.data('switchcase') !== 'undefined') {
  16302. console.log("encontrei");
  16303. command_parent = temp.data('switchcase');
  16304. is_in_else = false;
  16305. break;
  16306. }
  16307. }
  16308. }
  16309. console.log('debugging:');
  16310. console.log('el_jq');
  16311. console.log(el_jq);
  16312. console.log('command_parent');
  16313. console.log(command_parent);
  16314. console.log('command_target');
  16315. console.log(command_target);
  16316. var menor_distancia = 999999999;
  16317. var antes = true;
  16318. var t_bot;
  16319. var t_top;
  16320. t_top = el.getBoundingClientRect().top;
  16321. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16322. var d_top = event.clientY - t_top; // distancia topo
  16323. var d_bot = t_bot - event.clientY; // distancia baixo
  16324. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16325. if (d_top < d_bot) {
  16326. var recentComand = genericCreateCommand(command_type);
  16327. console.log('MMM1');
  16328. if (is_in_else) {
  16329. console.log('MMM2');
  16330. if (command_parent == command_target) {
  16331. console.log('MMM3');
  16332. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16333. command_parent.commands_else = [];
  16334. var recentComand = genericCreateCommand(command_type);
  16335. command_parent.commands_else.push(recentComand);
  16336. renderCommand(recentComand, el_jq, 3, function_obj);
  16337. } else {
  16338. // Se já tem algum comando no bloco:
  16339. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16340. }
  16341. return;
  16342. }
  16343. console.log('MMM7');
  16344. var index = command_parent.commands_else.indexOf(command_target);
  16345. if (index > -1) {
  16346. command_parent.commands_else.splice(index, 0, recentComand);
  16347. }
  16348. renderCommand(recentComand, el, 1, function_obj);
  16349. } else {
  16350. console.log('MMM4');
  16351. if (command_parent == command_target) {
  16352. console.log('Nxxxx5');
  16353. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16354. command_parent.commands_block = [];
  16355. console.log('SSS4');
  16356. var recentComand = genericCreateCommand(command_type);
  16357. command_parent.commands_block.push(recentComand);
  16358. renderCommand(recentComand, el_jq, 3, function_obj);
  16359. } else {
  16360. console.log('SSS5');
  16361. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16362. }
  16363. return;
  16364. }
  16365. console.log('MMM6');
  16366. var index = command_parent.commands_block.indexOf(command_target);
  16367. if (index > -1) {
  16368. command_parent.commands_block.splice(index, 0, recentComand);
  16369. }
  16370. renderCommand(recentComand, el, 1, function_obj);
  16371. }
  16372. } else {
  16373. console.log('XXX1');
  16374. var recentComand = genericCreateCommand(command_type);
  16375. if (is_in_else) {
  16376. if (command_parent == command_target) {
  16377. console.log('MMM3');
  16378. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16379. command_parent.commands_else = [];
  16380. console.log('SSS1');
  16381. var recentComand = genericCreateCommand(command_type);
  16382. command_parent.commands_else.push(recentComand);
  16383. renderCommand(recentComand, el_jq, 3, function_obj);
  16384. } else {
  16385. // Se já tem algum comando no bloco:
  16386. console.log('SSS2');
  16387. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16388. }
  16389. return;
  16390. }
  16391. console.log('XXX2');
  16392. var index = command_parent.commands_else.indexOf(command_target);
  16393. if (index > -1) {
  16394. command_parent.commands_else.splice(index + 1, 0, recentComand);
  16395. }
  16396. renderCommand(recentComand, el, 2, function_obj);
  16397. } else {
  16398. if (command_parent == command_target) {
  16399. console.log('Nxxxx78');
  16400. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16401. command_parent.commands_block = [];
  16402. var recentComand = genericCreateCommand(command_type);
  16403. command_parent.commands_block.push(recentComand);
  16404. console.log('SSS6');
  16405. renderCommand(recentComand, el_jq, 3, function_obj);
  16406. } else {
  16407. console.log('SSS7');
  16408. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16409. }
  16410. return;
  16411. }
  16412. console.log('XXX3');
  16413. var index = command_parent.commands_block.indexOf(command_target);
  16414. if (index > -1) {
  16415. command_parent.commands_block.splice(index + 1, 0, recentComand);
  16416. }
  16417. renderCommand(recentComand, el, 2, function_obj);
  16418. }
  16419. }
  16420. }
  16421. function insertCommandInBlock(el, event, function_obj, command_type) {
  16422. var el_jq = (0, _jquery2.default)(el);
  16423. var command_parent = el_jq.data('command');
  16424. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  16425. // Se não tiver outro comando ainda no bloco, só adiciona:
  16426. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16427. command_parent.commands_block = [];
  16428. var recentComand = genericCreateCommand(command_type);
  16429. command_parent.commands_block.push(recentComand);
  16430. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16431. } else {
  16432. // Se já tem algum comando no bloco:
  16433. findInBlockCorrectPlace(el, event, function_obj, command_type);
  16434. }
  16435. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  16436. console.log('QQ9');
  16437. // no if ou no else?
  16438. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  16439. var is_in_if = true;
  16440. if (correct_div.data('if')) {
  16441. is_in_if = true;
  16442. } else if (correct_div.data('else')) {
  16443. is_in_if = false;
  16444. } else {
  16445. var hier = correct_div.parentsUntil(".command_container");
  16446. for (var i = 0; i < hier.length; i++) {
  16447. var temp = (0, _jquery2.default)(hier[i]);
  16448. if (typeof temp.data('if') !== 'undefined') {
  16449. is_in_if = true;
  16450. break;
  16451. }
  16452. if (typeof temp.data('else') !== 'undefined') {
  16453. is_in_if = false;
  16454. break;
  16455. }
  16456. }
  16457. }
  16458. if (is_in_if) {
  16459. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16460. command_parent.commands_block = [];
  16461. var recentComand = genericCreateCommand(command_type);
  16462. command_parent.commands_block.push(recentComand);
  16463. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  16464. } else {
  16465. // Se já tem algum comando no bloco:
  16466. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  16467. }
  16468. } else {
  16469. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16470. command_parent.commands_else = [];
  16471. var recentComand = genericCreateCommand(command_type);
  16472. command_parent.commands_else.push(recentComand);
  16473. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  16474. } else {
  16475. // Se já tem algum comando no bloco:
  16476. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  16477. }
  16478. }
  16479. } else {
  16480. // é do tipo switch
  16481. console.log("está tentando inserir em um switch que está na raiz!");
  16482. addCommandToSwitchCase(event, function_obj, command_type);
  16483. }
  16484. }
  16485. function addCommandToSwitchCase(event, function_obj, command_type) {
  16486. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16487. var which_case = el.data('switchcase');
  16488. var case_div = el;
  16489. if (!which_case) {
  16490. var hier_find = el.parentsUntil(".all_cases_div");
  16491. for (var i = 0; i < hier_find.length; i++) {
  16492. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  16493. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  16494. case_div = (0, _jquery2.default)(hier_find[i]);
  16495. break;
  16496. }
  16497. }
  16498. }
  16499. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  16500. which_case.commands_block = [];
  16501. var recentComand = genericCreateCommand(command_type);
  16502. which_case.commands_block.push(recentComand);
  16503. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  16504. } else {
  16505. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  16506. }
  16507. }
  16508. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  16509. var all_sub = case_div.find('div.command_container');
  16510. var menor_distancia = 999999999;
  16511. var elemento_menor_distancia = null;
  16512. var antes = true;
  16513. var t_bot;
  16514. var t_top;
  16515. // Descobrindo o elemento mais próximo:
  16516. for (var i = 0; i < all_sub.length; i++) {
  16517. t_top = all_sub[i].getBoundingClientRect().top;
  16518. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16519. if (t_top - event.clientY < menor_distancia) {
  16520. menor_distancia = event.clientY - t_top;
  16521. elemento_menor_distancia = all_sub[i];
  16522. }
  16523. }
  16524. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16525. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16526. if (borda_inferior - event.clientY < menor_distancia) {
  16527. var recentComand = genericCreateCommand(command_type);
  16528. which_case.commands_block.push(recentComand);
  16529. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  16530. } else {
  16531. var recentComand = genericCreateCommand(command_type);
  16532. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16533. if (index > -1) {
  16534. which_case.commands_block.splice(index, 0, recentComand);
  16535. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16536. }
  16537. }
  16538. }
  16539. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  16540. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  16541. var el_jq = (0, _jquery2.default)(el);
  16542. var all_sub = el_jq.find('div.command_container');
  16543. var menor_distancia = 999999999;
  16544. var elemento_menor_distancia = null;
  16545. var antes = true;
  16546. var t_bot;
  16547. var t_top;
  16548. // Descobrindo o elemento mais próximo:
  16549. for (var i = 0; i < all_sub.length; i++) {
  16550. t_top = all_sub[i].getBoundingClientRect().top;
  16551. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16552. if (t_top - event.clientY < menor_distancia) {
  16553. menor_distancia = event.clientY - t_top;
  16554. elemento_menor_distancia = all_sub[i];
  16555. }
  16556. }
  16557. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16558. console.log("menor_distancia: ");
  16559. console.log(elemento_menor_distancia);
  16560. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16561. if (borda_inferior - event.clientY < menor_distancia) {
  16562. console.log('QQ11');
  16563. var recentComand = genericCreateCommand(command_type);
  16564. var command_parent = el_jq.data('command');
  16565. if (is_in_else) {
  16566. console.log('QQ15');
  16567. command_parent.commands_else.push(recentComand);
  16568. console.log('el_jq');
  16569. console.log(el_jq);
  16570. console.log("$(el_jq.find('.commands_else')[0]):: ");
  16571. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  16572. renderCommand(recentComand, el_jq, 3, function_obj);
  16573. } else {
  16574. console.log('QQ16');
  16575. command_parent.commands_block.push(recentComand);
  16576. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  16577. }
  16578. } else {
  16579. console.log('QQ12');
  16580. var recentComand = genericCreateCommand(command_type);
  16581. var command_parent = el_jq.data('command');
  16582. if (is_in_else) {
  16583. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16584. if (index > -1) {
  16585. command_parent.commands_else.splice(index, 0, recentComand);
  16586. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16587. }
  16588. } else {
  16589. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16590. if (index > -1) {
  16591. command_parent.commands_block.splice(index, 0, recentComand);
  16592. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16593. }
  16594. }
  16595. }
  16596. }
  16597. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  16598. switch ((0, _jquery2.default)(el).data('command').type) {
  16599. case Models.COMMAND_TYPES.iftrue:
  16600. case Models.COMMAND_TYPES.switch:
  16601. case Models.COMMAND_TYPES.repeatNtimes:
  16602. case Models.COMMAND_TYPES.whiletrue:
  16603. case Models.COMMAND_TYPES.dowhiletrue:
  16604. insertCommandInBlock(el, event, function_obj, command_type);
  16605. return;
  16606. }
  16607. var menor_distancia = 999999999;
  16608. var antes = true;
  16609. var t_bot;
  16610. var t_top;
  16611. t_top = el.getBoundingClientRect().top;
  16612. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16613. var d_top = event.clientY - t_top; // distancia topo
  16614. var d_bot = t_bot - event.clientY; // distancia baixo
  16615. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16616. if (d_top < d_bot) {
  16617. var recentComand = genericCreateCommand(command_type);
  16618. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16619. if (index > -1) {
  16620. function_obj.commands.splice(index, 0, recentComand);
  16621. }
  16622. renderCommand(recentComand, el, 1, function_obj);
  16623. } else {
  16624. var recentComand = genericCreateCommand(command_type);
  16625. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16626. if (index > -1) {
  16627. function_obj.commands.splice(index + 1, 0, recentComand);
  16628. }
  16629. renderCommand(recentComand, el, 2, function_obj);
  16630. }
  16631. }
  16632. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  16633. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16634. var menor_distancia = 999999999;
  16635. var elemento_menor_distancia = null;
  16636. var antes = true;
  16637. var t_bot;
  16638. var t_top;
  16639. // Descobrindo o elemento mais próximo:
  16640. for (var i = 0; i < all_sub.length; i++) {
  16641. t_top = all_sub[i].getBoundingClientRect().top;
  16642. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16643. if (t_top - event.clientY < menor_distancia) {
  16644. menor_distancia = event.clientY - t_top;
  16645. elemento_menor_distancia = all_sub[i];
  16646. }
  16647. }
  16648. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16649. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16650. if (borda_inferior - event.clientY < menor_distancia) {
  16651. var recentComand = genericCreateCommand(command_type);
  16652. function_obj.commands.push(recentComand);
  16653. //
  16654. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16655. } else {
  16656. var recentComand = genericCreateCommand(command_type);
  16657. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16658. if (index > -1) {
  16659. function_obj.commands.splice(index, 0, recentComand);
  16660. }
  16661. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16662. }
  16663. }
  16664. /***/ }),
  16665. /***/ "./js/visualUI/commands/attribution.js":
  16666. /*!*********************************************!*\
  16667. !*** ./js/visualUI/commands/attribution.js ***!
  16668. \*********************************************/
  16669. /*! no static exports found */
  16670. /***/ (function(module, exports, __webpack_require__) {
  16671. "use strict";
  16672. Object.defineProperty(exports, "__esModule", {
  16673. value: true
  16674. });
  16675. exports.createFloatingCommand = createFloatingCommand;
  16676. exports.renderCommand = renderCommand;
  16677. exports.manageExpressionElements = manageExpressionElements;
  16678. exports.renderMenuOperations = renderMenuOperations;
  16679. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16680. var _jquery2 = _interopRequireDefault(_jquery);
  16681. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16682. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16683. var Models = _interopRequireWildcard(_ivprog_elements);
  16684. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16685. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16686. var GlobalsManagement = _interopRequireWildcard(_globals);
  16687. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16688. var VariablesManagement = _interopRequireWildcard(_variables);
  16689. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16690. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16691. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16692. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16693. var CommandsManagement = _interopRequireWildcard(_commands);
  16694. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  16695. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16696. function createFloatingCommand() {
  16697. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  16698. }
  16699. function renderCommand(command, function_obj) {
  16700. var el = (0, _jquery2.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">' + _localizedStringsService.LocalizedStrings.getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> </div>');
  16701. el.data('command', command);
  16702. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  16703. if (!command.expression || command.expression.length < 1) {
  16704. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.none, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16705. command.expression.push(exp);
  16706. }
  16707. addHandlers(command, function_obj, el);
  16708. renderExpressionElements(command, function_obj, el);
  16709. return el;
  16710. }
  16711. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  16712. var index_to_move = expression_element.itens.indexOf(ref_object);
  16713. switch (selectedItem.data('exp')) {
  16714. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16715. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [expression_element.itens[index_to_move], Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16716. expression_element.itens[index_to_move] = exp;
  16717. break;
  16718. case Models.EXPRESSION_ELEMENTS.op_exp:
  16719. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  16720. expression_element.itens[index_to_move] = exp;
  16721. break;
  16722. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16723. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  16724. expression_element.itens[index_to_move] = exp;
  16725. break;
  16726. }
  16727. renderExpressionElements(command, function_obj, dom_object);
  16728. }
  16729. function renderExpressionElements(command, function_obj, el) {
  16730. var expression_div = el.find('.expression_elements');
  16731. var command_container;
  16732. if (el.hasClass("command_container") == false) {
  16733. var hier = el.parentsUntil(".command_container");
  16734. for (var i = 0; i < hier.length; i++) {
  16735. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16736. command_container = (0, _jquery2.default)(hier[i]);
  16737. break;
  16738. }
  16739. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16740. expression_div = (0, _jquery2.default)(hier[i]);
  16741. break;
  16742. }
  16743. }
  16744. }
  16745. if (command_container) {
  16746. expression_div = command_container.find('.expression_elements');
  16747. }
  16748. expression_div.text('');
  16749. for (var i = 0; i < command.expression.length; i++) {
  16750. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16751. temp.data('ref_element', command.expression[i]);
  16752. temp.data('ref_index', i);
  16753. expression_div.append(temp);
  16754. renderElement(command, function_obj, temp, command.expression[i]);
  16755. }
  16756. }
  16757. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  16758. var context_menu = '<div class="ui dropdown"><div class="text">';
  16759. switch (expression_element.itens[index_op]) {
  16760. case Models.ARITHMETIC_TYPES.plus:
  16761. context_menu += '+';
  16762. break;
  16763. case Models.ARITHMETIC_TYPES.minus:
  16764. context_menu += '-';
  16765. break;
  16766. case Models.ARITHMETIC_TYPES.multiplication:
  16767. context_menu += '*';
  16768. break;
  16769. case Models.ARITHMETIC_TYPES.division:
  16770. context_menu += '/';
  16771. break;
  16772. case Models.ARITHMETIC_TYPES.module:
  16773. context_menu += '%';
  16774. break;
  16775. case Models.ARITHMETIC_TYPES.none:
  16776. context_menu += '...';
  16777. break;
  16778. }
  16779. context_menu += '</div><div class="menu">';
  16780. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  16781. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  16782. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  16783. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  16784. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  16785. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  16786. context_menu += '</div></div>';
  16787. context_menu = (0, _jquery2.default)(context_menu);
  16788. temp_op.append(context_menu);
  16789. context_menu.dropdown({
  16790. onChange: function onChange(value, text, $selectedItem) {
  16791. expression_element.itens[index_op] = value;
  16792. }
  16793. });
  16794. }
  16795. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  16796. if (el.hasClass("command_container") == false) {
  16797. var hier = el.parentsUntil(".commands_list_div");
  16798. for (var i = 0; i < hier.length; i++) {
  16799. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16800. el = (0, _jquery2.default)(hier[i]);
  16801. break;
  16802. }
  16803. }
  16804. }
  16805. if (dom_append_menu.hasClass("expression_elements") == false) {
  16806. var hier = el.parentsUntil(".commands_list_div");
  16807. for (var i = 0; i < hier.length; i++) {
  16808. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16809. dom_append_menu = (0, _jquery2.default)(hier[i]);
  16810. break;
  16811. }
  16812. }
  16813. }
  16814. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  16815. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16816. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16817. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16818. context_menu += '</div></div>';
  16819. context_menu = (0, _jquery2.default)(context_menu);
  16820. dom_append_menu.append(context_menu);
  16821. context_menu.dropdown({
  16822. onChange: function onChange(value, text, $selectedItem) {
  16823. switch (value) {
  16824. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16825. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16826. expression_append_new_expression.push(exp);
  16827. break;
  16828. case Models.EXPRESSION_ELEMENTS.op_exp:
  16829. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16830. expression_append_new_expression.push(exp);
  16831. break;
  16832. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16833. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16834. expression_append_new_expression.push(exp);
  16835. break;
  16836. }
  16837. renderExpressionElements(command, function_obj, el);
  16838. }
  16839. });
  16840. }
  16841. function renderElement(command, function_obj, el, expression_element) {
  16842. switch (expression_element.type_exp) {
  16843. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16844. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16845. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  16846. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  16847. el.append(temp_exp_1);
  16848. el.append(temp_op);
  16849. el.append(temp_exp_2);
  16850. if (expression_element.itens[0].type) {
  16851. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  16852. } else {
  16853. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  16854. }
  16855. renderOperator(command, function_obj, temp_op, expression_element, 1);
  16856. if (expression_element.itens[2].type) {
  16857. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  16858. } else {
  16859. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  16860. }
  16861. break;
  16862. case Models.EXPRESSION_ELEMENTS.op_exp:
  16863. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16864. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16865. el.append(temp_op);
  16866. el.append(temp_exp);
  16867. renderOperator(command, function_obj, temp_op, expression_element, 0);
  16868. if (expression_element.itens[1].type) {
  16869. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  16870. } else {
  16871. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  16872. }
  16873. break;
  16874. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16875. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  16876. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16877. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  16878. el.append(temp_par_1);
  16879. el.append(temp_exp);
  16880. for (var j = 0; j < expression_element.itens.length; j++) {
  16881. if (expression_element.itens[j].type) {
  16882. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  16883. } else {
  16884. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  16885. }
  16886. }
  16887. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  16888. el.append(temp_par_2);
  16889. break;
  16890. }
  16891. }
  16892. function renderExpression(command, function_obj, el) {
  16893. var expression_div = el.find('.expression_elements');
  16894. expression_div.text('');
  16895. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16896. menu_add_item.data('index_add', 0);
  16897. expression_div.append(menu_add_item);
  16898. for (var i = 0; i < command.expression.length; i++) {
  16899. if (command.expression[i].type) {
  16900. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16901. temp.data('ref_element', command.expression[i]);
  16902. temp.data('ref_index', i);
  16903. expression_div.append(temp);
  16904. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  16905. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  16906. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  16907. temp.data('ref_element', command.expression[i]);
  16908. temp.data('ref_index', i);
  16909. expression_div.append(temp);
  16910. } else {
  16911. var temp = '<div class="expression_element">';
  16912. switch (command.expression[i]) {
  16913. case Models.ARITHMETIC_TYPES.plus:
  16914. temp += '+';
  16915. break;
  16916. case Models.ARITHMETIC_TYPES.minus:
  16917. temp += '-';
  16918. break;
  16919. case Models.ARITHMETIC_TYPES.multiplication:
  16920. temp += '*';
  16921. break;
  16922. case Models.ARITHMETIC_TYPES.division:
  16923. temp += '/';
  16924. break;
  16925. case Models.ARITHMETIC_TYPES.module:
  16926. temp += '%';
  16927. break;
  16928. }
  16929. temp += '</div>';
  16930. temp = (0, _jquery2.default)(temp);
  16931. temp.data('ref_element', command.expression[i]);
  16932. temp.data('ref_index', i);
  16933. expression_div.append(temp);
  16934. }
  16935. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16936. var index_temp = i + 1;
  16937. menu_add_item_seq.data('index_add', index_temp);
  16938. expression_div.append(menu_add_item_seq);
  16939. }
  16940. addMenuItens(command, function_obj, el);
  16941. }
  16942. function addMenuItens(command, function_obj, expression_div) {
  16943. var divs_expression = expression_div.find('.menu_add_item');
  16944. for (var i = 0; i < divs_expression.length; i++) {
  16945. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  16946. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  16947. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  16948. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  16949. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  16950. context_menu += '</div></div>';
  16951. context_menu = (0, _jquery2.default)(context_menu);
  16952. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  16953. context_menu.dropdown({
  16954. on: 'hover',
  16955. onChange: function onChange(value, text, $selectedItem) {
  16956. switch ($selectedItem.data('option')) {
  16957. case "value":
  16958. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16959. renderExpression(command, function_obj, expression_div);
  16960. break;
  16961. case "operator":
  16962. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  16963. renderExpression(command, function_obj, expression_div);
  16964. break;
  16965. case "parentheses":
  16966. command.expression.splice($selectedItem.data('index'), 0, "(");
  16967. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16968. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  16969. renderExpression(command, function_obj, expression_div);
  16970. break;
  16971. }
  16972. }
  16973. });
  16974. }
  16975. }
  16976. function addHandlers(command, function_obj, attribution_dom) {
  16977. attribution_dom.find('.button_remove_command').on('click', function () {
  16978. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  16979. attribution_dom.fadeOut();
  16980. }
  16981. });
  16982. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  16983. renderExpressionElements(command, function_obj, attribution_dom);
  16984. });
  16985. }
  16986. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  16987. /*console.log("recebido o seguinte DOM: ");
  16988. console.log(dom_object);
  16989. if (dom_object.hasClass('var_attributed')) {
  16990. return;
  16991. } else {
  16992. var hier = dom_object.parentsUntil(".command_container");
  16993. for (var i = 0; i < hier.length; i++) {
  16994. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  16995. return;
  16996. }
  16997. }
  16998. }
  16999. dom_object.find('.context_menu_clear').remove();
  17000. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17001. for (var tm in Models.ARITHMETIC_TYPES) {
  17002. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  17003. }
  17004. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  17005. menu_operations += '</div></div>';
  17006. menu_operations = $(menu_operations);
  17007. dom_object.append(menu_operations);
  17008. menu_operations.dropdown({
  17009. onChange: function(value, text, $selectedItem) {
  17010. switch ($($selectedItem).data('option')) {
  17011. case "clear":
  17012. $(dom_object).text('');
  17013. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  17014. break;
  17015. default:
  17016. createExpressionAround(command, ref_object, dom_object, function_obj);
  17017. menu_operations.find('.text').text('');
  17018. }
  17019. }
  17020. });*/
  17021. }
  17022. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  17023. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  17024. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  17025. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  17026. }
  17027. /***/ }),
  17028. /***/ "./js/visualUI/commands/break.js":
  17029. /*!***************************************!*\
  17030. !*** ./js/visualUI/commands/break.js ***!
  17031. \***************************************/
  17032. /*! no static exports found */
  17033. /***/ (function(module, exports, __webpack_require__) {
  17034. "use strict";
  17035. Object.defineProperty(exports, "__esModule", {
  17036. value: true
  17037. });
  17038. exports.createFloatingCommand = createFloatingCommand;
  17039. exports.renderCommand = renderCommand;
  17040. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17041. var _jquery2 = _interopRequireDefault(_jquery);
  17042. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17043. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17044. var Models = _interopRequireWildcard(_ivprog_elements);
  17045. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17046. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17047. var CommandsManagement = _interopRequireWildcard(_commands);
  17048. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17049. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17050. function createFloatingCommand() {
  17051. return (0, _jquery2.default)('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_break') + ' </span></div>');
  17052. }
  17053. function renderCommand(command, function_obj) {
  17054. var el = (0, _jquery2.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>' + _localizedStringsService.LocalizedStrings.getUI('text_break') + '</span> </div>');
  17055. el.data('command', command);
  17056. addHandlers(command, function_obj, el);
  17057. return el;
  17058. }
  17059. function addHandlers(command, function_obj, break_dom) {
  17060. break_dom.find('.button_remove_command').on('click', function () {
  17061. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  17062. break_dom.fadeOut();
  17063. }
  17064. });
  17065. }
  17066. /***/ }),
  17067. /***/ "./js/visualUI/commands/comment.js":
  17068. /*!*****************************************!*\
  17069. !*** ./js/visualUI/commands/comment.js ***!
  17070. \*****************************************/
  17071. /*! no static exports found */
  17072. /***/ (function(module, exports, __webpack_require__) {
  17073. "use strict";
  17074. Object.defineProperty(exports, "__esModule", {
  17075. value: true
  17076. });
  17077. exports.createFloatingCommand = createFloatingCommand;
  17078. exports.renderCommand = renderCommand;
  17079. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17080. var _jquery2 = _interopRequireDefault(_jquery);
  17081. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17082. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17083. var Models = _interopRequireWildcard(_ivprog_elements);
  17084. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17085. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17086. var GlobalsManagement = _interopRequireWildcard(_globals);
  17087. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17088. var VariablesManagement = _interopRequireWildcard(_variables);
  17089. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17090. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17091. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17092. var CommandsManagement = _interopRequireWildcard(_commands);
  17093. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17094. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17095. function createFloatingCommand() {
  17096. return (0, _jquery2.default)('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + ' </span></div>');
  17097. }
  17098. function renderCommand(command, function_obj) {
  17099. var el = (0, _jquery2.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>');
  17100. el.data('command', command);
  17101. addHandlers(command, function_obj, el);
  17102. renderTextComment(command, function_obj, el);
  17103. return el;
  17104. }
  17105. function renderTextComment(command, function_obj, el) {
  17106. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  17107. }
  17108. function addHandlers(command, function_obj, comment_dom) {
  17109. comment_dom.find('.button_remove_command').on('click', function () {
  17110. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  17111. comment_dom.fadeOut();
  17112. }
  17113. });
  17114. }
  17115. /***/ }),
  17116. /***/ "./js/visualUI/commands/conditional_expression.js":
  17117. /*!********************************************************!*\
  17118. !*** ./js/visualUI/commands/conditional_expression.js ***!
  17119. \********************************************************/
  17120. /*! no static exports found */
  17121. /***/ (function(module, exports, __webpack_require__) {
  17122. "use strict";
  17123. Object.defineProperty(exports, "__esModule", {
  17124. value: true
  17125. });
  17126. exports.renderExpression = renderExpression;
  17127. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17128. var _jquery2 = _interopRequireDefault(_jquery);
  17129. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17130. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17131. var Models = _interopRequireWildcard(_ivprog_elements);
  17132. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17133. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17134. var GlobalsManagement = _interopRequireWildcard(_globals);
  17135. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17136. var VariablesManagement = _interopRequireWildcard(_variables);
  17137. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17138. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17139. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17140. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17141. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  17142. expression.dom_object = initial_el_to_render;
  17143. if (expression.expression == null || expression.expression.length < 1) {
  17144. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  17145. } else {
  17146. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  17147. switch (expression.expression.type) {
  17148. case Models.EXPRESSION_TYPES.exp_logic:
  17149. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  17150. break;
  17151. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17152. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  17153. break;
  17154. }
  17155. initial_el_to_render.append(main_div);
  17156. var restartMenu = (0, _jquery2.default)('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  17157. initial_el_to_render.append(restartMenu);
  17158. restartMenu.on('click', function (e) {
  17159. expression.expression = null;
  17160. initial_el_to_render.empty();
  17161. renderExpression(command, expression, function_obj, initial_el_to_render);
  17162. });
  17163. }
  17164. }
  17165. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  17166. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17167. menu_operator.dropdown({
  17168. values: [{
  17169. name: '>',
  17170. value: Models.ARITHMETIC_COMPARISON.greater_than,
  17171. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  17172. }, {
  17173. name: '<',
  17174. value: Models.ARITHMETIC_COMPARISON.less_than,
  17175. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  17176. }, {
  17177. name: '==',
  17178. value: Models.ARITHMETIC_COMPARISON.equals_to,
  17179. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  17180. }, {
  17181. name: '!=',
  17182. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  17183. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  17184. }, {
  17185. name: '>=',
  17186. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  17187. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  17188. }, {
  17189. name: '<=',
  17190. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  17191. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  17192. }],
  17193. onChange: function onChange(value, text, $selectedItem) {
  17194. expression_arithmetic.operator = value;
  17195. }
  17196. });
  17197. element_to_append.append(menu_operator);
  17198. }
  17199. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  17200. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17201. menu_operator.dropdown({
  17202. values: [{
  17203. name: '==',
  17204. value: Models.LOGIC_COMPARISON.equals_to,
  17205. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  17206. }, {
  17207. name: '!=',
  17208. value: Models.LOGIC_COMPARISON.not_equals_to,
  17209. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  17210. }, {
  17211. name: '&&',
  17212. value: Models.LOGIC_COMPARISON.and,
  17213. selected: logic_operator == Models.LOGIC_COMPARISON.and
  17214. }, {
  17215. name: '||',
  17216. value: Models.LOGIC_COMPARISON.or,
  17217. selected: logic_operator == Models.LOGIC_COMPARISON.or
  17218. }],
  17219. onChange: function onChange(value, text, $selectedItem) {
  17220. if ($selectedItem) {
  17221. expression_logic.operator = value;
  17222. if (expression_logic.second_operand == null) {
  17223. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  17224. initial_el_to_render.empty();
  17225. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  17226. }
  17227. }
  17228. }
  17229. });
  17230. element_to_append.append(menu_operator);
  17231. }
  17232. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  17233. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17234. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17235. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17236. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17237. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17238. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17239. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17240. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17241. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17242. } else {
  17243. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  17244. }
  17245. element_to_append.append(exp_el_par_1);
  17246. element_to_append.append(exp_el_expr_el_1);
  17247. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  17248. element_to_append.append(exp_el_expr_operand);
  17249. if (expression_logic.second_operand) {
  17250. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17251. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17252. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17253. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17254. } else {
  17255. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  17256. }
  17257. element_to_append.append(exp_el_expr_el_2);
  17258. }
  17259. element_to_append.append(exp_el_par_2);
  17260. }
  17261. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  17262. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17263. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17264. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17265. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17266. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17267. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17268. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17269. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17270. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17271. } else {
  17272. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  17273. }
  17274. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17275. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17276. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17277. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17278. } else {
  17279. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  17280. }
  17281. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  17282. element_to_append.append(exp_el_par_1);
  17283. element_to_append.append(exp_el_expr_el_1);
  17284. element_to_append.append(exp_el_expr_operand);
  17285. element_to_append.append(exp_el_expr_el_2);
  17286. element_to_append.append(exp_el_par_2);
  17287. }
  17288. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  17289. var start_menu = '';
  17290. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>' + _localizedStringsService.LocalizedStrings.getUI('expression_menu_select') + '</i></div><i class="dropdown icon"></i><div class="menu">';
  17291. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + ' (EL == EL and EL)</div>';
  17292. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + ' (EA < EA)</div>';
  17293. start_menu += '</div></div>';
  17294. start_menu = (0, _jquery2.default)(start_menu);
  17295. start_menu.dropdown({
  17296. onChange: function onChange(value, text, $selectedItem) {
  17297. switch ($selectedItem.data('exp')) {
  17298. case Models.EXPRESSION_TYPES.exp_logic:
  17299. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17300. break;
  17301. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17302. expression.expression = new Models.ArithmeticExpression(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_COMPARISON.less_than);
  17303. break;
  17304. }
  17305. initial_el_to_render.html('');
  17306. renderExpression(command, expression, function_obj, initial_el_to_render);
  17307. },
  17308. selectOnKeydown: false
  17309. });
  17310. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17311. initial_el_to_render.append(start_menu);
  17312. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17313. }
  17314. /***/ }),
  17315. /***/ "./js/visualUI/commands/contextualized_menu.js":
  17316. /*!*****************************************************!*\
  17317. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  17318. \*****************************************************/
  17319. /*! no static exports found */
  17320. /***/ (function(module, exports, __webpack_require__) {
  17321. "use strict";
  17322. Object.defineProperty(exports, "__esModule", {
  17323. value: true
  17324. });
  17325. exports.renderMenu = renderMenu;
  17326. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17327. var _jquery2 = _interopRequireDefault(_jquery);
  17328. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17329. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17330. var Models = _interopRequireWildcard(_ivprog_elements);
  17331. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17332. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17333. var CommandsManagement = _interopRequireWildcard(_commands);
  17334. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17335. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17336. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  17337. var SwitchManagement = _interopRequireWildcard(_switch);
  17338. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17339. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17340. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17341. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17342. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  17343. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  17344. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17345. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17346. } else {
  17347. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17348. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  17349. }
  17350. menu_div += '</div></div>';
  17351. menu_div = (0, _jquery2.default)(menu_div);
  17352. dom_where_render.append(menu_div);
  17353. addHandlers(command, dom_where_render, function_obj, dom_command);
  17354. }
  17355. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  17356. console.log('command, dom_where_render, function_obj, dom_command');
  17357. console.log(command, dom_where_render, function_obj, dom_command);
  17358. console.log(dom_where_render.parents());
  17359. dom_where_render.find('.menu_commands').dropdown({
  17360. on: 'hover'
  17361. });
  17362. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  17363. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17364. if (command.commands_block == null || command.commands_block.length == 0) {
  17365. command.commands_block = [];
  17366. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  17367. command.commands_block.push(new_cmd);
  17368. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  17369. } else {
  17370. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17371. }
  17372. } else {
  17373. switch ((0, _jquery2.default)(this).data('command')) {
  17374. case Models.COMMAND_TYPES.break:
  17375. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17376. break;
  17377. case Models.COMMAND_TYPES.switchcase:
  17378. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  17379. break;
  17380. }
  17381. }
  17382. });
  17383. }
  17384. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  17385. if (command.cases == null) {
  17386. command.cases = [];
  17387. }
  17388. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17389. command.cases.push(sc);
  17390. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  17391. }
  17392. /***/ }),
  17393. /***/ "./js/visualUI/commands/dowhiletrue.js":
  17394. /*!*********************************************!*\
  17395. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  17396. \*********************************************/
  17397. /*! no static exports found */
  17398. /***/ (function(module, exports, __webpack_require__) {
  17399. "use strict";
  17400. Object.defineProperty(exports, "__esModule", {
  17401. value: true
  17402. });
  17403. exports.createFloatingCommand = createFloatingCommand;
  17404. exports.renderCommand = renderCommand;
  17405. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17406. var _jquery2 = _interopRequireDefault(_jquery);
  17407. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17408. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17409. var Models = _interopRequireWildcard(_ivprog_elements);
  17410. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17411. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17412. var GlobalsManagement = _interopRequireWildcard(_globals);
  17413. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17414. var VariablesManagement = _interopRequireWildcard(_variables);
  17415. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17416. var CommandsManagement = _interopRequireWildcard(_commands);
  17417. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17418. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17419. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17420. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17421. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17422. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17423. function createFloatingCommand() {
  17424. return (0, _jquery2.default)('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_do') + ' {<br>} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + '(x < 10) </span></div>');
  17425. }
  17426. function renderCommand(command, function_obj) {
  17427. var ret = '';
  17428. ret += '<div class="ui dowhiletrue 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 class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_do') + ' </span>';
  17429. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  17430. ret += '</div>';
  17431. ret += ' <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17432. ret += '</div>';
  17433. var el = (0, _jquery2.default)(ret);
  17434. el.data('command', command);
  17435. addHandlers(command, function_obj, el);
  17436. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17437. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17438. if (command.commands_block) {
  17439. for (var j = 0; j < command.commands_block.length; j++) {
  17440. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17441. }
  17442. }
  17443. return el;
  17444. }
  17445. function addHandlers(command, function_obj, dowhiletrue_dom) {
  17446. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  17447. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  17448. dowhiletrue_dom.fadeOut();
  17449. }
  17450. });
  17451. }
  17452. /***/ }),
  17453. /***/ "./js/visualUI/commands/functioncall.js":
  17454. /*!**********************************************!*\
  17455. !*** ./js/visualUI/commands/functioncall.js ***!
  17456. \**********************************************/
  17457. /*! no static exports found */
  17458. /***/ (function(module, exports, __webpack_require__) {
  17459. "use strict";
  17460. Object.defineProperty(exports, "__esModule", {
  17461. value: true
  17462. });
  17463. exports.createFloatingCommand = createFloatingCommand;
  17464. exports.renderCommand = renderCommand;
  17465. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17466. var _jquery2 = _interopRequireDefault(_jquery);
  17467. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17468. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17469. var Models = _interopRequireWildcard(_ivprog_elements);
  17470. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17471. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17472. var GlobalsManagement = _interopRequireWildcard(_globals);
  17473. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17474. var VariablesManagement = _interopRequireWildcard(_variables);
  17475. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17476. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17477. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17478. var CommandsManagement = _interopRequireWildcard(_commands);
  17479. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17480. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17481. function createFloatingCommand() {
  17482. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  17483. }
  17484. function renderCommand(command, function_obj) {
  17485. var el = (0, _jquery2.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>');
  17486. el.data('command', command);
  17487. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  17488. addHandlers(command, function_obj, el);
  17489. return el;
  17490. }
  17491. function addHandlers(command, function_obj, functioncall_dom) {
  17492. functioncall_dom.find('.button_remove_command').on('click', function () {
  17493. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  17494. functioncall_dom.fadeOut();
  17495. }
  17496. });
  17497. }
  17498. /***/ }),
  17499. /***/ "./js/visualUI/commands/iftrue.js":
  17500. /*!****************************************!*\
  17501. !*** ./js/visualUI/commands/iftrue.js ***!
  17502. \****************************************/
  17503. /*! no static exports found */
  17504. /***/ (function(module, exports, __webpack_require__) {
  17505. "use strict";
  17506. Object.defineProperty(exports, "__esModule", {
  17507. value: true
  17508. });
  17509. exports.createFloatingCommand = createFloatingCommand;
  17510. exports.renderCommand = renderCommand;
  17511. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17512. var _jquery2 = _interopRequireDefault(_jquery);
  17513. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17514. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17515. var Models = _interopRequireWildcard(_ivprog_elements);
  17516. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17517. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17518. var GlobalsManagement = _interopRequireWildcard(_globals);
  17519. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17520. var VariablesManagement = _interopRequireWildcard(_variables);
  17521. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17522. var CommandsManagement = _interopRequireWildcard(_commands);
  17523. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17524. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17525. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17526. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17527. function createFloatingCommand() {
  17528. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17529. }
  17530. function renderCommand(command, function_obj) {
  17531. var ret = '';
  17532. 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>';
  17533. ret += '<span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  17534. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17535. ret += '<span> </span> ';
  17536. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17537. ret += '</div></div>';
  17538. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  17539. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17540. ret += '</div>';
  17541. ret += '<span></span></div>';
  17542. ret += '</div>';
  17543. var el = (0, _jquery2.default)(ret);
  17544. el.data('command', command);
  17545. el.find('.block_commands').data('command', command);
  17546. el.find('.data_block_if').data('command', command);
  17547. el.find('.data_block_else').data('command', command);
  17548. addHandlers(command, function_obj, el);
  17549. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17550. if (command.commands_block) {
  17551. for (var j = 0; j < command.commands_block.length; j++) {
  17552. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.commands_if')[0]), 3, function_obj);
  17553. }
  17554. }
  17555. if (command.commands_else) {
  17556. for (var j = 0; j < command.commands_else.length; j++) {
  17557. CommandsManagement.renderCommand(command.commands_else[j], (0, _jquery2.default)(el.find('.commands_else')[0]), 3, function_obj);
  17558. }
  17559. }
  17560. return el;
  17561. }
  17562. function addHandlers(command, function_obj, iftrue_dom) {
  17563. iftrue_dom.find('.button_remove_command').on('click', function () {
  17564. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  17565. iftrue_dom.fadeOut();
  17566. }
  17567. });
  17568. }
  17569. /***/ }),
  17570. /***/ "./js/visualUI/commands/reader.js":
  17571. /*!****************************************!*\
  17572. !*** ./js/visualUI/commands/reader.js ***!
  17573. \****************************************/
  17574. /*! no static exports found */
  17575. /***/ (function(module, exports, __webpack_require__) {
  17576. "use strict";
  17577. Object.defineProperty(exports, "__esModule", {
  17578. value: true
  17579. });
  17580. exports.createFloatingCommand = createFloatingCommand;
  17581. exports.renderCommand = renderCommand;
  17582. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17583. var _jquery2 = _interopRequireDefault(_jquery);
  17584. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17585. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17586. var Models = _interopRequireWildcard(_ivprog_elements);
  17587. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17588. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17589. var GlobalsManagement = _interopRequireWildcard(_globals);
  17590. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17591. var VariablesManagement = _interopRequireWildcard(_variables);
  17592. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17593. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17594. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17595. var CommandsManagement = _interopRequireWildcard(_commands);
  17596. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17597. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17598. function createFloatingCommand() {
  17599. return (0, _jquery2.default)('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' var </span></div>');
  17600. }
  17601. function renderCommand(command, function_obj) {
  17602. 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">' + _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  17603. el = (0, _jquery2.default)(el);
  17604. el.data('command', command);
  17605. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17606. addHandlers(command, function_obj, el);
  17607. return el;
  17608. }
  17609. function addHandlers(command, function_obj, reader_dom) {
  17610. reader_dom.find('.button_remove_command').on('click', function () {
  17611. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  17612. reader_dom.fadeOut();
  17613. }
  17614. });
  17615. }
  17616. /***/ }),
  17617. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17618. /*!**********************************************!*\
  17619. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17620. \**********************************************/
  17621. /*! no static exports found */
  17622. /***/ (function(module, exports, __webpack_require__) {
  17623. "use strict";
  17624. Object.defineProperty(exports, "__esModule", {
  17625. value: true
  17626. });
  17627. exports.createFloatingCommand = createFloatingCommand;
  17628. exports.renderCommand = renderCommand;
  17629. exports.manageExpressionElements = manageExpressionElements;
  17630. exports.manageClearExpressionElements = manageClearExpressionElements;
  17631. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17632. var _jquery2 = _interopRequireDefault(_jquery);
  17633. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17634. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17635. var Models = _interopRequireWildcard(_ivprog_elements);
  17636. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17637. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17638. var GlobalsManagement = _interopRequireWildcard(_globals);
  17639. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17640. var VariablesManagement = _interopRequireWildcard(_variables);
  17641. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17642. var CommandsManagement = _interopRequireWildcard(_commands);
  17643. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17644. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17645. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17646. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17647. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17648. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17649. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17650. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17651. function createFloatingCommand() {
  17652. return (0, _jquery2.default)('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> para (x = 0; x < 10; x ++) { } </span></div>');
  17653. }
  17654. function renderCommand(command, function_obj) {
  17655. var ret = '<div class="ui repeatNtimes 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 class="span_command_spec"> ' + _localizedStringsService.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>';
  17656. ret += '<div class="ui block_commands">';
  17657. ret += '</div>';
  17658. ret += '<span> </span>';
  17659. ret += '</div>';
  17660. var el = (0, _jquery2.default)(ret);
  17661. el.data('command', command);
  17662. addHandlers(command, function_obj, el);
  17663. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17664. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  17665. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  17666. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17667. if (command.expression1) {
  17668. el.find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17669. VariableValueMenu.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17670. }
  17671. if (command.expression3) {
  17672. el.find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17673. VariableValueMenu.renderMenu(command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  17674. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17675. VariableValueMenu.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17676. }
  17677. if (command.commands_block) {
  17678. for (var j = 0; j < command.commands_block.length; j++) {
  17679. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17680. }
  17681. }
  17682. return el;
  17683. }
  17684. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17685. if (dom_object.hasClass('variable_attribution')) {
  17686. if (!command.expression3) {
  17687. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [command.var_attribution, Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "1", null, null, true)]);
  17688. command.expression3 = exp;
  17689. command.var_incrementation = command.var_attribution;
  17690. var cond_exp = new Models.ArithmeticExpression(command.var_attribution, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_COMPARISON.less_than);
  17691. command.expression2.expression = cond_exp;
  17692. }
  17693. dom_object.parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17694. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17695. dom_object.parent().find('.var_value_expression').empty();
  17696. VariableValueMenu.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17697. renderAlgorithm();
  17698. }
  17699. if (dom_object.hasClass('incrementation_variable')) {
  17700. dom_object.parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17701. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.exp_op_exp, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), Models.ARITHMETIC_TYPES.plus, new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  17702. command.expression3 = exp;
  17703. VariableValueMenu.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17704. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17705. VariableValueMenu.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17706. }
  17707. }
  17708. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17709. if (dom_object.hasClass('variable_attribution')) {
  17710. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  17711. command.expression1 = null;
  17712. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  17713. }
  17714. if (dom_object.hasClass('incrementation_variable')) {
  17715. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  17716. command.expression3 = null;
  17717. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  17718. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  17719. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  17720. }
  17721. }
  17722. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17723. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17724. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17725. repeatNtimes_dom.fadeOut();
  17726. }
  17727. });
  17728. }
  17729. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17730. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  17731. menu_operator.dropdown({
  17732. values: [{
  17733. name: '+',
  17734. value: Models.ARITHMETIC_TYPES.plus,
  17735. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  17736. }, {
  17737. name: '-',
  17738. value: Models.ARITHMETIC_TYPES.minus,
  17739. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  17740. }, {
  17741. name: '*',
  17742. value: Models.ARITHMETIC_TYPES.multiplication,
  17743. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  17744. }, {
  17745. name: '/',
  17746. value: Models.ARITHMETIC_TYPES.division,
  17747. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  17748. }, {
  17749. name: '%',
  17750. value: Models.ARITHMETIC_TYPES.module,
  17751. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  17752. }],
  17753. onChange: function onChange(value, text, $selectedItem) {
  17754. expression_element.itens[index_op] = value;
  17755. }
  17756. });
  17757. temp_op.append(menu_operator);
  17758. }
  17759. /***/ }),
  17760. /***/ "./js/visualUI/commands/return.js":
  17761. /*!****************************************!*\
  17762. !*** ./js/visualUI/commands/return.js ***!
  17763. \****************************************/
  17764. /*! no static exports found */
  17765. /***/ (function(module, exports, __webpack_require__) {
  17766. "use strict";
  17767. Object.defineProperty(exports, "__esModule", {
  17768. value: true
  17769. });
  17770. exports.createFloatingCommand = createFloatingCommand;
  17771. exports.renderCommand = renderCommand;
  17772. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17773. var _jquery2 = _interopRequireDefault(_jquery);
  17774. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17775. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17776. var Models = _interopRequireWildcard(_ivprog_elements);
  17777. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17778. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17779. var GlobalsManagement = _interopRequireWildcard(_globals);
  17780. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17781. var VariablesManagement = _interopRequireWildcard(_variables);
  17782. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17783. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17784. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17785. var CommandsManagement = _interopRequireWildcard(_commands);
  17786. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17787. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17788. function createFloatingCommand() {
  17789. return (0, _jquery2.default)('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span></div>');
  17790. }
  17791. function renderCommand(command, function_obj) {
  17792. var el = (0, _jquery2.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"> ' + _localizedStringsService.LocalizedStrings.getUI('text_return') + ' </span> <div class="var_value_menu_div"></div></div>');
  17793. el.data('command', command);
  17794. addHandlers(command, function_obj, el);
  17795. if (function_obj.return_type != _types.Types.VOID) {
  17796. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17797. } else {
  17798. el.find('.var_value_menu_div').remove();
  17799. }
  17800. return el;
  17801. }
  17802. function addHandlers(command, function_obj, return_dom) {
  17803. return_dom.find('.button_remove_command').on('click', function () {
  17804. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  17805. return_dom.fadeOut();
  17806. }
  17807. });
  17808. }
  17809. /***/ }),
  17810. /***/ "./js/visualUI/commands/switch.js":
  17811. /*!****************************************!*\
  17812. !*** ./js/visualUI/commands/switch.js ***!
  17813. \****************************************/
  17814. /*! no static exports found */
  17815. /***/ (function(module, exports, __webpack_require__) {
  17816. "use strict";
  17817. Object.defineProperty(exports, "__esModule", {
  17818. value: true
  17819. });
  17820. exports.createFloatingCommand = createFloatingCommand;
  17821. exports.renderCommand = renderCommand;
  17822. exports.renderCase = renderCase;
  17823. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17824. var _jquery2 = _interopRequireDefault(_jquery);
  17825. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17826. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17827. var Models = _interopRequireWildcard(_ivprog_elements);
  17828. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17829. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17830. var GlobalsManagement = _interopRequireWildcard(_globals);
  17831. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17832. var VariablesManagement = _interopRequireWildcard(_variables);
  17833. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17834. var CommandsManagement = _interopRequireWildcard(_commands);
  17835. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17836. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17837. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17838. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17839. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17840. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17841. function createFloatingCommand() {
  17842. return (0, _jquery2.default)('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( x ) { <br> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' 1: <br> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' 2: <br> } </span></div>');
  17843. }
  17844. function renderCommand(command, function_obj) {
  17845. var ret = '';
  17846. 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> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( <div class="ui variable_to_switch"></div> ) <div class="ui all_cases_div"></div></span>';
  17847. ret += '</div>';
  17848. var el = (0, _jquery2.default)(ret);
  17849. el.data('command', command);
  17850. addHandlers(command, function_obj, el);
  17851. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17852. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17853. if (command.cases) {
  17854. for (var i = 0; i < command.cases.length; i++) {
  17855. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17856. }
  17857. }
  17858. return el;
  17859. }
  17860. function renderCase(switchcase, command, function_obj, el) {
  17861. var casediv = (0, _jquery2.default)('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>' + _localizedStringsService.LocalizedStrings.getUI('text_code_case') + '</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');
  17862. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17863. casediv.data('switchcase', switchcase);
  17864. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17865. el.append(casediv);
  17866. if (switchcase.commands_block) {
  17867. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17868. CommandsManagement.renderCommand(switchcase.commands_block[j], (0, _jquery2.default)(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17869. }
  17870. }
  17871. casediv.find('.button_remove_command').on('click', function () {
  17872. for (var i = 0; i < command.cases.length; i++) {
  17873. if (switchcase == command.cases[i]) {
  17874. delete command.cases[i];
  17875. command.cases.splice(i, 1);
  17876. casediv.remove();
  17877. break;
  17878. }
  17879. }
  17880. });
  17881. }
  17882. function addHandlers(command, function_obj, switch_dom) {
  17883. switch_dom.find('.button_remove_command').on('click', function () {
  17884. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  17885. switch_dom.fadeOut();
  17886. }
  17887. });
  17888. }
  17889. /***/ }),
  17890. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17891. /*!*****************************************************!*\
  17892. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17893. \*****************************************************/
  17894. /*! no static exports found */
  17895. /***/ (function(module, exports, __webpack_require__) {
  17896. "use strict";
  17897. Object.defineProperty(exports, "__esModule", {
  17898. value: true
  17899. });
  17900. exports.VAR_OR_VALUE_TYPES = undefined;
  17901. exports.renderMenu = renderMenu;
  17902. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17903. var _jquery2 = _interopRequireDefault(_jquery);
  17904. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17905. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17906. var Models = _interopRequireWildcard(_ivprog_elements);
  17907. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17908. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17909. var GlobalsManagement = _interopRequireWildcard(_globals);
  17910. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17911. var VariablesManagement = _interopRequireWildcard(_variables);
  17912. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17913. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  17914. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  17915. var WritersManagement = _interopRequireWildcard(_writer);
  17916. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17917. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17918. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  17919. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17920. var VAR_OR_VALUE_TYPES = exports.VAR_OR_VALUE_TYPES = Object.freeze({ only_variable: 1, only_value: 2, only_function: 3, variable_and_function: 4, variable_and_value_opt: 5,
  17921. value_and_function: 6, all: 7 });
  17922. function renderMenu(command, ref_object, dom_object, function_obj) {
  17923. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  17924. var expression_element = arguments[5];
  17925. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  17926. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  17927. if (ref_object.function_called) {
  17928. if (ref_object.function_called.parameters_list) {
  17929. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  17930. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  17931. ref_object.parameters_list.pop();
  17932. } else {
  17933. ref_object.parameters_list.push(new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17934. }
  17935. }
  17936. }
  17937. }
  17938. 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">';
  17939. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  17940. 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">';
  17941. menu_var_or_value += '</div>';
  17942. }
  17943. 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) {
  17944. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  17945. menu_var_or_value += '<div class="menu menu_only_vars">';
  17946. menu_var_or_value += '</div></div>';
  17947. }
  17948. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  17949. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  17950. }
  17951. 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) {
  17952. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  17953. }
  17954. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  17955. 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">';
  17956. menu_var_or_value += '</div>';
  17957. }
  17958. 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) {
  17959. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('btn_function');
  17960. menu_var_or_value += '<div class="menu menu_only_functions">';
  17961. menu_var_or_value += '</div></div>';
  17962. if (command.type == Models.COMMAND_TYPES.attribution) {
  17963. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17964. menu_var_or_value += '<div class="menu">';
  17965. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17966. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17967. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17968. menu_var_or_value += '</div></div>';
  17969. }
  17970. }
  17971. menu_var_or_value += '</div></div>';
  17972. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  17973. dom_object.append(menu_var_or_value);
  17974. ref_object.dom_object = menu_var_or_value;
  17975. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  17976. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17977. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17978. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17979. if (ref_object.content || ref_object.function_called) {
  17980. if (ref_object.content) {
  17981. // Verificar se a variável ainda existe:
  17982. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  17983. if (variable_fun) {
  17984. ref_object.content = variable_fun;
  17985. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17986. } else {
  17987. if (ref_object.content && ref_object.content.type) {
  17988. ref_object.content = null;
  17989. appendSelectText(ref_object, menu_var_or_value);
  17990. } else {
  17991. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17992. }
  17993. }
  17994. } else if (ref_object.function_called) {
  17995. // Verificar se a função ainda existe:
  17996. var ret_function = isFunctionInProgram(ref_object.function_called);
  17997. if (ret_function) {
  17998. ref_object.function_called = ret_function;
  17999. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18000. } else {
  18001. ref_object.content = null;
  18002. ref_object.row = null;
  18003. ref_object.column = null;
  18004. delete ref_object.function_called;
  18005. delete ref_object.parameters_list;
  18006. appendSelectText(ref_object, menu_var_or_value);
  18007. }
  18008. }
  18009. } else {
  18010. appendSelectText(ref_object, menu_var_or_value);
  18011. }
  18012. }
  18013. function appendSelectText(ref_object, menu_var_or_value) {
  18014. switch (ref_object.variable_and_value) {
  18015. case VAR_OR_VALUE_TYPES.only_variable:
  18016. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_var') + '</i>');
  18017. break;
  18018. case VAR_OR_VALUE_TYPES.all:
  18019. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  18020. break;
  18021. case VAR_OR_VALUE_TYPES.variable_and_function:
  18022. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  18023. break;
  18024. case VAR_OR_VALUE_TYPES.only_function:
  18025. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_function') + '</i>');
  18026. break;
  18027. }
  18028. }
  18029. function isFunctionInProgram(function_called_obj) {
  18030. if (function_called_obj.name) {
  18031. if (window.program_obj.functions) {
  18032. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18033. if (window.program_obj.functions[i] == function_called_obj) {
  18034. return window.program_obj.functions[i];
  18035. }
  18036. }
  18037. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18038. if (window.program_obj.functions[i].name == function_called_obj.name) {
  18039. return window.program_obj.functions[i];
  18040. }
  18041. }
  18042. }
  18043. } else if (function_called_obj.identifier) {
  18044. for (var i = 0; i < window.system_functions.length; i++) {
  18045. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  18046. return window.system_functions[i];
  18047. }
  18048. }
  18049. }
  18050. return null;
  18051. }
  18052. function isVarInProgram(var_obj, function_obj) {
  18053. // Verify in locals:
  18054. if (function_obj.variables_list) {
  18055. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18056. if (function_obj.variables_list[i] == var_obj) {
  18057. return function_obj.variables_list[i];
  18058. }
  18059. }
  18060. }
  18061. // Verify in parameters:
  18062. if (function_obj.parameters_list) {
  18063. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18064. if (function_obj.parameters_list[i] == var_obj) {
  18065. return function_obj.parameters_list[i];
  18066. }
  18067. }
  18068. }
  18069. // Verify in globals:
  18070. if (window.program_obj.globals) {
  18071. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18072. if (window.program_obj.globals[i] == var_obj) {
  18073. return window.program_obj.globals[i];
  18074. }
  18075. }
  18076. }
  18077. // If not found, verify if the reference was lost
  18078. if (var_obj) {
  18079. if (function_obj.variables_list) {
  18080. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18081. if (function_obj.variables_list[i].name == var_obj.name) {
  18082. return function_obj.variables_list[i];
  18083. }
  18084. }
  18085. }
  18086. if (function_obj.parameters_list) {
  18087. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18088. if (function_obj.parameters_list[i].name == var_obj.name) {
  18089. return function_obj.parameters_list[i];
  18090. }
  18091. }
  18092. }
  18093. if (window.program_obj.globals) {
  18094. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18095. if (window.program_obj.globals[i].name == var_obj.name) {
  18096. return window.program_obj.globals[i];
  18097. }
  18098. }
  18099. }
  18100. }
  18101. return null;
  18102. }
  18103. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  18104. if (ref_object.function_called) {
  18105. menu_var_or_value.remove();
  18106. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18107. } else if (ref_object.content.type) {
  18108. menu_var_or_value.remove();
  18109. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18110. } else {
  18111. menu_var_or_value.remove();
  18112. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18113. }
  18114. }
  18115. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  18116. if (variable_obj.content || variable_obj.function_called) {
  18117. // Verificar se a variável ainda existe:
  18118. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  18119. if (var_fun) {
  18120. variable_obj.content = var_fun;
  18121. } else {
  18122. if (variable_obj.content && variable_obj.content.type) {
  18123. variable_obj.content = null;
  18124. appendSelectText(variable_obj, menu_var_or_value);
  18125. }
  18126. }
  18127. } else {
  18128. appendSelectText(variable_obj, menu_var_or_value);
  18129. }
  18130. if (variable_obj.content == null && variable_obj.function_called == null) {
  18131. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18132. return;
  18133. }
  18134. var ret = '';
  18135. if (variable_obj.function_called) {
  18136. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  18137. menu_var_or_value.find('.text').text(' ');
  18138. dom_object.find('.menu_var_or_value_dom').remove();
  18139. var parameters_menu;
  18140. if (variable_obj.function_called.name) {
  18141. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  18142. } else {
  18143. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  18144. }
  18145. parameters_menu += '<span> ) </span></div>';
  18146. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18147. dom_object.append(parameters_menu);
  18148. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18149. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18150. if (command.type == Models.COMMAND_TYPES.attribution) {
  18151. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18152. context_menu += '<div class="menu">';
  18153. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18154. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18155. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18156. context_menu += '</div></div>';
  18157. }
  18158. context_menu += '</div></div>';
  18159. context_menu = (0, _jquery2.default)(context_menu);
  18160. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18161. context_menu.dropdown({
  18162. onChange: function onChange(value, text, $selectedItem) {
  18163. console.log('S1');
  18164. if ($selectedItem.data('clear')) {
  18165. console.log('PP1');
  18166. dom_object.text('');
  18167. variable_obj.content = null;
  18168. variable_obj.row = null;
  18169. variable_obj.column = null;
  18170. delete variable_obj.function_called;
  18171. delete variable_obj.parameters_list;
  18172. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18173. }
  18174. if ($selectedItem.data('exp')) {
  18175. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18176. }
  18177. },
  18178. selectOnKeydown: false
  18179. });
  18180. } else {
  18181. menu_var_or_value.find('.text').text(' ');
  18182. dom_object.find('.menu_var_or_value_dom').remove();
  18183. var parameters_menu;
  18184. if (variable_obj.function_called.name) {
  18185. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  18186. } else {
  18187. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  18188. }
  18189. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18190. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18191. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  18192. parameters_menu += ' , ';
  18193. }
  18194. }
  18195. parameters_menu += '<span> ) </span></div>';
  18196. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18197. dom_object.append(parameters_menu);
  18198. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18199. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18200. }
  18201. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18202. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18203. if (command.type == Models.COMMAND_TYPES.attribution) {
  18204. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18205. context_menu += '<div class="menu">';
  18206. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18207. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18208. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18209. context_menu += '</div></div>';
  18210. }
  18211. context_menu += '</div></div>';
  18212. context_menu = (0, _jquery2.default)(context_menu);
  18213. context_menu.insertAfter(parameters_menu);
  18214. context_menu.dropdown({
  18215. onChange: function onChange(value, text, $selectedItem) {
  18216. console.log('S2');
  18217. if ($selectedItem.data('clear')) {
  18218. console.log('PP2');
  18219. dom_object.text('');
  18220. variable_obj.content = null;
  18221. variable_obj.row = null;
  18222. variable_obj.column = null;
  18223. delete variable_obj.function_called;
  18224. delete variable_obj.parameters_list;
  18225. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18226. }
  18227. if ($selectedItem.data('exp')) {
  18228. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18229. }
  18230. },
  18231. selectOnKeydown: false
  18232. });
  18233. }
  18234. } else if (variable_obj.content.type) {
  18235. var variable_render = "";
  18236. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  18237. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18238. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18239. variable_render += '</div>';
  18240. variable_render = (0, _jquery2.default)(variable_render);
  18241. dom_object.append(variable_render);
  18242. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18243. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18244. if (command.type == Models.COMMAND_TYPES.attribution) {
  18245. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18246. context_menu += '<div class="menu">';
  18247. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18248. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18249. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18250. context_menu += '</div></div>';
  18251. }
  18252. context_menu += '</div></div>';
  18253. context_menu = (0, _jquery2.default)(context_menu);
  18254. variable_render.append(context_menu);
  18255. context_menu.dropdown({
  18256. onChange: function onChange(value, text, $selectedItem) {
  18257. console.log('S3');
  18258. if ($selectedItem.data('clear')) {
  18259. console.log('PP3');
  18260. dom_object.text('');
  18261. variable_obj.content = null;
  18262. variable_obj.row = null;
  18263. variable_obj.column = null;
  18264. delete variable_obj.function_called;
  18265. delete variable_obj.parameters_list;
  18266. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18267. }
  18268. if ($selectedItem.data('exp')) {
  18269. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18270. }
  18271. },
  18272. selectOnKeydown: false
  18273. });
  18274. if (!variable_obj.column) {
  18275. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18276. }
  18277. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18278. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  18279. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18280. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18281. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18282. variable_render += '</div>';
  18283. variable_render = (0, _jquery2.default)(variable_render);
  18284. dom_object.append(variable_render);
  18285. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18286. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18287. if (command.type == Models.COMMAND_TYPES.attribution) {
  18288. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18289. context_menu += '<div class="menu">';
  18290. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18291. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18292. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18293. context_menu += '</div></div>';
  18294. }
  18295. context_menu += '</div></div>';
  18296. context_menu = (0, _jquery2.default)(context_menu);
  18297. variable_render.append(context_menu);
  18298. context_menu.dropdown({
  18299. onChange: function onChange(value, text, $selectedItem) {
  18300. console.log('S4');
  18301. if ($selectedItem.data('clear')) {
  18302. console.log('PP4');
  18303. dom_object.text('');
  18304. variable_obj.content = null;
  18305. variable_obj.row = null;
  18306. variable_obj.column = null;
  18307. delete variable_obj.function_called;
  18308. delete variable_obj.parameters_list;
  18309. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18310. }
  18311. if ($selectedItem.data('exp')) {
  18312. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18313. }
  18314. },
  18315. selectOnKeydown: false
  18316. });
  18317. if (!variable_obj.column) {
  18318. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18319. }
  18320. if (!variable_obj.row) {
  18321. variable_obj.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18322. }
  18323. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  18324. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18325. } else {
  18326. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18327. variable_render += '</div>';
  18328. variable_render = (0, _jquery2.default)(variable_render);
  18329. dom_object.append(variable_render);
  18330. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18331. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18332. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18333. console.log('dom_object6');
  18334. console.log(dom_object);
  18335. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18336. context_menu += '<div class="menu">';
  18337. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18338. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18339. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18340. context_menu += '</div></div>';
  18341. }
  18342. context_menu += '</div></div>';
  18343. context_menu = (0, _jquery2.default)(context_menu);
  18344. variable_render.append(context_menu);
  18345. context_menu.dropdown({
  18346. onChange: function onChange(value, text, $selectedItem) {
  18347. console.log('S5');
  18348. if ($selectedItem.data('clear')) {
  18349. console.log('PP5');
  18350. dom_object.text('');
  18351. variable_obj.content = null;
  18352. variable_obj.row = null;
  18353. variable_obj.column = null;
  18354. delete variable_obj.function_called;
  18355. delete variable_obj.parameters_list;
  18356. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18357. }
  18358. if ($selectedItem.data('exp')) {
  18359. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18360. }
  18361. },
  18362. selectOnKeydown: false
  18363. });
  18364. }
  18365. } else {
  18366. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  18367. variable_render += '</div>';
  18368. variable_render = (0, _jquery2.default)(variable_render);
  18369. dom_object.append(variable_render);
  18370. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18371. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18372. if (command.type == Models.COMMAND_TYPES.attribution) {
  18373. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18374. context_menu += '<div class="menu">';
  18375. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18376. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18377. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18378. context_menu += '</div></div>';
  18379. }
  18380. context_menu += '</div></div>';
  18381. context_menu = (0, _jquery2.default)(context_menu);
  18382. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18383. context_menu.insertAfter(variable_render);
  18384. }
  18385. context_menu.dropdown({
  18386. onChange: function onChange(value, text, $selectedItem) {
  18387. console.log('S6');
  18388. if ($selectedItem.data('clear')) {
  18389. console.log('PP6');
  18390. dom_object.text('');
  18391. variable_obj.content = null;
  18392. variable_obj.row = null;
  18393. variable_obj.column = null;
  18394. delete variable_obj.function_called;
  18395. delete variable_obj.parameters_list;
  18396. dom_object.find('.value_rendered').remove();
  18397. dom_object.find('.context_menu_clear').remove();
  18398. dom_object.find('.width-dynamic-minus').remove();
  18399. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18400. }
  18401. if ($selectedItem.data('exp')) {
  18402. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18403. }
  18404. },
  18405. selectOnKeydown: false
  18406. });
  18407. variable_render.on('click', function (e) {
  18408. variable_render.remove();
  18409. variable_render.empty();
  18410. variable_render.remove();
  18411. dom_object.empty();
  18412. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18413. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18414. });
  18415. }
  18416. }
  18417. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18418. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18419. sub_menu.append('<div class="divider"></div><div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_header_ivprog_functions') + '</div>');
  18420. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_math') + '<div class="menu menu_math_functions"></div></div>');
  18421. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_text') + '<div class="menu menu_text_functions"></div></div>');
  18422. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_arrangement') + '<div class="menu menu_arrangement_functions"></div></div>');
  18423. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_menu_functions_conversion') + '<div class="menu menu_conversion_functions"></div></div>');
  18424. // Insert Math functions:
  18425. for (var i = 0; i < window.system_functions.length; i++) {
  18426. var t = (0, _jquery2.default)('<div class="item"></div>');
  18427. t.data('function_reference', window.system_functions[i]);
  18428. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  18429. t.text(_localizedStringsService.LocalizedStrings.getUI(window.system_functions[i].identifier));
  18430. switch (window.system_functions[i].category) {
  18431. case Models.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18432. sub_menu.find('.menu_math_functions').append(t);
  18433. break;
  18434. case Models.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18435. sub_menu.find('.menu_text_functions').append(t);
  18436. break;
  18437. case Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18438. sub_menu.find('.menu_arrangement_functions').append(t);
  18439. break;
  18440. case Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18441. sub_menu.find('.menu_conversion_functions').append(t);
  18442. break;
  18443. }
  18444. }
  18445. }
  18446. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18447. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18448. sub_menu.text('');
  18449. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18450. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  18451. temp.data('function_reference', window.program_obj.functions[i]);
  18452. sub_menu.append(temp);
  18453. }
  18454. }
  18455. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18456. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  18457. sub_menu.text('');
  18458. var is_there = false;
  18459. if (window.program_obj.globals) {
  18460. if (ref_object.include_constant) {
  18461. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18462. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18463. temp.data('variable_reference', window.program_obj.globals[i]);
  18464. sub_menu.append(temp);
  18465. is_there = true;
  18466. }
  18467. } else {
  18468. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18469. if (!window.program_obj.globals[i].is_constant) {
  18470. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18471. temp.data('variable_reference', window.program_obj.globals[i]);
  18472. sub_menu.append(temp);
  18473. is_there = true;
  18474. }
  18475. }
  18476. }
  18477. }
  18478. if (function_obj.parameters_list) {
  18479. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18480. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  18481. temp.data('variable_reference', function_obj.parameters_list[i]);
  18482. sub_menu.append(temp);
  18483. is_there = true;
  18484. }
  18485. }
  18486. if (function_obj.variables_list) {
  18487. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18488. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  18489. temp.data('variable_reference', function_obj.variables_list[i]);
  18490. sub_menu.append(temp);
  18491. is_there = true;
  18492. }
  18493. }
  18494. if (!is_there) {
  18495. sub_menu.append((0, _jquery2.default)('<div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable') + '</div>'));
  18496. sub_menu.append((0, _jquery2.default)('<div class="item disabled">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable_instruction') + '</div>'));
  18497. }
  18498. }
  18499. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18500. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18501. menu_var_or_value.dropdown({
  18502. onChange: function onChange(value, text, $selectedItem) {
  18503. console.log('S7');
  18504. dom_object.find('.var_name').remove();
  18505. switch ($selectedItem.data('option')) {
  18506. case VAR_OR_VALUE_TYPES.only_function:
  18507. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  18508. break;
  18509. case VAR_OR_VALUE_TYPES.only_value:
  18510. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18511. break;
  18512. case VAR_OR_VALUE_TYPES.only_variable:
  18513. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  18514. break;
  18515. }
  18516. if ($selectedItem.data('exp')) {
  18517. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18518. }
  18519. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18520. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18521. }
  18522. },
  18523. selectOnKeydown: false
  18524. });
  18525. }
  18526. dom_object.find('.width-dynamic').on('input', function () {
  18527. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18528. (0, _jquery2.default)(this).focus();
  18529. var tmpStr = (0, _jquery2.default)(this).val();
  18530. (0, _jquery2.default)(this).val('');
  18531. (0, _jquery2.default)(this).val(tmpStr);
  18532. (0, _jquery2.default)(this).css({
  18533. width: inputWidth
  18534. });
  18535. }).trigger('input');
  18536. if (command.type == Models.COMMAND_TYPES.comment) {
  18537. dom_object.parent().on('click', function (e) {
  18538. dom_object.find('.value_rendered').remove();
  18539. dom_object.find('.value_rendered').empty();
  18540. dom_object.find('.value_rendered').remove();
  18541. dom_object.empty();
  18542. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18543. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18544. });
  18545. }
  18546. }
  18547. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18548. ref_object.function_called = function_selected;
  18549. ref_object.parameters_list = [];
  18550. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18551. menu_var_or_value.find('.text').text(' ');
  18552. dom_object.find('.menu_var_or_value_dom').remove();
  18553. var parameters_menu;
  18554. if (function_selected.name) {
  18555. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18556. } else {
  18557. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18558. }
  18559. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18560. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18561. if (j + 1 != function_selected.parameters_list.length) {
  18562. parameters_menu += ' , ';
  18563. }
  18564. }
  18565. parameters_menu += '<span> ) </span></div>';
  18566. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18567. dom_object.append(parameters_menu);
  18568. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18569. var temp;
  18570. if (function_selected.parameters_list[j].dimensions > 0) {
  18571. temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, function_selected.parameters_list[j].dimensions);
  18572. } else {
  18573. temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18574. }
  18575. ref_object.parameters_list.push(temp);
  18576. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18577. }
  18578. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18579. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18580. if (command.type == Models.COMMAND_TYPES.attribution) {
  18581. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18582. context_menu += '<div class="menu">';
  18583. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18584. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18585. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18586. context_menu += '</div></div>';
  18587. }
  18588. context_menu += '</div></div>';
  18589. context_menu = (0, _jquery2.default)(context_menu);
  18590. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18591. context_menu.dropdown({
  18592. onChange: function onChange(value, text, $selectedItem) {
  18593. console.log('S8');
  18594. if ($selectedItem.data('clear')) {
  18595. console.log('PP7');
  18596. dom_object.text('');
  18597. ref_object.content = null;
  18598. ref_object.row = null;
  18599. ref_object.column = null;
  18600. delete ref_object.function_called;
  18601. delete ref_object.parameters_list;
  18602. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18603. }
  18604. if ($selectedItem.data('exp')) {
  18605. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18606. }
  18607. },
  18608. selectOnKeydown: false
  18609. });
  18610. } else {
  18611. menu_var_or_value.find('.text').text(' ');
  18612. dom_object.find('.menu_var_or_value_dom').remove();
  18613. var parameters_menu;
  18614. if (function_selected.name) {
  18615. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18616. } else {
  18617. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18618. }
  18619. parameters_menu += '<span> ) </span></div>';
  18620. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18621. dom_object.append(parameters_menu);
  18622. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18623. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18624. if (command.type == Models.COMMAND_TYPES.attribution) {
  18625. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18626. context_menu += '<div class="menu">';
  18627. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18628. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18629. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18630. context_menu += '</div></div>';
  18631. }
  18632. context_menu += '</div></div>';
  18633. context_menu = (0, _jquery2.default)(context_menu);
  18634. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18635. context_menu.dropdown({
  18636. onChange: function onChange(value, text, $selectedItem) {
  18637. console.log('S9');
  18638. if ($selectedItem.data('clear')) {
  18639. console.log('PP8');
  18640. dom_object.text('');
  18641. ref_object.content = null;
  18642. ref_object.row = null;
  18643. ref_object.column = null;
  18644. delete ref_object.function_called;
  18645. delete ref_object.parameters_list;
  18646. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18647. }
  18648. if ($selectedItem.data('exp')) {
  18649. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18650. }
  18651. },
  18652. selectOnKeydown: false
  18653. });
  18654. }
  18655. if (command.type == Models.COMMAND_TYPES.attribution) {
  18656. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18657. }
  18658. }
  18659. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18660. ref_object.content = variable_selected;
  18661. menu_var_or_value.find('.text').text(' ');
  18662. dom_object.find('.menu_var_or_value_dom').remove();
  18663. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  18664. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18665. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18666. }
  18667. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18668. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18669. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18670. }
  18671. variable_render += '</div>';
  18672. variable_render = (0, _jquery2.default)(variable_render);
  18673. dom_object.append(variable_render);
  18674. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18675. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18676. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18677. }
  18678. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18679. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18680. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  18681. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18682. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18683. }
  18684. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18685. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18686. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18687. console.log("dom_object 10: ");
  18688. console.log(dom_object);
  18689. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18690. context_menu += '<div class="menu">';
  18691. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18692. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18693. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18694. context_menu += '</div></div>';
  18695. }
  18696. context_menu += '</div></div>';
  18697. context_menu = (0, _jquery2.default)(context_menu);
  18698. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  18699. context_menu.dropdown({
  18700. onChange: function onChange(value, text, $selectedItem) {
  18701. console.log('S10');
  18702. if ($selectedItem.data('clear')) {
  18703. console.log('PP9');
  18704. dom_object.text('');
  18705. ref_object.content = null;
  18706. ref_object.row = null;
  18707. ref_object.column = null;
  18708. delete ref_object.function_called;
  18709. delete ref_object.parameters_list;
  18710. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18711. }
  18712. if ($selectedItem.data('exp')) {
  18713. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18714. }
  18715. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18716. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18717. }
  18718. },
  18719. selectOnKeydown: false
  18720. });
  18721. if (command.type == Models.COMMAND_TYPES.attribution) {
  18722. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18723. }
  18724. }
  18725. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18726. if (ref_object.content == null) {
  18727. ref_object.content = "";
  18728. }
  18729. menu_var_or_value.find('.text').text(' ');
  18730. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18731. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  18732. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  18733. rendered.insertBefore(field);
  18734. field.focus();
  18735. field.val(ref_object.content);
  18736. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18737. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18738. if (command.type == Models.COMMAND_TYPES.attribution) {
  18739. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18740. context_menu += '<div class="menu">';
  18741. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18742. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18743. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18744. context_menu += '</div></div>';
  18745. }
  18746. context_menu += '</div></div>';
  18747. context_menu = (0, _jquery2.default)(context_menu);
  18748. dom_object.find('.menu_var_or_value_dom').remove();
  18749. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18750. context_menu.insertAfter(field);
  18751. }
  18752. context_menu.dropdown({
  18753. onChange: function onChange(value, text, $selectedItem) {
  18754. console.log('S11');
  18755. if ($selectedItem.data('clear')) {
  18756. console.log('PP10');
  18757. dom_object.text('');
  18758. dom_object.find('.value_rendered').remove();
  18759. dom_object.find('.context_menu_clear').remove();
  18760. dom_object.find('.width-dynamic-minus').remove();
  18761. ref_object.content = null;
  18762. ref_object.row = null;
  18763. ref_object.column = null;
  18764. delete ref_object.function_called;
  18765. delete ref_object.parameters_list;
  18766. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18767. }
  18768. if ($selectedItem.data('exp')) {
  18769. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18770. }
  18771. },
  18772. selectOnKeydown: false
  18773. });
  18774. dom_object.find('.width-dynamic-minus').focusout(function () {
  18775. if ((0, _jquery2.default)(this).val().trim()) {
  18776. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18777. }
  18778. rendered.text(ref_object.content);
  18779. (0, _jquery2.default)(this).remove();
  18780. });
  18781. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  18782. var code = e.keyCode || e.which;
  18783. if (code == 13) {
  18784. if ((0, _jquery2.default)(this).val().trim()) {
  18785. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18786. }
  18787. rendered.text(ref_object.content);
  18788. (0, _jquery2.default)(this).remove();
  18789. }
  18790. if (code == 27) {
  18791. rendered.text(ref_object.content);
  18792. (0, _jquery2.default)(this).remove();
  18793. }
  18794. });
  18795. if (command.type == Models.COMMAND_TYPES.comment) {
  18796. /*rendered.parent().on('click', function(e) {
  18797. rendered.parent().off();
  18798. console.log("TTT14");
  18799. rendered.remove();
  18800. rendered.empty();
  18801. rendered.remove();
  18802. dom_object.empty();
  18803. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18804. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  18805. });*/
  18806. }
  18807. rendered.on('click', function (e) {
  18808. console.log("TTT2");
  18809. rendered.remove();
  18810. rendered.empty();
  18811. rendered.remove();
  18812. dom_object.empty();
  18813. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18814. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18815. });
  18816. if (command.type == Models.COMMAND_TYPES.attribution) {
  18817. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18818. }
  18819. }
  18820. _jquery2.default.fn.textWidth = function (text, font) {
  18821. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  18822. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  18823. return _jquery2.default.fn.textWidth.fakeEl.width();
  18824. };
  18825. /***/ }),
  18826. /***/ "./js/visualUI/commands/whiletrue.js":
  18827. /*!*******************************************!*\
  18828. !*** ./js/visualUI/commands/whiletrue.js ***!
  18829. \*******************************************/
  18830. /*! no static exports found */
  18831. /***/ (function(module, exports, __webpack_require__) {
  18832. "use strict";
  18833. Object.defineProperty(exports, "__esModule", {
  18834. value: true
  18835. });
  18836. exports.createFloatingCommand = createFloatingCommand;
  18837. exports.renderCommand = renderCommand;
  18838. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18839. var _jquery2 = _interopRequireDefault(_jquery);
  18840. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18841. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18842. var Models = _interopRequireWildcard(_ivprog_elements);
  18843. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18844. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18845. var GlobalsManagement = _interopRequireWildcard(_globals);
  18846. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18847. var VariablesManagement = _interopRequireWildcard(_variables);
  18848. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18849. var CommandsManagement = _interopRequireWildcard(_commands);
  18850. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18851. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  18852. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18853. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  18854. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  18855. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18856. function createFloatingCommand() {
  18857. return (0, _jquery2.default)('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' ( x < 10 ) { } </span></div>');
  18858. }
  18859. function renderCommand(command, function_obj) {
  18860. var ret = '';
  18861. ret += '<div class="ui whiletrue 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 class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while') + ' </span>';
  18862. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  18863. ret += ' </span>';
  18864. ret += '<div class="ui block_commands">';
  18865. ret += '</div>';
  18866. ret += '<span> </span>';
  18867. ret += '</div>';
  18868. var el = (0, _jquery2.default)(ret);
  18869. el.data('command', command);
  18870. addHandlers(command, function_obj, el);
  18871. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  18872. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  18873. if (command.commands_block) {
  18874. for (var j = 0; j < command.commands_block.length; j++) {
  18875. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  18876. }
  18877. }
  18878. return el;
  18879. }
  18880. function addHandlers(command, function_obj, whiletrue_dom) {
  18881. whiletrue_dom.find('.button_remove_command').on('click', function () {
  18882. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  18883. whiletrue_dom.fadeOut();
  18884. }
  18885. });
  18886. }
  18887. /***/ }),
  18888. /***/ "./js/visualUI/commands/writer.js":
  18889. /*!****************************************!*\
  18890. !*** ./js/visualUI/commands/writer.js ***!
  18891. \****************************************/
  18892. /*! no static exports found */
  18893. /***/ (function(module, exports, __webpack_require__) {
  18894. "use strict";
  18895. Object.defineProperty(exports, "__esModule", {
  18896. value: true
  18897. });
  18898. exports.createFloatingCommand = createFloatingCommand;
  18899. exports.renderCommand = renderCommand;
  18900. exports.addContent = addContent;
  18901. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18902. var _jquery2 = _interopRequireDefault(_jquery);
  18903. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18904. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18905. var Models = _interopRequireWildcard(_ivprog_elements);
  18906. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18907. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18908. var GlobalsManagement = _interopRequireWildcard(_globals);
  18909. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18910. var VariablesManagement = _interopRequireWildcard(_variables);
  18911. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18912. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18913. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  18914. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18915. var CommandsManagement = _interopRequireWildcard(_commands);
  18916. __webpack_require__(/*! ../../Sortable.js */ "./js/Sortable.js");
  18917. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  18918. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18919. function createFloatingCommand() {
  18920. return (0, _jquery2.default)('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> ' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' var </span></div>');
  18921. }
  18922. function renderCommand(command, function_obj) {
  18923. var ret = '';
  18924. 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">' + _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( </span><div class="all_elements_write"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  18925. var el = (0, _jquery2.default)(ret);
  18926. el.data('command', command);
  18927. for (var i = 0; i < command.content.length; i++) {
  18928. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18929. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler"></div>');
  18930. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  18931. div_parent_with_handler.append(new_div_item);
  18932. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  18933. el.find('.all_elements_write').append(div_parent_with_handler);
  18934. VariableValueMenu.renderMenu(command, command.content[i], new_div_item, function_obj);
  18935. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18936. addHandlersManager(command, function_obj, el, div_parent_with_handler, command.content[i]);
  18937. }
  18938. if (command.content.length == 0) {
  18939. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18940. }
  18941. addHandlers(command, function_obj, el);
  18942. return el;
  18943. }
  18944. function addHandlersManager(command, function_obj, writer_dom, item_div, content_element) {
  18945. item_div.find('.times').on('click', function () {
  18946. for (var i = 0; i < command.content.length; i++) {
  18947. if (command.content[i] == content_element) {
  18948. delete command.content[i];
  18949. command.content.splice(i, 1);
  18950. item_div.children().off();
  18951. item_div.off();
  18952. item_div.fadeOut();
  18953. if (command.content.length > 0) {
  18954. item_div.next('.icon_add_item_to_writer').fadeOut();
  18955. }
  18956. break;
  18957. }
  18958. }
  18959. });
  18960. }
  18961. function addHandlers(command, function_obj, writer_dom) {
  18962. writer_dom.find('.button_remove_command').on('click', function () {
  18963. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  18964. writer_dom.fadeOut();
  18965. }
  18966. });
  18967. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  18968. handle: '.ellipsis',
  18969. animation: 100,
  18970. ghostClass: 'ghost',
  18971. group: 'writer',
  18972. draggable: '.div_parent_handler',
  18973. onEnd: function onEnd(evt) {
  18974. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  18975. writer_dom.empty();
  18976. writer_dom.replaceWith(renderCommand(command, function_obj));
  18977. }
  18978. });
  18979. }
  18980. function addHandlerIconAdd(dom_object, command, function_obj) {
  18981. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  18982. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  18983. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18984. if (!insert_after) {
  18985. dom_object.append(icon_add_item);
  18986. } else {
  18987. icon_add_item.insertAfter(after_which);
  18988. }
  18989. icon_add_item.on('click', function (e) {
  18990. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler" style="display:none;"></div>');
  18991. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18992. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  18993. div_parent_with_handler.append(new_div_item);
  18994. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  18995. div_parent_with_handler.insertAfter(icon_add_item);
  18996. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18997. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18998. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  18999. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19000. var pos = 1;
  19001. dom_object.find('.icon_add_item_to_writer').each(function () {
  19002. if ((0, _jquery2.default)(this).get(0) === icon_add_item.get(0)) {
  19003. command.content.splice(pos, 0, new_related_menu);
  19004. } else {
  19005. pos++;
  19006. }
  19007. });
  19008. if (command.content.length == 1) {
  19009. icon_add_item.remove();
  19010. }
  19011. div_parent_with_handler.fadeIn();
  19012. });
  19013. }
  19014. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  19015. if (dom_object.hasClass('var_value_menu_div')) {
  19016. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19017. icon_add_item.insertAfter(dom_object);
  19018. icon_add_item.on('click', function (e) {
  19019. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler"></div>');
  19020. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19021. div_parent_with_handler.append(new_div_item);
  19022. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  19023. div_parent_with_handler.insertAfter(icon_add_item);
  19024. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19025. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19026. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19027. command.content.push(new_related_menu);
  19028. if (command.content.length == 1) {
  19029. icon_add_item.remove();
  19030. }
  19031. });
  19032. }
  19033. }
  19034. /***/ }),
  19035. /***/ "./js/visualUI/commands_sidebar.js":
  19036. /*!*****************************************!*\
  19037. !*** ./js/visualUI/commands_sidebar.js ***!
  19038. \*****************************************/
  19039. /*! no static exports found */
  19040. /***/ (function(module, exports, __webpack_require__) {
  19041. "use strict";
  19042. Object.defineProperty(exports, "__esModule", {
  19043. value: true
  19044. });
  19045. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  19046. exports.removeCommand = removeCommand;
  19047. exports.createFloatingCommand = createFloatingCommand;
  19048. exports.renderCommand = renderCommand;
  19049. exports.genericCreateCommand = genericCreateCommand;
  19050. exports.prepareManageCommand = prepareManageCommand;
  19051. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19052. var _jquery2 = _interopRequireDefault(_jquery);
  19053. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19054. var _ivprog_elements_sidebar = __webpack_require__(/*! ./ivprog_elements_sidebar */ "./js/visualUI/ivprog_elements_sidebar.js");
  19055. var Models = _interopRequireWildcard(_ivprog_elements_sidebar);
  19056. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19057. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19058. var GlobalsManagement = _interopRequireWildcard(_globals);
  19059. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19060. var VariablesManagement = _interopRequireWildcard(_variables);
  19061. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  19062. var CommentsManagement = _interopRequireWildcard(_comment);
  19063. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  19064. var ReadersManagement = _interopRequireWildcard(_reader);
  19065. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  19066. var WritersManagement = _interopRequireWildcard(_writer);
  19067. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  19068. var AttributionsManagement = _interopRequireWildcard(_attribution);
  19069. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  19070. var IftruesManagement = _interopRequireWildcard(_iftrue);
  19071. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  19072. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  19073. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  19074. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  19075. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  19076. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  19077. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  19078. var SwitchesManagement = _interopRequireWildcard(_switch);
  19079. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  19080. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  19081. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19082. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  19083. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  19084. var BreaksManagement = _interopRequireWildcard(_break);
  19085. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  19086. var ReturnsManagement = _interopRequireWildcard(_return);
  19087. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  19088. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19089. var has_element_created_draged = false;
  19090. var which_element_is_draged = null;
  19091. function removeCommand(command, function_obj, dom_obj) {
  19092. if (function_obj.commands.indexOf(command) > -1) {
  19093. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  19094. return true;
  19095. }
  19096. // Utilize dois parantNode, pois o primeiro é o div de comandos
  19097. try {
  19098. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  19099. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  19100. return true;
  19101. }
  19102. } catch (err) {}
  19103. try {
  19104. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  19105. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  19106. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  19107. return true;
  19108. }
  19109. }
  19110. } catch (err) {}
  19111. console.log('veja: ');
  19112. console.log(dom_obj.parent());
  19113. if (dom_obj.parent().data('switchcase')) {
  19114. console.log("o que encontrei: ");
  19115. console.log(dom_obj.parent().data('switchcase'));
  19116. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  19117. return true;
  19118. }
  19119. return false;
  19120. }
  19121. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  19122. var floatingObject;
  19123. switch (command_type) {
  19124. case Models.COMMAND_TYPES.break:
  19125. floatingObject = BreaksManagement.createFloatingCommand();
  19126. break;
  19127. case Models.COMMAND_TYPES.comment:
  19128. floatingObject = CommentsManagement.createFloatingCommand();
  19129. break;
  19130. case Models.COMMAND_TYPES.reader:
  19131. floatingObject = ReadersManagement.createFloatingCommand();
  19132. break;
  19133. case Models.COMMAND_TYPES.writer:
  19134. floatingObject = WritersManagement.createFloatingCommand();
  19135. break;
  19136. case Models.COMMAND_TYPES.attribution:
  19137. floatingObject = AttributionsManagement.createFloatingCommand();
  19138. break;
  19139. case Models.COMMAND_TYPES.iftrue:
  19140. floatingObject = IftruesManagement.createFloatingCommand();
  19141. break;
  19142. case Models.COMMAND_TYPES.repeatNtimes:
  19143. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  19144. break;
  19145. case Models.COMMAND_TYPES.whiletrue:
  19146. floatingObject = WhiletruesManagement.createFloatingCommand();
  19147. break;
  19148. case Models.COMMAND_TYPES.dowhiletrue:
  19149. floatingObject = DowhiletruesManagement.createFloatingCommand();
  19150. break;
  19151. case Models.COMMAND_TYPES.switch:
  19152. floatingObject = SwitchesManagement.createFloatingCommand();
  19153. break;
  19154. case Models.COMMAND_TYPES.functioncall:
  19155. floatingObject = FunctioncallsManagement.createFloatingCommand();
  19156. break;
  19157. case Models.COMMAND_TYPES.return:
  19158. floatingObject = ReturnsManagement.createFloatingCommand();
  19159. break;
  19160. }
  19161. floatingObject.draggable({
  19162. drag: function drag(evt) {
  19163. borderMouseDragCommand(function_obj, function_container, evt);
  19164. },
  19165. stop: function stop(evt) {
  19166. function_container.find('.over_command_drag').each(function (index) {
  19167. (0, _jquery2.default)(this).removeClass('over_command_drag');
  19168. });
  19169. }
  19170. }).appendTo("body");
  19171. floatingObject.mouseup(function (evt) {
  19172. manageCommand(function_obj, function_container, evt, command_type);
  19173. });
  19174. floatingObject.css("position", "absolute");
  19175. mouse_event.type = "mousedown.draggable";
  19176. mouse_event.target = floatingObject[0];
  19177. floatingObject.css("left", mouse_event.pageX - 15);
  19178. floatingObject.css("top", mouse_event.pageY - 15);
  19179. floatingObject.trigger(mouse_event);
  19180. }
  19181. function borderMouseDragCommand(function_obj, function_container, evt) {
  19182. function_container.find('.over_command_drag').each(function (index) {
  19183. (0, _jquery2.default)(this).removeClass('over_command_drag');
  19184. });
  19185. var prev = null;
  19186. function_container.find('.commands_list_div').each(function (index) {
  19187. prev = (0, _jquery2.default)(this);
  19188. if (prev) {
  19189. var objLeft = prev.offset().left;
  19190. var objTop = prev.offset().top;
  19191. var objRight = objLeft + prev.width();
  19192. var objBottom = objTop + prev.height();
  19193. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  19194. prev.addClass("over_command_drag");
  19195. }
  19196. }
  19197. });
  19198. function_container.find('.command_container').each(function (index) {
  19199. var obj = (0, _jquery2.default)(this);
  19200. var objLeft = obj.offset().left;
  19201. var objTop = obj.offset().top;
  19202. var objRight = objLeft + obj.width();
  19203. var objBottom = objTop + obj.height();
  19204. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  19205. if (prev) {
  19206. prev.removeClass('over_command_drag');
  19207. }
  19208. obj.addClass("over_command_drag");
  19209. return;
  19210. }
  19211. });
  19212. }
  19213. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  19214. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  19215. var function_called = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  19216. var createdElement;
  19217. switch (command.type) {
  19218. case Models.COMMAND_TYPES.comment:
  19219. createdElement = CommentsManagement.renderCommand(command, function_obj);
  19220. break;
  19221. case Models.COMMAND_TYPES.break:
  19222. createdElement = BreaksManagement.renderCommand(command, function_obj);
  19223. break;
  19224. case Models.COMMAND_TYPES.reader:
  19225. createdElement = ReadersManagement.renderCommand(command, function_obj);
  19226. break;
  19227. case Models.COMMAND_TYPES.writer:
  19228. createdElement = WritersManagement.renderCommand(command, function_obj);
  19229. break;
  19230. case Models.COMMAND_TYPES.attribution:
  19231. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  19232. break;
  19233. case Models.COMMAND_TYPES.functioncall:
  19234. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  19235. break;
  19236. case Models.COMMAND_TYPES.iftrue:
  19237. createdElement = IftruesManagement.renderCommand(command, function_obj);
  19238. break;
  19239. case Models.COMMAND_TYPES.repeatNtimes:
  19240. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  19241. break;
  19242. case Models.COMMAND_TYPES.whiletrue:
  19243. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  19244. break;
  19245. case Models.COMMAND_TYPES.dowhiletrue:
  19246. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  19247. break;
  19248. case Models.COMMAND_TYPES.switch:
  19249. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  19250. break;
  19251. case Models.COMMAND_TYPES.return:
  19252. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  19253. break;
  19254. }
  19255. switch (before_after_inside) {
  19256. case 1:
  19257. createdElement.insertBefore(element_reference);
  19258. break;
  19259. case 2:
  19260. createdElement.insertAfter(element_reference);
  19261. break;
  19262. case 3:
  19263. element_reference.append(createdElement);
  19264. break;
  19265. }
  19266. console.log("typeof");
  19267. console.log(typeof function_called === 'undefined' ? 'undefined' : _typeof(function_called));
  19268. if ((command.type == Models.COMMAND_TYPES.functioncall || command.type == Models.COMMAND_TYPES.attribution) && function_called != null && function_called.type == 'function') {
  19269. var $div_items = createdElement.find('div.item');
  19270. for (var i = 0; i < $div_items.length; i++) {
  19271. var flag = function_called.identifier ? _localizedStringsService.LocalizedStrings.getUI(function_called.identifier) : function_called.name;
  19272. if ((0, _jquery2.default)($div_items[i]).text().trim() == flag) {
  19273. (0, _jquery2.default)($div_items[i]).trigger('click');
  19274. break;
  19275. }
  19276. }
  19277. }
  19278. createdElement.find('.button_remove_command').mouseover(function () {
  19279. createdElement.css({ 'opacity': '.8' });
  19280. });
  19281. createdElement.find('.button_remove_command').mouseout(function () {
  19282. createdElement.css({ 'opacity': '1' });
  19283. });
  19284. }
  19285. function genericCreateCommand(command_type) {
  19286. switch (command_type) {
  19287. case Models.COMMAND_TYPES.break:
  19288. return new Models.Break();
  19289. case Models.COMMAND_TYPES.comment:
  19290. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  19291. case Models.COMMAND_TYPES.reader:
  19292. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  19293. case Models.COMMAND_TYPES.writer:
  19294. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  19295. case Models.COMMAND_TYPES.attribution:
  19296. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  19297. case Models.COMMAND_TYPES.functioncall:
  19298. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  19299. case Models.COMMAND_TYPES.iftrue:
  19300. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  19301. case Models.COMMAND_TYPES.repeatNtimes:
  19302. return new Models.RepeatNTimes(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), null, new Models.ConditionalExpression(null), null, null);
  19303. case Models.COMMAND_TYPES.whiletrue:
  19304. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  19305. case Models.COMMAND_TYPES.dowhiletrue:
  19306. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  19307. case Models.COMMAND_TYPES.switch:
  19308. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  19309. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  19310. case Models.COMMAND_TYPES.return:
  19311. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  19312. }
  19313. }
  19314. function dragTrash(event) {
  19315. var trash = (0, _jquery2.default)('<i class="ui icon trash alternate outline"></i>');
  19316. (0, _jquery2.default)('body').append(trash);
  19317. trash.css('position', 'absolute');
  19318. trash.css('top', event.clientY);
  19319. trash.css('left', event.clientX - 20);
  19320. trash.css('font-size', '3em');
  19321. trash.css('display', 'none');
  19322. trash.fadeIn(200, function () {
  19323. trash.fadeOut(200, function () {
  19324. trash.remove();
  19325. });
  19326. });
  19327. }
  19328. function preCreateCommand(command_type, function_called) {
  19329. if (function_called == null) return genericCreateCommand(command_type);else if (command_type == 'functioncall') {
  19330. if (function_called.return_type != _types.Types.VOID) {
  19331. /*var var_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19332. var_menu.function_called = function_called;
  19333. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.none,
  19334. var_menu]);
  19335. exp.function_called = function_called;
  19336. return new Models.Attribution(new Models.VariableValueMenu(
  19337. VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false),[exp]);*/
  19338. command_type = 'attribution';
  19339. }
  19340. return genericCreateCommand(command_type);
  19341. /*var varM = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false);
  19342. varM.function_called = function_called;
  19343. var parameters = [];
  19344. for (var i = 0; i < function_called.parameters_list.length; i++) {
  19345. parameters.push(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  19346. }
  19347. //var functionCall = new Models.FunctionCall(varM, parameters);
  19348. var functionCall = new Models.FunctionCall(varM, null);
  19349. return functionCall;*/
  19350. } else if (command_type == 'attribution') {
  19351. var var_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19352. //var_menu.function_called = function_called;
  19353. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.none, var_menu]);
  19354. //exp.function_called = function_called;
  19355. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, function_called, null, null, false), [exp]);
  19356. }
  19357. }
  19358. function manageCommand(function_obj, function_container, event, command_type, function_called) {
  19359. (0, _jquery2.default)(".created_element").each(function (index) {
  19360. (0, _jquery2.default)(this).remove();
  19361. });
  19362. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  19363. console.log('soltou no: ');
  19364. console.log(el);
  19365. console.log(el.data('fun'));
  19366. // Primeiro verificar se ele soltou no espaço da função correta:
  19367. var hier = el.parentsUntil(".all_functions");
  19368. var esta_correto = false;
  19369. var esta_na_div_correta = false;
  19370. if (el.hasClass("commands_list_div")) {
  19371. esta_na_div_correta = true;
  19372. }
  19373. for (var i = 0; i < hier.length; i++) {
  19374. var temp = (0, _jquery2.default)(hier[i]);
  19375. if (temp.hasClass("commands_list_div")) {
  19376. esta_na_div_correta = true;
  19377. }
  19378. if (temp.data('fun') == function_obj) {
  19379. esta_correto = true;
  19380. break;
  19381. }
  19382. }
  19383. if (!esta_correto) {
  19384. has_element_created_draged = false;
  19385. which_element_is_draged = null;
  19386. dragTrash(event);
  19387. return;
  19388. } else {
  19389. if (!esta_na_div_correta) {
  19390. has_element_created_draged = false;
  19391. which_element_is_draged = null;
  19392. dragTrash(event);
  19393. return;
  19394. }
  19395. }
  19396. // Agora é descobrir qual o escopo para adicionar o comando:
  19397. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  19398. if (typeof el.data('fun') !== 'undefined') {
  19399. // Se a lista de comandos estiver vazia, então é o primeiro.
  19400. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  19401. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  19402. // pode adicionar
  19403. el.data('fun').commands = [];
  19404. var new_cmd = preCreateCommand(command_type, function_called);
  19405. el.data('fun').commands.push(new_cmd);
  19406. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj, function_called);
  19407. } else {
  19408. // Entra nesse else, caso já existam outros comandos no bloco:
  19409. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type, function_called);
  19410. }
  19411. } else {
  19412. console.log("soltou em um comando");
  19413. // descobrir em qual comando ele soltou:
  19414. var hier_find = el.parentsUntil(".commands_list_div");
  19415. var hierarquia_bottom_up = [];
  19416. if (typeof el.data('command') !== 'undefined') {
  19417. hierarquia_bottom_up.push(el.data('command'));
  19418. }
  19419. for (var i = 0; i < hier_find.length; i++) {
  19420. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  19421. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  19422. }
  19423. }
  19424. console.log("comando em que soltou: ");
  19425. console.log(hierarquia_bottom_up[0]);
  19426. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  19427. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  19428. console.log(hierarquia_bottom_up[i]);
  19429. }
  19430. // Se for do tipo break, verificar se está no contexto correto:
  19431. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  19432. var is_correct_context = false;
  19433. if (command_type == Models.COMMAND_TYPES.break) {
  19434. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  19435. if (hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.repeatNtimes || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.whiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.dowhiletrue || hierarquia_bottom_up[i].type == Models.COMMAND_TYPES.switch) {
  19436. is_correct_context = true;
  19437. break;
  19438. }
  19439. }
  19440. if (!is_correct_context) {
  19441. console.error("Context not allowed to insert BREAK COMMAND!");
  19442. return;
  19443. }
  19444. }
  19445. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  19446. if (hierarquia_bottom_up.length == 1) {
  19447. console.log('QQ1');
  19448. var sub_elemento = false;
  19449. for (var i = 0; i < hier_find.length; i++) {
  19450. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  19451. console.log('QQ2');
  19452. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type, function_called);
  19453. sub_elemento = true;
  19454. break;
  19455. }
  19456. }
  19457. if (!sub_elemento) {
  19458. console.log('QQ3');
  19459. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type, function_called);
  19460. }
  19461. } else {
  19462. console.log('QQ4');
  19463. // caso exista mais de um elemento na hierarquia:
  19464. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  19465. console.log('QQ5');
  19466. console.log("PPP1");
  19467. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up, function_called);
  19468. } else {
  19469. console.log('QQ6');
  19470. var sub_elemento = false;
  19471. for (var i = 0; i < hier_find.length; i++) {
  19472. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  19473. console.log('QQ7');
  19474. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up, function_called);
  19475. sub_elemento = true;
  19476. break;
  19477. }
  19478. }
  19479. }
  19480. }
  19481. }
  19482. has_element_created_draged = false;
  19483. which_element_is_draged = null;
  19484. }
  19485. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  19486. var function_called = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  19487. var el_jq = (0, _jquery2.default)(el);
  19488. var command_parent = el_jq.data('command');
  19489. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.switch) {
  19490. console.log('QQ17');
  19491. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  19492. console.log('QQ18');
  19493. // Se não tiver outro comando ainda no bloco, só adiciona:
  19494. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  19495. command_parent.commands_block = [];
  19496. var recentComand = preCreateCommand(command_type, function_called);
  19497. command_parent.commands_block.push(recentComand);
  19498. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj, function_called);
  19499. } else {
  19500. // Se já tem algum comando no bloco:
  19501. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent, function_called);
  19502. }
  19503. } else {
  19504. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  19505. addCommandToSwitchCase(event, function_obj, command_type, function_called);
  19506. }
  19507. } else {
  19508. console.log('QQ19');
  19509. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  19510. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type, function_called);
  19511. }
  19512. }
  19513. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  19514. var function_called = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
  19515. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  19516. var menor_distancia = 999999999;
  19517. var elemento_menor_distancia = null;
  19518. var antes = true;
  19519. var t_bot;
  19520. var t_top;
  19521. // Descobrindo o elemento mais próximo:
  19522. for (var i = 0; i < all_sub.length; i++) {
  19523. t_top = all_sub[i].getBoundingClientRect().top;
  19524. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  19525. if (t_top - event.clientY < menor_distancia) {
  19526. menor_distancia = event.clientY - t_top;
  19527. elemento_menor_distancia = all_sub[i];
  19528. }
  19529. }
  19530. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  19531. var recentComand = preCreateCommand(command_type, function_called);
  19532. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  19533. if (borda_inferior - event.clientY < menor_distancia) {
  19534. command_parent.commands_block.push(recentComand);
  19535. //
  19536. renderCommand(recentComand, node_list_commands, 3, function_obj, function_called);
  19537. } else {
  19538. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  19539. if (index > -1) {
  19540. command_parent.commands_block.splice(index, 0, recentComand);
  19541. }
  19542. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj, function_called);
  19543. }
  19544. }
  19545. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  19546. var function_called = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  19547. var el_jq = (0, _jquery2.default)(el);
  19548. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  19549. var command_target = el_jq.data('command');
  19550. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  19551. var is_in_else = false;
  19552. if (!command_parent) {
  19553. command_parent = el_jq.data('command');
  19554. temp_parent = el_jq;
  19555. var hier = el_jq.parentsUntil(".command_container");
  19556. for (var i = 0; i < hier.length; i++) {
  19557. var temp = (0, _jquery2.default)(hier[i]);
  19558. if (typeof temp.data('else') != 'undefined') {
  19559. is_in_else = true;
  19560. }
  19561. if (typeof temp.data('command') != 'undefined') {
  19562. command_parent = temp.data('command');
  19563. temp_parent = temp;
  19564. }
  19565. }
  19566. }
  19567. var hier = el_jq.parentsUntil(".command_container");
  19568. for (var i = 0; i < hier.length; i++) {
  19569. var temp = (0, _jquery2.default)(hier[i]);
  19570. if (typeof temp.data('else') != 'undefined') {
  19571. is_in_else = true;
  19572. }
  19573. }
  19574. if (command_parent == command_target) {
  19575. var hier = el_jq.parentsUntil(".command_container");
  19576. for (var i = 0; i < hier.length; i++) {
  19577. var temp = (0, _jquery2.default)(hier[i]);
  19578. if (typeof temp.data('else') !== 'undefined') {
  19579. is_in_else = true;
  19580. break;
  19581. }
  19582. }
  19583. }
  19584. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  19585. var hier = temp_parent.parentsUntil(".all_cases_div");
  19586. console.log("vou procurar!!");
  19587. for (var i = 0; i < hier.length; i++) {
  19588. console.log("estou vasculhando...");
  19589. var temp = (0, _jquery2.default)(hier[i]);
  19590. if (typeof temp.data('switchcase') !== 'undefined') {
  19591. console.log("encontrei");
  19592. command_parent = temp.data('switchcase');
  19593. is_in_else = false;
  19594. break;
  19595. }
  19596. }
  19597. }
  19598. console.log('debugging:');
  19599. console.log('el_jq');
  19600. console.log(el_jq);
  19601. console.log('command_parent');
  19602. console.log(command_parent);
  19603. console.log('command_target');
  19604. console.log(command_target);
  19605. var menor_distancia = 999999999;
  19606. var antes = true;
  19607. var t_bot;
  19608. var t_top;
  19609. t_top = el.getBoundingClientRect().top;
  19610. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  19611. var d_top = event.clientY - t_top; // distancia topo
  19612. var d_bot = t_bot - event.clientY; // distancia baixo
  19613. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  19614. if (d_top < d_bot) {
  19615. var recentComand = preCreateCommand(command_type, function_called);
  19616. console.log('MMM1');
  19617. if (is_in_else) {
  19618. console.log('MMM2');
  19619. if (command_parent == command_target) {
  19620. console.log('MMM3');
  19621. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  19622. command_parent.commands_else = [];
  19623. var recentComand = preCreateCommand(command_type, function_called);
  19624. command_parent.commands_else.push(recentComand);
  19625. renderCommand(recentComand, el_jq, 3, function_obj, function_called, function_called);
  19626. } else {
  19627. // Se já tem algum comando no bloco:
  19628. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true, function_called);
  19629. }
  19630. return;
  19631. }
  19632. console.log('MMM7');
  19633. var index = command_parent.commands_else.indexOf(command_target);
  19634. if (index > -1) {
  19635. command_parent.commands_else.splice(index, 0, recentComand);
  19636. }
  19637. renderCommand(recentComand, el, 1, function_obj);
  19638. } else {
  19639. console.log('MMM4');
  19640. if (command_parent == command_target) {
  19641. console.log('Nxxxx5');
  19642. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  19643. command_parent.commands_block = [];
  19644. console.log('SSS4');
  19645. var recentComand = preCreateCommand(command_type, function_called);
  19646. command_parent.commands_block.push(recentComand);
  19647. renderCommand(recentComand, el_jq, 3, function_obj, function_called);
  19648. } else {
  19649. console.log('SSS5');
  19650. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, false, function_called);
  19651. }
  19652. return;
  19653. }
  19654. console.log('MMM6');
  19655. var index = command_parent.commands_block.indexOf(command_target);
  19656. if (index > -1) {
  19657. command_parent.commands_block.splice(index, 0, recentComand);
  19658. }
  19659. renderCommand(recentComand, el, 1, function_obj, function_called);
  19660. }
  19661. } else {
  19662. console.log('XXX1');
  19663. var recentComand = preCreateCommand(command_type, function_called);
  19664. if (is_in_else) {
  19665. if (command_parent == command_target) {
  19666. console.log('MMM3');
  19667. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  19668. command_parent.commands_else = [];
  19669. console.log('SSS1');
  19670. var recentComand = preCreateCommand(command_type, function_called);
  19671. command_parent.commands_else.push(recentComand);
  19672. renderCommand(recentComand, el_jq, 3, function_obj, function_called);
  19673. } else {
  19674. // Se já tem algum comando no bloco:
  19675. console.log('SSS2');
  19676. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true, function_called);
  19677. }
  19678. return;
  19679. }
  19680. console.log('XXX2');
  19681. var index = command_parent.commands_else.indexOf(command_target);
  19682. if (index > -1) {
  19683. command_parent.commands_else.splice(index + 1, 0, recentComand);
  19684. }
  19685. renderCommand(recentComand, el, 2, function_obj, function_called);
  19686. } else {
  19687. if (command_parent == command_target) {
  19688. console.log('Nxxxx78');
  19689. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  19690. command_parent.commands_block = [];
  19691. var recentComand = preCreateCommand(command_type, function_called);
  19692. command_parent.commands_block.push(recentComand);
  19693. console.log('SSS6');
  19694. renderCommand(recentComand, el_jq, 3, function_obj, function_called);
  19695. } else {
  19696. console.log('SSS7');
  19697. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, false, function_called);
  19698. }
  19699. return;
  19700. }
  19701. console.log('XXX3');
  19702. var index = command_parent.commands_block.indexOf(command_target);
  19703. if (index > -1) {
  19704. command_parent.commands_block.splice(index + 1, 0, recentComand);
  19705. }
  19706. renderCommand(recentComand, el, 2, function_obj, function_called);
  19707. }
  19708. }
  19709. }
  19710. function insertCommandInBlock(el, event, function_obj, command_type) {
  19711. var function_called = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  19712. var el_jq = (0, _jquery2.default)(el);
  19713. var command_parent = el_jq.data('command');
  19714. if (el_jq.data('command').type == Models.COMMAND_TYPES.repeatNtimes || el_jq.data('command').type == Models.COMMAND_TYPES.whiletrue || el_jq.data('command').type == Models.COMMAND_TYPES.dowhiletrue) {
  19715. // Se não tiver outro comando ainda no bloco, só adiciona:
  19716. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  19717. command_parent.commands_block = [];
  19718. var recentComand = preCreateCommand(command_type, function_called);
  19719. command_parent.commands_block.push(recentComand);
  19720. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj, function_called);
  19721. } else {
  19722. // Se já tem algum comando no bloco:
  19723. findInBlockCorrectPlace(el, event, function_obj, command_type, false, function_called);
  19724. }
  19725. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  19726. console.log('QQ9');
  19727. // no if ou no else?
  19728. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  19729. var is_in_if = true;
  19730. if (correct_div.data('if')) {
  19731. is_in_if = true;
  19732. } else if (correct_div.data('else')) {
  19733. is_in_if = false;
  19734. } else {
  19735. var hier = correct_div.parentsUntil(".command_container");
  19736. for (var i = 0; i < hier.length; i++) {
  19737. var temp = (0, _jquery2.default)(hier[i]);
  19738. if (typeof temp.data('if') !== 'undefined') {
  19739. is_in_if = true;
  19740. break;
  19741. }
  19742. if (typeof temp.data('else') !== 'undefined') {
  19743. is_in_if = false;
  19744. break;
  19745. }
  19746. }
  19747. }
  19748. if (is_in_if) {
  19749. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  19750. command_parent.commands_block = [];
  19751. var recentComand = preCreateCommand(command_type, function_called);
  19752. command_parent.commands_block.push(recentComand);
  19753. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj, function_called, function_called);
  19754. } else {
  19755. // Se já tem algum comando no bloco:
  19756. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type, false, function_called);
  19757. }
  19758. } else {
  19759. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  19760. command_parent.commands_else = [];
  19761. var recentComand = preCreateCommand(command_type, function_called);
  19762. command_parent.commands_else.push(recentComand);
  19763. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  19764. } else {
  19765. // Se já tem algum comando no bloco:
  19766. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true, function_called);
  19767. }
  19768. }
  19769. } else {
  19770. // é do tipo switch
  19771. console.log("está tentando inserir em um switch que está na raiz!");
  19772. addCommandToSwitchCase(event, function_obj, command_type);
  19773. }
  19774. }
  19775. function addCommandToSwitchCase(event, function_obj, command_type, function_called) {
  19776. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  19777. var which_case = el.data('switchcase');
  19778. var case_div = el;
  19779. if (!which_case) {
  19780. var hier_find = el.parentsUntil(".all_cases_div");
  19781. for (var i = 0; i < hier_find.length; i++) {
  19782. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  19783. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  19784. case_div = (0, _jquery2.default)(hier_find[i]);
  19785. break;
  19786. }
  19787. }
  19788. }
  19789. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  19790. which_case.commands_block = [];
  19791. var recentComand = preCreateCommand(command_type, function_called);
  19792. which_case.commands_block.push(recentComand);
  19793. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj, function_called);
  19794. } else {
  19795. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type, function_called);
  19796. }
  19797. }
  19798. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  19799. var all_sub = case_div.find('div.command_container');
  19800. var menor_distancia = 999999999;
  19801. var elemento_menor_distancia = null;
  19802. var antes = true;
  19803. var t_bot;
  19804. var t_top;
  19805. // Descobrindo o elemento mais próximo:
  19806. for (var i = 0; i < all_sub.length; i++) {
  19807. t_top = all_sub[i].getBoundingClientRect().top;
  19808. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  19809. if (t_top - event.clientY < menor_distancia) {
  19810. menor_distancia = event.clientY - t_top;
  19811. elemento_menor_distancia = all_sub[i];
  19812. }
  19813. }
  19814. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  19815. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  19816. if (borda_inferior - event.clientY < menor_distancia) {
  19817. var recentComand = preCreateCommand(command_type, function_called);
  19818. which_case.commands_block.push(recentComand);
  19819. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj, function_called);
  19820. } else {
  19821. var recentComand = preCreateCommand(command_type, function_called);
  19822. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  19823. if (index > -1) {
  19824. which_case.commands_block.splice(index, 0, recentComand);
  19825. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj, function_called);
  19826. }
  19827. }
  19828. }
  19829. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  19830. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  19831. var function_called = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
  19832. var el_jq = (0, _jquery2.default)(el);
  19833. var all_sub = el_jq.find('div.command_container');
  19834. var menor_distancia = 999999999;
  19835. var elemento_menor_distancia = null;
  19836. var antes = true;
  19837. var t_bot;
  19838. var t_top;
  19839. // Descobrindo o elemento mais próximo:
  19840. for (var i = 0; i < all_sub.length; i++) {
  19841. t_top = all_sub[i].getBoundingClientRect().top;
  19842. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  19843. if (t_top - event.clientY < menor_distancia) {
  19844. menor_distancia = event.clientY - t_top;
  19845. elemento_menor_distancia = all_sub[i];
  19846. }
  19847. }
  19848. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  19849. console.log("menor_distancia: ");
  19850. console.log(elemento_menor_distancia);
  19851. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  19852. if (borda_inferior - event.clientY < menor_distancia) {
  19853. console.log('QQ11');
  19854. var recentComand = preCreateCommand(command_type, function_called);
  19855. var command_parent = el_jq.data('command');
  19856. if (is_in_else) {
  19857. console.log('QQ15');
  19858. command_parent.commands_else.push(recentComand);
  19859. console.log('el_jq');
  19860. console.log(el_jq);
  19861. console.log("$(el_jq.find('.commands_else')[0]):: ");
  19862. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  19863. renderCommand(recentComand, el_jq, 3, function_obj, function_called);
  19864. } else {
  19865. console.log('QQ16');
  19866. command_parent.commands_block.push(recentComand);
  19867. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj, function_called);
  19868. }
  19869. } else {
  19870. console.log('QQ12');
  19871. var recentComand = preCreateCommand(command_type, function_called);
  19872. var command_parent = el_jq.data('command');
  19873. if (is_in_else) {
  19874. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  19875. if (index > -1) {
  19876. command_parent.commands_else.splice(index, 0, recentComand);
  19877. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj, function_called);
  19878. }
  19879. } else {
  19880. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  19881. if (index > -1) {
  19882. command_parent.commands_block.splice(index, 0, recentComand);
  19883. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj, function_called);
  19884. }
  19885. }
  19886. }
  19887. }
  19888. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  19889. var function_called = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  19890. switch ((0, _jquery2.default)(el).data('command').type) {
  19891. case Models.COMMAND_TYPES.iftrue:
  19892. case Models.COMMAND_TYPES.switch:
  19893. case Models.COMMAND_TYPES.repeatNtimes:
  19894. case Models.COMMAND_TYPES.whiletrue:
  19895. case Models.COMMAND_TYPES.dowhiletrue:
  19896. insertCommandInBlock(el, event, function_obj, command_type, function_called);
  19897. return;
  19898. }
  19899. var menor_distancia = 999999999;
  19900. var antes = true;
  19901. var t_bot;
  19902. var t_top;
  19903. t_top = el.getBoundingClientRect().top;
  19904. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  19905. var d_top = event.clientY - t_top; // distancia topo
  19906. var d_bot = t_bot - event.clientY; // distancia baixo
  19907. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  19908. if (d_top < d_bot) {
  19909. var recentComand = preCreateCommand(command_type, function_called);
  19910. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  19911. if (index > -1) {
  19912. function_obj.commands.splice(index, 0, recentComand);
  19913. }
  19914. renderCommand(recentComand, el, 1, function_obj, function_called);
  19915. } else {
  19916. var recentComand = preCreateCommand(command_type, function_called);
  19917. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  19918. if (index > -1) {
  19919. function_obj.commands.splice(index + 1, 0, recentComand);
  19920. }
  19921. renderCommand(recentComand, el, 2, function_obj, function_called);
  19922. }
  19923. }
  19924. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  19925. var function_called = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
  19926. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  19927. var menor_distancia = 999999999;
  19928. var elemento_menor_distancia = null;
  19929. var antes = true;
  19930. var t_bot;
  19931. var t_top;
  19932. // Descobrindo o elemento mais próximo:
  19933. for (var i = 0; i < all_sub.length; i++) {
  19934. t_top = all_sub[i].getBoundingClientRect().top;
  19935. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  19936. if (t_top - event.clientY < menor_distancia) {
  19937. menor_distancia = event.clientY - t_top;
  19938. elemento_menor_distancia = all_sub[i];
  19939. }
  19940. }
  19941. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  19942. var recentComand = preCreateCommand(command_type, function_called);
  19943. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  19944. if (borda_inferior - event.clientY < menor_distancia) {
  19945. function_obj.commands.push(recentComand);
  19946. //
  19947. renderCommand(recentComand, node_list_commands, 3, function_obj, function_called);
  19948. } else {
  19949. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  19950. if (index > -1) {
  19951. function_obj.commands.splice(index, 0, recentComand);
  19952. }
  19953. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj, function_called);
  19954. }
  19955. }
  19956. //******************************************************
  19957. //* DOUGLAS
  19958. //******************************************************
  19959. exports.createFloatingCommand = createFloatingCommand = function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  19960. var floatingObject;
  19961. switch (command_type) {
  19962. case Models.COMMAND_TYPES.break:
  19963. floatingObject = BreaksManagement.createFloatingCommand();
  19964. break;
  19965. case Models.COMMAND_TYPES.comment:
  19966. floatingObject = CommentsManagement.createFloatingCommand();
  19967. break;
  19968. case Models.COMMAND_TYPES.reader:
  19969. floatingObject = ReadersManagement.createFloatingCommand();
  19970. break;
  19971. case Models.COMMAND_TYPES.writer:
  19972. floatingObject = WritersManagement.createFloatingCommand();
  19973. break;
  19974. case Models.COMMAND_TYPES.attribution:
  19975. floatingObject = AttributionsManagement.createFloatingCommand();
  19976. break;
  19977. case Models.COMMAND_TYPES.iftrue:
  19978. floatingObject = IftruesManagement.createFloatingCommand();
  19979. break;
  19980. case Models.COMMAND_TYPES.repeatNtimes:
  19981. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  19982. break;
  19983. case Models.COMMAND_TYPES.whiletrue:
  19984. floatingObject = WhiletruesManagement.createFloatingCommand();
  19985. break;
  19986. case Models.COMMAND_TYPES.dowhiletrue:
  19987. floatingObject = DowhiletruesManagement.createFloatingCommand();
  19988. break;
  19989. case Models.COMMAND_TYPES.switch:
  19990. floatingObject = SwitchesManagement.createFloatingCommand();
  19991. break;
  19992. case Models.COMMAND_TYPES.functioncall:
  19993. floatingObject = FunctioncallsManagement.createFloatingCommand();
  19994. break;
  19995. }
  19996. floatingObject.draggable().appendTo("body");
  19997. floatingObject.on('dragstart', function (e) {
  19998. console.log("TESTEEEEE");
  19999. }).trigger('dragstart');
  20000. floatingObject.mouseup(function (evt) {
  20001. console.log('mouseup');
  20002. (0, _jquery2.default)(".commands_list_div, .commands_list_div, .block_commands, .command_container").off('mouseenter mouseleave');
  20003. manageCommand(function_obj, function_container, evt, command_type);
  20004. });
  20005. floatingObject.css("position", "absolute");
  20006. mouse_event.type = "mousedown.draggable";
  20007. mouse_event.target = floatingObject[0];
  20008. floatingObject.css("left", mouse_event.pageX - 15);
  20009. floatingObject.css("top", mouse_event.pageY - 15);
  20010. floatingObject.trigger(mouse_event);
  20011. };
  20012. /*
  20013. manageCommand = function(function_obj, function_container, event, command_type) {
  20014. $( ".created_element" ).each(function( index ) {
  20015. $(this).remove();
  20016. });
  20017. var el = $(document.elementFromPoint(event.clientX, event.clientY));
  20018. console.log('soltou no: ');
  20019. console.log(el);
  20020. console.log(el.data('fun'));
  20021. // Primeiro verificar se ele soltou no espaço da função correta:
  20022. var hier = el.parentsUntil(".all_functions");
  20023. var esta_correto = false;
  20024. var esta_na_div_correta = false;
  20025. if (el.hasClass("commands_list_div")) {
  20026. esta_na_div_correta = true;
  20027. }
  20028. for (var i = 0; i < hier.length; i++) {
  20029. var temp = $(hier[i]);
  20030. if (temp.hasClass("commands_list_div")) {
  20031. esta_na_div_correta = true;
  20032. }
  20033. if (temp.data('fun') == function_obj || function_obj == null) {
  20034. function_obj = temp.data('fun');
  20035. esta_correto = true;
  20036. break;
  20037. }
  20038. }
  20039. if (!esta_correto) {
  20040. has_element_created_draged = false;
  20041. which_element_is_draged = null;
  20042. return;
  20043. } else {
  20044. if (!esta_na_div_correta) {
  20045. has_element_created_draged = false;
  20046. which_element_is_draged = null;
  20047. return;
  20048. }
  20049. }
  20050. // Agora é descobrir qual o escopo para adicionar o comando:
  20051. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  20052. if (typeof el.data('fun') !== 'undefined') {
  20053. // Se a lista de comandos estiver vazia, então é o primeiro.
  20054. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  20055. if ((el.data('fun').commands == null) || (el.data('fun').commands.length == 0)) {
  20056. // pode adicionar
  20057. el.data('fun').commands = [];
  20058. var new_cmd = genericCreateCommand(command_type);
  20059. el.data('fun').commands.push(new_cmd);
  20060. renderCommand(new_cmd, $(function_container).find('.commands_list_div'), 3, function_obj);
  20061. } else { // Entra nesse else, caso já existam outros comandos no bloco:
  20062. findNearbyCommandToAddInFunctionScope(el, event, $(function_container).find('.commands_list_div'), function_obj, command_type);
  20063. }
  20064. } else {
  20065. console.log("soltou em um comando");
  20066. // descobrir em qual comando ele soltou:
  20067. var hier_find = el.parentsUntil(".commands_list_div");
  20068. var hierarquia_bottom_up = [];
  20069. if (typeof el.data('command') !== 'undefined') {
  20070. hierarquia_bottom_up.push(el.data('command'));
  20071. }
  20072. for (var i = 0; i < hier_find.length; i++) {
  20073. if (typeof $(hier_find[i]).data('command') !== 'undefined') {
  20074. hierarquia_bottom_up.push($(hier_find[i]).data('command'));
  20075. }
  20076. }
  20077. console.log("comando em que soltou: ");
  20078. console.log(hierarquia_bottom_up[0]);
  20079. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  20080. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  20081. console.log(hierarquia_bottom_up[i]);
  20082. }
  20083. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  20084. if (hierarquia_bottom_up.length == 1) {
  20085. var sub_elemento = false;
  20086. for (var i = 0; i < hier_find.length; i++) {
  20087. if (typeof $(hier_find[i]).data('command') !== 'undefined') {
  20088. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  20089. sub_elemento = true;
  20090. break;
  20091. }
  20092. }
  20093. if (!sub_elemento) {
  20094. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  20095. }
  20096. } else {
  20097. // caso exista mais de um elemento na hierarquia:
  20098. if (typeof $(el).data('command') !== 'undefined') {
  20099. console.log("PPP1");
  20100. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  20101. } else {
  20102. var sub_elemento = false;
  20103. for (var i = 0; i < hier_find.length; i++) {
  20104. if (typeof $(hier_find[i]).data('command') !== 'undefined') {
  20105. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  20106. sub_elemento = true;
  20107. break;
  20108. }
  20109. }
  20110. }
  20111. }
  20112. }
  20113. has_element_created_draged = false;
  20114. which_element_is_draged = null;
  20115. }
  20116. */
  20117. function prepareManageCommand(function_obj, function_container, evt, command_type) {
  20118. var function_called = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  20119. manageCommand(function_obj, function_container, evt, command_type, function_called);
  20120. }
  20121. /***/ }),
  20122. /***/ "./js/visualUI/functions_sidebar.js":
  20123. /*!******************************************!*\
  20124. !*** ./js/visualUI/functions_sidebar.js ***!
  20125. \******************************************/
  20126. /*! no static exports found */
  20127. /***/ (function(module, exports, __webpack_require__) {
  20128. "use strict";
  20129. Object.defineProperty(exports, "__esModule", {
  20130. value: true
  20131. });
  20132. exports.renderFunction = renderFunction;
  20133. exports.initVisualUI = initVisualUI;
  20134. exports.generateMenuButton = generateMenuButton;
  20135. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20136. var _jquery2 = _interopRequireDefault(_jquery);
  20137. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20138. var _ivprog_elements_sidebar = __webpack_require__(/*! ./ivprog_elements_sidebar */ "./js/visualUI/ivprog_elements_sidebar.js");
  20139. var Models = _interopRequireWildcard(_ivprog_elements_sidebar);
  20140. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20141. var _globals_sidebar = __webpack_require__(/*! ./globals_sidebar */ "./js/visualUI/globals_sidebar.js");
  20142. var GlobalsManagement = _interopRequireWildcard(_globals_sidebar);
  20143. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  20144. var VariablesManagement = _interopRequireWildcard(_variables);
  20145. var _commands_sidebar = __webpack_require__(/*! ./commands_sidebar */ "./js/visualUI/commands_sidebar.js");
  20146. var CommandsManagement = _interopRequireWildcard(_commands_sidebar);
  20147. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  20148. var CodeManagement = _interopRequireWildcard(_code_generator);
  20149. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20150. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  20151. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  20152. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  20153. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  20154. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  20155. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  20156. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  20157. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  20158. var _algorithm_sidebar = __webpack_require__(/*! ./algorithm_sidebar */ "./js/visualUI/algorithm_sidebar.js");
  20159. var AlgorithmManagement = _interopRequireWildcard(_algorithm_sidebar);
  20160. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  20161. var Utils = _interopRequireWildcard(_utils);
  20162. __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  20163. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  20164. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20165. var counter_new_functions = 0;
  20166. var counter_new_parameters = 0;
  20167. var studentTemp = null;
  20168. var domConsole = null;
  20169. window.studentGrade = null;
  20170. window.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  20171. var program = new Models.Program();
  20172. window.system_functions = [];
  20173. // Adding math functions:
  20174. window.system_functions.push(new Models.SystemFunction('$sin', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20175. window.system_functions.push(new Models.SystemFunction('$cos', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20176. window.system_functions.push(new Models.SystemFunction('$tan', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20177. window.system_functions.push(new Models.SystemFunction('$sqrt', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20178. window.system_functions.push(new Models.SystemFunction('$pow', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20179. window.system_functions.push(new Models.SystemFunction('$log', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20180. window.system_functions.push(new Models.SystemFunction('$abs', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20181. window.system_functions.push(new Models.SystemFunction('$negate', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20182. window.system_functions.push(new Models.SystemFunction('$invert', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20183. window.system_functions.push(new Models.SystemFunction('$max', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20184. window.system_functions.push(new Models.SystemFunction('$min', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.math));
  20185. // Adding text functions:
  20186. window.system_functions.push(new Models.SystemFunction('$substring', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  20187. window.system_functions.push(new Models.SystemFunction('$length', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  20188. window.system_functions.push(new Models.SystemFunction('$uppercase', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  20189. window.system_functions.push(new Models.SystemFunction('$lowercase', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  20190. window.system_functions.push(new Models.SystemFunction('$charAt', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true), new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.text));
  20191. // Adding arrangement functions:
  20192. window.system_functions.push(new Models.SystemFunction('$numElements', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 1)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  20193. window.system_functions.push(new Models.SystemFunction('$matrixLines', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 2)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  20194. window.system_functions.push(new Models.SystemFunction('$matrixColumns', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 2)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  20195. // Adding conversion functions:
  20196. window.system_functions.push(new Models.SystemFunction('$isReal', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  20197. window.system_functions.push(new Models.SystemFunction('$isInt', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  20198. window.system_functions.push(new Models.SystemFunction('$isBool', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  20199. window.system_functions.push(new Models.SystemFunction('$castReal', _types.Types.REAL, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  20200. window.system_functions.push(new Models.SystemFunction('$castInt', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  20201. window.system_functions.push(new Models.SystemFunction('$castBool', _types.Types.BOOLEAN, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  20202. window.system_functions.push(new Models.SystemFunction('$castString', _types.Types.TEXT, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion));
  20203. 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');
  20204. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  20205. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  20206. program.addFunction(mainFunction);
  20207. window.program_obj = program;
  20208. window.generator = CodeManagement.generate;
  20209. window.runCodeAssessment = runCodeAssessment;
  20210. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  20211. window.insertContext = false;
  20212. window.watchW = _melankeWatchjs2.default;
  20213. _melankeWatchjs2.default.watch(window.program_obj.globals, function () {
  20214. if (window.insertContext) {
  20215. setTimeout(function () {
  20216. AlgorithmManagement.renderAlgorithm();
  20217. }, 300);
  20218. window.insertContext = false;
  20219. } else {
  20220. AlgorithmManagement.renderAlgorithm();
  20221. }
  20222. }, 1);
  20223. _melankeWatchjs2.default.watch(window.program_obj.functions, function () {
  20224. if (window.insertContext) {
  20225. setTimeout(function () {
  20226. AlgorithmManagement.renderAlgorithm();
  20227. }, 300);
  20228. window.insertContext = false;
  20229. } else {
  20230. AlgorithmManagement.renderAlgorithm();
  20231. }
  20232. }, 0);
  20233. function addFunctionHandler() {
  20234. var new_function = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("new_function") + "_" + counter_new_functions, _types.Types.VOID, 0, [], false, false, [], new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_start')));
  20235. program.addFunction(new_function);
  20236. counter_new_functions++;
  20237. window.insertContext = true;
  20238. var newe = renderFunction(new_function);
  20239. newe.css('display', 'none');
  20240. newe.fadeIn();
  20241. }
  20242. function addParameter(function_obj, function_container) {
  20243. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  20244. if (function_obj.parameters_list == null) {
  20245. function_obj.parameters_list = [];
  20246. }
  20247. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  20248. function_obj.parameters_list.push(new_parameter);
  20249. counter_new_parameters++;
  20250. var newe = renderParameter(function_obj, new_parameter, function_container);
  20251. if (is_from_click) {
  20252. newe.css('display', 'none');
  20253. newe.fadeIn();
  20254. }
  20255. }
  20256. function updateReturnType(function_obj, new_type) {
  20257. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20258. function_obj.return_type = new_type;
  20259. function_obj.return_dimensions = new_dimensions;
  20260. }
  20261. function removeFunction(function_obj) {
  20262. var index = program.functions.indexOf(function_obj);
  20263. if (index > -1) {
  20264. program.functions.splice(index, 1);
  20265. }
  20266. }
  20267. function minimizeFunction(function_obj) {
  20268. function_obj.is_hidden = !function_obj.is_hidden;
  20269. }
  20270. function addHandlers(function_obj, function_container) {
  20271. function_container.find('.ui.dropdown.function_return').dropdown({
  20272. onChange: function onChange(value, text, $selectedItem) {
  20273. if ($selectedItem.data('dimensions')) {
  20274. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  20275. } else {
  20276. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  20277. }
  20278. },
  20279. selectOnKeydown: false
  20280. });
  20281. function_container.find(".name_function_updated").on('click', function (e) {
  20282. enableNameFunctionUpdate(function_obj, function_container);
  20283. });
  20284. function_container.find(".add_parameter_button").on('click', function (e) {
  20285. window.insertContext = true;
  20286. addParameter(function_obj, function_container, true);
  20287. });
  20288. function_container.find('.menu_commands').dropdown({
  20289. on: 'hover'
  20290. });
  20291. function_container.find('.menu_commands a').on('click', function (evt) {
  20292. if (function_obj.commands == null || function_obj.commands.length == 0) {
  20293. function_obj.commands = [];
  20294. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  20295. function_obj.commands.push(new_cmd);
  20296. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  20297. } else {
  20298. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  20299. }
  20300. });
  20301. function_container.find('.add_var_button_function').on('click', function (e) {
  20302. window.insertContext = true;
  20303. VariablesManagement.addVariable(function_obj, function_container, true);
  20304. });
  20305. function_container.find('.remove_function_button').on('click', function (e) {
  20306. removeFunction(function_obj);
  20307. function_container.fadeOut();
  20308. });
  20309. function_container.find('.minimize_function_button').on('click', function (e) {
  20310. minimizeFunction(function_obj);
  20311. if (function_obj.is_hidden) {
  20312. function_container.find(".add_var_button_function").toggle();
  20313. function_container.find(".inline_add_command").toggle();
  20314. function_container.find(".function_area").slideToggle();
  20315. } else {
  20316. function_container.find(".function_area").slideToggle(function () {
  20317. function_container.find(".add_var_button_function").toggle();
  20318. function_container.find(".inline_add_command").toggle();
  20319. });
  20320. }
  20321. });
  20322. }
  20323. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  20324. function renderFunctionReturn(function_obj, function_element) {
  20325. var ret = '<div class="ui dropdown function_return">';
  20326. if (function_obj.return_dimensions > 0) {
  20327. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  20328. if (function_obj.return_dimensions == 1) {
  20329. ret += ' [ ] ';
  20330. } else {
  20331. ret += ' [ ] [ ] ';
  20332. }
  20333. ret += '</div>';
  20334. } else {
  20335. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  20336. }
  20337. ret += '<div class="menu">';
  20338. for (var tm in _types.Types) {
  20339. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions < 1 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  20340. }
  20341. for (var tm in _types.Types) {
  20342. if (tm == _types.Types.VOID.toUpperCase()) {
  20343. continue;
  20344. }
  20345. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.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="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  20346. }
  20347. ret += '</div></div>';
  20348. ret = (0, _jquery2.default)(ret);
  20349. function_element.find('.function_return').append(ret);
  20350. }
  20351. function renderFunction(function_obj) {
  20352. var appender = '<div class="ui secondary segment function_div list-group-item">';
  20353. if (function_obj.function_comment) {
  20354. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  20355. }
  20356. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  20357. 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>';
  20358. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  20359. if (function_obj.is_main) {
  20360. appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + _localizedStringsService.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">';
  20361. } else {
  20362. appender += '<div class="ui function_return"></div>';
  20363. 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">';
  20364. var menu_func = generateMenuButton(function_obj);
  20365. /*menu_func.css("display","none")
  20366. $('.functions_labels').append(menu_func);
  20367. menu_func.fadeIn();*/
  20368. (0, _jquery2.default)('.functions_labels').append(menu_func);
  20369. }
  20370. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  20371. appender += '<div class="ui add_var_context add_var_button_function" style="float: left; display: none;"><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>';
  20372. appender += '<div class="ui top attached segment variables_list_div" style="display: none;"></div>';
  20373. appender += '<div class="ui inline_add_command" style="display: none;"><i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" style="float: left;" ><i class="icon code"></i> <div class="menu"> ';
  20374. appender += '<a class="item" data-command="' + Models.COMMAND_TYPES.reader + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.writer + '"><i class="upload icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.comment + '"><i class="quote left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_comment') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.attribution + '"><i class="arrow left icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.functioncall + '"><i class="hand point right icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.iftrue + '" ><i class="random icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.repeatNtimes + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.whiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.dowhiletrue + '"><i class="sync icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.switch + '"><i class="list icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_switch') + '</a>' + '<a class="item" data-command="' + Models.COMMAND_TYPES.return + '"><i class="reply icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('text_btn_return') + '</a>' + '</div></div></div>';
  20375. appender += '<div class="ui bottom attached segment commands_list_div"></div>';
  20376. appender += '</div></div>';
  20377. appender = (0, _jquery2.default)(appender);
  20378. (0, _jquery2.default)('.all_functions').append(appender);
  20379. appender.data('fun', function_obj);
  20380. appender.find('.commands_list_div').data('fun', function_obj).attr('droppable', true).on('dragenter', function (e) {
  20381. e.preventDefault();
  20382. console.log('dragenter');
  20383. console.log(e.target);
  20384. (0, _jquery2.default)(e.target).addClass('div-over');
  20385. //e.stopPropagation();
  20386. }).on('dragover', function (e) {
  20387. e.preventDefault();
  20388. }).on('dragleave', function (e) {
  20389. e.preventDefault();
  20390. //e.stopPropagation();
  20391. console.log("dragleave");
  20392. (0, _jquery2.default)(e.target).removeClass('div-over');
  20393. console.log(e.target);
  20394. }).on('drop', function (e, bundle) {
  20395. e.preventDefault();
  20396. if (program_obj.dataTransfer == null) return;
  20397. if (bundle) {
  20398. e.clientX = bundle.clientX;
  20399. e.clientY = bundle.clientY;
  20400. }
  20401. //console.log('ondrop ' + e.originalEvent.dataTransfer.getData("text"));
  20402. console.log(e);
  20403. (0, _jquery2.default)(e.target).removeClass('div-over');
  20404. //var data = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
  20405. var data = program_obj.dataTransfer;
  20406. if (data.type == 'command') CommandsManagement.prepareManageCommand(function_obj, (0, _jquery2.default)(e.target).closest('.function_div'), e, data.content);else if (data.type == 'var') CommandsManagement.prepareManageCommand(function_obj, (0, _jquery2.default)(e.target).closest('.function_div'), e, "attribution", data.content);else {
  20407. if (!data.content.parameters_list) data.content.parameters_list = [];
  20408. CommandsManagement.prepareManageCommand(function_obj, (0, _jquery2.default)(e.target).closest('.function_div'), e, "functioncall", data.content);
  20409. }
  20410. //program_obj.dataTransfer;
  20411. program_obj.dataTransfer = null;
  20412. }).on('click', function (e) {
  20413. if (window.ghostNode) {
  20414. console.log("drop click");
  20415. (0, _jquery2.default)(document).off('mousemove').off('mousedown').off('keyup');
  20416. (0, _jquery2.default)(window.ghostNode).remove();
  20417. delete window.ghostNode;
  20418. (0, _jquery2.default)(this).trigger('drop', [e]);
  20419. (0, _jquery2.default)('.div-over').removeClass('div-over');
  20420. }
  20421. }).on('mouseover', function (evt) {
  20422. if (window.ghostNode) {
  20423. evt.type = 'dragenter';
  20424. //$(this).trigger('dragenter');
  20425. console.log('mouseover');
  20426. (0, _jquery2.default)(this).trigger(evt);
  20427. }
  20428. }).on('mouseout', function (evt) {
  20429. //$(this).trigger('dragleave');
  20430. if (window.ghostNode) {
  20431. evt.type = 'dragleave';
  20432. console.log('mouseout');
  20433. (0, _jquery2.default)(this).trigger(evt);
  20434. }
  20435. });
  20436. renderFunctionReturn(function_obj, appender);
  20437. addHandlers(function_obj, appender);
  20438. // Rendering parameters:
  20439. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  20440. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  20441. }
  20442. // Rendering variables:
  20443. for (var j = 0; j < function_obj.variables_list.length; j++) {
  20444. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  20445. }
  20446. // Rendering commands:
  20447. for (var j = 0; j < function_obj.commands.length; j++) {
  20448. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  20449. }
  20450. (0, _jquery2.default)('.minimize_function_button').popup({
  20451. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  20452. delay: {
  20453. show: 750,
  20454. hide: 0
  20455. }
  20456. });
  20457. Sortable.create(appender.find(".variables_list_div")[0], {
  20458. handle: '.ellipsis',
  20459. animation: 100,
  20460. ghostClass: 'ghost',
  20461. group: 'local_vars_drag_' + program.functions.indexOf(function_obj),
  20462. onEnd: function onEnd(evt) {
  20463. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  20464. }
  20465. });
  20466. Sortable.create(appender.find(".commands_list_div")[0], {
  20467. handle: '.command_drag',
  20468. animation: 100,
  20469. ghostClass: 'ghost',
  20470. group: 'commands_drag_' + program.functions.indexOf(function_obj),
  20471. onEnd: function onEnd(evt) {
  20472. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  20473. }
  20474. });
  20475. if (!function_obj.is_main) {
  20476. Sortable.create(appender.find(".container_parameters_list")[0], {
  20477. handle: '.ellipsis',
  20478. animation: 100,
  20479. ghostClass: 'ghost',
  20480. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  20481. onEnd: function onEnd(evt) {
  20482. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  20483. }
  20484. });
  20485. }
  20486. return appender;
  20487. }
  20488. function initVisualUI() {
  20489. // MUST USE CONST, LET, OR VAR !!!!!!
  20490. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  20491. // fill mainDiv with functions and globals...
  20492. // renderAlgorithm()...
  20493. (0, _jquery2.default)('.add_function_button').on('click', function () {
  20494. addFunctionHandler();
  20495. });
  20496. (0, _jquery2.default)('.add_global_button').on('click', function () {
  20497. window.insertContext = true;
  20498. GlobalsManagement.addGlobal(program, true);
  20499. });
  20500. (0, _jquery2.default)('.run_button').on('click', function () {
  20501. runCode();
  20502. });
  20503. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  20504. toggleVisualCoding();
  20505. });
  20506. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  20507. toggleTextualCoding();
  20508. });
  20509. (0, _jquery2.default)('.assessment').on('click', function () {
  20510. runCodeAssessment();
  20511. is_iassign = true;
  20512. });
  20513. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  20514. toggleConsole();
  20515. });
  20516. (0, _jquery2.default)('.expand_button').on('click', function () {
  20517. full_screen();
  20518. });
  20519. (0, _jquery2.default)('.main_title h2').prop('title', _localizedStringsService.LocalizedStrings.getUI('text_ivprog_description'));
  20520. }
  20521. var is_iassign = false;
  20522. (0, _jquery2.default)(document).ready(function () {
  20523. var time_show = 750;
  20524. (0, _jquery2.default)('.visual_coding_button').popup({
  20525. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  20526. delay: {
  20527. show: time_show,
  20528. hide: 0
  20529. }
  20530. });
  20531. (0, _jquery2.default)('.textual_coding_button').popup({
  20532. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  20533. delay: {
  20534. show: time_show,
  20535. hide: 0
  20536. }
  20537. });
  20538. (0, _jquery2.default)('.upload_file_button').popup({
  20539. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  20540. delay: {
  20541. show: time_show,
  20542. hide: 0
  20543. }
  20544. });
  20545. (0, _jquery2.default)('.download_file_button').popup({
  20546. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  20547. delay: {
  20548. show: time_show,
  20549. hide: 0
  20550. }
  20551. });
  20552. (0, _jquery2.default)('.undo_button').popup({
  20553. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  20554. delay: {
  20555. show: time_show,
  20556. hide: 0
  20557. }
  20558. });
  20559. (0, _jquery2.default)('.redo_button').popup({
  20560. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  20561. delay: {
  20562. show: time_show,
  20563. hide: 0
  20564. }
  20565. });
  20566. (0, _jquery2.default)('.run_button').popup({
  20567. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  20568. delay: {
  20569. show: time_show,
  20570. hide: 0
  20571. }
  20572. });
  20573. (0, _jquery2.default)('.assessment_button').popup({
  20574. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  20575. delay: {
  20576. show: time_show,
  20577. hide: 0
  20578. }
  20579. });
  20580. (0, _jquery2.default)('.help_button').popup({
  20581. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help") + ' - ' + _localizedStringsService.LocalizedStrings.getUI("text_ivprog_version"),
  20582. delay: {
  20583. show: time_show,
  20584. hide: 0
  20585. }
  20586. });
  20587. (0, _jquery2.default)('.add_global_button').popup({
  20588. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  20589. delay: {
  20590. show: time_show,
  20591. hide: 0
  20592. }
  20593. });
  20594. (0, _jquery2.default)('.div_toggle_console').popup({
  20595. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  20596. delay: {
  20597. show: time_show,
  20598. hide: 0
  20599. }
  20600. });
  20601. Sortable.create(listWithHandle, {
  20602. handle: '.glyphicon-move',
  20603. animation: 100,
  20604. ghostClass: 'ghost',
  20605. group: 'functions_divs_drag',
  20606. onEnd: function onEnd(evt) {
  20607. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  20608. }
  20609. });
  20610. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  20611. Sortable.create(listGlobalsHandle, {
  20612. handle: '.ellipsis',
  20613. animation: 100,
  20614. ghostClass: 'ghost',
  20615. group: 'globals_divs_drag',
  20616. onEnd: function onEnd(evt) {
  20617. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  20618. }
  20619. });
  20620. renderAlgorithm();
  20621. });
  20622. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  20623. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  20624. }
  20625. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  20626. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  20627. }
  20628. function updateSequenceGlobals(oldIndex, newIndex) {
  20629. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  20630. }
  20631. function updateSequenceFunction(oldIndex, newIndex) {
  20632. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  20633. }
  20634. function runCodeAssessment() {
  20635. window.studentGrade = null;
  20636. studentTemp = null;
  20637. var strCode = CodeManagement.generate();
  20638. if (strCode == null) {
  20639. return;
  20640. }
  20641. toggleConsole(true);
  20642. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  20643. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  20644. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  20645. runner.runTest().then(function (grade) {
  20646. if (!is_iassign) {
  20647. parent.getEvaluationCallback(grade);
  20648. } else {
  20649. is_iassign = false;
  20650. }
  20651. }).catch(function (err) {
  20652. return domConsole.err(err.message);
  20653. });
  20654. }
  20655. function runCode() {
  20656. var strCode = CodeManagement.generate();
  20657. if (strCode == null) {
  20658. return;
  20659. }
  20660. toggleConsole(true);
  20661. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  20662. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  20663. try {
  20664. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  20665. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  20666. var data = analyser.analyseTree();
  20667. var proc = new _ivprogProcessor.IVProgProcessor(data);
  20668. proc.registerInput(domConsole);
  20669. proc.registerOutput(domConsole);
  20670. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  20671. proc.interpretAST().then(function (_) {
  20672. domConsole.info("Programa executado com sucesso!");
  20673. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  20674. }).catch(function (err) {
  20675. domConsole.err(err.message);
  20676. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  20677. });
  20678. } catch (error) {
  20679. domConsole.err(error.message);
  20680. console.log(error);
  20681. }
  20682. }
  20683. function toggleConsole(is_running) {
  20684. if (is_running) {
  20685. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  20686. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  20687. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  20688. return;
  20689. }
  20690. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  20691. // esconder
  20692. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  20693. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  20694. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  20695. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  20696. } else {
  20697. // mostrar
  20698. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  20699. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  20700. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  20701. }
  20702. }
  20703. function waitToCloseConsole() {
  20704. domConsole.info("Aperte qualquer tecla para fechar...");
  20705. var p = new Promise(function (resolve, _) {
  20706. domConsole.requestInput(resolve, true);
  20707. });
  20708. p.then(function (_) {
  20709. domConsole.dispose();
  20710. domConsole = null;
  20711. (0, _jquery2.default)("#ivprog-term").hide();
  20712. });
  20713. }
  20714. function toggleTextualCoding() {
  20715. var code = CodeManagement.generate();
  20716. if (code == null) {
  20717. return;
  20718. }
  20719. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  20720. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  20721. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  20722. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  20723. (0, _jquery2.default)('.visual_coding_button').removeClass('active');
  20724. (0, _jquery2.default)('.textual_coding_button').addClass('active');
  20725. (0, _jquery2.default)('.tabs').addClass('loading');
  20726. }
  20727. function toggleVisualCoding() {
  20728. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  20729. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  20730. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  20731. (0, _jquery2.default)('.textual_coding_button').removeClass('active');
  20732. (0, _jquery2.default)('.visual_coding_button').addClass('active');
  20733. (0, _jquery2.default)('.menu .item').tab();
  20734. (0, _jquery2.default)('.tabs').removeClass('loading');
  20735. }
  20736. function removeParameter(function_obj, parameter_obj, parameter_container) {
  20737. var index = function_obj.parameters_list.indexOf(parameter_obj);
  20738. if (index > -1) {
  20739. window.insertContext = true;
  20740. function_obj.parameters_list.splice(index, 1);
  20741. }
  20742. (0, _jquery2.default)(parameter_container).fadeOut();
  20743. }
  20744. function updateParameterType(parameter_obj, new_type) {
  20745. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20746. parameter_obj.type = new_type;
  20747. parameter_obj.dimensions = new_dimensions;
  20748. if (new_dimensions > 0) {
  20749. parameter_obj.rows = new_dimensions;
  20750. parameter_obj.columns = 2;
  20751. }
  20752. }
  20753. function renderParameter(function_obj, parameter_obj, function_container) {
  20754. var ret = "";
  20755. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  20756. ret += '<div class="ui dropdown parameter_type">';
  20757. if (parameter_obj.dimensions > 0) {
  20758. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  20759. if (parameter_obj.dimensions == 1) {
  20760. ret += ' [ ] ';
  20761. } else {
  20762. ret += ' [ ] [ ] ';
  20763. }
  20764. ret += '</div>';
  20765. } else {
  20766. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  20767. }
  20768. ret += '<div class="menu">';
  20769. for (var tm in _types.Types) {
  20770. if (tm == _types.Types.VOID.toUpperCase()) {
  20771. continue;
  20772. }
  20773. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  20774. }
  20775. for (var tm in _types.Types) {
  20776. if (tm == _types.Types.VOID.toUpperCase()) {
  20777. continue;
  20778. }
  20779. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  20780. }
  20781. ret += '</div></div>';
  20782. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  20783. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  20784. ret = (0, _jquery2.default)(ret);
  20785. function_container.find('.container_parameters_list').append(ret);
  20786. ret.find('.remove_parameter').on('click', function (e) {
  20787. removeParameter(function_obj, parameter_obj, ret);
  20788. });
  20789. ret.find('.ui.dropdown.parameter_type').dropdown({
  20790. onChange: function onChange(value, text, $selectedItem) {
  20791. if ($selectedItem.data('dimensions')) {
  20792. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  20793. } else {
  20794. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')]);
  20795. }
  20796. },
  20797. selectOnKeydown: false
  20798. });
  20799. ret.find('.label_enable_name_parameter').on('click', function (e) {
  20800. enableNameParameterUpdate(parameter_obj, ret);
  20801. });
  20802. return ret;
  20803. }
  20804. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  20805. if (isValidIdentifier(new_name)) {
  20806. if (variableNameAlreadyExists(new_name, function_obj)) {
  20807. Utils.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_variable_duplicated'));
  20808. } else {
  20809. parameter_var.name = new_name;
  20810. }
  20811. } else {
  20812. Utils.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  20813. }
  20814. }
  20815. function variableNameAlreadyExists(name_var, function_obj) {
  20816. if (function_obj.parameters_list) {
  20817. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  20818. if (function_obj.parameters_list[i].name == name_var) {
  20819. return true;
  20820. }
  20821. }
  20822. }
  20823. if (function_obj.variables_list) {
  20824. for (var i = 0; i < function_obj.variables_list.length; i++) {
  20825. if (function_obj.variables_list[i].name == name_var) {
  20826. return true;
  20827. }
  20828. }
  20829. }
  20830. return false;
  20831. }
  20832. function updateFunctionName(function_var, new_name, function_obj_dom) {
  20833. if (isValidIdentifier(new_name)) {
  20834. if (functionNameAlreadyExists(new_name)) {
  20835. Utils.renderErrorMessage(function_obj_dom.find('.function_name_div'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name_duplicated'));
  20836. } else {
  20837. function_var.name = new_name;
  20838. }
  20839. } else {
  20840. Utils.renderErrorMessage(function_obj_dom.find('.function_name_div'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  20841. }
  20842. }
  20843. function functionNameAlreadyExists(function_name) {
  20844. for (var i = 0; i < window.program_obj.functions.length; i++) {
  20845. if (window.program_obj.functions[i].name == function_name) {
  20846. return true;
  20847. }
  20848. }
  20849. return false;
  20850. }
  20851. function isValidIdentifier(identifier_str) {
  20852. return (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str)
  20853. );
  20854. }
  20855. var opened_name_parameter = false;
  20856. var opened_input_parameter = null;
  20857. function enableNameParameterUpdate(parameter_obj, parent_node) {
  20858. if (opened_name_parameter) {
  20859. opened_input_parameter.focus();
  20860. return;
  20861. }
  20862. opened_name_parameter = true;
  20863. parent_node = (0, _jquery2.default)(parent_node);
  20864. var input_field;
  20865. parent_node.find('.span_name_parameter').text('');
  20866. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  20867. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  20868. input_field.on('input', function () {
  20869. var inputWidth = input_field.textWidth() + 10;
  20870. opened_input_parameter = input_field;
  20871. input_field.focus();
  20872. var tmpStr = input_field.val();
  20873. input_field.val('');
  20874. input_field.val(tmpStr);
  20875. input_field.css({
  20876. width: inputWidth
  20877. });
  20878. }).trigger('input');
  20879. input_field.focusout(function () {
  20880. /// update array:
  20881. if (input_field.val().trim()) {
  20882. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  20883. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20884. }
  20885. input_field.off();
  20886. input_field.remove();
  20887. /// update elements:
  20888. opened_name_parameter = false;
  20889. opened_input_parameter = false;
  20890. });
  20891. input_field.on('keydown', function (e) {
  20892. var code = e.keyCode || e.which;
  20893. if (code == 13) {
  20894. if (input_field.val().trim()) {
  20895. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  20896. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20897. }
  20898. input_field.off();
  20899. input_field.remove();
  20900. /// update elements:
  20901. opened_name_parameter = false;
  20902. opened_input_parameter = false;
  20903. }
  20904. if (code == 27) {
  20905. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20906. input_field.off();
  20907. input_field.remove();
  20908. /// update elements:
  20909. opened_name_parameter = false;
  20910. opened_input_parameter = false;
  20911. }
  20912. });
  20913. input_field.select();
  20914. }
  20915. var opened_name_function = false;
  20916. var opened_input = null;
  20917. var previousPadding = null;
  20918. function enableNameFunctionUpdate(function_obj, parent_node) {
  20919. if (opened_name_function) {
  20920. opened_input.focus();
  20921. return;
  20922. }
  20923. parent_node = (0, _jquery2.default)(parent_node);
  20924. parent_node.find('.span_name_function').text('');
  20925. var input_field;
  20926. if (!previousPadding) {
  20927. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  20928. }
  20929. parent_node.find('.span_name_function').css('padding-left', '0');
  20930. parent_node.find('.span_name_function').css('padding-right', '0');
  20931. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  20932. input_field.insertBefore(parent_node.find('.span_name_function'));
  20933. input_field.on('input', function () {
  20934. var inputWidth = input_field.textWidth() + 10;
  20935. opened_input = input_field;
  20936. input_field.focus();
  20937. var tmpStr = input_field.val();
  20938. input_field.val('');
  20939. input_field.val(tmpStr);
  20940. input_field.css({
  20941. width: inputWidth
  20942. });
  20943. }).trigger('input');
  20944. input_field.focusout(function () {
  20945. /// update array:
  20946. if (input_field.val().trim()) {
  20947. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  20948. }
  20949. input_field.off();
  20950. input_field.remove();
  20951. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20952. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20953. parent_node.find('.span_name_function').text(function_obj.name);
  20954. /// update elements:
  20955. opened_name_function = false;
  20956. opened_input = false;
  20957. });
  20958. input_field.on('keydown', function (e) {
  20959. var code = e.keyCode || e.which;
  20960. if (code == 13) {
  20961. if (input_field.val().trim()) {
  20962. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  20963. }
  20964. input_field.off();
  20965. input_field.remove();
  20966. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20967. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20968. parent_node.find('.span_name_function').text(function_obj.name);
  20969. /// update elements:
  20970. opened_name_function = false;
  20971. opened_input = false;
  20972. }
  20973. if (code == 27) {
  20974. input_field.off();
  20975. input_field.remove();
  20976. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20977. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20978. parent_node.find('.span_name_function').text(function_obj.name);
  20979. /// update elements:
  20980. opened_name_function = false;
  20981. opened_input = false;
  20982. }
  20983. });
  20984. input_field.select();
  20985. }
  20986. /****************************************************
  20987. //DOUGLAS
  20988. *******************************************************/
  20989. function generateMenuButton(function_obj) {
  20990. if (function_obj.identifier) {
  20991. var identifier = _localizedStringsService.LocalizedStrings.getUI(function_obj.identifier);
  20992. var menu_button = '<button class="fluid ui container segment labeled icon button list-group-item menu-item" draggable="true" data-function="' + identifier + '"><i class="code icon"></i> <span class="function_name">' + identifier + '</span> (<span class="function_params"></span>) : <span class="function_return_type">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</span></button>';
  20993. } else {
  20994. var menu_button = '<button class="fluid ui container segment labeled icon button list-group-item menu-item" draggable="true" data-function="' + function_obj.name + '"><i class="code icon"></i> <span class="function_name">' + function_obj.name + '</span> (<span class="function_params"></span>) : <span class="function_return_type">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</span></button>';
  20995. }
  20996. var params = "";
  20997. menu_button = (0, _jquery2.default)(menu_button);
  20998. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  20999. if (j > 0) params += ',';
  21000. if (!function_obj.identifier) {
  21001. params += _localizedStringsService.LocalizedStrings.getUI(function_obj.parameters_list[j].type);
  21002. } else {
  21003. params += function_obj.parameters_list[j].type;
  21004. }
  21005. }
  21006. menu_button.data('fun', function_obj).on('dragstart', function (e) {
  21007. program_obj.dataTransfer = { type: "function", content: function_obj };
  21008. //e.originalEvent.dataTransfer.setData("text", JSON.stringify({type:"function",content:function_obj}));
  21009. //evt.originalEvent.dataTransfer.setData("text",$(this).data('command'));
  21010. }).find('.function_params').text(params).find('.function_return_type').text(function_obj.type);
  21011. menu_button.on('click', function (evt) {
  21012. (0, _jquery2.default)(this).trigger('dragstart');
  21013. if (window.ghostNode) {
  21014. (0, _jquery2.default)(window.ghostNode).remove();
  21015. (0, _jquery2.default)(document).off('mousemove');
  21016. }
  21017. window.ghostNode = (0, _jquery2.default)(this).clone();
  21018. ghostNode.outerWidth((0, _jquery2.default)(this).outerWidth());
  21019. ghostNode.draggable().appendTo('body');
  21020. ghostNode.css('position', 'absolute');
  21021. ghostNode.css('left', evt.pageX);
  21022. ghostNode.css('top', evt.pageY);
  21023. evt.type = 'drag';
  21024. evt.target = ghostNode[0];
  21025. ghostNode.trigger(evt);
  21026. (0, _jquery2.default)(document).on('mousemove', function (evt) {
  21027. ghostNode.css('left', evt.pageX);
  21028. ghostNode.css('top', evt.pageY);
  21029. });
  21030. (0, _jquery2.default)(document).on('mousedown', function (evt) {
  21031. console.log("length ===");
  21032. console.log((0, _jquery2.default)(evt.target).closest(".commands_list_div"));
  21033. if ((0, _jquery2.default)(evt.target).closest(".commands_list_div").length <= 0) {
  21034. if (window.ghostNode) {
  21035. console.log("drop click");
  21036. (0, _jquery2.default)('.div-over').removeClass('div-over');
  21037. (0, _jquery2.default)(window.ghostNode).remove();
  21038. delete window.ghostNode;
  21039. (0, _jquery2.default)(document).off('mousemove').off('mousedown').off('keyup');
  21040. }
  21041. }
  21042. });
  21043. (0, _jquery2.default)(document).keyup(function (e) {
  21044. console.log("KeyUp");
  21045. if (e.key === "Escape") {
  21046. console.log("escape");
  21047. (0, _jquery2.default)('.div-over').removeClass('div-over');
  21048. (0, _jquery2.default)(window.ghostNode).remove();
  21049. delete window.ghostNode;
  21050. (0, _jquery2.default)(document).off('mousemove').off('mousedown').off('keyup');
  21051. }
  21052. });
  21053. });
  21054. return menu_button;
  21055. }
  21056. removeFunction = function removeFunction(function_obj) {
  21057. var index = program.functions.indexOf(function_obj);
  21058. if (index > -1) {
  21059. program.functions.splice(index, 1);
  21060. }
  21061. (0, _jquery2.default)('.functions_labels > [data-function=' + function_obj.name + ']').remove();
  21062. };
  21063. // renderFunction = function (function_obj) {
  21064. // var appender = '<div class="ui secondary segment function_div list-group-item">';
  21065. // if (function_obj.function_comment) {
  21066. // //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  21067. // }
  21068. // appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  21069. // 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>')
  21070. // + '<button class="ui icon button tiny minimize_function_button"><i class="icon window minimize"></i></button>';
  21071. // appender += '<div class="ui small icon buttons add_var_top_button"><div class="ui icon button add_var_button_function"><i class="icon superscript"></i></div>';
  21072. // appender += '<div class="ui icon button dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  21073. // appender += '<a class="item" data-command="' + Models.COMMAND_TYPES.reader + '"><i class="download icon"></i> ' + LocalizedStrings.getUI('text_read_var') + '</a>'
  21074. // + '<a class="item" data-command="' + Models.COMMAND_TYPES.writer + '"><i class="upload icon"></i> ' + LocalizedStrings.getUI('text_write_var') + '</a>'
  21075. // + '<a class="item" data-command="' + Models.COMMAND_TYPES.comment + '"><i class="quote left icon"></i> ' + LocalizedStrings.getUI('text_comment') + '</a>'
  21076. // + '<a class="item" data-command="' + Models.COMMAND_TYPES.attribution + '"><i class="arrow left icon"></i> ' + LocalizedStrings.getUI('text_attribution') + '</a>'
  21077. // + '<a class="item" data-command="' + Models.COMMAND_TYPES.functioncall + '"><i class="hand point right icon"></i> ' + LocalizedStrings.getUI('text_functioncall') + '</a>'
  21078. // + '<a class="item" data-command="' + Models.COMMAND_TYPES.iftrue + '" ><i class="random icon"></i> ' + LocalizedStrings.getUI('text_iftrue') + '</a>'
  21079. // + '<a class="item" data-command="' + Models.COMMAND_TYPES.repeatNtimes + '"><i class="sync icon"></i> ' + LocalizedStrings.getUI('text_repeatNtimes') + '</a>'
  21080. // + '<a class="item" data-command="' + Models.COMMAND_TYPES.whiletrue + '"><i class="sync icon"></i> ' + LocalizedStrings.getUI('text_whiletrue') + '</a>'
  21081. // + '<a class="item" data-command="' + Models.COMMAND_TYPES.dowhiletrue + '"><i class="sync icon"></i> ' + LocalizedStrings.getUI('text_dowhiletrue') + '</a>'
  21082. // + '<a class="item" data-command="' + Models.COMMAND_TYPES.switch + '"><i class="list icon"></i> ' + LocalizedStrings.getUI('text_switch') + '</a>'
  21083. // + '<a class="item" data-command="' + Models.COMMAND_TYPES.return + '"><i class="reply icon"></i> ' + LocalizedStrings.getUI('text_btn_return') + '</a>'
  21084. // + '</div></div></div>';
  21085. // appender += '<div class="function_signature_div">' + LocalizedStrings.getUI("function") + ' ';
  21086. // if (function_obj.is_main) {
  21087. // appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + LocalizedStrings.getUI('void') + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="span_name_function" >' + function_obj.name + '</span> </div> '
  21088. // + '( <div class="ui large labels parameters_list">';
  21089. // } else {
  21090. // appender += '<div class="ui function_return"></div>';
  21091. // appender += '<div class="function_name_div function_name_div_updated"><span class="span_name_function name_function_updated">' + function_obj.name + '</span> </div> '
  21092. // + ' <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">';
  21093. // $('.functions_labels').append(generateMenuButton(function_obj));
  21094. // console.log("aqui");
  21095. // //var menu_button = $('.functions_labels > [data-function=' + function_obj.name + ']');
  21096. // //var params = "";
  21097. // //menu_button
  21098. // }
  21099. // appender += '</div> ) </div>'
  21100. // + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ')
  21101. // + '<div class="ui top attached segment variables_list_div">'
  21102. // /*+ renderVariables(function_obj, sequence)*/
  21103. // + '</div>'
  21104. // + '<div class="ui bottom attached segment commands_list_div" id="function_drag_cmd_">';
  21105. // appender += '</div>';
  21106. // appender += '<div class="function_close_div"></div>'
  21107. // + '</div>'
  21108. // + '</div>';
  21109. // appender = $(appender);
  21110. // $('.all_functions').append(appender);
  21111. // appender.data('fun', function_obj);
  21112. // appender.find('.commands_list_div')
  21113. // .data('fun', function_obj)
  21114. // .attr('droppable', true)
  21115. // .on('dragenter', function (e) {
  21116. // e.preventDefault();
  21117. // console.log('dragenter');
  21118. // console.log(e.target)
  21119. // $(e.target).addClass('div-over')
  21120. // //e.stopPropagation();
  21121. // }).on('dragover', function (e) {
  21122. // e.preventDefault();
  21123. // })
  21124. // .on('dragleave', function (e) {
  21125. // e.preventDefault();
  21126. // //e.stopPropagation();
  21127. // console.log("dragleave")
  21128. // $(e.target).removeClass('div-over')
  21129. // console.log(e.target)
  21130. // })
  21131. // .on('drop', function (e, bundle) {
  21132. // e.preventDefault();
  21133. // if (bundle) {
  21134. // e.clientX = bundle.clientX;
  21135. // e.clientY = bundle.clientY;
  21136. // }
  21137. // //console.log('ondrop ' + e.originalEvent.dataTransfer.getData("text"));
  21138. // console.log(e)
  21139. // $(e.target).removeClass('div-over')
  21140. // //var data = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
  21141. // var data = program_obj.dataTransfer;
  21142. // if (data.type == 'command')
  21143. // CommandsManagement.prepareManageCommand(function_obj, $(e.target).closest('.function_div'), e, data.content);
  21144. // else if (data.type == 'var')
  21145. // CommandsManagement.prepareManageCommand(function_obj, $(e.target).closest('.function_div'), e, "attribution", data.content);
  21146. // else {
  21147. // if (!data.content.parameters_list)
  21148. // data.content.parameters_list = [];
  21149. // CommandsManagement.prepareManageCommand(function_obj, $(e.target).closest('.function_div'), e, "functioncall", data.content);
  21150. // }
  21151. // //program_obj.dataTransfer;
  21152. // }).on('click', function (e) {
  21153. // if (window.ghostNode) {
  21154. // console.log("drop click");
  21155. // $(document).off('mousemove').off('mousedown').off('keyup');
  21156. // $(window.ghostNode).remove();
  21157. // delete window.ghostNode;
  21158. // $(this).trigger('drop', [e]);
  21159. // $('.div-over').removeClass('div-over');
  21160. // }
  21161. // })
  21162. // .on('mouseover', function (evt) {
  21163. // if (window.ghostNode) {
  21164. // evt.type = 'dragenter';
  21165. // //$(this).trigger('dragenter');
  21166. // console.log('mouseover');
  21167. // $(this).trigger(evt);
  21168. // }
  21169. // })
  21170. // .on('mouseout', function (evt) {
  21171. // //$(this).trigger('dragleave');
  21172. // if (window.ghostNode) {
  21173. // evt.type = 'dragleave';
  21174. // console.log('mouseout');
  21175. // $(this).trigger(evt);
  21176. // }
  21177. // });
  21178. // renderFunctionReturn(function_obj, appender);
  21179. // addHandlers(function_obj, appender);
  21180. // // Rendering parameters:
  21181. // for (var j = 0; j < function_obj.parameters_list.length; j++) {
  21182. // renderParameter(function_obj, function_obj.parameters_list[j], appender);
  21183. // }
  21184. // // Rendering variables:
  21185. // for (var j = 0; j < function_obj.variables_list.length; j++) {
  21186. // VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  21187. // }
  21188. // // Rendering commands:
  21189. // for (var j = 0; j < function_obj.commands.length; j++) {
  21190. // CommandsManagement.renderCommand(function_obj.commands[j], $(appender.find('.commands_list_div')[0]), 3, function_obj);
  21191. // }
  21192. // console.log('kk')
  21193. // console.log($($('.function_div')[0]).data('fun'))
  21194. // console.log(appender.data('fun'))
  21195. // }
  21196. exports.initVisualUI = initVisualUI = function initVisualUI() {
  21197. // MUST USE CONST, LET, OR VAR !!!!!!
  21198. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  21199. // fill mainDiv with functions and globals...
  21200. // renderAlgorithm()...
  21201. (0, _jquery2.default)('.add_function_button').on('click', function () {
  21202. addFunctionHandler();
  21203. });
  21204. (0, _jquery2.default)('.add_global_button').on('click', function () {
  21205. GlobalsManagement.addGlobal(program);
  21206. });
  21207. (0, _jquery2.default)('.run_button').on('click', function () {
  21208. runCode();
  21209. });
  21210. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  21211. toggleVisualCoding();
  21212. });
  21213. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  21214. toggleTextualCoding();
  21215. });
  21216. (0, _jquery2.default)('.assessment').on('click', function () {
  21217. runCodeAssessment();
  21218. is_iassign = true;
  21219. });
  21220. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  21221. toggleConsole();
  21222. });
  21223. var commands = [{ type: Models.COMMAND_TYPES.reader, icon: "download", text: _localizedStringsService.LocalizedStrings.getUI('text_read_var'), alt: "Solicita a introdução de um valor pelo teclado e grava em uma variável." }, { type: Models.COMMAND_TYPES.writer, icon: "upload", text: _localizedStringsService.LocalizedStrings.getUI('text_write_var'), alt: "Imprime o conteúdo de uma variável, valor ou função. Pode somar várias variáveis ou concatenar sequências de texto." }, { type: Models.COMMAND_TYPES.comment, icon: "quote left", text: _localizedStringsService.LocalizedStrings.getUI('text_comment'), alt: "Permite a inserção de comentários do autor. Serão desconsiderados na execução." }, { type: Models.COMMAND_TYPES.attribution, icon: "arrow left", text: _localizedStringsService.LocalizedStrings.getUI('text_attribution'), alt: "Resolve uma expressão e armazena em uma variável." }, { type: Models.COMMAND_TYPES.iftrue, icon: "random", text: _localizedStringsService.LocalizedStrings.getUI('text_iftrue'), alt: "Avalia uma condição como verdadeira ou falsa, escolhendo entre dois fluxos dependendo do valor." }, { type: Models.COMMAND_TYPES.repeatNtimes, icon: "sync", text: _localizedStringsService.LocalizedStrings.getUI('text_repeatNtimes'), alt: "Repete um bloco de código N vezes." }, { type: Models.COMMAND_TYPES.whiletrue, icon: "sync", text: _localizedStringsService.LocalizedStrings.getUI('text_whiletrue'), alt: "Enquanto a condição for verdadeira, repete um bloco de código, avaliando a condição antes de cada execução." }, { type: Models.COMMAND_TYPES.dowhiletrue, icon: "sync", text: _localizedStringsService.LocalizedStrings.getUI('text_dowhiletrue'), alt: "Enquanto a condição for verdadeira, repete um bloco de código, avaliando a condição depois de cada execução." }, { type: Models.COMMAND_TYPES.switch, icon: "list", text: _localizedStringsService.LocalizedStrings.getUI('text_switch'), alt: "Avalia o valor de uma expressão e escolhe um bloco de código para executar dependendo do valor." }, { type: Models.COMMAND_TYPES.return, icon: "reply", text: _localizedStringsService.LocalizedStrings.getUI('text_btn_return'), alt: "Retorna o valor ao término de uma função." }];
  21224. for (var i = commands.length - 1; i >= 0; i--) {
  21225. var command = '<button class="fluid ui container segment labeled icon button list-group-item menu-item" title="' + commands[i].alt + '" draggable="true" data-command="' + commands[i].type + '"><i class="' + commands[i].icon + ' icon"></i> ' + commands[i].text + '</button>';
  21226. command = (0, _jquery2.default)(command);
  21227. command.on('dragstart', function (evt) {
  21228. //evt.originalEvent.dataTransfer.setData("text",$(this).data('command'));
  21229. //evt.originalEvent.dataTransfer.setData("text",JSON.stringify({type:"command",content:$(this).data('command')}));
  21230. program_obj.dataTransfer = { type: "command", content: (0, _jquery2.default)(this).data('command') };
  21231. console.log('dragstart');
  21232. console.log(evt);
  21233. });
  21234. command.on('click', function (evt) {
  21235. (0, _jquery2.default)(this).trigger('dragstart');
  21236. if (window.ghostNode) {
  21237. (0, _jquery2.default)(window.ghostNode).remove();
  21238. (0, _jquery2.default)(document).off('mousemove');
  21239. }
  21240. window.ghostNode = (0, _jquery2.default)(this).clone();
  21241. ghostNode.outerWidth((0, _jquery2.default)(this).outerWidth());
  21242. ghostNode.draggable().appendTo('body');
  21243. ghostNode.css('position', 'absolute');
  21244. ghostNode.css('left', evt.pageX);
  21245. ghostNode.css('top', evt.pageY);
  21246. evt.type = 'drag';
  21247. evt.target = ghostNode[0];
  21248. ghostNode.trigger(evt);
  21249. (0, _jquery2.default)(document).on('mousemove', function (evt) {
  21250. ghostNode.css('left', evt.pageX);
  21251. ghostNode.css('top', evt.pageY);
  21252. });
  21253. (0, _jquery2.default)(document).on('mousedown', function (evt) {
  21254. console.log("length ===");
  21255. console.log((0, _jquery2.default)(evt.target).closest(".commands_list_div"));
  21256. if ((0, _jquery2.default)(evt.target).closest(".commands_list_div").length <= 0) {
  21257. if (window.ghostNode) {
  21258. console.log("drop click");
  21259. (0, _jquery2.default)('.div-over').removeClass('div-over');
  21260. (0, _jquery2.default)(window.ghostNode).remove();
  21261. delete window.ghostNode;
  21262. (0, _jquery2.default)(document).off('mousemove').off('mousedown').off('keyup');
  21263. }
  21264. }
  21265. });
  21266. (0, _jquery2.default)(document).keyup(function (e) {
  21267. console.log("KeyUp");
  21268. if (e.key === "Escape") {
  21269. console.log("escape");
  21270. (0, _jquery2.default)('.div-over').removeClass('div-over');
  21271. (0, _jquery2.default)(window.ghostNode).remove();
  21272. delete window.ghostNode;
  21273. (0, _jquery2.default)(document).off('mousemove').off('mousedown').off('keyup');
  21274. }
  21275. });
  21276. });
  21277. (0, _jquery2.default)('.list-commands').prepend(command);
  21278. }
  21279. /*
  21280. $(document).on('mousemove',function(evt) {
  21281. if (typeof ghostNode !== 'undefined') {
  21282. ghostNode.css('left', evt.pageX - 15);
  21283. ghostNode.css('top', evt.pageY - 15);
  21284. }
  21285. });*/
  21286. var library_labels = (0, _jquery2.default)('.library_labels');
  21287. for (var i = 0; i < system_functions.length; i++) {
  21288. var system_button = generateMenuButton(system_functions[i]);
  21289. var category = system_functions[i].category;
  21290. var cat_accord = null;
  21291. if (library_labels.find('.' + category).length == 0) {
  21292. cat_accord = '<div class="ui styled accordion ' + category + '"> \
  21293. <div class="title"> \
  21294. <i class="dropdown icon"></i> \
  21295. ' + _localizedStringsService.LocalizedStrings.getUI(category) + ' \
  21296. </div> \
  21297. <div class="content"><div>';
  21298. library_labels.append(cat_accord);
  21299. }
  21300. cat_accord = (0, _jquery2.default)(library_labels.find('.' + category)[0]);
  21301. cat_accord.find('.content').append(system_button);
  21302. }
  21303. (0, _jquery2.default)('.accordion').accordion();
  21304. };
  21305. /*
  21306. renderParameter = function(function_obj, parameter_obj, function_container) {
  21307. var ret = "";
  21308. ret += '<div class="ui label function_name_parameter"><span class="span_name_parameter label_enable_name_parameter">'+parameter_obj.name+'</span> <i class="icon small pencil alternate enable_edit_name_parameter label_enable_name_parameter"></i>';
  21309. ret += '<div class="ui dropdown parameter_type">';
  21310. if (parameter_obj.dimensions > 0) {
  21311. ret += '<div class="text">'+ LocalizedStrings.getUI('vector')+':'+LocalizedStrings.getUI(parameter_obj.type);
  21312. ret += '</div>';
  21313. } else {
  21314. ret += '<div class="text">'+LocalizedStrings.getUI(parameter_obj.type)+'</div>';
  21315. }
  21316. ret += '<i class="dropdown icon"></i>'
  21317. + '<div class="menu">';
  21318. for (var tm in Types) {
  21319. if (tm == Types.VOID.toUpperCase()) {
  21320. continue;
  21321. }
  21322. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="'+tm+'" >'+LocalizedStrings.getUI(tm.toLowerCase())+'</div>';
  21323. }
  21324. for (var tm in Types) {
  21325. if (tm == Types.VOID.toUpperCase()) {
  21326. continue;
  21327. }
  21328. ret += '<div class="item">'
  21329. + '<i class="dropdown icon"></i>'
  21330. + LocalizedStrings.getUI('vector')+':'+LocalizedStrings.getUI(tm.toLowerCase())
  21331. + '<div class="menu">'
  21332. + '<div class="item" data-text="'+ LocalizedStrings.getUI('vector')+':'+LocalizedStrings.getUI(tm.toLowerCase())+' [ ] " data-type="'+tm+'" data-dimensions="1">[ ]</div>'
  21333. + '<div class="item" data-text="'+ LocalizedStrings.getUI('vector')+':'+LocalizedStrings.getUI(tm.toLowerCase())+' [ ] [ ] " data-type="'+tm+'" data-dimensions="2">[ ] [ ] </div>'
  21334. + '</div>'
  21335. + '</div>';
  21336. }
  21337. ret += '</div></div>';
  21338. ret += ' <i class="red icon times remove_parameter"></i></div>';
  21339. ret = $(ret);
  21340. function_container.find('.container_parameters_list').append(ret);
  21341. ret.find('.remove_parameter').on('click', function(e){
  21342. removeParameter(function_obj, parameter_obj, ret);
  21343. });
  21344. ret.find('.ui.dropdown.parameter_type').dropdown({
  21345. onChange: function(value, text, $selectedItem) {
  21346. if ($($selectedItem).data('dimensions')) {
  21347. updateParameterType(parameter_obj, Types[$($selectedItem).data('type')], $($selectedItem).data('dimensions'));
  21348. } else {
  21349. updateParameterType(parameter_obj, Types[$($selectedItem).data('type')]);
  21350. }
  21351. }
  21352. });
  21353. ret.find('.label_enable_name_parameter').on('click', function(e){
  21354. enableNameParameterUpdate(parameter_obj, ret);
  21355. });
  21356. }
  21357. enableNameFunctionUpdate = function(function_obj, parent_node) {
  21358. if (opened_name_function) {
  21359. $(opened_input).focus();
  21360. return;
  21361. }
  21362. $(parent_node).find('.span_name_function').text('');
  21363. $( "<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='"+function_obj.name+"' />" ).insertBefore($(parent_node).find('.span_name_function'));
  21364. $('.width-dynamic').on('input', function() {
  21365. var inputWidth = $(this).textWidth()+10;
  21366. opened_input = this;
  21367. $(this).focus();
  21368. var tmpStr = $(this).val();
  21369. $(this).val('');
  21370. $(this).val(tmpStr);
  21371. $(this).css({
  21372. width: inputWidth
  21373. })
  21374. }).trigger('input');
  21375. $('.width-dynamic').focusout(function() {
  21376. /// update array:
  21377. if ($(this).val().trim()) {
  21378. function_obj.name = $(this).val().trim();
  21379. }
  21380. $(this).remove();
  21381. $(parent_node).find('.span_name_function').text(function_obj.name);
  21382. /// update elements:
  21383. opened_name_function = false;
  21384. opened_input = false;
  21385. });
  21386. $('.width-dynamic').on('keydown', function(e) {
  21387. var code = e.keyCode || e.which;
  21388. if(code == 13) {
  21389. $('.functions_labels > [data-function=' + function_obj.name + ']')
  21390. .attr('data-function', $(this).val().trim())
  21391. .html('<i class="list icon"></i> ' + $(this).val().trim());
  21392. if ($(this).val().trim()) {
  21393. function_obj.name = $(this).val().trim();
  21394. }
  21395. $(this).remove();
  21396. $(parent_node).find('.span_name_function').text(function_obj.name);
  21397. /// update elements:
  21398. opened_name_function = false;
  21399. opened_input = false;
  21400. }
  21401. if(code == 27) {
  21402. $(this).remove();
  21403. $(parent_node).find('.span_name_function').text(function_obj.name);
  21404. /// update elements:
  21405. opened_name_function = false;
  21406. opened_input = false;
  21407. }
  21408. });
  21409. }
  21410. addParameter = function (function_obj, function_container) {
  21411. if (function_obj.parameters_list == null) {
  21412. function_obj.parameters_list = [];
  21413. }
  21414. var new_parameter = new Models.Variable(Types.INTEGER, LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  21415. new_parameter.function_obj = function_obj;
  21416. function_obj.parameters_list.push(new_parameter);
  21417. counter_new_parameters ++;
  21418. renderParameter(function_obj, new_parameter, function_container);
  21419. //updateMenuButton(function_obj);
  21420. }
  21421. removeParameter = function (function_obj, parameter_obj, parameter_container) {
  21422. var index = function_obj.parameters_list.indexOf(parameter_obj);
  21423. if (index > -1) {
  21424. function_obj.parameters_list.splice(index, 1);
  21425. }
  21426. $(parameter_container).remove();
  21427. }*/
  21428. /*
  21429. updateReturnType = function (function_obj, new_type, new_dimensions = 0) {
  21430. function_obj.return_type = new_type;
  21431. function_obj.return_dimensions = new_dimensions;
  21432. var menu_button = $('.functions_labels > [data-function=' + function_obj.name + ']');
  21433. menu_button.find('.function_return_type').text(LocalizedStrings.getUI(new_type));
  21434. }*/
  21435. /*
  21436. updateParameterType = function (parameter_obj, new_type, new_dimensions = 0) {
  21437. parameter_obj.type = new_type;
  21438. parameter_obj.dimensions = new_dimensions;
  21439. if (new_dimensions > 0) {
  21440. parameter_obj.rows = new_dimensions;
  21441. parameter_obj.columns = 2;
  21442. }
  21443. //updateMenuButton(parameter_obj.function_obj);
  21444. }*/
  21445. /***/ }),
  21446. /***/ "./js/visualUI/globals.js":
  21447. /*!********************************!*\
  21448. !*** ./js/visualUI/globals.js ***!
  21449. \********************************/
  21450. /*! no static exports found */
  21451. /***/ (function(module, exports, __webpack_require__) {
  21452. "use strict";
  21453. Object.defineProperty(exports, "__esModule", {
  21454. value: true
  21455. });
  21456. exports.addGlobal = addGlobal;
  21457. exports.renderGlobal = renderGlobal;
  21458. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21459. var _jquery2 = _interopRequireDefault(_jquery);
  21460. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  21461. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21462. var Models = _interopRequireWildcard(_ivprog_elements);
  21463. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21464. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  21465. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  21466. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21467. window.jQuery = _jquery2.default;
  21468. var counter_new_globals = 0;
  21469. function addGlobal(program) {
  21470. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  21471. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  21472. counter_new_globals++;
  21473. program.addGlobal(new_global);
  21474. var newe = renderGlobal(new_global);
  21475. if (is_from_click) {
  21476. newe.css('display', 'none');
  21477. newe.fadeIn();
  21478. }
  21479. }
  21480. function toggleConstant(global_var) {
  21481. global_var.is_constant = !global_var.is_constant;
  21482. }
  21483. function updateName(global_var, new_name) {
  21484. global_var.name = new_name;
  21485. }
  21486. function updateType(global_var, new_type) {
  21487. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  21488. global_var.type = new_type;
  21489. global_var.dimensions = new_dimensions;
  21490. if (new_dimensions > 0) {
  21491. global_var.rows = new_dimensions;
  21492. global_var.columns = 2;
  21493. }
  21494. updateInitialValues(global_var);
  21495. }
  21496. function removeGlobal(global_var, global_container) {
  21497. var index = window.program_obj.globals.indexOf(global_var);
  21498. if (index > -1) {
  21499. window.insertContext = true;
  21500. window.program_obj.globals.splice(index, 1);
  21501. }
  21502. global_container.children().off();
  21503. global_container.off();
  21504. global_container.fadeOut();
  21505. }
  21506. function updateInitialValues(global_var) {
  21507. if (global_var.type == _types.Types.INTEGER) {
  21508. if (global_var.dimensions == 0) {
  21509. global_var.value = 1;
  21510. }
  21511. if (global_var.dimensions == 1) {
  21512. global_var.value = [1, 1];
  21513. }
  21514. if (global_var.dimensions == 2) {
  21515. global_var.value = [[1, 1], [1, 1]];
  21516. }
  21517. }
  21518. if (global_var.type == _types.Types.REAL) {
  21519. if (global_var.dimensions == 0) {
  21520. global_var.value = 1.0;
  21521. }
  21522. if (global_var.dimensions == 1) {
  21523. global_var.value = [1.0, 1.0];
  21524. }
  21525. if (global_var.dimensions == 2) {
  21526. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  21527. }
  21528. }
  21529. if (global_var.type == _types.Types.TEXT) {
  21530. if (global_var.dimensions == 0) {
  21531. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  21532. }
  21533. if (global_var.dimensions == 1) {
  21534. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  21535. }
  21536. if (global_var.dimensions == 2) {
  21537. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  21538. }
  21539. }
  21540. if (global_var.type == _types.Types.BOOLEAN) {
  21541. if (global_var.dimensions == 0) {
  21542. global_var.value = true;
  21543. }
  21544. if (global_var.dimensions == 1) {
  21545. global_var.value = [true, true];
  21546. }
  21547. if (global_var.dimensions == 2) {
  21548. global_var.value = [[true, true], [true, true]];
  21549. }
  21550. }
  21551. }
  21552. function alternateBooleanGlobalValue(global_var, value_container) {
  21553. global_var.value = !global_var.value;
  21554. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  21555. }
  21556. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  21557. global_var.value[index] = !global_var.value[index];
  21558. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  21559. }
  21560. function removeGlobalColumnVector(global_var) {
  21561. if (global_var.columns == 0) {
  21562. return;
  21563. }
  21564. global_var.columns--;
  21565. global_var.value.splice(global_var.value.length - 1, 1);
  21566. }
  21567. function addGlobalColumnVector(global_var) {
  21568. global_var.columns++;
  21569. if (global_var.type == _types.Types.INTEGER) {
  21570. global_var.value.push(1);
  21571. }
  21572. if (global_var.type == _types.Types.REAL) {
  21573. global_var.value.push(1.0);
  21574. }
  21575. if (global_var.type == _types.Types.TEXT) {
  21576. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21577. }
  21578. if (global_var.type == _types.Types.BOOLEAN) {
  21579. global_var.value.push(true);
  21580. }
  21581. }
  21582. function removeColumnGlobalMatrix(global_var) {
  21583. if (global_var.columns == 0) {
  21584. return;
  21585. }
  21586. global_var.columns--;
  21587. for (var i = 0; i < global_var.rows; i++) {
  21588. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  21589. }
  21590. }
  21591. function addColumnGlobalMatrix(global_var) {
  21592. global_var.columns++;
  21593. if (global_var.type == _types.Types.INTEGER) {
  21594. for (var i = 0; i < global_var.rows; i++) {
  21595. global_var.value[i].push(1);
  21596. }
  21597. }
  21598. if (global_var.type == _types.Types.REAL) {
  21599. for (var i = 0; i < global_var.rows; i++) {
  21600. global_var.value[i].push(1.0);
  21601. }
  21602. }
  21603. if (global_var.type == _types.Types.TEXT) {
  21604. for (var i = 0; i < global_var.rows; i++) {
  21605. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21606. }
  21607. }
  21608. if (global_var.type == _types.Types.BOOLEAN) {
  21609. for (var i = 0; i < global_var.rows; i++) {
  21610. global_var.value[i].push(true);
  21611. }
  21612. }
  21613. }
  21614. function removeLineGlobalMatrix(global_var) {
  21615. if (global_var.rows == 0) {
  21616. return;
  21617. }
  21618. global_var.rows--;
  21619. global_var.value.splice(global_var.value.length - 1, 1);
  21620. }
  21621. function addLineGlobalMatrix(global_var) {
  21622. global_var.rows++;
  21623. if (global_var.type == _types.Types.INTEGER) {
  21624. var n_l = [];
  21625. for (var i = 0; i < global_var.columns; i++) {
  21626. n_l.push(1);
  21627. }
  21628. global_var.value.push(n_l);
  21629. }
  21630. if (global_var.type == _types.Types.REAL) {
  21631. var n_l = [];
  21632. for (i = 0; i < global_var.columns; i++) {
  21633. n_l.push(1.0);
  21634. }
  21635. global_var.value.push(n_l);
  21636. }
  21637. if (global_var.type == _types.Types.TEXT) {
  21638. var n_l = [];
  21639. for (i = 0; i < global_var.columns; i++) {
  21640. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21641. }
  21642. global_var.value.push(n_l);
  21643. }
  21644. if (global_var.type == _types.Types.BOOLEAN) {
  21645. var n_l = [];
  21646. for (i = 0; i < global_var.columns; i++) {
  21647. n_l.push(true);
  21648. }
  21649. global_var.value.push(n_l);
  21650. }
  21651. }
  21652. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  21653. global_var.value[row][index] = !global_var.value[row][index];
  21654. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  21655. }
  21656. function renderValues(global_var, global_container) {
  21657. var ret = "";
  21658. var j = 0;
  21659. if (global_var.dimensions == 0) {
  21660. if (global_var.type == _types.Types.REAL) {
  21661. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  21662. } else {
  21663. if (global_var.type == _types.Types.BOOLEAN) {
  21664. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  21665. } else {
  21666. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  21667. }
  21668. }
  21669. } else {
  21670. ret += '<table class="tabela_var">';
  21671. if (global_var.dimensions == 1) {
  21672. ret += '<tr>';
  21673. if (global_var.type == _types.Types.REAL) {
  21674. for (var k = 0; k < global_var.columns; k++) {
  21675. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  21676. }
  21677. } else {
  21678. for (var k = 0; k < global_var.columns; k++) {
  21679. if (global_var.type == _types.Types.BOOLEAN) {
  21680. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  21681. } else {
  21682. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  21683. }
  21684. }
  21685. }
  21686. ret += '</tr>';
  21687. ret += '</table>';
  21688. 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>';
  21689. }
  21690. if (global_var.dimensions == 2) {
  21691. if (global_var.type == _types.Types.REAL) {
  21692. for (var l = 0; l < global_var.rows; l++) {
  21693. ret += '<tr>';
  21694. for (var k = 0; k < global_var.columns; k++) {
  21695. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  21696. }
  21697. ret += '</tr>';
  21698. }
  21699. } else {
  21700. for (var l = 0; l < global_var.rows; l++) {
  21701. ret += '<tr>';
  21702. for (var k = 0; k < global_var.columns; k++) {
  21703. if (global_var.type == _types.Types.BOOLEAN) {
  21704. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[l][k]) + '</span></td>';
  21705. } else {
  21706. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  21707. }
  21708. }
  21709. ret += '</tr>';
  21710. }
  21711. }
  21712. if (global_var.rows == 0) {
  21713. ret += '<tr><td></td></tr>';
  21714. }
  21715. 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>';
  21716. ret += '</table>';
  21717. 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>';
  21718. }
  21719. }
  21720. global_container.find(".div_valor_var").html('');
  21721. ret = (0, _jquery2.default)(ret);
  21722. ret.find('.span_value_variable').data('associatedOject', global_var);
  21723. ret.find(".boolean_simple_type").on('click', function (e) {
  21724. alternateBooleanGlobalValue(global_var, this.parentNode);
  21725. });
  21726. ret.find(".simple_var").on('click', function (e) {
  21727. enableGlobalValueUpdate(global_var, this.parentNode);
  21728. });
  21729. ret.find(".boolean_vector_var").on('click', function (e) {
  21730. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  21731. });
  21732. ret.find(".vector_var").on('click', function (e) {
  21733. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  21734. });
  21735. ret.find(".remove_global_vector_column").on('click', function (e) {
  21736. removeGlobalColumnVector(global_var);
  21737. global_container.find(".div_valor_var").html('');
  21738. renderValues(global_var, global_container);
  21739. });
  21740. ret.find(".add_global_vector_column").on('click', function (e) {
  21741. addGlobalColumnVector(global_var);
  21742. global_container.find(".div_valor_var").html('');
  21743. renderValues(global_var, global_container);
  21744. });
  21745. ret.find(".remove_global_matrix_column").on('click', function (e) {
  21746. removeColumnGlobalMatrix(global_var);
  21747. global_container.find(".div_valor_var").html('');
  21748. renderValues(global_var, global_container);
  21749. });
  21750. ret.find(".add_global_matrix_column").on('click', function (e) {
  21751. addColumnGlobalMatrix(global_var);
  21752. global_container.find(".div_valor_var").html('');
  21753. renderValues(global_var, global_container);
  21754. });
  21755. ret.find(".remove_global_matrix_line").on('click', function (e) {
  21756. removeLineGlobalMatrix(global_var);
  21757. global_container.find(".div_valor_var").html('');
  21758. renderValues(global_var, global_container);
  21759. });
  21760. ret.find(".add_global_matrix_line").on('click', function (e) {
  21761. addLineGlobalMatrix(global_var);
  21762. global_container.find(".div_valor_var").html('');
  21763. renderValues(global_var, global_container);
  21764. });
  21765. ret.find(".boolean_matrix_var").on('click', function (e) {
  21766. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  21767. });
  21768. ret.find(".matrix_var").on('click', function (e) {
  21769. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  21770. });
  21771. global_container.find(".div_valor_var").append(ret);
  21772. updateColumnsAndRowsText(global_container, global_var);
  21773. }
  21774. function addHandlers(global_container) {
  21775. var global_var = global_container.data('associatedOject');
  21776. // Manage constant option:
  21777. global_container.find(".alternate_constant").on('click', function (e) {
  21778. toggleConstant(global_var);
  21779. (0, _jquery2.default)(this).removeClass("on off");
  21780. if (global_var.is_constant) {
  21781. (0, _jquery2.default)(this).addClass("on");
  21782. } else {
  21783. (0, _jquery2.default)(this).addClass("off");
  21784. }
  21785. });
  21786. // Manage global name:
  21787. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  21788. enableNameUpdate(global_container);
  21789. });
  21790. // Menu to change type:
  21791. global_container.find('.ui.dropdown.global_type').dropdown({
  21792. onChange: function onChange(value, text, $selectedItem) {
  21793. if ($selectedItem.data('dimensions')) {
  21794. updateType(global_var, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  21795. } else {
  21796. updateType(global_var, _types.Types[$selectedItem.data('type')]);
  21797. }
  21798. renderValues(global_var, global_container);
  21799. }
  21800. });
  21801. // Remove global:
  21802. global_container.find(".remove_global").on('click', function (e) {
  21803. removeGlobal(global_var, global_container);
  21804. });
  21805. }
  21806. function updateColumnsAndRowsText(global_container, global_var) {
  21807. var prev = global_container.find('.text').text().split('[');
  21808. if (prev.length == 2) {
  21809. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  21810. global_container.find('.text').empty();
  21811. global_container.find('.text').text(ff);
  21812. }
  21813. if (prev.length == 3) {
  21814. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  21815. global_container.find('.text').empty();
  21816. global_container.find('.text').text(ff);
  21817. }
  21818. }
  21819. function renderGlobal(global_var) {
  21820. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  21821. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  21822. element += '<div class="ui dropdown global_type">';
  21823. if (global_var.dimensions > 0) {
  21824. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  21825. for (var i = 0; i < global_var.dimensions; i++) {
  21826. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  21827. }
  21828. element += '</div>';
  21829. } else {
  21830. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  21831. }
  21832. element += '<div class="menu">';
  21833. for (var tm in _types.Types) {
  21834. if (tm == _types.Types.VOID.toUpperCase()) {
  21835. continue;
  21836. }
  21837. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  21838. }
  21839. for (var tm in _types.Types) {
  21840. if (tm == _types.Types.VOID.toUpperCase()) {
  21841. continue;
  21842. }
  21843. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  21844. }
  21845. 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> ';
  21846. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  21847. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  21848. var complete_element = (0, _jquery2.default)(element);
  21849. complete_element.data('associatedOject', global_var);
  21850. (0, _jquery2.default)('.list_globals').append(complete_element);
  21851. addHandlers(complete_element);
  21852. renderValues(global_var, complete_element);
  21853. if (global_var.dimensions == 1) {
  21854. complete_element.find('.dimensions_0').text(global_var.columns);
  21855. }
  21856. if (global_var.dimensions == 2) {
  21857. complete_element.find('.dimensions_0').text(global_var.columns);
  21858. complete_element.find('.dimensions_1').text(global_var.rows);
  21859. }
  21860. return complete_element;
  21861. }
  21862. var opened_name_value_matrix_global_v = false;
  21863. var opened_input_value_matrix_global_v = null;
  21864. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  21865. if (opened_name_value_matrix_global_v) {
  21866. opened_input_value_matrix_global_v.focus();
  21867. return;
  21868. }
  21869. parent_node = (0, _jquery2.default)(parent_node);
  21870. opened_name_value_matrix_global_v = true;
  21871. parent_node.find('.span_value_variable').text('');
  21872. var input_field;
  21873. if (global_var.type == _types.Types.REAL) {
  21874. input_field = (0, _jquery2.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) + "' />");
  21875. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21876. } else {
  21877. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />");
  21878. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21879. }
  21880. input_field.on('input', function () {
  21881. var inputWidth = input_field.textWidth() + 10;
  21882. opened_input_value_matrix_global_v = input_field;
  21883. input_field.focus();
  21884. var tmpStr = input_field.val();
  21885. input_field.val('');
  21886. input_field.val(tmpStr);
  21887. input_field.css({
  21888. width: inputWidth
  21889. });
  21890. }).trigger('input');
  21891. input_field.focusout(function () {
  21892. /// update array:
  21893. if (input_field.val().trim()) {
  21894. if (global_var.type == _types.Types.REAL) {
  21895. global_var.value[row][index] = parseFloat(input_field.val().trim());
  21896. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  21897. } else {
  21898. if (global_var.type == _types.Types.INTEGER) {
  21899. global_var.value[row][index] = parseInt(input_field.val().trim());
  21900. } else {
  21901. global_var.value[row][index] = input_field.val().trim();
  21902. }
  21903. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21904. }
  21905. } else {
  21906. if (global_var.type == _types.Types.REAL) {
  21907. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  21908. } else {
  21909. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21910. }
  21911. }
  21912. if (global_var.type == _types.Types.TEXT) {
  21913. global_var.value[row][index] = input_field.val();
  21914. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21915. }
  21916. input_field.off();
  21917. input_field.remove();
  21918. /// update elements:
  21919. opened_name_value_matrix_global_v = false;
  21920. opened_input_value_matrix_global_v = false;
  21921. });
  21922. input_field.on('keydown', function (e) {
  21923. var code = e.keyCode || e.which;
  21924. if (code == 13) {
  21925. if (input_field.val().trim()) {
  21926. if (global_var.type == _types.Types.REAL) {
  21927. global_var.value[row][index] = parseFloat(input_field.val().trim());
  21928. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  21929. } else {
  21930. if (global_var.type == _types.Types.INTEGER) {
  21931. global_var.value[row][index] = parseInt(input_field.val().trim());
  21932. } else {
  21933. global_var.value[row][index] = input_field.val().trim();
  21934. }
  21935. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21936. }
  21937. } else {
  21938. if (global_var.type == _types.Types.REAL) {
  21939. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  21940. } else {
  21941. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21942. }
  21943. }
  21944. if (global_var.type == _types.Types.TEXT) {
  21945. global_var.value[row][index] = input_field.val();
  21946. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21947. }
  21948. input_field.off();
  21949. input_field.remove();
  21950. /// update elements:
  21951. opened_name_value_matrix_global_v = false;
  21952. opened_input_value_matrix_global_v = false;
  21953. }
  21954. if (code == 27) {
  21955. if (global_var.type == _types.Types.REAL) {
  21956. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  21957. } else {
  21958. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  21959. }
  21960. input_field.off();
  21961. input_field.remove();
  21962. /// update elements:
  21963. opened_name_value_matrix_global_v = false;
  21964. opened_input_value_matrix_global_v = false;
  21965. }
  21966. });
  21967. input_field.select();
  21968. }
  21969. var opened_name_value_global_var = false;
  21970. var opened_input_value_global_ar = null;
  21971. function enableGlobalValueUpdate(global_var, parent_node) {
  21972. if (opened_name_value_global_var) {
  21973. opened_input_value_global_ar.focus();
  21974. return;
  21975. }
  21976. parent_node = (0, _jquery2.default)(parent_node);
  21977. opened_name_value_global_var = true;
  21978. parent_node.find('.span_value_variable').text('');
  21979. var input_field;
  21980. if (global_var.type == _types.Types.REAL) {
  21981. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value.toFixed(1) + "' />");
  21982. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21983. } else {
  21984. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  21985. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21986. }
  21987. input_field.on('input', function () {
  21988. var inputWidth = input_field.textWidth() + 10;
  21989. opened_input_value_global_ar = input_field;
  21990. input_field.focus();
  21991. var tmpStr = input_field.val();
  21992. input_field.val('');
  21993. input_field.val(tmpStr);
  21994. input_field.css({
  21995. width: inputWidth
  21996. });
  21997. }).trigger('input');
  21998. input_field.focusout(function () {
  21999. /// update array:
  22000. if (input_field.val().trim()) {
  22001. if (global_var.type == _types.Types.REAL) {
  22002. global_var.value = parseFloat(input_field.val().trim());
  22003. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  22004. } else {
  22005. if (global_var.type == _types.Types.INTEGER) {
  22006. global_var.value = parseInt(input_field.val().trim());
  22007. } else {
  22008. global_var.value = input_field.val().trim();
  22009. }
  22010. parent_node.find('.span_value_variable').text(global_var.value);
  22011. }
  22012. } else {
  22013. if (global_var.type == _types.Types.REAL) {
  22014. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  22015. } else {
  22016. parent_node.find('.span_value_variable').text(global_var.value);
  22017. }
  22018. }
  22019. if (global_var.type == _types.Types.TEXT) {
  22020. global_var.value = input_field.val();
  22021. parent_node.find('.span_value_variable').text(global_var.value);
  22022. }
  22023. input_field.off();
  22024. input_field.remove();
  22025. /// update elements:
  22026. opened_name_value_global_var = false;
  22027. opened_input_value_global_ar = false;
  22028. });
  22029. input_field.on('keydown', function (e) {
  22030. var code = e.keyCode || e.which;
  22031. if (code == 13) {
  22032. if (input_field.val().trim()) {
  22033. if (global_var.type == _types.Types.REAL) {
  22034. global_var.value = parseFloat(input_field.val().trim());
  22035. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  22036. } else {
  22037. if (global_var.type == _types.Types.INTEGER) {
  22038. global_var.value = parseInt(input_field.val().trim());
  22039. } else {
  22040. global_var.value = input_field.val().trim();
  22041. }
  22042. parent_node.find('.span_value_variable').text(global_var.value);
  22043. }
  22044. } else {
  22045. if (global_var.type == _types.Types.REAL) {
  22046. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  22047. } else {
  22048. parent_node.find('.span_value_variable').text(global_var.value);
  22049. }
  22050. }
  22051. if (global_var.type == _types.Types.TEXT) {
  22052. global_var.value = input_field.val();
  22053. parent_node.find('.span_value_variable').text(global_var.value);
  22054. }
  22055. input_field.off();
  22056. input_field.remove();
  22057. /// update elements:
  22058. opened_name_value_global_var = false;
  22059. opened_input_value_global_ar = false;
  22060. }
  22061. if (code == 27) {
  22062. if (global_var.type == _types.Types.REAL) {
  22063. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  22064. } else {
  22065. parent_node.find('.span_value_variable').text(global_var.value);
  22066. }
  22067. input_field.off();
  22068. input_field.remove();
  22069. /// update elements:
  22070. opened_name_value_global_var = false;
  22071. opened_input_value_global_ar = false;
  22072. }
  22073. });
  22074. input_field.select();
  22075. }
  22076. var opened_name_global = false;
  22077. var opened_input_global = null;
  22078. function enableNameUpdate(global_container) {
  22079. var global_var = global_container.data('associatedOject');
  22080. if (opened_name_global) {
  22081. opened_input_global.focus();
  22082. return;
  22083. }
  22084. opened_name_global = true;
  22085. global_container.find('.span_name_variable').text('');
  22086. var input_name = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  22087. input_name.insertBefore(global_container.find('.span_name_variable'));
  22088. input_name.on('input', function () {
  22089. var inputWidth = input_name.textWidth() + 10;
  22090. opened_input_global = input_name;
  22091. opened_input_global.focus();
  22092. opened_input_global.css({
  22093. width: inputWidth
  22094. });
  22095. }).trigger('input');
  22096. input_name.focusout(function () {
  22097. /// update array:
  22098. if (input_name.val().trim().length > 0) {
  22099. updateName(global_var, input_name.val().trim());
  22100. global_container.find('.span_name_variable').text(global_var.name);
  22101. } else {
  22102. global_container.find('.span_name_variable').text(global_var.name);
  22103. }
  22104. input_name.off();
  22105. input_name.remove();
  22106. /// update elements:
  22107. opened_name_global = false;
  22108. opened_input_global = false;
  22109. });
  22110. input_name.on('keydown', function (e) {
  22111. var code = e.keyCode || e.which;
  22112. if (code == 13) {
  22113. if (input_name.val().trim()) {
  22114. updateName(global_var, input_name.val().trim());
  22115. global_container.find('.span_name_variable').text(global_var.name);
  22116. } else {
  22117. global_container.find('.span_name_variable').text(global_var.name);
  22118. }
  22119. input_name.off();
  22120. input_name.remove();
  22121. /// update elements:
  22122. opened_name_global = false;
  22123. opened_input_global = false;
  22124. }
  22125. if (code == 27) {
  22126. global_container.find('.span_name_variable').text(global_var.name);
  22127. input_name.off();
  22128. input_name.remove();
  22129. /// update elements:
  22130. opened_name_global = false;
  22131. opened_input_global = false;
  22132. }
  22133. });
  22134. input_name.select();
  22135. }
  22136. var opened_name_value_vector_global_ = false;
  22137. var opened_input_value_vector_global_ = null;
  22138. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  22139. if (opened_name_value_vector_global_) {
  22140. opened_input_value_vector_global_.focus();
  22141. return;
  22142. }
  22143. parent_node = (0, _jquery2.default)(parent_node);
  22144. opened_name_value_vector_global_ = true;
  22145. parent_node.find('.span_value_variable').text('');
  22146. var input_field;
  22147. if (global_var.type == _types.Types.REAL) {
  22148. input_field = (0, _jquery2.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) + "' />");
  22149. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22150. } else {
  22151. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
  22152. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22153. }
  22154. input_field.on('input', function () {
  22155. var inputWidth = input_field.textWidth() + 10;
  22156. opened_input_value_vector_global_ = input_field;
  22157. input_field.focus();
  22158. var tmpStr = input_field.val();
  22159. input_field.val('');
  22160. input_field.val(tmpStr);
  22161. input_field.css({
  22162. width: inputWidth
  22163. });
  22164. }).trigger('input');
  22165. input_field.focusout(function () {
  22166. /// update array:
  22167. if (input_field.val().trim()) {
  22168. if (global_var.type == _types.Types.REAL) {
  22169. global_var.value[index] = parseFloat(input_field.val().trim());
  22170. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  22171. } else {
  22172. if (global_var.type == _types.Types.INTEGER) {
  22173. global_var.value[index] = parseInt(input_field.val().trim());
  22174. } else {
  22175. global_var.value[index] = input_field.val().trim();
  22176. }
  22177. parent_node.find('.span_value_variable').text(global_var.value[index]);
  22178. }
  22179. } else {
  22180. if (global_var.type == _types.Types.REAL) {
  22181. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  22182. } else {
  22183. parent_node.find('.span_value_variable').text(global_var.value[index]);
  22184. }
  22185. }
  22186. if (global_var.type == _types.Types.TEXT) {
  22187. global_var.value[index] = input_field.val();
  22188. parent_node.find('.span_value_variable').text(global_var.value[index]);
  22189. }
  22190. input_field.off();
  22191. input_field.remove();
  22192. /// update elements:
  22193. opened_name_value_vector_global_ = false;
  22194. opened_input_value_vector_global_ = false;
  22195. });
  22196. input_field.on('keydown', function (e) {
  22197. var code = e.keyCode || e.which;
  22198. if (code == 13) {
  22199. if (input_field.val().trim()) {
  22200. if (global_var.type == _types.Types.REAL) {
  22201. global_var.value[index] = parseFloat(input_field.val().trim());
  22202. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  22203. } else {
  22204. if (global_var.type == _types.Types.INTEGER) {
  22205. global_var.value[index] = parseInt(input_field.val().trim());
  22206. } else {
  22207. global_var.value[index] = input_field.val().trim();
  22208. }
  22209. parent_node.find('.span_value_variable').text(global_var.value[index]);
  22210. }
  22211. } else {
  22212. if (global_var.type == _types.Types.REAL) {
  22213. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  22214. } else {
  22215. parent_node.find('.span_value_variable').text(global_var.value[index]);
  22216. }
  22217. }
  22218. if (global_var.type == _types.Types.TEXT) {
  22219. global_var.value[index] = input_field.val();
  22220. parent_node.find('.span_value_variable').text(global_var.value[index]);
  22221. }
  22222. input_field.off();
  22223. input_field.remove();
  22224. /// update elements:
  22225. opened_name_value_vector_global_ = false;
  22226. opened_input_value_vector_global_ = false;
  22227. }
  22228. if (code == 27) {
  22229. if (global_var.type == _types.Types.REAL) {
  22230. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  22231. } else {
  22232. parent_node.find('.span_value_variable').text(global_var.value[index]);
  22233. }
  22234. input_field.off();
  22235. input_field.remove();
  22236. /// update elements:
  22237. opened_name_value_vector_global_ = false;
  22238. opened_input_value_vector_global_ = false;
  22239. }
  22240. });
  22241. input_field.select();
  22242. }
  22243. _jquery2.default.fn.textWidth = function (text, font) {
  22244. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  22245. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  22246. return _jquery2.default.fn.textWidth.fakeEl.width();
  22247. };
  22248. /***/ }),
  22249. /***/ "./js/visualUI/globals_sidebar.js":
  22250. /*!****************************************!*\
  22251. !*** ./js/visualUI/globals_sidebar.js ***!
  22252. \****************************************/
  22253. /*! no static exports found */
  22254. /***/ (function(module, exports, __webpack_require__) {
  22255. "use strict";
  22256. Object.defineProperty(exports, "__esModule", {
  22257. value: true
  22258. });
  22259. exports.addGlobal = addGlobal;
  22260. exports.renderGlobal = renderGlobal;
  22261. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22262. var _jquery2 = _interopRequireDefault(_jquery);
  22263. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  22264. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22265. var Models = _interopRequireWildcard(_ivprog_elements);
  22266. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22267. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  22268. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  22269. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  22270. window.jQuery = _jquery2.default;
  22271. var counter_new_globals = 0;
  22272. function addGlobal(program) {
  22273. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  22274. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  22275. counter_new_globals++;
  22276. program.addGlobal(new_global);
  22277. var newe = renderGlobal(new_global);
  22278. if (is_from_click) {
  22279. newe.css('display', 'none');
  22280. newe.fadeIn();
  22281. }
  22282. }
  22283. function toggleConstant(global_var) {
  22284. global_var.is_constant = !global_var.is_constant;
  22285. }
  22286. function updateName(global_var, new_name) {
  22287. global_var.name = new_name;
  22288. }
  22289. function updateType(global_var, new_type) {
  22290. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  22291. global_var.type = new_type;
  22292. global_var.dimensions = new_dimensions;
  22293. if (new_dimensions > 0) {
  22294. global_var.rows = new_dimensions;
  22295. global_var.columns = 2;
  22296. }
  22297. updateInitialValues(global_var);
  22298. }
  22299. function removeGlobal(global_var, global_container) {
  22300. var index = window.program_obj.globals.indexOf(global_var);
  22301. if (index > -1) {
  22302. window.insertContext = true;
  22303. window.program_obj.globals.splice(index, 1);
  22304. }
  22305. global_container.children().off();
  22306. global_container.off();
  22307. global_container.fadeOut();
  22308. }
  22309. function updateInitialValues(global_var) {
  22310. if (global_var.type == _types.Types.INTEGER) {
  22311. if (global_var.dimensions == 0) {
  22312. global_var.value = 1;
  22313. }
  22314. if (global_var.dimensions == 1) {
  22315. global_var.value = [1, 1];
  22316. }
  22317. if (global_var.dimensions == 2) {
  22318. global_var.value = [[1, 1], [1, 1]];
  22319. }
  22320. }
  22321. if (global_var.type == _types.Types.REAL) {
  22322. if (global_var.dimensions == 0) {
  22323. global_var.value = 1.0;
  22324. }
  22325. if (global_var.dimensions == 1) {
  22326. global_var.value = [1.0, 1.0];
  22327. }
  22328. if (global_var.dimensions == 2) {
  22329. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  22330. }
  22331. }
  22332. if (global_var.type == _types.Types.TEXT) {
  22333. if (global_var.dimensions == 0) {
  22334. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  22335. }
  22336. if (global_var.dimensions == 1) {
  22337. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  22338. }
  22339. if (global_var.dimensions == 2) {
  22340. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  22341. }
  22342. }
  22343. if (global_var.type == _types.Types.BOOLEAN) {
  22344. if (global_var.dimensions == 0) {
  22345. global_var.value = true;
  22346. }
  22347. if (global_var.dimensions == 1) {
  22348. global_var.value = [true, true];
  22349. }
  22350. if (global_var.dimensions == 2) {
  22351. global_var.value = [[true, true], [true, true]];
  22352. }
  22353. }
  22354. }
  22355. function alternateBooleanGlobalValue(global_var, value_container) {
  22356. global_var.value = !global_var.value;
  22357. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  22358. }
  22359. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  22360. global_var.value[index] = !global_var.value[index];
  22361. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  22362. }
  22363. function removeGlobalColumnVector(global_var) {
  22364. if (global_var.columns == 0) {
  22365. return;
  22366. }
  22367. global_var.columns--;
  22368. global_var.value.splice(global_var.value.length - 1, 1);
  22369. }
  22370. function addGlobalColumnVector(global_var) {
  22371. global_var.columns++;
  22372. if (global_var.type == _types.Types.INTEGER) {
  22373. global_var.value.push(1);
  22374. }
  22375. if (global_var.type == _types.Types.REAL) {
  22376. global_var.value.push(1.0);
  22377. }
  22378. if (global_var.type == _types.Types.TEXT) {
  22379. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  22380. }
  22381. if (global_var.type == _types.Types.BOOLEAN) {
  22382. global_var.value.push(true);
  22383. }
  22384. }
  22385. function removeColumnGlobalMatrix(global_var) {
  22386. if (global_var.columns == 0) {
  22387. return;
  22388. }
  22389. global_var.columns--;
  22390. for (var i = 0; i < global_var.rows; i++) {
  22391. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  22392. }
  22393. }
  22394. function addColumnGlobalMatrix(global_var) {
  22395. global_var.columns++;
  22396. if (global_var.type == _types.Types.INTEGER) {
  22397. for (var i = 0; i < global_var.rows; i++) {
  22398. global_var.value[i].push(1);
  22399. }
  22400. }
  22401. if (global_var.type == _types.Types.REAL) {
  22402. for (var i = 0; i < global_var.rows; i++) {
  22403. global_var.value[i].push(1.0);
  22404. }
  22405. }
  22406. if (global_var.type == _types.Types.TEXT) {
  22407. for (var i = 0; i < global_var.rows; i++) {
  22408. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  22409. }
  22410. }
  22411. if (global_var.type == _types.Types.BOOLEAN) {
  22412. for (var i = 0; i < global_var.rows; i++) {
  22413. global_var.value[i].push(true);
  22414. }
  22415. }
  22416. }
  22417. function removeLineGlobalMatrix(global_var) {
  22418. if (global_var.rows == 0) {
  22419. return;
  22420. }
  22421. global_var.rows--;
  22422. global_var.value.splice(global_var.value.length - 1, 1);
  22423. }
  22424. function addLineGlobalMatrix(global_var) {
  22425. global_var.rows++;
  22426. if (global_var.type == _types.Types.INTEGER) {
  22427. var n_l = [];
  22428. for (var i = 0; i < global_var.columns; i++) {
  22429. n_l.push(1);
  22430. }
  22431. global_var.value.push(n_l);
  22432. }
  22433. if (global_var.type == _types.Types.REAL) {
  22434. var n_l = [];
  22435. for (i = 0; i < global_var.columns; i++) {
  22436. n_l.push(1.0);
  22437. }
  22438. global_var.value.push(n_l);
  22439. }
  22440. if (global_var.type == _types.Types.TEXT) {
  22441. var n_l = [];
  22442. for (i = 0; i < global_var.columns; i++) {
  22443. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  22444. }
  22445. global_var.value.push(n_l);
  22446. }
  22447. if (global_var.type == _types.Types.BOOLEAN) {
  22448. var n_l = [];
  22449. for (i = 0; i < global_var.columns; i++) {
  22450. n_l.push(true);
  22451. }
  22452. global_var.value.push(n_l);
  22453. }
  22454. }
  22455. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  22456. global_var.value[row][index] = !global_var.value[row][index];
  22457. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  22458. }
  22459. function renderValues(global_var, global_container) {
  22460. var ret = "";
  22461. var j = 0;
  22462. if (global_var.dimensions == 0) {
  22463. if (global_var.type == _types.Types.REAL) {
  22464. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  22465. } else {
  22466. if (global_var.type == _types.Types.BOOLEAN) {
  22467. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  22468. } else {
  22469. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  22470. }
  22471. }
  22472. } else {
  22473. ret += '<table class="tabela_var">';
  22474. if (global_var.dimensions == 1) {
  22475. ret += '<tr>';
  22476. if (global_var.type == _types.Types.REAL) {
  22477. for (var k = 0; k < global_var.columns; k++) {
  22478. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  22479. }
  22480. } else {
  22481. for (var k = 0; k < global_var.columns; k++) {
  22482. if (global_var.type == _types.Types.BOOLEAN) {
  22483. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  22484. } else {
  22485. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  22486. }
  22487. }
  22488. }
  22489. ret += '</tr>';
  22490. ret += '</table>';
  22491. 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>';
  22492. }
  22493. if (global_var.dimensions == 2) {
  22494. if (global_var.type == _types.Types.REAL) {
  22495. for (var l = 0; l < global_var.rows; l++) {
  22496. ret += '<tr>';
  22497. for (var k = 0; k < global_var.columns; k++) {
  22498. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  22499. }
  22500. ret += '</tr>';
  22501. }
  22502. } else {
  22503. for (var l = 0; l < global_var.rows; l++) {
  22504. ret += '<tr>';
  22505. for (var k = 0; k < global_var.columns; k++) {
  22506. if (global_var.type == _types.Types.BOOLEAN) {
  22507. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[l][k]) + '</span></td>';
  22508. } else {
  22509. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  22510. }
  22511. }
  22512. ret += '</tr>';
  22513. }
  22514. }
  22515. if (global_var.rows == 0) {
  22516. ret += '<tr><td></td></tr>';
  22517. }
  22518. 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>';
  22519. ret += '</table>';
  22520. 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>';
  22521. }
  22522. }
  22523. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  22524. ret = (0, _jquery2.default)(ret);
  22525. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', global_var);
  22526. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  22527. alternateBooleanGlobalValue(global_var, this.parentNode);
  22528. });
  22529. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  22530. enableGlobalValueUpdate(global_var, this.parentNode);
  22531. });
  22532. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  22533. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  22534. });
  22535. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  22536. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  22537. });
  22538. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  22539. removeGlobalColumnVector(global_var);
  22540. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  22541. renderValues(global_var, global_container);
  22542. });
  22543. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  22544. addGlobalColumnVector(global_var);
  22545. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  22546. renderValues(global_var, global_container);
  22547. });
  22548. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  22549. removeColumnGlobalMatrix(global_var);
  22550. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  22551. renderValues(global_var, global_container);
  22552. });
  22553. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  22554. addColumnGlobalMatrix(global_var);
  22555. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  22556. renderValues(global_var, global_container);
  22557. });
  22558. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  22559. removeLineGlobalMatrix(global_var);
  22560. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  22561. renderValues(global_var, global_container);
  22562. });
  22563. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  22564. addLineGlobalMatrix(global_var);
  22565. (0, _jquery2.default)(global_container).find(".div_valor_var").html('');
  22566. renderValues(global_var, global_container);
  22567. });
  22568. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  22569. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  22570. });
  22571. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  22572. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  22573. });
  22574. (0, _jquery2.default)(global_container).find(".div_valor_var").append(ret);
  22575. updateColumnsAndRowsText(global_container, global_var);
  22576. }
  22577. function addHandlers(global_container) {
  22578. var global_var = global_container.data('associatedOject');
  22579. // Manage constant option:
  22580. global_container.find(".alternate_constant").on('click', function (e) {
  22581. toggleConstant(global_var);
  22582. (0, _jquery2.default)(this).removeClass("on off");
  22583. if (global_var.is_constant) {
  22584. (0, _jquery2.default)(this).addClass("on");
  22585. } else {
  22586. (0, _jquery2.default)(this).addClass("off");
  22587. }
  22588. });
  22589. // Manage global name:
  22590. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  22591. enableNameUpdate(global_container);
  22592. });
  22593. // Menu to change type:
  22594. global_container.find('.ui.dropdown.global_type').dropdown({
  22595. onChange: function onChange(value, text, $selectedItem) {
  22596. if ((0, _jquery2.default)($selectedItem).data('dimensions')) {
  22597. updateType(global_var, _types.Types[(0, _jquery2.default)($selectedItem).data('type')], (0, _jquery2.default)($selectedItem).data('dimensions'));
  22598. } else {
  22599. updateType(global_var, _types.Types[(0, _jquery2.default)($selectedItem).data('type')]);
  22600. }
  22601. renderValues(global_var, global_container);
  22602. }
  22603. });
  22604. // Remove global:
  22605. global_container.find(".remove_global").on('click', function (e) {
  22606. removeGlobal(global_var, global_container);
  22607. });
  22608. global_container.attr("draggable", "true").on('dragstart', function (e) {
  22609. //console.log(document.elementFromPoint(e.clientX, e.clientY));
  22610. //if ( global_container[0] == document.elementFromPoint(e.clientX, e.clientY) )
  22611. program_obj.dataTransfer = { type: "var", content: global_var };
  22612. });
  22613. global_container.on('click', function (evt) {
  22614. console.log(this);
  22615. console.log(evt.target);
  22616. if (evt.target === this) {
  22617. (0, _jquery2.default)(this).trigger('dragstart');
  22618. if (window.ghostNode) {
  22619. (0, _jquery2.default)(window.ghostNode).remove();
  22620. (0, _jquery2.default)(document).off('mousemove');
  22621. }
  22622. window.ghostNode = (0, _jquery2.default)(this).clone();
  22623. ghostNode.outerWidth((0, _jquery2.default)(this).outerWidth());
  22624. ghostNode.draggable().appendTo('body');
  22625. ghostNode.css('position', 'absolute');
  22626. ghostNode.css('left', evt.pageX);
  22627. ghostNode.css('top', evt.pageY);
  22628. evt.type = 'drag';
  22629. evt.target = ghostNode[0];
  22630. ghostNode.trigger(evt);
  22631. (0, _jquery2.default)(document).on('mousemove', function (evt) {
  22632. ghostNode.css('left', evt.pageX);
  22633. ghostNode.css('top', evt.pageY);
  22634. });
  22635. (0, _jquery2.default)(document).on('mousedown', function (evt) {
  22636. console.log("length ===");
  22637. console.log((0, _jquery2.default)(evt.target).closest(".commands_list_div"));
  22638. if ((0, _jquery2.default)(evt.target).closest(".commands_list_div").length <= 0) {
  22639. if (window.ghostNode) {
  22640. console.log("drop click");
  22641. (0, _jquery2.default)('.div-over').removeClass('div-over');
  22642. (0, _jquery2.default)(window.ghostNode).remove();
  22643. delete window.ghostNode;
  22644. (0, _jquery2.default)(document).off('mousemove').off('mousedown').off('keyup');
  22645. }
  22646. }
  22647. });
  22648. (0, _jquery2.default)(document).keyup(function (e) {
  22649. console.log("KeyUp");
  22650. if (e.key === "Escape") {
  22651. console.log("escape");
  22652. (0, _jquery2.default)('.div-over').removeClass('div-over');
  22653. (0, _jquery2.default)(window.ghostNode).remove();
  22654. delete window.ghostNode;
  22655. (0, _jquery2.default)(document).off('mousemove').off('mousedown').off('keyup');
  22656. }
  22657. });
  22658. }
  22659. });
  22660. }
  22661. function updateColumnsAndRowsText(global_container, global_var) {
  22662. var prev = global_container.find('.text').text().split('[');
  22663. if (prev.length == 2) {
  22664. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  22665. global_container.find('.text').empty();
  22666. global_container.find('.text').text(ff);
  22667. }
  22668. if (prev.length == 3) {
  22669. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  22670. global_container.find('.text').empty();
  22671. global_container.find('.text').text(ff);
  22672. }
  22673. }
  22674. function renderGlobal(global_var) {
  22675. var element = '<div class="fluid ui segment global_container pink inverted"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  22676. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  22677. element += '<div class="ui dropdown global_type">';
  22678. if (global_var.dimensions > 0) {
  22679. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  22680. for (var i = 0; i < global_var.dimensions; i++) {
  22681. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  22682. }
  22683. element += '</div>';
  22684. } else {
  22685. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  22686. }
  22687. element += '<div class="menu">';
  22688. for (var tm in _types.Types) {
  22689. if (tm == _types.Types.VOID.toUpperCase()) {
  22690. continue;
  22691. }
  22692. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  22693. }
  22694. for (var tm in _types.Types) {
  22695. if (tm == _types.Types.VOID.toUpperCase()) {
  22696. continue;
  22697. }
  22698. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  22699. }
  22700. 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> ';
  22701. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  22702. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  22703. var complete_element = (0, _jquery2.default)(element);
  22704. (0, _jquery2.default)(complete_element).data('associatedOject', global_var);
  22705. (0, _jquery2.default)('.list_globals').append(complete_element);
  22706. addHandlers(complete_element);
  22707. renderValues(global_var, complete_element);
  22708. if (global_var.dimensions == 1) {
  22709. complete_element.find('.dimensions_0').text(global_var.columns);
  22710. }
  22711. if (global_var.dimensions == 2) {
  22712. complete_element.find('.dimensions_0').text(global_var.columns);
  22713. complete_element.find('.dimensions_1').text(global_var.rows);
  22714. }
  22715. return complete_element;
  22716. }
  22717. var opened_name_value_matrix_global_v = false;
  22718. var opened_input_value_matrix_global_v = null;
  22719. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  22720. if (opened_name_value_matrix_global_v) {
  22721. (0, _jquery2.default)(opened_input_value_matrix_global_v).focus();
  22722. return;
  22723. }
  22724. parent_node = (0, _jquery2.default)(parent_node);
  22725. opened_name_value_matrix_global_v = true;
  22726. parent_node.find('.span_value_variable').text('');
  22727. var input_field;
  22728. if (global_var.type == _types.Types.REAL) {
  22729. input_field = (0, _jquery2.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) + "' />");
  22730. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22731. } else {
  22732. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />");
  22733. input_field.insertBefore(parent_node.find('.span_value_variable'));
  22734. }
  22735. input_field.on('input', function () {
  22736. var inputWidth = input_field.textWidth() + 10;
  22737. opened_input_value_matrix_global_v = input_field;
  22738. input_field.focus();
  22739. var tmpStr = input_field.val();
  22740. input_field.val('');
  22741. input_field.val(tmpStr);
  22742. input_field.css({
  22743. width: inputWidth
  22744. });
  22745. }).trigger('input');
  22746. input_field.focusout(function () {
  22747. /// update array:
  22748. if (input_field.val().trim()) {
  22749. if (global_var.type == _types.Types.REAL) {
  22750. global_var.value[row][index] = parseFloat(input_field.val().trim());
  22751. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  22752. } else {
  22753. if (global_var.type == _types.Types.INTEGER) {
  22754. global_var.value[row][index] = parseInt(input_field.val().trim());
  22755. } else {
  22756. global_var.value[row][index] = input_field.val().trim();
  22757. }
  22758. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  22759. }
  22760. } else {
  22761. if (global_var.type == _types.Types.REAL) {
  22762. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  22763. } else {
  22764. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  22765. }
  22766. }
  22767. if (global_var.type == _types.Types.TEXT) {
  22768. global_var.value[row][index] = input_field.val();
  22769. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  22770. }
  22771. input_field.off();
  22772. input_field.remove();
  22773. /// update elements:
  22774. opened_name_value_matrix_global_v = false;
  22775. opened_input_value_matrix_global_v = false;
  22776. });
  22777. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  22778. var code = e.keyCode || e.which;
  22779. if (code == 13) {
  22780. if ((0, _jquery2.default)(this).val().trim()) {
  22781. if (global_var.type == _types.Types.REAL) {
  22782. global_var.value[row][index] = parseFloat((0, _jquery2.default)(this).val().trim());
  22783. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  22784. } else {
  22785. if (global_var.type == _types.Types.INTEGER) {
  22786. global_var.value[row][index] = parseInt((0, _jquery2.default)(this).val().trim());
  22787. } else {
  22788. global_var.value[row][index] = (0, _jquery2.default)(this).val().trim();
  22789. }
  22790. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[row][index]);
  22791. }
  22792. }
  22793. (0, _jquery2.default)(this).remove();
  22794. /// update elements:
  22795. opened_name_value_matrix_global_v = false;
  22796. opened_input_value_matrix_global_v = false;
  22797. }
  22798. if (code == 27) {
  22799. if (global_var.type == _types.Types.REAL) {
  22800. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  22801. } else {
  22802. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[row][index]);
  22803. }
  22804. (0, _jquery2.default)(this).remove();
  22805. /// update elements:
  22806. opened_name_value_matrix_global_v = false;
  22807. opened_input_value_matrix_global_v = false;
  22808. }
  22809. });
  22810. }
  22811. var opened_name_value_global_var = false;
  22812. var opened_input_value_global_ar = null;
  22813. function enableGlobalValueUpdate(global_var, parent_node) {
  22814. if (opened_name_value_global_var) {
  22815. (0, _jquery2.default)(opened_input_value_global_ar).focus();
  22816. return;
  22817. }
  22818. opened_name_value_global_var = true;
  22819. (0, _jquery2.default)(parent_node).find('.span_value_variable').text('');
  22820. if (global_var.type == _types.Types.REAL) {
  22821. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value.toFixed(1) + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  22822. } else {
  22823. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  22824. }
  22825. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  22826. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  22827. opened_input_value_global_ar = this;
  22828. (0, _jquery2.default)(this).focus();
  22829. var tmpStr = (0, _jquery2.default)(this).val();
  22830. (0, _jquery2.default)(this).val('');
  22831. (0, _jquery2.default)(this).val(tmpStr);
  22832. (0, _jquery2.default)(this).css({
  22833. width: inputWidth
  22834. });
  22835. }).trigger('input');
  22836. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  22837. /// update array:
  22838. if ((0, _jquery2.default)(this).val().trim()) {
  22839. if (global_var.type == _types.Types.REAL) {
  22840. global_var.value = parseFloat((0, _jquery2.default)(this).val().trim());
  22841. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value.toFixed(1));
  22842. } else {
  22843. if (global_var.type == _types.Types.INTEGER) {
  22844. global_var.value = parseInt((0, _jquery2.default)(this).val().trim());
  22845. } else {
  22846. global_var.value = (0, _jquery2.default)(this).val().trim();
  22847. }
  22848. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value);
  22849. }
  22850. }
  22851. (0, _jquery2.default)(this).remove();
  22852. /// update elements:
  22853. opened_name_value_global_var = false;
  22854. opened_input_value_global_ar = false;
  22855. });
  22856. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  22857. var code = e.keyCode || e.which;
  22858. if (code == 13) {
  22859. if ((0, _jquery2.default)(this).val().trim()) {
  22860. if (global_var.type == _types.Types.REAL) {
  22861. global_var.value = parseFloat((0, _jquery2.default)(this).val().trim());
  22862. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value.toFixed(1));
  22863. } else {
  22864. if (global_var.type == _types.Types.INTEGER) {
  22865. global_var.value = parseInt((0, _jquery2.default)(this).val().trim());
  22866. } else {
  22867. global_var.value = (0, _jquery2.default)(this).val().trim();
  22868. }
  22869. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value);
  22870. }
  22871. }
  22872. (0, _jquery2.default)(this).remove();
  22873. /// update elements:
  22874. opened_name_value_global_var = false;
  22875. opened_input_value_global_ar = false;
  22876. }
  22877. if (code == 27) {
  22878. if (global_var.type == _types.Types.REAL) {
  22879. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value.toFixed(1));
  22880. } else {
  22881. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value);
  22882. }
  22883. (0, _jquery2.default)(this).remove();
  22884. /// update elements:
  22885. opened_name_value_global_var = false;
  22886. opened_input_value_global_ar = false;
  22887. }
  22888. });
  22889. }
  22890. var opened_name_global = false;
  22891. var opened_input_global = null;
  22892. function enableNameUpdate(global_container) {
  22893. var global_var = global_container.data('associatedOject');
  22894. if (opened_name_global) {
  22895. opened_input_global.focus();
  22896. return;
  22897. }
  22898. opened_name_global = true;
  22899. global_container.find('.span_name_variable').text('');
  22900. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />").insertBefore(global_container.find('.span_name_variable'));
  22901. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  22902. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  22903. opened_input_global = (0, _jquery2.default)(this);
  22904. opened_input_global.focus();
  22905. opened_input_global.css({
  22906. width: inputWidth
  22907. });
  22908. }).trigger('input');
  22909. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  22910. /// update array:
  22911. if ((0, _jquery2.default)(this).val().trim().length > 0) {
  22912. updateName(global_var, (0, _jquery2.default)(this).val().trim());
  22913. global_container.find('.span_name_variable').text(global_var.name);
  22914. } else {
  22915. global_container.find('.span_name_variable').text(global_var.name);
  22916. }
  22917. (0, _jquery2.default)(this).remove();
  22918. /// update elements:
  22919. opened_name_global = false;
  22920. opened_input_global = false;
  22921. });
  22922. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  22923. var code = e.keyCode || e.which;
  22924. if (code == 13) {
  22925. if ((0, _jquery2.default)(this).val().trim()) {
  22926. updateName(global_var, (0, _jquery2.default)(this).val().trim());
  22927. global_container.find('.span_name_variable').text(global_var.name);
  22928. } else {
  22929. global_container.find('.span_name_variable').text(global_var.name);
  22930. }
  22931. (0, _jquery2.default)(this).remove();
  22932. /// update elements:
  22933. opened_name_global = false;
  22934. opened_input_global = false;
  22935. }
  22936. if (code == 27) {
  22937. global_container.find('.span_name_variable').text(global_var.name);
  22938. (0, _jquery2.default)(this).remove();
  22939. /// update elements:
  22940. opened_name_global = false;
  22941. opened_input_global = false;
  22942. }
  22943. });
  22944. (0, _jquery2.default)('.width-dynamic').select();
  22945. }
  22946. var opened_name_value_vector_global_ = false;
  22947. var opened_input_value_vector_global_ = null;
  22948. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  22949. if (opened_name_value_vector_global_) {
  22950. (0, _jquery2.default)(opened_input_value_vector_global_).focus();
  22951. return;
  22952. }
  22953. opened_name_value_vector_global_ = true;
  22954. (0, _jquery2.default)(parent_node).find('.span_value_variable').text('');
  22955. if (global_var.type == _types.Types.REAL) {
  22956. (0, _jquery2.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) + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  22957. } else {
  22958. (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />").insertBefore((0, _jquery2.default)(parent_node).find('.span_value_variable'));
  22959. }
  22960. (0, _jquery2.default)('.width-dynamic').on('input', function () {
  22961. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  22962. opened_input_value_vector_global_ = this;
  22963. (0, _jquery2.default)(this).focus();
  22964. var tmpStr = (0, _jquery2.default)(this).val();
  22965. (0, _jquery2.default)(this).val('');
  22966. (0, _jquery2.default)(this).val(tmpStr);
  22967. (0, _jquery2.default)(this).css({
  22968. width: inputWidth
  22969. });
  22970. }).trigger('input');
  22971. (0, _jquery2.default)('.width-dynamic').focusout(function () {
  22972. /// update array:
  22973. if ((0, _jquery2.default)(this).val().trim()) {
  22974. if (global_var.type == _types.Types.REAL) {
  22975. global_var.value[index] = parseFloat((0, _jquery2.default)(this).val().trim());
  22976. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index].toFixed(1));
  22977. } else {
  22978. if (global_var.type == _types.Types.INTEGER) {
  22979. global_var.value[index] = parseInt((0, _jquery2.default)(this).val().trim());
  22980. } else {
  22981. global_var.value[index] = (0, _jquery2.default)(this).val().trim();
  22982. }
  22983. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index]);
  22984. }
  22985. }
  22986. (0, _jquery2.default)(this).remove();
  22987. /// update elements:
  22988. opened_name_value_vector_global_ = false;
  22989. opened_input_value_vector_global_ = false;
  22990. });
  22991. (0, _jquery2.default)('.width-dynamic').on('keydown', function (e) {
  22992. var code = e.keyCode || e.which;
  22993. if (code == 13) {
  22994. if ((0, _jquery2.default)(this).val().trim()) {
  22995. if (global_var.type == _types.Types.REAL) {
  22996. global_var.value[index] = parseFloat((0, _jquery2.default)(this).val().trim());
  22997. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index].toFixed(1));
  22998. } else {
  22999. if (global_var.type == _types.Types.INTEGER) {
  23000. global_var.value[index] = parseInt((0, _jquery2.default)(this).val().trim());
  23001. } else {
  23002. global_var.value[index] = (0, _jquery2.default)(this).val().trim();
  23003. }
  23004. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index]);
  23005. }
  23006. }
  23007. (0, _jquery2.default)(this).remove();
  23008. /// update elements:
  23009. opened_name_value_vector_global_ = false;
  23010. opened_input_value_vector_global_ = false;
  23011. }
  23012. if (code == 27) {
  23013. if (global_var.type == _types.Types.REAL) {
  23014. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index].toFixed(1));
  23015. } else {
  23016. (0, _jquery2.default)(parent_node).find('.span_value_variable').text(global_var.value[index]);
  23017. }
  23018. (0, _jquery2.default)(this).remove();
  23019. /// update elements:
  23020. opened_name_value_vector_global_ = false;
  23021. opened_input_value_vector_global_ = false;
  23022. }
  23023. });
  23024. }
  23025. _jquery2.default.fn.textWidth = function (text, font) {
  23026. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  23027. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  23028. return _jquery2.default.fn.textWidth.fakeEl.width();
  23029. };
  23030. /***/ }),
  23031. /***/ "./js/visualUI/ivprog_elements.js":
  23032. /*!****************************************!*\
  23033. !*** ./js/visualUI/ivprog_elements.js ***!
  23034. \****************************************/
  23035. /*! no static exports found */
  23036. /***/ (function(module, exports, __webpack_require__) {
  23037. "use strict";
  23038. Object.defineProperty(exports, "__esModule", {
  23039. value: true
  23040. });
  23041. exports.Program = exports.FunctionCallMenu = exports.VariableValueMenu = exports.FunctionCall = exports.SwitchCase = exports.Return = exports.Switch = exports.DoWhileTrue = exports.WhileTrue = exports.RepeatNTimes = exports.IfTrue = exports.ArithmeticExpression = exports.LogicExpression = exports.ConditionalExpression = exports.ExpressionElement = exports.Attribution = exports.Writer = exports.Reader = exports.Break = exports.Comment = exports.SystemFunction = exports.Function = exports.Variable = exports.SYSTEM_FUNCTIONS_CATEGORIES = exports.LOGIC_COMPARISON = exports.ARITHMETIC_COMPARISON = exports.EXPRESSION_TYPES = exports.EXPRESSION_ELEMENTS = exports.ARITHMETIC_TYPES = exports.COMMAND_TYPES = undefined;
  23042. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  23043. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23044. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  23045. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  23046. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  23047. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  23048. var _algorithm_sidebar = __webpack_require__(/*! ./algorithm_sidebar */ "./js/visualUI/algorithm_sidebar.js");
  23049. var AlgorithmManagement = _interopRequireWildcard(_algorithm_sidebar);
  23050. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  23051. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  23052. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  23053. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  23054. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  23055. return: "return" });
  23056. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  23057. var EXPRESSION_ELEMENTS = exports.EXPRESSION_ELEMENTS = Object.freeze({ exp_op_exp: "exp_op_exp", op_exp: "op_exp", par_exp_par: "par_exp_par", start_point: "start_point" });
  23058. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  23059. var ARITHMETIC_COMPARISON = exports.ARITHMETIC_COMPARISON = Object.freeze({ greater_than: "greater_than", less_than: "less_than", equals_to: "equals_to", not_equals_to: "not_equals_to", greater_than_or_equals_to: "greater_than_or_equals_to", less_than_or_equals_to: "less_than_or_equals_to" });
  23060. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  23061. var SYSTEM_FUNCTIONS_CATEGORIES = exports.SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({ math: "math", text: "text", arrangement: "arrangement", conversion: "conversion" });
  23062. var Variable = exports.Variable = function Variable(type, name, value) {
  23063. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  23064. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  23065. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  23066. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  23067. _classCallCheck(this, Variable);
  23068. this.type = type;
  23069. this.name = name;
  23070. this.value = value;
  23071. this.dimensions = dimensions;
  23072. this.is_constant = is_constant;
  23073. this.rows = rows;
  23074. this.columns = columns;
  23075. };
  23076. var Function = exports.Function = function Function(name) {
  23077. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  23078. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  23079. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  23080. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  23081. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  23082. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  23083. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  23084. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  23085. _classCallCheck(this, Function);
  23086. this.type = COMMAND_TYPES.function;
  23087. this.name = name;
  23088. this.return_type = return_type;
  23089. this.return_dimensions = return_dimensions;
  23090. this.parameters_list = parameters_list;
  23091. this.is_main = is_main;
  23092. this.is_hidden = is_hidden;
  23093. this.variables_list = variables_list;
  23094. this.function_comment = function_comment;
  23095. this.commands = commands;
  23096. };
  23097. var SystemFunction = exports.SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  23098. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  23099. var category = arguments[5];
  23100. _classCallCheck(this, SystemFunction);
  23101. this.type = COMMAND_TYPES.function;
  23102. this.identifier = identifier;
  23103. this.return_type = return_type;
  23104. this.return_dimensions = return_dimensions;
  23105. this.parameters_list = parameters_list;
  23106. this.function_comment = function_comment;
  23107. this.category = category;
  23108. };
  23109. var Comment = exports.Comment = function Comment(comment_text) {
  23110. _classCallCheck(this, Comment);
  23111. this.type = COMMAND_TYPES.comment;
  23112. this.comment_text = comment_text;
  23113. };
  23114. var Break = exports.Break = function Break() {
  23115. _classCallCheck(this, Break);
  23116. this.type = COMMAND_TYPES.break;
  23117. };
  23118. var Reader = exports.Reader = function Reader() {
  23119. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  23120. _classCallCheck(this, Reader);
  23121. this.type = COMMAND_TYPES.reader;
  23122. this.variable_value_menu = variable_value_menu;
  23123. };
  23124. var Writer = exports.Writer = function Writer(content) {
  23125. _classCallCheck(this, Writer);
  23126. this.type = COMMAND_TYPES.writer;
  23127. this.content = content;
  23128. };
  23129. var Attribution = exports.Attribution = function Attribution(variable) {
  23130. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23131. _classCallCheck(this, Attribution);
  23132. this.type = COMMAND_TYPES.attribution;
  23133. this.variable = variable;
  23134. this.expression = expression;
  23135. };
  23136. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  23137. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23138. _classCallCheck(this, ExpressionElement);
  23139. this.type_exp = type_exp;
  23140. this.itens = itens;
  23141. };
  23142. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  23143. _classCallCheck(this, ConditionalExpression);
  23144. this.type = EXPRESSION_TYPES.exp_conditional;
  23145. this.expression = expression;
  23146. };
  23147. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  23148. _classCallCheck(this, LogicExpression);
  23149. this.type = EXPRESSION_TYPES.exp_logic;
  23150. this.has_neg = has_neg;
  23151. this.first_operand = first_operand;
  23152. this.second_operand = second_operand;
  23153. this.operator = operator;
  23154. };
  23155. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  23156. _classCallCheck(this, ArithmeticExpression);
  23157. this.type = EXPRESSION_TYPES.exp_arithmetic;
  23158. this.first_operand = first_operand;
  23159. this.second_operand = second_operand;
  23160. this.operator = operator;
  23161. };
  23162. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  23163. _classCallCheck(this, IfTrue);
  23164. this.type = COMMAND_TYPES.iftrue;
  23165. this.expression = expression;
  23166. this.commands_block = commands_block;
  23167. this.commands_else = commands_else;
  23168. };
  23169. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  23170. _classCallCheck(this, RepeatNTimes);
  23171. this.type = COMMAND_TYPES.repeatNtimes;
  23172. this.var_attribution = var_attribution;
  23173. this.var_incrementation = var_incrementation;
  23174. this.expression1 = expression1;
  23175. this.expression2 = expression2;
  23176. this.expression3 = expression3;
  23177. this.commands_block = commands_block;
  23178. };
  23179. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  23180. _classCallCheck(this, WhileTrue);
  23181. this.type = COMMAND_TYPES.whiletrue;
  23182. this.expression = expression;
  23183. this.commands_block = commands_block;
  23184. };
  23185. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  23186. _classCallCheck(this, DoWhileTrue);
  23187. this.type = COMMAND_TYPES.dowhiletrue;
  23188. this.expression = expression;
  23189. this.commands_block = commands_block;
  23190. };
  23191. var Switch = exports.Switch = function Switch(variable) {
  23192. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23193. _classCallCheck(this, Switch);
  23194. this.type = COMMAND_TYPES.switch;
  23195. this.variable = variable;
  23196. this.cases = cases;
  23197. };
  23198. var Return = exports.Return = function Return(variable_value_menu) {
  23199. _classCallCheck(this, Return);
  23200. this.type = COMMAND_TYPES.return;
  23201. this.variable_value_menu = variable_value_menu;
  23202. };
  23203. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  23204. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23205. _classCallCheck(this, SwitchCase);
  23206. this.type = COMMAND_TYPES.switchcase;
  23207. this.variable_value_menu = variable_value_menu;
  23208. this.commands_block = commands_block;
  23209. };
  23210. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  23211. _classCallCheck(this, FunctionCall);
  23212. this.type = COMMAND_TYPES.functioncall;
  23213. this.function_called = function_called;
  23214. this.parameters_list = parameters_list;
  23215. };
  23216. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  23217. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  23218. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  23219. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  23220. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  23221. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  23222. _classCallCheck(this, VariableValueMenu);
  23223. this.type = "var_value";
  23224. this.variable_and_value = variable_and_value;
  23225. this.content = content;
  23226. this.row = row;
  23227. this.column = column;
  23228. this.include_constant = include_constant;
  23229. };
  23230. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  23231. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  23232. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23233. _classCallCheck(this, FunctionCallMenu);
  23234. this.type = "function_call";
  23235. this.function_called = function_called;
  23236. this.parameters_list = parameters_list;
  23237. };
  23238. var Program = exports.Program = function () {
  23239. function Program() {
  23240. _classCallCheck(this, Program);
  23241. this.functions = [];
  23242. this.globals = [];
  23243. }
  23244. _createClass(Program, [{
  23245. key: 'addFunction',
  23246. value: function addFunction(function_to_add) {
  23247. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  23248. AlgorithmManagement.renderAlgorithm();
  23249. }, 1);
  23250. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  23251. AlgorithmManagement.renderAlgorithm();
  23252. }, 1);
  23253. _melankeWatchjs2.default.watch(function_to_add, "name", function () {
  23254. AlgorithmManagement.renderAlgorithm();
  23255. }, 1);
  23256. this.functions.push(function_to_add);
  23257. }
  23258. }, {
  23259. key: 'addVariable',
  23260. value: function addVariable(function_to_receive, variable) {
  23261. if (this.functions[function_to_receive].variable === null) {
  23262. this.functions[function_to_receive].variables_list = [];
  23263. }
  23264. this.functions[function_to_receive].variables_list.push(variable);
  23265. }
  23266. }, {
  23267. key: 'addGlobal',
  23268. value: function addGlobal(variable) {
  23269. this.globals.push(variable);
  23270. }
  23271. }]);
  23272. return Program;
  23273. }();
  23274. /***/ }),
  23275. /***/ "./js/visualUI/ivprog_elements_sidebar.js":
  23276. /*!************************************************!*\
  23277. !*** ./js/visualUI/ivprog_elements_sidebar.js ***!
  23278. \************************************************/
  23279. /*! no static exports found */
  23280. /***/ (function(module, exports, __webpack_require__) {
  23281. "use strict";
  23282. Object.defineProperty(exports, "__esModule", {
  23283. value: true
  23284. });
  23285. exports.Program = exports.FunctionCallMenu = exports.VariableValueMenu = exports.FunctionCall = exports.SwitchCase = exports.Return = exports.Switch = exports.DoWhileTrue = exports.WhileTrue = exports.RepeatNTimes = exports.IfTrue = exports.ArithmeticExpression = exports.LogicExpression = exports.ConditionalExpression = exports.ExpressionElement = exports.Attribution = exports.Writer = exports.Reader = exports.Break = exports.Comment = exports.SystemFunction = exports.Function = exports.Variable = exports.SYSTEM_FUNCTIONS_CATEGORIES = exports.LOGIC_COMPARISON = exports.ARITHMETIC_COMPARISON = exports.EXPRESSION_TYPES = exports.EXPRESSION_ELEMENTS = exports.ARITHMETIC_TYPES = exports.COMMAND_TYPES = undefined;
  23286. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  23287. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23288. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  23289. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  23290. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  23291. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  23292. var _algorithm_sidebar = __webpack_require__(/*! ./algorithm_sidebar */ "./js/visualUI/algorithm_sidebar.js");
  23293. var AlgorithmManagement = _interopRequireWildcard(_algorithm_sidebar);
  23294. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  23295. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  23296. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  23297. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  23298. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  23299. return: "return" });
  23300. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  23301. var EXPRESSION_ELEMENTS = exports.EXPRESSION_ELEMENTS = Object.freeze({ exp_op_exp: "exp_op_exp", op_exp: "op_exp", par_exp_par: "par_exp_par", start_point: "start_point" });
  23302. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  23303. var ARITHMETIC_COMPARISON = exports.ARITHMETIC_COMPARISON = Object.freeze({ greater_than: "greater_than", less_than: "less_than", equals_to: "equals_to", not_equals_to: "not_equals_to", greater_than_or_equals_to: "greater_than_or_equals_to", less_than_or_equals_to: "less_than_or_equals_to" });
  23304. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  23305. var SYSTEM_FUNCTIONS_CATEGORIES = exports.SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({ math: "math", text: "text", arrangement: "arrangement", conversion: "conversion" });
  23306. var Variable = exports.Variable = function Variable(type, name, value) {
  23307. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  23308. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  23309. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  23310. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  23311. _classCallCheck(this, Variable);
  23312. this.type = type;
  23313. this.name = name;
  23314. this.value = value;
  23315. this.dimensions = dimensions;
  23316. this.is_constant = is_constant;
  23317. this.rows = rows;
  23318. this.columns = columns;
  23319. };
  23320. var Function = exports.Function = function Function(name) {
  23321. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  23322. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  23323. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  23324. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  23325. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  23326. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  23327. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  23328. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  23329. _classCallCheck(this, Function);
  23330. this.type = COMMAND_TYPES.function;
  23331. this.name = name;
  23332. this.return_type = return_type;
  23333. this.return_dimensions = return_dimensions;
  23334. this.parameters_list = parameters_list;
  23335. this.is_main = is_main;
  23336. this.is_hidden = is_hidden;
  23337. this.variables_list = variables_list;
  23338. this.function_comment = function_comment;
  23339. this.commands = commands;
  23340. };
  23341. var SystemFunction = exports.SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  23342. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  23343. var category = arguments[5];
  23344. _classCallCheck(this, SystemFunction);
  23345. this.type = COMMAND_TYPES.function;
  23346. this.identifier = identifier;
  23347. this.return_type = return_type;
  23348. this.return_dimensions = return_dimensions;
  23349. this.parameters_list = parameters_list;
  23350. this.function_comment = function_comment;
  23351. this.category = category;
  23352. };
  23353. var Comment = exports.Comment = function Comment(comment_text) {
  23354. _classCallCheck(this, Comment);
  23355. this.type = COMMAND_TYPES.comment;
  23356. this.comment_text = comment_text;
  23357. };
  23358. var Break = exports.Break = function Break() {
  23359. _classCallCheck(this, Break);
  23360. this.type = COMMAND_TYPES.break;
  23361. };
  23362. var Reader = exports.Reader = function Reader() {
  23363. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  23364. _classCallCheck(this, Reader);
  23365. this.type = COMMAND_TYPES.reader;
  23366. this.variable_value_menu = variable_value_menu;
  23367. };
  23368. var Writer = exports.Writer = function Writer(content) {
  23369. _classCallCheck(this, Writer);
  23370. this.type = COMMAND_TYPES.writer;
  23371. this.content = content;
  23372. };
  23373. var Attribution = exports.Attribution = function Attribution(variable) {
  23374. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23375. _classCallCheck(this, Attribution);
  23376. this.type = COMMAND_TYPES.attribution;
  23377. this.variable = variable;
  23378. this.expression = expression;
  23379. };
  23380. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  23381. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23382. _classCallCheck(this, ExpressionElement);
  23383. this.type_exp = type_exp;
  23384. this.itens = itens;
  23385. };
  23386. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  23387. _classCallCheck(this, ConditionalExpression);
  23388. this.type = EXPRESSION_TYPES.exp_conditional;
  23389. this.expression = expression;
  23390. };
  23391. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  23392. _classCallCheck(this, LogicExpression);
  23393. this.type = EXPRESSION_TYPES.exp_logic;
  23394. this.has_neg = has_neg;
  23395. this.first_operand = first_operand;
  23396. this.second_operand = second_operand;
  23397. this.operator = operator;
  23398. };
  23399. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  23400. _classCallCheck(this, ArithmeticExpression);
  23401. this.type = EXPRESSION_TYPES.exp_arithmetic;
  23402. this.first_operand = first_operand;
  23403. this.second_operand = second_operand;
  23404. this.operator = operator;
  23405. };
  23406. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  23407. _classCallCheck(this, IfTrue);
  23408. this.type = COMMAND_TYPES.iftrue;
  23409. this.expression = expression;
  23410. this.commands_block = commands_block;
  23411. this.commands_else = commands_else;
  23412. };
  23413. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  23414. _classCallCheck(this, RepeatNTimes);
  23415. this.type = COMMAND_TYPES.repeatNtimes;
  23416. this.var_attribution = var_attribution;
  23417. this.var_incrementation = var_incrementation;
  23418. this.expression1 = expression1;
  23419. this.expression2 = expression2;
  23420. this.expression3 = expression3;
  23421. this.commands_block = commands_block;
  23422. };
  23423. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  23424. _classCallCheck(this, WhileTrue);
  23425. this.type = COMMAND_TYPES.whiletrue;
  23426. this.expression = expression;
  23427. this.commands_block = commands_block;
  23428. };
  23429. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  23430. _classCallCheck(this, DoWhileTrue);
  23431. this.type = COMMAND_TYPES.dowhiletrue;
  23432. this.expression = expression;
  23433. this.commands_block = commands_block;
  23434. };
  23435. var Switch = exports.Switch = function Switch(variable) {
  23436. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23437. _classCallCheck(this, Switch);
  23438. this.type = COMMAND_TYPES.switch;
  23439. this.variable = variable;
  23440. this.cases = cases;
  23441. };
  23442. var Return = exports.Return = function Return(variable_value_menu) {
  23443. _classCallCheck(this, Return);
  23444. this.type = COMMAND_TYPES.return;
  23445. this.variable_value_menu = variable_value_menu;
  23446. };
  23447. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  23448. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23449. _classCallCheck(this, SwitchCase);
  23450. this.type = COMMAND_TYPES.switchcase;
  23451. this.variable_value_menu = variable_value_menu;
  23452. this.commands_block = commands_block;
  23453. };
  23454. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  23455. _classCallCheck(this, FunctionCall);
  23456. this.type = COMMAND_TYPES.functioncall;
  23457. this.function_called = function_called;
  23458. this.parameters_list = parameters_list;
  23459. };
  23460. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  23461. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  23462. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  23463. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  23464. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  23465. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  23466. _classCallCheck(this, VariableValueMenu);
  23467. this.type = "var_value";
  23468. this.variable_and_value = variable_and_value;
  23469. this.content = content;
  23470. this.row = row;
  23471. this.column = column;
  23472. this.include_constant = include_constant;
  23473. };
  23474. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  23475. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  23476. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23477. _classCallCheck(this, FunctionCallMenu);
  23478. this.type = "function_call";
  23479. this.function_called = function_called;
  23480. this.parameters_list = parameters_list;
  23481. };
  23482. var Program = exports.Program = function () {
  23483. function Program() {
  23484. _classCallCheck(this, Program);
  23485. this.functions = [];
  23486. this.globals = [];
  23487. }
  23488. _createClass(Program, [{
  23489. key: 'addFunction',
  23490. value: function addFunction(function_to_add) {
  23491. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  23492. AlgorithmManagement.renderAlgorithm();
  23493. }, 1);
  23494. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  23495. AlgorithmManagement.renderAlgorithm();
  23496. }, 1);
  23497. _melankeWatchjs2.default.watch(function_to_add, "name", function () {
  23498. AlgorithmManagement.renderAlgorithm();
  23499. }, 1);
  23500. _melankeWatchjs2.default.watch(function_to_add, "return_type", function () {
  23501. AlgorithmManagement.renderAlgorithm();
  23502. }, 1);
  23503. this.functions.push(function_to_add);
  23504. }
  23505. }, {
  23506. key: 'addVariable',
  23507. value: function addVariable(function_to_receive, variable) {
  23508. if (this.functions[function_to_receive].variable === null) {
  23509. this.functions[function_to_receive].variables_list = [];
  23510. }
  23511. this.functions[function_to_receive].variables_list.push(variable);
  23512. }
  23513. }, {
  23514. key: 'addGlobal',
  23515. value: function addGlobal(variable) {
  23516. this.globals.push(variable);
  23517. }
  23518. }]);
  23519. return Program;
  23520. }();
  23521. /***/ }),
  23522. /***/ "./js/visualUI/types.js":
  23523. /*!******************************!*\
  23524. !*** ./js/visualUI/types.js ***!
  23525. \******************************/
  23526. /*! no static exports found */
  23527. /***/ (function(module, exports, __webpack_require__) {
  23528. "use strict";
  23529. Object.defineProperty(exports, "__esModule", {
  23530. value: true
  23531. });
  23532. var Types = exports.Types = Object.freeze({
  23533. INTEGER: "integer",
  23534. REAL: "real",
  23535. TEXT: "text",
  23536. BOOLEAN: "boolean",
  23537. VOID: "void"
  23538. });
  23539. /***/ }),
  23540. /***/ "./js/visualUI/utils.js":
  23541. /*!******************************!*\
  23542. !*** ./js/visualUI/utils.js ***!
  23543. \******************************/
  23544. /*! no static exports found */
  23545. /***/ (function(module, exports, __webpack_require__) {
  23546. "use strict";
  23547. Object.defineProperty(exports, "__esModule", {
  23548. value: true
  23549. });
  23550. exports.renderErrorMessage = renderErrorMessage;
  23551. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23552. var _jquery2 = _interopRequireDefault(_jquery);
  23553. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  23554. function renderErrorMessage(dom_obj_target, message_text) {
  23555. dom_obj_target.popup({
  23556. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  23557. transition: "fade up",
  23558. on: 'click',
  23559. closable: true,
  23560. movePopup: true,
  23561. boundary: window,
  23562. preserve: false,
  23563. target: false,
  23564. className: {
  23565. popup: 'ui popup invalid-identifier'
  23566. },
  23567. onHidden: function onHidden($module) {
  23568. dom_obj_target.popup('destroy');
  23569. }
  23570. }).popup('toggle');
  23571. }
  23572. /***/ }),
  23573. /***/ "./js/visualUI/variables.js":
  23574. /*!**********************************!*\
  23575. !*** ./js/visualUI/variables.js ***!
  23576. \**********************************/
  23577. /*! no static exports found */
  23578. /***/ (function(module, exports, __webpack_require__) {
  23579. "use strict";
  23580. Object.defineProperty(exports, "__esModule", {
  23581. value: true
  23582. });
  23583. exports.addVariable = addVariable;
  23584. exports.renderVariable = renderVariable;
  23585. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23586. var _jquery2 = _interopRequireDefault(_jquery);
  23587. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  23588. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23589. var Models = _interopRequireWildcard(_ivprog_elements);
  23590. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23591. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  23592. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  23593. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  23594. window.jQuery = _jquery2.default;
  23595. var counter_new_variables = 0;
  23596. function addVariable(function_obj, function_container) {
  23597. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  23598. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  23599. if (function_obj.variables_list == null) {
  23600. function_obj.variables_list = [];
  23601. }
  23602. function_obj.variables_list.push(new_var);
  23603. counter_new_variables++;
  23604. var newe = renderVariable(function_container, new_var, function_obj);
  23605. if (is_in_click) {
  23606. newe.css('display', 'none');
  23607. newe.fadeIn();
  23608. }
  23609. }
  23610. function updateName(variable_obj, new_name) {
  23611. variable_obj.name = new_name;
  23612. }
  23613. function removeVariable(variable_obj, variable_container) {
  23614. var function_associated = variable_container.data('associatedFunction');
  23615. var index = function_associated.variables_list.indexOf(variable_obj);
  23616. if (index > -1) {
  23617. window.insertContext = true;
  23618. delete function_associated.variables_list[index];
  23619. function_associated.variables_list.splice(index, 1);
  23620. }
  23621. variable_container.children().off();
  23622. variable_container.off();
  23623. variable_container.fadeOut();
  23624. }
  23625. function updateType(variable_obj, new_type) {
  23626. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  23627. variable_obj.type = new_type;
  23628. variable_obj.dimensions = new_dimensions;
  23629. if (new_dimensions > 0) {
  23630. variable_obj.rows = new_dimensions;
  23631. variable_obj.columns = 2;
  23632. }
  23633. updateInitialValues(variable_obj);
  23634. }
  23635. function addHandlers(variable_obj, variable_container) {
  23636. // Manage variable name:
  23637. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  23638. enableNameUpdate(variable_obj, variable_container);
  23639. });
  23640. // Menu to change type:
  23641. variable_container.find('.ui.dropdown.variable_type').dropdown({
  23642. onChange: function onChange(value, text, $selectedItem) {
  23643. if ($selectedItem.data('dimensions')) {
  23644. updateType(variable_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  23645. } else {
  23646. updateType(variable_obj, _types.Types[$selectedItem.data('type')]);
  23647. }
  23648. renderValues(variable_obj, variable_container);
  23649. }
  23650. });
  23651. // Remove variable:
  23652. variable_container.find(".remove_variable").on('click', function (e) {
  23653. removeVariable(variable_obj, variable_container);
  23654. });
  23655. }
  23656. function renderVariable(function_container, new_var, function_obj) {
  23657. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  23658. element += '<div class="ui dropdown variable_type">';
  23659. if (new_var.dimensions > 0) {
  23660. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  23661. for (var i = 0; i < new_var.dimensions; i++) {
  23662. element += ' [ ] ';
  23663. }
  23664. element += '</div>';
  23665. } else {
  23666. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  23667. }
  23668. element += '<div class="menu">';
  23669. for (var tm in _types.Types) {
  23670. if (tm == _types.Types.VOID.toUpperCase()) {
  23671. continue;
  23672. }
  23673. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  23674. }
  23675. for (var tm in _types.Types) {
  23676. if (tm == _types.Types.VOID.toUpperCase()) {
  23677. continue;
  23678. }
  23679. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  23680. }
  23681. element += '</div></div> ';
  23682. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  23683. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  23684. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  23685. element = (0, _jquery2.default)(element);
  23686. element.data('associatedFunction', function_obj);
  23687. function_container.find('.variables_list_div').append(element);
  23688. addHandlers(new_var, element);
  23689. renderValues(new_var, element);
  23690. return element;
  23691. }
  23692. function updateColumnsAndRowsText(variable_container, variable_var) {
  23693. var prev = variable_container.find('.text').text().split('[');
  23694. if (prev.length == 2) {
  23695. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  23696. variable_container.find('.text').empty();
  23697. variable_container.find('.text').text(ff);
  23698. }
  23699. if (prev.length == 3) {
  23700. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  23701. variable_container.find('.text').empty();
  23702. variable_container.find('.text').text(ff);
  23703. }
  23704. }
  23705. function renderValues(new_var, variable_container) {
  23706. var ret = "";
  23707. var j = 0;
  23708. if (new_var.dimensions == 0) {
  23709. if (new_var.type == _types.Types.REAL) {
  23710. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  23711. } else {
  23712. if (new_var.type == _types.Types.BOOLEAN) {
  23713. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value) + '</span> </div> ';
  23714. } else {
  23715. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  23716. }
  23717. }
  23718. } else {
  23719. ret += '<table class="tabela_var">';
  23720. if (new_var.dimensions == 1) {
  23721. ret += '<tr>';
  23722. if (new_var.type == _types.Types.REAL) {
  23723. for (var k = 0; k < new_var.columns; k++) {
  23724. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  23725. }
  23726. } else {
  23727. for (var k = 0; k < new_var.columns; k++) {
  23728. if (new_var.type == _types.Types.BOOLEAN) {
  23729. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[k]) + '</span></td>';
  23730. } else {
  23731. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  23732. }
  23733. }
  23734. }
  23735. ret += '</tr>';
  23736. ret += '</table>';
  23737. 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>';
  23738. }
  23739. if (new_var.dimensions == 2) {
  23740. if (new_var.type == _types.Types.REAL) {
  23741. for (var l = 0; l < new_var.rows; l++) {
  23742. ret += '<tr>';
  23743. for (var k = 0; k < new_var.columns; k++) {
  23744. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  23745. }
  23746. ret += '</tr>';
  23747. }
  23748. } else {
  23749. for (var l = 0; l < new_var.rows; l++) {
  23750. ret += '<tr>';
  23751. for (var k = 0; k < new_var.columns; k++) {
  23752. if (new_var.type == _types.Types.BOOLEAN) {
  23753. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[l][k]) + '</span></td>';
  23754. } else {
  23755. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  23756. }
  23757. }
  23758. ret += '</tr>';
  23759. }
  23760. }
  23761. if (new_var.rows == 0) {
  23762. ret += '<tr><td></td></tr>';
  23763. }
  23764. 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>';
  23765. ret += '</table>';
  23766. 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>';
  23767. }
  23768. }
  23769. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  23770. ret = (0, _jquery2.default)(ret);
  23771. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  23772. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  23773. alternateBooleanValue(new_var, this.parentNode);
  23774. });
  23775. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  23776. enableValueUpdate(new_var, this.parentNode);
  23777. });
  23778. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  23779. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  23780. });
  23781. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  23782. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  23783. });
  23784. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  23785. removeColumnVector(new_var);
  23786. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  23787. renderValues(new_var, variable_container);
  23788. });
  23789. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  23790. addColumnVector(new_var);
  23791. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  23792. renderValues(new_var, variable_container);
  23793. });
  23794. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  23795. removeColumnMatrix(new_var);
  23796. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  23797. renderValues(new_var, variable_container);
  23798. });
  23799. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  23800. addColumnMatrix(new_var);
  23801. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  23802. renderValues(new_var, variable_container);
  23803. });
  23804. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  23805. removeLineMatrix(new_var);
  23806. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  23807. renderValues(new_var, variable_container);
  23808. });
  23809. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  23810. addLineMatrix(new_var);
  23811. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  23812. renderValues(new_var, variable_container);
  23813. });
  23814. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  23815. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  23816. });
  23817. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  23818. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  23819. });
  23820. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  23821. updateColumnsAndRowsText(variable_container, new_var);
  23822. }
  23823. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  23824. var_obj.value[row][index] = !var_obj.value[row][index];
  23825. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[row][index]));
  23826. }
  23827. function addLineMatrix(var_obj) {
  23828. var_obj.rows++;
  23829. if (var_obj.type == _types.Types.INTEGER) {
  23830. var n_l = [];
  23831. for (var i = 0; i < var_obj.columns; i++) {
  23832. n_l.push(1);
  23833. }
  23834. var_obj.value.push(n_l);
  23835. }
  23836. if (var_obj.type == _types.Types.REAL) {
  23837. var n_l = [];
  23838. for (i = 0; i < var_obj.columns; i++) {
  23839. n_l.push(1.0);
  23840. }
  23841. var_obj.value.push(n_l);
  23842. }
  23843. if (var_obj.type == _types.Types.TEXT) {
  23844. var n_l = [];
  23845. for (i = 0; i < var_obj.columns; i++) {
  23846. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  23847. }
  23848. var_obj.value.push(n_l);
  23849. }
  23850. if (var_obj.type == _types.Types.BOOLEAN) {
  23851. var n_l = [];
  23852. for (i = 0; i < var_obj.columns; i++) {
  23853. n_l.push(true);
  23854. }
  23855. var_obj.value.push(n_l);
  23856. }
  23857. }
  23858. function removeLineMatrix(var_obj) {
  23859. if (var_obj.rows == 0) {
  23860. return;
  23861. }
  23862. var_obj.rows--;
  23863. var_obj.value.splice(var_obj.value.length - 1, 1);
  23864. }
  23865. function addColumnMatrix(var_obj) {
  23866. var_obj.columns++;
  23867. if (var_obj.type == _types.Types.INTEGER) {
  23868. for (var i = 0; i < var_obj.rows; i++) {
  23869. var_obj.value[i].push(1);
  23870. }
  23871. }
  23872. if (var_obj.type == _types.Types.REAL) {
  23873. for (var i = 0; i < var_obj.rows; i++) {
  23874. var_obj.value[i].push(1.0);
  23875. }
  23876. }
  23877. if (var_obj.type == _types.Types.TEXT) {
  23878. for (var i = 0; i < var_obj.rows; i++) {
  23879. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  23880. }
  23881. }
  23882. if (var_obj.type == _types.Types.BOOLEAN) {
  23883. for (var i = 0; i < var_obj.rows; i++) {
  23884. var_obj.value[i].push(true);
  23885. }
  23886. }
  23887. }
  23888. function removeColumnMatrix(var_obj) {
  23889. if (var_obj.columns == 0) {
  23890. return;
  23891. }
  23892. var_obj.columns--;
  23893. for (var i = 0; i < var_obj.rows; i++) {
  23894. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  23895. }
  23896. }
  23897. function addColumnVector(var_obj) {
  23898. var_obj.columns++;
  23899. if (var_obj.type == _types.Types.INTEGER) {
  23900. var_obj.value.push(1);
  23901. }
  23902. if (var_obj.type == _types.Types.REAL) {
  23903. var_obj.value.push(1.0);
  23904. }
  23905. if (var_obj.type == _types.Types.TEXT) {
  23906. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  23907. }
  23908. if (var_obj.type == _types.Types.BOOLEAN) {
  23909. var_obj.value.push(true);
  23910. }
  23911. }
  23912. function removeColumnVector(var_obj) {
  23913. if (var_obj.columns == 0) {
  23914. return;
  23915. }
  23916. var_obj.columns--;
  23917. var_obj.value.splice(var_obj.value.length - 1, 1);
  23918. }
  23919. function alternateBooleanValue(var_obj, value_container) {
  23920. var_obj.value = !var_obj.value;
  23921. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value));
  23922. }
  23923. function alternateBooleanVectorValue(var_obj, index, value_container) {
  23924. var_obj.value[index] = !var_obj.value[index];
  23925. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[index]));
  23926. }
  23927. function updateInitialValues(variable_obj) {
  23928. if (variable_obj.type == _types.Types.INTEGER) {
  23929. if (variable_obj.dimensions == 0) {
  23930. variable_obj.value = 1;
  23931. }
  23932. if (variable_obj.dimensions == 1) {
  23933. variable_obj.value = [1, 1];
  23934. }
  23935. if (variable_obj.dimensions == 2) {
  23936. variable_obj.value = [[1, 1], [1, 1]];
  23937. }
  23938. }
  23939. if (variable_obj.type == _types.Types.REAL) {
  23940. if (variable_obj.dimensions == 0) {
  23941. variable_obj.value = 1.0;
  23942. }
  23943. if (variable_obj.dimensions == 1) {
  23944. variable_obj.value = [1.0, 1.0];
  23945. }
  23946. if (variable_obj.dimensions == 2) {
  23947. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  23948. }
  23949. }
  23950. if (variable_obj.type == _types.Types.TEXT) {
  23951. if (variable_obj.dimensions == 0) {
  23952. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  23953. }
  23954. if (variable_obj.dimensions == 1) {
  23955. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  23956. }
  23957. if (variable_obj.dimensions == 2) {
  23958. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  23959. }
  23960. }
  23961. if (variable_obj.type == _types.Types.BOOLEAN) {
  23962. if (variable_obj.dimensions == 0) {
  23963. variable_obj.value = true;
  23964. }
  23965. if (variable_obj.dimensions == 1) {
  23966. variable_obj.value = [true, true];
  23967. }
  23968. if (variable_obj.dimensions == 2) {
  23969. variable_obj.value = [[true, true], [true, true]];
  23970. }
  23971. }
  23972. }
  23973. var opened_name_value_vector_global_ = false;
  23974. var opened_input_value_vector_global_ = null;
  23975. function enableVectorValueUpdate(var_obj, index, parent_node) {
  23976. if (opened_name_value_vector_global_) {
  23977. opened_input_value_vector_global_.focus();
  23978. return;
  23979. }
  23980. parent_node = (0, _jquery2.default)(parent_node);
  23981. opened_name_value_vector_global_ = true;
  23982. parent_node.find('.span_value_variable').text('');
  23983. var input_field;
  23984. if (var_obj.type == _types.Types.REAL) {
  23985. input_field = (0, _jquery2.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) + "' />");
  23986. input_field.insertBefore(parent_node.find('.span_value_variable'));
  23987. } else {
  23988. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
  23989. input_field.insertBefore(parent_node.find('.span_value_variable'));
  23990. }
  23991. input_field.on('input', function () {
  23992. var inputWidth = input_field.textWidth() + 10;
  23993. opened_input_value_vector_global_ = input_field;
  23994. input_field.focus();
  23995. var tmpStr = input_field.val();
  23996. input_field.val('');
  23997. input_field.val(tmpStr);
  23998. input_field.css({
  23999. width: inputWidth
  24000. });
  24001. }).trigger('input');
  24002. input_field.focusout(function () {
  24003. /// update array:
  24004. if (input_field.val().trim()) {
  24005. if (var_obj.type == _types.Types.REAL) {
  24006. var_obj.value[index] = parseFloat(input_field.val().trim());
  24007. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  24008. } else {
  24009. if (var_obj.type == _types.Types.INTEGER) {
  24010. var_obj.value[index] = parseInt(input_field.val().trim());
  24011. } else {
  24012. var_obj.value[index] = input_field.val().trim();
  24013. }
  24014. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  24015. }
  24016. } else {
  24017. if (var_obj.type == _types.Types.REAL) {
  24018. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  24019. } else {
  24020. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  24021. }
  24022. }
  24023. if (var_obj.type == _types.Types.TEXT) {
  24024. var_obj.value[index] = input_field.val();
  24025. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  24026. }
  24027. input_field.off();
  24028. input_field.remove();
  24029. /// update elements:
  24030. opened_name_value_vector_global_ = false;
  24031. opened_input_value_vector_global_ = false;
  24032. });
  24033. input_field.on('keydown', function (e) {
  24034. var code = e.keyCode || e.which;
  24035. if (code == 13) {
  24036. if (input_field.val().trim()) {
  24037. if (var_obj.type == _types.Types.REAL) {
  24038. var_obj.value[index] = parseFloat(input_field.val().trim());
  24039. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  24040. } else {
  24041. if (var_obj.type == _types.Types.INTEGER) {
  24042. var_obj.value[index] = parseInt(input_field.val().trim());
  24043. } else {
  24044. var_obj.value[index] = input_field.val().trim();
  24045. }
  24046. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  24047. }
  24048. } else {
  24049. if (var_obj.type == _types.Types.REAL) {
  24050. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  24051. } else {
  24052. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  24053. }
  24054. }
  24055. if (var_obj.type == _types.Types.TEXT) {
  24056. var_obj.value[index] = input_field.val();
  24057. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  24058. }
  24059. input_field.off();
  24060. input_field.remove();
  24061. /// update elements:
  24062. opened_name_value_vector_global_ = false;
  24063. opened_input_value_vector_global_ = false;
  24064. }
  24065. if (code == 27) {
  24066. if (var_obj.type == _types.Types.REAL) {
  24067. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  24068. } else {
  24069. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  24070. }
  24071. input_field.off();
  24072. input_field.remove();
  24073. /// update elements:
  24074. opened_name_value_vector_global_ = false;
  24075. opened_input_value_vector_global_ = false;
  24076. }
  24077. });
  24078. input_field.select();
  24079. }
  24080. var opened_name_value_global_var = false;
  24081. var opened_input_value_global_ar = null;
  24082. function enableValueUpdate(var_obj, parent_node) {
  24083. if (opened_name_value_global_var) {
  24084. opened_input_value_global_ar.focus();
  24085. return;
  24086. }
  24087. parent_node = (0, _jquery2.default)(parent_node);
  24088. opened_name_value_global_var = true;
  24089. var input_field;
  24090. parent_node.find('.span_value_variable').text('');
  24091. if (var_obj.type == _types.Types.REAL) {
  24092. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value.toFixed(1) + "' />");
  24093. input_field.insertBefore(parent_node.find('.span_value_variable'));
  24094. } else {
  24095. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  24096. input_field.insertBefore(parent_node.find('.span_value_variable'));
  24097. }
  24098. input_field.on('input', function () {
  24099. var inputWidth = input_field.textWidth() + 10;
  24100. opened_input_value_global_ar = input_field;
  24101. input_field.focus();
  24102. var tmpStr = input_field.val();
  24103. input_field.val('');
  24104. input_field.val(tmpStr);
  24105. input_field.css({
  24106. width: inputWidth
  24107. });
  24108. }).trigger('input');
  24109. input_field.focusout(function () {
  24110. /// update array:
  24111. if (input_field.val().trim()) {
  24112. if (var_obj.type == _types.Types.REAL) {
  24113. var_obj.value = parseFloat(input_field.val().trim());
  24114. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  24115. } else {
  24116. if (var_obj.type == _types.Types.INTEGER) {
  24117. var_obj.value = parseInt(input_field.val().trim());
  24118. } else {
  24119. var_obj.value = input_field.val().trim();
  24120. }
  24121. parent_node.find('.span_value_variable').text(var_obj.value);
  24122. }
  24123. } else {
  24124. if (var_obj.type == _types.Types.REAL) {
  24125. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  24126. } else {
  24127. parent_node.find('.span_value_variable').text(var_obj.value);
  24128. }
  24129. }
  24130. if (var_obj.type == _types.Types.TEXT) {
  24131. var_obj.value = input_field.val();
  24132. parent_node.find('.span_value_variable').text(var_obj.value);
  24133. }
  24134. input_field.off();
  24135. input_field.remove();
  24136. /// update elements:
  24137. opened_name_value_global_var = false;
  24138. opened_input_value_global_ar = false;
  24139. });
  24140. input_field.on('keydown', function (e) {
  24141. var code = e.keyCode || e.which;
  24142. if (code == 13) {
  24143. if (input_field.val().trim()) {
  24144. if (var_obj.type == _types.Types.REAL) {
  24145. var_obj.value = parseFloat(input_field.val().trim());
  24146. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  24147. } else {
  24148. if (var_obj.type == _types.Types.INTEGER) {
  24149. var_obj.value = parseInt(input_field.val().trim());
  24150. } else {
  24151. var_obj.value = input_field.val().trim();
  24152. }
  24153. parent_node.find('.span_value_variable').text(var_obj.value);
  24154. }
  24155. } else {
  24156. if (var_obj.type == _types.Types.REAL) {
  24157. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  24158. } else {
  24159. parent_node.find('.span_value_variable').text(var_obj.value);
  24160. }
  24161. }
  24162. if (var_obj.type == _types.Types.TEXT) {
  24163. var_obj.value = input_field.val();
  24164. parent_node.find('.span_value_variable').text(var_obj.value);
  24165. }
  24166. input_field.off();
  24167. input_field.remove();
  24168. /// update elements:
  24169. opened_name_value_global_var = false;
  24170. opened_input_value_global_ar = false;
  24171. }
  24172. if (code == 27) {
  24173. if (var_obj.type == _types.Types.REAL) {
  24174. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  24175. } else {
  24176. parent_node.find('.span_value_variable').text(var_obj.value);
  24177. }
  24178. input_field.off();
  24179. input_field.remove();
  24180. /// update elements:
  24181. opened_name_value_global_var = false;
  24182. opened_input_value_global_ar = false;
  24183. }
  24184. });
  24185. input_field.select();
  24186. }
  24187. var opened_name_global = false;
  24188. var opened_input_global = null;
  24189. function enableNameUpdate(variable_obj, variable_container) {
  24190. if (opened_name_global) {
  24191. opened_input_global.focus();
  24192. return;
  24193. }
  24194. opened_name_global = true;
  24195. variable_container.find('.span_name_variable').text('');
  24196. var input_name;
  24197. input_name = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  24198. input_name.insertBefore(variable_container.find('.span_name_variable'));
  24199. input_name.on('input', function () {
  24200. var inputWidth = input_name.textWidth() + 10;
  24201. opened_input_global = input_name;
  24202. input_name.focus();
  24203. var tmpStr = input_name.val();
  24204. input_name.val('');
  24205. input_name.val(tmpStr);
  24206. input_name.css({
  24207. width: inputWidth
  24208. });
  24209. }).trigger('input');
  24210. input_name.focusout(function () {
  24211. /// update array:
  24212. if (input_name.val().trim().length > 0) {
  24213. updateName(variable_obj, input_name.val().trim());
  24214. variable_container.find('.span_name_variable').text(variable_obj.name);
  24215. } else {
  24216. variable_container.find('.span_name_variable').text(variable_obj.name);
  24217. }
  24218. input_name.off();
  24219. input_name.remove();
  24220. /// update elements:
  24221. opened_name_global = false;
  24222. opened_input_global = false;
  24223. });
  24224. input_name.on('keydown', function (e) {
  24225. var code = e.keyCode || e.which;
  24226. if (code == 13) {
  24227. if (input_name.val().trim().length > 0) {
  24228. updateName(variable_obj, input_name.val().trim());
  24229. variable_container.find('.span_name_variable').text(variable_obj.name);
  24230. } else {
  24231. variable_container.find('.span_name_variable').text(variable_obj.name);
  24232. }
  24233. input_name.off();
  24234. input_name.remove();
  24235. /// update elements:
  24236. opened_name_global = false;
  24237. opened_input_global = false;
  24238. }
  24239. if (code == 27) {
  24240. variable_container.find('.span_name_variable').text(variable_obj.name);
  24241. input_name.off();
  24242. input_name.remove();
  24243. /// update elements:
  24244. opened_name_global = false;
  24245. opened_input_global = false;
  24246. }
  24247. });
  24248. input_name.select();
  24249. }
  24250. var opened_name_value_matrix_global_v = false;
  24251. var opened_input_value_matrix_global_v = null;
  24252. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  24253. if (opened_name_value_matrix_global_v) {
  24254. opened_input_value_matrix_global_v.focus();
  24255. return;
  24256. }
  24257. parent_node = (0, _jquery2.default)(parent_node);
  24258. opened_name_value_matrix_global_v = true;
  24259. parent_node.find('.span_value_variable').text('');
  24260. var input_field;
  24261. if (var_obj.type == _types.Types.REAL) {
  24262. input_field = (0, _jquery2.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) + "' />");
  24263. input_field.insertBefore(parent_node.find('.span_value_variable'));
  24264. } else {
  24265. input_field = (0, _jquery2.default)("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index] + "' />");
  24266. input_field.insertBefore(parent_node.find('.span_value_variable'));
  24267. }
  24268. input_field.on('input', function () {
  24269. var inputWidth = input_field.textWidth() + 10;
  24270. opened_input_value_matrix_global_v = input_field;
  24271. input_field.focus();
  24272. var tmpStr = input_field.val();
  24273. input_field.val('');
  24274. input_field.val(tmpStr);
  24275. input_field.css({
  24276. width: inputWidth
  24277. });
  24278. }).trigger('input');
  24279. input_field.focusout(function () {
  24280. /// update array:
  24281. if (input_field.val().trim()) {
  24282. if (var_obj.type == _types.Types.REAL) {
  24283. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  24284. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  24285. } else {
  24286. if (var_obj.type == _types.Types.INTEGER) {
  24287. var_obj.value[row][index] = parseInt(input_field.val().trim());
  24288. } else {
  24289. var_obj.value[row][index] = input_field.val().trim();
  24290. }
  24291. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  24292. }
  24293. } else {
  24294. if (var_obj.type == _types.Types.REAL) {
  24295. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  24296. } else {
  24297. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  24298. }
  24299. }
  24300. if (var_obj.type == _types.Types.TEXT) {
  24301. var_obj.value[row][index] = input_field.val();
  24302. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  24303. }
  24304. input_field.off();
  24305. input_field.remove();
  24306. /// update elements:
  24307. opened_name_value_matrix_global_v = false;
  24308. opened_input_value_matrix_global_v = false;
  24309. });
  24310. input_field.on('keydown', function (e) {
  24311. var code = e.keyCode || e.which;
  24312. if (code == 13) {
  24313. if (input_field.val().trim()) {
  24314. if (var_obj.type == _types.Types.REAL) {
  24315. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  24316. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  24317. } else {
  24318. if (var_obj.type == _types.Types.INTEGER) {
  24319. var_obj.value[row][index] = parseInt(input_field.val().trim());
  24320. } else {
  24321. var_obj.value[row][index] = input_field.val().trim();
  24322. }
  24323. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  24324. }
  24325. } else {
  24326. if (var_obj.type == _types.Types.REAL) {
  24327. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  24328. } else {
  24329. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  24330. }
  24331. }
  24332. if (var_obj.type == _types.Types.TEXT) {
  24333. var_obj.value[row][index] = input_field.val();
  24334. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  24335. }
  24336. input_field.off();
  24337. input_field.remove();
  24338. /// update elements:
  24339. opened_name_value_matrix_global_v = false;
  24340. opened_input_value_matrix_global_v = false;
  24341. }
  24342. if (code == 27) {
  24343. if (var_obj.type == _types.Types.REAL) {
  24344. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  24345. } else {
  24346. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  24347. }
  24348. input_field.off();
  24349. input_field.remove();
  24350. /// update elements:
  24351. opened_name_value_matrix_global_v = false;
  24352. opened_input_value_matrix_global_v = false;
  24353. }
  24354. });
  24355. input_field.select();
  24356. }
  24357. /***/ }),
  24358. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  24359. /*!****************************************************!*\
  24360. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  24361. \****************************************************/
  24362. /*! no static exports found */
  24363. /***/ (function(module, exports, __webpack_require__) {
  24364. "use strict";
  24365. //
  24366. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24367. * Use of this file is governed by the BSD 3-clause license that
  24368. * can be found in the LICENSE.txt file in the project root.
  24369. */
  24370. // This implementation of {@link TokenStream} loads tokens from a
  24371. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  24372. // access to any previous token by index.
  24373. //
  24374. // <p>
  24375. // This token stream ignores the value of {@link Token//getChannel}. If your
  24376. // parser requires the token stream filter tokens to only those on a particular
  24377. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  24378. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  24379. // {@link CommonTokenStream}.</p>
  24380. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  24381. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  24382. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  24383. // this is just to keep meaningful parameter types to Parser
  24384. function TokenStream() {
  24385. return this;
  24386. }
  24387. function BufferedTokenStream(tokenSource) {
  24388. TokenStream.call(this);
  24389. // The {@link TokenSource} from which tokens for this stream are fetched.
  24390. this.tokenSource = tokenSource;
  24391. // A collection of all tokens fetched from the token source. The list is
  24392. // considered a complete view of the input once {@link //fetchedEOF} is set
  24393. // to {@code true}.
  24394. this.tokens = [];
  24395. // The index into {@link //tokens} of the current token (next token to
  24396. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  24397. // be
  24398. // {@link //LT LT(1)}.
  24399. //
  24400. // <p>This field is set to -1 when the stream is first constructed or when
  24401. // {@link //setTokenSource} is called, indicating that the first token has
  24402. // not yet been fetched from the token source. For additional information,
  24403. // see the documentation of {@link IntStream} for a description of
  24404. // Initializing Methods.</p>
  24405. this.index = -1;
  24406. // Indicates whether the {@link Token//EOF} token has been fetched from
  24407. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  24408. // performance for the following cases:
  24409. //
  24410. // <ul>
  24411. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  24412. // prevent
  24413. // consuming the EOF symbol is optimized by checking the values of
  24414. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  24415. // //LA}.</li>
  24416. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  24417. // into
  24418. // {@link //tokens} is trivial with this field.</li>
  24419. // <ul>
  24420. this.fetchedEOF = false;
  24421. return this;
  24422. }
  24423. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  24424. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  24425. BufferedTokenStream.prototype.mark = function () {
  24426. return 0;
  24427. };
  24428. BufferedTokenStream.prototype.release = function (marker) {
  24429. // no resources to release
  24430. };
  24431. BufferedTokenStream.prototype.reset = function () {
  24432. this.seek(0);
  24433. };
  24434. BufferedTokenStream.prototype.seek = function (index) {
  24435. this.lazyInit();
  24436. this.index = this.adjustSeekIndex(index);
  24437. };
  24438. BufferedTokenStream.prototype.get = function (index) {
  24439. this.lazyInit();
  24440. return this.tokens[index];
  24441. };
  24442. BufferedTokenStream.prototype.consume = function () {
  24443. var skipEofCheck = false;
  24444. if (this.index >= 0) {
  24445. if (this.fetchedEOF) {
  24446. // the last token in tokens is EOF. skip check if p indexes any
  24447. // fetched token except the last.
  24448. skipEofCheck = this.index < this.tokens.length - 1;
  24449. } else {
  24450. // no EOF token in tokens. skip check if p indexes a fetched token.
  24451. skipEofCheck = this.index < this.tokens.length;
  24452. }
  24453. } else {
  24454. // not yet initialized
  24455. skipEofCheck = false;
  24456. }
  24457. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  24458. throw "cannot consume EOF";
  24459. }
  24460. if (this.sync(this.index + 1)) {
  24461. this.index = this.adjustSeekIndex(this.index + 1);
  24462. }
  24463. };
  24464. // Make sure index {@code i} in tokens has a token.
  24465. //
  24466. // @return {@code true} if a token is located at index {@code i}, otherwise
  24467. // {@code false}.
  24468. // @see //get(int i)
  24469. // /
  24470. BufferedTokenStream.prototype.sync = function (i) {
  24471. var n = i - this.tokens.length + 1; // how many more elements we need?
  24472. if (n > 0) {
  24473. var fetched = this.fetch(n);
  24474. return fetched >= n;
  24475. }
  24476. return true;
  24477. };
  24478. // Add {@code n} elements to buffer.
  24479. //
  24480. // @return The actual number of elements added to the buffer.
  24481. // /
  24482. BufferedTokenStream.prototype.fetch = function (n) {
  24483. if (this.fetchedEOF) {
  24484. return 0;
  24485. }
  24486. for (var i = 0; i < n; i++) {
  24487. var t = this.tokenSource.nextToken();
  24488. t.tokenIndex = this.tokens.length;
  24489. this.tokens.push(t);
  24490. if (t.type === Token.EOF) {
  24491. this.fetchedEOF = true;
  24492. return i + 1;
  24493. }
  24494. }
  24495. return n;
  24496. };
  24497. // Get all tokens from start..stop inclusively///
  24498. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  24499. if (types === undefined) {
  24500. types = null;
  24501. }
  24502. if (start < 0 || stop < 0) {
  24503. return null;
  24504. }
  24505. this.lazyInit();
  24506. var subset = [];
  24507. if (stop >= this.tokens.length) {
  24508. stop = this.tokens.length - 1;
  24509. }
  24510. for (var i = start; i < stop; i++) {
  24511. var t = this.tokens[i];
  24512. if (t.type === Token.EOF) {
  24513. break;
  24514. }
  24515. if (types === null || types.contains(t.type)) {
  24516. subset.push(t);
  24517. }
  24518. }
  24519. return subset;
  24520. };
  24521. BufferedTokenStream.prototype.LA = function (i) {
  24522. return this.LT(i).type;
  24523. };
  24524. BufferedTokenStream.prototype.LB = function (k) {
  24525. if (this.index - k < 0) {
  24526. return null;
  24527. }
  24528. return this.tokens[this.index - k];
  24529. };
  24530. BufferedTokenStream.prototype.LT = function (k) {
  24531. this.lazyInit();
  24532. if (k === 0) {
  24533. return null;
  24534. }
  24535. if (k < 0) {
  24536. return this.LB(-k);
  24537. }
  24538. var i = this.index + k - 1;
  24539. this.sync(i);
  24540. if (i >= this.tokens.length) {
  24541. // return EOF token
  24542. // EOF must be last token
  24543. return this.tokens[this.tokens.length - 1];
  24544. }
  24545. return this.tokens[i];
  24546. };
  24547. // Allowed derived classes to modify the behavior of operations which change
  24548. // the current stream position by adjusting the target token index of a seek
  24549. // operation. The default implementation simply returns {@code i}. If an
  24550. // exception is thrown in this method, the current stream index should not be
  24551. // changed.
  24552. //
  24553. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  24554. // that
  24555. // the seek target is always an on-channel token.</p>
  24556. //
  24557. // @param i The target token index.
  24558. // @return The adjusted target token index.
  24559. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  24560. return i;
  24561. };
  24562. BufferedTokenStream.prototype.lazyInit = function () {
  24563. if (this.index === -1) {
  24564. this.setup();
  24565. }
  24566. };
  24567. BufferedTokenStream.prototype.setup = function () {
  24568. this.sync(0);
  24569. this.index = this.adjustSeekIndex(0);
  24570. };
  24571. // Reset this token stream by setting its token source.///
  24572. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  24573. this.tokenSource = tokenSource;
  24574. this.tokens = [];
  24575. this.index = -1;
  24576. this.fetchedEOF = false;
  24577. };
  24578. // Given a starting index, return the index of the next token on channel.
  24579. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  24580. // on channel between i and EOF.
  24581. // /
  24582. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  24583. this.sync(i);
  24584. if (i >= this.tokens.length) {
  24585. return -1;
  24586. }
  24587. var token = this.tokens[i];
  24588. while (token.channel !== this.channel) {
  24589. if (token.type === Token.EOF) {
  24590. return -1;
  24591. }
  24592. i += 1;
  24593. this.sync(i);
  24594. token = this.tokens[i];
  24595. }
  24596. return i;
  24597. };
  24598. // Given a starting index, return the index of the previous token on channel.
  24599. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  24600. // on channel between i and 0.
  24601. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  24602. while (i >= 0 && this.tokens[i].channel !== channel) {
  24603. i -= 1;
  24604. }
  24605. return i;
  24606. };
  24607. // Collect all tokens on specified channel to the right of
  24608. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  24609. // EOF. If channel is -1, find any non default channel token.
  24610. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  24611. if (channel === undefined) {
  24612. channel = -1;
  24613. }
  24614. this.lazyInit();
  24615. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  24616. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  24617. }
  24618. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  24619. var from_ = tokenIndex + 1;
  24620. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  24621. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  24622. return this.filterForChannel(from_, to, channel);
  24623. };
  24624. // Collect all tokens on specified channel to the left of
  24625. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  24626. // If channel is -1, find any non default channel token.
  24627. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  24628. if (channel === undefined) {
  24629. channel = -1;
  24630. }
  24631. this.lazyInit();
  24632. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  24633. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  24634. }
  24635. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  24636. if (prevOnChannel === tokenIndex - 1) {
  24637. return null;
  24638. }
  24639. // if none on channel to left, prevOnChannel=-1 then from=0
  24640. var from_ = prevOnChannel + 1;
  24641. var to = tokenIndex - 1;
  24642. return this.filterForChannel(from_, to, channel);
  24643. };
  24644. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  24645. var hidden = [];
  24646. for (var i = left; i < right + 1; i++) {
  24647. var t = this.tokens[i];
  24648. if (channel === -1) {
  24649. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  24650. hidden.push(t);
  24651. }
  24652. } else if (t.channel === channel) {
  24653. hidden.push(t);
  24654. }
  24655. }
  24656. if (hidden.length === 0) {
  24657. return null;
  24658. }
  24659. return hidden;
  24660. };
  24661. BufferedTokenStream.prototype.getSourceName = function () {
  24662. return this.tokenSource.getSourceName();
  24663. };
  24664. // Get the text of all tokens in this buffer.///
  24665. BufferedTokenStream.prototype.getText = function (interval) {
  24666. this.lazyInit();
  24667. this.fill();
  24668. if (interval === undefined || interval === null) {
  24669. interval = new Interval(0, this.tokens.length - 1);
  24670. }
  24671. var start = interval.start;
  24672. if (start instanceof Token) {
  24673. start = start.tokenIndex;
  24674. }
  24675. var stop = interval.stop;
  24676. if (stop instanceof Token) {
  24677. stop = stop.tokenIndex;
  24678. }
  24679. if (start === null || stop === null || start < 0 || stop < 0) {
  24680. return "";
  24681. }
  24682. if (stop >= this.tokens.length) {
  24683. stop = this.tokens.length - 1;
  24684. }
  24685. var s = "";
  24686. for (var i = start; i < stop + 1; i++) {
  24687. var t = this.tokens[i];
  24688. if (t.type === Token.EOF) {
  24689. break;
  24690. }
  24691. s = s + t.text;
  24692. }
  24693. return s;
  24694. };
  24695. // Get all tokens from lexer until EOF///
  24696. BufferedTokenStream.prototype.fill = function () {
  24697. this.lazyInit();
  24698. while (this.fetch(1000) === 1000) {
  24699. continue;
  24700. }
  24701. };
  24702. exports.BufferedTokenStream = BufferedTokenStream;
  24703. /***/ }),
  24704. /***/ "./node_modules/antlr4/CharStreams.js":
  24705. /*!********************************************!*\
  24706. !*** ./node_modules/antlr4/CharStreams.js ***!
  24707. \********************************************/
  24708. /*! no static exports found */
  24709. /***/ (function(module, exports, __webpack_require__) {
  24710. "use strict";
  24711. //
  24712. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24713. * Use of this file is governed by the BSD 3-clause license that
  24714. * can be found in the LICENSE.txt file in the project root.
  24715. */
  24716. //
  24717. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  24718. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  24719. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  24720. // Utility functions to create InputStreams from various sources.
  24721. //
  24722. // All returned InputStreams support the full range of Unicode
  24723. // up to U+10FFFF (the default behavior of InputStream only supports
  24724. // code points up to U+FFFF).
  24725. var CharStreams = {
  24726. // Creates an InputStream from a string.
  24727. fromString: function fromString(str) {
  24728. return new InputStream(str, true);
  24729. },
  24730. // Asynchronously creates an InputStream from a blob given the
  24731. // encoding of the bytes in that blob (defaults to 'utf8' if
  24732. // encoding is null).
  24733. //
  24734. // Invokes onLoad(result) on success, onError(error) on
  24735. // failure.
  24736. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  24737. var reader = FileReader();
  24738. reader.onload = function (e) {
  24739. var is = new InputStream(e.target.result, true);
  24740. onLoad(is);
  24741. };
  24742. reader.onerror = onError;
  24743. reader.readAsText(blob, encoding);
  24744. },
  24745. // Creates an InputStream from a Buffer given the
  24746. // encoding of the bytes in that buffer (defaults to 'utf8' if
  24747. // encoding is null).
  24748. fromBuffer: function fromBuffer(buffer, encoding) {
  24749. return new InputStream(buffer.toString(encoding), true);
  24750. },
  24751. // Asynchronously creates an InputStream from a file on disk given
  24752. // the encoding of the bytes in that file (defaults to 'utf8' if
  24753. // encoding is null).
  24754. //
  24755. // Invokes callback(error, result) on completion.
  24756. fromPath: function fromPath(path, encoding, callback) {
  24757. fs.readFile(path, encoding, function (err, data) {
  24758. var is = null;
  24759. if (data !== null) {
  24760. is = new InputStream(data, true);
  24761. }
  24762. callback(err, is);
  24763. });
  24764. },
  24765. // Synchronously creates an InputStream given a path to a file
  24766. // on disk and the encoding of the bytes in that file (defaults to
  24767. // 'utf8' if encoding is null).
  24768. fromPathSync: function fromPathSync(path, encoding) {
  24769. var data = fs.readFileSync(path, encoding);
  24770. return new InputStream(data, true);
  24771. }
  24772. };
  24773. exports.CharStreams = CharStreams;
  24774. /***/ }),
  24775. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  24776. /*!***************************************************!*\
  24777. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  24778. \***************************************************/
  24779. /*! no static exports found */
  24780. /***/ (function(module, exports, __webpack_require__) {
  24781. "use strict";
  24782. //
  24783. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24784. * Use of this file is governed by the BSD 3-clause license that
  24785. * can be found in the LICENSE.txt file in the project root.
  24786. */
  24787. //
  24788. //
  24789. // This default implementation of {@link TokenFactory} creates
  24790. // {@link CommonToken} objects.
  24791. //
  24792. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  24793. function TokenFactory() {
  24794. return this;
  24795. }
  24796. function CommonTokenFactory(copyText) {
  24797. TokenFactory.call(this);
  24798. // Indicates whether {@link CommonToken//setText} should be called after
  24799. // constructing tokens to explicitly set the text. This is useful for cases
  24800. // where the input stream might not be able to provide arbitrary substrings
  24801. // of text from the input after the lexer creates a token (e.g. the
  24802. // implementation of {@link CharStream//getText} in
  24803. // {@link UnbufferedCharStream} throws an
  24804. // {@link UnsupportedOperationException}). Explicitly setting the token text
  24805. // allows {@link Token//getText} to be called at any time regardless of the
  24806. // input stream implementation.
  24807. //
  24808. // <p>
  24809. // The default value is {@code false} to avoid the performance and memory
  24810. // overhead of copying text for every token unless explicitly requested.</p>
  24811. //
  24812. this.copyText = copyText === undefined ? false : copyText;
  24813. return this;
  24814. }
  24815. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  24816. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  24817. //
  24818. // The default {@link CommonTokenFactory} instance.
  24819. //
  24820. // <p>
  24821. // This token factory does not explicitly copy token text when constructing
  24822. // tokens.</p>
  24823. //
  24824. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  24825. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  24826. var t = new CommonToken(source, type, channel, start, stop);
  24827. t.line = line;
  24828. t.column = column;
  24829. if (text !== null) {
  24830. t.text = text;
  24831. } else if (this.copyText && source[1] !== null) {
  24832. t.text = source[1].getText(start, stop);
  24833. }
  24834. return t;
  24835. };
  24836. CommonTokenFactory.prototype.createThin = function (type, text) {
  24837. var t = new CommonToken(null, type);
  24838. t.text = text;
  24839. return t;
  24840. };
  24841. exports.CommonTokenFactory = CommonTokenFactory;
  24842. /***/ }),
  24843. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  24844. /*!**************************************************!*\
  24845. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  24846. \**************************************************/
  24847. /*! no static exports found */
  24848. /***/ (function(module, exports, __webpack_require__) {
  24849. "use strict";
  24850. //
  24851. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24852. * Use of this file is governed by the BSD 3-clause license that
  24853. * can be found in the LICENSE.txt file in the project root.
  24854. */
  24855. ///
  24856. //
  24857. // This class extends {@link BufferedTokenStream} with functionality to filter
  24858. // token streams to tokens on a particular channel (tokens where
  24859. // {@link Token//getChannel} returns a particular value).
  24860. //
  24861. // <p>
  24862. // This token stream provides access to all tokens by index or when calling
  24863. // methods like {@link //getText}. The channel filtering is only used for code
  24864. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  24865. // {@link //LB}.</p>
  24866. //
  24867. // <p>
  24868. // By default, tokens are placed on the default channel
  24869. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  24870. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  24871. // call {@link Lexer//setChannel}.
  24872. // </p>
  24873. //
  24874. // <p>
  24875. // Note: lexer rules which use the {@code ->skip} lexer command or call
  24876. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  24877. // such a rule will not be available as part of the token stream, regardless of
  24878. // channel.</p>
  24879. ///
  24880. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  24881. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  24882. function CommonTokenStream(lexer, channel) {
  24883. BufferedTokenStream.call(this, lexer);
  24884. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  24885. return this;
  24886. }
  24887. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  24888. CommonTokenStream.prototype.constructor = CommonTokenStream;
  24889. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  24890. return this.nextTokenOnChannel(i, this.channel);
  24891. };
  24892. CommonTokenStream.prototype.LB = function (k) {
  24893. if (k === 0 || this.index - k < 0) {
  24894. return null;
  24895. }
  24896. var i = this.index;
  24897. var n = 1;
  24898. // find k good tokens looking backwards
  24899. while (n <= k) {
  24900. // skip off-channel tokens
  24901. i = this.previousTokenOnChannel(i - 1, this.channel);
  24902. n += 1;
  24903. }
  24904. if (i < 0) {
  24905. return null;
  24906. }
  24907. return this.tokens[i];
  24908. };
  24909. CommonTokenStream.prototype.LT = function (k) {
  24910. this.lazyInit();
  24911. if (k === 0) {
  24912. return null;
  24913. }
  24914. if (k < 0) {
  24915. return this.LB(-k);
  24916. }
  24917. var i = this.index;
  24918. var n = 1; // we know tokens[pos] is a good one
  24919. // find k good tokens
  24920. while (n < k) {
  24921. // skip off-channel tokens, but make sure to not look past EOF
  24922. if (this.sync(i + 1)) {
  24923. i = this.nextTokenOnChannel(i + 1, this.channel);
  24924. }
  24925. n += 1;
  24926. }
  24927. return this.tokens[i];
  24928. };
  24929. // Count EOF just once.///
  24930. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  24931. var n = 0;
  24932. this.fill();
  24933. for (var i = 0; i < this.tokens.length; i++) {
  24934. var t = this.tokens[i];
  24935. if (t.channel === this.channel) {
  24936. n += 1;
  24937. }
  24938. if (t.type === Token.EOF) {
  24939. break;
  24940. }
  24941. }
  24942. return n;
  24943. };
  24944. exports.CommonTokenStream = CommonTokenStream;
  24945. /***/ }),
  24946. /***/ "./node_modules/antlr4/FileStream.js":
  24947. /*!*******************************************!*\
  24948. !*** ./node_modules/antlr4/FileStream.js ***!
  24949. \*******************************************/
  24950. /*! no static exports found */
  24951. /***/ (function(module, exports, __webpack_require__) {
  24952. "use strict";
  24953. //
  24954. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24955. * Use of this file is governed by the BSD 3-clause license that
  24956. * can be found in the LICENSE.txt file in the project root.
  24957. */
  24958. //
  24959. //
  24960. // This is an InputStream that is loaded from a file all at once
  24961. // when you construct the object.
  24962. //
  24963. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  24964. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  24965. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  24966. function FileStream(fileName, decodeToUnicodeCodePoints) {
  24967. var data = fs.readFileSync(fileName, "utf8");
  24968. InputStream.call(this, data, decodeToUnicodeCodePoints);
  24969. this.fileName = fileName;
  24970. return this;
  24971. }
  24972. FileStream.prototype = Object.create(InputStream.prototype);
  24973. FileStream.prototype.constructor = FileStream;
  24974. exports.FileStream = FileStream;
  24975. /***/ }),
  24976. /***/ "./node_modules/antlr4/InputStream.js":
  24977. /*!********************************************!*\
  24978. !*** ./node_modules/antlr4/InputStream.js ***!
  24979. \********************************************/
  24980. /*! no static exports found */
  24981. /***/ (function(module, exports, __webpack_require__) {
  24982. "use strict";
  24983. //
  24984. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24985. * Use of this file is governed by the BSD 3-clause license that
  24986. * can be found in the LICENSE.txt file in the project root.
  24987. */
  24988. //
  24989. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  24990. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  24991. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  24992. // Vacuum all input from a string and then treat it like a buffer.
  24993. function _loadString(stream) {
  24994. stream._index = 0;
  24995. stream.data = [];
  24996. if (stream.decodeToUnicodeCodePoints) {
  24997. for (var i = 0; i < stream.strdata.length;) {
  24998. var codePoint = stream.strdata.codePointAt(i);
  24999. stream.data.push(codePoint);
  25000. i += codePoint <= 0xFFFF ? 1 : 2;
  25001. }
  25002. } else {
  25003. for (var i = 0; i < stream.strdata.length; i++) {
  25004. var codeUnit = stream.strdata.charCodeAt(i);
  25005. stream.data.push(codeUnit);
  25006. }
  25007. }
  25008. stream._size = stream.data.length;
  25009. }
  25010. // If decodeToUnicodeCodePoints is true, the input is treated
  25011. // as a series of Unicode code points.
  25012. //
  25013. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  25014. // units.
  25015. function InputStream(data, decodeToUnicodeCodePoints) {
  25016. this.name = "<empty>";
  25017. this.strdata = data;
  25018. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  25019. _loadString(this);
  25020. return this;
  25021. }
  25022. Object.defineProperty(InputStream.prototype, "index", {
  25023. get: function get() {
  25024. return this._index;
  25025. }
  25026. });
  25027. Object.defineProperty(InputStream.prototype, "size", {
  25028. get: function get() {
  25029. return this._size;
  25030. }
  25031. });
  25032. // Reset the stream so that it's in the same state it was
  25033. // when the object was created *except* the data array is not
  25034. // touched.
  25035. //
  25036. InputStream.prototype.reset = function () {
  25037. this._index = 0;
  25038. };
  25039. InputStream.prototype.consume = function () {
  25040. if (this._index >= this._size) {
  25041. // assert this.LA(1) == Token.EOF
  25042. throw "cannot consume EOF";
  25043. }
  25044. this._index += 1;
  25045. };
  25046. InputStream.prototype.LA = function (offset) {
  25047. if (offset === 0) {
  25048. return 0; // undefined
  25049. }
  25050. if (offset < 0) {
  25051. offset += 1; // e.g., translate LA(-1) to use offset=0
  25052. }
  25053. var pos = this._index + offset - 1;
  25054. if (pos < 0 || pos >= this._size) {
  25055. // invalid
  25056. return Token.EOF;
  25057. }
  25058. return this.data[pos];
  25059. };
  25060. InputStream.prototype.LT = function (offset) {
  25061. return this.LA(offset);
  25062. };
  25063. // mark/release do nothing; we have entire buffer
  25064. InputStream.prototype.mark = function () {
  25065. return -1;
  25066. };
  25067. InputStream.prototype.release = function (marker) {};
  25068. // consume() ahead until p==_index; can't just set p=_index as we must
  25069. // update line and column. If we seek backwards, just set p
  25070. //
  25071. InputStream.prototype.seek = function (_index) {
  25072. if (_index <= this._index) {
  25073. this._index = _index; // just jump; don't update stream state (line,
  25074. // ...)
  25075. return;
  25076. }
  25077. // seek forward
  25078. this._index = Math.min(_index, this._size);
  25079. };
  25080. InputStream.prototype.getText = function (start, stop) {
  25081. if (stop >= this._size) {
  25082. stop = this._size - 1;
  25083. }
  25084. if (start >= this._size) {
  25085. return "";
  25086. } else {
  25087. if (this.decodeToUnicodeCodePoints) {
  25088. var result = "";
  25089. for (var i = start; i <= stop; i++) {
  25090. result += String.fromCodePoint(this.data[i]);
  25091. }
  25092. return result;
  25093. } else {
  25094. return this.strdata.slice(start, stop + 1);
  25095. }
  25096. }
  25097. };
  25098. InputStream.prototype.toString = function () {
  25099. return this.strdata;
  25100. };
  25101. exports.InputStream = InputStream;
  25102. /***/ }),
  25103. /***/ "./node_modules/antlr4/IntervalSet.js":
  25104. /*!********************************************!*\
  25105. !*** ./node_modules/antlr4/IntervalSet.js ***!
  25106. \********************************************/
  25107. /*! no static exports found */
  25108. /***/ (function(module, exports, __webpack_require__) {
  25109. "use strict";
  25110. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25111. * Use of this file is governed by the BSD 3-clause license that
  25112. * can be found in the LICENSE.txt file in the project root.
  25113. */
  25114. /*jslint smarttabs:true */
  25115. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  25116. /* stop is not included! */
  25117. function Interval(start, stop) {
  25118. this.start = start;
  25119. this.stop = stop;
  25120. return this;
  25121. }
  25122. Interval.prototype.contains = function (item) {
  25123. return item >= this.start && item < this.stop;
  25124. };
  25125. Interval.prototype.toString = function () {
  25126. if (this.start === this.stop - 1) {
  25127. return this.start.toString();
  25128. } else {
  25129. return this.start.toString() + ".." + (this.stop - 1).toString();
  25130. }
  25131. };
  25132. Object.defineProperty(Interval.prototype, "length", {
  25133. get: function get() {
  25134. return this.stop - this.start;
  25135. }
  25136. });
  25137. function IntervalSet() {
  25138. this.intervals = null;
  25139. this.readOnly = false;
  25140. }
  25141. IntervalSet.prototype.first = function (v) {
  25142. if (this.intervals === null || this.intervals.length === 0) {
  25143. return Token.INVALID_TYPE;
  25144. } else {
  25145. return this.intervals[0].start;
  25146. }
  25147. };
  25148. IntervalSet.prototype.addOne = function (v) {
  25149. this.addInterval(new Interval(v, v + 1));
  25150. };
  25151. IntervalSet.prototype.addRange = function (l, h) {
  25152. this.addInterval(new Interval(l, h + 1));
  25153. };
  25154. IntervalSet.prototype.addInterval = function (v) {
  25155. if (this.intervals === null) {
  25156. this.intervals = [];
  25157. this.intervals.push(v);
  25158. } else {
  25159. // find insert pos
  25160. for (var k = 0; k < this.intervals.length; k++) {
  25161. var i = this.intervals[k];
  25162. // distinct range -> insert
  25163. if (v.stop < i.start) {
  25164. this.intervals.splice(k, 0, v);
  25165. return;
  25166. }
  25167. // contiguous range -> adjust
  25168. else if (v.stop === i.start) {
  25169. this.intervals[k].start = v.start;
  25170. return;
  25171. }
  25172. // overlapping range -> adjust and reduce
  25173. else if (v.start <= i.stop) {
  25174. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  25175. this.reduce(k);
  25176. return;
  25177. }
  25178. }
  25179. // greater than any existing
  25180. this.intervals.push(v);
  25181. }
  25182. };
  25183. IntervalSet.prototype.addSet = function (other) {
  25184. if (other.intervals !== null) {
  25185. for (var k = 0; k < other.intervals.length; k++) {
  25186. var i = other.intervals[k];
  25187. this.addInterval(new Interval(i.start, i.stop));
  25188. }
  25189. }
  25190. return this;
  25191. };
  25192. IntervalSet.prototype.reduce = function (k) {
  25193. // only need to reduce if k is not the last
  25194. if (k < this.intervalslength - 1) {
  25195. var l = this.intervals[k];
  25196. var r = this.intervals[k + 1];
  25197. // if r contained in l
  25198. if (l.stop >= r.stop) {
  25199. this.intervals.pop(k + 1);
  25200. this.reduce(k);
  25201. } else if (l.stop >= r.start) {
  25202. this.intervals[k] = new Interval(l.start, r.stop);
  25203. this.intervals.pop(k + 1);
  25204. }
  25205. }
  25206. };
  25207. IntervalSet.prototype.complement = function (start, stop) {
  25208. var result = new IntervalSet();
  25209. result.addInterval(new Interval(start, stop + 1));
  25210. for (var i = 0; i < this.intervals.length; i++) {
  25211. result.removeRange(this.intervals[i]);
  25212. }
  25213. return result;
  25214. };
  25215. IntervalSet.prototype.contains = function (item) {
  25216. if (this.intervals === null) {
  25217. return false;
  25218. } else {
  25219. for (var k = 0; k < this.intervals.length; k++) {
  25220. if (this.intervals[k].contains(item)) {
  25221. return true;
  25222. }
  25223. }
  25224. return false;
  25225. }
  25226. };
  25227. Object.defineProperty(IntervalSet.prototype, "length", {
  25228. get: function get() {
  25229. var len = 0;
  25230. this.intervals.map(function (i) {
  25231. len += i.length;
  25232. });
  25233. return len;
  25234. }
  25235. });
  25236. IntervalSet.prototype.removeRange = function (v) {
  25237. if (v.start === v.stop - 1) {
  25238. this.removeOne(v.start);
  25239. } else if (this.intervals !== null) {
  25240. var k = 0;
  25241. for (var n = 0; n < this.intervals.length; n++) {
  25242. var i = this.intervals[k];
  25243. // intervals are ordered
  25244. if (v.stop <= i.start) {
  25245. return;
  25246. }
  25247. // check for including range, split it
  25248. else if (v.start > i.start && v.stop < i.stop) {
  25249. this.intervals[k] = new Interval(i.start, v.start);
  25250. var x = new Interval(v.stop, i.stop);
  25251. this.intervals.splice(k, 0, x);
  25252. return;
  25253. }
  25254. // check for included range, remove it
  25255. else if (v.start <= i.start && v.stop >= i.stop) {
  25256. this.intervals.splice(k, 1);
  25257. k = k - 1; // need another pass
  25258. }
  25259. // check for lower boundary
  25260. else if (v.start < i.stop) {
  25261. this.intervals[k] = new Interval(i.start, v.start);
  25262. }
  25263. // check for upper boundary
  25264. else if (v.stop < i.stop) {
  25265. this.intervals[k] = new Interval(v.stop, i.stop);
  25266. }
  25267. k += 1;
  25268. }
  25269. }
  25270. };
  25271. IntervalSet.prototype.removeOne = function (v) {
  25272. if (this.intervals !== null) {
  25273. for (var k = 0; k < this.intervals.length; k++) {
  25274. var i = this.intervals[k];
  25275. // intervals is ordered
  25276. if (v < i.start) {
  25277. return;
  25278. }
  25279. // check for single value range
  25280. else if (v === i.start && v === i.stop - 1) {
  25281. this.intervals.splice(k, 1);
  25282. return;
  25283. }
  25284. // check for lower boundary
  25285. else if (v === i.start) {
  25286. this.intervals[k] = new Interval(i.start + 1, i.stop);
  25287. return;
  25288. }
  25289. // check for upper boundary
  25290. else if (v === i.stop - 1) {
  25291. this.intervals[k] = new Interval(i.start, i.stop - 1);
  25292. return;
  25293. }
  25294. // split existing range
  25295. else if (v < i.stop - 1) {
  25296. var x = new Interval(i.start, v);
  25297. i.start = v + 1;
  25298. this.intervals.splice(k, 0, x);
  25299. return;
  25300. }
  25301. }
  25302. }
  25303. };
  25304. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  25305. literalNames = literalNames || null;
  25306. symbolicNames = symbolicNames || null;
  25307. elemsAreChar = elemsAreChar || false;
  25308. if (this.intervals === null) {
  25309. return "{}";
  25310. } else if (literalNames !== null || symbolicNames !== null) {
  25311. return this.toTokenString(literalNames, symbolicNames);
  25312. } else if (elemsAreChar) {
  25313. return this.toCharString();
  25314. } else {
  25315. return this.toIndexString();
  25316. }
  25317. };
  25318. IntervalSet.prototype.toCharString = function () {
  25319. var names = [];
  25320. for (var i = 0; i < this.intervals.length; i++) {
  25321. var v = this.intervals[i];
  25322. if (v.stop === v.start + 1) {
  25323. if (v.start === Token.EOF) {
  25324. names.push("<EOF>");
  25325. } else {
  25326. names.push("'" + String.fromCharCode(v.start) + "'");
  25327. }
  25328. } else {
  25329. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  25330. }
  25331. }
  25332. if (names.length > 1) {
  25333. return "{" + names.join(", ") + "}";
  25334. } else {
  25335. return names[0];
  25336. }
  25337. };
  25338. IntervalSet.prototype.toIndexString = function () {
  25339. var names = [];
  25340. for (var i = 0; i < this.intervals.length; i++) {
  25341. var v = this.intervals[i];
  25342. if (v.stop === v.start + 1) {
  25343. if (v.start === Token.EOF) {
  25344. names.push("<EOF>");
  25345. } else {
  25346. names.push(v.start.toString());
  25347. }
  25348. } else {
  25349. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  25350. }
  25351. }
  25352. if (names.length > 1) {
  25353. return "{" + names.join(", ") + "}";
  25354. } else {
  25355. return names[0];
  25356. }
  25357. };
  25358. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  25359. var names = [];
  25360. for (var i = 0; i < this.intervals.length; i++) {
  25361. var v = this.intervals[i];
  25362. for (var j = v.start; j < v.stop; j++) {
  25363. names.push(this.elementName(literalNames, symbolicNames, j));
  25364. }
  25365. }
  25366. if (names.length > 1) {
  25367. return "{" + names.join(", ") + "}";
  25368. } else {
  25369. return names[0];
  25370. }
  25371. };
  25372. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  25373. if (a === Token.EOF) {
  25374. return "<EOF>";
  25375. } else if (a === Token.EPSILON) {
  25376. return "<EPSILON>";
  25377. } else {
  25378. return literalNames[a] || symbolicNames[a];
  25379. }
  25380. };
  25381. exports.Interval = Interval;
  25382. exports.IntervalSet = IntervalSet;
  25383. /***/ }),
  25384. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  25385. /*!********************************************!*\
  25386. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  25387. \********************************************/
  25388. /*! no static exports found */
  25389. /***/ (function(module, exports, __webpack_require__) {
  25390. "use strict";
  25391. //
  25392. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25393. * Use of this file is governed by the BSD 3-clause license that
  25394. * can be found in the LICENSE.txt file in the project root.
  25395. */
  25396. ///
  25397. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  25398. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  25399. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  25400. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  25401. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  25402. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25403. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  25404. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  25405. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  25406. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  25407. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  25408. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  25409. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  25410. var PredictionContext = pc.PredictionContext;
  25411. var SingletonPredictionContext = pc.SingletonPredictionContext;
  25412. function LL1Analyzer(atn) {
  25413. this.atn = atn;
  25414. }
  25415. //* Special value added to the lookahead sets to indicate that we hit
  25416. // a predicate during analysis if {@code seeThruPreds==false}.
  25417. ///
  25418. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  25419. //*
  25420. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  25421. // of an {@link ATNState}. The returned array has one element for each
  25422. // outgoing transition in {@code s}. If the closure from transition
  25423. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  25424. // element at index <em>i</em> of the result will be {@code null}.
  25425. //
  25426. // @param s the ATN state
  25427. // @return the expected symbols for each outgoing transition of {@code s}.
  25428. ///
  25429. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  25430. if (s === null) {
  25431. return null;
  25432. }
  25433. var count = s.transitions.length;
  25434. var look = [];
  25435. for (var alt = 0; alt < count; alt++) {
  25436. look[alt] = new IntervalSet();
  25437. var lookBusy = new Set();
  25438. var seeThruPreds = false; // fail to get lookahead upon pred
  25439. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  25440. // Wipe out lookahead for this alternative if we found nothing
  25441. // or we had a predicate when we !seeThruPreds
  25442. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  25443. look[alt] = null;
  25444. }
  25445. }
  25446. return look;
  25447. };
  25448. //*
  25449. // Compute set of tokens that can follow {@code s} in the ATN in the
  25450. // specified {@code ctx}.
  25451. //
  25452. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  25453. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  25454. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  25455. // reached, {@link Token//EOF} is added to the result set.</p>
  25456. //
  25457. // @param s the ATN state
  25458. // @param stopState the ATN state to stop at. This can be a
  25459. // {@link BlockEndState} to detect epsilon paths through a closure.
  25460. // @param ctx the complete parser context, or {@code null} if the context
  25461. // should be ignored
  25462. //
  25463. // @return The set of tokens that can follow {@code s} in the ATN in the
  25464. // specified {@code ctx}.
  25465. ///
  25466. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  25467. var r = new IntervalSet();
  25468. var seeThruPreds = true; // ignore preds; get all lookahead
  25469. ctx = ctx || null;
  25470. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  25471. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  25472. return r;
  25473. };
  25474. //*
  25475. // Compute set of tokens that can follow {@code s} in the ATN in the
  25476. // specified {@code ctx}.
  25477. //
  25478. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  25479. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  25480. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  25481. // {@code true} and {@code stopState} or the end of the outermost rule is
  25482. // reached, {@link Token//EOF} is added to the result set.</p>
  25483. //
  25484. // @param s the ATN state.
  25485. // @param stopState the ATN state to stop at. This can be a
  25486. // {@link BlockEndState} to detect epsilon paths through a closure.
  25487. // @param ctx The outer context, or {@code null} if the outer context should
  25488. // not be used.
  25489. // @param look The result lookahead set.
  25490. // @param lookBusy A set used for preventing epsilon closures in the ATN
  25491. // from causing a stack overflow. Outside code should pass
  25492. // {@code new Set<ATNConfig>} for this argument.
  25493. // @param calledRuleStack A set used for preventing left recursion in the
  25494. // ATN from causing a stack overflow. Outside code should pass
  25495. // {@code new BitSet()} for this argument.
  25496. // @param seeThruPreds {@code true} to true semantic predicates as
  25497. // implicitly {@code true} and "see through them", otherwise {@code false}
  25498. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  25499. // result if one is encountered.
  25500. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  25501. // outermost context is reached. This parameter has no effect if {@code ctx}
  25502. // is {@code null}.
  25503. ///
  25504. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  25505. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  25506. if (lookBusy.contains(c)) {
  25507. return;
  25508. }
  25509. lookBusy.add(c);
  25510. if (s === stopState) {
  25511. if (ctx === null) {
  25512. look.addOne(Token.EPSILON);
  25513. return;
  25514. } else if (ctx.isEmpty() && addEOF) {
  25515. look.addOne(Token.EOF);
  25516. return;
  25517. }
  25518. }
  25519. if (s instanceof RuleStopState) {
  25520. if (ctx === null) {
  25521. look.addOne(Token.EPSILON);
  25522. return;
  25523. } else if (ctx.isEmpty() && addEOF) {
  25524. look.addOne(Token.EOF);
  25525. return;
  25526. }
  25527. if (ctx !== PredictionContext.EMPTY) {
  25528. // run thru all possible stack tops in ctx
  25529. for (var i = 0; i < ctx.length; i++) {
  25530. var returnState = this.atn.states[ctx.getReturnState(i)];
  25531. var removed = calledRuleStack.contains(returnState.ruleIndex);
  25532. try {
  25533. calledRuleStack.remove(returnState.ruleIndex);
  25534. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  25535. } finally {
  25536. if (removed) {
  25537. calledRuleStack.add(returnState.ruleIndex);
  25538. }
  25539. }
  25540. }
  25541. return;
  25542. }
  25543. }
  25544. for (var j = 0; j < s.transitions.length; j++) {
  25545. var t = s.transitions[j];
  25546. if (t.constructor === RuleTransition) {
  25547. if (calledRuleStack.contains(t.target.ruleIndex)) {
  25548. continue;
  25549. }
  25550. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  25551. try {
  25552. calledRuleStack.add(t.target.ruleIndex);
  25553. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  25554. } finally {
  25555. calledRuleStack.remove(t.target.ruleIndex);
  25556. }
  25557. } else if (t instanceof AbstractPredicateTransition) {
  25558. if (seeThruPreds) {
  25559. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  25560. } else {
  25561. look.addOne(LL1Analyzer.HIT_PRED);
  25562. }
  25563. } else if (t.isEpsilon) {
  25564. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  25565. } else if (t.constructor === WildcardTransition) {
  25566. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  25567. } else {
  25568. var set = t.label;
  25569. if (set !== null) {
  25570. if (t instanceof NotSetTransition) {
  25571. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  25572. }
  25573. look.addSet(set);
  25574. }
  25575. }
  25576. }
  25577. };
  25578. exports.LL1Analyzer = LL1Analyzer;
  25579. /***/ }),
  25580. /***/ "./node_modules/antlr4/Lexer.js":
  25581. /*!**************************************!*\
  25582. !*** ./node_modules/antlr4/Lexer.js ***!
  25583. \**************************************/
  25584. /*! no static exports found */
  25585. /***/ (function(module, exports, __webpack_require__) {
  25586. "use strict";
  25587. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25588. * Use of this file is governed by the BSD 3-clause license that
  25589. * can be found in the LICENSE.txt file in the project root.
  25590. */
  25591. ///
  25592. // A lexer is recognizer that draws input symbols from a character stream.
  25593. // lexer grammars result in a subclass of this object. A Lexer object
  25594. // uses simplified match() and error recovery mechanisms in the interest of speed.
  25595. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  25596. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  25597. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  25598. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  25599. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  25600. function TokenSource() {
  25601. return this;
  25602. }
  25603. function Lexer(input) {
  25604. Recognizer.call(this);
  25605. this._input = input;
  25606. this._factory = CommonTokenFactory.DEFAULT;
  25607. this._tokenFactorySourcePair = [this, input];
  25608. this._interp = null; // child classes must populate this
  25609. // The goal of all lexer rules/methods is to create a token object.
  25610. // this is an instance variable as multiple rules may collaborate to
  25611. // create a single token. nextToken will return this object after
  25612. // matching lexer rule(s). If you subclass to allow multiple token
  25613. // emissions, then set this to the last token to be matched or
  25614. // something nonnull so that the auto token emit mechanism will not
  25615. // emit another token.
  25616. this._token = null;
  25617. // What character index in the stream did the current token start at?
  25618. // Needed, for example, to get the text for current token. Set at
  25619. // the start of nextToken.
  25620. this._tokenStartCharIndex = -1;
  25621. // The line on which the first character of the token resides///
  25622. this._tokenStartLine = -1;
  25623. // The character position of first character within the line///
  25624. this._tokenStartColumn = -1;
  25625. // Once we see EOF on char stream, next token will be EOF.
  25626. // If you have DONE : EOF ; then you see DONE EOF.
  25627. this._hitEOF = false;
  25628. // The channel number for the current token///
  25629. this._channel = Token.DEFAULT_CHANNEL;
  25630. // The token type for the current token///
  25631. this._type = Token.INVALID_TYPE;
  25632. this._modeStack = [];
  25633. this._mode = Lexer.DEFAULT_MODE;
  25634. // You can set the text for the current token to override what is in
  25635. // the input char buffer. Use setText() or can set this instance var.
  25636. // /
  25637. this._text = null;
  25638. return this;
  25639. }
  25640. Lexer.prototype = Object.create(Recognizer.prototype);
  25641. Lexer.prototype.constructor = Lexer;
  25642. Lexer.DEFAULT_MODE = 0;
  25643. Lexer.MORE = -2;
  25644. Lexer.SKIP = -3;
  25645. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  25646. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  25647. Lexer.MIN_CHAR_VALUE = 0x0000;
  25648. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  25649. Lexer.prototype.reset = function () {
  25650. // wack Lexer state variables
  25651. if (this._input !== null) {
  25652. this._input.seek(0); // rewind the input
  25653. }
  25654. this._token = null;
  25655. this._type = Token.INVALID_TYPE;
  25656. this._channel = Token.DEFAULT_CHANNEL;
  25657. this._tokenStartCharIndex = -1;
  25658. this._tokenStartColumn = -1;
  25659. this._tokenStartLine = -1;
  25660. this._text = null;
  25661. this._hitEOF = false;
  25662. this._mode = Lexer.DEFAULT_MODE;
  25663. this._modeStack = [];
  25664. this._interp.reset();
  25665. };
  25666. // Return a token from this source; i.e., match a token on the char stream.
  25667. Lexer.prototype.nextToken = function () {
  25668. if (this._input === null) {
  25669. throw "nextToken requires a non-null input stream.";
  25670. }
  25671. // Mark start location in char stream so unbuffered streams are
  25672. // guaranteed at least have text of current token
  25673. var tokenStartMarker = this._input.mark();
  25674. try {
  25675. while (true) {
  25676. if (this._hitEOF) {
  25677. this.emitEOF();
  25678. return this._token;
  25679. }
  25680. this._token = null;
  25681. this._channel = Token.DEFAULT_CHANNEL;
  25682. this._tokenStartCharIndex = this._input.index;
  25683. this._tokenStartColumn = this._interp.column;
  25684. this._tokenStartLine = this._interp.line;
  25685. this._text = null;
  25686. var continueOuter = false;
  25687. while (true) {
  25688. this._type = Token.INVALID_TYPE;
  25689. var ttype = Lexer.SKIP;
  25690. try {
  25691. ttype = this._interp.match(this._input, this._mode);
  25692. } catch (e) {
  25693. if (e instanceof RecognitionException) {
  25694. this.notifyListeners(e); // report error
  25695. this.recover(e);
  25696. } else {
  25697. console.log(e.stack);
  25698. throw e;
  25699. }
  25700. }
  25701. if (this._input.LA(1) === Token.EOF) {
  25702. this._hitEOF = true;
  25703. }
  25704. if (this._type === Token.INVALID_TYPE) {
  25705. this._type = ttype;
  25706. }
  25707. if (this._type === Lexer.SKIP) {
  25708. continueOuter = true;
  25709. break;
  25710. }
  25711. if (this._type !== Lexer.MORE) {
  25712. break;
  25713. }
  25714. }
  25715. if (continueOuter) {
  25716. continue;
  25717. }
  25718. if (this._token === null) {
  25719. this.emit();
  25720. }
  25721. return this._token;
  25722. }
  25723. } finally {
  25724. // make sure we release marker after match or
  25725. // unbuffered char stream will keep buffering
  25726. this._input.release(tokenStartMarker);
  25727. }
  25728. };
  25729. // Instruct the lexer to skip creating a token for current lexer rule
  25730. // and look for another token. nextToken() knows to keep looking when
  25731. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  25732. // if token==null at end of any token rule, it creates one for you
  25733. // and emits it.
  25734. // /
  25735. Lexer.prototype.skip = function () {
  25736. this._type = Lexer.SKIP;
  25737. };
  25738. Lexer.prototype.more = function () {
  25739. this._type = Lexer.MORE;
  25740. };
  25741. Lexer.prototype.mode = function (m) {
  25742. this._mode = m;
  25743. };
  25744. Lexer.prototype.pushMode = function (m) {
  25745. if (this._interp.debug) {
  25746. console.log("pushMode " + m);
  25747. }
  25748. this._modeStack.push(this._mode);
  25749. this.mode(m);
  25750. };
  25751. Lexer.prototype.popMode = function () {
  25752. if (this._modeStack.length === 0) {
  25753. throw "Empty Stack";
  25754. }
  25755. if (this._interp.debug) {
  25756. console.log("popMode back to " + this._modeStack.slice(0, -1));
  25757. }
  25758. this.mode(this._modeStack.pop());
  25759. return this._mode;
  25760. };
  25761. // Set the char stream and reset the lexer
  25762. Object.defineProperty(Lexer.prototype, "inputStream", {
  25763. get: function get() {
  25764. return this._input;
  25765. },
  25766. set: function set(input) {
  25767. this._input = null;
  25768. this._tokenFactorySourcePair = [this, this._input];
  25769. this.reset();
  25770. this._input = input;
  25771. this._tokenFactorySourcePair = [this, this._input];
  25772. }
  25773. });
  25774. Object.defineProperty(Lexer.prototype, "sourceName", {
  25775. get: function sourceName() {
  25776. return this._input.sourceName;
  25777. }
  25778. });
  25779. // By default does not support multiple emits per nextToken invocation
  25780. // for efficiency reasons. Subclass and override this method, nextToken,
  25781. // and getToken (to push tokens into a list and pull from that list
  25782. // rather than a single variable as this implementation does).
  25783. // /
  25784. Lexer.prototype.emitToken = function (token) {
  25785. this._token = token;
  25786. };
  25787. // The standard method called to automatically emit a token at the
  25788. // outermost lexical rule. The token object should point into the
  25789. // char buffer start..stop. If there is a text override in 'text',
  25790. // use that to set the token's text. Override this method to emit
  25791. // custom Token objects or provide a new factory.
  25792. // /
  25793. Lexer.prototype.emit = function () {
  25794. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  25795. this.emitToken(t);
  25796. return t;
  25797. };
  25798. Lexer.prototype.emitEOF = function () {
  25799. var cpos = this.column;
  25800. var lpos = this.line;
  25801. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  25802. this.emitToken(eof);
  25803. return eof;
  25804. };
  25805. Object.defineProperty(Lexer.prototype, "type", {
  25806. get: function get() {
  25807. return this.type;
  25808. },
  25809. set: function set(type) {
  25810. this._type = type;
  25811. }
  25812. });
  25813. Object.defineProperty(Lexer.prototype, "line", {
  25814. get: function get() {
  25815. return this._interp.line;
  25816. },
  25817. set: function set(line) {
  25818. this._interp.line = line;
  25819. }
  25820. });
  25821. Object.defineProperty(Lexer.prototype, "column", {
  25822. get: function get() {
  25823. return this._interp.column;
  25824. },
  25825. set: function set(column) {
  25826. this._interp.column = column;
  25827. }
  25828. });
  25829. // What is the index of the current character of lookahead?///
  25830. Lexer.prototype.getCharIndex = function () {
  25831. return this._input.index;
  25832. };
  25833. // Return the text matched so far for the current token or any text override.
  25834. //Set the complete text of this token; it wipes any previous changes to the text.
  25835. Object.defineProperty(Lexer.prototype, "text", {
  25836. get: function get() {
  25837. if (this._text !== null) {
  25838. return this._text;
  25839. } else {
  25840. return this._interp.getText(this._input);
  25841. }
  25842. },
  25843. set: function set(text) {
  25844. this._text = text;
  25845. }
  25846. });
  25847. // Return a list of all Token objects in input char stream.
  25848. // Forces load of all tokens. Does not include EOF token.
  25849. // /
  25850. Lexer.prototype.getAllTokens = function () {
  25851. var tokens = [];
  25852. var t = this.nextToken();
  25853. while (t.type !== Token.EOF) {
  25854. tokens.push(t);
  25855. t = this.nextToken();
  25856. }
  25857. return tokens;
  25858. };
  25859. Lexer.prototype.notifyListeners = function (e) {
  25860. var start = this._tokenStartCharIndex;
  25861. var stop = this._input.index;
  25862. var text = this._input.getText(start, stop);
  25863. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  25864. var listener = this.getErrorListenerDispatch();
  25865. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  25866. };
  25867. Lexer.prototype.getErrorDisplay = function (s) {
  25868. var d = [];
  25869. for (var i = 0; i < s.length; i++) {
  25870. d.push(s[i]);
  25871. }
  25872. return d.join('');
  25873. };
  25874. Lexer.prototype.getErrorDisplayForChar = function (c) {
  25875. if (c.charCodeAt(0) === Token.EOF) {
  25876. return "<EOF>";
  25877. } else if (c === '\n') {
  25878. return "\\n";
  25879. } else if (c === '\t') {
  25880. return "\\t";
  25881. } else if (c === '\r') {
  25882. return "\\r";
  25883. } else {
  25884. return c;
  25885. }
  25886. };
  25887. Lexer.prototype.getCharErrorDisplay = function (c) {
  25888. return "'" + this.getErrorDisplayForChar(c) + "'";
  25889. };
  25890. // Lexers can normally match any char in it's vocabulary after matching
  25891. // a token, so do the easy thing and just kill a character and hope
  25892. // it all works out. You can instead use the rule invocation stack
  25893. // to do sophisticated error recovery if you are in a fragment rule.
  25894. // /
  25895. Lexer.prototype.recover = function (re) {
  25896. if (this._input.LA(1) !== Token.EOF) {
  25897. if (re instanceof LexerNoViableAltException) {
  25898. // skip a char and try again
  25899. this._interp.consume(this._input);
  25900. } else {
  25901. // TODO: Do we lose character or line position information?
  25902. this._input.consume();
  25903. }
  25904. }
  25905. };
  25906. exports.Lexer = Lexer;
  25907. /***/ }),
  25908. /***/ "./node_modules/antlr4/Parser.js":
  25909. /*!***************************************!*\
  25910. !*** ./node_modules/antlr4/Parser.js ***!
  25911. \***************************************/
  25912. /*! no static exports found */
  25913. /***/ (function(module, exports, __webpack_require__) {
  25914. "use strict";
  25915. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25916. * Use of this file is governed by the BSD 3-clause license that
  25917. * can be found in the LICENSE.txt file in the project root.
  25918. */
  25919. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  25920. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  25921. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  25922. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  25923. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  25924. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  25925. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  25926. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  25927. function TraceListener(parser) {
  25928. ParseTreeListener.call(this);
  25929. this.parser = parser;
  25930. return this;
  25931. }
  25932. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  25933. TraceListener.prototype.constructor = TraceListener;
  25934. TraceListener.prototype.enterEveryRule = function (ctx) {
  25935. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  25936. };
  25937. TraceListener.prototype.visitTerminal = function (node) {
  25938. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  25939. };
  25940. TraceListener.prototype.exitEveryRule = function (ctx) {
  25941. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  25942. };
  25943. // this is all the parsing support code essentially; most of it is error
  25944. // recovery stuff.//
  25945. function Parser(input) {
  25946. Recognizer.call(this);
  25947. // The input stream.
  25948. this._input = null;
  25949. // The error handling strategy for the parser. The default value is a new
  25950. // instance of {@link DefaultErrorStrategy}.
  25951. this._errHandler = new DefaultErrorStrategy();
  25952. this._precedenceStack = [];
  25953. this._precedenceStack.push(0);
  25954. // The {@link ParserRuleContext} object for the currently executing rule.
  25955. // this is always non-null during the parsing process.
  25956. this._ctx = null;
  25957. // Specifies whether or not the parser should construct a parse tree during
  25958. // the parsing process. The default value is {@code true}.
  25959. this.buildParseTrees = true;
  25960. // When {@link //setTrace}{@code (true)} is called, a reference to the
  25961. // {@link TraceListener} is stored here so it can be easily removed in a
  25962. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  25963. // implemented as a parser listener so this field is not directly used by
  25964. // other parser methods.
  25965. this._tracer = null;
  25966. // The list of {@link ParseTreeListener} listeners registered to receive
  25967. // events during the parse.
  25968. this._parseListeners = null;
  25969. // The number of syntax errors reported during parsing. this value is
  25970. // incremented each time {@link //notifyErrorListeners} is called.
  25971. this._syntaxErrors = 0;
  25972. this.setInputStream(input);
  25973. return this;
  25974. }
  25975. Parser.prototype = Object.create(Recognizer.prototype);
  25976. Parser.prototype.contructor = Parser;
  25977. // this field maps from the serialized ATN string to the deserialized {@link
  25978. // ATN} with
  25979. // bypass alternatives.
  25980. //
  25981. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  25982. //
  25983. Parser.bypassAltsAtnCache = {};
  25984. // reset the parser's state//
  25985. Parser.prototype.reset = function () {
  25986. if (this._input !== null) {
  25987. this._input.seek(0);
  25988. }
  25989. this._errHandler.reset(this);
  25990. this._ctx = null;
  25991. this._syntaxErrors = 0;
  25992. this.setTrace(false);
  25993. this._precedenceStack = [];
  25994. this._precedenceStack.push(0);
  25995. if (this._interp !== null) {
  25996. this._interp.reset();
  25997. }
  25998. };
  25999. // Match current input symbol against {@code ttype}. If the symbol type
  26000. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  26001. // called to complete the match process.
  26002. //
  26003. // <p>If the symbol type does not match,
  26004. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  26005. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  26006. // {@code true} and the token index of the symbol returned by
  26007. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  26008. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  26009. //
  26010. // @param ttype the token type to match
  26011. // @return the matched symbol
  26012. // @throws RecognitionException if the current input symbol did not match
  26013. // {@code ttype} and the error strategy could not recover from the
  26014. // mismatched symbol
  26015. Parser.prototype.match = function (ttype) {
  26016. var t = this.getCurrentToken();
  26017. if (t.type === ttype) {
  26018. this._errHandler.reportMatch(this);
  26019. this.consume();
  26020. } else {
  26021. t = this._errHandler.recoverInline(this);
  26022. if (this.buildParseTrees && t.tokenIndex === -1) {
  26023. // we must have conjured up a new token during single token
  26024. // insertion
  26025. // if it's not the current symbol
  26026. this._ctx.addErrorNode(t);
  26027. }
  26028. }
  26029. return t;
  26030. };
  26031. // Match current input symbol as a wildcard. If the symbol type matches
  26032. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  26033. // and {@link //consume} are called to complete the match process.
  26034. //
  26035. // <p>If the symbol type does not match,
  26036. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  26037. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  26038. // {@code true} and the token index of the symbol returned by
  26039. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  26040. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  26041. //
  26042. // @return the matched symbol
  26043. // @throws RecognitionException if the current input symbol did not match
  26044. // a wildcard and the error strategy could not recover from the mismatched
  26045. // symbol
  26046. Parser.prototype.matchWildcard = function () {
  26047. var t = this.getCurrentToken();
  26048. if (t.type > 0) {
  26049. this._errHandler.reportMatch(this);
  26050. this.consume();
  26051. } else {
  26052. t = this._errHandler.recoverInline(this);
  26053. if (this._buildParseTrees && t.tokenIndex === -1) {
  26054. // we must have conjured up a new token during single token
  26055. // insertion
  26056. // if it's not the current symbol
  26057. this._ctx.addErrorNode(t);
  26058. }
  26059. }
  26060. return t;
  26061. };
  26062. Parser.prototype.getParseListeners = function () {
  26063. return this._parseListeners || [];
  26064. };
  26065. // Registers {@code listener} to receive events during the parsing process.
  26066. //
  26067. // <p>To support output-preserving grammar transformations (including but not
  26068. // limited to left-recursion removal, automated left-factoring, and
  26069. // optimized code generation), calls to listener methods during the parse
  26070. // may differ substantially from calls made by
  26071. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  26072. // particular, rule entry and exit events may occur in a different order
  26073. // during the parse than after the parser. In addition, calls to certain
  26074. // rule entry methods may be omitted.</p>
  26075. //
  26076. // <p>With the following specific exceptions, calls to listener events are
  26077. // <em>deterministic</em>, i.e. for identical input the calls to listener
  26078. // methods will be the same.</p>
  26079. //
  26080. // <ul>
  26081. // <li>Alterations to the grammar used to generate code may change the
  26082. // behavior of the listener calls.</li>
  26083. // <li>Alterations to the command line options passed to ANTLR 4 when
  26084. // generating the parser may change the behavior of the listener calls.</li>
  26085. // <li>Changing the version of the ANTLR Tool used to generate the parser
  26086. // may change the behavior of the listener calls.</li>
  26087. // </ul>
  26088. //
  26089. // @param listener the listener to add
  26090. //
  26091. // @throws NullPointerException if {@code} listener is {@code null}
  26092. //
  26093. Parser.prototype.addParseListener = function (listener) {
  26094. if (listener === null) {
  26095. throw "listener";
  26096. }
  26097. if (this._parseListeners === null) {
  26098. this._parseListeners = [];
  26099. }
  26100. this._parseListeners.push(listener);
  26101. };
  26102. //
  26103. // Remove {@code listener} from the list of parse listeners.
  26104. //
  26105. // <p>If {@code listener} is {@code null} or has not been added as a parse
  26106. // listener, this method does nothing.</p>
  26107. // @param listener the listener to remove
  26108. //
  26109. Parser.prototype.removeParseListener = function (listener) {
  26110. if (this._parseListeners !== null) {
  26111. var idx = this._parseListeners.indexOf(listener);
  26112. if (idx >= 0) {
  26113. this._parseListeners.splice(idx, 1);
  26114. }
  26115. if (this._parseListeners.length === 0) {
  26116. this._parseListeners = null;
  26117. }
  26118. }
  26119. };
  26120. // Remove all parse listeners.
  26121. Parser.prototype.removeParseListeners = function () {
  26122. this._parseListeners = null;
  26123. };
  26124. // Notify any parse listeners of an enter rule event.
  26125. Parser.prototype.triggerEnterRuleEvent = function () {
  26126. if (this._parseListeners !== null) {
  26127. var ctx = this._ctx;
  26128. this._parseListeners.map(function (listener) {
  26129. listener.enterEveryRule(ctx);
  26130. ctx.enterRule(listener);
  26131. });
  26132. }
  26133. };
  26134. //
  26135. // Notify any parse listeners of an exit rule event.
  26136. //
  26137. // @see //addParseListener
  26138. //
  26139. Parser.prototype.triggerExitRuleEvent = function () {
  26140. if (this._parseListeners !== null) {
  26141. // reverse order walk of listeners
  26142. var ctx = this._ctx;
  26143. this._parseListeners.slice(0).reverse().map(function (listener) {
  26144. ctx.exitRule(listener);
  26145. listener.exitEveryRule(ctx);
  26146. });
  26147. }
  26148. };
  26149. Parser.prototype.getTokenFactory = function () {
  26150. return this._input.tokenSource._factory;
  26151. };
  26152. // Tell our token source and error strategy about a new way to create tokens.//
  26153. Parser.prototype.setTokenFactory = function (factory) {
  26154. this._input.tokenSource._factory = factory;
  26155. };
  26156. // The ATN with bypass alternatives is expensive to create so we create it
  26157. // lazily.
  26158. //
  26159. // @throws UnsupportedOperationException if the current parser does not
  26160. // implement the {@link //getSerializedATN()} method.
  26161. //
  26162. Parser.prototype.getATNWithBypassAlts = function () {
  26163. var serializedAtn = this.getSerializedATN();
  26164. if (serializedAtn === null) {
  26165. throw "The current parser does not support an ATN with bypass alternatives.";
  26166. }
  26167. var result = this.bypassAltsAtnCache[serializedAtn];
  26168. if (result === null) {
  26169. var deserializationOptions = new ATNDeserializationOptions();
  26170. deserializationOptions.generateRuleBypassTransitions = true;
  26171. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  26172. this.bypassAltsAtnCache[serializedAtn] = result;
  26173. }
  26174. return result;
  26175. };
  26176. // The preferred method of getting a tree pattern. For example, here's a
  26177. // sample use:
  26178. //
  26179. // <pre>
  26180. // ParseTree t = parser.expr();
  26181. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  26182. // MyParser.RULE_expr);
  26183. // ParseTreeMatch m = p.match(t);
  26184. // String id = m.get("ID");
  26185. // </pre>
  26186. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  26187. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  26188. lexer = lexer || null;
  26189. if (lexer === null) {
  26190. if (this.getTokenStream() !== null) {
  26191. var tokenSource = this.getTokenStream().tokenSource;
  26192. if (tokenSource instanceof Lexer) {
  26193. lexer = tokenSource;
  26194. }
  26195. }
  26196. }
  26197. if (lexer === null) {
  26198. throw "Parser can't discover a lexer to use";
  26199. }
  26200. var m = new ParseTreePatternMatcher(lexer, this);
  26201. return m.compile(pattern, patternRuleIndex);
  26202. };
  26203. Parser.prototype.getInputStream = function () {
  26204. return this.getTokenStream();
  26205. };
  26206. Parser.prototype.setInputStream = function (input) {
  26207. this.setTokenStream(input);
  26208. };
  26209. Parser.prototype.getTokenStream = function () {
  26210. return this._input;
  26211. };
  26212. // Set the token stream and reset the parser.//
  26213. Parser.prototype.setTokenStream = function (input) {
  26214. this._input = null;
  26215. this.reset();
  26216. this._input = input;
  26217. };
  26218. // Match needs to return the current input symbol, which gets put
  26219. // into the label for the associated token ref; e.g., x=ID.
  26220. //
  26221. Parser.prototype.getCurrentToken = function () {
  26222. return this._input.LT(1);
  26223. };
  26224. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  26225. offendingToken = offendingToken || null;
  26226. err = err || null;
  26227. if (offendingToken === null) {
  26228. offendingToken = this.getCurrentToken();
  26229. }
  26230. this._syntaxErrors += 1;
  26231. var line = offendingToken.line;
  26232. var column = offendingToken.column;
  26233. var listener = this.getErrorListenerDispatch();
  26234. listener.syntaxError(this, offendingToken, line, column, msg, err);
  26235. };
  26236. //
  26237. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  26238. //
  26239. // <p>E.g., given the following input with {@code A} being the current
  26240. // lookahead symbol, this function moves the cursor to {@code B} and returns
  26241. // {@code A}.</p>
  26242. //
  26243. // <pre>
  26244. // A B
  26245. // ^
  26246. // </pre>
  26247. //
  26248. // If the parser is not in error recovery mode, the consumed symbol is added
  26249. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  26250. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  26251. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  26252. // added to the parse tree using
  26253. // {@link ParserRuleContext//addErrorNode(Token)}, and
  26254. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  26255. // listeners.
  26256. //
  26257. Parser.prototype.consume = function () {
  26258. var o = this.getCurrentToken();
  26259. if (o.type !== Token.EOF) {
  26260. this.getInputStream().consume();
  26261. }
  26262. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  26263. if (this.buildParseTrees || hasListener) {
  26264. var node;
  26265. if (this._errHandler.inErrorRecoveryMode(this)) {
  26266. node = this._ctx.addErrorNode(o);
  26267. } else {
  26268. node = this._ctx.addTokenNode(o);
  26269. }
  26270. node.invokingState = this.state;
  26271. if (hasListener) {
  26272. this._parseListeners.map(function (listener) {
  26273. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  26274. listener.visitErrorNode(node);
  26275. } else if (node instanceof TerminalNode) {
  26276. listener.visitTerminal(node);
  26277. }
  26278. });
  26279. }
  26280. }
  26281. return o;
  26282. };
  26283. Parser.prototype.addContextToParseTree = function () {
  26284. // add current context to parent if we have a parent
  26285. if (this._ctx.parentCtx !== null) {
  26286. this._ctx.parentCtx.addChild(this._ctx);
  26287. }
  26288. };
  26289. // Always called by generated parsers upon entry to a rule. Access field
  26290. // {@link //_ctx} get the current context.
  26291. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  26292. this.state = state;
  26293. this._ctx = localctx;
  26294. this._ctx.start = this._input.LT(1);
  26295. if (this.buildParseTrees) {
  26296. this.addContextToParseTree();
  26297. }
  26298. if (this._parseListeners !== null) {
  26299. this.triggerEnterRuleEvent();
  26300. }
  26301. };
  26302. Parser.prototype.exitRule = function () {
  26303. this._ctx.stop = this._input.LT(-1);
  26304. // trigger event on _ctx, before it reverts to parent
  26305. if (this._parseListeners !== null) {
  26306. this.triggerExitRuleEvent();
  26307. }
  26308. this.state = this._ctx.invokingState;
  26309. this._ctx = this._ctx.parentCtx;
  26310. };
  26311. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  26312. localctx.setAltNumber(altNum);
  26313. // if we have new localctx, make sure we replace existing ctx
  26314. // that is previous child of parse tree
  26315. if (this.buildParseTrees && this._ctx !== localctx) {
  26316. if (this._ctx.parentCtx !== null) {
  26317. this._ctx.parentCtx.removeLastChild();
  26318. this._ctx.parentCtx.addChild(localctx);
  26319. }
  26320. }
  26321. this._ctx = localctx;
  26322. };
  26323. // Get the precedence level for the top-most precedence rule.
  26324. //
  26325. // @return The precedence level for the top-most precedence rule, or -1 if
  26326. // the parser context is not nested within a precedence rule.
  26327. Parser.prototype.getPrecedence = function () {
  26328. if (this._precedenceStack.length === 0) {
  26329. return -1;
  26330. } else {
  26331. return this._precedenceStack[this._precedenceStack.length - 1];
  26332. }
  26333. };
  26334. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  26335. this.state = state;
  26336. this._precedenceStack.push(precedence);
  26337. this._ctx = localctx;
  26338. this._ctx.start = this._input.LT(1);
  26339. if (this._parseListeners !== null) {
  26340. this.triggerEnterRuleEvent(); // simulates rule entry for
  26341. // left-recursive rules
  26342. }
  26343. };
  26344. //
  26345. // Like {@link //enterRule} but for recursive rules.
  26346. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  26347. var previous = this._ctx;
  26348. previous.parentCtx = localctx;
  26349. previous.invokingState = state;
  26350. previous.stop = this._input.LT(-1);
  26351. this._ctx = localctx;
  26352. this._ctx.start = previous.start;
  26353. if (this.buildParseTrees) {
  26354. this._ctx.addChild(previous);
  26355. }
  26356. if (this._parseListeners !== null) {
  26357. this.triggerEnterRuleEvent(); // simulates rule entry for
  26358. // left-recursive rules
  26359. }
  26360. };
  26361. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  26362. this._precedenceStack.pop();
  26363. this._ctx.stop = this._input.LT(-1);
  26364. var retCtx = this._ctx; // save current ctx (return value)
  26365. // unroll so _ctx is as it was before call to recursive method
  26366. if (this._parseListeners !== null) {
  26367. while (this._ctx !== parentCtx) {
  26368. this.triggerExitRuleEvent();
  26369. this._ctx = this._ctx.parentCtx;
  26370. }
  26371. } else {
  26372. this._ctx = parentCtx;
  26373. }
  26374. // hook into tree
  26375. retCtx.parentCtx = parentCtx;
  26376. if (this.buildParseTrees && parentCtx !== null) {
  26377. // add return ctx into invoking rule's tree
  26378. parentCtx.addChild(retCtx);
  26379. }
  26380. };
  26381. Parser.prototype.getInvokingContext = function (ruleIndex) {
  26382. var ctx = this._ctx;
  26383. while (ctx !== null) {
  26384. if (ctx.ruleIndex === ruleIndex) {
  26385. return ctx;
  26386. }
  26387. ctx = ctx.parentCtx;
  26388. }
  26389. return null;
  26390. };
  26391. Parser.prototype.precpred = function (localctx, precedence) {
  26392. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  26393. };
  26394. Parser.prototype.inContext = function (context) {
  26395. // TODO: useful in parser?
  26396. return false;
  26397. };
  26398. //
  26399. // Checks whether or not {@code symbol} can follow the current state in the
  26400. // ATN. The behavior of this method is equivalent to the following, but is
  26401. // implemented such that the complete context-sensitive follow set does not
  26402. // need to be explicitly constructed.
  26403. //
  26404. // <pre>
  26405. // return getExpectedTokens().contains(symbol);
  26406. // </pre>
  26407. //
  26408. // @param symbol the symbol type to check
  26409. // @return {@code true} if {@code symbol} can follow the current state in
  26410. // the ATN, otherwise {@code false}.
  26411. Parser.prototype.isExpectedToken = function (symbol) {
  26412. var atn = this._interp.atn;
  26413. var ctx = this._ctx;
  26414. var s = atn.states[this.state];
  26415. var following = atn.nextTokens(s);
  26416. if (following.contains(symbol)) {
  26417. return true;
  26418. }
  26419. if (!following.contains(Token.EPSILON)) {
  26420. return false;
  26421. }
  26422. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  26423. var invokingState = atn.states[ctx.invokingState];
  26424. var rt = invokingState.transitions[0];
  26425. following = atn.nextTokens(rt.followState);
  26426. if (following.contains(symbol)) {
  26427. return true;
  26428. }
  26429. ctx = ctx.parentCtx;
  26430. }
  26431. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  26432. return true;
  26433. } else {
  26434. return false;
  26435. }
  26436. };
  26437. // Computes the set of input symbols which could follow the current parser
  26438. // state and context, as given by {@link //getState} and {@link //getContext},
  26439. // respectively.
  26440. //
  26441. // @see ATN//getExpectedTokens(int, RuleContext)
  26442. //
  26443. Parser.prototype.getExpectedTokens = function () {
  26444. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  26445. };
  26446. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  26447. var atn = this._interp.atn;
  26448. var s = atn.states[this.state];
  26449. return atn.nextTokens(s);
  26450. };
  26451. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  26452. Parser.prototype.getRuleIndex = function (ruleName) {
  26453. var ruleIndex = this.getRuleIndexMap()[ruleName];
  26454. if (ruleIndex !== null) {
  26455. return ruleIndex;
  26456. } else {
  26457. return -1;
  26458. }
  26459. };
  26460. // Return List&lt;String&gt; of the rule names in your parser instance
  26461. // leading up to a call to the current rule. You could override if
  26462. // you want more details such as the file/line info of where
  26463. // in the ATN a rule is invoked.
  26464. //
  26465. // this is very useful for error messages.
  26466. //
  26467. Parser.prototype.getRuleInvocationStack = function (p) {
  26468. p = p || null;
  26469. if (p === null) {
  26470. p = this._ctx;
  26471. }
  26472. var stack = [];
  26473. while (p !== null) {
  26474. // compute what follows who invoked us
  26475. var ruleIndex = p.ruleIndex;
  26476. if (ruleIndex < 0) {
  26477. stack.push("n/a");
  26478. } else {
  26479. stack.push(this.ruleNames[ruleIndex]);
  26480. }
  26481. p = p.parentCtx;
  26482. }
  26483. return stack;
  26484. };
  26485. // For debugging and other purposes.//
  26486. Parser.prototype.getDFAStrings = function () {
  26487. return this._interp.decisionToDFA.toString();
  26488. };
  26489. // For debugging and other purposes.//
  26490. Parser.prototype.dumpDFA = function () {
  26491. var seenOne = false;
  26492. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  26493. var dfa = this._interp.decisionToDFA[i];
  26494. if (dfa.states.length > 0) {
  26495. if (seenOne) {
  26496. console.log();
  26497. }
  26498. this.printer.println("Decision " + dfa.decision + ":");
  26499. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  26500. seenOne = true;
  26501. }
  26502. }
  26503. };
  26504. /*
  26505. " printer = function() {\r\n" +
  26506. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  26507. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  26508. " };\r\n" +
  26509. */
  26510. Parser.prototype.getSourceName = function () {
  26511. return this._input.sourceName;
  26512. };
  26513. // During a parse is sometimes useful to listen in on the rule entry and exit
  26514. // events as well as token matches. this is for quick and dirty debugging.
  26515. //
  26516. Parser.prototype.setTrace = function (trace) {
  26517. if (!trace) {
  26518. this.removeParseListener(this._tracer);
  26519. this._tracer = null;
  26520. } else {
  26521. if (this._tracer !== null) {
  26522. this.removeParseListener(this._tracer);
  26523. }
  26524. this._tracer = new TraceListener(this);
  26525. this.addParseListener(this._tracer);
  26526. }
  26527. };
  26528. exports.Parser = Parser;
  26529. /***/ }),
  26530. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  26531. /*!**************************************************!*\
  26532. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  26533. \**************************************************/
  26534. /*! no static exports found */
  26535. /***/ (function(module, exports, __webpack_require__) {
  26536. "use strict";
  26537. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26538. * Use of this file is governed by the BSD 3-clause license that
  26539. * can be found in the LICENSE.txt file in the project root.
  26540. */
  26541. //* A rule invocation record for parsing.
  26542. //
  26543. // Contains all of the information about the current rule not stored in the
  26544. // RuleContext. It handles parse tree children list, Any ATN state
  26545. // tracing, and the default values available for rule indications:
  26546. // start, stop, rule index, current alt number, current
  26547. // ATN state.
  26548. //
  26549. // Subclasses made for each rule and grammar track the parameters,
  26550. // return values, locals, and labels specific to that rule. These
  26551. // are the objects that are returned from rules.
  26552. //
  26553. // Note text is not an actual field of a rule return value; it is computed
  26554. // from start and stop using the input stream's toString() method. I
  26555. // could add a ctor to this so that we can pass in and store the input
  26556. // stream, but I'm not sure we want to do that. It would seem to be undefined
  26557. // to get the .text property anyway if the rule matches tokens from multiple
  26558. // input streams.
  26559. //
  26560. // I do not use getters for fields of objects that are used simply to
  26561. // group values such as this aggregate. The getters/setters are there to
  26562. // satisfy the superclass interface.
  26563. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  26564. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  26565. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  26566. var TerminalNode = Tree.TerminalNode;
  26567. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  26568. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  26569. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  26570. function ParserRuleContext(parent, invokingStateNumber) {
  26571. parent = parent || null;
  26572. invokingStateNumber = invokingStateNumber || null;
  26573. RuleContext.call(this, parent, invokingStateNumber);
  26574. this.ruleIndex = -1;
  26575. // * If we are debugging or building a parse tree for a visitor,
  26576. // we need to track all of the tokens and rule invocations associated
  26577. // with this rule's context. This is empty for parsing w/o tree constr.
  26578. // operation because we don't the need to track the details about
  26579. // how we parse this rule.
  26580. // /
  26581. this.children = null;
  26582. this.start = null;
  26583. this.stop = null;
  26584. // The exception that forced this rule to return. If the rule successfully
  26585. // completed, this is {@code null}.
  26586. this.exception = null;
  26587. }
  26588. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  26589. ParserRuleContext.prototype.constructor = ParserRuleContext;
  26590. // * COPY a ctx (I'm deliberately not using copy constructor)///
  26591. ParserRuleContext.prototype.copyFrom = function (ctx) {
  26592. // from RuleContext
  26593. this.parentCtx = ctx.parentCtx;
  26594. this.invokingState = ctx.invokingState;
  26595. this.children = null;
  26596. this.start = ctx.start;
  26597. this.stop = ctx.stop;
  26598. // copy any error nodes to alt label node
  26599. if (ctx.children) {
  26600. this.children = [];
  26601. // reset parent pointer for any error nodes
  26602. ctx.children.map(function (child) {
  26603. if (child instanceof ErrorNodeImpl) {
  26604. this.children.push(child);
  26605. child.parentCtx = this;
  26606. }
  26607. }, this);
  26608. }
  26609. };
  26610. // Double dispatch methods for listeners
  26611. ParserRuleContext.prototype.enterRule = function (listener) {};
  26612. ParserRuleContext.prototype.exitRule = function (listener) {};
  26613. // * Does not set parent link; other add methods do that///
  26614. ParserRuleContext.prototype.addChild = function (child) {
  26615. if (this.children === null) {
  26616. this.children = [];
  26617. }
  26618. this.children.push(child);
  26619. return child;
  26620. };
  26621. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  26622. // we entered a rule. If we have // label, we will need to remove
  26623. // generic ruleContext object.
  26624. // /
  26625. ParserRuleContext.prototype.removeLastChild = function () {
  26626. if (this.children !== null) {
  26627. this.children.pop();
  26628. }
  26629. };
  26630. ParserRuleContext.prototype.addTokenNode = function (token) {
  26631. var node = new TerminalNodeImpl(token);
  26632. this.addChild(node);
  26633. node.parentCtx = this;
  26634. return node;
  26635. };
  26636. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  26637. var node = new ErrorNodeImpl(badToken);
  26638. this.addChild(node);
  26639. node.parentCtx = this;
  26640. return node;
  26641. };
  26642. ParserRuleContext.prototype.getChild = function (i, type) {
  26643. type = type || null;
  26644. if (this.children === null || i < 0 || i >= this.children.length) {
  26645. return null;
  26646. }
  26647. if (type === null) {
  26648. return this.children[i];
  26649. } else {
  26650. for (var j = 0; j < this.children.length; j++) {
  26651. var child = this.children[j];
  26652. if (child instanceof type) {
  26653. if (i === 0) {
  26654. return child;
  26655. } else {
  26656. i -= 1;
  26657. }
  26658. }
  26659. }
  26660. return null;
  26661. }
  26662. };
  26663. ParserRuleContext.prototype.getToken = function (ttype, i) {
  26664. if (this.children === null || i < 0 || i >= this.children.length) {
  26665. return null;
  26666. }
  26667. for (var j = 0; j < this.children.length; j++) {
  26668. var child = this.children[j];
  26669. if (child instanceof TerminalNode) {
  26670. if (child.symbol.type === ttype) {
  26671. if (i === 0) {
  26672. return child;
  26673. } else {
  26674. i -= 1;
  26675. }
  26676. }
  26677. }
  26678. }
  26679. return null;
  26680. };
  26681. ParserRuleContext.prototype.getTokens = function (ttype) {
  26682. if (this.children === null) {
  26683. return [];
  26684. } else {
  26685. var tokens = [];
  26686. for (var j = 0; j < this.children.length; j++) {
  26687. var child = this.children[j];
  26688. if (child instanceof TerminalNode) {
  26689. if (child.symbol.type === ttype) {
  26690. tokens.push(child);
  26691. }
  26692. }
  26693. }
  26694. return tokens;
  26695. }
  26696. };
  26697. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  26698. return this.getChild(i, ctxType);
  26699. };
  26700. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  26701. if (this.children === null) {
  26702. return [];
  26703. } else {
  26704. var contexts = [];
  26705. for (var j = 0; j < this.children.length; j++) {
  26706. var child = this.children[j];
  26707. if (child instanceof ctxType) {
  26708. contexts.push(child);
  26709. }
  26710. }
  26711. return contexts;
  26712. }
  26713. };
  26714. ParserRuleContext.prototype.getChildCount = function () {
  26715. if (this.children === null) {
  26716. return 0;
  26717. } else {
  26718. return this.children.length;
  26719. }
  26720. };
  26721. ParserRuleContext.prototype.getSourceInterval = function () {
  26722. if (this.start === null || this.stop === null) {
  26723. return INVALID_INTERVAL;
  26724. } else {
  26725. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  26726. }
  26727. };
  26728. RuleContext.EMPTY = new ParserRuleContext();
  26729. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  26730. ParserRuleContext.call(parent, invokingStateNumber);
  26731. this.ruleIndex = ruleIndex;
  26732. return this;
  26733. }
  26734. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  26735. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  26736. exports.ParserRuleContext = ParserRuleContext;
  26737. /***/ }),
  26738. /***/ "./node_modules/antlr4/PredictionContext.js":
  26739. /*!**************************************************!*\
  26740. !*** ./node_modules/antlr4/PredictionContext.js ***!
  26741. \**************************************************/
  26742. /*! no static exports found */
  26743. /***/ (function(module, exports, __webpack_require__) {
  26744. "use strict";
  26745. //
  26746. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26747. * Use of this file is governed by the BSD 3-clause license that
  26748. * can be found in the LICENSE.txt file in the project root.
  26749. */
  26750. ///
  26751. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  26752. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  26753. function PredictionContext(cachedHashCode) {
  26754. this.cachedHashCode = cachedHashCode;
  26755. }
  26756. // Represents {@code $} in local context prediction, which means wildcard.
  26757. // {@code//+x =//}.
  26758. // /
  26759. PredictionContext.EMPTY = null;
  26760. // Represents {@code $} in an array in full context mode, when {@code $}
  26761. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  26762. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  26763. // /
  26764. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  26765. PredictionContext.globalNodeCount = 1;
  26766. PredictionContext.id = PredictionContext.globalNodeCount;
  26767. // Stores the computed hash code of this {@link PredictionContext}. The hash
  26768. // code is computed in parts to match the following reference algorithm.
  26769. //
  26770. // <pre>
  26771. // private int referenceHashCode() {
  26772. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  26773. // //INITIAL_HASH});
  26774. //
  26775. // for (int i = 0; i &lt; {@link //size()}; i++) {
  26776. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  26777. // getParent}(i));
  26778. // }
  26779. //
  26780. // for (int i = 0; i &lt; {@link //size()}; i++) {
  26781. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  26782. // //getReturnState getReturnState}(i));
  26783. // }
  26784. //
  26785. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  26786. // //size()});
  26787. // return hash;
  26788. // }
  26789. // </pre>
  26790. // /
  26791. // This means only the {@link //EMPTY} context is in set.
  26792. PredictionContext.prototype.isEmpty = function () {
  26793. return this === PredictionContext.EMPTY;
  26794. };
  26795. PredictionContext.prototype.hasEmptyPath = function () {
  26796. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  26797. };
  26798. PredictionContext.prototype.hashCode = function () {
  26799. return this.cachedHashCode;
  26800. };
  26801. PredictionContext.prototype.updateHashCode = function (hash) {
  26802. hash.update(this.cachedHashCode);
  26803. };
  26804. /*
  26805. function calculateHashString(parent, returnState) {
  26806. return "" + parent + returnState;
  26807. }
  26808. */
  26809. // Used to cache {@link PredictionContext} objects. Its used for the shared
  26810. // context cash associated with contexts in DFA states. This cache
  26811. // can be used for both lexers and parsers.
  26812. function PredictionContextCache() {
  26813. this.cache = {};
  26814. return this;
  26815. }
  26816. // Add a context to the cache and return it. If the context already exists,
  26817. // return that one instead and do not add a new context to the cache.
  26818. // Protect shared cache from unsafe thread access.
  26819. //
  26820. PredictionContextCache.prototype.add = function (ctx) {
  26821. if (ctx === PredictionContext.EMPTY) {
  26822. return PredictionContext.EMPTY;
  26823. }
  26824. var existing = this.cache[ctx] || null;
  26825. if (existing !== null) {
  26826. return existing;
  26827. }
  26828. this.cache[ctx] = ctx;
  26829. return ctx;
  26830. };
  26831. PredictionContextCache.prototype.get = function (ctx) {
  26832. return this.cache[ctx] || null;
  26833. };
  26834. Object.defineProperty(PredictionContextCache.prototype, "length", {
  26835. get: function get() {
  26836. return this.cache.length;
  26837. }
  26838. });
  26839. function SingletonPredictionContext(parent, returnState) {
  26840. var hashCode = 0;
  26841. if (parent !== null) {
  26842. var hash = new Hash();
  26843. hash.update(parent, returnState);
  26844. hashCode = hash.finish();
  26845. }
  26846. PredictionContext.call(this, hashCode);
  26847. this.parentCtx = parent;
  26848. this.returnState = returnState;
  26849. }
  26850. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  26851. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  26852. SingletonPredictionContext.create = function (parent, returnState) {
  26853. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  26854. // someone can pass in the bits of an array ctx that mean $
  26855. return PredictionContext.EMPTY;
  26856. } else {
  26857. return new SingletonPredictionContext(parent, returnState);
  26858. }
  26859. };
  26860. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  26861. get: function get() {
  26862. return 1;
  26863. }
  26864. });
  26865. SingletonPredictionContext.prototype.getParent = function (index) {
  26866. return this.parentCtx;
  26867. };
  26868. SingletonPredictionContext.prototype.getReturnState = function (index) {
  26869. return this.returnState;
  26870. };
  26871. SingletonPredictionContext.prototype.equals = function (other) {
  26872. if (this === other) {
  26873. return true;
  26874. } else if (!(other instanceof SingletonPredictionContext)) {
  26875. return false;
  26876. } else if (this.hashCode() !== other.hashCode()) {
  26877. return false; // can't be same if hash is different
  26878. } else {
  26879. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  26880. }
  26881. };
  26882. SingletonPredictionContext.prototype.toString = function () {
  26883. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  26884. if (up.length === 0) {
  26885. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  26886. return "$";
  26887. } else {
  26888. return "" + this.returnState;
  26889. }
  26890. } else {
  26891. return "" + this.returnState + " " + up;
  26892. }
  26893. };
  26894. function EmptyPredictionContext() {
  26895. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  26896. return this;
  26897. }
  26898. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  26899. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  26900. EmptyPredictionContext.prototype.isEmpty = function () {
  26901. return true;
  26902. };
  26903. EmptyPredictionContext.prototype.getParent = function (index) {
  26904. return null;
  26905. };
  26906. EmptyPredictionContext.prototype.getReturnState = function (index) {
  26907. return this.returnState;
  26908. };
  26909. EmptyPredictionContext.prototype.equals = function (other) {
  26910. return this === other;
  26911. };
  26912. EmptyPredictionContext.prototype.toString = function () {
  26913. return "$";
  26914. };
  26915. PredictionContext.EMPTY = new EmptyPredictionContext();
  26916. function ArrayPredictionContext(parents, returnStates) {
  26917. // Parent can be null only if full ctx mode and we make an array
  26918. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  26919. // null parent and
  26920. // returnState == {@link //EMPTY_RETURN_STATE}.
  26921. var h = new Hash();
  26922. h.update(parents, returnStates);
  26923. var hashCode = h.finish();
  26924. PredictionContext.call(this, hashCode);
  26925. this.parents = parents;
  26926. this.returnStates = returnStates;
  26927. return this;
  26928. }
  26929. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  26930. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  26931. ArrayPredictionContext.prototype.isEmpty = function () {
  26932. // since EMPTY_RETURN_STATE can only appear in the last position, we
  26933. // don't need to verify that size==1
  26934. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  26935. };
  26936. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  26937. get: function get() {
  26938. return this.returnStates.length;
  26939. }
  26940. });
  26941. ArrayPredictionContext.prototype.getParent = function (index) {
  26942. return this.parents[index];
  26943. };
  26944. ArrayPredictionContext.prototype.getReturnState = function (index) {
  26945. return this.returnStates[index];
  26946. };
  26947. ArrayPredictionContext.prototype.equals = function (other) {
  26948. if (this === other) {
  26949. return true;
  26950. } else if (!(other instanceof ArrayPredictionContext)) {
  26951. return false;
  26952. } else if (this.hashCode() !== other.hashCode()) {
  26953. return false; // can't be same if hash is different
  26954. } else {
  26955. return this.returnStates === other.returnStates && this.parents === other.parents;
  26956. }
  26957. };
  26958. ArrayPredictionContext.prototype.toString = function () {
  26959. if (this.isEmpty()) {
  26960. return "[]";
  26961. } else {
  26962. var s = "[";
  26963. for (var i = 0; i < this.returnStates.length; i++) {
  26964. if (i > 0) {
  26965. s = s + ", ";
  26966. }
  26967. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  26968. s = s + "$";
  26969. continue;
  26970. }
  26971. s = s + this.returnStates[i];
  26972. if (this.parents[i] !== null) {
  26973. s = s + " " + this.parents[i];
  26974. } else {
  26975. s = s + "null";
  26976. }
  26977. }
  26978. return s + "]";
  26979. }
  26980. };
  26981. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  26982. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  26983. // /
  26984. function predictionContextFromRuleContext(atn, outerContext) {
  26985. if (outerContext === undefined || outerContext === null) {
  26986. outerContext = RuleContext.EMPTY;
  26987. }
  26988. // if we are in RuleContext of start rule, s, then PredictionContext
  26989. // is EMPTY. Nobody called us. (if we are empty, return empty)
  26990. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  26991. return PredictionContext.EMPTY;
  26992. }
  26993. // If we have a parent, convert it to a PredictionContext graph
  26994. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  26995. var state = atn.states[outerContext.invokingState];
  26996. var transition = state.transitions[0];
  26997. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  26998. }
  26999. /*
  27000. function calculateListsHashString(parents, returnStates) {
  27001. var s = "";
  27002. parents.map(function(p) {
  27003. s = s + p;
  27004. });
  27005. returnStates.map(function(r) {
  27006. s = s + r;
  27007. });
  27008. return s;
  27009. }
  27010. */
  27011. function merge(a, b, rootIsWildcard, mergeCache) {
  27012. // share same graph if both same
  27013. if (a === b) {
  27014. return a;
  27015. }
  27016. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  27017. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  27018. }
  27019. // At least one of a or b is array
  27020. // If one is $ and rootIsWildcard, return $ as// wildcard
  27021. if (rootIsWildcard) {
  27022. if (a instanceof EmptyPredictionContext) {
  27023. return a;
  27024. }
  27025. if (b instanceof EmptyPredictionContext) {
  27026. return b;
  27027. }
  27028. }
  27029. // convert singleton so both are arrays to normalize
  27030. if (a instanceof SingletonPredictionContext) {
  27031. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  27032. }
  27033. if (b instanceof SingletonPredictionContext) {
  27034. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  27035. }
  27036. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  27037. }
  27038. //
  27039. // Merge two {@link SingletonPredictionContext} instances.
  27040. //
  27041. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  27042. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  27043. // type="image/svg+xml"/></p>
  27044. //
  27045. // <p>Same stack top, parents differ; merge parents giving array node, then
  27046. // remainders of those graphs. A new root node is created to point to the
  27047. // merged parents.<br>
  27048. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  27049. // type="image/svg+xml"/></p>
  27050. //
  27051. // <p>Different stack tops pointing to same parent. Make array node for the
  27052. // root where both element in the root point to the same (original)
  27053. // parent.<br>
  27054. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  27055. // type="image/svg+xml"/></p>
  27056. //
  27057. // <p>Different stack tops pointing to different parents. Make array node for
  27058. // the root where each element points to the corresponding original
  27059. // parent.<br>
  27060. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  27061. // type="image/svg+xml"/></p>
  27062. //
  27063. // @param a the first {@link SingletonPredictionContext}
  27064. // @param b the second {@link SingletonPredictionContext}
  27065. // @param rootIsWildcard {@code true} if this is a local-context merge,
  27066. // otherwise false to indicate a full-context merge
  27067. // @param mergeCache
  27068. // /
  27069. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  27070. if (mergeCache !== null) {
  27071. var previous = mergeCache.get(a, b);
  27072. if (previous !== null) {
  27073. return previous;
  27074. }
  27075. previous = mergeCache.get(b, a);
  27076. if (previous !== null) {
  27077. return previous;
  27078. }
  27079. }
  27080. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  27081. if (rootMerge !== null) {
  27082. if (mergeCache !== null) {
  27083. mergeCache.set(a, b, rootMerge);
  27084. }
  27085. return rootMerge;
  27086. }
  27087. if (a.returnState === b.returnState) {
  27088. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  27089. // if parent is same as existing a or b parent or reduced to a parent,
  27090. // return it
  27091. if (parent === a.parentCtx) {
  27092. return a; // ax + bx = ax, if a=b
  27093. }
  27094. if (parent === b.parentCtx) {
  27095. return b; // ax + bx = bx, if a=b
  27096. }
  27097. // else: ax + ay = a'[x,y]
  27098. // merge parents x and y, giving array node with x,y then remainders
  27099. // of those graphs. dup a, a' points at merged array
  27100. // new joined parent so create new singleton pointing to it, a'
  27101. var spc = SingletonPredictionContext.create(parent, a.returnState);
  27102. if (mergeCache !== null) {
  27103. mergeCache.set(a, b, spc);
  27104. }
  27105. return spc;
  27106. } else {
  27107. // a != b payloads differ
  27108. // see if we can collapse parents due to $+x parents if local ctx
  27109. var singleParent = null;
  27110. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  27111. // ax +
  27112. // bx =
  27113. // [a,b]x
  27114. singleParent = a.parentCtx;
  27115. }
  27116. if (singleParent !== null) {
  27117. // parents are same
  27118. // sort payloads and use same parent
  27119. var payloads = [a.returnState, b.returnState];
  27120. if (a.returnState > b.returnState) {
  27121. payloads[0] = b.returnState;
  27122. payloads[1] = a.returnState;
  27123. }
  27124. var parents = [singleParent, singleParent];
  27125. var apc = new ArrayPredictionContext(parents, payloads);
  27126. if (mergeCache !== null) {
  27127. mergeCache.set(a, b, apc);
  27128. }
  27129. return apc;
  27130. }
  27131. // parents differ and can't merge them. Just pack together
  27132. // into array; can't merge.
  27133. // ax + by = [ax,by]
  27134. var payloads = [a.returnState, b.returnState];
  27135. var parents = [a.parentCtx, b.parentCtx];
  27136. if (a.returnState > b.returnState) {
  27137. // sort by payload
  27138. payloads[0] = b.returnState;
  27139. payloads[1] = a.returnState;
  27140. parents = [b.parentCtx, a.parentCtx];
  27141. }
  27142. var a_ = new ArrayPredictionContext(parents, payloads);
  27143. if (mergeCache !== null) {
  27144. mergeCache.set(a, b, a_);
  27145. }
  27146. return a_;
  27147. }
  27148. }
  27149. //
  27150. // Handle case where at least one of {@code a} or {@code b} is
  27151. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  27152. // to represent {@link //EMPTY}.
  27153. //
  27154. // <h2>Local-Context Merges</h2>
  27155. //
  27156. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  27157. // is true.</p>
  27158. //
  27159. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  27160. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  27161. //
  27162. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  27163. // {@code //EMPTY}; return left graph.<br>
  27164. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  27165. //
  27166. // <p>Special case of last merge if local context.<br>
  27167. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  27168. //
  27169. // <h2>Full-Context Merges</h2>
  27170. //
  27171. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  27172. // is false.</p>
  27173. //
  27174. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  27175. //
  27176. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  27177. // null parent).<br>
  27178. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  27179. //
  27180. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  27181. //
  27182. // @param a the first {@link SingletonPredictionContext}
  27183. // @param b the second {@link SingletonPredictionContext}
  27184. // @param rootIsWildcard {@code true} if this is a local-context merge,
  27185. // otherwise false to indicate a full-context merge
  27186. // /
  27187. function mergeRoot(a, b, rootIsWildcard) {
  27188. if (rootIsWildcard) {
  27189. if (a === PredictionContext.EMPTY) {
  27190. return PredictionContext.EMPTY; // // + b =//
  27191. }
  27192. if (b === PredictionContext.EMPTY) {
  27193. return PredictionContext.EMPTY; // a +// =//
  27194. }
  27195. } else {
  27196. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  27197. return PredictionContext.EMPTY; // $ + $ = $
  27198. } else if (a === PredictionContext.EMPTY) {
  27199. // $ + x = [$,x]
  27200. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  27201. var parents = [b.parentCtx, null];
  27202. return new ArrayPredictionContext(parents, payloads);
  27203. } else if (b === PredictionContext.EMPTY) {
  27204. // x + $ = [$,x] ($ is always first if present)
  27205. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  27206. var parents = [a.parentCtx, null];
  27207. return new ArrayPredictionContext(parents, payloads);
  27208. }
  27209. }
  27210. return null;
  27211. }
  27212. //
  27213. // Merge two {@link ArrayPredictionContext} instances.
  27214. //
  27215. // <p>Different tops, different parents.<br>
  27216. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  27217. //
  27218. // <p>Shared top, same parents.<br>
  27219. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  27220. //
  27221. // <p>Shared top, different parents.<br>
  27222. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  27223. //
  27224. // <p>Shared top, all shared parents.<br>
  27225. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  27226. // type="image/svg+xml"/></p>
  27227. //
  27228. // <p>Equal tops, merge parents and reduce top to
  27229. // {@link SingletonPredictionContext}.<br>
  27230. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  27231. // /
  27232. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  27233. if (mergeCache !== null) {
  27234. var previous = mergeCache.get(a, b);
  27235. if (previous !== null) {
  27236. return previous;
  27237. }
  27238. previous = mergeCache.get(b, a);
  27239. if (previous !== null) {
  27240. return previous;
  27241. }
  27242. }
  27243. // merge sorted payloads a + b => M
  27244. var i = 0; // walks a
  27245. var j = 0; // walks b
  27246. var k = 0; // walks target M array
  27247. var mergedReturnStates = [];
  27248. var mergedParents = [];
  27249. // walk and merge to yield mergedParents, mergedReturnStates
  27250. while (i < a.returnStates.length && j < b.returnStates.length) {
  27251. var a_parent = a.parents[i];
  27252. var b_parent = b.parents[j];
  27253. if (a.returnStates[i] === b.returnStates[j]) {
  27254. // same payload (stack tops are equal), must yield merged singleton
  27255. var payload = a.returnStates[i];
  27256. // $+$ = $
  27257. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  27258. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  27259. // ->
  27260. // ax
  27261. if (bothDollars || ax_ax) {
  27262. mergedParents[k] = a_parent; // choose left
  27263. mergedReturnStates[k] = payload;
  27264. } else {
  27265. // ax+ay -> a'[x,y]
  27266. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  27267. mergedParents[k] = mergedParent;
  27268. mergedReturnStates[k] = payload;
  27269. }
  27270. i += 1; // hop over left one as usual
  27271. j += 1; // but also skip one in right side since we merge
  27272. } else if (a.returnStates[i] < b.returnStates[j]) {
  27273. // copy a[i] to M
  27274. mergedParents[k] = a_parent;
  27275. mergedReturnStates[k] = a.returnStates[i];
  27276. i += 1;
  27277. } else {
  27278. // b > a, copy b[j] to M
  27279. mergedParents[k] = b_parent;
  27280. mergedReturnStates[k] = b.returnStates[j];
  27281. j += 1;
  27282. }
  27283. k += 1;
  27284. }
  27285. // copy over any payloads remaining in either array
  27286. if (i < a.returnStates.length) {
  27287. for (var p = i; p < a.returnStates.length; p++) {
  27288. mergedParents[k] = a.parents[p];
  27289. mergedReturnStates[k] = a.returnStates[p];
  27290. k += 1;
  27291. }
  27292. } else {
  27293. for (var p = j; p < b.returnStates.length; p++) {
  27294. mergedParents[k] = b.parents[p];
  27295. mergedReturnStates[k] = b.returnStates[p];
  27296. k += 1;
  27297. }
  27298. }
  27299. // trim merged if we combined a few that had same stack tops
  27300. if (k < mergedParents.length) {
  27301. // write index < last position; trim
  27302. if (k === 1) {
  27303. // for just one merged element, return singleton top
  27304. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  27305. if (mergeCache !== null) {
  27306. mergeCache.set(a, b, a_);
  27307. }
  27308. return a_;
  27309. }
  27310. mergedParents = mergedParents.slice(0, k);
  27311. mergedReturnStates = mergedReturnStates.slice(0, k);
  27312. }
  27313. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  27314. // if we created same array as a or b, return that instead
  27315. // TODO: track whether this is possible above during merge sort for speed
  27316. if (M === a) {
  27317. if (mergeCache !== null) {
  27318. mergeCache.set(a, b, a);
  27319. }
  27320. return a;
  27321. }
  27322. if (M === b) {
  27323. if (mergeCache !== null) {
  27324. mergeCache.set(a, b, b);
  27325. }
  27326. return b;
  27327. }
  27328. combineCommonParents(mergedParents);
  27329. if (mergeCache !== null) {
  27330. mergeCache.set(a, b, M);
  27331. }
  27332. return M;
  27333. }
  27334. //
  27335. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  27336. // ones.
  27337. // /
  27338. function combineCommonParents(parents) {
  27339. var uniqueParents = {};
  27340. for (var p = 0; p < parents.length; p++) {
  27341. var parent = parents[p];
  27342. if (!(parent in uniqueParents)) {
  27343. uniqueParents[parent] = parent;
  27344. }
  27345. }
  27346. for (var q = 0; q < parents.length; q++) {
  27347. parents[q] = uniqueParents[parents[q]];
  27348. }
  27349. }
  27350. function getCachedPredictionContext(context, contextCache, visited) {
  27351. if (context.isEmpty()) {
  27352. return context;
  27353. }
  27354. var existing = visited[context] || null;
  27355. if (existing !== null) {
  27356. return existing;
  27357. }
  27358. existing = contextCache.get(context);
  27359. if (existing !== null) {
  27360. visited[context] = existing;
  27361. return existing;
  27362. }
  27363. var changed = false;
  27364. var parents = [];
  27365. for (var i = 0; i < parents.length; i++) {
  27366. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  27367. if (changed || parent !== context.getParent(i)) {
  27368. if (!changed) {
  27369. parents = [];
  27370. for (var j = 0; j < context.length; j++) {
  27371. parents[j] = context.getParent(j);
  27372. }
  27373. changed = true;
  27374. }
  27375. parents[i] = parent;
  27376. }
  27377. }
  27378. if (!changed) {
  27379. contextCache.add(context);
  27380. visited[context] = context;
  27381. return context;
  27382. }
  27383. var updated = null;
  27384. if (parents.length === 0) {
  27385. updated = PredictionContext.EMPTY;
  27386. } else if (parents.length === 1) {
  27387. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  27388. } else {
  27389. updated = new ArrayPredictionContext(parents, context.returnStates);
  27390. }
  27391. contextCache.add(updated);
  27392. visited[updated] = updated;
  27393. visited[context] = updated;
  27394. return updated;
  27395. }
  27396. // ter's recursive version of Sam's getAllNodes()
  27397. function getAllContextNodes(context, nodes, visited) {
  27398. if (nodes === null) {
  27399. nodes = [];
  27400. return getAllContextNodes(context, nodes, visited);
  27401. } else if (visited === null) {
  27402. visited = {};
  27403. return getAllContextNodes(context, nodes, visited);
  27404. } else {
  27405. if (context === null || visited[context] !== null) {
  27406. return nodes;
  27407. }
  27408. visited[context] = context;
  27409. nodes.push(context);
  27410. for (var i = 0; i < context.length; i++) {
  27411. getAllContextNodes(context.getParent(i), nodes, visited);
  27412. }
  27413. return nodes;
  27414. }
  27415. }
  27416. exports.merge = merge;
  27417. exports.PredictionContext = PredictionContext;
  27418. exports.PredictionContextCache = PredictionContextCache;
  27419. exports.SingletonPredictionContext = SingletonPredictionContext;
  27420. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  27421. exports.getCachedPredictionContext = getCachedPredictionContext;
  27422. /***/ }),
  27423. /***/ "./node_modules/antlr4/Recognizer.js":
  27424. /*!*******************************************!*\
  27425. !*** ./node_modules/antlr4/Recognizer.js ***!
  27426. \*******************************************/
  27427. /*! no static exports found */
  27428. /***/ (function(module, exports, __webpack_require__) {
  27429. "use strict";
  27430. //
  27431. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27432. * Use of this file is governed by the BSD 3-clause license that
  27433. * can be found in the LICENSE.txt file in the project root.
  27434. */
  27435. //
  27436. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27437. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  27438. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  27439. function Recognizer() {
  27440. this._listeners = [ConsoleErrorListener.INSTANCE];
  27441. this._interp = null;
  27442. this._stateNumber = -1;
  27443. return this;
  27444. }
  27445. Recognizer.tokenTypeMapCache = {};
  27446. Recognizer.ruleIndexMapCache = {};
  27447. Recognizer.prototype.checkVersion = function (toolVersion) {
  27448. var runtimeVersion = "4.7.2";
  27449. if (runtimeVersion !== toolVersion) {
  27450. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  27451. }
  27452. };
  27453. Recognizer.prototype.addErrorListener = function (listener) {
  27454. this._listeners.push(listener);
  27455. };
  27456. Recognizer.prototype.removeErrorListeners = function () {
  27457. this._listeners = [];
  27458. };
  27459. Recognizer.prototype.getTokenTypeMap = function () {
  27460. var tokenNames = this.getTokenNames();
  27461. if (tokenNames === null) {
  27462. throw "The current recognizer does not provide a list of token names.";
  27463. }
  27464. var result = this.tokenTypeMapCache[tokenNames];
  27465. if (result === undefined) {
  27466. result = tokenNames.reduce(function (o, k, i) {
  27467. o[k] = i;
  27468. });
  27469. result.EOF = Token.EOF;
  27470. this.tokenTypeMapCache[tokenNames] = result;
  27471. }
  27472. return result;
  27473. };
  27474. // Get a map from rule names to rule indexes.
  27475. //
  27476. // <p>Used for XPath and tree pattern compilation.</p>
  27477. //
  27478. Recognizer.prototype.getRuleIndexMap = function () {
  27479. var ruleNames = this.ruleNames;
  27480. if (ruleNames === null) {
  27481. throw "The current recognizer does not provide a list of rule names.";
  27482. }
  27483. var result = this.ruleIndexMapCache[ruleNames];
  27484. if (result === undefined) {
  27485. result = ruleNames.reduce(function (o, k, i) {
  27486. o[k] = i;
  27487. });
  27488. this.ruleIndexMapCache[ruleNames] = result;
  27489. }
  27490. return result;
  27491. };
  27492. Recognizer.prototype.getTokenType = function (tokenName) {
  27493. var ttype = this.getTokenTypeMap()[tokenName];
  27494. if (ttype !== undefined) {
  27495. return ttype;
  27496. } else {
  27497. return Token.INVALID_TYPE;
  27498. }
  27499. };
  27500. // What is the error header, normally line/character position information?//
  27501. Recognizer.prototype.getErrorHeader = function (e) {
  27502. var line = e.getOffendingToken().line;
  27503. var column = e.getOffendingToken().column;
  27504. return "line " + line + ":" + column;
  27505. };
  27506. // How should a token be displayed in an error message? The default
  27507. // is to display just the text, but during development you might
  27508. // want to have a lot of information spit out. Override in that case
  27509. // to use t.toString() (which, for CommonToken, dumps everything about
  27510. // the token). This is better than forcing you to override a method in
  27511. // your token objects because you don't have to go modify your lexer
  27512. // so that it creates a new Java type.
  27513. //
  27514. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  27515. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  27516. // feature when necessary. For example, see
  27517. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  27518. //
  27519. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  27520. if (t === null) {
  27521. return "<no token>";
  27522. }
  27523. var s = t.text;
  27524. if (s === null) {
  27525. if (t.type === Token.EOF) {
  27526. s = "<EOF>";
  27527. } else {
  27528. s = "<" + t.type + ">";
  27529. }
  27530. }
  27531. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  27532. return "'" + s + "'";
  27533. };
  27534. Recognizer.prototype.getErrorListenerDispatch = function () {
  27535. return new ProxyErrorListener(this._listeners);
  27536. };
  27537. // subclass needs to override these if there are sempreds or actions
  27538. // that the ATN interp needs to execute
  27539. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  27540. return true;
  27541. };
  27542. Recognizer.prototype.precpred = function (localctx, precedence) {
  27543. return true;
  27544. };
  27545. //Indicate that the recognizer has changed internal state that is
  27546. //consistent with the ATN state passed in. This way we always know
  27547. //where we are in the ATN as the parser goes along. The rule
  27548. //context objects form a stack that lets us see the stack of
  27549. //invoking rules. Combine this and we have complete ATN
  27550. //configuration information.
  27551. Object.defineProperty(Recognizer.prototype, "state", {
  27552. get: function get() {
  27553. return this._stateNumber;
  27554. },
  27555. set: function set(state) {
  27556. this._stateNumber = state;
  27557. }
  27558. });
  27559. exports.Recognizer = Recognizer;
  27560. /***/ }),
  27561. /***/ "./node_modules/antlr4/RuleContext.js":
  27562. /*!********************************************!*\
  27563. !*** ./node_modules/antlr4/RuleContext.js ***!
  27564. \********************************************/
  27565. /*! no static exports found */
  27566. /***/ (function(module, exports, __webpack_require__) {
  27567. "use strict";
  27568. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27569. * Use of this file is governed by the BSD 3-clause license that
  27570. * can be found in the LICENSE.txt file in the project root.
  27571. */
  27572. ///
  27573. // A rule context is a record of a single rule invocation. It knows
  27574. // which context invoked it, if any. If there is no parent context, then
  27575. // naturally the invoking state is not valid. The parent link
  27576. // provides a chain upwards from the current rule invocation to the root
  27577. // of the invocation tree, forming a stack. We actually carry no
  27578. // information about the rule associated with this context (except
  27579. // when parsing). We keep only the state number of the invoking state from
  27580. // the ATN submachine that invoked this. Contrast this with the s
  27581. // pointer inside ParserRuleContext that tracks the current state
  27582. // being "executed" for the current rule.
  27583. //
  27584. // The parent contexts are useful for computing lookahead sets and
  27585. // getting error information.
  27586. //
  27587. // These objects are used during parsing and prediction.
  27588. // For the special case of parsers, we use the subclass
  27589. // ParserRuleContext.
  27590. //
  27591. // @see ParserRuleContext
  27592. ///
  27593. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  27594. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  27595. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  27596. function RuleContext(parent, invokingState) {
  27597. RuleNode.call(this);
  27598. // What context invoked this rule?
  27599. this.parentCtx = parent || null;
  27600. // What state invoked the rule associated with this context?
  27601. // The "return address" is the followState of invokingState
  27602. // If parent is null, this should be -1.
  27603. this.invokingState = invokingState || -1;
  27604. return this;
  27605. }
  27606. RuleContext.prototype = Object.create(RuleNode.prototype);
  27607. RuleContext.prototype.constructor = RuleContext;
  27608. RuleContext.prototype.depth = function () {
  27609. var n = 0;
  27610. var p = this;
  27611. while (p !== null) {
  27612. p = p.parentCtx;
  27613. n += 1;
  27614. }
  27615. return n;
  27616. };
  27617. // A context is empty if there is no invoking state; meaning nobody call
  27618. // current context.
  27619. RuleContext.prototype.isEmpty = function () {
  27620. return this.invokingState === -1;
  27621. };
  27622. // satisfy the ParseTree / SyntaxTree interface
  27623. RuleContext.prototype.getSourceInterval = function () {
  27624. return INVALID_INTERVAL;
  27625. };
  27626. RuleContext.prototype.getRuleContext = function () {
  27627. return this;
  27628. };
  27629. RuleContext.prototype.getPayload = function () {
  27630. return this;
  27631. };
  27632. // Return the combined text of all child nodes. This method only considers
  27633. // tokens which have been added to the parse tree.
  27634. // <p>
  27635. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  27636. // added to the parse trees, they will not appear in the output of this
  27637. // method.
  27638. // /
  27639. RuleContext.prototype.getText = function () {
  27640. if (this.getChildCount() === 0) {
  27641. return "";
  27642. } else {
  27643. return this.children.map(function (child) {
  27644. return child.getText();
  27645. }).join("");
  27646. }
  27647. };
  27648. // For rule associated with this parse tree internal node, return
  27649. // the outer alternative number used to match the input. Default
  27650. // implementation does not compute nor store this alt num. Create
  27651. // a subclass of ParserRuleContext with backing field and set
  27652. // option contextSuperClass.
  27653. // to set it.
  27654. RuleContext.prototype.getAltNumber = function () {
  27655. return INVALID_ALT_NUMBER;
  27656. };
  27657. // Set the outer alternative number for this context node. Default
  27658. // implementation does nothing to avoid backing field overhead for
  27659. // trees that don't need it. Create
  27660. // a subclass of ParserRuleContext with backing field and set
  27661. // option contextSuperClass.
  27662. RuleContext.prototype.setAltNumber = function (altNumber) {};
  27663. RuleContext.prototype.getChild = function (i) {
  27664. return null;
  27665. };
  27666. RuleContext.prototype.getChildCount = function () {
  27667. return 0;
  27668. };
  27669. RuleContext.prototype.accept = function (visitor) {
  27670. return visitor.visitChildren(this);
  27671. };
  27672. //need to manage circular dependencies, so export now
  27673. exports.RuleContext = RuleContext;
  27674. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  27675. // Print out a whole tree, not just a node, in LISP format
  27676. // (root child1 .. childN). Print just a node if this is a leaf.
  27677. //
  27678. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  27679. return Trees.toStringTree(this, ruleNames, recog);
  27680. };
  27681. RuleContext.prototype.toString = function (ruleNames, stop) {
  27682. ruleNames = ruleNames || null;
  27683. stop = stop || null;
  27684. var p = this;
  27685. var s = "[";
  27686. while (p !== null && p !== stop) {
  27687. if (ruleNames === null) {
  27688. if (!p.isEmpty()) {
  27689. s += p.invokingState;
  27690. }
  27691. } else {
  27692. var ri = p.ruleIndex;
  27693. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  27694. s += ruleName;
  27695. }
  27696. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  27697. s += " ";
  27698. }
  27699. p = p.parentCtx;
  27700. }
  27701. s += "]";
  27702. return s;
  27703. };
  27704. /***/ }),
  27705. /***/ "./node_modules/antlr4/Token.js":
  27706. /*!**************************************!*\
  27707. !*** ./node_modules/antlr4/Token.js ***!
  27708. \**************************************/
  27709. /*! no static exports found */
  27710. /***/ (function(module, exports, __webpack_require__) {
  27711. "use strict";
  27712. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27713. * Use of this file is governed by the BSD 3-clause license that
  27714. * can be found in the LICENSE.txt file in the project root.
  27715. */
  27716. //
  27717. // A token has properties: text, type, line, character position in the line
  27718. // (so we can ignore tabs), token channel, index, and source from which
  27719. // we obtained this token.
  27720. function Token() {
  27721. this.source = null;
  27722. this.type = null; // token type of the token
  27723. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  27724. this.start = null; // optional; return -1 if not implemented.
  27725. this.stop = null; // optional; return -1 if not implemented.
  27726. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  27727. this.line = null; // line=1..n of the 1st character
  27728. this.column = null; // beginning of the line at which it occurs, 0..n-1
  27729. this._text = null; // text of the token.
  27730. return this;
  27731. }
  27732. Token.INVALID_TYPE = 0;
  27733. // During lookahead operations, this "token" signifies we hit rule end ATN state
  27734. // and did not follow it despite needing to.
  27735. Token.EPSILON = -2;
  27736. Token.MIN_USER_TOKEN_TYPE = 1;
  27737. Token.EOF = -1;
  27738. // All tokens go to the parser (unless skip() is called in that rule)
  27739. // on a particular "channel". The parser tunes to a particular channel
  27740. // so that whitespace etc... can go to the parser on a "hidden" channel.
  27741. Token.DEFAULT_CHANNEL = 0;
  27742. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  27743. // by parser.
  27744. Token.HIDDEN_CHANNEL = 1;
  27745. // Explicitly set the text for this token. If {code text} is not
  27746. // {@code null}, then {@link //getText} will return this value rather than
  27747. // extracting the text from the input.
  27748. //
  27749. // @param text The explicit text of the token, or {@code null} if the text
  27750. // should be obtained from the input along with the start and stop indexes
  27751. // of the token.
  27752. Object.defineProperty(Token.prototype, "text", {
  27753. get: function get() {
  27754. return this._text;
  27755. },
  27756. set: function set(text) {
  27757. this._text = text;
  27758. }
  27759. });
  27760. Token.prototype.getTokenSource = function () {
  27761. return this.source[0];
  27762. };
  27763. Token.prototype.getInputStream = function () {
  27764. return this.source[1];
  27765. };
  27766. function CommonToken(source, type, channel, start, stop) {
  27767. Token.call(this);
  27768. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  27769. this.type = type !== undefined ? type : null;
  27770. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  27771. this.start = start !== undefined ? start : -1;
  27772. this.stop = stop !== undefined ? stop : -1;
  27773. this.tokenIndex = -1;
  27774. if (this.source[0] !== null) {
  27775. this.line = source[0].line;
  27776. this.column = source[0].column;
  27777. } else {
  27778. this.column = -1;
  27779. }
  27780. return this;
  27781. }
  27782. CommonToken.prototype = Object.create(Token.prototype);
  27783. CommonToken.prototype.constructor = CommonToken;
  27784. // An empty {@link Pair} which is used as the default value of
  27785. // {@link //source} for tokens that do not have a source.
  27786. CommonToken.EMPTY_SOURCE = [null, null];
  27787. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  27788. //
  27789. // <p>
  27790. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  27791. // constructed token will share a reference to the {@link //text} field and
  27792. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  27793. // be assigned the result of calling {@link //getText}, and {@link //source}
  27794. // will be constructed from the result of {@link Token//getTokenSource} and
  27795. // {@link Token//getInputStream}.</p>
  27796. //
  27797. // @param oldToken The token to copy.
  27798. //
  27799. CommonToken.prototype.clone = function () {
  27800. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  27801. t.tokenIndex = this.tokenIndex;
  27802. t.line = this.line;
  27803. t.column = this.column;
  27804. t.text = this.text;
  27805. return t;
  27806. };
  27807. Object.defineProperty(CommonToken.prototype, "text", {
  27808. get: function get() {
  27809. if (this._text !== null) {
  27810. return this._text;
  27811. }
  27812. var input = this.getInputStream();
  27813. if (input === null) {
  27814. return null;
  27815. }
  27816. var n = input.size;
  27817. if (this.start < n && this.stop < n) {
  27818. return input.getText(this.start, this.stop);
  27819. } else {
  27820. return "<EOF>";
  27821. }
  27822. },
  27823. set: function set(text) {
  27824. this._text = text;
  27825. }
  27826. });
  27827. CommonToken.prototype.toString = function () {
  27828. var txt = this.text;
  27829. if (txt !== null) {
  27830. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  27831. } else {
  27832. txt = "<no text>";
  27833. }
  27834. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  27835. };
  27836. exports.Token = Token;
  27837. exports.CommonToken = CommonToken;
  27838. /***/ }),
  27839. /***/ "./node_modules/antlr4/Utils.js":
  27840. /*!**************************************!*\
  27841. !*** ./node_modules/antlr4/Utils.js ***!
  27842. \**************************************/
  27843. /*! no static exports found */
  27844. /***/ (function(module, exports, __webpack_require__) {
  27845. "use strict";
  27846. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  27847. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27848. * Use of this file is governed by the BSD 3-clause license that
  27849. * can be found in the LICENSE.txt file in the project root.
  27850. */
  27851. function arrayToString(a) {
  27852. return "[" + a.join(", ") + "]";
  27853. }
  27854. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  27855. String.prototype.hashCode = function () {
  27856. var remainder,
  27857. bytes,
  27858. h1,
  27859. h1b,
  27860. c1,
  27861. c1b,
  27862. c2,
  27863. c2b,
  27864. k1,
  27865. i,
  27866. key = this.toString();
  27867. remainder = key.length & 3; // key.length % 4
  27868. bytes = key.length - remainder;
  27869. h1 = String.prototype.seed;
  27870. c1 = 0xcc9e2d51;
  27871. c2 = 0x1b873593;
  27872. i = 0;
  27873. while (i < bytes) {
  27874. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  27875. ++i;
  27876. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  27877. k1 = k1 << 15 | k1 >>> 17;
  27878. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  27879. h1 ^= k1;
  27880. h1 = h1 << 13 | h1 >>> 19;
  27881. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  27882. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  27883. }
  27884. k1 = 0;
  27885. switch (remainder) {
  27886. case 3:
  27887. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  27888. case 2:
  27889. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  27890. case 1:
  27891. k1 ^= key.charCodeAt(i) & 0xff;
  27892. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  27893. k1 = k1 << 15 | k1 >>> 17;
  27894. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  27895. h1 ^= k1;
  27896. }
  27897. h1 ^= key.length;
  27898. h1 ^= h1 >>> 16;
  27899. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  27900. h1 ^= h1 >>> 13;
  27901. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  27902. h1 ^= h1 >>> 16;
  27903. return h1 >>> 0;
  27904. };
  27905. function standardEqualsFunction(a, b) {
  27906. return a.equals(b);
  27907. }
  27908. function standardHashCodeFunction(a) {
  27909. return a.hashCode();
  27910. }
  27911. function Set(hashFunction, equalsFunction) {
  27912. this.data = {};
  27913. this.hashFunction = hashFunction || standardHashCodeFunction;
  27914. this.equalsFunction = equalsFunction || standardEqualsFunction;
  27915. return this;
  27916. }
  27917. Object.defineProperty(Set.prototype, "length", {
  27918. get: function get() {
  27919. var l = 0;
  27920. for (var key in this.data) {
  27921. if (key.indexOf("hash_") === 0) {
  27922. l = l + this.data[key].length;
  27923. }
  27924. }
  27925. return l;
  27926. }
  27927. });
  27928. Set.prototype.add = function (value) {
  27929. var hash = this.hashFunction(value);
  27930. var key = "hash_" + hash;
  27931. if (key in this.data) {
  27932. var values = this.data[key];
  27933. for (var i = 0; i < values.length; i++) {
  27934. if (this.equalsFunction(value, values[i])) {
  27935. return values[i];
  27936. }
  27937. }
  27938. values.push(value);
  27939. return value;
  27940. } else {
  27941. this.data[key] = [value];
  27942. return value;
  27943. }
  27944. };
  27945. Set.prototype.contains = function (value) {
  27946. return this.get(value) != null;
  27947. };
  27948. Set.prototype.get = function (value) {
  27949. var hash = this.hashFunction(value);
  27950. var key = "hash_" + hash;
  27951. if (key in this.data) {
  27952. var values = this.data[key];
  27953. for (var i = 0; i < values.length; i++) {
  27954. if (this.equalsFunction(value, values[i])) {
  27955. return values[i];
  27956. }
  27957. }
  27958. }
  27959. return null;
  27960. };
  27961. Set.prototype.values = function () {
  27962. var l = [];
  27963. for (var key in this.data) {
  27964. if (key.indexOf("hash_") === 0) {
  27965. l = l.concat(this.data[key]);
  27966. }
  27967. }
  27968. return l;
  27969. };
  27970. Set.prototype.toString = function () {
  27971. return arrayToString(this.values());
  27972. };
  27973. function BitSet() {
  27974. this.data = [];
  27975. return this;
  27976. }
  27977. BitSet.prototype.add = function (value) {
  27978. this.data[value] = true;
  27979. };
  27980. BitSet.prototype.or = function (set) {
  27981. var bits = this;
  27982. Object.keys(set.data).map(function (alt) {
  27983. bits.add(alt);
  27984. });
  27985. };
  27986. BitSet.prototype.remove = function (value) {
  27987. delete this.data[value];
  27988. };
  27989. BitSet.prototype.contains = function (value) {
  27990. return this.data[value] === true;
  27991. };
  27992. BitSet.prototype.values = function () {
  27993. return Object.keys(this.data);
  27994. };
  27995. BitSet.prototype.minValue = function () {
  27996. return Math.min.apply(null, this.values());
  27997. };
  27998. BitSet.prototype.hashCode = function () {
  27999. var hash = new Hash();
  28000. hash.update(this.values());
  28001. return hash.finish();
  28002. };
  28003. BitSet.prototype.equals = function (other) {
  28004. if (!(other instanceof BitSet)) {
  28005. return false;
  28006. }
  28007. return this.hashCode() === other.hashCode();
  28008. };
  28009. Object.defineProperty(BitSet.prototype, "length", {
  28010. get: function get() {
  28011. return this.values().length;
  28012. }
  28013. });
  28014. BitSet.prototype.toString = function () {
  28015. return "{" + this.values().join(", ") + "}";
  28016. };
  28017. function Map(hashFunction, equalsFunction) {
  28018. this.data = {};
  28019. this.hashFunction = hashFunction || standardHashCodeFunction;
  28020. this.equalsFunction = equalsFunction || standardEqualsFunction;
  28021. return this;
  28022. }
  28023. Object.defineProperty(Map.prototype, "length", {
  28024. get: function get() {
  28025. var l = 0;
  28026. for (var hashKey in this.data) {
  28027. if (hashKey.indexOf("hash_") === 0) {
  28028. l = l + this.data[hashKey].length;
  28029. }
  28030. }
  28031. return l;
  28032. }
  28033. });
  28034. Map.prototype.put = function (key, value) {
  28035. var hashKey = "hash_" + this.hashFunction(key);
  28036. if (hashKey in this.data) {
  28037. var entries = this.data[hashKey];
  28038. for (var i = 0; i < entries.length; i++) {
  28039. var entry = entries[i];
  28040. if (this.equalsFunction(key, entry.key)) {
  28041. var oldValue = entry.value;
  28042. entry.value = value;
  28043. return oldValue;
  28044. }
  28045. }
  28046. entries.push({ key: key, value: value });
  28047. return value;
  28048. } else {
  28049. this.data[hashKey] = [{ key: key, value: value }];
  28050. return value;
  28051. }
  28052. };
  28053. Map.prototype.containsKey = function (key) {
  28054. var hashKey = "hash_" + this.hashFunction(key);
  28055. if (hashKey in this.data) {
  28056. var entries = this.data[hashKey];
  28057. for (var i = 0; i < entries.length; i++) {
  28058. var entry = entries[i];
  28059. if (this.equalsFunction(key, entry.key)) return true;
  28060. }
  28061. }
  28062. return false;
  28063. };
  28064. Map.prototype.get = function (key) {
  28065. var hashKey = "hash_" + this.hashFunction(key);
  28066. if (hashKey in this.data) {
  28067. var entries = this.data[hashKey];
  28068. for (var i = 0; i < entries.length; i++) {
  28069. var entry = entries[i];
  28070. if (this.equalsFunction(key, entry.key)) return entry.value;
  28071. }
  28072. }
  28073. return null;
  28074. };
  28075. Map.prototype.entries = function () {
  28076. var l = [];
  28077. for (var key in this.data) {
  28078. if (key.indexOf("hash_") === 0) {
  28079. l = l.concat(this.data[key]);
  28080. }
  28081. }
  28082. return l;
  28083. };
  28084. Map.prototype.getKeys = function () {
  28085. return this.entries().map(function (e) {
  28086. return e.key;
  28087. });
  28088. };
  28089. Map.prototype.getValues = function () {
  28090. return this.entries().map(function (e) {
  28091. return e.value;
  28092. });
  28093. };
  28094. Map.prototype.toString = function () {
  28095. var ss = this.entries().map(function (entry) {
  28096. return '{' + entry.key + ':' + entry.value + '}';
  28097. });
  28098. return '[' + ss.join(", ") + ']';
  28099. };
  28100. function AltDict() {
  28101. this.data = {};
  28102. return this;
  28103. }
  28104. AltDict.prototype.get = function (key) {
  28105. key = "k-" + key;
  28106. if (key in this.data) {
  28107. return this.data[key];
  28108. } else {
  28109. return null;
  28110. }
  28111. };
  28112. AltDict.prototype.put = function (key, value) {
  28113. key = "k-" + key;
  28114. this.data[key] = value;
  28115. };
  28116. AltDict.prototype.values = function () {
  28117. var data = this.data;
  28118. var keys = Object.keys(this.data);
  28119. return keys.map(function (key) {
  28120. return data[key];
  28121. });
  28122. };
  28123. function DoubleDict() {
  28124. return this;
  28125. }
  28126. function Hash() {
  28127. this.count = 0;
  28128. this.hash = 0;
  28129. return this;
  28130. }
  28131. Hash.prototype.update = function () {
  28132. for (var i = 0; i < arguments.length; i++) {
  28133. var value = arguments[i];
  28134. if (value == null) continue;
  28135. if (Array.isArray(value)) this.update.apply(value);else {
  28136. var k = 0;
  28137. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  28138. case 'undefined':
  28139. case 'function':
  28140. continue;
  28141. case 'number':
  28142. case 'boolean':
  28143. k = value;
  28144. break;
  28145. case 'string':
  28146. k = value.hashCode();
  28147. break;
  28148. default:
  28149. value.updateHashCode(this);
  28150. continue;
  28151. }
  28152. k = k * 0xCC9E2D51;
  28153. k = k << 15 | k >>> 32 - 15;
  28154. k = k * 0x1B873593;
  28155. this.count = this.count + 1;
  28156. var hash = this.hash ^ k;
  28157. hash = hash << 13 | hash >>> 32 - 13;
  28158. hash = hash * 5 + 0xE6546B64;
  28159. this.hash = hash;
  28160. }
  28161. }
  28162. };
  28163. Hash.prototype.finish = function () {
  28164. var hash = this.hash ^ this.count * 4;
  28165. hash = hash ^ hash >>> 16;
  28166. hash = hash * 0x85EBCA6B;
  28167. hash = hash ^ hash >>> 13;
  28168. hash = hash * 0xC2B2AE35;
  28169. hash = hash ^ hash >>> 16;
  28170. return hash;
  28171. };
  28172. function hashStuff() {
  28173. var hash = new Hash();
  28174. hash.update.apply(arguments);
  28175. return hash.finish();
  28176. }
  28177. DoubleDict.prototype.get = function (a, b) {
  28178. var d = this[a] || null;
  28179. return d === null ? null : d[b] || null;
  28180. };
  28181. DoubleDict.prototype.set = function (a, b, o) {
  28182. var d = this[a] || null;
  28183. if (d === null) {
  28184. d = {};
  28185. this[a] = d;
  28186. }
  28187. d[b] = o;
  28188. };
  28189. function escapeWhitespace(s, escapeSpaces) {
  28190. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  28191. if (escapeSpaces) {
  28192. s = s.replace(/ /g, "\xB7");
  28193. }
  28194. return s;
  28195. }
  28196. function titleCase(str) {
  28197. return str.replace(/\w\S*/g, function (txt) {
  28198. return txt.charAt(0).toUpperCase() + txt.substr(1);
  28199. });
  28200. };
  28201. function equalArrays(a, b) {
  28202. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  28203. if (a == b) return true;
  28204. if (a.length != b.length) return false;
  28205. for (var i = 0; i < a.length; i++) {
  28206. if (a[i] == b[i]) continue;
  28207. if (!a[i].equals(b[i])) return false;
  28208. }
  28209. return true;
  28210. };
  28211. exports.Hash = Hash;
  28212. exports.Set = Set;
  28213. exports.Map = Map;
  28214. exports.BitSet = BitSet;
  28215. exports.AltDict = AltDict;
  28216. exports.DoubleDict = DoubleDict;
  28217. exports.hashStuff = hashStuff;
  28218. exports.escapeWhitespace = escapeWhitespace;
  28219. exports.arrayToString = arrayToString;
  28220. exports.titleCase = titleCase;
  28221. exports.equalArrays = equalArrays;
  28222. /***/ }),
  28223. /***/ "./node_modules/antlr4/atn/ATN.js":
  28224. /*!****************************************!*\
  28225. !*** ./node_modules/antlr4/atn/ATN.js ***!
  28226. \****************************************/
  28227. /*! no static exports found */
  28228. /***/ (function(module, exports, __webpack_require__) {
  28229. "use strict";
  28230. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28231. * Use of this file is governed by the BSD 3-clause license that
  28232. * can be found in the LICENSE.txt file in the project root.
  28233. */
  28234. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  28235. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  28236. function ATN(grammarType, maxTokenType) {
  28237. // Used for runtime deserialization of ATNs from strings///
  28238. // The type of the ATN.
  28239. this.grammarType = grammarType;
  28240. // The maximum value for any symbol recognized by a transition in the ATN.
  28241. this.maxTokenType = maxTokenType;
  28242. this.states = [];
  28243. // Each subrule/rule is a decision point and we must track them so we
  28244. // can go back later and build DFA predictors for them. This includes
  28245. // all the rules, subrules, optional blocks, ()+, ()* etc...
  28246. this.decisionToState = [];
  28247. // Maps from rule index to starting state number.
  28248. this.ruleToStartState = [];
  28249. // Maps from rule index to stop state number.
  28250. this.ruleToStopState = null;
  28251. this.modeNameToStartState = {};
  28252. // For lexer ATNs, this maps the rule index to the resulting token type.
  28253. // For parser ATNs, this maps the rule index to the generated bypass token
  28254. // type if the
  28255. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  28256. // deserialization option was specified; otherwise, this is {@code null}.
  28257. this.ruleToTokenType = null;
  28258. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  28259. // be referenced by action transitions in the ATN.
  28260. this.lexerActions = null;
  28261. this.modeToStartState = [];
  28262. return this;
  28263. }
  28264. // Compute the set of valid tokens that can occur starting in state {@code s}.
  28265. // If {@code ctx} is null, the set of tokens will not include what can follow
  28266. // the rule surrounding {@code s}. In other words, the set will be
  28267. // restricted to tokens reachable staying within {@code s}'s rule.
  28268. ATN.prototype.nextTokensInContext = function (s, ctx) {
  28269. var anal = new LL1Analyzer(this);
  28270. return anal.LOOK(s, null, ctx);
  28271. };
  28272. // Compute the set of valid tokens that can occur starting in {@code s} and
  28273. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  28274. // rule.
  28275. ATN.prototype.nextTokensNoContext = function (s) {
  28276. if (s.nextTokenWithinRule !== null) {
  28277. return s.nextTokenWithinRule;
  28278. }
  28279. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  28280. s.nextTokenWithinRule.readOnly = true;
  28281. return s.nextTokenWithinRule;
  28282. };
  28283. ATN.prototype.nextTokens = function (s, ctx) {
  28284. if (ctx === undefined) {
  28285. return this.nextTokensNoContext(s);
  28286. } else {
  28287. return this.nextTokensInContext(s, ctx);
  28288. }
  28289. };
  28290. ATN.prototype.addState = function (state) {
  28291. if (state !== null) {
  28292. state.atn = this;
  28293. state.stateNumber = this.states.length;
  28294. }
  28295. this.states.push(state);
  28296. };
  28297. ATN.prototype.removeState = function (state) {
  28298. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  28299. };
  28300. ATN.prototype.defineDecisionState = function (s) {
  28301. this.decisionToState.push(s);
  28302. s.decision = this.decisionToState.length - 1;
  28303. return s.decision;
  28304. };
  28305. ATN.prototype.getDecisionState = function (decision) {
  28306. if (this.decisionToState.length === 0) {
  28307. return null;
  28308. } else {
  28309. return this.decisionToState[decision];
  28310. }
  28311. };
  28312. // Computes the set of input symbols which could follow ATN state number
  28313. // {@code stateNumber} in the specified full {@code context}. This method
  28314. // considers the complete parser context, but does not evaluate semantic
  28315. // predicates (i.e. all predicates encountered during the calculation are
  28316. // assumed true). If a path in the ATN exists from the starting state to the
  28317. // {@link RuleStopState} of the outermost context without matching any
  28318. // symbols, {@link Token//EOF} is added to the returned set.
  28319. //
  28320. // <p>If {@code context} is {@code null}, it is treated as
  28321. // {@link ParserRuleContext//EMPTY}.</p>
  28322. //
  28323. // @param stateNumber the ATN state number
  28324. // @param context the full parse context
  28325. // @return The set of potentially valid input symbols which could follow the
  28326. // specified state in the specified context.
  28327. // @throws IllegalArgumentException if the ATN does not contain a state with
  28328. // number {@code stateNumber}
  28329. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28330. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  28331. if (stateNumber < 0 || stateNumber >= this.states.length) {
  28332. throw "Invalid state number.";
  28333. }
  28334. var s = this.states[stateNumber];
  28335. var following = this.nextTokens(s);
  28336. if (!following.contains(Token.EPSILON)) {
  28337. return following;
  28338. }
  28339. var expected = new IntervalSet();
  28340. expected.addSet(following);
  28341. expected.removeOne(Token.EPSILON);
  28342. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  28343. var invokingState = this.states[ctx.invokingState];
  28344. var rt = invokingState.transitions[0];
  28345. following = this.nextTokens(rt.followState);
  28346. expected.addSet(following);
  28347. expected.removeOne(Token.EPSILON);
  28348. ctx = ctx.parentCtx;
  28349. }
  28350. if (following.contains(Token.EPSILON)) {
  28351. expected.addOne(Token.EOF);
  28352. }
  28353. return expected;
  28354. };
  28355. ATN.INVALID_ALT_NUMBER = 0;
  28356. exports.ATN = ATN;
  28357. /***/ }),
  28358. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  28359. /*!**********************************************!*\
  28360. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  28361. \**********************************************/
  28362. /*! no static exports found */
  28363. /***/ (function(module, exports, __webpack_require__) {
  28364. "use strict";
  28365. //
  28366. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28367. * Use of this file is governed by the BSD 3-clause license that
  28368. * can be found in the LICENSE.txt file in the project root.
  28369. */
  28370. ///
  28371. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  28372. // The syntactic context is a graph-structured stack node whose
  28373. // path(s) to the root is the rule invocation(s)
  28374. // chain used to arrive at the state. The semantic context is
  28375. // the tree of semantic predicates encountered before reaching
  28376. // an ATN state.
  28377. ///
  28378. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  28379. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  28380. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  28381. function checkParams(params, isCfg) {
  28382. if (params === null) {
  28383. var result = { state: null, alt: null, context: null, semanticContext: null };
  28384. if (isCfg) {
  28385. result.reachesIntoOuterContext = 0;
  28386. }
  28387. return result;
  28388. } else {
  28389. var props = {};
  28390. props.state = params.state || null;
  28391. props.alt = params.alt === undefined ? null : params.alt;
  28392. props.context = params.context || null;
  28393. props.semanticContext = params.semanticContext || null;
  28394. if (isCfg) {
  28395. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  28396. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  28397. }
  28398. return props;
  28399. }
  28400. }
  28401. function ATNConfig(params, config) {
  28402. this.checkContext(params, config);
  28403. params = checkParams(params);
  28404. config = checkParams(config, true);
  28405. // The ATN state associated with this configuration///
  28406. this.state = params.state !== null ? params.state : config.state;
  28407. // What alt (or lexer rule) is predicted by this configuration///
  28408. this.alt = params.alt !== null ? params.alt : config.alt;
  28409. // The stack of invoking states leading to the rule/states associated
  28410. // with this config. We track only those contexts pushed during
  28411. // execution of the ATN simulator.
  28412. this.context = params.context !== null ? params.context : config.context;
  28413. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  28414. // We cannot execute predicates dependent upon local context unless
  28415. // we know for sure we are in the correct context. Because there is
  28416. // no way to do this efficiently, we simply cannot evaluate
  28417. // dependent predicates unless we are in the rule that initially
  28418. // invokes the ATN simulator.
  28419. //
  28420. // closure() tracks the depth of how far we dip into the
  28421. // outer context: depth &gt; 0. Note that it may not be totally
  28422. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  28423. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  28424. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  28425. return this;
  28426. }
  28427. ATNConfig.prototype.checkContext = function (params, config) {
  28428. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  28429. this.context = null;
  28430. }
  28431. };
  28432. ATNConfig.prototype.hashCode = function () {
  28433. var hash = new Hash();
  28434. this.updateHashCode(hash);
  28435. return hash.finish();
  28436. };
  28437. ATNConfig.prototype.updateHashCode = function (hash) {
  28438. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  28439. };
  28440. // An ATN configuration is equal to another if both have
  28441. // the same state, they predict the same alternative, and
  28442. // syntactic/semantic contexts are the same.
  28443. ATNConfig.prototype.equals = function (other) {
  28444. if (this === other) {
  28445. return true;
  28446. } else if (!(other instanceof ATNConfig)) {
  28447. return false;
  28448. } else {
  28449. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && (this.context === null ? other.context === null : this.context.equals(other.context)) && this.semanticContext.equals(other.semanticContext) && this.precedenceFilterSuppressed === other.precedenceFilterSuppressed;
  28450. }
  28451. };
  28452. ATNConfig.prototype.hashCodeForConfigSet = function () {
  28453. var hash = new Hash();
  28454. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  28455. return hash.finish();
  28456. };
  28457. ATNConfig.prototype.equalsForConfigSet = function (other) {
  28458. if (this === other) {
  28459. return true;
  28460. } else if (!(other instanceof ATNConfig)) {
  28461. return false;
  28462. } else {
  28463. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  28464. }
  28465. };
  28466. ATNConfig.prototype.toString = function () {
  28467. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  28468. };
  28469. function LexerATNConfig(params, config) {
  28470. ATNConfig.call(this, params, config);
  28471. // This is the backing field for {@link //getLexerActionExecutor}.
  28472. var lexerActionExecutor = params.lexerActionExecutor || null;
  28473. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  28474. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  28475. return this;
  28476. }
  28477. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  28478. LexerATNConfig.prototype.constructor = LexerATNConfig;
  28479. LexerATNConfig.prototype.updateHashCode = function (hash) {
  28480. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  28481. };
  28482. LexerATNConfig.prototype.equals = function (other) {
  28483. return this === other || other instanceof LexerATNConfig && this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision && (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) && ATNConfig.prototype.equals.call(this, other);
  28484. };
  28485. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  28486. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  28487. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  28488. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  28489. };
  28490. exports.ATNConfig = ATNConfig;
  28491. exports.LexerATNConfig = LexerATNConfig;
  28492. /***/ }),
  28493. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  28494. /*!*************************************************!*\
  28495. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  28496. \*************************************************/
  28497. /*! no static exports found */
  28498. /***/ (function(module, exports, __webpack_require__) {
  28499. "use strict";
  28500. //
  28501. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28502. * Use of this file is governed by the BSD 3-clause license that
  28503. * can be found in the LICENSE.txt file in the project root.
  28504. */
  28505. //
  28506. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  28507. // info about the set, with support for combining similar configurations using a
  28508. // graph-structured stack.
  28509. ///
  28510. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  28511. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  28512. var Hash = Utils.Hash;
  28513. var Set = Utils.Set;
  28514. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  28515. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  28516. function hashATNConfig(c) {
  28517. return c.hashCodeForConfigSet();
  28518. }
  28519. function equalATNConfigs(a, b) {
  28520. if (a === b) {
  28521. return true;
  28522. } else if (a === null || b === null) {
  28523. return false;
  28524. } else return a.equalsForConfigSet(b);
  28525. }
  28526. function ATNConfigSet(fullCtx) {
  28527. //
  28528. // The reason that we need this is because we don't want the hash map to use
  28529. // the standard hash code and equals. We need all configurations with the
  28530. // same
  28531. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  28532. // doubles
  28533. // the number of objects associated with ATNConfigs. The other solution is
  28534. // to
  28535. // use a hash table that lets us specify the equals/hashcode operation.
  28536. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  28537. // when we go readonly as this set becomes a DFA state.
  28538. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  28539. // Indicates that this configuration set is part of a full context
  28540. // LL prediction. It will be used to determine how to merge $. With SLL
  28541. // it's a wildcard whereas it is not for LL context merge.
  28542. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  28543. // Indicates that the set of configurations is read-only. Do not
  28544. // allow any code to manipulate the set; DFA states will point at
  28545. // the sets and they must not change. This does not protect the other
  28546. // fields; in particular, conflictingAlts is set after
  28547. // we've made this readonly.
  28548. this.readOnly = false;
  28549. // Track the elements as they are added to the set; supports get(i)///
  28550. this.configs = [];
  28551. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  28552. // together, saves recomputation
  28553. // TODO: can we track conflicts as they are added to save scanning configs
  28554. // later?
  28555. this.uniqueAlt = 0;
  28556. this.conflictingAlts = null;
  28557. // Used in parser and lexer. In lexer, it indicates we hit a pred
  28558. // while computing a closure operation. Don't make a DFA state from this.
  28559. this.hasSemanticContext = false;
  28560. this.dipsIntoOuterContext = false;
  28561. this.cachedHashCode = -1;
  28562. return this;
  28563. }
  28564. // Adding a new config means merging contexts with existing configs for
  28565. // {@code (s, i, pi, _)}, where {@code s} is the
  28566. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  28567. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  28568. // {@code (s,i,pi)} as key.
  28569. //
  28570. // <p>This method updates {@link //dipsIntoOuterContext} and
  28571. // {@link //hasSemanticContext} when necessary.</p>
  28572. // /
  28573. ATNConfigSet.prototype.add = function (config, mergeCache) {
  28574. if (mergeCache === undefined) {
  28575. mergeCache = null;
  28576. }
  28577. if (this.readOnly) {
  28578. throw "This set is readonly";
  28579. }
  28580. if (config.semanticContext !== SemanticContext.NONE) {
  28581. this.hasSemanticContext = true;
  28582. }
  28583. if (config.reachesIntoOuterContext > 0) {
  28584. this.dipsIntoOuterContext = true;
  28585. }
  28586. var existing = this.configLookup.add(config);
  28587. if (existing === config) {
  28588. this.cachedHashCode = -1;
  28589. this.configs.push(config); // track order here
  28590. return true;
  28591. }
  28592. // a previous (s,i,pi,_), merge with it and save result
  28593. var rootIsWildcard = !this.fullCtx;
  28594. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  28595. // no need to check for existing.context, config.context in cache
  28596. // since only way to create new graphs is "call rule" and here. We
  28597. // cache at both places.
  28598. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  28599. // make sure to preserve the precedence filter suppression during the merge
  28600. if (config.precedenceFilterSuppressed) {
  28601. existing.precedenceFilterSuppressed = true;
  28602. }
  28603. existing.context = merged; // replace context; no need to alt mapping
  28604. return true;
  28605. };
  28606. ATNConfigSet.prototype.getStates = function () {
  28607. var states = new Set();
  28608. for (var i = 0; i < this.configs.length; i++) {
  28609. states.add(this.configs[i].state);
  28610. }
  28611. return states;
  28612. };
  28613. ATNConfigSet.prototype.getPredicates = function () {
  28614. var preds = [];
  28615. for (var i = 0; i < this.configs.length; i++) {
  28616. var c = this.configs[i].semanticContext;
  28617. if (c !== SemanticContext.NONE) {
  28618. preds.push(c.semanticContext);
  28619. }
  28620. }
  28621. return preds;
  28622. };
  28623. Object.defineProperty(ATNConfigSet.prototype, "items", {
  28624. get: function get() {
  28625. return this.configs;
  28626. }
  28627. });
  28628. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  28629. if (this.readOnly) {
  28630. throw "This set is readonly";
  28631. }
  28632. if (this.configLookup.length === 0) {
  28633. return;
  28634. }
  28635. for (var i = 0; i < this.configs.length; i++) {
  28636. var config = this.configs[i];
  28637. config.context = interpreter.getCachedContext(config.context);
  28638. }
  28639. };
  28640. ATNConfigSet.prototype.addAll = function (coll) {
  28641. for (var i = 0; i < coll.length; i++) {
  28642. this.add(coll[i]);
  28643. }
  28644. return false;
  28645. };
  28646. ATNConfigSet.prototype.equals = function (other) {
  28647. return this === other || other instanceof ATNConfigSet && Utils.equalArrays(this.configs, other.configs) && this.fullCtx === other.fullCtx && this.uniqueAlt === other.uniqueAlt && this.conflictingAlts === other.conflictingAlts && this.hasSemanticContext === other.hasSemanticContext && this.dipsIntoOuterContext === other.dipsIntoOuterContext;
  28648. };
  28649. ATNConfigSet.prototype.hashCode = function () {
  28650. var hash = new Hash();
  28651. this.updateHashCode(hash);
  28652. return hash.finish();
  28653. };
  28654. ATNConfigSet.prototype.updateHashCode = function (hash) {
  28655. if (this.readOnly) {
  28656. if (this.cachedHashCode === -1) {
  28657. var hash = new Hash();
  28658. hash.update(this.configs);
  28659. this.cachedHashCode = hash.finish();
  28660. }
  28661. hash.update(this.cachedHashCode);
  28662. } else {
  28663. hash.update(this.configs);
  28664. }
  28665. };
  28666. Object.defineProperty(ATNConfigSet.prototype, "length", {
  28667. get: function get() {
  28668. return this.configs.length;
  28669. }
  28670. });
  28671. ATNConfigSet.prototype.isEmpty = function () {
  28672. return this.configs.length === 0;
  28673. };
  28674. ATNConfigSet.prototype.contains = function (item) {
  28675. if (this.configLookup === null) {
  28676. throw "This method is not implemented for readonly sets.";
  28677. }
  28678. return this.configLookup.contains(item);
  28679. };
  28680. ATNConfigSet.prototype.containsFast = function (item) {
  28681. if (this.configLookup === null) {
  28682. throw "This method is not implemented for readonly sets.";
  28683. }
  28684. return this.configLookup.containsFast(item);
  28685. };
  28686. ATNConfigSet.prototype.clear = function () {
  28687. if (this.readOnly) {
  28688. throw "This set is readonly";
  28689. }
  28690. this.configs = [];
  28691. this.cachedHashCode = -1;
  28692. this.configLookup = new Set();
  28693. };
  28694. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  28695. this.readOnly = readOnly;
  28696. if (readOnly) {
  28697. this.configLookup = null; // can't mod, no need for lookup cache
  28698. }
  28699. };
  28700. ATNConfigSet.prototype.toString = function () {
  28701. return Utils.arrayToString(this.configs) + (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") + (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") + (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") + (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  28702. };
  28703. function OrderedATNConfigSet() {
  28704. ATNConfigSet.call(this);
  28705. this.configLookup = new Set();
  28706. return this;
  28707. }
  28708. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  28709. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  28710. exports.ATNConfigSet = ATNConfigSet;
  28711. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  28712. /***/ }),
  28713. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  28714. /*!**************************************************************!*\
  28715. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  28716. \**************************************************************/
  28717. /*! no static exports found */
  28718. /***/ (function(module, exports, __webpack_require__) {
  28719. "use strict";
  28720. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28721. * Use of this file is governed by the BSD 3-clause license that
  28722. * can be found in the LICENSE.txt file in the project root.
  28723. */
  28724. function ATNDeserializationOptions(copyFrom) {
  28725. if (copyFrom === undefined) {
  28726. copyFrom = null;
  28727. }
  28728. this.readOnly = false;
  28729. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  28730. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  28731. return this;
  28732. }
  28733. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  28734. ATNDeserializationOptions.defaultOptions.readOnly = true;
  28735. // def __setattr__(self, key, value):
  28736. // if key!="readOnly" and self.readOnly:
  28737. // raise Exception("The object is read only.")
  28738. // super(type(self), self).__setattr__(key,value)
  28739. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  28740. /***/ }),
  28741. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  28742. /*!****************************************************!*\
  28743. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  28744. \****************************************************/
  28745. /*! no static exports found */
  28746. /***/ (function(module, exports, __webpack_require__) {
  28747. "use strict";
  28748. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28749. * Use of this file is governed by the BSD 3-clause license that
  28750. * can be found in the LICENSE.txt file in the project root.
  28751. */
  28752. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28753. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  28754. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  28755. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  28756. var ATNState = ATNStates.ATNState;
  28757. var BasicState = ATNStates.BasicState;
  28758. var DecisionState = ATNStates.DecisionState;
  28759. var BlockStartState = ATNStates.BlockStartState;
  28760. var BlockEndState = ATNStates.BlockEndState;
  28761. var LoopEndState = ATNStates.LoopEndState;
  28762. var RuleStartState = ATNStates.RuleStartState;
  28763. var RuleStopState = ATNStates.RuleStopState;
  28764. var TokensStartState = ATNStates.TokensStartState;
  28765. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  28766. var StarLoopbackState = ATNStates.StarLoopbackState;
  28767. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  28768. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  28769. var StarBlockStartState = ATNStates.StarBlockStartState;
  28770. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  28771. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  28772. var Transition = Transitions.Transition;
  28773. var AtomTransition = Transitions.AtomTransition;
  28774. var SetTransition = Transitions.SetTransition;
  28775. var NotSetTransition = Transitions.NotSetTransition;
  28776. var RuleTransition = Transitions.RuleTransition;
  28777. var RangeTransition = Transitions.RangeTransition;
  28778. var ActionTransition = Transitions.ActionTransition;
  28779. var EpsilonTransition = Transitions.EpsilonTransition;
  28780. var WildcardTransition = Transitions.WildcardTransition;
  28781. var PredicateTransition = Transitions.PredicateTransition;
  28782. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  28783. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  28784. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28785. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  28786. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  28787. var LexerActionType = LexerActions.LexerActionType;
  28788. var LexerSkipAction = LexerActions.LexerSkipAction;
  28789. var LexerChannelAction = LexerActions.LexerChannelAction;
  28790. var LexerCustomAction = LexerActions.LexerCustomAction;
  28791. var LexerMoreAction = LexerActions.LexerMoreAction;
  28792. var LexerTypeAction = LexerActions.LexerTypeAction;
  28793. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  28794. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  28795. var LexerModeAction = LexerActions.LexerModeAction;
  28796. // This is the earliest supported serialized UUID.
  28797. // stick to serialized version for now, we don't need a UUID instance
  28798. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  28799. //
  28800. // This UUID indicates the serialized ATN contains two sets of
  28801. // IntervalSets, where the second set's values are encoded as
  28802. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  28803. //
  28804. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  28805. // This list contains all of the currently supported UUIDs, ordered by when
  28806. // the feature first appeared in this branch.
  28807. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  28808. var SERIALIZED_VERSION = 3;
  28809. // This is the current serialized UUID.
  28810. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  28811. function initArray(length, value) {
  28812. var tmp = [];
  28813. tmp[length - 1] = value;
  28814. return tmp.map(function (i) {
  28815. return value;
  28816. });
  28817. }
  28818. function ATNDeserializer(options) {
  28819. if (options === undefined || options === null) {
  28820. options = ATNDeserializationOptions.defaultOptions;
  28821. }
  28822. this.deserializationOptions = options;
  28823. this.stateFactories = null;
  28824. this.actionFactories = null;
  28825. return this;
  28826. }
  28827. // Determines if a particular serialized representation of an ATN supports
  28828. // a particular feature, identified by the {@link UUID} used for serializing
  28829. // the ATN at the time the feature was first introduced.
  28830. //
  28831. // @param feature The {@link UUID} marking the first time the feature was
  28832. // supported in the serialized ATN.
  28833. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  28834. // currently being deserialized.
  28835. // @return {@code true} if the {@code actualUuid} value represents a
  28836. // serialized ATN at or after the feature identified by {@code feature} was
  28837. // introduced; otherwise, {@code false}.
  28838. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  28839. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  28840. if (idx1 < 0) {
  28841. return false;
  28842. }
  28843. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  28844. return idx2 >= idx1;
  28845. };
  28846. ATNDeserializer.prototype.deserialize = function (data) {
  28847. this.reset(data);
  28848. this.checkVersion();
  28849. this.checkUUID();
  28850. var atn = this.readATN();
  28851. this.readStates(atn);
  28852. this.readRules(atn);
  28853. this.readModes(atn);
  28854. var sets = [];
  28855. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  28856. this.readSets(atn, sets, this.readInt.bind(this));
  28857. // Next, if the ATN was serialized with the Unicode SMP feature,
  28858. // deserialize sets with 32-bit arguments <= U+10FFFF.
  28859. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  28860. this.readSets(atn, sets, this.readInt32.bind(this));
  28861. }
  28862. this.readEdges(atn, sets);
  28863. this.readDecisions(atn);
  28864. this.readLexerActions(atn);
  28865. this.markPrecedenceDecisions(atn);
  28866. this.verifyATN(atn);
  28867. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  28868. this.generateRuleBypassTransitions(atn);
  28869. // re-verify after modification
  28870. this.verifyATN(atn);
  28871. }
  28872. return atn;
  28873. };
  28874. ATNDeserializer.prototype.reset = function (data) {
  28875. var adjust = function adjust(c) {
  28876. var v = c.charCodeAt(0);
  28877. return v > 1 ? v - 2 : v + 65533;
  28878. };
  28879. var temp = data.split("").map(adjust);
  28880. // don't adjust the first value since that's the version number
  28881. temp[0] = data.charCodeAt(0);
  28882. this.data = temp;
  28883. this.pos = 0;
  28884. };
  28885. ATNDeserializer.prototype.checkVersion = function () {
  28886. var version = this.readInt();
  28887. if (version !== SERIALIZED_VERSION) {
  28888. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  28889. }
  28890. };
  28891. ATNDeserializer.prototype.checkUUID = function () {
  28892. var uuid = this.readUUID();
  28893. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  28894. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  28895. }
  28896. this.uuid = uuid;
  28897. };
  28898. ATNDeserializer.prototype.readATN = function () {
  28899. var grammarType = this.readInt();
  28900. var maxTokenType = this.readInt();
  28901. return new ATN(grammarType, maxTokenType);
  28902. };
  28903. ATNDeserializer.prototype.readStates = function (atn) {
  28904. var j, pair, stateNumber;
  28905. var loopBackStateNumbers = [];
  28906. var endStateNumbers = [];
  28907. var nstates = this.readInt();
  28908. for (var i = 0; i < nstates; i++) {
  28909. var stype = this.readInt();
  28910. // ignore bad type of states
  28911. if (stype === ATNState.INVALID_TYPE) {
  28912. atn.addState(null);
  28913. continue;
  28914. }
  28915. var ruleIndex = this.readInt();
  28916. if (ruleIndex === 0xFFFF) {
  28917. ruleIndex = -1;
  28918. }
  28919. var s = this.stateFactory(stype, ruleIndex);
  28920. if (stype === ATNState.LOOP_END) {
  28921. // special case
  28922. var loopBackStateNumber = this.readInt();
  28923. loopBackStateNumbers.push([s, loopBackStateNumber]);
  28924. } else if (s instanceof BlockStartState) {
  28925. var endStateNumber = this.readInt();
  28926. endStateNumbers.push([s, endStateNumber]);
  28927. }
  28928. atn.addState(s);
  28929. }
  28930. // delay the assignment of loop back and end states until we know all the
  28931. // state instances have been initialized
  28932. for (j = 0; j < loopBackStateNumbers.length; j++) {
  28933. pair = loopBackStateNumbers[j];
  28934. pair[0].loopBackState = atn.states[pair[1]];
  28935. }
  28936. for (j = 0; j < endStateNumbers.length; j++) {
  28937. pair = endStateNumbers[j];
  28938. pair[0].endState = atn.states[pair[1]];
  28939. }
  28940. var numNonGreedyStates = this.readInt();
  28941. for (j = 0; j < numNonGreedyStates; j++) {
  28942. stateNumber = this.readInt();
  28943. atn.states[stateNumber].nonGreedy = true;
  28944. }
  28945. var numPrecedenceStates = this.readInt();
  28946. for (j = 0; j < numPrecedenceStates; j++) {
  28947. stateNumber = this.readInt();
  28948. atn.states[stateNumber].isPrecedenceRule = true;
  28949. }
  28950. };
  28951. ATNDeserializer.prototype.readRules = function (atn) {
  28952. var i;
  28953. var nrules = this.readInt();
  28954. if (atn.grammarType === ATNType.LEXER) {
  28955. atn.ruleToTokenType = initArray(nrules, 0);
  28956. }
  28957. atn.ruleToStartState = initArray(nrules, 0);
  28958. for (i = 0; i < nrules; i++) {
  28959. var s = this.readInt();
  28960. var startState = atn.states[s];
  28961. atn.ruleToStartState[i] = startState;
  28962. if (atn.grammarType === ATNType.LEXER) {
  28963. var tokenType = this.readInt();
  28964. if (tokenType === 0xFFFF) {
  28965. tokenType = Token.EOF;
  28966. }
  28967. atn.ruleToTokenType[i] = tokenType;
  28968. }
  28969. }
  28970. atn.ruleToStopState = initArray(nrules, 0);
  28971. for (i = 0; i < atn.states.length; i++) {
  28972. var state = atn.states[i];
  28973. if (!(state instanceof RuleStopState)) {
  28974. continue;
  28975. }
  28976. atn.ruleToStopState[state.ruleIndex] = state;
  28977. atn.ruleToStartState[state.ruleIndex].stopState = state;
  28978. }
  28979. };
  28980. ATNDeserializer.prototype.readModes = function (atn) {
  28981. var nmodes = this.readInt();
  28982. for (var i = 0; i < nmodes; i++) {
  28983. var s = this.readInt();
  28984. atn.modeToStartState.push(atn.states[s]);
  28985. }
  28986. };
  28987. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  28988. var m = this.readInt();
  28989. for (var i = 0; i < m; i++) {
  28990. var iset = new IntervalSet();
  28991. sets.push(iset);
  28992. var n = this.readInt();
  28993. var containsEof = this.readInt();
  28994. if (containsEof !== 0) {
  28995. iset.addOne(-1);
  28996. }
  28997. for (var j = 0; j < n; j++) {
  28998. var i1 = readUnicode();
  28999. var i2 = readUnicode();
  29000. iset.addRange(i1, i2);
  29001. }
  29002. }
  29003. };
  29004. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  29005. var i, j, state, trans, target;
  29006. var nedges = this.readInt();
  29007. for (i = 0; i < nedges; i++) {
  29008. var src = this.readInt();
  29009. var trg = this.readInt();
  29010. var ttype = this.readInt();
  29011. var arg1 = this.readInt();
  29012. var arg2 = this.readInt();
  29013. var arg3 = this.readInt();
  29014. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  29015. var srcState = atn.states[src];
  29016. srcState.addTransition(trans);
  29017. }
  29018. // edges for rule stop states can be derived, so they aren't serialized
  29019. for (i = 0; i < atn.states.length; i++) {
  29020. state = atn.states[i];
  29021. for (j = 0; j < state.transitions.length; j++) {
  29022. var t = state.transitions[j];
  29023. if (!(t instanceof RuleTransition)) {
  29024. continue;
  29025. }
  29026. var outermostPrecedenceReturn = -1;
  29027. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  29028. if (t.precedence === 0) {
  29029. outermostPrecedenceReturn = t.target.ruleIndex;
  29030. }
  29031. }
  29032. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  29033. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  29034. }
  29035. }
  29036. for (i = 0; i < atn.states.length; i++) {
  29037. state = atn.states[i];
  29038. if (state instanceof BlockStartState) {
  29039. // we need to know the end state to set its start state
  29040. if (state.endState === null) {
  29041. throw "IllegalState";
  29042. }
  29043. // block end states can only be associated to a single block start
  29044. // state
  29045. if (state.endState.startState !== null) {
  29046. throw "IllegalState";
  29047. }
  29048. state.endState.startState = state;
  29049. }
  29050. if (state instanceof PlusLoopbackState) {
  29051. for (j = 0; j < state.transitions.length; j++) {
  29052. target = state.transitions[j].target;
  29053. if (target instanceof PlusBlockStartState) {
  29054. target.loopBackState = state;
  29055. }
  29056. }
  29057. } else if (state instanceof StarLoopbackState) {
  29058. for (j = 0; j < state.transitions.length; j++) {
  29059. target = state.transitions[j].target;
  29060. if (target instanceof StarLoopEntryState) {
  29061. target.loopBackState = state;
  29062. }
  29063. }
  29064. }
  29065. }
  29066. };
  29067. ATNDeserializer.prototype.readDecisions = function (atn) {
  29068. var ndecisions = this.readInt();
  29069. for (var i = 0; i < ndecisions; i++) {
  29070. var s = this.readInt();
  29071. var decState = atn.states[s];
  29072. atn.decisionToState.push(decState);
  29073. decState.decision = i;
  29074. }
  29075. };
  29076. ATNDeserializer.prototype.readLexerActions = function (atn) {
  29077. if (atn.grammarType === ATNType.LEXER) {
  29078. var count = this.readInt();
  29079. atn.lexerActions = initArray(count, null);
  29080. for (var i = 0; i < count; i++) {
  29081. var actionType = this.readInt();
  29082. var data1 = this.readInt();
  29083. if (data1 === 0xFFFF) {
  29084. data1 = -1;
  29085. }
  29086. var data2 = this.readInt();
  29087. if (data2 === 0xFFFF) {
  29088. data2 = -1;
  29089. }
  29090. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  29091. atn.lexerActions[i] = lexerAction;
  29092. }
  29093. }
  29094. };
  29095. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  29096. var i;
  29097. var count = atn.ruleToStartState.length;
  29098. for (i = 0; i < count; i++) {
  29099. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  29100. }
  29101. for (i = 0; i < count; i++) {
  29102. this.generateRuleBypassTransition(atn, i);
  29103. }
  29104. };
  29105. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  29106. var i, state;
  29107. var bypassStart = new BasicBlockStartState();
  29108. bypassStart.ruleIndex = idx;
  29109. atn.addState(bypassStart);
  29110. var bypassStop = new BlockEndState();
  29111. bypassStop.ruleIndex = idx;
  29112. atn.addState(bypassStop);
  29113. bypassStart.endState = bypassStop;
  29114. atn.defineDecisionState(bypassStart);
  29115. bypassStop.startState = bypassStart;
  29116. var excludeTransition = null;
  29117. var endState = null;
  29118. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  29119. // wrap from the beginning of the rule to the StarLoopEntryState
  29120. endState = null;
  29121. for (i = 0; i < atn.states.length; i++) {
  29122. state = atn.states[i];
  29123. if (this.stateIsEndStateFor(state, idx)) {
  29124. endState = state;
  29125. excludeTransition = state.loopBackState.transitions[0];
  29126. break;
  29127. }
  29128. }
  29129. if (excludeTransition === null) {
  29130. throw "Couldn't identify final state of the precedence rule prefix section.";
  29131. }
  29132. } else {
  29133. endState = atn.ruleToStopState[idx];
  29134. }
  29135. // all non-excluded transitions that currently target end state need to
  29136. // target blockEnd instead
  29137. for (i = 0; i < atn.states.length; i++) {
  29138. state = atn.states[i];
  29139. for (var j = 0; j < state.transitions.length; j++) {
  29140. var transition = state.transitions[j];
  29141. if (transition === excludeTransition) {
  29142. continue;
  29143. }
  29144. if (transition.target === endState) {
  29145. transition.target = bypassStop;
  29146. }
  29147. }
  29148. }
  29149. // all transitions leaving the rule start state need to leave blockStart
  29150. // instead
  29151. var ruleToStartState = atn.ruleToStartState[idx];
  29152. var count = ruleToStartState.transitions.length;
  29153. while (count > 0) {
  29154. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  29155. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  29156. }
  29157. // link the new states
  29158. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  29159. bypassStop.addTransition(new EpsilonTransition(endState));
  29160. var matchState = new BasicState();
  29161. atn.addState(matchState);
  29162. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  29163. bypassStart.addTransition(new EpsilonTransition(matchState));
  29164. };
  29165. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  29166. if (state.ruleIndex !== idx) {
  29167. return null;
  29168. }
  29169. if (!(state instanceof StarLoopEntryState)) {
  29170. return null;
  29171. }
  29172. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  29173. if (!(maybeLoopEndState instanceof LoopEndState)) {
  29174. return null;
  29175. }
  29176. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  29177. return state;
  29178. } else {
  29179. return null;
  29180. }
  29181. };
  29182. //
  29183. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  29184. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  29185. // correct value.
  29186. //
  29187. // @param atn The ATN.
  29188. //
  29189. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  29190. for (var i = 0; i < atn.states.length; i++) {
  29191. var state = atn.states[i];
  29192. if (!(state instanceof StarLoopEntryState)) {
  29193. continue;
  29194. }
  29195. // We analyze the ATN to determine if this ATN decision state is the
  29196. // decision for the closure block that determines whether a
  29197. // precedence rule should continue or complete.
  29198. //
  29199. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  29200. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  29201. if (maybeLoopEndState instanceof LoopEndState) {
  29202. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  29203. state.isPrecedenceDecision = true;
  29204. }
  29205. }
  29206. }
  29207. }
  29208. };
  29209. ATNDeserializer.prototype.verifyATN = function (atn) {
  29210. if (!this.deserializationOptions.verifyATN) {
  29211. return;
  29212. }
  29213. // verify assumptions
  29214. for (var i = 0; i < atn.states.length; i++) {
  29215. var state = atn.states[i];
  29216. if (state === null) {
  29217. continue;
  29218. }
  29219. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  29220. if (state instanceof PlusBlockStartState) {
  29221. this.checkCondition(state.loopBackState !== null);
  29222. } else if (state instanceof StarLoopEntryState) {
  29223. this.checkCondition(state.loopBackState !== null);
  29224. this.checkCondition(state.transitions.length === 2);
  29225. if (state.transitions[0].target instanceof StarBlockStartState) {
  29226. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  29227. this.checkCondition(!state.nonGreedy);
  29228. } else if (state.transitions[0].target instanceof LoopEndState) {
  29229. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  29230. this.checkCondition(state.nonGreedy);
  29231. } else {
  29232. throw "IllegalState";
  29233. }
  29234. } else if (state instanceof StarLoopbackState) {
  29235. this.checkCondition(state.transitions.length === 1);
  29236. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  29237. } else if (state instanceof LoopEndState) {
  29238. this.checkCondition(state.loopBackState !== null);
  29239. } else if (state instanceof RuleStartState) {
  29240. this.checkCondition(state.stopState !== null);
  29241. } else if (state instanceof BlockStartState) {
  29242. this.checkCondition(state.endState !== null);
  29243. } else if (state instanceof BlockEndState) {
  29244. this.checkCondition(state.startState !== null);
  29245. } else if (state instanceof DecisionState) {
  29246. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  29247. } else {
  29248. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  29249. }
  29250. }
  29251. };
  29252. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  29253. if (!condition) {
  29254. if (message === undefined || message === null) {
  29255. message = "IllegalState";
  29256. }
  29257. throw message;
  29258. }
  29259. };
  29260. ATNDeserializer.prototype.readInt = function () {
  29261. return this.data[this.pos++];
  29262. };
  29263. ATNDeserializer.prototype.readInt32 = function () {
  29264. var low = this.readInt();
  29265. var high = this.readInt();
  29266. return low | high << 16;
  29267. };
  29268. ATNDeserializer.prototype.readLong = function () {
  29269. var low = this.readInt32();
  29270. var high = this.readInt32();
  29271. return low & 0x00000000FFFFFFFF | high << 32;
  29272. };
  29273. function createByteToHex() {
  29274. var bth = [];
  29275. for (var i = 0; i < 256; i++) {
  29276. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  29277. }
  29278. return bth;
  29279. }
  29280. var byteToHex = createByteToHex();
  29281. ATNDeserializer.prototype.readUUID = function () {
  29282. var bb = [];
  29283. for (var i = 7; i >= 0; i--) {
  29284. var int = this.readInt();
  29285. /* jshint bitwise: false */
  29286. bb[2 * i + 1] = int & 0xFF;
  29287. bb[2 * i] = int >> 8 & 0xFF;
  29288. }
  29289. return byteToHex[bb[0]] + byteToHex[bb[1]] + byteToHex[bb[2]] + byteToHex[bb[3]] + '-' + byteToHex[bb[4]] + byteToHex[bb[5]] + '-' + byteToHex[bb[6]] + byteToHex[bb[7]] + '-' + byteToHex[bb[8]] + byteToHex[bb[9]] + '-' + byteToHex[bb[10]] + byteToHex[bb[11]] + byteToHex[bb[12]] + byteToHex[bb[13]] + byteToHex[bb[14]] + byteToHex[bb[15]];
  29290. };
  29291. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  29292. var target = atn.states[trg];
  29293. switch (type) {
  29294. case Transition.EPSILON:
  29295. return new EpsilonTransition(target);
  29296. case Transition.RANGE:
  29297. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  29298. case Transition.RULE:
  29299. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  29300. case Transition.PREDICATE:
  29301. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  29302. case Transition.PRECEDENCE:
  29303. return new PrecedencePredicateTransition(target, arg1);
  29304. case Transition.ATOM:
  29305. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  29306. case Transition.ACTION:
  29307. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  29308. case Transition.SET:
  29309. return new SetTransition(target, sets[arg1]);
  29310. case Transition.NOT_SET:
  29311. return new NotSetTransition(target, sets[arg1]);
  29312. case Transition.WILDCARD:
  29313. return new WildcardTransition(target);
  29314. default:
  29315. throw "The specified transition type: " + type + " is not valid.";
  29316. }
  29317. };
  29318. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  29319. if (this.stateFactories === null) {
  29320. var sf = [];
  29321. sf[ATNState.INVALID_TYPE] = null;
  29322. sf[ATNState.BASIC] = function () {
  29323. return new BasicState();
  29324. };
  29325. sf[ATNState.RULE_START] = function () {
  29326. return new RuleStartState();
  29327. };
  29328. sf[ATNState.BLOCK_START] = function () {
  29329. return new BasicBlockStartState();
  29330. };
  29331. sf[ATNState.PLUS_BLOCK_START] = function () {
  29332. return new PlusBlockStartState();
  29333. };
  29334. sf[ATNState.STAR_BLOCK_START] = function () {
  29335. return new StarBlockStartState();
  29336. };
  29337. sf[ATNState.TOKEN_START] = function () {
  29338. return new TokensStartState();
  29339. };
  29340. sf[ATNState.RULE_STOP] = function () {
  29341. return new RuleStopState();
  29342. };
  29343. sf[ATNState.BLOCK_END] = function () {
  29344. return new BlockEndState();
  29345. };
  29346. sf[ATNState.STAR_LOOP_BACK] = function () {
  29347. return new StarLoopbackState();
  29348. };
  29349. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  29350. return new StarLoopEntryState();
  29351. };
  29352. sf[ATNState.PLUS_LOOP_BACK] = function () {
  29353. return new PlusLoopbackState();
  29354. };
  29355. sf[ATNState.LOOP_END] = function () {
  29356. return new LoopEndState();
  29357. };
  29358. this.stateFactories = sf;
  29359. }
  29360. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  29361. throw "The specified state type " + type + " is not valid.";
  29362. } else {
  29363. var s = this.stateFactories[type]();
  29364. if (s !== null) {
  29365. s.ruleIndex = ruleIndex;
  29366. return s;
  29367. }
  29368. }
  29369. };
  29370. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  29371. if (this.actionFactories === null) {
  29372. var af = [];
  29373. af[LexerActionType.CHANNEL] = function (data1, data2) {
  29374. return new LexerChannelAction(data1);
  29375. };
  29376. af[LexerActionType.CUSTOM] = function (data1, data2) {
  29377. return new LexerCustomAction(data1, data2);
  29378. };
  29379. af[LexerActionType.MODE] = function (data1, data2) {
  29380. return new LexerModeAction(data1);
  29381. };
  29382. af[LexerActionType.MORE] = function (data1, data2) {
  29383. return LexerMoreAction.INSTANCE;
  29384. };
  29385. af[LexerActionType.POP_MODE] = function (data1, data2) {
  29386. return LexerPopModeAction.INSTANCE;
  29387. };
  29388. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  29389. return new LexerPushModeAction(data1);
  29390. };
  29391. af[LexerActionType.SKIP] = function (data1, data2) {
  29392. return LexerSkipAction.INSTANCE;
  29393. };
  29394. af[LexerActionType.TYPE] = function (data1, data2) {
  29395. return new LexerTypeAction(data1);
  29396. };
  29397. this.actionFactories = af;
  29398. }
  29399. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  29400. throw "The specified lexer action type " + type + " is not valid.";
  29401. } else {
  29402. return this.actionFactories[type](data1, data2);
  29403. }
  29404. };
  29405. exports.ATNDeserializer = ATNDeserializer;
  29406. /***/ }),
  29407. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  29408. /*!*************************************************!*\
  29409. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  29410. \*************************************************/
  29411. /*! no static exports found */
  29412. /***/ (function(module, exports, __webpack_require__) {
  29413. "use strict";
  29414. //
  29415. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29416. * Use of this file is governed by the BSD 3-clause license that
  29417. * can be found in the LICENSE.txt file in the project root.
  29418. */
  29419. ///
  29420. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  29421. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  29422. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  29423. function ATNSimulator(atn, sharedContextCache) {
  29424. // The context cache maps all PredictionContext objects that are ==
  29425. // to a single cached copy. This cache is shared across all contexts
  29426. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  29427. // to use only cached nodes/graphs in addDFAState(). We don't want to
  29428. // fill this during closure() since there are lots of contexts that
  29429. // pop up but are not used ever again. It also greatly slows down closure().
  29430. //
  29431. // <p>This cache makes a huge difference in memory and a little bit in speed.
  29432. // For the Java grammar on java.*, it dropped the memory requirements
  29433. // at the end from 25M to 16M. We don't store any of the full context
  29434. // graphs in the DFA because they are limited to local context only,
  29435. // but apparently there's a lot of repetition there as well. We optimize
  29436. // the config contexts before storing the config set in the DFA states
  29437. // by literally rebuilding them with cached subgraphs only.</p>
  29438. //
  29439. // <p>I tried a cache for use during closure operations, that was
  29440. // whacked after each adaptivePredict(). It cost a little bit
  29441. // more time I think and doesn't save on the overall footprint
  29442. // so it's not worth the complexity.</p>
  29443. ///
  29444. this.atn = atn;
  29445. this.sharedContextCache = sharedContextCache;
  29446. return this;
  29447. }
  29448. // Must distinguish between missing edge and edge we know leads nowhere///
  29449. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  29450. ATNSimulator.prototype.getCachedContext = function (context) {
  29451. if (this.sharedContextCache === null) {
  29452. return context;
  29453. }
  29454. var visited = {};
  29455. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  29456. };
  29457. exports.ATNSimulator = ATNSimulator;
  29458. /***/ }),
  29459. /***/ "./node_modules/antlr4/atn/ATNState.js":
  29460. /*!*********************************************!*\
  29461. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  29462. \*********************************************/
  29463. /*! no static exports found */
  29464. /***/ (function(module, exports, __webpack_require__) {
  29465. "use strict";
  29466. //
  29467. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29468. * Use of this file is governed by the BSD 3-clause license that
  29469. * can be found in the LICENSE.txt file in the project root.
  29470. */
  29471. //
  29472. // The following images show the relation of states and
  29473. // {@link ATNState//transitions} for various grammar constructs.
  29474. //
  29475. // <ul>
  29476. //
  29477. // <li>Solid edges marked with an &//0949; indicate a required
  29478. // {@link EpsilonTransition}.</li>
  29479. //
  29480. // <li>Dashed edges indicate locations where any transition derived from
  29481. // {@link Transition} might appear.</li>
  29482. //
  29483. // <li>Dashed nodes are place holders for either a sequence of linked
  29484. // {@link BasicState} states or the inclusion of a block representing a nested
  29485. // construct in one of the forms below.</li>
  29486. //
  29487. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  29488. // any number of alternatives (one or more). Nodes without the {@code ...} only
  29489. // support the exact number of alternatives shown in the diagram.</li>
  29490. //
  29491. // </ul>
  29492. //
  29493. // <h2>Basic Blocks</h2>
  29494. //
  29495. // <h3>Rule</h3>
  29496. //
  29497. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  29498. //
  29499. // <h3>Block of 1 or more alternatives</h3>
  29500. //
  29501. // <embed src="images/Block.svg" type="image/svg+xml"/>
  29502. //
  29503. // <h2>Greedy Loops</h2>
  29504. //
  29505. // <h3>Greedy Closure: {@code (...)*}</h3>
  29506. //
  29507. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  29508. //
  29509. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  29510. //
  29511. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  29512. //
  29513. // <h3>Greedy Optional: {@code (...)?}</h3>
  29514. //
  29515. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  29516. //
  29517. // <h2>Non-Greedy Loops</h2>
  29518. //
  29519. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  29520. //
  29521. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  29522. //
  29523. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  29524. //
  29525. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  29526. //
  29527. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  29528. //
  29529. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  29530. //
  29531. var INITIAL_NUM_TRANSITIONS = 4;
  29532. function ATNState() {
  29533. // Which ATN are we in?
  29534. this.atn = null;
  29535. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  29536. this.stateType = null;
  29537. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  29538. this.epsilonOnlyTransitions = false;
  29539. // Track the transitions emanating from this ATN state.
  29540. this.transitions = [];
  29541. // Used to cache lookahead during parsing, not used during construction
  29542. this.nextTokenWithinRule = null;
  29543. return this;
  29544. }
  29545. // constants for serialization
  29546. ATNState.INVALID_TYPE = 0;
  29547. ATNState.BASIC = 1;
  29548. ATNState.RULE_START = 2;
  29549. ATNState.BLOCK_START = 3;
  29550. ATNState.PLUS_BLOCK_START = 4;
  29551. ATNState.STAR_BLOCK_START = 5;
  29552. ATNState.TOKEN_START = 6;
  29553. ATNState.RULE_STOP = 7;
  29554. ATNState.BLOCK_END = 8;
  29555. ATNState.STAR_LOOP_BACK = 9;
  29556. ATNState.STAR_LOOP_ENTRY = 10;
  29557. ATNState.PLUS_LOOP_BACK = 11;
  29558. ATNState.LOOP_END = 12;
  29559. ATNState.serializationNames = ["INVALID", "BASIC", "RULE_START", "BLOCK_START", "PLUS_BLOCK_START", "STAR_BLOCK_START", "TOKEN_START", "RULE_STOP", "BLOCK_END", "STAR_LOOP_BACK", "STAR_LOOP_ENTRY", "PLUS_LOOP_BACK", "LOOP_END"];
  29560. ATNState.INVALID_STATE_NUMBER = -1;
  29561. ATNState.prototype.toString = function () {
  29562. return this.stateNumber;
  29563. };
  29564. ATNState.prototype.equals = function (other) {
  29565. if (other instanceof ATNState) {
  29566. return this.stateNumber === other.stateNumber;
  29567. } else {
  29568. return false;
  29569. }
  29570. };
  29571. ATNState.prototype.isNonGreedyExitState = function () {
  29572. return false;
  29573. };
  29574. ATNState.prototype.addTransition = function (trans, index) {
  29575. if (index === undefined) {
  29576. index = -1;
  29577. }
  29578. if (this.transitions.length === 0) {
  29579. this.epsilonOnlyTransitions = trans.isEpsilon;
  29580. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  29581. this.epsilonOnlyTransitions = false;
  29582. }
  29583. if (index === -1) {
  29584. this.transitions.push(trans);
  29585. } else {
  29586. this.transitions.splice(index, 1, trans);
  29587. }
  29588. };
  29589. function BasicState() {
  29590. ATNState.call(this);
  29591. this.stateType = ATNState.BASIC;
  29592. return this;
  29593. }
  29594. BasicState.prototype = Object.create(ATNState.prototype);
  29595. BasicState.prototype.constructor = BasicState;
  29596. function DecisionState() {
  29597. ATNState.call(this);
  29598. this.decision = -1;
  29599. this.nonGreedy = false;
  29600. return this;
  29601. }
  29602. DecisionState.prototype = Object.create(ATNState.prototype);
  29603. DecisionState.prototype.constructor = DecisionState;
  29604. // The start of a regular {@code (...)} block.
  29605. function BlockStartState() {
  29606. DecisionState.call(this);
  29607. this.endState = null;
  29608. return this;
  29609. }
  29610. BlockStartState.prototype = Object.create(DecisionState.prototype);
  29611. BlockStartState.prototype.constructor = BlockStartState;
  29612. function BasicBlockStartState() {
  29613. BlockStartState.call(this);
  29614. this.stateType = ATNState.BLOCK_START;
  29615. return this;
  29616. }
  29617. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  29618. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  29619. // Terminal node of a simple {@code (a|b|c)} block.
  29620. function BlockEndState() {
  29621. ATNState.call(this);
  29622. this.stateType = ATNState.BLOCK_END;
  29623. this.startState = null;
  29624. return this;
  29625. }
  29626. BlockEndState.prototype = Object.create(ATNState.prototype);
  29627. BlockEndState.prototype.constructor = BlockEndState;
  29628. // The last node in the ATN for a rule, unless that rule is the start symbol.
  29629. // In that case, there is one transition to EOF. Later, we might encode
  29630. // references to all calls to this rule to compute FOLLOW sets for
  29631. // error handling.
  29632. //
  29633. function RuleStopState() {
  29634. ATNState.call(this);
  29635. this.stateType = ATNState.RULE_STOP;
  29636. return this;
  29637. }
  29638. RuleStopState.prototype = Object.create(ATNState.prototype);
  29639. RuleStopState.prototype.constructor = RuleStopState;
  29640. function RuleStartState() {
  29641. ATNState.call(this);
  29642. this.stateType = ATNState.RULE_START;
  29643. this.stopState = null;
  29644. this.isPrecedenceRule = false;
  29645. return this;
  29646. }
  29647. RuleStartState.prototype = Object.create(ATNState.prototype);
  29648. RuleStartState.prototype.constructor = RuleStartState;
  29649. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  29650. // one to the loop back to start of the block and one to exit.
  29651. //
  29652. function PlusLoopbackState() {
  29653. DecisionState.call(this);
  29654. this.stateType = ATNState.PLUS_LOOP_BACK;
  29655. return this;
  29656. }
  29657. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  29658. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  29659. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  29660. // we don't use for code generation; somebody might need it, so I'm defining
  29661. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  29662. // real decision-making note for {@code A+}.
  29663. //
  29664. function PlusBlockStartState() {
  29665. BlockStartState.call(this);
  29666. this.stateType = ATNState.PLUS_BLOCK_START;
  29667. this.loopBackState = null;
  29668. return this;
  29669. }
  29670. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  29671. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  29672. // The block that begins a closure loop.
  29673. function StarBlockStartState() {
  29674. BlockStartState.call(this);
  29675. this.stateType = ATNState.STAR_BLOCK_START;
  29676. return this;
  29677. }
  29678. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  29679. StarBlockStartState.prototype.constructor = StarBlockStartState;
  29680. function StarLoopbackState() {
  29681. ATNState.call(this);
  29682. this.stateType = ATNState.STAR_LOOP_BACK;
  29683. return this;
  29684. }
  29685. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  29686. StarLoopbackState.prototype.constructor = StarLoopbackState;
  29687. function StarLoopEntryState() {
  29688. DecisionState.call(this);
  29689. this.stateType = ATNState.STAR_LOOP_ENTRY;
  29690. this.loopBackState = null;
  29691. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  29692. this.isPrecedenceDecision = null;
  29693. return this;
  29694. }
  29695. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  29696. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  29697. // Mark the end of a * or + loop.
  29698. function LoopEndState() {
  29699. ATNState.call(this);
  29700. this.stateType = ATNState.LOOP_END;
  29701. this.loopBackState = null;
  29702. return this;
  29703. }
  29704. LoopEndState.prototype = Object.create(ATNState.prototype);
  29705. LoopEndState.prototype.constructor = LoopEndState;
  29706. // The Tokens rule start state linking to each lexer rule start state */
  29707. function TokensStartState() {
  29708. DecisionState.call(this);
  29709. this.stateType = ATNState.TOKEN_START;
  29710. return this;
  29711. }
  29712. TokensStartState.prototype = Object.create(DecisionState.prototype);
  29713. TokensStartState.prototype.constructor = TokensStartState;
  29714. exports.ATNState = ATNState;
  29715. exports.BasicState = BasicState;
  29716. exports.DecisionState = DecisionState;
  29717. exports.BlockStartState = BlockStartState;
  29718. exports.BlockEndState = BlockEndState;
  29719. exports.LoopEndState = LoopEndState;
  29720. exports.RuleStartState = RuleStartState;
  29721. exports.RuleStopState = RuleStopState;
  29722. exports.TokensStartState = TokensStartState;
  29723. exports.PlusLoopbackState = PlusLoopbackState;
  29724. exports.StarLoopbackState = StarLoopbackState;
  29725. exports.StarLoopEntryState = StarLoopEntryState;
  29726. exports.PlusBlockStartState = PlusBlockStartState;
  29727. exports.StarBlockStartState = StarBlockStartState;
  29728. exports.BasicBlockStartState = BasicBlockStartState;
  29729. /***/ }),
  29730. /***/ "./node_modules/antlr4/atn/ATNType.js":
  29731. /*!********************************************!*\
  29732. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  29733. \********************************************/
  29734. /*! no static exports found */
  29735. /***/ (function(module, exports, __webpack_require__) {
  29736. "use strict";
  29737. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29738. * Use of this file is governed by the BSD 3-clause license that
  29739. * can be found in the LICENSE.txt file in the project root.
  29740. */
  29741. ///
  29742. // Represents the type of recognizer an ATN applies to.
  29743. function ATNType() {}
  29744. ATNType.LEXER = 0;
  29745. ATNType.PARSER = 1;
  29746. exports.ATNType = ATNType;
  29747. /***/ }),
  29748. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  29749. /*!******************************************************!*\
  29750. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  29751. \******************************************************/
  29752. /*! no static exports found */
  29753. /***/ (function(module, exports, __webpack_require__) {
  29754. "use strict";
  29755. //
  29756. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29757. * Use of this file is governed by the BSD 3-clause license that
  29758. * can be found in the LICENSE.txt file in the project root.
  29759. */
  29760. ///
  29761. // When we hit an accept state in either the DFA or the ATN, we
  29762. // have to notify the character stream to start buffering characters
  29763. // via {@link IntStream//mark} and record the current state. The current sim state
  29764. // includes the current index into the input, the current line,
  29765. // and current character position in that line. Note that the Lexer is
  29766. // tracking the starting line and characterization of the token. These
  29767. // variables track the "state" of the simulator when it hits an accept state.
  29768. //
  29769. // <p>We track these variables separately for the DFA and ATN simulation
  29770. // because the DFA simulation often has to fail over to the ATN
  29771. // simulation. If the ATN simulation fails, we need the DFA to fall
  29772. // back to its previously accepted state, if any. If the ATN succeeds,
  29773. // then the ATN does the accept and the DFA simulator that invoked it
  29774. // can simply return the predicted token type.</p>
  29775. ///
  29776. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  29777. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  29778. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  29779. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  29780. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  29781. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  29782. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  29783. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  29784. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  29785. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  29786. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  29787. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  29788. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  29789. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  29790. function resetSimState(sim) {
  29791. sim.index = -1;
  29792. sim.line = 0;
  29793. sim.column = -1;
  29794. sim.dfaState = null;
  29795. }
  29796. function SimState() {
  29797. resetSimState(this);
  29798. return this;
  29799. }
  29800. SimState.prototype.reset = function () {
  29801. resetSimState(this);
  29802. };
  29803. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  29804. ATNSimulator.call(this, atn, sharedContextCache);
  29805. this.decisionToDFA = decisionToDFA;
  29806. this.recog = recog;
  29807. // The current token's starting index into the character stream.
  29808. // Shared across DFA to ATN simulation in case the ATN fails and the
  29809. // DFA did not have a previous accept state. In this case, we use the
  29810. // ATN-generated exception object.
  29811. this.startIndex = -1;
  29812. // line number 1..n within the input///
  29813. this.line = 1;
  29814. // The index of the character relative to the beginning of the line
  29815. // 0..n-1///
  29816. this.column = 0;
  29817. this.mode = Lexer.DEFAULT_MODE;
  29818. // Used during DFA/ATN exec to record the most recent accept configuration
  29819. // info
  29820. this.prevAccept = new SimState();
  29821. // done
  29822. return this;
  29823. }
  29824. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  29825. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  29826. LexerATNSimulator.debug = false;
  29827. LexerATNSimulator.dfa_debug = false;
  29828. LexerATNSimulator.MIN_DFA_EDGE = 0;
  29829. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  29830. LexerATNSimulator.match_calls = 0;
  29831. LexerATNSimulator.prototype.copyState = function (simulator) {
  29832. this.column = simulator.column;
  29833. this.line = simulator.line;
  29834. this.mode = simulator.mode;
  29835. this.startIndex = simulator.startIndex;
  29836. };
  29837. LexerATNSimulator.prototype.match = function (input, mode) {
  29838. this.match_calls += 1;
  29839. this.mode = mode;
  29840. var mark = input.mark();
  29841. try {
  29842. this.startIndex = input.index;
  29843. this.prevAccept.reset();
  29844. var dfa = this.decisionToDFA[mode];
  29845. if (dfa.s0 === null) {
  29846. return this.matchATN(input);
  29847. } else {
  29848. return this.execATN(input, dfa.s0);
  29849. }
  29850. } finally {
  29851. input.release(mark);
  29852. }
  29853. };
  29854. LexerATNSimulator.prototype.reset = function () {
  29855. this.prevAccept.reset();
  29856. this.startIndex = -1;
  29857. this.line = 1;
  29858. this.column = 0;
  29859. this.mode = Lexer.DEFAULT_MODE;
  29860. };
  29861. LexerATNSimulator.prototype.matchATN = function (input) {
  29862. var startState = this.atn.modeToStartState[this.mode];
  29863. if (LexerATNSimulator.debug) {
  29864. console.log("matchATN mode " + this.mode + " start: " + startState);
  29865. }
  29866. var old_mode = this.mode;
  29867. var s0_closure = this.computeStartState(input, startState);
  29868. var suppressEdge = s0_closure.hasSemanticContext;
  29869. s0_closure.hasSemanticContext = false;
  29870. var next = this.addDFAState(s0_closure);
  29871. if (!suppressEdge) {
  29872. this.decisionToDFA[this.mode].s0 = next;
  29873. }
  29874. var predict = this.execATN(input, next);
  29875. if (LexerATNSimulator.debug) {
  29876. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  29877. }
  29878. return predict;
  29879. };
  29880. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  29881. if (LexerATNSimulator.debug) {
  29882. console.log("start state closure=" + ds0.configs);
  29883. }
  29884. if (ds0.isAcceptState) {
  29885. // allow zero-length tokens
  29886. this.captureSimState(this.prevAccept, input, ds0);
  29887. }
  29888. var t = input.LA(1);
  29889. var s = ds0; // s is current/from DFA state
  29890. while (true) {
  29891. // while more work
  29892. if (LexerATNSimulator.debug) {
  29893. console.log("execATN loop starting closure: " + s.configs);
  29894. }
  29895. // As we move src->trg, src->trg, we keep track of the previous trg to
  29896. // avoid looking up the DFA state again, which is expensive.
  29897. // If the previous target was already part of the DFA, we might
  29898. // be able to avoid doing a reach operation upon t. If s!=null,
  29899. // it means that semantic predicates didn't prevent us from
  29900. // creating a DFA state. Once we know s!=null, we check to see if
  29901. // the DFA state has an edge already for t. If so, we can just reuse
  29902. // it's configuration set; there's no point in re-computing it.
  29903. // This is kind of like doing DFA simulation within the ATN
  29904. // simulation because DFA simulation is really just a way to avoid
  29905. // computing reach/closure sets. Technically, once we know that
  29906. // we have a previously added DFA state, we could jump over to
  29907. // the DFA simulator. But, that would mean popping back and forth
  29908. // a lot and making things more complicated algorithmically.
  29909. // This optimization makes a lot of sense for loops within DFA.
  29910. // A character will take us back to an existing DFA state
  29911. // that already has lots of edges out of it. e.g., .* in comments.
  29912. // print("Target for:" + str(s) + " and:" + str(t))
  29913. var target = this.getExistingTargetState(s, t);
  29914. // print("Existing:" + str(target))
  29915. if (target === null) {
  29916. target = this.computeTargetState(input, s, t);
  29917. // print("Computed:" + str(target))
  29918. }
  29919. if (target === ATNSimulator.ERROR) {
  29920. break;
  29921. }
  29922. // If this is a consumable input element, make sure to consume before
  29923. // capturing the accept state so the input index, line, and char
  29924. // position accurately reflect the state of the interpreter at the
  29925. // end of the token.
  29926. if (t !== Token.EOF) {
  29927. this.consume(input);
  29928. }
  29929. if (target.isAcceptState) {
  29930. this.captureSimState(this.prevAccept, input, target);
  29931. if (t === Token.EOF) {
  29932. break;
  29933. }
  29934. }
  29935. t = input.LA(1);
  29936. s = target; // flip; current DFA target becomes new src/from state
  29937. }
  29938. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  29939. };
  29940. // Get an existing target state for an edge in the DFA. If the target state
  29941. // for the edge has not yet been computed or is otherwise not available,
  29942. // this method returns {@code null}.
  29943. //
  29944. // @param s The current DFA state
  29945. // @param t The next input symbol
  29946. // @return The existing target DFA state for the given input symbol
  29947. // {@code t}, or {@code null} if the target state for this edge is not
  29948. // already cached
  29949. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  29950. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  29951. return null;
  29952. }
  29953. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  29954. if (target === undefined) {
  29955. target = null;
  29956. }
  29957. if (LexerATNSimulator.debug && target !== null) {
  29958. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  29959. }
  29960. return target;
  29961. };
  29962. // Compute a target state for an edge in the DFA, and attempt to add the
  29963. // computed state and corresponding edge to the DFA.
  29964. //
  29965. // @param input The input stream
  29966. // @param s The current DFA state
  29967. // @param t The next input symbol
  29968. //
  29969. // @return The computed target DFA state for the given input symbol
  29970. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  29971. // returns {@link //ERROR}.
  29972. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  29973. var reach = new OrderedATNConfigSet();
  29974. // if we don't find an existing DFA state
  29975. // Fill reach starting from closure, following t transitions
  29976. this.getReachableConfigSet(input, s.configs, reach, t);
  29977. if (reach.items.length === 0) {
  29978. // we got nowhere on t from s
  29979. if (!reach.hasSemanticContext) {
  29980. // we got nowhere on t, don't throw out this knowledge; it'd
  29981. // cause a failover from DFA later.
  29982. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  29983. }
  29984. // stop when we can't match any more char
  29985. return ATNSimulator.ERROR;
  29986. }
  29987. // Add an edge from s to target DFA found/created for reach
  29988. return this.addDFAEdge(s, t, null, reach);
  29989. };
  29990. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  29991. if (this.prevAccept.dfaState !== null) {
  29992. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  29993. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  29994. return prevAccept.dfaState.prediction;
  29995. } else {
  29996. // if no accept and EOF is first char, return EOF
  29997. if (t === Token.EOF && input.index === this.startIndex) {
  29998. return Token.EOF;
  29999. }
  30000. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  30001. }
  30002. };
  30003. // Given a starting configuration set, figure out all ATN configurations
  30004. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  30005. // parameter.
  30006. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  30007. // this is used to skip processing for configs which have a lower priority
  30008. // than a config that already reached an accept state for the same rule
  30009. var skipAlt = ATN.INVALID_ALT_NUMBER;
  30010. for (var i = 0; i < closure.items.length; i++) {
  30011. var cfg = closure.items[i];
  30012. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  30013. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  30014. continue;
  30015. }
  30016. if (LexerATNSimulator.debug) {
  30017. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  30018. }
  30019. for (var j = 0; j < cfg.state.transitions.length; j++) {
  30020. var trans = cfg.state.transitions[j]; // for each transition
  30021. var target = this.getReachableTarget(trans, t);
  30022. if (target !== null) {
  30023. var lexerActionExecutor = cfg.lexerActionExecutor;
  30024. if (lexerActionExecutor !== null) {
  30025. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  30026. }
  30027. var treatEofAsEpsilon = t === Token.EOF;
  30028. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  30029. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  30030. // any remaining configs for this alt have a lower priority
  30031. // than the one that just reached an accept state.
  30032. skipAlt = cfg.alt;
  30033. }
  30034. }
  30035. }
  30036. }
  30037. };
  30038. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  30039. if (LexerATNSimulator.debug) {
  30040. console.log("ACTION %s\n", lexerActionExecutor);
  30041. }
  30042. // seek to after last char in token
  30043. input.seek(index);
  30044. this.line = line;
  30045. this.column = charPos;
  30046. if (lexerActionExecutor !== null && this.recog !== null) {
  30047. lexerActionExecutor.execute(this.recog, input, startIndex);
  30048. }
  30049. };
  30050. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  30051. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  30052. return trans.target;
  30053. } else {
  30054. return null;
  30055. }
  30056. };
  30057. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  30058. var initialContext = PredictionContext.EMPTY;
  30059. var configs = new OrderedATNConfigSet();
  30060. for (var i = 0; i < p.transitions.length; i++) {
  30061. var target = p.transitions[i].target;
  30062. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  30063. this.closure(input, cfg, configs, false, false, false);
  30064. }
  30065. return configs;
  30066. };
  30067. // Since the alternatives within any lexer decision are ordered by
  30068. // preference, this method stops pursuing the closure as soon as an accept
  30069. // state is reached. After the first accept state is reached by depth-first
  30070. // search from {@code config}, all other (potentially reachable) states for
  30071. // this rule would have a lower priority.
  30072. //
  30073. // @return {@code true} if an accept state is reached, otherwise
  30074. // {@code false}.
  30075. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  30076. var cfg = null;
  30077. if (LexerATNSimulator.debug) {
  30078. console.log("closure(" + config.toString(this.recog, true) + ")");
  30079. }
  30080. if (config.state instanceof RuleStopState) {
  30081. if (LexerATNSimulator.debug) {
  30082. if (this.recog !== null) {
  30083. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  30084. } else {
  30085. console.log("closure at rule stop %s\n", config);
  30086. }
  30087. }
  30088. if (config.context === null || config.context.hasEmptyPath()) {
  30089. if (config.context === null || config.context.isEmpty()) {
  30090. configs.add(config);
  30091. return true;
  30092. } else {
  30093. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  30094. currentAltReachedAcceptState = true;
  30095. }
  30096. }
  30097. if (config.context !== null && !config.context.isEmpty()) {
  30098. for (var i = 0; i < config.context.length; i++) {
  30099. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  30100. var newContext = config.context.getParent(i); // "pop" return state
  30101. var returnState = this.atn.states[config.context.getReturnState(i)];
  30102. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  30103. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  30104. }
  30105. }
  30106. }
  30107. return currentAltReachedAcceptState;
  30108. }
  30109. // optimization
  30110. if (!config.state.epsilonOnlyTransitions) {
  30111. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  30112. configs.add(config);
  30113. }
  30114. }
  30115. for (var j = 0; j < config.state.transitions.length; j++) {
  30116. var trans = config.state.transitions[j];
  30117. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  30118. if (cfg !== null) {
  30119. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  30120. }
  30121. }
  30122. return currentAltReachedAcceptState;
  30123. };
  30124. // side-effect: can alter configs.hasSemanticContext
  30125. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  30126. var cfg = null;
  30127. if (trans.serializationType === Transition.RULE) {
  30128. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  30129. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  30130. } else if (trans.serializationType === Transition.PRECEDENCE) {
  30131. throw "Precedence predicates are not supported in lexers.";
  30132. } else if (trans.serializationType === Transition.PREDICATE) {
  30133. // Track traversing semantic predicates. If we traverse,
  30134. // we cannot add a DFA state for this "reach" computation
  30135. // because the DFA would not test the predicate again in the
  30136. // future. Rather than creating collections of semantic predicates
  30137. // like v3 and testing them on prediction, v4 will test them on the
  30138. // fly all the time using the ATN not the DFA. This is slower but
  30139. // semantically it's not used that often. One of the key elements to
  30140. // this predicate mechanism is not adding DFA states that see
  30141. // predicates immediately afterwards in the ATN. For example,
  30142. // a : ID {p1}? | ID {p2}? ;
  30143. // should create the start state for rule 'a' (to save start state
  30144. // competition), but should not create target of ID state. The
  30145. // collection of ATN states the following ID references includes
  30146. // states reached by traversing predicates. Since this is when we
  30147. // test them, we cannot cash the DFA state target of ID.
  30148. if (LexerATNSimulator.debug) {
  30149. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  30150. }
  30151. configs.hasSemanticContext = true;
  30152. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  30153. cfg = new LexerATNConfig({ state: trans.target }, config);
  30154. }
  30155. } else if (trans.serializationType === Transition.ACTION) {
  30156. if (config.context === null || config.context.hasEmptyPath()) {
  30157. // execute actions anywhere in the start rule for a token.
  30158. //
  30159. // TODO: if the entry rule is invoked recursively, some
  30160. // actions may be executed during the recursive call. The
  30161. // problem can appear when hasEmptyPath() is true but
  30162. // isEmpty() is false. In this case, the config needs to be
  30163. // split into two contexts - one with just the empty path
  30164. // and another with everything but the empty path.
  30165. // Unfortunately, the current algorithm does not allow
  30166. // getEpsilonTarget to return two configurations, so
  30167. // additional modifications are needed before we can support
  30168. // the split operation.
  30169. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  30170. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  30171. } else {
  30172. // ignore actions in referenced rules
  30173. cfg = new LexerATNConfig({ state: trans.target }, config);
  30174. }
  30175. } else if (trans.serializationType === Transition.EPSILON) {
  30176. cfg = new LexerATNConfig({ state: trans.target }, config);
  30177. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  30178. if (treatEofAsEpsilon) {
  30179. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  30180. cfg = new LexerATNConfig({ state: trans.target }, config);
  30181. }
  30182. }
  30183. }
  30184. return cfg;
  30185. };
  30186. // Evaluate a predicate specified in the lexer.
  30187. //
  30188. // <p>If {@code speculative} is {@code true}, this method was called before
  30189. // {@link //consume} for the matched character. This method should call
  30190. // {@link //consume} before evaluating the predicate to ensure position
  30191. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  30192. // and {@link Lexer//getcolumn}, properly reflect the current
  30193. // lexer state. This method should restore {@code input} and the simulator
  30194. // to the original state before returning (i.e. undo the actions made by the
  30195. // call to {@link //consume}.</p>
  30196. //
  30197. // @param input The input stream.
  30198. // @param ruleIndex The rule containing the predicate.
  30199. // @param predIndex The index of the predicate within the rule.
  30200. // @param speculative {@code true} if the current index in {@code input} is
  30201. // one character before the predicate's location.
  30202. //
  30203. // @return {@code true} if the specified predicate evaluates to
  30204. // {@code true}.
  30205. // /
  30206. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  30207. // assume true if no recognizer was provided
  30208. if (this.recog === null) {
  30209. return true;
  30210. }
  30211. if (!speculative) {
  30212. return this.recog.sempred(null, ruleIndex, predIndex);
  30213. }
  30214. var savedcolumn = this.column;
  30215. var savedLine = this.line;
  30216. var index = input.index;
  30217. var marker = input.mark();
  30218. try {
  30219. this.consume(input);
  30220. return this.recog.sempred(null, ruleIndex, predIndex);
  30221. } finally {
  30222. this.column = savedcolumn;
  30223. this.line = savedLine;
  30224. input.seek(index);
  30225. input.release(marker);
  30226. }
  30227. };
  30228. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  30229. settings.index = input.index;
  30230. settings.line = this.line;
  30231. settings.column = this.column;
  30232. settings.dfaState = dfaState;
  30233. };
  30234. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  30235. if (to === undefined) {
  30236. to = null;
  30237. }
  30238. if (cfgs === undefined) {
  30239. cfgs = null;
  30240. }
  30241. if (to === null && cfgs !== null) {
  30242. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  30243. // marker indicating dynamic predicate evaluation makes this edge
  30244. // dependent on the specific input sequence, so the static edge in the
  30245. // DFA should be omitted. The target DFAState is still created since
  30246. // execATN has the ability to resynchronize with the DFA state cache
  30247. // following the predicate evaluation step.
  30248. //
  30249. // TJP notes: next time through the DFA, we see a pred again and eval.
  30250. // If that gets us to a previously created (but dangling) DFA
  30251. // state, we can continue in pure DFA mode from there.
  30252. // /
  30253. var suppressEdge = cfgs.hasSemanticContext;
  30254. cfgs.hasSemanticContext = false;
  30255. to = this.addDFAState(cfgs);
  30256. if (suppressEdge) {
  30257. return to;
  30258. }
  30259. }
  30260. // add the edge
  30261. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  30262. // Only track edges within the DFA bounds
  30263. return to;
  30264. }
  30265. if (LexerATNSimulator.debug) {
  30266. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  30267. }
  30268. if (from_.edges === null) {
  30269. // make room for tokens 1..n and -1 masquerading as index 0
  30270. from_.edges = [];
  30271. }
  30272. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  30273. return to;
  30274. };
  30275. // Add a new DFA state if there isn't one with this set of
  30276. // configurations already. This method also detects the first
  30277. // configuration containing an ATN rule stop state. Later, when
  30278. // traversing the DFA, we will know which rule to accept.
  30279. LexerATNSimulator.prototype.addDFAState = function (configs) {
  30280. var proposed = new DFAState(null, configs);
  30281. var firstConfigWithRuleStopState = null;
  30282. for (var i = 0; i < configs.items.length; i++) {
  30283. var cfg = configs.items[i];
  30284. if (cfg.state instanceof RuleStopState) {
  30285. firstConfigWithRuleStopState = cfg;
  30286. break;
  30287. }
  30288. }
  30289. if (firstConfigWithRuleStopState !== null) {
  30290. proposed.isAcceptState = true;
  30291. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  30292. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  30293. }
  30294. var dfa = this.decisionToDFA[this.mode];
  30295. var existing = dfa.states.get(proposed);
  30296. if (existing !== null) {
  30297. return existing;
  30298. }
  30299. var newState = proposed;
  30300. newState.stateNumber = dfa.states.length;
  30301. configs.setReadonly(true);
  30302. newState.configs = configs;
  30303. dfa.states.add(newState);
  30304. return newState;
  30305. };
  30306. LexerATNSimulator.prototype.getDFA = function (mode) {
  30307. return this.decisionToDFA[mode];
  30308. };
  30309. // Get the text matched so far for the current token.
  30310. LexerATNSimulator.prototype.getText = function (input) {
  30311. // index is first lookahead char, don't include.
  30312. return input.getText(this.startIndex, input.index - 1);
  30313. };
  30314. LexerATNSimulator.prototype.consume = function (input) {
  30315. var curChar = input.LA(1);
  30316. if (curChar === "\n".charCodeAt(0)) {
  30317. this.line += 1;
  30318. this.column = 0;
  30319. } else {
  30320. this.column += 1;
  30321. }
  30322. input.consume();
  30323. };
  30324. LexerATNSimulator.prototype.getTokenName = function (tt) {
  30325. if (tt === -1) {
  30326. return "EOF";
  30327. } else {
  30328. return "'" + String.fromCharCode(tt) + "'";
  30329. }
  30330. };
  30331. exports.LexerATNSimulator = LexerATNSimulator;
  30332. /***/ }),
  30333. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  30334. /*!************************************************!*\
  30335. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  30336. \************************************************/
  30337. /*! no static exports found */
  30338. /***/ (function(module, exports, __webpack_require__) {
  30339. "use strict";
  30340. //
  30341. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30342. * Use of this file is governed by the BSD 3-clause license that
  30343. * can be found in the LICENSE.txt file in the project root.
  30344. */
  30345. //
  30346. function LexerActionType() {}
  30347. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  30348. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  30349. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  30350. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  30351. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  30352. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  30353. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  30354. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  30355. function LexerAction(action) {
  30356. this.actionType = action;
  30357. this.isPositionDependent = false;
  30358. return this;
  30359. }
  30360. LexerAction.prototype.hashCode = function () {
  30361. var hash = new Hash();
  30362. this.updateHashCode(hash);
  30363. return hash.finish();
  30364. };
  30365. LexerAction.prototype.updateHashCode = function (hash) {
  30366. hash.update(this.actionType);
  30367. };
  30368. LexerAction.prototype.equals = function (other) {
  30369. return this === other;
  30370. };
  30371. //
  30372. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  30373. //
  30374. // <p>The {@code skip} command does not have any parameters, so this action is
  30375. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  30376. function LexerSkipAction() {
  30377. LexerAction.call(this, LexerActionType.SKIP);
  30378. return this;
  30379. }
  30380. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  30381. LexerSkipAction.prototype.constructor = LexerSkipAction;
  30382. // Provides a singleton instance of this parameterless lexer action.
  30383. LexerSkipAction.INSTANCE = new LexerSkipAction();
  30384. LexerSkipAction.prototype.execute = function (lexer) {
  30385. lexer.skip();
  30386. };
  30387. LexerSkipAction.prototype.toString = function () {
  30388. return "skip";
  30389. };
  30390. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  30391. // with the assigned type.
  30392. function LexerTypeAction(type) {
  30393. LexerAction.call(this, LexerActionType.TYPE);
  30394. this.type = type;
  30395. return this;
  30396. }
  30397. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  30398. LexerTypeAction.prototype.constructor = LexerTypeAction;
  30399. LexerTypeAction.prototype.execute = function (lexer) {
  30400. lexer.type = this.type;
  30401. };
  30402. LexerTypeAction.prototype.updateHashCode = function (hash) {
  30403. hash.update(this.actionType, this.type);
  30404. };
  30405. LexerTypeAction.prototype.equals = function (other) {
  30406. if (this === other) {
  30407. return true;
  30408. } else if (!(other instanceof LexerTypeAction)) {
  30409. return false;
  30410. } else {
  30411. return this.type === other.type;
  30412. }
  30413. };
  30414. LexerTypeAction.prototype.toString = function () {
  30415. return "type(" + this.type + ")";
  30416. };
  30417. // Implements the {@code pushMode} lexer action by calling
  30418. // {@link Lexer//pushMode} with the assigned mode.
  30419. function LexerPushModeAction(mode) {
  30420. LexerAction.call(this, LexerActionType.PUSH_MODE);
  30421. this.mode = mode;
  30422. return this;
  30423. }
  30424. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  30425. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  30426. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  30427. // value provided by {@link //getMode}.</p>
  30428. LexerPushModeAction.prototype.execute = function (lexer) {
  30429. lexer.pushMode(this.mode);
  30430. };
  30431. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  30432. hash.update(this.actionType, this.mode);
  30433. };
  30434. LexerPushModeAction.prototype.equals = function (other) {
  30435. if (this === other) {
  30436. return true;
  30437. } else if (!(other instanceof LexerPushModeAction)) {
  30438. return false;
  30439. } else {
  30440. return this.mode === other.mode;
  30441. }
  30442. };
  30443. LexerPushModeAction.prototype.toString = function () {
  30444. return "pushMode(" + this.mode + ")";
  30445. };
  30446. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  30447. //
  30448. // <p>The {@code popMode} command does not have any parameters, so this action is
  30449. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  30450. function LexerPopModeAction() {
  30451. LexerAction.call(this, LexerActionType.POP_MODE);
  30452. return this;
  30453. }
  30454. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  30455. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  30456. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  30457. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  30458. LexerPopModeAction.prototype.execute = function (lexer) {
  30459. lexer.popMode();
  30460. };
  30461. LexerPopModeAction.prototype.toString = function () {
  30462. return "popMode";
  30463. };
  30464. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  30465. //
  30466. // <p>The {@code more} command does not have any parameters, so this action is
  30467. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  30468. function LexerMoreAction() {
  30469. LexerAction.call(this, LexerActionType.MORE);
  30470. return this;
  30471. }
  30472. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  30473. LexerMoreAction.prototype.constructor = LexerMoreAction;
  30474. LexerMoreAction.INSTANCE = new LexerMoreAction();
  30475. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  30476. LexerMoreAction.prototype.execute = function (lexer) {
  30477. lexer.more();
  30478. };
  30479. LexerMoreAction.prototype.toString = function () {
  30480. return "more";
  30481. };
  30482. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  30483. // the assigned mode.
  30484. function LexerModeAction(mode) {
  30485. LexerAction.call(this, LexerActionType.MODE);
  30486. this.mode = mode;
  30487. return this;
  30488. }
  30489. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  30490. LexerModeAction.prototype.constructor = LexerModeAction;
  30491. // <p>This action is implemented by calling {@link Lexer//mode} with the
  30492. // value provided by {@link //getMode}.</p>
  30493. LexerModeAction.prototype.execute = function (lexer) {
  30494. lexer.mode(this.mode);
  30495. };
  30496. LexerModeAction.prototype.updateHashCode = function (hash) {
  30497. hash.update(this.actionType, this.mode);
  30498. };
  30499. LexerModeAction.prototype.equals = function (other) {
  30500. if (this === other) {
  30501. return true;
  30502. } else if (!(other instanceof LexerModeAction)) {
  30503. return false;
  30504. } else {
  30505. return this.mode === other.mode;
  30506. }
  30507. };
  30508. LexerModeAction.prototype.toString = function () {
  30509. return "mode(" + this.mode + ")";
  30510. };
  30511. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  30512. // rule and action indexes assigned to the custom action. The implementation of
  30513. // a custom action is added to the generated code for the lexer in an override
  30514. // of {@link Recognizer//action} when the grammar is compiled.
  30515. //
  30516. // <p>This class may represent embedded actions created with the <code>{...}</code>
  30517. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  30518. // command argument could not be evaluated when the grammar was compiled.</p>
  30519. // Constructs a custom lexer action with the specified rule and action
  30520. // indexes.
  30521. //
  30522. // @param ruleIndex The rule index to use for calls to
  30523. // {@link Recognizer//action}.
  30524. // @param actionIndex The action index to use for calls to
  30525. // {@link Recognizer//action}.
  30526. function LexerCustomAction(ruleIndex, actionIndex) {
  30527. LexerAction.call(this, LexerActionType.CUSTOM);
  30528. this.ruleIndex = ruleIndex;
  30529. this.actionIndex = actionIndex;
  30530. this.isPositionDependent = true;
  30531. return this;
  30532. }
  30533. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  30534. LexerCustomAction.prototype.constructor = LexerCustomAction;
  30535. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  30536. // appropriate rule and action indexes.</p>
  30537. LexerCustomAction.prototype.execute = function (lexer) {
  30538. lexer.action(null, this.ruleIndex, this.actionIndex);
  30539. };
  30540. LexerCustomAction.prototype.updateHashCode = function (hash) {
  30541. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  30542. };
  30543. LexerCustomAction.prototype.equals = function (other) {
  30544. if (this === other) {
  30545. return true;
  30546. } else if (!(other instanceof LexerCustomAction)) {
  30547. return false;
  30548. } else {
  30549. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  30550. }
  30551. };
  30552. // Implements the {@code channel} lexer action by calling
  30553. // {@link Lexer//setChannel} with the assigned channel.
  30554. // Constructs a new {@code channel} action with the specified channel value.
  30555. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  30556. function LexerChannelAction(channel) {
  30557. LexerAction.call(this, LexerActionType.CHANNEL);
  30558. this.channel = channel;
  30559. return this;
  30560. }
  30561. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  30562. LexerChannelAction.prototype.constructor = LexerChannelAction;
  30563. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  30564. // value provided by {@link //getChannel}.</p>
  30565. LexerChannelAction.prototype.execute = function (lexer) {
  30566. lexer._channel = this.channel;
  30567. };
  30568. LexerChannelAction.prototype.updateHashCode = function (hash) {
  30569. hash.update(this.actionType, this.channel);
  30570. };
  30571. LexerChannelAction.prototype.equals = function (other) {
  30572. if (this === other) {
  30573. return true;
  30574. } else if (!(other instanceof LexerChannelAction)) {
  30575. return false;
  30576. } else {
  30577. return this.channel === other.channel;
  30578. }
  30579. };
  30580. LexerChannelAction.prototype.toString = function () {
  30581. return "channel(" + this.channel + ")";
  30582. };
  30583. // This implementation of {@link LexerAction} is used for tracking input offsets
  30584. // for position-dependent actions within a {@link LexerActionExecutor}.
  30585. //
  30586. // <p>This action is not serialized as part of the ATN, and is only required for
  30587. // position-dependent lexer actions which appear at a location other than the
  30588. // end of a rule. For more information about DFA optimizations employed for
  30589. // lexer actions, see {@link LexerActionExecutor//append} and
  30590. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  30591. // Constructs a new indexed custom action by associating a character offset
  30592. // with a {@link LexerAction}.
  30593. //
  30594. // <p>Note: This class is only required for lexer actions for which
  30595. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  30596. //
  30597. // @param offset The offset into the input {@link CharStream}, relative to
  30598. // the token start index, at which the specified lexer action should be
  30599. // executed.
  30600. // @param action The lexer action to execute at a particular offset in the
  30601. // input {@link CharStream}.
  30602. function LexerIndexedCustomAction(offset, action) {
  30603. LexerAction.call(this, action.actionType);
  30604. this.offset = offset;
  30605. this.action = action;
  30606. this.isPositionDependent = true;
  30607. return this;
  30608. }
  30609. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  30610. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  30611. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  30612. // using the provided {@code lexer}.</p>
  30613. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  30614. // assume the input stream position was properly set by the calling code
  30615. this.action.execute(lexer);
  30616. };
  30617. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  30618. hash.update(this.actionType, this.offset, this.action);
  30619. };
  30620. LexerIndexedCustomAction.prototype.equals = function (other) {
  30621. if (this === other) {
  30622. return true;
  30623. } else if (!(other instanceof LexerIndexedCustomAction)) {
  30624. return false;
  30625. } else {
  30626. return this.offset === other.offset && this.action === other.action;
  30627. }
  30628. };
  30629. exports.LexerActionType = LexerActionType;
  30630. exports.LexerSkipAction = LexerSkipAction;
  30631. exports.LexerChannelAction = LexerChannelAction;
  30632. exports.LexerCustomAction = LexerCustomAction;
  30633. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  30634. exports.LexerMoreAction = LexerMoreAction;
  30635. exports.LexerTypeAction = LexerTypeAction;
  30636. exports.LexerPushModeAction = LexerPushModeAction;
  30637. exports.LexerPopModeAction = LexerPopModeAction;
  30638. exports.LexerModeAction = LexerModeAction;
  30639. /***/ }),
  30640. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  30641. /*!********************************************************!*\
  30642. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  30643. \********************************************************/
  30644. /*! no static exports found */
  30645. /***/ (function(module, exports, __webpack_require__) {
  30646. "use strict";
  30647. //
  30648. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30649. * Use of this file is governed by the BSD 3-clause license that
  30650. * can be found in the LICENSE.txt file in the project root.
  30651. */
  30652. ///
  30653. // Represents an executor for a sequence of lexer actions which traversed during
  30654. // the matching operation of a lexer rule (token).
  30655. //
  30656. // <p>The executor tracks position information for position-dependent lexer actions
  30657. // efficiently, ensuring that actions appearing only at the end of the rule do
  30658. // not cause bloating of the {@link DFA} created for the lexer.</p>
  30659. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  30660. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  30661. function LexerActionExecutor(lexerActions) {
  30662. this.lexerActions = lexerActions === null ? [] : lexerActions;
  30663. // Caches the result of {@link //hashCode} since the hash code is an element
  30664. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  30665. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  30666. // lexerActions]))
  30667. return this;
  30668. }
  30669. // Creates a {@link LexerActionExecutor} which executes the actions for
  30670. // the input {@code lexerActionExecutor} followed by a specified
  30671. // {@code lexerAction}.
  30672. //
  30673. // @param lexerActionExecutor The executor for actions already traversed by
  30674. // the lexer while matching a token within a particular
  30675. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  30676. // though it were an empty executor.
  30677. // @param lexerAction The lexer action to execute after the actions
  30678. // specified in {@code lexerActionExecutor}.
  30679. //
  30680. // @return A {@link LexerActionExecutor} for executing the combine actions
  30681. // of {@code lexerActionExecutor} and {@code lexerAction}.
  30682. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  30683. if (lexerActionExecutor === null) {
  30684. return new LexerActionExecutor([lexerAction]);
  30685. }
  30686. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  30687. return new LexerActionExecutor(lexerActions);
  30688. };
  30689. // Creates a {@link LexerActionExecutor} which encodes the current offset
  30690. // for position-dependent lexer actions.
  30691. //
  30692. // <p>Normally, when the executor encounters lexer actions where
  30693. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  30694. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  30695. // position to the <em>end</em> of the current token. This behavior provides
  30696. // for efficient DFA representation of lexer actions which appear at the end
  30697. // of a lexer rule, even when the lexer rule matches a variable number of
  30698. // characters.</p>
  30699. //
  30700. // <p>Prior to traversing a match transition in the ATN, the current offset
  30701. // from the token start index is assigned to all position-dependent lexer
  30702. // actions which have not already been assigned a fixed offset. By storing
  30703. // the offsets relative to the token start index, the DFA representation of
  30704. // lexer actions which appear in the middle of tokens remains efficient due
  30705. // to sharing among tokens of the same length, regardless of their absolute
  30706. // position in the input stream.</p>
  30707. //
  30708. // <p>If the current executor already has offsets assigned to all
  30709. // position-dependent lexer actions, the method returns {@code this}.</p>
  30710. //
  30711. // @param offset The current offset to assign to all position-dependent
  30712. // lexer actions which do not already have offsets assigned.
  30713. //
  30714. // @return A {@link LexerActionExecutor} which stores input stream offsets
  30715. // for all position-dependent lexer actions.
  30716. // /
  30717. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  30718. var updatedLexerActions = null;
  30719. for (var i = 0; i < this.lexerActions.length; i++) {
  30720. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  30721. if (updatedLexerActions === null) {
  30722. updatedLexerActions = this.lexerActions.concat([]);
  30723. }
  30724. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  30725. }
  30726. }
  30727. if (updatedLexerActions === null) {
  30728. return this;
  30729. } else {
  30730. return new LexerActionExecutor(updatedLexerActions);
  30731. }
  30732. };
  30733. // Execute the actions encapsulated by this executor within the context of a
  30734. // particular {@link Lexer}.
  30735. //
  30736. // <p>This method calls {@link IntStream//seek} to set the position of the
  30737. // {@code input} {@link CharStream} prior to calling
  30738. // {@link LexerAction//execute} on a position-dependent action. Before the
  30739. // method returns, the input position will be restored to the same position
  30740. // it was in when the method was invoked.</p>
  30741. //
  30742. // @param lexer The lexer instance.
  30743. // @param input The input stream which is the source for the current token.
  30744. // When this method is called, the current {@link IntStream//index} for
  30745. // {@code input} should be the start of the following token, i.e. 1
  30746. // character past the end of the current token.
  30747. // @param startIndex The token start index. This value may be passed to
  30748. // {@link IntStream//seek} to set the {@code input} position to the beginning
  30749. // of the token.
  30750. // /
  30751. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  30752. var requiresSeek = false;
  30753. var stopIndex = input.index;
  30754. try {
  30755. for (var i = 0; i < this.lexerActions.length; i++) {
  30756. var lexerAction = this.lexerActions[i];
  30757. if (lexerAction instanceof LexerIndexedCustomAction) {
  30758. var offset = lexerAction.offset;
  30759. input.seek(startIndex + offset);
  30760. lexerAction = lexerAction.action;
  30761. requiresSeek = startIndex + offset !== stopIndex;
  30762. } else if (lexerAction.isPositionDependent) {
  30763. input.seek(stopIndex);
  30764. requiresSeek = false;
  30765. }
  30766. lexerAction.execute(lexer);
  30767. }
  30768. } finally {
  30769. if (requiresSeek) {
  30770. input.seek(stopIndex);
  30771. }
  30772. }
  30773. };
  30774. LexerActionExecutor.prototype.hashCode = function () {
  30775. return this.cachedHashCode;
  30776. };
  30777. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  30778. hash.update(this.cachedHashCode);
  30779. };
  30780. LexerActionExecutor.prototype.equals = function (other) {
  30781. if (this === other) {
  30782. return true;
  30783. } else if (!(other instanceof LexerActionExecutor)) {
  30784. return false;
  30785. } else if (this.cachedHashCode != other.cachedHashCode) {
  30786. return false;
  30787. } else if (this.lexerActions.length != other.lexerActions.length) {
  30788. return false;
  30789. } else {
  30790. var numActions = this.lexerActions.length;
  30791. for (var idx = 0; idx < numActions; ++idx) {
  30792. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  30793. return false;
  30794. }
  30795. }
  30796. return true;
  30797. }
  30798. };
  30799. exports.LexerActionExecutor = LexerActionExecutor;
  30800. /***/ }),
  30801. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  30802. /*!*******************************************************!*\
  30803. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  30804. \*******************************************************/
  30805. /*! no static exports found */
  30806. /***/ (function(module, exports, __webpack_require__) {
  30807. "use strict";
  30808. //
  30809. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30810. * Use of this file is governed by the BSD 3-clause license that
  30811. * can be found in the LICENSE.txt file in the project root.
  30812. */
  30813. //
  30814. //
  30815. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  30816. //
  30817. // <p>
  30818. // The basic complexity of the adaptive strategy makes it harder to understand.
  30819. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  30820. // requests go through the DFA first. If they reach a state without an edge for
  30821. // the current symbol, the algorithm fails over to the ATN simulation to
  30822. // complete the DFA path for the current input (until it finds a conflict state
  30823. // or uniquely predicting state).</p>
  30824. //
  30825. // <p>
  30826. // All of that is done without using the outer context because we want to create
  30827. // a DFA that is not dependent upon the rule invocation stack when we do a
  30828. // prediction. One DFA works in all contexts. We avoid using context not
  30829. // necessarily because it's slower, although it can be, but because of the DFA
  30830. // caching problem. The closure routine only considers the rule invocation stack
  30831. // created during prediction beginning in the decision rule. For example, if
  30832. // prediction occurs without invoking another rule's ATN, there are no context
  30833. // stacks in the configurations. When lack of context leads to a conflict, we
  30834. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  30835. // strategy (versus full LL(*)).</p>
  30836. //
  30837. // <p>
  30838. // When SLL yields a configuration set with conflict, we rewind the input and
  30839. // retry the ATN simulation, this time using full outer context without adding
  30840. // to the DFA. Configuration context stacks will be the full invocation stacks
  30841. // from the start rule. If we get a conflict using full context, then we can
  30842. // definitively say we have a true ambiguity for that input sequence. If we
  30843. // don't get a conflict, it implies that the decision is sensitive to the outer
  30844. // context. (It is not context-sensitive in the sense of context-sensitive
  30845. // grammars.)</p>
  30846. //
  30847. // <p>
  30848. // The next time we reach this DFA state with an SLL conflict, through DFA
  30849. // simulation, we will again retry the ATN simulation using full context mode.
  30850. // This is slow because we can't save the results and have to "interpret" the
  30851. // ATN each time we get that input.</p>
  30852. //
  30853. // <p>
  30854. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  30855. //
  30856. // <p>
  30857. // We could cache results from full context to predicted alternative easily and
  30858. // that saves a lot of time but doesn't work in presence of predicates. The set
  30859. // of visible predicates from the ATN start state changes depending on the
  30860. // context, because closure can fall off the end of a rule. I tried to cache
  30861. // tuples (stack context, semantic context, predicted alt) but it was slower
  30862. // than interpreting and much more complicated. Also required a huge amount of
  30863. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  30864. // to keep this algorithm simple. By launching multiple threads, we can improve
  30865. // the speed of parsing across a large number of files.</p>
  30866. //
  30867. // <p>
  30868. // There is no strict ordering between the amount of input used by SLL vs LL,
  30869. // which makes it really hard to build a cache for full context. Let's say that
  30870. // we have input A B C that leads to an SLL conflict with full context X. That
  30871. // implies that using X we might only use A B but we could also use A B C D to
  30872. // resolve conflict. Input A B C D could predict alternative 1 in one position
  30873. // in the input and A B C E could predict alternative 2 in another position in
  30874. // input. The conflicting SLL configurations could still be non-unique in the
  30875. // full context prediction, which would lead us to requiring more input than the
  30876. // original A B C. To make a prediction cache work, we have to track the exact
  30877. // input used during the previous prediction. That amounts to a cache that maps
  30878. // X to a specific DFA for that context.</p>
  30879. //
  30880. // <p>
  30881. // Something should be done for left-recursive expression predictions. They are
  30882. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  30883. // with full LL thing Sam does.</p>
  30884. //
  30885. // <p>
  30886. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  30887. //
  30888. // <p>
  30889. // We avoid doing full context retry when the outer context is empty, we did not
  30890. // dip into the outer context by falling off the end of the decision state rule,
  30891. // or when we force SLL mode.</p>
  30892. //
  30893. // <p>
  30894. // As an example of the not dip into outer context case, consider as super
  30895. // constructor calls versus function calls. One grammar might look like
  30896. // this:</p>
  30897. //
  30898. // <pre>
  30899. // ctorBody
  30900. // : '{' superCall? stat* '}'
  30901. // ;
  30902. // </pre>
  30903. //
  30904. // <p>
  30905. // Or, you might see something like</p>
  30906. //
  30907. // <pre>
  30908. // stat
  30909. // : superCall ';'
  30910. // | expression ';'
  30911. // | ...
  30912. // ;
  30913. // </pre>
  30914. //
  30915. // <p>
  30916. // In both cases I believe that no closure operations will dip into the outer
  30917. // context. In the first case ctorBody in the worst case will stop at the '}'.
  30918. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  30919. // entry rule and not dip into the outer context.</p>
  30920. //
  30921. // <p>
  30922. // <strong>PREDICATES</strong></p>
  30923. //
  30924. // <p>
  30925. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  30926. // LL simulation deals with predicates differently. SLL collects predicates as
  30927. // it performs closure operations like ANTLR v3 did. It delays predicate
  30928. // evaluation until it reaches and accept state. This allows us to cache the SLL
  30929. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  30930. // closure, the DFA state configuration sets would be different and we couldn't
  30931. // build up a suitable DFA.</p>
  30932. //
  30933. // <p>
  30934. // When building a DFA accept state during ATN simulation, we evaluate any
  30935. // predicates and return the sole semantically valid alternative. If there is
  30936. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  30937. // we throw an exception. Alternatives without predicates act like they have
  30938. // true predicates. The simple way to think about it is to strip away all
  30939. // alternatives with false predicates and choose the minimum alternative that
  30940. // remains.</p>
  30941. //
  30942. // <p>
  30943. // When we start in the DFA and reach an accept state that's predicated, we test
  30944. // those and return the minimum semantically viable alternative. If no
  30945. // alternatives are viable, we throw an exception.</p>
  30946. //
  30947. // <p>
  30948. // During full LL ATN simulation, closure always evaluates predicates and
  30949. // on-the-fly. This is crucial to reducing the configuration set size during
  30950. // closure. It hits a landmine when parsing with the Java grammar, for example,
  30951. // without this on-the-fly evaluation.</p>
  30952. //
  30953. // <p>
  30954. // <strong>SHARING DFA</strong></p>
  30955. //
  30956. // <p>
  30957. // All instances of the same parser share the same decision DFAs through a
  30958. // static field. Each instance gets its own ATN simulator but they share the
  30959. // same {@link //decisionToDFA} field. They also share a
  30960. // {@link PredictionContextCache} object that makes sure that all
  30961. // {@link PredictionContext} objects are shared among the DFA states. This makes
  30962. // a big size difference.</p>
  30963. //
  30964. // <p>
  30965. // <strong>THREAD SAFETY</strong></p>
  30966. //
  30967. // <p>
  30968. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  30969. // it adds a new DFA object to that array. {@link //addDFAEdge}
  30970. // locks on the DFA for the current decision when setting the
  30971. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  30972. // the DFA for the current decision when looking up a DFA state to see if it
  30973. // already exists. We must make sure that all requests to add DFA states that
  30974. // are equivalent result in the same shared DFA object. This is because lots of
  30975. // threads will be trying to update the DFA at once. The
  30976. // {@link //addDFAState} method also locks inside the DFA lock
  30977. // but this time on the shared context cache when it rebuilds the
  30978. // configurations' {@link PredictionContext} objects using cached
  30979. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  30980. // safe as long as we can guarantee that all threads referencing
  30981. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  30982. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  30983. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  30984. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  30985. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  30986. // {@code dfa.edges[t]} to be non-null. The
  30987. // {@link //addDFAEdge} method could be racing to set the field
  30988. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  30989. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  30990. // way it will work because it's not doing a test and set operation.</p>
  30991. //
  30992. // <p>
  30993. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  30994. // Parsing)</strong></p>
  30995. //
  30996. // <p>
  30997. // Sam pointed out that if SLL does not give a syntax error, then there is no
  30998. // point in doing full LL, which is slower. We only have to try LL if we get a
  30999. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  31000. // mode with the {@link BailErrorStrategy}:</p>
  31001. //
  31002. // <pre>
  31003. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  31004. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  31005. // </pre>
  31006. //
  31007. // <p>
  31008. // If it does not get a syntax error, then we're done. If it does get a syntax
  31009. // error, we need to retry with the combined SLL/LL strategy.</p>
  31010. //
  31011. // <p>
  31012. // The reason this works is as follows. If there are no SLL conflicts, then the
  31013. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  31014. // the full LL analysis must yield a set of viable alternatives which is a
  31015. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  31016. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  31017. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  31018. // is truly ambiguous on the current input. If the LL set is smaller, then the
  31019. // SLL conflict resolution might choose an alternative that the full LL would
  31020. // rule out as a possibility based upon better context information. If that's
  31021. // the case, then the SLL parse will definitely get an error because the full LL
  31022. // analysis says it's not viable. If SLL conflict resolution chooses an
  31023. // alternative within the LL set, them both SLL and LL would choose the same
  31024. // alternative because they both choose the minimum of multiple conflicting
  31025. // alternatives.</p>
  31026. //
  31027. // <p>
  31028. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  31029. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  31030. // parsing will get an error because SLL will pursue alternative 1. If
  31031. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  31032. // choose the same alternative because alternative one is the minimum of either
  31033. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  31034. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  31035. //
  31036. // <p>
  31037. // Of course, if the input is invalid, then we will get an error for sure in
  31038. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  31039. // the input.</p>
  31040. //
  31041. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  31042. var Set = Utils.Set;
  31043. var BitSet = Utils.BitSet;
  31044. var DoubleDict = Utils.DoubleDict;
  31045. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31046. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  31047. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  31048. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  31049. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31050. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  31051. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  31052. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  31053. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  31054. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  31055. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  31056. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  31057. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  31058. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  31059. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  31060. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31061. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  31062. var Transition = Transitions.Transition;
  31063. var SetTransition = Transitions.SetTransition;
  31064. var NotSetTransition = Transitions.NotSetTransition;
  31065. var RuleTransition = Transitions.RuleTransition;
  31066. var ActionTransition = Transitions.ActionTransition;
  31067. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  31068. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  31069. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  31070. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  31071. ATNSimulator.call(this, atn, sharedContextCache);
  31072. this.parser = parser;
  31073. this.decisionToDFA = decisionToDFA;
  31074. // SLL, LL, or LL + exact ambig detection?//
  31075. this.predictionMode = PredictionMode.LL;
  31076. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  31077. this._input = null;
  31078. this._startIndex = 0;
  31079. this._outerContext = null;
  31080. this._dfa = null;
  31081. // Each prediction operation uses a cache for merge of prediction contexts.
  31082. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  31083. // isn't synchronized but we're ok since two threads shouldn't reuse same
  31084. // parser/atnsim object because it can only handle one input at a time.
  31085. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  31086. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  31087. // also be examined during cache lookup.
  31088. //
  31089. this.mergeCache = null;
  31090. return this;
  31091. }
  31092. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  31093. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  31094. ParserATNSimulator.prototype.debug = false;
  31095. ParserATNSimulator.prototype.debug_closure = false;
  31096. ParserATNSimulator.prototype.debug_add = false;
  31097. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  31098. ParserATNSimulator.prototype.dfa_debug = false;
  31099. ParserATNSimulator.prototype.retry_debug = false;
  31100. ParserATNSimulator.prototype.reset = function () {};
  31101. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  31102. if (this.debug || this.debug_list_atn_decisions) {
  31103. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  31104. }
  31105. this._input = input;
  31106. this._startIndex = input.index;
  31107. this._outerContext = outerContext;
  31108. var dfa = this.decisionToDFA[decision];
  31109. this._dfa = dfa;
  31110. var m = input.mark();
  31111. var index = input.index;
  31112. // Now we are certain to have a specific decision's DFA
  31113. // But, do we still need an initial state?
  31114. try {
  31115. var s0;
  31116. if (dfa.precedenceDfa) {
  31117. // the start state for a precedence DFA depends on the current
  31118. // parser precedence, and is provided by a DFA method.
  31119. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  31120. } else {
  31121. // the start state for a "regular" DFA is just s0
  31122. s0 = dfa.s0;
  31123. }
  31124. if (s0 === null) {
  31125. if (outerContext === null) {
  31126. outerContext = RuleContext.EMPTY;
  31127. }
  31128. if (this.debug || this.debug_list_atn_decisions) {
  31129. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  31130. }
  31131. var fullCtx = false;
  31132. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  31133. if (dfa.precedenceDfa) {
  31134. // If this is a precedence DFA, we use applyPrecedenceFilter
  31135. // to convert the computed start state to a precedence start
  31136. // state. We then use DFA.setPrecedenceStartState to set the
  31137. // appropriate start state for the precedence level rather
  31138. // than simply setting DFA.s0.
  31139. //
  31140. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  31141. s0_closure = this.applyPrecedenceFilter(s0_closure);
  31142. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  31143. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  31144. } else {
  31145. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  31146. dfa.s0 = s0;
  31147. }
  31148. }
  31149. var alt = this.execATN(dfa, s0, input, index, outerContext);
  31150. if (this.debug) {
  31151. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  31152. }
  31153. return alt;
  31154. } finally {
  31155. this._dfa = null;
  31156. this.mergeCache = null; // wack cache after each prediction
  31157. input.seek(index);
  31158. input.release(m);
  31159. }
  31160. };
  31161. // Performs ATN simulation to compute a predicted alternative based
  31162. // upon the remaining input, but also updates the DFA cache to avoid
  31163. // having to traverse the ATN again for the same input sequence.
  31164. // There are some key conditions we're looking for after computing a new
  31165. // set of ATN configs (proposed DFA state):
  31166. // if the set is empty, there is no viable alternative for current symbol
  31167. // does the state uniquely predict an alternative?
  31168. // does the state have a conflict that would prevent us from
  31169. // putting it on the work list?
  31170. // We also have some key operations to do:
  31171. // add an edge from previous DFA state to potentially new DFA state, D,
  31172. // upon current symbol but only if adding to work list, which means in all
  31173. // cases except no viable alternative (and possibly non-greedy decisions?)
  31174. // collecting predicates and adding semantic context to DFA accept states
  31175. // adding rule context to context-sensitive DFA accept states
  31176. // consuming an input symbol
  31177. // reporting a conflict
  31178. // reporting an ambiguity
  31179. // reporting a context sensitivity
  31180. // reporting insufficient predicates
  31181. // cover these cases:
  31182. // dead end
  31183. // single alt
  31184. // single alt + preds
  31185. // conflict
  31186. // conflict + preds
  31187. //
  31188. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  31189. if (this.debug || this.debug_list_atn_decisions) {
  31190. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  31191. }
  31192. var alt;
  31193. var previousD = s0;
  31194. if (this.debug) {
  31195. console.log("s0 = " + s0);
  31196. }
  31197. var t = input.LA(1);
  31198. while (true) {
  31199. // while more work
  31200. var D = this.getExistingTargetState(previousD, t);
  31201. if (D === null) {
  31202. D = this.computeTargetState(dfa, previousD, t);
  31203. }
  31204. if (D === ATNSimulator.ERROR) {
  31205. // if any configs in previous dipped into outer context, that
  31206. // means that input up to t actually finished entry rule
  31207. // at least for SLL decision. Full LL doesn't dip into outer
  31208. // so don't need special case.
  31209. // We will get an error no matter what so delay until after
  31210. // decision; better error message. Also, no reachable target
  31211. // ATN states in SLL implies LL will also get nowhere.
  31212. // If conflict in states that dip out, choose min since we
  31213. // will get error no matter what.
  31214. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  31215. input.seek(startIndex);
  31216. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  31217. if (alt !== ATN.INVALID_ALT_NUMBER) {
  31218. return alt;
  31219. } else {
  31220. throw e;
  31221. }
  31222. }
  31223. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  31224. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  31225. var conflictingAlts = null;
  31226. if (D.predicates !== null) {
  31227. if (this.debug) {
  31228. console.log("DFA state has preds in DFA sim LL failover");
  31229. }
  31230. var conflictIndex = input.index;
  31231. if (conflictIndex !== startIndex) {
  31232. input.seek(startIndex);
  31233. }
  31234. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  31235. if (conflictingAlts.length === 1) {
  31236. if (this.debug) {
  31237. console.log("Full LL avoided");
  31238. }
  31239. return conflictingAlts.minValue();
  31240. }
  31241. if (conflictIndex !== startIndex) {
  31242. // restore the index so reporting the fallback to full
  31243. // context occurs with the index at the correct spot
  31244. input.seek(conflictIndex);
  31245. }
  31246. }
  31247. if (this.dfa_debug) {
  31248. console.log("ctx sensitive state " + outerContext + " in " + D);
  31249. }
  31250. var fullCtx = true;
  31251. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  31252. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  31253. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  31254. return alt;
  31255. }
  31256. if (D.isAcceptState) {
  31257. if (D.predicates === null) {
  31258. return D.prediction;
  31259. }
  31260. var stopIndex = input.index;
  31261. input.seek(startIndex);
  31262. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  31263. if (alts.length === 0) {
  31264. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  31265. } else if (alts.length === 1) {
  31266. return alts.minValue();
  31267. } else {
  31268. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  31269. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  31270. return alts.minValue();
  31271. }
  31272. }
  31273. previousD = D;
  31274. if (t !== Token.EOF) {
  31275. input.consume();
  31276. t = input.LA(1);
  31277. }
  31278. }
  31279. };
  31280. //
  31281. // Get an existing target state for an edge in the DFA. If the target state
  31282. // for the edge has not yet been computed or is otherwise not available,
  31283. // this method returns {@code null}.
  31284. //
  31285. // @param previousD The current DFA state
  31286. // @param t The next input symbol
  31287. // @return The existing target DFA state for the given input symbol
  31288. // {@code t}, or {@code null} if the target state for this edge is not
  31289. // already cached
  31290. //
  31291. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  31292. var edges = previousD.edges;
  31293. if (edges === null) {
  31294. return null;
  31295. } else {
  31296. return edges[t + 1] || null;
  31297. }
  31298. };
  31299. //
  31300. // Compute a target state for an edge in the DFA, and attempt to add the
  31301. // computed state and corresponding edge to the DFA.
  31302. //
  31303. // @param dfa The DFA
  31304. // @param previousD The current DFA state
  31305. // @param t The next input symbol
  31306. //
  31307. // @return The computed target DFA state for the given input symbol
  31308. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  31309. // returns {@link //ERROR}.
  31310. //
  31311. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  31312. var reach = this.computeReachSet(previousD.configs, t, false);
  31313. if (reach === null) {
  31314. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  31315. return ATNSimulator.ERROR;
  31316. }
  31317. // create new target state; we'll add to DFA after it's complete
  31318. var D = new DFAState(null, reach);
  31319. var predictedAlt = this.getUniqueAlt(reach);
  31320. if (this.debug) {
  31321. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  31322. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  31323. }
  31324. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  31325. // NO CONFLICT, UNIQUELY PREDICTED ALT
  31326. D.isAcceptState = true;
  31327. D.configs.uniqueAlt = predictedAlt;
  31328. D.prediction = predictedAlt;
  31329. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  31330. // MORE THAN ONE VIABLE ALTERNATIVE
  31331. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  31332. D.requiresFullContext = true;
  31333. // in SLL-only mode, we will stop at this state and return the minimum alt
  31334. D.isAcceptState = true;
  31335. D.prediction = D.configs.conflictingAlts.minValue();
  31336. }
  31337. if (D.isAcceptState && D.configs.hasSemanticContext) {
  31338. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  31339. if (D.predicates !== null) {
  31340. D.prediction = ATN.INVALID_ALT_NUMBER;
  31341. }
  31342. }
  31343. // all adds to dfa are done after we've created full D state
  31344. D = this.addDFAEdge(dfa, previousD, t, D);
  31345. return D;
  31346. };
  31347. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  31348. // We need to test all predicates, even in DFA states that
  31349. // uniquely predict alternative.
  31350. var nalts = decisionState.transitions.length;
  31351. // Update DFA so reach becomes accept state with (predicate,alt)
  31352. // pairs if preds found for conflicting alts
  31353. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  31354. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  31355. if (altToPred !== null) {
  31356. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  31357. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  31358. } else {
  31359. // There are preds in configs but they might go away
  31360. // when OR'd together like {p}? || NONE == NONE. If neither
  31361. // alt has preds, resolve to min alt
  31362. dfaState.prediction = altsToCollectPredsFrom.minValue();
  31363. }
  31364. };
  31365. // comes back with reach.uniqueAlt set to a valid alt
  31366. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  31367. s0, input, startIndex, outerContext) {
  31368. if (this.debug || this.debug_list_atn_decisions) {
  31369. console.log("execATNWithFullContext " + s0);
  31370. }
  31371. var fullCtx = true;
  31372. var foundExactAmbig = false;
  31373. var reach = null;
  31374. var previous = s0;
  31375. input.seek(startIndex);
  31376. var t = input.LA(1);
  31377. var predictedAlt = -1;
  31378. while (true) {
  31379. // while more work
  31380. reach = this.computeReachSet(previous, t, fullCtx);
  31381. if (reach === null) {
  31382. // if any configs in previous dipped into outer context, that
  31383. // means that input up to t actually finished entry rule
  31384. // at least for LL decision. Full LL doesn't dip into outer
  31385. // so don't need special case.
  31386. // We will get an error no matter what so delay until after
  31387. // decision; better error message. Also, no reachable target
  31388. // ATN states in SLL implies LL will also get nowhere.
  31389. // If conflict in states that dip out, choose min since we
  31390. // will get error no matter what.
  31391. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  31392. input.seek(startIndex);
  31393. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  31394. if (alt !== ATN.INVALID_ALT_NUMBER) {
  31395. return alt;
  31396. } else {
  31397. throw e;
  31398. }
  31399. }
  31400. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  31401. if (this.debug) {
  31402. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  31403. }
  31404. reach.uniqueAlt = this.getUniqueAlt(reach);
  31405. // unique prediction?
  31406. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  31407. predictedAlt = reach.uniqueAlt;
  31408. break;
  31409. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  31410. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  31411. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  31412. break;
  31413. }
  31414. } else {
  31415. // In exact ambiguity mode, we never try to terminate early.
  31416. // Just keeps scarfing until we know what the conflict is
  31417. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  31418. foundExactAmbig = true;
  31419. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  31420. break;
  31421. }
  31422. // else there are multiple non-conflicting subsets or
  31423. // we're not sure what the ambiguity is yet.
  31424. // So, keep going.
  31425. }
  31426. previous = reach;
  31427. if (t !== Token.EOF) {
  31428. input.consume();
  31429. t = input.LA(1);
  31430. }
  31431. }
  31432. // If the configuration set uniquely predicts an alternative,
  31433. // without conflict, then we know that it's a full LL decision
  31434. // not SLL.
  31435. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  31436. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  31437. return predictedAlt;
  31438. }
  31439. // We do not check predicates here because we have checked them
  31440. // on-the-fly when doing full context prediction.
  31441. //
  31442. // In non-exact ambiguity detection mode, we might actually be able to
  31443. // detect an exact ambiguity, but I'm not going to spend the cycles
  31444. // needed to check. We only emit ambiguity warnings in exact ambiguity
  31445. // mode.
  31446. //
  31447. // For example, we might know that we have conflicting configurations.
  31448. // But, that does not mean that there is no way forward without a
  31449. // conflict. It's possible to have nonconflicting alt subsets as in:
  31450. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  31451. // from
  31452. //
  31453. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  31454. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  31455. //
  31456. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  31457. // would resolve this without conflict to alternative 1. Any other viable
  31458. // next sequence, however, is associated with a conflict. We stop
  31459. // looking for input because no amount of further lookahead will alter
  31460. // the fact that we should predict alternative 1. We just can't say for
  31461. // sure that there is an ambiguity without looking further.
  31462. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  31463. return predictedAlt;
  31464. };
  31465. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  31466. if (this.debug) {
  31467. console.log("in computeReachSet, starting closure: " + closure);
  31468. }
  31469. if (this.mergeCache === null) {
  31470. this.mergeCache = new DoubleDict();
  31471. }
  31472. var intermediate = new ATNConfigSet(fullCtx);
  31473. // Configurations already in a rule stop state indicate reaching the end
  31474. // of the decision rule (local context) or end of the start rule (full
  31475. // context). Once reached, these configurations are never updated by a
  31476. // closure operation, so they are handled separately for the performance
  31477. // advantage of having a smaller intermediate set when calling closure.
  31478. //
  31479. // For full-context reach operations, separate handling is required to
  31480. // ensure that the alternative matching the longest overall sequence is
  31481. // chosen when multiple such configurations can match the input.
  31482. var skippedStopStates = null;
  31483. // First figure out where we can reach on input t
  31484. for (var i = 0; i < closure.items.length; i++) {
  31485. var c = closure.items[i];
  31486. if (this.debug_add) {
  31487. console.log("testing " + this.getTokenName(t) + " at " + c);
  31488. }
  31489. if (c.state instanceof RuleStopState) {
  31490. if (fullCtx || t === Token.EOF) {
  31491. if (skippedStopStates === null) {
  31492. skippedStopStates = [];
  31493. }
  31494. skippedStopStates.push(c);
  31495. if (this.debug_add) {
  31496. console.log("added " + c + " to skippedStopStates");
  31497. }
  31498. }
  31499. continue;
  31500. }
  31501. for (var j = 0; j < c.state.transitions.length; j++) {
  31502. var trans = c.state.transitions[j];
  31503. var target = this.getReachableTarget(trans, t);
  31504. if (target !== null) {
  31505. var cfg = new ATNConfig({ state: target }, c);
  31506. intermediate.add(cfg, this.mergeCache);
  31507. if (this.debug_add) {
  31508. console.log("added " + cfg + " to intermediate");
  31509. }
  31510. }
  31511. }
  31512. }
  31513. // Now figure out where the reach operation can take us...
  31514. var reach = null;
  31515. // This block optimizes the reach operation for intermediate sets which
  31516. // trivially indicate a termination state for the overall
  31517. // adaptivePredict operation.
  31518. //
  31519. // The conditions assume that intermediate
  31520. // contains all configurations relevant to the reach set, but this
  31521. // condition is not true when one or more configurations have been
  31522. // withheld in skippedStopStates, or when the current symbol is EOF.
  31523. //
  31524. if (skippedStopStates === null && t !== Token.EOF) {
  31525. if (intermediate.items.length === 1) {
  31526. // Don't pursue the closure if there is just one state.
  31527. // It can only have one alternative; just add to result
  31528. // Also don't pursue the closure if there is unique alternative
  31529. // among the configurations.
  31530. reach = intermediate;
  31531. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  31532. // Also don't pursue the closure if there is unique alternative
  31533. // among the configurations.
  31534. reach = intermediate;
  31535. }
  31536. }
  31537. // If the reach set could not be trivially determined, perform a closure
  31538. // operation on the intermediate set to compute its initial value.
  31539. //
  31540. if (reach === null) {
  31541. reach = new ATNConfigSet(fullCtx);
  31542. var closureBusy = new Set();
  31543. var treatEofAsEpsilon = t === Token.EOF;
  31544. for (var k = 0; k < intermediate.items.length; k++) {
  31545. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  31546. }
  31547. }
  31548. if (t === Token.EOF) {
  31549. // After consuming EOF no additional input is possible, so we are
  31550. // only interested in configurations which reached the end of the
  31551. // decision rule (local context) or end of the start rule (full
  31552. // context). Update reach to contain only these configurations. This
  31553. // handles both explicit EOF transitions in the grammar and implicit
  31554. // EOF transitions following the end of the decision or start rule.
  31555. //
  31556. // When reach==intermediate, no closure operation was performed. In
  31557. // this case, removeAllConfigsNotInRuleStopState needs to check for
  31558. // reachable rule stop states as well as configurations already in
  31559. // a rule stop state.
  31560. //
  31561. // This is handled before the configurations in skippedStopStates,
  31562. // because any configurations potentially added from that list are
  31563. // already guaranteed to meet this condition whether or not it's
  31564. // required.
  31565. //
  31566. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  31567. }
  31568. // If skippedStopStates!==null, then it contains at least one
  31569. // configuration. For full-context reach operations, these
  31570. // configurations reached the end of the start rule, in which case we
  31571. // only add them back to reach if no configuration during the current
  31572. // closure operation reached such a state. This ensures adaptivePredict
  31573. // chooses an alternative matching the longest overall sequence when
  31574. // multiple alternatives are viable.
  31575. //
  31576. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  31577. for (var l = 0; l < skippedStopStates.length; l++) {
  31578. reach.add(skippedStopStates[l], this.mergeCache);
  31579. }
  31580. }
  31581. if (reach.items.length === 0) {
  31582. return null;
  31583. } else {
  31584. return reach;
  31585. }
  31586. };
  31587. //
  31588. // Return a configuration set containing only the configurations from
  31589. // {@code configs} which are in a {@link RuleStopState}. If all
  31590. // configurations in {@code configs} are already in a rule stop state, this
  31591. // method simply returns {@code configs}.
  31592. //
  31593. // <p>When {@code lookToEndOfRule} is true, this method uses
  31594. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  31595. // not already in a rule stop state to see if a rule stop state is reachable
  31596. // from the configuration via epsilon-only transitions.</p>
  31597. //
  31598. // @param configs the configuration set to update
  31599. // @param lookToEndOfRule when true, this method checks for rule stop states
  31600. // reachable by epsilon-only transitions from each configuration in
  31601. // {@code configs}.
  31602. //
  31603. // @return {@code configs} if all configurations in {@code configs} are in a
  31604. // rule stop state, otherwise return a new configuration set containing only
  31605. // the configurations from {@code configs} which are in a rule stop state
  31606. //
  31607. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  31608. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  31609. return configs;
  31610. }
  31611. var result = new ATNConfigSet(configs.fullCtx);
  31612. for (var i = 0; i < configs.items.length; i++) {
  31613. var config = configs.items[i];
  31614. if (config.state instanceof RuleStopState) {
  31615. result.add(config, this.mergeCache);
  31616. continue;
  31617. }
  31618. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  31619. var nextTokens = this.atn.nextTokens(config.state);
  31620. if (nextTokens.contains(Token.EPSILON)) {
  31621. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  31622. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  31623. }
  31624. }
  31625. }
  31626. return result;
  31627. };
  31628. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  31629. // always at least the implicit call to start rule
  31630. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  31631. var configs = new ATNConfigSet(fullCtx);
  31632. for (var i = 0; i < p.transitions.length; i++) {
  31633. var target = p.transitions[i].target;
  31634. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  31635. var closureBusy = new Set();
  31636. this.closure(c, configs, closureBusy, true, fullCtx, false);
  31637. }
  31638. return configs;
  31639. };
  31640. //
  31641. // This method transforms the start state computed by
  31642. // {@link //computeStartState} to the special start state used by a
  31643. // precedence DFA for a particular precedence value. The transformation
  31644. // process applies the following changes to the start state's configuration
  31645. // set.
  31646. //
  31647. // <ol>
  31648. // <li>Evaluate the precedence predicates for each configuration using
  31649. // {@link SemanticContext//evalPrecedence}.</li>
  31650. // <li>Remove all configurations which predict an alternative greater than
  31651. // 1, for which another configuration that predicts alternative 1 is in the
  31652. // same ATN state with the same prediction context. This transformation is
  31653. // valid for the following reasons:
  31654. // <ul>
  31655. // <li>The closure block cannot contain any epsilon transitions which bypass
  31656. // the body of the closure, so all states reachable via alternative 1 are
  31657. // part of the precedence alternatives of the transformed left-recursive
  31658. // rule.</li>
  31659. // <li>The "primary" portion of a left recursive rule cannot contain an
  31660. // epsilon transition, so the only way an alternative other than 1 can exist
  31661. // in a state that is also reachable via alternative 1 is by nesting calls
  31662. // to the left-recursive rule, with the outer calls not being at the
  31663. // preferred precedence level.</li>
  31664. // </ul>
  31665. // </li>
  31666. // </ol>
  31667. //
  31668. // <p>
  31669. // The prediction context must be considered by this filter to address
  31670. // situations like the following.
  31671. // </p>
  31672. // <code>
  31673. // <pre>
  31674. // grammar TA;
  31675. // prog: statement* EOF;
  31676. // statement: letterA | statement letterA 'b' ;
  31677. // letterA: 'a';
  31678. // </pre>
  31679. // </code>
  31680. // <p>
  31681. // If the above grammar, the ATN state immediately before the token
  31682. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  31683. // of both the primary and closure blocks of the left-recursive rule
  31684. // {@code statement}. The prediction context associated with each of these
  31685. // configurations distinguishes between them, and prevents the alternative
  31686. // which stepped out to {@code prog} (and then back in to {@code statement}
  31687. // from being eliminated by the filter.
  31688. // </p>
  31689. //
  31690. // @param configs The configuration set computed by
  31691. // {@link //computeStartState} as the start state for the DFA.
  31692. // @return The transformed configuration set representing the start state
  31693. // for a precedence DFA at a particular precedence level (determined by
  31694. // calling {@link Parser//getPrecedence}).
  31695. //
  31696. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  31697. var config;
  31698. var statesFromAlt1 = [];
  31699. var configSet = new ATNConfigSet(configs.fullCtx);
  31700. for (var i = 0; i < configs.items.length; i++) {
  31701. config = configs.items[i];
  31702. // handle alt 1 first
  31703. if (config.alt !== 1) {
  31704. continue;
  31705. }
  31706. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  31707. if (updatedContext === null) {
  31708. // the configuration was eliminated
  31709. continue;
  31710. }
  31711. statesFromAlt1[config.state.stateNumber] = config.context;
  31712. if (updatedContext !== config.semanticContext) {
  31713. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  31714. } else {
  31715. configSet.add(config, this.mergeCache);
  31716. }
  31717. }
  31718. for (i = 0; i < configs.items.length; i++) {
  31719. config = configs.items[i];
  31720. if (config.alt === 1) {
  31721. // already handled
  31722. continue;
  31723. }
  31724. // In the future, this elimination step could be updated to also
  31725. // filter the prediction context for alternatives predicting alt>1
  31726. // (basically a graph subtraction algorithm).
  31727. if (!config.precedenceFilterSuppressed) {
  31728. var context = statesFromAlt1[config.state.stateNumber] || null;
  31729. if (context !== null && context.equals(config.context)) {
  31730. // eliminated
  31731. continue;
  31732. }
  31733. }
  31734. configSet.add(config, this.mergeCache);
  31735. }
  31736. return configSet;
  31737. };
  31738. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  31739. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  31740. return trans.target;
  31741. } else {
  31742. return null;
  31743. }
  31744. };
  31745. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  31746. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  31747. // altToPred starts as an array of all null contexts. The entry at index i
  31748. // corresponds to alternative i. altToPred[i] may have one of three values:
  31749. // 1. null: no ATNConfig c is found such that c.alt==i
  31750. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  31751. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  31752. // alt i has at least one unpredicated config.
  31753. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  31754. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  31755. //
  31756. // From this, it is clear that NONE||anything==NONE.
  31757. //
  31758. var altToPred = [];
  31759. for (var i = 0; i < configs.items.length; i++) {
  31760. var c = configs.items[i];
  31761. if (ambigAlts.contains(c.alt)) {
  31762. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  31763. }
  31764. }
  31765. var nPredAlts = 0;
  31766. for (i = 1; i < nalts + 1; i++) {
  31767. var pred = altToPred[i] || null;
  31768. if (pred === null) {
  31769. altToPred[i] = SemanticContext.NONE;
  31770. } else if (pred !== SemanticContext.NONE) {
  31771. nPredAlts += 1;
  31772. }
  31773. }
  31774. // nonambig alts are null in altToPred
  31775. if (nPredAlts === 0) {
  31776. altToPred = null;
  31777. }
  31778. if (this.debug) {
  31779. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  31780. }
  31781. return altToPred;
  31782. };
  31783. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  31784. var pairs = [];
  31785. var containsPredicate = false;
  31786. for (var i = 1; i < altToPred.length; i++) {
  31787. var pred = altToPred[i];
  31788. // unpredicated is indicated by SemanticContext.NONE
  31789. if (ambigAlts !== null && ambigAlts.contains(i)) {
  31790. pairs.push(new PredPrediction(pred, i));
  31791. }
  31792. if (pred !== SemanticContext.NONE) {
  31793. containsPredicate = true;
  31794. }
  31795. }
  31796. if (!containsPredicate) {
  31797. return null;
  31798. }
  31799. return pairs;
  31800. };
  31801. //
  31802. // This method is used to improve the localization of error messages by
  31803. // choosing an alternative rather than throwing a
  31804. // {@link NoViableAltException} in particular prediction scenarios where the
  31805. // {@link //ERROR} state was reached during ATN simulation.
  31806. //
  31807. // <p>
  31808. // The default implementation of this method uses the following
  31809. // algorithm to identify an ATN configuration which successfully parsed the
  31810. // decision entry rule. Choosing such an alternative ensures that the
  31811. // {@link ParserRuleContext} returned by the calling rule will be complete
  31812. // and valid, and the syntax error will be reported later at a more
  31813. // localized location.</p>
  31814. //
  31815. // <ul>
  31816. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  31817. // they are semantically valid if predicated, return the min associated alt.</li>
  31818. // <li>Else, if a semantically invalid but syntactically valid path exist
  31819. // or paths exist, return the minimum associated alt.
  31820. // </li>
  31821. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  31822. // </ul>
  31823. //
  31824. // <p>
  31825. // In some scenarios, the algorithm described above could predict an
  31826. // alternative which will result in a {@link FailedPredicateException} in
  31827. // the parser. Specifically, this could occur if the <em>only</em> configuration
  31828. // capable of successfully parsing to the end of the decision rule is
  31829. // blocked by a semantic predicate. By choosing this alternative within
  31830. // {@link //adaptivePredict} instead of throwing a
  31831. // {@link NoViableAltException}, the resulting
  31832. // {@link FailedPredicateException} in the parser will identify the specific
  31833. // predicate which is preventing the parser from successfully parsing the
  31834. // decision rule, which helps developers identify and correct logic errors
  31835. // in semantic predicates.
  31836. // </p>
  31837. //
  31838. // @param configs The ATN configurations which were valid immediately before
  31839. // the {@link //ERROR} state was reached
  31840. // @param outerContext The is the \gamma_0 initial parser context from the paper
  31841. // or the parser stack at the instant before prediction commences.
  31842. //
  31843. // @return The value to return from {@link //adaptivePredict}, or
  31844. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  31845. // identified and {@link //adaptivePredict} should report an error instead.
  31846. //
  31847. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  31848. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  31849. var semValidConfigs = cfgs[0];
  31850. var semInvalidConfigs = cfgs[1];
  31851. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  31852. if (alt !== ATN.INVALID_ALT_NUMBER) {
  31853. // semantically/syntactically viable path exists
  31854. return alt;
  31855. }
  31856. // Is there a syntactically valid path with a failed pred?
  31857. if (semInvalidConfigs.items.length > 0) {
  31858. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  31859. if (alt !== ATN.INVALID_ALT_NUMBER) {
  31860. // syntactically viable path exists
  31861. return alt;
  31862. }
  31863. }
  31864. return ATN.INVALID_ALT_NUMBER;
  31865. };
  31866. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  31867. var alts = [];
  31868. for (var i = 0; i < configs.items.length; i++) {
  31869. var c = configs.items[i];
  31870. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  31871. if (alts.indexOf(c.alt) < 0) {
  31872. alts.push(c.alt);
  31873. }
  31874. }
  31875. }
  31876. if (alts.length === 0) {
  31877. return ATN.INVALID_ALT_NUMBER;
  31878. } else {
  31879. return Math.min.apply(null, alts);
  31880. }
  31881. };
  31882. // Walk the list of configurations and split them according to
  31883. // those that have preds evaluating to true/false. If no pred, assume
  31884. // true pred and include in succeeded set. Returns Pair of sets.
  31885. //
  31886. // Create a new set so as not to alter the incoming parameter.
  31887. //
  31888. // Assumption: the input stream has been restored to the starting point
  31889. // prediction, which is where predicates need to evaluate.
  31890. //
  31891. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  31892. var succeeded = new ATNConfigSet(configs.fullCtx);
  31893. var failed = new ATNConfigSet(configs.fullCtx);
  31894. for (var i = 0; i < configs.items.length; i++) {
  31895. var c = configs.items[i];
  31896. if (c.semanticContext !== SemanticContext.NONE) {
  31897. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  31898. if (predicateEvaluationResult) {
  31899. succeeded.add(c);
  31900. } else {
  31901. failed.add(c);
  31902. }
  31903. } else {
  31904. succeeded.add(c);
  31905. }
  31906. }
  31907. return [succeeded, failed];
  31908. };
  31909. // Look through a list of predicate/alt pairs, returning alts for the
  31910. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  31911. // unpredicated config which behaves as "always true." If !complete
  31912. // then we stop at the first predicate that evaluates to true. This
  31913. // includes pairs with null predicates.
  31914. //
  31915. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  31916. var predictions = new BitSet();
  31917. for (var i = 0; i < predPredictions.length; i++) {
  31918. var pair = predPredictions[i];
  31919. if (pair.pred === SemanticContext.NONE) {
  31920. predictions.add(pair.alt);
  31921. if (!complete) {
  31922. break;
  31923. }
  31924. continue;
  31925. }
  31926. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  31927. if (this.debug || this.dfa_debug) {
  31928. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  31929. }
  31930. if (predicateEvaluationResult) {
  31931. if (this.debug || this.dfa_debug) {
  31932. console.log("PREDICT " + pair.alt);
  31933. }
  31934. predictions.add(pair.alt);
  31935. if (!complete) {
  31936. break;
  31937. }
  31938. }
  31939. }
  31940. return predictions;
  31941. };
  31942. // TODO: If we are doing predicates, there is no point in pursuing
  31943. // closure operations if we reach a DFA state that uniquely predicts
  31944. // alternative. We will not be caching that DFA state and it is a
  31945. // waste to pursue the closure. Might have to advance when we do
  31946. // ambig detection thought :(
  31947. //
  31948. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  31949. var initialDepth = 0;
  31950. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  31951. };
  31952. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  31953. if (this.debug || this.debug_closure) {
  31954. console.log("closure(" + config.toString(this.parser, true) + ")");
  31955. // console.log("configs(" + configs.toString() + ")");
  31956. if (config.reachesIntoOuterContext > 50) {
  31957. throw "problem";
  31958. }
  31959. }
  31960. if (config.state instanceof RuleStopState) {
  31961. // We hit rule end. If we have context info, use it
  31962. // run thru all possible stack tops in ctx
  31963. if (!config.context.isEmpty()) {
  31964. for (var i = 0; i < config.context.length; i++) {
  31965. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  31966. if (fullCtx) {
  31967. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  31968. continue;
  31969. } else {
  31970. // we have no context info, just chase follow links (if greedy)
  31971. if (this.debug) {
  31972. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  31973. }
  31974. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  31975. }
  31976. continue;
  31977. }
  31978. var returnState = this.atn.states[config.context.getReturnState(i)];
  31979. var newContext = config.context.getParent(i); // "pop" return state
  31980. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  31981. var c = new ATNConfig(parms, null);
  31982. // While we have context to pop back from, we may have
  31983. // gotten that context AFTER having falling off a rule.
  31984. // Make sure we track that we are now out of context.
  31985. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  31986. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  31987. }
  31988. return;
  31989. } else if (fullCtx) {
  31990. // reached end of start rule
  31991. configs.add(config, this.mergeCache);
  31992. return;
  31993. } else {
  31994. // else if we have no context info, just chase follow links (if greedy)
  31995. if (this.debug) {
  31996. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  31997. }
  31998. }
  31999. }
  32000. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  32001. };
  32002. // Do the actual work of walking epsilon edges//
  32003. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  32004. var p = config.state;
  32005. // optimization
  32006. if (!p.epsilonOnlyTransitions) {
  32007. configs.add(config, this.mergeCache);
  32008. // make sure to not return here, because EOF transitions can act as
  32009. // both epsilon transitions and non-epsilon transitions.
  32010. }
  32011. for (var i = 0; i < p.transitions.length; i++) {
  32012. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  32013. var t = p.transitions[i];
  32014. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  32015. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  32016. if (c !== null) {
  32017. var newDepth = depth;
  32018. if (config.state instanceof RuleStopState) {
  32019. // target fell off end of rule; mark resulting c as having dipped into outer context
  32020. // We can't get here if incoming config was rule stop and we had context
  32021. // track how far we dip into outer context. Might
  32022. // come in handy and we avoid evaluating context dependent
  32023. // preds if this is > 0.
  32024. if (this._dfa !== null && this._dfa.precedenceDfa) {
  32025. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  32026. c.precedenceFilterSuppressed = true;
  32027. }
  32028. }
  32029. c.reachesIntoOuterContext += 1;
  32030. if (closureBusy.add(c) !== c) {
  32031. // avoid infinite recursion for right-recursive rules
  32032. continue;
  32033. }
  32034. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  32035. newDepth -= 1;
  32036. if (this.debug) {
  32037. console.log("dips into outer ctx: " + c);
  32038. }
  32039. } else {
  32040. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  32041. // avoid infinite recursion for EOF* and EOF+
  32042. continue;
  32043. }
  32044. if (t instanceof RuleTransition) {
  32045. // latch when newDepth goes negative - once we step out of the entry context we can't return
  32046. if (newDepth >= 0) {
  32047. newDepth += 1;
  32048. }
  32049. }
  32050. }
  32051. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  32052. }
  32053. }
  32054. };
  32055. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  32056. // return False
  32057. var p = config.state;
  32058. // First check to see if we are in StarLoopEntryState generated during
  32059. // left-recursion elimination. For efficiency, also check if
  32060. // the context has an empty stack case. If so, it would mean
  32061. // global FOLLOW so we can't perform optimization
  32062. // Are we the special loop entry/exit state? or SLL wildcard
  32063. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  32064. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  32065. // Require all return states to return back to the same rule that p is in.
  32066. var numCtxs = config.context.length;
  32067. for (var i = 0; i < numCtxs; i++) {
  32068. // for each stack context
  32069. var returnState = this.atn.states[config.context.getReturnState(i)];
  32070. if (returnState.ruleIndex != p.ruleIndex) return false;
  32071. }
  32072. var decisionStartState = p.transitions[0].target;
  32073. var blockEndStateNum = decisionStartState.endState.stateNumber;
  32074. var blockEndState = this.atn.states[blockEndStateNum];
  32075. // Verify that the top of each stack context leads to loop entry/exit
  32076. // state through epsilon edges and w/o leaving rule.
  32077. for (var i = 0; i < numCtxs; i++) {
  32078. // for each stack context
  32079. var returnStateNumber = config.context.getReturnState(i);
  32080. var returnState = this.atn.states[returnStateNumber];
  32081. // all states must have single outgoing epsilon edge
  32082. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  32083. // Look for prefix op case like 'not expr', (' type ')' expr
  32084. var returnStateTarget = returnState.transitions[0].target;
  32085. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  32086. // Look for 'expr op expr' or case where expr's return state is block end
  32087. // of (...)* internal block; the block end points to loop back
  32088. // which points to p but we don't need to check that
  32089. if (returnState == blockEndState) continue;
  32090. // Look for ternary expr ? expr : expr. The return state points at block end,
  32091. // which points at loop entry state
  32092. if (returnStateTarget == blockEndState) continue;
  32093. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  32094. // return state points at block end state of (...)* internal block
  32095. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  32096. // anything else ain't conforming
  32097. return false;
  32098. }
  32099. return true;
  32100. };
  32101. ParserATNSimulator.prototype.getRuleName = function (index) {
  32102. if (this.parser !== null && index >= 0) {
  32103. return this.parser.ruleNames[index];
  32104. } else {
  32105. return "<rule " + index + ">";
  32106. }
  32107. };
  32108. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  32109. switch (t.serializationType) {
  32110. case Transition.RULE:
  32111. return this.ruleTransition(config, t);
  32112. case Transition.PRECEDENCE:
  32113. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  32114. case Transition.PREDICATE:
  32115. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  32116. case Transition.ACTION:
  32117. return this.actionTransition(config, t);
  32118. case Transition.EPSILON:
  32119. return new ATNConfig({ state: t.target }, config);
  32120. case Transition.ATOM:
  32121. case Transition.RANGE:
  32122. case Transition.SET:
  32123. // EOF transitions act like epsilon transitions after the first EOF
  32124. // transition is traversed
  32125. if (treatEofAsEpsilon) {
  32126. if (t.matches(Token.EOF, 0, 1)) {
  32127. return new ATNConfig({ state: t.target }, config);
  32128. }
  32129. }
  32130. return null;
  32131. default:
  32132. return null;
  32133. }
  32134. };
  32135. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  32136. if (this.debug) {
  32137. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  32138. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  32139. }
  32140. return new ATNConfig({ state: t.target }, config);
  32141. };
  32142. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  32143. if (this.debug) {
  32144. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  32145. if (this.parser !== null) {
  32146. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  32147. }
  32148. }
  32149. var c = null;
  32150. if (collectPredicates && inContext) {
  32151. if (fullCtx) {
  32152. // In full context mode, we can evaluate predicates on-the-fly
  32153. // during closure, which dramatically reduces the size of
  32154. // the config sets. It also obviates the need to test predicates
  32155. // later during conflict resolution.
  32156. var currentPosition = this._input.index;
  32157. this._input.seek(this._startIndex);
  32158. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  32159. this._input.seek(currentPosition);
  32160. if (predSucceeds) {
  32161. c = new ATNConfig({ state: pt.target }, config); // no pred context
  32162. }
  32163. } else {
  32164. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  32165. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  32166. }
  32167. } else {
  32168. c = new ATNConfig({ state: pt.target }, config);
  32169. }
  32170. if (this.debug) {
  32171. console.log("config from pred transition=" + c);
  32172. }
  32173. return c;
  32174. };
  32175. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  32176. if (this.debug) {
  32177. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  32178. if (this.parser !== null) {
  32179. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  32180. }
  32181. }
  32182. var c = null;
  32183. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  32184. if (fullCtx) {
  32185. // In full context mode, we can evaluate predicates on-the-fly
  32186. // during closure, which dramatically reduces the size of
  32187. // the config sets. It also obviates the need to test predicates
  32188. // later during conflict resolution.
  32189. var currentPosition = this._input.index;
  32190. this._input.seek(this._startIndex);
  32191. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  32192. this._input.seek(currentPosition);
  32193. if (predSucceeds) {
  32194. c = new ATNConfig({ state: pt.target }, config); // no pred context
  32195. }
  32196. } else {
  32197. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  32198. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  32199. }
  32200. } else {
  32201. c = new ATNConfig({ state: pt.target }, config);
  32202. }
  32203. if (this.debug) {
  32204. console.log("config from pred transition=" + c);
  32205. }
  32206. return c;
  32207. };
  32208. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  32209. if (this.debug) {
  32210. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  32211. }
  32212. var returnState = t.followState;
  32213. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  32214. return new ATNConfig({ state: t.target, context: newContext }, config);
  32215. };
  32216. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  32217. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  32218. return PredictionMode.getAlts(altsets);
  32219. };
  32220. // Sam pointed out a problem with the previous definition, v3, of
  32221. // ambiguous states. If we have another state associated with conflicting
  32222. // alternatives, we should keep going. For example, the following grammar
  32223. //
  32224. // s : (ID | ID ID?) ';' ;
  32225. //
  32226. // When the ATN simulation reaches the state before ';', it has a DFA
  32227. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  32228. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  32229. // because alternative to has another way to continue, via [6|2|[]].
  32230. // The key is that we have a single state that has config's only associated
  32231. // with a single alternative, 2, and crucially the state transitions
  32232. // among the configurations are all non-epsilon transitions. That means
  32233. // we don't consider any conflicts that include alternative 2. So, we
  32234. // ignore the conflict between alts 1 and 2. We ignore a set of
  32235. // conflicting alts when there is an intersection with an alternative
  32236. // associated with a single alt state in the state&rarr;config-list map.
  32237. //
  32238. // It's also the case that we might have two conflicting configurations but
  32239. // also a 3rd nonconflicting configuration for a different alternative:
  32240. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  32241. //
  32242. // a : A | A | A B ;
  32243. //
  32244. // After matching input A, we reach the stop state for rule A, state 1.
  32245. // State 8 is the state right before B. Clearly alternatives 1 and 2
  32246. // conflict and no amount of further lookahead will separate the two.
  32247. // However, alternative 3 will be able to continue and so we do not
  32248. // stop working on this state. In the previous example, we're concerned
  32249. // with states associated with the conflicting alternatives. Here alt
  32250. // 3 is not associated with the conflicting configs, but since we can continue
  32251. // looking for input reasonably, I don't declare the state done. We
  32252. // ignore a set of conflicting alts when we have an alternative
  32253. // that we still need to pursue.
  32254. //
  32255. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  32256. var conflictingAlts = null;
  32257. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  32258. conflictingAlts = new BitSet();
  32259. conflictingAlts.add(configs.uniqueAlt);
  32260. } else {
  32261. conflictingAlts = configs.conflictingAlts;
  32262. }
  32263. return conflictingAlts;
  32264. };
  32265. ParserATNSimulator.prototype.getTokenName = function (t) {
  32266. if (t === Token.EOF) {
  32267. return "EOF";
  32268. }
  32269. if (this.parser !== null && this.parser.literalNames !== null) {
  32270. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  32271. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  32272. console.log("" + this.parser.getInputStream().getTokens());
  32273. } else {
  32274. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  32275. return name + "<" + t + ">";
  32276. }
  32277. }
  32278. return "" + t;
  32279. };
  32280. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  32281. return this.getTokenName(input.LA(1));
  32282. };
  32283. // Used for debugging in adaptivePredict around execATN but I cut
  32284. // it out for clarity now that alg. works well. We can leave this
  32285. // "dead" code for a bit.
  32286. //
  32287. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  32288. console.log("dead end configs: ");
  32289. var decs = nvae.getDeadEndConfigs();
  32290. for (var i = 0; i < decs.length; i++) {
  32291. var c = decs[i];
  32292. var trans = "no edges";
  32293. if (c.state.transitions.length > 0) {
  32294. var t = c.state.transitions[0];
  32295. if (t instanceof AtomTransition) {
  32296. trans = "Atom " + this.getTokenName(t.label);
  32297. } else if (t instanceof SetTransition) {
  32298. var neg = t instanceof NotSetTransition;
  32299. trans = (neg ? "~" : "") + "Set " + t.set;
  32300. }
  32301. }
  32302. console.error(c.toString(this.parser, true) + ":" + trans);
  32303. }
  32304. };
  32305. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  32306. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  32307. };
  32308. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  32309. var alt = ATN.INVALID_ALT_NUMBER;
  32310. for (var i = 0; i < configs.items.length; i++) {
  32311. var c = configs.items[i];
  32312. if (alt === ATN.INVALID_ALT_NUMBER) {
  32313. alt = c.alt; // found first alt
  32314. } else if (c.alt !== alt) {
  32315. return ATN.INVALID_ALT_NUMBER;
  32316. }
  32317. }
  32318. return alt;
  32319. };
  32320. //
  32321. // Add an edge to the DFA, if possible. This method calls
  32322. // {@link //addDFAState} to ensure the {@code to} state is present in the
  32323. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  32324. // range of edges that can be represented in the DFA tables, this method
  32325. // returns without adding the edge to the DFA.
  32326. //
  32327. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  32328. // Otherwise, this method returns the {@link DFAState} returned by calling
  32329. // {@link //addDFAState} for the {@code to} state.</p>
  32330. //
  32331. // @param dfa The DFA
  32332. // @param from The source state for the edge
  32333. // @param t The input symbol
  32334. // @param to The target state for the edge
  32335. //
  32336. // @return If {@code to} is {@code null}, this method returns {@code null};
  32337. // otherwise this method returns the result of calling {@link //addDFAState}
  32338. // on {@code to}
  32339. //
  32340. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  32341. if (this.debug) {
  32342. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  32343. }
  32344. if (to === null) {
  32345. return null;
  32346. }
  32347. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  32348. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  32349. return to;
  32350. }
  32351. if (from_.edges === null) {
  32352. from_.edges = [];
  32353. }
  32354. from_.edges[t + 1] = to; // connect
  32355. if (this.debug) {
  32356. var literalNames = this.parser === null ? null : this.parser.literalNames;
  32357. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  32358. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  32359. }
  32360. return to;
  32361. };
  32362. //
  32363. // Add state {@code D} to the DFA if it is not already present, and return
  32364. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  32365. // is already in the DFA, the existing state is returned. Otherwise this
  32366. // method returns {@code D} after adding it to the DFA.
  32367. //
  32368. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  32369. // does not change the DFA.</p>
  32370. //
  32371. // @param dfa The dfa
  32372. // @param D The DFA state to add
  32373. // @return The state stored in the DFA. This will be either the existing
  32374. // state if {@code D} is already in the DFA, or {@code D} itself if the
  32375. // state was not already present.
  32376. //
  32377. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  32378. if (D == ATNSimulator.ERROR) {
  32379. return D;
  32380. }
  32381. var existing = dfa.states.get(D);
  32382. if (existing !== null) {
  32383. return existing;
  32384. }
  32385. D.stateNumber = dfa.states.length;
  32386. if (!D.configs.readOnly) {
  32387. D.configs.optimizeConfigs(this);
  32388. D.configs.setReadonly(true);
  32389. }
  32390. dfa.states.add(D);
  32391. if (this.debug) {
  32392. console.log("adding new DFA state: " + D);
  32393. }
  32394. return D;
  32395. };
  32396. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  32397. if (this.debug || this.retry_debug) {
  32398. var interval = new Interval(startIndex, stopIndex + 1);
  32399. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  32400. }
  32401. if (this.parser !== null) {
  32402. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  32403. }
  32404. };
  32405. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  32406. if (this.debug || this.retry_debug) {
  32407. var interval = new Interval(startIndex, stopIndex + 1);
  32408. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  32409. }
  32410. if (this.parser !== null) {
  32411. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  32412. }
  32413. };
  32414. // If context sensitive parsing, we know it's ambiguity not conflict//
  32415. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  32416. if (this.debug || this.retry_debug) {
  32417. var interval = new Interval(startIndex, stopIndex + 1);
  32418. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  32419. }
  32420. if (this.parser !== null) {
  32421. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  32422. }
  32423. };
  32424. exports.ParserATNSimulator = ParserATNSimulator;
  32425. /***/ }),
  32426. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  32427. /*!***************************************************!*\
  32428. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  32429. \***************************************************/
  32430. /*! no static exports found */
  32431. /***/ (function(module, exports, __webpack_require__) {
  32432. "use strict";
  32433. //
  32434. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32435. * Use of this file is governed by the BSD 3-clause license that
  32436. * can be found in the LICENSE.txt file in the project root.
  32437. */
  32438. //
  32439. //
  32440. // This enumeration defines the prediction modes available in ANTLR 4 along with
  32441. // utility methods for analyzing configuration sets for conflicts and/or
  32442. // ambiguities.
  32443. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  32444. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  32445. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  32446. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  32447. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  32448. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  32449. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  32450. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  32451. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  32452. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  32453. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  32454. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  32455. function PredictionMode() {
  32456. return this;
  32457. }
  32458. //
  32459. // The SLL(*) prediction mode. This prediction mode ignores the current
  32460. // parser context when making predictions. This is the fastest prediction
  32461. // mode, and provides correct results for many grammars. This prediction
  32462. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  32463. // may result in syntax errors for grammar and input combinations which are
  32464. // not SLL.
  32465. //
  32466. // <p>
  32467. // When using this prediction mode, the parser will either return a correct
  32468. // parse tree (i.e. the same parse tree that would be returned with the
  32469. // {@link //LL} prediction mode), or it will report a syntax error. If a
  32470. // syntax error is encountered when using the {@link //SLL} prediction mode,
  32471. // it may be due to either an actual syntax error in the input or indicate
  32472. // that the particular combination of grammar and input requires the more
  32473. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  32474. //
  32475. // <p>
  32476. // This prediction mode does not provide any guarantees for prediction
  32477. // behavior for syntactically-incorrect inputs.</p>
  32478. //
  32479. PredictionMode.SLL = 0;
  32480. //
  32481. // The LL(*) prediction mode. This prediction mode allows the current parser
  32482. // context to be used for resolving SLL conflicts that occur during
  32483. // prediction. This is the fastest prediction mode that guarantees correct
  32484. // parse results for all combinations of grammars with syntactically correct
  32485. // inputs.
  32486. //
  32487. // <p>
  32488. // When using this prediction mode, the parser will make correct decisions
  32489. // for all syntactically-correct grammar and input combinations. However, in
  32490. // cases where the grammar is truly ambiguous this prediction mode might not
  32491. // report a precise answer for <em>exactly which</em> alternatives are
  32492. // ambiguous.</p>
  32493. //
  32494. // <p>
  32495. // This prediction mode does not provide any guarantees for prediction
  32496. // behavior for syntactically-incorrect inputs.</p>
  32497. //
  32498. PredictionMode.LL = 1;
  32499. //
  32500. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  32501. // the correctness guarantees provided by the {@link //LL} prediction mode,
  32502. // this prediction mode instructs the prediction algorithm to determine the
  32503. // complete and exact set of ambiguous alternatives for every ambiguous
  32504. // decision encountered while parsing.
  32505. //
  32506. // <p>
  32507. // This prediction mode may be used for diagnosing ambiguities during
  32508. // grammar development. Due to the performance overhead of calculating sets
  32509. // of ambiguous alternatives, this prediction mode should be avoided when
  32510. // the exact results are not necessary.</p>
  32511. //
  32512. // <p>
  32513. // This prediction mode does not provide any guarantees for prediction
  32514. // behavior for syntactically-incorrect inputs.</p>
  32515. //
  32516. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  32517. //
  32518. // Computes the SLL prediction termination condition.
  32519. //
  32520. // <p>
  32521. // This method computes the SLL prediction termination condition for both of
  32522. // the following cases.</p>
  32523. //
  32524. // <ul>
  32525. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  32526. // <li>Pure SLL without LL fallback</li>
  32527. // </ul>
  32528. //
  32529. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  32530. //
  32531. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  32532. // ensured regardless of how the termination condition is computed by this
  32533. // method. Due to the substantially higher cost of LL prediction, the
  32534. // prediction should only fall back to LL when the additional lookahead
  32535. // cannot lead to a unique SLL prediction.</p>
  32536. //
  32537. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  32538. // conflicting subsets should fall back to full LL, even if the
  32539. // configuration sets don't resolve to the same alternative (e.g.
  32540. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  32541. // configuration, SLL could continue with the hopes that more lookahead will
  32542. // resolve via one of those non-conflicting configurations.</p>
  32543. //
  32544. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  32545. // stops when it sees only conflicting configuration subsets. In contrast,
  32546. // full LL keeps going when there is uncertainty.</p>
  32547. //
  32548. // <p><strong>HEURISTIC</strong></p>
  32549. //
  32550. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  32551. // unless we see a state that only has one alternative associated with it.
  32552. // The single-alt-state thing lets prediction continue upon rules like
  32553. // (otherwise, it would admit defeat too soon):</p>
  32554. //
  32555. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  32556. //
  32557. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  32558. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  32559. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  32560. // processing this node because alternative to has another way to continue,
  32561. // via {@code [6|2|[]]}.</p>
  32562. //
  32563. // <p>It also let's us continue for this rule:</p>
  32564. //
  32565. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  32566. //
  32567. // <p>After matching input A, we reach the stop state for rule A, state 1.
  32568. // State 8 is the state right before B. Clearly alternatives 1 and 2
  32569. // conflict and no amount of further lookahead will separate the two.
  32570. // However, alternative 3 will be able to continue and so we do not stop
  32571. // working on this state. In the previous example, we're concerned with
  32572. // states associated with the conflicting alternatives. Here alt 3 is not
  32573. // associated with the conflicting configs, but since we can continue
  32574. // looking for input reasonably, don't declare the state done.</p>
  32575. //
  32576. // <p><strong>PURE SLL PARSING</strong></p>
  32577. //
  32578. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  32579. // combine stack contexts for configurations that differ only by semantic
  32580. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  32581. //
  32582. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  32583. //
  32584. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  32585. // states because they need to create the DFA cache that works in all
  32586. // semantic situations. In contrast, full LL evaluates predicates collected
  32587. // during start state computation so it can ignore predicates thereafter.
  32588. // This means that SLL termination detection can totally ignore semantic
  32589. // predicates.</p>
  32590. //
  32591. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  32592. // semantic predicate contexts so we might see two configurations like the
  32593. // following.</p>
  32594. //
  32595. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  32596. //
  32597. // <p>Before testing these configurations against others, we have to merge
  32598. // {@code x} and {@code x'} (without modifying the existing configurations).
  32599. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  32600. // the following configurations.</p>
  32601. //
  32602. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  32603. //
  32604. // <p>If the configuration set has predicates (as indicated by
  32605. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  32606. // the configurations to strip out all of the predicates so that a standard
  32607. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  32608. //
  32609. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  32610. // Configs in rule stop states indicate reaching the end of the decision
  32611. // rule (local context) or end of start rule (full context). If all
  32612. // configs meet this condition, then none of the configurations is able
  32613. // to match additional input so we terminate prediction.
  32614. //
  32615. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  32616. return true;
  32617. }
  32618. // pure SLL mode parsing
  32619. if (mode === PredictionMode.SLL) {
  32620. // Don't bother with combining configs from different semantic
  32621. // contexts if we can fail over to full LL; costs more time
  32622. // since we'll often fail over anyway.
  32623. if (configs.hasSemanticContext) {
  32624. // dup configs, tossing out semantic predicates
  32625. var dup = new ATNConfigSet();
  32626. for (var i = 0; i < configs.items.length; i++) {
  32627. var c = configs.items[i];
  32628. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  32629. dup.add(c);
  32630. }
  32631. configs = dup;
  32632. }
  32633. // now we have combined contexts for configs with dissimilar preds
  32634. }
  32635. // pure SLL or combined SLL+LL mode parsing
  32636. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  32637. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  32638. };
  32639. // Checks if any configuration in {@code configs} is in a
  32640. // {@link RuleStopState}. Configurations meeting this condition have reached
  32641. // the end of the decision rule (local context) or end of start rule (full
  32642. // context).
  32643. //
  32644. // @param configs the configuration set to test
  32645. // @return {@code true} if any configuration in {@code configs} is in a
  32646. // {@link RuleStopState}, otherwise {@code false}
  32647. PredictionMode.hasConfigInRuleStopState = function (configs) {
  32648. for (var i = 0; i < configs.items.length; i++) {
  32649. var c = configs.items[i];
  32650. if (c.state instanceof RuleStopState) {
  32651. return true;
  32652. }
  32653. }
  32654. return false;
  32655. };
  32656. // Checks if all configurations in {@code configs} are in a
  32657. // {@link RuleStopState}. Configurations meeting this condition have reached
  32658. // the end of the decision rule (local context) or end of start rule (full
  32659. // context).
  32660. //
  32661. // @param configs the configuration set to test
  32662. // @return {@code true} if all configurations in {@code configs} are in a
  32663. // {@link RuleStopState}, otherwise {@code false}
  32664. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  32665. for (var i = 0; i < configs.items.length; i++) {
  32666. var c = configs.items[i];
  32667. if (!(c.state instanceof RuleStopState)) {
  32668. return false;
  32669. }
  32670. }
  32671. return true;
  32672. };
  32673. //
  32674. // Full LL prediction termination.
  32675. //
  32676. // <p>Can we stop looking ahead during ATN simulation or is there some
  32677. // uncertainty as to which alternative we will ultimately pick, after
  32678. // consuming more input? Even if there are partial conflicts, we might know
  32679. // that everything is going to resolve to the same minimum alternative. That
  32680. // means we can stop since no more lookahead will change that fact. On the
  32681. // other hand, there might be multiple conflicts that resolve to different
  32682. // minimums. That means we need more look ahead to decide which of those
  32683. // alternatives we should predict.</p>
  32684. //
  32685. // <p>The basic idea is to split the set of configurations {@code C}, into
  32686. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  32687. // non-conflicting configurations. Two configurations conflict if they have
  32688. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  32689. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  32690. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  32691. //
  32692. // <p>Reduce these configuration subsets to the set of possible alternatives.
  32693. // You can compute the alternative subsets in one pass as follows:</p>
  32694. //
  32695. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  32696. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  32697. //
  32698. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  32699. //
  32700. // <pre>
  32701. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  32702. // alt and not pred
  32703. // </pre>
  32704. //
  32705. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  32706. //
  32707. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  32708. // {@code s} and {@code ctx}.</p>
  32709. //
  32710. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  32711. // the union of these alternative subsets is a singleton, then no amount of
  32712. // more lookahead will help us. We will always pick that alternative. If,
  32713. // however, there is more than one alternative, then we are uncertain which
  32714. // alternative to predict and must continue looking for resolution. We may
  32715. // or may not discover an ambiguity in the future, even if there are no
  32716. // conflicting subsets this round.</p>
  32717. //
  32718. // <p>The biggest sin is to terminate early because it means we've made a
  32719. // decision but were uncertain as to the eventual outcome. We haven't used
  32720. // enough lookahead. On the other hand, announcing a conflict too late is no
  32721. // big deal; you will still have the conflict. It's just inefficient. It
  32722. // might even look until the end of file.</p>
  32723. //
  32724. // <p>No special consideration for semantic predicates is required because
  32725. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  32726. // no configuration contains a semantic context during the termination
  32727. // check.</p>
  32728. //
  32729. // <p><strong>CONFLICTING CONFIGS</strong></p>
  32730. //
  32731. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  32732. // when {@code i!=j} but {@code x=x'}. Because we merge all
  32733. // {@code (s, i, _)} configurations together, that means that there are at
  32734. // most {@code n} configurations associated with state {@code s} for
  32735. // {@code n} possible alternatives in the decision. The merged stacks
  32736. // complicate the comparison of configuration contexts {@code x} and
  32737. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  32738. // merge and checking to see if the merged result is either {@code x} or
  32739. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  32740. // is the superset, then {@code i} is the only possible prediction since the
  32741. // others resolve to {@code min(i)} as well. However, if {@code x} is
  32742. // associated with {@code j>i} then at least one stack configuration for
  32743. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  32744. // should keep going, looking for more lookahead due to the uncertainty.</p>
  32745. //
  32746. // <p>For simplicity, I'm doing a equality check between {@code x} and
  32747. // {@code x'} that lets the algorithm continue to consume lookahead longer
  32748. // than necessary. The reason I like the equality is of course the
  32749. // simplicity but also because that is the test you need to detect the
  32750. // alternatives that are actually in conflict.</p>
  32751. //
  32752. // <p><strong>CONTINUE/STOP RULE</strong></p>
  32753. //
  32754. // <p>Continue if union of resolved alternative sets from non-conflicting and
  32755. // conflicting alternative subsets has more than one alternative. We are
  32756. // uncertain about which alternative to predict.</p>
  32757. //
  32758. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  32759. // alternatives are still in the running for the amount of input we've
  32760. // consumed at this point. The conflicting sets let us to strip away
  32761. // configurations that won't lead to more states because we resolve
  32762. // conflicts to the configuration with a minimum alternate for the
  32763. // conflicting set.</p>
  32764. //
  32765. // <p><strong>CASES</strong></p>
  32766. //
  32767. // <ul>
  32768. //
  32769. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  32770. //
  32771. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  32772. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  32773. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  32774. // {@code {1,3}} =&gt; continue
  32775. // </li>
  32776. //
  32777. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  32778. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  32779. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  32780. // {@code {1}} =&gt; stop and predict 1</li>
  32781. //
  32782. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  32783. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  32784. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  32785. // ambiguity {@code {1,2}}</li>
  32786. //
  32787. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  32788. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  32789. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  32790. //
  32791. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  32792. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  32793. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  32794. //
  32795. // </ul>
  32796. //
  32797. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  32798. //
  32799. // <p>If all states report the same conflicting set of alternatives, then we
  32800. // know we have the exact ambiguity set.</p>
  32801. //
  32802. // <p><code>|A_<em>i</em>|&gt;1</code> and
  32803. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  32804. //
  32805. // <p>In other words, we continue examining lookahead until all {@code A_i}
  32806. // have more than one alternative and all {@code A_i} are the same. If
  32807. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  32808. // because the resolved set is {@code {1}}. To determine what the real
  32809. // ambiguity is, we have to know whether the ambiguity is between one and
  32810. // two or one and three so we keep going. We can only stop prediction when
  32811. // we need exact ambiguity detection when the sets look like
  32812. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  32813. //
  32814. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  32815. return PredictionMode.getSingleViableAlt(altsets);
  32816. };
  32817. //
  32818. // Determines if every alternative subset in {@code altsets} contains more
  32819. // than one alternative.
  32820. //
  32821. // @param altsets a collection of alternative subsets
  32822. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  32823. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  32824. //
  32825. PredictionMode.allSubsetsConflict = function (altsets) {
  32826. return !PredictionMode.hasNonConflictingAltSet(altsets);
  32827. };
  32828. //
  32829. // Determines if any single alternative subset in {@code altsets} contains
  32830. // exactly one alternative.
  32831. //
  32832. // @param altsets a collection of alternative subsets
  32833. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  32834. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  32835. //
  32836. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  32837. for (var i = 0; i < altsets.length; i++) {
  32838. var alts = altsets[i];
  32839. if (alts.length === 1) {
  32840. return true;
  32841. }
  32842. }
  32843. return false;
  32844. };
  32845. //
  32846. // Determines if any single alternative subset in {@code altsets} contains
  32847. // more than one alternative.
  32848. //
  32849. // @param altsets a collection of alternative subsets
  32850. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  32851. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  32852. //
  32853. PredictionMode.hasConflictingAltSet = function (altsets) {
  32854. for (var i = 0; i < altsets.length; i++) {
  32855. var alts = altsets[i];
  32856. if (alts.length > 1) {
  32857. return true;
  32858. }
  32859. }
  32860. return false;
  32861. };
  32862. //
  32863. // Determines if every alternative subset in {@code altsets} is equivalent.
  32864. //
  32865. // @param altsets a collection of alternative subsets
  32866. // @return {@code true} if every member of {@code altsets} is equal to the
  32867. // others, otherwise {@code false}
  32868. //
  32869. PredictionMode.allSubsetsEqual = function (altsets) {
  32870. var first = null;
  32871. for (var i = 0; i < altsets.length; i++) {
  32872. var alts = altsets[i];
  32873. if (first === null) {
  32874. first = alts;
  32875. } else if (alts !== first) {
  32876. return false;
  32877. }
  32878. }
  32879. return true;
  32880. };
  32881. //
  32882. // Returns the unique alternative predicted by all alternative subsets in
  32883. // {@code altsets}. If no such alternative exists, this method returns
  32884. // {@link ATN//INVALID_ALT_NUMBER}.
  32885. //
  32886. // @param altsets a collection of alternative subsets
  32887. //
  32888. PredictionMode.getUniqueAlt = function (altsets) {
  32889. var all = PredictionMode.getAlts(altsets);
  32890. if (all.length === 1) {
  32891. return all.minValue();
  32892. } else {
  32893. return ATN.INVALID_ALT_NUMBER;
  32894. }
  32895. };
  32896. // Gets the complete set of represented alternatives for a collection of
  32897. // alternative subsets. This method returns the union of each {@link BitSet}
  32898. // in {@code altsets}.
  32899. //
  32900. // @param altsets a collection of alternative subsets
  32901. // @return the set of represented alternatives in {@code altsets}
  32902. //
  32903. PredictionMode.getAlts = function (altsets) {
  32904. var all = new BitSet();
  32905. altsets.map(function (alts) {
  32906. all.or(alts);
  32907. });
  32908. return all;
  32909. };
  32910. //
  32911. // This function gets the conflicting alt subsets from a configuration set.
  32912. // For each configuration {@code c} in {@code configs}:
  32913. //
  32914. // <pre>
  32915. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  32916. // alt and not pred
  32917. // </pre>
  32918. PredictionMode.getConflictingAltSubsets = function (configs) {
  32919. var configToAlts = new Map();
  32920. configToAlts.hashFunction = function (cfg) {
  32921. hashStuff(cfg.state.stateNumber, cfg.context);
  32922. };
  32923. configToAlts.equalsFunction = function (c1, c2) {
  32924. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  32925. };
  32926. configs.items.map(function (cfg) {
  32927. var alts = configToAlts.get(cfg);
  32928. if (alts === null) {
  32929. alts = new BitSet();
  32930. configToAlts.put(cfg, alts);
  32931. }
  32932. alts.add(cfg.alt);
  32933. });
  32934. return configToAlts.getValues();
  32935. };
  32936. //
  32937. // Get a map from state to alt subset from a configuration set. For each
  32938. // configuration {@code c} in {@code configs}:
  32939. //
  32940. // <pre>
  32941. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  32942. // </pre>
  32943. //
  32944. PredictionMode.getStateToAltMap = function (configs) {
  32945. var m = new AltDict();
  32946. configs.items.map(function (c) {
  32947. var alts = m.get(c.state);
  32948. if (alts === null) {
  32949. alts = new BitSet();
  32950. m.put(c.state, alts);
  32951. }
  32952. alts.add(c.alt);
  32953. });
  32954. return m;
  32955. };
  32956. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  32957. var values = PredictionMode.getStateToAltMap(configs).values();
  32958. for (var i = 0; i < values.length; i++) {
  32959. if (values[i].length === 1) {
  32960. return true;
  32961. }
  32962. }
  32963. return false;
  32964. };
  32965. PredictionMode.getSingleViableAlt = function (altsets) {
  32966. var result = null;
  32967. for (var i = 0; i < altsets.length; i++) {
  32968. var alts = altsets[i];
  32969. var minAlt = alts.minValue();
  32970. if (result === null) {
  32971. result = minAlt;
  32972. } else if (result !== minAlt) {
  32973. // more than 1 viable alt
  32974. return ATN.INVALID_ALT_NUMBER;
  32975. }
  32976. }
  32977. return result;
  32978. };
  32979. exports.PredictionMode = PredictionMode;
  32980. /***/ }),
  32981. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  32982. /*!****************************************************!*\
  32983. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  32984. \****************************************************/
  32985. /*! no static exports found */
  32986. /***/ (function(module, exports, __webpack_require__) {
  32987. "use strict";
  32988. //
  32989. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32990. * Use of this file is governed by the BSD 3-clause license that
  32991. * can be found in the LICENSE.txt file in the project root.
  32992. */
  32993. //
  32994. // A tree structure used to record the semantic context in which
  32995. // an ATN configuration is valid. It's either a single predicate,
  32996. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  32997. //
  32998. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  32999. // {@link SemanticContext} within the scope of this outer class.</p>
  33000. //
  33001. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  33002. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  33003. function SemanticContext() {
  33004. return this;
  33005. }
  33006. SemanticContext.prototype.hashCode = function () {
  33007. var hash = new Hash();
  33008. this.updateHashCode(hash);
  33009. return hash.finish();
  33010. };
  33011. // For context independent predicates, we evaluate them without a local
  33012. // context (i.e., null context). That way, we can evaluate them without
  33013. // having to create proper rule-specific context during prediction (as
  33014. // opposed to the parser, which creates them naturally). In a practical
  33015. // sense, this avoids a cast exception from RuleContext to myruleContext.
  33016. //
  33017. // <p>For context dependent predicates, we must pass in a local context so that
  33018. // references such as $arg evaluate properly as _localctx.arg. We only
  33019. // capture context dependent predicates in the context in which we begin
  33020. // prediction, so we passed in the outer context here in case of context
  33021. // dependent predicate evaluation.</p>
  33022. //
  33023. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  33024. //
  33025. // Evaluate the precedence predicates for the context and reduce the result.
  33026. //
  33027. // @param parser The parser instance.
  33028. // @param outerContext The current parser context object.
  33029. // @return The simplified semantic context after precedence predicates are
  33030. // evaluated, which will be one of the following values.
  33031. // <ul>
  33032. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  33033. // precedence predicates are evaluated.</li>
  33034. // <li>{@code null}: if the predicate simplifies to {@code false} after
  33035. // precedence predicates are evaluated.</li>
  33036. // <li>{@code this}: if the semantic context is not changed as a result of
  33037. // precedence predicate evaluation.</li>
  33038. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  33039. // semantic context after precedence predicates are evaluated.</li>
  33040. // </ul>
  33041. //
  33042. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  33043. return this;
  33044. };
  33045. SemanticContext.andContext = function (a, b) {
  33046. if (a === null || a === SemanticContext.NONE) {
  33047. return b;
  33048. }
  33049. if (b === null || b === SemanticContext.NONE) {
  33050. return a;
  33051. }
  33052. var result = new AND(a, b);
  33053. if (result.opnds.length === 1) {
  33054. return result.opnds[0];
  33055. } else {
  33056. return result;
  33057. }
  33058. };
  33059. SemanticContext.orContext = function (a, b) {
  33060. if (a === null) {
  33061. return b;
  33062. }
  33063. if (b === null) {
  33064. return a;
  33065. }
  33066. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  33067. return SemanticContext.NONE;
  33068. }
  33069. var result = new OR(a, b);
  33070. if (result.opnds.length === 1) {
  33071. return result.opnds[0];
  33072. } else {
  33073. return result;
  33074. }
  33075. };
  33076. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  33077. SemanticContext.call(this);
  33078. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  33079. this.predIndex = predIndex === undefined ? -1 : predIndex;
  33080. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  33081. return this;
  33082. }
  33083. Predicate.prototype = Object.create(SemanticContext.prototype);
  33084. Predicate.prototype.constructor = Predicate;
  33085. //The default {@link SemanticContext}, which is semantically equivalent to
  33086. //a predicate of the form {@code {true}?}.
  33087. //
  33088. SemanticContext.NONE = new Predicate();
  33089. Predicate.prototype.evaluate = function (parser, outerContext) {
  33090. var localctx = this.isCtxDependent ? outerContext : null;
  33091. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  33092. };
  33093. Predicate.prototype.updateHashCode = function (hash) {
  33094. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  33095. };
  33096. Predicate.prototype.equals = function (other) {
  33097. if (this === other) {
  33098. return true;
  33099. } else if (!(other instanceof Predicate)) {
  33100. return false;
  33101. } else {
  33102. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  33103. }
  33104. };
  33105. Predicate.prototype.toString = function () {
  33106. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  33107. };
  33108. function PrecedencePredicate(precedence) {
  33109. SemanticContext.call(this);
  33110. this.precedence = precedence === undefined ? 0 : precedence;
  33111. }
  33112. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  33113. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  33114. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  33115. return parser.precpred(outerContext, this.precedence);
  33116. };
  33117. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  33118. if (parser.precpred(outerContext, this.precedence)) {
  33119. return SemanticContext.NONE;
  33120. } else {
  33121. return null;
  33122. }
  33123. };
  33124. PrecedencePredicate.prototype.compareTo = function (other) {
  33125. return this.precedence - other.precedence;
  33126. };
  33127. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  33128. hash.update(31);
  33129. };
  33130. PrecedencePredicate.prototype.equals = function (other) {
  33131. if (this === other) {
  33132. return true;
  33133. } else if (!(other instanceof PrecedencePredicate)) {
  33134. return false;
  33135. } else {
  33136. return this.precedence === other.precedence;
  33137. }
  33138. };
  33139. PrecedencePredicate.prototype.toString = function () {
  33140. return "{" + this.precedence + ">=prec}?";
  33141. };
  33142. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  33143. var result = [];
  33144. set.values().map(function (context) {
  33145. if (context instanceof PrecedencePredicate) {
  33146. result.push(context);
  33147. }
  33148. });
  33149. return result;
  33150. };
  33151. // A semantic context which is true whenever none of the contained contexts
  33152. // is false.
  33153. //
  33154. function AND(a, b) {
  33155. SemanticContext.call(this);
  33156. var operands = new Set();
  33157. if (a instanceof AND) {
  33158. a.opnds.map(function (o) {
  33159. operands.add(o);
  33160. });
  33161. } else {
  33162. operands.add(a);
  33163. }
  33164. if (b instanceof AND) {
  33165. b.opnds.map(function (o) {
  33166. operands.add(o);
  33167. });
  33168. } else {
  33169. operands.add(b);
  33170. }
  33171. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  33172. if (precedencePredicates.length > 0) {
  33173. // interested in the transition with the lowest precedence
  33174. var reduced = null;
  33175. precedencePredicates.map(function (p) {
  33176. if (reduced === null || p.precedence < reduced.precedence) {
  33177. reduced = p;
  33178. }
  33179. });
  33180. operands.add(reduced);
  33181. }
  33182. this.opnds = operands.values();
  33183. return this;
  33184. }
  33185. AND.prototype = Object.create(SemanticContext.prototype);
  33186. AND.prototype.constructor = AND;
  33187. AND.prototype.equals = function (other) {
  33188. if (this === other) {
  33189. return true;
  33190. } else if (!(other instanceof AND)) {
  33191. return false;
  33192. } else {
  33193. return this.opnds === other.opnds;
  33194. }
  33195. };
  33196. AND.prototype.updateHashCode = function (hash) {
  33197. hash.update(this.opnds, "AND");
  33198. };
  33199. //
  33200. // {@inheritDoc}
  33201. //
  33202. // <p>
  33203. // The evaluation of predicates by this context is short-circuiting, but
  33204. // unordered.</p>
  33205. //
  33206. AND.prototype.evaluate = function (parser, outerContext) {
  33207. for (var i = 0; i < this.opnds.length; i++) {
  33208. if (!this.opnds[i].evaluate(parser, outerContext)) {
  33209. return false;
  33210. }
  33211. }
  33212. return true;
  33213. };
  33214. AND.prototype.evalPrecedence = function (parser, outerContext) {
  33215. var differs = false;
  33216. var operands = [];
  33217. for (var i = 0; i < this.opnds.length; i++) {
  33218. var context = this.opnds[i];
  33219. var evaluated = context.evalPrecedence(parser, outerContext);
  33220. differs |= evaluated !== context;
  33221. if (evaluated === null) {
  33222. // The AND context is false if any element is false
  33223. return null;
  33224. } else if (evaluated !== SemanticContext.NONE) {
  33225. // Reduce the result by skipping true elements
  33226. operands.push(evaluated);
  33227. }
  33228. }
  33229. if (!differs) {
  33230. return this;
  33231. }
  33232. if (operands.length === 0) {
  33233. // all elements were true, so the AND context is true
  33234. return SemanticContext.NONE;
  33235. }
  33236. var result = null;
  33237. operands.map(function (o) {
  33238. result = result === null ? o : SemanticContext.andContext(result, o);
  33239. });
  33240. return result;
  33241. };
  33242. AND.prototype.toString = function () {
  33243. var s = "";
  33244. this.opnds.map(function (o) {
  33245. s += "&& " + o.toString();
  33246. });
  33247. return s.length > 3 ? s.slice(3) : s;
  33248. };
  33249. //
  33250. // A semantic context which is true whenever at least one of the contained
  33251. // contexts is true.
  33252. //
  33253. function OR(a, b) {
  33254. SemanticContext.call(this);
  33255. var operands = new Set();
  33256. if (a instanceof OR) {
  33257. a.opnds.map(function (o) {
  33258. operands.add(o);
  33259. });
  33260. } else {
  33261. operands.add(a);
  33262. }
  33263. if (b instanceof OR) {
  33264. b.opnds.map(function (o) {
  33265. operands.add(o);
  33266. });
  33267. } else {
  33268. operands.add(b);
  33269. }
  33270. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  33271. if (precedencePredicates.length > 0) {
  33272. // interested in the transition with the highest precedence
  33273. var s = precedencePredicates.sort(function (a, b) {
  33274. return a.compareTo(b);
  33275. });
  33276. var reduced = s[s.length - 1];
  33277. operands.add(reduced);
  33278. }
  33279. this.opnds = operands.values();
  33280. return this;
  33281. }
  33282. OR.prototype = Object.create(SemanticContext.prototype);
  33283. OR.prototype.constructor = OR;
  33284. OR.prototype.constructor = function (other) {
  33285. if (this === other) {
  33286. return true;
  33287. } else if (!(other instanceof OR)) {
  33288. return false;
  33289. } else {
  33290. return this.opnds === other.opnds;
  33291. }
  33292. };
  33293. OR.prototype.updateHashCode = function (hash) {
  33294. hash.update(this.opnds, "OR");
  33295. };
  33296. // <p>
  33297. // The evaluation of predicates by this context is short-circuiting, but
  33298. // unordered.</p>
  33299. //
  33300. OR.prototype.evaluate = function (parser, outerContext) {
  33301. for (var i = 0; i < this.opnds.length; i++) {
  33302. if (this.opnds[i].evaluate(parser, outerContext)) {
  33303. return true;
  33304. }
  33305. }
  33306. return false;
  33307. };
  33308. OR.prototype.evalPrecedence = function (parser, outerContext) {
  33309. var differs = false;
  33310. var operands = [];
  33311. for (var i = 0; i < this.opnds.length; i++) {
  33312. var context = this.opnds[i];
  33313. var evaluated = context.evalPrecedence(parser, outerContext);
  33314. differs |= evaluated !== context;
  33315. if (evaluated === SemanticContext.NONE) {
  33316. // The OR context is true if any element is true
  33317. return SemanticContext.NONE;
  33318. } else if (evaluated !== null) {
  33319. // Reduce the result by skipping false elements
  33320. operands.push(evaluated);
  33321. }
  33322. }
  33323. if (!differs) {
  33324. return this;
  33325. }
  33326. if (operands.length === 0) {
  33327. // all elements were false, so the OR context is false
  33328. return null;
  33329. }
  33330. var result = null;
  33331. operands.map(function (o) {
  33332. return result === null ? o : SemanticContext.orContext(result, o);
  33333. });
  33334. return result;
  33335. };
  33336. OR.prototype.toString = function () {
  33337. var s = "";
  33338. this.opnds.map(function (o) {
  33339. s += "|| " + o.toString();
  33340. });
  33341. return s.length > 3 ? s.slice(3) : s;
  33342. };
  33343. exports.SemanticContext = SemanticContext;
  33344. exports.PrecedencePredicate = PrecedencePredicate;
  33345. exports.Predicate = Predicate;
  33346. /***/ }),
  33347. /***/ "./node_modules/antlr4/atn/Transition.js":
  33348. /*!***********************************************!*\
  33349. !*** ./node_modules/antlr4/atn/Transition.js ***!
  33350. \***********************************************/
  33351. /*! no static exports found */
  33352. /***/ (function(module, exports, __webpack_require__) {
  33353. "use strict";
  33354. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33355. * Use of this file is governed by the BSD 3-clause license that
  33356. * can be found in the LICENSE.txt file in the project root.
  33357. */
  33358. //
  33359. // An ATN transition between any two ATN states. Subclasses define
  33360. // atom, set, epsilon, action, predicate, rule transitions.
  33361. //
  33362. // <p>This is a one way link. It emanates from a state (usually via a list of
  33363. // transitions) and has a target state.</p>
  33364. //
  33365. // <p>Since we never have to change the ATN transitions once we construct it,
  33366. // we can fix these transitions as specific classes. The DFA transitions
  33367. // on the other hand need to update the labels as it adds transitions to
  33368. // the states. We'll use the term Edge for the DFA to distinguish them from
  33369. // ATN transitions.</p>
  33370. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  33371. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  33372. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  33373. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  33374. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  33375. function Transition(target) {
  33376. // The target of this transition.
  33377. if (target === undefined || target === null) {
  33378. throw "target cannot be null.";
  33379. }
  33380. this.target = target;
  33381. // Are we epsilon, action, sempred?
  33382. this.isEpsilon = false;
  33383. this.label = null;
  33384. return this;
  33385. }
  33386. // constants for serialization
  33387. Transition.EPSILON = 1;
  33388. Transition.RANGE = 2;
  33389. Transition.RULE = 3;
  33390. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  33391. Transition.ATOM = 5;
  33392. Transition.ACTION = 6;
  33393. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  33394. Transition.NOT_SET = 8;
  33395. Transition.WILDCARD = 9;
  33396. Transition.PRECEDENCE = 10;
  33397. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  33398. Transition.serializationTypes = {
  33399. EpsilonTransition: Transition.EPSILON,
  33400. RangeTransition: Transition.RANGE,
  33401. RuleTransition: Transition.RULE,
  33402. PredicateTransition: Transition.PREDICATE,
  33403. AtomTransition: Transition.ATOM,
  33404. ActionTransition: Transition.ACTION,
  33405. SetTransition: Transition.SET,
  33406. NotSetTransition: Transition.NOT_SET,
  33407. WildcardTransition: Transition.WILDCARD,
  33408. PrecedencePredicateTransition: Transition.PRECEDENCE
  33409. };
  33410. // TODO: make all transitions sets? no, should remove set edges
  33411. function AtomTransition(target, label) {
  33412. Transition.call(this, target);
  33413. this.label_ = label; // The token type or character value; or, signifies special label.
  33414. this.label = this.makeLabel();
  33415. this.serializationType = Transition.ATOM;
  33416. return this;
  33417. }
  33418. AtomTransition.prototype = Object.create(Transition.prototype);
  33419. AtomTransition.prototype.constructor = AtomTransition;
  33420. AtomTransition.prototype.makeLabel = function () {
  33421. var s = new IntervalSet();
  33422. s.addOne(this.label_);
  33423. return s;
  33424. };
  33425. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  33426. return this.label_ === symbol;
  33427. };
  33428. AtomTransition.prototype.toString = function () {
  33429. return this.label_;
  33430. };
  33431. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  33432. Transition.call(this, ruleStart);
  33433. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  33434. this.precedence = precedence;
  33435. this.followState = followState; // what node to begin computations following ref to rule
  33436. this.serializationType = Transition.RULE;
  33437. this.isEpsilon = true;
  33438. return this;
  33439. }
  33440. RuleTransition.prototype = Object.create(Transition.prototype);
  33441. RuleTransition.prototype.constructor = RuleTransition;
  33442. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  33443. return false;
  33444. };
  33445. function EpsilonTransition(target, outermostPrecedenceReturn) {
  33446. Transition.call(this, target);
  33447. this.serializationType = Transition.EPSILON;
  33448. this.isEpsilon = true;
  33449. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  33450. return this;
  33451. }
  33452. EpsilonTransition.prototype = Object.create(Transition.prototype);
  33453. EpsilonTransition.prototype.constructor = EpsilonTransition;
  33454. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  33455. return false;
  33456. };
  33457. EpsilonTransition.prototype.toString = function () {
  33458. return "epsilon";
  33459. };
  33460. function RangeTransition(target, start, stop) {
  33461. Transition.call(this, target);
  33462. this.serializationType = Transition.RANGE;
  33463. this.start = start;
  33464. this.stop = stop;
  33465. this.label = this.makeLabel();
  33466. return this;
  33467. }
  33468. RangeTransition.prototype = Object.create(Transition.prototype);
  33469. RangeTransition.prototype.constructor = RangeTransition;
  33470. RangeTransition.prototype.makeLabel = function () {
  33471. var s = new IntervalSet();
  33472. s.addRange(this.start, this.stop);
  33473. return s;
  33474. };
  33475. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  33476. return symbol >= this.start && symbol <= this.stop;
  33477. };
  33478. RangeTransition.prototype.toString = function () {
  33479. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  33480. };
  33481. function AbstractPredicateTransition(target) {
  33482. Transition.call(this, target);
  33483. return this;
  33484. }
  33485. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  33486. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  33487. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  33488. AbstractPredicateTransition.call(this, target);
  33489. this.serializationType = Transition.PREDICATE;
  33490. this.ruleIndex = ruleIndex;
  33491. this.predIndex = predIndex;
  33492. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  33493. this.isEpsilon = true;
  33494. return this;
  33495. }
  33496. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  33497. PredicateTransition.prototype.constructor = PredicateTransition;
  33498. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  33499. return false;
  33500. };
  33501. PredicateTransition.prototype.getPredicate = function () {
  33502. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  33503. };
  33504. PredicateTransition.prototype.toString = function () {
  33505. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  33506. };
  33507. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  33508. Transition.call(this, target);
  33509. this.serializationType = Transition.ACTION;
  33510. this.ruleIndex = ruleIndex;
  33511. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  33512. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  33513. this.isEpsilon = true;
  33514. return this;
  33515. }
  33516. ActionTransition.prototype = Object.create(Transition.prototype);
  33517. ActionTransition.prototype.constructor = ActionTransition;
  33518. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  33519. return false;
  33520. };
  33521. ActionTransition.prototype.toString = function () {
  33522. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  33523. };
  33524. // A transition containing a set of values.
  33525. function SetTransition(target, set) {
  33526. Transition.call(this, target);
  33527. this.serializationType = Transition.SET;
  33528. if (set !== undefined && set !== null) {
  33529. this.label = set;
  33530. } else {
  33531. this.label = new IntervalSet();
  33532. this.label.addOne(Token.INVALID_TYPE);
  33533. }
  33534. return this;
  33535. }
  33536. SetTransition.prototype = Object.create(Transition.prototype);
  33537. SetTransition.prototype.constructor = SetTransition;
  33538. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  33539. return this.label.contains(symbol);
  33540. };
  33541. SetTransition.prototype.toString = function () {
  33542. return this.label.toString();
  33543. };
  33544. function NotSetTransition(target, set) {
  33545. SetTransition.call(this, target, set);
  33546. this.serializationType = Transition.NOT_SET;
  33547. return this;
  33548. }
  33549. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  33550. NotSetTransition.prototype.constructor = NotSetTransition;
  33551. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  33552. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  33553. };
  33554. NotSetTransition.prototype.toString = function () {
  33555. return '~' + SetTransition.prototype.toString.call(this);
  33556. };
  33557. function WildcardTransition(target) {
  33558. Transition.call(this, target);
  33559. this.serializationType = Transition.WILDCARD;
  33560. return this;
  33561. }
  33562. WildcardTransition.prototype = Object.create(Transition.prototype);
  33563. WildcardTransition.prototype.constructor = WildcardTransition;
  33564. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  33565. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  33566. };
  33567. WildcardTransition.prototype.toString = function () {
  33568. return ".";
  33569. };
  33570. function PrecedencePredicateTransition(target, precedence) {
  33571. AbstractPredicateTransition.call(this, target);
  33572. this.serializationType = Transition.PRECEDENCE;
  33573. this.precedence = precedence;
  33574. this.isEpsilon = true;
  33575. return this;
  33576. }
  33577. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  33578. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  33579. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  33580. return false;
  33581. };
  33582. PrecedencePredicateTransition.prototype.getPredicate = function () {
  33583. return new PrecedencePredicate(this.precedence);
  33584. };
  33585. PrecedencePredicateTransition.prototype.toString = function () {
  33586. return this.precedence + " >= _p";
  33587. };
  33588. exports.Transition = Transition;
  33589. exports.AtomTransition = AtomTransition;
  33590. exports.SetTransition = SetTransition;
  33591. exports.NotSetTransition = NotSetTransition;
  33592. exports.RuleTransition = RuleTransition;
  33593. exports.ActionTransition = ActionTransition;
  33594. exports.EpsilonTransition = EpsilonTransition;
  33595. exports.RangeTransition = RangeTransition;
  33596. exports.WildcardTransition = WildcardTransition;
  33597. exports.PredicateTransition = PredicateTransition;
  33598. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  33599. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  33600. /***/ }),
  33601. /***/ "./node_modules/antlr4/atn/index.js":
  33602. /*!******************************************!*\
  33603. !*** ./node_modules/antlr4/atn/index.js ***!
  33604. \******************************************/
  33605. /*! no static exports found */
  33606. /***/ (function(module, exports, __webpack_require__) {
  33607. "use strict";
  33608. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33609. * Use of this file is governed by the BSD 3-clause license that
  33610. * can be found in the LICENSE.txt file in the project root.
  33611. */
  33612. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  33613. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  33614. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  33615. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  33616. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  33617. /***/ }),
  33618. /***/ "./node_modules/antlr4/dfa/DFA.js":
  33619. /*!****************************************!*\
  33620. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  33621. \****************************************/
  33622. /*! no static exports found */
  33623. /***/ (function(module, exports, __webpack_require__) {
  33624. "use strict";
  33625. //
  33626. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33627. * Use of this file is governed by the BSD 3-clause license that
  33628. * can be found in the LICENSE.txt file in the project root.
  33629. */
  33630. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  33631. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  33632. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  33633. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  33634. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  33635. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  33636. function DFA(atnStartState, decision) {
  33637. if (decision === undefined) {
  33638. decision = 0;
  33639. }
  33640. // From which ATN state did we create this DFA?
  33641. this.atnStartState = atnStartState;
  33642. this.decision = decision;
  33643. // A set of all DFA states. Use {@link Map} so we can get old state back
  33644. // ({@link Set} only allows you to see if it's there).
  33645. this._states = new Set();
  33646. this.s0 = null;
  33647. // {@code true} if this DFA is for a precedence decision; otherwise,
  33648. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  33649. // {@link //setPrecedenceDfa}.
  33650. this.precedenceDfa = false;
  33651. if (atnStartState instanceof StarLoopEntryState) {
  33652. if (atnStartState.isPrecedenceDecision) {
  33653. this.precedenceDfa = true;
  33654. var precedenceState = new DFAState(null, new ATNConfigSet());
  33655. precedenceState.edges = [];
  33656. precedenceState.isAcceptState = false;
  33657. precedenceState.requiresFullContext = false;
  33658. this.s0 = precedenceState;
  33659. }
  33660. }
  33661. return this;
  33662. }
  33663. // Get the start state for a specific precedence value.
  33664. //
  33665. // @param precedence The current precedence.
  33666. // @return The start state corresponding to the specified precedence, or
  33667. // {@code null} if no start state exists for the specified precedence.
  33668. //
  33669. // @throws IllegalStateException if this is not a precedence DFA.
  33670. // @see //isPrecedenceDfa()
  33671. DFA.prototype.getPrecedenceStartState = function (precedence) {
  33672. if (!this.precedenceDfa) {
  33673. throw "Only precedence DFAs may contain a precedence start state.";
  33674. }
  33675. // s0.edges is never null for a precedence DFA
  33676. if (precedence < 0 || precedence >= this.s0.edges.length) {
  33677. return null;
  33678. }
  33679. return this.s0.edges[precedence] || null;
  33680. };
  33681. // Set the start state for a specific precedence value.
  33682. //
  33683. // @param precedence The current precedence.
  33684. // @param startState The start state corresponding to the specified
  33685. // precedence.
  33686. //
  33687. // @throws IllegalStateException if this is not a precedence DFA.
  33688. // @see //isPrecedenceDfa()
  33689. //
  33690. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  33691. if (!this.precedenceDfa) {
  33692. throw "Only precedence DFAs may contain a precedence start state.";
  33693. }
  33694. if (precedence < 0) {
  33695. return;
  33696. }
  33697. // synchronization on s0 here is ok. when the DFA is turned into a
  33698. // precedence DFA, s0 will be initialized once and not updated again
  33699. // s0.edges is never null for a precedence DFA
  33700. this.s0.edges[precedence] = startState;
  33701. };
  33702. //
  33703. // Sets whether this is a precedence DFA. If the specified value differs
  33704. // from the current DFA configuration, the following actions are taken;
  33705. // otherwise no changes are made to the current DFA.
  33706. //
  33707. // <ul>
  33708. // <li>The {@link //states} map is cleared</li>
  33709. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  33710. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  33711. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  33712. // store the start states for individual precedence values.</li>
  33713. // <li>The {@link //precedenceDfa} field is updated</li>
  33714. // </ul>
  33715. //
  33716. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  33717. // {@code false}
  33718. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  33719. if (this.precedenceDfa !== precedenceDfa) {
  33720. this._states = new DFAStatesSet();
  33721. if (precedenceDfa) {
  33722. var precedenceState = new DFAState(null, new ATNConfigSet());
  33723. precedenceState.edges = [];
  33724. precedenceState.isAcceptState = false;
  33725. precedenceState.requiresFullContext = false;
  33726. this.s0 = precedenceState;
  33727. } else {
  33728. this.s0 = null;
  33729. }
  33730. this.precedenceDfa = precedenceDfa;
  33731. }
  33732. };
  33733. Object.defineProperty(DFA.prototype, "states", {
  33734. get: function get() {
  33735. return this._states;
  33736. }
  33737. });
  33738. // Return a list of all states in this DFA, ordered by state number.
  33739. DFA.prototype.sortedStates = function () {
  33740. var list = this._states.values();
  33741. return list.sort(function (a, b) {
  33742. return a.stateNumber - b.stateNumber;
  33743. });
  33744. };
  33745. DFA.prototype.toString = function (literalNames, symbolicNames) {
  33746. literalNames = literalNames || null;
  33747. symbolicNames = symbolicNames || null;
  33748. if (this.s0 === null) {
  33749. return "";
  33750. }
  33751. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  33752. return serializer.toString();
  33753. };
  33754. DFA.prototype.toLexerString = function () {
  33755. if (this.s0 === null) {
  33756. return "";
  33757. }
  33758. var serializer = new LexerDFASerializer(this);
  33759. return serializer.toString();
  33760. };
  33761. exports.DFA = DFA;
  33762. /***/ }),
  33763. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  33764. /*!**************************************************!*\
  33765. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  33766. \**************************************************/
  33767. /*! no static exports found */
  33768. /***/ (function(module, exports, __webpack_require__) {
  33769. "use strict";
  33770. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33771. * Use of this file is governed by the BSD 3-clause license that
  33772. * can be found in the LICENSE.txt file in the project root.
  33773. */
  33774. // A DFA walker that knows how to dump them to serialized strings.#/
  33775. function DFASerializer(dfa, literalNames, symbolicNames) {
  33776. this.dfa = dfa;
  33777. this.literalNames = literalNames || [];
  33778. this.symbolicNames = symbolicNames || [];
  33779. return this;
  33780. }
  33781. DFASerializer.prototype.toString = function () {
  33782. if (this.dfa.s0 === null) {
  33783. return null;
  33784. }
  33785. var buf = "";
  33786. var states = this.dfa.sortedStates();
  33787. for (var i = 0; i < states.length; i++) {
  33788. var s = states[i];
  33789. if (s.edges !== null) {
  33790. var n = s.edges.length;
  33791. for (var j = 0; j < n; j++) {
  33792. var t = s.edges[j] || null;
  33793. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  33794. buf = buf.concat(this.getStateString(s));
  33795. buf = buf.concat("-");
  33796. buf = buf.concat(this.getEdgeLabel(j));
  33797. buf = buf.concat("->");
  33798. buf = buf.concat(this.getStateString(t));
  33799. buf = buf.concat('\n');
  33800. }
  33801. }
  33802. }
  33803. }
  33804. return buf.length === 0 ? null : buf;
  33805. };
  33806. DFASerializer.prototype.getEdgeLabel = function (i) {
  33807. if (i === 0) {
  33808. return "EOF";
  33809. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  33810. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  33811. } else {
  33812. return String.fromCharCode(i - 1);
  33813. }
  33814. };
  33815. DFASerializer.prototype.getStateString = function (s) {
  33816. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  33817. if (s.isAcceptState) {
  33818. if (s.predicates !== null) {
  33819. return baseStateStr + "=>" + s.predicates.toString();
  33820. } else {
  33821. return baseStateStr + "=>" + s.prediction.toString();
  33822. }
  33823. } else {
  33824. return baseStateStr;
  33825. }
  33826. };
  33827. function LexerDFASerializer(dfa) {
  33828. DFASerializer.call(this, dfa, null);
  33829. return this;
  33830. }
  33831. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  33832. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  33833. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  33834. return "'" + String.fromCharCode(i) + "'";
  33835. };
  33836. exports.DFASerializer = DFASerializer;
  33837. exports.LexerDFASerializer = LexerDFASerializer;
  33838. /***/ }),
  33839. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  33840. /*!*********************************************!*\
  33841. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  33842. \*********************************************/
  33843. /*! no static exports found */
  33844. /***/ (function(module, exports, __webpack_require__) {
  33845. "use strict";
  33846. //
  33847. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33848. * Use of this file is governed by the BSD 3-clause license that
  33849. * can be found in the LICENSE.txt file in the project root.
  33850. */
  33851. ///
  33852. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  33853. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  33854. var Hash = Utils.Hash;
  33855. var Set = Utils.Set;
  33856. // Map a predicate to a predicted alternative.///
  33857. function PredPrediction(pred, alt) {
  33858. this.alt = alt;
  33859. this.pred = pred;
  33860. return this;
  33861. }
  33862. PredPrediction.prototype.toString = function () {
  33863. return "(" + this.pred + ", " + this.alt + ")";
  33864. };
  33865. // A DFA state represents a set of possible ATN configurations.
  33866. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  33867. // to keep track of all possible states the ATN can be in after
  33868. // reading each input symbol. That is to say, after reading
  33869. // input a1a2..an, the DFA is in a state that represents the
  33870. // subset T of the states of the ATN that are reachable from the
  33871. // ATN's start state along some path labeled a1a2..an."
  33872. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  33873. // would be a bitset representing the set of states the
  33874. // ATN could be in. We need to track the alt predicted by each
  33875. // state as well, however. More importantly, we need to maintain
  33876. // a stack of states, tracking the closure operations as they
  33877. // jump from rule to rule, emulating rule invocations (method calls).
  33878. // I have to add a stack to simulate the proper lookahead sequences for
  33879. // the underlying LL grammar from which the ATN was derived.
  33880. //
  33881. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  33882. // is both a state (ala normal conversion) and a RuleContext describing
  33883. // the chain of rules (if any) followed to arrive at that state.</p>
  33884. //
  33885. // <p>A DFA state may have multiple references to a particular state,
  33886. // but with different ATN contexts (with same or different alts)
  33887. // meaning that state was reached via a different set of rule invocations.</p>
  33888. // /
  33889. function DFAState(stateNumber, configs) {
  33890. if (stateNumber === null) {
  33891. stateNumber = -1;
  33892. }
  33893. if (configs === null) {
  33894. configs = new ATNConfigSet();
  33895. }
  33896. this.stateNumber = stateNumber;
  33897. this.configs = configs;
  33898. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  33899. // {@link Token//EOF} maps to {@code edges[0]}.
  33900. this.edges = null;
  33901. this.isAcceptState = false;
  33902. // if accept state, what ttype do we match or alt do we predict?
  33903. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  33904. // //predicates}{@code !=null} or
  33905. // {@link //requiresFullContext}.
  33906. this.prediction = 0;
  33907. this.lexerActionExecutor = null;
  33908. // Indicates that this state was created during SLL prediction that
  33909. // discovered a conflict between the configurations in the state. Future
  33910. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  33911. // full context prediction if this field is true.
  33912. this.requiresFullContext = false;
  33913. // During SLL parsing, this is a list of predicates associated with the
  33914. // ATN configurations of the DFA state. When we have predicates,
  33915. // {@link //requiresFullContext} is {@code false} since full context
  33916. // prediction evaluates predicates
  33917. // on-the-fly. If this is not null, then {@link //prediction} is
  33918. // {@link ATN//INVALID_ALT_NUMBER}.
  33919. //
  33920. // <p>We only use these for non-{@link //requiresFullContext} but
  33921. // conflicting states. That
  33922. // means we know from the context (it's $ or we don't dip into outer
  33923. // context) that it's an ambiguity not a conflict.</p>
  33924. //
  33925. // <p>This list is computed by {@link
  33926. // ParserATNSimulator//predicateDFAState}.</p>
  33927. this.predicates = null;
  33928. return this;
  33929. }
  33930. // Get the set of all alts mentioned by all ATN configurations in this
  33931. // DFA state.
  33932. DFAState.prototype.getAltSet = function () {
  33933. var alts = new Set();
  33934. if (this.configs !== null) {
  33935. for (var i = 0; i < this.configs.length; i++) {
  33936. var c = this.configs[i];
  33937. alts.add(c.alt);
  33938. }
  33939. }
  33940. if (alts.length === 0) {
  33941. return null;
  33942. } else {
  33943. return alts;
  33944. }
  33945. };
  33946. // Two {@link DFAState} instances are equal if their ATN configuration sets
  33947. // are the same. This method is used to see if a state already exists.
  33948. //
  33949. // <p>Because the number of alternatives and number of ATN configurations are
  33950. // finite, there is a finite number of DFA states that can be processed.
  33951. // This is necessary to show that the algorithm terminates.</p>
  33952. //
  33953. // <p>Cannot test the DFA state numbers here because in
  33954. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  33955. // exists that has this exact set of ATN configurations. The
  33956. // {@link //stateNumber} is irrelevant.</p>
  33957. DFAState.prototype.equals = function (other) {
  33958. // compare set of ATN configurations in this set with other
  33959. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  33960. };
  33961. DFAState.prototype.toString = function () {
  33962. var s = "" + this.stateNumber + ":" + this.configs;
  33963. if (this.isAcceptState) {
  33964. s = s + "=>";
  33965. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  33966. }
  33967. return s;
  33968. };
  33969. DFAState.prototype.hashCode = function () {
  33970. var hash = new Hash();
  33971. hash.update(this.configs);
  33972. if (this.isAcceptState) {
  33973. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  33974. }
  33975. return hash.finish();
  33976. };
  33977. exports.DFAState = DFAState;
  33978. exports.PredPrediction = PredPrediction;
  33979. /***/ }),
  33980. /***/ "./node_modules/antlr4/dfa/index.js":
  33981. /*!******************************************!*\
  33982. !*** ./node_modules/antlr4/dfa/index.js ***!
  33983. \******************************************/
  33984. /*! no static exports found */
  33985. /***/ (function(module, exports, __webpack_require__) {
  33986. "use strict";
  33987. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33988. * Use of this file is governed by the BSD 3-clause license that
  33989. * can be found in the LICENSE.txt file in the project root.
  33990. */
  33991. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  33992. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  33993. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  33994. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  33995. /***/ }),
  33996. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  33997. /*!**************************************************************!*\
  33998. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  33999. \**************************************************************/
  34000. /*! no static exports found */
  34001. /***/ (function(module, exports, __webpack_require__) {
  34002. "use strict";
  34003. //
  34004. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  34005. * Use of this file is governed by the BSD 3-clause license that
  34006. * can be found in the LICENSE.txt file in the project root.
  34007. */
  34008. //
  34009. //
  34010. // This implementation of {@link ANTLRErrorListener} can be used to identify
  34011. // certain potential correctness and performance problems in grammars. "Reports"
  34012. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  34013. // message.
  34014. //
  34015. // <ul>
  34016. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  34017. // grammar can match the input.</li>
  34018. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  34019. // prediction resolved an SLL conflict to a unique alternative which equaled the
  34020. // minimum alternative of the SLL conflict.</li>
  34021. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  34022. // full-context prediction resolved an SLL conflict to a unique alternative,
  34023. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  34024. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  34025. // this situation occurs.</li>
  34026. // </ul>
  34027. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  34028. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  34029. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  34030. function DiagnosticErrorListener(exactOnly) {
  34031. ErrorListener.call(this);
  34032. exactOnly = exactOnly || true;
  34033. // whether all ambiguities or only exact ambiguities are reported.
  34034. this.exactOnly = exactOnly;
  34035. return this;
  34036. }
  34037. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  34038. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  34039. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  34040. if (this.exactOnly && !exact) {
  34041. return;
  34042. }
  34043. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  34044. recognizer.notifyErrorListeners(msg);
  34045. };
  34046. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  34047. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  34048. recognizer.notifyErrorListeners(msg);
  34049. };
  34050. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  34051. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  34052. recognizer.notifyErrorListeners(msg);
  34053. };
  34054. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  34055. var decision = dfa.decision;
  34056. var ruleIndex = dfa.atnStartState.ruleIndex;
  34057. var ruleNames = recognizer.ruleNames;
  34058. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  34059. return "" + decision;
  34060. }
  34061. var ruleName = ruleNames[ruleIndex] || null;
  34062. if (ruleName === null || ruleName.length === 0) {
  34063. return "" + decision;
  34064. }
  34065. return "" + decision + " (" + ruleName + ")";
  34066. };
  34067. //
  34068. // Computes the set of conflicting or ambiguous alternatives from a
  34069. // configuration set, if that information was not already provided by the
  34070. // parser.
  34071. //
  34072. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  34073. // reported by the parser.
  34074. // @param configs The conflicting or ambiguous configuration set.
  34075. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  34076. // returns the set of alternatives represented in {@code configs}.
  34077. //
  34078. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  34079. if (reportedAlts !== null) {
  34080. return reportedAlts;
  34081. }
  34082. var result = new BitSet();
  34083. for (var i = 0; i < configs.items.length; i++) {
  34084. result.add(configs.items[i].alt);
  34085. }
  34086. return "{" + result.values().join(", ") + "}";
  34087. };
  34088. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  34089. /***/ }),
  34090. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  34091. /*!****************************************************!*\
  34092. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  34093. \****************************************************/
  34094. /*! no static exports found */
  34095. /***/ (function(module, exports, __webpack_require__) {
  34096. "use strict";
  34097. //
  34098. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  34099. * Use of this file is governed by the BSD 3-clause license that
  34100. * can be found in the LICENSE.txt file in the project root.
  34101. */
  34102. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  34103. // default implementation of each method does nothing, but can be overridden as
  34104. // necessary.
  34105. function ErrorListener() {
  34106. return this;
  34107. }
  34108. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  34109. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  34110. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  34111. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  34112. function ConsoleErrorListener() {
  34113. ErrorListener.call(this);
  34114. return this;
  34115. }
  34116. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  34117. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  34118. //
  34119. // Provides a default instance of {@link ConsoleErrorListener}.
  34120. //
  34121. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  34122. //
  34123. // {@inheritDoc}
  34124. //
  34125. // <p>
  34126. // This implementation prints messages to {@link System//err} containing the
  34127. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  34128. // the following format.</p>
  34129. //
  34130. // <pre>
  34131. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  34132. // </pre>
  34133. //
  34134. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  34135. console.error("line " + line + ":" + column + " " + msg);
  34136. };
  34137. function ProxyErrorListener(delegates) {
  34138. ErrorListener.call(this);
  34139. if (delegates === null) {
  34140. throw "delegates";
  34141. }
  34142. this.delegates = delegates;
  34143. return this;
  34144. }
  34145. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  34146. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  34147. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  34148. this.delegates.map(function (d) {
  34149. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  34150. });
  34151. };
  34152. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  34153. this.delegates.map(function (d) {
  34154. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  34155. });
  34156. };
  34157. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  34158. this.delegates.map(function (d) {
  34159. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  34160. });
  34161. };
  34162. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  34163. this.delegates.map(function (d) {
  34164. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  34165. });
  34166. };
  34167. exports.ErrorListener = ErrorListener;
  34168. exports.ConsoleErrorListener = ConsoleErrorListener;
  34169. exports.ProxyErrorListener = ProxyErrorListener;
  34170. /***/ }),
  34171. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  34172. /*!****************************************************!*\
  34173. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  34174. \****************************************************/
  34175. /*! no static exports found */
  34176. /***/ (function(module, exports, __webpack_require__) {
  34177. "use strict";
  34178. //
  34179. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  34180. * Use of this file is governed by the BSD 3-clause license that
  34181. * can be found in the LICENSE.txt file in the project root.
  34182. */
  34183. //
  34184. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  34185. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  34186. var NoViableAltException = Errors.NoViableAltException;
  34187. var InputMismatchException = Errors.InputMismatchException;
  34188. var FailedPredicateException = Errors.FailedPredicateException;
  34189. var ParseCancellationException = Errors.ParseCancellationException;
  34190. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  34191. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  34192. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  34193. function ErrorStrategy() {}
  34194. ErrorStrategy.prototype.reset = function (recognizer) {};
  34195. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  34196. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  34197. ErrorStrategy.prototype.sync = function (recognizer) {};
  34198. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  34199. ErrorStrategy.prototype.reportError = function (recognizer) {};
  34200. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  34201. // error reporting and recovery in ANTLR parsers.
  34202. //
  34203. function DefaultErrorStrategy() {
  34204. ErrorStrategy.call(this);
  34205. // Indicates whether the error strategy is currently "recovering from an
  34206. // error". This is used to suppress reporting multiple error messages while
  34207. // attempting to recover from a detected syntax error.
  34208. //
  34209. // @see //inErrorRecoveryMode
  34210. //
  34211. this.errorRecoveryMode = false;
  34212. // The index into the input stream where the last error occurred.
  34213. // This is used to prevent infinite loops where an error is found
  34214. // but no token is consumed during recovery...another error is found,
  34215. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  34216. // one token/tree node is consumed for two errors.
  34217. //
  34218. this.lastErrorIndex = -1;
  34219. this.lastErrorStates = null;
  34220. return this;
  34221. }
  34222. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  34223. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  34224. // <p>The default implementation simply calls {@link //endErrorCondition} to
  34225. // ensure that the handler is not in error recovery mode.</p>
  34226. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  34227. this.endErrorCondition(recognizer);
  34228. };
  34229. //
  34230. // This method is called to enter error recovery mode when a recognition
  34231. // exception is reported.
  34232. //
  34233. // @param recognizer the parser instance
  34234. //
  34235. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  34236. this.errorRecoveryMode = true;
  34237. };
  34238. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  34239. return this.errorRecoveryMode;
  34240. };
  34241. //
  34242. // This method is called to leave error recovery mode after recovering from
  34243. // a recognition exception.
  34244. //
  34245. // @param recognizer
  34246. //
  34247. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  34248. this.errorRecoveryMode = false;
  34249. this.lastErrorStates = null;
  34250. this.lastErrorIndex = -1;
  34251. };
  34252. //
  34253. // {@inheritDoc}
  34254. //
  34255. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  34256. //
  34257. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  34258. this.endErrorCondition(recognizer);
  34259. };
  34260. //
  34261. // {@inheritDoc}
  34262. //
  34263. // <p>The default implementation returns immediately if the handler is already
  34264. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  34265. // and dispatches the reporting task based on the runtime type of {@code e}
  34266. // according to the following table.</p>
  34267. //
  34268. // <ul>
  34269. // <li>{@link NoViableAltException}: Dispatches the call to
  34270. // {@link //reportNoViableAlternative}</li>
  34271. // <li>{@link InputMismatchException}: Dispatches the call to
  34272. // {@link //reportInputMismatch}</li>
  34273. // <li>{@link FailedPredicateException}: Dispatches the call to
  34274. // {@link //reportFailedPredicate}</li>
  34275. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  34276. // the exception</li>
  34277. // </ul>
  34278. //
  34279. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  34280. // if we've already reported an error and have not matched a token
  34281. // yet successfully, don't report any errors.
  34282. if (this.inErrorRecoveryMode(recognizer)) {
  34283. return; // don't report spurious errors
  34284. }
  34285. this.beginErrorCondition(recognizer);
  34286. if (e instanceof NoViableAltException) {
  34287. this.reportNoViableAlternative(recognizer, e);
  34288. } else if (e instanceof InputMismatchException) {
  34289. this.reportInputMismatch(recognizer, e);
  34290. } else if (e instanceof FailedPredicateException) {
  34291. this.reportFailedPredicate(recognizer, e);
  34292. } else {
  34293. console.log("unknown recognition error type: " + e.constructor.name);
  34294. console.log(e.stack);
  34295. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  34296. }
  34297. };
  34298. //
  34299. // {@inheritDoc}
  34300. //
  34301. // <p>The default implementation resynchronizes the parser by consuming tokens
  34302. // until we find one in the resynchronization set--loosely the set of tokens
  34303. // that can follow the current rule.</p>
  34304. //
  34305. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  34306. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  34307. // uh oh, another error at same token index and previously-visited
  34308. // state in ATN; must be a case where LT(1) is in the recovery
  34309. // token set so nothing got consumed. Consume a single token
  34310. // at least to prevent an infinite loop; this is a failsafe.
  34311. recognizer.consume();
  34312. }
  34313. this.lastErrorIndex = recognizer._input.index;
  34314. if (this.lastErrorStates === null) {
  34315. this.lastErrorStates = [];
  34316. }
  34317. this.lastErrorStates.push(recognizer.state);
  34318. var followSet = this.getErrorRecoverySet(recognizer);
  34319. this.consumeUntil(recognizer, followSet);
  34320. };
  34321. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  34322. // that the current lookahead symbol is consistent with what were expecting
  34323. // at this point in the ATN. You can call this anytime but ANTLR only
  34324. // generates code to check before subrules/loops and each iteration.
  34325. //
  34326. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  34327. // subrules. E.g.,</p>
  34328. //
  34329. // <pre>
  34330. // a : sync ( stuff sync )* ;
  34331. // sync : {consume to what can follow sync} ;
  34332. // </pre>
  34333. //
  34334. // At the start of a sub rule upon error, {@link //sync} performs single
  34335. // token deletion, if possible. If it can't do that, it bails on the current
  34336. // rule and uses the default error recovery, which consumes until the
  34337. // resynchronization set of the current rule.
  34338. //
  34339. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  34340. // with an empty alternative), then the expected set includes what follows
  34341. // the subrule.</p>
  34342. //
  34343. // <p>During loop iteration, it consumes until it sees a token that can start a
  34344. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  34345. // stay in the loop as long as possible.</p>
  34346. //
  34347. // <p><strong>ORIGINS</strong></p>
  34348. //
  34349. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  34350. // A single mismatch token or missing token would force the parser to bail
  34351. // out of the entire rules surrounding the loop. So, for rule</p>
  34352. //
  34353. // <pre>
  34354. // classDef : 'class' ID '{' member* '}'
  34355. // </pre>
  34356. //
  34357. // input with an extra token between members would force the parser to
  34358. // consume until it found the next class definition rather than the next
  34359. // member definition of the current class.
  34360. //
  34361. // <p>This functionality cost a little bit of effort because the parser has to
  34362. // compare token set at the start of the loop and at each iteration. If for
  34363. // some reason speed is suffering for you, you can turn off this
  34364. // functionality by simply overriding this method as a blank { }.</p>
  34365. //
  34366. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  34367. // If already recovering, don't try to sync
  34368. if (this.inErrorRecoveryMode(recognizer)) {
  34369. return;
  34370. }
  34371. var s = recognizer._interp.atn.states[recognizer.state];
  34372. var la = recognizer.getTokenStream().LA(1);
  34373. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  34374. var nextTokens = recognizer.atn.nextTokens(s);
  34375. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  34376. return;
  34377. }
  34378. switch (s.stateType) {
  34379. case ATNState.BLOCK_START:
  34380. case ATNState.STAR_BLOCK_START:
  34381. case ATNState.PLUS_BLOCK_START:
  34382. case ATNState.STAR_LOOP_ENTRY:
  34383. // report error and recover if possible
  34384. if (this.singleTokenDeletion(recognizer) !== null) {
  34385. return;
  34386. } else {
  34387. throw new InputMismatchException(recognizer);
  34388. }
  34389. break;
  34390. case ATNState.PLUS_LOOP_BACK:
  34391. case ATNState.STAR_LOOP_BACK:
  34392. this.reportUnwantedToken(recognizer);
  34393. var expecting = new IntervalSet();
  34394. expecting.addSet(recognizer.getExpectedTokens());
  34395. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  34396. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  34397. break;
  34398. default:
  34399. // do nothing if we can't identify the exact kind of ATN state
  34400. }
  34401. };
  34402. // This is called by {@link //reportError} when the exception is a
  34403. // {@link NoViableAltException}.
  34404. //
  34405. // @see //reportError
  34406. //
  34407. // @param recognizer the parser instance
  34408. // @param e the recognition exception
  34409. //
  34410. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  34411. var tokens = recognizer.getTokenStream();
  34412. var input;
  34413. if (tokens !== null) {
  34414. if (e.startToken.type === Token.EOF) {
  34415. input = "<EOF>";
  34416. } else {
  34417. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  34418. }
  34419. } else {
  34420. input = "<unknown input>";
  34421. }
  34422. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  34423. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  34424. };
  34425. //
  34426. // This is called by {@link //reportError} when the exception is an
  34427. // {@link InputMismatchException}.
  34428. //
  34429. // @see //reportError
  34430. //
  34431. // @param recognizer the parser instance
  34432. // @param e the recognition exception
  34433. //
  34434. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  34435. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  34436. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  34437. };
  34438. //
  34439. // This is called by {@link //reportError} when the exception is a
  34440. // {@link FailedPredicateException}.
  34441. //
  34442. // @see //reportError
  34443. //
  34444. // @param recognizer the parser instance
  34445. // @param e the recognition exception
  34446. //
  34447. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  34448. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  34449. var msg = "rule " + ruleName + " " + e.message;
  34450. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  34451. };
  34452. // This method is called to report a syntax error which requires the removal
  34453. // of a token from the input stream. At the time this method is called, the
  34454. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  34455. // removed from the input stream. When this method returns,
  34456. // {@code recognizer} is in error recovery mode.
  34457. //
  34458. // <p>This method is called when {@link //singleTokenDeletion} identifies
  34459. // single-token deletion as a viable recovery strategy for a mismatched
  34460. // input error.</p>
  34461. //
  34462. // <p>The default implementation simply returns if the handler is already in
  34463. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  34464. // enter error recovery mode, followed by calling
  34465. // {@link Parser//notifyErrorListeners}.</p>
  34466. //
  34467. // @param recognizer the parser instance
  34468. //
  34469. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  34470. if (this.inErrorRecoveryMode(recognizer)) {
  34471. return;
  34472. }
  34473. this.beginErrorCondition(recognizer);
  34474. var t = recognizer.getCurrentToken();
  34475. var tokenName = this.getTokenErrorDisplay(t);
  34476. var expecting = this.getExpectedTokens(recognizer);
  34477. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  34478. recognizer.notifyErrorListeners(msg, t, null);
  34479. };
  34480. // This method is called to report a syntax error which requires the
  34481. // insertion of a missing token into the input stream. At the time this
  34482. // method is called, the missing token has not yet been inserted. When this
  34483. // method returns, {@code recognizer} is in error recovery mode.
  34484. //
  34485. // <p>This method is called when {@link //singleTokenInsertion} identifies
  34486. // single-token insertion as a viable recovery strategy for a mismatched
  34487. // input error.</p>
  34488. //
  34489. // <p>The default implementation simply returns if the handler is already in
  34490. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  34491. // enter error recovery mode, followed by calling
  34492. // {@link Parser//notifyErrorListeners}.</p>
  34493. //
  34494. // @param recognizer the parser instance
  34495. //
  34496. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  34497. if (this.inErrorRecoveryMode(recognizer)) {
  34498. return;
  34499. }
  34500. this.beginErrorCondition(recognizer);
  34501. var t = recognizer.getCurrentToken();
  34502. var expecting = this.getExpectedTokens(recognizer);
  34503. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  34504. recognizer.notifyErrorListeners(msg, t, null);
  34505. };
  34506. // <p>The default implementation attempts to recover from the mismatched input
  34507. // by using single token insertion and deletion as described below. If the
  34508. // recovery attempt fails, this method throws an
  34509. // {@link InputMismatchException}.</p>
  34510. //
  34511. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  34512. //
  34513. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  34514. // right token, however, then assume {@code LA(1)} is some extra spurious
  34515. // token and delete it. Then consume and return the next token (which was
  34516. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  34517. //
  34518. // <p>This recovery strategy is implemented by {@link
  34519. // //singleTokenDeletion}.</p>
  34520. //
  34521. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  34522. //
  34523. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  34524. // after the expected {@code LA(1)} token, then assume the token is missing
  34525. // and use the parser's {@link TokenFactory} to create it on the fly. The
  34526. // "insertion" is performed by returning the created token as the successful
  34527. // result of the match operation.</p>
  34528. //
  34529. // <p>This recovery strategy is implemented by {@link
  34530. // //singleTokenInsertion}.</p>
  34531. //
  34532. // <p><strong>EXAMPLE</strong></p>
  34533. //
  34534. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  34535. // the parser returns from the nested call to {@code expr}, it will have
  34536. // call chain:</p>
  34537. //
  34538. // <pre>
  34539. // stat &rarr; expr &rarr; atom
  34540. // </pre>
  34541. //
  34542. // and it will be trying to match the {@code ')'} at this point in the
  34543. // derivation:
  34544. //
  34545. // <pre>
  34546. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  34547. // ^
  34548. // </pre>
  34549. //
  34550. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  34551. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  34552. // is in the set of tokens that can follow the {@code ')'} token reference
  34553. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  34554. //
  34555. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  34556. // SINGLE TOKEN DELETION
  34557. var matchedSymbol = this.singleTokenDeletion(recognizer);
  34558. if (matchedSymbol !== null) {
  34559. // we have deleted the extra token.
  34560. // now, move past ttype token as if all were ok
  34561. recognizer.consume();
  34562. return matchedSymbol;
  34563. }
  34564. // SINGLE TOKEN INSERTION
  34565. if (this.singleTokenInsertion(recognizer)) {
  34566. return this.getMissingSymbol(recognizer);
  34567. }
  34568. // even that didn't work; must throw the exception
  34569. throw new InputMismatchException(recognizer);
  34570. };
  34571. //
  34572. // This method implements the single-token insertion inline error recovery
  34573. // strategy. It is called by {@link //recoverInline} if the single-token
  34574. // deletion strategy fails to recover from the mismatched input. If this
  34575. // method returns {@code true}, {@code recognizer} will be in error recovery
  34576. // mode.
  34577. //
  34578. // <p>This method determines whether or not single-token insertion is viable by
  34579. // checking if the {@code LA(1)} input symbol could be successfully matched
  34580. // if it were instead the {@code LA(2)} symbol. If this method returns
  34581. // {@code true}, the caller is responsible for creating and inserting a
  34582. // token with the correct type to produce this behavior.</p>
  34583. //
  34584. // @param recognizer the parser instance
  34585. // @return {@code true} if single-token insertion is a viable recovery
  34586. // strategy for the current mismatched input, otherwise {@code false}
  34587. //
  34588. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  34589. var currentSymbolType = recognizer.getTokenStream().LA(1);
  34590. // if current token is consistent with what could come after current
  34591. // ATN state, then we know we're missing a token; error recovery
  34592. // is free to conjure up and insert the missing token
  34593. var atn = recognizer._interp.atn;
  34594. var currentState = atn.states[recognizer.state];
  34595. var next = currentState.transitions[0].target;
  34596. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  34597. if (expectingAtLL2.contains(currentSymbolType)) {
  34598. this.reportMissingToken(recognizer);
  34599. return true;
  34600. } else {
  34601. return false;
  34602. }
  34603. };
  34604. // This method implements the single-token deletion inline error recovery
  34605. // strategy. It is called by {@link //recoverInline} to attempt to recover
  34606. // from mismatched input. If this method returns null, the parser and error
  34607. // handler state will not have changed. If this method returns non-null,
  34608. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  34609. // returned token was a successful match.
  34610. //
  34611. // <p>If the single-token deletion is successful, this method calls
  34612. // {@link //reportUnwantedToken} to report the error, followed by
  34613. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  34614. // before returning {@link //reportMatch} is called to signal a successful
  34615. // match.</p>
  34616. //
  34617. // @param recognizer the parser instance
  34618. // @return the successfully matched {@link Token} instance if single-token
  34619. // deletion successfully recovers from the mismatched input, otherwise
  34620. // {@code null}
  34621. //
  34622. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  34623. var nextTokenType = recognizer.getTokenStream().LA(2);
  34624. var expecting = this.getExpectedTokens(recognizer);
  34625. if (expecting.contains(nextTokenType)) {
  34626. this.reportUnwantedToken(recognizer);
  34627. // print("recoverFromMismatchedToken deleting " \
  34628. // + str(recognizer.getTokenStream().LT(1)) \
  34629. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  34630. // + " is what we want", file=sys.stderr)
  34631. recognizer.consume(); // simply delete extra token
  34632. // we want to return the token we're actually matching
  34633. var matchedSymbol = recognizer.getCurrentToken();
  34634. this.reportMatch(recognizer); // we know current token is correct
  34635. return matchedSymbol;
  34636. } else {
  34637. return null;
  34638. }
  34639. };
  34640. // Conjure up a missing token during error recovery.
  34641. //
  34642. // The recognizer attempts to recover from single missing
  34643. // symbols. But, actions might refer to that missing symbol.
  34644. // For example, x=ID {f($x);}. The action clearly assumes
  34645. // that there has been an identifier matched previously and that
  34646. // $x points at that token. If that token is missing, but
  34647. // the next token in the stream is what we want we assume that
  34648. // this token is missing and we keep going. Because we
  34649. // have to return some token to replace the missing token,
  34650. // we have to conjure one up. This method gives the user control
  34651. // over the tokens returned for missing tokens. Mostly,
  34652. // you will want to create something special for identifier
  34653. // tokens. For literals such as '{' and ',', the default
  34654. // action in the parser or tree parser works. It simply creates
  34655. // a CommonToken of the appropriate type. The text will be the token.
  34656. // If you change what tokens must be created by the lexer,
  34657. // override this method to create the appropriate tokens.
  34658. //
  34659. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  34660. var currentSymbol = recognizer.getCurrentToken();
  34661. var expecting = this.getExpectedTokens(recognizer);
  34662. var expectedTokenType = expecting.first(); // get any element
  34663. var tokenText;
  34664. if (expectedTokenType === Token.EOF) {
  34665. tokenText = "<missing EOF>";
  34666. } else {
  34667. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  34668. }
  34669. var current = currentSymbol;
  34670. var lookback = recognizer.getTokenStream().LT(-1);
  34671. if (current.type === Token.EOF && lookback !== null) {
  34672. current = lookback;
  34673. }
  34674. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  34675. };
  34676. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  34677. return recognizer.getExpectedTokens();
  34678. };
  34679. // How should a token be displayed in an error message? The default
  34680. // is to display just the text, but during development you might
  34681. // want to have a lot of information spit out. Override in that case
  34682. // to use t.toString() (which, for CommonToken, dumps everything about
  34683. // the token). This is better than forcing you to override a method in
  34684. // your token objects because you don't have to go modify your lexer
  34685. // so that it creates a new Java type.
  34686. //
  34687. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  34688. if (t === null) {
  34689. return "<no token>";
  34690. }
  34691. var s = t.text;
  34692. if (s === null) {
  34693. if (t.type === Token.EOF) {
  34694. s = "<EOF>";
  34695. } else {
  34696. s = "<" + t.type + ">";
  34697. }
  34698. }
  34699. return this.escapeWSAndQuote(s);
  34700. };
  34701. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  34702. s = s.replace(/\n/g, "\\n");
  34703. s = s.replace(/\r/g, "\\r");
  34704. s = s.replace(/\t/g, "\\t");
  34705. return "'" + s + "'";
  34706. };
  34707. // Compute the error recovery set for the current rule. During
  34708. // rule invocation, the parser pushes the set of tokens that can
  34709. // follow that rule reference on the stack; this amounts to
  34710. // computing FIRST of what follows the rule reference in the
  34711. // enclosing rule. See LinearApproximator.FIRST().
  34712. // This local follow set only includes tokens
  34713. // from within the rule; i.e., the FIRST computation done by
  34714. // ANTLR stops at the end of a rule.
  34715. //
  34716. // EXAMPLE
  34717. //
  34718. // When you find a "no viable alt exception", the input is not
  34719. // consistent with any of the alternatives for rule r. The best
  34720. // thing to do is to consume tokens until you see something that
  34721. // can legally follow a call to r//or* any rule that called r.
  34722. // You don't want the exact set of viable next tokens because the
  34723. // input might just be missing a token--you might consume the
  34724. // rest of the input looking for one of the missing tokens.
  34725. //
  34726. // Consider grammar:
  34727. //
  34728. // a : '[' b ']'
  34729. // | '(' b ')'
  34730. // ;
  34731. // b : c '^' INT ;
  34732. // c : ID
  34733. // | INT
  34734. // ;
  34735. //
  34736. // At each rule invocation, the set of tokens that could follow
  34737. // that rule is pushed on a stack. Here are the various
  34738. // context-sensitive follow sets:
  34739. //
  34740. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  34741. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  34742. // FOLLOW(c_in_b) = FIRST('^') = '^'
  34743. //
  34744. // Upon erroneous input "[]", the call chain is
  34745. //
  34746. // a -> b -> c
  34747. //
  34748. // and, hence, the follow context stack is:
  34749. //
  34750. // depth follow set start of rule execution
  34751. // 0 <EOF> a (from main())
  34752. // 1 ']' b
  34753. // 2 '^' c
  34754. //
  34755. // Notice that ')' is not included, because b would have to have
  34756. // been called from a different context in rule a for ')' to be
  34757. // included.
  34758. //
  34759. // For error recovery, we cannot consider FOLLOW(c)
  34760. // (context-sensitive or otherwise). We need the combined set of
  34761. // all context-sensitive FOLLOW sets--the set of all tokens that
  34762. // could follow any reference in the call chain. We need to
  34763. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  34764. // we resync'd to that token, we'd consume until EOF. We need to
  34765. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  34766. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  34767. // not consume anything. After printing an error, rule c would
  34768. // return normally. Rule b would not find the required '^' though.
  34769. // At this point, it gets a mismatched token error and throws an
  34770. // exception (since LA(1) is not in the viable following token
  34771. // set). The rule exception handler tries to recover, but finds
  34772. // the same recovery set and doesn't consume anything. Rule b
  34773. // exits normally returning to rule a. Now it finds the ']' (and
  34774. // with the successful match exits errorRecovery mode).
  34775. //
  34776. // So, you can see that the parser walks up the call chain looking
  34777. // for the token that was a member of the recovery set.
  34778. //
  34779. // Errors are not generated in errorRecovery mode.
  34780. //
  34781. // ANTLR's error recovery mechanism is based upon original ideas:
  34782. //
  34783. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  34784. //
  34785. // and
  34786. //
  34787. // "A note on error recovery in recursive descent parsers":
  34788. // http://portal.acm.org/citation.cfm?id=947902.947905
  34789. //
  34790. // Later, Josef Grosch had some good ideas:
  34791. //
  34792. // "Efficient and Comfortable Error Recovery in Recursive Descent
  34793. // Parsers":
  34794. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  34795. //
  34796. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  34797. // at run-time upon error to avoid overhead during parsing.
  34798. //
  34799. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  34800. var atn = recognizer._interp.atn;
  34801. var ctx = recognizer._ctx;
  34802. var recoverSet = new IntervalSet();
  34803. while (ctx !== null && ctx.invokingState >= 0) {
  34804. // compute what follows who invoked us
  34805. var invokingState = atn.states[ctx.invokingState];
  34806. var rt = invokingState.transitions[0];
  34807. var follow = atn.nextTokens(rt.followState);
  34808. recoverSet.addSet(follow);
  34809. ctx = ctx.parentCtx;
  34810. }
  34811. recoverSet.removeOne(Token.EPSILON);
  34812. return recoverSet;
  34813. };
  34814. // Consume tokens until one matches the given token set.//
  34815. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  34816. var ttype = recognizer.getTokenStream().LA(1);
  34817. while (ttype !== Token.EOF && !set.contains(ttype)) {
  34818. recognizer.consume();
  34819. ttype = recognizer.getTokenStream().LA(1);
  34820. }
  34821. };
  34822. //
  34823. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  34824. // by immediately canceling the parse operation with a
  34825. // {@link ParseCancellationException}. The implementation ensures that the
  34826. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  34827. // that were not completed prior to encountering the error.
  34828. //
  34829. // <p>
  34830. // This error strategy is useful in the following scenarios.</p>
  34831. //
  34832. // <ul>
  34833. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  34834. // stage of two-stage parsing to immediately terminate if an error is
  34835. // encountered, and immediately fall back to the second stage. In addition to
  34836. // avoiding wasted work by attempting to recover from errors here, the empty
  34837. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  34838. // the first stage.</li>
  34839. // <li><strong>Silent validation:</strong> When syntax errors are not being
  34840. // reported or logged, and the parse result is simply ignored if errors occur,
  34841. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  34842. // when the result will be ignored either way.</li>
  34843. // </ul>
  34844. //
  34845. // <p>
  34846. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  34847. //
  34848. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  34849. //
  34850. function BailErrorStrategy() {
  34851. DefaultErrorStrategy.call(this);
  34852. return this;
  34853. }
  34854. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  34855. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  34856. // Instead of recovering from exception {@code e}, re-throw it wrapped
  34857. // in a {@link ParseCancellationException} so it is not caught by the
  34858. // rule function catches. Use {@link Exception//getCause()} to get the
  34859. // original {@link RecognitionException}.
  34860. //
  34861. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  34862. var context = recognizer._ctx;
  34863. while (context !== null) {
  34864. context.exception = e;
  34865. context = context.parentCtx;
  34866. }
  34867. throw new ParseCancellationException(e);
  34868. };
  34869. // Make sure we don't attempt to recover inline; if the parser
  34870. // successfully recovers, it won't throw an exception.
  34871. //
  34872. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  34873. this.recover(recognizer, new InputMismatchException(recognizer));
  34874. };
  34875. // Make sure we don't attempt to recover from problems in subrules.//
  34876. BailErrorStrategy.prototype.sync = function (recognizer) {
  34877. // pass
  34878. };
  34879. exports.BailErrorStrategy = BailErrorStrategy;
  34880. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  34881. /***/ }),
  34882. /***/ "./node_modules/antlr4/error/Errors.js":
  34883. /*!*********************************************!*\
  34884. !*** ./node_modules/antlr4/error/Errors.js ***!
  34885. \*********************************************/
  34886. /*! no static exports found */
  34887. /***/ (function(module, exports, __webpack_require__) {
  34888. "use strict";
  34889. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  34890. * Use of this file is governed by the BSD 3-clause license that
  34891. * can be found in the LICENSE.txt file in the project root.
  34892. */
  34893. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  34894. // 3 kinds of errors: prediction errors, failed predicate errors, and
  34895. // mismatched input errors. In each case, the parser knows where it is
  34896. // in the input, where it is in the ATN, the rule invocation stack,
  34897. // and what kind of problem occurred.
  34898. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  34899. function RecognitionException(params) {
  34900. Error.call(this);
  34901. if (!!Error.captureStackTrace) {
  34902. Error.captureStackTrace(this, RecognitionException);
  34903. } else {
  34904. var stack = new Error().stack;
  34905. }
  34906. this.message = params.message;
  34907. this.recognizer = params.recognizer;
  34908. this.input = params.input;
  34909. this.ctx = params.ctx;
  34910. // The current {@link Token} when an error occurred. Since not all streams
  34911. // support accessing symbols by index, we have to track the {@link Token}
  34912. // instance itself.
  34913. this.offendingToken = null;
  34914. // Get the ATN state number the parser was in at the time the error
  34915. // occurred. For {@link NoViableAltException} and
  34916. // {@link LexerNoViableAltException} exceptions, this is the
  34917. // {@link DecisionState} number. For others, it is the state whose outgoing
  34918. // edge we couldn't match.
  34919. this.offendingState = -1;
  34920. if (this.recognizer !== null) {
  34921. this.offendingState = this.recognizer.state;
  34922. }
  34923. return this;
  34924. }
  34925. RecognitionException.prototype = Object.create(Error.prototype);
  34926. RecognitionException.prototype.constructor = RecognitionException;
  34927. // <p>If the state number is not known, this method returns -1.</p>
  34928. //
  34929. // Gets the set of input symbols which could potentially follow the
  34930. // previously matched symbol at the time this exception was thrown.
  34931. //
  34932. // <p>If the set of expected tokens is not known and could not be computed,
  34933. // this method returns {@code null}.</p>
  34934. //
  34935. // @return The set of token types that could potentially follow the current
  34936. // state in the ATN, or {@code null} if the information is not available.
  34937. // /
  34938. RecognitionException.prototype.getExpectedTokens = function () {
  34939. if (this.recognizer !== null) {
  34940. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  34941. } else {
  34942. return null;
  34943. }
  34944. };
  34945. RecognitionException.prototype.toString = function () {
  34946. return this.message;
  34947. };
  34948. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  34949. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  34950. this.startIndex = startIndex;
  34951. this.deadEndConfigs = deadEndConfigs;
  34952. return this;
  34953. }
  34954. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  34955. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  34956. LexerNoViableAltException.prototype.toString = function () {
  34957. var symbol = "";
  34958. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  34959. symbol = this.input.getText((this.startIndex, this.startIndex));
  34960. }
  34961. return "LexerNoViableAltException" + symbol;
  34962. };
  34963. // Indicates that the parser could not decide which of two or more paths
  34964. // to take based upon the remaining input. It tracks the starting token
  34965. // of the offending input and also knows where the parser was
  34966. // in the various paths when the error. Reported by reportNoViableAlternative()
  34967. //
  34968. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  34969. ctx = ctx || recognizer._ctx;
  34970. offendingToken = offendingToken || recognizer.getCurrentToken();
  34971. startToken = startToken || recognizer.getCurrentToken();
  34972. input = input || recognizer.getInputStream();
  34973. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  34974. // Which configurations did we try at input.index() that couldn't match
  34975. // input.LT(1)?//
  34976. this.deadEndConfigs = deadEndConfigs;
  34977. // The token object at the start index; the input stream might
  34978. // not be buffering tokens so get a reference to it. (At the
  34979. // time the error occurred, of course the stream needs to keep a
  34980. // buffer all of the tokens but later we might not have access to those.)
  34981. this.startToken = startToken;
  34982. this.offendingToken = offendingToken;
  34983. }
  34984. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  34985. NoViableAltException.prototype.constructor = NoViableAltException;
  34986. // This signifies any kind of mismatched input exceptions such as
  34987. // when the current input does not match the expected token.
  34988. //
  34989. function InputMismatchException(recognizer) {
  34990. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  34991. this.offendingToken = recognizer.getCurrentToken();
  34992. }
  34993. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  34994. InputMismatchException.prototype.constructor = InputMismatchException;
  34995. // A semantic predicate failed during validation. Validation of predicates
  34996. // occurs when normally parsing the alternative just like matching a token.
  34997. // Disambiguating predicate evaluation occurs when we test a predicate during
  34998. // prediction.
  34999. function FailedPredicateException(recognizer, predicate, message) {
  35000. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  35001. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  35002. var s = recognizer._interp.atn.states[recognizer.state];
  35003. var trans = s.transitions[0];
  35004. if (trans instanceof PredicateTransition) {
  35005. this.ruleIndex = trans.ruleIndex;
  35006. this.predicateIndex = trans.predIndex;
  35007. } else {
  35008. this.ruleIndex = 0;
  35009. this.predicateIndex = 0;
  35010. }
  35011. this.predicate = predicate;
  35012. this.offendingToken = recognizer.getCurrentToken();
  35013. return this;
  35014. }
  35015. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  35016. FailedPredicateException.prototype.constructor = FailedPredicateException;
  35017. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  35018. if (message !== null) {
  35019. return message;
  35020. } else {
  35021. return "failed predicate: {" + predicate + "}?";
  35022. }
  35023. };
  35024. function ParseCancellationException() {
  35025. Error.call(this);
  35026. Error.captureStackTrace(this, ParseCancellationException);
  35027. return this;
  35028. }
  35029. ParseCancellationException.prototype = Object.create(Error.prototype);
  35030. ParseCancellationException.prototype.constructor = ParseCancellationException;
  35031. exports.RecognitionException = RecognitionException;
  35032. exports.NoViableAltException = NoViableAltException;
  35033. exports.LexerNoViableAltException = LexerNoViableAltException;
  35034. exports.InputMismatchException = InputMismatchException;
  35035. exports.FailedPredicateException = FailedPredicateException;
  35036. exports.ParseCancellationException = ParseCancellationException;
  35037. /***/ }),
  35038. /***/ "./node_modules/antlr4/error/index.js":
  35039. /*!********************************************!*\
  35040. !*** ./node_modules/antlr4/error/index.js ***!
  35041. \********************************************/
  35042. /*! no static exports found */
  35043. /***/ (function(module, exports, __webpack_require__) {
  35044. "use strict";
  35045. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35046. * Use of this file is governed by the BSD 3-clause license that
  35047. * can be found in the LICENSE.txt file in the project root.
  35048. */
  35049. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  35050. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  35051. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  35052. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  35053. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  35054. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  35055. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  35056. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  35057. /***/ }),
  35058. /***/ "./node_modules/antlr4/index.js":
  35059. /*!**************************************!*\
  35060. !*** ./node_modules/antlr4/index.js ***!
  35061. \**************************************/
  35062. /*! no static exports found */
  35063. /***/ (function(module, exports, __webpack_require__) {
  35064. "use strict";
  35065. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35066. * Use of this file is governed by the BSD 3-clause license that
  35067. * can be found in the LICENSE.txt file in the project root.
  35068. */
  35069. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  35070. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  35071. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  35072. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  35073. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  35074. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  35075. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  35076. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  35077. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  35078. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  35079. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  35080. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  35081. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  35082. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  35083. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  35084. exports.PredictionContextCache = pc.PredictionContextCache;
  35085. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  35086. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  35087. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  35088. /***/ }),
  35089. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  35090. /*!******************************************************!*\
  35091. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  35092. \******************************************************/
  35093. /*! no static exports found */
  35094. /***/ (function(module, exports, __webpack_require__) {
  35095. "use strict";
  35096. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  35097. if (!String.prototype.codePointAt) {
  35098. (function () {
  35099. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  35100. var defineProperty = function () {
  35101. // IE 8 only supports `Object.defineProperty` on DOM elements
  35102. try {
  35103. var object = {};
  35104. var $defineProperty = Object.defineProperty;
  35105. var result = $defineProperty(object, object, object) && $defineProperty;
  35106. } catch (error) {}
  35107. return result;
  35108. }();
  35109. var codePointAt = function codePointAt(position) {
  35110. if (this == null) {
  35111. throw TypeError();
  35112. }
  35113. var string = String(this);
  35114. var size = string.length;
  35115. // `ToInteger`
  35116. var index = position ? Number(position) : 0;
  35117. if (index != index) {
  35118. // better `isNaN`
  35119. index = 0;
  35120. }
  35121. // Account for out-of-bounds indices:
  35122. if (index < 0 || index >= size) {
  35123. return undefined;
  35124. }
  35125. // Get the first code unit
  35126. var first = string.charCodeAt(index);
  35127. var second;
  35128. if ( // check if it’s the start of a surrogate pair
  35129. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  35130. size > index + 1 // there is a next code unit
  35131. ) {
  35132. second = string.charCodeAt(index + 1);
  35133. if (second >= 0xDC00 && second <= 0xDFFF) {
  35134. // low surrogate
  35135. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  35136. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  35137. }
  35138. }
  35139. return first;
  35140. };
  35141. if (defineProperty) {
  35142. defineProperty(String.prototype, 'codePointAt', {
  35143. 'value': codePointAt,
  35144. 'configurable': true,
  35145. 'writable': true
  35146. });
  35147. } else {
  35148. String.prototype.codePointAt = codePointAt;
  35149. }
  35150. })();
  35151. }
  35152. /***/ }),
  35153. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  35154. /*!********************************************************!*\
  35155. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  35156. \********************************************************/
  35157. /*! no static exports found */
  35158. /***/ (function(module, exports, __webpack_require__) {
  35159. "use strict";
  35160. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  35161. if (!String.fromCodePoint) {
  35162. (function () {
  35163. var defineProperty = function () {
  35164. // IE 8 only supports `Object.defineProperty` on DOM elements
  35165. try {
  35166. var object = {};
  35167. var $defineProperty = Object.defineProperty;
  35168. var result = $defineProperty(object, object, object) && $defineProperty;
  35169. } catch (error) {}
  35170. return result;
  35171. }();
  35172. var stringFromCharCode = String.fromCharCode;
  35173. var floor = Math.floor;
  35174. var fromCodePoint = function fromCodePoint(_) {
  35175. var MAX_SIZE = 0x4000;
  35176. var codeUnits = [];
  35177. var highSurrogate;
  35178. var lowSurrogate;
  35179. var index = -1;
  35180. var length = arguments.length;
  35181. if (!length) {
  35182. return '';
  35183. }
  35184. var result = '';
  35185. while (++index < length) {
  35186. var codePoint = Number(arguments[index]);
  35187. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  35188. codePoint < 0 || // not a valid Unicode code point
  35189. codePoint > 0x10FFFF || // not a valid Unicode code point
  35190. floor(codePoint) != codePoint // not an integer
  35191. ) {
  35192. throw RangeError('Invalid code point: ' + codePoint);
  35193. }
  35194. if (codePoint <= 0xFFFF) {
  35195. // BMP code point
  35196. codeUnits.push(codePoint);
  35197. } else {
  35198. // Astral code point; split in surrogate halves
  35199. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  35200. codePoint -= 0x10000;
  35201. highSurrogate = (codePoint >> 10) + 0xD800;
  35202. lowSurrogate = codePoint % 0x400 + 0xDC00;
  35203. codeUnits.push(highSurrogate, lowSurrogate);
  35204. }
  35205. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  35206. result += stringFromCharCode.apply(null, codeUnits);
  35207. codeUnits.length = 0;
  35208. }
  35209. }
  35210. return result;
  35211. };
  35212. if (defineProperty) {
  35213. defineProperty(String, 'fromCodePoint', {
  35214. 'value': fromCodePoint,
  35215. 'configurable': true,
  35216. 'writable': true
  35217. });
  35218. } else {
  35219. String.fromCodePoint = fromCodePoint;
  35220. }
  35221. })();
  35222. }
  35223. /***/ }),
  35224. /***/ "./node_modules/antlr4/tree/Tree.js":
  35225. /*!******************************************!*\
  35226. !*** ./node_modules/antlr4/tree/Tree.js ***!
  35227. \******************************************/
  35228. /*! no static exports found */
  35229. /***/ (function(module, exports, __webpack_require__) {
  35230. "use strict";
  35231. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35232. * Use of this file is governed by the BSD 3-clause license that
  35233. * can be found in the LICENSE.txt file in the project root.
  35234. */
  35235. ///
  35236. // The basic notion of a tree has a parent, a payload, and a list of children.
  35237. // It is the most abstract interface for all the trees used by ANTLR.
  35238. ///
  35239. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  35240. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  35241. var INVALID_INTERVAL = new Interval(-1, -2);
  35242. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  35243. function Tree() {
  35244. return this;
  35245. }
  35246. function SyntaxTree() {
  35247. Tree.call(this);
  35248. return this;
  35249. }
  35250. SyntaxTree.prototype = Object.create(Tree.prototype);
  35251. SyntaxTree.prototype.constructor = SyntaxTree;
  35252. function ParseTree() {
  35253. SyntaxTree.call(this);
  35254. return this;
  35255. }
  35256. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  35257. ParseTree.prototype.constructor = ParseTree;
  35258. function RuleNode() {
  35259. ParseTree.call(this);
  35260. return this;
  35261. }
  35262. RuleNode.prototype = Object.create(ParseTree.prototype);
  35263. RuleNode.prototype.constructor = RuleNode;
  35264. function TerminalNode() {
  35265. ParseTree.call(this);
  35266. return this;
  35267. }
  35268. TerminalNode.prototype = Object.create(ParseTree.prototype);
  35269. TerminalNode.prototype.constructor = TerminalNode;
  35270. function ErrorNode() {
  35271. TerminalNode.call(this);
  35272. return this;
  35273. }
  35274. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  35275. ErrorNode.prototype.constructor = ErrorNode;
  35276. function ParseTreeVisitor() {
  35277. return this;
  35278. }
  35279. ParseTreeVisitor.prototype.visit = function (ctx) {
  35280. if (Array.isArray(ctx)) {
  35281. return ctx.map(function (child) {
  35282. return child.accept(this);
  35283. }, this);
  35284. } else {
  35285. return ctx.accept(this);
  35286. }
  35287. };
  35288. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  35289. if (ctx.children) {
  35290. return this.visit(ctx.children);
  35291. } else {
  35292. return null;
  35293. }
  35294. };
  35295. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  35296. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  35297. function ParseTreeListener() {
  35298. return this;
  35299. }
  35300. ParseTreeListener.prototype.visitTerminal = function (node) {};
  35301. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  35302. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  35303. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  35304. function TerminalNodeImpl(symbol) {
  35305. TerminalNode.call(this);
  35306. this.parentCtx = null;
  35307. this.symbol = symbol;
  35308. return this;
  35309. }
  35310. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  35311. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  35312. TerminalNodeImpl.prototype.getChild = function (i) {
  35313. return null;
  35314. };
  35315. TerminalNodeImpl.prototype.getSymbol = function () {
  35316. return this.symbol;
  35317. };
  35318. TerminalNodeImpl.prototype.getParent = function () {
  35319. return this.parentCtx;
  35320. };
  35321. TerminalNodeImpl.prototype.getPayload = function () {
  35322. return this.symbol;
  35323. };
  35324. TerminalNodeImpl.prototype.getSourceInterval = function () {
  35325. if (this.symbol === null) {
  35326. return INVALID_INTERVAL;
  35327. }
  35328. var tokenIndex = this.symbol.tokenIndex;
  35329. return new Interval(tokenIndex, tokenIndex);
  35330. };
  35331. TerminalNodeImpl.prototype.getChildCount = function () {
  35332. return 0;
  35333. };
  35334. TerminalNodeImpl.prototype.accept = function (visitor) {
  35335. return visitor.visitTerminal(this);
  35336. };
  35337. TerminalNodeImpl.prototype.getText = function () {
  35338. return this.symbol.text;
  35339. };
  35340. TerminalNodeImpl.prototype.toString = function () {
  35341. if (this.symbol.type === Token.EOF) {
  35342. return "<EOF>";
  35343. } else {
  35344. return this.symbol.text;
  35345. }
  35346. };
  35347. // Represents a token that was consumed during resynchronization
  35348. // rather than during a valid match operation. For example,
  35349. // we will create this kind of a node during single token insertion
  35350. // and deletion as well as during "consume until error recovery set"
  35351. // upon no viable alternative exceptions.
  35352. function ErrorNodeImpl(token) {
  35353. TerminalNodeImpl.call(this, token);
  35354. return this;
  35355. }
  35356. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  35357. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  35358. ErrorNodeImpl.prototype.isErrorNode = function () {
  35359. return true;
  35360. };
  35361. ErrorNodeImpl.prototype.accept = function (visitor) {
  35362. return visitor.visitErrorNode(this);
  35363. };
  35364. function ParseTreeWalker() {
  35365. return this;
  35366. }
  35367. ParseTreeWalker.prototype.walk = function (listener, t) {
  35368. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  35369. if (errorNode) {
  35370. listener.visitErrorNode(t);
  35371. } else if (t instanceof TerminalNode) {
  35372. listener.visitTerminal(t);
  35373. } else {
  35374. this.enterRule(listener, t);
  35375. for (var i = 0; i < t.getChildCount(); i++) {
  35376. var child = t.getChild(i);
  35377. this.walk(listener, child);
  35378. }
  35379. this.exitRule(listener, t);
  35380. }
  35381. };
  35382. //
  35383. // The discovery of a rule node, involves sending two events: the generic
  35384. // {@link ParseTreeListener//enterEveryRule} and a
  35385. // {@link RuleContext}-specific event. First we trigger the generic and then
  35386. // the rule specific. We to them in reverse order upon finishing the node.
  35387. //
  35388. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  35389. var ctx = r.getRuleContext();
  35390. listener.enterEveryRule(ctx);
  35391. ctx.enterRule(listener);
  35392. };
  35393. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  35394. var ctx = r.getRuleContext();
  35395. ctx.exitRule(listener);
  35396. listener.exitEveryRule(ctx);
  35397. };
  35398. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  35399. exports.RuleNode = RuleNode;
  35400. exports.ErrorNode = ErrorNode;
  35401. exports.TerminalNode = TerminalNode;
  35402. exports.ErrorNodeImpl = ErrorNodeImpl;
  35403. exports.TerminalNodeImpl = TerminalNodeImpl;
  35404. exports.ParseTreeListener = ParseTreeListener;
  35405. exports.ParseTreeVisitor = ParseTreeVisitor;
  35406. exports.ParseTreeWalker = ParseTreeWalker;
  35407. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  35408. /***/ }),
  35409. /***/ "./node_modules/antlr4/tree/Trees.js":
  35410. /*!*******************************************!*\
  35411. !*** ./node_modules/antlr4/tree/Trees.js ***!
  35412. \*******************************************/
  35413. /*! no static exports found */
  35414. /***/ (function(module, exports, __webpack_require__) {
  35415. "use strict";
  35416. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35417. * Use of this file is governed by the BSD 3-clause license that
  35418. * can be found in the LICENSE.txt file in the project root.
  35419. */
  35420. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  35421. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  35422. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  35423. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  35424. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  35425. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  35426. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  35427. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  35428. /** A set of utility routines useful for all kinds of ANTLR trees. */
  35429. function Trees() {}
  35430. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  35431. // node payloads to get the text for the nodes. Detect
  35432. // parse trees and extract data appropriately.
  35433. Trees.toStringTree = function (tree, ruleNames, recog) {
  35434. ruleNames = ruleNames || null;
  35435. recog = recog || null;
  35436. if (recog !== null) {
  35437. ruleNames = recog.ruleNames;
  35438. }
  35439. var s = Trees.getNodeText(tree, ruleNames);
  35440. s = Utils.escapeWhitespace(s, false);
  35441. var c = tree.getChildCount();
  35442. if (c === 0) {
  35443. return s;
  35444. }
  35445. var res = "(" + s + ' ';
  35446. if (c > 0) {
  35447. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  35448. res = res.concat(s);
  35449. }
  35450. for (var i = 1; i < c; i++) {
  35451. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  35452. res = res.concat(' ' + s);
  35453. }
  35454. res = res.concat(")");
  35455. return res;
  35456. };
  35457. Trees.getNodeText = function (t, ruleNames, recog) {
  35458. ruleNames = ruleNames || null;
  35459. recog = recog || null;
  35460. if (recog !== null) {
  35461. ruleNames = recog.ruleNames;
  35462. }
  35463. if (ruleNames !== null) {
  35464. if (t instanceof RuleContext) {
  35465. var altNumber = t.getAltNumber();
  35466. if (altNumber != INVALID_ALT_NUMBER) {
  35467. return ruleNames[t.ruleIndex] + ":" + altNumber;
  35468. }
  35469. return ruleNames[t.ruleIndex];
  35470. } else if (t instanceof ErrorNode) {
  35471. return t.toString();
  35472. } else if (t instanceof TerminalNode) {
  35473. if (t.symbol !== null) {
  35474. return t.symbol.text;
  35475. }
  35476. }
  35477. }
  35478. // no recog for rule names
  35479. var payload = t.getPayload();
  35480. if (payload instanceof Token) {
  35481. return payload.text;
  35482. }
  35483. return t.getPayload().toString();
  35484. };
  35485. // Return ordered list of all children of this node
  35486. Trees.getChildren = function (t) {
  35487. var list = [];
  35488. for (var i = 0; i < t.getChildCount(); i++) {
  35489. list.push(t.getChild(i));
  35490. }
  35491. return list;
  35492. };
  35493. // Return a list of all ancestors of this node. The first node of
  35494. // list is the root and the last is the parent of this node.
  35495. //
  35496. Trees.getAncestors = function (t) {
  35497. var ancestors = [];
  35498. t = t.getParent();
  35499. while (t !== null) {
  35500. ancestors = [t].concat(ancestors);
  35501. t = t.getParent();
  35502. }
  35503. return ancestors;
  35504. };
  35505. Trees.findAllTokenNodes = function (t, ttype) {
  35506. return Trees.findAllNodes(t, ttype, true);
  35507. };
  35508. Trees.findAllRuleNodes = function (t, ruleIndex) {
  35509. return Trees.findAllNodes(t, ruleIndex, false);
  35510. };
  35511. Trees.findAllNodes = function (t, index, findTokens) {
  35512. var nodes = [];
  35513. Trees._findAllNodes(t, index, findTokens, nodes);
  35514. return nodes;
  35515. };
  35516. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  35517. // check this node (the root) first
  35518. if (findTokens && t instanceof TerminalNode) {
  35519. if (t.symbol.type === index) {
  35520. nodes.push(t);
  35521. }
  35522. } else if (!findTokens && t instanceof ParserRuleContext) {
  35523. if (t.ruleIndex === index) {
  35524. nodes.push(t);
  35525. }
  35526. }
  35527. // check children
  35528. for (var i = 0; i < t.getChildCount(); i++) {
  35529. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  35530. }
  35531. };
  35532. Trees.descendants = function (t) {
  35533. var nodes = [t];
  35534. for (var i = 0; i < t.getChildCount(); i++) {
  35535. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  35536. }
  35537. return nodes;
  35538. };
  35539. exports.Trees = Trees;
  35540. /***/ }),
  35541. /***/ "./node_modules/antlr4/tree/index.js":
  35542. /*!*******************************************!*\
  35543. !*** ./node_modules/antlr4/tree/index.js ***!
  35544. \*******************************************/
  35545. /*! no static exports found */
  35546. /***/ (function(module, exports, __webpack_require__) {
  35547. "use strict";
  35548. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35549. * Use of this file is governed by the BSD 3-clause license that
  35550. * can be found in the LICENSE.txt file in the project root.
  35551. */
  35552. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  35553. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  35554. exports.RuleNode = Tree.RuleNode;
  35555. exports.ParseTreeListener = Tree.ParseTreeListener;
  35556. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  35557. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  35558. /***/ }),
  35559. /***/ "./node_modules/decimal.js/decimal.js":
  35560. /*!********************************************!*\
  35561. !*** ./node_modules/decimal.js/decimal.js ***!
  35562. \********************************************/
  35563. /*! no static exports found */
  35564. /***/ (function(module, exports, __webpack_require__) {
  35565. "use strict";
  35566. var __WEBPACK_AMD_DEFINE_RESULT__;
  35567. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  35568. /*! decimal.js v10.0.2 https://github.com/MikeMcl/decimal.js/LICENCE */
  35569. ;(function (globalScope) {
  35570. 'use strict';
  35571. /*
  35572. * decimal.js v10.0.2
  35573. * An arbitrary-precision Decimal type for JavaScript.
  35574. * https://github.com/MikeMcl/decimal.js
  35575. * Copyright (c) 2018 Michael Mclaughlin <M8ch88l@gmail.com>
  35576. * MIT Licence
  35577. */
  35578. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  35579. // The maximum exponent magnitude.
  35580. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  35581. var EXP_LIMIT = 9e15,
  35582. // 0 to 9e15
  35583. // The limit on the value of `precision`, and on the value of the first argument to
  35584. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  35585. MAX_DIGITS = 1e9,
  35586. // 0 to 1e9
  35587. // Base conversion alphabet.
  35588. NUMERALS = '0123456789abcdef',
  35589. // The natural logarithm of 10 (1025 digits).
  35590. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  35591. // Pi (1025 digits).
  35592. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  35593. // The initial configuration properties of the Decimal constructor.
  35594. DEFAULTS = {
  35595. // These values must be integers within the stated ranges (inclusive).
  35596. // Most of these values can be changed at run-time using the `Decimal.config` method.
  35597. // The maximum number of significant digits of the result of a calculation or base conversion.
  35598. // E.g. `Decimal.config({ precision: 20 });`
  35599. precision: 20, // 1 to MAX_DIGITS
  35600. // The rounding mode used when rounding to `precision`.
  35601. //
  35602. // ROUND_UP 0 Away from zero.
  35603. // ROUND_DOWN 1 Towards zero.
  35604. // ROUND_CEIL 2 Towards +Infinity.
  35605. // ROUND_FLOOR 3 Towards -Infinity.
  35606. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  35607. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  35608. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  35609. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  35610. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  35611. //
  35612. // E.g.
  35613. // `Decimal.rounding = 4;`
  35614. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  35615. rounding: 4, // 0 to 8
  35616. // The modulo mode used when calculating the modulus: a mod n.
  35617. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  35618. // The remainder (r) is calculated as: r = a - n * q.
  35619. //
  35620. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  35621. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  35622. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  35623. // HALF_EVEN 6 The IEEE 754 remainder function.
  35624. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  35625. //
  35626. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  35627. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  35628. // be used, but they may not give useful results.
  35629. modulo: 1, // 0 to 9
  35630. // The exponent value at and beneath which `toString` returns exponential notation.
  35631. // JavaScript numbers: -7
  35632. toExpNeg: -7, // 0 to -EXP_LIMIT
  35633. // The exponent value at and above which `toString` returns exponential notation.
  35634. // JavaScript numbers: 21
  35635. toExpPos: 21, // 0 to EXP_LIMIT
  35636. // The minimum exponent value, beneath which underflow to zero occurs.
  35637. // JavaScript numbers: -324 (5e-324)
  35638. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  35639. // The maximum exponent value, above which overflow to Infinity occurs.
  35640. // JavaScript numbers: 308 (1.7976931348623157e+308)
  35641. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  35642. // Whether to use cryptographically-secure random number generation, if available.
  35643. crypto: false // true/false
  35644. },
  35645. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  35646. Decimal,
  35647. inexact,
  35648. noConflict,
  35649. quadrant,
  35650. external = true,
  35651. decimalError = '[DecimalError] ',
  35652. invalidArgument = decimalError + 'Invalid argument: ',
  35653. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  35654. cryptoUnavailable = decimalError + 'crypto unavailable',
  35655. mathfloor = Math.floor,
  35656. mathpow = Math.pow,
  35657. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  35658. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  35659. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  35660. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  35661. BASE = 1e7,
  35662. LOG_BASE = 7,
  35663. MAX_SAFE_INTEGER = 9007199254740991,
  35664. LN10_PRECISION = LN10.length - 1,
  35665. PI_PRECISION = PI.length - 1,
  35666. // Decimal.prototype object
  35667. P = { name: '[object Decimal]' };
  35668. // Decimal prototype methods
  35669. /*
  35670. * absoluteValue abs
  35671. * ceil
  35672. * comparedTo cmp
  35673. * cosine cos
  35674. * cubeRoot cbrt
  35675. * decimalPlaces dp
  35676. * dividedBy div
  35677. * dividedToIntegerBy divToInt
  35678. * equals eq
  35679. * floor
  35680. * greaterThan gt
  35681. * greaterThanOrEqualTo gte
  35682. * hyperbolicCosine cosh
  35683. * hyperbolicSine sinh
  35684. * hyperbolicTangent tanh
  35685. * inverseCosine acos
  35686. * inverseHyperbolicCosine acosh
  35687. * inverseHyperbolicSine asinh
  35688. * inverseHyperbolicTangent atanh
  35689. * inverseSine asin
  35690. * inverseTangent atan
  35691. * isFinite
  35692. * isInteger isInt
  35693. * isNaN
  35694. * isNegative isNeg
  35695. * isPositive isPos
  35696. * isZero
  35697. * lessThan lt
  35698. * lessThanOrEqualTo lte
  35699. * logarithm log
  35700. * [maximum] [max]
  35701. * [minimum] [min]
  35702. * minus sub
  35703. * modulo mod
  35704. * naturalExponential exp
  35705. * naturalLogarithm ln
  35706. * negated neg
  35707. * plus add
  35708. * precision sd
  35709. * round
  35710. * sine sin
  35711. * squareRoot sqrt
  35712. * tangent tan
  35713. * times mul
  35714. * toBinary
  35715. * toDecimalPlaces toDP
  35716. * toExponential
  35717. * toFixed
  35718. * toFraction
  35719. * toHexadecimal toHex
  35720. * toNearest
  35721. * toNumber
  35722. * toOctal
  35723. * toPower pow
  35724. * toPrecision
  35725. * toSignificantDigits toSD
  35726. * toString
  35727. * truncated trunc
  35728. * valueOf toJSON
  35729. */
  35730. /*
  35731. * Return a new Decimal whose value is the absolute value of this Decimal.
  35732. *
  35733. */
  35734. P.absoluteValue = P.abs = function () {
  35735. var x = new this.constructor(this);
  35736. if (x.s < 0) x.s = 1;
  35737. return finalise(x);
  35738. };
  35739. /*
  35740. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  35741. * direction of positive Infinity.
  35742. *
  35743. */
  35744. P.ceil = function () {
  35745. return finalise(new this.constructor(this), this.e + 1, 2);
  35746. };
  35747. /*
  35748. * Return
  35749. * 1 if the value of this Decimal is greater than the value of `y`,
  35750. * -1 if the value of this Decimal is less than the value of `y`,
  35751. * 0 if they have the same value,
  35752. * NaN if the value of either Decimal is NaN.
  35753. *
  35754. */
  35755. P.comparedTo = P.cmp = function (y) {
  35756. var i,
  35757. j,
  35758. xdL,
  35759. ydL,
  35760. x = this,
  35761. xd = x.d,
  35762. yd = (y = new x.constructor(y)).d,
  35763. xs = x.s,
  35764. ys = y.s;
  35765. // Either NaN or ±Infinity?
  35766. if (!xd || !yd) {
  35767. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  35768. }
  35769. // Either zero?
  35770. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  35771. // Signs differ?
  35772. if (xs !== ys) return xs;
  35773. // Compare exponents.
  35774. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  35775. xdL = xd.length;
  35776. ydL = yd.length;
  35777. // Compare digit by digit.
  35778. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  35779. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  35780. }
  35781. // Compare lengths.
  35782. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  35783. };
  35784. /*
  35785. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  35786. *
  35787. * Domain: [-Infinity, Infinity]
  35788. * Range: [-1, 1]
  35789. *
  35790. * cos(0) = 1
  35791. * cos(-0) = 1
  35792. * cos(Infinity) = NaN
  35793. * cos(-Infinity) = NaN
  35794. * cos(NaN) = NaN
  35795. *
  35796. */
  35797. P.cosine = P.cos = function () {
  35798. var pr,
  35799. rm,
  35800. x = this,
  35801. Ctor = x.constructor;
  35802. if (!x.d) return new Ctor(NaN);
  35803. // cos(0) = cos(-0) = 1
  35804. if (!x.d[0]) return new Ctor(1);
  35805. pr = Ctor.precision;
  35806. rm = Ctor.rounding;
  35807. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  35808. Ctor.rounding = 1;
  35809. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  35810. Ctor.precision = pr;
  35811. Ctor.rounding = rm;
  35812. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  35813. };
  35814. /*
  35815. *
  35816. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  35817. * `precision` significant digits using rounding mode `rounding`.
  35818. *
  35819. * cbrt(0) = 0
  35820. * cbrt(-0) = -0
  35821. * cbrt(1) = 1
  35822. * cbrt(-1) = -1
  35823. * cbrt(N) = N
  35824. * cbrt(-I) = -I
  35825. * cbrt(I) = I
  35826. *
  35827. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  35828. *
  35829. */
  35830. P.cubeRoot = P.cbrt = function () {
  35831. var e,
  35832. m,
  35833. n,
  35834. r,
  35835. rep,
  35836. s,
  35837. sd,
  35838. t,
  35839. t3,
  35840. t3plusx,
  35841. x = this,
  35842. Ctor = x.constructor;
  35843. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  35844. external = false;
  35845. // Initial estimate.
  35846. s = x.s * Math.pow(x.s * x, 1 / 3);
  35847. // Math.cbrt underflow/overflow?
  35848. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  35849. if (!s || Math.abs(s) == 1 / 0) {
  35850. n = digitsToString(x.d);
  35851. e = x.e;
  35852. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  35853. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  35854. s = Math.pow(n, 1 / 3);
  35855. // Rarely, e may be one less than the result exponent value.
  35856. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  35857. if (s == 1 / 0) {
  35858. n = '5e' + e;
  35859. } else {
  35860. n = s.toExponential();
  35861. n = n.slice(0, n.indexOf('e') + 1) + e;
  35862. }
  35863. r = new Ctor(n);
  35864. r.s = x.s;
  35865. } else {
  35866. r = new Ctor(s.toString());
  35867. }
  35868. sd = (e = Ctor.precision) + 3;
  35869. // Halley's method.
  35870. // TODO? Compare Newton's method.
  35871. for (;;) {
  35872. t = r;
  35873. t3 = t.times(t).times(t);
  35874. t3plusx = t3.plus(x);
  35875. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  35876. // TODO? Replace with for-loop and checkRoundingDigits.
  35877. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  35878. n = n.slice(sd - 3, sd + 1);
  35879. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  35880. // , i.e. approaching a rounding boundary, continue the iteration.
  35881. if (n == '9999' || !rep && n == '4999') {
  35882. // On the first iteration only, check to see if rounding up gives the exact result as the
  35883. // nines may infinitely repeat.
  35884. if (!rep) {
  35885. finalise(t, e + 1, 0);
  35886. if (t.times(t).times(t).eq(x)) {
  35887. r = t;
  35888. break;
  35889. }
  35890. }
  35891. sd += 4;
  35892. rep = 1;
  35893. } else {
  35894. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  35895. // If not, then there are further digits and m will be truthy.
  35896. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  35897. // Truncate to the first rounding digit.
  35898. finalise(r, e + 1, 1);
  35899. m = !r.times(r).times(r).eq(x);
  35900. }
  35901. break;
  35902. }
  35903. }
  35904. }
  35905. external = true;
  35906. return finalise(r, e, Ctor.rounding, m);
  35907. };
  35908. /*
  35909. * Return the number of decimal places of the value of this Decimal.
  35910. *
  35911. */
  35912. P.decimalPlaces = P.dp = function () {
  35913. var w,
  35914. d = this.d,
  35915. n = NaN;
  35916. if (d) {
  35917. w = d.length - 1;
  35918. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  35919. // Subtract the number of trailing zeros of the last word.
  35920. w = d[w];
  35921. if (w) for (; w % 10 == 0; w /= 10) {
  35922. n--;
  35923. }if (n < 0) n = 0;
  35924. }
  35925. return n;
  35926. };
  35927. /*
  35928. * n / 0 = I
  35929. * n / N = N
  35930. * n / I = 0
  35931. * 0 / n = 0
  35932. * 0 / 0 = N
  35933. * 0 / N = N
  35934. * 0 / I = 0
  35935. * N / n = N
  35936. * N / 0 = N
  35937. * N / N = N
  35938. * N / I = N
  35939. * I / n = I
  35940. * I / 0 = I
  35941. * I / N = N
  35942. * I / I = N
  35943. *
  35944. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  35945. * `precision` significant digits using rounding mode `rounding`.
  35946. *
  35947. */
  35948. P.dividedBy = P.div = function (y) {
  35949. return divide(this, new this.constructor(y));
  35950. };
  35951. /*
  35952. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  35953. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  35954. *
  35955. */
  35956. P.dividedToIntegerBy = P.divToInt = function (y) {
  35957. var x = this,
  35958. Ctor = x.constructor;
  35959. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  35960. };
  35961. /*
  35962. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  35963. *
  35964. */
  35965. P.equals = P.eq = function (y) {
  35966. return this.cmp(y) === 0;
  35967. };
  35968. /*
  35969. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  35970. * direction of negative Infinity.
  35971. *
  35972. */
  35973. P.floor = function () {
  35974. return finalise(new this.constructor(this), this.e + 1, 3);
  35975. };
  35976. /*
  35977. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  35978. * false.
  35979. *
  35980. */
  35981. P.greaterThan = P.gt = function (y) {
  35982. return this.cmp(y) > 0;
  35983. };
  35984. /*
  35985. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  35986. * otherwise return false.
  35987. *
  35988. */
  35989. P.greaterThanOrEqualTo = P.gte = function (y) {
  35990. var k = this.cmp(y);
  35991. return k == 1 || k === 0;
  35992. };
  35993. /*
  35994. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  35995. * Decimal.
  35996. *
  35997. * Domain: [-Infinity, Infinity]
  35998. * Range: [1, Infinity]
  35999. *
  36000. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  36001. *
  36002. * cosh(0) = 1
  36003. * cosh(-0) = 1
  36004. * cosh(Infinity) = Infinity
  36005. * cosh(-Infinity) = Infinity
  36006. * cosh(NaN) = NaN
  36007. *
  36008. * x time taken (ms) result
  36009. * 1000 9 9.8503555700852349694e+433
  36010. * 10000 25 4.4034091128314607936e+4342
  36011. * 100000 171 1.4033316802130615897e+43429
  36012. * 1000000 3817 1.5166076984010437725e+434294
  36013. * 10000000 abandoned after 2 minute wait
  36014. *
  36015. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  36016. *
  36017. */
  36018. P.hyperbolicCosine = P.cosh = function () {
  36019. var k,
  36020. n,
  36021. pr,
  36022. rm,
  36023. len,
  36024. x = this,
  36025. Ctor = x.constructor,
  36026. one = new Ctor(1);
  36027. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  36028. if (x.isZero()) return one;
  36029. pr = Ctor.precision;
  36030. rm = Ctor.rounding;
  36031. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  36032. Ctor.rounding = 1;
  36033. len = x.d.length;
  36034. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  36035. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  36036. // Estimate the optimum number of times to use the argument reduction.
  36037. // TODO? Estimation reused from cosine() and may not be optimal here.
  36038. if (len < 32) {
  36039. k = Math.ceil(len / 3);
  36040. n = Math.pow(4, -k).toString();
  36041. } else {
  36042. k = 16;
  36043. n = '2.3283064365386962890625e-10';
  36044. }
  36045. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  36046. // Reverse argument reduction
  36047. var cosh2_x,
  36048. i = k,
  36049. d8 = new Ctor(8);
  36050. for (; i--;) {
  36051. cosh2_x = x.times(x);
  36052. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  36053. }
  36054. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  36055. };
  36056. /*
  36057. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  36058. * Decimal.
  36059. *
  36060. * Domain: [-Infinity, Infinity]
  36061. * Range: [-Infinity, Infinity]
  36062. *
  36063. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  36064. *
  36065. * sinh(0) = 0
  36066. * sinh(-0) = -0
  36067. * sinh(Infinity) = Infinity
  36068. * sinh(-Infinity) = -Infinity
  36069. * sinh(NaN) = NaN
  36070. *
  36071. * x time taken (ms)
  36072. * 10 2 ms
  36073. * 100 5 ms
  36074. * 1000 14 ms
  36075. * 10000 82 ms
  36076. * 100000 886 ms 1.4033316802130615897e+43429
  36077. * 200000 2613 ms
  36078. * 300000 5407 ms
  36079. * 400000 8824 ms
  36080. * 500000 13026 ms 8.7080643612718084129e+217146
  36081. * 1000000 48543 ms
  36082. *
  36083. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  36084. *
  36085. */
  36086. P.hyperbolicSine = P.sinh = function () {
  36087. var k,
  36088. pr,
  36089. rm,
  36090. len,
  36091. x = this,
  36092. Ctor = x.constructor;
  36093. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  36094. pr = Ctor.precision;
  36095. rm = Ctor.rounding;
  36096. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  36097. Ctor.rounding = 1;
  36098. len = x.d.length;
  36099. if (len < 3) {
  36100. x = taylorSeries(Ctor, 2, x, x, true);
  36101. } else {
  36102. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  36103. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  36104. // 3 multiplications and 1 addition
  36105. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  36106. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  36107. // 4 multiplications and 2 additions
  36108. // Estimate the optimum number of times to use the argument reduction.
  36109. k = 1.4 * Math.sqrt(len);
  36110. k = k > 16 ? 16 : k | 0;
  36111. x = x.times(Math.pow(5, -k));
  36112. x = taylorSeries(Ctor, 2, x, x, true);
  36113. // Reverse argument reduction
  36114. var sinh2_x,
  36115. d5 = new Ctor(5),
  36116. d16 = new Ctor(16),
  36117. d20 = new Ctor(20);
  36118. for (; k--;) {
  36119. sinh2_x = x.times(x);
  36120. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  36121. }
  36122. }
  36123. Ctor.precision = pr;
  36124. Ctor.rounding = rm;
  36125. return finalise(x, pr, rm, true);
  36126. };
  36127. /*
  36128. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  36129. * Decimal.
  36130. *
  36131. * Domain: [-Infinity, Infinity]
  36132. * Range: [-1, 1]
  36133. *
  36134. * tanh(x) = sinh(x) / cosh(x)
  36135. *
  36136. * tanh(0) = 0
  36137. * tanh(-0) = -0
  36138. * tanh(Infinity) = 1
  36139. * tanh(-Infinity) = -1
  36140. * tanh(NaN) = NaN
  36141. *
  36142. */
  36143. P.hyperbolicTangent = P.tanh = function () {
  36144. var pr,
  36145. rm,
  36146. x = this,
  36147. Ctor = x.constructor;
  36148. if (!x.isFinite()) return new Ctor(x.s);
  36149. if (x.isZero()) return new Ctor(x);
  36150. pr = Ctor.precision;
  36151. rm = Ctor.rounding;
  36152. Ctor.precision = pr + 7;
  36153. Ctor.rounding = 1;
  36154. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  36155. };
  36156. /*
  36157. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  36158. * this Decimal.
  36159. *
  36160. * Domain: [-1, 1]
  36161. * Range: [0, pi]
  36162. *
  36163. * acos(x) = pi/2 - asin(x)
  36164. *
  36165. * acos(0) = pi/2
  36166. * acos(-0) = pi/2
  36167. * acos(1) = 0
  36168. * acos(-1) = pi
  36169. * acos(1/2) = pi/3
  36170. * acos(-1/2) = 2*pi/3
  36171. * acos(|x| > 1) = NaN
  36172. * acos(NaN) = NaN
  36173. *
  36174. */
  36175. P.inverseCosine = P.acos = function () {
  36176. var halfPi,
  36177. x = this,
  36178. Ctor = x.constructor,
  36179. k = x.abs().cmp(1),
  36180. pr = Ctor.precision,
  36181. rm = Ctor.rounding;
  36182. if (k !== -1) {
  36183. return k === 0
  36184. // |x| is 1
  36185. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  36186. // |x| > 1 or x is NaN
  36187. : new Ctor(NaN);
  36188. }
  36189. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  36190. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  36191. Ctor.precision = pr + 6;
  36192. Ctor.rounding = 1;
  36193. x = x.asin();
  36194. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  36195. Ctor.precision = pr;
  36196. Ctor.rounding = rm;
  36197. return halfPi.minus(x);
  36198. };
  36199. /*
  36200. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  36201. * value of this Decimal.
  36202. *
  36203. * Domain: [1, Infinity]
  36204. * Range: [0, Infinity]
  36205. *
  36206. * acosh(x) = ln(x + sqrt(x^2 - 1))
  36207. *
  36208. * acosh(x < 1) = NaN
  36209. * acosh(NaN) = NaN
  36210. * acosh(Infinity) = Infinity
  36211. * acosh(-Infinity) = NaN
  36212. * acosh(0) = NaN
  36213. * acosh(-0) = NaN
  36214. * acosh(1) = 0
  36215. * acosh(-1) = NaN
  36216. *
  36217. */
  36218. P.inverseHyperbolicCosine = P.acosh = function () {
  36219. var pr,
  36220. rm,
  36221. x = this,
  36222. Ctor = x.constructor;
  36223. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  36224. if (!x.isFinite()) return new Ctor(x);
  36225. pr = Ctor.precision;
  36226. rm = Ctor.rounding;
  36227. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  36228. Ctor.rounding = 1;
  36229. external = false;
  36230. x = x.times(x).minus(1).sqrt().plus(x);
  36231. external = true;
  36232. Ctor.precision = pr;
  36233. Ctor.rounding = rm;
  36234. return x.ln();
  36235. };
  36236. /*
  36237. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  36238. * of this Decimal.
  36239. *
  36240. * Domain: [-Infinity, Infinity]
  36241. * Range: [-Infinity, Infinity]
  36242. *
  36243. * asinh(x) = ln(x + sqrt(x^2 + 1))
  36244. *
  36245. * asinh(NaN) = NaN
  36246. * asinh(Infinity) = Infinity
  36247. * asinh(-Infinity) = -Infinity
  36248. * asinh(0) = 0
  36249. * asinh(-0) = -0
  36250. *
  36251. */
  36252. P.inverseHyperbolicSine = P.asinh = function () {
  36253. var pr,
  36254. rm,
  36255. x = this,
  36256. Ctor = x.constructor;
  36257. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  36258. pr = Ctor.precision;
  36259. rm = Ctor.rounding;
  36260. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  36261. Ctor.rounding = 1;
  36262. external = false;
  36263. x = x.times(x).plus(1).sqrt().plus(x);
  36264. external = true;
  36265. Ctor.precision = pr;
  36266. Ctor.rounding = rm;
  36267. return x.ln();
  36268. };
  36269. /*
  36270. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  36271. * value of this Decimal.
  36272. *
  36273. * Domain: [-1, 1]
  36274. * Range: [-Infinity, Infinity]
  36275. *
  36276. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  36277. *
  36278. * atanh(|x| > 1) = NaN
  36279. * atanh(NaN) = NaN
  36280. * atanh(Infinity) = NaN
  36281. * atanh(-Infinity) = NaN
  36282. * atanh(0) = 0
  36283. * atanh(-0) = -0
  36284. * atanh(1) = Infinity
  36285. * atanh(-1) = -Infinity
  36286. *
  36287. */
  36288. P.inverseHyperbolicTangent = P.atanh = function () {
  36289. var pr,
  36290. rm,
  36291. wpr,
  36292. xsd,
  36293. x = this,
  36294. Ctor = x.constructor;
  36295. if (!x.isFinite()) return new Ctor(NaN);
  36296. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  36297. pr = Ctor.precision;
  36298. rm = Ctor.rounding;
  36299. xsd = x.sd();
  36300. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  36301. Ctor.precision = wpr = xsd - x.e;
  36302. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  36303. Ctor.precision = pr + 4;
  36304. Ctor.rounding = 1;
  36305. x = x.ln();
  36306. Ctor.precision = pr;
  36307. Ctor.rounding = rm;
  36308. return x.times(0.5);
  36309. };
  36310. /*
  36311. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  36312. * Decimal.
  36313. *
  36314. * Domain: [-Infinity, Infinity]
  36315. * Range: [-pi/2, pi/2]
  36316. *
  36317. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  36318. *
  36319. * asin(0) = 0
  36320. * asin(-0) = -0
  36321. * asin(1/2) = pi/6
  36322. * asin(-1/2) = -pi/6
  36323. * asin(1) = pi/2
  36324. * asin(-1) = -pi/2
  36325. * asin(|x| > 1) = NaN
  36326. * asin(NaN) = NaN
  36327. *
  36328. * TODO? Compare performance of Taylor series.
  36329. *
  36330. */
  36331. P.inverseSine = P.asin = function () {
  36332. var halfPi,
  36333. k,
  36334. pr,
  36335. rm,
  36336. x = this,
  36337. Ctor = x.constructor;
  36338. if (x.isZero()) return new Ctor(x);
  36339. k = x.abs().cmp(1);
  36340. pr = Ctor.precision;
  36341. rm = Ctor.rounding;
  36342. if (k !== -1) {
  36343. // |x| is 1
  36344. if (k === 0) {
  36345. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  36346. halfPi.s = x.s;
  36347. return halfPi;
  36348. }
  36349. // |x| > 1 or x is NaN
  36350. return new Ctor(NaN);
  36351. }
  36352. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  36353. Ctor.precision = pr + 6;
  36354. Ctor.rounding = 1;
  36355. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  36356. Ctor.precision = pr;
  36357. Ctor.rounding = rm;
  36358. return x.times(2);
  36359. };
  36360. /*
  36361. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  36362. * of this Decimal.
  36363. *
  36364. * Domain: [-Infinity, Infinity]
  36365. * Range: [-pi/2, pi/2]
  36366. *
  36367. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  36368. *
  36369. * atan(0) = 0
  36370. * atan(-0) = -0
  36371. * atan(1) = pi/4
  36372. * atan(-1) = -pi/4
  36373. * atan(Infinity) = pi/2
  36374. * atan(-Infinity) = -pi/2
  36375. * atan(NaN) = NaN
  36376. *
  36377. */
  36378. P.inverseTangent = P.atan = function () {
  36379. var i,
  36380. j,
  36381. k,
  36382. n,
  36383. px,
  36384. t,
  36385. r,
  36386. wpr,
  36387. x2,
  36388. x = this,
  36389. Ctor = x.constructor,
  36390. pr = Ctor.precision,
  36391. rm = Ctor.rounding;
  36392. if (!x.isFinite()) {
  36393. if (!x.s) return new Ctor(NaN);
  36394. if (pr + 4 <= PI_PRECISION) {
  36395. r = getPi(Ctor, pr + 4, rm).times(0.5);
  36396. r.s = x.s;
  36397. return r;
  36398. }
  36399. } else if (x.isZero()) {
  36400. return new Ctor(x);
  36401. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  36402. r = getPi(Ctor, pr + 4, rm).times(0.25);
  36403. r.s = x.s;
  36404. return r;
  36405. }
  36406. Ctor.precision = wpr = pr + 10;
  36407. Ctor.rounding = 1;
  36408. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  36409. // Argument reduction
  36410. // Ensure |x| < 0.42
  36411. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  36412. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  36413. for (i = k; i; --i) {
  36414. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  36415. }external = false;
  36416. j = Math.ceil(wpr / LOG_BASE);
  36417. n = 1;
  36418. x2 = x.times(x);
  36419. r = new Ctor(x);
  36420. px = x;
  36421. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  36422. for (; i !== -1;) {
  36423. px = px.times(x2);
  36424. t = r.minus(px.div(n += 2));
  36425. px = px.times(x2);
  36426. r = t.plus(px.div(n += 2));
  36427. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  36428. }
  36429. if (k) r = r.times(2 << k - 1);
  36430. external = true;
  36431. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  36432. };
  36433. /*
  36434. * Return true if the value of this Decimal is a finite number, otherwise return false.
  36435. *
  36436. */
  36437. P.isFinite = function () {
  36438. return !!this.d;
  36439. };
  36440. /*
  36441. * Return true if the value of this Decimal is an integer, otherwise return false.
  36442. *
  36443. */
  36444. P.isInteger = P.isInt = function () {
  36445. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  36446. };
  36447. /*
  36448. * Return true if the value of this Decimal is NaN, otherwise return false.
  36449. *
  36450. */
  36451. P.isNaN = function () {
  36452. return !this.s;
  36453. };
  36454. /*
  36455. * Return true if the value of this Decimal is negative, otherwise return false.
  36456. *
  36457. */
  36458. P.isNegative = P.isNeg = function () {
  36459. return this.s < 0;
  36460. };
  36461. /*
  36462. * Return true if the value of this Decimal is positive, otherwise return false.
  36463. *
  36464. */
  36465. P.isPositive = P.isPos = function () {
  36466. return this.s > 0;
  36467. };
  36468. /*
  36469. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  36470. *
  36471. */
  36472. P.isZero = function () {
  36473. return !!this.d && this.d[0] === 0;
  36474. };
  36475. /*
  36476. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  36477. *
  36478. */
  36479. P.lessThan = P.lt = function (y) {
  36480. return this.cmp(y) < 0;
  36481. };
  36482. /*
  36483. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  36484. *
  36485. */
  36486. P.lessThanOrEqualTo = P.lte = function (y) {
  36487. return this.cmp(y) < 1;
  36488. };
  36489. /*
  36490. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  36491. * significant digits using rounding mode `rounding`.
  36492. *
  36493. * If no base is specified, return log[10](arg).
  36494. *
  36495. * log[base](arg) = ln(arg) / ln(base)
  36496. *
  36497. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  36498. * otherwise:
  36499. *
  36500. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  36501. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  36502. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  36503. *
  36504. * log[-b](a) = NaN
  36505. * log[0](a) = NaN
  36506. * log[1](a) = NaN
  36507. * log[NaN](a) = NaN
  36508. * log[Infinity](a) = NaN
  36509. * log[b](0) = -Infinity
  36510. * log[b](-0) = -Infinity
  36511. * log[b](-a) = NaN
  36512. * log[b](1) = 0
  36513. * log[b](Infinity) = Infinity
  36514. * log[b](NaN) = NaN
  36515. *
  36516. * [base] {number|string|Decimal} The base of the logarithm.
  36517. *
  36518. */
  36519. P.logarithm = P.log = function (base) {
  36520. var isBase10,
  36521. d,
  36522. denominator,
  36523. k,
  36524. inf,
  36525. num,
  36526. sd,
  36527. r,
  36528. arg = this,
  36529. Ctor = arg.constructor,
  36530. pr = Ctor.precision,
  36531. rm = Ctor.rounding,
  36532. guard = 5;
  36533. // Default base is 10.
  36534. if (base == null) {
  36535. base = new Ctor(10);
  36536. isBase10 = true;
  36537. } else {
  36538. base = new Ctor(base);
  36539. d = base.d;
  36540. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  36541. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  36542. isBase10 = base.eq(10);
  36543. }
  36544. d = arg.d;
  36545. // Is arg negative, non-finite, 0 or 1?
  36546. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  36547. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  36548. }
  36549. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  36550. // integer power of 10.
  36551. if (isBase10) {
  36552. if (d.length > 1) {
  36553. inf = true;
  36554. } else {
  36555. for (k = d[0]; k % 10 === 0;) {
  36556. k /= 10;
  36557. }inf = k !== 1;
  36558. }
  36559. }
  36560. external = false;
  36561. sd = pr + guard;
  36562. num = naturalLogarithm(arg, sd);
  36563. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  36564. // The result will have 5 rounding digits.
  36565. r = divide(num, denominator, sd, 1);
  36566. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  36567. // calculate 10 further digits.
  36568. //
  36569. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  36570. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  36571. // further digits, the last 14 are nines, round up and assume the result is exact.
  36572. // Also assume the result is exact if the last 14 are zero.
  36573. //
  36574. // Example of a result that will be incorrectly rounded:
  36575. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  36576. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  36577. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  36578. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  36579. // place is still 2.6.
  36580. if (checkRoundingDigits(r.d, k = pr, rm)) {
  36581. do {
  36582. sd += 10;
  36583. num = naturalLogarithm(arg, sd);
  36584. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  36585. r = divide(num, denominator, sd, 1);
  36586. if (!inf) {
  36587. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  36588. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  36589. r = finalise(r, pr + 1, 0);
  36590. }
  36591. break;
  36592. }
  36593. } while (checkRoundingDigits(r.d, k += 10, rm));
  36594. }
  36595. external = true;
  36596. return finalise(r, pr, rm);
  36597. };
  36598. /*
  36599. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  36600. *
  36601. * arguments {number|string|Decimal}
  36602. *
  36603. P.max = function () {
  36604. Array.prototype.push.call(arguments, this);
  36605. return maxOrMin(this.constructor, arguments, 'lt');
  36606. };
  36607. */
  36608. /*
  36609. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  36610. *
  36611. * arguments {number|string|Decimal}
  36612. *
  36613. P.min = function () {
  36614. Array.prototype.push.call(arguments, this);
  36615. return maxOrMin(this.constructor, arguments, 'gt');
  36616. };
  36617. */
  36618. /*
  36619. * n - 0 = n
  36620. * n - N = N
  36621. * n - I = -I
  36622. * 0 - n = -n
  36623. * 0 - 0 = 0
  36624. * 0 - N = N
  36625. * 0 - I = -I
  36626. * N - n = N
  36627. * N - 0 = N
  36628. * N - N = N
  36629. * N - I = N
  36630. * I - n = I
  36631. * I - 0 = I
  36632. * I - N = N
  36633. * I - I = N
  36634. *
  36635. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  36636. * significant digits using rounding mode `rounding`.
  36637. *
  36638. */
  36639. P.minus = P.sub = function (y) {
  36640. var d,
  36641. e,
  36642. i,
  36643. j,
  36644. k,
  36645. len,
  36646. pr,
  36647. rm,
  36648. xd,
  36649. xe,
  36650. xLTy,
  36651. yd,
  36652. x = this,
  36653. Ctor = x.constructor;
  36654. y = new Ctor(y);
  36655. // If either is not finite...
  36656. if (!x.d || !y.d) {
  36657. // Return NaN if either is NaN.
  36658. if (!x.s || !y.s) y = new Ctor(NaN);
  36659. // Return y negated if x is finite and y is ±Infinity.
  36660. else if (x.d) y.s = -y.s;
  36661. // Return x if y is finite and x is ±Infinity.
  36662. // Return x if both are ±Infinity with different signs.
  36663. // Return NaN if both are ±Infinity with the same sign.
  36664. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  36665. return y;
  36666. }
  36667. // If signs differ...
  36668. if (x.s != y.s) {
  36669. y.s = -y.s;
  36670. return x.plus(y);
  36671. }
  36672. xd = x.d;
  36673. yd = y.d;
  36674. pr = Ctor.precision;
  36675. rm = Ctor.rounding;
  36676. // If either is zero...
  36677. if (!xd[0] || !yd[0]) {
  36678. // Return y negated if x is zero and y is non-zero.
  36679. if (yd[0]) y.s = -y.s;
  36680. // Return x if y is zero and x is non-zero.
  36681. else if (xd[0]) y = new Ctor(x);
  36682. // Return zero if both are zero.
  36683. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  36684. else return new Ctor(rm === 3 ? -0 : 0);
  36685. return external ? finalise(y, pr, rm) : y;
  36686. }
  36687. // x and y are finite, non-zero numbers with the same sign.
  36688. // Calculate base 1e7 exponents.
  36689. e = mathfloor(y.e / LOG_BASE);
  36690. xe = mathfloor(x.e / LOG_BASE);
  36691. xd = xd.slice();
  36692. k = xe - e;
  36693. // If base 1e7 exponents differ...
  36694. if (k) {
  36695. xLTy = k < 0;
  36696. if (xLTy) {
  36697. d = xd;
  36698. k = -k;
  36699. len = yd.length;
  36700. } else {
  36701. d = yd;
  36702. e = xe;
  36703. len = xd.length;
  36704. }
  36705. // Numbers with massively different exponents would result in a very high number of
  36706. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  36707. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  36708. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  36709. if (k > i) {
  36710. k = i;
  36711. d.length = 1;
  36712. }
  36713. // Prepend zeros to equalise exponents.
  36714. d.reverse();
  36715. for (i = k; i--;) {
  36716. d.push(0);
  36717. }d.reverse();
  36718. // Base 1e7 exponents equal.
  36719. } else {
  36720. // Check digits to determine which is the bigger number.
  36721. i = xd.length;
  36722. len = yd.length;
  36723. xLTy = i < len;
  36724. if (xLTy) len = i;
  36725. for (i = 0; i < len; i++) {
  36726. if (xd[i] != yd[i]) {
  36727. xLTy = xd[i] < yd[i];
  36728. break;
  36729. }
  36730. }
  36731. k = 0;
  36732. }
  36733. if (xLTy) {
  36734. d = xd;
  36735. xd = yd;
  36736. yd = d;
  36737. y.s = -y.s;
  36738. }
  36739. len = xd.length;
  36740. // Append zeros to `xd` if shorter.
  36741. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  36742. for (i = yd.length - len; i > 0; --i) {
  36743. xd[len++] = 0;
  36744. } // Subtract yd from xd.
  36745. for (i = yd.length; i > k;) {
  36746. if (xd[--i] < yd[i]) {
  36747. for (j = i; j && xd[--j] === 0;) {
  36748. xd[j] = BASE - 1;
  36749. }--xd[j];
  36750. xd[i] += BASE;
  36751. }
  36752. xd[i] -= yd[i];
  36753. }
  36754. // Remove trailing zeros.
  36755. for (; xd[--len] === 0;) {
  36756. xd.pop();
  36757. } // Remove leading zeros and adjust exponent accordingly.
  36758. for (; xd[0] === 0; xd.shift()) {
  36759. --e;
  36760. } // Zero?
  36761. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  36762. y.d = xd;
  36763. y.e = getBase10Exponent(xd, e);
  36764. return external ? finalise(y, pr, rm) : y;
  36765. };
  36766. /*
  36767. * n % 0 = N
  36768. * n % N = N
  36769. * n % I = n
  36770. * 0 % n = 0
  36771. * -0 % n = -0
  36772. * 0 % 0 = N
  36773. * 0 % N = N
  36774. * 0 % I = 0
  36775. * N % n = N
  36776. * N % 0 = N
  36777. * N % N = N
  36778. * N % I = N
  36779. * I % n = N
  36780. * I % 0 = N
  36781. * I % N = N
  36782. * I % I = N
  36783. *
  36784. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  36785. * `precision` significant digits using rounding mode `rounding`.
  36786. *
  36787. * The result depends on the modulo mode.
  36788. *
  36789. */
  36790. P.modulo = P.mod = function (y) {
  36791. var q,
  36792. x = this,
  36793. Ctor = x.constructor;
  36794. y = new Ctor(y);
  36795. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  36796. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  36797. // Return x if y is ±Infinity or x is ±0.
  36798. if (!y.d || x.d && !x.d[0]) {
  36799. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  36800. }
  36801. // Prevent rounding of intermediate calculations.
  36802. external = false;
  36803. if (Ctor.modulo == 9) {
  36804. // Euclidian division: q = sign(y) * floor(x / abs(y))
  36805. // result = x - q * y where 0 <= result < abs(y)
  36806. q = divide(x, y.abs(), 0, 3, 1);
  36807. q.s *= y.s;
  36808. } else {
  36809. q = divide(x, y, 0, Ctor.modulo, 1);
  36810. }
  36811. q = q.times(y);
  36812. external = true;
  36813. return x.minus(q);
  36814. };
  36815. /*
  36816. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  36817. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  36818. * significant digits using rounding mode `rounding`.
  36819. *
  36820. */
  36821. P.naturalExponential = P.exp = function () {
  36822. return naturalExponential(this);
  36823. };
  36824. /*
  36825. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  36826. * rounded to `precision` significant digits using rounding mode `rounding`.
  36827. *
  36828. */
  36829. P.naturalLogarithm = P.ln = function () {
  36830. return naturalLogarithm(this);
  36831. };
  36832. /*
  36833. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  36834. * -1.
  36835. *
  36836. */
  36837. P.negated = P.neg = function () {
  36838. var x = new this.constructor(this);
  36839. x.s = -x.s;
  36840. return finalise(x);
  36841. };
  36842. /*
  36843. * n + 0 = n
  36844. * n + N = N
  36845. * n + I = I
  36846. * 0 + n = n
  36847. * 0 + 0 = 0
  36848. * 0 + N = N
  36849. * 0 + I = I
  36850. * N + n = N
  36851. * N + 0 = N
  36852. * N + N = N
  36853. * N + I = N
  36854. * I + n = I
  36855. * I + 0 = I
  36856. * I + N = N
  36857. * I + I = I
  36858. *
  36859. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  36860. * significant digits using rounding mode `rounding`.
  36861. *
  36862. */
  36863. P.plus = P.add = function (y) {
  36864. var carry,
  36865. d,
  36866. e,
  36867. i,
  36868. k,
  36869. len,
  36870. pr,
  36871. rm,
  36872. xd,
  36873. yd,
  36874. x = this,
  36875. Ctor = x.constructor;
  36876. y = new Ctor(y);
  36877. // If either is not finite...
  36878. if (!x.d || !y.d) {
  36879. // Return NaN if either is NaN.
  36880. if (!x.s || !y.s) y = new Ctor(NaN);
  36881. // Return x if y is finite and x is ±Infinity.
  36882. // Return x if both are ±Infinity with the same sign.
  36883. // Return NaN if both are ±Infinity with different signs.
  36884. // Return y if x is finite and y is ±Infinity.
  36885. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  36886. return y;
  36887. }
  36888. // If signs differ...
  36889. if (x.s != y.s) {
  36890. y.s = -y.s;
  36891. return x.minus(y);
  36892. }
  36893. xd = x.d;
  36894. yd = y.d;
  36895. pr = Ctor.precision;
  36896. rm = Ctor.rounding;
  36897. // If either is zero...
  36898. if (!xd[0] || !yd[0]) {
  36899. // Return x if y is zero.
  36900. // Return y if y is non-zero.
  36901. if (!yd[0]) y = new Ctor(x);
  36902. return external ? finalise(y, pr, rm) : y;
  36903. }
  36904. // x and y are finite, non-zero numbers with the same sign.
  36905. // Calculate base 1e7 exponents.
  36906. k = mathfloor(x.e / LOG_BASE);
  36907. e = mathfloor(y.e / LOG_BASE);
  36908. xd = xd.slice();
  36909. i = k - e;
  36910. // If base 1e7 exponents differ...
  36911. if (i) {
  36912. if (i < 0) {
  36913. d = xd;
  36914. i = -i;
  36915. len = yd.length;
  36916. } else {
  36917. d = yd;
  36918. e = k;
  36919. len = xd.length;
  36920. }
  36921. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  36922. k = Math.ceil(pr / LOG_BASE);
  36923. len = k > len ? k + 1 : len + 1;
  36924. if (i > len) {
  36925. i = len;
  36926. d.length = 1;
  36927. }
  36928. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  36929. d.reverse();
  36930. for (; i--;) {
  36931. d.push(0);
  36932. }d.reverse();
  36933. }
  36934. len = xd.length;
  36935. i = yd.length;
  36936. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  36937. if (len - i < 0) {
  36938. i = len;
  36939. d = yd;
  36940. yd = xd;
  36941. xd = d;
  36942. }
  36943. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  36944. for (carry = 0; i;) {
  36945. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  36946. xd[i] %= BASE;
  36947. }
  36948. if (carry) {
  36949. xd.unshift(carry);
  36950. ++e;
  36951. }
  36952. // Remove trailing zeros.
  36953. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  36954. for (len = xd.length; xd[--len] == 0;) {
  36955. xd.pop();
  36956. }y.d = xd;
  36957. y.e = getBase10Exponent(xd, e);
  36958. return external ? finalise(y, pr, rm) : y;
  36959. };
  36960. /*
  36961. * Return the number of significant digits of the value of this Decimal.
  36962. *
  36963. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  36964. *
  36965. */
  36966. P.precision = P.sd = function (z) {
  36967. var k,
  36968. x = this;
  36969. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  36970. if (x.d) {
  36971. k = getPrecision(x.d);
  36972. if (z && x.e + 1 > k) k = x.e + 1;
  36973. } else {
  36974. k = NaN;
  36975. }
  36976. return k;
  36977. };
  36978. /*
  36979. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  36980. * rounding mode `rounding`.
  36981. *
  36982. */
  36983. P.round = function () {
  36984. var x = this,
  36985. Ctor = x.constructor;
  36986. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  36987. };
  36988. /*
  36989. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  36990. *
  36991. * Domain: [-Infinity, Infinity]
  36992. * Range: [-1, 1]
  36993. *
  36994. * sin(x) = x - x^3/3! + x^5/5! - ...
  36995. *
  36996. * sin(0) = 0
  36997. * sin(-0) = -0
  36998. * sin(Infinity) = NaN
  36999. * sin(-Infinity) = NaN
  37000. * sin(NaN) = NaN
  37001. *
  37002. */
  37003. P.sine = P.sin = function () {
  37004. var pr,
  37005. rm,
  37006. x = this,
  37007. Ctor = x.constructor;
  37008. if (!x.isFinite()) return new Ctor(NaN);
  37009. if (x.isZero()) return new Ctor(x);
  37010. pr = Ctor.precision;
  37011. rm = Ctor.rounding;
  37012. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  37013. Ctor.rounding = 1;
  37014. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  37015. Ctor.precision = pr;
  37016. Ctor.rounding = rm;
  37017. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  37018. };
  37019. /*
  37020. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  37021. * significant digits using rounding mode `rounding`.
  37022. *
  37023. * sqrt(-n) = N
  37024. * sqrt(N) = N
  37025. * sqrt(-I) = N
  37026. * sqrt(I) = I
  37027. * sqrt(0) = 0
  37028. * sqrt(-0) = -0
  37029. *
  37030. */
  37031. P.squareRoot = P.sqrt = function () {
  37032. var m,
  37033. n,
  37034. sd,
  37035. r,
  37036. rep,
  37037. t,
  37038. x = this,
  37039. d = x.d,
  37040. e = x.e,
  37041. s = x.s,
  37042. Ctor = x.constructor;
  37043. // Negative/NaN/Infinity/zero?
  37044. if (s !== 1 || !d || !d[0]) {
  37045. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  37046. }
  37047. external = false;
  37048. // Initial estimate.
  37049. s = Math.sqrt(+x);
  37050. // Math.sqrt underflow/overflow?
  37051. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  37052. if (s == 0 || s == 1 / 0) {
  37053. n = digitsToString(d);
  37054. if ((n.length + e) % 2 == 0) n += '0';
  37055. s = Math.sqrt(n);
  37056. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  37057. if (s == 1 / 0) {
  37058. n = '1e' + e;
  37059. } else {
  37060. n = s.toExponential();
  37061. n = n.slice(0, n.indexOf('e') + 1) + e;
  37062. }
  37063. r = new Ctor(n);
  37064. } else {
  37065. r = new Ctor(s.toString());
  37066. }
  37067. sd = (e = Ctor.precision) + 3;
  37068. // Newton-Raphson iteration.
  37069. for (;;) {
  37070. t = r;
  37071. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  37072. // TODO? Replace with for-loop and checkRoundingDigits.
  37073. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  37074. n = n.slice(sd - 3, sd + 1);
  37075. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  37076. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  37077. if (n == '9999' || !rep && n == '4999') {
  37078. // On the first iteration only, check to see if rounding up gives the exact result as the
  37079. // nines may infinitely repeat.
  37080. if (!rep) {
  37081. finalise(t, e + 1, 0);
  37082. if (t.times(t).eq(x)) {
  37083. r = t;
  37084. break;
  37085. }
  37086. }
  37087. sd += 4;
  37088. rep = 1;
  37089. } else {
  37090. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  37091. // If not, then there are further digits and m will be truthy.
  37092. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  37093. // Truncate to the first rounding digit.
  37094. finalise(r, e + 1, 1);
  37095. m = !r.times(r).eq(x);
  37096. }
  37097. break;
  37098. }
  37099. }
  37100. }
  37101. external = true;
  37102. return finalise(r, e, Ctor.rounding, m);
  37103. };
  37104. /*
  37105. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  37106. *
  37107. * Domain: [-Infinity, Infinity]
  37108. * Range: [-Infinity, Infinity]
  37109. *
  37110. * tan(0) = 0
  37111. * tan(-0) = -0
  37112. * tan(Infinity) = NaN
  37113. * tan(-Infinity) = NaN
  37114. * tan(NaN) = NaN
  37115. *
  37116. */
  37117. P.tangent = P.tan = function () {
  37118. var pr,
  37119. rm,
  37120. x = this,
  37121. Ctor = x.constructor;
  37122. if (!x.isFinite()) return new Ctor(NaN);
  37123. if (x.isZero()) return new Ctor(x);
  37124. pr = Ctor.precision;
  37125. rm = Ctor.rounding;
  37126. Ctor.precision = pr + 10;
  37127. Ctor.rounding = 1;
  37128. x = x.sin();
  37129. x.s = 1;
  37130. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  37131. Ctor.precision = pr;
  37132. Ctor.rounding = rm;
  37133. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  37134. };
  37135. /*
  37136. * n * 0 = 0
  37137. * n * N = N
  37138. * n * I = I
  37139. * 0 * n = 0
  37140. * 0 * 0 = 0
  37141. * 0 * N = N
  37142. * 0 * I = N
  37143. * N * n = N
  37144. * N * 0 = N
  37145. * N * N = N
  37146. * N * I = N
  37147. * I * n = I
  37148. * I * 0 = N
  37149. * I * N = N
  37150. * I * I = I
  37151. *
  37152. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  37153. * digits using rounding mode `rounding`.
  37154. *
  37155. */
  37156. P.times = P.mul = function (y) {
  37157. var carry,
  37158. e,
  37159. i,
  37160. k,
  37161. r,
  37162. rL,
  37163. t,
  37164. xdL,
  37165. ydL,
  37166. x = this,
  37167. Ctor = x.constructor,
  37168. xd = x.d,
  37169. yd = (y = new Ctor(y)).d;
  37170. y.s *= x.s;
  37171. // If either is NaN, ±Infinity or ±0...
  37172. if (!xd || !xd[0] || !yd || !yd[0]) {
  37173. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  37174. // Return NaN if either is NaN.
  37175. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  37176. ? NaN
  37177. // Return ±Infinity if either is ±Infinity.
  37178. // Return ±0 if either is ±0.
  37179. : !xd || !yd ? y.s / 0 : y.s * 0);
  37180. }
  37181. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  37182. xdL = xd.length;
  37183. ydL = yd.length;
  37184. // Ensure xd points to the longer array.
  37185. if (xdL < ydL) {
  37186. r = xd;
  37187. xd = yd;
  37188. yd = r;
  37189. rL = xdL;
  37190. xdL = ydL;
  37191. ydL = rL;
  37192. }
  37193. // Initialise the result array with zeros.
  37194. r = [];
  37195. rL = xdL + ydL;
  37196. for (i = rL; i--;) {
  37197. r.push(0);
  37198. } // Multiply!
  37199. for (i = ydL; --i >= 0;) {
  37200. carry = 0;
  37201. for (k = xdL + i; k > i;) {
  37202. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  37203. r[k--] = t % BASE | 0;
  37204. carry = t / BASE | 0;
  37205. }
  37206. r[k] = (r[k] + carry) % BASE | 0;
  37207. }
  37208. // Remove trailing zeros.
  37209. for (; !r[--rL];) {
  37210. r.pop();
  37211. }if (carry) ++e;else r.shift();
  37212. y.d = r;
  37213. y.e = getBase10Exponent(r, e);
  37214. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  37215. };
  37216. /*
  37217. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  37218. * digits using rounding mode `rm`.
  37219. *
  37220. * If the optional `sd` argument is present then return binary exponential notation.
  37221. *
  37222. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  37223. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  37224. *
  37225. */
  37226. P.toBinary = function (sd, rm) {
  37227. return toStringBinary(this, 2, sd, rm);
  37228. };
  37229. /*
  37230. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  37231. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  37232. *
  37233. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  37234. *
  37235. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  37236. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  37237. *
  37238. */
  37239. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  37240. var x = this,
  37241. Ctor = x.constructor;
  37242. x = new Ctor(x);
  37243. if (dp === void 0) return x;
  37244. checkInt32(dp, 0, MAX_DIGITS);
  37245. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  37246. return finalise(x, dp + x.e + 1, rm);
  37247. };
  37248. /*
  37249. * Return a string representing the value of this Decimal in exponential notation rounded to
  37250. * `dp` fixed decimal places using rounding mode `rounding`.
  37251. *
  37252. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  37253. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  37254. *
  37255. */
  37256. P.toExponential = function (dp, rm) {
  37257. var str,
  37258. x = this,
  37259. Ctor = x.constructor;
  37260. if (dp === void 0) {
  37261. str = finiteToString(x, true);
  37262. } else {
  37263. checkInt32(dp, 0, MAX_DIGITS);
  37264. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  37265. x = finalise(new Ctor(x), dp + 1, rm);
  37266. str = finiteToString(x, true, dp + 1);
  37267. }
  37268. return x.isNeg() && !x.isZero() ? '-' + str : str;
  37269. };
  37270. /*
  37271. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  37272. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  37273. * omitted.
  37274. *
  37275. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  37276. *
  37277. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  37278. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  37279. *
  37280. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  37281. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  37282. * (-0).toFixed(3) is '0.000'.
  37283. * (-0.5).toFixed(0) is '-0'.
  37284. *
  37285. */
  37286. P.toFixed = function (dp, rm) {
  37287. var str,
  37288. y,
  37289. x = this,
  37290. Ctor = x.constructor;
  37291. if (dp === void 0) {
  37292. str = finiteToString(x);
  37293. } else {
  37294. checkInt32(dp, 0, MAX_DIGITS);
  37295. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  37296. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  37297. str = finiteToString(y, false, dp + y.e + 1);
  37298. }
  37299. // To determine whether to add the minus sign look at the value before it was rounded,
  37300. // i.e. look at `x` rather than `y`.
  37301. return x.isNeg() && !x.isZero() ? '-' + str : str;
  37302. };
  37303. /*
  37304. * Return an array representing the value of this Decimal as a simple fraction with an integer
  37305. * numerator and an integer denominator.
  37306. *
  37307. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  37308. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  37309. * value necessary to represent the number exactly.
  37310. *
  37311. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  37312. *
  37313. */
  37314. P.toFraction = function (maxD) {
  37315. var d,
  37316. d0,
  37317. d1,
  37318. d2,
  37319. e,
  37320. k,
  37321. n,
  37322. n0,
  37323. n1,
  37324. pr,
  37325. q,
  37326. r,
  37327. x = this,
  37328. xd = x.d,
  37329. Ctor = x.constructor;
  37330. if (!xd) return new Ctor(x);
  37331. n1 = d0 = new Ctor(1);
  37332. d1 = n0 = new Ctor(0);
  37333. d = new Ctor(d1);
  37334. e = d.e = getPrecision(xd) - x.e - 1;
  37335. k = e % LOG_BASE;
  37336. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  37337. if (maxD == null) {
  37338. // d is 10**e, the minimum max-denominator needed.
  37339. maxD = e > 0 ? d : n1;
  37340. } else {
  37341. n = new Ctor(maxD);
  37342. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  37343. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  37344. }
  37345. external = false;
  37346. n = new Ctor(digitsToString(xd));
  37347. pr = Ctor.precision;
  37348. Ctor.precision = e = xd.length * LOG_BASE * 2;
  37349. for (;;) {
  37350. q = divide(n, d, 0, 1, 1);
  37351. d2 = d0.plus(q.times(d1));
  37352. if (d2.cmp(maxD) == 1) break;
  37353. d0 = d1;
  37354. d1 = d2;
  37355. d2 = n1;
  37356. n1 = n0.plus(q.times(d2));
  37357. n0 = d2;
  37358. d2 = d;
  37359. d = n.minus(q.times(d2));
  37360. n = d2;
  37361. }
  37362. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  37363. n0 = n0.plus(d2.times(n1));
  37364. d0 = d0.plus(d2.times(d1));
  37365. n0.s = n1.s = x.s;
  37366. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  37367. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  37368. Ctor.precision = pr;
  37369. external = true;
  37370. return r;
  37371. };
  37372. /*
  37373. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  37374. * digits using rounding mode `rm`.
  37375. *
  37376. * If the optional `sd` argument is present then return binary exponential notation.
  37377. *
  37378. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  37379. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  37380. *
  37381. */
  37382. P.toHexadecimal = P.toHex = function (sd, rm) {
  37383. return toStringBinary(this, 16, sd, rm);
  37384. };
  37385. /*
  37386. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  37387. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  37388. *
  37389. * The return value will always have the same sign as this Decimal, unless either this Decimal
  37390. * or `y` is NaN, in which case the return value will be also be NaN.
  37391. *
  37392. * The return value is not affected by the value of `precision`.
  37393. *
  37394. * y {number|string|Decimal} The magnitude to round to a multiple of.
  37395. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  37396. *
  37397. * 'toNearest() rounding mode not an integer: {rm}'
  37398. * 'toNearest() rounding mode out of range: {rm}'
  37399. *
  37400. */
  37401. P.toNearest = function (y, rm) {
  37402. var x = this,
  37403. Ctor = x.constructor;
  37404. x = new Ctor(x);
  37405. if (y == null) {
  37406. // If x is not finite, return x.
  37407. if (!x.d) return x;
  37408. y = new Ctor(1);
  37409. rm = Ctor.rounding;
  37410. } else {
  37411. y = new Ctor(y);
  37412. if (rm === void 0) {
  37413. rm = Ctor.rounding;
  37414. } else {
  37415. checkInt32(rm, 0, 8);
  37416. }
  37417. // If x is not finite, return x if y is not NaN, else NaN.
  37418. if (!x.d) return y.s ? x : y;
  37419. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  37420. if (!y.d) {
  37421. if (y.s) y.s = x.s;
  37422. return y;
  37423. }
  37424. }
  37425. // If y is not zero, calculate the nearest multiple of y to x.
  37426. if (y.d[0]) {
  37427. external = false;
  37428. x = divide(x, y, 0, rm, 1).times(y);
  37429. external = true;
  37430. finalise(x);
  37431. // If y is zero, return zero with the sign of x.
  37432. } else {
  37433. y.s = x.s;
  37434. x = y;
  37435. }
  37436. return x;
  37437. };
  37438. /*
  37439. * Return the value of this Decimal converted to a number primitive.
  37440. * Zero keeps its sign.
  37441. *
  37442. */
  37443. P.toNumber = function () {
  37444. return +this;
  37445. };
  37446. /*
  37447. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  37448. * digits using rounding mode `rm`.
  37449. *
  37450. * If the optional `sd` argument is present then return binary exponential notation.
  37451. *
  37452. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  37453. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  37454. *
  37455. */
  37456. P.toOctal = function (sd, rm) {
  37457. return toStringBinary(this, 8, sd, rm);
  37458. };
  37459. /*
  37460. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  37461. * to `precision` significant digits using rounding mode `rounding`.
  37462. *
  37463. * ECMAScript compliant.
  37464. *
  37465. * pow(x, NaN) = NaN
  37466. * pow(x, ±0) = 1
  37467. * pow(NaN, non-zero) = NaN
  37468. * pow(abs(x) > 1, +Infinity) = +Infinity
  37469. * pow(abs(x) > 1, -Infinity) = +0
  37470. * pow(abs(x) == 1, ±Infinity) = NaN
  37471. * pow(abs(x) < 1, +Infinity) = +0
  37472. * pow(abs(x) < 1, -Infinity) = +Infinity
  37473. * pow(+Infinity, y > 0) = +Infinity
  37474. * pow(+Infinity, y < 0) = +0
  37475. * pow(-Infinity, odd integer > 0) = -Infinity
  37476. * pow(-Infinity, even integer > 0) = +Infinity
  37477. * pow(-Infinity, odd integer < 0) = -0
  37478. * pow(-Infinity, even integer < 0) = +0
  37479. * pow(+0, y > 0) = +0
  37480. * pow(+0, y < 0) = +Infinity
  37481. * pow(-0, odd integer > 0) = -0
  37482. * pow(-0, even integer > 0) = +0
  37483. * pow(-0, odd integer < 0) = -Infinity
  37484. * pow(-0, even integer < 0) = +Infinity
  37485. * pow(finite x < 0, finite non-integer) = NaN
  37486. *
  37487. * For non-integer or very large exponents pow(x, y) is calculated using
  37488. *
  37489. * x^y = exp(y*ln(x))
  37490. *
  37491. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  37492. * probability of an incorrectly rounded result
  37493. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  37494. * i.e. 1 in 250,000,000,000,000
  37495. *
  37496. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  37497. *
  37498. * y {number|string|Decimal} The power to which to raise this Decimal.
  37499. *
  37500. */
  37501. P.toPower = P.pow = function (y) {
  37502. var e,
  37503. k,
  37504. pr,
  37505. r,
  37506. rm,
  37507. s,
  37508. x = this,
  37509. Ctor = x.constructor,
  37510. yn = +(y = new Ctor(y));
  37511. // Either ±Infinity, NaN or ±0?
  37512. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  37513. x = new Ctor(x);
  37514. if (x.eq(1)) return x;
  37515. pr = Ctor.precision;
  37516. rm = Ctor.rounding;
  37517. if (y.eq(1)) return finalise(x, pr, rm);
  37518. // y exponent
  37519. e = mathfloor(y.e / LOG_BASE);
  37520. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  37521. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  37522. r = intPow(Ctor, x, k, pr);
  37523. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  37524. }
  37525. s = x.s;
  37526. // if x is negative
  37527. if (s < 0) {
  37528. // if y is not an integer
  37529. if (e < y.d.length - 1) return new Ctor(NaN);
  37530. // Result is positive if x is negative and the last digit of integer y is even.
  37531. if ((y.d[e] & 1) == 0) s = 1;
  37532. // if x.eq(-1)
  37533. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  37534. x.s = s;
  37535. return x;
  37536. }
  37537. }
  37538. // Estimate result exponent.
  37539. // x^y = 10^e, where e = y * log10(x)
  37540. // log10(x) = log10(x_significand) + x_exponent
  37541. // log10(x_significand) = ln(x_significand) / ln(10)
  37542. k = mathpow(+x, yn);
  37543. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  37544. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  37545. // Overflow/underflow?
  37546. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  37547. external = false;
  37548. Ctor.rounding = x.s = 1;
  37549. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  37550. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  37551. // new Decimal(2.32456).pow('2087987436534566.46411')
  37552. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  37553. k = Math.min(12, (e + '').length);
  37554. // r = x^y = exp(y*ln(x))
  37555. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  37556. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  37557. if (r.d) {
  37558. // Truncate to the required precision plus five rounding digits.
  37559. r = finalise(r, pr + 5, 1);
  37560. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  37561. // the result.
  37562. if (checkRoundingDigits(r.d, pr, rm)) {
  37563. e = pr + 10;
  37564. // Truncate to the increased precision plus five rounding digits.
  37565. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  37566. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  37567. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  37568. r = finalise(r, pr + 1, 0);
  37569. }
  37570. }
  37571. }
  37572. r.s = s;
  37573. external = true;
  37574. Ctor.rounding = rm;
  37575. return finalise(r, pr, rm);
  37576. };
  37577. /*
  37578. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  37579. * using rounding mode `rounding`.
  37580. *
  37581. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  37582. * the integer part of the value in normal notation.
  37583. *
  37584. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  37585. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  37586. *
  37587. */
  37588. P.toPrecision = function (sd, rm) {
  37589. var str,
  37590. x = this,
  37591. Ctor = x.constructor;
  37592. if (sd === void 0) {
  37593. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  37594. } else {
  37595. checkInt32(sd, 1, MAX_DIGITS);
  37596. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  37597. x = finalise(new Ctor(x), sd, rm);
  37598. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  37599. }
  37600. return x.isNeg() && !x.isZero() ? '-' + str : str;
  37601. };
  37602. /*
  37603. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  37604. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  37605. * omitted.
  37606. *
  37607. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  37608. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  37609. *
  37610. * 'toSD() digits out of range: {sd}'
  37611. * 'toSD() digits not an integer: {sd}'
  37612. * 'toSD() rounding mode not an integer: {rm}'
  37613. * 'toSD() rounding mode out of range: {rm}'
  37614. *
  37615. */
  37616. P.toSignificantDigits = P.toSD = function (sd, rm) {
  37617. var x = this,
  37618. Ctor = x.constructor;
  37619. if (sd === void 0) {
  37620. sd = Ctor.precision;
  37621. rm = Ctor.rounding;
  37622. } else {
  37623. checkInt32(sd, 1, MAX_DIGITS);
  37624. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  37625. }
  37626. return finalise(new Ctor(x), sd, rm);
  37627. };
  37628. /*
  37629. * Return a string representing the value of this Decimal.
  37630. *
  37631. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  37632. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  37633. *
  37634. */
  37635. P.toString = function () {
  37636. var x = this,
  37637. Ctor = x.constructor,
  37638. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  37639. return x.isNeg() && !x.isZero() ? '-' + str : str;
  37640. };
  37641. /*
  37642. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  37643. *
  37644. */
  37645. P.truncated = P.trunc = function () {
  37646. return finalise(new this.constructor(this), this.e + 1, 1);
  37647. };
  37648. /*
  37649. * Return a string representing the value of this Decimal.
  37650. * Unlike `toString`, negative zero will include the minus sign.
  37651. *
  37652. */
  37653. P.valueOf = P.toJSON = function () {
  37654. var x = this,
  37655. Ctor = x.constructor,
  37656. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  37657. return x.isNeg() ? '-' + str : str;
  37658. };
  37659. /*
  37660. // Add aliases to match BigDecimal method names.
  37661. // P.add = P.plus;
  37662. P.subtract = P.minus;
  37663. P.multiply = P.times;
  37664. P.divide = P.div;
  37665. P.remainder = P.mod;
  37666. P.compareTo = P.cmp;
  37667. P.negate = P.neg;
  37668. */
  37669. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  37670. /*
  37671. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  37672. * finiteToString, naturalExponential, naturalLogarithm
  37673. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  37674. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  37675. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  37676. * convertBase toStringBinary, parseOther
  37677. * cos P.cos
  37678. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  37679. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  37680. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  37681. * taylorSeries, atan2, parseOther
  37682. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  37683. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  37684. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  37685. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  37686. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  37687. * P.truncated, divide, getLn10, getPi, naturalExponential,
  37688. * naturalLogarithm, ceil, floor, round, trunc
  37689. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  37690. * toStringBinary
  37691. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  37692. * getLn10 P.logarithm, naturalLogarithm
  37693. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  37694. * getPrecision P.precision, P.toFraction
  37695. * getZeroString digitsToString, finiteToString
  37696. * intPow P.toPower, parseOther
  37697. * isOdd toLessThanHalfPi
  37698. * maxOrMin max, min
  37699. * naturalExponential P.naturalExponential, P.toPower
  37700. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  37701. * P.toPower, naturalExponential
  37702. * nonFiniteToString finiteToString, toStringBinary
  37703. * parseDecimal Decimal
  37704. * parseOther Decimal
  37705. * sin P.sin
  37706. * taylorSeries P.cosh, P.sinh, cos, sin
  37707. * toLessThanHalfPi P.cos, P.sin
  37708. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  37709. * truncate intPow
  37710. *
  37711. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  37712. * naturalLogarithm, config, parseOther, random, Decimal
  37713. */
  37714. function digitsToString(d) {
  37715. var i,
  37716. k,
  37717. ws,
  37718. indexOfLastWord = d.length - 1,
  37719. str = '',
  37720. w = d[0];
  37721. if (indexOfLastWord > 0) {
  37722. str += w;
  37723. for (i = 1; i < indexOfLastWord; i++) {
  37724. ws = d[i] + '';
  37725. k = LOG_BASE - ws.length;
  37726. if (k) str += getZeroString(k);
  37727. str += ws;
  37728. }
  37729. w = d[i];
  37730. ws = w + '';
  37731. k = LOG_BASE - ws.length;
  37732. if (k) str += getZeroString(k);
  37733. } else if (w === 0) {
  37734. return '0';
  37735. }
  37736. // Remove trailing zeros of last w.
  37737. for (; w % 10 === 0;) {
  37738. w /= 10;
  37739. }return str + w;
  37740. }
  37741. function checkInt32(i, min, max) {
  37742. if (i !== ~~i || i < min || i > max) {
  37743. throw Error(invalidArgument + i);
  37744. }
  37745. }
  37746. /*
  37747. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  37748. * `repeating == null` if caller is `log` or `pow`,
  37749. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  37750. */
  37751. function checkRoundingDigits(d, i, rm, repeating) {
  37752. var di, k, r, rd;
  37753. // Get the length of the first word of the array d.
  37754. for (k = d[0]; k >= 10; k /= 10) {
  37755. --i;
  37756. } // Is the rounding digit in the first word of d?
  37757. if (--i < 0) {
  37758. i += LOG_BASE;
  37759. di = 0;
  37760. } else {
  37761. di = Math.ceil((i + 1) / LOG_BASE);
  37762. i %= LOG_BASE;
  37763. }
  37764. // i is the index (0 - 6) of the rounding digit.
  37765. // E.g. if within the word 3487563 the first rounding digit is 5,
  37766. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  37767. k = mathpow(10, LOG_BASE - i);
  37768. rd = d[di] % k | 0;
  37769. if (repeating == null) {
  37770. if (i < 3) {
  37771. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  37772. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  37773. } else {
  37774. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  37775. }
  37776. } else {
  37777. if (i < 4) {
  37778. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  37779. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  37780. } else {
  37781. r = ((repeating || rm < 4) && rd + 1 == k || !repeating && rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  37782. }
  37783. }
  37784. return r;
  37785. }
  37786. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  37787. // Eg. convertBase('255', 10, 16) returns [15, 15].
  37788. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  37789. function convertBase(str, baseIn, baseOut) {
  37790. var j,
  37791. arr = [0],
  37792. arrL,
  37793. i = 0,
  37794. strL = str.length;
  37795. for (; i < strL;) {
  37796. for (arrL = arr.length; arrL--;) {
  37797. arr[arrL] *= baseIn;
  37798. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  37799. for (j = 0; j < arr.length; j++) {
  37800. if (arr[j] > baseOut - 1) {
  37801. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  37802. arr[j + 1] += arr[j] / baseOut | 0;
  37803. arr[j] %= baseOut;
  37804. }
  37805. }
  37806. }
  37807. return arr.reverse();
  37808. }
  37809. /*
  37810. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  37811. * |x| < pi/2
  37812. *
  37813. */
  37814. function cosine(Ctor, x) {
  37815. var k,
  37816. y,
  37817. len = x.d.length;
  37818. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  37819. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  37820. // Estimate the optimum number of times to use the argument reduction.
  37821. if (len < 32) {
  37822. k = Math.ceil(len / 3);
  37823. y = Math.pow(4, -k).toString();
  37824. } else {
  37825. k = 16;
  37826. y = '2.3283064365386962890625e-10';
  37827. }
  37828. Ctor.precision += k;
  37829. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  37830. // Reverse argument reduction
  37831. for (var i = k; i--;) {
  37832. var cos2x = x.times(x);
  37833. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  37834. }
  37835. Ctor.precision -= k;
  37836. return x;
  37837. }
  37838. /*
  37839. * Perform division in the specified base.
  37840. */
  37841. var divide = function () {
  37842. // Assumes non-zero x and k, and hence non-zero result.
  37843. function multiplyInteger(x, k, base) {
  37844. var temp,
  37845. carry = 0,
  37846. i = x.length;
  37847. for (x = x.slice(); i--;) {
  37848. temp = x[i] * k + carry;
  37849. x[i] = temp % base | 0;
  37850. carry = temp / base | 0;
  37851. }
  37852. if (carry) x.unshift(carry);
  37853. return x;
  37854. }
  37855. function compare(a, b, aL, bL) {
  37856. var i, r;
  37857. if (aL != bL) {
  37858. r = aL > bL ? 1 : -1;
  37859. } else {
  37860. for (i = r = 0; i < aL; i++) {
  37861. if (a[i] != b[i]) {
  37862. r = a[i] > b[i] ? 1 : -1;
  37863. break;
  37864. }
  37865. }
  37866. }
  37867. return r;
  37868. }
  37869. function subtract(a, b, aL, base) {
  37870. var i = 0;
  37871. // Subtract b from a.
  37872. for (; aL--;) {
  37873. a[aL] -= i;
  37874. i = a[aL] < b[aL] ? 1 : 0;
  37875. a[aL] = i * base + a[aL] - b[aL];
  37876. }
  37877. // Remove leading zeros.
  37878. for (; !a[0] && a.length > 1;) {
  37879. a.shift();
  37880. }
  37881. }
  37882. return function (x, y, pr, rm, dp, base) {
  37883. var cmp,
  37884. e,
  37885. i,
  37886. k,
  37887. logBase,
  37888. more,
  37889. prod,
  37890. prodL,
  37891. q,
  37892. qd,
  37893. rem,
  37894. remL,
  37895. rem0,
  37896. sd,
  37897. t,
  37898. xi,
  37899. xL,
  37900. yd0,
  37901. yL,
  37902. yz,
  37903. Ctor = x.constructor,
  37904. sign = x.s == y.s ? 1 : -1,
  37905. xd = x.d,
  37906. yd = y.d;
  37907. // Either NaN, Infinity or 0?
  37908. if (!xd || !xd[0] || !yd || !yd[0]) {
  37909. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  37910. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  37911. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  37912. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  37913. }
  37914. if (base) {
  37915. logBase = 1;
  37916. e = x.e - y.e;
  37917. } else {
  37918. base = BASE;
  37919. logBase = LOG_BASE;
  37920. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  37921. }
  37922. yL = yd.length;
  37923. xL = xd.length;
  37924. q = new Ctor(sign);
  37925. qd = q.d = [];
  37926. // Result exponent may be one less than e.
  37927. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  37928. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  37929. if (yd[i] > (xd[i] || 0)) e--;
  37930. if (pr == null) {
  37931. sd = pr = Ctor.precision;
  37932. rm = Ctor.rounding;
  37933. } else if (dp) {
  37934. sd = pr + (x.e - y.e) + 1;
  37935. } else {
  37936. sd = pr;
  37937. }
  37938. if (sd < 0) {
  37939. qd.push(1);
  37940. more = true;
  37941. } else {
  37942. // Convert precision in number of base 10 digits to base 1e7 digits.
  37943. sd = sd / logBase + 2 | 0;
  37944. i = 0;
  37945. // divisor < 1e7
  37946. if (yL == 1) {
  37947. k = 0;
  37948. yd = yd[0];
  37949. sd++;
  37950. // k is the carry.
  37951. for (; (i < xL || k) && sd--; i++) {
  37952. t = k * base + (xd[i] || 0);
  37953. qd[i] = t / yd | 0;
  37954. k = t % yd | 0;
  37955. }
  37956. more = k || i < xL;
  37957. // divisor >= 1e7
  37958. } else {
  37959. // Normalise xd and yd so highest order digit of yd is >= base/2
  37960. k = base / (yd[0] + 1) | 0;
  37961. if (k > 1) {
  37962. yd = multiplyInteger(yd, k, base);
  37963. xd = multiplyInteger(xd, k, base);
  37964. yL = yd.length;
  37965. xL = xd.length;
  37966. }
  37967. xi = yL;
  37968. rem = xd.slice(0, yL);
  37969. remL = rem.length;
  37970. // Add zeros to make remainder as long as divisor.
  37971. for (; remL < yL;) {
  37972. rem[remL++] = 0;
  37973. }yz = yd.slice();
  37974. yz.unshift(0);
  37975. yd0 = yd[0];
  37976. if (yd[1] >= base / 2) ++yd0;
  37977. do {
  37978. k = 0;
  37979. // Compare divisor and remainder.
  37980. cmp = compare(yd, rem, yL, remL);
  37981. // If divisor < remainder.
  37982. if (cmp < 0) {
  37983. // Calculate trial digit, k.
  37984. rem0 = rem[0];
  37985. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  37986. // k will be how many times the divisor goes into the current remainder.
  37987. k = rem0 / yd0 | 0;
  37988. // Algorithm:
  37989. // 1. product = divisor * trial digit (k)
  37990. // 2. if product > remainder: product -= divisor, k--
  37991. // 3. remainder -= product
  37992. // 4. if product was < remainder at 2:
  37993. // 5. compare new remainder and divisor
  37994. // 6. If remainder > divisor: remainder -= divisor, k++
  37995. if (k > 1) {
  37996. if (k >= base) k = base - 1;
  37997. // product = divisor * trial digit.
  37998. prod = multiplyInteger(yd, k, base);
  37999. prodL = prod.length;
  38000. remL = rem.length;
  38001. // Compare product and remainder.
  38002. cmp = compare(prod, rem, prodL, remL);
  38003. // product > remainder.
  38004. if (cmp == 1) {
  38005. k--;
  38006. // Subtract divisor from product.
  38007. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  38008. }
  38009. } else {
  38010. // cmp is -1.
  38011. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  38012. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  38013. if (k == 0) cmp = k = 1;
  38014. prod = yd.slice();
  38015. }
  38016. prodL = prod.length;
  38017. if (prodL < remL) prod.unshift(0);
  38018. // Subtract product from remainder.
  38019. subtract(rem, prod, remL, base);
  38020. // If product was < previous remainder.
  38021. if (cmp == -1) {
  38022. remL = rem.length;
  38023. // Compare divisor and new remainder.
  38024. cmp = compare(yd, rem, yL, remL);
  38025. // If divisor < new remainder, subtract divisor from remainder.
  38026. if (cmp < 1) {
  38027. k++;
  38028. // Subtract divisor from remainder.
  38029. subtract(rem, yL < remL ? yz : yd, remL, base);
  38030. }
  38031. }
  38032. remL = rem.length;
  38033. } else if (cmp === 0) {
  38034. k++;
  38035. rem = [0];
  38036. } // if cmp === 1, k will be 0
  38037. // Add the next digit, k, to the result array.
  38038. qd[i++] = k;
  38039. // Update the remainder.
  38040. if (cmp && rem[0]) {
  38041. rem[remL++] = xd[xi] || 0;
  38042. } else {
  38043. rem = [xd[xi]];
  38044. remL = 1;
  38045. }
  38046. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  38047. more = rem[0] !== void 0;
  38048. }
  38049. // Leading zero?
  38050. if (!qd[0]) qd.shift();
  38051. }
  38052. // logBase is 1 when divide is being used for base conversion.
  38053. if (logBase == 1) {
  38054. q.e = e;
  38055. inexact = more;
  38056. } else {
  38057. // To calculate q.e, first get the number of digits of qd[0].
  38058. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  38059. i++;
  38060. }q.e = i + e * logBase - 1;
  38061. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  38062. }
  38063. return q;
  38064. };
  38065. }();
  38066. /*
  38067. * Round `x` to `sd` significant digits using rounding mode `rm`.
  38068. * Check for over/under-flow.
  38069. */
  38070. function finalise(x, sd, rm, isTruncated) {
  38071. var digits,
  38072. i,
  38073. j,
  38074. k,
  38075. rd,
  38076. roundUp,
  38077. w,
  38078. xd,
  38079. xdi,
  38080. Ctor = x.constructor;
  38081. // Don't round if sd is null or undefined.
  38082. out: if (sd != null) {
  38083. xd = x.d;
  38084. // Infinity/NaN.
  38085. if (!xd) return x;
  38086. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  38087. // w: the word of xd containing rd, a base 1e7 number.
  38088. // xdi: the index of w within xd.
  38089. // digits: the number of digits of w.
  38090. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  38091. // they had leading zeros)
  38092. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  38093. // Get the length of the first word of the digits array xd.
  38094. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  38095. digits++;
  38096. }i = sd - digits;
  38097. // Is the rounding digit in the first word of xd?
  38098. if (i < 0) {
  38099. i += LOG_BASE;
  38100. j = sd;
  38101. w = xd[xdi = 0];
  38102. // Get the rounding digit at index j of w.
  38103. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  38104. } else {
  38105. xdi = Math.ceil((i + 1) / LOG_BASE);
  38106. k = xd.length;
  38107. if (xdi >= k) {
  38108. if (isTruncated) {
  38109. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  38110. for (; k++ <= xdi;) {
  38111. xd.push(0);
  38112. }w = rd = 0;
  38113. digits = 1;
  38114. i %= LOG_BASE;
  38115. j = i - LOG_BASE + 1;
  38116. } else {
  38117. break out;
  38118. }
  38119. } else {
  38120. w = k = xd[xdi];
  38121. // Get the number of digits of w.
  38122. for (digits = 1; k >= 10; k /= 10) {
  38123. digits++;
  38124. } // Get the index of rd within w.
  38125. i %= LOG_BASE;
  38126. // Get the index of rd within w, adjusted for leading zeros.
  38127. // The number of leading zeros of w is given by LOG_BASE - digits.
  38128. j = i - LOG_BASE + digits;
  38129. // Get the rounding digit at index j of w.
  38130. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  38131. }
  38132. }
  38133. // Are there any non-zero digits after the rounding digit?
  38134. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  38135. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  38136. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  38137. // will give 714.
  38138. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  38139. // Check whether the digit to the left of the rounding digit is odd.
  38140. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  38141. if (sd < 1 || !xd[0]) {
  38142. xd.length = 0;
  38143. if (roundUp) {
  38144. // Convert sd to decimal places.
  38145. sd -= x.e + 1;
  38146. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  38147. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  38148. x.e = -sd || 0;
  38149. } else {
  38150. // Zero.
  38151. xd[0] = x.e = 0;
  38152. }
  38153. return x;
  38154. }
  38155. // Remove excess digits.
  38156. if (i == 0) {
  38157. xd.length = xdi;
  38158. k = 1;
  38159. xdi--;
  38160. } else {
  38161. xd.length = xdi + 1;
  38162. k = mathpow(10, LOG_BASE - i);
  38163. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  38164. // j > 0 means i > number of leading zeros of w.
  38165. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  38166. }
  38167. if (roundUp) {
  38168. for (;;) {
  38169. // Is the digit to be rounded up in the first word of xd?
  38170. if (xdi == 0) {
  38171. // i will be the length of xd[0] before k is added.
  38172. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  38173. i++;
  38174. }j = xd[0] += k;
  38175. for (k = 1; j >= 10; j /= 10) {
  38176. k++;
  38177. } // if i != k the length has increased.
  38178. if (i != k) {
  38179. x.e++;
  38180. if (xd[0] == BASE) xd[0] = 1;
  38181. }
  38182. break;
  38183. } else {
  38184. xd[xdi] += k;
  38185. if (xd[xdi] != BASE) break;
  38186. xd[xdi--] = 0;
  38187. k = 1;
  38188. }
  38189. }
  38190. }
  38191. // Remove trailing zeros.
  38192. for (i = xd.length; xd[--i] === 0;) {
  38193. xd.pop();
  38194. }
  38195. }
  38196. if (external) {
  38197. // Overflow?
  38198. if (x.e > Ctor.maxE) {
  38199. // Infinity.
  38200. x.d = null;
  38201. x.e = NaN;
  38202. // Underflow?
  38203. } else if (x.e < Ctor.minE) {
  38204. // Zero.
  38205. x.e = 0;
  38206. x.d = [0];
  38207. // Ctor.underflow = true;
  38208. } // else Ctor.underflow = false;
  38209. }
  38210. return x;
  38211. }
  38212. function finiteToString(x, isExp, sd) {
  38213. if (!x.isFinite()) return nonFiniteToString(x);
  38214. var k,
  38215. e = x.e,
  38216. str = digitsToString(x.d),
  38217. len = str.length;
  38218. if (isExp) {
  38219. if (sd && (k = sd - len) > 0) {
  38220. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  38221. } else if (len > 1) {
  38222. str = str.charAt(0) + '.' + str.slice(1);
  38223. }
  38224. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  38225. } else if (e < 0) {
  38226. str = '0.' + getZeroString(-e - 1) + str;
  38227. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  38228. } else if (e >= len) {
  38229. str += getZeroString(e + 1 - len);
  38230. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  38231. } else {
  38232. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  38233. if (sd && (k = sd - len) > 0) {
  38234. if (e + 1 === len) str += '.';
  38235. str += getZeroString(k);
  38236. }
  38237. }
  38238. return str;
  38239. }
  38240. // Calculate the base 10 exponent from the base 1e7 exponent.
  38241. function getBase10Exponent(digits, e) {
  38242. var w = digits[0];
  38243. // Add the number of digits of the first word of the digits array.
  38244. for (e *= LOG_BASE; w >= 10; w /= 10) {
  38245. e++;
  38246. }return e;
  38247. }
  38248. function getLn10(Ctor, sd, pr) {
  38249. if (sd > LN10_PRECISION) {
  38250. // Reset global state in case the exception is caught.
  38251. external = true;
  38252. if (pr) Ctor.precision = pr;
  38253. throw Error(precisionLimitExceeded);
  38254. }
  38255. return finalise(new Ctor(LN10), sd, 1, true);
  38256. }
  38257. function getPi(Ctor, sd, rm) {
  38258. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  38259. return finalise(new Ctor(PI), sd, rm, true);
  38260. }
  38261. function getPrecision(digits) {
  38262. var w = digits.length - 1,
  38263. len = w * LOG_BASE + 1;
  38264. w = digits[w];
  38265. // If non-zero...
  38266. if (w) {
  38267. // Subtract the number of trailing zeros of the last word.
  38268. for (; w % 10 == 0; w /= 10) {
  38269. len--;
  38270. } // Add the number of digits of the first word.
  38271. for (w = digits[0]; w >= 10; w /= 10) {
  38272. len++;
  38273. }
  38274. }
  38275. return len;
  38276. }
  38277. function getZeroString(k) {
  38278. var zs = '';
  38279. for (; k--;) {
  38280. zs += '0';
  38281. }return zs;
  38282. }
  38283. /*
  38284. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  38285. * integer of type number.
  38286. *
  38287. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  38288. *
  38289. */
  38290. function intPow(Ctor, x, n, pr) {
  38291. var isTruncated,
  38292. r = new Ctor(1),
  38293. // Max n of 9007199254740991 takes 53 loop iterations.
  38294. // Maximum digits array length; leaves [28, 34] guard digits.
  38295. k = Math.ceil(pr / LOG_BASE + 4);
  38296. external = false;
  38297. for (;;) {
  38298. if (n % 2) {
  38299. r = r.times(x);
  38300. if (truncate(r.d, k)) isTruncated = true;
  38301. }
  38302. n = mathfloor(n / 2);
  38303. if (n === 0) {
  38304. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  38305. n = r.d.length - 1;
  38306. if (isTruncated && r.d[n] === 0) ++r.d[n];
  38307. break;
  38308. }
  38309. x = x.times(x);
  38310. truncate(x.d, k);
  38311. }
  38312. external = true;
  38313. return r;
  38314. }
  38315. function isOdd(n) {
  38316. return n.d[n.d.length - 1] & 1;
  38317. }
  38318. /*
  38319. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  38320. */
  38321. function maxOrMin(Ctor, args, ltgt) {
  38322. var y,
  38323. x = new Ctor(args[0]),
  38324. i = 0;
  38325. for (; ++i < args.length;) {
  38326. y = new Ctor(args[i]);
  38327. if (!y.s) {
  38328. x = y;
  38329. break;
  38330. } else if (x[ltgt](y)) {
  38331. x = y;
  38332. }
  38333. }
  38334. return x;
  38335. }
  38336. /*
  38337. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  38338. * digits.
  38339. *
  38340. * Taylor/Maclaurin series.
  38341. *
  38342. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  38343. *
  38344. * Argument reduction:
  38345. * Repeat x = x / 32, k += 5, until |x| < 0.1
  38346. * exp(x) = exp(x / 2^k)^(2^k)
  38347. *
  38348. * Previously, the argument was initially reduced by
  38349. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  38350. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  38351. * found to be slower than just dividing repeatedly by 32 as above.
  38352. *
  38353. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  38354. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  38355. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  38356. *
  38357. * exp(Infinity) = Infinity
  38358. * exp(-Infinity) = 0
  38359. * exp(NaN) = NaN
  38360. * exp(±0) = 1
  38361. *
  38362. * exp(x) is non-terminating for any finite, non-zero x.
  38363. *
  38364. * The result will always be correctly rounded.
  38365. *
  38366. */
  38367. function naturalExponential(x, sd) {
  38368. var denominator,
  38369. guard,
  38370. j,
  38371. pow,
  38372. sum,
  38373. t,
  38374. wpr,
  38375. rep = 0,
  38376. i = 0,
  38377. k = 0,
  38378. Ctor = x.constructor,
  38379. rm = Ctor.rounding,
  38380. pr = Ctor.precision;
  38381. // 0/NaN/Infinity?
  38382. if (!x.d || !x.d[0] || x.e > 17) {
  38383. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  38384. }
  38385. if (sd == null) {
  38386. external = false;
  38387. wpr = pr;
  38388. } else {
  38389. wpr = sd;
  38390. }
  38391. t = new Ctor(0.03125);
  38392. // while abs(x) >= 0.1
  38393. while (x.e > -2) {
  38394. // x = x / 2^5
  38395. x = x.times(t);
  38396. k += 5;
  38397. }
  38398. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  38399. // necessary to ensure the first 4 rounding digits are correct.
  38400. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  38401. wpr += guard;
  38402. denominator = pow = sum = new Ctor(1);
  38403. Ctor.precision = wpr;
  38404. for (;;) {
  38405. pow = finalise(pow.times(x), wpr, 1);
  38406. denominator = denominator.times(++i);
  38407. t = sum.plus(divide(pow, denominator, wpr, 1));
  38408. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  38409. j = k;
  38410. while (j--) {
  38411. sum = finalise(sum.times(sum), wpr, 1);
  38412. } // Check to see if the first 4 rounding digits are [49]999.
  38413. // If so, repeat the summation with a higher precision, otherwise
  38414. // e.g. with precision: 18, rounding: 1
  38415. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  38416. // `wpr - guard` is the index of first rounding digit.
  38417. if (sd == null) {
  38418. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  38419. Ctor.precision = wpr += 10;
  38420. denominator = pow = t = new Ctor(1);
  38421. i = 0;
  38422. rep++;
  38423. } else {
  38424. return finalise(sum, Ctor.precision = pr, rm, external = true);
  38425. }
  38426. } else {
  38427. Ctor.precision = pr;
  38428. return sum;
  38429. }
  38430. }
  38431. sum = t;
  38432. }
  38433. }
  38434. /*
  38435. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  38436. * digits.
  38437. *
  38438. * ln(-n) = NaN
  38439. * ln(0) = -Infinity
  38440. * ln(-0) = -Infinity
  38441. * ln(1) = 0
  38442. * ln(Infinity) = Infinity
  38443. * ln(-Infinity) = NaN
  38444. * ln(NaN) = NaN
  38445. *
  38446. * ln(n) (n != 1) is non-terminating.
  38447. *
  38448. */
  38449. function naturalLogarithm(y, sd) {
  38450. var c,
  38451. c0,
  38452. denominator,
  38453. e,
  38454. numerator,
  38455. rep,
  38456. sum,
  38457. t,
  38458. wpr,
  38459. x1,
  38460. x2,
  38461. n = 1,
  38462. guard = 10,
  38463. x = y,
  38464. xd = x.d,
  38465. Ctor = x.constructor,
  38466. rm = Ctor.rounding,
  38467. pr = Ctor.precision;
  38468. // Is x negative or Infinity, NaN, 0 or 1?
  38469. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  38470. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  38471. }
  38472. if (sd == null) {
  38473. external = false;
  38474. wpr = pr;
  38475. } else {
  38476. wpr = sd;
  38477. }
  38478. Ctor.precision = wpr += guard;
  38479. c = digitsToString(xd);
  38480. c0 = c.charAt(0);
  38481. if (Math.abs(e = x.e) < 1.5e15) {
  38482. // Argument reduction.
  38483. // The series converges faster the closer the argument is to 1, so using
  38484. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  38485. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  38486. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  38487. // later be divided by this number, then separate out the power of 10 using
  38488. // ln(a*10^b) = ln(a) + b*ln(10).
  38489. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  38490. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  38491. // max n is 6 (gives 0.7 - 1.3)
  38492. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  38493. x = x.times(y);
  38494. c = digitsToString(x.d);
  38495. c0 = c.charAt(0);
  38496. n++;
  38497. }
  38498. e = x.e;
  38499. if (c0 > 1) {
  38500. x = new Ctor('0.' + c);
  38501. e++;
  38502. } else {
  38503. x = new Ctor(c0 + '.' + c.slice(1));
  38504. }
  38505. } else {
  38506. // The argument reduction method above may result in overflow if the argument y is a massive
  38507. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  38508. // function using ln(x*10^e) = ln(x) + e*ln(10).
  38509. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  38510. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  38511. Ctor.precision = pr;
  38512. return sd == null ? finalise(x, pr, rm, external = true) : x;
  38513. }
  38514. // x1 is x reduced to a value near 1.
  38515. x1 = x;
  38516. // Taylor series.
  38517. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  38518. // where x = (y - 1)/(y + 1) (|x| < 1)
  38519. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  38520. x2 = finalise(x.times(x), wpr, 1);
  38521. denominator = 3;
  38522. for (;;) {
  38523. numerator = finalise(numerator.times(x2), wpr, 1);
  38524. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  38525. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  38526. sum = sum.times(2);
  38527. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  38528. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  38529. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  38530. sum = divide(sum, new Ctor(n), wpr, 1);
  38531. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  38532. // been repeated previously) and the first 4 rounding digits 9999?
  38533. // If so, restart the summation with a higher precision, otherwise
  38534. // e.g. with precision: 12, rounding: 1
  38535. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  38536. // `wpr - guard` is the index of first rounding digit.
  38537. if (sd == null) {
  38538. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  38539. Ctor.precision = wpr += guard;
  38540. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  38541. x2 = finalise(x.times(x), wpr, 1);
  38542. denominator = rep = 1;
  38543. } else {
  38544. return finalise(sum, Ctor.precision = pr, rm, external = true);
  38545. }
  38546. } else {
  38547. Ctor.precision = pr;
  38548. return sum;
  38549. }
  38550. }
  38551. sum = t;
  38552. denominator += 2;
  38553. }
  38554. }
  38555. // ±Infinity, NaN.
  38556. function nonFiniteToString(x) {
  38557. // Unsigned.
  38558. return String(x.s * x.s / 0);
  38559. }
  38560. /*
  38561. * Parse the value of a new Decimal `x` from string `str`.
  38562. */
  38563. function parseDecimal(x, str) {
  38564. var e, i, len;
  38565. // Decimal point?
  38566. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  38567. // Exponential form?
  38568. if ((i = str.search(/e/i)) > 0) {
  38569. // Determine exponent.
  38570. if (e < 0) e = i;
  38571. e += +str.slice(i + 1);
  38572. str = str.substring(0, i);
  38573. } else if (e < 0) {
  38574. // Integer.
  38575. e = str.length;
  38576. }
  38577. // Determine leading zeros.
  38578. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  38579. // Determine trailing zeros.
  38580. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  38581. str = str.slice(i, len);
  38582. if (str) {
  38583. len -= i;
  38584. x.e = e = e - i - 1;
  38585. x.d = [];
  38586. // Transform base
  38587. // e is the base 10 exponent.
  38588. // i is where to slice str to get the first word of the digits array.
  38589. i = (e + 1) % LOG_BASE;
  38590. if (e < 0) i += LOG_BASE;
  38591. if (i < len) {
  38592. if (i) x.d.push(+str.slice(0, i));
  38593. for (len -= LOG_BASE; i < len;) {
  38594. x.d.push(+str.slice(i, i += LOG_BASE));
  38595. }str = str.slice(i);
  38596. i = LOG_BASE - str.length;
  38597. } else {
  38598. i -= len;
  38599. }
  38600. for (; i--;) {
  38601. str += '0';
  38602. }x.d.push(+str);
  38603. if (external) {
  38604. // Overflow?
  38605. if (x.e > x.constructor.maxE) {
  38606. // Infinity.
  38607. x.d = null;
  38608. x.e = NaN;
  38609. // Underflow?
  38610. } else if (x.e < x.constructor.minE) {
  38611. // Zero.
  38612. x.e = 0;
  38613. x.d = [0];
  38614. // x.constructor.underflow = true;
  38615. } // else x.constructor.underflow = false;
  38616. }
  38617. } else {
  38618. // Zero.
  38619. x.e = 0;
  38620. x.d = [0];
  38621. }
  38622. return x;
  38623. }
  38624. /*
  38625. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  38626. */
  38627. function parseOther(x, str) {
  38628. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  38629. if (str === 'Infinity' || str === 'NaN') {
  38630. if (!+str) x.s = NaN;
  38631. x.e = NaN;
  38632. x.d = null;
  38633. return x;
  38634. }
  38635. if (isHex.test(str)) {
  38636. base = 16;
  38637. str = str.toLowerCase();
  38638. } else if (isBinary.test(str)) {
  38639. base = 2;
  38640. } else if (isOctal.test(str)) {
  38641. base = 8;
  38642. } else {
  38643. throw Error(invalidArgument + str);
  38644. }
  38645. // Is there a binary exponent part?
  38646. i = str.search(/p/i);
  38647. if (i > 0) {
  38648. p = +str.slice(i + 1);
  38649. str = str.substring(2, i);
  38650. } else {
  38651. str = str.slice(2);
  38652. }
  38653. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  38654. // fraction part will be restored.
  38655. i = str.indexOf('.');
  38656. isFloat = i >= 0;
  38657. Ctor = x.constructor;
  38658. if (isFloat) {
  38659. str = str.replace('.', '');
  38660. len = str.length;
  38661. i = len - i;
  38662. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  38663. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  38664. }
  38665. xd = convertBase(str, base, BASE);
  38666. xe = xd.length - 1;
  38667. // Remove trailing zeros.
  38668. for (i = xe; xd[i] === 0; --i) {
  38669. xd.pop();
  38670. }if (i < 0) return new Ctor(x.s * 0);
  38671. x.e = getBase10Exponent(xd, xe);
  38672. x.d = xd;
  38673. external = false;
  38674. // At what precision to perform the division to ensure exact conversion?
  38675. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  38676. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  38677. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  38678. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  38679. // Therefore using 4 * the number of digits of str will always be enough.
  38680. if (isFloat) x = divide(x, divisor, len * 4);
  38681. // Multiply by the binary exponent part if present.
  38682. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  38683. external = true;
  38684. return x;
  38685. }
  38686. /*
  38687. * sin(x) = x - x^3/3! + x^5/5! - ...
  38688. * |x| < pi/2
  38689. *
  38690. */
  38691. function sine(Ctor, x) {
  38692. var k,
  38693. len = x.d.length;
  38694. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  38695. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  38696. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  38697. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  38698. // Estimate the optimum number of times to use the argument reduction.
  38699. k = 1.4 * Math.sqrt(len);
  38700. k = k > 16 ? 16 : k | 0;
  38701. // Max k before Math.pow precision loss is 22
  38702. x = x.times(Math.pow(5, -k));
  38703. x = taylorSeries(Ctor, 2, x, x);
  38704. // Reverse argument reduction
  38705. var sin2_x,
  38706. d5 = new Ctor(5),
  38707. d16 = new Ctor(16),
  38708. d20 = new Ctor(20);
  38709. for (; k--;) {
  38710. sin2_x = x.times(x);
  38711. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  38712. }
  38713. return x;
  38714. }
  38715. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  38716. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  38717. var j,
  38718. t,
  38719. u,
  38720. x2,
  38721. i = 1,
  38722. pr = Ctor.precision,
  38723. k = Math.ceil(pr / LOG_BASE);
  38724. external = false;
  38725. x2 = x.times(x);
  38726. u = new Ctor(y);
  38727. for (;;) {
  38728. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  38729. u = isHyperbolic ? y.plus(t) : y.minus(t);
  38730. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  38731. t = u.plus(y);
  38732. if (t.d[k] !== void 0) {
  38733. for (j = k; t.d[j] === u.d[j] && j--;) {}
  38734. if (j == -1) break;
  38735. }
  38736. j = u;
  38737. u = y;
  38738. y = t;
  38739. t = j;
  38740. i++;
  38741. }
  38742. external = true;
  38743. t.d.length = k + 1;
  38744. return t;
  38745. }
  38746. // Return the absolute value of `x` reduced to less than or equal to half pi.
  38747. function toLessThanHalfPi(Ctor, x) {
  38748. var t,
  38749. isNeg = x.s < 0,
  38750. pi = getPi(Ctor, Ctor.precision, 1),
  38751. halfPi = pi.times(0.5);
  38752. x = x.abs();
  38753. if (x.lte(halfPi)) {
  38754. quadrant = isNeg ? 4 : 1;
  38755. return x;
  38756. }
  38757. t = x.divToInt(pi);
  38758. if (t.isZero()) {
  38759. quadrant = isNeg ? 3 : 2;
  38760. } else {
  38761. x = x.minus(t.times(pi));
  38762. // 0 <= x < pi
  38763. if (x.lte(halfPi)) {
  38764. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  38765. return x;
  38766. }
  38767. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  38768. }
  38769. return x.minus(pi).abs();
  38770. }
  38771. /*
  38772. * Return the value of Decimal `x` as a string in base `baseOut`.
  38773. *
  38774. * If the optional `sd` argument is present include a binary exponent suffix.
  38775. */
  38776. function toStringBinary(x, baseOut, sd, rm) {
  38777. var base,
  38778. e,
  38779. i,
  38780. k,
  38781. len,
  38782. roundUp,
  38783. str,
  38784. xd,
  38785. y,
  38786. Ctor = x.constructor,
  38787. isExp = sd !== void 0;
  38788. if (isExp) {
  38789. checkInt32(sd, 1, MAX_DIGITS);
  38790. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  38791. } else {
  38792. sd = Ctor.precision;
  38793. rm = Ctor.rounding;
  38794. }
  38795. if (!x.isFinite()) {
  38796. str = nonFiniteToString(x);
  38797. } else {
  38798. str = finiteToString(x);
  38799. i = str.indexOf('.');
  38800. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  38801. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  38802. // minBinaryExponent = floor(decimalExponent * log[2](10))
  38803. // log[2](10) = 3.321928094887362347870319429489390175864
  38804. if (isExp) {
  38805. base = 2;
  38806. if (baseOut == 16) {
  38807. sd = sd * 4 - 3;
  38808. } else if (baseOut == 8) {
  38809. sd = sd * 3 - 2;
  38810. }
  38811. } else {
  38812. base = baseOut;
  38813. }
  38814. // Convert the number as an integer then divide the result by its base raised to a power such
  38815. // that the fraction part will be restored.
  38816. // Non-integer.
  38817. if (i >= 0) {
  38818. str = str.replace('.', '');
  38819. y = new Ctor(1);
  38820. y.e = str.length - i;
  38821. y.d = convertBase(finiteToString(y), 10, base);
  38822. y.e = y.d.length;
  38823. }
  38824. xd = convertBase(str, 10, base);
  38825. e = len = xd.length;
  38826. // Remove trailing zeros.
  38827. for (; xd[--len] == 0;) {
  38828. xd.pop();
  38829. }if (!xd[0]) {
  38830. str = isExp ? '0p+0' : '0';
  38831. } else {
  38832. if (i < 0) {
  38833. e--;
  38834. } else {
  38835. x = new Ctor(x);
  38836. x.d = xd;
  38837. x.e = e;
  38838. x = divide(x, y, sd, rm, 0, base);
  38839. xd = x.d;
  38840. e = x.e;
  38841. roundUp = inexact;
  38842. }
  38843. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  38844. i = xd[sd];
  38845. k = base / 2;
  38846. roundUp = roundUp || xd[sd + 1] !== void 0;
  38847. roundUp = rm < 4 ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x.s < 0 ? 8 : 7));
  38848. xd.length = sd;
  38849. if (roundUp) {
  38850. // Rounding up may mean the previous digit has to be rounded up and so on.
  38851. for (; ++xd[--sd] > base - 1;) {
  38852. xd[sd] = 0;
  38853. if (!sd) {
  38854. ++e;
  38855. xd.unshift(1);
  38856. }
  38857. }
  38858. }
  38859. // Determine trailing zeros.
  38860. for (len = xd.length; !xd[len - 1]; --len) {}
  38861. // E.g. [4, 11, 15] becomes 4bf.
  38862. for (i = 0, str = ''; i < len; i++) {
  38863. str += NUMERALS.charAt(xd[i]);
  38864. } // Add binary exponent suffix?
  38865. if (isExp) {
  38866. if (len > 1) {
  38867. if (baseOut == 16 || baseOut == 8) {
  38868. i = baseOut == 16 ? 4 : 3;
  38869. for (--len; len % i; len++) {
  38870. str += '0';
  38871. }xd = convertBase(str, base, baseOut);
  38872. for (len = xd.length; !xd[len - 1]; --len) {}
  38873. // xd[0] will always be be 1
  38874. for (i = 1, str = '1.'; i < len; i++) {
  38875. str += NUMERALS.charAt(xd[i]);
  38876. }
  38877. } else {
  38878. str = str.charAt(0) + '.' + str.slice(1);
  38879. }
  38880. }
  38881. str = str + (e < 0 ? 'p' : 'p+') + e;
  38882. } else if (e < 0) {
  38883. for (; ++e;) {
  38884. str = '0' + str;
  38885. }str = '0.' + str;
  38886. } else {
  38887. if (++e > len) for (e -= len; e--;) {
  38888. str += '0';
  38889. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  38890. }
  38891. }
  38892. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  38893. }
  38894. return x.s < 0 ? '-' + str : str;
  38895. }
  38896. // Does not strip trailing zeros.
  38897. function truncate(arr, len) {
  38898. if (arr.length > len) {
  38899. arr.length = len;
  38900. return true;
  38901. }
  38902. }
  38903. // Decimal methods
  38904. /*
  38905. * abs
  38906. * acos
  38907. * acosh
  38908. * add
  38909. * asin
  38910. * asinh
  38911. * atan
  38912. * atanh
  38913. * atan2
  38914. * cbrt
  38915. * ceil
  38916. * clone
  38917. * config
  38918. * cos
  38919. * cosh
  38920. * div
  38921. * exp
  38922. * floor
  38923. * hypot
  38924. * ln
  38925. * log
  38926. * log2
  38927. * log10
  38928. * max
  38929. * min
  38930. * mod
  38931. * mul
  38932. * pow
  38933. * random
  38934. * round
  38935. * set
  38936. * sign
  38937. * sin
  38938. * sinh
  38939. * sqrt
  38940. * sub
  38941. * tan
  38942. * tanh
  38943. * trunc
  38944. */
  38945. /*
  38946. * Return a new Decimal whose value is the absolute value of `x`.
  38947. *
  38948. * x {number|string|Decimal}
  38949. *
  38950. */
  38951. function abs(x) {
  38952. return new this(x).abs();
  38953. }
  38954. /*
  38955. * Return a new Decimal whose value is the arccosine in radians of `x`.
  38956. *
  38957. * x {number|string|Decimal}
  38958. *
  38959. */
  38960. function acos(x) {
  38961. return new this(x).acos();
  38962. }
  38963. /*
  38964. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  38965. * `precision` significant digits using rounding mode `rounding`.
  38966. *
  38967. * x {number|string|Decimal} A value in radians.
  38968. *
  38969. */
  38970. function acosh(x) {
  38971. return new this(x).acosh();
  38972. }
  38973. /*
  38974. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  38975. * digits using rounding mode `rounding`.
  38976. *
  38977. * x {number|string|Decimal}
  38978. * y {number|string|Decimal}
  38979. *
  38980. */
  38981. function add(x, y) {
  38982. return new this(x).plus(y);
  38983. }
  38984. /*
  38985. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  38986. * significant digits using rounding mode `rounding`.
  38987. *
  38988. * x {number|string|Decimal}
  38989. *
  38990. */
  38991. function asin(x) {
  38992. return new this(x).asin();
  38993. }
  38994. /*
  38995. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  38996. * `precision` significant digits using rounding mode `rounding`.
  38997. *
  38998. * x {number|string|Decimal} A value in radians.
  38999. *
  39000. */
  39001. function asinh(x) {
  39002. return new this(x).asinh();
  39003. }
  39004. /*
  39005. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  39006. * significant digits using rounding mode `rounding`.
  39007. *
  39008. * x {number|string|Decimal}
  39009. *
  39010. */
  39011. function atan(x) {
  39012. return new this(x).atan();
  39013. }
  39014. /*
  39015. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  39016. * `precision` significant digits using rounding mode `rounding`.
  39017. *
  39018. * x {number|string|Decimal} A value in radians.
  39019. *
  39020. */
  39021. function atanh(x) {
  39022. return new this(x).atanh();
  39023. }
  39024. /*
  39025. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  39026. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  39027. *
  39028. * Domain: [-Infinity, Infinity]
  39029. * Range: [-pi, pi]
  39030. *
  39031. * y {number|string|Decimal} The y-coordinate.
  39032. * x {number|string|Decimal} The x-coordinate.
  39033. *
  39034. * atan2(±0, -0) = ±pi
  39035. * atan2(±0, +0) = ±0
  39036. * atan2(±0, -x) = ±pi for x > 0
  39037. * atan2(±0, x) = ±0 for x > 0
  39038. * atan2(-y, ±0) = -pi/2 for y > 0
  39039. * atan2(y, ±0) = pi/2 for y > 0
  39040. * atan2(±y, -Infinity) = ±pi for finite y > 0
  39041. * atan2(±y, +Infinity) = ±0 for finite y > 0
  39042. * atan2(±Infinity, x) = ±pi/2 for finite x
  39043. * atan2(±Infinity, -Infinity) = ±3*pi/4
  39044. * atan2(±Infinity, +Infinity) = ±pi/4
  39045. * atan2(NaN, x) = NaN
  39046. * atan2(y, NaN) = NaN
  39047. *
  39048. */
  39049. function atan2(y, x) {
  39050. y = new this(y);
  39051. x = new this(x);
  39052. var r,
  39053. pr = this.precision,
  39054. rm = this.rounding,
  39055. wpr = pr + 4;
  39056. // Either NaN
  39057. if (!y.s || !x.s) {
  39058. r = new this(NaN);
  39059. // Both ±Infinity
  39060. } else if (!y.d && !x.d) {
  39061. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  39062. r.s = y.s;
  39063. // x is ±Infinity or y is ±0
  39064. } else if (!x.d || y.isZero()) {
  39065. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  39066. r.s = y.s;
  39067. // y is ±Infinity or x is ±0
  39068. } else if (!y.d || x.isZero()) {
  39069. r = getPi(this, wpr, 1).times(0.5);
  39070. r.s = y.s;
  39071. // Both non-zero and finite
  39072. } else if (x.s < 0) {
  39073. this.precision = wpr;
  39074. this.rounding = 1;
  39075. r = this.atan(divide(y, x, wpr, 1));
  39076. x = getPi(this, wpr, 1);
  39077. this.precision = pr;
  39078. this.rounding = rm;
  39079. r = y.s < 0 ? r.minus(x) : r.plus(x);
  39080. } else {
  39081. r = this.atan(divide(y, x, wpr, 1));
  39082. }
  39083. return r;
  39084. }
  39085. /*
  39086. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  39087. * digits using rounding mode `rounding`.
  39088. *
  39089. * x {number|string|Decimal}
  39090. *
  39091. */
  39092. function cbrt(x) {
  39093. return new this(x).cbrt();
  39094. }
  39095. /*
  39096. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  39097. *
  39098. * x {number|string|Decimal}
  39099. *
  39100. */
  39101. function ceil(x) {
  39102. return finalise(x = new this(x), x.e + 1, 2);
  39103. }
  39104. /*
  39105. * Configure global settings for a Decimal constructor.
  39106. *
  39107. * `obj` is an object with one or more of the following properties,
  39108. *
  39109. * precision {number}
  39110. * rounding {number}
  39111. * toExpNeg {number}
  39112. * toExpPos {number}
  39113. * maxE {number}
  39114. * minE {number}
  39115. * modulo {number}
  39116. * crypto {boolean|number}
  39117. * defaults {true}
  39118. *
  39119. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  39120. *
  39121. */
  39122. function config(obj) {
  39123. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  39124. var i,
  39125. p,
  39126. v,
  39127. useDefaults = obj.defaults === true,
  39128. ps = ['precision', 1, MAX_DIGITS, 'rounding', 0, 8, 'toExpNeg', -EXP_LIMIT, 0, 'toExpPos', 0, EXP_LIMIT, 'maxE', 0, EXP_LIMIT, 'minE', -EXP_LIMIT, 0, 'modulo', 0, 9];
  39129. for (i = 0; i < ps.length; i += 3) {
  39130. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  39131. if ((v = obj[p]) !== void 0) {
  39132. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  39133. }
  39134. }
  39135. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  39136. if ((v = obj[p]) !== void 0) {
  39137. if (v === true || v === false || v === 0 || v === 1) {
  39138. if (v) {
  39139. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  39140. this[p] = true;
  39141. } else {
  39142. throw Error(cryptoUnavailable);
  39143. }
  39144. } else {
  39145. this[p] = false;
  39146. }
  39147. } else {
  39148. throw Error(invalidArgument + p + ': ' + v);
  39149. }
  39150. }
  39151. return this;
  39152. }
  39153. /*
  39154. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  39155. * digits using rounding mode `rounding`.
  39156. *
  39157. * x {number|string|Decimal} A value in radians.
  39158. *
  39159. */
  39160. function cos(x) {
  39161. return new this(x).cos();
  39162. }
  39163. /*
  39164. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  39165. * significant digits using rounding mode `rounding`.
  39166. *
  39167. * x {number|string|Decimal} A value in radians.
  39168. *
  39169. */
  39170. function cosh(x) {
  39171. return new this(x).cosh();
  39172. }
  39173. /*
  39174. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  39175. * constructor.
  39176. *
  39177. */
  39178. function clone(obj) {
  39179. var i, p, ps;
  39180. /*
  39181. * The Decimal constructor and exported function.
  39182. * Return a new Decimal instance.
  39183. *
  39184. * v {number|string|Decimal} A numeric value.
  39185. *
  39186. */
  39187. function Decimal(v) {
  39188. var e,
  39189. i,
  39190. t,
  39191. x = this;
  39192. // Decimal called without new.
  39193. if (!(x instanceof Decimal)) return new Decimal(v);
  39194. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  39195. // which points to Object.
  39196. x.constructor = Decimal;
  39197. // Duplicate.
  39198. if (v instanceof Decimal) {
  39199. x.s = v.s;
  39200. x.e = v.e;
  39201. x.d = (v = v.d) ? v.slice() : v;
  39202. return;
  39203. }
  39204. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  39205. if (t === 'number') {
  39206. if (v === 0) {
  39207. x.s = 1 / v < 0 ? -1 : 1;
  39208. x.e = 0;
  39209. x.d = [0];
  39210. return;
  39211. }
  39212. if (v < 0) {
  39213. v = -v;
  39214. x.s = -1;
  39215. } else {
  39216. x.s = 1;
  39217. }
  39218. // Fast path for small integers.
  39219. if (v === ~~v && v < 1e7) {
  39220. for (e = 0, i = v; i >= 10; i /= 10) {
  39221. e++;
  39222. }x.e = e;
  39223. x.d = [v];
  39224. return;
  39225. // Infinity, NaN.
  39226. } else if (v * 0 !== 0) {
  39227. if (!v) x.s = NaN;
  39228. x.e = NaN;
  39229. x.d = null;
  39230. return;
  39231. }
  39232. return parseDecimal(x, v.toString());
  39233. } else if (t !== 'string') {
  39234. throw Error(invalidArgument + v);
  39235. }
  39236. // Minus sign?
  39237. if (v.charCodeAt(0) === 45) {
  39238. v = v.slice(1);
  39239. x.s = -1;
  39240. } else {
  39241. x.s = 1;
  39242. }
  39243. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  39244. }
  39245. Decimal.prototype = P;
  39246. Decimal.ROUND_UP = 0;
  39247. Decimal.ROUND_DOWN = 1;
  39248. Decimal.ROUND_CEIL = 2;
  39249. Decimal.ROUND_FLOOR = 3;
  39250. Decimal.ROUND_HALF_UP = 4;
  39251. Decimal.ROUND_HALF_DOWN = 5;
  39252. Decimal.ROUND_HALF_EVEN = 6;
  39253. Decimal.ROUND_HALF_CEIL = 7;
  39254. Decimal.ROUND_HALF_FLOOR = 8;
  39255. Decimal.EUCLID = 9;
  39256. Decimal.config = Decimal.set = config;
  39257. Decimal.clone = clone;
  39258. Decimal.isDecimal = isDecimalInstance;
  39259. Decimal.abs = abs;
  39260. Decimal.acos = acos;
  39261. Decimal.acosh = acosh; // ES6
  39262. Decimal.add = add;
  39263. Decimal.asin = asin;
  39264. Decimal.asinh = asinh; // ES6
  39265. Decimal.atan = atan;
  39266. Decimal.atanh = atanh; // ES6
  39267. Decimal.atan2 = atan2;
  39268. Decimal.cbrt = cbrt; // ES6
  39269. Decimal.ceil = ceil;
  39270. Decimal.cos = cos;
  39271. Decimal.cosh = cosh; // ES6
  39272. Decimal.div = div;
  39273. Decimal.exp = exp;
  39274. Decimal.floor = floor;
  39275. Decimal.hypot = hypot; // ES6
  39276. Decimal.ln = ln;
  39277. Decimal.log = log;
  39278. Decimal.log10 = log10; // ES6
  39279. Decimal.log2 = log2; // ES6
  39280. Decimal.max = max;
  39281. Decimal.min = min;
  39282. Decimal.mod = mod;
  39283. Decimal.mul = mul;
  39284. Decimal.pow = pow;
  39285. Decimal.random = random;
  39286. Decimal.round = round;
  39287. Decimal.sign = sign; // ES6
  39288. Decimal.sin = sin;
  39289. Decimal.sinh = sinh; // ES6
  39290. Decimal.sqrt = sqrt;
  39291. Decimal.sub = sub;
  39292. Decimal.tan = tan;
  39293. Decimal.tanh = tanh; // ES6
  39294. Decimal.trunc = trunc; // ES6
  39295. if (obj === void 0) obj = {};
  39296. if (obj) {
  39297. if (obj.defaults !== true) {
  39298. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  39299. for (i = 0; i < ps.length;) {
  39300. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  39301. }
  39302. }
  39303. }
  39304. Decimal.config(obj);
  39305. return Decimal;
  39306. }
  39307. /*
  39308. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  39309. * digits using rounding mode `rounding`.
  39310. *
  39311. * x {number|string|Decimal}
  39312. * y {number|string|Decimal}
  39313. *
  39314. */
  39315. function div(x, y) {
  39316. return new this(x).div(y);
  39317. }
  39318. /*
  39319. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  39320. * significant digits using rounding mode `rounding`.
  39321. *
  39322. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  39323. *
  39324. */
  39325. function exp(x) {
  39326. return new this(x).exp();
  39327. }
  39328. /*
  39329. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  39330. *
  39331. * x {number|string|Decimal}
  39332. *
  39333. */
  39334. function floor(x) {
  39335. return finalise(x = new this(x), x.e + 1, 3);
  39336. }
  39337. /*
  39338. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  39339. * rounded to `precision` significant digits using rounding mode `rounding`.
  39340. *
  39341. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  39342. *
  39343. */
  39344. function hypot() {
  39345. var i,
  39346. n,
  39347. t = new this(0);
  39348. external = false;
  39349. for (i = 0; i < arguments.length;) {
  39350. n = new this(arguments[i++]);
  39351. if (!n.d) {
  39352. if (n.s) {
  39353. external = true;
  39354. return new this(1 / 0);
  39355. }
  39356. t = n;
  39357. } else if (t.d) {
  39358. t = t.plus(n.times(n));
  39359. }
  39360. }
  39361. external = true;
  39362. return t.sqrt();
  39363. }
  39364. /*
  39365. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  39366. * otherwise return false.
  39367. *
  39368. */
  39369. function isDecimalInstance(obj) {
  39370. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  39371. }
  39372. /*
  39373. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  39374. * significant digits using rounding mode `rounding`.
  39375. *
  39376. * x {number|string|Decimal}
  39377. *
  39378. */
  39379. function ln(x) {
  39380. return new this(x).ln();
  39381. }
  39382. /*
  39383. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  39384. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  39385. *
  39386. * log[y](x)
  39387. *
  39388. * x {number|string|Decimal} The argument of the logarithm.
  39389. * y {number|string|Decimal} The base of the logarithm.
  39390. *
  39391. */
  39392. function log(x, y) {
  39393. return new this(x).log(y);
  39394. }
  39395. /*
  39396. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  39397. * significant digits using rounding mode `rounding`.
  39398. *
  39399. * x {number|string|Decimal}
  39400. *
  39401. */
  39402. function log2(x) {
  39403. return new this(x).log(2);
  39404. }
  39405. /*
  39406. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  39407. * significant digits using rounding mode `rounding`.
  39408. *
  39409. * x {number|string|Decimal}
  39410. *
  39411. */
  39412. function log10(x) {
  39413. return new this(x).log(10);
  39414. }
  39415. /*
  39416. * Return a new Decimal whose value is the maximum of the arguments.
  39417. *
  39418. * arguments {number|string|Decimal}
  39419. *
  39420. */
  39421. function max() {
  39422. return maxOrMin(this, arguments, 'lt');
  39423. }
  39424. /*
  39425. * Return a new Decimal whose value is the minimum of the arguments.
  39426. *
  39427. * arguments {number|string|Decimal}
  39428. *
  39429. */
  39430. function min() {
  39431. return maxOrMin(this, arguments, 'gt');
  39432. }
  39433. /*
  39434. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  39435. * using rounding mode `rounding`.
  39436. *
  39437. * x {number|string|Decimal}
  39438. * y {number|string|Decimal}
  39439. *
  39440. */
  39441. function mod(x, y) {
  39442. return new this(x).mod(y);
  39443. }
  39444. /*
  39445. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  39446. * digits using rounding mode `rounding`.
  39447. *
  39448. * x {number|string|Decimal}
  39449. * y {number|string|Decimal}
  39450. *
  39451. */
  39452. function mul(x, y) {
  39453. return new this(x).mul(y);
  39454. }
  39455. /*
  39456. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  39457. * significant digits using rounding mode `rounding`.
  39458. *
  39459. * x {number|string|Decimal} The base.
  39460. * y {number|string|Decimal} The exponent.
  39461. *
  39462. */
  39463. function pow(x, y) {
  39464. return new this(x).pow(y);
  39465. }
  39466. /*
  39467. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  39468. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  39469. * are produced).
  39470. *
  39471. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  39472. *
  39473. */
  39474. function random(sd) {
  39475. var d,
  39476. e,
  39477. k,
  39478. n,
  39479. i = 0,
  39480. r = new this(1),
  39481. rd = [];
  39482. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  39483. k = Math.ceil(sd / LOG_BASE);
  39484. if (!this.crypto) {
  39485. for (; i < k;) {
  39486. rd[i++] = Math.random() * 1e7 | 0;
  39487. } // Browsers supporting crypto.getRandomValues.
  39488. } else if (crypto.getRandomValues) {
  39489. d = crypto.getRandomValues(new Uint32Array(k));
  39490. for (; i < k;) {
  39491. n = d[i];
  39492. // 0 <= n < 4294967296
  39493. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  39494. if (n >= 4.29e9) {
  39495. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  39496. } else {
  39497. // 0 <= n <= 4289999999
  39498. // 0 <= (n % 1e7) <= 9999999
  39499. rd[i++] = n % 1e7;
  39500. }
  39501. }
  39502. // Node.js supporting crypto.randomBytes.
  39503. } else if (crypto.randomBytes) {
  39504. // buffer
  39505. d = crypto.randomBytes(k *= 4);
  39506. for (; i < k;) {
  39507. // 0 <= n < 2147483648
  39508. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  39509. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  39510. if (n >= 2.14e9) {
  39511. crypto.randomBytes(4).copy(d, i);
  39512. } else {
  39513. // 0 <= n <= 2139999999
  39514. // 0 <= (n % 1e7) <= 9999999
  39515. rd.push(n % 1e7);
  39516. i += 4;
  39517. }
  39518. }
  39519. i = k / 4;
  39520. } else {
  39521. throw Error(cryptoUnavailable);
  39522. }
  39523. k = rd[--i];
  39524. sd %= LOG_BASE;
  39525. // Convert trailing digits to zeros according to sd.
  39526. if (k && sd) {
  39527. n = mathpow(10, LOG_BASE - sd);
  39528. rd[i] = (k / n | 0) * n;
  39529. }
  39530. // Remove trailing words which are zero.
  39531. for (; rd[i] === 0; i--) {
  39532. rd.pop();
  39533. } // Zero?
  39534. if (i < 0) {
  39535. e = 0;
  39536. rd = [0];
  39537. } else {
  39538. e = -1;
  39539. // Remove leading words which are zero and adjust exponent accordingly.
  39540. for (; rd[0] === 0; e -= LOG_BASE) {
  39541. rd.shift();
  39542. } // Count the digits of the first word of rd to determine leading zeros.
  39543. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  39544. k++;
  39545. } // Adjust the exponent for leading zeros of the first word of rd.
  39546. if (k < LOG_BASE) e -= LOG_BASE - k;
  39547. }
  39548. r.e = e;
  39549. r.d = rd;
  39550. return r;
  39551. }
  39552. /*
  39553. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  39554. *
  39555. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  39556. *
  39557. * x {number|string|Decimal}
  39558. *
  39559. */
  39560. function round(x) {
  39561. return finalise(x = new this(x), x.e + 1, this.rounding);
  39562. }
  39563. /*
  39564. * Return
  39565. * 1 if x > 0,
  39566. * -1 if x < 0,
  39567. * 0 if x is 0,
  39568. * -0 if x is -0,
  39569. * NaN otherwise
  39570. *
  39571. */
  39572. function sign(x) {
  39573. x = new this(x);
  39574. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  39575. }
  39576. /*
  39577. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  39578. * using rounding mode `rounding`.
  39579. *
  39580. * x {number|string|Decimal} A value in radians.
  39581. *
  39582. */
  39583. function sin(x) {
  39584. return new this(x).sin();
  39585. }
  39586. /*
  39587. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  39588. * significant digits using rounding mode `rounding`.
  39589. *
  39590. * x {number|string|Decimal} A value in radians.
  39591. *
  39592. */
  39593. function sinh(x) {
  39594. return new this(x).sinh();
  39595. }
  39596. /*
  39597. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  39598. * digits using rounding mode `rounding`.
  39599. *
  39600. * x {number|string|Decimal}
  39601. *
  39602. */
  39603. function sqrt(x) {
  39604. return new this(x).sqrt();
  39605. }
  39606. /*
  39607. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  39608. * using rounding mode `rounding`.
  39609. *
  39610. * x {number|string|Decimal}
  39611. * y {number|string|Decimal}
  39612. *
  39613. */
  39614. function sub(x, y) {
  39615. return new this(x).sub(y);
  39616. }
  39617. /*
  39618. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  39619. * digits using rounding mode `rounding`.
  39620. *
  39621. * x {number|string|Decimal} A value in radians.
  39622. *
  39623. */
  39624. function tan(x) {
  39625. return new this(x).tan();
  39626. }
  39627. /*
  39628. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  39629. * significant digits using rounding mode `rounding`.
  39630. *
  39631. * x {number|string|Decimal} A value in radians.
  39632. *
  39633. */
  39634. function tanh(x) {
  39635. return new this(x).tanh();
  39636. }
  39637. /*
  39638. * Return a new Decimal whose value is `x` truncated to an integer.
  39639. *
  39640. * x {number|string|Decimal}
  39641. *
  39642. */
  39643. function trunc(x) {
  39644. return finalise(x = new this(x), x.e + 1, 1);
  39645. }
  39646. // Create and configure initial Decimal constructor.
  39647. Decimal = clone(DEFAULTS);
  39648. Decimal['default'] = Decimal.Decimal = Decimal;
  39649. // Create the internal constants from their string values.
  39650. LN10 = new Decimal(LN10);
  39651. PI = new Decimal(PI);
  39652. // Export.
  39653. // AMD.
  39654. if (true) {
  39655. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  39656. return Decimal;
  39657. }).call(exports, __webpack_require__, exports, module),
  39658. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  39659. // Node and other environments that support module.exports.
  39660. } else {}
  39661. })(undefined);
  39662. /***/ }),
  39663. /***/ "./node_modules/jquery/dist/jquery.js":
  39664. /*!********************************************!*\
  39665. !*** ./node_modules/jquery/dist/jquery.js ***!
  39666. \********************************************/
  39667. /*! no static exports found */
  39668. /***/ (function(module, exports, __webpack_require__) {
  39669. "use strict";
  39670. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  39671. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  39672. /*!
  39673. * jQuery JavaScript Library v3.3.1
  39674. * https://jquery.com/
  39675. *
  39676. * Includes Sizzle.js
  39677. * https://sizzlejs.com/
  39678. *
  39679. * Copyright JS Foundation and other contributors
  39680. * Released under the MIT license
  39681. * https://jquery.org/license
  39682. *
  39683. * Date: 2018-01-20T17:24Z
  39684. */
  39685. (function (global, factory) {
  39686. "use strict";
  39687. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  39688. // For CommonJS and CommonJS-like environments where a proper `window`
  39689. // is present, execute the factory and get jQuery.
  39690. // For environments that do not have a `window` with a `document`
  39691. // (such as Node.js), expose a factory as module.exports.
  39692. // This accentuates the need for the creation of a real `window`.
  39693. // e.g. var jQuery = require("jquery")(window);
  39694. // See ticket #14549 for more info.
  39695. module.exports = global.document ? factory(global, true) : function (w) {
  39696. if (!w.document) {
  39697. throw new Error("jQuery requires a window with a document");
  39698. }
  39699. return factory(w);
  39700. };
  39701. } else {
  39702. factory(global);
  39703. }
  39704. // Pass this if window is not defined yet
  39705. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  39706. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  39707. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  39708. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  39709. // enough that all such attempts are guarded in a try block.
  39710. "use strict";
  39711. var arr = [];
  39712. var document = window.document;
  39713. var getProto = Object.getPrototypeOf;
  39714. var _slice = arr.slice;
  39715. var concat = arr.concat;
  39716. var push = arr.push;
  39717. var indexOf = arr.indexOf;
  39718. var class2type = {};
  39719. var toString = class2type.toString;
  39720. var hasOwn = class2type.hasOwnProperty;
  39721. var fnToString = hasOwn.toString;
  39722. var ObjectFunctionString = fnToString.call(Object);
  39723. var support = {};
  39724. var isFunction = function isFunction(obj) {
  39725. // Support: Chrome <=57, Firefox <=52
  39726. // In some browsers, typeof returns "function" for HTML <object> elements
  39727. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  39728. // We don't want to classify *any* DOM node as a function.
  39729. return typeof obj === "function" && typeof obj.nodeType !== "number";
  39730. };
  39731. var isWindow = function isWindow(obj) {
  39732. return obj != null && obj === obj.window;
  39733. };
  39734. var preservedScriptAttributes = {
  39735. type: true,
  39736. src: true,
  39737. noModule: true
  39738. };
  39739. function DOMEval(code, doc, node) {
  39740. doc = doc || document;
  39741. var i,
  39742. script = doc.createElement("script");
  39743. script.text = code;
  39744. if (node) {
  39745. for (i in preservedScriptAttributes) {
  39746. if (node[i]) {
  39747. script[i] = node[i];
  39748. }
  39749. }
  39750. }
  39751. doc.head.appendChild(script).parentNode.removeChild(script);
  39752. }
  39753. function toType(obj) {
  39754. if (obj == null) {
  39755. return obj + "";
  39756. }
  39757. // Support: Android <=2.3 only (functionish RegExp)
  39758. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  39759. }
  39760. /* global Symbol */
  39761. // Defining this global in .eslintrc.json would create a danger of using the global
  39762. // unguarded in another place, it seems safer to define global only for this module
  39763. var version = "3.3.1",
  39764. // Define a local copy of jQuery
  39765. jQuery = function jQuery(selector, context) {
  39766. // The jQuery object is actually just the init constructor 'enhanced'
  39767. // Need init if jQuery is called (just allow error to be thrown if not included)
  39768. return new jQuery.fn.init(selector, context);
  39769. },
  39770. // Support: Android <=4.0 only
  39771. // Make sure we trim BOM and NBSP
  39772. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  39773. jQuery.fn = jQuery.prototype = {
  39774. // The current version of jQuery being used
  39775. jquery: version,
  39776. constructor: jQuery,
  39777. // The default length of a jQuery object is 0
  39778. length: 0,
  39779. toArray: function toArray() {
  39780. return _slice.call(this);
  39781. },
  39782. // Get the Nth element in the matched element set OR
  39783. // Get the whole matched element set as a clean array
  39784. get: function get(num) {
  39785. // Return all the elements in a clean array
  39786. if (num == null) {
  39787. return _slice.call(this);
  39788. }
  39789. // Return just the one element from the set
  39790. return num < 0 ? this[num + this.length] : this[num];
  39791. },
  39792. // Take an array of elements and push it onto the stack
  39793. // (returning the new matched element set)
  39794. pushStack: function pushStack(elems) {
  39795. // Build a new jQuery matched element set
  39796. var ret = jQuery.merge(this.constructor(), elems);
  39797. // Add the old object onto the stack (as a reference)
  39798. ret.prevObject = this;
  39799. // Return the newly-formed element set
  39800. return ret;
  39801. },
  39802. // Execute a callback for every element in the matched set.
  39803. each: function each(callback) {
  39804. return jQuery.each(this, callback);
  39805. },
  39806. map: function map(callback) {
  39807. return this.pushStack(jQuery.map(this, function (elem, i) {
  39808. return callback.call(elem, i, elem);
  39809. }));
  39810. },
  39811. slice: function slice() {
  39812. return this.pushStack(_slice.apply(this, arguments));
  39813. },
  39814. first: function first() {
  39815. return this.eq(0);
  39816. },
  39817. last: function last() {
  39818. return this.eq(-1);
  39819. },
  39820. eq: function eq(i) {
  39821. var len = this.length,
  39822. j = +i + (i < 0 ? len : 0);
  39823. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  39824. },
  39825. end: function end() {
  39826. return this.prevObject || this.constructor();
  39827. },
  39828. // For internal use only.
  39829. // Behaves like an Array's method, not like a jQuery method.
  39830. push: push,
  39831. sort: arr.sort,
  39832. splice: arr.splice
  39833. };
  39834. jQuery.extend = jQuery.fn.extend = function () {
  39835. var options,
  39836. name,
  39837. src,
  39838. copy,
  39839. copyIsArray,
  39840. clone,
  39841. target = arguments[0] || {},
  39842. i = 1,
  39843. length = arguments.length,
  39844. deep = false;
  39845. // Handle a deep copy situation
  39846. if (typeof target === "boolean") {
  39847. deep = target;
  39848. // Skip the boolean and the target
  39849. target = arguments[i] || {};
  39850. i++;
  39851. }
  39852. // Handle case when target is a string or something (possible in deep copy)
  39853. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  39854. target = {};
  39855. }
  39856. // Extend jQuery itself if only one argument is passed
  39857. if (i === length) {
  39858. target = this;
  39859. i--;
  39860. }
  39861. for (; i < length; i++) {
  39862. // Only deal with non-null/undefined values
  39863. if ((options = arguments[i]) != null) {
  39864. // Extend the base object
  39865. for (name in options) {
  39866. src = target[name];
  39867. copy = options[name];
  39868. // Prevent never-ending loop
  39869. if (target === copy) {
  39870. continue;
  39871. }
  39872. // Recurse if we're merging plain objects or arrays
  39873. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  39874. if (copyIsArray) {
  39875. copyIsArray = false;
  39876. clone = src && Array.isArray(src) ? src : [];
  39877. } else {
  39878. clone = src && jQuery.isPlainObject(src) ? src : {};
  39879. }
  39880. // Never move original objects, clone them
  39881. target[name] = jQuery.extend(deep, clone, copy);
  39882. // Don't bring in undefined values
  39883. } else if (copy !== undefined) {
  39884. target[name] = copy;
  39885. }
  39886. }
  39887. }
  39888. }
  39889. // Return the modified object
  39890. return target;
  39891. };
  39892. jQuery.extend({
  39893. // Unique for each copy of jQuery on the page
  39894. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  39895. // Assume jQuery is ready without the ready module
  39896. isReady: true,
  39897. error: function error(msg) {
  39898. throw new Error(msg);
  39899. },
  39900. noop: function noop() {},
  39901. isPlainObject: function isPlainObject(obj) {
  39902. var proto, Ctor;
  39903. // Detect obvious negatives
  39904. // Use toString instead of jQuery.type to catch host objects
  39905. if (!obj || toString.call(obj) !== "[object Object]") {
  39906. return false;
  39907. }
  39908. proto = getProto(obj);
  39909. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  39910. if (!proto) {
  39911. return true;
  39912. }
  39913. // Objects with prototype are plain iff they were constructed by a global Object function
  39914. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  39915. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  39916. },
  39917. isEmptyObject: function isEmptyObject(obj) {
  39918. /* eslint-disable no-unused-vars */
  39919. // See https://github.com/eslint/eslint/issues/6125
  39920. var name;
  39921. for (name in obj) {
  39922. return false;
  39923. }
  39924. return true;
  39925. },
  39926. // Evaluates a script in a global context
  39927. globalEval: function globalEval(code) {
  39928. DOMEval(code);
  39929. },
  39930. each: function each(obj, callback) {
  39931. var length,
  39932. i = 0;
  39933. if (isArrayLike(obj)) {
  39934. length = obj.length;
  39935. for (; i < length; i++) {
  39936. if (callback.call(obj[i], i, obj[i]) === false) {
  39937. break;
  39938. }
  39939. }
  39940. } else {
  39941. for (i in obj) {
  39942. if (callback.call(obj[i], i, obj[i]) === false) {
  39943. break;
  39944. }
  39945. }
  39946. }
  39947. return obj;
  39948. },
  39949. // Support: Android <=4.0 only
  39950. trim: function trim(text) {
  39951. return text == null ? "" : (text + "").replace(rtrim, "");
  39952. },
  39953. // results is for internal usage only
  39954. makeArray: function makeArray(arr, results) {
  39955. var ret = results || [];
  39956. if (arr != null) {
  39957. if (isArrayLike(Object(arr))) {
  39958. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  39959. } else {
  39960. push.call(ret, arr);
  39961. }
  39962. }
  39963. return ret;
  39964. },
  39965. inArray: function inArray(elem, arr, i) {
  39966. return arr == null ? -1 : indexOf.call(arr, elem, i);
  39967. },
  39968. // Support: Android <=4.0 only, PhantomJS 1 only
  39969. // push.apply(_, arraylike) throws on ancient WebKit
  39970. merge: function merge(first, second) {
  39971. var len = +second.length,
  39972. j = 0,
  39973. i = first.length;
  39974. for (; j < len; j++) {
  39975. first[i++] = second[j];
  39976. }
  39977. first.length = i;
  39978. return first;
  39979. },
  39980. grep: function grep(elems, callback, invert) {
  39981. var callbackInverse,
  39982. matches = [],
  39983. i = 0,
  39984. length = elems.length,
  39985. callbackExpect = !invert;
  39986. // Go through the array, only saving the items
  39987. // that pass the validator function
  39988. for (; i < length; i++) {
  39989. callbackInverse = !callback(elems[i], i);
  39990. if (callbackInverse !== callbackExpect) {
  39991. matches.push(elems[i]);
  39992. }
  39993. }
  39994. return matches;
  39995. },
  39996. // arg is for internal usage only
  39997. map: function map(elems, callback, arg) {
  39998. var length,
  39999. value,
  40000. i = 0,
  40001. ret = [];
  40002. // Go through the array, translating each of the items to their new values
  40003. if (isArrayLike(elems)) {
  40004. length = elems.length;
  40005. for (; i < length; i++) {
  40006. value = callback(elems[i], i, arg);
  40007. if (value != null) {
  40008. ret.push(value);
  40009. }
  40010. }
  40011. // Go through every key on the object,
  40012. } else {
  40013. for (i in elems) {
  40014. value = callback(elems[i], i, arg);
  40015. if (value != null) {
  40016. ret.push(value);
  40017. }
  40018. }
  40019. }
  40020. // Flatten any nested arrays
  40021. return concat.apply([], ret);
  40022. },
  40023. // A global GUID counter for objects
  40024. guid: 1,
  40025. // jQuery.support is not used in Core but other projects attach their
  40026. // properties to it so it needs to exist.
  40027. support: support
  40028. });
  40029. if (typeof Symbol === "function") {
  40030. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  40031. }
  40032. // Populate the class2type map
  40033. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  40034. class2type["[object " + name + "]"] = name.toLowerCase();
  40035. });
  40036. function isArrayLike(obj) {
  40037. // Support: real iOS 8.2 only (not reproducible in simulator)
  40038. // `in` check used to prevent JIT error (gh-2145)
  40039. // hasOwn isn't used here due to false negatives
  40040. // regarding Nodelist length in IE
  40041. var length = !!obj && "length" in obj && obj.length,
  40042. type = toType(obj);
  40043. if (isFunction(obj) || isWindow(obj)) {
  40044. return false;
  40045. }
  40046. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  40047. }
  40048. var Sizzle =
  40049. /*!
  40050. * Sizzle CSS Selector Engine v2.3.3
  40051. * https://sizzlejs.com/
  40052. *
  40053. * Copyright jQuery Foundation and other contributors
  40054. * Released under the MIT license
  40055. * http://jquery.org/license
  40056. *
  40057. * Date: 2016-08-08
  40058. */
  40059. function (window) {
  40060. var i,
  40061. support,
  40062. Expr,
  40063. getText,
  40064. isXML,
  40065. tokenize,
  40066. compile,
  40067. select,
  40068. outermostContext,
  40069. sortInput,
  40070. hasDuplicate,
  40071. // Local document vars
  40072. setDocument,
  40073. document,
  40074. docElem,
  40075. documentIsHTML,
  40076. rbuggyQSA,
  40077. rbuggyMatches,
  40078. matches,
  40079. contains,
  40080. // Instance-specific data
  40081. expando = "sizzle" + 1 * new Date(),
  40082. preferredDoc = window.document,
  40083. dirruns = 0,
  40084. done = 0,
  40085. classCache = createCache(),
  40086. tokenCache = createCache(),
  40087. compilerCache = createCache(),
  40088. sortOrder = function sortOrder(a, b) {
  40089. if (a === b) {
  40090. hasDuplicate = true;
  40091. }
  40092. return 0;
  40093. },
  40094. // Instance methods
  40095. hasOwn = {}.hasOwnProperty,
  40096. arr = [],
  40097. pop = arr.pop,
  40098. push_native = arr.push,
  40099. push = arr.push,
  40100. slice = arr.slice,
  40101. // Use a stripped-down indexOf as it's faster than native
  40102. // https://jsperf.com/thor-indexof-vs-for/5
  40103. indexOf = function indexOf(list, elem) {
  40104. var i = 0,
  40105. len = list.length;
  40106. for (; i < len; i++) {
  40107. if (list[i] === elem) {
  40108. return i;
  40109. }
  40110. }
  40111. return -1;
  40112. },
  40113. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  40114. // Regular expressions
  40115. // http://www.w3.org/TR/css3-selectors/#whitespace
  40116. whitespace = "[\\x20\\t\\r\\n\\f]",
  40117. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  40118. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  40119. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  40120. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  40121. // Operator (capture 2)
  40122. "*([*^$|!~]?=)" + whitespace +
  40123. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  40124. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  40125. pseudos = ":(" + identifier + ")(?:\\((" +
  40126. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  40127. // 1. quoted (capture 3; capture 4 or capture 5)
  40128. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  40129. // 2. simple (capture 6)
  40130. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  40131. // 3. anything else (capture 2)
  40132. ".*" + ")\\)|)",
  40133. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  40134. rwhitespace = new RegExp(whitespace + "+", "g"),
  40135. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  40136. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  40137. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  40138. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  40139. rpseudo = new RegExp(pseudos),
  40140. ridentifier = new RegExp("^" + identifier + "$"),
  40141. matchExpr = {
  40142. "ID": new RegExp("^#(" + identifier + ")"),
  40143. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  40144. "TAG": new RegExp("^(" + identifier + "|[*])"),
  40145. "ATTR": new RegExp("^" + attributes),
  40146. "PSEUDO": new RegExp("^" + pseudos),
  40147. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  40148. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  40149. // For use in libraries implementing .is()
  40150. // We use this for POS matching in `select`
  40151. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  40152. },
  40153. rinputs = /^(?:input|select|textarea|button)$/i,
  40154. rheader = /^h\d$/i,
  40155. rnative = /^[^{]+\{\s*\[native \w/,
  40156. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  40157. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  40158. rsibling = /[+~]/,
  40159. // CSS escapes
  40160. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  40161. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  40162. funescape = function funescape(_, escaped, escapedWhitespace) {
  40163. var high = "0x" + escaped - 0x10000;
  40164. // NaN means non-codepoint
  40165. // Support: Firefox<24
  40166. // Workaround erroneous numeric interpretation of +"0x"
  40167. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  40168. // BMP codepoint
  40169. String.fromCharCode(high + 0x10000) :
  40170. // Supplemental Plane codepoint (surrogate pair)
  40171. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  40172. },
  40173. // CSS string/identifier serialization
  40174. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  40175. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  40176. fcssescape = function fcssescape(ch, asCodePoint) {
  40177. if (asCodePoint) {
  40178. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  40179. if (ch === "\0") {
  40180. return "\uFFFD";
  40181. }
  40182. // Control characters and (dependent upon position) numbers get escaped as code points
  40183. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  40184. }
  40185. // Other potentially-special ASCII characters get backslash-escaped
  40186. return "\\" + ch;
  40187. },
  40188. // Used for iframes
  40189. // See setDocument()
  40190. // Removing the function wrapper causes a "Permission Denied"
  40191. // error in IE
  40192. unloadHandler = function unloadHandler() {
  40193. setDocument();
  40194. },
  40195. disabledAncestor = addCombinator(function (elem) {
  40196. return elem.disabled === true && ("form" in elem || "label" in elem);
  40197. }, { dir: "parentNode", next: "legend" });
  40198. // Optimize for push.apply( _, NodeList )
  40199. try {
  40200. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  40201. // Support: Android<4.0
  40202. // Detect silently failing push.apply
  40203. arr[preferredDoc.childNodes.length].nodeType;
  40204. } catch (e) {
  40205. push = { apply: arr.length ?
  40206. // Leverage slice if possible
  40207. function (target, els) {
  40208. push_native.apply(target, slice.call(els));
  40209. } :
  40210. // Support: IE<9
  40211. // Otherwise append directly
  40212. function (target, els) {
  40213. var j = target.length,
  40214. i = 0;
  40215. // Can't trust NodeList.length
  40216. while (target[j++] = els[i++]) {}
  40217. target.length = j - 1;
  40218. }
  40219. };
  40220. }
  40221. function Sizzle(selector, context, results, seed) {
  40222. var m,
  40223. i,
  40224. elem,
  40225. nid,
  40226. match,
  40227. groups,
  40228. newSelector,
  40229. newContext = context && context.ownerDocument,
  40230. // nodeType defaults to 9, since context defaults to document
  40231. nodeType = context ? context.nodeType : 9;
  40232. results = results || [];
  40233. // Return early from calls with invalid selector or context
  40234. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  40235. return results;
  40236. }
  40237. // Try to shortcut find operations (as opposed to filters) in HTML documents
  40238. if (!seed) {
  40239. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  40240. setDocument(context);
  40241. }
  40242. context = context || document;
  40243. if (documentIsHTML) {
  40244. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  40245. // (excepting DocumentFragment context, where the methods don't exist)
  40246. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  40247. // ID selector
  40248. if (m = match[1]) {
  40249. // Document context
  40250. if (nodeType === 9) {
  40251. if (elem = context.getElementById(m)) {
  40252. // Support: IE, Opera, Webkit
  40253. // TODO: identify versions
  40254. // getElementById can match elements by name instead of ID
  40255. if (elem.id === m) {
  40256. results.push(elem);
  40257. return results;
  40258. }
  40259. } else {
  40260. return results;
  40261. }
  40262. // Element context
  40263. } else {
  40264. // Support: IE, Opera, Webkit
  40265. // TODO: identify versions
  40266. // getElementById can match elements by name instead of ID
  40267. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  40268. results.push(elem);
  40269. return results;
  40270. }
  40271. }
  40272. // Type selector
  40273. } else if (match[2]) {
  40274. push.apply(results, context.getElementsByTagName(selector));
  40275. return results;
  40276. // Class selector
  40277. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  40278. push.apply(results, context.getElementsByClassName(m));
  40279. return results;
  40280. }
  40281. }
  40282. // Take advantage of querySelectorAll
  40283. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  40284. if (nodeType !== 1) {
  40285. newContext = context;
  40286. newSelector = selector;
  40287. // qSA looks outside Element context, which is not what we want
  40288. // Thanks to Andrew Dupont for this workaround technique
  40289. // Support: IE <=8
  40290. // Exclude object elements
  40291. } else if (context.nodeName.toLowerCase() !== "object") {
  40292. // Capture the context ID, setting it first if necessary
  40293. if (nid = context.getAttribute("id")) {
  40294. nid = nid.replace(rcssescape, fcssescape);
  40295. } else {
  40296. context.setAttribute("id", nid = expando);
  40297. }
  40298. // Prefix every selector in the list
  40299. groups = tokenize(selector);
  40300. i = groups.length;
  40301. while (i--) {
  40302. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  40303. }
  40304. newSelector = groups.join(",");
  40305. // Expand context for sibling selectors
  40306. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  40307. }
  40308. if (newSelector) {
  40309. try {
  40310. push.apply(results, newContext.querySelectorAll(newSelector));
  40311. return results;
  40312. } catch (qsaError) {} finally {
  40313. if (nid === expando) {
  40314. context.removeAttribute("id");
  40315. }
  40316. }
  40317. }
  40318. }
  40319. }
  40320. }
  40321. // All others
  40322. return select(selector.replace(rtrim, "$1"), context, results, seed);
  40323. }
  40324. /**
  40325. * Create key-value caches of limited size
  40326. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  40327. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  40328. * deleting the oldest entry
  40329. */
  40330. function createCache() {
  40331. var keys = [];
  40332. function cache(key, value) {
  40333. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  40334. if (keys.push(key + " ") > Expr.cacheLength) {
  40335. // Only keep the most recent entries
  40336. delete cache[keys.shift()];
  40337. }
  40338. return cache[key + " "] = value;
  40339. }
  40340. return cache;
  40341. }
  40342. /**
  40343. * Mark a function for special use by Sizzle
  40344. * @param {Function} fn The function to mark
  40345. */
  40346. function markFunction(fn) {
  40347. fn[expando] = true;
  40348. return fn;
  40349. }
  40350. /**
  40351. * Support testing using an element
  40352. * @param {Function} fn Passed the created element and returns a boolean result
  40353. */
  40354. function assert(fn) {
  40355. var el = document.createElement("fieldset");
  40356. try {
  40357. return !!fn(el);
  40358. } catch (e) {
  40359. return false;
  40360. } finally {
  40361. // Remove from its parent by default
  40362. if (el.parentNode) {
  40363. el.parentNode.removeChild(el);
  40364. }
  40365. // release memory in IE
  40366. el = null;
  40367. }
  40368. }
  40369. /**
  40370. * Adds the same handler for all of the specified attrs
  40371. * @param {String} attrs Pipe-separated list of attributes
  40372. * @param {Function} handler The method that will be applied
  40373. */
  40374. function addHandle(attrs, handler) {
  40375. var arr = attrs.split("|"),
  40376. i = arr.length;
  40377. while (i--) {
  40378. Expr.attrHandle[arr[i]] = handler;
  40379. }
  40380. }
  40381. /**
  40382. * Checks document order of two siblings
  40383. * @param {Element} a
  40384. * @param {Element} b
  40385. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  40386. */
  40387. function siblingCheck(a, b) {
  40388. var cur = b && a,
  40389. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  40390. // Use IE sourceIndex if available on both nodes
  40391. if (diff) {
  40392. return diff;
  40393. }
  40394. // Check if b follows a
  40395. if (cur) {
  40396. while (cur = cur.nextSibling) {
  40397. if (cur === b) {
  40398. return -1;
  40399. }
  40400. }
  40401. }
  40402. return a ? 1 : -1;
  40403. }
  40404. /**
  40405. * Returns a function to use in pseudos for input types
  40406. * @param {String} type
  40407. */
  40408. function createInputPseudo(type) {
  40409. return function (elem) {
  40410. var name = elem.nodeName.toLowerCase();
  40411. return name === "input" && elem.type === type;
  40412. };
  40413. }
  40414. /**
  40415. * Returns a function to use in pseudos for buttons
  40416. * @param {String} type
  40417. */
  40418. function createButtonPseudo(type) {
  40419. return function (elem) {
  40420. var name = elem.nodeName.toLowerCase();
  40421. return (name === "input" || name === "button") && elem.type === type;
  40422. };
  40423. }
  40424. /**
  40425. * Returns a function to use in pseudos for :enabled/:disabled
  40426. * @param {Boolean} disabled true for :disabled; false for :enabled
  40427. */
  40428. function createDisabledPseudo(disabled) {
  40429. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  40430. return function (elem) {
  40431. // Only certain elements can match :enabled or :disabled
  40432. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  40433. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  40434. if ("form" in elem) {
  40435. // Check for inherited disabledness on relevant non-disabled elements:
  40436. // * listed form-associated elements in a disabled fieldset
  40437. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  40438. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  40439. // * option elements in a disabled optgroup
  40440. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  40441. // All such elements have a "form" property.
  40442. if (elem.parentNode && elem.disabled === false) {
  40443. // Option elements defer to a parent optgroup if present
  40444. if ("label" in elem) {
  40445. if ("label" in elem.parentNode) {
  40446. return elem.parentNode.disabled === disabled;
  40447. } else {
  40448. return elem.disabled === disabled;
  40449. }
  40450. }
  40451. // Support: IE 6 - 11
  40452. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  40453. return elem.isDisabled === disabled ||
  40454. // Where there is no isDisabled, check manually
  40455. /* jshint -W018 */
  40456. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  40457. }
  40458. return elem.disabled === disabled;
  40459. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  40460. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  40461. // even exist on them, let alone have a boolean value.
  40462. } else if ("label" in elem) {
  40463. return elem.disabled === disabled;
  40464. }
  40465. // Remaining elements are neither :enabled nor :disabled
  40466. return false;
  40467. };
  40468. }
  40469. /**
  40470. * Returns a function to use in pseudos for positionals
  40471. * @param {Function} fn
  40472. */
  40473. function createPositionalPseudo(fn) {
  40474. return markFunction(function (argument) {
  40475. argument = +argument;
  40476. return markFunction(function (seed, matches) {
  40477. var j,
  40478. matchIndexes = fn([], seed.length, argument),
  40479. i = matchIndexes.length;
  40480. // Match elements found at the specified indexes
  40481. while (i--) {
  40482. if (seed[j = matchIndexes[i]]) {
  40483. seed[j] = !(matches[j] = seed[j]);
  40484. }
  40485. }
  40486. });
  40487. });
  40488. }
  40489. /**
  40490. * Checks a node for validity as a Sizzle context
  40491. * @param {Element|Object=} context
  40492. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  40493. */
  40494. function testContext(context) {
  40495. return context && typeof context.getElementsByTagName !== "undefined" && context;
  40496. }
  40497. // Expose support vars for convenience
  40498. support = Sizzle.support = {};
  40499. /**
  40500. * Detects XML nodes
  40501. * @param {Element|Object} elem An element or a document
  40502. * @returns {Boolean} True iff elem is a non-HTML XML node
  40503. */
  40504. isXML = Sizzle.isXML = function (elem) {
  40505. // documentElement is verified for cases where it doesn't yet exist
  40506. // (such as loading iframes in IE - #4833)
  40507. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  40508. return documentElement ? documentElement.nodeName !== "HTML" : false;
  40509. };
  40510. /**
  40511. * Sets document-related variables once based on the current document
  40512. * @param {Element|Object} [doc] An element or document object to use to set the document
  40513. * @returns {Object} Returns the current document
  40514. */
  40515. setDocument = Sizzle.setDocument = function (node) {
  40516. var hasCompare,
  40517. subWindow,
  40518. doc = node ? node.ownerDocument || node : preferredDoc;
  40519. // Return early if doc is invalid or already selected
  40520. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  40521. return document;
  40522. }
  40523. // Update global variables
  40524. document = doc;
  40525. docElem = document.documentElement;
  40526. documentIsHTML = !isXML(document);
  40527. // Support: IE 9-11, Edge
  40528. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  40529. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  40530. // Support: IE 11, Edge
  40531. if (subWindow.addEventListener) {
  40532. subWindow.addEventListener("unload", unloadHandler, false);
  40533. // Support: IE 9 - 10 only
  40534. } else if (subWindow.attachEvent) {
  40535. subWindow.attachEvent("onunload", unloadHandler);
  40536. }
  40537. }
  40538. /* Attributes
  40539. ---------------------------------------------------------------------- */
  40540. // Support: IE<8
  40541. // Verify that getAttribute really returns attributes and not properties
  40542. // (excepting IE8 booleans)
  40543. support.attributes = assert(function (el) {
  40544. el.className = "i";
  40545. return !el.getAttribute("className");
  40546. });
  40547. /* getElement(s)By*
  40548. ---------------------------------------------------------------------- */
  40549. // Check if getElementsByTagName("*") returns only elements
  40550. support.getElementsByTagName = assert(function (el) {
  40551. el.appendChild(document.createComment(""));
  40552. return !el.getElementsByTagName("*").length;
  40553. });
  40554. // Support: IE<9
  40555. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  40556. // Support: IE<10
  40557. // Check if getElementById returns elements by name
  40558. // The broken getElementById methods don't pick up programmatically-set names,
  40559. // so use a roundabout getElementsByName test
  40560. support.getById = assert(function (el) {
  40561. docElem.appendChild(el).id = expando;
  40562. return !document.getElementsByName || !document.getElementsByName(expando).length;
  40563. });
  40564. // ID filter and find
  40565. if (support.getById) {
  40566. Expr.filter["ID"] = function (id) {
  40567. var attrId = id.replace(runescape, funescape);
  40568. return function (elem) {
  40569. return elem.getAttribute("id") === attrId;
  40570. };
  40571. };
  40572. Expr.find["ID"] = function (id, context) {
  40573. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  40574. var elem = context.getElementById(id);
  40575. return elem ? [elem] : [];
  40576. }
  40577. };
  40578. } else {
  40579. Expr.filter["ID"] = function (id) {
  40580. var attrId = id.replace(runescape, funescape);
  40581. return function (elem) {
  40582. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  40583. return node && node.value === attrId;
  40584. };
  40585. };
  40586. // Support: IE 6 - 7 only
  40587. // getElementById is not reliable as a find shortcut
  40588. Expr.find["ID"] = function (id, context) {
  40589. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  40590. var node,
  40591. i,
  40592. elems,
  40593. elem = context.getElementById(id);
  40594. if (elem) {
  40595. // Verify the id attribute
  40596. node = elem.getAttributeNode("id");
  40597. if (node && node.value === id) {
  40598. return [elem];
  40599. }
  40600. // Fall back on getElementsByName
  40601. elems = context.getElementsByName(id);
  40602. i = 0;
  40603. while (elem = elems[i++]) {
  40604. node = elem.getAttributeNode("id");
  40605. if (node && node.value === id) {
  40606. return [elem];
  40607. }
  40608. }
  40609. }
  40610. return [];
  40611. }
  40612. };
  40613. }
  40614. // Tag
  40615. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  40616. if (typeof context.getElementsByTagName !== "undefined") {
  40617. return context.getElementsByTagName(tag);
  40618. // DocumentFragment nodes don't have gEBTN
  40619. } else if (support.qsa) {
  40620. return context.querySelectorAll(tag);
  40621. }
  40622. } : function (tag, context) {
  40623. var elem,
  40624. tmp = [],
  40625. i = 0,
  40626. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  40627. results = context.getElementsByTagName(tag);
  40628. // Filter out possible comments
  40629. if (tag === "*") {
  40630. while (elem = results[i++]) {
  40631. if (elem.nodeType === 1) {
  40632. tmp.push(elem);
  40633. }
  40634. }
  40635. return tmp;
  40636. }
  40637. return results;
  40638. };
  40639. // Class
  40640. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  40641. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  40642. return context.getElementsByClassName(className);
  40643. }
  40644. };
  40645. /* QSA/matchesSelector
  40646. ---------------------------------------------------------------------- */
  40647. // QSA and matchesSelector support
  40648. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  40649. rbuggyMatches = [];
  40650. // qSa(:focus) reports false when true (Chrome 21)
  40651. // We allow this because of a bug in IE8/9 that throws an error
  40652. // whenever `document.activeElement` is accessed on an iframe
  40653. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  40654. // See https://bugs.jquery.com/ticket/13378
  40655. rbuggyQSA = [];
  40656. if (support.qsa = rnative.test(document.querySelectorAll)) {
  40657. // Build QSA regex
  40658. // Regex strategy adopted from Diego Perini
  40659. assert(function (el) {
  40660. // Select is set to empty string on purpose
  40661. // This is to test IE's treatment of not explicitly
  40662. // setting a boolean content attribute,
  40663. // since its presence should be enough
  40664. // https://bugs.jquery.com/ticket/12359
  40665. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  40666. // Support: IE8, Opera 11-12.16
  40667. // Nothing should be selected when empty strings follow ^= or $= or *=
  40668. // The test attribute must be unknown in Opera but "safe" for WinRT
  40669. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  40670. if (el.querySelectorAll("[msallowcapture^='']").length) {
  40671. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  40672. }
  40673. // Support: IE8
  40674. // Boolean attributes and "value" are not treated correctly
  40675. if (!el.querySelectorAll("[selected]").length) {
  40676. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  40677. }
  40678. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  40679. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  40680. rbuggyQSA.push("~=");
  40681. }
  40682. // Webkit/Opera - :checked should return selected option elements
  40683. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  40684. // IE8 throws error here and will not see later tests
  40685. if (!el.querySelectorAll(":checked").length) {
  40686. rbuggyQSA.push(":checked");
  40687. }
  40688. // Support: Safari 8+, iOS 8+
  40689. // https://bugs.webkit.org/show_bug.cgi?id=136851
  40690. // In-page `selector#id sibling-combinator selector` fails
  40691. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  40692. rbuggyQSA.push(".#.+[+~]");
  40693. }
  40694. });
  40695. assert(function (el) {
  40696. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  40697. // Support: Windows 8 Native Apps
  40698. // The type and name attributes are restricted during .innerHTML assignment
  40699. var input = document.createElement("input");
  40700. input.setAttribute("type", "hidden");
  40701. el.appendChild(input).setAttribute("name", "D");
  40702. // Support: IE8
  40703. // Enforce case-sensitivity of name attribute
  40704. if (el.querySelectorAll("[name=d]").length) {
  40705. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  40706. }
  40707. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  40708. // IE8 throws error here and will not see later tests
  40709. if (el.querySelectorAll(":enabled").length !== 2) {
  40710. rbuggyQSA.push(":enabled", ":disabled");
  40711. }
  40712. // Support: IE9-11+
  40713. // IE's :disabled selector does not pick up the children of disabled fieldsets
  40714. docElem.appendChild(el).disabled = true;
  40715. if (el.querySelectorAll(":disabled").length !== 2) {
  40716. rbuggyQSA.push(":enabled", ":disabled");
  40717. }
  40718. // Opera 10-11 does not throw on post-comma invalid pseudos
  40719. el.querySelectorAll("*,:x");
  40720. rbuggyQSA.push(",.*:");
  40721. });
  40722. }
  40723. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  40724. assert(function (el) {
  40725. // Check to see if it's possible to do matchesSelector
  40726. // on a disconnected node (IE 9)
  40727. support.disconnectedMatch = matches.call(el, "*");
  40728. // This should fail with an exception
  40729. // Gecko does not error, returns false instead
  40730. matches.call(el, "[s!='']:x");
  40731. rbuggyMatches.push("!=", pseudos);
  40732. });
  40733. }
  40734. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  40735. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  40736. /* Contains
  40737. ---------------------------------------------------------------------- */
  40738. hasCompare = rnative.test(docElem.compareDocumentPosition);
  40739. // Element contains another
  40740. // Purposefully self-exclusive
  40741. // As in, an element does not contain itself
  40742. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  40743. var adown = a.nodeType === 9 ? a.documentElement : a,
  40744. bup = b && b.parentNode;
  40745. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  40746. } : function (a, b) {
  40747. if (b) {
  40748. while (b = b.parentNode) {
  40749. if (b === a) {
  40750. return true;
  40751. }
  40752. }
  40753. }
  40754. return false;
  40755. };
  40756. /* Sorting
  40757. ---------------------------------------------------------------------- */
  40758. // Document order sorting
  40759. sortOrder = hasCompare ? function (a, b) {
  40760. // Flag for duplicate removal
  40761. if (a === b) {
  40762. hasDuplicate = true;
  40763. return 0;
  40764. }
  40765. // Sort on method existence if only one input has compareDocumentPosition
  40766. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  40767. if (compare) {
  40768. return compare;
  40769. }
  40770. // Calculate position if both inputs belong to the same document
  40771. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  40772. // Otherwise we know they are disconnected
  40773. 1;
  40774. // Disconnected nodes
  40775. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  40776. // Choose the first element that is related to our preferred document
  40777. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  40778. return -1;
  40779. }
  40780. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  40781. return 1;
  40782. }
  40783. // Maintain original order
  40784. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  40785. }
  40786. return compare & 4 ? -1 : 1;
  40787. } : function (a, b) {
  40788. // Exit early if the nodes are identical
  40789. if (a === b) {
  40790. hasDuplicate = true;
  40791. return 0;
  40792. }
  40793. var cur,
  40794. i = 0,
  40795. aup = a.parentNode,
  40796. bup = b.parentNode,
  40797. ap = [a],
  40798. bp = [b];
  40799. // Parentless nodes are either documents or disconnected
  40800. if (!aup || !bup) {
  40801. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  40802. // If the nodes are siblings, we can do a quick check
  40803. } else if (aup === bup) {
  40804. return siblingCheck(a, b);
  40805. }
  40806. // Otherwise we need full lists of their ancestors for comparison
  40807. cur = a;
  40808. while (cur = cur.parentNode) {
  40809. ap.unshift(cur);
  40810. }
  40811. cur = b;
  40812. while (cur = cur.parentNode) {
  40813. bp.unshift(cur);
  40814. }
  40815. // Walk down the tree looking for a discrepancy
  40816. while (ap[i] === bp[i]) {
  40817. i++;
  40818. }
  40819. return i ?
  40820. // Do a sibling check if the nodes have a common ancestor
  40821. siblingCheck(ap[i], bp[i]) :
  40822. // Otherwise nodes in our document sort first
  40823. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  40824. };
  40825. return document;
  40826. };
  40827. Sizzle.matches = function (expr, elements) {
  40828. return Sizzle(expr, null, null, elements);
  40829. };
  40830. Sizzle.matchesSelector = function (elem, expr) {
  40831. // Set document vars if needed
  40832. if ((elem.ownerDocument || elem) !== document) {
  40833. setDocument(elem);
  40834. }
  40835. // Make sure that attribute selectors are quoted
  40836. expr = expr.replace(rattributeQuotes, "='$1']");
  40837. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  40838. try {
  40839. var ret = matches.call(elem, expr);
  40840. // IE 9's matchesSelector returns false on disconnected nodes
  40841. if (ret || support.disconnectedMatch ||
  40842. // As well, disconnected nodes are said to be in a document
  40843. // fragment in IE 9
  40844. elem.document && elem.document.nodeType !== 11) {
  40845. return ret;
  40846. }
  40847. } catch (e) {}
  40848. }
  40849. return Sizzle(expr, document, null, [elem]).length > 0;
  40850. };
  40851. Sizzle.contains = function (context, elem) {
  40852. // Set document vars if needed
  40853. if ((context.ownerDocument || context) !== document) {
  40854. setDocument(context);
  40855. }
  40856. return contains(context, elem);
  40857. };
  40858. Sizzle.attr = function (elem, name) {
  40859. // Set document vars if needed
  40860. if ((elem.ownerDocument || elem) !== document) {
  40861. setDocument(elem);
  40862. }
  40863. var fn = Expr.attrHandle[name.toLowerCase()],
  40864. // Don't get fooled by Object.prototype properties (jQuery #13807)
  40865. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  40866. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  40867. };
  40868. Sizzle.escape = function (sel) {
  40869. return (sel + "").replace(rcssescape, fcssescape);
  40870. };
  40871. Sizzle.error = function (msg) {
  40872. throw new Error("Syntax error, unrecognized expression: " + msg);
  40873. };
  40874. /**
  40875. * Document sorting and removing duplicates
  40876. * @param {ArrayLike} results
  40877. */
  40878. Sizzle.uniqueSort = function (results) {
  40879. var elem,
  40880. duplicates = [],
  40881. j = 0,
  40882. i = 0;
  40883. // Unless we *know* we can detect duplicates, assume their presence
  40884. hasDuplicate = !support.detectDuplicates;
  40885. sortInput = !support.sortStable && results.slice(0);
  40886. results.sort(sortOrder);
  40887. if (hasDuplicate) {
  40888. while (elem = results[i++]) {
  40889. if (elem === results[i]) {
  40890. j = duplicates.push(i);
  40891. }
  40892. }
  40893. while (j--) {
  40894. results.splice(duplicates[j], 1);
  40895. }
  40896. }
  40897. // Clear input after sorting to release objects
  40898. // See https://github.com/jquery/sizzle/pull/225
  40899. sortInput = null;
  40900. return results;
  40901. };
  40902. /**
  40903. * Utility function for retrieving the text value of an array of DOM nodes
  40904. * @param {Array|Element} elem
  40905. */
  40906. getText = Sizzle.getText = function (elem) {
  40907. var node,
  40908. ret = "",
  40909. i = 0,
  40910. nodeType = elem.nodeType;
  40911. if (!nodeType) {
  40912. // If no nodeType, this is expected to be an array
  40913. while (node = elem[i++]) {
  40914. // Do not traverse comment nodes
  40915. ret += getText(node);
  40916. }
  40917. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  40918. // Use textContent for elements
  40919. // innerText usage removed for consistency of new lines (jQuery #11153)
  40920. if (typeof elem.textContent === "string") {
  40921. return elem.textContent;
  40922. } else {
  40923. // Traverse its children
  40924. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  40925. ret += getText(elem);
  40926. }
  40927. }
  40928. } else if (nodeType === 3 || nodeType === 4) {
  40929. return elem.nodeValue;
  40930. }
  40931. // Do not include comment or processing instruction nodes
  40932. return ret;
  40933. };
  40934. Expr = Sizzle.selectors = {
  40935. // Can be adjusted by the user
  40936. cacheLength: 50,
  40937. createPseudo: markFunction,
  40938. match: matchExpr,
  40939. attrHandle: {},
  40940. find: {},
  40941. relative: {
  40942. ">": { dir: "parentNode", first: true },
  40943. " ": { dir: "parentNode" },
  40944. "+": { dir: "previousSibling", first: true },
  40945. "~": { dir: "previousSibling" }
  40946. },
  40947. preFilter: {
  40948. "ATTR": function ATTR(match) {
  40949. match[1] = match[1].replace(runescape, funescape);
  40950. // Move the given value to match[3] whether quoted or unquoted
  40951. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  40952. if (match[2] === "~=") {
  40953. match[3] = " " + match[3] + " ";
  40954. }
  40955. return match.slice(0, 4);
  40956. },
  40957. "CHILD": function CHILD(match) {
  40958. /* matches from matchExpr["CHILD"]
  40959. 1 type (only|nth|...)
  40960. 2 what (child|of-type)
  40961. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  40962. 4 xn-component of xn+y argument ([+-]?\d*n|)
  40963. 5 sign of xn-component
  40964. 6 x of xn-component
  40965. 7 sign of y-component
  40966. 8 y of y-component
  40967. */
  40968. match[1] = match[1].toLowerCase();
  40969. if (match[1].slice(0, 3) === "nth") {
  40970. // nth-* requires argument
  40971. if (!match[3]) {
  40972. Sizzle.error(match[0]);
  40973. }
  40974. // numeric x and y parameters for Expr.filter.CHILD
  40975. // remember that false/true cast respectively to 0/1
  40976. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  40977. match[5] = +(match[7] + match[8] || match[3] === "odd");
  40978. // other types prohibit arguments
  40979. } else if (match[3]) {
  40980. Sizzle.error(match[0]);
  40981. }
  40982. return match;
  40983. },
  40984. "PSEUDO": function PSEUDO(match) {
  40985. var excess,
  40986. unquoted = !match[6] && match[2];
  40987. if (matchExpr["CHILD"].test(match[0])) {
  40988. return null;
  40989. }
  40990. // Accept quoted arguments as-is
  40991. if (match[3]) {
  40992. match[2] = match[4] || match[5] || "";
  40993. // Strip excess characters from unquoted arguments
  40994. } else if (unquoted && rpseudo.test(unquoted) && (
  40995. // Get excess from tokenize (recursively)
  40996. excess = tokenize(unquoted, true)) && (
  40997. // advance to the next closing parenthesis
  40998. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  40999. // excess is a negative index
  41000. match[0] = match[0].slice(0, excess);
  41001. match[2] = unquoted.slice(0, excess);
  41002. }
  41003. // Return only captures needed by the pseudo filter method (type and argument)
  41004. return match.slice(0, 3);
  41005. }
  41006. },
  41007. filter: {
  41008. "TAG": function TAG(nodeNameSelector) {
  41009. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  41010. return nodeNameSelector === "*" ? function () {
  41011. return true;
  41012. } : function (elem) {
  41013. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  41014. };
  41015. },
  41016. "CLASS": function CLASS(className) {
  41017. var pattern = classCache[className + " "];
  41018. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  41019. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  41020. });
  41021. },
  41022. "ATTR": function ATTR(name, operator, check) {
  41023. return function (elem) {
  41024. var result = Sizzle.attr(elem, name);
  41025. if (result == null) {
  41026. return operator === "!=";
  41027. }
  41028. if (!operator) {
  41029. return true;
  41030. }
  41031. result += "";
  41032. return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf(check) === 0 : operator === "*=" ? check && result.indexOf(check) > -1 : operator === "$=" ? check && result.slice(-check.length) === check : operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : false;
  41033. };
  41034. },
  41035. "CHILD": function CHILD(type, what, argument, first, last) {
  41036. var simple = type.slice(0, 3) !== "nth",
  41037. forward = type.slice(-4) !== "last",
  41038. ofType = what === "of-type";
  41039. return first === 1 && last === 0 ?
  41040. // Shortcut for :nth-*(n)
  41041. function (elem) {
  41042. return !!elem.parentNode;
  41043. } : function (elem, context, xml) {
  41044. var cache,
  41045. uniqueCache,
  41046. outerCache,
  41047. node,
  41048. nodeIndex,
  41049. start,
  41050. dir = simple !== forward ? "nextSibling" : "previousSibling",
  41051. parent = elem.parentNode,
  41052. name = ofType && elem.nodeName.toLowerCase(),
  41053. useCache = !xml && !ofType,
  41054. diff = false;
  41055. if (parent) {
  41056. // :(first|last|only)-(child|of-type)
  41057. if (simple) {
  41058. while (dir) {
  41059. node = elem;
  41060. while (node = node[dir]) {
  41061. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  41062. return false;
  41063. }
  41064. }
  41065. // Reverse direction for :only-* (if we haven't yet done so)
  41066. start = dir = type === "only" && !start && "nextSibling";
  41067. }
  41068. return true;
  41069. }
  41070. start = [forward ? parent.firstChild : parent.lastChild];
  41071. // non-xml :nth-child(...) stores cache data on `parent`
  41072. if (forward && useCache) {
  41073. // Seek `elem` from a previously-cached index
  41074. // ...in a gzip-friendly way
  41075. node = parent;
  41076. outerCache = node[expando] || (node[expando] = {});
  41077. // Support: IE <9 only
  41078. // Defend against cloned attroperties (jQuery gh-1709)
  41079. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  41080. cache = uniqueCache[type] || [];
  41081. nodeIndex = cache[0] === dirruns && cache[1];
  41082. diff = nodeIndex && cache[2];
  41083. node = nodeIndex && parent.childNodes[nodeIndex];
  41084. while (node = ++nodeIndex && node && node[dir] || (
  41085. // Fallback to seeking `elem` from the start
  41086. diff = nodeIndex = 0) || start.pop()) {
  41087. // When found, cache indexes on `parent` and break
  41088. if (node.nodeType === 1 && ++diff && node === elem) {
  41089. uniqueCache[type] = [dirruns, nodeIndex, diff];
  41090. break;
  41091. }
  41092. }
  41093. } else {
  41094. // Use previously-cached element index if available
  41095. if (useCache) {
  41096. // ...in a gzip-friendly way
  41097. node = elem;
  41098. outerCache = node[expando] || (node[expando] = {});
  41099. // Support: IE <9 only
  41100. // Defend against cloned attroperties (jQuery gh-1709)
  41101. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  41102. cache = uniqueCache[type] || [];
  41103. nodeIndex = cache[0] === dirruns && cache[1];
  41104. diff = nodeIndex;
  41105. }
  41106. // xml :nth-child(...)
  41107. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  41108. if (diff === false) {
  41109. // Use the same loop as above to seek `elem` from the start
  41110. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  41111. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  41112. // Cache the index of each encountered element
  41113. if (useCache) {
  41114. outerCache = node[expando] || (node[expando] = {});
  41115. // Support: IE <9 only
  41116. // Defend against cloned attroperties (jQuery gh-1709)
  41117. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  41118. uniqueCache[type] = [dirruns, diff];
  41119. }
  41120. if (node === elem) {
  41121. break;
  41122. }
  41123. }
  41124. }
  41125. }
  41126. }
  41127. // Incorporate the offset, then check against cycle size
  41128. diff -= last;
  41129. return diff === first || diff % first === 0 && diff / first >= 0;
  41130. }
  41131. };
  41132. },
  41133. "PSEUDO": function PSEUDO(pseudo, argument) {
  41134. // pseudo-class names are case-insensitive
  41135. // http://www.w3.org/TR/selectors/#pseudo-classes
  41136. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  41137. // Remember that setFilters inherits from pseudos
  41138. var args,
  41139. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  41140. // The user may use createPseudo to indicate that
  41141. // arguments are needed to create the filter function
  41142. // just as Sizzle does
  41143. if (fn[expando]) {
  41144. return fn(argument);
  41145. }
  41146. // But maintain support for old signatures
  41147. if (fn.length > 1) {
  41148. args = [pseudo, pseudo, "", argument];
  41149. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  41150. var idx,
  41151. matched = fn(seed, argument),
  41152. i = matched.length;
  41153. while (i--) {
  41154. idx = indexOf(seed, matched[i]);
  41155. seed[idx] = !(matches[idx] = matched[i]);
  41156. }
  41157. }) : function (elem) {
  41158. return fn(elem, 0, args);
  41159. };
  41160. }
  41161. return fn;
  41162. }
  41163. },
  41164. pseudos: {
  41165. // Potentially complex pseudos
  41166. "not": markFunction(function (selector) {
  41167. // Trim the selector passed to compile
  41168. // to avoid treating leading and trailing
  41169. // spaces as combinators
  41170. var input = [],
  41171. results = [],
  41172. matcher = compile(selector.replace(rtrim, "$1"));
  41173. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  41174. var elem,
  41175. unmatched = matcher(seed, null, xml, []),
  41176. i = seed.length;
  41177. // Match elements unmatched by `matcher`
  41178. while (i--) {
  41179. if (elem = unmatched[i]) {
  41180. seed[i] = !(matches[i] = elem);
  41181. }
  41182. }
  41183. }) : function (elem, context, xml) {
  41184. input[0] = elem;
  41185. matcher(input, null, xml, results);
  41186. // Don't keep the element (issue #299)
  41187. input[0] = null;
  41188. return !results.pop();
  41189. };
  41190. }),
  41191. "has": markFunction(function (selector) {
  41192. return function (elem) {
  41193. return Sizzle(selector, elem).length > 0;
  41194. };
  41195. }),
  41196. "contains": markFunction(function (text) {
  41197. text = text.replace(runescape, funescape);
  41198. return function (elem) {
  41199. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  41200. };
  41201. }),
  41202. // "Whether an element is represented by a :lang() selector
  41203. // is based solely on the element's language value
  41204. // being equal to the identifier C,
  41205. // or beginning with the identifier C immediately followed by "-".
  41206. // The matching of C against the element's language value is performed case-insensitively.
  41207. // The identifier C does not have to be a valid language name."
  41208. // http://www.w3.org/TR/selectors/#lang-pseudo
  41209. "lang": markFunction(function (lang) {
  41210. // lang value must be a valid identifier
  41211. if (!ridentifier.test(lang || "")) {
  41212. Sizzle.error("unsupported lang: " + lang);
  41213. }
  41214. lang = lang.replace(runescape, funescape).toLowerCase();
  41215. return function (elem) {
  41216. var elemLang;
  41217. do {
  41218. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  41219. elemLang = elemLang.toLowerCase();
  41220. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  41221. }
  41222. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  41223. return false;
  41224. };
  41225. }),
  41226. // Miscellaneous
  41227. "target": function target(elem) {
  41228. var hash = window.location && window.location.hash;
  41229. return hash && hash.slice(1) === elem.id;
  41230. },
  41231. "root": function root(elem) {
  41232. return elem === docElem;
  41233. },
  41234. "focus": function focus(elem) {
  41235. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  41236. },
  41237. // Boolean properties
  41238. "enabled": createDisabledPseudo(false),
  41239. "disabled": createDisabledPseudo(true),
  41240. "checked": function checked(elem) {
  41241. // In CSS3, :checked should return both checked and selected elements
  41242. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  41243. var nodeName = elem.nodeName.toLowerCase();
  41244. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  41245. },
  41246. "selected": function selected(elem) {
  41247. // Accessing this property makes selected-by-default
  41248. // options in Safari work properly
  41249. if (elem.parentNode) {
  41250. elem.parentNode.selectedIndex;
  41251. }
  41252. return elem.selected === true;
  41253. },
  41254. // Contents
  41255. "empty": function empty(elem) {
  41256. // http://www.w3.org/TR/selectors/#empty-pseudo
  41257. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  41258. // but not by others (comment: 8; processing instruction: 7; etc.)
  41259. // nodeType < 6 works because attributes (2) do not appear as children
  41260. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  41261. if (elem.nodeType < 6) {
  41262. return false;
  41263. }
  41264. }
  41265. return true;
  41266. },
  41267. "parent": function parent(elem) {
  41268. return !Expr.pseudos["empty"](elem);
  41269. },
  41270. // Element/input types
  41271. "header": function header(elem) {
  41272. return rheader.test(elem.nodeName);
  41273. },
  41274. "input": function input(elem) {
  41275. return rinputs.test(elem.nodeName);
  41276. },
  41277. "button": function button(elem) {
  41278. var name = elem.nodeName.toLowerCase();
  41279. return name === "input" && elem.type === "button" || name === "button";
  41280. },
  41281. "text": function text(elem) {
  41282. var attr;
  41283. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  41284. // Support: IE<8
  41285. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  41286. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  41287. },
  41288. // Position-in-collection
  41289. "first": createPositionalPseudo(function () {
  41290. return [0];
  41291. }),
  41292. "last": createPositionalPseudo(function (matchIndexes, length) {
  41293. return [length - 1];
  41294. }),
  41295. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  41296. return [argument < 0 ? argument + length : argument];
  41297. }),
  41298. "even": createPositionalPseudo(function (matchIndexes, length) {
  41299. var i = 0;
  41300. for (; i < length; i += 2) {
  41301. matchIndexes.push(i);
  41302. }
  41303. return matchIndexes;
  41304. }),
  41305. "odd": createPositionalPseudo(function (matchIndexes, length) {
  41306. var i = 1;
  41307. for (; i < length; i += 2) {
  41308. matchIndexes.push(i);
  41309. }
  41310. return matchIndexes;
  41311. }),
  41312. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  41313. var i = argument < 0 ? argument + length : argument;
  41314. for (; --i >= 0;) {
  41315. matchIndexes.push(i);
  41316. }
  41317. return matchIndexes;
  41318. }),
  41319. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  41320. var i = argument < 0 ? argument + length : argument;
  41321. for (; ++i < length;) {
  41322. matchIndexes.push(i);
  41323. }
  41324. return matchIndexes;
  41325. })
  41326. }
  41327. };
  41328. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  41329. // Add button/input type pseudos
  41330. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  41331. Expr.pseudos[i] = createInputPseudo(i);
  41332. }
  41333. for (i in { submit: true, reset: true }) {
  41334. Expr.pseudos[i] = createButtonPseudo(i);
  41335. }
  41336. // Easy API for creating new setFilters
  41337. function setFilters() {}
  41338. setFilters.prototype = Expr.filters = Expr.pseudos;
  41339. Expr.setFilters = new setFilters();
  41340. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  41341. var matched,
  41342. match,
  41343. tokens,
  41344. type,
  41345. soFar,
  41346. groups,
  41347. preFilters,
  41348. cached = tokenCache[selector + " "];
  41349. if (cached) {
  41350. return parseOnly ? 0 : cached.slice(0);
  41351. }
  41352. soFar = selector;
  41353. groups = [];
  41354. preFilters = Expr.preFilter;
  41355. while (soFar) {
  41356. // Comma and first run
  41357. if (!matched || (match = rcomma.exec(soFar))) {
  41358. if (match) {
  41359. // Don't consume trailing commas as valid
  41360. soFar = soFar.slice(match[0].length) || soFar;
  41361. }
  41362. groups.push(tokens = []);
  41363. }
  41364. matched = false;
  41365. // Combinators
  41366. if (match = rcombinators.exec(soFar)) {
  41367. matched = match.shift();
  41368. tokens.push({
  41369. value: matched,
  41370. // Cast descendant combinators to space
  41371. type: match[0].replace(rtrim, " ")
  41372. });
  41373. soFar = soFar.slice(matched.length);
  41374. }
  41375. // Filters
  41376. for (type in Expr.filter) {
  41377. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  41378. matched = match.shift();
  41379. tokens.push({
  41380. value: matched,
  41381. type: type,
  41382. matches: match
  41383. });
  41384. soFar = soFar.slice(matched.length);
  41385. }
  41386. }
  41387. if (!matched) {
  41388. break;
  41389. }
  41390. }
  41391. // Return the length of the invalid excess
  41392. // if we're just parsing
  41393. // Otherwise, throw an error or return tokens
  41394. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  41395. // Cache the tokens
  41396. tokenCache(selector, groups).slice(0);
  41397. };
  41398. function toSelector(tokens) {
  41399. var i = 0,
  41400. len = tokens.length,
  41401. selector = "";
  41402. for (; i < len; i++) {
  41403. selector += tokens[i].value;
  41404. }
  41405. return selector;
  41406. }
  41407. function addCombinator(matcher, combinator, base) {
  41408. var dir = combinator.dir,
  41409. skip = combinator.next,
  41410. key = skip || dir,
  41411. checkNonElements = base && key === "parentNode",
  41412. doneName = done++;
  41413. return combinator.first ?
  41414. // Check against closest ancestor/preceding element
  41415. function (elem, context, xml) {
  41416. while (elem = elem[dir]) {
  41417. if (elem.nodeType === 1 || checkNonElements) {
  41418. return matcher(elem, context, xml);
  41419. }
  41420. }
  41421. return false;
  41422. } :
  41423. // Check against all ancestor/preceding elements
  41424. function (elem, context, xml) {
  41425. var oldCache,
  41426. uniqueCache,
  41427. outerCache,
  41428. newCache = [dirruns, doneName];
  41429. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  41430. if (xml) {
  41431. while (elem = elem[dir]) {
  41432. if (elem.nodeType === 1 || checkNonElements) {
  41433. if (matcher(elem, context, xml)) {
  41434. return true;
  41435. }
  41436. }
  41437. }
  41438. } else {
  41439. while (elem = elem[dir]) {
  41440. if (elem.nodeType === 1 || checkNonElements) {
  41441. outerCache = elem[expando] || (elem[expando] = {});
  41442. // Support: IE <9 only
  41443. // Defend against cloned attroperties (jQuery gh-1709)
  41444. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  41445. if (skip && skip === elem.nodeName.toLowerCase()) {
  41446. elem = elem[dir] || elem;
  41447. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  41448. // Assign to newCache so results back-propagate to previous elements
  41449. return newCache[2] = oldCache[2];
  41450. } else {
  41451. // Reuse newcache so results back-propagate to previous elements
  41452. uniqueCache[key] = newCache;
  41453. // A match means we're done; a fail means we have to keep checking
  41454. if (newCache[2] = matcher(elem, context, xml)) {
  41455. return true;
  41456. }
  41457. }
  41458. }
  41459. }
  41460. }
  41461. return false;
  41462. };
  41463. }
  41464. function elementMatcher(matchers) {
  41465. return matchers.length > 1 ? function (elem, context, xml) {
  41466. var i = matchers.length;
  41467. while (i--) {
  41468. if (!matchers[i](elem, context, xml)) {
  41469. return false;
  41470. }
  41471. }
  41472. return true;
  41473. } : matchers[0];
  41474. }
  41475. function multipleContexts(selector, contexts, results) {
  41476. var i = 0,
  41477. len = contexts.length;
  41478. for (; i < len; i++) {
  41479. Sizzle(selector, contexts[i], results);
  41480. }
  41481. return results;
  41482. }
  41483. function condense(unmatched, map, filter, context, xml) {
  41484. var elem,
  41485. newUnmatched = [],
  41486. i = 0,
  41487. len = unmatched.length,
  41488. mapped = map != null;
  41489. for (; i < len; i++) {
  41490. if (elem = unmatched[i]) {
  41491. if (!filter || filter(elem, context, xml)) {
  41492. newUnmatched.push(elem);
  41493. if (mapped) {
  41494. map.push(i);
  41495. }
  41496. }
  41497. }
  41498. }
  41499. return newUnmatched;
  41500. }
  41501. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  41502. if (postFilter && !postFilter[expando]) {
  41503. postFilter = setMatcher(postFilter);
  41504. }
  41505. if (postFinder && !postFinder[expando]) {
  41506. postFinder = setMatcher(postFinder, postSelector);
  41507. }
  41508. return markFunction(function (seed, results, context, xml) {
  41509. var temp,
  41510. i,
  41511. elem,
  41512. preMap = [],
  41513. postMap = [],
  41514. preexisting = results.length,
  41515. // Get initial elements from seed or context
  41516. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  41517. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  41518. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  41519. matcherOut = matcher ?
  41520. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  41521. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  41522. // ...intermediate processing is necessary
  41523. [] :
  41524. // ...otherwise use results directly
  41525. results : matcherIn;
  41526. // Find primary matches
  41527. if (matcher) {
  41528. matcher(matcherIn, matcherOut, context, xml);
  41529. }
  41530. // Apply postFilter
  41531. if (postFilter) {
  41532. temp = condense(matcherOut, postMap);
  41533. postFilter(temp, [], context, xml);
  41534. // Un-match failing elements by moving them back to matcherIn
  41535. i = temp.length;
  41536. while (i--) {
  41537. if (elem = temp[i]) {
  41538. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  41539. }
  41540. }
  41541. }
  41542. if (seed) {
  41543. if (postFinder || preFilter) {
  41544. if (postFinder) {
  41545. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  41546. temp = [];
  41547. i = matcherOut.length;
  41548. while (i--) {
  41549. if (elem = matcherOut[i]) {
  41550. // Restore matcherIn since elem is not yet a final match
  41551. temp.push(matcherIn[i] = elem);
  41552. }
  41553. }
  41554. postFinder(null, matcherOut = [], temp, xml);
  41555. }
  41556. // Move matched elements from seed to results to keep them synchronized
  41557. i = matcherOut.length;
  41558. while (i--) {
  41559. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  41560. seed[temp] = !(results[temp] = elem);
  41561. }
  41562. }
  41563. }
  41564. // Add elements to results, through postFinder if defined
  41565. } else {
  41566. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  41567. if (postFinder) {
  41568. postFinder(null, results, matcherOut, xml);
  41569. } else {
  41570. push.apply(results, matcherOut);
  41571. }
  41572. }
  41573. });
  41574. }
  41575. function matcherFromTokens(tokens) {
  41576. var checkContext,
  41577. matcher,
  41578. j,
  41579. len = tokens.length,
  41580. leadingRelative = Expr.relative[tokens[0].type],
  41581. implicitRelative = leadingRelative || Expr.relative[" "],
  41582. i = leadingRelative ? 1 : 0,
  41583. // The foundational matcher ensures that elements are reachable from top-level context(s)
  41584. matchContext = addCombinator(function (elem) {
  41585. return elem === checkContext;
  41586. }, implicitRelative, true),
  41587. matchAnyContext = addCombinator(function (elem) {
  41588. return indexOf(checkContext, elem) > -1;
  41589. }, implicitRelative, true),
  41590. matchers = [function (elem, context, xml) {
  41591. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  41592. // Avoid hanging onto element (issue #299)
  41593. checkContext = null;
  41594. return ret;
  41595. }];
  41596. for (; i < len; i++) {
  41597. if (matcher = Expr.relative[tokens[i].type]) {
  41598. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  41599. } else {
  41600. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  41601. // Return special upon seeing a positional matcher
  41602. if (matcher[expando]) {
  41603. // Find the next relative operator (if any) for proper handling
  41604. j = ++i;
  41605. for (; j < len; j++) {
  41606. if (Expr.relative[tokens[j].type]) {
  41607. break;
  41608. }
  41609. }
  41610. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  41611. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  41612. tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
  41613. }
  41614. matchers.push(matcher);
  41615. }
  41616. }
  41617. return elementMatcher(matchers);
  41618. }
  41619. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  41620. var bySet = setMatchers.length > 0,
  41621. byElement = elementMatchers.length > 0,
  41622. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  41623. var elem,
  41624. j,
  41625. matcher,
  41626. matchedCount = 0,
  41627. i = "0",
  41628. unmatched = seed && [],
  41629. setMatched = [],
  41630. contextBackup = outermostContext,
  41631. // We must always have either seed elements or outermost context
  41632. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  41633. // Use integer dirruns iff this is the outermost matcher
  41634. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  41635. len = elems.length;
  41636. if (outermost) {
  41637. outermostContext = context === document || context || outermost;
  41638. }
  41639. // Add elements passing elementMatchers directly to results
  41640. // Support: IE<9, Safari
  41641. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  41642. for (; i !== len && (elem = elems[i]) != null; i++) {
  41643. if (byElement && elem) {
  41644. j = 0;
  41645. if (!context && elem.ownerDocument !== document) {
  41646. setDocument(elem);
  41647. xml = !documentIsHTML;
  41648. }
  41649. while (matcher = elementMatchers[j++]) {
  41650. if (matcher(elem, context || document, xml)) {
  41651. results.push(elem);
  41652. break;
  41653. }
  41654. }
  41655. if (outermost) {
  41656. dirruns = dirrunsUnique;
  41657. }
  41658. }
  41659. // Track unmatched elements for set filters
  41660. if (bySet) {
  41661. // They will have gone through all possible matchers
  41662. if (elem = !matcher && elem) {
  41663. matchedCount--;
  41664. }
  41665. // Lengthen the array for every element, matched or not
  41666. if (seed) {
  41667. unmatched.push(elem);
  41668. }
  41669. }
  41670. }
  41671. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  41672. // makes the latter nonnegative.
  41673. matchedCount += i;
  41674. // Apply set filters to unmatched elements
  41675. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  41676. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  41677. // no element matchers and no seed.
  41678. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  41679. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  41680. // numerically zero.
  41681. if (bySet && i !== matchedCount) {
  41682. j = 0;
  41683. while (matcher = setMatchers[j++]) {
  41684. matcher(unmatched, setMatched, context, xml);
  41685. }
  41686. if (seed) {
  41687. // Reintegrate element matches to eliminate the need for sorting
  41688. if (matchedCount > 0) {
  41689. while (i--) {
  41690. if (!(unmatched[i] || setMatched[i])) {
  41691. setMatched[i] = pop.call(results);
  41692. }
  41693. }
  41694. }
  41695. // Discard index placeholder values to get only actual matches
  41696. setMatched = condense(setMatched);
  41697. }
  41698. // Add matches to results
  41699. push.apply(results, setMatched);
  41700. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  41701. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  41702. Sizzle.uniqueSort(results);
  41703. }
  41704. }
  41705. // Override manipulation of globals by nested matchers
  41706. if (outermost) {
  41707. dirruns = dirrunsUnique;
  41708. outermostContext = contextBackup;
  41709. }
  41710. return unmatched;
  41711. };
  41712. return bySet ? markFunction(superMatcher) : superMatcher;
  41713. }
  41714. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  41715. var i,
  41716. setMatchers = [],
  41717. elementMatchers = [],
  41718. cached = compilerCache[selector + " "];
  41719. if (!cached) {
  41720. // Generate a function of recursive functions that can be used to check each element
  41721. if (!match) {
  41722. match = tokenize(selector);
  41723. }
  41724. i = match.length;
  41725. while (i--) {
  41726. cached = matcherFromTokens(match[i]);
  41727. if (cached[expando]) {
  41728. setMatchers.push(cached);
  41729. } else {
  41730. elementMatchers.push(cached);
  41731. }
  41732. }
  41733. // Cache the compiled function
  41734. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  41735. // Save selector and tokenization
  41736. cached.selector = selector;
  41737. }
  41738. return cached;
  41739. };
  41740. /**
  41741. * A low-level selection function that works with Sizzle's compiled
  41742. * selector functions
  41743. * @param {String|Function} selector A selector or a pre-compiled
  41744. * selector function built with Sizzle.compile
  41745. * @param {Element} context
  41746. * @param {Array} [results]
  41747. * @param {Array} [seed] A set of elements to match against
  41748. */
  41749. select = Sizzle.select = function (selector, context, results, seed) {
  41750. var i,
  41751. tokens,
  41752. token,
  41753. type,
  41754. find,
  41755. compiled = typeof selector === "function" && selector,
  41756. match = !seed && tokenize(selector = compiled.selector || selector);
  41757. results = results || [];
  41758. // Try to minimize operations if there is only one selector in the list and no seed
  41759. // (the latter of which guarantees us context)
  41760. if (match.length === 1) {
  41761. // Reduce context if the leading compound selector is an ID
  41762. tokens = match[0] = match[0].slice(0);
  41763. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  41764. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  41765. if (!context) {
  41766. return results;
  41767. // Precompiled matchers will still verify ancestry, so step up a level
  41768. } else if (compiled) {
  41769. context = context.parentNode;
  41770. }
  41771. selector = selector.slice(tokens.shift().value.length);
  41772. }
  41773. // Fetch a seed set for right-to-left matching
  41774. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  41775. while (i--) {
  41776. token = tokens[i];
  41777. // Abort if we hit a combinator
  41778. if (Expr.relative[type = token.type]) {
  41779. break;
  41780. }
  41781. if (find = Expr.find[type]) {
  41782. // Search, expanding context for leading sibling combinators
  41783. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  41784. // If seed is empty or no tokens remain, we can return early
  41785. tokens.splice(i, 1);
  41786. selector = seed.length && toSelector(tokens);
  41787. if (!selector) {
  41788. push.apply(results, seed);
  41789. return results;
  41790. }
  41791. break;
  41792. }
  41793. }
  41794. }
  41795. }
  41796. // Compile and execute a filtering function if one is not provided
  41797. // Provide `match` to avoid retokenization if we modified the selector above
  41798. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  41799. return results;
  41800. };
  41801. // One-time assignments
  41802. // Sort stability
  41803. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  41804. // Support: Chrome 14-35+
  41805. // Always assume duplicates if they aren't passed to the comparison function
  41806. support.detectDuplicates = !!hasDuplicate;
  41807. // Initialize against the default document
  41808. setDocument();
  41809. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  41810. // Detached nodes confoundingly follow *each other*
  41811. support.sortDetached = assert(function (el) {
  41812. // Should return 1, but returns 4 (following)
  41813. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  41814. });
  41815. // Support: IE<8
  41816. // Prevent attribute/property "interpolation"
  41817. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  41818. if (!assert(function (el) {
  41819. el.innerHTML = "<a href='#'></a>";
  41820. return el.firstChild.getAttribute("href") === "#";
  41821. })) {
  41822. addHandle("type|href|height|width", function (elem, name, isXML) {
  41823. if (!isXML) {
  41824. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  41825. }
  41826. });
  41827. }
  41828. // Support: IE<9
  41829. // Use defaultValue in place of getAttribute("value")
  41830. if (!support.attributes || !assert(function (el) {
  41831. el.innerHTML = "<input/>";
  41832. el.firstChild.setAttribute("value", "");
  41833. return el.firstChild.getAttribute("value") === "";
  41834. })) {
  41835. addHandle("value", function (elem, name, isXML) {
  41836. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  41837. return elem.defaultValue;
  41838. }
  41839. });
  41840. }
  41841. // Support: IE<9
  41842. // Use getAttributeNode to fetch booleans when getAttribute lies
  41843. if (!assert(function (el) {
  41844. return el.getAttribute("disabled") == null;
  41845. })) {
  41846. addHandle(booleans, function (elem, name, isXML) {
  41847. var val;
  41848. if (!isXML) {
  41849. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  41850. }
  41851. });
  41852. }
  41853. return Sizzle;
  41854. }(window);
  41855. jQuery.find = Sizzle;
  41856. jQuery.expr = Sizzle.selectors;
  41857. // Deprecated
  41858. jQuery.expr[":"] = jQuery.expr.pseudos;
  41859. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  41860. jQuery.text = Sizzle.getText;
  41861. jQuery.isXMLDoc = Sizzle.isXML;
  41862. jQuery.contains = Sizzle.contains;
  41863. jQuery.escapeSelector = Sizzle.escape;
  41864. var dir = function dir(elem, _dir, until) {
  41865. var matched = [],
  41866. truncate = until !== undefined;
  41867. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  41868. if (elem.nodeType === 1) {
  41869. if (truncate && jQuery(elem).is(until)) {
  41870. break;
  41871. }
  41872. matched.push(elem);
  41873. }
  41874. }
  41875. return matched;
  41876. };
  41877. var _siblings = function _siblings(n, elem) {
  41878. var matched = [];
  41879. for (; n; n = n.nextSibling) {
  41880. if (n.nodeType === 1 && n !== elem) {
  41881. matched.push(n);
  41882. }
  41883. }
  41884. return matched;
  41885. };
  41886. var rneedsContext = jQuery.expr.match.needsContext;
  41887. function nodeName(elem, name) {
  41888. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  41889. };
  41890. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  41891. // Implement the identical functionality for filter and not
  41892. function winnow(elements, qualifier, not) {
  41893. if (isFunction(qualifier)) {
  41894. return jQuery.grep(elements, function (elem, i) {
  41895. return !!qualifier.call(elem, i, elem) !== not;
  41896. });
  41897. }
  41898. // Single element
  41899. if (qualifier.nodeType) {
  41900. return jQuery.grep(elements, function (elem) {
  41901. return elem === qualifier !== not;
  41902. });
  41903. }
  41904. // Arraylike of elements (jQuery, arguments, Array)
  41905. if (typeof qualifier !== "string") {
  41906. return jQuery.grep(elements, function (elem) {
  41907. return indexOf.call(qualifier, elem) > -1 !== not;
  41908. });
  41909. }
  41910. // Filtered directly for both simple and complex selectors
  41911. return jQuery.filter(qualifier, elements, not);
  41912. }
  41913. jQuery.filter = function (expr, elems, not) {
  41914. var elem = elems[0];
  41915. if (not) {
  41916. expr = ":not(" + expr + ")";
  41917. }
  41918. if (elems.length === 1 && elem.nodeType === 1) {
  41919. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  41920. }
  41921. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  41922. return elem.nodeType === 1;
  41923. }));
  41924. };
  41925. jQuery.fn.extend({
  41926. find: function find(selector) {
  41927. var i,
  41928. ret,
  41929. len = this.length,
  41930. self = this;
  41931. if (typeof selector !== "string") {
  41932. return this.pushStack(jQuery(selector).filter(function () {
  41933. for (i = 0; i < len; i++) {
  41934. if (jQuery.contains(self[i], this)) {
  41935. return true;
  41936. }
  41937. }
  41938. }));
  41939. }
  41940. ret = this.pushStack([]);
  41941. for (i = 0; i < len; i++) {
  41942. jQuery.find(selector, self[i], ret);
  41943. }
  41944. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  41945. },
  41946. filter: function filter(selector) {
  41947. return this.pushStack(winnow(this, selector || [], false));
  41948. },
  41949. not: function not(selector) {
  41950. return this.pushStack(winnow(this, selector || [], true));
  41951. },
  41952. is: function is(selector) {
  41953. return !!winnow(this,
  41954. // If this is a positional/relative selector, check membership in the returned set
  41955. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  41956. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  41957. }
  41958. });
  41959. // Initialize a jQuery object
  41960. // A central reference to the root jQuery(document)
  41961. var rootjQuery,
  41962. // A simple way to check for HTML strings
  41963. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  41964. // Strict HTML recognition (#11290: must start with <)
  41965. // Shortcut simple #id case for speed
  41966. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  41967. init = jQuery.fn.init = function (selector, context, root) {
  41968. var match, elem;
  41969. // HANDLE: $(""), $(null), $(undefined), $(false)
  41970. if (!selector) {
  41971. return this;
  41972. }
  41973. // Method init() accepts an alternate rootjQuery
  41974. // so migrate can support jQuery.sub (gh-2101)
  41975. root = root || rootjQuery;
  41976. // Handle HTML strings
  41977. if (typeof selector === "string") {
  41978. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  41979. // Assume that strings that start and end with <> are HTML and skip the regex check
  41980. match = [null, selector, null];
  41981. } else {
  41982. match = rquickExpr.exec(selector);
  41983. }
  41984. // Match html or make sure no context is specified for #id
  41985. if (match && (match[1] || !context)) {
  41986. // HANDLE: $(html) -> $(array)
  41987. if (match[1]) {
  41988. context = context instanceof jQuery ? context[0] : context;
  41989. // Option to run scripts is true for back-compat
  41990. // Intentionally let the error be thrown if parseHTML is not present
  41991. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  41992. // HANDLE: $(html, props)
  41993. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  41994. for (match in context) {
  41995. // Properties of context are called as methods if possible
  41996. if (isFunction(this[match])) {
  41997. this[match](context[match]);
  41998. // ...and otherwise set as attributes
  41999. } else {
  42000. this.attr(match, context[match]);
  42001. }
  42002. }
  42003. }
  42004. return this;
  42005. // HANDLE: $(#id)
  42006. } else {
  42007. elem = document.getElementById(match[2]);
  42008. if (elem) {
  42009. // Inject the element directly into the jQuery object
  42010. this[0] = elem;
  42011. this.length = 1;
  42012. }
  42013. return this;
  42014. }
  42015. // HANDLE: $(expr, $(...))
  42016. } else if (!context || context.jquery) {
  42017. return (context || root).find(selector);
  42018. // HANDLE: $(expr, context)
  42019. // (which is just equivalent to: $(context).find(expr)
  42020. } else {
  42021. return this.constructor(context).find(selector);
  42022. }
  42023. // HANDLE: $(DOMElement)
  42024. } else if (selector.nodeType) {
  42025. this[0] = selector;
  42026. this.length = 1;
  42027. return this;
  42028. // HANDLE: $(function)
  42029. // Shortcut for document ready
  42030. } else if (isFunction(selector)) {
  42031. return root.ready !== undefined ? root.ready(selector) :
  42032. // Execute immediately if ready is not present
  42033. selector(jQuery);
  42034. }
  42035. return jQuery.makeArray(selector, this);
  42036. };
  42037. // Give the init function the jQuery prototype for later instantiation
  42038. init.prototype = jQuery.fn;
  42039. // Initialize central reference
  42040. rootjQuery = jQuery(document);
  42041. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  42042. // Methods guaranteed to produce a unique set when starting from a unique set
  42043. guaranteedUnique = {
  42044. children: true,
  42045. contents: true,
  42046. next: true,
  42047. prev: true
  42048. };
  42049. jQuery.fn.extend({
  42050. has: function has(target) {
  42051. var targets = jQuery(target, this),
  42052. l = targets.length;
  42053. return this.filter(function () {
  42054. var i = 0;
  42055. for (; i < l; i++) {
  42056. if (jQuery.contains(this, targets[i])) {
  42057. return true;
  42058. }
  42059. }
  42060. });
  42061. },
  42062. closest: function closest(selectors, context) {
  42063. var cur,
  42064. i = 0,
  42065. l = this.length,
  42066. matched = [],
  42067. targets = typeof selectors !== "string" && jQuery(selectors);
  42068. // Positional selectors never match, since there's no _selection_ context
  42069. if (!rneedsContext.test(selectors)) {
  42070. for (; i < l; i++) {
  42071. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  42072. // Always skip document fragments
  42073. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  42074. // Don't pass non-elements to Sizzle
  42075. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  42076. matched.push(cur);
  42077. break;
  42078. }
  42079. }
  42080. }
  42081. }
  42082. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  42083. },
  42084. // Determine the position of an element within the set
  42085. index: function index(elem) {
  42086. // No argument, return index in parent
  42087. if (!elem) {
  42088. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  42089. }
  42090. // Index in selector
  42091. if (typeof elem === "string") {
  42092. return indexOf.call(jQuery(elem), this[0]);
  42093. }
  42094. // Locate the position of the desired element
  42095. return indexOf.call(this,
  42096. // If it receives a jQuery object, the first element is used
  42097. elem.jquery ? elem[0] : elem);
  42098. },
  42099. add: function add(selector, context) {
  42100. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  42101. },
  42102. addBack: function addBack(selector) {
  42103. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  42104. }
  42105. });
  42106. function sibling(cur, dir) {
  42107. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  42108. return cur;
  42109. }
  42110. jQuery.each({
  42111. parent: function parent(elem) {
  42112. var parent = elem.parentNode;
  42113. return parent && parent.nodeType !== 11 ? parent : null;
  42114. },
  42115. parents: function parents(elem) {
  42116. return dir(elem, "parentNode");
  42117. },
  42118. parentsUntil: function parentsUntil(elem, i, until) {
  42119. return dir(elem, "parentNode", until);
  42120. },
  42121. next: function next(elem) {
  42122. return sibling(elem, "nextSibling");
  42123. },
  42124. prev: function prev(elem) {
  42125. return sibling(elem, "previousSibling");
  42126. },
  42127. nextAll: function nextAll(elem) {
  42128. return dir(elem, "nextSibling");
  42129. },
  42130. prevAll: function prevAll(elem) {
  42131. return dir(elem, "previousSibling");
  42132. },
  42133. nextUntil: function nextUntil(elem, i, until) {
  42134. return dir(elem, "nextSibling", until);
  42135. },
  42136. prevUntil: function prevUntil(elem, i, until) {
  42137. return dir(elem, "previousSibling", until);
  42138. },
  42139. siblings: function siblings(elem) {
  42140. return _siblings((elem.parentNode || {}).firstChild, elem);
  42141. },
  42142. children: function children(elem) {
  42143. return _siblings(elem.firstChild);
  42144. },
  42145. contents: function contents(elem) {
  42146. if (nodeName(elem, "iframe")) {
  42147. return elem.contentDocument;
  42148. }
  42149. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  42150. // Treat the template element as a regular one in browsers that
  42151. // don't support it.
  42152. if (nodeName(elem, "template")) {
  42153. elem = elem.content || elem;
  42154. }
  42155. return jQuery.merge([], elem.childNodes);
  42156. }
  42157. }, function (name, fn) {
  42158. jQuery.fn[name] = function (until, selector) {
  42159. var matched = jQuery.map(this, fn, until);
  42160. if (name.slice(-5) !== "Until") {
  42161. selector = until;
  42162. }
  42163. if (selector && typeof selector === "string") {
  42164. matched = jQuery.filter(selector, matched);
  42165. }
  42166. if (this.length > 1) {
  42167. // Remove duplicates
  42168. if (!guaranteedUnique[name]) {
  42169. jQuery.uniqueSort(matched);
  42170. }
  42171. // Reverse order for parents* and prev-derivatives
  42172. if (rparentsprev.test(name)) {
  42173. matched.reverse();
  42174. }
  42175. }
  42176. return this.pushStack(matched);
  42177. };
  42178. });
  42179. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  42180. // Convert String-formatted options into Object-formatted ones
  42181. function createOptions(options) {
  42182. var object = {};
  42183. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  42184. object[flag] = true;
  42185. });
  42186. return object;
  42187. }
  42188. /*
  42189. * Create a callback list using the following parameters:
  42190. *
  42191. * options: an optional list of space-separated options that will change how
  42192. * the callback list behaves or a more traditional option object
  42193. *
  42194. * By default a callback list will act like an event callback list and can be
  42195. * "fired" multiple times.
  42196. *
  42197. * Possible options:
  42198. *
  42199. * once: will ensure the callback list can only be fired once (like a Deferred)
  42200. *
  42201. * memory: will keep track of previous values and will call any callback added
  42202. * after the list has been fired right away with the latest "memorized"
  42203. * values (like a Deferred)
  42204. *
  42205. * unique: will ensure a callback can only be added once (no duplicate in the list)
  42206. *
  42207. * stopOnFalse: interrupt callings when a callback returns false
  42208. *
  42209. */
  42210. jQuery.Callbacks = function (options) {
  42211. // Convert options from String-formatted to Object-formatted if needed
  42212. // (we check in cache first)
  42213. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  42214. var // Flag to know if list is currently firing
  42215. firing,
  42216. // Last fire value for non-forgettable lists
  42217. memory,
  42218. // Flag to know if list was already fired
  42219. _fired,
  42220. // Flag to prevent firing
  42221. _locked,
  42222. // Actual callback list
  42223. list = [],
  42224. // Queue of execution data for repeatable lists
  42225. queue = [],
  42226. // Index of currently firing callback (modified by add/remove as needed)
  42227. firingIndex = -1,
  42228. // Fire callbacks
  42229. fire = function fire() {
  42230. // Enforce single-firing
  42231. _locked = _locked || options.once;
  42232. // Execute callbacks for all pending executions,
  42233. // respecting firingIndex overrides and runtime changes
  42234. _fired = firing = true;
  42235. for (; queue.length; firingIndex = -1) {
  42236. memory = queue.shift();
  42237. while (++firingIndex < list.length) {
  42238. // Run callback and check for early termination
  42239. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  42240. // Jump to end and forget the data so .add doesn't re-fire
  42241. firingIndex = list.length;
  42242. memory = false;
  42243. }
  42244. }
  42245. }
  42246. // Forget the data if we're done with it
  42247. if (!options.memory) {
  42248. memory = false;
  42249. }
  42250. firing = false;
  42251. // Clean up if we're done firing for good
  42252. if (_locked) {
  42253. // Keep an empty list if we have data for future add calls
  42254. if (memory) {
  42255. list = [];
  42256. // Otherwise, this object is spent
  42257. } else {
  42258. list = "";
  42259. }
  42260. }
  42261. },
  42262. // Actual Callbacks object
  42263. self = {
  42264. // Add a callback or a collection of callbacks to the list
  42265. add: function add() {
  42266. if (list) {
  42267. // If we have memory from a past run, we should fire after adding
  42268. if (memory && !firing) {
  42269. firingIndex = list.length - 1;
  42270. queue.push(memory);
  42271. }
  42272. (function add(args) {
  42273. jQuery.each(args, function (_, arg) {
  42274. if (isFunction(arg)) {
  42275. if (!options.unique || !self.has(arg)) {
  42276. list.push(arg);
  42277. }
  42278. } else if (arg && arg.length && toType(arg) !== "string") {
  42279. // Inspect recursively
  42280. add(arg);
  42281. }
  42282. });
  42283. })(arguments);
  42284. if (memory && !firing) {
  42285. fire();
  42286. }
  42287. }
  42288. return this;
  42289. },
  42290. // Remove a callback from the list
  42291. remove: function remove() {
  42292. jQuery.each(arguments, function (_, arg) {
  42293. var index;
  42294. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  42295. list.splice(index, 1);
  42296. // Handle firing indexes
  42297. if (index <= firingIndex) {
  42298. firingIndex--;
  42299. }
  42300. }
  42301. });
  42302. return this;
  42303. },
  42304. // Check if a given callback is in the list.
  42305. // If no argument is given, return whether or not list has callbacks attached.
  42306. has: function has(fn) {
  42307. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  42308. },
  42309. // Remove all callbacks from the list
  42310. empty: function empty() {
  42311. if (list) {
  42312. list = [];
  42313. }
  42314. return this;
  42315. },
  42316. // Disable .fire and .add
  42317. // Abort any current/pending executions
  42318. // Clear all callbacks and values
  42319. disable: function disable() {
  42320. _locked = queue = [];
  42321. list = memory = "";
  42322. return this;
  42323. },
  42324. disabled: function disabled() {
  42325. return !list;
  42326. },
  42327. // Disable .fire
  42328. // Also disable .add unless we have memory (since it would have no effect)
  42329. // Abort any pending executions
  42330. lock: function lock() {
  42331. _locked = queue = [];
  42332. if (!memory && !firing) {
  42333. list = memory = "";
  42334. }
  42335. return this;
  42336. },
  42337. locked: function locked() {
  42338. return !!_locked;
  42339. },
  42340. // Call all callbacks with the given context and arguments
  42341. fireWith: function fireWith(context, args) {
  42342. if (!_locked) {
  42343. args = args || [];
  42344. args = [context, args.slice ? args.slice() : args];
  42345. queue.push(args);
  42346. if (!firing) {
  42347. fire();
  42348. }
  42349. }
  42350. return this;
  42351. },
  42352. // Call all the callbacks with the given arguments
  42353. fire: function fire() {
  42354. self.fireWith(this, arguments);
  42355. return this;
  42356. },
  42357. // To know if the callbacks have already been called at least once
  42358. fired: function fired() {
  42359. return !!_fired;
  42360. }
  42361. };
  42362. return self;
  42363. };
  42364. function Identity(v) {
  42365. return v;
  42366. }
  42367. function Thrower(ex) {
  42368. throw ex;
  42369. }
  42370. function adoptValue(value, resolve, reject, noValue) {
  42371. var method;
  42372. try {
  42373. // Check for promise aspect first to privilege synchronous behavior
  42374. if (value && isFunction(method = value.promise)) {
  42375. method.call(value).done(resolve).fail(reject);
  42376. // Other thenables
  42377. } else if (value && isFunction(method = value.then)) {
  42378. method.call(value, resolve, reject);
  42379. // Other non-thenables
  42380. } else {
  42381. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  42382. // * false: [ value ].slice( 0 ) => resolve( value )
  42383. // * true: [ value ].slice( 1 ) => resolve()
  42384. resolve.apply(undefined, [value].slice(noValue));
  42385. }
  42386. // For Promises/A+, convert exceptions into rejections
  42387. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  42388. // Deferred#then to conditionally suppress rejection.
  42389. } catch (value) {
  42390. // Support: Android 4.0 only
  42391. // Strict mode functions invoked without .call/.apply get global-object context
  42392. reject.apply(undefined, [value]);
  42393. }
  42394. }
  42395. jQuery.extend({
  42396. Deferred: function Deferred(func) {
  42397. var tuples = [
  42398. // action, add listener, callbacks,
  42399. // ... .then handlers, argument index, [final state]
  42400. ["notify", "progress", jQuery.Callbacks("memory"), jQuery.Callbacks("memory"), 2], ["resolve", "done", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 1, "rejected"]],
  42401. _state = "pending",
  42402. _promise = {
  42403. state: function state() {
  42404. return _state;
  42405. },
  42406. always: function always() {
  42407. deferred.done(arguments).fail(arguments);
  42408. return this;
  42409. },
  42410. "catch": function _catch(fn) {
  42411. return _promise.then(null, fn);
  42412. },
  42413. // Keep pipe for back-compat
  42414. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  42415. var fns = arguments;
  42416. return jQuery.Deferred(function (newDefer) {
  42417. jQuery.each(tuples, function (i, tuple) {
  42418. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  42419. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  42420. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  42421. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  42422. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  42423. deferred[tuple[1]](function () {
  42424. var returned = fn && fn.apply(this, arguments);
  42425. if (returned && isFunction(returned.promise)) {
  42426. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  42427. } else {
  42428. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  42429. }
  42430. });
  42431. });
  42432. fns = null;
  42433. }).promise();
  42434. },
  42435. then: function then(onFulfilled, onRejected, onProgress) {
  42436. var maxDepth = 0;
  42437. function resolve(depth, deferred, handler, special) {
  42438. return function () {
  42439. var that = this,
  42440. args = arguments,
  42441. mightThrow = function mightThrow() {
  42442. var returned, then;
  42443. // Support: Promises/A+ section 2.3.3.3.3
  42444. // https://promisesaplus.com/#point-59
  42445. // Ignore double-resolution attempts
  42446. if (depth < maxDepth) {
  42447. return;
  42448. }
  42449. returned = handler.apply(that, args);
  42450. // Support: Promises/A+ section 2.3.1
  42451. // https://promisesaplus.com/#point-48
  42452. if (returned === deferred.promise()) {
  42453. throw new TypeError("Thenable self-resolution");
  42454. }
  42455. // Support: Promises/A+ sections 2.3.3.1, 3.5
  42456. // https://promisesaplus.com/#point-54
  42457. // https://promisesaplus.com/#point-75
  42458. // Retrieve `then` only once
  42459. then = returned && (
  42460. // Support: Promises/A+ section 2.3.4
  42461. // https://promisesaplus.com/#point-64
  42462. // Only check objects and functions for thenability
  42463. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  42464. // Handle a returned thenable
  42465. if (isFunction(then)) {
  42466. // Special processors (notify) just wait for resolution
  42467. if (special) {
  42468. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  42469. // Normal processors (resolve) also hook into progress
  42470. } else {
  42471. // ...and disregard older resolution values
  42472. maxDepth++;
  42473. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  42474. }
  42475. // Handle all other returned values
  42476. } else {
  42477. // Only substitute handlers pass on context
  42478. // and multiple values (non-spec behavior)
  42479. if (handler !== Identity) {
  42480. that = undefined;
  42481. args = [returned];
  42482. }
  42483. // Process the value(s)
  42484. // Default process is resolve
  42485. (special || deferred.resolveWith)(that, args);
  42486. }
  42487. },
  42488. // Only normal processors (resolve) catch and reject exceptions
  42489. process = special ? mightThrow : function () {
  42490. try {
  42491. mightThrow();
  42492. } catch (e) {
  42493. if (jQuery.Deferred.exceptionHook) {
  42494. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  42495. }
  42496. // Support: Promises/A+ section 2.3.3.3.4.1
  42497. // https://promisesaplus.com/#point-61
  42498. // Ignore post-resolution exceptions
  42499. if (depth + 1 >= maxDepth) {
  42500. // Only substitute handlers pass on context
  42501. // and multiple values (non-spec behavior)
  42502. if (handler !== Thrower) {
  42503. that = undefined;
  42504. args = [e];
  42505. }
  42506. deferred.rejectWith(that, args);
  42507. }
  42508. }
  42509. };
  42510. // Support: Promises/A+ section 2.3.3.3.1
  42511. // https://promisesaplus.com/#point-57
  42512. // Re-resolve promises immediately to dodge false rejection from
  42513. // subsequent errors
  42514. if (depth) {
  42515. process();
  42516. } else {
  42517. // Call an optional hook to record the stack, in case of exception
  42518. // since it's otherwise lost when execution goes async
  42519. if (jQuery.Deferred.getStackHook) {
  42520. process.stackTrace = jQuery.Deferred.getStackHook();
  42521. }
  42522. window.setTimeout(process);
  42523. }
  42524. };
  42525. }
  42526. return jQuery.Deferred(function (newDefer) {
  42527. // progress_handlers.add( ... )
  42528. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  42529. // fulfilled_handlers.add( ... )
  42530. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  42531. // rejected_handlers.add( ... )
  42532. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  42533. }).promise();
  42534. },
  42535. // Get a promise for this deferred
  42536. // If obj is provided, the promise aspect is added to the object
  42537. promise: function promise(obj) {
  42538. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  42539. }
  42540. },
  42541. deferred = {};
  42542. // Add list-specific methods
  42543. jQuery.each(tuples, function (i, tuple) {
  42544. var list = tuple[2],
  42545. stateString = tuple[5];
  42546. // promise.progress = list.add
  42547. // promise.done = list.add
  42548. // promise.fail = list.add
  42549. _promise[tuple[1]] = list.add;
  42550. // Handle state
  42551. if (stateString) {
  42552. list.add(function () {
  42553. // state = "resolved" (i.e., fulfilled)
  42554. // state = "rejected"
  42555. _state = stateString;
  42556. },
  42557. // rejected_callbacks.disable
  42558. // fulfilled_callbacks.disable
  42559. tuples[3 - i][2].disable,
  42560. // rejected_handlers.disable
  42561. // fulfilled_handlers.disable
  42562. tuples[3 - i][3].disable,
  42563. // progress_callbacks.lock
  42564. tuples[0][2].lock,
  42565. // progress_handlers.lock
  42566. tuples[0][3].lock);
  42567. }
  42568. // progress_handlers.fire
  42569. // fulfilled_handlers.fire
  42570. // rejected_handlers.fire
  42571. list.add(tuple[3].fire);
  42572. // deferred.notify = function() { deferred.notifyWith(...) }
  42573. // deferred.resolve = function() { deferred.resolveWith(...) }
  42574. // deferred.reject = function() { deferred.rejectWith(...) }
  42575. deferred[tuple[0]] = function () {
  42576. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  42577. return this;
  42578. };
  42579. // deferred.notifyWith = list.fireWith
  42580. // deferred.resolveWith = list.fireWith
  42581. // deferred.rejectWith = list.fireWith
  42582. deferred[tuple[0] + "With"] = list.fireWith;
  42583. });
  42584. // Make the deferred a promise
  42585. _promise.promise(deferred);
  42586. // Call given func if any
  42587. if (func) {
  42588. func.call(deferred, deferred);
  42589. }
  42590. // All done!
  42591. return deferred;
  42592. },
  42593. // Deferred helper
  42594. when: function when(singleValue) {
  42595. var
  42596. // count of uncompleted subordinates
  42597. remaining = arguments.length,
  42598. // count of unprocessed arguments
  42599. i = remaining,
  42600. // subordinate fulfillment data
  42601. resolveContexts = Array(i),
  42602. resolveValues = _slice.call(arguments),
  42603. // the master Deferred
  42604. master = jQuery.Deferred(),
  42605. // subordinate callback factory
  42606. updateFunc = function updateFunc(i) {
  42607. return function (value) {
  42608. resolveContexts[i] = this;
  42609. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  42610. if (! --remaining) {
  42611. master.resolveWith(resolveContexts, resolveValues);
  42612. }
  42613. };
  42614. };
  42615. // Single- and empty arguments are adopted like Promise.resolve
  42616. if (remaining <= 1) {
  42617. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  42618. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  42619. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  42620. return master.then();
  42621. }
  42622. }
  42623. // Multiple arguments are aggregated like Promise.all array elements
  42624. while (i--) {
  42625. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  42626. }
  42627. return master.promise();
  42628. }
  42629. });
  42630. // These usually indicate a programmer mistake during development,
  42631. // warn about them ASAP rather than swallowing them by default.
  42632. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  42633. jQuery.Deferred.exceptionHook = function (error, stack) {
  42634. // Support: IE 8 - 9 only
  42635. // Console exists when dev tools are open, which can happen at any time
  42636. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  42637. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  42638. }
  42639. };
  42640. jQuery.readyException = function (error) {
  42641. window.setTimeout(function () {
  42642. throw error;
  42643. });
  42644. };
  42645. // The deferred used on DOM ready
  42646. var readyList = jQuery.Deferred();
  42647. jQuery.fn.ready = function (fn) {
  42648. readyList.then(fn)
  42649. // Wrap jQuery.readyException in a function so that the lookup
  42650. // happens at the time of error handling instead of callback
  42651. // registration.
  42652. .catch(function (error) {
  42653. jQuery.readyException(error);
  42654. });
  42655. return this;
  42656. };
  42657. jQuery.extend({
  42658. // Is the DOM ready to be used? Set to true once it occurs.
  42659. isReady: false,
  42660. // A counter to track how many items to wait for before
  42661. // the ready event fires. See #6781
  42662. readyWait: 1,
  42663. // Handle when the DOM is ready
  42664. ready: function ready(wait) {
  42665. // Abort if there are pending holds or we're already ready
  42666. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  42667. return;
  42668. }
  42669. // Remember that the DOM is ready
  42670. jQuery.isReady = true;
  42671. // If a normal DOM Ready event fired, decrement, and wait if need be
  42672. if (wait !== true && --jQuery.readyWait > 0) {
  42673. return;
  42674. }
  42675. // If there are functions bound, to execute
  42676. readyList.resolveWith(document, [jQuery]);
  42677. }
  42678. });
  42679. jQuery.ready.then = readyList.then;
  42680. // The ready event handler and self cleanup method
  42681. function completed() {
  42682. document.removeEventListener("DOMContentLoaded", completed);
  42683. window.removeEventListener("load", completed);
  42684. jQuery.ready();
  42685. }
  42686. // Catch cases where $(document).ready() is called
  42687. // after the browser event has already occurred.
  42688. // Support: IE <=9 - 10 only
  42689. // Older IE sometimes signals "interactive" too soon
  42690. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  42691. // Handle it asynchronously to allow scripts the opportunity to delay ready
  42692. window.setTimeout(jQuery.ready);
  42693. } else {
  42694. // Use the handy event callback
  42695. document.addEventListener("DOMContentLoaded", completed);
  42696. // A fallback to window.onload, that will always work
  42697. window.addEventListener("load", completed);
  42698. }
  42699. // Multifunctional method to get and set values of a collection
  42700. // The value/s can optionally be executed if it's a function
  42701. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  42702. var i = 0,
  42703. len = elems.length,
  42704. bulk = key == null;
  42705. // Sets many values
  42706. if (toType(key) === "object") {
  42707. chainable = true;
  42708. for (i in key) {
  42709. access(elems, fn, i, key[i], true, emptyGet, raw);
  42710. }
  42711. // Sets one value
  42712. } else if (value !== undefined) {
  42713. chainable = true;
  42714. if (!isFunction(value)) {
  42715. raw = true;
  42716. }
  42717. if (bulk) {
  42718. // Bulk operations run against the entire set
  42719. if (raw) {
  42720. fn.call(elems, value);
  42721. fn = null;
  42722. // ...except when executing function values
  42723. } else {
  42724. bulk = fn;
  42725. fn = function fn(elem, key, value) {
  42726. return bulk.call(jQuery(elem), value);
  42727. };
  42728. }
  42729. }
  42730. if (fn) {
  42731. for (; i < len; i++) {
  42732. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  42733. }
  42734. }
  42735. }
  42736. if (chainable) {
  42737. return elems;
  42738. }
  42739. // Gets
  42740. if (bulk) {
  42741. return fn.call(elems);
  42742. }
  42743. return len ? fn(elems[0], key) : emptyGet;
  42744. };
  42745. // Matches dashed string for camelizing
  42746. var rmsPrefix = /^-ms-/,
  42747. rdashAlpha = /-([a-z])/g;
  42748. // Used by camelCase as callback to replace()
  42749. function fcamelCase(all, letter) {
  42750. return letter.toUpperCase();
  42751. }
  42752. // Convert dashed to camelCase; used by the css and data modules
  42753. // Support: IE <=9 - 11, Edge 12 - 15
  42754. // Microsoft forgot to hump their vendor prefix (#9572)
  42755. function camelCase(string) {
  42756. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  42757. }
  42758. var acceptData = function acceptData(owner) {
  42759. // Accepts only:
  42760. // - Node
  42761. // - Node.ELEMENT_NODE
  42762. // - Node.DOCUMENT_NODE
  42763. // - Object
  42764. // - Any
  42765. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  42766. };
  42767. function Data() {
  42768. this.expando = jQuery.expando + Data.uid++;
  42769. }
  42770. Data.uid = 1;
  42771. Data.prototype = {
  42772. cache: function cache(owner) {
  42773. // Check if the owner object already has a cache
  42774. var value = owner[this.expando];
  42775. // If not, create one
  42776. if (!value) {
  42777. value = {};
  42778. // We can accept data for non-element nodes in modern browsers,
  42779. // but we should not, see #8335.
  42780. // Always return an empty object.
  42781. if (acceptData(owner)) {
  42782. // If it is a node unlikely to be stringify-ed or looped over
  42783. // use plain assignment
  42784. if (owner.nodeType) {
  42785. owner[this.expando] = value;
  42786. // Otherwise secure it in a non-enumerable property
  42787. // configurable must be true to allow the property to be
  42788. // deleted when data is removed
  42789. } else {
  42790. Object.defineProperty(owner, this.expando, {
  42791. value: value,
  42792. configurable: true
  42793. });
  42794. }
  42795. }
  42796. }
  42797. return value;
  42798. },
  42799. set: function set(owner, data, value) {
  42800. var prop,
  42801. cache = this.cache(owner);
  42802. // Handle: [ owner, key, value ] args
  42803. // Always use camelCase key (gh-2257)
  42804. if (typeof data === "string") {
  42805. cache[camelCase(data)] = value;
  42806. // Handle: [ owner, { properties } ] args
  42807. } else {
  42808. // Copy the properties one-by-one to the cache object
  42809. for (prop in data) {
  42810. cache[camelCase(prop)] = data[prop];
  42811. }
  42812. }
  42813. return cache;
  42814. },
  42815. get: function get(owner, key) {
  42816. return key === undefined ? this.cache(owner) :
  42817. // Always use camelCase key (gh-2257)
  42818. owner[this.expando] && owner[this.expando][camelCase(key)];
  42819. },
  42820. access: function access(owner, key, value) {
  42821. // In cases where either:
  42822. //
  42823. // 1. No key was specified
  42824. // 2. A string key was specified, but no value provided
  42825. //
  42826. // Take the "read" path and allow the get method to determine
  42827. // which value to return, respectively either:
  42828. //
  42829. // 1. The entire cache object
  42830. // 2. The data stored at the key
  42831. //
  42832. if (key === undefined || key && typeof key === "string" && value === undefined) {
  42833. return this.get(owner, key);
  42834. }
  42835. // When the key is not a string, or both a key and value
  42836. // are specified, set or extend (existing objects) with either:
  42837. //
  42838. // 1. An object of properties
  42839. // 2. A key and value
  42840. //
  42841. this.set(owner, key, value);
  42842. // Since the "set" path can have two possible entry points
  42843. // return the expected data based on which path was taken[*]
  42844. return value !== undefined ? value : key;
  42845. },
  42846. remove: function remove(owner, key) {
  42847. var i,
  42848. cache = owner[this.expando];
  42849. if (cache === undefined) {
  42850. return;
  42851. }
  42852. if (key !== undefined) {
  42853. // Support array or space separated string of keys
  42854. if (Array.isArray(key)) {
  42855. // If key is an array of keys...
  42856. // We always set camelCase keys, so remove that.
  42857. key = key.map(camelCase);
  42858. } else {
  42859. key = camelCase(key);
  42860. // If a key with the spaces exists, use it.
  42861. // Otherwise, create an array by matching non-whitespace
  42862. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  42863. }
  42864. i = key.length;
  42865. while (i--) {
  42866. delete cache[key[i]];
  42867. }
  42868. }
  42869. // Remove the expando if there's no more data
  42870. if (key === undefined || jQuery.isEmptyObject(cache)) {
  42871. // Support: Chrome <=35 - 45
  42872. // Webkit & Blink performance suffers when deleting properties
  42873. // from DOM nodes, so set to undefined instead
  42874. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  42875. if (owner.nodeType) {
  42876. owner[this.expando] = undefined;
  42877. } else {
  42878. delete owner[this.expando];
  42879. }
  42880. }
  42881. },
  42882. hasData: function hasData(owner) {
  42883. var cache = owner[this.expando];
  42884. return cache !== undefined && !jQuery.isEmptyObject(cache);
  42885. }
  42886. };
  42887. var dataPriv = new Data();
  42888. var dataUser = new Data();
  42889. // Implementation Summary
  42890. //
  42891. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  42892. // 2. Improve the module's maintainability by reducing the storage
  42893. // paths to a single mechanism.
  42894. // 3. Use the same single mechanism to support "private" and "user" data.
  42895. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  42896. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  42897. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  42898. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  42899. rmultiDash = /[A-Z]/g;
  42900. function getData(data) {
  42901. if (data === "true") {
  42902. return true;
  42903. }
  42904. if (data === "false") {
  42905. return false;
  42906. }
  42907. if (data === "null") {
  42908. return null;
  42909. }
  42910. // Only convert to a number if it doesn't change the string
  42911. if (data === +data + "") {
  42912. return +data;
  42913. }
  42914. if (rbrace.test(data)) {
  42915. return JSON.parse(data);
  42916. }
  42917. return data;
  42918. }
  42919. function dataAttr(elem, key, data) {
  42920. var name;
  42921. // If nothing was found internally, try to fetch any
  42922. // data from the HTML5 data-* attribute
  42923. if (data === undefined && elem.nodeType === 1) {
  42924. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  42925. data = elem.getAttribute(name);
  42926. if (typeof data === "string") {
  42927. try {
  42928. data = getData(data);
  42929. } catch (e) {}
  42930. // Make sure we set the data so it isn't changed later
  42931. dataUser.set(elem, key, data);
  42932. } else {
  42933. data = undefined;
  42934. }
  42935. }
  42936. return data;
  42937. }
  42938. jQuery.extend({
  42939. hasData: function hasData(elem) {
  42940. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  42941. },
  42942. data: function data(elem, name, _data) {
  42943. return dataUser.access(elem, name, _data);
  42944. },
  42945. removeData: function removeData(elem, name) {
  42946. dataUser.remove(elem, name);
  42947. },
  42948. // TODO: Now that all calls to _data and _removeData have been replaced
  42949. // with direct calls to dataPriv methods, these can be deprecated.
  42950. _data: function _data(elem, name, data) {
  42951. return dataPriv.access(elem, name, data);
  42952. },
  42953. _removeData: function _removeData(elem, name) {
  42954. dataPriv.remove(elem, name);
  42955. }
  42956. });
  42957. jQuery.fn.extend({
  42958. data: function data(key, value) {
  42959. var i,
  42960. name,
  42961. data,
  42962. elem = this[0],
  42963. attrs = elem && elem.attributes;
  42964. // Gets all values
  42965. if (key === undefined) {
  42966. if (this.length) {
  42967. data = dataUser.get(elem);
  42968. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  42969. i = attrs.length;
  42970. while (i--) {
  42971. // Support: IE 11 only
  42972. // The attrs elements can be null (#14894)
  42973. if (attrs[i]) {
  42974. name = attrs[i].name;
  42975. if (name.indexOf("data-") === 0) {
  42976. name = camelCase(name.slice(5));
  42977. dataAttr(elem, name, data[name]);
  42978. }
  42979. }
  42980. }
  42981. dataPriv.set(elem, "hasDataAttrs", true);
  42982. }
  42983. }
  42984. return data;
  42985. }
  42986. // Sets multiple values
  42987. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  42988. return this.each(function () {
  42989. dataUser.set(this, key);
  42990. });
  42991. }
  42992. return access(this, function (value) {
  42993. var data;
  42994. // The calling jQuery object (element matches) is not empty
  42995. // (and therefore has an element appears at this[ 0 ]) and the
  42996. // `value` parameter was not undefined. An empty jQuery object
  42997. // will result in `undefined` for elem = this[ 0 ] which will
  42998. // throw an exception if an attempt to read a data cache is made.
  42999. if (elem && value === undefined) {
  43000. // Attempt to get data from the cache
  43001. // The key will always be camelCased in Data
  43002. data = dataUser.get(elem, key);
  43003. if (data !== undefined) {
  43004. return data;
  43005. }
  43006. // Attempt to "discover" the data in
  43007. // HTML5 custom data-* attrs
  43008. data = dataAttr(elem, key);
  43009. if (data !== undefined) {
  43010. return data;
  43011. }
  43012. // We tried really hard, but the data doesn't exist.
  43013. return;
  43014. }
  43015. // Set the data...
  43016. this.each(function () {
  43017. // We always store the camelCased key
  43018. dataUser.set(this, key, value);
  43019. });
  43020. }, null, value, arguments.length > 1, null, true);
  43021. },
  43022. removeData: function removeData(key) {
  43023. return this.each(function () {
  43024. dataUser.remove(this, key);
  43025. });
  43026. }
  43027. });
  43028. jQuery.extend({
  43029. queue: function queue(elem, type, data) {
  43030. var queue;
  43031. if (elem) {
  43032. type = (type || "fx") + "queue";
  43033. queue = dataPriv.get(elem, type);
  43034. // Speed up dequeue by getting out quickly if this is just a lookup
  43035. if (data) {
  43036. if (!queue || Array.isArray(data)) {
  43037. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  43038. } else {
  43039. queue.push(data);
  43040. }
  43041. }
  43042. return queue || [];
  43043. }
  43044. },
  43045. dequeue: function dequeue(elem, type) {
  43046. type = type || "fx";
  43047. var queue = jQuery.queue(elem, type),
  43048. startLength = queue.length,
  43049. fn = queue.shift(),
  43050. hooks = jQuery._queueHooks(elem, type),
  43051. next = function next() {
  43052. jQuery.dequeue(elem, type);
  43053. };
  43054. // If the fx queue is dequeued, always remove the progress sentinel
  43055. if (fn === "inprogress") {
  43056. fn = queue.shift();
  43057. startLength--;
  43058. }
  43059. if (fn) {
  43060. // Add a progress sentinel to prevent the fx queue from being
  43061. // automatically dequeued
  43062. if (type === "fx") {
  43063. queue.unshift("inprogress");
  43064. }
  43065. // Clear up the last queue stop function
  43066. delete hooks.stop;
  43067. fn.call(elem, next, hooks);
  43068. }
  43069. if (!startLength && hooks) {
  43070. hooks.empty.fire();
  43071. }
  43072. },
  43073. // Not public - generate a queueHooks object, or return the current one
  43074. _queueHooks: function _queueHooks(elem, type) {
  43075. var key = type + "queueHooks";
  43076. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  43077. empty: jQuery.Callbacks("once memory").add(function () {
  43078. dataPriv.remove(elem, [type + "queue", key]);
  43079. })
  43080. });
  43081. }
  43082. });
  43083. jQuery.fn.extend({
  43084. queue: function queue(type, data) {
  43085. var setter = 2;
  43086. if (typeof type !== "string") {
  43087. data = type;
  43088. type = "fx";
  43089. setter--;
  43090. }
  43091. if (arguments.length < setter) {
  43092. return jQuery.queue(this[0], type);
  43093. }
  43094. return data === undefined ? this : this.each(function () {
  43095. var queue = jQuery.queue(this, type, data);
  43096. // Ensure a hooks for this queue
  43097. jQuery._queueHooks(this, type);
  43098. if (type === "fx" && queue[0] !== "inprogress") {
  43099. jQuery.dequeue(this, type);
  43100. }
  43101. });
  43102. },
  43103. dequeue: function dequeue(type) {
  43104. return this.each(function () {
  43105. jQuery.dequeue(this, type);
  43106. });
  43107. },
  43108. clearQueue: function clearQueue(type) {
  43109. return this.queue(type || "fx", []);
  43110. },
  43111. // Get a promise resolved when queues of a certain type
  43112. // are emptied (fx is the type by default)
  43113. promise: function promise(type, obj) {
  43114. var tmp,
  43115. count = 1,
  43116. defer = jQuery.Deferred(),
  43117. elements = this,
  43118. i = this.length,
  43119. resolve = function resolve() {
  43120. if (! --count) {
  43121. defer.resolveWith(elements, [elements]);
  43122. }
  43123. };
  43124. if (typeof type !== "string") {
  43125. obj = type;
  43126. type = undefined;
  43127. }
  43128. type = type || "fx";
  43129. while (i--) {
  43130. tmp = dataPriv.get(elements[i], type + "queueHooks");
  43131. if (tmp && tmp.empty) {
  43132. count++;
  43133. tmp.empty.add(resolve);
  43134. }
  43135. }
  43136. resolve();
  43137. return defer.promise(obj);
  43138. }
  43139. });
  43140. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  43141. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  43142. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  43143. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  43144. // isHiddenWithinTree might be called from jQuery#filter function;
  43145. // in that case, element will be second argument
  43146. elem = el || elem;
  43147. // Inline style trumps all
  43148. return elem.style.display === "none" || elem.style.display === "" &&
  43149. // Otherwise, check computed style
  43150. // Support: Firefox <=43 - 45
  43151. // Disconnected elements can have computed display: none, so first confirm that elem is
  43152. // in the document.
  43153. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  43154. };
  43155. var swap = function swap(elem, options, callback, args) {
  43156. var ret,
  43157. name,
  43158. old = {};
  43159. // Remember the old values, and insert the new ones
  43160. for (name in options) {
  43161. old[name] = elem.style[name];
  43162. elem.style[name] = options[name];
  43163. }
  43164. ret = callback.apply(elem, args || []);
  43165. // Revert the old values
  43166. for (name in options) {
  43167. elem.style[name] = old[name];
  43168. }
  43169. return ret;
  43170. };
  43171. function adjustCSS(elem, prop, valueParts, tween) {
  43172. var adjusted,
  43173. scale,
  43174. maxIterations = 20,
  43175. currentValue = tween ? function () {
  43176. return tween.cur();
  43177. } : function () {
  43178. return jQuery.css(elem, prop, "");
  43179. },
  43180. initial = currentValue(),
  43181. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  43182. // Starting value computation is required for potential unit mismatches
  43183. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  43184. if (initialInUnit && initialInUnit[3] !== unit) {
  43185. // Support: Firefox <=54
  43186. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  43187. initial = initial / 2;
  43188. // Trust units reported by jQuery.css
  43189. unit = unit || initialInUnit[3];
  43190. // Iteratively approximate from a nonzero starting point
  43191. initialInUnit = +initial || 1;
  43192. while (maxIterations--) {
  43193. // Evaluate and update our best guess (doubling guesses that zero out).
  43194. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  43195. jQuery.style(elem, prop, initialInUnit + unit);
  43196. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  43197. maxIterations = 0;
  43198. }
  43199. initialInUnit = initialInUnit / scale;
  43200. }
  43201. initialInUnit = initialInUnit * 2;
  43202. jQuery.style(elem, prop, initialInUnit + unit);
  43203. // Make sure we update the tween properties later on
  43204. valueParts = valueParts || [];
  43205. }
  43206. if (valueParts) {
  43207. initialInUnit = +initialInUnit || +initial || 0;
  43208. // Apply relative offset (+=/-=) if specified
  43209. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  43210. if (tween) {
  43211. tween.unit = unit;
  43212. tween.start = initialInUnit;
  43213. tween.end = adjusted;
  43214. }
  43215. }
  43216. return adjusted;
  43217. }
  43218. var defaultDisplayMap = {};
  43219. function getDefaultDisplay(elem) {
  43220. var temp,
  43221. doc = elem.ownerDocument,
  43222. nodeName = elem.nodeName,
  43223. display = defaultDisplayMap[nodeName];
  43224. if (display) {
  43225. return display;
  43226. }
  43227. temp = doc.body.appendChild(doc.createElement(nodeName));
  43228. display = jQuery.css(temp, "display");
  43229. temp.parentNode.removeChild(temp);
  43230. if (display === "none") {
  43231. display = "block";
  43232. }
  43233. defaultDisplayMap[nodeName] = display;
  43234. return display;
  43235. }
  43236. function showHide(elements, show) {
  43237. var display,
  43238. elem,
  43239. values = [],
  43240. index = 0,
  43241. length = elements.length;
  43242. // Determine new display value for elements that need to change
  43243. for (; index < length; index++) {
  43244. elem = elements[index];
  43245. if (!elem.style) {
  43246. continue;
  43247. }
  43248. display = elem.style.display;
  43249. if (show) {
  43250. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  43251. // check is required in this first loop unless we have a nonempty display value (either
  43252. // inline or about-to-be-restored)
  43253. if (display === "none") {
  43254. values[index] = dataPriv.get(elem, "display") || null;
  43255. if (!values[index]) {
  43256. elem.style.display = "";
  43257. }
  43258. }
  43259. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  43260. values[index] = getDefaultDisplay(elem);
  43261. }
  43262. } else {
  43263. if (display !== "none") {
  43264. values[index] = "none";
  43265. // Remember what we're overwriting
  43266. dataPriv.set(elem, "display", display);
  43267. }
  43268. }
  43269. }
  43270. // Set the display of the elements in a second loop to avoid constant reflow
  43271. for (index = 0; index < length; index++) {
  43272. if (values[index] != null) {
  43273. elements[index].style.display = values[index];
  43274. }
  43275. }
  43276. return elements;
  43277. }
  43278. jQuery.fn.extend({
  43279. show: function show() {
  43280. return showHide(this, true);
  43281. },
  43282. hide: function hide() {
  43283. return showHide(this);
  43284. },
  43285. toggle: function toggle(state) {
  43286. if (typeof state === "boolean") {
  43287. return state ? this.show() : this.hide();
  43288. }
  43289. return this.each(function () {
  43290. if (isHiddenWithinTree(this)) {
  43291. jQuery(this).show();
  43292. } else {
  43293. jQuery(this).hide();
  43294. }
  43295. });
  43296. }
  43297. });
  43298. var rcheckableType = /^(?:checkbox|radio)$/i;
  43299. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  43300. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  43301. // We have to close these tags to support XHTML (#13200)
  43302. var wrapMap = {
  43303. // Support: IE <=9 only
  43304. option: [1, "<select multiple='multiple'>", "</select>"],
  43305. // XHTML parsers do not magically insert elements in the
  43306. // same way that tag soup parsers do. So we cannot shorten
  43307. // this by omitting <tbody> or other required elements.
  43308. thead: [1, "<table>", "</table>"],
  43309. col: [2, "<table><colgroup>", "</colgroup></table>"],
  43310. tr: [2, "<table><tbody>", "</tbody></table>"],
  43311. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  43312. _default: [0, "", ""]
  43313. };
  43314. // Support: IE <=9 only
  43315. wrapMap.optgroup = wrapMap.option;
  43316. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  43317. wrapMap.th = wrapMap.td;
  43318. function getAll(context, tag) {
  43319. // Support: IE <=9 - 11 only
  43320. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  43321. var ret;
  43322. if (typeof context.getElementsByTagName !== "undefined") {
  43323. ret = context.getElementsByTagName(tag || "*");
  43324. } else if (typeof context.querySelectorAll !== "undefined") {
  43325. ret = context.querySelectorAll(tag || "*");
  43326. } else {
  43327. ret = [];
  43328. }
  43329. if (tag === undefined || tag && nodeName(context, tag)) {
  43330. return jQuery.merge([context], ret);
  43331. }
  43332. return ret;
  43333. }
  43334. // Mark scripts as having already been evaluated
  43335. function setGlobalEval(elems, refElements) {
  43336. var i = 0,
  43337. l = elems.length;
  43338. for (; i < l; i++) {
  43339. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  43340. }
  43341. }
  43342. var rhtml = /<|&#?\w+;/;
  43343. function buildFragment(elems, context, scripts, selection, ignored) {
  43344. var elem,
  43345. tmp,
  43346. tag,
  43347. wrap,
  43348. contains,
  43349. j,
  43350. fragment = context.createDocumentFragment(),
  43351. nodes = [],
  43352. i = 0,
  43353. l = elems.length;
  43354. for (; i < l; i++) {
  43355. elem = elems[i];
  43356. if (elem || elem === 0) {
  43357. // Add nodes directly
  43358. if (toType(elem) === "object") {
  43359. // Support: Android <=4.0 only, PhantomJS 1 only
  43360. // push.apply(_, arraylike) throws on ancient WebKit
  43361. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  43362. // Convert non-html into a text node
  43363. } else if (!rhtml.test(elem)) {
  43364. nodes.push(context.createTextNode(elem));
  43365. // Convert html into DOM nodes
  43366. } else {
  43367. tmp = tmp || fragment.appendChild(context.createElement("div"));
  43368. // Deserialize a standard representation
  43369. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  43370. wrap = wrapMap[tag] || wrapMap._default;
  43371. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  43372. // Descend through wrappers to the right content
  43373. j = wrap[0];
  43374. while (j--) {
  43375. tmp = tmp.lastChild;
  43376. }
  43377. // Support: Android <=4.0 only, PhantomJS 1 only
  43378. // push.apply(_, arraylike) throws on ancient WebKit
  43379. jQuery.merge(nodes, tmp.childNodes);
  43380. // Remember the top-level container
  43381. tmp = fragment.firstChild;
  43382. // Ensure the created nodes are orphaned (#12392)
  43383. tmp.textContent = "";
  43384. }
  43385. }
  43386. }
  43387. // Remove wrapper from fragment
  43388. fragment.textContent = "";
  43389. i = 0;
  43390. while (elem = nodes[i++]) {
  43391. // Skip elements already in the context collection (trac-4087)
  43392. if (selection && jQuery.inArray(elem, selection) > -1) {
  43393. if (ignored) {
  43394. ignored.push(elem);
  43395. }
  43396. continue;
  43397. }
  43398. contains = jQuery.contains(elem.ownerDocument, elem);
  43399. // Append to fragment
  43400. tmp = getAll(fragment.appendChild(elem), "script");
  43401. // Preserve script evaluation history
  43402. if (contains) {
  43403. setGlobalEval(tmp);
  43404. }
  43405. // Capture executables
  43406. if (scripts) {
  43407. j = 0;
  43408. while (elem = tmp[j++]) {
  43409. if (rscriptType.test(elem.type || "")) {
  43410. scripts.push(elem);
  43411. }
  43412. }
  43413. }
  43414. }
  43415. return fragment;
  43416. }
  43417. (function () {
  43418. var fragment = document.createDocumentFragment(),
  43419. div = fragment.appendChild(document.createElement("div")),
  43420. input = document.createElement("input");
  43421. // Support: Android 4.0 - 4.3 only
  43422. // Check state lost if the name is set (#11217)
  43423. // Support: Windows Web Apps (WWA)
  43424. // `name` and `type` must use .setAttribute for WWA (#14901)
  43425. input.setAttribute("type", "radio");
  43426. input.setAttribute("checked", "checked");
  43427. input.setAttribute("name", "t");
  43428. div.appendChild(input);
  43429. // Support: Android <=4.1 only
  43430. // Older WebKit doesn't clone checked state correctly in fragments
  43431. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  43432. // Support: IE <=11 only
  43433. // Make sure textarea (and checkbox) defaultValue is properly cloned
  43434. div.innerHTML = "<textarea>x</textarea>";
  43435. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  43436. })();
  43437. var documentElement = document.documentElement;
  43438. var rkeyEvent = /^key/,
  43439. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  43440. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  43441. function returnTrue() {
  43442. return true;
  43443. }
  43444. function returnFalse() {
  43445. return false;
  43446. }
  43447. // Support: IE <=9 only
  43448. // See #13393 for more info
  43449. function safeActiveElement() {
  43450. try {
  43451. return document.activeElement;
  43452. } catch (err) {}
  43453. }
  43454. function _on(elem, types, selector, data, fn, one) {
  43455. var origFn, type;
  43456. // Types can be a map of types/handlers
  43457. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  43458. // ( types-Object, selector, data )
  43459. if (typeof selector !== "string") {
  43460. // ( types-Object, data )
  43461. data = data || selector;
  43462. selector = undefined;
  43463. }
  43464. for (type in types) {
  43465. _on(elem, type, selector, data, types[type], one);
  43466. }
  43467. return elem;
  43468. }
  43469. if (data == null && fn == null) {
  43470. // ( types, fn )
  43471. fn = selector;
  43472. data = selector = undefined;
  43473. } else if (fn == null) {
  43474. if (typeof selector === "string") {
  43475. // ( types, selector, fn )
  43476. fn = data;
  43477. data = undefined;
  43478. } else {
  43479. // ( types, data, fn )
  43480. fn = data;
  43481. data = selector;
  43482. selector = undefined;
  43483. }
  43484. }
  43485. if (fn === false) {
  43486. fn = returnFalse;
  43487. } else if (!fn) {
  43488. return elem;
  43489. }
  43490. if (one === 1) {
  43491. origFn = fn;
  43492. fn = function fn(event) {
  43493. // Can use an empty set, since event contains the info
  43494. jQuery().off(event);
  43495. return origFn.apply(this, arguments);
  43496. };
  43497. // Use same guid so caller can remove using origFn
  43498. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  43499. }
  43500. return elem.each(function () {
  43501. jQuery.event.add(this, types, fn, data, selector);
  43502. });
  43503. }
  43504. /*
  43505. * Helper functions for managing events -- not part of the public interface.
  43506. * Props to Dean Edwards' addEvent library for many of the ideas.
  43507. */
  43508. jQuery.event = {
  43509. global: {},
  43510. add: function add(elem, types, handler, data, selector) {
  43511. var handleObjIn,
  43512. eventHandle,
  43513. tmp,
  43514. events,
  43515. t,
  43516. handleObj,
  43517. special,
  43518. handlers,
  43519. type,
  43520. namespaces,
  43521. origType,
  43522. elemData = dataPriv.get(elem);
  43523. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  43524. if (!elemData) {
  43525. return;
  43526. }
  43527. // Caller can pass in an object of custom data in lieu of the handler
  43528. if (handler.handler) {
  43529. handleObjIn = handler;
  43530. handler = handleObjIn.handler;
  43531. selector = handleObjIn.selector;
  43532. }
  43533. // Ensure that invalid selectors throw exceptions at attach time
  43534. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  43535. if (selector) {
  43536. jQuery.find.matchesSelector(documentElement, selector);
  43537. }
  43538. // Make sure that the handler has a unique ID, used to find/remove it later
  43539. if (!handler.guid) {
  43540. handler.guid = jQuery.guid++;
  43541. }
  43542. // Init the element's event structure and main handler, if this is the first
  43543. if (!(events = elemData.events)) {
  43544. events = elemData.events = {};
  43545. }
  43546. if (!(eventHandle = elemData.handle)) {
  43547. eventHandle = elemData.handle = function (e) {
  43548. // Discard the second event of a jQuery.event.trigger() and
  43549. // when an event is called after a page has unloaded
  43550. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  43551. };
  43552. }
  43553. // Handle multiple events separated by a space
  43554. types = (types || "").match(rnothtmlwhite) || [""];
  43555. t = types.length;
  43556. while (t--) {
  43557. tmp = rtypenamespace.exec(types[t]) || [];
  43558. type = origType = tmp[1];
  43559. namespaces = (tmp[2] || "").split(".").sort();
  43560. // There *must* be a type, no attaching namespace-only handlers
  43561. if (!type) {
  43562. continue;
  43563. }
  43564. // If event changes its type, use the special event handlers for the changed type
  43565. special = jQuery.event.special[type] || {};
  43566. // If selector defined, determine special event api type, otherwise given type
  43567. type = (selector ? special.delegateType : special.bindType) || type;
  43568. // Update special based on newly reset type
  43569. special = jQuery.event.special[type] || {};
  43570. // handleObj is passed to all event handlers
  43571. handleObj = jQuery.extend({
  43572. type: type,
  43573. origType: origType,
  43574. data: data,
  43575. handler: handler,
  43576. guid: handler.guid,
  43577. selector: selector,
  43578. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  43579. namespace: namespaces.join(".")
  43580. }, handleObjIn);
  43581. // Init the event handler queue if we're the first
  43582. if (!(handlers = events[type])) {
  43583. handlers = events[type] = [];
  43584. handlers.delegateCount = 0;
  43585. // Only use addEventListener if the special events handler returns false
  43586. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  43587. if (elem.addEventListener) {
  43588. elem.addEventListener(type, eventHandle);
  43589. }
  43590. }
  43591. }
  43592. if (special.add) {
  43593. special.add.call(elem, handleObj);
  43594. if (!handleObj.handler.guid) {
  43595. handleObj.handler.guid = handler.guid;
  43596. }
  43597. }
  43598. // Add to the element's handler list, delegates in front
  43599. if (selector) {
  43600. handlers.splice(handlers.delegateCount++, 0, handleObj);
  43601. } else {
  43602. handlers.push(handleObj);
  43603. }
  43604. // Keep track of which events have ever been used, for event optimization
  43605. jQuery.event.global[type] = true;
  43606. }
  43607. },
  43608. // Detach an event or set of events from an element
  43609. remove: function remove(elem, types, handler, selector, mappedTypes) {
  43610. var j,
  43611. origCount,
  43612. tmp,
  43613. events,
  43614. t,
  43615. handleObj,
  43616. special,
  43617. handlers,
  43618. type,
  43619. namespaces,
  43620. origType,
  43621. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  43622. if (!elemData || !(events = elemData.events)) {
  43623. return;
  43624. }
  43625. // Once for each type.namespace in types; type may be omitted
  43626. types = (types || "").match(rnothtmlwhite) || [""];
  43627. t = types.length;
  43628. while (t--) {
  43629. tmp = rtypenamespace.exec(types[t]) || [];
  43630. type = origType = tmp[1];
  43631. namespaces = (tmp[2] || "").split(".").sort();
  43632. // Unbind all events (on this namespace, if provided) for the element
  43633. if (!type) {
  43634. for (type in events) {
  43635. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  43636. }
  43637. continue;
  43638. }
  43639. special = jQuery.event.special[type] || {};
  43640. type = (selector ? special.delegateType : special.bindType) || type;
  43641. handlers = events[type] || [];
  43642. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  43643. // Remove matching events
  43644. origCount = j = handlers.length;
  43645. while (j--) {
  43646. handleObj = handlers[j];
  43647. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  43648. handlers.splice(j, 1);
  43649. if (handleObj.selector) {
  43650. handlers.delegateCount--;
  43651. }
  43652. if (special.remove) {
  43653. special.remove.call(elem, handleObj);
  43654. }
  43655. }
  43656. }
  43657. // Remove generic event handler if we removed something and no more handlers exist
  43658. // (avoids potential for endless recursion during removal of special event handlers)
  43659. if (origCount && !handlers.length) {
  43660. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  43661. jQuery.removeEvent(elem, type, elemData.handle);
  43662. }
  43663. delete events[type];
  43664. }
  43665. }
  43666. // Remove data and the expando if it's no longer used
  43667. if (jQuery.isEmptyObject(events)) {
  43668. dataPriv.remove(elem, "handle events");
  43669. }
  43670. },
  43671. dispatch: function dispatch(nativeEvent) {
  43672. // Make a writable jQuery.Event from the native event object
  43673. var event = jQuery.event.fix(nativeEvent);
  43674. var i,
  43675. j,
  43676. ret,
  43677. matched,
  43678. handleObj,
  43679. handlerQueue,
  43680. args = new Array(arguments.length),
  43681. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  43682. special = jQuery.event.special[event.type] || {};
  43683. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  43684. args[0] = event;
  43685. for (i = 1; i < arguments.length; i++) {
  43686. args[i] = arguments[i];
  43687. }
  43688. event.delegateTarget = this;
  43689. // Call the preDispatch hook for the mapped type, and let it bail if desired
  43690. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  43691. return;
  43692. }
  43693. // Determine handlers
  43694. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  43695. // Run delegates first; they may want to stop propagation beneath us
  43696. i = 0;
  43697. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  43698. event.currentTarget = matched.elem;
  43699. j = 0;
  43700. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  43701. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  43702. // a subset or equal to those in the bound event (both can have no namespace).
  43703. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  43704. event.handleObj = handleObj;
  43705. event.data = handleObj.data;
  43706. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  43707. if (ret !== undefined) {
  43708. if ((event.result = ret) === false) {
  43709. event.preventDefault();
  43710. event.stopPropagation();
  43711. }
  43712. }
  43713. }
  43714. }
  43715. }
  43716. // Call the postDispatch hook for the mapped type
  43717. if (special.postDispatch) {
  43718. special.postDispatch.call(this, event);
  43719. }
  43720. return event.result;
  43721. },
  43722. handlers: function handlers(event, _handlers) {
  43723. var i,
  43724. handleObj,
  43725. sel,
  43726. matchedHandlers,
  43727. matchedSelectors,
  43728. handlerQueue = [],
  43729. delegateCount = _handlers.delegateCount,
  43730. cur = event.target;
  43731. // Find delegate handlers
  43732. if (delegateCount &&
  43733. // Support: IE <=9
  43734. // Black-hole SVG <use> instance trees (trac-13180)
  43735. cur.nodeType &&
  43736. // Support: Firefox <=42
  43737. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  43738. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  43739. // Support: IE 11 only
  43740. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  43741. !(event.type === "click" && event.button >= 1)) {
  43742. for (; cur !== this; cur = cur.parentNode || this) {
  43743. // Don't check non-elements (#13208)
  43744. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  43745. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  43746. matchedHandlers = [];
  43747. matchedSelectors = {};
  43748. for (i = 0; i < delegateCount; i++) {
  43749. handleObj = _handlers[i];
  43750. // Don't conflict with Object.prototype properties (#13203)
  43751. sel = handleObj.selector + " ";
  43752. if (matchedSelectors[sel] === undefined) {
  43753. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  43754. }
  43755. if (matchedSelectors[sel]) {
  43756. matchedHandlers.push(handleObj);
  43757. }
  43758. }
  43759. if (matchedHandlers.length) {
  43760. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  43761. }
  43762. }
  43763. }
  43764. }
  43765. // Add the remaining (directly-bound) handlers
  43766. cur = this;
  43767. if (delegateCount < _handlers.length) {
  43768. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  43769. }
  43770. return handlerQueue;
  43771. },
  43772. addProp: function addProp(name, hook) {
  43773. Object.defineProperty(jQuery.Event.prototype, name, {
  43774. enumerable: true,
  43775. configurable: true,
  43776. get: isFunction(hook) ? function () {
  43777. if (this.originalEvent) {
  43778. return hook(this.originalEvent);
  43779. }
  43780. } : function () {
  43781. if (this.originalEvent) {
  43782. return this.originalEvent[name];
  43783. }
  43784. },
  43785. set: function set(value) {
  43786. Object.defineProperty(this, name, {
  43787. enumerable: true,
  43788. configurable: true,
  43789. writable: true,
  43790. value: value
  43791. });
  43792. }
  43793. });
  43794. },
  43795. fix: function fix(originalEvent) {
  43796. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  43797. },
  43798. special: {
  43799. load: {
  43800. // Prevent triggered image.load events from bubbling to window.load
  43801. noBubble: true
  43802. },
  43803. focus: {
  43804. // Fire native event if possible so blur/focus sequence is correct
  43805. trigger: function trigger() {
  43806. if (this !== safeActiveElement() && this.focus) {
  43807. this.focus();
  43808. return false;
  43809. }
  43810. },
  43811. delegateType: "focusin"
  43812. },
  43813. blur: {
  43814. trigger: function trigger() {
  43815. if (this === safeActiveElement() && this.blur) {
  43816. this.blur();
  43817. return false;
  43818. }
  43819. },
  43820. delegateType: "focusout"
  43821. },
  43822. click: {
  43823. // For checkbox, fire native event so checked state will be right
  43824. trigger: function trigger() {
  43825. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  43826. this.click();
  43827. return false;
  43828. }
  43829. },
  43830. // For cross-browser consistency, don't fire native .click() on links
  43831. _default: function _default(event) {
  43832. return nodeName(event.target, "a");
  43833. }
  43834. },
  43835. beforeunload: {
  43836. postDispatch: function postDispatch(event) {
  43837. // Support: Firefox 20+
  43838. // Firefox doesn't alert if the returnValue field is not set.
  43839. if (event.result !== undefined && event.originalEvent) {
  43840. event.originalEvent.returnValue = event.result;
  43841. }
  43842. }
  43843. }
  43844. }
  43845. };
  43846. jQuery.removeEvent = function (elem, type, handle) {
  43847. // This "if" is needed for plain objects
  43848. if (elem.removeEventListener) {
  43849. elem.removeEventListener(type, handle);
  43850. }
  43851. };
  43852. jQuery.Event = function (src, props) {
  43853. // Allow instantiation without the 'new' keyword
  43854. if (!(this instanceof jQuery.Event)) {
  43855. return new jQuery.Event(src, props);
  43856. }
  43857. // Event object
  43858. if (src && src.type) {
  43859. this.originalEvent = src;
  43860. this.type = src.type;
  43861. // Events bubbling up the document may have been marked as prevented
  43862. // by a handler lower down the tree; reflect the correct value.
  43863. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  43864. // Support: Android <=2.3 only
  43865. src.returnValue === false ? returnTrue : returnFalse;
  43866. // Create target properties
  43867. // Support: Safari <=6 - 7 only
  43868. // Target should not be a text node (#504, #13143)
  43869. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  43870. this.currentTarget = src.currentTarget;
  43871. this.relatedTarget = src.relatedTarget;
  43872. // Event type
  43873. } else {
  43874. this.type = src;
  43875. }
  43876. // Put explicitly provided properties onto the event object
  43877. if (props) {
  43878. jQuery.extend(this, props);
  43879. }
  43880. // Create a timestamp if incoming event doesn't have one
  43881. this.timeStamp = src && src.timeStamp || Date.now();
  43882. // Mark it as fixed
  43883. this[jQuery.expando] = true;
  43884. };
  43885. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  43886. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  43887. jQuery.Event.prototype = {
  43888. constructor: jQuery.Event,
  43889. isDefaultPrevented: returnFalse,
  43890. isPropagationStopped: returnFalse,
  43891. isImmediatePropagationStopped: returnFalse,
  43892. isSimulated: false,
  43893. preventDefault: function preventDefault() {
  43894. var e = this.originalEvent;
  43895. this.isDefaultPrevented = returnTrue;
  43896. if (e && !this.isSimulated) {
  43897. e.preventDefault();
  43898. }
  43899. },
  43900. stopPropagation: function stopPropagation() {
  43901. var e = this.originalEvent;
  43902. this.isPropagationStopped = returnTrue;
  43903. if (e && !this.isSimulated) {
  43904. e.stopPropagation();
  43905. }
  43906. },
  43907. stopImmediatePropagation: function stopImmediatePropagation() {
  43908. var e = this.originalEvent;
  43909. this.isImmediatePropagationStopped = returnTrue;
  43910. if (e && !this.isSimulated) {
  43911. e.stopImmediatePropagation();
  43912. }
  43913. this.stopPropagation();
  43914. }
  43915. };
  43916. // Includes all common event props including KeyEvent and MouseEvent specific props
  43917. jQuery.each({
  43918. altKey: true,
  43919. bubbles: true,
  43920. cancelable: true,
  43921. changedTouches: true,
  43922. ctrlKey: true,
  43923. detail: true,
  43924. eventPhase: true,
  43925. metaKey: true,
  43926. pageX: true,
  43927. pageY: true,
  43928. shiftKey: true,
  43929. view: true,
  43930. "char": true,
  43931. charCode: true,
  43932. key: true,
  43933. keyCode: true,
  43934. button: true,
  43935. buttons: true,
  43936. clientX: true,
  43937. clientY: true,
  43938. offsetX: true,
  43939. offsetY: true,
  43940. pointerId: true,
  43941. pointerType: true,
  43942. screenX: true,
  43943. screenY: true,
  43944. targetTouches: true,
  43945. toElement: true,
  43946. touches: true,
  43947. which: function which(event) {
  43948. var button = event.button;
  43949. // Add which for key events
  43950. if (event.which == null && rkeyEvent.test(event.type)) {
  43951. return event.charCode != null ? event.charCode : event.keyCode;
  43952. }
  43953. // Add which for click: 1 === left; 2 === middle; 3 === right
  43954. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  43955. if (button & 1) {
  43956. return 1;
  43957. }
  43958. if (button & 2) {
  43959. return 3;
  43960. }
  43961. if (button & 4) {
  43962. return 2;
  43963. }
  43964. return 0;
  43965. }
  43966. return event.which;
  43967. }
  43968. }, jQuery.event.addProp);
  43969. // Create mouseenter/leave events using mouseover/out and event-time checks
  43970. // so that event delegation works in jQuery.
  43971. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  43972. //
  43973. // Support: Safari 7 only
  43974. // Safari sends mouseenter too often; see:
  43975. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  43976. // for the description of the bug (it existed in older Chrome versions as well).
  43977. jQuery.each({
  43978. mouseenter: "mouseover",
  43979. mouseleave: "mouseout",
  43980. pointerenter: "pointerover",
  43981. pointerleave: "pointerout"
  43982. }, function (orig, fix) {
  43983. jQuery.event.special[orig] = {
  43984. delegateType: fix,
  43985. bindType: fix,
  43986. handle: function handle(event) {
  43987. var ret,
  43988. target = this,
  43989. related = event.relatedTarget,
  43990. handleObj = event.handleObj;
  43991. // For mouseenter/leave call the handler if related is outside the target.
  43992. // NB: No relatedTarget if the mouse left/entered the browser window
  43993. if (!related || related !== target && !jQuery.contains(target, related)) {
  43994. event.type = handleObj.origType;
  43995. ret = handleObj.handler.apply(this, arguments);
  43996. event.type = fix;
  43997. }
  43998. return ret;
  43999. }
  44000. };
  44001. });
  44002. jQuery.fn.extend({
  44003. on: function on(types, selector, data, fn) {
  44004. return _on(this, types, selector, data, fn);
  44005. },
  44006. one: function one(types, selector, data, fn) {
  44007. return _on(this, types, selector, data, fn, 1);
  44008. },
  44009. off: function off(types, selector, fn) {
  44010. var handleObj, type;
  44011. if (types && types.preventDefault && types.handleObj) {
  44012. // ( event ) dispatched jQuery.Event
  44013. handleObj = types.handleObj;
  44014. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  44015. return this;
  44016. }
  44017. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  44018. // ( types-object [, selector] )
  44019. for (type in types) {
  44020. this.off(type, selector, types[type]);
  44021. }
  44022. return this;
  44023. }
  44024. if (selector === false || typeof selector === "function") {
  44025. // ( types [, fn] )
  44026. fn = selector;
  44027. selector = undefined;
  44028. }
  44029. if (fn === false) {
  44030. fn = returnFalse;
  44031. }
  44032. return this.each(function () {
  44033. jQuery.event.remove(this, types, fn, selector);
  44034. });
  44035. }
  44036. });
  44037. var
  44038. /* eslint-disable max-len */
  44039. // See https://github.com/eslint/eslint/issues/3229
  44040. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  44041. /* eslint-enable */
  44042. // Support: IE <=10 - 11, Edge 12 - 13 only
  44043. // In IE/Edge using regex groups here causes severe slowdowns.
  44044. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  44045. rnoInnerhtml = /<script|<style|<link/i,
  44046. // checked="checked" or checked
  44047. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  44048. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  44049. // Prefer a tbody over its parent table for containing new rows
  44050. function manipulationTarget(elem, content) {
  44051. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  44052. return jQuery(elem).children("tbody")[0] || elem;
  44053. }
  44054. return elem;
  44055. }
  44056. // Replace/restore the type attribute of script elements for safe DOM manipulation
  44057. function disableScript(elem) {
  44058. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  44059. return elem;
  44060. }
  44061. function restoreScript(elem) {
  44062. if ((elem.type || "").slice(0, 5) === "true/") {
  44063. elem.type = elem.type.slice(5);
  44064. } else {
  44065. elem.removeAttribute("type");
  44066. }
  44067. return elem;
  44068. }
  44069. function cloneCopyEvent(src, dest) {
  44070. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  44071. if (dest.nodeType !== 1) {
  44072. return;
  44073. }
  44074. // 1. Copy private data: events, handlers, etc.
  44075. if (dataPriv.hasData(src)) {
  44076. pdataOld = dataPriv.access(src);
  44077. pdataCur = dataPriv.set(dest, pdataOld);
  44078. events = pdataOld.events;
  44079. if (events) {
  44080. delete pdataCur.handle;
  44081. pdataCur.events = {};
  44082. for (type in events) {
  44083. for (i = 0, l = events[type].length; i < l; i++) {
  44084. jQuery.event.add(dest, type, events[type][i]);
  44085. }
  44086. }
  44087. }
  44088. }
  44089. // 2. Copy user data
  44090. if (dataUser.hasData(src)) {
  44091. udataOld = dataUser.access(src);
  44092. udataCur = jQuery.extend({}, udataOld);
  44093. dataUser.set(dest, udataCur);
  44094. }
  44095. }
  44096. // Fix IE bugs, see support tests
  44097. function fixInput(src, dest) {
  44098. var nodeName = dest.nodeName.toLowerCase();
  44099. // Fails to persist the checked state of a cloned checkbox or radio button.
  44100. if (nodeName === "input" && rcheckableType.test(src.type)) {
  44101. dest.checked = src.checked;
  44102. // Fails to return the selected option to the default selected state when cloning options
  44103. } else if (nodeName === "input" || nodeName === "textarea") {
  44104. dest.defaultValue = src.defaultValue;
  44105. }
  44106. }
  44107. function domManip(collection, args, callback, ignored) {
  44108. // Flatten any nested arrays
  44109. args = concat.apply([], args);
  44110. var fragment,
  44111. first,
  44112. scripts,
  44113. hasScripts,
  44114. node,
  44115. doc,
  44116. i = 0,
  44117. l = collection.length,
  44118. iNoClone = l - 1,
  44119. value = args[0],
  44120. valueIsFunction = isFunction(value);
  44121. // We can't cloneNode fragments that contain checked, in WebKit
  44122. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  44123. return collection.each(function (index) {
  44124. var self = collection.eq(index);
  44125. if (valueIsFunction) {
  44126. args[0] = value.call(this, index, self.html());
  44127. }
  44128. domManip(self, args, callback, ignored);
  44129. });
  44130. }
  44131. if (l) {
  44132. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  44133. first = fragment.firstChild;
  44134. if (fragment.childNodes.length === 1) {
  44135. fragment = first;
  44136. }
  44137. // Require either new content or an interest in ignored elements to invoke the callback
  44138. if (first || ignored) {
  44139. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  44140. hasScripts = scripts.length;
  44141. // Use the original fragment for the last item
  44142. // instead of the first because it can end up
  44143. // being emptied incorrectly in certain situations (#8070).
  44144. for (; i < l; i++) {
  44145. node = fragment;
  44146. if (i !== iNoClone) {
  44147. node = jQuery.clone(node, true, true);
  44148. // Keep references to cloned scripts for later restoration
  44149. if (hasScripts) {
  44150. // Support: Android <=4.0 only, PhantomJS 1 only
  44151. // push.apply(_, arraylike) throws on ancient WebKit
  44152. jQuery.merge(scripts, getAll(node, "script"));
  44153. }
  44154. }
  44155. callback.call(collection[i], node, i);
  44156. }
  44157. if (hasScripts) {
  44158. doc = scripts[scripts.length - 1].ownerDocument;
  44159. // Reenable scripts
  44160. jQuery.map(scripts, restoreScript);
  44161. // Evaluate executable scripts on first document insertion
  44162. for (i = 0; i < hasScripts; i++) {
  44163. node = scripts[i];
  44164. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  44165. if (node.src && (node.type || "").toLowerCase() !== "module") {
  44166. // Optional AJAX dependency, but won't run scripts if not present
  44167. if (jQuery._evalUrl) {
  44168. jQuery._evalUrl(node.src);
  44169. }
  44170. } else {
  44171. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  44172. }
  44173. }
  44174. }
  44175. }
  44176. }
  44177. }
  44178. return collection;
  44179. }
  44180. function _remove(elem, selector, keepData) {
  44181. var node,
  44182. nodes = selector ? jQuery.filter(selector, elem) : elem,
  44183. i = 0;
  44184. for (; (node = nodes[i]) != null; i++) {
  44185. if (!keepData && node.nodeType === 1) {
  44186. jQuery.cleanData(getAll(node));
  44187. }
  44188. if (node.parentNode) {
  44189. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  44190. setGlobalEval(getAll(node, "script"));
  44191. }
  44192. node.parentNode.removeChild(node);
  44193. }
  44194. }
  44195. return elem;
  44196. }
  44197. jQuery.extend({
  44198. htmlPrefilter: function htmlPrefilter(html) {
  44199. return html.replace(rxhtmlTag, "<$1></$2>");
  44200. },
  44201. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  44202. var i,
  44203. l,
  44204. srcElements,
  44205. destElements,
  44206. clone = elem.cloneNode(true),
  44207. inPage = jQuery.contains(elem.ownerDocument, elem);
  44208. // Fix IE cloning issues
  44209. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  44210. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  44211. destElements = getAll(clone);
  44212. srcElements = getAll(elem);
  44213. for (i = 0, l = srcElements.length; i < l; i++) {
  44214. fixInput(srcElements[i], destElements[i]);
  44215. }
  44216. }
  44217. // Copy the events from the original to the clone
  44218. if (dataAndEvents) {
  44219. if (deepDataAndEvents) {
  44220. srcElements = srcElements || getAll(elem);
  44221. destElements = destElements || getAll(clone);
  44222. for (i = 0, l = srcElements.length; i < l; i++) {
  44223. cloneCopyEvent(srcElements[i], destElements[i]);
  44224. }
  44225. } else {
  44226. cloneCopyEvent(elem, clone);
  44227. }
  44228. }
  44229. // Preserve script evaluation history
  44230. destElements = getAll(clone, "script");
  44231. if (destElements.length > 0) {
  44232. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  44233. }
  44234. // Return the cloned set
  44235. return clone;
  44236. },
  44237. cleanData: function cleanData(elems) {
  44238. var data,
  44239. elem,
  44240. type,
  44241. special = jQuery.event.special,
  44242. i = 0;
  44243. for (; (elem = elems[i]) !== undefined; i++) {
  44244. if (acceptData(elem)) {
  44245. if (data = elem[dataPriv.expando]) {
  44246. if (data.events) {
  44247. for (type in data.events) {
  44248. if (special[type]) {
  44249. jQuery.event.remove(elem, type);
  44250. // This is a shortcut to avoid jQuery.event.remove's overhead
  44251. } else {
  44252. jQuery.removeEvent(elem, type, data.handle);
  44253. }
  44254. }
  44255. }
  44256. // Support: Chrome <=35 - 45+
  44257. // Assign undefined instead of using delete, see Data#remove
  44258. elem[dataPriv.expando] = undefined;
  44259. }
  44260. if (elem[dataUser.expando]) {
  44261. // Support: Chrome <=35 - 45+
  44262. // Assign undefined instead of using delete, see Data#remove
  44263. elem[dataUser.expando] = undefined;
  44264. }
  44265. }
  44266. }
  44267. }
  44268. });
  44269. jQuery.fn.extend({
  44270. detach: function detach(selector) {
  44271. return _remove(this, selector, true);
  44272. },
  44273. remove: function remove(selector) {
  44274. return _remove(this, selector);
  44275. },
  44276. text: function text(value) {
  44277. return access(this, function (value) {
  44278. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  44279. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  44280. this.textContent = value;
  44281. }
  44282. });
  44283. }, null, value, arguments.length);
  44284. },
  44285. append: function append() {
  44286. return domManip(this, arguments, function (elem) {
  44287. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  44288. var target = manipulationTarget(this, elem);
  44289. target.appendChild(elem);
  44290. }
  44291. });
  44292. },
  44293. prepend: function prepend() {
  44294. return domManip(this, arguments, function (elem) {
  44295. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  44296. var target = manipulationTarget(this, elem);
  44297. target.insertBefore(elem, target.firstChild);
  44298. }
  44299. });
  44300. },
  44301. before: function before() {
  44302. return domManip(this, arguments, function (elem) {
  44303. if (this.parentNode) {
  44304. this.parentNode.insertBefore(elem, this);
  44305. }
  44306. });
  44307. },
  44308. after: function after() {
  44309. return domManip(this, arguments, function (elem) {
  44310. if (this.parentNode) {
  44311. this.parentNode.insertBefore(elem, this.nextSibling);
  44312. }
  44313. });
  44314. },
  44315. empty: function empty() {
  44316. var elem,
  44317. i = 0;
  44318. for (; (elem = this[i]) != null; i++) {
  44319. if (elem.nodeType === 1) {
  44320. // Prevent memory leaks
  44321. jQuery.cleanData(getAll(elem, false));
  44322. // Remove any remaining nodes
  44323. elem.textContent = "";
  44324. }
  44325. }
  44326. return this;
  44327. },
  44328. clone: function clone(dataAndEvents, deepDataAndEvents) {
  44329. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  44330. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  44331. return this.map(function () {
  44332. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  44333. });
  44334. },
  44335. html: function html(value) {
  44336. return access(this, function (value) {
  44337. var elem = this[0] || {},
  44338. i = 0,
  44339. l = this.length;
  44340. if (value === undefined && elem.nodeType === 1) {
  44341. return elem.innerHTML;
  44342. }
  44343. // See if we can take a shortcut and just use innerHTML
  44344. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  44345. value = jQuery.htmlPrefilter(value);
  44346. try {
  44347. for (; i < l; i++) {
  44348. elem = this[i] || {};
  44349. // Remove element nodes and prevent memory leaks
  44350. if (elem.nodeType === 1) {
  44351. jQuery.cleanData(getAll(elem, false));
  44352. elem.innerHTML = value;
  44353. }
  44354. }
  44355. elem = 0;
  44356. // If using innerHTML throws an exception, use the fallback method
  44357. } catch (e) {}
  44358. }
  44359. if (elem) {
  44360. this.empty().append(value);
  44361. }
  44362. }, null, value, arguments.length);
  44363. },
  44364. replaceWith: function replaceWith() {
  44365. var ignored = [];
  44366. // Make the changes, replacing each non-ignored context element with the new content
  44367. return domManip(this, arguments, function (elem) {
  44368. var parent = this.parentNode;
  44369. if (jQuery.inArray(this, ignored) < 0) {
  44370. jQuery.cleanData(getAll(this));
  44371. if (parent) {
  44372. parent.replaceChild(elem, this);
  44373. }
  44374. }
  44375. // Force callback invocation
  44376. }, ignored);
  44377. }
  44378. });
  44379. jQuery.each({
  44380. appendTo: "append",
  44381. prependTo: "prepend",
  44382. insertBefore: "before",
  44383. insertAfter: "after",
  44384. replaceAll: "replaceWith"
  44385. }, function (name, original) {
  44386. jQuery.fn[name] = function (selector) {
  44387. var elems,
  44388. ret = [],
  44389. insert = jQuery(selector),
  44390. last = insert.length - 1,
  44391. i = 0;
  44392. for (; i <= last; i++) {
  44393. elems = i === last ? this : this.clone(true);
  44394. jQuery(insert[i])[original](elems);
  44395. // Support: Android <=4.0 only, PhantomJS 1 only
  44396. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  44397. push.apply(ret, elems.get());
  44398. }
  44399. return this.pushStack(ret);
  44400. };
  44401. });
  44402. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  44403. var getStyles = function getStyles(elem) {
  44404. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  44405. // IE throws on elements created in popups
  44406. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  44407. var view = elem.ownerDocument.defaultView;
  44408. if (!view || !view.opener) {
  44409. view = window;
  44410. }
  44411. return view.getComputedStyle(elem);
  44412. };
  44413. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  44414. (function () {
  44415. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  44416. // so they're executed at the same time to save the second computation.
  44417. function computeStyleTests() {
  44418. // This is a singleton, we need to execute it only once
  44419. if (!div) {
  44420. return;
  44421. }
  44422. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  44423. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  44424. documentElement.appendChild(container).appendChild(div);
  44425. var divStyle = window.getComputedStyle(div);
  44426. pixelPositionVal = divStyle.top !== "1%";
  44427. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  44428. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  44429. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  44430. // Some styles come back with percentage values, even though they shouldn't
  44431. div.style.right = "60%";
  44432. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  44433. // Support: IE 9 - 11 only
  44434. // Detect misreporting of content dimensions for box-sizing:border-box elements
  44435. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  44436. // Support: IE 9 only
  44437. // Detect overflow:scroll screwiness (gh-3699)
  44438. div.style.position = "absolute";
  44439. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  44440. documentElement.removeChild(container);
  44441. // Nullify the div so it wouldn't be stored in the memory and
  44442. // it will also be a sign that checks already performed
  44443. div = null;
  44444. }
  44445. function roundPixelMeasures(measure) {
  44446. return Math.round(parseFloat(measure));
  44447. }
  44448. var pixelPositionVal,
  44449. boxSizingReliableVal,
  44450. scrollboxSizeVal,
  44451. pixelBoxStylesVal,
  44452. reliableMarginLeftVal,
  44453. container = document.createElement("div"),
  44454. div = document.createElement("div");
  44455. // Finish early in limited (non-browser) environments
  44456. if (!div.style) {
  44457. return;
  44458. }
  44459. // Support: IE <=9 - 11 only
  44460. // Style of cloned element affects source element cloned (#8908)
  44461. div.style.backgroundClip = "content-box";
  44462. div.cloneNode(true).style.backgroundClip = "";
  44463. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  44464. jQuery.extend(support, {
  44465. boxSizingReliable: function boxSizingReliable() {
  44466. computeStyleTests();
  44467. return boxSizingReliableVal;
  44468. },
  44469. pixelBoxStyles: function pixelBoxStyles() {
  44470. computeStyleTests();
  44471. return pixelBoxStylesVal;
  44472. },
  44473. pixelPosition: function pixelPosition() {
  44474. computeStyleTests();
  44475. return pixelPositionVal;
  44476. },
  44477. reliableMarginLeft: function reliableMarginLeft() {
  44478. computeStyleTests();
  44479. return reliableMarginLeftVal;
  44480. },
  44481. scrollboxSize: function scrollboxSize() {
  44482. computeStyleTests();
  44483. return scrollboxSizeVal;
  44484. }
  44485. });
  44486. })();
  44487. function curCSS(elem, name, computed) {
  44488. var width,
  44489. minWidth,
  44490. maxWidth,
  44491. ret,
  44492. // Support: Firefox 51+
  44493. // Retrieving style before computed somehow
  44494. // fixes an issue with getting wrong values
  44495. // on detached elements
  44496. style = elem.style;
  44497. computed = computed || getStyles(elem);
  44498. // getPropertyValue is needed for:
  44499. // .css('filter') (IE 9 only, #12537)
  44500. // .css('--customProperty) (#3144)
  44501. if (computed) {
  44502. ret = computed.getPropertyValue(name) || computed[name];
  44503. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  44504. ret = jQuery.style(elem, name);
  44505. }
  44506. // A tribute to the "awesome hack by Dean Edwards"
  44507. // Android Browser returns percentage for some values,
  44508. // but width seems to be reliably pixels.
  44509. // This is against the CSSOM draft spec:
  44510. // https://drafts.csswg.org/cssom/#resolved-values
  44511. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  44512. // Remember the original values
  44513. width = style.width;
  44514. minWidth = style.minWidth;
  44515. maxWidth = style.maxWidth;
  44516. // Put in the new values to get a computed value out
  44517. style.minWidth = style.maxWidth = style.width = ret;
  44518. ret = computed.width;
  44519. // Revert the changed values
  44520. style.width = width;
  44521. style.minWidth = minWidth;
  44522. style.maxWidth = maxWidth;
  44523. }
  44524. }
  44525. return ret !== undefined ?
  44526. // Support: IE <=9 - 11 only
  44527. // IE returns zIndex value as an integer.
  44528. ret + "" : ret;
  44529. }
  44530. function addGetHookIf(conditionFn, hookFn) {
  44531. // Define the hook, we'll check on the first run if it's really needed.
  44532. return {
  44533. get: function get() {
  44534. if (conditionFn()) {
  44535. // Hook not needed (or it's not possible to use it due
  44536. // to missing dependency), remove it.
  44537. delete this.get;
  44538. return;
  44539. }
  44540. // Hook needed; redefine it so that the support test is not executed again.
  44541. return (this.get = hookFn).apply(this, arguments);
  44542. }
  44543. };
  44544. }
  44545. var
  44546. // Swappable if display is none or starts with table
  44547. // except "table", "table-cell", or "table-caption"
  44548. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  44549. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  44550. rcustomProp = /^--/,
  44551. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  44552. cssNormalTransform = {
  44553. letterSpacing: "0",
  44554. fontWeight: "400"
  44555. },
  44556. cssPrefixes = ["Webkit", "Moz", "ms"],
  44557. emptyStyle = document.createElement("div").style;
  44558. // Return a css property mapped to a potentially vendor prefixed property
  44559. function vendorPropName(name) {
  44560. // Shortcut for names that are not vendor prefixed
  44561. if (name in emptyStyle) {
  44562. return name;
  44563. }
  44564. // Check for vendor prefixed names
  44565. var capName = name[0].toUpperCase() + name.slice(1),
  44566. i = cssPrefixes.length;
  44567. while (i--) {
  44568. name = cssPrefixes[i] + capName;
  44569. if (name in emptyStyle) {
  44570. return name;
  44571. }
  44572. }
  44573. }
  44574. // Return a property mapped along what jQuery.cssProps suggests or to
  44575. // a vendor prefixed property.
  44576. function finalPropName(name) {
  44577. var ret = jQuery.cssProps[name];
  44578. if (!ret) {
  44579. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  44580. }
  44581. return ret;
  44582. }
  44583. function setPositiveNumber(elem, value, subtract) {
  44584. // Any relative (+/-) values have already been
  44585. // normalized at this point
  44586. var matches = rcssNum.exec(value);
  44587. return matches ?
  44588. // Guard against undefined "subtract", e.g., when used as in cssHooks
  44589. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  44590. }
  44591. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  44592. var i = dimension === "width" ? 1 : 0,
  44593. extra = 0,
  44594. delta = 0;
  44595. // Adjustment may not be necessary
  44596. if (box === (isBorderBox ? "border" : "content")) {
  44597. return 0;
  44598. }
  44599. for (; i < 4; i += 2) {
  44600. // Both box models exclude margin
  44601. if (box === "margin") {
  44602. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  44603. }
  44604. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  44605. if (!isBorderBox) {
  44606. // Add padding
  44607. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  44608. // For "border" or "margin", add border
  44609. if (box !== "padding") {
  44610. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  44611. // But still keep track of it otherwise
  44612. } else {
  44613. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  44614. }
  44615. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  44616. // "padding" or "margin"
  44617. } else {
  44618. // For "content", subtract padding
  44619. if (box === "content") {
  44620. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  44621. }
  44622. // For "content" or "padding", subtract border
  44623. if (box !== "margin") {
  44624. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  44625. }
  44626. }
  44627. }
  44628. // Account for positive content-box scroll gutter when requested by providing computedVal
  44629. if (!isBorderBox && computedVal >= 0) {
  44630. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  44631. // Assuming integer scroll gutter, subtract the rest and round down
  44632. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  44633. }
  44634. return delta;
  44635. }
  44636. function getWidthOrHeight(elem, dimension, extra) {
  44637. // Start with computed style
  44638. var styles = getStyles(elem),
  44639. val = curCSS(elem, dimension, styles),
  44640. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  44641. valueIsBorderBox = isBorderBox;
  44642. // Support: Firefox <=54
  44643. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  44644. if (rnumnonpx.test(val)) {
  44645. if (!extra) {
  44646. return val;
  44647. }
  44648. val = "auto";
  44649. }
  44650. // Check for style in case a browser which returns unreliable values
  44651. // for getComputedStyle silently falls back to the reliable elem.style
  44652. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  44653. // Fall back to offsetWidth/offsetHeight when value is "auto"
  44654. // This happens for inline elements with no explicit setting (gh-3571)
  44655. // Support: Android <=4.1 - 4.3 only
  44656. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  44657. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  44658. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  44659. // offsetWidth/offsetHeight provide border-box values
  44660. valueIsBorderBox = true;
  44661. }
  44662. // Normalize "" and auto
  44663. val = parseFloat(val) || 0;
  44664. // Adjust for the element's box model
  44665. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  44666. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  44667. val) + "px";
  44668. }
  44669. jQuery.extend({
  44670. // Add in style property hooks for overriding the default
  44671. // behavior of getting and setting a style property
  44672. cssHooks: {
  44673. opacity: {
  44674. get: function get(elem, computed) {
  44675. if (computed) {
  44676. // We should always get a number back from opacity
  44677. var ret = curCSS(elem, "opacity");
  44678. return ret === "" ? "1" : ret;
  44679. }
  44680. }
  44681. }
  44682. },
  44683. // Don't automatically add "px" to these possibly-unitless properties
  44684. cssNumber: {
  44685. "animationIterationCount": true,
  44686. "columnCount": true,
  44687. "fillOpacity": true,
  44688. "flexGrow": true,
  44689. "flexShrink": true,
  44690. "fontWeight": true,
  44691. "lineHeight": true,
  44692. "opacity": true,
  44693. "order": true,
  44694. "orphans": true,
  44695. "widows": true,
  44696. "zIndex": true,
  44697. "zoom": true
  44698. },
  44699. // Add in properties whose names you wish to fix before
  44700. // setting or getting the value
  44701. cssProps: {},
  44702. // Get and set the style property on a DOM Node
  44703. style: function style(elem, name, value, extra) {
  44704. // Don't set styles on text and comment nodes
  44705. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  44706. return;
  44707. }
  44708. // Make sure that we're working with the right name
  44709. var ret,
  44710. type,
  44711. hooks,
  44712. origName = camelCase(name),
  44713. isCustomProp = rcustomProp.test(name),
  44714. style = elem.style;
  44715. // Make sure that we're working with the right name. We don't
  44716. // want to query the value if it is a CSS custom property
  44717. // since they are user-defined.
  44718. if (!isCustomProp) {
  44719. name = finalPropName(origName);
  44720. }
  44721. // Gets hook for the prefixed version, then unprefixed version
  44722. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  44723. // Check if we're setting a value
  44724. if (value !== undefined) {
  44725. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  44726. // Convert "+=" or "-=" to relative numbers (#7345)
  44727. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  44728. value = adjustCSS(elem, name, ret);
  44729. // Fixes bug #9237
  44730. type = "number";
  44731. }
  44732. // Make sure that null and NaN values aren't set (#7116)
  44733. if (value == null || value !== value) {
  44734. return;
  44735. }
  44736. // If a number was passed in, add the unit (except for certain CSS properties)
  44737. if (type === "number") {
  44738. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  44739. }
  44740. // background-* props affect original clone's values
  44741. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  44742. style[name] = "inherit";
  44743. }
  44744. // If a hook was provided, use that value, otherwise just set the specified value
  44745. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  44746. if (isCustomProp) {
  44747. style.setProperty(name, value);
  44748. } else {
  44749. style[name] = value;
  44750. }
  44751. }
  44752. } else {
  44753. // If a hook was provided get the non-computed value from there
  44754. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  44755. return ret;
  44756. }
  44757. // Otherwise just get the value from the style object
  44758. return style[name];
  44759. }
  44760. },
  44761. css: function css(elem, name, extra, styles) {
  44762. var val,
  44763. num,
  44764. hooks,
  44765. origName = camelCase(name),
  44766. isCustomProp = rcustomProp.test(name);
  44767. // Make sure that we're working with the right name. We don't
  44768. // want to modify the value if it is a CSS custom property
  44769. // since they are user-defined.
  44770. if (!isCustomProp) {
  44771. name = finalPropName(origName);
  44772. }
  44773. // Try prefixed name followed by the unprefixed name
  44774. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  44775. // If a hook was provided get the computed value from there
  44776. if (hooks && "get" in hooks) {
  44777. val = hooks.get(elem, true, extra);
  44778. }
  44779. // Otherwise, if a way to get the computed value exists, use that
  44780. if (val === undefined) {
  44781. val = curCSS(elem, name, styles);
  44782. }
  44783. // Convert "normal" to computed value
  44784. if (val === "normal" && name in cssNormalTransform) {
  44785. val = cssNormalTransform[name];
  44786. }
  44787. // Make numeric if forced or a qualifier was provided and val looks numeric
  44788. if (extra === "" || extra) {
  44789. num = parseFloat(val);
  44790. return extra === true || isFinite(num) ? num || 0 : val;
  44791. }
  44792. return val;
  44793. }
  44794. });
  44795. jQuery.each(["height", "width"], function (i, dimension) {
  44796. jQuery.cssHooks[dimension] = {
  44797. get: function get(elem, computed, extra) {
  44798. if (computed) {
  44799. // Certain elements can have dimension info if we invisibly show them
  44800. // but it must have a current display style that would benefit
  44801. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  44802. // Support: Safari 8+
  44803. // Table columns in Safari have non-zero offsetWidth & zero
  44804. // getBoundingClientRect().width unless display is changed.
  44805. // Support: IE <=11 only
  44806. // Running getBoundingClientRect on a disconnected node
  44807. // in IE throws an error.
  44808. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  44809. return getWidthOrHeight(elem, dimension, extra);
  44810. }) : getWidthOrHeight(elem, dimension, extra);
  44811. }
  44812. },
  44813. set: function set(elem, value, extra) {
  44814. var matches,
  44815. styles = getStyles(elem),
  44816. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  44817. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  44818. // Account for unreliable border-box dimensions by comparing offset* to computed and
  44819. // faking a content-box to get border and padding (gh-3699)
  44820. if (isBorderBox && support.scrollboxSize() === styles.position) {
  44821. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  44822. }
  44823. // Convert to pixels if value adjustment is needed
  44824. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  44825. elem.style[dimension] = value;
  44826. value = jQuery.css(elem, dimension);
  44827. }
  44828. return setPositiveNumber(elem, value, subtract);
  44829. }
  44830. };
  44831. });
  44832. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  44833. if (computed) {
  44834. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  44835. return elem.getBoundingClientRect().left;
  44836. })) + "px";
  44837. }
  44838. });
  44839. // These hooks are used by animate to expand properties
  44840. jQuery.each({
  44841. margin: "",
  44842. padding: "",
  44843. border: "Width"
  44844. }, function (prefix, suffix) {
  44845. jQuery.cssHooks[prefix + suffix] = {
  44846. expand: function expand(value) {
  44847. var i = 0,
  44848. expanded = {},
  44849. // Assumes a single number if not a string
  44850. parts = typeof value === "string" ? value.split(" ") : [value];
  44851. for (; i < 4; i++) {
  44852. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  44853. }
  44854. return expanded;
  44855. }
  44856. };
  44857. if (prefix !== "margin") {
  44858. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  44859. }
  44860. });
  44861. jQuery.fn.extend({
  44862. css: function css(name, value) {
  44863. return access(this, function (elem, name, value) {
  44864. var styles,
  44865. len,
  44866. map = {},
  44867. i = 0;
  44868. if (Array.isArray(name)) {
  44869. styles = getStyles(elem);
  44870. len = name.length;
  44871. for (; i < len; i++) {
  44872. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  44873. }
  44874. return map;
  44875. }
  44876. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  44877. }, name, value, arguments.length > 1);
  44878. }
  44879. });
  44880. function Tween(elem, options, prop, end, easing) {
  44881. return new Tween.prototype.init(elem, options, prop, end, easing);
  44882. }
  44883. jQuery.Tween = Tween;
  44884. Tween.prototype = {
  44885. constructor: Tween,
  44886. init: function init(elem, options, prop, end, easing, unit) {
  44887. this.elem = elem;
  44888. this.prop = prop;
  44889. this.easing = easing || jQuery.easing._default;
  44890. this.options = options;
  44891. this.start = this.now = this.cur();
  44892. this.end = end;
  44893. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  44894. },
  44895. cur: function cur() {
  44896. var hooks = Tween.propHooks[this.prop];
  44897. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  44898. },
  44899. run: function run(percent) {
  44900. var eased,
  44901. hooks = Tween.propHooks[this.prop];
  44902. if (this.options.duration) {
  44903. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  44904. } else {
  44905. this.pos = eased = percent;
  44906. }
  44907. this.now = (this.end - this.start) * eased + this.start;
  44908. if (this.options.step) {
  44909. this.options.step.call(this.elem, this.now, this);
  44910. }
  44911. if (hooks && hooks.set) {
  44912. hooks.set(this);
  44913. } else {
  44914. Tween.propHooks._default.set(this);
  44915. }
  44916. return this;
  44917. }
  44918. };
  44919. Tween.prototype.init.prototype = Tween.prototype;
  44920. Tween.propHooks = {
  44921. _default: {
  44922. get: function get(tween) {
  44923. var result;
  44924. // Use a property on the element directly when it is not a DOM element,
  44925. // or when there is no matching style property that exists.
  44926. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  44927. return tween.elem[tween.prop];
  44928. }
  44929. // Passing an empty string as a 3rd parameter to .css will automatically
  44930. // attempt a parseFloat and fallback to a string if the parse fails.
  44931. // Simple values such as "10px" are parsed to Float;
  44932. // complex values such as "rotate(1rad)" are returned as-is.
  44933. result = jQuery.css(tween.elem, tween.prop, "");
  44934. // Empty strings, null, undefined and "auto" are converted to 0.
  44935. return !result || result === "auto" ? 0 : result;
  44936. },
  44937. set: function set(tween) {
  44938. // Use step hook for back compat.
  44939. // Use cssHook if its there.
  44940. // Use .style if available and use plain properties where available.
  44941. if (jQuery.fx.step[tween.prop]) {
  44942. jQuery.fx.step[tween.prop](tween);
  44943. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  44944. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  44945. } else {
  44946. tween.elem[tween.prop] = tween.now;
  44947. }
  44948. }
  44949. }
  44950. };
  44951. // Support: IE <=9 only
  44952. // Panic based approach to setting things on disconnected nodes
  44953. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  44954. set: function set(tween) {
  44955. if (tween.elem.nodeType && tween.elem.parentNode) {
  44956. tween.elem[tween.prop] = tween.now;
  44957. }
  44958. }
  44959. };
  44960. jQuery.easing = {
  44961. linear: function linear(p) {
  44962. return p;
  44963. },
  44964. swing: function swing(p) {
  44965. return 0.5 - Math.cos(p * Math.PI) / 2;
  44966. },
  44967. _default: "swing"
  44968. };
  44969. jQuery.fx = Tween.prototype.init;
  44970. // Back compat <1.8 extension point
  44971. jQuery.fx.step = {};
  44972. var fxNow,
  44973. inProgress,
  44974. rfxtypes = /^(?:toggle|show|hide)$/,
  44975. rrun = /queueHooks$/;
  44976. function schedule() {
  44977. if (inProgress) {
  44978. if (document.hidden === false && window.requestAnimationFrame) {
  44979. window.requestAnimationFrame(schedule);
  44980. } else {
  44981. window.setTimeout(schedule, jQuery.fx.interval);
  44982. }
  44983. jQuery.fx.tick();
  44984. }
  44985. }
  44986. // Animations created synchronously will run synchronously
  44987. function createFxNow() {
  44988. window.setTimeout(function () {
  44989. fxNow = undefined;
  44990. });
  44991. return fxNow = Date.now();
  44992. }
  44993. // Generate parameters to create a standard animation
  44994. function genFx(type, includeWidth) {
  44995. var which,
  44996. i = 0,
  44997. attrs = { height: type };
  44998. // If we include width, step value is 1 to do all cssExpand values,
  44999. // otherwise step value is 2 to skip over Left and Right
  45000. includeWidth = includeWidth ? 1 : 0;
  45001. for (; i < 4; i += 2 - includeWidth) {
  45002. which = cssExpand[i];
  45003. attrs["margin" + which] = attrs["padding" + which] = type;
  45004. }
  45005. if (includeWidth) {
  45006. attrs.opacity = attrs.width = type;
  45007. }
  45008. return attrs;
  45009. }
  45010. function createTween(value, prop, animation) {
  45011. var tween,
  45012. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  45013. index = 0,
  45014. length = collection.length;
  45015. for (; index < length; index++) {
  45016. if (tween = collection[index].call(animation, prop, value)) {
  45017. // We're done with this property
  45018. return tween;
  45019. }
  45020. }
  45021. }
  45022. function defaultPrefilter(elem, props, opts) {
  45023. var prop,
  45024. value,
  45025. toggle,
  45026. hooks,
  45027. oldfire,
  45028. propTween,
  45029. restoreDisplay,
  45030. display,
  45031. isBox = "width" in props || "height" in props,
  45032. anim = this,
  45033. orig = {},
  45034. style = elem.style,
  45035. hidden = elem.nodeType && isHiddenWithinTree(elem),
  45036. dataShow = dataPriv.get(elem, "fxshow");
  45037. // Queue-skipping animations hijack the fx hooks
  45038. if (!opts.queue) {
  45039. hooks = jQuery._queueHooks(elem, "fx");
  45040. if (hooks.unqueued == null) {
  45041. hooks.unqueued = 0;
  45042. oldfire = hooks.empty.fire;
  45043. hooks.empty.fire = function () {
  45044. if (!hooks.unqueued) {
  45045. oldfire();
  45046. }
  45047. };
  45048. }
  45049. hooks.unqueued++;
  45050. anim.always(function () {
  45051. // Ensure the complete handler is called before this completes
  45052. anim.always(function () {
  45053. hooks.unqueued--;
  45054. if (!jQuery.queue(elem, "fx").length) {
  45055. hooks.empty.fire();
  45056. }
  45057. });
  45058. });
  45059. }
  45060. // Detect show/hide animations
  45061. for (prop in props) {
  45062. value = props[prop];
  45063. if (rfxtypes.test(value)) {
  45064. delete props[prop];
  45065. toggle = toggle || value === "toggle";
  45066. if (value === (hidden ? "hide" : "show")) {
  45067. // Pretend to be hidden if this is a "show" and
  45068. // there is still data from a stopped show/hide
  45069. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  45070. hidden = true;
  45071. // Ignore all other no-op show/hide data
  45072. } else {
  45073. continue;
  45074. }
  45075. }
  45076. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  45077. }
  45078. }
  45079. // Bail out if this is a no-op like .hide().hide()
  45080. propTween = !jQuery.isEmptyObject(props);
  45081. if (!propTween && jQuery.isEmptyObject(orig)) {
  45082. return;
  45083. }
  45084. // Restrict "overflow" and "display" styles during box animations
  45085. if (isBox && elem.nodeType === 1) {
  45086. // Support: IE <=9 - 11, Edge 12 - 15
  45087. // Record all 3 overflow attributes because IE does not infer the shorthand
  45088. // from identically-valued overflowX and overflowY and Edge just mirrors
  45089. // the overflowX value there.
  45090. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  45091. // Identify a display type, preferring old show/hide data over the CSS cascade
  45092. restoreDisplay = dataShow && dataShow.display;
  45093. if (restoreDisplay == null) {
  45094. restoreDisplay = dataPriv.get(elem, "display");
  45095. }
  45096. display = jQuery.css(elem, "display");
  45097. if (display === "none") {
  45098. if (restoreDisplay) {
  45099. display = restoreDisplay;
  45100. } else {
  45101. // Get nonempty value(s) by temporarily forcing visibility
  45102. showHide([elem], true);
  45103. restoreDisplay = elem.style.display || restoreDisplay;
  45104. display = jQuery.css(elem, "display");
  45105. showHide([elem]);
  45106. }
  45107. }
  45108. // Animate inline elements as inline-block
  45109. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  45110. if (jQuery.css(elem, "float") === "none") {
  45111. // Restore the original display value at the end of pure show/hide animations
  45112. if (!propTween) {
  45113. anim.done(function () {
  45114. style.display = restoreDisplay;
  45115. });
  45116. if (restoreDisplay == null) {
  45117. display = style.display;
  45118. restoreDisplay = display === "none" ? "" : display;
  45119. }
  45120. }
  45121. style.display = "inline-block";
  45122. }
  45123. }
  45124. }
  45125. if (opts.overflow) {
  45126. style.overflow = "hidden";
  45127. anim.always(function () {
  45128. style.overflow = opts.overflow[0];
  45129. style.overflowX = opts.overflow[1];
  45130. style.overflowY = opts.overflow[2];
  45131. });
  45132. }
  45133. // Implement show/hide animations
  45134. propTween = false;
  45135. for (prop in orig) {
  45136. // General show/hide setup for this element animation
  45137. if (!propTween) {
  45138. if (dataShow) {
  45139. if ("hidden" in dataShow) {
  45140. hidden = dataShow.hidden;
  45141. }
  45142. } else {
  45143. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  45144. }
  45145. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  45146. if (toggle) {
  45147. dataShow.hidden = !hidden;
  45148. }
  45149. // Show elements before animating them
  45150. if (hidden) {
  45151. showHide([elem], true);
  45152. }
  45153. /* eslint-disable no-loop-func */
  45154. anim.done(function () {
  45155. /* eslint-enable no-loop-func */
  45156. // The final step of a "hide" animation is actually hiding the element
  45157. if (!hidden) {
  45158. showHide([elem]);
  45159. }
  45160. dataPriv.remove(elem, "fxshow");
  45161. for (prop in orig) {
  45162. jQuery.style(elem, prop, orig[prop]);
  45163. }
  45164. });
  45165. }
  45166. // Per-property setup
  45167. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  45168. if (!(prop in dataShow)) {
  45169. dataShow[prop] = propTween.start;
  45170. if (hidden) {
  45171. propTween.end = propTween.start;
  45172. propTween.start = 0;
  45173. }
  45174. }
  45175. }
  45176. }
  45177. function propFilter(props, specialEasing) {
  45178. var index, name, easing, value, hooks;
  45179. // camelCase, specialEasing and expand cssHook pass
  45180. for (index in props) {
  45181. name = camelCase(index);
  45182. easing = specialEasing[name];
  45183. value = props[index];
  45184. if (Array.isArray(value)) {
  45185. easing = value[1];
  45186. value = props[index] = value[0];
  45187. }
  45188. if (index !== name) {
  45189. props[name] = value;
  45190. delete props[index];
  45191. }
  45192. hooks = jQuery.cssHooks[name];
  45193. if (hooks && "expand" in hooks) {
  45194. value = hooks.expand(value);
  45195. delete props[name];
  45196. // Not quite $.extend, this won't overwrite existing keys.
  45197. // Reusing 'index' because we have the correct "name"
  45198. for (index in value) {
  45199. if (!(index in props)) {
  45200. props[index] = value[index];
  45201. specialEasing[index] = easing;
  45202. }
  45203. }
  45204. } else {
  45205. specialEasing[name] = easing;
  45206. }
  45207. }
  45208. }
  45209. function Animation(elem, properties, options) {
  45210. var result,
  45211. stopped,
  45212. index = 0,
  45213. length = Animation.prefilters.length,
  45214. deferred = jQuery.Deferred().always(function () {
  45215. // Don't match elem in the :animated selector
  45216. delete tick.elem;
  45217. }),
  45218. tick = function tick() {
  45219. if (stopped) {
  45220. return false;
  45221. }
  45222. var currentTime = fxNow || createFxNow(),
  45223. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  45224. // Support: Android 2.3 only
  45225. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  45226. temp = remaining / animation.duration || 0,
  45227. percent = 1 - temp,
  45228. index = 0,
  45229. length = animation.tweens.length;
  45230. for (; index < length; index++) {
  45231. animation.tweens[index].run(percent);
  45232. }
  45233. deferred.notifyWith(elem, [animation, percent, remaining]);
  45234. // If there's more to do, yield
  45235. if (percent < 1 && length) {
  45236. return remaining;
  45237. }
  45238. // If this was an empty animation, synthesize a final progress notification
  45239. if (!length) {
  45240. deferred.notifyWith(elem, [animation, 1, 0]);
  45241. }
  45242. // Resolve the animation and report its conclusion
  45243. deferred.resolveWith(elem, [animation]);
  45244. return false;
  45245. },
  45246. animation = deferred.promise({
  45247. elem: elem,
  45248. props: jQuery.extend({}, properties),
  45249. opts: jQuery.extend(true, {
  45250. specialEasing: {},
  45251. easing: jQuery.easing._default
  45252. }, options),
  45253. originalProperties: properties,
  45254. originalOptions: options,
  45255. startTime: fxNow || createFxNow(),
  45256. duration: options.duration,
  45257. tweens: [],
  45258. createTween: function createTween(prop, end) {
  45259. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  45260. animation.tweens.push(tween);
  45261. return tween;
  45262. },
  45263. stop: function stop(gotoEnd) {
  45264. var index = 0,
  45265. // If we are going to the end, we want to run all the tweens
  45266. // otherwise we skip this part
  45267. length = gotoEnd ? animation.tweens.length : 0;
  45268. if (stopped) {
  45269. return this;
  45270. }
  45271. stopped = true;
  45272. for (; index < length; index++) {
  45273. animation.tweens[index].run(1);
  45274. }
  45275. // Resolve when we played the last frame; otherwise, reject
  45276. if (gotoEnd) {
  45277. deferred.notifyWith(elem, [animation, 1, 0]);
  45278. deferred.resolveWith(elem, [animation, gotoEnd]);
  45279. } else {
  45280. deferred.rejectWith(elem, [animation, gotoEnd]);
  45281. }
  45282. return this;
  45283. }
  45284. }),
  45285. props = animation.props;
  45286. propFilter(props, animation.opts.specialEasing);
  45287. for (; index < length; index++) {
  45288. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  45289. if (result) {
  45290. if (isFunction(result.stop)) {
  45291. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  45292. }
  45293. return result;
  45294. }
  45295. }
  45296. jQuery.map(props, createTween, animation);
  45297. if (isFunction(animation.opts.start)) {
  45298. animation.opts.start.call(elem, animation);
  45299. }
  45300. // Attach callbacks from options
  45301. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  45302. jQuery.fx.timer(jQuery.extend(tick, {
  45303. elem: elem,
  45304. anim: animation,
  45305. queue: animation.opts.queue
  45306. }));
  45307. return animation;
  45308. }
  45309. jQuery.Animation = jQuery.extend(Animation, {
  45310. tweeners: {
  45311. "*": [function (prop, value) {
  45312. var tween = this.createTween(prop, value);
  45313. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  45314. return tween;
  45315. }]
  45316. },
  45317. tweener: function tweener(props, callback) {
  45318. if (isFunction(props)) {
  45319. callback = props;
  45320. props = ["*"];
  45321. } else {
  45322. props = props.match(rnothtmlwhite);
  45323. }
  45324. var prop,
  45325. index = 0,
  45326. length = props.length;
  45327. for (; index < length; index++) {
  45328. prop = props[index];
  45329. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  45330. Animation.tweeners[prop].unshift(callback);
  45331. }
  45332. },
  45333. prefilters: [defaultPrefilter],
  45334. prefilter: function prefilter(callback, prepend) {
  45335. if (prepend) {
  45336. Animation.prefilters.unshift(callback);
  45337. } else {
  45338. Animation.prefilters.push(callback);
  45339. }
  45340. }
  45341. });
  45342. jQuery.speed = function (speed, easing, fn) {
  45343. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  45344. complete: fn || !fn && easing || isFunction(speed) && speed,
  45345. duration: speed,
  45346. easing: fn && easing || easing && !isFunction(easing) && easing
  45347. };
  45348. // Go to the end state if fx are off
  45349. if (jQuery.fx.off) {
  45350. opt.duration = 0;
  45351. } else {
  45352. if (typeof opt.duration !== "number") {
  45353. if (opt.duration in jQuery.fx.speeds) {
  45354. opt.duration = jQuery.fx.speeds[opt.duration];
  45355. } else {
  45356. opt.duration = jQuery.fx.speeds._default;
  45357. }
  45358. }
  45359. }
  45360. // Normalize opt.queue - true/undefined/null -> "fx"
  45361. if (opt.queue == null || opt.queue === true) {
  45362. opt.queue = "fx";
  45363. }
  45364. // Queueing
  45365. opt.old = opt.complete;
  45366. opt.complete = function () {
  45367. if (isFunction(opt.old)) {
  45368. opt.old.call(this);
  45369. }
  45370. if (opt.queue) {
  45371. jQuery.dequeue(this, opt.queue);
  45372. }
  45373. };
  45374. return opt;
  45375. };
  45376. jQuery.fn.extend({
  45377. fadeTo: function fadeTo(speed, to, easing, callback) {
  45378. // Show any hidden elements after setting opacity to 0
  45379. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  45380. // Animate to the value specified
  45381. .end().animate({ opacity: to }, speed, easing, callback);
  45382. },
  45383. animate: function animate(prop, speed, easing, callback) {
  45384. var empty = jQuery.isEmptyObject(prop),
  45385. optall = jQuery.speed(speed, easing, callback),
  45386. doAnimation = function doAnimation() {
  45387. // Operate on a copy of prop so per-property easing won't be lost
  45388. var anim = Animation(this, jQuery.extend({}, prop), optall);
  45389. // Empty animations, or finishing resolves immediately
  45390. if (empty || dataPriv.get(this, "finish")) {
  45391. anim.stop(true);
  45392. }
  45393. };
  45394. doAnimation.finish = doAnimation;
  45395. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  45396. },
  45397. stop: function stop(type, clearQueue, gotoEnd) {
  45398. var stopQueue = function stopQueue(hooks) {
  45399. var stop = hooks.stop;
  45400. delete hooks.stop;
  45401. stop(gotoEnd);
  45402. };
  45403. if (typeof type !== "string") {
  45404. gotoEnd = clearQueue;
  45405. clearQueue = type;
  45406. type = undefined;
  45407. }
  45408. if (clearQueue && type !== false) {
  45409. this.queue(type || "fx", []);
  45410. }
  45411. return this.each(function () {
  45412. var dequeue = true,
  45413. index = type != null && type + "queueHooks",
  45414. timers = jQuery.timers,
  45415. data = dataPriv.get(this);
  45416. if (index) {
  45417. if (data[index] && data[index].stop) {
  45418. stopQueue(data[index]);
  45419. }
  45420. } else {
  45421. for (index in data) {
  45422. if (data[index] && data[index].stop && rrun.test(index)) {
  45423. stopQueue(data[index]);
  45424. }
  45425. }
  45426. }
  45427. for (index = timers.length; index--;) {
  45428. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  45429. timers[index].anim.stop(gotoEnd);
  45430. dequeue = false;
  45431. timers.splice(index, 1);
  45432. }
  45433. }
  45434. // Start the next in the queue if the last step wasn't forced.
  45435. // Timers currently will call their complete callbacks, which
  45436. // will dequeue but only if they were gotoEnd.
  45437. if (dequeue || !gotoEnd) {
  45438. jQuery.dequeue(this, type);
  45439. }
  45440. });
  45441. },
  45442. finish: function finish(type) {
  45443. if (type !== false) {
  45444. type = type || "fx";
  45445. }
  45446. return this.each(function () {
  45447. var index,
  45448. data = dataPriv.get(this),
  45449. queue = data[type + "queue"],
  45450. hooks = data[type + "queueHooks"],
  45451. timers = jQuery.timers,
  45452. length = queue ? queue.length : 0;
  45453. // Enable finishing flag on private data
  45454. data.finish = true;
  45455. // Empty the queue first
  45456. jQuery.queue(this, type, []);
  45457. if (hooks && hooks.stop) {
  45458. hooks.stop.call(this, true);
  45459. }
  45460. // Look for any active animations, and finish them
  45461. for (index = timers.length; index--;) {
  45462. if (timers[index].elem === this && timers[index].queue === type) {
  45463. timers[index].anim.stop(true);
  45464. timers.splice(index, 1);
  45465. }
  45466. }
  45467. // Look for any animations in the old queue and finish them
  45468. for (index = 0; index < length; index++) {
  45469. if (queue[index] && queue[index].finish) {
  45470. queue[index].finish.call(this);
  45471. }
  45472. }
  45473. // Turn off finishing flag
  45474. delete data.finish;
  45475. });
  45476. }
  45477. });
  45478. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  45479. var cssFn = jQuery.fn[name];
  45480. jQuery.fn[name] = function (speed, easing, callback) {
  45481. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  45482. };
  45483. });
  45484. // Generate shortcuts for custom animations
  45485. jQuery.each({
  45486. slideDown: genFx("show"),
  45487. slideUp: genFx("hide"),
  45488. slideToggle: genFx("toggle"),
  45489. fadeIn: { opacity: "show" },
  45490. fadeOut: { opacity: "hide" },
  45491. fadeToggle: { opacity: "toggle" }
  45492. }, function (name, props) {
  45493. jQuery.fn[name] = function (speed, easing, callback) {
  45494. return this.animate(props, speed, easing, callback);
  45495. };
  45496. });
  45497. jQuery.timers = [];
  45498. jQuery.fx.tick = function () {
  45499. var timer,
  45500. i = 0,
  45501. timers = jQuery.timers;
  45502. fxNow = Date.now();
  45503. for (; i < timers.length; i++) {
  45504. timer = timers[i];
  45505. // Run the timer and safely remove it when done (allowing for external removal)
  45506. if (!timer() && timers[i] === timer) {
  45507. timers.splice(i--, 1);
  45508. }
  45509. }
  45510. if (!timers.length) {
  45511. jQuery.fx.stop();
  45512. }
  45513. fxNow = undefined;
  45514. };
  45515. jQuery.fx.timer = function (timer) {
  45516. jQuery.timers.push(timer);
  45517. jQuery.fx.start();
  45518. };
  45519. jQuery.fx.interval = 13;
  45520. jQuery.fx.start = function () {
  45521. if (inProgress) {
  45522. return;
  45523. }
  45524. inProgress = true;
  45525. schedule();
  45526. };
  45527. jQuery.fx.stop = function () {
  45528. inProgress = null;
  45529. };
  45530. jQuery.fx.speeds = {
  45531. slow: 600,
  45532. fast: 200,
  45533. // Default speed
  45534. _default: 400
  45535. };
  45536. // Based off of the plugin by Clint Helfers, with permission.
  45537. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  45538. jQuery.fn.delay = function (time, type) {
  45539. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  45540. type = type || "fx";
  45541. return this.queue(type, function (next, hooks) {
  45542. var timeout = window.setTimeout(next, time);
  45543. hooks.stop = function () {
  45544. window.clearTimeout(timeout);
  45545. };
  45546. });
  45547. };
  45548. (function () {
  45549. var input = document.createElement("input"),
  45550. select = document.createElement("select"),
  45551. opt = select.appendChild(document.createElement("option"));
  45552. input.type = "checkbox";
  45553. // Support: Android <=4.3 only
  45554. // Default value for a checkbox should be "on"
  45555. support.checkOn = input.value !== "";
  45556. // Support: IE <=11 only
  45557. // Must access selectedIndex to make default options select
  45558. support.optSelected = opt.selected;
  45559. // Support: IE <=11 only
  45560. // An input loses its value after becoming a radio
  45561. input = document.createElement("input");
  45562. input.value = "t";
  45563. input.type = "radio";
  45564. support.radioValue = input.value === "t";
  45565. })();
  45566. var boolHook,
  45567. attrHandle = jQuery.expr.attrHandle;
  45568. jQuery.fn.extend({
  45569. attr: function attr(name, value) {
  45570. return access(this, jQuery.attr, name, value, arguments.length > 1);
  45571. },
  45572. removeAttr: function removeAttr(name) {
  45573. return this.each(function () {
  45574. jQuery.removeAttr(this, name);
  45575. });
  45576. }
  45577. });
  45578. jQuery.extend({
  45579. attr: function attr(elem, name, value) {
  45580. var ret,
  45581. hooks,
  45582. nType = elem.nodeType;
  45583. // Don't get/set attributes on text, comment and attribute nodes
  45584. if (nType === 3 || nType === 8 || nType === 2) {
  45585. return;
  45586. }
  45587. // Fallback to prop when attributes are not supported
  45588. if (typeof elem.getAttribute === "undefined") {
  45589. return jQuery.prop(elem, name, value);
  45590. }
  45591. // Attribute hooks are determined by the lowercase version
  45592. // Grab necessary hook if one is defined
  45593. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  45594. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  45595. }
  45596. if (value !== undefined) {
  45597. if (value === null) {
  45598. jQuery.removeAttr(elem, name);
  45599. return;
  45600. }
  45601. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  45602. return ret;
  45603. }
  45604. elem.setAttribute(name, value + "");
  45605. return value;
  45606. }
  45607. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  45608. return ret;
  45609. }
  45610. ret = jQuery.find.attr(elem, name);
  45611. // Non-existent attributes return null, we normalize to undefined
  45612. return ret == null ? undefined : ret;
  45613. },
  45614. attrHooks: {
  45615. type: {
  45616. set: function set(elem, value) {
  45617. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  45618. var val = elem.value;
  45619. elem.setAttribute("type", value);
  45620. if (val) {
  45621. elem.value = val;
  45622. }
  45623. return value;
  45624. }
  45625. }
  45626. }
  45627. },
  45628. removeAttr: function removeAttr(elem, value) {
  45629. var name,
  45630. i = 0,
  45631. // Attribute names can contain non-HTML whitespace characters
  45632. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  45633. attrNames = value && value.match(rnothtmlwhite);
  45634. if (attrNames && elem.nodeType === 1) {
  45635. while (name = attrNames[i++]) {
  45636. elem.removeAttribute(name);
  45637. }
  45638. }
  45639. }
  45640. });
  45641. // Hooks for boolean attributes
  45642. boolHook = {
  45643. set: function set(elem, value, name) {
  45644. if (value === false) {
  45645. // Remove boolean attributes when set to false
  45646. jQuery.removeAttr(elem, name);
  45647. } else {
  45648. elem.setAttribute(name, name);
  45649. }
  45650. return name;
  45651. }
  45652. };
  45653. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  45654. var getter = attrHandle[name] || jQuery.find.attr;
  45655. attrHandle[name] = function (elem, name, isXML) {
  45656. var ret,
  45657. handle,
  45658. lowercaseName = name.toLowerCase();
  45659. if (!isXML) {
  45660. // Avoid an infinite loop by temporarily removing this function from the getter
  45661. handle = attrHandle[lowercaseName];
  45662. attrHandle[lowercaseName] = ret;
  45663. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  45664. attrHandle[lowercaseName] = handle;
  45665. }
  45666. return ret;
  45667. };
  45668. });
  45669. var rfocusable = /^(?:input|select|textarea|button)$/i,
  45670. rclickable = /^(?:a|area)$/i;
  45671. jQuery.fn.extend({
  45672. prop: function prop(name, value) {
  45673. return access(this, jQuery.prop, name, value, arguments.length > 1);
  45674. },
  45675. removeProp: function removeProp(name) {
  45676. return this.each(function () {
  45677. delete this[jQuery.propFix[name] || name];
  45678. });
  45679. }
  45680. });
  45681. jQuery.extend({
  45682. prop: function prop(elem, name, value) {
  45683. var ret,
  45684. hooks,
  45685. nType = elem.nodeType;
  45686. // Don't get/set properties on text, comment and attribute nodes
  45687. if (nType === 3 || nType === 8 || nType === 2) {
  45688. return;
  45689. }
  45690. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  45691. // Fix name and attach hooks
  45692. name = jQuery.propFix[name] || name;
  45693. hooks = jQuery.propHooks[name];
  45694. }
  45695. if (value !== undefined) {
  45696. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  45697. return ret;
  45698. }
  45699. return elem[name] = value;
  45700. }
  45701. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  45702. return ret;
  45703. }
  45704. return elem[name];
  45705. },
  45706. propHooks: {
  45707. tabIndex: {
  45708. get: function get(elem) {
  45709. // Support: IE <=9 - 11 only
  45710. // elem.tabIndex doesn't always return the
  45711. // correct value when it hasn't been explicitly set
  45712. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  45713. // Use proper attribute retrieval(#12072)
  45714. var tabindex = jQuery.find.attr(elem, "tabindex");
  45715. if (tabindex) {
  45716. return parseInt(tabindex, 10);
  45717. }
  45718. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  45719. return 0;
  45720. }
  45721. return -1;
  45722. }
  45723. }
  45724. },
  45725. propFix: {
  45726. "for": "htmlFor",
  45727. "class": "className"
  45728. }
  45729. });
  45730. // Support: IE <=11 only
  45731. // Accessing the selectedIndex property
  45732. // forces the browser to respect setting selected
  45733. // on the option
  45734. // The getter ensures a default option is selected
  45735. // when in an optgroup
  45736. // eslint rule "no-unused-expressions" is disabled for this code
  45737. // since it considers such accessions noop
  45738. if (!support.optSelected) {
  45739. jQuery.propHooks.selected = {
  45740. get: function get(elem) {
  45741. /* eslint no-unused-expressions: "off" */
  45742. var parent = elem.parentNode;
  45743. if (parent && parent.parentNode) {
  45744. parent.parentNode.selectedIndex;
  45745. }
  45746. return null;
  45747. },
  45748. set: function set(elem) {
  45749. /* eslint no-unused-expressions: "off" */
  45750. var parent = elem.parentNode;
  45751. if (parent) {
  45752. parent.selectedIndex;
  45753. if (parent.parentNode) {
  45754. parent.parentNode.selectedIndex;
  45755. }
  45756. }
  45757. }
  45758. };
  45759. }
  45760. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  45761. jQuery.propFix[this.toLowerCase()] = this;
  45762. });
  45763. // Strip and collapse whitespace according to HTML spec
  45764. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  45765. function stripAndCollapse(value) {
  45766. var tokens = value.match(rnothtmlwhite) || [];
  45767. return tokens.join(" ");
  45768. }
  45769. function getClass(elem) {
  45770. return elem.getAttribute && elem.getAttribute("class") || "";
  45771. }
  45772. function classesToArray(value) {
  45773. if (Array.isArray(value)) {
  45774. return value;
  45775. }
  45776. if (typeof value === "string") {
  45777. return value.match(rnothtmlwhite) || [];
  45778. }
  45779. return [];
  45780. }
  45781. jQuery.fn.extend({
  45782. addClass: function addClass(value) {
  45783. var classes,
  45784. elem,
  45785. cur,
  45786. curValue,
  45787. clazz,
  45788. j,
  45789. finalValue,
  45790. i = 0;
  45791. if (isFunction(value)) {
  45792. return this.each(function (j) {
  45793. jQuery(this).addClass(value.call(this, j, getClass(this)));
  45794. });
  45795. }
  45796. classes = classesToArray(value);
  45797. if (classes.length) {
  45798. while (elem = this[i++]) {
  45799. curValue = getClass(elem);
  45800. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  45801. if (cur) {
  45802. j = 0;
  45803. while (clazz = classes[j++]) {
  45804. if (cur.indexOf(" " + clazz + " ") < 0) {
  45805. cur += clazz + " ";
  45806. }
  45807. }
  45808. // Only assign if different to avoid unneeded rendering.
  45809. finalValue = stripAndCollapse(cur);
  45810. if (curValue !== finalValue) {
  45811. elem.setAttribute("class", finalValue);
  45812. }
  45813. }
  45814. }
  45815. }
  45816. return this;
  45817. },
  45818. removeClass: function removeClass(value) {
  45819. var classes,
  45820. elem,
  45821. cur,
  45822. curValue,
  45823. clazz,
  45824. j,
  45825. finalValue,
  45826. i = 0;
  45827. if (isFunction(value)) {
  45828. return this.each(function (j) {
  45829. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  45830. });
  45831. }
  45832. if (!arguments.length) {
  45833. return this.attr("class", "");
  45834. }
  45835. classes = classesToArray(value);
  45836. if (classes.length) {
  45837. while (elem = this[i++]) {
  45838. curValue = getClass(elem);
  45839. // This expression is here for better compressibility (see addClass)
  45840. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  45841. if (cur) {
  45842. j = 0;
  45843. while (clazz = classes[j++]) {
  45844. // Remove *all* instances
  45845. while (cur.indexOf(" " + clazz + " ") > -1) {
  45846. cur = cur.replace(" " + clazz + " ", " ");
  45847. }
  45848. }
  45849. // Only assign if different to avoid unneeded rendering.
  45850. finalValue = stripAndCollapse(cur);
  45851. if (curValue !== finalValue) {
  45852. elem.setAttribute("class", finalValue);
  45853. }
  45854. }
  45855. }
  45856. }
  45857. return this;
  45858. },
  45859. toggleClass: function toggleClass(value, stateVal) {
  45860. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  45861. isValidValue = type === "string" || Array.isArray(value);
  45862. if (typeof stateVal === "boolean" && isValidValue) {
  45863. return stateVal ? this.addClass(value) : this.removeClass(value);
  45864. }
  45865. if (isFunction(value)) {
  45866. return this.each(function (i) {
  45867. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  45868. });
  45869. }
  45870. return this.each(function () {
  45871. var className, i, self, classNames;
  45872. if (isValidValue) {
  45873. // Toggle individual class names
  45874. i = 0;
  45875. self = jQuery(this);
  45876. classNames = classesToArray(value);
  45877. while (className = classNames[i++]) {
  45878. // Check each className given, space separated list
  45879. if (self.hasClass(className)) {
  45880. self.removeClass(className);
  45881. } else {
  45882. self.addClass(className);
  45883. }
  45884. }
  45885. // Toggle whole class name
  45886. } else if (value === undefined || type === "boolean") {
  45887. className = getClass(this);
  45888. if (className) {
  45889. // Store className if set
  45890. dataPriv.set(this, "__className__", className);
  45891. }
  45892. // If the element has a class name or if we're passed `false`,
  45893. // then remove the whole classname (if there was one, the above saved it).
  45894. // Otherwise bring back whatever was previously saved (if anything),
  45895. // falling back to the empty string if nothing was stored.
  45896. if (this.setAttribute) {
  45897. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  45898. }
  45899. }
  45900. });
  45901. },
  45902. hasClass: function hasClass(selector) {
  45903. var className,
  45904. elem,
  45905. i = 0;
  45906. className = " " + selector + " ";
  45907. while (elem = this[i++]) {
  45908. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  45909. return true;
  45910. }
  45911. }
  45912. return false;
  45913. }
  45914. });
  45915. var rreturn = /\r/g;
  45916. jQuery.fn.extend({
  45917. val: function val(value) {
  45918. var hooks,
  45919. ret,
  45920. valueIsFunction,
  45921. elem = this[0];
  45922. if (!arguments.length) {
  45923. if (elem) {
  45924. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  45925. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  45926. return ret;
  45927. }
  45928. ret = elem.value;
  45929. // Handle most common string cases
  45930. if (typeof ret === "string") {
  45931. return ret.replace(rreturn, "");
  45932. }
  45933. // Handle cases where value is null/undef or number
  45934. return ret == null ? "" : ret;
  45935. }
  45936. return;
  45937. }
  45938. valueIsFunction = isFunction(value);
  45939. return this.each(function (i) {
  45940. var val;
  45941. if (this.nodeType !== 1) {
  45942. return;
  45943. }
  45944. if (valueIsFunction) {
  45945. val = value.call(this, i, jQuery(this).val());
  45946. } else {
  45947. val = value;
  45948. }
  45949. // Treat null/undefined as ""; convert numbers to string
  45950. if (val == null) {
  45951. val = "";
  45952. } else if (typeof val === "number") {
  45953. val += "";
  45954. } else if (Array.isArray(val)) {
  45955. val = jQuery.map(val, function (value) {
  45956. return value == null ? "" : value + "";
  45957. });
  45958. }
  45959. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  45960. // If set returns undefined, fall back to normal setting
  45961. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  45962. this.value = val;
  45963. }
  45964. });
  45965. }
  45966. });
  45967. jQuery.extend({
  45968. valHooks: {
  45969. option: {
  45970. get: function get(elem) {
  45971. var val = jQuery.find.attr(elem, "value");
  45972. return val != null ? val :
  45973. // Support: IE <=10 - 11 only
  45974. // option.text throws exceptions (#14686, #14858)
  45975. // Strip and collapse whitespace
  45976. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  45977. stripAndCollapse(jQuery.text(elem));
  45978. }
  45979. },
  45980. select: {
  45981. get: function get(elem) {
  45982. var value,
  45983. option,
  45984. i,
  45985. options = elem.options,
  45986. index = elem.selectedIndex,
  45987. one = elem.type === "select-one",
  45988. values = one ? null : [],
  45989. max = one ? index + 1 : options.length;
  45990. if (index < 0) {
  45991. i = max;
  45992. } else {
  45993. i = one ? index : 0;
  45994. }
  45995. // Loop through all the selected options
  45996. for (; i < max; i++) {
  45997. option = options[i];
  45998. // Support: IE <=9 only
  45999. // IE8-9 doesn't update selected after form reset (#2551)
  46000. if ((option.selected || i === index) &&
  46001. // Don't return options that are disabled or in a disabled optgroup
  46002. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  46003. // Get the specific value for the option
  46004. value = jQuery(option).val();
  46005. // We don't need an array for one selects
  46006. if (one) {
  46007. return value;
  46008. }
  46009. // Multi-Selects return an array
  46010. values.push(value);
  46011. }
  46012. }
  46013. return values;
  46014. },
  46015. set: function set(elem, value) {
  46016. var optionSet,
  46017. option,
  46018. options = elem.options,
  46019. values = jQuery.makeArray(value),
  46020. i = options.length;
  46021. while (i--) {
  46022. option = options[i];
  46023. /* eslint-disable no-cond-assign */
  46024. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  46025. optionSet = true;
  46026. }
  46027. /* eslint-enable no-cond-assign */
  46028. }
  46029. // Force browsers to behave consistently when non-matching value is set
  46030. if (!optionSet) {
  46031. elem.selectedIndex = -1;
  46032. }
  46033. return values;
  46034. }
  46035. }
  46036. }
  46037. });
  46038. // Radios and checkboxes getter/setter
  46039. jQuery.each(["radio", "checkbox"], function () {
  46040. jQuery.valHooks[this] = {
  46041. set: function set(elem, value) {
  46042. if (Array.isArray(value)) {
  46043. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  46044. }
  46045. }
  46046. };
  46047. if (!support.checkOn) {
  46048. jQuery.valHooks[this].get = function (elem) {
  46049. return elem.getAttribute("value") === null ? "on" : elem.value;
  46050. };
  46051. }
  46052. });
  46053. // Return jQuery for attributes-only inclusion
  46054. support.focusin = "onfocusin" in window;
  46055. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  46056. stopPropagationCallback = function stopPropagationCallback(e) {
  46057. e.stopPropagation();
  46058. };
  46059. jQuery.extend(jQuery.event, {
  46060. trigger: function trigger(event, data, elem, onlyHandlers) {
  46061. var i,
  46062. cur,
  46063. tmp,
  46064. bubbleType,
  46065. ontype,
  46066. handle,
  46067. special,
  46068. lastElement,
  46069. eventPath = [elem || document],
  46070. type = hasOwn.call(event, "type") ? event.type : event,
  46071. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  46072. cur = lastElement = tmp = elem = elem || document;
  46073. // Don't do events on text and comment nodes
  46074. if (elem.nodeType === 3 || elem.nodeType === 8) {
  46075. return;
  46076. }
  46077. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  46078. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  46079. return;
  46080. }
  46081. if (type.indexOf(".") > -1) {
  46082. // Namespaced trigger; create a regexp to match event type in handle()
  46083. namespaces = type.split(".");
  46084. type = namespaces.shift();
  46085. namespaces.sort();
  46086. }
  46087. ontype = type.indexOf(":") < 0 && "on" + type;
  46088. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  46089. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  46090. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  46091. event.isTrigger = onlyHandlers ? 2 : 3;
  46092. event.namespace = namespaces.join(".");
  46093. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  46094. // Clean up the event in case it is being reused
  46095. event.result = undefined;
  46096. if (!event.target) {
  46097. event.target = elem;
  46098. }
  46099. // Clone any incoming data and prepend the event, creating the handler arg list
  46100. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  46101. // Allow special events to draw outside the lines
  46102. special = jQuery.event.special[type] || {};
  46103. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  46104. return;
  46105. }
  46106. // Determine event propagation path in advance, per W3C events spec (#9951)
  46107. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  46108. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  46109. bubbleType = special.delegateType || type;
  46110. if (!rfocusMorph.test(bubbleType + type)) {
  46111. cur = cur.parentNode;
  46112. }
  46113. for (; cur; cur = cur.parentNode) {
  46114. eventPath.push(cur);
  46115. tmp = cur;
  46116. }
  46117. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  46118. if (tmp === (elem.ownerDocument || document)) {
  46119. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  46120. }
  46121. }
  46122. // Fire handlers on the event path
  46123. i = 0;
  46124. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  46125. lastElement = cur;
  46126. event.type = i > 1 ? bubbleType : special.bindType || type;
  46127. // jQuery handler
  46128. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  46129. if (handle) {
  46130. handle.apply(cur, data);
  46131. }
  46132. // Native handler
  46133. handle = ontype && cur[ontype];
  46134. if (handle && handle.apply && acceptData(cur)) {
  46135. event.result = handle.apply(cur, data);
  46136. if (event.result === false) {
  46137. event.preventDefault();
  46138. }
  46139. }
  46140. }
  46141. event.type = type;
  46142. // If nobody prevented the default action, do it now
  46143. if (!onlyHandlers && !event.isDefaultPrevented()) {
  46144. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  46145. // Call a native DOM method on the target with the same name as the event.
  46146. // Don't do default actions on window, that's where global variables be (#6170)
  46147. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  46148. // Don't re-trigger an onFOO event when we call its FOO() method
  46149. tmp = elem[ontype];
  46150. if (tmp) {
  46151. elem[ontype] = null;
  46152. }
  46153. // Prevent re-triggering of the same event, since we already bubbled it above
  46154. jQuery.event.triggered = type;
  46155. if (event.isPropagationStopped()) {
  46156. lastElement.addEventListener(type, stopPropagationCallback);
  46157. }
  46158. elem[type]();
  46159. if (event.isPropagationStopped()) {
  46160. lastElement.removeEventListener(type, stopPropagationCallback);
  46161. }
  46162. jQuery.event.triggered = undefined;
  46163. if (tmp) {
  46164. elem[ontype] = tmp;
  46165. }
  46166. }
  46167. }
  46168. }
  46169. return event.result;
  46170. },
  46171. // Piggyback on a donor event to simulate a different one
  46172. // Used only for `focus(in | out)` events
  46173. simulate: function simulate(type, elem, event) {
  46174. var e = jQuery.extend(new jQuery.Event(), event, {
  46175. type: type,
  46176. isSimulated: true
  46177. });
  46178. jQuery.event.trigger(e, null, elem);
  46179. }
  46180. });
  46181. jQuery.fn.extend({
  46182. trigger: function trigger(type, data) {
  46183. return this.each(function () {
  46184. jQuery.event.trigger(type, data, this);
  46185. });
  46186. },
  46187. triggerHandler: function triggerHandler(type, data) {
  46188. var elem = this[0];
  46189. if (elem) {
  46190. return jQuery.event.trigger(type, data, elem, true);
  46191. }
  46192. }
  46193. });
  46194. // Support: Firefox <=44
  46195. // Firefox doesn't have focus(in | out) events
  46196. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  46197. //
  46198. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  46199. // focus(in | out) events fire after focus & blur events,
  46200. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  46201. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  46202. if (!support.focusin) {
  46203. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  46204. // Attach a single capturing handler on the document while someone wants focusin/focusout
  46205. var handler = function handler(event) {
  46206. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  46207. };
  46208. jQuery.event.special[fix] = {
  46209. setup: function setup() {
  46210. var doc = this.ownerDocument || this,
  46211. attaches = dataPriv.access(doc, fix);
  46212. if (!attaches) {
  46213. doc.addEventListener(orig, handler, true);
  46214. }
  46215. dataPriv.access(doc, fix, (attaches || 0) + 1);
  46216. },
  46217. teardown: function teardown() {
  46218. var doc = this.ownerDocument || this,
  46219. attaches = dataPriv.access(doc, fix) - 1;
  46220. if (!attaches) {
  46221. doc.removeEventListener(orig, handler, true);
  46222. dataPriv.remove(doc, fix);
  46223. } else {
  46224. dataPriv.access(doc, fix, attaches);
  46225. }
  46226. }
  46227. };
  46228. });
  46229. }
  46230. var location = window.location;
  46231. var nonce = Date.now();
  46232. var rquery = /\?/;
  46233. // Cross-browser xml parsing
  46234. jQuery.parseXML = function (data) {
  46235. var xml;
  46236. if (!data || typeof data !== "string") {
  46237. return null;
  46238. }
  46239. // Support: IE 9 - 11 only
  46240. // IE throws on parseFromString with invalid input.
  46241. try {
  46242. xml = new window.DOMParser().parseFromString(data, "text/xml");
  46243. } catch (e) {
  46244. xml = undefined;
  46245. }
  46246. if (!xml || xml.getElementsByTagName("parsererror").length) {
  46247. jQuery.error("Invalid XML: " + data);
  46248. }
  46249. return xml;
  46250. };
  46251. var rbracket = /\[\]$/,
  46252. rCRLF = /\r?\n/g,
  46253. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  46254. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  46255. function buildParams(prefix, obj, traditional, add) {
  46256. var name;
  46257. if (Array.isArray(obj)) {
  46258. // Serialize array item.
  46259. jQuery.each(obj, function (i, v) {
  46260. if (traditional || rbracket.test(prefix)) {
  46261. // Treat each array item as a scalar.
  46262. add(prefix, v);
  46263. } else {
  46264. // Item is non-scalar (array or object), encode its numeric index.
  46265. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  46266. }
  46267. });
  46268. } else if (!traditional && toType(obj) === "object") {
  46269. // Serialize object item.
  46270. for (name in obj) {
  46271. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  46272. }
  46273. } else {
  46274. // Serialize scalar item.
  46275. add(prefix, obj);
  46276. }
  46277. }
  46278. // Serialize an array of form elements or a set of
  46279. // key/values into a query string
  46280. jQuery.param = function (a, traditional) {
  46281. var prefix,
  46282. s = [],
  46283. add = function add(key, valueOrFunction) {
  46284. // If value is a function, invoke it and use its return value
  46285. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  46286. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  46287. };
  46288. // If an array was passed in, assume that it is an array of form elements.
  46289. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  46290. // Serialize the form elements
  46291. jQuery.each(a, function () {
  46292. add(this.name, this.value);
  46293. });
  46294. } else {
  46295. // If traditional, encode the "old" way (the way 1.3.2 or older
  46296. // did it), otherwise encode params recursively.
  46297. for (prefix in a) {
  46298. buildParams(prefix, a[prefix], traditional, add);
  46299. }
  46300. }
  46301. // Return the resulting serialization
  46302. return s.join("&");
  46303. };
  46304. jQuery.fn.extend({
  46305. serialize: function serialize() {
  46306. return jQuery.param(this.serializeArray());
  46307. },
  46308. serializeArray: function serializeArray() {
  46309. return this.map(function () {
  46310. // Can add propHook for "elements" to filter or add form elements
  46311. var elements = jQuery.prop(this, "elements");
  46312. return elements ? jQuery.makeArray(elements) : this;
  46313. }).filter(function () {
  46314. var type = this.type;
  46315. // Use .is( ":disabled" ) so that fieldset[disabled] works
  46316. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  46317. }).map(function (i, elem) {
  46318. var val = jQuery(this).val();
  46319. if (val == null) {
  46320. return null;
  46321. }
  46322. if (Array.isArray(val)) {
  46323. return jQuery.map(val, function (val) {
  46324. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  46325. });
  46326. }
  46327. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  46328. }).get();
  46329. }
  46330. });
  46331. var r20 = /%20/g,
  46332. rhash = /#.*$/,
  46333. rantiCache = /([?&])_=[^&]*/,
  46334. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  46335. // #7653, #8125, #8152: local protocol detection
  46336. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  46337. rnoContent = /^(?:GET|HEAD)$/,
  46338. rprotocol = /^\/\//,
  46339. /* Prefilters
  46340. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  46341. * 2) These are called:
  46342. * - BEFORE asking for a transport
  46343. * - AFTER param serialization (s.data is a string if s.processData is true)
  46344. * 3) key is the dataType
  46345. * 4) the catchall symbol "*" can be used
  46346. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  46347. */
  46348. prefilters = {},
  46349. /* Transports bindings
  46350. * 1) key is the dataType
  46351. * 2) the catchall symbol "*" can be used
  46352. * 3) selection will start with transport dataType and THEN go to "*" if needed
  46353. */
  46354. transports = {},
  46355. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  46356. allTypes = "*/".concat("*"),
  46357. // Anchor tag for parsing the document origin
  46358. originAnchor = document.createElement("a");
  46359. originAnchor.href = location.href;
  46360. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  46361. function addToPrefiltersOrTransports(structure) {
  46362. // dataTypeExpression is optional and defaults to "*"
  46363. return function (dataTypeExpression, func) {
  46364. if (typeof dataTypeExpression !== "string") {
  46365. func = dataTypeExpression;
  46366. dataTypeExpression = "*";
  46367. }
  46368. var dataType,
  46369. i = 0,
  46370. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  46371. if (isFunction(func)) {
  46372. // For each dataType in the dataTypeExpression
  46373. while (dataType = dataTypes[i++]) {
  46374. // Prepend if requested
  46375. if (dataType[0] === "+") {
  46376. dataType = dataType.slice(1) || "*";
  46377. (structure[dataType] = structure[dataType] || []).unshift(func);
  46378. // Otherwise append
  46379. } else {
  46380. (structure[dataType] = structure[dataType] || []).push(func);
  46381. }
  46382. }
  46383. }
  46384. };
  46385. }
  46386. // Base inspection function for prefilters and transports
  46387. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  46388. var inspected = {},
  46389. seekingTransport = structure === transports;
  46390. function inspect(dataType) {
  46391. var selected;
  46392. inspected[dataType] = true;
  46393. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  46394. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  46395. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  46396. options.dataTypes.unshift(dataTypeOrTransport);
  46397. inspect(dataTypeOrTransport);
  46398. return false;
  46399. } else if (seekingTransport) {
  46400. return !(selected = dataTypeOrTransport);
  46401. }
  46402. });
  46403. return selected;
  46404. }
  46405. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  46406. }
  46407. // A special extend for ajax options
  46408. // that takes "flat" options (not to be deep extended)
  46409. // Fixes #9887
  46410. function ajaxExtend(target, src) {
  46411. var key,
  46412. deep,
  46413. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  46414. for (key in src) {
  46415. if (src[key] !== undefined) {
  46416. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  46417. }
  46418. }
  46419. if (deep) {
  46420. jQuery.extend(true, target, deep);
  46421. }
  46422. return target;
  46423. }
  46424. /* Handles responses to an ajax request:
  46425. * - finds the right dataType (mediates between content-type and expected dataType)
  46426. * - returns the corresponding response
  46427. */
  46428. function ajaxHandleResponses(s, jqXHR, responses) {
  46429. var ct,
  46430. type,
  46431. finalDataType,
  46432. firstDataType,
  46433. contents = s.contents,
  46434. dataTypes = s.dataTypes;
  46435. // Remove auto dataType and get content-type in the process
  46436. while (dataTypes[0] === "*") {
  46437. dataTypes.shift();
  46438. if (ct === undefined) {
  46439. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  46440. }
  46441. }
  46442. // Check if we're dealing with a known content-type
  46443. if (ct) {
  46444. for (type in contents) {
  46445. if (contents[type] && contents[type].test(ct)) {
  46446. dataTypes.unshift(type);
  46447. break;
  46448. }
  46449. }
  46450. }
  46451. // Check to see if we have a response for the expected dataType
  46452. if (dataTypes[0] in responses) {
  46453. finalDataType = dataTypes[0];
  46454. } else {
  46455. // Try convertible dataTypes
  46456. for (type in responses) {
  46457. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  46458. finalDataType = type;
  46459. break;
  46460. }
  46461. if (!firstDataType) {
  46462. firstDataType = type;
  46463. }
  46464. }
  46465. // Or just use first one
  46466. finalDataType = finalDataType || firstDataType;
  46467. }
  46468. // If we found a dataType
  46469. // We add the dataType to the list if needed
  46470. // and return the corresponding response
  46471. if (finalDataType) {
  46472. if (finalDataType !== dataTypes[0]) {
  46473. dataTypes.unshift(finalDataType);
  46474. }
  46475. return responses[finalDataType];
  46476. }
  46477. }
  46478. /* Chain conversions given the request and the original response
  46479. * Also sets the responseXXX fields on the jqXHR instance
  46480. */
  46481. function ajaxConvert(s, response, jqXHR, isSuccess) {
  46482. var conv2,
  46483. current,
  46484. conv,
  46485. tmp,
  46486. prev,
  46487. converters = {},
  46488. // Work with a copy of dataTypes in case we need to modify it for conversion
  46489. dataTypes = s.dataTypes.slice();
  46490. // Create converters map with lowercased keys
  46491. if (dataTypes[1]) {
  46492. for (conv in s.converters) {
  46493. converters[conv.toLowerCase()] = s.converters[conv];
  46494. }
  46495. }
  46496. current = dataTypes.shift();
  46497. // Convert to each sequential dataType
  46498. while (current) {
  46499. if (s.responseFields[current]) {
  46500. jqXHR[s.responseFields[current]] = response;
  46501. }
  46502. // Apply the dataFilter if provided
  46503. if (!prev && isSuccess && s.dataFilter) {
  46504. response = s.dataFilter(response, s.dataType);
  46505. }
  46506. prev = current;
  46507. current = dataTypes.shift();
  46508. if (current) {
  46509. // There's only work to do if current dataType is non-auto
  46510. if (current === "*") {
  46511. current = prev;
  46512. // Convert response if prev dataType is non-auto and differs from current
  46513. } else if (prev !== "*" && prev !== current) {
  46514. // Seek a direct converter
  46515. conv = converters[prev + " " + current] || converters["* " + current];
  46516. // If none found, seek a pair
  46517. if (!conv) {
  46518. for (conv2 in converters) {
  46519. // If conv2 outputs current
  46520. tmp = conv2.split(" ");
  46521. if (tmp[1] === current) {
  46522. // If prev can be converted to accepted input
  46523. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  46524. if (conv) {
  46525. // Condense equivalence converters
  46526. if (conv === true) {
  46527. conv = converters[conv2];
  46528. // Otherwise, insert the intermediate dataType
  46529. } else if (converters[conv2] !== true) {
  46530. current = tmp[0];
  46531. dataTypes.unshift(tmp[1]);
  46532. }
  46533. break;
  46534. }
  46535. }
  46536. }
  46537. }
  46538. // Apply converter (if not an equivalence)
  46539. if (conv !== true) {
  46540. // Unless errors are allowed to bubble, catch and return them
  46541. if (conv && s.throws) {
  46542. response = conv(response);
  46543. } else {
  46544. try {
  46545. response = conv(response);
  46546. } catch (e) {
  46547. return {
  46548. state: "parsererror",
  46549. error: conv ? e : "No conversion from " + prev + " to " + current
  46550. };
  46551. }
  46552. }
  46553. }
  46554. }
  46555. }
  46556. }
  46557. return { state: "success", data: response };
  46558. }
  46559. jQuery.extend({
  46560. // Counter for holding the number of active queries
  46561. active: 0,
  46562. // Last-Modified header cache for next request
  46563. lastModified: {},
  46564. etag: {},
  46565. ajaxSettings: {
  46566. url: location.href,
  46567. type: "GET",
  46568. isLocal: rlocalProtocol.test(location.protocol),
  46569. global: true,
  46570. processData: true,
  46571. async: true,
  46572. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  46573. /*
  46574. timeout: 0,
  46575. data: null,
  46576. dataType: null,
  46577. username: null,
  46578. password: null,
  46579. cache: null,
  46580. throws: false,
  46581. traditional: false,
  46582. headers: {},
  46583. */
  46584. accepts: {
  46585. "*": allTypes,
  46586. text: "text/plain",
  46587. html: "text/html",
  46588. xml: "application/xml, text/xml",
  46589. json: "application/json, text/javascript"
  46590. },
  46591. contents: {
  46592. xml: /\bxml\b/,
  46593. html: /\bhtml/,
  46594. json: /\bjson\b/
  46595. },
  46596. responseFields: {
  46597. xml: "responseXML",
  46598. text: "responseText",
  46599. json: "responseJSON"
  46600. },
  46601. // Data converters
  46602. // Keys separate source (or catchall "*") and destination types with a single space
  46603. converters: {
  46604. // Convert anything to text
  46605. "* text": String,
  46606. // Text to html (true = no transformation)
  46607. "text html": true,
  46608. // Evaluate text as a json expression
  46609. "text json": JSON.parse,
  46610. // Parse text as xml
  46611. "text xml": jQuery.parseXML
  46612. },
  46613. // For options that shouldn't be deep extended:
  46614. // you can add your own custom options here if
  46615. // and when you create one that shouldn't be
  46616. // deep extended (see ajaxExtend)
  46617. flatOptions: {
  46618. url: true,
  46619. context: true
  46620. }
  46621. },
  46622. // Creates a full fledged settings object into target
  46623. // with both ajaxSettings and settings fields.
  46624. // If target is omitted, writes into ajaxSettings.
  46625. ajaxSetup: function ajaxSetup(target, settings) {
  46626. return settings ?
  46627. // Building a settings object
  46628. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  46629. // Extending ajaxSettings
  46630. ajaxExtend(jQuery.ajaxSettings, target);
  46631. },
  46632. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  46633. ajaxTransport: addToPrefiltersOrTransports(transports),
  46634. // Main method
  46635. ajax: function ajax(url, options) {
  46636. // If url is an object, simulate pre-1.5 signature
  46637. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  46638. options = url;
  46639. url = undefined;
  46640. }
  46641. // Force options to be an object
  46642. options = options || {};
  46643. var transport,
  46644. // URL without anti-cache param
  46645. cacheURL,
  46646. // Response headers
  46647. responseHeadersString,
  46648. responseHeaders,
  46649. // timeout handle
  46650. timeoutTimer,
  46651. // Url cleanup var
  46652. urlAnchor,
  46653. // Request state (becomes false upon send and true upon completion)
  46654. completed,
  46655. // To know if global events are to be dispatched
  46656. fireGlobals,
  46657. // Loop variable
  46658. i,
  46659. // uncached part of the url
  46660. uncached,
  46661. // Create the final options object
  46662. s = jQuery.ajaxSetup({}, options),
  46663. // Callbacks context
  46664. callbackContext = s.context || s,
  46665. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  46666. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  46667. // Deferreds
  46668. deferred = jQuery.Deferred(),
  46669. completeDeferred = jQuery.Callbacks("once memory"),
  46670. // Status-dependent callbacks
  46671. _statusCode = s.statusCode || {},
  46672. // Headers (they are sent all at once)
  46673. requestHeaders = {},
  46674. requestHeadersNames = {},
  46675. // Default abort message
  46676. strAbort = "canceled",
  46677. // Fake xhr
  46678. jqXHR = {
  46679. readyState: 0,
  46680. // Builds headers hashtable if needed
  46681. getResponseHeader: function getResponseHeader(key) {
  46682. var match;
  46683. if (completed) {
  46684. if (!responseHeaders) {
  46685. responseHeaders = {};
  46686. while (match = rheaders.exec(responseHeadersString)) {
  46687. responseHeaders[match[1].toLowerCase()] = match[2];
  46688. }
  46689. }
  46690. match = responseHeaders[key.toLowerCase()];
  46691. }
  46692. return match == null ? null : match;
  46693. },
  46694. // Raw string
  46695. getAllResponseHeaders: function getAllResponseHeaders() {
  46696. return completed ? responseHeadersString : null;
  46697. },
  46698. // Caches the header
  46699. setRequestHeader: function setRequestHeader(name, value) {
  46700. if (completed == null) {
  46701. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  46702. requestHeaders[name] = value;
  46703. }
  46704. return this;
  46705. },
  46706. // Overrides response content-type header
  46707. overrideMimeType: function overrideMimeType(type) {
  46708. if (completed == null) {
  46709. s.mimeType = type;
  46710. }
  46711. return this;
  46712. },
  46713. // Status-dependent callbacks
  46714. statusCode: function statusCode(map) {
  46715. var code;
  46716. if (map) {
  46717. if (completed) {
  46718. // Execute the appropriate callbacks
  46719. jqXHR.always(map[jqXHR.status]);
  46720. } else {
  46721. // Lazy-add the new callbacks in a way that preserves old ones
  46722. for (code in map) {
  46723. _statusCode[code] = [_statusCode[code], map[code]];
  46724. }
  46725. }
  46726. }
  46727. return this;
  46728. },
  46729. // Cancel the request
  46730. abort: function abort(statusText) {
  46731. var finalText = statusText || strAbort;
  46732. if (transport) {
  46733. transport.abort(finalText);
  46734. }
  46735. done(0, finalText);
  46736. return this;
  46737. }
  46738. };
  46739. // Attach deferreds
  46740. deferred.promise(jqXHR);
  46741. // Add protocol if not provided (prefilters might expect it)
  46742. // Handle falsy url in the settings object (#10093: consistency with old signature)
  46743. // We also use the url parameter if available
  46744. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  46745. // Alias method option to type as per ticket #12004
  46746. s.type = options.method || options.type || s.method || s.type;
  46747. // Extract dataTypes list
  46748. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  46749. // A cross-domain request is in order when the origin doesn't match the current origin.
  46750. if (s.crossDomain == null) {
  46751. urlAnchor = document.createElement("a");
  46752. // Support: IE <=8 - 11, Edge 12 - 15
  46753. // IE throws exception on accessing the href property if url is malformed,
  46754. // e.g. http://example.com:80x/
  46755. try {
  46756. urlAnchor.href = s.url;
  46757. // Support: IE <=8 - 11 only
  46758. // Anchor's host property isn't correctly set when s.url is relative
  46759. urlAnchor.href = urlAnchor.href;
  46760. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  46761. } catch (e) {
  46762. // If there is an error parsing the URL, assume it is crossDomain,
  46763. // it can be rejected by the transport if it is invalid
  46764. s.crossDomain = true;
  46765. }
  46766. }
  46767. // Convert data if not already a string
  46768. if (s.data && s.processData && typeof s.data !== "string") {
  46769. s.data = jQuery.param(s.data, s.traditional);
  46770. }
  46771. // Apply prefilters
  46772. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  46773. // If request was aborted inside a prefilter, stop there
  46774. if (completed) {
  46775. return jqXHR;
  46776. }
  46777. // We can fire global events as of now if asked to
  46778. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  46779. fireGlobals = jQuery.event && s.global;
  46780. // Watch for a new set of requests
  46781. if (fireGlobals && jQuery.active++ === 0) {
  46782. jQuery.event.trigger("ajaxStart");
  46783. }
  46784. // Uppercase the type
  46785. s.type = s.type.toUpperCase();
  46786. // Determine if request has content
  46787. s.hasContent = !rnoContent.test(s.type);
  46788. // Save the URL in case we're toying with the If-Modified-Since
  46789. // and/or If-None-Match header later on
  46790. // Remove hash to simplify url manipulation
  46791. cacheURL = s.url.replace(rhash, "");
  46792. // More options handling for requests with no content
  46793. if (!s.hasContent) {
  46794. // Remember the hash so we can put it back
  46795. uncached = s.url.slice(cacheURL.length);
  46796. // If data is available and should be processed, append data to url
  46797. if (s.data && (s.processData || typeof s.data === "string")) {
  46798. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  46799. // #9682: remove data so that it's not used in an eventual retry
  46800. delete s.data;
  46801. }
  46802. // Add or update anti-cache param if needed
  46803. if (s.cache === false) {
  46804. cacheURL = cacheURL.replace(rantiCache, "$1");
  46805. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  46806. }
  46807. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  46808. s.url = cacheURL + uncached;
  46809. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  46810. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  46811. s.data = s.data.replace(r20, "+");
  46812. }
  46813. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  46814. if (s.ifModified) {
  46815. if (jQuery.lastModified[cacheURL]) {
  46816. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  46817. }
  46818. if (jQuery.etag[cacheURL]) {
  46819. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  46820. }
  46821. }
  46822. // Set the correct header, if data is being sent
  46823. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  46824. jqXHR.setRequestHeader("Content-Type", s.contentType);
  46825. }
  46826. // Set the Accepts header for the server, depending on the dataType
  46827. jqXHR.setRequestHeader("Accept", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]);
  46828. // Check for headers option
  46829. for (i in s.headers) {
  46830. jqXHR.setRequestHeader(i, s.headers[i]);
  46831. }
  46832. // Allow custom headers/mimetypes and early abort
  46833. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  46834. // Abort if not done already and return
  46835. return jqXHR.abort();
  46836. }
  46837. // Aborting is no longer a cancellation
  46838. strAbort = "abort";
  46839. // Install callbacks on deferreds
  46840. completeDeferred.add(s.complete);
  46841. jqXHR.done(s.success);
  46842. jqXHR.fail(s.error);
  46843. // Get transport
  46844. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  46845. // If no transport, we auto-abort
  46846. if (!transport) {
  46847. done(-1, "No Transport");
  46848. } else {
  46849. jqXHR.readyState = 1;
  46850. // Send global event
  46851. if (fireGlobals) {
  46852. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  46853. }
  46854. // If request was aborted inside ajaxSend, stop there
  46855. if (completed) {
  46856. return jqXHR;
  46857. }
  46858. // Timeout
  46859. if (s.async && s.timeout > 0) {
  46860. timeoutTimer = window.setTimeout(function () {
  46861. jqXHR.abort("timeout");
  46862. }, s.timeout);
  46863. }
  46864. try {
  46865. completed = false;
  46866. transport.send(requestHeaders, done);
  46867. } catch (e) {
  46868. // Rethrow post-completion exceptions
  46869. if (completed) {
  46870. throw e;
  46871. }
  46872. // Propagate others as results
  46873. done(-1, e);
  46874. }
  46875. }
  46876. // Callback for when everything is done
  46877. function done(status, nativeStatusText, responses, headers) {
  46878. var isSuccess,
  46879. success,
  46880. error,
  46881. response,
  46882. modified,
  46883. statusText = nativeStatusText;
  46884. // Ignore repeat invocations
  46885. if (completed) {
  46886. return;
  46887. }
  46888. completed = true;
  46889. // Clear timeout if it exists
  46890. if (timeoutTimer) {
  46891. window.clearTimeout(timeoutTimer);
  46892. }
  46893. // Dereference transport for early garbage collection
  46894. // (no matter how long the jqXHR object will be used)
  46895. transport = undefined;
  46896. // Cache response headers
  46897. responseHeadersString = headers || "";
  46898. // Set readyState
  46899. jqXHR.readyState = status > 0 ? 4 : 0;
  46900. // Determine if successful
  46901. isSuccess = status >= 200 && status < 300 || status === 304;
  46902. // Get response data
  46903. if (responses) {
  46904. response = ajaxHandleResponses(s, jqXHR, responses);
  46905. }
  46906. // Convert no matter what (that way responseXXX fields are always set)
  46907. response = ajaxConvert(s, response, jqXHR, isSuccess);
  46908. // If successful, handle type chaining
  46909. if (isSuccess) {
  46910. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  46911. if (s.ifModified) {
  46912. modified = jqXHR.getResponseHeader("Last-Modified");
  46913. if (modified) {
  46914. jQuery.lastModified[cacheURL] = modified;
  46915. }
  46916. modified = jqXHR.getResponseHeader("etag");
  46917. if (modified) {
  46918. jQuery.etag[cacheURL] = modified;
  46919. }
  46920. }
  46921. // if no content
  46922. if (status === 204 || s.type === "HEAD") {
  46923. statusText = "nocontent";
  46924. // if not modified
  46925. } else if (status === 304) {
  46926. statusText = "notmodified";
  46927. // If we have data, let's convert it
  46928. } else {
  46929. statusText = response.state;
  46930. success = response.data;
  46931. error = response.error;
  46932. isSuccess = !error;
  46933. }
  46934. } else {
  46935. // Extract error from statusText and normalize for non-aborts
  46936. error = statusText;
  46937. if (status || !statusText) {
  46938. statusText = "error";
  46939. if (status < 0) {
  46940. status = 0;
  46941. }
  46942. }
  46943. }
  46944. // Set data for the fake xhr object
  46945. jqXHR.status = status;
  46946. jqXHR.statusText = (nativeStatusText || statusText) + "";
  46947. // Success/Error
  46948. if (isSuccess) {
  46949. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  46950. } else {
  46951. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  46952. }
  46953. // Status-dependent callbacks
  46954. jqXHR.statusCode(_statusCode);
  46955. _statusCode = undefined;
  46956. if (fireGlobals) {
  46957. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  46958. }
  46959. // Complete
  46960. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  46961. if (fireGlobals) {
  46962. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  46963. // Handle the global AJAX counter
  46964. if (! --jQuery.active) {
  46965. jQuery.event.trigger("ajaxStop");
  46966. }
  46967. }
  46968. }
  46969. return jqXHR;
  46970. },
  46971. getJSON: function getJSON(url, data, callback) {
  46972. return jQuery.get(url, data, callback, "json");
  46973. },
  46974. getScript: function getScript(url, callback) {
  46975. return jQuery.get(url, undefined, callback, "script");
  46976. }
  46977. });
  46978. jQuery.each(["get", "post"], function (i, method) {
  46979. jQuery[method] = function (url, data, callback, type) {
  46980. // Shift arguments if data argument was omitted
  46981. if (isFunction(data)) {
  46982. type = type || callback;
  46983. callback = data;
  46984. data = undefined;
  46985. }
  46986. // The url can be an options object (which then must have .url)
  46987. return jQuery.ajax(jQuery.extend({
  46988. url: url,
  46989. type: method,
  46990. dataType: type,
  46991. data: data,
  46992. success: callback
  46993. }, jQuery.isPlainObject(url) && url));
  46994. };
  46995. });
  46996. jQuery._evalUrl = function (url) {
  46997. return jQuery.ajax({
  46998. url: url,
  46999. // Make this explicit, since user can override this through ajaxSetup (#11264)
  47000. type: "GET",
  47001. dataType: "script",
  47002. cache: true,
  47003. async: false,
  47004. global: false,
  47005. "throws": true
  47006. });
  47007. };
  47008. jQuery.fn.extend({
  47009. wrapAll: function wrapAll(html) {
  47010. var wrap;
  47011. if (this[0]) {
  47012. if (isFunction(html)) {
  47013. html = html.call(this[0]);
  47014. }
  47015. // The elements to wrap the target around
  47016. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  47017. if (this[0].parentNode) {
  47018. wrap.insertBefore(this[0]);
  47019. }
  47020. wrap.map(function () {
  47021. var elem = this;
  47022. while (elem.firstElementChild) {
  47023. elem = elem.firstElementChild;
  47024. }
  47025. return elem;
  47026. }).append(this);
  47027. }
  47028. return this;
  47029. },
  47030. wrapInner: function wrapInner(html) {
  47031. if (isFunction(html)) {
  47032. return this.each(function (i) {
  47033. jQuery(this).wrapInner(html.call(this, i));
  47034. });
  47035. }
  47036. return this.each(function () {
  47037. var self = jQuery(this),
  47038. contents = self.contents();
  47039. if (contents.length) {
  47040. contents.wrapAll(html);
  47041. } else {
  47042. self.append(html);
  47043. }
  47044. });
  47045. },
  47046. wrap: function wrap(html) {
  47047. var htmlIsFunction = isFunction(html);
  47048. return this.each(function (i) {
  47049. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  47050. });
  47051. },
  47052. unwrap: function unwrap(selector) {
  47053. this.parent(selector).not("body").each(function () {
  47054. jQuery(this).replaceWith(this.childNodes);
  47055. });
  47056. return this;
  47057. }
  47058. });
  47059. jQuery.expr.pseudos.hidden = function (elem) {
  47060. return !jQuery.expr.pseudos.visible(elem);
  47061. };
  47062. jQuery.expr.pseudos.visible = function (elem) {
  47063. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  47064. };
  47065. jQuery.ajaxSettings.xhr = function () {
  47066. try {
  47067. return new window.XMLHttpRequest();
  47068. } catch (e) {}
  47069. };
  47070. var xhrSuccessStatus = {
  47071. // File protocol always yields status code 0, assume 200
  47072. 0: 200,
  47073. // Support: IE <=9 only
  47074. // #1450: sometimes IE returns 1223 when it should be 204
  47075. 1223: 204
  47076. },
  47077. xhrSupported = jQuery.ajaxSettings.xhr();
  47078. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  47079. support.ajax = xhrSupported = !!xhrSupported;
  47080. jQuery.ajaxTransport(function (options) {
  47081. var _callback, errorCallback;
  47082. // Cross domain only allowed if supported through XMLHttpRequest
  47083. if (support.cors || xhrSupported && !options.crossDomain) {
  47084. return {
  47085. send: function send(headers, complete) {
  47086. var i,
  47087. xhr = options.xhr();
  47088. xhr.open(options.type, options.url, options.async, options.username, options.password);
  47089. // Apply custom fields if provided
  47090. if (options.xhrFields) {
  47091. for (i in options.xhrFields) {
  47092. xhr[i] = options.xhrFields[i];
  47093. }
  47094. }
  47095. // Override mime type if needed
  47096. if (options.mimeType && xhr.overrideMimeType) {
  47097. xhr.overrideMimeType(options.mimeType);
  47098. }
  47099. // X-Requested-With header
  47100. // For cross-domain requests, seeing as conditions for a preflight are
  47101. // akin to a jigsaw puzzle, we simply never set it to be sure.
  47102. // (it can always be set on a per-request basis or even using ajaxSetup)
  47103. // For same-domain requests, won't change header if already provided.
  47104. if (!options.crossDomain && !headers["X-Requested-With"]) {
  47105. headers["X-Requested-With"] = "XMLHttpRequest";
  47106. }
  47107. // Set headers
  47108. for (i in headers) {
  47109. xhr.setRequestHeader(i, headers[i]);
  47110. }
  47111. // Callback
  47112. _callback = function callback(type) {
  47113. return function () {
  47114. if (_callback) {
  47115. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  47116. if (type === "abort") {
  47117. xhr.abort();
  47118. } else if (type === "error") {
  47119. // Support: IE <=9 only
  47120. // On a manual native abort, IE9 throws
  47121. // errors on any property access that is not readyState
  47122. if (typeof xhr.status !== "number") {
  47123. complete(0, "error");
  47124. } else {
  47125. complete(
  47126. // File: protocol always yields status 0; see #8605, #14207
  47127. xhr.status, xhr.statusText);
  47128. }
  47129. } else {
  47130. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  47131. // Support: IE <=9 only
  47132. // IE9 has no XHR2 but throws on binary (trac-11426)
  47133. // For XHR2 non-text, let the caller handle it (gh-2498)
  47134. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  47135. }
  47136. }
  47137. };
  47138. };
  47139. // Listen to events
  47140. xhr.onload = _callback();
  47141. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  47142. // Support: IE 9 only
  47143. // Use onreadystatechange to replace onabort
  47144. // to handle uncaught aborts
  47145. if (xhr.onabort !== undefined) {
  47146. xhr.onabort = errorCallback;
  47147. } else {
  47148. xhr.onreadystatechange = function () {
  47149. // Check readyState before timeout as it changes
  47150. if (xhr.readyState === 4) {
  47151. // Allow onerror to be called first,
  47152. // but that will not handle a native abort
  47153. // Also, save errorCallback to a variable
  47154. // as xhr.onerror cannot be accessed
  47155. window.setTimeout(function () {
  47156. if (_callback) {
  47157. errorCallback();
  47158. }
  47159. });
  47160. }
  47161. };
  47162. }
  47163. // Create the abort callback
  47164. _callback = _callback("abort");
  47165. try {
  47166. // Do send the request (this may raise an exception)
  47167. xhr.send(options.hasContent && options.data || null);
  47168. } catch (e) {
  47169. // #14683: Only rethrow if this hasn't been notified as an error yet
  47170. if (_callback) {
  47171. throw e;
  47172. }
  47173. }
  47174. },
  47175. abort: function abort() {
  47176. if (_callback) {
  47177. _callback();
  47178. }
  47179. }
  47180. };
  47181. }
  47182. });
  47183. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  47184. jQuery.ajaxPrefilter(function (s) {
  47185. if (s.crossDomain) {
  47186. s.contents.script = false;
  47187. }
  47188. });
  47189. // Install script dataType
  47190. jQuery.ajaxSetup({
  47191. accepts: {
  47192. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  47193. },
  47194. contents: {
  47195. script: /\b(?:java|ecma)script\b/
  47196. },
  47197. converters: {
  47198. "text script": function textScript(text) {
  47199. jQuery.globalEval(text);
  47200. return text;
  47201. }
  47202. }
  47203. });
  47204. // Handle cache's special case and crossDomain
  47205. jQuery.ajaxPrefilter("script", function (s) {
  47206. if (s.cache === undefined) {
  47207. s.cache = false;
  47208. }
  47209. if (s.crossDomain) {
  47210. s.type = "GET";
  47211. }
  47212. });
  47213. // Bind script tag hack transport
  47214. jQuery.ajaxTransport("script", function (s) {
  47215. // This transport only deals with cross domain requests
  47216. if (s.crossDomain) {
  47217. var script, _callback2;
  47218. return {
  47219. send: function send(_, complete) {
  47220. script = jQuery("<script>").prop({
  47221. charset: s.scriptCharset,
  47222. src: s.url
  47223. }).on("load error", _callback2 = function callback(evt) {
  47224. script.remove();
  47225. _callback2 = null;
  47226. if (evt) {
  47227. complete(evt.type === "error" ? 404 : 200, evt.type);
  47228. }
  47229. });
  47230. // Use native DOM manipulation to avoid our domManip AJAX trickery
  47231. document.head.appendChild(script[0]);
  47232. },
  47233. abort: function abort() {
  47234. if (_callback2) {
  47235. _callback2();
  47236. }
  47237. }
  47238. };
  47239. }
  47240. });
  47241. var oldCallbacks = [],
  47242. rjsonp = /(=)\?(?=&|$)|\?\?/;
  47243. // Default jsonp settings
  47244. jQuery.ajaxSetup({
  47245. jsonp: "callback",
  47246. jsonpCallback: function jsonpCallback() {
  47247. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  47248. this[callback] = true;
  47249. return callback;
  47250. }
  47251. });
  47252. // Detect, normalize options and install callbacks for jsonp requests
  47253. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  47254. var callbackName,
  47255. overwritten,
  47256. responseContainer,
  47257. jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");
  47258. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  47259. if (jsonProp || s.dataTypes[0] === "jsonp") {
  47260. // Get callback name, remembering preexisting value associated with it
  47261. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  47262. // Insert callback into url or form data
  47263. if (jsonProp) {
  47264. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  47265. } else if (s.jsonp !== false) {
  47266. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  47267. }
  47268. // Use data converter to retrieve json after script execution
  47269. s.converters["script json"] = function () {
  47270. if (!responseContainer) {
  47271. jQuery.error(callbackName + " was not called");
  47272. }
  47273. return responseContainer[0];
  47274. };
  47275. // Force json dataType
  47276. s.dataTypes[0] = "json";
  47277. // Install callback
  47278. overwritten = window[callbackName];
  47279. window[callbackName] = function () {
  47280. responseContainer = arguments;
  47281. };
  47282. // Clean-up function (fires after converters)
  47283. jqXHR.always(function () {
  47284. // If previous value didn't exist - remove it
  47285. if (overwritten === undefined) {
  47286. jQuery(window).removeProp(callbackName);
  47287. // Otherwise restore preexisting value
  47288. } else {
  47289. window[callbackName] = overwritten;
  47290. }
  47291. // Save back as free
  47292. if (s[callbackName]) {
  47293. // Make sure that re-using the options doesn't screw things around
  47294. s.jsonpCallback = originalSettings.jsonpCallback;
  47295. // Save the callback name for future use
  47296. oldCallbacks.push(callbackName);
  47297. }
  47298. // Call if it was a function and we have a response
  47299. if (responseContainer && isFunction(overwritten)) {
  47300. overwritten(responseContainer[0]);
  47301. }
  47302. responseContainer = overwritten = undefined;
  47303. });
  47304. // Delegate to script
  47305. return "script";
  47306. }
  47307. });
  47308. // Support: Safari 8 only
  47309. // In Safari 8 documents created via document.implementation.createHTMLDocument
  47310. // collapse sibling forms: the second one becomes a child of the first one.
  47311. // Because of that, this security measure has to be disabled in Safari 8.
  47312. // https://bugs.webkit.org/show_bug.cgi?id=137337
  47313. support.createHTMLDocument = function () {
  47314. var body = document.implementation.createHTMLDocument("").body;
  47315. body.innerHTML = "<form></form><form></form>";
  47316. return body.childNodes.length === 2;
  47317. }();
  47318. // Argument "data" should be string of html
  47319. // context (optional): If specified, the fragment will be created in this context,
  47320. // defaults to document
  47321. // keepScripts (optional): If true, will include scripts passed in the html string
  47322. jQuery.parseHTML = function (data, context, keepScripts) {
  47323. if (typeof data !== "string") {
  47324. return [];
  47325. }
  47326. if (typeof context === "boolean") {
  47327. keepScripts = context;
  47328. context = false;
  47329. }
  47330. var base, parsed, scripts;
  47331. if (!context) {
  47332. // Stop scripts or inline event handlers from being executed immediately
  47333. // by using document.implementation
  47334. if (support.createHTMLDocument) {
  47335. context = document.implementation.createHTMLDocument("");
  47336. // Set the base href for the created document
  47337. // so any parsed elements with URLs
  47338. // are based on the document's URL (gh-2965)
  47339. base = context.createElement("base");
  47340. base.href = document.location.href;
  47341. context.head.appendChild(base);
  47342. } else {
  47343. context = document;
  47344. }
  47345. }
  47346. parsed = rsingleTag.exec(data);
  47347. scripts = !keepScripts && [];
  47348. // Single tag
  47349. if (parsed) {
  47350. return [context.createElement(parsed[1])];
  47351. }
  47352. parsed = buildFragment([data], context, scripts);
  47353. if (scripts && scripts.length) {
  47354. jQuery(scripts).remove();
  47355. }
  47356. return jQuery.merge([], parsed.childNodes);
  47357. };
  47358. /**
  47359. * Load a url into a page
  47360. */
  47361. jQuery.fn.load = function (url, params, callback) {
  47362. var selector,
  47363. type,
  47364. response,
  47365. self = this,
  47366. off = url.indexOf(" ");
  47367. if (off > -1) {
  47368. selector = stripAndCollapse(url.slice(off));
  47369. url = url.slice(0, off);
  47370. }
  47371. // If it's a function
  47372. if (isFunction(params)) {
  47373. // We assume that it's the callback
  47374. callback = params;
  47375. params = undefined;
  47376. // Otherwise, build a param string
  47377. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  47378. type = "POST";
  47379. }
  47380. // If we have elements to modify, make the request
  47381. if (self.length > 0) {
  47382. jQuery.ajax({
  47383. url: url,
  47384. // If "type" variable is undefined, then "GET" method will be used.
  47385. // Make value of this field explicit since
  47386. // user can override it through ajaxSetup method
  47387. type: type || "GET",
  47388. dataType: "html",
  47389. data: params
  47390. }).done(function (responseText) {
  47391. // Save response for use in complete callback
  47392. response = arguments;
  47393. self.html(selector ?
  47394. // If a selector was specified, locate the right elements in a dummy div
  47395. // Exclude scripts to avoid IE 'Permission Denied' errors
  47396. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  47397. // Otherwise use the full result
  47398. responseText);
  47399. // If the request succeeds, this function gets "data", "status", "jqXHR"
  47400. // but they are ignored because response was set above.
  47401. // If it fails, this function gets "jqXHR", "status", "error"
  47402. }).always(callback && function (jqXHR, status) {
  47403. self.each(function () {
  47404. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  47405. });
  47406. });
  47407. }
  47408. return this;
  47409. };
  47410. // Attach a bunch of functions for handling common AJAX events
  47411. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  47412. jQuery.fn[type] = function (fn) {
  47413. return this.on(type, fn);
  47414. };
  47415. });
  47416. jQuery.expr.pseudos.animated = function (elem) {
  47417. return jQuery.grep(jQuery.timers, function (fn) {
  47418. return elem === fn.elem;
  47419. }).length;
  47420. };
  47421. jQuery.offset = {
  47422. setOffset: function setOffset(elem, options, i) {
  47423. var curPosition,
  47424. curLeft,
  47425. curCSSTop,
  47426. curTop,
  47427. curOffset,
  47428. curCSSLeft,
  47429. calculatePosition,
  47430. position = jQuery.css(elem, "position"),
  47431. curElem = jQuery(elem),
  47432. props = {};
  47433. // Set position first, in-case top/left are set even on static elem
  47434. if (position === "static") {
  47435. elem.style.position = "relative";
  47436. }
  47437. curOffset = curElem.offset();
  47438. curCSSTop = jQuery.css(elem, "top");
  47439. curCSSLeft = jQuery.css(elem, "left");
  47440. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  47441. // Need to be able to calculate position if either
  47442. // top or left is auto and position is either absolute or fixed
  47443. if (calculatePosition) {
  47444. curPosition = curElem.position();
  47445. curTop = curPosition.top;
  47446. curLeft = curPosition.left;
  47447. } else {
  47448. curTop = parseFloat(curCSSTop) || 0;
  47449. curLeft = parseFloat(curCSSLeft) || 0;
  47450. }
  47451. if (isFunction(options)) {
  47452. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  47453. options = options.call(elem, i, jQuery.extend({}, curOffset));
  47454. }
  47455. if (options.top != null) {
  47456. props.top = options.top - curOffset.top + curTop;
  47457. }
  47458. if (options.left != null) {
  47459. props.left = options.left - curOffset.left + curLeft;
  47460. }
  47461. if ("using" in options) {
  47462. options.using.call(elem, props);
  47463. } else {
  47464. curElem.css(props);
  47465. }
  47466. }
  47467. };
  47468. jQuery.fn.extend({
  47469. // offset() relates an element's border box to the document origin
  47470. offset: function offset(options) {
  47471. // Preserve chaining for setter
  47472. if (arguments.length) {
  47473. return options === undefined ? this : this.each(function (i) {
  47474. jQuery.offset.setOffset(this, options, i);
  47475. });
  47476. }
  47477. var rect,
  47478. win,
  47479. elem = this[0];
  47480. if (!elem) {
  47481. return;
  47482. }
  47483. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  47484. // Support: IE <=11 only
  47485. // Running getBoundingClientRect on a
  47486. // disconnected node in IE throws an error
  47487. if (!elem.getClientRects().length) {
  47488. return { top: 0, left: 0 };
  47489. }
  47490. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  47491. rect = elem.getBoundingClientRect();
  47492. win = elem.ownerDocument.defaultView;
  47493. return {
  47494. top: rect.top + win.pageYOffset,
  47495. left: rect.left + win.pageXOffset
  47496. };
  47497. },
  47498. // position() relates an element's margin box to its offset parent's padding box
  47499. // This corresponds to the behavior of CSS absolute positioning
  47500. position: function position() {
  47501. if (!this[0]) {
  47502. return;
  47503. }
  47504. var offsetParent,
  47505. offset,
  47506. doc,
  47507. elem = this[0],
  47508. parentOffset = { top: 0, left: 0 };
  47509. // position:fixed elements are offset from the viewport, which itself always has zero offset
  47510. if (jQuery.css(elem, "position") === "fixed") {
  47511. // Assume position:fixed implies availability of getBoundingClientRect
  47512. offset = elem.getBoundingClientRect();
  47513. } else {
  47514. offset = this.offset();
  47515. // Account for the *real* offset parent, which can be the document or its root element
  47516. // when a statically positioned element is identified
  47517. doc = elem.ownerDocument;
  47518. offsetParent = elem.offsetParent || doc.documentElement;
  47519. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  47520. offsetParent = offsetParent.parentNode;
  47521. }
  47522. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  47523. // Incorporate borders into its offset, since they are outside its content origin
  47524. parentOffset = jQuery(offsetParent).offset();
  47525. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  47526. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  47527. }
  47528. }
  47529. // Subtract parent offsets and element margins
  47530. return {
  47531. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  47532. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  47533. };
  47534. },
  47535. // This method will return documentElement in the following cases:
  47536. // 1) For the element inside the iframe without offsetParent, this method will return
  47537. // documentElement of the parent window
  47538. // 2) For the hidden or detached element
  47539. // 3) For body or html element, i.e. in case of the html node - it will return itself
  47540. //
  47541. // but those exceptions were never presented as a real life use-cases
  47542. // and might be considered as more preferable results.
  47543. //
  47544. // This logic, however, is not guaranteed and can change at any point in the future
  47545. offsetParent: function offsetParent() {
  47546. return this.map(function () {
  47547. var offsetParent = this.offsetParent;
  47548. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  47549. offsetParent = offsetParent.offsetParent;
  47550. }
  47551. return offsetParent || documentElement;
  47552. });
  47553. }
  47554. });
  47555. // Create scrollLeft and scrollTop methods
  47556. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  47557. var top = "pageYOffset" === prop;
  47558. jQuery.fn[method] = function (val) {
  47559. return access(this, function (elem, method, val) {
  47560. // Coalesce documents and windows
  47561. var win;
  47562. if (isWindow(elem)) {
  47563. win = elem;
  47564. } else if (elem.nodeType === 9) {
  47565. win = elem.defaultView;
  47566. }
  47567. if (val === undefined) {
  47568. return win ? win[prop] : elem[method];
  47569. }
  47570. if (win) {
  47571. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  47572. } else {
  47573. elem[method] = val;
  47574. }
  47575. }, method, val, arguments.length);
  47576. };
  47577. });
  47578. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  47579. // Add the top/left cssHooks using jQuery.fn.position
  47580. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  47581. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  47582. // getComputedStyle returns percent when specified for top/left/bottom/right;
  47583. // rather than make the css module depend on the offset module, just check for it here
  47584. jQuery.each(["top", "left"], function (i, prop) {
  47585. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  47586. if (computed) {
  47587. computed = curCSS(elem, prop);
  47588. // If curCSS returns percentage, fallback to offset
  47589. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  47590. }
  47591. });
  47592. });
  47593. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  47594. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  47595. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  47596. // Margin is only for outerHeight, outerWidth
  47597. jQuery.fn[funcName] = function (margin, value) {
  47598. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  47599. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  47600. return access(this, function (elem, type, value) {
  47601. var doc;
  47602. if (isWindow(elem)) {
  47603. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  47604. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  47605. }
  47606. // Get document width or height
  47607. if (elem.nodeType === 9) {
  47608. doc = elem.documentElement;
  47609. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  47610. // whichever is greatest
  47611. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  47612. }
  47613. return value === undefined ?
  47614. // Get width or height on the element, requesting but not forcing parseFloat
  47615. jQuery.css(elem, type, extra) :
  47616. // Set width or height on the element
  47617. jQuery.style(elem, type, value, extra);
  47618. }, type, chainable ? margin : undefined, chainable);
  47619. };
  47620. });
  47621. });
  47622. jQuery.each(("blur focus focusin focusout resize scroll click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup contextmenu").split(" "), function (i, name) {
  47623. // Handle event binding
  47624. jQuery.fn[name] = function (data, fn) {
  47625. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  47626. };
  47627. });
  47628. jQuery.fn.extend({
  47629. hover: function hover(fnOver, fnOut) {
  47630. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  47631. }
  47632. });
  47633. jQuery.fn.extend({
  47634. bind: function bind(types, data, fn) {
  47635. return this.on(types, null, data, fn);
  47636. },
  47637. unbind: function unbind(types, fn) {
  47638. return this.off(types, null, fn);
  47639. },
  47640. delegate: function delegate(selector, types, data, fn) {
  47641. return this.on(types, selector, data, fn);
  47642. },
  47643. undelegate: function undelegate(selector, types, fn) {
  47644. // ( namespace ) or ( selector, types [, fn] )
  47645. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  47646. }
  47647. });
  47648. // Bind a function to a context, optionally partially applying any
  47649. // arguments.
  47650. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  47651. // However, it is not slated for removal any time soon
  47652. jQuery.proxy = function (fn, context) {
  47653. var tmp, args, proxy;
  47654. if (typeof context === "string") {
  47655. tmp = fn[context];
  47656. context = fn;
  47657. fn = tmp;
  47658. }
  47659. // Quick check to determine if target is callable, in the spec
  47660. // this throws a TypeError, but we will just return undefined.
  47661. if (!isFunction(fn)) {
  47662. return undefined;
  47663. }
  47664. // Simulated bind
  47665. args = _slice.call(arguments, 2);
  47666. proxy = function proxy() {
  47667. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  47668. };
  47669. // Set the guid of unique handler to the same of original handler, so it can be removed
  47670. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  47671. return proxy;
  47672. };
  47673. jQuery.holdReady = function (hold) {
  47674. if (hold) {
  47675. jQuery.readyWait++;
  47676. } else {
  47677. jQuery.ready(true);
  47678. }
  47679. };
  47680. jQuery.isArray = Array.isArray;
  47681. jQuery.parseJSON = JSON.parse;
  47682. jQuery.nodeName = nodeName;
  47683. jQuery.isFunction = isFunction;
  47684. jQuery.isWindow = isWindow;
  47685. jQuery.camelCase = camelCase;
  47686. jQuery.type = toType;
  47687. jQuery.now = Date.now;
  47688. jQuery.isNumeric = function (obj) {
  47689. // As of jQuery 3.0, isNumeric is limited to
  47690. // strings and numbers (primitives or objects)
  47691. // that can be coerced to finite numbers (gh-2662)
  47692. var type = jQuery.type(obj);
  47693. return (type === "number" || type === "string") &&
  47694. // parseFloat NaNs numeric-cast false positives ("")
  47695. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  47696. // subtraction forces infinities to NaN
  47697. !isNaN(obj - parseFloat(obj));
  47698. };
  47699. // Register as a named AMD module, since jQuery can be concatenated with other
  47700. // files that may use define, but not via a proper concatenation script that
  47701. // understands anonymous AMD modules. A named AMD is safest and most robust
  47702. // way to register. Lowercase jquery is used because AMD module names are
  47703. // derived from file names, and jQuery is normally delivered in a lowercase
  47704. // file name. Do this after creating the global so that if an AMD module wants
  47705. // to call noConflict to hide this version of jQuery, it will work.
  47706. // Note that for maximum portability, libraries that are not jQuery should
  47707. // declare themselves as anonymous modules, and avoid setting a global if an
  47708. // AMD loader is present. jQuery is a special case. For more information, see
  47709. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  47710. if (true) {
  47711. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  47712. return jQuery;
  47713. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  47714. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  47715. }
  47716. var
  47717. // Map over jQuery in case of overwrite
  47718. _jQuery = window.jQuery,
  47719. // Map over the $ in case of overwrite
  47720. _$ = window.$;
  47721. jQuery.noConflict = function (deep) {
  47722. if (window.$ === jQuery) {
  47723. window.$ = _$;
  47724. }
  47725. if (deep && window.jQuery === jQuery) {
  47726. window.jQuery = _jQuery;
  47727. }
  47728. return jQuery;
  47729. };
  47730. // Expose jQuery and $ identifiers, even in AMD
  47731. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  47732. // and CommonJS for browser emulators (#13566)
  47733. if (!noGlobal) {
  47734. window.jQuery = window.$ = jQuery;
  47735. }
  47736. return jQuery;
  47737. });
  47738. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  47739. /***/ }),
  47740. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  47741. /*!********************************************************!*\
  47742. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  47743. \********************************************************/
  47744. /*! no static exports found */
  47745. /***/ (function(module, exports, __webpack_require__) {
  47746. "use strict";
  47747. Object.defineProperty(exports, "__esModule", {
  47748. value: true
  47749. });
  47750. var LanguageService = /** @class */function () {
  47751. function LanguageService(lsKey, defaultLang) {
  47752. if (defaultLang === void 0) {
  47753. defaultLang = 'pt';
  47754. }
  47755. this.lsKey = lsKey;
  47756. this.defaultLang = defaultLang;
  47757. this.listeners = [];
  47758. this.document = document;
  47759. this.setupListener();
  47760. }
  47761. LanguageService.prototype.setupListener = function () {
  47762. var _this = this;
  47763. if (this.document !== null) {
  47764. this.document.addEventListener("storage", function (event) {
  47765. var e = event;
  47766. if (e.key === _this.lsKey) {
  47767. _this.listeners.forEach(function (l) {
  47768. return l();
  47769. });
  47770. }
  47771. });
  47772. }
  47773. };
  47774. LanguageService.prototype.getLang = function () {
  47775. var lang = localStorage.getItem(this.lsKey);
  47776. if (lang === null || lang === undefined) {
  47777. console.warn("Internal Error: User language information has not been set. Returning default...");
  47778. return this.getDefaultLang();
  47779. }
  47780. return lang;
  47781. };
  47782. LanguageService.prototype.getDefaultLang = function () {
  47783. return this.defaultLang;
  47784. };
  47785. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  47786. this.listeners.push(listener);
  47787. };
  47788. return LanguageService;
  47789. }();
  47790. exports.LanguageService = LanguageService;
  47791. /***/ }),
  47792. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  47793. /*!************************************************************!*\
  47794. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  47795. \************************************************************/
  47796. /*! no static exports found */
  47797. /***/ (function(module, exports, __webpack_require__) {
  47798. "use strict";
  47799. Object.defineProperty(exports, "__esModule", {
  47800. value: true
  47801. });
  47802. var LanguageServiceNoLS = /** @class */function () {
  47803. function LanguageServiceNoLS(lang) {
  47804. this.lang = lang;
  47805. this.listeners = [];
  47806. }
  47807. LanguageServiceNoLS.prototype.setupListener = function () {};
  47808. LanguageServiceNoLS.prototype.notifyChange = function () {
  47809. this.listeners.forEach(function (l) {
  47810. return l();
  47811. });
  47812. };
  47813. LanguageServiceNoLS.prototype.setLang = function (lang) {
  47814. this.lang = lang;
  47815. this.notifyChange();
  47816. };
  47817. LanguageServiceNoLS.prototype.getLang = function () {
  47818. return this.lang;
  47819. };
  47820. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  47821. return this.lang;
  47822. };
  47823. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  47824. this.listeners.push(listener);
  47825. };
  47826. return LanguageServiceNoLS;
  47827. }();
  47828. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  47829. /***/ }),
  47830. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  47831. /*!*********************************************************!*\
  47832. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  47833. \*********************************************************/
  47834. /*! no static exports found */
  47835. /***/ (function(module, exports, __webpack_require__) {
  47836. "use strict";
  47837. Object.defineProperty(exports, "__esModule", {
  47838. value: true
  47839. });
  47840. exports.LocalizedStrings = undefined;
  47841. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  47842. var LocalizedStrings = /** @class */function () {
  47843. function LocalizedStrings(service, i18nData, listenToChange) {
  47844. if (listenToChange === void 0) {
  47845. listenToChange = false;
  47846. }
  47847. var _this = this;
  47848. this.service = service;
  47849. this.i18nData = i18nData;
  47850. this.listenToChange = listenToChange;
  47851. this.document = document;
  47852. if (this.listenToChange) {
  47853. service.registerLanguageChangeListener(function () {
  47854. _this.updateTagText();
  47855. });
  47856. }
  47857. }
  47858. LocalizedStrings.prototype.getString = function (id, type) {
  47859. var i18nObj = this.i18nData[this.service.getLang()];
  47860. if (!!!i18nObj) {
  47861. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  47862. i18nObj = this.i18nData[this.service.getDefaultLang()];
  47863. }
  47864. if (!!!i18nObj[type]) {
  47865. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  47866. } else if (!!!i18nObj[type][id]) {
  47867. return "{MISSING_I18N_IDENTIFIER}";
  47868. } else {
  47869. return i18nObj[type][id];
  47870. }
  47871. };
  47872. LocalizedStrings.prototype.getOR = function () {
  47873. return this.getUI('join_or');
  47874. };
  47875. LocalizedStrings.prototype.getError = function (id, context) {
  47876. if (context === void 0) {
  47877. context = [];
  47878. }
  47879. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  47880. return this.processString(text, context);
  47881. };
  47882. LocalizedStrings.prototype.getMessage = function (id, context) {
  47883. if (context === void 0) {
  47884. context = [];
  47885. }
  47886. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  47887. return this.processString(text, context);
  47888. };
  47889. LocalizedStrings.prototype.getUI = function (id, context) {
  47890. if (context === void 0) {
  47891. context = [];
  47892. }
  47893. var text = this.getString(id, _StringTypes.StringTypes.UI);
  47894. return this.processString(text, context);
  47895. };
  47896. LocalizedStrings.prototype.processString = function (text, context) {
  47897. for (var i = 0; i < context.length; i++) {
  47898. var v = context[i];
  47899. text = text.replace('\$' + i, v);
  47900. }
  47901. return text;
  47902. };
  47903. LocalizedStrings.prototype.updateTagText = function (func) {
  47904. var _this = this;
  47905. if (func === void 0) {
  47906. func = null;
  47907. }
  47908. if (this.document !== null) {
  47909. var list = this.document.querySelectorAll("data.i18n");
  47910. list.forEach(function (node) {
  47911. if (func === null) {
  47912. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  47913. } else {
  47914. node.innerHTML = func(node.getAttribute("value"));
  47915. }
  47916. });
  47917. }
  47918. };
  47919. LocalizedStrings.prototype.processTagTex = function (text) {
  47920. if (text === null) {
  47921. return "<Invalid i18n identifier>";
  47922. }
  47923. var opts = text.split(':');
  47924. var type = opts[0].toLowerCase();
  47925. var id = opts[1];
  47926. if (_StringTypes.StringTypes.ERROR === type) {
  47927. return this.getError(id);
  47928. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  47929. return this.getMessage(id);
  47930. } else if (_StringTypes.StringTypes.UI === type) {
  47931. return this.getUI(id);
  47932. } else {
  47933. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  47934. return this.getString(id, type);
  47935. }
  47936. };
  47937. return LocalizedStrings;
  47938. }();
  47939. exports.LocalizedStrings = LocalizedStrings;
  47940. /***/ }),
  47941. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  47942. /*!****************************************************!*\
  47943. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  47944. \****************************************************/
  47945. /*! no static exports found */
  47946. /***/ (function(module, exports, __webpack_require__) {
  47947. "use strict";
  47948. Object.defineProperty(exports, "__esModule", {
  47949. value: true
  47950. });
  47951. var StringTypes = exports.StringTypes = undefined;
  47952. (function (StringTypes) {
  47953. StringTypes["ERROR"] = "error";
  47954. StringTypes["MESSAGE"] = "message";
  47955. StringTypes["UI"] = "ui";
  47956. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  47957. /***/ }),
  47958. /***/ "./node_modules/line-i18n/dist/index.js":
  47959. /*!**********************************************!*\
  47960. !*** ./node_modules/line-i18n/dist/index.js ***!
  47961. \**********************************************/
  47962. /*! no static exports found */
  47963. /***/ (function(module, exports, __webpack_require__) {
  47964. "use strict";
  47965. Object.defineProperty(exports, "__esModule", {
  47966. value: true
  47967. });
  47968. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  47969. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  47970. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  47971. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  47972. exports.default = {
  47973. LanguageService: _LanguageService.LanguageService,
  47974. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  47975. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  47976. StringTypes: _StringTypes.StringTypes
  47977. };
  47978. /***/ }),
  47979. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  47980. /*!***************************************************!*\
  47981. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  47982. \***************************************************/
  47983. /*! no static exports found */
  47984. /***/ (function(module, exports, __webpack_require__) {
  47985. "use strict";
  47986. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  47987. * DEVELOPED BY
  47988. * GIL LOPES BUENO
  47989. * gilbueno.mail@gmail.com
  47990. *
  47991. * WORKS WITH:
  47992. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  47993. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  47994. *
  47995. * FORK:
  47996. * https://github.com/melanke/Watch.JS
  47997. *
  47998. * LICENSE: MIT
  47999. */
  48000. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  48001. (function (factory) {
  48002. if (( false ? undefined : _typeof(exports)) === 'object') {
  48003. // Node. Does not work with strict CommonJS, but
  48004. // only CommonJS-like enviroments that support module.exports,
  48005. // like Node.
  48006. module.exports = factory();
  48007. } else if (true) {
  48008. // AMD. Register as an anonymous module.
  48009. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  48010. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  48011. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  48012. __WEBPACK_AMD_DEFINE_FACTORY__),
  48013. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  48014. } else {}
  48015. })(function () {
  48016. var WatchJS = {
  48017. noMore: false, // use WatchJS.suspend(obj) instead
  48018. useDirtyCheck: false, // use only dirty checking to track changes.
  48019. preserveExistingSetters: false
  48020. },
  48021. lengthsubjects = [];
  48022. var dirtyChecklist = [];
  48023. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  48024. var supportDefineProperty = false;
  48025. try {
  48026. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  48027. } catch (ex) {/* not supported */}
  48028. var isFunction = function isFunction(functionToCheck) {
  48029. var getType = {};
  48030. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  48031. };
  48032. var isInt = function isInt(x) {
  48033. return x % 1 === 0;
  48034. };
  48035. var isArray = function isArray(obj) {
  48036. return Object.prototype.toString.call(obj) === '[object Array]';
  48037. };
  48038. var isObject = function isObject(obj) {
  48039. return {}.toString.apply(obj) === '[object Object]';
  48040. };
  48041. var getObjDiff = function getObjDiff(a, b) {
  48042. var aplus = [],
  48043. bplus = [];
  48044. if (!(typeof a == "string") && !(typeof b == "string")) {
  48045. if (isArray(a) && b) {
  48046. for (var i = 0; i < a.length; i++) {
  48047. if (b[i] === undefined) aplus.push(i);
  48048. }
  48049. } else {
  48050. for (var i in a) {
  48051. if (a.hasOwnProperty(i)) {
  48052. if (b && !b.hasOwnProperty(i)) {
  48053. aplus.push(i);
  48054. }
  48055. }
  48056. }
  48057. }
  48058. if (isArray(b) && a) {
  48059. for (var j = 0; j < b.length; j++) {
  48060. if (a[j] === undefined) bplus.push(j);
  48061. }
  48062. } else {
  48063. for (var j in b) {
  48064. if (b.hasOwnProperty(j)) {
  48065. if (a && !a.hasOwnProperty(j)) {
  48066. bplus.push(j);
  48067. }
  48068. }
  48069. }
  48070. }
  48071. }
  48072. return {
  48073. added: aplus,
  48074. removed: bplus
  48075. };
  48076. };
  48077. var clone = function clone(obj) {
  48078. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  48079. return obj;
  48080. }
  48081. var copy = obj.constructor();
  48082. for (var attr in obj) {
  48083. copy[attr] = obj[attr];
  48084. }
  48085. return copy;
  48086. };
  48087. var getExistingSetter = function getExistingSetter(obj, propName) {
  48088. if (WatchJS.preserveExistingSetters) {
  48089. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  48090. return existing.set;
  48091. }
  48092. return undefined;
  48093. };
  48094. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  48095. try {
  48096. var existingSetter = getExistingSetter(obj, propName);
  48097. Object.defineProperty(obj, propName, {
  48098. get: getter,
  48099. set: function set(value) {
  48100. setter.call(this, value, true); // coalesce changes
  48101. if (existingSetter) {
  48102. existingSetter(value);
  48103. }
  48104. },
  48105. enumerable: true,
  48106. configurable: true
  48107. });
  48108. } catch (e1) {
  48109. try {
  48110. Object.prototype.__defineGetter__.call(obj, propName, getter);
  48111. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  48112. setter.call(this, value, true); // coalesce changes
  48113. });
  48114. } catch (e2) {
  48115. observeDirtyChanges(obj, propName, setter);
  48116. //throw new Error("watchJS error: browser not supported :/")
  48117. }
  48118. }
  48119. };
  48120. var defineProp = function defineProp(obj, propName, value) {
  48121. try {
  48122. Object.defineProperty(obj, propName, {
  48123. enumerable: false,
  48124. configurable: true,
  48125. writable: false,
  48126. value: value
  48127. });
  48128. } catch (error) {
  48129. obj[propName] = value;
  48130. }
  48131. };
  48132. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  48133. dirtyChecklist[dirtyChecklist.length] = {
  48134. prop: propName,
  48135. object: obj,
  48136. orig: clone(obj[propName]),
  48137. callback: setter
  48138. };
  48139. };
  48140. var watch = function watch() {
  48141. if (isFunction(arguments[1])) {
  48142. watchAll.apply(this, arguments);
  48143. } else if (isArray(arguments[1])) {
  48144. watchMany.apply(this, arguments);
  48145. } else {
  48146. watchOne.apply(this, arguments);
  48147. }
  48148. };
  48149. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  48150. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  48151. //accepts only objects and array (not string)
  48152. return;
  48153. }
  48154. if (isArray(obj)) {
  48155. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  48156. if (level === undefined || level > 0) {
  48157. for (var prop = 0; prop < obj.length; prop++) {
  48158. // watch objects in array
  48159. watchAll(obj[prop], watcher, level, addNRemove);
  48160. }
  48161. }
  48162. } else {
  48163. var prop,
  48164. props = [];
  48165. for (prop in obj) {
  48166. //for each attribute if obj is an object
  48167. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  48168. continue;
  48169. }
  48170. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  48171. props.push(prop); //put in the props
  48172. }
  48173. }
  48174. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  48175. }
  48176. if (addNRemove) {
  48177. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  48178. }
  48179. };
  48180. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  48181. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  48182. //accepts only objects and array (not string)
  48183. return;
  48184. }
  48185. for (var i = 0; i < props.length; i++) {
  48186. //watch each property
  48187. var prop = props[i];
  48188. watchOne(obj, prop, watcher, level, addNRemove);
  48189. }
  48190. };
  48191. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  48192. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  48193. //accepts only objects and array (not string)
  48194. return;
  48195. }
  48196. if (isFunction(obj[prop])) {
  48197. //dont watch if it is a function
  48198. return;
  48199. }
  48200. if (obj[prop] != null && (level === undefined || level > 0)) {
  48201. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  48202. }
  48203. defineWatcher(obj, prop, watcher, level);
  48204. if (addNRemove && (level === undefined || level > 0)) {
  48205. pushToLengthSubjects(obj, prop, watcher, level);
  48206. }
  48207. };
  48208. var unwatch = function unwatch() {
  48209. if (isFunction(arguments[1])) {
  48210. unwatchAll.apply(this, arguments);
  48211. } else if (isArray(arguments[1])) {
  48212. unwatchMany.apply(this, arguments);
  48213. } else {
  48214. unwatchOne.apply(this, arguments);
  48215. }
  48216. };
  48217. var unwatchAll = function unwatchAll(obj, watcher) {
  48218. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  48219. //accepts only objects and array (not string)
  48220. return;
  48221. }
  48222. if (isArray(obj)) {
  48223. var props = ['__watchall__'];
  48224. for (var prop = 0; prop < obj.length; prop++) {
  48225. //for each item if obj is an array
  48226. props.push(prop); //put in the props
  48227. }
  48228. unwatchMany(obj, props, watcher); //watch all itens of the props
  48229. } else {
  48230. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  48231. var props = [];
  48232. for (var prop2 in obj2) {
  48233. //for each attribute if obj is an object
  48234. if (obj2.hasOwnProperty(prop2)) {
  48235. if (obj2[prop2] instanceof Object) {
  48236. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  48237. } else {
  48238. props.push(prop2); //put in the props
  48239. }
  48240. }
  48241. }
  48242. unwatchMany(obj2, props, watcher); //unwatch all of the props
  48243. };
  48244. unwatchPropsInObject(obj);
  48245. }
  48246. };
  48247. var unwatchMany = function unwatchMany(obj, props, watcher) {
  48248. for (var prop2 in props) {
  48249. //watch each attribute of "props" if is an object
  48250. if (props.hasOwnProperty(prop2)) {
  48251. unwatchOne(obj, props[prop2], watcher);
  48252. }
  48253. }
  48254. };
  48255. var timeouts = [],
  48256. timerID = null;
  48257. function clearTimerID() {
  48258. timerID = null;
  48259. for (var i = 0; i < timeouts.length; i++) {
  48260. timeouts[i]();
  48261. }
  48262. timeouts.length = 0;
  48263. }
  48264. var getTimerID = function getTimerID() {
  48265. if (!timerID) {
  48266. timerID = setTimeout(clearTimerID);
  48267. }
  48268. return timerID;
  48269. };
  48270. var registerTimeout = function registerTimeout(fn) {
  48271. // register function to be called on timeout
  48272. if (timerID == null) getTimerID();
  48273. timeouts[timeouts.length] = fn;
  48274. };
  48275. // Track changes made to an array, object or an object's property
  48276. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  48277. // Syntax:
  48278. // trackChange(obj, callback, recursive, addNRemove)
  48279. // trackChange(obj, prop, callback, recursive, addNRemove)
  48280. var trackChange = function trackChange() {
  48281. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  48282. fn.apply(this, arguments);
  48283. };
  48284. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  48285. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  48286. var change = null,
  48287. lastTimerID = -1;
  48288. var isArr = isArray(obj);
  48289. var level,
  48290. fn = function fn(prop, action, newValue, oldValue) {
  48291. var timerID = getTimerID();
  48292. if (lastTimerID !== timerID) {
  48293. // check if timer has changed since last update
  48294. lastTimerID = timerID;
  48295. change = {
  48296. type: 'update'
  48297. };
  48298. change['value'] = obj;
  48299. change['splices'] = null;
  48300. registerTimeout(function () {
  48301. callback.call(this, change);
  48302. change = null;
  48303. });
  48304. }
  48305. // create splices for array changes
  48306. if (isArr && obj === this && change !== null) {
  48307. if (action === 'pop' || action === 'shift') {
  48308. newValue = [];
  48309. oldValue = [oldValue];
  48310. } else if (action === 'push' || action === 'unshift') {
  48311. newValue = [newValue];
  48312. oldValue = [];
  48313. } else if (action !== 'splice') {
  48314. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  48315. }
  48316. if (!change.splices) change.splices = [];
  48317. change.splices[change.splices.length] = {
  48318. index: prop,
  48319. deleteCount: oldValue ? oldValue.length : 0,
  48320. addedCount: newValue ? newValue.length : 0,
  48321. added: newValue,
  48322. deleted: oldValue
  48323. };
  48324. }
  48325. };
  48326. level = recursive == true ? undefined : 0;
  48327. watchAll(obj, fn, level, addNRemove);
  48328. };
  48329. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  48330. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  48331. if (obj && prop) {
  48332. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  48333. var change = {
  48334. type: 'update'
  48335. };
  48336. change['value'] = newvalue;
  48337. change['oldvalue'] = oldvalue;
  48338. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  48339. trackObject(newvalue, callback, recursive, addNRemove);
  48340. }
  48341. callback.call(this, change);
  48342. }, 0);
  48343. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  48344. trackObject(obj[prop], callback, recursive, addNRemove);
  48345. }
  48346. }
  48347. };
  48348. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  48349. var newWatcher = false;
  48350. var isArr = isArray(obj);
  48351. if (!obj.watchers) {
  48352. defineProp(obj, "watchers", {});
  48353. if (isArr) {
  48354. // watch array functions
  48355. watchFunctions(obj, function (index, action, newValue, oldValue) {
  48356. addPendingChange(obj, index, action, newValue, oldValue);
  48357. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  48358. var i,
  48359. n,
  48360. ln,
  48361. wAll,
  48362. watchList = obj.watchers[prop];
  48363. if (wAll = obj.watchers['__watchall__']) {
  48364. watchList = watchList ? watchList.concat(wAll) : wAll;
  48365. }
  48366. ln = watchList ? watchList.length : 0;
  48367. for (i = 0; i < ln; i++) {
  48368. if (action !== 'splice') {
  48369. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  48370. } else {
  48371. // watch spliced values
  48372. for (n = 0; n < newValue.length; n++) {
  48373. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  48374. }
  48375. }
  48376. }
  48377. }
  48378. });
  48379. }
  48380. }
  48381. if (!obj.watchers[prop]) {
  48382. obj.watchers[prop] = [];
  48383. if (!isArr) newWatcher = true;
  48384. }
  48385. for (var i = 0; i < obj.watchers[prop].length; i++) {
  48386. if (obj.watchers[prop][i] === watcher) {
  48387. return;
  48388. }
  48389. }
  48390. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  48391. if (newWatcher) {
  48392. var val = obj[prop];
  48393. var getter = function getter() {
  48394. return val;
  48395. };
  48396. var setter = function setter(newval, delayWatcher) {
  48397. var oldval = val;
  48398. val = newval;
  48399. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  48400. // watch sub properties
  48401. var i,
  48402. ln = obj.watchers[prop].length;
  48403. for (i = 0; i < ln; i++) {
  48404. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  48405. }
  48406. }
  48407. //watchFunctions(obj, prop);
  48408. if (isSuspended(obj, prop)) {
  48409. resume(obj, prop);
  48410. return;
  48411. }
  48412. if (!WatchJS.noMore) {
  48413. // this does not work with Object.observe
  48414. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  48415. if (oldval !== newval) {
  48416. if (!delayWatcher) {
  48417. callWatchers(obj, prop, "set", newval, oldval);
  48418. } else {
  48419. addPendingChange(obj, prop, "set", newval, oldval);
  48420. }
  48421. WatchJS.noMore = false;
  48422. }
  48423. }
  48424. };
  48425. if (WatchJS.useDirtyCheck) {
  48426. observeDirtyChanges(obj, prop, setter);
  48427. } else {
  48428. defineGetAndSet(obj, prop, getter, setter);
  48429. }
  48430. }
  48431. };
  48432. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  48433. if (prop !== undefined) {
  48434. var ln,
  48435. wl,
  48436. watchList = obj.watchers[prop];
  48437. if (wl = obj.watchers['__watchall__']) {
  48438. watchList = watchList ? watchList.concat(wl) : wl;
  48439. }
  48440. ln = watchList ? watchList.length : 0;
  48441. for (var wr = 0; wr < ln; wr++) {
  48442. watchList[wr].call(obj, prop, action, newval, oldval);
  48443. }
  48444. } else {
  48445. for (var prop in obj) {
  48446. //call all
  48447. if (obj.hasOwnProperty(prop)) {
  48448. callWatchers(obj, prop, action, newval, oldval);
  48449. }
  48450. }
  48451. }
  48452. };
  48453. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  48454. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  48455. defineProp(obj, methodName, function () {
  48456. var index = 0;
  48457. var i, newValue, oldValue, response;
  48458. // get values before splicing array
  48459. if (methodName === 'splice') {
  48460. var start = arguments[0];
  48461. var end = start + arguments[1];
  48462. oldValue = obj.slice(start, end);
  48463. newValue = [];
  48464. for (i = 2; i < arguments.length; i++) {
  48465. newValue[i - 2] = arguments[i];
  48466. }
  48467. index = start;
  48468. } else {
  48469. newValue = arguments.length > 0 ? arguments[0] : undefined;
  48470. }
  48471. response = original.apply(obj, arguments);
  48472. if (methodName !== 'slice') {
  48473. if (methodName === 'pop') {
  48474. oldValue = response;
  48475. index = obj.length;
  48476. } else if (methodName === 'push') {
  48477. index = obj.length - 1;
  48478. } else if (methodName === 'shift') {
  48479. oldValue = response;
  48480. } else if (methodName !== 'unshift' && newValue === undefined) {
  48481. newValue = response;
  48482. }
  48483. callback.call(obj, index, methodName, newValue, oldValue);
  48484. }
  48485. return response;
  48486. });
  48487. };
  48488. var watchFunctions = function watchFunctions(obj, callback) {
  48489. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  48490. return;
  48491. }
  48492. for (var i = methodNames.length, methodName; i--;) {
  48493. methodName = methodNames[i];
  48494. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  48495. }
  48496. };
  48497. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  48498. if (prop) {
  48499. if (obj.watchers && obj.watchers[prop]) {
  48500. if (watcher === undefined) {
  48501. delete obj.watchers[prop]; // remove all property watchers
  48502. } else {
  48503. for (var i = 0; i < obj.watchers[prop].length; i++) {
  48504. var w = obj.watchers[prop][i];
  48505. if (w == watcher) {
  48506. obj.watchers[prop].splice(i, 1);
  48507. }
  48508. }
  48509. }
  48510. }
  48511. } else {
  48512. delete obj.watchers;
  48513. }
  48514. removeFromLengthSubjects(obj, prop, watcher);
  48515. removeFromDirtyChecklist(obj, prop);
  48516. };
  48517. // suspend watchers until next update cycle
  48518. var suspend = function suspend(obj, prop) {
  48519. if (obj.watchers) {
  48520. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  48521. obj.watchers[name] = true;
  48522. }
  48523. };
  48524. var isSuspended = function isSuspended(obj, prop) {
  48525. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  48526. };
  48527. // resumes preivously suspended watchers
  48528. var resume = function resume(obj, prop) {
  48529. registerTimeout(function () {
  48530. delete obj.watchers['__wjs_suspend__'];
  48531. delete obj.watchers['__wjs_suspend__' + prop];
  48532. });
  48533. };
  48534. var pendingTimerID = null;
  48535. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  48536. pendingChanges[pendingChanges.length] = {
  48537. obj: obj,
  48538. prop: prop,
  48539. mode: mode,
  48540. newval: newval,
  48541. oldval: oldval
  48542. };
  48543. if (pendingTimerID === null) {
  48544. pendingTimerID = setTimeout(applyPendingChanges);
  48545. }
  48546. };
  48547. var applyPendingChanges = function applyPendingChanges() {
  48548. // apply pending changes
  48549. var change = null;
  48550. pendingTimerID = null;
  48551. for (var i = 0; i < pendingChanges.length; i++) {
  48552. change = pendingChanges[i];
  48553. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  48554. }
  48555. if (change) {
  48556. pendingChanges = [];
  48557. change = null;
  48558. }
  48559. };
  48560. var loop = function loop() {
  48561. // check for new or deleted props
  48562. for (var i = 0; i < lengthsubjects.length; i++) {
  48563. var subj = lengthsubjects[i];
  48564. if (subj.prop === "$$watchlengthsubjectroot") {
  48565. var difference = getObjDiff(subj.obj, subj.actual);
  48566. if (difference.added.length || difference.removed.length) {
  48567. if (difference.added.length) {
  48568. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  48569. }
  48570. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  48571. }
  48572. subj.actual = clone(subj.obj);
  48573. } else {
  48574. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  48575. if (difference.added.length || difference.removed.length) {
  48576. if (difference.added.length) {
  48577. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  48578. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  48579. }
  48580. }
  48581. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  48582. }
  48583. subj.actual = clone(subj.obj[subj.prop]);
  48584. }
  48585. }
  48586. // start dirty check
  48587. var n, value;
  48588. if (dirtyChecklist.length > 0) {
  48589. for (var i = 0; i < dirtyChecklist.length; i++) {
  48590. n = dirtyChecklist[i];
  48591. value = n.object[n.prop];
  48592. if (!compareValues(n.orig, value)) {
  48593. n.orig = clone(value);
  48594. n.callback(value);
  48595. }
  48596. }
  48597. }
  48598. };
  48599. var compareValues = function compareValues(a, b) {
  48600. var i,
  48601. state = true;
  48602. if (a !== b) {
  48603. if (isObject(a)) {
  48604. for (i in a) {
  48605. if (!supportDefineProperty && i === 'watchers') continue;
  48606. if (a[i] !== b[i]) {
  48607. state = false;
  48608. break;
  48609. };
  48610. }
  48611. } else {
  48612. state = false;
  48613. }
  48614. }
  48615. return state;
  48616. };
  48617. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  48618. var actual;
  48619. if (prop === "$$watchlengthsubjectroot") {
  48620. actual = clone(obj);
  48621. } else {
  48622. actual = clone(obj[prop]);
  48623. }
  48624. lengthsubjects.push({
  48625. obj: obj,
  48626. prop: prop,
  48627. actual: actual,
  48628. watcher: watcher,
  48629. level: level
  48630. });
  48631. };
  48632. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  48633. for (var i = 0; i < lengthsubjects.length; i++) {
  48634. var subj = lengthsubjects[i];
  48635. if (subj.obj == obj) {
  48636. if (!prop || subj.prop == prop) {
  48637. if (!watcher || subj.watcher == watcher) {
  48638. // if we splice off one item at position i
  48639. // we need to decrement i as the array is one item shorter
  48640. // so when we increment i in the loop statement we
  48641. // will land at the correct index.
  48642. // if it's not decremented, you won't delete all length subjects
  48643. lengthsubjects.splice(i--, 1);
  48644. }
  48645. }
  48646. }
  48647. }
  48648. };
  48649. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  48650. var notInUse;
  48651. for (var i = 0; i < dirtyChecklist.length; i++) {
  48652. var n = dirtyChecklist[i];
  48653. var watchers = n.object.watchers;
  48654. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  48655. if (notInUse) {
  48656. // we use the same syntax as in removeFromLengthSubjects
  48657. dirtyChecklist.splice(i--, 1);
  48658. }
  48659. }
  48660. };
  48661. setInterval(loop, 50);
  48662. WatchJS.watch = watch;
  48663. WatchJS.unwatch = unwatch;
  48664. WatchJS.callWatchers = callWatchers;
  48665. WatchJS.suspend = suspend; // suspend watchers
  48666. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  48667. return WatchJS;
  48668. });
  48669. /***/ }),
  48670. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  48671. /*!******************************************************!*\
  48672. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  48673. \******************************************************/
  48674. /*! no static exports found */
  48675. /***/ (function(module, exports, __webpack_require__) {
  48676. "use strict";
  48677. /***/ }),
  48678. /***/ "./node_modules/webpack/buildin/module.js":
  48679. /*!***********************************!*\
  48680. !*** (webpack)/buildin/module.js ***!
  48681. \***********************************/
  48682. /*! no static exports found */
  48683. /***/ (function(module, exports, __webpack_require__) {
  48684. "use strict";
  48685. module.exports = function (module) {
  48686. if (!module.webpackPolyfill) {
  48687. module.deprecate = function () {};
  48688. module.paths = [];
  48689. // module.parent = undefined by default
  48690. if (!module.children) module.children = [];
  48691. Object.defineProperty(module, "loaded", {
  48692. enumerable: true,
  48693. get: function get() {
  48694. return module.l;
  48695. }
  48696. });
  48697. Object.defineProperty(module, "id", {
  48698. enumerable: true,
  48699. get: function get() {
  48700. return module.i;
  48701. }
  48702. });
  48703. module.webpackPolyfill = 1;
  48704. }
  48705. return module;
  48706. };
  48707. /***/ })
  48708. /******/ });
  48709. //# sourceMappingURL=ivprog.bundle.js.map